CN111885562A - Bluetooth networking method and system - Google Patents

Bluetooth networking method and system Download PDF

Info

Publication number
CN111885562A
CN111885562A CN202010628364.XA CN202010628364A CN111885562A CN 111885562 A CN111885562 A CN 111885562A CN 202010628364 A CN202010628364 A CN 202010628364A CN 111885562 A CN111885562 A CN 111885562A
Authority
CN
China
Prior art keywords
bluetooth
broadcast message
queue
unique mark
bluetooth device
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202010628364.XA
Other languages
Chinese (zh)
Inventor
张学阳
李学军
郑辉
李成贵
邹家蒙
夏小明
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Routon Electronic Co ltd
Original Assignee
Routon Electronic Co ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Routon Electronic Co ltd filed Critical Routon Electronic Co ltd
Priority to CN202010628364.XA priority Critical patent/CN111885562A/en
Publication of CN111885562A publication Critical patent/CN111885562A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04WWIRELESS COMMUNICATION NETWORKS
    • H04W4/00Services specially adapted for wireless communication networks; Facilities therefor
    • H04W4/80Services using short range communication, e.g. near-field communication [NFC], radio-frequency identification [RFID] or low energy communication
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04WWIRELESS COMMUNICATION NETWORKS
    • H04W76/00Connection management
    • H04W76/10Connection setup
    • H04W76/11Allocation or use of connection identifiers
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04WWIRELESS COMMUNICATION NETWORKS
    • H04W76/00Connection management
    • H04W76/10Connection setup
    • H04W76/15Setup of multiple wireless link connections
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04WWIRELESS COMMUNICATION NETWORKS
    • H04W84/00Network topologies
    • H04W84/18Self-organising networks, e.g. ad-hoc networks or sensor networks

Abstract

The embodiment of the invention provides a Bluetooth networking method and a Bluetooth networking system, wherein the Bluetooth networking method comprises the following steps: the method comprises the steps of obtaining a unique mark of a first Bluetooth device to be networked, adding the unique mark of the first Bluetooth device to be networked into a first queue, wherein the first queue is used for recording the unique mark of the first Bluetooth device to be networked; selecting second Bluetooth equipment from the first queue according to a preset number, generating a first broadcast message according to the unique mark of the selected second Bluetooth equipment and the mac address of the Bluetooth base station, and broadcasting the first broadcast message; after receiving the first broadcast message, the Bluetooth device compares whether the first broadcast message has a corresponding unique mark; and receiving the broadcast message which is replied by the second Bluetooth device and has accessed to the network, determining that the second Bluetooth device has accessed to the network, and removing the unique mark of the second Bluetooth device which has accessed to the network from the first queue. The complexity of the processing flow of the Bluetooth equipment can be reduced, and the real-time performance of Bluetooth data transmission is improved.

Description

Bluetooth networking method and system
Technical Field
The invention relates to the field of wireless communication, in particular to a Bluetooth networking method and a Bluetooth networking system.
Background
Bluetooth, as a short-range wireless connection technology, establishes a special connection for the fixed and mobile device communication environments based on low-cost short-range wireless connection, and can implement convenient, fast, flexible, safe, low-cost, low-power consumption data communication and voice communication between devices, so it is one of the mainstream technologies currently implementing wireless personal area network communication.
Compared with the traditional Bluetooth (BT for short), the Bluetooth (BLE) with Low power consumption has the advantages of fast search, fast connection and ultra-Low power consumption, and connection and data transmission are kept. Bluetooth low energy has been widely used since its self-introduction.
Establishing a bluetooth connection is a necessary condition for data transmission, and the networking modes based on the bluetooth low energy in the prior art include a point-to-point networking mode adopting a star structure and a mesh networking mode using a mesh topology structure. When a star-structured peer-to-peer networking mode is adopted, 1 Bluetooth master device can only be connected with 7 Bluetooth slave devices, and communicates with 7 slave devices in a polling mode to form a Bluetooth piconet. The networking mode severely limits the number of networking devices and communication distance, and the polling mode also causes low data communication efficiency.
When a mesh networking mode of a mesh topology structure is used, a plurality of modules can be simply added into the network, each network can be connected with more than 65000 equipment nodes by using a star network and a relay technology, each equipment node can freely communicate with other nodes, and the network can be interconnected. Although the communication distance is far longer than that of a piconet, a mesh network based on a mesh topology structure adopts a method of connecting more bluetooth devices, so that a complex network access process exists, the communication data volume of nodes is large, the real-time performance of data is poor, and the subsequent maintenance is difficult.
Therefore, how to provide a bluetooth networking method and system, so as to reduce the complexity of the processing flow of the bluetooth device and improve the real-time performance of bluetooth data transmission, is a problem to be solved urgently.
Disclosure of Invention
Aiming at the defects in the prior art, the embodiment of the invention provides a Bluetooth networking method and a Bluetooth networking system.
In a first aspect, an embodiment of the present invention provides a bluetooth networking method, including:
the method comprises the steps of obtaining a unique mark of a first Bluetooth device to be networked, adding the unique mark of the first Bluetooth device to be networked into a first queue, wherein the first queue is used for recording the unique mark of the first Bluetooth device to be networked;
selecting second Bluetooth equipment from the first queue according to a preset number, generating a first broadcast message according to the unique mark of the selected second Bluetooth equipment and the mac address of the Bluetooth base station, and broadcasting the first broadcast message; after receiving the first broadcast message, the Bluetooth device compares whether the first broadcast message has a corresponding unique mark;
and receiving a broadcast message which is replied by the second Bluetooth device and has accessed to the network, determining that the second Bluetooth device has accessed to the network, and removing the unique mark of the second Bluetooth device which has accessed to the network from the first queue.
Optionally, the bluetooth networking method further includes:
and moving the unique mark of the second Bluetooth device to the end of the first queue when the network-accessed broadcast message replied by the second Bluetooth device is not received in the first period.
Optionally, the bluetooth networking method further includes:
and judging whether the first queue is an empty queue, when the first queue is not the empty queue, re-executing the steps of selecting second Bluetooth equipment from the first queue according to a preset number, generating a first broadcast message according to the unique mark of the selected second Bluetooth equipment and the mac address of the Bluetooth base station, and broadcasting the first broadcast message.
Optionally, the bluetooth networking method further includes:
the unique mark and the corresponding packet number of the third Bluetooth device to be grouped are obtained, and the unique mark and the corresponding packet number of the third Bluetooth device to be grouped are added into a second queue, wherein the second queue is used for recording the unique mark and the corresponding packet number of the third Bluetooth device to be grouped;
selecting fourth Bluetooth equipment from the second queue according to a preset number, generating a second broadcast message according to the unique mark of the selected fourth Bluetooth equipment and the corresponding packet number, and broadcasting the second broadcast message; after receiving the second broadcast message, the Bluetooth device compares whether the second broadcast message has a corresponding unique mark;
when receiving a grouped broadcast message replied by a fourth Bluetooth device in a second period, determining that the fourth Bluetooth device has been grouped, and removing the unique mark of the grouped fourth Bluetooth device and the corresponding group number from the second queue;
when the grouped broadcast message replied by the fourth Bluetooth device is not received in a second period, moving a group number corresponding to the unique mark of the fourth Bluetooth device to the tail of the second queue;
and judging whether the second queue is an empty queue, when the second queue is not the empty queue, re-executing the steps of selecting fourth Bluetooth equipment from the second queue according to the preset number, generating a second broadcast message according to the packet number corresponding to the unique mark of the selected fourth Bluetooth equipment, and broadcasting the second broadcast message.
Optionally, the bluetooth networking method further includes:
acquiring a unique mark and a network quitting instruction of a fifth Bluetooth device to be quitted, and adding the unique mark of the fifth Bluetooth device to be quitted into a third queue, wherein the third queue is used for recording the unique mark of the fifth Bluetooth device to be quitted;
selecting sixth Bluetooth equipment from the third queue according to a preset number, generating a third broadcast message according to the unique mark and the network quitting instruction of the selected sixth Bluetooth equipment, and broadcasting the third broadcast message; after receiving the third broadcast message, the bluetooth device compares whether the third broadcast message has a corresponding unique mark;
when receiving a network quitting broadcast message replied by a sixth Bluetooth device in a third period, determining that the sixth Bluetooth device has quitted the network, and removing the unique mark of the sixth Bluetooth device which has quitted the network from the third queue;
when the quitted network broadcast message replied by the sixth Bluetooth device is not received in a third period, moving the unique mark of the sixth Bluetooth device to the end of the third queue;
and judging whether the third queue is an empty queue, when the third queue is not the empty queue, re-executing the steps of selecting sixth Bluetooth equipment from the third queue according to the preset number, generating a third broadcast message according to the unique mark and the network quitting instruction of the selected sixth Bluetooth equipment, and broadcasting the third broadcast message.
Optionally, the bluetooth networking method further includes:
acquiring a unique mark and a group quitting instruction of a seventh Bluetooth device to be quitted, and adding the unique mark of the seventh Bluetooth device to be quitted into a fourth queue, wherein the fourth queue is used for recording the unique mark of the seventh Bluetooth device to be quitted;
selecting eighth Bluetooth equipment from the fourth queue according to a preset number, generating a fourth broadcast message according to the unique mark and the group quitting instruction of the selected eighth Bluetooth equipment, and broadcasting the fourth broadcast message; after receiving the fourth broadcast message, the bluetooth device compares whether the fourth broadcast message has a corresponding unique mark;
when receiving a broadcast message of a group quitting replied from an eighth Bluetooth device in a fourth period, determining that the eighth Bluetooth device has quitted, and removing the unique mark of the eighth Bluetooth device which has quitted from the fourth queue;
when the broadcast message returned by the eighth Bluetooth device and returned by the eighth Bluetooth device is not received in a fourth period, moving the unique mark of the eighth Bluetooth device to the end of the fourth queue;
and judging whether the fourth queue is an empty queue, when the fourth queue is not the empty queue, re-executing the steps of selecting eighth Bluetooth equipment from the fourth queue according to the preset number, generating a fourth broadcast message according to the unique mark and the group quitting instruction of the selected eighth Bluetooth equipment, and broadcasting the fourth broadcast message.
In a second aspect, an embodiment of the present invention provides a bluetooth networking method, including:
receiving a first broadcast message sent by a Bluetooth base station, and comparing whether the first broadcast message has a corresponding unique mark; wherein the first broadcast message carries a unique identifier of the second Bluetooth device and a mac address of the Bluetooth base station; the second Bluetooth equipment is selected to be connected to the network according to a preset number;
if the comparison is successful, storing the mac address of the Bluetooth base station, completing the network access and replying the accessed broadcast message; for the bluetooth base station to determine that the bluetooth device has accessed the network.
Optionally, the bluetooth networking method further includes:
after receiving a second broadcast message sent by a Bluetooth base station, comparing whether the second broadcast message has a corresponding unique mark; if so, recording a packet number corresponding to the unique mark of the second broadcast message; wherein the second broadcast message carries a unique identifier and a corresponding packet number of a fourth bluetooth device; the fourth Bluetooth equipment is selected to be grouped according to a preset number;
completing grouping and replying the grouped broadcast message; for the bluetooth base station to determine that the bluetooth device has been grouped.
Optionally, the bluetooth networking method further includes:
receiving a third broadcast message sent by a Bluetooth base station, and comparing whether the third broadcast message has a corresponding unique mark; the third broadcast message carries a unique mark and a network quitting instruction of a sixth Bluetooth device; the sixth Bluetooth equipment is selected to be quitted according to a preset number;
if the comparison is successful, replying the broadcast message of the quit network and finishing the quit network; for the bluetooth base station to determine that the bluetooth device has exited the network.
Optionally, the bluetooth networking method further includes:
receiving a fourth broadcast message sent by a Bluetooth base station, and comparing whether the fourth broadcast message has a corresponding unique mark; the fourth broadcast message carries a unique mark and a group quitting instruction of the eighth Bluetooth device; the eighth Bluetooth device is a Bluetooth device to be quitted, which is selected according to a preset number;
if the comparison is successful, replying the broadcast message of the group quit and finishing the group quit; for the bluetooth base station to determine that the bluetooth device has exited the group.
In a third aspect, an embodiment of the present invention provides a bluetooth networking system, including:
at least one bluetooth base station capable of executing the bluetooth networking method, and at least one bluetooth device capable of executing the bluetooth networking method.
In a fourth aspect, an embodiment of the present invention provides an electronic device, including a memory and a processor, where the processor and the memory complete communication with each other through a bus; the memory stores program instructions executable by the processor, which when invoked by the processor are capable of performing the various steps of the bluetooth networking method described above.
In a fifth aspect, an embodiment of the present invention provides a non-transitory computer-readable storage medium, on which a computer program is stored, and the computer program, when executed by a processor, implements the steps of the bluetooth networking method as described above.
Embodiments of the present invention provide a bluetooth networking method and system, which can reduce complexity of a processing flow of a bluetooth device and improve real-time performance of bluetooth data transmission by effectively reducing data transmission amount and an interaction flow.
Drawings
In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings used in the description of the embodiments or the prior art will be briefly described below, and it is obvious that the drawings in the following description are some embodiments of the present invention, and those skilled in the art can also obtain other drawings according to the drawings without creative efforts.
Fig. 1 is a flowchart of a bluetooth networking method according to an embodiment of the present invention;
fig. 2 is a flowchart of a bluetooth networking method according to another embodiment of the present invention;
fig. 3 is a schematic structural diagram of a bluetooth networking system according to an embodiment of the present invention;
fig. 4 is a schematic structural diagram of an electronic device according to an embodiment of the present invention.
Detailed Description
In order to make the objects, technical solutions and advantages of the embodiments of the present invention clearer, the technical solutions in the embodiments of the present invention will be clearly and completely described below with reference to the drawings in the embodiments of the present invention, and it is obvious that the described embodiments are some, but not all, embodiments of the present invention. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present invention.
Fig. 1 is a flowchart of a bluetooth networking method according to an embodiment of the present invention, and as shown in fig. 1, the bluetooth networking method according to the embodiment of the present invention is applied to a bluetooth base station, and the method includes:
step S1, acquiring a unique mark of a first Bluetooth device to be networked, and adding the unique mark of the first Bluetooth device to be networked into a first queue, wherein the first queue is used for recording the unique mark of the first Bluetooth device to be networked;
step S2, selecting second Bluetooth devices from the first queue according to a preset number, generating a first broadcast message according to the unique identifier of the selected second Bluetooth devices and the mac address of the Bluetooth base station, and broadcasting the first broadcast message; after receiving the first broadcast message, the Bluetooth device compares whether the first broadcast message has a corresponding unique mark;
step S3, receiving an already-accessed broadcast message replied by a second bluetooth device, determining that the second bluetooth device has already accessed, and removing the unique identifier of the already-accessed second bluetooth device from the first queue.
Specifically, in step S1, the bluetooth base station acquires the mac address of the first bluetooth device to be networked through the internet, and adds the last 3 bytes of the mac address of the first bluetooth device as the unique identifier of the bluetooth device into the first queue.
The bluetooth mac address is composed of 6 bytes (48 bits long), 16-ary digits, the first 3 bytes (0-23 bits) are assigned by the bluetooth manufacturer, and the last 3 bytes (24-47 bits) are used to identify the node id of the LAN (local area network) to ensure the distinction between individuals. Therefore, because the bytes of the broadcast are limited by bytes, the last 3 bytes of the mac address of the bluetooth device are taken as the unique mark of the bluetooth device, the loading amount of effective information during broadcasting can be effectively increased, and the transmission amount and the transmission times of data are reduced.
It should be noted that, in this embodiment, the unique identifier of the bluetooth device is the last 3 bytes of the mac address of the bluetooth device, and in practical application, other data may also be used as the unique identifier of the bluetooth device, which is not limited in this embodiment.
In step S2, the bluetooth base station selects second bluetooth devices from the first queue according to a preset number, and generates and broadcasts a first broadcast message according to the unique identifier of the selected second bluetooth device and the mac address of the bluetooth base station; after receiving the first broadcast message, the bluetooth device compares whether the first broadcast message has the unique mark corresponding to the bluetooth device.
Specifically, for example, the first queue has a total of 20 unique identifiers of the first bluetooth devices, and at this time, the bluetooth base station adopts an algorithm of queue sorting, selects 7 bluetooth devices in the first queue in order as the second bluetooth devices, and uses the unique identifiers of the 7 second bluetooth devices and the mac addresses of the bluetooth base station as the first broadcast message.
It should be noted that, in the embodiment of the present invention, the bluetooth protocol used is a bluetooth BLE4.2 protocol, and for the purpose of interconnection, the BLE4.2 protocol defines a detailed format for broadcast Data and scan response Data of 31 bytes, and one broadcast Data packet is composed of six parts, namely Len, ADType, Random, iden, cmd, and Data.
Because the maximum Data information which can be carried by one broadcast message in the protocol is 26 bytes, when the last 3 bytes of the mac address of the Bluetooth device are used as the unique mark of the Bluetooth device, the broadcast can carry the unique marks of 8 Bluetooth devices at most at the same time.
It should be noted that, in the embodiment of the present invention, in the first broadcast message, the Data information only carries the unique identifier of the bluetooth device, and the mac address of the bluetooth base station is carried by the bluetooth protocol layer, which does not need to be carried by the Data information.
However, in an actual use situation, other bluetooth protocols such as the bluetooth BLE5.0 protocol may be used, or other data may be used as the unique identifier of the bluetooth device, so that the number of the unique identifiers of the bluetooth devices that can be carried at most at one time in one broadcast may be adjusted according to the actual situation, and meanwhile, the number of the bluetooth devices in the network entry queue, the frequency and duration of broadcast transmission may all be adjusted according to the actual situation, which is not limited in this embodiment.
On the basis, Random numbers can be added in the broadcast messages, when the Bluetooth equipment receiving the broadcast messages finds that the Random numbers in the continuous broadcast messages are the same, only one piece of information is processed, the Bluetooth equipment is ensured to process the same broadcast message only once, the same broadcast message is prevented from being processed repeatedly, and the complexity of the processing flow of the Bluetooth equipment is reduced.
In step S3, the bluetooth base station receives the returned broadcast message of network access from the second bluetooth device, determines that the second bluetooth device has network access, and removes the unique identifier of the second bluetooth device that has network access determined from the first queue.
The embodiment of the invention provides a Bluetooth networking method, which adopts a mode of active inquiry of a Bluetooth base station and passive response of Bluetooth equipment, and is different from a scheme that a request and a reply are required in four steps of connection establishment, connection request, connection establishment and connection disconnection in the traditional Bluetooth connection process. The interactive flow between the Bluetooth base station and the Bluetooth equipment can be effectively reduced, data transmission is carried out through the unique mark of the Bluetooth, the transmission quantity of data can be effectively reduced, the complexity of the processing flow of the Bluetooth equipment is reduced, and the real-time performance of Bluetooth data transmission is improved.
Based on the above embodiment, optionally, the bluetooth networking method further includes:
and moving the unique mark of the second Bluetooth device to the end of the first queue when the network-accessed broadcast message replied by the second Bluetooth device is not received in the first period.
Specifically, in order to enable the bluetooth device to receive the broadcast, the bluetooth base station may continuously broadcast the first broadcast message for a period of time, so that after the bluetooth device receives the first broadcast message, the bluetooth base station may compare whether there is a unique identifier corresponding to the bluetooth base station in the first broadcast message. The time that the Bluetooth base station continuously broadcasts is taken as a first period.
After the Bluetooth device accesses the network, the Bluetooth device feeds back the accessed broadcast message to the Bluetooth base station, so that the Bluetooth base station can determine that the Bluetooth device accesses the network. And when the network-accessed broadcast message replied by the second Bluetooth equipment is not received in the first period, the Bluetooth base station determines that the second Bluetooth equipment is not accessed to the network and moves the unique mark of the second Bluetooth equipment which is determined not to be accessed to the tail of the first queue. In the process of circularly selecting the Bluetooth devices in the first queue, the Bluetooth devices at the end of the first queue are selected again.
For example, the first queue has a total of 20 unique identifiers of the first bluetooth devices, and at this time, the bluetooth base station adopts an algorithm for queue sorting, and in step a, the unique identifiers of 7 second bluetooth devices and the mac address of the bluetooth base station are arbitrarily selected as the first broadcast message, and the broadcast is continuously performed for 0.5s at a frequency of transmitting once every 100 ms. The time 0.5s that the bluetooth base station continuously broadcasts at this time is taken as the first period.
If 7 second bluetooth devices in the first period, 4 broadcast messages which are accessed to the network are fed back to the bluetooth base station. The bluetooth base station removes the unique identifiers of the 4 bluetooth devices from the first queue. The unique identifiers of the other 3 bluetooth devices are moved to the end of the first queue.
When it needs to be described, in this embodiment, when the first bluetooth device with the preset number in the first queue is selected as the second bluetooth device, the queue sorting algorithm is adopted. The unique identifiers of all bluetooth devices in the first queue are processed in sequence. In a specific application, the method may also be random selection, or reverse selection, which is not limited in this embodiment.
The embodiment of the invention provides a Bluetooth networking method, which adopts a mode of active inquiry of a Bluetooth base station and passive response of Bluetooth equipment, and is different from a scheme that a request and a reply are required in four steps of connection establishment, connection request, connection establishment and connection disconnection in the traditional Bluetooth connection process. The interactive flow between the Bluetooth base station and the Bluetooth equipment can be effectively reduced, data transmission is carried out through the unique mark of the Bluetooth, the transmission quantity of data can be effectively reduced, the complexity of the processing flow of the Bluetooth equipment is reduced, and the real-time performance of Bluetooth data transmission is improved. The Bluetooth base station adopts the algorithm of queue sequencing, so that the condition that fewer broadcasts exist in the environment can be effectively ensured, the possibility of Bluetooth broadcast conflict is reduced, and the effective network access of Bluetooth equipment is ensured.
Based on the above embodiment, optionally, the bluetooth networking method further includes:
and judging whether the first queue is an empty queue, when the first queue is not the empty queue, re-executing the steps of selecting second Bluetooth equipment from the first queue according to a preset number, generating a first broadcast message according to the unique mark of the selected second Bluetooth equipment and the mac address of the Bluetooth base station, and broadcasting the first broadcast message.
Specifically, in the process of continuously selecting the first bluetooth device in the first queue as the second bluetooth device, broadcasting the unique identifier of the second bluetooth device, and removing the unique identifier of the bluetooth device to be networked from the first queue, the unique identifier of the first bluetooth device stored in the first queue is less and less.
And the Bluetooth base station needs to judge whether the first queue is an empty queue, and when the first queue is not the empty queue, the Bluetooth base station re-executes the steps of selecting second Bluetooth equipment from the first queue according to the preset number, generating a first broadcast message according to the unique mark of the selected second Bluetooth equipment and the mac address of the Bluetooth base station, and broadcasting the first broadcast message.
If the first queue is judged to be an empty queue, the fact that all the Bluetooth devices with access networks in the first queue have access networks is shown.
It should be noted that, since the transmission process of bluetooth is affected by obstacles, there may be a case that an individual bluetooth device cannot always access the network, and on the basis of the above embodiment, it is possible to set a response time threshold to control whether broadcasting still needs to be continued. For example, the response time threshold for 20 bluetooth devices to be networked is set to 5min, and the time 0.5s for which the bluetooth base station continuously broadcasts is taken as the first period. And after 10 first periods, the Bluetooth equipment still cannot access the network, judging that the response of the Bluetooth equipment is overtime, and abandoning to continue broadcasting.
The embodiment of the invention provides a Bluetooth networking method, which adopts a mode of active inquiry of a Bluetooth base station and passive response of Bluetooth equipment, and is different from a scheme that a request and a reply are required in four steps of connection establishment, connection request, connection establishment and connection disconnection in the traditional Bluetooth connection process. The method can effectively reduce the interactive flow between the Bluetooth base station and the Bluetooth equipment in the process of accessing the network of the Bluetooth equipment, and transmits data by using the unique mark of the Bluetooth, thereby effectively reducing the transmission quantity of data, reducing the complexity of the processing flow of the Bluetooth equipment and improving the real-time performance of Bluetooth data transmission.
Based on the above embodiment, optionally, the bluetooth networking method further includes:
the unique mark and the corresponding packet number of the third Bluetooth device to be grouped are obtained, and the unique mark and the corresponding packet number of the third Bluetooth device to be grouped are added into a second queue, wherein the second queue is used for recording the unique mark and the corresponding packet number of the third Bluetooth device to be grouped;
selecting fourth Bluetooth equipment from the second queue according to a preset number, generating a second broadcast message according to the unique mark of the selected fourth Bluetooth equipment and the corresponding packet number, and broadcasting the second broadcast message; after receiving the second broadcast message, the Bluetooth device compares whether the second broadcast message has a corresponding unique mark;
when receiving a grouped broadcast message replied by a fourth Bluetooth device in a second period, determining that the fourth Bluetooth device has been grouped, and removing the unique mark of the grouped fourth Bluetooth device and the corresponding group number from the second queue;
when the grouped broadcast message replied by the fourth Bluetooth device is not received in a second period, moving a group number corresponding to the unique mark of the fourth Bluetooth device to the tail of the second queue;
and judging whether the second queue is an empty queue, when the second queue is not the empty queue, re-executing the steps of selecting fourth Bluetooth equipment from the second queue according to the preset number, generating a second broadcast message according to the packet number corresponding to the unique mark of the selected fourth Bluetooth equipment, and broadcasting the second broadcast message.
Specifically, the bluetooth base station adds the unique identifier and the corresponding packet number, which are acquired through the internet and are required to be grouped into the third bluetooth device, into the second queue.
Selecting fourth Bluetooth equipment from the second queue according to a preset number, generating a second broadcast message according to the unique mark of the selected fourth Bluetooth equipment and the corresponding packet number, and broadcasting the second broadcast message; after receiving the second broadcast message, the bluetooth device compares whether the second broadcast message has the unique mark corresponding to the bluetooth device.
And when the Bluetooth equipment finds that the second broadcast message comprises the unique mark corresponding to the Bluetooth equipment, grouping according to the grouping number corresponding to the unique mark of the Bluetooth equipment, and feeding back the grouped broadcast message to the Bluetooth base station.
And the Bluetooth base station receives the grouped broadcast message replied by the fourth Bluetooth device, determines that the fourth Bluetooth device is grouped, and removes the unique mark of the grouped fourth Bluetooth device and the corresponding group number from the second queue.
And taking the duration of the same broadcast message sent by the Bluetooth base station as a second period, and if the Bluetooth base station does not receive the grouped broadcast message replied by the fourth Bluetooth device in the second period, moving the group number corresponding to the unique mark of the fourth Bluetooth device to the tail of the second queue.
After the second period is carried out once, the Bluetooth base station judges whether the second queue is an empty queue, when the second queue is not the empty queue, the steps of selecting fourth Bluetooth equipment from the second queue according to the preset number, generating a second broadcast message according to the packet number corresponding to the unique mark of the selected fourth Bluetooth equipment, and broadcasting the second broadcast message are carried out again. Or the bluetooth device that still does not implement the packet is deemed to react to a timeout and forgo continuing the broadcast.
And if the Bluetooth base station finds that the second queue is empty, judging that all the third Bluetooth devices needing grouping in the second queue are completely grouped, and stopping continuing broadcasting.
It should be noted that, in the embodiment of the present invention, the number of unique tags of bluetooth devices that can be carried at most at the same time in one broadcast may be adjusted according to the actual situation, and meanwhile, the number of bluetooth devices in a packet queue, the frequency and the duration of broadcast transmission may all be adjusted according to the actual situation, which is not limited in this embodiment.
The embodiment of the invention provides a Bluetooth networking method, which adopts a mode of active inquiry of a Bluetooth base station and passive response of Bluetooth equipment, and is different from a scheme that a request and a reply are required in four steps of connection establishment, connection request, connection establishment and connection disconnection in the traditional Bluetooth connection process. The interactive flow between the Bluetooth base station and the Bluetooth equipment can be effectively reduced, data transmission is carried out through the unique mark of the Bluetooth, the transmission quantity of data can be effectively reduced, the complexity of the processing flow of the Bluetooth equipment is reduced, and the real-time performance of Bluetooth data transmission is improved. The bluetooth base station adopts the algorithm of queue sequencing, can effectively guarantee that the broadcasting that exists is less in the environment, reduces the possibility of bluetooth broadcast conflict, guarantees the quick effectual network access of bluetooth equipment and packetizes, realizes the management to bluetooth equipment data transmission, adds the function that realizes that multiunit bluetooth equipment receives different broadcast messages, improves the flexibility that bluetooth equipment used.
Based on the above embodiment, optionally, the bluetooth networking method further includes:
acquiring a unique mark and a network quitting instruction of a fifth Bluetooth device to be quitted, and adding the unique mark of the fifth Bluetooth device to be quitted into a third queue, wherein the third queue is used for recording the unique mark of the fifth Bluetooth device to be quitted;
selecting sixth Bluetooth equipment from the third queue according to a preset number, generating a third broadcast message according to the unique mark and the network quitting instruction of the selected sixth Bluetooth equipment, and broadcasting the third broadcast message; after receiving the third broadcast message, the bluetooth device compares whether the third broadcast message has the unique mark corresponding to the bluetooth device.
When receiving a network quitting broadcast message replied by a sixth Bluetooth device in a third period, determining that the sixth Bluetooth device has quitted the network, and removing the unique mark of the sixth Bluetooth device which has quitted the network from the third queue;
when the quitted network broadcast message replied by the sixth Bluetooth device is not received in a third period, moving the unique mark of the sixth Bluetooth device to the end of the third queue;
and judging whether the third queue is an empty queue, when the third queue is not the empty queue, re-executing the steps of selecting sixth Bluetooth equipment from the third queue according to the preset number, generating a third broadcast message according to the unique mark and the network quitting instruction of the selected sixth Bluetooth equipment, and broadcasting the third broadcast message.
Specifically, after the bluetooth device is networked, the networked bluetooth device can be disconnected, and the bluetooth base station acquires the unique mark of the fifth bluetooth device needing to be disconnected through the internet and joins the third queue.
And selecting a preset number of Bluetooth devices from the third queue as sixth Bluetooth devices, generating a third broadcast message according to the sixth Bluetooth devices and the network quitting instruction, and sending the third broadcast message.
In order to enable the Bluetooth device to receive the broadcast, the Bluetooth base station continuously broadcasts a third broadcast message for a period of time, so that the Bluetooth device compares whether the third broadcast message has a corresponding unique mark or not after receiving the third broadcast message; the duration of continuously sending the third broadcast message is a third period.
And when the Bluetooth equipment finds that the third broadcast message comprises the unique mark corresponding to the Bluetooth equipment, feeding back the network quitting broadcast message to the Bluetooth base station and quitting the network.
And the Bluetooth base station receives the broadcast message of the network quitting replied by the sixth Bluetooth equipment, determines that the sixth Bluetooth equipment has quitted the network, and removes the unique mark of the sixth Bluetooth equipment which has quitted the network from the third queue.
And if the Bluetooth base station does not receive the broadcast message of the sixth Bluetooth device returning network in a third period, moving the unique mark of the sixth Bluetooth device to the end of the third queue.
After a third period, the Bluetooth base station judges whether the third queue is an empty queue, when the third queue is not an empty queue, the Bluetooth base station re-executes the steps of selecting sixth Bluetooth equipment from the third queue according to a preset number, generating a third broadcast message according to the unique mark of the selected sixth Bluetooth equipment, and broadcasting the third broadcast message. Or the Bluetooth device which still does not realize the network quitting reacts overtime, and the broadcasting is abandoned.
And if the Bluetooth base station finds that the third queue is empty, judging that all fifth Bluetooth devices needing to quit the network in the third queue are completely quitted, and stopping continuing broadcasting.
It should be noted that, in the embodiment of the present invention, the number of unique tags of bluetooth devices that can be carried at most at the same time in one broadcast may be adjusted according to the actual situation, and meanwhile, the number of bluetooth devices in a packet queue, the frequency and the duration of broadcast transmission may all be adjusted according to the actual situation, which is not limited in this embodiment.
The embodiment of the invention provides a Bluetooth networking method, which adopts a mode of active inquiry of a Bluetooth base station and passive response of Bluetooth equipment, and is different from a scheme that a request and a reply are required in four steps of connection establishment, connection request, connection establishment and connection disconnection in the traditional Bluetooth connection process. Can be at the in-process that bluetooth equipment went into the net, divide into groups and move back the net, the mutual flow between effectual reduction bluetooth basic station and the bluetooth equipment to carry out data transmission through the only sign that uses the bluetooth, the transmission capacity that can effectual reduction data reduces the complexity of the processing procedure of bluetooth equipment, improves bluetooth data transmission's real-time performance, through realizing that the quick income of bluetooth equipment nets and moves back the net, improves the reaction rate of bluetooth network deployment.
Based on the above embodiment, optionally, the bluetooth networking method further includes:
acquiring a unique mark and a group quitting instruction of a seventh Bluetooth device to be quitted, and adding the unique mark of the seventh Bluetooth device to be quitted into a fourth queue, wherein the fourth queue is used for recording the unique mark of the seventh Bluetooth device to be quitted;
selecting eighth Bluetooth equipment from the fourth queue according to a preset number, generating a fourth broadcast message according to the unique mark and the group quitting instruction of the selected eighth Bluetooth equipment, and broadcasting the fourth broadcast message; after receiving the fourth broadcast message, the bluetooth device compares whether the fourth broadcast message has a corresponding unique mark;
when receiving a broadcast message of a group quitting replied from an eighth Bluetooth device in a fourth period, determining that the eighth Bluetooth device has quitted, and removing the unique mark of the eighth Bluetooth device which has quitted from the fourth queue;
when the broadcast message returned by the eighth Bluetooth device and returned by the eighth Bluetooth device is not received in a fourth period, moving the unique mark of the eighth Bluetooth device to the end of the fourth queue;
and judging whether the fourth queue is an empty queue, when the fourth queue is not the empty queue, re-executing the steps of selecting eighth Bluetooth equipment from the fourth queue according to the preset number, generating a fourth broadcast message according to the unique mark and the group quitting instruction of the selected eighth Bluetooth equipment, and broadcasting the fourth broadcast message.
Specifically, after the bluetooth devices are grouped, the bluetooth devices which are connected to the network can be quitted, the bluetooth base station acquires the unique mark of the seventh bluetooth device which needs to be quitted through the internet, and the seventh bluetooth device is added into the fourth queue.
And selecting a preset number of Bluetooth devices from the fourth queue as eighth Bluetooth devices, generating a fourth broadcast message according to the eighth Bluetooth devices and the group quitting instruction, and sending the fourth broadcast message.
In order to enable the Bluetooth device to receive the broadcast, the Bluetooth base station continuously broadcasts a fourth broadcast message for a period of time, so that the Bluetooth device compares whether the fourth broadcast message has a corresponding unique mark or not after receiving the fourth broadcast message; the duration of continuously sending the fourth broadcast message is a fourth period.
And when the Bluetooth equipment finds that the fourth broadcast message comprises the unique mark corresponding to the Bluetooth equipment, feeding back the group quitting broadcast message to the Bluetooth base station and quitting the group.
And the Bluetooth base station receives the broadcast message of the group quitting replied by the eighth Bluetooth equipment, determines that the eighth Bluetooth equipment has quitted the group, and removes the unique mark of the eighth Bluetooth equipment which has quitted the group from the fourth queue.
And if the Bluetooth base station does not receive the broadcast message of the eighth Bluetooth device reply back group in a fourth period, moving the unique mark of the eighth Bluetooth device to the end of the fourth queue.
After the fourth cycle, the Bluetooth base station judges whether the fourth queue is an empty queue, and when the fourth queue is not an empty queue, the Bluetooth base station re-executes the steps of selecting eighth Bluetooth equipment from the fourth queue according to a preset number, generating a fourth broadcast message according to the unique mark of the selected eighth Bluetooth equipment, and broadcasting the fourth broadcast message. Or the Bluetooth device which still does not realize the quitting responds to the overtime and abandons the continuous broadcasting.
And if the Bluetooth base station finds that the fourth queue is empty, judging that all seventh Bluetooth equipment needing to be subjected to group quitting in the fourth queue are completely quitted, and stopping continuing broadcasting.
It should be noted that, in the embodiment of the present invention, the number of unique tags of bluetooth devices that can be carried at most at the same time in one broadcast may be adjusted according to the actual situation, and meanwhile, the number of bluetooth devices in a packet queue, the frequency and the duration of broadcast transmission may all be adjusted according to the actual situation, which is not limited in this embodiment.
Secondly, in this embodiment, only the network quitting situation is introduced separately, and in the actual use process, the network quitting and the group quitting processes may be implemented separately, may also be performed simultaneously, may be set according to the actual situation, may use cmd command characters in the broadcast message as the network quitting instruction and the group quitting instruction, or use other methods, and this embodiment is not limited thereto.
The embodiment of the invention provides a Bluetooth networking method, which adopts a mode of active inquiry of a Bluetooth base station and passive response of Bluetooth equipment, and is different from a scheme that a request and a reply are required in four steps of connection establishment, connection request, connection establishment and connection disconnection in the traditional Bluetooth connection process. The interactive flow between the Bluetooth base station and the Bluetooth equipment can be effectively reduced, data transmission is carried out through the unique mark of the Bluetooth, the transmission quantity of data can be effectively reduced, the complexity of the processing flow of the Bluetooth equipment is reduced, and the real-time performance of Bluetooth data transmission is improved. The Bluetooth base station adopts the algorithm of queue sequencing, so that the broadcasting existing in the environment can be effectively ensured to be less, the possibility of Bluetooth broadcasting conflict is reduced, and the Bluetooth equipment can be ensured to be quickly and effectively accessed to the network, grouped, quitted from the network and quitted from the network. The flexible control of the Bluetooth networking is realized, the high information transmission safety of the Bluetooth equipment and the base station is ensured, the functions of grouping control and quick response are added, the reaction capability and the stability of the Bluetooth networking are improved, and the Bluetooth networking can be suitable for more occasions.
Fig. 2 is a flowchart of a bluetooth networking method according to another embodiment of the present invention, and as shown in fig. 2, the bluetooth networking method according to another embodiment of the present invention is applied to a bluetooth device, and the method includes:
step 201: receiving a first broadcast message sent by a Bluetooth base station, and comparing whether the first broadcast message has a corresponding unique mark; wherein the first broadcast message carries a unique identifier of the second Bluetooth device and a mac address of the Bluetooth base station; the second Bluetooth equipment is selected to be connected to the network according to a preset number;
step 202: if the comparison is successful, storing the mac address of the Bluetooth base station, completing the network access and replying the accessed broadcast message; for the bluetooth base station to determine that the bluetooth device has accessed the network.
Specifically, in step 201: the method comprises the steps that a Bluetooth device receives a first broadcast message sent by a Bluetooth base station, and compares whether the first broadcast message has a unique mark corresponding to the Bluetooth device, wherein the first broadcast message is a broadcast message carrying the unique mark of a second Bluetooth device and a mac address of the Bluetooth base station. The second equipment is selected to be the Bluetooth equipment to be accessed to the network according to the preset number.
In step 202: if the Bluetooth equipment determines that the first broadcast message contains the unique mark corresponding to the Bluetooth equipment, the mac address of the Bluetooth base station is stored, network access is completed, and the accessed broadcast message is replied to the Bluetooth base station; for the bluetooth base station to determine that the bluetooth device has accessed the network.
It should be noted that the embodiment of the present invention is applicable to a plurality of bluetooth BLE protocols, and when the adopted bluetooth protocol is a bluetooth BLE4.2 protocol, because the maximum Data information that can be carried by one broadcast message in the protocol is 26 bytes, when the last 3 bytes of the mac address of the bluetooth device are used as the unique identifier of the bluetooth device, the maximum unique identifier of 8 bluetooth devices can be carried by one broadcast. If the bluetooth BLE5.0 protocol is used, the number of the broadcasts that can be carried at the same time will be increased, and the bluetooth protocol used in the method is not limited in this embodiment.
The embodiment of the invention provides a Bluetooth networking method, which adopts a mode of active inquiry of a Bluetooth base station and passive response of Bluetooth equipment, and is different from a scheme that a request and a reply are required in four steps of connection establishment, connection request, connection establishment and connection disconnection in the traditional Bluetooth connection process. The network access can be realized only by one-time response, the interactive flow between the Bluetooth base station and the Bluetooth equipment can be effectively reduced, data transmission is carried out by using the unique mark of the Bluetooth, the transmission quantity of data can be effectively reduced, the complexity of the processing flow of the Bluetooth equipment is reduced, the real-time performance of the Bluetooth data transmission is improved, and the effective network access of the Bluetooth equipment is ensured.
Based on the above embodiment, optionally, the bluetooth networking method further includes:
after receiving a second broadcast message sent by a Bluetooth base station, comparing whether the second broadcast message has a corresponding unique mark; if so, recording a packet number corresponding to the unique mark of the second broadcast message; wherein the second broadcast message carries a unique identifier and a corresponding packet number of a fourth bluetooth device; the fourth Bluetooth equipment is selected to be grouped according to a preset number;
completing grouping and replying the grouped broadcast message; for the bluetooth base station to determine that the bluetooth device has been grouped.
Specifically, after receiving a second broadcast message sent by the bluetooth base station, the bluetooth device compares whether the second broadcast message has a corresponding unique identifier.
If the Bluetooth base station finds that the unique mark corresponding to the Bluetooth base station exists in the second broadcast message, the Bluetooth base station records the packet number corresponding to the unique mark in the second broadcast message, the second broadcast message carries the unique mark and the corresponding packet number of the fourth Bluetooth device, and the fourth Bluetooth device is a Bluetooth device to be grouped and selected according to a preset number.
And finishing the grouping and replying the grouped broadcast message to the Bluetooth base station so that the Bluetooth base station can determine that the Bluetooth equipment is grouped.
The embodiment of the invention provides a Bluetooth networking method, which adopts a mode of active inquiry of a Bluetooth base station and passive response of Bluetooth equipment, and is different from a scheme that a request and a reply are required in four steps of connection establishment, connection request, connection establishment and connection disconnection in the traditional Bluetooth connection process. Network access and grouping can be realized only through one-time response, the interactive flow between a Bluetooth base station and Bluetooth equipment can be effectively reduced, data transmission is carried out through the unique mark of the Bluetooth, the transmission quantity of data can be effectively reduced, the complexity of the processing flow of the Bluetooth equipment is reduced, the real-time performance of Bluetooth data transmission is improved, the rapid and effective network access and grouping of the Bluetooth equipment are ensured, and the Bluetooth networking can be suitable for more occasions.
Based on the above embodiment, optionally, the bluetooth networking method further includes:
receiving a third broadcast message sent by a Bluetooth base station, and comparing whether the third broadcast message has a corresponding unique mark; the third broadcast message carries a unique mark and a network quitting instruction of a sixth Bluetooth device; the sixth Bluetooth equipment is selected to be quitted according to a preset number;
if the comparison is successful, replying the broadcast message of the quit network and finishing the quit network; for the bluetooth base station to determine that the bluetooth device has exited the network.
Specifically, the bluetooth device may also perform network logout after performing network access, and after receiving a third broadcast message sent by the bluetooth base station, the bluetooth device compares whether the third broadcast message has a unique identifier corresponding to the bluetooth device. And the third broadcast message carries a network quitting instruction and the unique mark of the Bluetooth equipment.
If the Bluetooth base station finds that the third broadcast message has the corresponding unique mark, the Bluetooth base station returns the network quitting broadcast message to the Bluetooth base station and finishes the network quitting; for the bluetooth base station to determine that the bluetooth device has exited the network.
The embodiment of the invention provides a Bluetooth networking method, which adopts a mode of active inquiry of a Bluetooth base station and passive response of Bluetooth equipment, and is different from a scheme that a request and a reply are required in four steps of connection establishment, connection request, connection establishment and connection disconnection in the traditional Bluetooth connection process. The Bluetooth device can realize network access, grouping and network quitting only through one-time response, can effectively reduce the interaction flow between the Bluetooth base station and the Bluetooth device, and can effectively reduce the data transmission amount by using the unique mark of the Bluetooth, reduce the complexity of the processing flow of the Bluetooth device, improve the real-time performance of Bluetooth data transmission, ensure the quick and effective network access, grouping and network quitting of the Bluetooth device, and improve the flexibility of Bluetooth networking application.
Based on the above embodiment, optionally, the bluetooth networking method further includes:
receiving a fourth broadcast message sent by a Bluetooth base station, and comparing whether the fourth broadcast message has a corresponding unique mark; the fourth broadcast message carries a unique mark and a group quitting instruction of the eighth Bluetooth device; the eighth Bluetooth device is a Bluetooth device to be quitted, which is selected according to a preset number;
if the comparison is successful, replying the broadcast message of the group quit and finishing the group quit; for the bluetooth base station to determine that the bluetooth device has exited the group.
Specifically, the bluetooth device may also perform group quitting after performing grouping, and after receiving a fourth broadcast message sent by the bluetooth base station, the bluetooth device compares whether there is a unique identifier corresponding to the bluetooth device in the fourth broadcast message. The fourth broadcast message carries a group quitting instruction and a unique mark of the Bluetooth equipment.
If the Bluetooth base station finds that the fourth broadcast message has the unique mark corresponding to the Bluetooth base station, the Bluetooth base station returns the broadcast message for group quitting and finishes the group quitting; for the bluetooth base station to determine that the bluetooth device has exited the group.
The embodiment of the invention provides a Bluetooth networking method, which adopts a mode of active inquiry of a Bluetooth base station and passive response of Bluetooth equipment, and is different from a scheme that a request and a reply are required in four steps of connection establishment, connection request, connection establishment and connection disconnection in the traditional Bluetooth connection process. The Bluetooth data transmission system can realize network access, grouping, group quitting and network quitting only through one-time response, can effectively reduce the interaction flow between the Bluetooth base station and the Bluetooth equipment, and carry out data transmission through the unique mark using the Bluetooth, can effectively reduce the transmission quantity of data, reduce the complexity of the processing flow of the Bluetooth equipment, improve the real-time performance of the Bluetooth data transmission, ensure that the Bluetooth equipment can quickly and effectively access to the network, group quit and network quit, and improve the real-time performance of the Bluetooth data transmission while ensuring the safety performance of the Bluetooth, so that the Bluetooth data transmission system can be suitable for more occasions with higher requirements on real-time performance.
Based on the above embodiments, optionally, in the bluetooth networking method,
the Bluetooth equipment which has finished networking can receive any broadcast message from the Bluetooth base station connected with the Bluetooth equipment, and filters the broadcast of the non-Bluetooth base station by adopting a mode of setting a bottom white list of Bluetooth.
Specifically, the white list of the bottom layer is used as a security mechanism in the BLE protocol, and is actually a group of bluetooth addresses, in this embodiment, when the bluetooth base station broadcasts the access information, the first broadcast message carries the unique identifier of the bluetooth device and the mac address of the bluetooth base station.
When the Bluetooth base station accesses the network, the mac address of the Bluetooth base station can be added into the bottom white list so as to achieve the purposes of receiving any broadcast message from the connected Bluetooth base station and filtering the broadcast of the non-Bluetooth base station.
The embodiment of the invention provides a Bluetooth networking method, which adopts a mode of active inquiry of a Bluetooth base station and passive response of Bluetooth equipment, and is different from a scheme that a request and a reply are required in four steps of connection establishment, connection request, connection establishment and connection disconnection in the traditional Bluetooth connection process. The interactive flow between the bluetooth basic station and the bluetooth equipment can be effectively reduced, and data transmission is carried out through the unique mark using the bluetooth, so that the transmission quantity of data can be effectively reduced, the complexity of the processing flow of the bluetooth equipment is reduced, the real-time performance of bluetooth data transmission is improved, and the effective networking, grouping and network quitting of the bluetooth equipment are ensured. Through setting up bottom white list, realize carrying out filterable purpose to the broadcast of non-bluetooth basic station, guarantee information transmission's security.
The following describes an embodiment of the present invention with reference to a specific application scenario of a train:
the Bluetooth base station installed in the classroom and the Bluetooth intelligent student card carried by the students are used in attendance checking, interactive answering and grouping competition scenes.
Scene one: work attendance
Before class, the Bluetooth base station sends the broadcast message carrying the unique mark of the Bluetooth intelligent student card and the mac address of the Bluetooth base station through the network access method, the Bluetooth intelligent student card carried by the student acquires the broadcast message, performs network access connection, and feeds back the network-accessed broadcast message to the Bluetooth base station (first connection).
If the Bluetooth intelligent student card is connected before, after the Bluetooth equipment adds the mac address of the Bluetooth base station into the bottom white list, the Bluetooth intelligent student card can be automatically accessed to the network according to the class white list.
The teacher utilizes the bluetooth basic station to judge student's rate of attendance according to the condition that bluetooth intelligence student's card was networked, also can initiatively initiate the attendance through connecting the bluetooth basic station through cell-phone app, acquires student's rate of attendance.
Scene two: interactive answering question
When the students answer the questions interactively, teachers connect the Bluetooth base station through the mobile phone app to initiate answering tasks (for example, selecting or judging the questions), the Bluetooth intelligent student card is enabled to enter an answering mode rapidly in a mode of broadcasting the personnel in the network (other classes of students outside the network cannot enter the answering mode), the Bluetooth base station enters a monitoring mode, after the students answer the questions, the Bluetooth base station can receive answering results fed back by the Bluetooth intelligent student card, the Bluetooth base station reports the mobile phone app after counting, and the teachers can obtain effective data such as answering results/time in real time according to the mobile phone to know the learning conditions of the students.
It should be noted that the specific number of the bluetooth devices that the bluetooth base station can maximally carry access to the network is related to the product type of the bluetooth base station and the number of obstacles in the use environment, and this embodiment is not limited herein.
Scene three: group competition
The teacher groups students, plans out a group list, uploads the group list to the mobile phone app, the Bluetooth base station automatically downloads the group list in the mobile phone app, and the Bluetooth base station groups the Bluetooth intelligent student cards which are accessed to the network according to the group list. After grouping is finished, the Bluetooth base station can issue questions aiming at the specified grouping, or realize operations such as multi-group answering and the like.
It should be noted that, this embodiment only describes a specific application scenario of a bluetooth networking method, and the method may also be applied to other occasions, which is not limited in this embodiment and is not described herein again.
Fig. 3 is a schematic structural diagram of a bluetooth networking system according to an embodiment of the present invention, and as shown in fig. 3, the bluetooth networking system includes:
at least one bluetooth base station capable of executing the bluetooth networking method, and at least one bluetooth device capable of executing the bluetooth networking method.
Specifically, fig. 3 only describes a situation where one bluetooth base station is connected to 8 bluetooth devices, which is only an optional connection manner in this embodiment, in addition, the number of bluetooth devices may be increased or decreased, the system may also include a plurality of bluetooth base stations, and the specific settings thereof may be adjusted according to actual situations, which is not limited in this embodiment.
In this embodiment, the bluetooth base station and the bluetooth device are configured to execute the corresponding bluetooth networking method, and a specific implementation manner of the bluetooth base station and the bluetooth device is consistent with the bluetooth networking method described above, which is not described herein again.
The embodiment of the invention provides a Bluetooth networking system, which adopts a mode of active inquiry of a Bluetooth base station and passive response of Bluetooth equipment, and is different from a scheme that in the traditional Bluetooth connection process, four steps of connection establishment, connection request establishment and connection disconnection all need request and reply. The interactive flow between the bluetooth basic station and the bluetooth equipment can be effectively reduced, and data transmission is carried out through the unique mark using the bluetooth, so that the transmission quantity of data can be effectively reduced, the complexity of the processing flow of the bluetooth equipment is reduced, the real-time performance of bluetooth data transmission is improved, and the effective networking, grouping and network quitting of the bluetooth equipment are ensured. Through setting up bottom white list, realize carrying out filterable purpose to the broadcast of non-bluetooth basic station, guarantee information transmission's security.
Fig. 4 is a schematic entity structure diagram of an electronic device according to an embodiment of the present invention, and as shown in fig. 4, the electronic device may include: a processor (processor)410, a communication Interface 420, a memory (memory)430 and a communication bus 440, wherein the processor 410, the communication Interface 420 and the memory 430 are communicated with each other via the communication bus 440. The processor 410 may invoke logic instructions in the memory 430 to perform the various steps of the bluetooth networking method described above. For example: the method comprises the steps of obtaining a unique mark of a first Bluetooth device to be networked, adding the unique mark of the first Bluetooth device to be networked into a first queue, wherein the first queue is used for recording the unique mark of the first Bluetooth device to be networked; selecting second Bluetooth equipment from the first queue according to a preset number, generating a first broadcast message according to the unique mark of the selected second Bluetooth equipment and the mac address of the Bluetooth base station, and broadcasting the first broadcast message; after receiving the first broadcast message, the Bluetooth device compares whether the first broadcast message has a corresponding unique mark; and receiving a broadcast message which is replied by the second Bluetooth device and has accessed to the network, determining that the second Bluetooth device has accessed to the network, and removing the unique mark of the second Bluetooth device which has accessed to the network from the first queue.
In addition, the logic instructions in the memory 430 may be implemented in the form of software functional units and stored in a computer readable storage medium when the software functional units are sold or used as independent products. Based on such understanding, the technical solution of the present invention may be embodied in the form of a software product, which is stored in a storage medium and includes instructions for causing a computer device (which may be a personal computer, a server, or a network device) to execute all or part of the steps of the method according to the embodiments of the present invention. And the aforementioned storage medium includes: a U-disk, a removable hard disk, a Read-Only Memory (ROM), a Random Access Memory (RAM), a magnetic disk or an optical disk, and other various media capable of storing program codes.
In another aspect, an embodiment of the present invention further provides a non-transitory computer-readable storage medium, on which a computer program is stored, where the computer program is executed by a processor to implement the bluetooth networking method provided in the foregoing embodiments. Examples include: the method comprises the steps of obtaining a unique mark of a first Bluetooth device to be networked, adding the unique mark of the first Bluetooth device to be networked into a first queue, wherein the first queue is used for recording the unique mark of the first Bluetooth device to be networked; selecting second Bluetooth equipment from the first queue according to a preset number, generating a first broadcast message according to the unique mark of the selected second Bluetooth equipment and the mac address of the Bluetooth base station, and broadcasting the first broadcast message; after receiving the first broadcast message, the Bluetooth device compares whether the first broadcast message has a corresponding unique mark; and receiving a broadcast message which is replied by the second Bluetooth device and has accessed to the network, determining that the second Bluetooth device has accessed to the network, and removing the unique mark of the second Bluetooth device which has accessed to the network from the first queue.
The above-described embodiments of the apparatus are merely illustrative, and the units described as separate parts may or may not be physically separate, and parts displayed as units may or may not be physical units, may be located in one place, or may be distributed on a plurality of network units. Some or all of the modules may be selected according to actual needs to achieve the purpose of the solution of the present embodiment. One of ordinary skill in the art can understand and implement it without inventive effort.
Through the above description of the embodiments, those skilled in the art will clearly understand that each embodiment can be implemented by software plus a necessary general hardware platform, and certainly can also be implemented by hardware. With this understanding in mind, the above-described technical solutions may be embodied in the form of a software product, which can be stored in a computer-readable storage medium such as ROM/RAM, magnetic disk, optical disk, etc., and includes instructions for causing a computer device (which may be a personal computer, a server, or a network device, etc.) to execute the methods described in the embodiments or some parts of the embodiments.
Finally, it should be noted that: the above examples are only intended to illustrate the technical solution of the present invention, but not to limit it; although the present invention has been described in detail with reference to the foregoing embodiments, it will be understood by those of ordinary skill in the art that: the technical solutions described in the foregoing embodiments may still be modified, or some technical features may be equivalently replaced; and such modifications or substitutions do not depart from the spirit and scope of the corresponding technical solutions of the embodiments of the present invention.

Claims (11)

1. A Bluetooth networking method, comprising:
the method comprises the steps of obtaining a unique mark of a first Bluetooth device to be networked, adding the unique mark of the first Bluetooth device to be networked into a first queue, wherein the first queue is used for recording the unique mark of the first Bluetooth device to be networked;
selecting second Bluetooth equipment from the first queue according to a preset number, generating a first broadcast message according to the unique mark of the selected second Bluetooth equipment and the mac address of the Bluetooth base station, and broadcasting the first broadcast message; after receiving the first broadcast message, the Bluetooth device compares whether the first broadcast message has a corresponding unique mark;
and receiving a broadcast message which is replied by the second Bluetooth device and has accessed to the network, determining that the second Bluetooth device has accessed to the network, and removing the unique mark of the second Bluetooth device which has accessed to the network from the first queue.
2. The bluetooth networking method according to claim 1, further comprising:
and moving the unique mark of the second Bluetooth device to the end of the first queue when the network-accessed broadcast message replied by the second Bluetooth device is not received in the first period.
3. The bluetooth networking method according to claim 2, further comprising:
and judging whether the first queue is an empty queue, when the first queue is not the empty queue, re-executing the steps of selecting second Bluetooth equipment from the first queue according to a preset number, generating a first broadcast message according to the unique mark of the selected second Bluetooth equipment and the mac address of the Bluetooth base station, and broadcasting the first broadcast message.
4. The bluetooth networking method according to any one of claims 1 to 3, further comprising:
the unique mark and the corresponding packet number of the third Bluetooth device to be grouped are obtained, and the unique mark and the corresponding packet number of the third Bluetooth device to be grouped are added into a second queue, wherein the second queue is used for recording the unique mark and the corresponding packet number of the third Bluetooth device to be grouped;
selecting fourth Bluetooth equipment from the second queue according to a preset number, generating a second broadcast message according to the unique mark of the selected fourth Bluetooth equipment and the corresponding packet number, and broadcasting the second broadcast message; after receiving the second broadcast message, the Bluetooth device compares whether the second broadcast message has a corresponding unique mark;
when receiving a grouped broadcast message replied by a fourth Bluetooth device in a second period, determining that the fourth Bluetooth device has been grouped, and removing the unique mark of the grouped fourth Bluetooth device and the corresponding group number from the second queue;
when the grouped broadcast message replied by the fourth Bluetooth device is not received in a second period, moving a group number corresponding to the unique mark of the fourth Bluetooth device to the tail of the second queue;
and judging whether the second queue is an empty queue, when the second queue is not the empty queue, re-executing the steps of selecting fourth Bluetooth equipment from the second queue according to the preset number, generating a second broadcast message according to the packet number corresponding to the unique mark of the selected fourth Bluetooth equipment, and broadcasting the second broadcast message.
5. The bluetooth networking method according to any one of claims 1 to 3, further comprising:
acquiring a unique mark and a network quitting instruction of a fifth Bluetooth device to be quitted, and adding the unique mark of the fifth Bluetooth device to be quitted into a third queue, wherein the third queue is used for recording the unique mark of the fifth Bluetooth device to be quitted;
selecting sixth Bluetooth equipment from the third queue according to a preset number, generating a third broadcast message according to the unique mark and the network quitting instruction of the selected sixth Bluetooth equipment, and broadcasting the third broadcast message; after receiving the third broadcast message, the bluetooth device compares whether the third broadcast message has a corresponding unique mark;
when receiving a network quitting broadcast message replied by a sixth Bluetooth device in a third period, determining that the sixth Bluetooth device has quitted the network, and removing the unique mark of the sixth Bluetooth device which has quitted the network from the third queue;
when the quitted network broadcast message replied by the sixth Bluetooth device is not received in a third period, moving the unique mark of the sixth Bluetooth device to the end of the third queue;
and judging whether the third queue is an empty queue, when the third queue is not the empty queue, re-executing the steps of selecting sixth Bluetooth equipment from the third queue according to the preset number, generating a third broadcast message according to the unique mark and the network quitting instruction of the selected sixth Bluetooth equipment, and broadcasting the third broadcast message.
6. The bluetooth networking method according to claim 4, further comprising:
acquiring a unique mark and a group quitting instruction of a seventh Bluetooth device to be quitted, and adding the unique mark of the seventh Bluetooth device to be quitted into a fourth queue, wherein the fourth queue is used for recording the unique mark of the seventh Bluetooth device to be quitted;
selecting eighth Bluetooth equipment from the fourth queue according to a preset number, generating a fourth broadcast message according to the unique mark and the group quitting instruction of the selected eighth Bluetooth equipment, and broadcasting the fourth broadcast message; after receiving the fourth broadcast message, the bluetooth device compares whether the fourth broadcast message has a corresponding unique mark;
when receiving a broadcast message of a group quitting replied from an eighth Bluetooth device in a fourth period, determining that the eighth Bluetooth device has quitted, and removing the unique mark of the eighth Bluetooth device which has quitted from the fourth queue;
when the broadcast message returned by the eighth Bluetooth device and returned by the eighth Bluetooth device is not received in a fourth period, moving the unique mark of the eighth Bluetooth device to the end of the fourth queue;
and judging whether the fourth queue is an empty queue, when the fourth queue is not the empty queue, re-executing the steps of selecting eighth Bluetooth equipment from the fourth queue according to the preset number, generating a fourth broadcast message according to the unique mark and the group quitting instruction of the selected eighth Bluetooth equipment, and broadcasting the fourth broadcast message.
7. A Bluetooth networking method, comprising:
receiving a first broadcast message sent by a Bluetooth base station, and comparing whether the first broadcast message has a corresponding unique mark; wherein the first broadcast message carries a unique identifier of the second Bluetooth device and a mac address of the Bluetooth base station; the second Bluetooth equipment is selected to be connected to the network according to a preset number;
if the comparison is successful, storing the mac address of the Bluetooth base station, completing the network access and replying the accessed broadcast message; for the bluetooth base station to determine that the bluetooth device has accessed the network.
8. The bluetooth networking method according to claim 7, further comprising:
after receiving a second broadcast message sent by a Bluetooth base station, comparing whether the second broadcast message has a corresponding unique mark; if so, recording a packet number corresponding to the unique mark of the second broadcast message; wherein the second broadcast message carries a unique identifier and a corresponding packet number of a fourth bluetooth device; the fourth Bluetooth equipment is selected to be grouped according to a preset number;
completing grouping and replying the grouped broadcast message; for the bluetooth base station to determine that the bluetooth device has been grouped.
9. The bluetooth networking method according to claim 7 or 8, further comprising:
receiving a third broadcast message sent by a Bluetooth base station, and comparing whether the third broadcast message has a corresponding unique mark; the third broadcast message carries a unique mark and a network quitting instruction of a sixth Bluetooth device; the sixth Bluetooth equipment is selected to be quitted according to a preset number;
if the comparison is successful, replying the broadcast message of the quit network and finishing the quit network; for the bluetooth base station to determine that the bluetooth device has exited the network.
10. The bluetooth networking method according to claim 7 or 8, further comprising:
receiving a fourth broadcast message sent by a Bluetooth base station, and comparing whether the fourth broadcast message has a corresponding unique mark; the fourth broadcast message carries a unique mark and a group quitting instruction of the eighth Bluetooth device; the eighth Bluetooth device is a Bluetooth device to be quitted, which is selected according to a preset number;
if the comparison is successful, replying the broadcast message of the group quit and finishing the group quit; for the bluetooth base station to determine that the bluetooth device has exited the group.
11. A bluetooth networking system, comprising:
at least one bluetooth base station capable of performing the bluetooth networking method of any one of claims 1 to 6, and at least one bluetooth device capable of performing the bluetooth networking method of any one of claims 7 to 10.
CN202010628364.XA 2020-07-01 2020-07-01 Bluetooth networking method and system Pending CN111885562A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202010628364.XA CN111885562A (en) 2020-07-01 2020-07-01 Bluetooth networking method and system

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202010628364.XA CN111885562A (en) 2020-07-01 2020-07-01 Bluetooth networking method and system

Publications (1)

Publication Number Publication Date
CN111885562A true CN111885562A (en) 2020-11-03

Family

ID=73149995

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202010628364.XA Pending CN111885562A (en) 2020-07-01 2020-07-01 Bluetooth networking method and system

Country Status (1)

Country Link
CN (1) CN111885562A (en)

Cited By (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112367654A (en) * 2020-11-06 2021-02-12 炬力(珠海)微电子有限公司 TWS equipment team forming method and device, electronic equipment and storage medium
CN112398828A (en) * 2020-11-04 2021-02-23 浙江瑞瀛物联科技有限公司 Quick network access method and system based on zigbee system
CN113163346A (en) * 2021-04-21 2021-07-23 成都锐成芯微科技股份有限公司 Broadcast packet filtering method and wireless communication system
CN113259860A (en) * 2021-06-15 2021-08-13 四川九通智路科技有限公司 Ad hoc network method based on Bluetooth broadcast communication
CN114423066A (en) * 2022-03-09 2022-04-29 深圳市爱图仕影像器材有限公司 Networking control method and device for data communication
CN115334486A (en) * 2022-10-18 2022-11-11 成都锐成芯微科技股份有限公司 Bluetooth communication method and Bluetooth system
CN117156597A (en) * 2023-01-20 2023-12-01 荣耀终端有限公司 Ad hoc network-based device processing method, device and storage medium

Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN106464556A (en) * 2015-03-03 2017-02-22 华为技术有限公司 Node networking method, apparatus and system
CN106878933A (en) * 2017-04-27 2017-06-20 厦门非泛科技有限公司 A kind of bluetooth equipment network-building method and system
CN107635215A (en) * 2017-08-25 2018-01-26 西安电子科技大学 Mesh network-building methods based on low-power consumption bluetooth
US20180160284A1 (en) * 2015-04-30 2018-06-07 Lg Electronics Inc. Method and device for transmitting/receiving data using bluetooth mesh network
CN110366153A (en) * 2019-07-17 2019-10-22 苏州佩林网络科技有限公司 A kind of method of bluetooth ad hoc network
CN111200805A (en) * 2018-11-19 2020-05-26 福建天泉教育科技有限公司 Bluetooth networking method and system based on Bluetooth equipment

Patent Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN106464556A (en) * 2015-03-03 2017-02-22 华为技术有限公司 Node networking method, apparatus and system
US20180160284A1 (en) * 2015-04-30 2018-06-07 Lg Electronics Inc. Method and device for transmitting/receiving data using bluetooth mesh network
CN106878933A (en) * 2017-04-27 2017-06-20 厦门非泛科技有限公司 A kind of bluetooth equipment network-building method and system
CN107635215A (en) * 2017-08-25 2018-01-26 西安电子科技大学 Mesh network-building methods based on low-power consumption bluetooth
CN111200805A (en) * 2018-11-19 2020-05-26 福建天泉教育科技有限公司 Bluetooth networking method and system based on Bluetooth equipment
CN110366153A (en) * 2019-07-17 2019-10-22 苏州佩林网络科技有限公司 A kind of method of bluetooth ad hoc network

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
宋丽华;张泽;李也白;: "基于RPL的蓝牙组网技术在智能家居的应用", 计算机工程与设计, no. 10 *

Cited By (9)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112398828A (en) * 2020-11-04 2021-02-23 浙江瑞瀛物联科技有限公司 Quick network access method and system based on zigbee system
CN112367654A (en) * 2020-11-06 2021-02-12 炬力(珠海)微电子有限公司 TWS equipment team forming method and device, electronic equipment and storage medium
CN112367654B (en) * 2020-11-06 2023-05-12 炬力(珠海)微电子有限公司 TWS equipment team forming method and device, electronic equipment and storage medium
CN113163346A (en) * 2021-04-21 2021-07-23 成都锐成芯微科技股份有限公司 Broadcast packet filtering method and wireless communication system
CN113259860A (en) * 2021-06-15 2021-08-13 四川九通智路科技有限公司 Ad hoc network method based on Bluetooth broadcast communication
CN114423066A (en) * 2022-03-09 2022-04-29 深圳市爱图仕影像器材有限公司 Networking control method and device for data communication
CN115334486A (en) * 2022-10-18 2022-11-11 成都锐成芯微科技股份有限公司 Bluetooth communication method and Bluetooth system
CN115334486B (en) * 2022-10-18 2023-03-03 成都锐成芯微科技股份有限公司 Bluetooth communication method and Bluetooth system
CN117156597A (en) * 2023-01-20 2023-12-01 荣耀终端有限公司 Ad hoc network-based device processing method, device and storage medium

Similar Documents

Publication Publication Date Title
CN111885562A (en) Bluetooth networking method and system
CN104869526B (en) A kind of communication of device-to-device and its resource allocation methods, equipment
CN104838597B (en) Adaptive channel reuse mechanism in communication network
CN103220752B (en) Method for equipment network access, access point, network access equipment and system
EP4213534A1 (en) Method and apparatus for performing sensing in wireless lan system
CN107079370A (en) A kind of signal strength measurement method and apparatus
CN110505618B (en) Service processing method and server
CN105940720B (en) It is a kind of to trigger the method for register machine protocol interaction, access point, website
CN109168171A (en) configuration information obtaining method, device, equipment and system
CN104540086A (en) Business card information transmission method and device
CN106507501A (en) A kind of Bluetooth connecting method and device
CN106559903A (en) End-to-end communication link establishing method, access point and website
CN106453370A (en) Method and device for allowing IPC to register to NVR
CN110519856A (en) The data transmission method and terminal of a kind of NB-IoT and base station
Mao et al. Mobile message board: Location-based message dissemination in wireless ad-hoc networks
CN111182611A (en) Communication method and device
JP2007288312A (en) Data collection method and data collection system using wireless lan
CN106780815A (en) A kind of register method and mobile terminal based on geographical position
CN112616171B (en) Communication method and device based on wireless local area network and computer readable storage medium
CN116249077B (en) Method and device for acquiring communication routing state of working group member
CN114698138A (en) Channel access method and device
CN111787431A (en) Centralized meter reading system of dual-mode networking communication technology and implementation method thereof
CN114666255B (en) Method for testing network distribution performance of Internet of things equipment and related equipment thereof
CN106686697B (en) The method of zigbee terminal device node administration
CN106850246A (en) The recognition methods of facility information and device

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination