Movatterモバイル変換


[0]ホーム

URL:


CN114007209B - BLE-based data transmission method and device and BLE master device - Google Patents

BLE-based data transmission method and device and BLE master device
Download PDF

Info

Publication number
CN114007209B
CN114007209BCN202111265147.XACN202111265147ACN114007209BCN 114007209 BCN114007209 BCN 114007209BCN 202111265147 ACN202111265147 ACN 202111265147ACN 114007209 BCN114007209 BCN 114007209B
Authority
CN
China
Prior art keywords
ble
slave device
master device
ble slave
data packet
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.)
Active
Application number
CN202111265147.XA
Other languages
Chinese (zh)
Other versions
CN114007209A (en
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.)
Goertek Techology Co Ltd
Original Assignee
Goertek Techology 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 Goertek Techology Co LtdfiledCriticalGoertek Techology Co Ltd
Priority to CN202111265147.XApriorityCriticalpatent/CN114007209B/en
Publication of CN114007209ApublicationCriticalpatent/CN114007209A/en
Application grantedgrantedCritical
Publication of CN114007209BpublicationCriticalpatent/CN114007209B/en
Activelegal-statusCriticalCurrent
Anticipated expirationlegal-statusCritical

Links

Classifications

Landscapes

Abstract

The invention discloses a BLE-based data transmission method, a BLE-based data transmission device, BLE master equipment and a computer-readable storage medium, wherein the method comprises the following steps: the BLE master device obtains the simultaneous transmission files corresponding to the BLE slave devices respectively; wherein the number of BLE slave devices is greater than or equal to 2; transmitting data packets while sequentially transmitting corresponding preset numbers to each BLE slave device in each communication gap by using BLE connection of the BLE master device and the BLE slave devices; wherein, the data packets transmitted simultaneously are the data packets corresponding to the file transmitted simultaneously; according to the invention, the BLE master device can send the preset number of data packets to each slave device in each BLE communication gap, so that the BLE communication gaps can be utilized more efficiently, the transmission time of the BLE master device for transmitting files to a plurality of slave devices is reduced, the OTA upgrading speed can be improved when the BLE slave devices are subjected to OTA upgrading, and the user experience is improved.

Description

BLE-based data transmission method and device and BLE master device
Technical Field
The present invention relates to the field of bluetooth communications technologies, and in particular, to a BLE-based data transmission method and apparatus, a BLE master device, and a computer readable storage medium.
Background
Bluetooth technology is increasingly used in electronic products, especially in VR (Virtual Reality) technology, and in order to track the game handle of a matched device, data needs to be transmitted in real time and high efficiency through bluetooth. Typically, a VR is equipped with dual game handles, and when an OTA (Over-the-Air Technology) is upgraded, the left and right handles need to be upgraded in sequence. The traditional method is to upgrade one handle firstly and upgrade the other after finishing, so that the upgrade efficiency is low, the user experience effect is reduced, and therefore, the quick and efficient OTA is of great importance.
In the BLE field, when one BLE master transmits a file to a plurality of slaves, the file is often transmitted sequentially; if the BLE master device needs to upgrade two slave devices, the conventional OTA upgrade is to upgrade one slave device in turn, i.e. upgrade one handle and upgrade the other slave device. This approach is typically in a BLE communication gap (a minimum BLE communication gap is 7.5 ms) where the BLE master only transmits one packet of data to one BLE slave and does not utilize a good BLE communication gap (this gap is also referred to as timeslot). Therefore, how to reduce the transmission time of the file from the BLE master device to the plurality of slave devices, thereby improving the OTA upgrading speed of the BLE slave device and improving the user experience is an urgent problem to be solved nowadays.
Disclosure of Invention
The invention aims to provide a data transmission method and device based on BLE, BLE master equipment and a computer readable storage medium, so as to reduce the transmission time of the BLE master equipment for transmitting files to a plurality of slave equipment, thereby improving the OTA upgrading speed of the BLE slave equipment and improving the user experience.
In order to solve the above technical problems, the present invention provides a BLE-based data transmission method, including:
The BLE master device obtains the simultaneous transmission files corresponding to the BLE slave devices respectively; wherein the number of BLE slave devices is greater than or equal to 2;
Transmitting data packets while sequentially transmitting corresponding preset numbers to the BLE slave devices in each communication gap by utilizing BLE connection of the BLE master device and the BLE slave devices; wherein, the simultaneous transmission data packet is a data packet corresponding to the simultaneous transmission file.
Optionally, the above-mentioned method includes, before each communication gap sequentially sends a corresponding preset number of simultaneous transmission data packets to each BLE slave device, using BLE connection between the BLE master device and the BLE slave device, further includes:
disconnecting the BLE connection between the BLE master device and each BLE slave device, renegotiating a maximum transmission unit of BLE communication with each BLE slave device, and adjusting the original first packet length to a second packet length; wherein the second packet length is greater than the first packet length;
After the negotiation is completed, the BLE master device reestablishes BLE connection with each BLE slave device.
Optionally, the disconnecting the BLE master device from the BLE of each BLE slave device and renegotiating a maximum transmission unit for BLE communication with each BLE slave device, and adjusting the original first packet length to a second packet length, includes:
transmitting a simultaneous transmission request to each BLE slave device by using BLE connection of the BLE master device and the BLE slave devices;
And disconnecting the BLE connection of the BLE master device and each BLE slave device according to the request success information returned by each BLE slave device, and renegotiating a maximum transmission unit of BLE communication with each BLE slave device.
Optionally, the above-mentioned method includes, after each communication gap sequentially sends a corresponding preset number of simultaneous transmission data packets to each BLE slave device, using BLE connection between the BLE master device and the BLE slave device, further includes:
After the respective corresponding simultaneous transmission files of the BLE slave devices are successfully sent, disconnecting the BLE master device from the BLE of the BLE slave devices again, renegotiating a maximum transmission unit for BLE communication with the BLE slave devices, and adjusting the second packet length to be the first packet length;
After the negotiation is completed, the BLE master device reestablishes BLE connection with each BLE slave device.
Optionally, when the simultaneous transmission file is an upgrade file, the BLE master device obtains the simultaneous transmission file corresponding to each BLE slave device, including:
And when the BLE master device detects that each BLE slave device needs to be upgraded, acquiring an upgrade file of each BLE slave device.
Optionally, when the preset number is 1, the transmitting data packets while sequentially sending the corresponding preset number to each BLE slave device in each communication gap by using BLE connection between the BLE master device and the BLE slave device includes:
Acquiring current data packets corresponding to the BLE slave devices respectively; wherein, the current data packet is any one of the simultaneous transmission data packets;
sequentially sending corresponding current data packets to each BLE slave device in a current communication gap;
Judging whether the simultaneous transmission files corresponding to the BLE slave devices are successfully transmitted according to the current data packet success information returned by the BLE slave devices;
If not, executing the step of acquiring the current data packet corresponding to each BLE slave device;
If yes, the simultaneous transmission files corresponding to the BLE slave devices are successfully transmitted.
Optionally, the obtaining the current data packet corresponding to each BLE slave device includes:
if the success information of the current data packet corresponding to the current BLE slave device is received and the current data packet corresponding to the current BLE slave device is not the last packet data packet of the simultaneous transmission file, acquiring the next data packet in the transmission data packet corresponding to the current BLE slave device, and taking the next data packet as the current data packet corresponding to the current BLE slave device; wherein the current BLE slave device is any one of the BLE slave devices;
And if the success information of the current data packet corresponding to the current BLE slave device is not received, acquiring the current data packet in the transmission data packet corresponding to the current BLE slave device again.
The invention also provides a BLE-based data transmission device, which is applied to BLE main equipment and comprises:
The file acquisition module is used for acquiring the simultaneous transmission files corresponding to the BLE slave devices respectively; wherein the number of BLE slave devices is greater than or equal to 2;
A file transmission module, configured to connect with a BLE of the BLE slave device by using the BLE master device, and transmit a data packet while sequentially sending a corresponding preset number of data packets to each BLE slave device in each communication gap; wherein, the simultaneous transmission data packet is a data packet corresponding to the simultaneous transmission file.
The invention also provides a BLE master device comprising:
A memory for storing a computer program;
a processor for implementing the steps of the BLE-based data transmission method as described above when executing the computer program.
Furthermore, the present invention provides a computer readable storage medium having stored thereon a computer program which when executed by a processor implements the steps of a BLE based data transmission method as described above.
The invention provides a BLE-based data transmission method, which comprises the following steps: the BLE master device obtains the simultaneous transmission files corresponding to the BLE slave devices respectively; wherein the number of BLE slave devices is greater than or equal to 2; transmitting data packets while sequentially transmitting corresponding preset numbers to each BLE slave device in each communication gap by using BLE connection of the BLE master device and the BLE slave devices; wherein, the data packets transmitted simultaneously are the data packets corresponding to the file transmitted simultaneously;
Therefore, the invention utilizes the BLE connection of the BLE master device and the BLE slave devices, and transmits the data packets to each BLE slave device while sequentially transmitting the corresponding preset number of data packets to each BLE slave device in each communication gap, so that the BLE master device can transmit the preset number of data packets to each slave device in each BLE communication gap, can more efficiently utilize the BLE communication gap, and reduce the transmission time of the BLE master device for transmitting files to a plurality of slave devices, thereby improving the OTA upgrading speed and user experience when the BLE slave devices are subjected to OTA upgrading. In addition, the invention also provides a BLE-based data transmission device, a BLE master device and a computer readable storage medium, which also have the beneficial effects.
Drawings
In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings that are required to be used in the embodiments or the description of the prior art will be briefly described below, and it is obvious that the drawings in the following description are only embodiments of the present invention, and that other drawings can be obtained according to the provided drawings without inventive effort for a person skilled in the art.
Fig. 1 is a flowchart of a BLE-based data transmission method according to an embodiment of the present invention;
fig. 2 is a schematic system structure diagram of another BLE-based data transmission method according to an embodiment of the present invention;
fig. 3 is a flowchart of another BLE-based data transmission method according to an embodiment of the present invention;
fig. 4 is a flow chart of another BLE-based data transmission method according to an embodiment of the present invention;
Fig. 5 is a block diagram of a data transmission device based on BLE according to an embodiment of the present invention;
Fig. 6 is a schematic structural diagram of a BLE master device according to an embodiment of the present invention;
fig. 7 is a schematic diagram of a specific structure of a BLE master device according to an embodiment of the present invention.
Detailed Description
For the purpose of making the objects, technical solutions and advantages of the embodiments of the present invention more apparent, the technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings in the embodiments of the present invention, and it is apparent that the described embodiments are some embodiments of the present invention, but not all embodiments of the present invention. All other embodiments, which can be made by those skilled in the art based on the embodiments of the invention without making any inventive effort, are intended to be within the scope of the invention.
Referring to fig. 1, fig. 1 is a flowchart of a BLE-based data transmission method according to an embodiment of the present invention. The method may include:
step 101: the BLE master device obtains the simultaneous transmission files corresponding to the BLE slave devices respectively; wherein the number of BLE slave devices is greater than or equal to 2.
Wherein the BLE Master device in this step may be a device in the BLE connection that is a Master device (Master), such as a Head Mounted Display (HMD) in a VR product; the BLE Slave may be a device in the BLE connection that is a Slave (Slave), such as a handle that makes a BLE connection with a head mounted display (i.e., BLE master).
Specifically, the file transmitted simultaneously in this step may be a file that the BLE master needs to send to each BLE slave simultaneously through BLE connection, such as an upgrade file of each BLE slave. For the specific content of the simultaneous transmission file corresponding to each BLE slave device in this embodiment, the designer may set the simultaneous transmission file according to the practical scenario and the user requirement, for example, the simultaneous transmission file corresponding to each BLE slave device may be the same file, for example, when performing OTA upgrade on each BLE slave device, the upgrade file of the BLE slave device; the simultaneous transmission files corresponding to the BLE slave devices may also be different files corresponding to the BLE slave devices. The present embodiment does not impose any limitation on this.
Likewise, for the specific number of BLE Slave devices in this embodiment, the designer may set the number of BLE Slave devices according to the practical scenario, for example, the number of BLE Slave devices may be 2, for example, two handles (BLE Slave handle 1 and BLE Slave handle 2) connected to the VR HMD (i.e., BLE master device) through BLE in fig. 2, or two TWS (True Wireless Stereo, truly wireless stereo) headphones connected to the charging box (i.e., BLE master device) through BLE; the number of BLE slaves may also be a positive integer greater than 2. The present embodiment does not impose any limitation on this.
It should be noted that, for the specific manner of acquiring the corresponding simultaneous transmission file of each BLE slave device by the BLE master device in this step, the designer may set the simultaneous transmission file as an upgrade file according to a practical scenario and user requirements, that is, when the BLE master device in this embodiment performs simultaneous upgrade on each BLE slave device, the BLE master device may acquire the upgrade file (that is, the simultaneous transmission file) of each BLE slave device when detecting that each BLE slave device needs to be upgraded, for example, download the upgrade file of each BLE slave device from the server. The present embodiment does not limit this as long as the BLE master can acquire a simultaneous transmission file that needs to be simultaneously transmitted to each BLE slave.
Step 102: transmitting data packets while sequentially transmitting corresponding preset numbers to each BLE slave device in each communication gap by using BLE connection of the BLE master device and the BLE slave devices; wherein, the data packets transmitted simultaneously are the data packets corresponding to the file transmitted simultaneously.
It can be understood that in this step, the BLE master device may be configured to use the BLE connection with each BLE slave device to send, in each communication gap (i.e., a BLE communication gap), a preset number of data packets (i.e., simultaneous transmission data packets) of the respective corresponding simultaneous transmission file to each BLE slave device in sequence, so as to complete simultaneous transmission of the respective corresponding simultaneous transmission file of each BLE slave device. That is, in this step, the BLE master device may send, in sequence, a preset number of simultaneous transmission data packets corresponding to each BLE slave device in each communication gap in the process of sending the corresponding simultaneous transmission file to each BLE slave device, until each corresponding simultaneous transmission file of each BLE slave device is successfully sent.
Specifically, the data packet transmitted simultaneously in this step may be a data packet transmitted during file transmission. In this step, the BLE master device transmits the preset number of simultaneous transmission data packets to each BLE slave device in each BLE communication gap, so that efficiency of transmitting simultaneous transmission files to each BLE slave device by the BLE master device can be improved, and transmission time is reduced. In order to further improve the file transmission efficiency, in this embodiment, before sending the simultaneous transmission file to each BLE slave device, the BLE master device may renegotiate an MTU (maximum transmission unit) with each BLE slave device to increase the packet length of BLE transmission, that is, increase the data amount of the simultaneous transmission data packets, so as to reduce the number of data packets corresponding to the simultaneous transmission file (that is, simultaneously transmit the data packets); for example, in this embodiment, before step 102, the BLE master device may disconnect the BLE connection between the BLE master device and each BLE slave device, renegotiate the maximum transmission unit for BLE communication with each BLE slave device, and adjust the original first packet length to the second packet length; after the negotiation is completed, the BLE master device reestablishes BLE connection with each BLE slave device, and proceeds to step 102; wherein the second packet length is greater than the first packet length.
Correspondingly, in this embodiment, after sending the simultaneous transmission file to each BLE slave device, the BLE master device may renegotiate an MTU (maximum transmission unit) with each BLE slave device to restore the packet length of BLE transmission to the packet length of normal BLE transmission; for example, after step 102, the BLE master device may disconnect the BLE connection between the BLE master device and each BLE slave device again after successfully transmitting the corresponding simultaneous transmission file of each BLE slave device, renegotiate the maximum transmission unit of BLE communication with each BLE slave device, and adjust the second packet length to the first packet length.
It should be noted that, for the specific setting of transmitting the data packet while sequentially transmitting the preset number to each BLE slave device in the communication gap (i.e., the BLE communication gap) and each communication gap in this step, the designer may set the specific setting according to the practical scenario and the user requirement, for example, the communication gap may be the smallest BLE communication gap, such as 7.5ms. The BLE master device in each communication gap can sequentially send corresponding preset number of simultaneous transmission data packets to each BLE slave device according to a preset time interval, for example, the preset time interval can be the quotient of the communication gap and the number of the BLE slave devices; for example, when the communication gap is 7.5ms and the number of BLE slave devices is 2, the preset time interval may be 3.75ms, that is, within 7.5ms, the interval is 3.75ms, and the BLE master device sends the preset number of simultaneous transmission data packets corresponding to one BLE slave device first, and then sends the preset number of simultaneous transmission data packets corresponding to another BLE slave device; similarly, when the BLE master device receives ACK (acknowledgement character) packets of the BLE slave device, the interval is also 3.75ms, and the ACK packets of the two BLE slave devices are respectively accepted, so as to ensure the validity of data in the transmission process.
Correspondingly, for the specific numerical value setting of the preset number in this embodiment, that is, the number setting of the simultaneous transmission data packets sent by the BLE master device to each BLE slave device in each communication gap may be set by a designer, for example, the preset number may be 1 in this embodiment, that is, in one BLE communication gap, the BLE master device only sends a corresponding simultaneous transmission data packet (such as an upgrade data packet) to each BLE slave device, so as to ensure that after each simultaneous transmission data packet is sent to a corresponding BLE slave device, the successful information (such as an ACK packet) corresponding to the simultaneous transmission data packet returned by the BLE slave device can be received, thereby avoiding the situation of packet loss or error checking of the simultaneous transmission file, and ensuring the transmission success rate of the simultaneous transmission file (such as an upgrade file), and further ensuring the OTA upgrade success rate of the BLE slave device. The preset number in this embodiment may be a number greater than or equal to 2, which is not limited in this embodiment.
Specifically, for the specific mode that the BLE master device uses the BLE connection between the BLE master device and the BLE slave devices in the step, and transmits data packets while sequentially transmitting the respective corresponding preset number to each BLE slave device in each communication gap, the specific mode can be set by a designer according to a usage scenario and user requirements, if the preset number is 1, the BLE master device in the step can acquire the current data packets corresponding to each BLE slave device; sequentially sending corresponding current data packets to each BLE slave device in the current communication gap; judging whether the simultaneous transmission files corresponding to each BLE slave device are successfully transmitted or not according to the success information of the current data packet returned by each BLE slave device; if not, executing the step of acquiring the current data packet corresponding to each BLE slave device; if yes, it is true that all BLE slave devices respectively correspond to the simultaneous transmission files and are successfully transmitted. The current data packet corresponding to each BLE slave device is any one of the simultaneous transmission data packets of the simultaneous transmission file corresponding to each BLE slave device.
In this embodiment, in the embodiment of the present invention, by using the BLE connection between the BLE master device and the BLE slave devices, the data packets are transmitted while each communication gap sequentially sends a corresponding preset number of data packets to each BLE slave device, so that the BLE master device can send a preset number of data packets to each slave device in each BLE communication gap, thereby more efficiently utilizing the BLE communication gap, reducing the transmission time of the BLE master device for transmitting files to a plurality of slave devices, and further improving the OTA upgrading speed and user experience when performing OTA upgrading on the BLE slave devices.
Referring to fig. 3, fig. 3 is a flowchart of another BLE-based data transmission method according to an embodiment of the present invention. The method may include:
step 201: when the BLE master device detects that each BLE slave device needs to be upgraded, the upgrading file of each BLE slave device is obtained.
In this embodiment, the BLE master device performs an OTA upgrade on each BLE slave device, that is, in this embodiment, the BLE master device may simultaneously transmit an upgrade file to each BLE slave device, so as to increase the OTA upgrade speed of the BLE slave device; for the procedure of transmitting other files from the BLE master device to each BLE slave device, the procedure may be set correspondingly in a similar manner to the method provided in this embodiment, which is not limited in any way.
Specifically, as shown in fig. 2, the BLE master device in this embodiment may be a VR HMD, and the BLE Slave device in this embodiment may be two handles (BLE Slave handle 1 and BLE Slave handle 2) connected to the VR HMD through BLE; in this step, a processor (e.g., a CPU) in the BLE master device may obtain an upgrade file of each BLE slave device when it detects that each BLE slave device needs to be upgraded.
Correspondingly, the method provided by the embodiment may further include that the BLE master device detects whether each BLE slave device needs to be upgraded; if yes, go to step 201; if not, ending the process or waiting for next detection of whether each BLE slave device needs upgrading. In this embodiment, a specific manner of detecting whether each BLE slave device needs to be upgraded by the BLE master device is not limited, and may be implemented in the same or similar manner as the method of detecting upgrade of each BLE slave device by the BLE master device in the prior art.
Step 202: disconnecting BLE connection between the BLE master device and each BLE slave device, renegotiating a maximum transmission unit of BLE communication with each BLE slave device, and adjusting the original first packet length to a second packet length; wherein the second packet length is greater than the first packet length.
It can be understood that in this step, the BLE master device renegotiates the maximum transmission unit of BLE communication with each BLE slave device after disconnecting the BLE connection, and adjusts the original first packet length to the second packet length, so that the number of upgrade data packets corresponding to the upgrade file can be reduced, thereby reducing the transmission time of the upgrade file.
Specifically, for the specific manner that in this step, the BLE master device disconnects the BLE master device from the BLE of each BLE slave device and renegotiates the Maximum Transmission Unit (MTU) of BLE communication with each BLE slave device, and adjusts the original first packet length to the second packet length, the specific manner may be set by the designer according to the practical scenario and the user requirement, for example, the BLE master device may use the BLE master device to connect with the BLE of the BLE slave device to send a simultaneous transmission request (such as the upgrade request in fig. 4) to each BLE slave device, so as to inform each BLE slave device of the upcoming file simultaneous transmission event; and according to the request success information (such as an ACK packet) returned by each BLE slave device, disconnecting the BLE master device from BLE of each BLE slave device, and renegotiating a maximum transmission unit of BLE communication with each BLE slave device so as to adjust the MTU from the first packet length of original normal BLE communication to the second packet length of file simultaneous transmission.
As shown in fig. 2 and fig. 4, when the CPU of the BLE master detects that two BLE slave devices (BLE slave) need to be upgraded, the CPU may first send an upgrade request packet to the bluetooth component (BLE Host) of the BLE master by means of wired transmission, so that the BLE Host sends this upgrade event (i.e. a simultaneous transmission request) to the two connected BLE slave devices through BLE; after the two BLE slave devices receive the upgrade event, the MTU is set to the size (namely the second packet length) required by the OTA upgrade transmission process so as to reduce the total packet number of OTA transmission and further reduce the upgrade time; when two BLE slave devices return an ACK (i.e. request success information) to the BLE Host, the BLE master device or the BLE slave device can actively disconnect bluetooth and renegotiate the MTU after the BLE Host receives the ACK.
Step 203: after the negotiation is completed, the BLE master device reestablishes the BLE connection with each BLE slave device.
It may be appreciated that in this step, after renegotiating the MTU of BLE communication with each BLE slave device, the BLE master device may reestablish a BLE connection with each BLE slave device, so as to transmit an upgrade file to each BLE slave device by using the reestablished BLE connection.
Step 204: acquiring current data packets corresponding to each BLE slave device; the current data packet is any upgrade data packet of the upgrade file.
Specifically, in this step, the BLE master device may acquire an upgrade data packet (i.e., a current data packet) of an upgrade file corresponding to each BLE slave device that needs to be sent in the current time slot. The current data packet corresponding to each BLE slave device may be the same upgrade data packet, for example, the first upgrade data packet is sent to each BLE slave device; the current data packets corresponding to each BLE slave device may also be different upgrade data packets, for example, after the transmission of the upgrade data packet sent to any BLE slave device fails, the current upgrade data packet corresponding to the BLE slave device may be the upgrade data packet failed in the last transmission, and the current upgrade data packets corresponding to other BLE slave devices may be the next upgrade data packet that is continuously sent.
That is, in this step, the BLE master device may obtain the current data packet corresponding to each BLE slave device according to the upgrade file and the current data packet success information (such as a successful ACK packet) of the current data packet corresponding to each BLE slave device sent in the previous communication gap; if in this step, when the BLE master device sends an upgrade data packet to each BLE slave device for the first time, the first upgrade data packet of the upgrade file may be directly obtained, and used as the current data packet corresponding to each BLE slave device; when receiving successful information of a current data packet corresponding to a current BLE slave device when the BLE master device sends an upgrade data packet to each BLE slave device, and if the current data packet corresponding to the current BLE slave device is not the last packet data packet of a simultaneous transmission file (i.e. upgrade file), acquiring a next data packet in the transmission file corresponding to the current BLE slave device, and taking the next data packet as the current data packet corresponding to the current BLE slave device; if the success information of the current data packet corresponding to the current BLE slave device is not received, acquiring the current data packet in the transmission data packet corresponding to the current BLE slave device again; if the success information of the current data packet corresponding to the current BLE slave device is received, and the current data packet corresponding to the current BLE slave device is the last packet of the simultaneous transmission file, the successful transmission of the upgrade file of the current BLE slave device can be determined; wherein the current BLE slave is any BLE slave.
As shown in fig. 2 and fig. 4, after the BLE Host of the BLE master renegotiates the MTU with the two BLE slaves and successfully reestablishes the BLE connection, the BLE Host is notified to the CPU of the BLE master, and in this step the CPU may prepare the current data packet (upgrade data packet) corresponding to each of the BLE slaves, so as to send the current data packet to the two BLE slaves through the BLE Host.
Step 205: and sequentially sending the corresponding current data packets to each BLE slave device in the current communication gap.
In this step, the BLE master device may sequentially send respective corresponding current data packets to each BLE slave device in the current communication gap; as shown in fig. 2 and fig. 4, the CPU of the BLE master device may send the respective corresponding current data packet sent by each BLE slave device to the BLE Host, so that the BLE Host sequentially sends the respective corresponding current data packet to each BLE slave device in the current communication gap; for example, when the communication gap is 7.5ms, the 7.5ms of the communication gap can be equally divided into two 3.75ms, that is, within 7.5ms, the interval is 3.75ms, and the BLE Host sends one packet of upgrade data (i.e., the current data packet) to each of the two BLE slave devices.
Step 206: judging whether the upgrade files corresponding to the BLE slave devices are successfully transmitted according to the success information of the current data packet returned by the BLE slave devices; if not, go to step 204; if so, step 207 is entered.
It can be understood that in this step, the BLE master device determines whether to complete the transmission of the upgrade files of each BLE slave device by determining whether the upgrade files corresponding to each BLE slave device are successfully transmitted according to the success information of the current data packet returned by each BLE slave device.
Specifically, in this step, the BLE master device determines whether to receive the success information of the current data packet returned by the current BLE slave device and determine whether the current data packet corresponding to the current BLE slave device is the last packet of the data packet of the simultaneous transmission file (i.e. the upgrade file) respectively or sequentially; when current data packet success information returned by the current BLE slave device is received and the current data packet corresponding to the current BLE slave device is the last packet of data packet of the upgrade file, determining that the upgrade file of the current BLE slave device is successfully transmitted; when the success information of the current data packet returned by the current BLE slave device is not received or the current data packet corresponding to the current BLE slave device is not the last packet of the upgrading file, determining that the upgrading file of the current BLE slave device is not successfully transmitted; thereby determining whether the upgrade files of all BLE slave devices are transmitted.
As shown in fig. 2 and fig. 4, after receiving the ACK packet of the BLE slave device, the BLE Host of the BLE master device returns the ACK packet to the CPU, and then the CPU determines whether the received ACK packet is successful or failed, if successful (i.e., the current packet success information), the CPU continues to transmit the next packet upgrade data packet corresponding to the BLE slave device to the BLE Host, otherwise, the CPU continues to transmit the current data packet. When the next packet of upgrade data packet is transmitted, the CPU needs to judge whether the next packet is the last packet, if so, after the CPU receives the successful ACK of the last packet, the successful completion of the transmission of the upgrade file of the BLE slave is determined.
Step 207: and actually, the upgrade files corresponding to the BLE slave devices are successfully transmitted, the BLE connection between the BLE master device and the BLE slave devices is disconnected again, the BLE communication maximum transmission unit is renegotiated with the BLE slave devices, and the second packet length is adjusted to be the first packet length.
After the BLE master device determines that the respective corresponding transmission files of the respective BLE slave devices are successfully transmitted, the BLE master device and the respective BLE slave devices are disconnected again, and renegotiate the maximum transmission unit of BLE communication with the respective BLE slave devices, so that the MTU of BLE communication can be adjusted from the second packet length when the upgrade files are transmitted to the first packet length of normal BLE communication, and the subsequent BLE master device can perform normal BLE communication with the respective BLE slave devices.
Specifically, in this step, after the respective upgrade files corresponding to the BLE slave devices are actually transmitted successfully, the BLE master device may send file transmission completion information (such as an upgrade completion packet in fig. 4) to the BLE slave devices, so that the BLE slave devices can know that the upgrade file transmission is completed; and then, the BLE master device or the BLE slave device actively disconnects the BLE master device from the BLE of each BLE slave device, renegotiates the maximum transmission unit of BLE communication between the BLE master device and each BLE slave device, and adjusts the second packet length to be the first packet length. As shown in fig. 4, after determining that the upgrade files corresponding to the respective BLE slave devices are successfully transmitted, the CPU of the BLE master device may send an upgrade completion packet to the two BLE slave devices through a BLE Host, so that the two BLE slave devices may restart and upgrade according to the received upgrade completion packet, actively disconnect the BLE connection, renegotiate a Maximum Transmission Unit (MTU) of BLE communication with the BLE master device, and adjust the second packet length to the original first packet length.
Step 208: after the negotiation is completed, the BLE master device reestablishes the BLE connection with each BLE slave device.
It can be understood that in this step, the BLE master device reestablishes the BLE connection with each BLE slave device, where the MTU is the first packet, so that the BLE master device can perform normal BLE communication with each BLE slave device.
In this embodiment, the embodiment of the present invention sequentially sends the corresponding current data packets to each BLE slave device in the current communication gap, so that an upgrade data packet can be sent to each BLE slave device in each communication gap, and thus, the reply acknowledgement of the BLE slave device can be received while each BLE slave device sends each upgrade data packet, the situations of packet loss or check error are reduced, the accuracy of transmission of an upgrade file is ensured, and the OTA upgrade success rate of the BLE slave device is improved.
Corresponding to the above method embodiment, the present invention further provides a BLE-based data transmission device, and a BLE-based data transmission device described below and a BLE-based data transmission method described above may be referred to correspondingly.
Referring to fig. 5, fig. 5 is a block diagram of a BLE-based data transmission device according to an embodiment of the present invention. The data transmission apparatus applied to the BLE master device may include:
a file obtaining module 10, configured to obtain simultaneous transmission files corresponding to respective BLE slave devices; wherein the number of BLE slave devices is greater than or equal to 2;
The file transmission module 20 is configured to utilize BLE connection between the BLE master device and the BLE slave devices, and transmit data packets while sequentially sending respective corresponding preset numbers to the respective BLE slave devices in each communication gap; wherein, the data packets transmitted simultaneously are the data packets corresponding to the file transmitted simultaneously.
Optionally, the apparatus may further include:
The MTU adjusting module is used for disconnecting BLE connection between the BLE master device and each BLE slave device, renegotiating a maximum transmission unit of BLE communication with each BLE slave device, and adjusting the original first packet length to a second packet length; wherein the second packet length is greater than the first packet length;
And the BLE reconnection module is used for reestablishing the BLE connection between the BLE master device and each BLE slave device after the negotiation is completed, and sending a start signal to the file transmission module 20.
Optionally, the MTU adjustment module may include:
A request sending sub-module, configured to send a simultaneous transmission request to each BLE slave device by using BLE connection between the BLE master device and the BLE slave devices;
And the disconnection adjustment sub-module is used for disconnecting the BLE connection of the BLE master device and each BLE slave device according to the request success information returned by each BLE slave device, and renegotiating the maximum transmission unit of BLE communication with each BLE slave device.
Optionally, the apparatus may further include:
the MTU recovery module is used for disconnecting BLE master equipment from BLE of each BLE slave equipment again after the corresponding simultaneous transmission file of each BLE slave equipment is successfully transmitted, renegotiating a maximum transmission unit for BLE communication with each BLE slave equipment, and adjusting the second packet length to be the first packet length;
And the BLE recovery connection module is used for reestablishing BLE connection between the BLE master device and each BLE slave device after the negotiation is completed.
Optionally, when the simultaneous transmission file is an upgrade file, the file obtaining module 10 may be specifically configured to obtain the upgrade file of each BLE slave device when it is detected that each BLE slave device needs to be upgraded.
Optionally, when the preset number is 1, the file transfer module 20 may include:
a data packet obtaining sub-module, configured to obtain current data packets corresponding to respective BLE slave devices; wherein, the current data packet is any synchronous transmission data packet;
a data packet transmission sub-module, configured to sequentially send respective corresponding current data packets to each BLE slave device in a current communication gap;
The transmission judging sub-module is used for judging whether the simultaneous transmission files corresponding to the BLE slave devices are successfully transmitted or not according to the current data packet success information returned by the BLE slave devices; if not, sending a starting signal to a data packet acquisition submodule; if yes, it is true that all BLE slave devices respectively correspond to the simultaneous transmission files and are successfully transmitted.
Optionally, the data packet obtaining sub-module may be specifically configured to obtain a next data packet in the transmission data packet corresponding to the current BLE slave device if the success information of the current data packet corresponding to the current BLE slave device is received and the current data packet corresponding to the current BLE slave device is not the last packet data packet of the simultaneous transmission file, and take the next data packet as the current data packet corresponding to the current BLE slave device; if the success information of the current data packet corresponding to the current BLE slave device is not received, acquiring the current data packet in the transmission data packet corresponding to the current BLE slave device again; wherein the current BLE slave is any BLE slave.
In this embodiment, the file transmission module 20 uses the BLE connection between the BLE master device and the BLE slave devices, and transmits the data packets to each corresponding preset number of BLE slave devices in sequence in each communication gap, so that the BLE master device can transmit the preset number of data packets to each slave device in each BLE communication gap, and can more efficiently use the BLE communication gap, reduce the transmission time of the BLE master device for transmitting files to a plurality of slave devices, and thereby improve the OTA upgrading speed and user experience when the BLE slave devices are subjected to OTA upgrading.
Corresponding to the above method embodiment, the present invention further provides a BLE master device, and a BLE master device described below and a BLE-based data transmission method described above may be referred to correspondingly.
Referring to fig. 6, fig. 6 is a schematic structural diagram of a BLE master device according to an embodiment of the present invention. The BLE master may include:
a memory D1 for storing a computer program;
A processor D2, configured to implement the steps of the BLE-based data transmission method provided in the above method embodiment when executing a computer program.
Specifically, referring to fig. 7, fig. 7 is a schematic diagram of a specific structure of a BLE master device according to an embodiment of the present invention, where the BLE master device 310 may have a relatively large difference due to different configurations or performances, and may include one or more processors (central processing units, CPU) 322 (e.g., one or more processors) and a memory 332, and one or more storage mediums 330 (e.g., one or more mass storage devices) storing applications 342 or data 344. Wherein the memory 332 and the storage medium 330 may be transitory or persistent. The program stored on the storage medium 330 may include one or more units (not shown), each of which may include a series of instruction operations in the electronic device. Still further, central processor 322 may be configured to communicate with storage medium 330, executing a series of instruction operations in storage medium 330 on BLE master device 310.
BLE master device 310 may also include one or more power supplies 326, one or more wired or wireless network interfaces 350, one or more input/output interfaces 358, and/or one or more operating systems 341. For example, windows ServerTM, mac OS XTM, unixTM, linuxTM, freeBSDTM, etc., BLE master 310 may also include Bluetooth features.
Wherein BLE master device 310 may be embodied as a Head Mounted Display (HMD).
The steps in the BLE-based data transmission method described above may be implemented by the structure of the BLE master device.
Corresponding to the above method embodiments, the embodiments of the present invention further provide a computer readable storage medium, which is described below and a BLE-based data transmission method described above can be referred to correspondingly.
A computer readable storage medium having stored thereon a computer program which when executed by a processor implements the steps of a BLE-based data transmission method provided by the above method embodiments.
The computer readable storage medium may be a usb disk, a removable hard disk, a Read-Only Memory (ROM), a random access Memory (Random Access Memory, RAM), a magnetic disk, or an optical disk, which may store program codes.
In the description, each embodiment is described in a progressive manner, and each embodiment is mainly described by the differences from other embodiments, so that the same similar parts among the embodiments are mutually referred. For the apparatus, BLE master device, and computer-readable storage medium of the embodiment disclosure, since they correspond to the methods of the embodiment disclosure, the description is relatively simple, and the relevant points are referred to in the description of the method section.
The above describes in detail a BLE-based data transmission method and apparatus, a BLE master device, and a computer readable storage medium provided by the present invention. The principles and embodiments of the present invention have been described herein with reference to specific examples, the description of which is intended only to facilitate an understanding of the method of the present invention and its core ideas. It should be noted that it will be apparent to those skilled in the art that various modifications and adaptations of the invention can be made without departing from the principles of the invention and these modifications and adaptations are intended to be within the scope of the invention as defined in the following claims.

Claims (7)

CN202111265147.XA2021-10-282021-10-28BLE-based data transmission method and device and BLE master deviceActiveCN114007209B (en)

Priority Applications (1)

Application NumberPriority DateFiling DateTitle
CN202111265147.XACN114007209B (en)2021-10-282021-10-28BLE-based data transmission method and device and BLE master device

Applications Claiming Priority (1)

Application NumberPriority DateFiling DateTitle
CN202111265147.XACN114007209B (en)2021-10-282021-10-28BLE-based data transmission method and device and BLE master device

Publications (2)

Publication NumberPublication Date
CN114007209A CN114007209A (en)2022-02-01
CN114007209Btrue CN114007209B (en)2024-09-27

Family

ID=79924708

Family Applications (1)

Application NumberTitlePriority DateFiling Date
CN202111265147.XAActiveCN114007209B (en)2021-10-282021-10-28BLE-based data transmission method and device and BLE master device

Country Status (1)

CountryLink
CN (1)CN114007209B (en)

Families Citing this family (2)

* Cited by examiner, † Cited by third party
Publication numberPriority datePublication dateAssigneeTitle
EP3817466B1 (en)*2019-09-042023-06-07Shenzhen Goodix Technology Co., Ltd.Data synchronization method and apparatus, device, system, and storage medium
CN115022252B (en)*2022-05-312024-04-09青岛海信移动通信技术有限公司Method and equipment for configuring maximum length of transmission data packet

Citations (2)

* Cited by examiner, † Cited by third party
Publication numberPriority datePublication dateAssigneeTitle
WO2020154938A1 (en)*2019-01-302020-08-06华为技术有限公司Data transmission method and related apparatus
CN113157300A (en)*2021-05-192021-07-23深圳Tcl新技术有限公司Data processing method, device and storage medium

Family Cites Families (6)

* Cited by examiner, † Cited by third party
Publication numberPriority datePublication dateAssigneeTitle
EP3817466B1 (en)*2019-09-042023-06-07Shenzhen Goodix Technology Co., Ltd.Data synchronization method and apparatus, device, system, and storage medium
CN111163387B (en)*2019-12-292021-08-24歌尔科技有限公司TWS earphone upgrading method and device, charging box and storage medium
WO2021155482A1 (en)*2020-02-032021-08-12深圳市汇顶科技股份有限公司Data transmission method and ble device
CN111432400B (en)*2020-02-192022-10-14成都四相致新科技有限公司Cluster OTA upgrading method and system
CN112994754B (en)*2021-02-032022-08-16展讯通信(上海)有限公司Bluetooth audio data transmission method, equipment, chip and storage medium
CN113329381B (en)*2021-04-282022-03-11荣耀终端有限公司Method for establishing Bluetooth connection and electronic equipment

Patent Citations (2)

* Cited by examiner, † Cited by third party
Publication numberPriority datePublication dateAssigneeTitle
WO2020154938A1 (en)*2019-01-302020-08-06华为技术有限公司Data transmission method and related apparatus
CN113157300A (en)*2021-05-192021-07-23深圳Tcl新技术有限公司Data processing method, device and storage medium

Also Published As

Publication numberPublication date
CN114007209A (en)2022-02-01

Similar Documents

PublicationPublication DateTitle
AU2021266341B2 (en)Session processing method, device, and system
US11612002B2 (en)System and method for synchronous independent channel access in a wireless network
CN107835040B (en)Data communication method, equipment and storage medium based on Bluetooth
US20210211965A1 (en)Data Transmission Method, Electronic Device, and Computer Readable Storage Medium
CN114007209B (en)BLE-based data transmission method and device and BLE master device
EP2838309A1 (en)Method, device and system for establishing data connection
US10789180B2 (en)SPI-based data transmission method and device
CN112968752B (en)Baud rate switching method and device for UART communication and initiator terminal
US20160249312A1 (en)Timing advance adjustment method and device
CN112256297A (en) A Bluetooth peripheral firmware upgrade method, system and mobile phone terminal
US11770212B2 (en)Data transmission methods, data transmission device, and data transmission apparatuses
CN110912805B (en) Synchronization method, terminal, server and system for message reading status
CN104935641A (en) Method and device for accelerating file transfer
CN111417168A (en) System information transmission method, terminal and network device
US20210289518A1 (en)Method for Navigation Control and Related Products
CN112887155B (en)QoS (quality of service) associated information synchronization method and related product
CN109302456A (en)A kind of document transmission method and device based on aerial downloading OTA technology
CN112866897B (en)Positioning measurement method, terminal and network node
CN109586832B (en)Wireless synchronization method, wireless slave, wireless master and wireless synchronization system
EP4175335A1 (en)Wifi network access method, communication method, peripheral apparatus, and storage medium
EP2515601A1 (en)Dial-up connection method and device of mobile data terminal
CN108024350B (en)Dynamic time allocation method and device
US11803494B2 (en)Data communication method, master device and system
CN112888032B (en)Lossless switching method, target base station and lossless switching system
CN112449357B (en) An information interaction method and related equipment

Legal Events

DateCodeTitleDescription
PB01Publication
PB01Publication
SE01Entry into force of request for substantive examination
SE01Entry into force of request for substantive examination
TA01Transfer of patent application right

Effective date of registration:20221123

Address after:No. 500 Songling Road, Laoshan District, Qingdao City, Shandong Province, 266100

Applicant after:GOERTEK TECHNOLOGY Co.,Ltd.

Address before:261031 workshop 1, phase III, Geer Photoelectric Industrial Park, 3999 Huixian Road, Yongchun community, Qingchi street, Weifang High tech Zone, Weifang City, Shandong Province

Applicant before:GoerTek Optical Technology Co.,Ltd.

TA01Transfer of patent application right
GR01Patent grant
GR01Patent grant

[8]ページ先頭

©2009-2025 Movatter.jp