CN114268934A - BLE GATT-based flow control method, device and storage medium - Google Patents

BLE GATT-based flow control method, device and storage medium Download PDF

Info

Publication number
CN114268934A
CN114268934A CN202111608428.0A CN202111608428A CN114268934A CN 114268934 A CN114268934 A CN 114268934A CN 202111608428 A CN202111608428 A CN 202111608428A CN 114268934 A CN114268934 A CN 114268934A
Authority
CN
China
Prior art keywords
gatt
mqtt
message
pool
flow control
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
CN202111608428.0A
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.)
Shenzhen Skyworth Software Co Ltd
Original Assignee
Shenzhen Skyworth Software 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 Shenzhen Skyworth Software Co Ltd filed Critical Shenzhen Skyworth Software Co Ltd
Priority to CN202111608428.0A priority Critical patent/CN114268934A/en
Publication of CN114268934A publication Critical patent/CN114268934A/en
Pending legal-status Critical Current

Links

Images

Landscapes

  • Mobile Radio Communication Systems (AREA)

Abstract

The invention discloses a flow control method, equipment and a storage medium based on BLE GATT, wherein the method comprises the following steps: receiving a first Mqtt message sent by terminal equipment, and after classifying the first Mqtt message, performing de-duplication processing on a second Mqtt message obtained by classification; requesting at regular time and sending a second Mqtt message to a filter, and storing a third Mqtt message obtained by filtering in a GATT channel message pool; and sending the third Mqtt message in the GATT channel message pool to a GATT proxy device, so that the GATT proxy device forwards the third Mqtt message to each Mesh network device. Therefore, aiming at the application scene that the receiver can only process a limited number of PDUs in unit time, the flow control method is adopted to solve the problems of probabilistic message loss and non-real-time caused by excessive channel messages, and PDU transceiving events can be reliably transmitted and received in real time.

Description

BLE GATT-based flow control method, device and storage medium
Technical Field
The invention relates to the field of BLE Mesh networks, in particular to a flow control method and device based on BLE GATT and a computer readable storage medium.
Background
There are various reasons for unreliable BLE (Bluetooth Low Energy) Mesh messages of the GATT (Generic Attribute Profile Specification) channel, for example, the GATT channel messages may be lost due to interference of BLE devices by other signals, or congestion caused by too many GATT channel messages. Although BLE spreading and adaptive frequency hopping designs have solved most of the signal interference problems, the Mesh message of the GATT channel is not real-time, and because the receiver can only process a limited number of PDUs (Protocol Data units) in a Unit time, the number of GATT channel messages is large, which causes channel congestion, and thus the BLE Mesh message is unreliable. That is, when a user frequently issues commands at a client, the BLE Mesh network device receives too many messages in a short time, so that the user uses the BLE Mesh network device and the user's state is inconsistent with the user's intended state.
Disclosure of Invention
The invention mainly aims to provide a flow control method based on BLE GATT, and aims to solve the technical problems that the sending and receiving of the blade Mesh message based on the Gatt connection in the prior art are not real-time and unreliable.
In order to achieve the above object, the present invention provides a BLE GATT-based flow control method, including:
receiving a first Mqtt message sent by terminal equipment, and after classifying the first Mqtt message, performing de-duplication processing on a second Mqtt message obtained by classification;
requesting at regular time and sending a second Mqtt message to a filter, and storing a third Mqtt message obtained by filtering in a GATT channel message pool;
and sending the third Mqtt message in the GATT channel message pool to a GATT proxy device, so that the GATT proxy device forwards the third Mqtt message to each Mesh network device.
Optionally, the step of performing deduplication processing on the classified second Mqtt message includes:
and storing the second Mqtt message into a Map, and in the Map, performing deduplication processing by taking the serial number of the Mesh network device corresponding to the second Mqtt message as a key and an increment entity class of the Mesh network device as a value.
Optionally, the step of requesting and sending a second Mqtt message to the filter at a timing further includes:
when the classified second Mqtt message is received, a timing task is informed to request the second Mqtt message in the Map in real time, and the second Mqtt message is sent to a filter;
and if the number of the second Mqtt messages in the Map is larger than the threshold value of the GATT channel message pool, sending the second Mqtt messages with the threshold number of the GATT channel message pool from the Map to the filter.
Optionally, after the step of requesting and sending the second Mqtt message to the filter at the timing, the method further includes:
judging whether the target distribution equipment corresponding to the second Mqtt message is Mesh network equipment or not;
and if the target distribution equipment corresponding to the second Mqtt message is not Mesh network equipment, removing the second Mqtt message from the Map.
Optionally, after the step of determining whether the target distribution device corresponding to the second Mqtt message is a Mesh network device, the method further includes:
if the target distribution equipment corresponding to the second Mqtt message is Mesh network equipment, judging whether the monitored GATT agent equipment is online;
removing the second Mqtt message from the Map if the GATT agent device is not online.
Optionally, after the step of determining whether the intercepted GATT proxy device is online, the method further includes:
if the monitored GATT agent equipment is on line, judging whether the number of third Mqtt messages in the GATT channel message pool is larger than the threshold value of the GATT channel message pool or not;
and if the number of the third Mqtt messages in the GATT channel message pool is larger than the threshold value of the GATT channel message pool, executing the step of sending the third Mqtt messages in the GATT channel message pool to the GATT proxy device after the number of the third Mqtt messages in the GATT channel message pool is smaller than the threshold value of the GATT channel message pool.
Optionally, after the step of determining whether the number of third Mqtt messages in the GATT channel message pool is greater than the threshold of the GATT channel message pool, the method further includes:
if the number of the third Mqtt messages in the GATT channel message pool is not larger than the threshold value of the GATT channel message pool, judging whether the serial number key words and the increment entity class values of the third Mqtt messages are equal to the serial number key words and the increment entity class values of the corresponding target Mesh network equipment;
if not, executing the step of sending the third Mqtt message in the GATT channel message pool to a GATT agent device;
and if so, not executing the step of sending the third Mqtt message in the GATT channel message pool to the GATT proxy equipment, and removing the second Mqtt message from the Map.
Optionally, the BLE GATT-based flow control method further includes:
if one third Mqtt message is sent to the GATT agent device, adding one to the third Mqtt message quantity of the GATT channel message pool;
if the same third Mqtt message is received from the Mesh network device after the third Mqtt message is sent by the GATT channel message pool, reducing the number of the third Mqtt message of the GATT channel message pool by one, and removing the corresponding Mqtt message from the Map;
and if the number of the third Mqtt messages in the GATT channel message pool is equal to the threshold value of the GATT channel message pool, stopping sending the third Mqtt messages.
In addition, to achieve the above object, the present invention further provides a BLE GATT-based flow control device, including: a memory, a processor, and a BLE GATT-based flow control program stored on the memory and executable on the processor, the BLE GATT-based flow control program when executed by the processor implementing the steps of the BLE GATT-based flow control method as described above.
Furthermore, to achieve the above object, the present invention further provides a computer readable storage medium having a BLE GATT-based flow control program stored thereon, where the BLE GATT-based flow control program, when executed by a processor, implements the steps of the BLE GATT-based flow control method as described above.
According to the flow control method, the flow control equipment and the computer-readable storage medium based on the BLE GATT, firstly, after a first Mqtt message sent by terminal equipment is received, the first Mqtt message is classified to obtain a second Mqtt message, and the second Mqtt message is subjected to de-duplication processing; then, requesting at regular time and sending a second Mqtt message to a filter, filtering to obtain a third Mqtt message and storing the third Mqtt message in a GATT channel message pool; and finally, sending the third Mqtt message in the GATT channel message pool to the GATT proxy equipment so as to forward the third Mqtt message to each Mesh network equipment. Therefore, aiming at the application scene that the receiver can only process a limited number of PDUs in unit time, the flow control method is adopted to correspondingly process the unreliable real-time condition of the GATT channel message, the problems of probabilistic message loss and message real-time caused by excessive GATT channel message number can be effectively solved, and the PDU receiving and sending event can be effectively and reliably sent and received in real time.
Drawings
FIG. 1 is a schematic diagram of a hardware execution environment execution device according to an embodiment of the present invention;
figure 2 is a flow chart illustrating an embodiment of a BLE GATT-based flow control method according to the present invention;
figure 3 is a schematic diagram of another embodiment of the BLE GATT-based flow control method according to the present invention.
The implementation, functional features and advantages of the objects of the present invention will be further explained with reference to the accompanying drawings.
Detailed Description
It should be understood that the specific embodiments described herein are merely illustrative of the invention and are not intended to limit the invention.
Referring to fig. 1, fig. 1 is a schematic structural diagram of an operating device in a hardware operating environment according to an embodiment of the present invention.
As shown in fig. 1, the operation device may include: a processor 1001, such as a Central Processing Unit (CPU), a communication bus 1002, a user interface 1003, a network interface 1004, and a memory 1005. Wherein a communication bus 1002 is used to enable connective communication between these components. The user interface 1003 may include a Display screen (Display), an input unit such as a Keyboard (Keyboard), and the optional user interface 1003 may also include a standard wired interface, a wireless interface. The network interface 1004 may optionally include a standard wired interface, a WIreless interface (e.g., a WIreless-FIdelity (WI-FI) interface). The Memory 1005 may be a Random Access Memory (RAM) Memory, or may be a Non-Volatile Memory (NVM), such as a disk Memory. The memory 1005 may alternatively be a storage device separate from the processor 1001.
Those skilled in the art will appreciate that the configuration shown in FIG. 1 does not constitute a limitation of the operating device and may include more or fewer components than shown, or some components may be combined, or a different arrangement of components.
As shown in fig. 1, the memory 1005, which is a storage medium, may include therein an operating system, a data storage module, a network communication module, a user interface module, and a BLE GATT-based flow control program.
In the operating device shown in fig. 1, the network interface 1004 is mainly used for data communication with other devices; the user interface 1003 is mainly used for data interaction with a user; the processor 1001 and the memory 1005 in the running device of the present invention may be provided in a running device that calls a BLE GATT-based flow control program stored in the memory 1005 by the processor 1001 and performs the following operations:
receiving a first Mqtt message sent by terminal equipment, and after classifying the first Mqtt message, performing de-duplication processing on a second Mqtt message obtained by classification;
requesting at regular time and sending a second Mqtt message to a filter, and storing a third Mqtt message obtained by filtering in a GATT channel message pool;
and sending the third Mqtt message in the GATT channel message pool to a GATT proxy device, so that the GATT proxy device forwards the third Mqtt message to each Mesh network device.
Further, the processor 1001 may call a BLE GATT-based flow control program stored in the memory 1005, and also perform the following operations:
the step of performing deduplication processing on the classified second Mqtt message comprises the following steps:
and storing the second Mqtt message into a Map, and in the Map, performing deduplication processing by taking the serial number of the Mesh network device corresponding to the second Mqtt message as a key and an increment entity class of the Mesh network device as a value.
Further, the processor 1001 may call a BLE GATT-based flow control program stored in the memory 1005, and also perform the following operations:
the step of requesting and sending a second Mqtt message to the filter at a timing further comprises:
when the classified second Mqtt message is received, a timing task is informed to request the second Mqtt message in the Map in real time, and the second Mqtt message is sent to a filter;
and if the number of the second Mqtt messages in the Map is larger than the threshold value of the GATT channel message pool, sending the second Mqtt messages with the threshold number of the GATT channel message pool from the Map to the filter.
Further, the processor 1001 may call a BLE GATT-based flow control program stored in the memory 1005, and also perform the following operations:
after the step of requesting and sending a second Mqtt message to the filter at the timing, the method further comprises:
judging whether the target distribution equipment corresponding to the second Mqtt message is Mesh network equipment or not;
and if the target distribution equipment corresponding to the second Mqtt message is not Mesh network equipment, removing the second Mqtt message from the Map.
Further, the processor 1001 may call a BLE GATT-based flow control program stored in the memory 1005, and also perform the following operations:
after the step of determining whether the target distribution device corresponding to the second Mqtt message is a Mesh network device, the method further includes:
if the target distribution equipment corresponding to the second Mqtt message is Mesh network equipment, judging whether the monitored GATT agent equipment is online;
removing the second Mqtt message from the Map if the GATT agent device is not online.
Further, the processor 1001 may call a BLE GATT-based flow control program stored in the memory 1005, and also perform the following operations:
after the step of determining whether the intercepted GATT proxy device is online, the method further includes:
if the monitored GATT agent equipment is on line, judging whether the number of third Mqtt messages in the GATT channel message pool is larger than the threshold value of the GATT channel message pool or not;
and if the number of the third Mqtt messages in the GATT channel message pool is larger than the threshold value of the GATT channel message pool, executing the step of sending the third Mqtt messages in the GATT channel message pool to the GATT proxy device after the number of the third Mqtt messages in the GATT channel message pool is smaller than the threshold value of the GATT channel message pool.
Further, the processor 1001 may call a BLE GATT-based flow control program stored in the memory 1005, and also perform the following operations:
after the step of determining whether the number of third Mqtt messages in the GATT channel message pool is greater than the threshold of the GATT channel message pool, the method further includes:
if the number of the third Mqtt messages in the GATT channel message pool is not larger than the threshold value of the GATT channel message pool, judging whether the serial number key words and the increment entity class values of the third Mqtt messages are equal to the serial number key words and the increment entity class values of the corresponding target Mesh network equipment;
if not, executing the step of sending the third Mqtt message in the GATT channel message pool to a GATT agent device;
and if so, not executing the step of sending the third Mqtt message in the GATT channel message pool to the GATT proxy equipment, and removing the second Mqtt message from the Map.
Further, the processor 1001 may call a BLE GATT-based flow control program stored in the memory 1005, and also perform the following operations:
the BLE GATT-based flow control method further comprises:
if one third Mqtt message is sent to the GATT agent device, adding one to the third Mqtt message quantity of the GATT channel message pool;
if the same third Mqtt message is received from the Mesh network device after the third Mqtt message is sent by the GATT channel message pool, reducing the number of the third Mqtt message of the GATT channel message pool by one, and removing the corresponding Mqtt message from the Map;
and if the number of the third Mqtt messages in the GATT channel message pool is equal to the threshold value of the GATT channel message pool, stopping sending the third Mqtt messages.
An embodiment of the present invention provides a flow control method based on BLE GATT, and referring to fig. 2, fig. 2 is a schematic flowchart of a first embodiment of the flow control method based on BLE GATT according to the present invention.
In this embodiment, the BLE GATT-based flow control method includes:
step S10: and receiving a first Mqtt message sent by the terminal equipment, and after classifying the first Mqtt message, carrying out de-duplication processing on a second Mqtt message obtained by classification.
Many of the reliability issues to be solved by the bluetooth protocol stack stem from the use of radio as a carrier for data. However, there are other sources of reliability problems for wired communications. When a device sends data to another device, it sends the data through a series of data packets. If the receiving device is not able to process the packets fast enough, it may be forced to start dropping packets and the data they contain when the buffer reaches maximum capacity.
While flow control is the name given to various policies that ensure that data is communicated at a rate that can be accommodated by a receiving device or component, BLE (Bluetooth Low Energy) provides a simple form of flow control for the link layer. The first device may be allowed to retransmit the original packet at a later time by not updating the NESN (Next Expected Sequence Number) device when sending the reply. Since the original packet has already been received and processed, the retransmitted copies will be discarded, thus slowing the arrival of new packets that need to be completely processed. L2CAP (Logical Link Control and Adaptation Protocol) supports a variety of more complex flow Control modes, such as Enhanced credit flow Control mode (edfc), which is used with EATT (Enhanced Attribute Protocol).
Credit flow control is a special approach to solve this problem. In general (in the prior art), the working principle is as follows: the transmitting device knows the capabilities of the receiving device in terms of the number of PDUs (Protocol Data units) it can handle without losing Data (e.g., overflowing its buffer). The transmitter sets a counter based on the receiver capacity limit. The counter is decremented each time a PDU is sent by the transmitter. When the counter reaches zero, the transmitter knows that the receiver is fully loaded, so it temporarily stops sending PDUs and the receiver processes the backlogged PDUs. After the receiver reads and processes one or more PDUs from its buffer, it sends back the corresponding point number to the transmitter, which increments its counter with this value. When the counter is non-zero, the transmitter may continue to transmit further PDUs.
In this embodiment, referring to fig. 3, the Gateway (i.e., the transmitter) receives a first Mqtt (Message Queuing Telemetry Transport protocol) Message when each terminal, such as android, IOS, and Google Assistant (Google Assistant, supports functions of speech recognition, artificial intelligence, natural speech understanding, and the like), accesses the Mesh network, and classifies the first Mqtt Message.
If none of the PDUs sent to the receiver respond or are not with an acknowledgement, the transmitter cannot send data to the receiver any more, and can only wait for the PDU command to timeout to be removed from the GATT tunnel message pool, so that the transmitter delays in sending data more. So at the Mqtt connection in fig. 3: gateway classifies messages when receiving the first Mqtt message (PDU message in this embodiment), and messages related to Mesh network devices are stored in Map and flow control channel is further moved, while unacknowledged messages (other messages in fig. 3) are not moved. Therefore, the messages sent by the flow control channel are effective and reliable. And then, carrying out deduplication processing on the second Mqtt message obtained by classification in Map.
Step S20: and requesting at regular time and sending a second Mqtt message to the filter, and storing a third Mqtt message obtained by filtering in the GATT channel message pool.
To ensure message validity, in this embodiment, the flow control is implemented with a filter when sending data to the GATT proxy device to filter invalid PDU messages, as shown in fig. 3: and a filter process is set, when a timing task requests a second Mqtt message in Map, the second Mqtt message is sent to a filter, a third Mqtt message is obtained after filtering by the filter process shown in FIG. 3, and the third Mqtt message is sent to a GATT channel message pool for further forwarding operation.
Step S30: and sending the third Mqtt message in the GATT channel message pool to a GATT proxy device, so that the GATT proxy device forwards the third Mqtt message to each Mesh network device.
In this embodiment, the third Mqtt message in the GATT channel message pool is sent to the node device in the Mesh network: and the GATT proxy device forwards the third Mqtt message to other node devices in the Mesh network.
In this embodiment, first, after receiving a first Mqtt message sent by a terminal device, performing classification processing on the first Mqtt message to obtain a second Mqtt message, and performing deduplication processing on the second Mqtt message; then, requesting at regular time and sending a second Mqtt message to a filter, filtering to obtain a third Mqtt message and storing the third Mqtt message in a GATT channel message pool; and finally, sending the third Mqtt message in the GATT channel message pool to the GATT proxy equipment so as to forward the third Mqtt message to each Mesh network equipment. Therefore, aiming at the application scene that the receiver can only process a limited number of PDUs in unit time, the flow control method is adopted to correspondingly process the unreliable real-time condition of the GATT channel message, the problems of probabilistic message loss and message real-time caused by excessive GATT channel message number can be effectively solved, and the PDU receiving and sending event can be effectively and reliably sent and received in real time.
Optionally, the step of performing deduplication processing on the classified second Mqtt message includes:
and storing the second Mqtt message into a Map, and in the Map, performing deduplication processing by taking the serial number of the Mesh network device corresponding to the second Mqtt message as a key and an increment entity class of the Mesh network device as a value.
A buffer is temporary storage in a computer or microcontroller memory. Each protocol layer may require one or more buffers due to limited available memory. Each buffer has a maximum size. When a device sends data to another device, it sends the data through a series of secure packets. These packets are typically temporarily placed in a buffer after being received by other devices. The packet then passes up through various levels of the protocol stack, possibly temporarily staying in other buffers en route. If the rate at which packets arrive at the buffer exceeds the rate at which packets are removed from the buffer, the buffer eventually overflows and some packets are discarded. When this occurs, the data contained in these packets is lost and may be considered a communication failure.
In the present embodiment, Map is regarded as the above-mentioned cache area. Referring to fig. 3 at 1: the Gateway receives the second Mqtt message and stores the second Mqtt message in the Map. The Map takes the SN (Sequence Number) of the BLE Mesh network device as a key and the incremental entity class generated by the command set of the BLE Mesh network device as a value. The command set includes control instructions of various messages, such as a command for controlling the Mesh network device, a command for acquiring the version number of the Mesh network device, and the like. The entity class can be regarded as a subset of the command set, and one or more or even all commands in the command set are stored. For example, when a switch command of a Mesh network device is stored in the Map, and then a command for storing the version number of the Mesh network device is stored, it is equivalent to performing incremental processing on the command set, and storing the two command messages in an incremental entity class.
The specific duplication eliminating treatment steps are as follows: when a second Mqtt message for opening and closing a Mesh network device is continuously received in a short time, because the GATT channel message pool cannot be consumed or cannot be consumed, the last second Mqtt message covers the second Mqtt message for opening, closing and opening of the same SN keyword, only the data of the last second Mqtt message for closing the Mesh network device exists, and therefore, the last received message is taken as the standard, each BLE Mesh network device in the memory is ensured to have only one piece of data, and the deduplication processing is finished. By adding the duplication removal mechanism, when a client sends a large amount of data to Gateway, a user can effectively obtain an expected result of the BLE Mesh network device in real time.
Optionally, the step of requesting and sending a second Mqtt message to the filter at a timing further includes:
when the classified second Mqtt message is received, a timing task is informed to request the second Mqtt message in the Map in real time, and the second Mqtt message is sent to a filter;
and if the number of the second Mqtt messages in the Map is larger than the threshold value of the GATT channel message pool, sending the second Mqtt messages with the threshold number of the GATT channel message pool from the Map to the filter.
In the present embodiment, as at 2 in fig. 3: the timed task is to consume the second Mqtt message in the Map, requesting the Map one second round-robin. If the second Mqtt data exists, the second Mqtt data is consumed, and the filter process is followed downwards, namely the timed task real-time requests the second Mqtt message in the Map and sends the second Mqtt message to the filter process. And when the Gateway receives the first Mqtt message, the Gateway notifies the timed task to request the Map once, and ensures that the second Mqtt message in the Map is consumed in real time. If the number of the second Mqtt messages received by the Map is larger than the threshold value of the GATT channel message pool, only the messages with the threshold value size of the GATT channel message pool can be consumed at the beginning, and other messages can be sent after waiting for the empty position of the GATT channel message pool.
Optionally, after the step of requesting and sending the second Mqtt message to the filter at the timing, the method further includes:
judging whether the target distribution equipment corresponding to the second Mqtt message is Mesh network equipment or not;
and if the target distribution equipment corresponding to the second Mqtt message is not Mesh network equipment, removing the second Mqtt message from the Map.
In this embodiment, after the timed task requests and sends the second Mqtt message to the filter, it is determined whether the target distribution device corresponding to the second Mqtt message is a Mesh network device or not, and whether a Mesh network corresponding to the Mqtt message is configured. That is, in the device-related message (i.e., the second Mqtt message obtained by classifying and de-duplicating the first Mqtt message in step S10), it is determined whether the target distribution device corresponding to the second Mqtt message is a Mesh network device. If yes, the subsequent judgment process is carried out. If not, the second Mqtt message is removed from the Map.
Optionally, after the step of determining whether the target distribution device corresponding to the second Mqtt message is a Mesh network device, the method further includes:
if the target distribution equipment corresponding to the second Mqtt message is Mesh network equipment, judging whether the monitored GATT agent equipment is online;
removing the second Mqtt message from the Map if the GATT agent device is not online.
In this embodiment, if the target distribution device corresponding to the second Mqtt message obtained after classification and deduplication is a Mesh network device, it is then determined whether the monitored GATT proxy device is online. That is, if the monitored GATT proxy device is online, that is, the GATT proxy device is connected to the Mesh network device and the GATT proxy device is online, the subsequent determination process is performed. If not, the second Mqtt message is removed from the Map.
Optionally, after the step of determining whether the intercepted GATT proxy device is online, the method further includes:
if the monitored GATT agent equipment is on line, judging whether the number of third Mqtt messages in the GATT channel message pool is larger than the threshold value of the GATT channel message pool or not;
and if the number of the third Mqtt messages in the GATT channel message pool is larger than the threshold value of the GATT channel message pool, executing the step of sending the third Mqtt messages in the GATT channel message pool to the GATT proxy device after the number of the third Mqtt messages in the GATT channel message pool is smaller than the threshold value of the GATT channel message pool.
In this embodiment, if the target distribution device corresponding to the second Mqtt message obtained after classification and deduplication is Mesh network device and the monitored GATT proxy device is online, it is then determined whether the number of the third Mqtt messages in the GATT channel message pool is greater than the threshold of the GATT channel message pool.
A threshold value is set in the Gateway GATT channel message pool, which is set to 7 third Mqtt messages in this embodiment, but in other communication modes, such as a communication mode that does not use GATT as a carrier channel, but connects to a serial port or HTTP to a MESH network, the threshold value of the number of messages may be relatively large.
Optionally, after the step of determining whether the number of third Mqtt messages in the GATT channel message pool is greater than the threshold of the GATT channel message pool, the method further includes:
if the number of the third Mqtt messages in the GATT channel message pool is not larger than the threshold value of the GATT channel message pool, judging whether the serial number key words and the increment entity class values of the third Mqtt messages are equal to the serial number key words and the increment entity class values of the corresponding target Mesh network equipment;
if not, executing the step of sending the third Mqtt message in the GATT channel message pool to a GATT agent device;
and if so, not executing the step of sending the third Mqtt message in the GATT channel message pool to the GATT proxy equipment, and removing the second Mqtt message from the Map.
In this embodiment, if the target distribution device corresponding to the second Mqtt message obtained after classification and deduplication is Mesh network device, and the monitored GATT proxy device is online, and the number of the third Mqtt messages in the GATT channel message pool is not greater than the threshold value of the GATT channel message pool, it is determined whether the sequence number key and the incremental entity class value of the third Mqtt message are equal to the sequence number key and the incremental entity class value of the corresponding target Mesh network device. That is, the sent value is equal to the current value of the device, that is, the sent value is a status message for turning on the device, and the current on-off state of the device is in the on state, so that the corresponding second Mqtt message is removed from the Map without sending the on status message again. Only if the transmitted value is a status message to turn on the device and the current on-off state of the device is in the off state, or the transmitted value is a status message to turn off the device and the current on-off state of the device is in the on state, the on or off status message needs to be transmitted to the device. And if the sequence number key word and the increment entity class value of the third Mqtt message are not equal to the sequence number key word and the increment entity class value of the corresponding target Mesh network device, not processing the third Mqtt message, and performing a filter process on other Mqtt messages in the Map.
Optionally, the BLE GATT-based flow control method further includes:
if one third Mqtt message is sent to the GATT agent device, adding one to the third Mqtt message quantity of the GATT channel message pool;
if the same third Mqtt message is received from the Mesh network device after the third Mqtt message is sent by the GATT channel message pool, reducing the number of the third Mqtt message of the GATT channel message pool by one, and removing the corresponding Mqtt message from the Map;
and if the number of the third Mqtt messages in the GATT channel message pool is equal to the threshold value of the GATT channel message pool, stopping sending the third Mqtt messages.
In this embodiment, the GATT channel message pool is incremented by one piece of data each time the Gateway (i.e., transmitter) sends data to the GATT proxy device (i.e., receiver), but only after sending data to the receiver, is the message pool incremented by one piece of data, i.e., a piece of data is freed up to receive a new third Mqtt message. When the number of GATT channel message pools is equal to the set threshold value, the data can not be sent; when any piece of data in the GATT channel message pool is returned from the receiver, the message is removed from the message pool, and thus the number in the message pool is reduced once. Only one message is returned each time, the message can retrieve the command in the entity class according to the SN serial number, and then the covering processing is carried out. The Gateway can send data to the GATT proxy device again, and the more or all the receivers return, the more data the transmitter can send. Until the message pool threshold is reached, the transmitter may continue to send messages as long as it is no greater than the GATT channel message pool threshold.
In addition, an embodiment of the present invention further provides a BLE GATT-based flow control device, where the BLE GATT-based flow control device includes: a memory, a processor, and a BLE GATT-based flow control program stored on the memory and executable on the processor, the BLE GATT-based flow control program when executed by the processor implementing the steps of the BLE GATT-based flow control method as described above.
Furthermore, an embodiment of the present invention also provides a computer-readable storage medium, where a BLE GATT-based flow control program is stored on the computer-readable storage medium, and when executed by a processor, the BLE GATT-based flow control program implements the steps of the BLE GATT-based flow control method described above.
It should be noted that, in this document, the terms "comprises," "comprising," or any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, method, article, or system that comprises a list of elements does not include only those elements but may include other elements not expressly listed or inherent to such process, method, article, or system. Without further limitation, an element defined by the phrase "comprising an … …" does not exclude the presence of other like elements in a process, method, article, or system that comprises the element.
The above-mentioned serial numbers of the embodiments of the present invention are merely for description and do not represent the merits of the embodiments.
Through the above description of the embodiments, those skilled in the art will clearly understand that the method of the above embodiments can be implemented by software plus a necessary general hardware platform, and certainly can also be implemented by hardware, but in many cases, the former is a better implementation manner. 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 (e.g., ROM/RAM, magnetic disk, optical disk) as described above and includes instructions for enabling a terminal device (e.g., a mobile phone, a computer, a server, or a network device) to execute the method according to the embodiments of the present invention.
The above description is only a preferred embodiment of the present invention, and not intended to limit the scope of the present invention, and all modifications of equivalent structures and equivalent processes, which are made by using the contents of the present specification and the accompanying drawings, or directly or indirectly applied to other related technical fields, are included in the scope of the present invention.

Claims (10)

1. A BLE GATT-based flow control method, comprising the steps of:
receiving a first Mqtt message sent by terminal equipment, and after classifying the first Mqtt message, performing de-duplication processing on a second Mqtt message obtained by classification;
requesting at regular time and sending a second Mqtt message to a filter, and storing a third Mqtt message obtained by filtering in a GATT channel message pool;
and sending the third Mqtt message in the GATT channel message pool to a GATT proxy device, so that the GATT proxy device forwards the third Mqtt message to each Mesh network device.
2. The BLE GATT-based flow control method according to claim 1, wherein the step of de-duplicating the sorted second Mqtt message comprises:
and storing the second Mqtt message into a Map, and in the Map, performing deduplication processing by taking the serial number of the Mesh network device corresponding to the second Mqtt message as a key and an increment entity class of the Mesh network device as a value.
3. The BLE GATT-based flow control method of claim 2, wherein the step of timing the request and sending a second Mqtt message to a filter, further comprises:
when the classified second Mqtt message is received, a timing task is informed to request the second Mqtt message in the Map in real time, and the second Mqtt message is sent to a filter;
and if the number of the second Mqtt messages in the Map is larger than the threshold value of the GATT channel message pool, sending the second Mqtt messages with the threshold number of the GATT channel message pool from the Map to the filter.
4. The BLE GATT-based flow control method of claim 2, further comprising, after the step of requesting timing and sending a second Mqtt message to a filter:
judging whether the target distribution equipment corresponding to the second Mqtt message is Mesh network equipment or not;
and if the target distribution equipment corresponding to the second Mqtt message is not Mesh network equipment, removing the second Mqtt message from the Map.
5. The BLE GATT-based flow control method of claim 4, further comprising, after the step of determining whether the target distribution device to which the second Mqtt message corresponds is a Mesh network device:
if the target distribution equipment corresponding to the second Mqtt message is Mesh network equipment, judging whether the monitored GATT agent equipment is online;
removing the second Mqtt message from the Map if the GATT agent device is not online.
6. The BLE GATT-based flow control method of claim 5, further comprising, after the step of determining whether the snooped GATT proxy device is online:
if the monitored GATT agent equipment is on line, judging whether the number of third Mqtt messages in the GATT channel message pool is larger than the threshold value of the GATT channel message pool or not;
and if the number of the third Mqtt messages in the GATT channel message pool is larger than the threshold value of the GATT channel message pool, executing the step of sending the third Mqtt messages in the GATT channel message pool to the GATT proxy device after the number of the third Mqtt messages in the GATT channel message pool is smaller than the threshold value of the GATT channel message pool.
7. The BLE GATT-based flow control method of claim 6, further comprising, after the step of determining whether the number of third Mqtt messages in the GATT channel message pool is greater than a threshold value for the GATT channel message pool:
if the number of the third Mqtt messages in the GATT channel message pool is not larger than the threshold value of the GATT channel message pool, judging whether the serial number key words and the increment entity class values of the third Mqtt messages are equal to the serial number key words and the increment entity class values of the corresponding target Mesh network equipment;
if not, executing the step of sending the third Mqtt message in the GATT channel message pool to a GATT agent device;
and if so, not executing the step of sending the third Mqtt message in the GATT channel message pool to the GATT proxy equipment, and removing the second Mqtt message from the Map.
8. The BLE GATT-based flow control method of any one of claims 1 to 7, further comprising:
if one third Mqtt message is sent to the GATT agent device, adding one to the third Mqtt message quantity of the GATT channel message pool;
if the same third Mqtt message is received from the Mesh network device after the third Mqtt message is sent by the GATT channel message pool, reducing the number of the third Mqtt message of the GATT channel message pool by one, and removing the corresponding Mqtt message from the Map;
and if the number of the third Mqtt messages in the GATT channel message pool is equal to the threshold value of the GATT channel message pool, stopping sending the third Mqtt messages.
9. A BLE GATT-based flow control device, comprising: memory, a processor and a BLE GATT-based flow control program stored on the memory and executable on the processor, the BLE GATT-based flow control program being configured to implement the steps of the BLE GATT-based flow control method according to any one of claims 1 to 8.
10. A computer readable storage medium, having stored thereon a BLE GATT-based flow control program which, when executed by a processor, implements the steps of the BLE GATT-based flow control method according to any one of claims 1 to 8.
CN202111608428.0A 2021-12-24 2021-12-24 BLE GATT-based flow control method, device and storage medium Pending CN114268934A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202111608428.0A CN114268934A (en) 2021-12-24 2021-12-24 BLE GATT-based flow control method, device and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202111608428.0A CN114268934A (en) 2021-12-24 2021-12-24 BLE GATT-based flow control method, device and storage medium

Publications (1)

Publication Number Publication Date
CN114268934A true CN114268934A (en) 2022-04-01

Family

ID=80830047

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202111608428.0A Pending CN114268934A (en) 2021-12-24 2021-12-24 BLE GATT-based flow control method, device and storage medium

Country Status (1)

Country Link
CN (1) CN114268934A (en)

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN109873904A (en) * 2019-03-05 2019-06-11 平安科技(深圳)有限公司 User of message status report process method, device and the storage medium of message push
CN111669732A (en) * 2019-03-06 2020-09-15 乐鑫信息科技(上海)股份有限公司 Method for filtering redundant data packets at nodes in bluetooth Mesh network
CN112017413A (en) * 2020-08-17 2020-12-01 苏州博联科技有限公司 Optimization method for Bluetooth Mesh remote control system
WO2021102735A1 (en) * 2019-11-27 2021-06-03 Oppo广东移动通信有限公司 Access control method and device for ble mesh apparatus, and storage medium

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN109873904A (en) * 2019-03-05 2019-06-11 平安科技(深圳)有限公司 User of message status report process method, device and the storage medium of message push
CN111669732A (en) * 2019-03-06 2020-09-15 乐鑫信息科技(上海)股份有限公司 Method for filtering redundant data packets at nodes in bluetooth Mesh network
WO2021102735A1 (en) * 2019-11-27 2021-06-03 Oppo广东移动通信有限公司 Access control method and device for ble mesh apparatus, and storage medium
CN112017413A (en) * 2020-08-17 2020-12-01 苏州博联科技有限公司 Optimization method for Bluetooth Mesh remote control system

Similar Documents

Publication Publication Date Title
KR101670642B1 (en) System and method for scheduling packet transmission on a client device
US7724750B2 (en) Expedited data transmission in packet based network
US20070133582A1 (en) Efficient send socket call handling by a transport layer
US20020059435A1 (en) Method and system for improving network performance using a performance enhancing proxy
JP2007089174A (en) Method and device for improving signal transmission rate in wireless communication system
US20080256271A1 (en) Methods and apparatus for reducing storage usage in devices
CN108270687B (en) Load balancing processing method and device
WO2022017529A1 (en) Data transmission method and system, electronic device, and storage medium
CN110875887A (en) MQTT protocol-based communication interaction method and communication interaction system
CN111314237A (en) Method, device and equipment for adjusting data packet transmission rate and readable storage medium
US20070291782A1 (en) Acknowledgement filtering
US9456325B2 (en) Transmission of a multimedia message doubled with the transmission of a text message
CN110266446B (en) Method and device for adjusting out-of-order time length based on SACK mode
CN109067506A (en) A kind of lightweight asynchronous message implementation method concurrent based on multi-slide-windows mouth
CN109586931B (en) Multicast method and terminal equipment
CN113783794A (en) Congestion control method and device
CN114268934A (en) BLE GATT-based flow control method, device and storage medium
CN111314961A (en) TCP transmission method, device and system
WO2008073493A2 (en) Methods and apparatus for reducing storage usage in devices
US8831008B1 (en) Reliable message delivery in mesh networks
JP4506430B2 (en) Application monitor device
CN115344405A (en) Data processing method, network interface card, electronic equipment and storage medium
CN110971535B (en) Communication congestion control method, device, equipment and storage medium
US20110238858A1 (en) Traffic shaping device
CN110912831B (en) TCP transmission method, device and storage medium

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