Bluetooth base station addressing and message sending method in multi-base-station scene
By optimizing the data processing and message delivery methods of Bluetooth base stations and servers in multi-base station scenarios, the problem of Bluetooth message transmission failure in multi-base station scenarios is solved, and a higher success rate and efficiency are achieved.
Patent Information
- Application Number
- CN202411387784.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-10-07
- Publication Date
- 2025-01-07
AI Technical Summary
In multi-base station scenarios, it is difficult for the prior art to quickly and accurately determine the Bluetooth base station closest or optimal location to the target smart tag, resulting in a failure to send a message.
By establishing a data cache queue between the Bluetooth base station and the server, the data processing and uploading methods of the Bluetooth base station are optimized, and the base station with the connection state, the most recent scanning time or the largest signal strength is preferred for message dispatch, and moving average filtering and filtering are used. Mechanism reduces invalid data.
It improves the success rate of Bluetooth message issuance, ensuring that in multi-base station scenarios, the base station closest to the smart tag or optimal location can be quickly selected for message delivery.
Smart Images

Figure CN119277332A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of Bluetooth wireless communications, and in particular to a method for Bluetooth base station addressing and message sending in a multi-base station scenario. Background Art
[0002] Bluetooth is the most widely used near-field communication technology. In real life, many smart terminal devices are based on Bluetooth for data communication, such as wearable device bracelets, smart table signs, smart badges, etc., which can be collectively referred to as "smart tags". Under normal circumstances, smart tags communicate one-to-one with terminals such as smartphones through Bluetooth. However, in some special occasions, such as nursing homes, primary and secondary schools, factories, etc., it is not suitable for people to carry smartphones. At this time, third-party devices, such as Bluetooth base stations, are needed to achieve one-to-many or many-to-many communication with smart tags.
[0003] In the scenario where a Bluetooth base station communicates with a smart tag, a text message can be sent to the smart tag through the Bluetooth base station to realize functions such as information delivery, alarm notification, and work dispatch push. However, this requires that the base station and the smart tag are close to each other and the signal strength is high, otherwise it is easy to cause the delivery to fail. In addition, in this scenario, multiple base stations are usually deployed on site, but the system does not know which base station the smart tag is closest to, so a base station addressing method is needed in a multi-base station scenario that can quickly determine the base station closest to the target smart tag or the optimal location, and then send messages by establishing a Bluetooth connection.
[0004] In order to quickly and accurately send Bluetooth messages to target smart tags in a multi-base station scenario, the present invention proposes a method for Bluetooth base station addressing and message sending in a multi-base station scenario. Summary of the invention
[0005] In order to solve the problem of quickly determining the base station closest to or at the optimal position of a target smart tag when sending messages in a multi-base station scenario, the present invention proposes a method for Bluetooth base station addressing and message sending in a multi-base station scenario.
[0006] This technical solution is based on a multi-base station scenario. Specifically, multiple smart tags (such as wearable Bluetooth bracelets) that can receive Bluetooth messages are in a scenario where multiple Bluetooth base stations that comply with Bluetooth 4.2 or 5.0 protocols are deployed. The smart tags are configured on personnel or movable objects and are in a movable state; the Bluetooth base stations are deployed at fixed positions in the scenario. Smart tags broadcast Bluetooth signals at T0 intervals, and Bluetooth base stations scan and record the Bluetooth broadcast data of all detected smart tags. The Bluetooth base stations can actively establish connections with detected smart tags and send Bluetooth messages. Multiple Bluetooth base stations are converged to a network switch through a wired or wireless network, and the network switch is connected to a server, which installs and runs control software.
[0007] Based on the above scenario of multiple Bluetooth base stations, the present invention proposes a method for sending Bluetooth messages in a multi-base station scenario, which specifically includes:
[0008] The Bluetooth base station is provided with a data cache area, which contains a queue of all smart tag data scanned by the Bluetooth base station, denoted as queue S; the Bluetooth base station scans the broadcast data of the smart tag every second, and caches the scanned broadcast data and scanning time information into queue S, and the length of queue S is denoted as Ts seconds, that is, queue S caches the smart tag data and scanning time information scanned within the last Ts seconds; further, each group of smart tag data includes at least the smart tag MAC address, the received signal strength indicator RSSI (Received Signal Strength Index), and the most recent connection status; the Bluetooth base station updates queue S every second, and when the latest scanned smart tag already exists in queue S, the smart tag data and the most recent scanning time in queue S are updated; if there is smart tag data received for the first time, the smart tag data is added to queue S; if a smart tag data is not updated within Ts seconds, the smart tag data is removed from queue S.
[0009] The smart tag broadcasts data at an interval of T0, and the Bluetooth base station uploads all smart tag data in the queue S to the server control software at a fixed interval T, where T0=1s and T<=T0.
[0010] The server control software is provided with a smart tag data cache area. After the server control software receives all the smart tag data of queue S reported by the Bluetooth base station at interval T, it sets a cache data queue for each smart tag, which is recorded as the base station data queue Q of the tag; the queue Q is sorted according to the time reported by the Bluetooth base station that scanned the smart tag, and the data length of the queue Q is recorded as Tq; further, the queue Q includes at least the Bluetooth base station number that scanned the smart tag, the corresponding RSS I value scanned for the smart tag, the time of the most recent scan, and the most recent connection status.
[0011] After receiving the smart tag data reported by the Bluetooth base station at an interval T, the server control software updates the base station data queue Q of the tag. If there is a duplicate base station, the RSS I value, scanning time, and connection status of the smart tag scanned by the base station in queue Q will be updated; if there is base station reported data received for the first time, the base station data will be added to queue Q, and all base station data will be reordered according to the time when the smart tag was scanned.
[0012] In actual applications, the fluctuation of Bluetooth signals may cause the RSSI of a distant smart tag scanned by a Bluetooth base station to be larger than that of a nearby smart tag at a certain moment, or the Bluetooth base station may miss scanning some of the smart tags due to the large number of smart tags on site. Therefore, when the server control software wants to send a Bluetooth message to a specified smart tag, if it simply selects the Bluetooth base station with the largest RSSI value for the smart tag in the base station data queue Q of the smart tag, it may cause the sending to fail. Therefore, an optimized Bluetooth base station addressing method is further provided, and the specific steps are as follows:
[0013] Step 1: For the smart tag that needs to send Bluetooth messages, the server control software gives priority to the Bluetooth base station in the connected state in the base station data queue Q corresponding to the smart tag, immediately sends instructions and sends Bluetooth messages. If the sending is successful, the process ends; otherwise, it delays 2s and sends it again through the base station; if it is successful again through the base station, the process ends, otherwise, it goes to step 2; if there is no Bluetooth base station in the connected state in the base station data queue Q, it goes to step 2.
[0014] Step 2: The server control software selects the Bluetooth base station with the closest scanning time in the base station data queue Q corresponding to the smart tag to which the message needs to be sent, initiates a connection and sends the message; if the message is sent successfully, the process ends; if the message fails, the process proceeds to step 3;
[0015] Step 3: The server control software selects the Bluetooth base station with the largest RSS I value in the base station data queue Q corresponding to the smart tag that needs to send the message to connect and send. If successful, it ends; otherwise, it returns to step 2 and reselects the Bluetooth base station with the most recent scan time in the current queue to connect and send; if successful, it ends; if failed, it terminates this sending and returns that the reason for the sending failure is connection timeout. The Bluetooth base station with the most recent scan time in the queue is reselected because the Bluetooth base station data in the data queue Q of the tag may have been updated during the attempt to send.
[0016] Furthermore, in order to effectively control the Bluetooth base station cache size, the length of the data queue S of all smart tags in the Bluetooth base station data cache area is set to Ts seconds, which is set to be greater than or equal to the fixed interval T at which the Bluetooth base station uploads smart tag data, that is, Ts>=T.
[0017] Furthermore, a data queue S is set in the data buffer area of the Bluetooth base station for all scanned smart tags, and the length of Ts is set to 3 seconds, that is, Ts=3s.
[0018] Furthermore, the server control software sets the length Tq of each smart tag cache data queue Q in the smart tag data cache area, where Tq=10s, that is, the server control software reports the base station data of each smart tag for a maximum of 10s.
[0019] Furthermore, because the fluctuation of the Bluetooth signal may cause the RSS I of a distant smart tag scanned by the Bluetooth base station to be larger than the RSS I of a nearby smart tag at a certain moment, it is necessary to perform moving average filtering on the RSS I data in the smart tag data queue S in the Bluetooth base station. Specifically, the RSS I of the newly scanned smart tag and the RSS I of the smart tag with the same number saved in the queue S are averaged and then stored in the queue S as the latest RSSI data.
[0020] Furthermore, in order to reduce invalid data scanned, the Bluetooth base station is configured to filter based on the Bluetooth name field of the smart tag, so that only the smart tag data information that matches the Bluetooth name is uploaded to the server control software.
[0021] Furthermore, in order to reduce invalid data scanned, the Bluetooth base station is set to filter according to the Bluetooth MAC address segment of the smart tag. Specifically, only the smart tag data whose last 4 digits of the Bluetooth MAC are fixed number values is uploaded, so that only the smart tag data information that complies with the Bluetooth MAC address rules is uploaded to the server control software.
[0022] Furthermore, in order to reduce invalid data scanned, the Bluetooth base station sets an RSSI filtering mechanism to only upload data of smart tags scanned with RSSI values greater than or equal to -80dBm.
[0023] The present invention provides a method for optimizing Bluetooth message sending in a multi-base station scenario, through which the Bluetooth base station closest to a smart tag or at the optimal location can be effectively and quickly selected for message sending, thereby greatly improving the sending success rate. BRIEF DESCRIPTION OF THE DRAWINGS
[0024] Figure 1 A multi-base station scenario of a specific embodiment of the present invention includes a smart tag, a Bluetooth base station, a network switch, and a server, and control software runs on the server;
[0025] Figure 2 A schematic diagram of a smart tag data cache queue S of a Bluetooth base station according to a specific embodiment of the present invention;
[0026] Figure 3 A schematic diagram of a base station data queue Q of a smart tag M of a server control software according to a specific embodiment of the present invention. DETAILED DESCRIPTION
[0027] The following is a detailed description of an implementation method of a method for Bluetooth base station addressing and message sending in a multi-base station scenario provided by the present invention in conjunction with the accompanying drawings, specifically:
[0028] refer to Figure 1 , providing a scenario in which multiple Bluetooth base stations 2 compliant with Bluetooth 4.2 or 5.0 protocols are deployed. In this scenario, multiple smart tags 1 that can receive Bluetooth messages are in a movable state; the Bluetooth base station 2 is deployed at a fixed position in the scenario. The smart tag 1 broadcasts Bluetooth signals at T0 intervals, and the Bluetooth base station 2 scans and records the Bluetooth broadcast data of all detected smart tags 1. The Bluetooth base station 2 can actively establish a connection with the detected smart tag 1 and send Bluetooth messages. Multiple Bluetooth base stations 2 are converged to a network switch 3 through a wired or wireless network, and the network switch 3 is connected to a server 4 by wire. The server 4 has control software installed and running.
[0029] Based on the above scenario, a method for sending Bluetooth messages in a multi-base station scenario is provided. Figure 2 As shown, including:
[0030] The Bluetooth base station 2 is provided with a data cache area, which contains a data queue of all smart tags 1 scanned by the base station, denoted as queue S; the Bluetooth base station 2 scans the broadcast data of the smart tag 1 every second, and caches the scanned broadcast data and scanning time information into queue S, and the length of queue S is denoted as Ts seconds, that is, queue S caches the data and scanning time information of multiple smart tags 1 scanned within the last Ts seconds; further, the data of each smart tag 1 includes at least the Bluetooth MAC address of the smart tag 1, the strength indication of the received signal RSS I, and the most recent connection status; the Bluetooth base station 2 updates queue S every second, and when the latest scanned smart tag 1 already exists in queue S, the data of the smart tag 1 in queue S and the most recent scanning time are updated; if there is data of a smart tag 1 received for the first time, the data of the smart tag 1 is added to queue S; if the data of a smart tag 1 is not updated within Ts seconds, the data of the smart tag is removed from queue S.
[0031] The smart tag 1 broadcasts data at intervals of T0, and the Bluetooth base station 2 uploads the data of all smart tags 1 in the queue S to the server 4 running the control software at a fixed interval T, where T0=1s and T<=T0. Usually, T=300ms is set.
[0032] The control software of server 4 is provided with a data cache area for smart tag 1. After receiving all the smart tag 1 data in queue S reported by the Bluetooth base station 2 at interval T, the control software of server 4 sets a cache data queue for each smart tag 1, which is recorded as the base station data queue Q of the smart tag 1; the base station data queue Q is sorted according to the time reported by the Bluetooth base station that scanned the smart tag 1, and the data length of queue Q is recorded as Tq; further, queue Q includes at least the number of the Bluetooth base station 2 that scanned the smart tag 1, the RSS I value corresponding to the scan of the smart tag 1, the time of the most recent scan, and the most recent connection status.
[0033] After receiving the smart tag 1 data reported by the Bluetooth base station 2 at an interval T, the control software of the server 4 updates the base station data queue Q of the tag. If there is a duplicate base station, the RSS I value, scanning time, and connection status of the smart tag 1 scanned by the base station in the queue Q are updated; if there is base station reported data received for the first time, the base station data is added to the queue Q, and all base station data are reordered according to the time when the smart tag is scanned.
[0034] In actual applications, the fluctuation of the Bluetooth signal may cause the RSS I of the distant smart tag 1 scanned by the Bluetooth base station 2 to be larger than the RSS I of the nearby smart tag 1 at a certain moment, or the Bluetooth base station 2 may miss scanning some of the smart tags 1 due to the large number of smart tags 1 on site. Therefore, when the server 4 control software wants to send a Bluetooth message to a specified smart tag 1, if it simply selects the Bluetooth base station 2 with the largest RSS I value of the smart tag 1 scanned in the base station data queue Q of the smart tag 1, it may cause the sending to fail. Therefore, the following method is provided, and the specific steps are as follows:
[0035] Step 1: For the smart tag 1 that needs to send a Bluetooth message, the control software of the server 4 gives priority to the Bluetooth base station 2 that is in a connected state in the base station data queue Q corresponding to the smart tag 1, immediately sends an instruction and sends the Bluetooth message. If the sending is successful, the process ends; otherwise, the sending is sent again through the base station after a delay of 2s; if the sending is successful again through the base station, the process ends, otherwise, the process goes to step 2; if there is no Bluetooth base station 2 in a connected state in the base station data queue Q, the process goes to step 2.
[0036] Step 2: The control software of the server 4 selects the Bluetooth base station 2 with the nearest scanning time from the base station data queue Q corresponding to the smart tag 1 to which the message needs to be sent, initiates a connection and sends the message; if the message is sent successfully, the process ends; if the message fails, the process proceeds to step 3;
[0037] Step 3: The control software of server 4 selects the Bluetooth base station 2 with the largest RSSI value in the base station data queue Q corresponding to the smart tag that needs to send the message to connect and send. If successful, it ends; otherwise, it returns to step 2 and reselects the Bluetooth base station 2 with the most recent scan time in the current queue to connect and send; if successful, it ends; if failed, it terminates this sending and returns that the reason for the sending failure is connection timeout. The Bluetooth base station 2 with the most recent scan time in the queue is reselected because the Bluetooth base station 2 data in the data queue Q of the tag may have been updated during the attempt to send.
[0038] Furthermore, in order to effectively control the cache size of the Bluetooth base station 2, the length of the data queue S of all smart tags 1 in the data cache area of the Bluetooth base station 2 is set to Ts seconds, which is set to be greater than or equal to the fixed interval T at which the Bluetooth base station 2 uploads smart tag 1 data, that is, Ts>=T.
[0039] Furthermore, a data queue S is set in the data buffer area of the Bluetooth base station 2 for all scanned smart tags 1, and the length of Ts is set to 3 seconds, that is, Ts=3s.
[0040] Furthermore, the control software of server 4 sets the length Tq of the cache data queue Q of each smart tag 1 in the smart tag data cache area, where Tq=10s, that is, the control software of server 4 caches the base station data reported by each smart tag 1 for a maximum of 10s.
[0041] Furthermore, because the fluctuation of the Bluetooth signal may cause the RSSI of the distant smart tag 1 scanned by the Bluetooth base station 2 to be larger than the RSS I of the nearby smart tag at a certain moment, it is necessary to perform moving average filtering on the RSSI data in the smart tag data queue S in the Bluetooth base station. Specifically, the RSS I of the newly scanned smart tag 1 and the RSS I of the smart tag with the same number saved in the queue S are averaged and then stored in the queue S as the latest RSS I data.
[0042] Furthermore, in order to reduce invalid data scanned, the Bluetooth base station 2 is configured to filter based on the Bluetooth name field name of the smart tag 1, thereby only uploading data information of the smart tag 1 that matches the Bluetooth name to the server 4 control software.
[0043] Furthermore, in order to reduce invalid data scanned, the Bluetooth base station 2 is configured to filter according to the Bluetooth MAC address segment of the smart tag 1. Specifically, only the smart tag data whose last 4 digits of the Bluetooth MAC are fixed number values is uploaded, thereby only uploading the smart tag 1 data information that complies with the Bluetooth MAC address rules to the server 4 control software.
[0044] Furthermore, in order to reduce invalid scanned data, the Bluetooth base station 2 is provided with an RSS I filtering mechanism, and only uploads the scanned smart tag data whose RSS I value is greater than or equal to -80dBm.
[0045] Through the above method, the Bluetooth base station number closest to the smart tag can be effectively determined in a multi-base station scenario, thereby effectively improving the efficiency and success rate of sending Bluetooth messages.
[0046] The above is only a preferred embodiment of the present invention. It should be pointed out that ordinary technicians in this technical field can make several improvements and modifications without departing from the principle of the present invention. These improvements and modifications should also be regarded as the scope of protection of the present invention.
Claims
1. A method for addressing and sending messages of Bluetooth base stations in a multi-base station scenario, characterized in that: include: Provide a scene in which multiple Bluetooth base stations compliant with Bluetooth 4.2 or 5.0 protocol are deployed, and the Bluetooth base stations are deployed at fixed positions in the scene; provide multiple smart tags that can receive Bluetooth messages, and the smart tags are configured on personnel or movable objects and are in a movable state; the smart tags broadcast Bluetooth signals at T0 intervals, and the Bluetooth base stations scan and record all detected Bluetooth broadcast data of the smart tags, and the Bluetooth base stations can actively establish connections with the detected smart tags and send Bluetooth messages; the multiple Bluetooth base stations are all converged to a network switch through a wired or wireless network, and the network switch is wired to a server, and the server is installed with and runs control software; The Bluetooth base station is provided with a data cache area, and the cache area contains a queue of all smart tag data scanned by the Bluetooth base station, which is recorded as queue S; the Bluetooth base station scans the broadcast data of the smart tag every second, and caches the scanned broadcast data and scanning time information into queue S, and the length of queue S is recorded as Ts seconds, that is, queue S caches the smart tag data and scanning time information scanned within the last Ts seconds; further, each group of the smart tag data includes at least the smart tag MAC address, the received signal strength indication RSSI, and the most recent connection status; the Bluetooth base station updates queue S every second, and when the latest scanned smart tag already exists in queue S, the broadcast data and the most recent scanning time of the smart tag in queue S are updated; if there is smart tag data received for the first time, the smart tag data is added to queue S; If the broadcast data of a smart tag is not updated within Ts seconds, the data of the smart tag is removed from the queue S. The smart tag broadcasts data at intervals of T0, and the Bluetooth base station uploads all smart tag data in queue S to the server control software at fixed intervals of T; The server control software is provided with a smart tag data cache area. After receiving all the smart tag data of the queue S reported by the Bluetooth base station at an interval T, the server control software sets a cache data queue for each smart tag, which is recorded as the base station data queue Q of the tag; the queue Q is sorted according to the time reported by the Bluetooth base station that scanned the smart tag, and the data length of the queue Q is recorded as Tq; further, the queue Q includes at least the Bluetooth base station number that scanned the smart tag, the RSSI value corresponding to the smart tag scanned, the most recent scanning time, and the most recent connection status; After receiving the smart tag data reported by the Bluetooth base station at interval T, the server control software updates the base station data queue Q of the tag. If there is a duplicate base station, the RSSI value, scanning time, and connection status of the base station scanning the smart tag in the queue Q are updated; if there is base station reporting data received for the first time, the base station data is added to the queue Q, and all base station data are reordered according to the time when the smart tag is scanned; A method for addressing a Bluetooth base station and sending a message, the specific steps are as follows: Step 1: The server control software preferentially selects a connected Bluetooth base station in the base station data queue Q corresponding to the smart tag to which the Bluetooth message needs to be sent, and immediately sends a command and sends the Bluetooth message. If the sending is successful, the process ends; otherwise, the sending is repeated through the base station after a delay of 2 seconds; if the sending is successful again through the base station, the process ends; otherwise, the process proceeds to step 2; If there is no Bluetooth base station in the base station data queue Q that is in a connected state, go to step 2. Step 2: The server control software selects the Bluetooth base station with the closest scanning time in the base station data queue Q corresponding to the smart tag to which the message needs to be sent, initiates a connection and sends the message; if the message is sent successfully, the process ends; if the message fails, the process proceeds to step 3; Step 3: The server control software connects and sends the message to the Bluetooth base station with the largest RSSI value in the base station data queue Q corresponding to the smart tag to which the message needs to be sent. If successful, the process ends; otherwise, the server returns to step 2 and reselects the Bluetooth base station with the most recent scan time in the current queue for connection and sending. If successful, the process ends; if failed, the sending is terminated and the reason for the sending failure is returned as connection timeout.
2. The method for Bluetooth base station addressing and message sending in a multi-base station scenario according to claim 1, characterized in that: In order to effectively control the Bluetooth base station cache size, the length Ts seconds of all smart tag data queues S in the Bluetooth base station data cache area is set to be greater than or equal to the fixed interval T of the Bluetooth base station uploading smart tag data, that is, Ts>=T.
3. A method for Bluetooth base station addressing and message sending in a multi-base station scenario according to claim 2, characterized in that: The smart tag broadcasts data at an interval of T0, and the Bluetooth base station uploads all smart tag data in the queue S to the server control software at a fixed interval T, where T0=1s and T<=T0.
4. A method for Bluetooth base station addressing and message sending in a multi-base station scenario according to claim 2, characterized in that: The length Ts of all smart tag data queues S in the Bluetooth base station data buffer is set to 3 seconds, that is, Ts=3s.
5. A method for Bluetooth base station addressing and message sending in a multi-base station scenario according to claim 1, characterized in that: The server control software sets the length Tq of each smart tag cache data queue Q in the smart tag data cache area, where Tq=10s, that is, the server control software caches the base station data of the tag for each smart tag for a maximum of 10s.
6. A method for Bluetooth base station addressing and message sending in a multi-base station scenario according to claim 1, characterized in that: Perform moving average filtering on the RSSI data in the smart tag data queue S in the Bluetooth base station. Specifically, calculate the average value of the newly scanned smart tag RSSI and the RSSI of the smart tag with the same number saved in the queue S, and then store them in the queue S as the latest RSSI data.
7. A method for Bluetooth base station addressing and message sending in a multi-base station scenario according to claim 1, characterized in that: The Bluetooth base station is configured to filter according to the Bluetooth name field name of the smart tag, and only uploads the smart tag data information that matches the Bluetooth name to the server control software.
8. A method for Bluetooth base station addressing and message sending in a multi-base station scenario according to claim 1, characterized in that: The Bluetooth base station is configured to filter based on the Bluetooth MAC address segment of the smart tag, specifically, only upload the smart tag data whose last 4 digits of the Bluetooth MAC are fixed number values.
9. A method for Bluetooth base station addressing and message sending in a multi-base station scenario according to claim 1, characterized in that: The Bluetooth base station is provided with an RSSI filtering mechanism, and only uploads the smart tag data scanned with an RSSI value greater than or equal to -80dBm.