Bluetooth broadcast method, device and computer equipment
By generating a unique broadcast name based on identification information, the connection error problem caused by multiple Bluetooth devices sharing the same default broadcast name is solved, and the accurate identification and connection of the device is achieved.
Patent Information
- Application Number
- CN202211453028.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-11-21
- Publication Date
- 2024-12-20
- Estimated Expiration
- 2042-11-21
AI Technical Summary
When multiple Bluetooth devices exist at the same time, the same default broadcast name causes the device connection error and the target device cannot be accurately found.
By obtaining the identification information of the electronic device (such as the MAC address or serial number), it is determined whether it matches the setting identification information. If the matching is made, a specific broadcast name will be generated, otherwise the default broadcast name will be generated and broadcast to the outside world through Bluetooth.
Ensure that each Bluetooth device has a unique broadcast name, avoid connection errors, and improve the accurate connection capability of the device in the simultaneous application scenarios of multiple devices.
Smart Images

Figure CN115776648B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of electronic technology, and in particular to a Bluetooth broadcasting method, device and computer equipment. Background Art
[0002] Bluetooth devices broadcast Bluetooth broadcast names to facilitate other Bluetooth devices to connect to them. When other Bluetooth devices establish Bluetooth connections with them, they mainly use the corresponding Bluetooth broadcast names to establish Bluetooth connections with them. When there are multiple Bluetooth devices around, multiple Bluetooth devices will broadcast the default broadcast name, which is usually the same broadcast name. In this way, during the Bluetooth device testing phase or when multiple Bluetooth devices are used at the same time, other Bluetooth devices will search for multiple Bluetooth broadcast names with the same name when searching for Bluetooth devices. In this way, they cannot accurately find the Bluetooth device to be connected, resulting in Bluetooth device connection errors and other problems. Summary of the invention
[0003] The present invention aims to solve one of the technical problems in the related art at least to a certain extent. To this end, one object of the present invention is to provide a Bluetooth broadcast method, device and computer equipment.
[0004] On the one hand, in order to achieve the above object, according to the Bluetooth broadcast method of an embodiment of the present invention, the Bluetooth broadcast method comprises the steps of:
[0005] Obtaining identification information of the electronic device;
[0006] Determining whether the identification information matches the set identification information;
[0007] If the identification information matches the set identification information, generating a broadcast name corresponding to the set identification information;
[0008] Otherwise, a default broadcast name is generated;
[0009] The generated broadcast name will be broadcasted externally via Bluetooth.
[0010] Further, according to an embodiment of the present invention, the identification information is a MAC address or a serial number.
[0011] Further, according to an embodiment of the present invention, the method for determining whether the identification information matches the set identification information includes:
[0012] Compare the MAC address or serial number of the electronic device with data within a set range;
[0013] Determine whether the MAC address or serial number of the electronic device falls within a set range of the data, and if so, determine that the identification information matches the set identification information;
[0014] Otherwise, it is determined that the identification information does not match the set identification information.
[0015] Further, according to an embodiment of the present invention, the method for generating a broadcast name corresponding to the set identification information comprises the steps of:
[0016] Calculate the sorting position of the MAC address or serial number in the data within the set range;
[0017] A broadcast name corresponding to the sorting position is generated.
[0018] Further, according to an embodiment of the present invention, the Bluetooth broadcast method further includes:
[0019] It is determined whether the electronic device has stored a set broadcast name. If the set broadcast name is stored, the set broadcast name is broadcasted externally via Bluetooth.
[0020] On the other hand, the present invention also provides a Bluetooth broadcasting device, comprising:
[0021] An identification information acquisition module, the identification information acquisition module is used to acquire identification information of the electronic device;
[0022] An information matching judgment module, the information matching judgment module is used to judge whether the identification information matches the set identification information;
[0023] a broadcast name generating module, the broadcast name generating module being used for generating a broadcast name corresponding to the set identification information if the identification information matches the set identification information;
[0024] A default broadcast name generating module, wherein the default broadcast name generating module is used to generate a default broadcast name when the identification information does not match the set identification information;
[0025] The Bluetooth broadcast module is used to broadcast the generated broadcast name externally via Bluetooth.
[0026] Further, according to an embodiment of the present invention, the information matching judgment module includes:
[0027] A data comparison module, the data comparison module is used to compare the MAC address or serial number of the electronic device with data within a set range;
[0028] A data judgment module is used to judge whether the MAC address or serial number of the electronic device falls within the set range of the data. If so, it is judged that the identification information matches the set identification information; otherwise, it is judged that the identification information does not match the set identification information.
[0029] Further, according to an embodiment of the present invention, the broadcast name generating module includes:
[0030] A sorting position calculation module, the sorting position calculation module is used to calculate the sorting position of the MAC address or serial number in the data within the set range;
[0031] A sorting broadcast name generating module is used to generate a broadcast name corresponding to the sorting position.
[0032] Further, according to an embodiment of the present invention, the Bluetooth broadcasting device further includes:
[0033] The broadcast name setting module is used to determine whether the electronic device has stored a set broadcast name. If the set broadcast name has been stored, the set broadcast name is broadcasted externally via Bluetooth.
[0034] On the other hand, an embodiment of the present invention further provides a computer device, comprising a first memory, a first processor, and a computer program stored in the first memory and executable on the first processor, wherein the first processor implements the above-mentioned Bluetooth broadcast method when executing the computer program.
[0035] The embodiments of the present invention provide a Bluetooth broadcast method, apparatus and computer equipment, wherein S101 is used to obtain identification information of an electronic device. S102 is used to determine whether the identification information matches the set identification information. S103 is used to generate a broadcast name corresponding to the set identification information if the identification information matches the set identification information. S104 is used to generate a default broadcast name otherwise. S105 is used to broadcast the generated broadcast name to the outside via Bluetooth. In this way, each keyboard can generate a different Bluetooth broadcast name by burning the Mac address of the device through a burning tool, so that each keyboard has a corresponding broadcast name. When multiple Bluetooth devices broadcast at the same time, other Bluetooth devices can accurately find the device to be connected through different Bluetooth broadcast names. BRIEF DESCRIPTION OF THE DRAWINGS
[0036] Figure 1 A flow chart of a Bluetooth broadcast method provided by an embodiment of the present invention;
[0037] Figure 2 A flow chart of a method for determining whether the identification information matches the set identification information provided by an embodiment of the present invention;
[0038] Figure 3 A flow chart of a method for generating a broadcast name corresponding to the set identification information provided by an embodiment of the present invention;
[0039] Figure 4A flow chart of another Bluetooth broadcast method provided by an embodiment of the present invention;
[0040] Figure 5 A flow chart of another Bluetooth broadcast method provided by an embodiment of the present invention;
[0041] Figure 6 A structural block diagram of a Bluetooth broadcast device provided by an embodiment of the present invention;
[0042] Figure 7 A structural block diagram of an information matching judgment module provided in an embodiment of the present invention;
[0043] Figure 8 A structural block diagram of a broadcast name generation module provided in an embodiment of the present invention;
[0044] Fig. 9 A structural block diagram of another Bluetooth broadcasting device provided by an embodiment of the present invention;
[0045] Fig.10 A structural block diagram of a computer device provided in an embodiment of the present invention.
[0046] The realization of the purpose, functional features and advantages of the present invention will be further explained in conjunction with embodiments and with reference to the accompanying drawings. DETAILED DESCRIPTION
[0047] In order to make those skilled in the art better understand the scheme of the present invention, the technical scheme in the embodiment of the present invention will be clearly and completely described below in conjunction with the accompanying drawings in the embodiment of the present invention. Unless otherwise defined, all technical and scientific terms used herein have the same meaning as those commonly understood by those skilled in the art of the present invention. The terms used in the specification of the present invention herein are only for the purpose of describing specific embodiments and are not intended to limit the present invention.
[0048] Reference to "embodiments" herein means that a particular feature, structure, or characteristic described in conjunction with the embodiments may be included in at least one embodiment of the present invention. The appearance of the phrase in various places in the specification does not necessarily refer to the same embodiment, nor is it an independent or alternative embodiment that is mutually exclusive with other embodiments. It is explicitly and implicitly understood by those skilled in the art that the embodiments described herein may be combined with other embodiments.
[0049] Bluetooth devices broadcast Bluetooth broadcast names to facilitate other Bluetooth devices to connect to them. When other Bluetooth devices establish Bluetooth connections with them, they mainly use the corresponding Bluetooth broadcast names to establish Bluetooth connections with them. When there are multiple Bluetooth devices around, multiple Bluetooth devices will broadcast the default broadcast name, which is usually the same broadcast name. In this way, during the Bluetooth device testing phase or when multiple Bluetooth devices are used at the same time, other Bluetooth devices will search for multiple Bluetooth broadcast names with the same name when searching for Bluetooth devices. In this way, they cannot accurately find the Bluetooth device to be connected, resulting in Bluetooth device connection errors and other problems.
[0050] In order to solve the above problems, on the one hand, refer to Figure 1 The embodiment of the present invention provides a Bluetooth broadcast method, comprising the steps of:
[0051] S101: Obtain identification information of an electronic device.
[0052] S102: Determine whether the identification information matches the set identification information.
[0053] S103: If the identification information matches the set identification information, generate a broadcast name corresponding to the set identification information.
[0054] S104: Otherwise, generate a default broadcast name.
[0055] S105: broadcast the generated broadcast name externally via Bluetooth.
[0056] Specifically, Figure 1 As shown in, in step S101, the electronic device obtains its own unique identification information. The electronic device is a Bluetooth device. For example, it can be a Bluetooth keyboard. In one embodiment of the present invention, the unique identification information is a MAC address or a serial number. Since the MAC address or the serial number is unique, the electronic device can be uniquely identified. In this way, it is convenient to associate the MAC address or the serial number with the Bluetooth broadcast name in the subsequent steps, so as to realize the alienation setting of the broadcast name of different electronic devices.
[0057] After the unique identification information of the electronic device is obtained, in step S102, it is determined whether the unique identification information matches the set identification information; since the range of the unique identification information of the electronic device may be very large. Only when the unique identification information of the electronic device falls within the set range and matches the set identification information, the generation and processing of the Bluetooth broadcast name is performed through step S103, reducing the complex and time-consuming calculation process. For example, the unique identification information is a MAC address or a serial number. The range of the MAC address is very large. If the unique identification information of the electronic device is obtained and compared with all MAC addresses one by one, the amount of calculation is very large, and the purpose of quickly generating a broadcast name cannot be achieved. In addition, in the production or application of Bluetooth devices in an enterprise, the number of Bluetooth devices produced, tested or applied is usually limited. For example, when an enterprise produces a batch of Bluetooth keyboards, it is usually several thousand or tens of thousands. Then, when testing a batch of Bluetooth keyboards, the number is also limited, so it is only necessary to distinguish the broadcast names of a limited number of Bluetooth keyboards.
[0058] In step S103, if the identification information matches the set identification information, a broadcast name corresponding to the set identification information is generated; that is, when the unique identification information of the electronic device obtained matches or is the same as a certain identification information in the set identification information, a broadcast name corresponding to the set identification information is generated; in this way, the broadcast name is not only unique but also easy to identify. When the generated broadcast name is broadcasted, it is more convenient for other Bluetooth devices to connect and avoid errors.
[0059] In step S104, if the Bluetooth device Mac address is not within the set range, the software default broadcast name will be used. In this way, errors caused by failure to generate a broadcast name are avoided, and the normal use of the Bluetooth device is ensured. In step S105, the generated broadcast name is broadcasted externally via Bluetooth.
[0060] In the embodiment of the present invention, through S101, unique identification information of the electronic device is obtained. S102, whether the identification information matches the set identification information is determined. S103, if the identification information matches the set identification information, a broadcast name corresponding to the set identification information is generated. S104, otherwise, a default broadcast name is generated. S105, the generated broadcast name is broadcasted to the outside via Bluetooth. In this way, each keyboard can generate a different serial number and Bluetooth broadcast name by burning the Mac address of the device through a burning tool, so that each keyboard has a corresponding serial number and broadcast name. When multiple Bluetooth devices broadcast at the same time, other Bluetooth devices can accurately find the device to be connected through different Bluetooth broadcast names.
[0061] See also Figure 2In one embodiment of the present invention, the method for determining whether the identification information matches the set identification information comprises the steps of:
[0062] S1021, comparing the MAC address or serial number of the electronic device with data within a set range;
[0063] S1022, determining whether the MAC address or serial number of the electronic device falls within a set range of data;
[0064] S1023: If yes, determine that the identification information matches the set identification information;
[0065] S1024: Otherwise, it is determined that the identification information does not match the set identification information.
[0066] Specifically, Figure 2 As shown in , in step S101, by obtaining the unique identification information of the electronic device; the unique identification information can be the Bluetooth Mac address of the electronic device (keyboard), and by step S1021, the MAC address or serial number of the electronic device is compared with the data within the set range; for example: the Mac address of a keyboard is 301F9A80EDCF, and the address segment set by the software is 301F9A80EDCF-F015, by comparing the Mac address 301F9A80EDCF of the keyboard with the data of the set address segment of 301F9A80EDCF to 301F9A80F015. By step S1022, it can be determined that the Mac address 301F9A80EDCF falls within the data range of the set address segment of 301F9A80EDCF-F015. In this way, it can be determined by step S1023 that the identification information matches the set identification information. For another example, when the Mac address of the electronic device is 301F9A80EDCE or 301F9A80F016, the Mac address of the electronic device does not fall within the data range of the set address segment of 301F9A80EDCF to 301F9A80F015. In this way, it can be determined in step S1024 that the identification information does not match the set identification information. In other embodiments, the matching method based on the serial number and SN number is similar to the above steps S1021 to S1024, and will not be repeated again.
[0067] See also Figure 3 In another embodiment of the present invention, the method for generating a broadcast name corresponding to the set identification information comprises the steps of:
[0068] S1031, calculating the sorting position of the MAC address or serial number in the data within the set range;
[0069] S1032: Generate a broadcast name corresponding to the sorting position.
[0070] Specifically, after determining that the MAC address or serial number of the electronic device falls within the set address segment range of the data, since the Mac address of the electronic device (for example, a Bluetooth keyboard) is within the set range, the software calculates which Mac address or serial number the keyboard Mac address is within the software set range, finds the sorting position of the serial number, and then generates a broadcast name based on the serial number. For example, if the keyboard's Mac address 301F9A80EDCF is located at the first position in the sorting of Mac addresses 301F9A80EDCF to 301F9A80F015, the serial number of the keyboard is 0001, and the keyboard broadcast name is "Keyboard 0001". For another example: if the keyboard's Mac address 301F9A80EDD0 is located at the second position in the sorting of Mac addresses 301F9A80EDCF to 301F9A80F015, the serial number of the keyboard is 0002, and the keyboard broadcast name is "Keyboard 0002". And so on. By generating such a broadcast name, the broadcast name is simpler and easier to identify.
[0071] It should be noted that in other embodiments, the broadcast name can be produced in other forms, not the form of text plus numbers "Keyboard 0002" as exemplified in the embodiment of the present invention. Other similar equivalent replacement embodiments should also be within the protection scope of the present invention.
[0072] See also Figure 3 In one embodiment of the present invention, the Bluetooth broadcast method further includes: S201, determining whether a set broadcast name has been stored in the electronic device; if the set broadcast name has been stored, broadcasting the set broadcast name to the outside via Bluetooth. Figure 3 As shown in FIG. 1 , in one embodiment of the present invention, it is also possible to detect whether a set broadcast name has been stored in the electronic device through S201. The set broadcast name can be set manually by a user, or when testing the electronic device, the tester can set it manually, or it can be set by the above-mentioned Figure 1 The result of storing the broadcast name generated after steps S101 to S103. In step S201, if it is detected that the electronic device has stored the set broadcast name, the set broadcast name can be directly broadcasted to the outside without going through Figure 1 Steps S101 to S103 (or Figure 4 In steps S202 to S204), the broadcast name is regenerated.
[0073] See also Figure 5 , Figure 5 Another Bluetooth broadcast method flow chart provided by an embodiment of the present invention, through Figure 6 The present invention is further described as follows: Figure 5 As shown in , when the Bluetooth device is turned on, it reads the adv_name variable of the flash memory and determines whether the broadcast name has been stored. If the broadcast name is stored, the stored broadcast name can be directly broadcast. Otherwise, the unique identification information of the electronic device is obtained by reading the mac address of the flash memory. And determine whether the mac address is within the mac address segment range set by the software. If not, the default broadcast name is directly used for Bluetooth broadcast. If it is within the set mac address segment range, a broadcast name is generated according to the read mac address, and the generated broadcast name is broadcast, because the mac address is unique. The broadcast names generated in this way can be different to avoid the same broadcast name. When testing the Bluetooth device, the Bluetooth broadcast names sorted in sequence can be connected one by one, and multiple Bluetooth keyboards can be tested one by one to avoid connection errors or repeated tests.
[0074] On the other hand, see Figure 6 The present invention also provides a Bluetooth broadcasting device, including: an identification information acquisition module, an information matching judgment module, a broadcast name generation module, a default broadcast name generation module and a Bluetooth broadcasting module, wherein the identification information acquisition module is used to obtain unique identification information of the electronic device.
[0075] The information matching judgment module is used to judge whether the unique identification information matches the set identification information.
[0076] The broadcast name generating module is used for generating a broadcast name corresponding to the set identification information if the identification information matches the set identification information.
[0077] The default broadcast name generating module is used to generate a default broadcast name when the identification information does not match the set identification information.
[0078] The Bluetooth broadcast module is used to broadcast the generated broadcast name externally via Bluetooth.
[0079] See also Figure 7 In one embodiment of the present invention, the information matching judgment module includes: a data comparison module and a data judgment module, and the data comparison module is used to compare the MAC address or serial number of the electronic device with the data within a set range.
[0080] The data judgment module is used to judge whether the MAC address or serial number of the electronic device falls within the set range of the data. If so, it is judged that the identification information matches the set identification information; otherwise, it is judged that the identification information does not match the set identification information.
[0081] See also Figure 8In one embodiment of the present invention, the broadcast name generation module includes: a sorting position calculation module and a sorting broadcast name generation module, and the sorting position calculation module is used to calculate the sorting position of the MAC address or serial number in the data within the set range.
[0082] The sorting broadcast name generating module is used to generate a broadcast name corresponding to the sorting position.
[0083] See also Fig. 9 In one embodiment of the present invention, the Bluetooth broadcasting device also includes: a set broadcast name broadcasting module, the set broadcast name broadcasting module is used to determine whether the set broadcast name has been stored in the electronic device, and if the set broadcast name has been stored, the set broadcast name is broadcasted externally via Bluetooth.
[0084] See also Fig.10 On the other hand, an embodiment of the present invention further provides a computer device, the computer device comprising a first memory, a first processor, and a computer program stored in the first memory and executable on the first processor, wherein the first processor implements the Bluetooth broadcast method in the above steps when executing the computer program. Alternatively, when the computer program is executed by the processor, the functions of each module / unit in the device described in the above embodiment are implemented, such as Fig.10 Functionality of the modules shown.
[0085] See also Fig.10 , the computer device may include but is not limited to a processor and a memory. A person skilled in the art may understand that the diagram is only an example of a computer device and does not constitute a limitation on the computer device. The computer device may include more or fewer components than shown in the diagram, or may combine certain components, or different components. For example, the computer device may also include an input / output device, a network access device, a bus, etc.
[0086] The processor may be a central processing unit (CPU), other general-purpose processors, digital signal processors (DSP), application-specific integrated circuits (ASIC), field programmable gate arrays (FPGA) or other programmable logic devices, discrete gate or transistor logic devices, discrete preset hardware components, etc. A general-purpose processor may be a microprocessor or any conventional processor, etc.
[0087] The memory may be an internal storage unit of the computer device, such as a hard disk or memory of the computer device. The memory may also be an external storage device of the computer device, such as a plug-in hard disk, a smart media card (SMC), a secure digital (SD) card, a flash card, etc. equipped on the computer device. Furthermore, the memory may include both an internal storage unit and an external storage device of the computer device. The memory is used to store the computer program and other programs and data required by the computer device. The memory may also be used to temporarily store data that has been output or is to be output.
[0088] The computer program may be stored in a computer-readable storage medium, and when the computer program is executed by a processor, the steps of each of the above-mentioned method embodiments may be implemented. The computer program includes computer program code, and the computer program code may be in source code form, object code form, executable file or some intermediate form, etc. The computer-readable medium may include: any entity or device capable of carrying the computer program code, recording medium, USB flash drive, mobile hard disk, magnetic disk, optical disk, computer memory, read-only memory (ROM), random access memory (RAM), electric carrier signal, telecommunication signal and software distribution medium, etc.
[0089] The above are only embodiments of the present invention, but they do not limit the patent scope of the present invention. Although the present invention is described in detail with reference to the above embodiments, those skilled in the art can still modify the technical solutions recorded in the above embodiments, or replace some of the technical features with equivalent ones. Any equivalent structure made by using the contents of the present invention specification and drawings, directly or indirectly used in other related technical fields, is also within the scope of patent protection of the present invention.
[0090] In the description of this specification, the description with reference to the terms "one embodiment", "some embodiments", "examples", "specific examples", or "some examples" means that the specific features, structures, materials or characteristics described in conjunction with the embodiment or example are included in at least one embodiment or example of the present invention. In this specification, the schematic representation of the above terms does not necessarily refer to the same embodiment or example. Moreover, the specific features, structures, materials or characteristics described may be combined in any one or more embodiments or examples in a suitable manner.
[0091] Although the embodiments of the present invention have been shown and described above, it is to be understood that the above embodiments are exemplary and are not to be construed as limitations on the present invention. A person skilled in the art may change, modify, replace and modify the above embodiments within the scope of the present invention without departing from the principles and intent of the present invention.
Claims
1. A Bluetooth broadcast method, characterized in that: Includes steps: Obtaining identification information of the electronic device; wherein the identification information is a MAC address or a serial number; Determining whether the identification information matches the set identification information; If the identification information matches the set identification information, generating a broadcast name corresponding to the set identification information; Otherwise, a default broadcast name is generated; The generated broadcast name will be broadcasted externally via Bluetooth; in, The method for determining whether the identification information matches the set identification information includes: Compare the MAC address or serial number of the electronic device with data within a set range; Determine whether the MAC address or serial number of the electronic device falls within a set range of the data, and if so, determine that the identification information matches the set identification information; Otherwise, it is determined that the identification information does not match the set identification information.
2. The Bluetooth broadcast method according to claim 1, characterized in that: The method for generating a broadcast name corresponding to the set identification information comprises the steps of: Calculate the sorting position of the MAC address or serial number in the data within the set range; A broadcast name corresponding to the sorting position is generated.
3. The Bluetooth broadcast method according to claim 1, characterized in that: Also includes: It is determined whether the electronic device has stored a set broadcast name. If the set broadcast name is stored, the set broadcast name is broadcasted externally via Bluetooth.
4. A Bluetooth broadcasting device, characterized in that: include: An identification information acquisition module, the identification information acquisition module is used to obtain identification information of the electronic device; wherein the identification information is a MAC address or a serial number; An information matching judgment module, the information matching judgment module is used to judge whether the identification information matches the set identification information; a broadcast name generating module, the broadcast name generating module being used for generating a broadcast name corresponding to the set identification information if the identification information matches the set identification information; A default broadcast name generating module, wherein the default broadcast name generating module is used to generate a default broadcast name when the identification information does not match the set identification information; A Bluetooth broadcast module, the Bluetooth broadcast module is used to broadcast the generated broadcast name externally via Bluetooth; in, The information matching judgment module includes: A data comparison module, the data comparison module is used to compare the MAC address or serial number of the electronic device with data within a set range; A data judgment module is used to judge whether the MAC address or serial number of the electronic device falls within the set range of the data. If so, it is judged that the identification information matches the set identification information; otherwise, it is judged that the identification information does not match the set identification information.
5. The Bluetooth broadcasting device according to claim 4, characterized in that: The broadcast name generation module includes: A sorting position calculation module, the sorting position calculation module is used to calculate the sorting position of the MAC address or serial number in the data within the set range; A sorting broadcast name generating module is used to generate a broadcast name corresponding to the sorting position.
6. The Bluetooth broadcasting device according to claim 4, characterized in that: Also includes: The broadcast name setting module is used to determine whether the electronic device has stored a set broadcast name. If the set broadcast name has been stored, the set broadcast name is broadcasted externally via Bluetooth.
7. A computer device, comprising a first memory, a first processor, and a computer program stored in the first memory and executable on the first processor, characterized in that: When the first processor executes the computer program, the Bluetooth broadcast method according to any one of claims 1 to 3 is implemented.
