Disclosure of Invention
The application provides a data transmission method based on low-power-consumption Bluetooth, which aims to solve the problem that the time overhead and the power consumption overhead are large when the existing broadcaster equipment and the existing scanner equipment are in two-way communication.
The application provides a data transmission method based on low-power-consumption Bluetooth, which comprises the following steps:
receiving a low-power-consumption Bluetooth broadcast data packet sent by broadcaster equipment;
sending scanning request data to the broadcaster device for the Bluetooth Low energy broadcast data packet; wherein the scan request data is for instructing the broadcaster device to include data required by the scanner device in a scan response packet sent to the scanner device.
Optionally, the sending, to the broadcaster device, scanning request data for the bluetooth low energy broadcast data packet includes:
determining scanning request data according to the low-power-consumption Bluetooth broadcast data packet;
adding the scan request data to a scan request packet;
sending a scan request packet including the scan request data to the broadcaster device.
Optionally, the adding the scan request data to the scan request packet includes:
the scan request data is added to the scan request packet as a field of payload data of the scan request packet.
Optionally, the scan request data includes:
address information of data required by the scanner device.
Optionally, the scan request data further includes:
length information of a data structure corresponding to address information of data required by the scanner device;
type information corresponding to address information of data required by the scanner device.
Optionally, the method further includes:
receiving a scanning response packet sent by the broadcaster device; wherein the scanning response includes data required by the scanner device.
Optionally, the bluetooth low energy broadcast packet is a connectable non-directional broadcast packet or a scannable non-directional broadcast packet.
Optionally, the determining the scanning request data according to the bluetooth low energy broadcast data packet includes:
analyzing the low-power-consumption Bluetooth broadcast data packet to obtain an analysis result;
and determining the scanning request data according to the analysis result.
Optionally, the analyzing the bluetooth low energy broadcast data packet to obtain an analyzed result includes:
analyzing the low-power-consumption Bluetooth broadcast data packet to obtain data in a custom field in the low-power-consumption Bluetooth broadcast data packet;
the determining scan request data according to the result of the parsing includes: and determining the scanning request data according to the data in the custom field and the preset corresponding relation between the data in the custom field and the scanning request data.
The application also provides a data transmission method based on the low-power Bluetooth, which comprises the following steps:
sending a low-power Bluetooth broadcast data packet to the scanner device;
receiving scanning request data sent by the scanner device; wherein the scanning request data is used for indicating that the broadcaster equipment contains data required by the scanner equipment in a scanning response packet sent to the scanner equipment;
and sending a scanning response packet to the scanner equipment according to the scanning request data, wherein the scanning response packet comprises data required by the scanner equipment.
Optionally, sending a scan response packet to the scanner device according to the scan request data includes:
obtaining data required by the scanner device according to the scanning request data;
encapsulating data required by the scanner device into the scan response packet;
and sending a scanning response packet carrying data required by the scanner equipment to the scanner equipment.
Optionally, the broadcast data packet includes data for determining the scan request data.
This application provides a data transmission device based on bluetooth low energy in addition, includes:
the broadcast data packet receiving unit is used for receiving the low-power-consumption Bluetooth broadcast data packet sent by the broadcaster equipment;
a scanning request data sending unit, configured to send scanning request data to the broadcaster device for the bluetooth low energy broadcast data packet; wherein the scan request data is for instructing the broadcaster device to include data required by the scanner device in a scan response packet sent to the scanner device.
The present application additionally provides an electronic device comprising:
a processor; and
a memory for storing a program of a bluetooth low energy-based data transmission method, the apparatus performing the following steps after being powered on and running the program of the bluetooth low energy-based data transmission method through the processor:
receiving a low-power-consumption Bluetooth broadcast data packet sent by broadcaster equipment;
sending scanning request data to the broadcaster device for the Bluetooth Low energy broadcast data packet; wherein the scan request data is for instructing the broadcaster device to include data required by the scanner device in a scan response packet sent to the scanner device.
The present application further provides a storage device storing a program of a bluetooth low energy-based data transmission method, the program being executed by a processor to perform the steps of:
receiving a low-power-consumption Bluetooth broadcast data packet sent by broadcaster equipment;
sending scanning request data to the broadcaster device for the Bluetooth Low energy broadcast data packet; wherein the scan request data is for instructing the broadcaster device to include data required by the scanner device in a scan response packet sent to the scanner device.
This application provides a data transmission device based on bluetooth low energy in addition, includes:
the broadcast data packet sending unit is used for sending a low-power Bluetooth broadcast data packet to the scanner equipment;
a scanning request data receiving unit, configured to receive scanning request data sent by the scanner device; wherein the scanning request data is used for indicating that the broadcaster equipment contains data required by the scanner equipment in a scanning response packet sent to the scanner equipment;
and the scanning response packet sending unit is used for sending a scanning response packet to the scanner equipment according to the scanning request data, wherein the scanning response packet contains data required by the scanner equipment.
The present application additionally provides an electronic device comprising:
a processor; and
a memory for storing a program of a bluetooth low energy-based data transmission method, the apparatus performing the following steps after being powered on and running the program of the bluetooth low energy-based data transmission method through the processor:
sending a low-power Bluetooth broadcast data packet to the scanner device;
receiving scanning request data sent by the scanner device; wherein the scanning request data is used for indicating that the broadcaster equipment contains data required by the scanner equipment in a scanning response packet sent to the scanner equipment;
and sending a scanning response packet to the scanner equipment according to the scanning request data, wherein the scanning response packet comprises data required by the scanner equipment.
The present application additionally provides a memory device, characterized in that,
a program storing a bluetooth low energy based data transmission method, the program being executed by a processor to perform the steps of:
sending a low-power Bluetooth broadcast data packet to the scanner device;
receiving scanning request data sent by the scanner device; wherein the scanning request data is used for indicating that the broadcaster equipment contains data required by the scanner equipment in a scanning response packet sent to the scanner equipment;
and sending a scanning response packet to the scanner equipment according to the scanning request data, wherein the scanning response packet comprises data required by the scanner equipment.
The present application further provides a data transmission method, including:
receiving a broadcast data packet sent by broadcaster equipment;
sending scan request data to the broadcaster device for the broadcast data packet; wherein the scan request data is for instructing the broadcaster device to include data required by the scanner device in a scan response packet sent to the scanner device.
The present application further provides a data transmission method, including:
transmitting a broadcast data packet to a scanner device;
receiving scanning request data sent by the scanner device; wherein the scanning request data is used for indicating that the broadcaster equipment contains data required by the scanner equipment in a scanning response packet sent to the scanner equipment;
and sending a scanning response packet to the scanner equipment according to the scanning request data, wherein the scanning response packet comprises data required by the scanner equipment.
Compared with the prior art, the method has the following advantages:
the application provides a data transmission method based on low-power-consumption Bluetooth.A scanner device sends scanning request data to a broadcaster device aiming at a low-power-consumption Bluetooth broadcast data packet after receiving the low-power-consumption Bluetooth broadcast data packet sent by the broadcaster device; because the scanning request data is used for indicating the broadcaster equipment to include the data required by the scanner equipment in the scanning response packet sent to the scanner equipment, under the condition that the connection between the broadcaster equipment and the scanner equipment is not established, the bidirectional communication between the broadcaster equipment and the scanner equipment is realized in a broadcasting mode, and the time overhead and the power consumption overhead of establishing the connection are saved.
Detailed Description
In the following description, numerous specific details are set forth in order to provide a thorough understanding of the present application. This application is capable of implementation in many different ways than those herein set forth and of similar import by those skilled in the art without departing from the spirit of this application and is therefore not limited to the specific implementations disclosed below.
Some embodiments provided in the present application may be applied to a scenario of a broadcasting device and a scanning device, as shown in fig. 1A, which is a schematic diagram of an embodiment of an application scenario provided in the present application. The broadcasting equipment is an integrated cloud sensor, integrates sensors such as a temperature sensor, a CO2 sensor, a TVOC sensor and a formaldehyde sensor, and can be arranged in an intelligent home; the scanning device is a BLE gateway. Taking BLE gateway 1 to obtain data from the integrated cloud sensor as an example: step 1, broadcasting equipment sends broadcast data (referring to low-power-consumption Bluetooth broadcast data) to a BLE gateway; step 2, the BLE gateway 1 receives broadcast data; step 3, the BLE gateway 1 sends scanning request data to the broadcasting equipment (the scanning request data carries identification information of data which needs to be sent by the broadcasting equipment by the BLE gateway 1); step 4, the broadcasting equipment receives scanning request data sent by the BLE gateway 1; and step 5, the BLE gateway 1 sends a scanning response packet (the scanning response packet carries data required by the BLE gateway 1) to the scanning equipment. As shown in fig. 1B, which is a schematic diagram of another application scenario embodiment provided in the present application, the difference from the scenario of fig. 1A is that a many-to-many scenario is provided, and BLE gateways 1 to BLE gateway n can obtain data of any one of broadcasting devices 1 to broadcasting devices n. It should be noted that the above application scenario is only one embodiment of the application scenario, and this application scenario embodiment is provided to facilitate understanding of the bluetooth low energy based data transmission method of the present application, and is not used to limit the bluetooth low energy based data transmission method of the present application.
The first embodiment of the present application provides a data transmission method based on bluetooth low energy, and the execution subject is a scanner device. The following description is made with reference to fig. 1 to 3.
As shown in fig. 1, in step S101, a bluetooth low energy broadcast packet transmitted by a broadcaster apparatus is received.
The broadcaster device may comprise a broadcaster or a slave device. For example, the broadcaster device may be an integrated cloud sensing device, which integrates a temperature sensor, a CO2 sensor, a TVOC sensor, a formaldehyde sensor, and the like, and may be disposed in a smart home, and the like.
The scanning device may be a BLE gateway.
As shown in fig. 2, in step 201, the broadcaster device (Advertiser) sends the bluetooth low energy broadcast packet (ADV _ SCAN _ IND) to the Scanner device (Scanner), and the Scanner device receives the bluetooth low energy broadcast packet sent by the broadcaster device.
The bluetooth low energy broadcast packet may include: connectable non-directed broadcasting (Connectable non-directed broadcasting ADV _ IND) data packets, Scannable non-directed broadcasting (Scannable non-directed broadcasting ADV _ SCAN _ IND) data packets.
As shown in fig. 1, in step S102, the scan request data is sent to the broadcaster device for the bluetooth low energy broadcast data packet; wherein the scan request data is for instructing the broadcaster device to include data required by the scanner device in a scan response packet sent to the scanner device.
The scan request data may include: address information of data required by the scanner device. The method can also comprise the following steps: length information of a data structure corresponding to address information of data required by the scanner device, and type information corresponding to the address information of the data required by the scanner device. As shown in fig. 3, the AD Structure1 is a Data Structure of a part of scan request Data, and includes Length information (Length) of the AD Structure1, type information (AD type) of address information of Data required by a scanner device, and address information (AD Data) of Data required by the scanner device, where the AD type is 0xFF and may indicate a vendor-defined type.
The sending the scan request data to the broadcaster device for the bluetooth low energy broadcast data packet comprises:
determining scanning request data according to the broadcast data packet;
adding the scan request data to a scan request packet;
sending a scan request packet including the scan request data to the broadcaster device.
In an implementation, the scan request data may be added to the scan request packet, and the scan request packet containing the scan request data may be sent to the broadcaster device. As shown in fig. 2, the scanner device transmits a SCAN request packet including SCAN _ REQ and SCAN request DATA (SCAN _ REQ _ DATA) to the broadcaster device in step 202.
In specific implementation, when determining the scan request data according to the broadcast data packet, the scanner device may include the following two ways: the first mode is as follows: after the scanner equipment obtains the broadcast data packet, determining scanning request data according to service requirements; the second way is: after the scanner equipment obtains the broadcast data packet, analyzing the broadcast data packet to obtain an analysis result; and determining the scanning request data according to the analysis result.
The analyzing the broadcast data packet to obtain an analyzed result includes:
analyzing the broadcast data packet to obtain data in a custom field in the broadcast data packet;
the determining scan request data according to the result of the parsing includes: and determining the scanning request data according to the data in the custom field and the preset corresponding relation between the data in the custom field and the scanning request data.
The broadcast data packet can carry data of a custom field with the length not more than 31 bytes, the broadcaster device and the scanner device can agree with the corresponding relation between the data of the custom field and the scanning request data in advance, and the scanner device determines the scanning data according to the agreed corresponding relation between the data of the custom field and the scanning request data in advance. For example, the ADV _ SCAN _ IND custom field carries "AA BB CC DD", indicating that the scanner device is required to send a data; the ADV _ SCAN _ IND custom field carries "AA BB CC EE" indicating that the scanner device is required to send another type of data.
Adding the scan request data to a scan request packet, comprising:
the scan request data is added to the scan request packet as a field of payload data of the scan request packet.
In the existing bluetooth low energy protocol, SCAN _ REQ sent by the scanner device does not contain any valid data except for the address.
Payload data (Payload) of SCAN _ REQ is as follows:
where ScanA is the address of the scanner device and AdvA is the address of the broadcaster device.
On the basis of the existing bluetooth low energy protocol, in order to realize interaction between the broadcaster device and the scanner device through broadcast data, SCAN request data may be added to Payload data (Payload) of SCAN _ REQ. By adding scanning request data into Payload data (Payload) of SCAN _ REQ, effective data transmission from scanning Scanner to advertisement can be realized, and bidirectional data circulation between two communication parties is really realized. The modified Payload is shown below:
as an implementation manner, the first embodiment of the present application may further include:
receiving a scanning response packet sent by the broadcaster device; wherein the scanning response includes data required by the scanner device.
As shown in fig. 2, in step S203, the broadcaster device transmits a scanning response packet determined according to the scanning request data to the scanner device, and the scanner device receives the scanning response packet transmitted by the broadcaster device.
After the broadcaster device obtains the scan request data sent by the scanner device, the broadcaster device may parse the data required by the scanner device from the scan request data, encapsulate the data required by the scanner device into a scan response packet, and send the scan response packet to the scanner device, and the scanner device receives the scan response packet. In the first embodiment of the present application, the scanning response packet is not a layer of fixed data, but different scanning response packets are dynamically responded to the scanner device according to the scanning request data, so that bidirectional data communication between the broadcaster device and the scanner device is realized, and the problems of time overhead and power consumption overhead caused by establishing connection are avoided.
The following describes, by way of example, a procedure for implementing bidirectional data transmission between a broadcaster device and a scanner device using the method of the first embodiment of the present application.
An Advertiser device sends basic information ADV _ SCAN _ IND to a Scanner device; the scanner device, upon receipt, decides to let the broadcaster device return the values of the registers R7, R7000 and R70000, thus sending SCAN request DATA (SCAN _ REQ _ DATA) to the broadcaster device; the broadcaster device receives the SCAN request data, parses from it the values of the scanner device required registers R7, R7000 and R70000, assembles the values of the registers R7, R7000 and R70000 into a SCAN response packet (SCAN _ RSP) and sends it to the scanner device. The method comprises the following concrete steps:
as shown in fig. 2, in step 201, the advertisement sends basic information ADV _ SCAN _ IND to the Scanner;
as shown in fig. 2, at step 202, the Scanner determines that the value of adviveriser return registers R7, R7000 and R70000 is needed after receiving ADV _ SCAN _ IND. SCAN _ REQ _ DATA is then assembled as follows:
structure1 is: length is 3 (indicating that Structure1 is 3 bytes in Length); AD Type has a value of 0xFF (indicating vendor defined); AD Data is 07 (representing register 7).
Structure2 is: length is 4 (indicating that Structure2 is 4 bytes in Length); AD Type has a value of 0xFF (indicating vendor defined); AD Data is 1B58 (representing register 7000).
Structure3 is: length is 5 (indicating that Structure3 is 5 bytes in Length); AD Type has a value of 0xFF (indicating vendor defined); AD Data is 011170 (representing register 70000).
As shown in fig. 2, in step 203, the advertisement receives SCAN _ REQ _ DATA, parses the values of registers R7, R7000 and R70000 required by Scanner, and assembles the values of registers R7, R7000 and R70000 into SCAN _ RSP to be sent to Scanner.
In the first embodiment of the present application, after receiving the bluetooth low energy broadcast data packet sent by the broadcaster, the scanner device sends the scan request data to the broadcaster device for the bluetooth low energy broadcast data packet; because the scanning request data is used for indicating the broadcaster equipment to include the data required by the scanner equipment in the scanning response packet sent to the scanner equipment, under the condition that the connection between the broadcaster equipment and the scanner equipment is not established, the bidirectional communication between the broadcaster equipment and the scanner equipment is realized in a broadcasting mode, and the time overhead and the power consumption overhead of establishing the connection are saved.
The second embodiment of the present application provides a data transmission method based on bluetooth low energy, and the execution subject is a broadcaster device. This is explained below with reference to fig. 4.
As shown in fig. 4, in step S401, a bluetooth low energy broadcast packet is transmitted to the scanner device.
The scanner device may include a device for scanning broadcast or a master device.
As shown in fig. 2, in step 201, the broadcaster device (Advertiser) sends the bluetooth low energy broadcast packet (ADV _ SCAN _ IND) to the Scanner device (Scanner), and the Scanner device receives the bluetooth low energy broadcast packet sent by the broadcaster device.
The bluetooth low energy broadcast packet may include data for determining scan request data. The low-power-consumption Bluetooth broadcast data packet can carry data of a custom field with the length not more than 31 bytes, the broadcaster device and the scanner device can agree with the corresponding relation between the data of the custom field and the scanning request data in advance, and the scanner device determines the scanning data according to the agreed corresponding relation between the data of the custom field and the scanning request data in advance. For example, the ADV _ SCAN _ IND custom field carries "AA BB CC DD", indicating that the scanner device is required to send a data; the ADV _ SCAN _ IND custom field carries "AA BB CC EE" indicating that the scanner device is required to send another type of data.
As shown in fig. 4, in step S402, receiving scan request data sent by the scanner device; wherein the scan request data is for instructing the broadcaster device to include data required by the scanner device in a scan response packet sent to the scanner device.
The scan request data may include: address information of data required by the scanner device. The method can also comprise the following steps: length information of a data structure corresponding to address information of data required by the scanner device, and type information corresponding to the address information of the data required by the scanner device. As shown in fig. 3, the AD Structure1 is a Data Structure of a part of scan request Data, and includes Length information (Length) of the AD Structure1, type information (AD type) of address information of Data required by a scanner device, and address information (AD Data) of Data required by the scanner device, where the AD type is 0xFF and may indicate a vendor-defined type.
The receiving of the scan request data sent by the scanner device includes:
receiving a scanning response packet sent by the scanner device;
and obtaining the scanning request data from the scanning response packet.
As shown in fig. 2, in step 202, the scanner device transmits a SCAN request packet including SCAN _ REQ and SCAN request DATA (SCAN _ REQ _ DATA) to the broadcaster device, and after the broadcaster device receives the SCAN response packet, the SCAN request DATA may be parsed from the SCAN response packet.
As shown in fig. 4, in step S403, a scan response packet is sent to the scanner device according to the scan request data, and the scan response packet includes data required by the scanner device.
Sending a scan response packet to the scanner device according to the scan request data, including:
obtaining data required by the scanner device according to the scanning request data;
encapsulating data required by the scanner device into the scan response packet;
and sending a scanning response packet carrying data required by the scanner equipment to the scanner equipment.
Following the example of the first embodiment of the present application, as shown in fig. 2, after the administrator receives SCAN _ REQ _ DATA, the values of the registers R7, R7000 and R70000 required by the Scanner are parsed out, and then the values of the registers R7, R7000 and R70000 are assembled into a SCAN response packet (SCAN _ RSP) and sent to the Scanner.
In the second embodiment of the present application, the broadcaster device dynamically responds to the scanner device with different scanning response packets according to the scanning request data, and the scanning response packets are no longer a layer of fixed data, so that bidirectional data communication between the broadcaster device and the scanner device is achieved, and the problems of time overhead and power consumption overhead caused by establishing a connection are avoided.
Corresponding to the data transmission method based on the bluetooth low energy provided by the first embodiment of the present application, a third embodiment of the present application provides a data transmission device based on the bluetooth low energy.
As shown in fig. 5, the bluetooth low energy-based data transmission apparatus includes:
a broadcast packet receiving unit 501, configured to receive a low power consumption bluetooth broadcast packet sent by a broadcaster device;
a scan request data sending unit 502, configured to send scan request data to the broadcaster device for the bluetooth low energy broadcast data packet; wherein the scan request data is for instructing the broadcaster device to include data required by the scanner device in a scan response packet sent to the scanner device.
Optionally, the scan request data sending unit is specifically configured to:
determining scanning request data according to the low-power-consumption Bluetooth broadcast data packet;
adding the scan request data to a scan request packet;
sending a scan request packet including the scan request data to the broadcaster device.
Optionally, the scan request data sending unit is specifically configured to:
the scan request data is added to the scan request packet as a field of payload data of the scan request packet.
Optionally, the scan request data includes:
address information of data required by the scanner device.
Optionally, the scan request data further includes:
length information of a data structure corresponding to address information of data required by the scanner device;
type information corresponding to address information of data required by the scanner device.
Optionally, the apparatus further comprises:
a scanning response packet receiving unit for receiving a scanning response packet transmitted by the broadcaster device; wherein the scanning response includes data required by the scanner device.
Optionally, the bluetooth low energy broadcast packet is a connectable non-directional broadcast packet or a scannable non-directional broadcast packet.
Optionally, the scan request data sending unit is specifically configured to:
analyzing the low-power-consumption Bluetooth broadcast data packet to obtain an analysis result;
and determining the scanning request data according to the analysis result.
The scan request data sending unit is specifically configured to:
analyzing the low-power-consumption Bluetooth broadcast data packet to obtain data in a custom field in the low-power-consumption Bluetooth broadcast data packet;
the determining scan request data according to the result of the parsing includes: and determining the scanning request data according to the data in the custom field and the preset corresponding relation between the data in the custom field and the scanning request data.
It should be noted that, for the detailed description of the apparatus provided in the third embodiment of the present application, reference may be made to the related description of the first embodiment of the present application, and details are not described here again.
A fourth embodiment of the present application provides an electronic device corresponding to the bluetooth low energy-based data transmission method provided in the first embodiment of the present application.
As shown in fig. 6, the electronic device includes:
a processor 601; and
a memory 602 for storing a program of the bluetooth low energy-based data transmission method, the apparatus performing the following steps after being powered on and running the program of the bluetooth low energy-based data transmission method through the processor:
receiving a low-power-consumption Bluetooth broadcast data packet sent by broadcaster equipment;
sending scanning request data to the broadcaster device for the Bluetooth Low energy broadcast data packet; wherein the scan request data is for instructing the broadcaster device to include data required by the scanner device in a scan response packet sent to the scanner device.
Optionally, the sending, to the broadcaster device, scanning request data for the bluetooth low energy broadcast data packet includes:
determining scanning request data according to the low-power-consumption Bluetooth broadcast data packet;
adding the scan request data to a scan request packet;
sending a scan request packet including the scan request data to the broadcaster device.
Optionally, the adding the scan request data to the scan request packet includes:
the scan request data is added to the scan request packet as a field of payload data of the scan request packet.
Optionally, the scan request data includes:
address information of data required by the scanner device.
Optionally, the scan request data further includes:
length information of a data structure corresponding to address information of data required by the scanner device;
type information corresponding to address information of data required by the scanner device.
Optionally, the electronic device further performs the following steps:
receiving a scanning response packet sent by the broadcaster device; wherein the scanning response includes data required by the scanner device.
Optionally, the bluetooth low energy broadcast packet is a connectable non-directional broadcast packet or a scannable non-directional broadcast packet.
Optionally, the determining the scanning request data according to the bluetooth low energy broadcast data packet includes:
analyzing the low-power-consumption Bluetooth broadcast data packet to obtain an analysis result;
and determining the scanning request data according to the analysis result.
Optionally, the analyzing the bluetooth low energy broadcast data packet to obtain an analyzed result includes:
analyzing the low-power-consumption Bluetooth broadcast data packet to obtain data in a custom field in the low-power-consumption Bluetooth broadcast data packet;
the determining scan request data according to the result of the parsing includes: and determining the scanning request data according to the data in the custom field and the preset corresponding relation between the data in the custom field and the scanning request data.
It should be noted that, for the detailed description of the electronic device provided in the fourth embodiment of the present application, reference may be made to the related description of the first embodiment of the present application, and details are not repeated here.
In correspondence with the bluetooth low energy-based data transmission method provided in the first embodiment of the present application, a fifth embodiment of the present application provides a storage device storing a program of the bluetooth low energy-based data transmission method, the program being executed by a processor to perform the steps of:
receiving a low-power-consumption Bluetooth broadcast data packet sent by broadcaster equipment;
sending scanning request data to the broadcaster device for the Bluetooth Low energy broadcast data packet; wherein the scan request data is for instructing the broadcaster device to include data required by the scanner device in a scan response packet sent to the scanner device.
It should be noted that, for the detailed description of the storage device provided in the fifth embodiment of the present application, reference may be made to the related description of the first embodiment of the present application, and details are not described here again.
Corresponding to the data transmission method based on bluetooth low energy provided in the first embodiment of the present application, a sixth embodiment of the present application provides a data transmission device based on bluetooth low energy.
As shown in fig. 7, the bluetooth low energy-based data transmission apparatus includes:
a broadcast packet transmitting unit 701 configured to transmit a low power consumption bluetooth broadcast packet to a scanner device;
a scanning request data receiving unit 702, configured to receive scanning request data sent by the scanner device; wherein the scanning request data is used for indicating that the broadcaster equipment contains data required by the scanner equipment in a scanning response packet sent to the scanner equipment;
a scanning response packet sending unit 703, configured to send a scanning response packet to the scanner device according to the scanning request data, where the scanning response packet includes data required by the scanner device.
Optionally, the scanning response packet sending unit is specifically configured to:
obtaining data required by the scanner device according to the scanning request data;
encapsulating data required by the scanner device into the scan response packet;
and sending a scanning response packet carrying data required by the scanner equipment to the scanner equipment.
Optionally, the broadcast data packet includes data for determining the scan request data.
Optionally, the scan request data receiving unit is specifically configured to:
receiving a scanning response packet sent by the scanner device;
and obtaining the scanning request data from the scanning response packet.
It should be noted that, for the detailed description of the apparatus provided in the sixth embodiment of the present application, reference may be made to the related description of the second embodiment of the present application, and details are not described here again.
A seventh embodiment of the present application provides an electronic device corresponding to the bluetooth low energy-based data transmission method provided in the second embodiment of the present application.
As shown in fig. 6, the electronic device includes:
a processor 601; and
a memory 602 for storing a program of the bluetooth low energy-based data transmission method, the apparatus performing the following steps after being powered on and running the program of the bluetooth low energy-based data transmission method through the processor:
sending a low-power Bluetooth broadcast data packet to the scanner device;
receiving scanning request data sent by the scanner device; wherein the scanning request data is used for indicating that the broadcaster equipment contains data required by the scanner equipment in a scanning response packet sent to the scanner equipment;
and sending a scanning response packet to the scanner equipment according to the scanning request data, wherein the scanning response packet comprises data required by the scanner equipment.
Optionally, sending a scan response packet to the scanner device according to the scan request data includes:
obtaining data required by the scanner device according to the scanning request data;
encapsulating data required by the scanner device into the scan response packet;
and sending a scanning response packet carrying data required by the scanner equipment to the scanner equipment.
Optionally, the broadcast data packet includes data for determining the scan request data.
Optionally, the receiving the scan request data sent by the scanner device includes:
receiving a scanning response packet sent by the scanner device;
and obtaining the scanning request data from the scanning response packet.
It should be noted that, for the detailed description of the electronic device provided in the seventh embodiment of the present application, reference may be made to the related description of the second embodiment of the present application, and details are not described here again.
In correspondence with the bluetooth low energy-based data transmission method provided in the second embodiment of the present application, an eighth embodiment of the present application provides a storage device storing a program of the bluetooth low energy-based data transmission method, the program being executed by a processor to perform the steps of:
sending a low-power Bluetooth broadcast data packet to the scanner device;
receiving scanning request data sent by the scanner device; wherein the scanning request data is used for indicating that the broadcaster equipment contains data required by the scanner equipment in a scanning response packet sent to the scanner equipment;
and sending a scanning response packet to the scanner equipment according to the scanning request data, wherein the scanning response packet comprises data required by the scanner equipment.
It should be noted that, for the detailed description of the storage device provided in the eighth embodiment of the present application, reference may be made to the related description of the second embodiment of the present application, and details are not described here again.
A ninth embodiment of the present application provides a data transmission method, including:
receiving a broadcast data packet sent by broadcaster equipment;
sending scan request data to the broadcaster device for the broadcast data packet; wherein the scan request data is for instructing the broadcaster device to include data required by the scanner device in a scan response packet sent to the scanner device.
It should be noted that, for the detailed description of the data transmission method provided in the ninth embodiment of the present application, reference may be made to the related description of the first embodiment of the present application, and only the bluetooth low energy broadcast data packet of the first embodiment needs to be replaced by a broadcast data packet, which is not described herein again.
A tenth embodiment of the present application provides a data transmission method, including:
transmitting a broadcast data packet to a scanner device;
receiving scanning request data sent by the scanner device; wherein the scanning request data is used for indicating that the broadcaster equipment contains data required by the scanner equipment in a scanning response packet sent to the scanner equipment;
and sending a scanning response packet to the scanner equipment according to the scanning request data, wherein the scanning response packet comprises data required by the scanner equipment.
It should be noted that, for the detailed description of the data transmission method provided in the tenth embodiment of the present application, reference may be made to the related description of the second embodiment of the present application, and only the bluetooth low energy broadcast data packet of the first embodiment needs to be replaced by a broadcast data packet, which is not described herein again.
A tenth embodiment of the present application provides a method for acquiring environmental data, where an execution subject is a BLE gateway device, and the tenth embodiment of the present application is a scenario embodiment of the first embodiment of the present application. This will be explained with reference to fig. 8.
As shown in fig. 8, in step S801, a bluetooth low energy broadcast packet transmitted by a cloud sensing device is received.
The cloud sensing equipment is broadcaster equipment and can send out a low-power-consumption Bluetooth broadcast data packet.
As shown in fig. 8, in step S802, scanning request data is sent to the integrated cloud sensing device for the bluetooth low energy broadcast data packet; the scanning request data is used for indicating that the cloud sensing device includes environment data required by the BLE gateway device in a scanning response packet sent to the BLE gateway device.
Wherein the BLE gateway device acts as a scanner device.
As shown in fig. 8, in step S803, a scan response packet sent by the cloud sensing device is received, where the scan response packet includes environment data required by a BLE gateway device. Wherein, cloud sensor equipment can be integration cloud sensor equipment, possesses BLE communication function.
The process of acquiring environmental data from the integrated cloud sensing device by the BLE gateway device is described below with reference to a specific example. The integrated cloud sensing equipment integrates sensors such as temperature and humidity, CO2, TVOC, formaldehyde and PM2.5 into one device, data of the sensors cannot be collectively transmitted to BLE gateway equipment in a Bluetooth broadcast message (the longest 31 bytes in normal broadcast), and by the method provided by the tenth embodiment of the application, the integrated cloud sensing equipment can transmit the data to the BLE gateway in multiple packets. Firstly, the integrated cloud sensing equipment and the BLE gateway agree in advance:
0x 0001: temperature and humidity 0x 0002: CO 20 x0003 TVOC 0x0004 Formaldehyde 0x0005 PM2.5
1. The integrated cloud sensing equipment sends a scannable broadcast to the BLE gateway;
2. the method comprises the steps that a BLE gateway sends scanning request data after scanning broadcasting, and additional information 0x0001 is carried in the scanning request data except the MAC address of the BLE gateway; after receiving the temperature and humidity data, the integrated cloud sensing equipment sends the temperature and humidity data in a scanning response packet;
3. the method comprises the steps that after being scanned by the BLE gateway, scanning request data are sent, and in the scanning request data, additional information 0x0002 is carried in addition to the MAC address of the BLE gateway; after receiving the data, the integrated cloud sensing equipment sends the CO2 data in a scanning response packet;
4. the method comprises the steps that after being scanned by the BLE gateway, scanning request data are sent, and in the scanning request data, additional information 0x0003 is carried in addition to the MAC address of the BLE gateway; after receiving the TVOC data, the integrated cloud sensing equipment places the TVOC data in a scanning response packet and sends the TVOC data out;
5. the method comprises the steps that after being scanned by the BLE gateway, scanning request data are sent, and in the scanning request data, additional information 0x0004 is carried in addition to the MAC address of the BLE gateway; after receiving the formaldehyde data, the integrated cloud sensing equipment sends the formaldehyde data in a scanning response packet;
6. the BLE gateway sends scanning request data after scanning the broadcast, and the scanning request data carries additional information 0x0005 besides the MAC address of the AP; after receiving the data, the integrated cloud sensing equipment sends the PM2.5 data in a scanning response packet;
through this kind of mode integration cloud sensing equipment can divide many packets of data to send for BLE gateway, when need what data by AP control completely, the overall system flexibility ratio promotes greatly.
The method for acquiring the environmental data provided by the tenth embodiment of the application can be applied to scenes such as smart homes, unmanned vehicles, factory processing, IOT and the like. For example, in an intelligent home, the integrated cloud sensing device may integrate sensors such as temperature and humidity, CO2, TVOC, formaldehyde, PM2.5, and the like into one device, the integrated cloud sensing device sends a bluetooth low energy broadcast data packet, the BLE gateway sends "scan request data" after scanning the broadcast data packet, and the "scan request data" carries information of environment data required by the BLE gateway; after the integrated cloud sensing equipment receives the environmental data, the environmental data needed by the BLE gateway is sent out in the scanning response packet, and through the mode, the integrated cloud sensing equipment can send the environmental data to the BLE gateway in multiple packets, is connected with an intelligent management terminal of the BLE gateway, such as an intelligent mobile phone, a tablet personal computer and the like, and achieves remote control and checking of home information after the environmental data are obtained; for another example, in an unmanned vehicle, the integrated cloud sensing device may integrate a temperature sensor (for monitoring the temperature in the vehicle), a water temperature sensor (for monitoring the temperature of the engine), an acceleration sensor, and the like into one device, the integrated cloud sensing device sends a bluetooth low energy broadcast data packet, the BLE gateway sends "scan request data" after scanning the broadcast data packet, and the "scan request data" carries information of environmental data required by the BLE gateway; after the integrated cloud sensing equipment receives the environmental data, the environmental data needed by the BLE gateway are placed in the scanning response packet to be sent out, and after the environmental data are obtained, the intelligent management terminal connected with the BLE gateway remotely controls the driving of the automobile.
Although the present application has been described with reference to the preferred embodiments, it is not intended to limit the present application, and those skilled in the art can make variations and modifications without departing from the spirit and scope of the present application, therefore, the scope of the present application should be determined by the claims that follow.
In a typical configuration, a computing device includes one or more processors (CPUs), input/output interfaces, network interfaces, and memory.
The memory may include forms of volatile memory in a computer readable medium, Random Access Memory (RAM) and/or non-volatile memory, such as Read Only Memory (ROM) or flash memory (flash RAM). Memory is an example of a computer-readable medium.
Computer-readable media, including both non-transitory and non-transitory, removable and non-removable media, may implement information storage by any method or technology. The information may be computer readable instructions, data structures, modules of a program, or other data. Examples of computer storage media include, but are not limited to, phase change memory (PRAM), Static Random Access Memory (SRAM), Dynamic Random Access Memory (DRAM), other types of Random Access Memory (RAM), Read Only Memory (ROM), Electrically Erasable Programmable Read Only Memory (EEPROM), flash memory or other memory technology, compact disc read only memory (CD-ROM), Digital Versatile Discs (DVD) or other optical storage, magnetic cassettes, magnetic tape magnetic disk storage or other magnetic storage devices, or any other non-transmission medium that can be used to store information that can be accessed by a computing device. As defined herein, computer readable media does not include non-transitory computer readable media (transient media), such as modulated data signals and carrier waves.
As will be appreciated by one skilled in the art, embodiments of the present application may be provided as a method, system, or computer program product. Accordingly, the present application may take the form of an entirely hardware embodiment, an entirely software embodiment or an embodiment combining software and hardware aspects. Furthermore, the present application may take the form of a computer program product embodied on one or more computer-usable storage media (including, but not limited to, disk storage, CD-ROM, optical storage, and the like) having computer-usable program code embodied therein.