A data transmission method and device based on BLE and BLE master device

By sequentially sending a preset number of data packets within the BLE communication gap and adjusting the maximum transmission unit, the problem of low efficiency of file transmission from the BLE master device to multiple slave devices is solved, the OTA upgrade speed is improved, and the user experience is improved.

CN114007209BActive Publication Date: 2024-09-27GEER TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202111265147.X
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2021-10-28
Publication Date
2024-09-27
Estimated Expiration
2041-10-28

AI Technical Summary

Technical Problem

In the BLE field, in the traditional OTA upgrade method, when the BLE master device transmits files to multiple slave devices, the sequential transmission results in low efficiency and the inability to fully utilize the BLE communication gap, which reduces the user experience.

Method used

Through the connection between the BLE master device and the slave device, a preset number of simultaneous transmission data packets are sent in sequence during each communication gap, and the maximum transmission unit is optionally adjusted to improve the length of the data packet and transmission efficiency.

Benefits of technology

It reduces the time for the BLE master device to transmit files to multiple slave devices, increases the speed of OTA upgrade, and improves the user experience.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN114007209B
    Figure CN114007209B
Patent Text Reader

Abstract

The present invention discloses a data transmission method and apparatus based on BLE, a BLE master device and a computer-readable storage medium, the method comprising: a BLE master device obtains a simultaneously transmitted file corresponding to each BLE slave device; wherein the number of BLE slave devices is greater than or equal to 2; utilizing a BLE connection between the BLE master device and the BLE slave device, and sending a preset number of simultaneously transmitted data packets corresponding to each BLE slave device in turn in each communication gap; wherein the simultaneously transmitted data packets are data packets corresponding to the simultaneously transmitted files; in the present invention, the BLE master device can send a 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 to transmit files to multiple slave devices, thereby being able to increase the OTA upgrade speed when performing OTA upgrades on the BLE slave devices, thereby improving the user experience.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of Bluetooth communication technology, and in particular to a BLE-based data transmission method, device, BLE master device and computer-readable storage medium. Background Art

[0002] Bluetooth technology is increasingly used in electronic products, especially in VR (Virtual Reality) technology, which requires real-time and efficient data transmission via Bluetooth to track the game controller of the supporting device. VR is generally equipped with dual game controllers. When upgrading via OTA (Over-the-Air Technology), the left and right controllers need to be upgraded in turn. The traditional method is to upgrade one controller first, and then upgrade the other after completion. The upgrade efficiency is not high, which reduces the user experience, so fast and efficient OTA is crucial.

[0003] In the BLE field, when a BLE master device transfers files to multiple slave devices, they are often transferred sequentially; for example, when the BLE master device needs to upgrade two slave devices, traditional OTA upgrades are all upgraded sequentially, that is, upgrade one handle first and then upgrade the other. This method is generally in a BLE communication gap (a minimum BLE communication gap is 7.5ms), the BLE master device only transmits a packet of data to a BLE slave device, and does not make good use of the BLE communication gap (this gap is also called timeslot). Therefore, how to reduce the transmission time of the BLE master device to transmit files to multiple slave devices, thereby increasing the OTA upgrade speed of the BLE slave device and improving the user experience, is a problem that needs to be solved urgently today. Summary of the invention

[0004] The purpose of the present invention is to provide a BLE-based data transmission method, device, BLE master device and computer-readable storage medium to reduce the transmission time of a BLE master device to transmit files to multiple slave devices, thereby increasing the OTA upgrade speed of the BLE slave device and improving the user experience.

[0005] In order to solve the above technical problems, the present invention provides a data transmission method based on BLE, comprising:

[0006] The BLE master device obtains the simultaneously transmitted files corresponding to each BLE slave device; wherein the number of the BLE slave devices is greater than or equal to 2;

[0007] Utilizing the BLE connection between the BLE master device and the BLE slave device, a preset number of simultaneously transmitted data packets corresponding to each BLE slave device are sent in turn to each BLE slave device in each communication interval; wherein the simultaneously transmitted data packets are data packets corresponding to the simultaneously transmitted files.

[0008] Optionally, the method utilizing the BLE connection between the BLE master device and the BLE slave device, before sending a preset number of simultaneous transmission data packets corresponding to each BLE slave device in sequence during each communication interval, further includes:

[0009] Disconnecting the BLE connection between the BLE master device and each of the BLE slave devices, and renegotiating the maximum transmission unit of BLE communication with each of the BLE slave devices, adjusting the original first packet length to a second packet length; wherein the second packet length is greater than the first packet length;

[0010] After the negotiation is completed, the BLE master device re-establishes a BLE connection with each of the BLE slave devices.

[0011] Optionally, disconnecting the BLE connection between the BLE master device and each of the BLE slave devices, and renegotiating a maximum transmission unit of BLE communication with each of the BLE slave devices, and adjusting the original first packet length to a second packet length, includes:

[0012] Utilizing the BLE connection between the BLE master device and the BLE slave device, sending a simultaneous transmission request to each of the BLE slave devices;

[0013] According to the request success information returned by each of the BLE slave devices, the BLE connection between the BLE master device and each of the BLE slave devices is disconnected, and the maximum transmission unit of BLE communication is renegotiated with each of the BLE slave devices.

[0014] Optionally, the method utilizing the BLE connection between the BLE master device and the BLE slave device, after sending a preset number of simultaneous transmission data packets corresponding to each of the BLE slave devices in sequence in each communication gap, further includes:

[0015] After successfully sending the corresponding simultaneous transmission files of each of the BLE slave devices, disconnecting the BLE connection between the BLE master device and each of the BLE slave devices again, and renegotiating the maximum transmission unit of BLE communication with each of the BLE slave devices, and adjusting the second packet length to the first packet length;

[0016] After the negotiation is completed, the BLE master device re-establishes a BLE connection with each of the BLE slave devices.

[0017] Optionally, when the simultaneously transmitted file is an upgrade file, the BLE master device obtains the simultaneously transmitted file corresponding to each BLE slave device, including:

[0018] When the BLE master device detects that each of the BLE slave devices needs to be upgraded, it obtains the upgrade file of each of the BLE slave devices.

[0019] Optionally, when the preset number is 1, utilizing the BLE connection between the BLE master device and the BLE slave device to sequentially send a preset number of data packets corresponding to each of the BLE slave devices in each communication gap while transmitting the data packets includes:

[0020] Obtaining a current data packet corresponding to each of the BLE slave devices; wherein the current data packet is any of the simultaneously transmitted data packets;

[0021] Sending the current data packets corresponding to each of the BLE slave devices in turn during the current communication interval;

[0022] According to the current data packet success information returned by each of the BLE slave devices, it is determined whether the simultaneously transmitted files corresponding to each of the BLE slave devices are successfully transmitted;

[0023] If not, executing the step of obtaining the current data packet corresponding to each of the BLE slave devices;

[0024] If so, it is true that the simultaneous transmission files corresponding to each of the BLE slave devices are successfully transmitted.

[0025] Optionally, the obtaining of current data packets corresponding to each of the BLE slave devices includes:

[0026] 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 data packet of the file transmitted simultaneously, then the next data packet in the transmission data packet corresponding to the current BLE slave device is obtained, and the next data packet is used as the current data packet corresponding to the current BLE slave device; wherein the current BLE slave device is any of the BLE slave devices;

[0027] If the success information of the current data packet corresponding to the current BLE slave device is not received, the current data packet in the transmission data packet corresponding to the current BLE slave device is obtained again.

[0028] The present invention also provides a BLE-based data transmission device, which is applied to a BLE master device, comprising:

[0029] A file acquisition module, used to acquire the simultaneously transmitted files corresponding to each BLE slave device; wherein the number of the BLE slave devices is greater than or equal to 2;

[0030] The file transfer module is used to utilize the BLE connection between the BLE master device and the BLE slave device to send a preset number of simultaneously transmitted data packets corresponding to each of the BLE slave devices in turn during each communication interval; wherein the simultaneously transmitted data packets are data packets corresponding to the simultaneously transmitted files.

[0031] The present invention also provides a BLE master device, comprising:

[0032] Memory for storing computer programs;

[0033] A processor is used to implement the steps of the BLE-based data transmission method as described above when executing the computer program.

[0034] In addition, the present invention also provides a computer-readable storage medium, on which a computer program is stored. When the computer program is executed by a processor, the steps of the BLE-based data transmission method as described above are implemented.

[0035] A BLE-based data transmission method provided by the present invention includes: a BLE master device obtains a simultaneously transmitted file corresponding to each BLE slave device; wherein the number of BLE slave devices is greater than or equal to 2; utilizing a BLE connection between the BLE master device and the BLE slave device, and sending a preset number of simultaneously transmitted data packets corresponding to each BLE slave device in turn in each communication interval; wherein the simultaneously transmitted data packets are data packets corresponding to the simultaneously transmitted files;

[0036] It can be seen that the present invention utilizes the BLE connection between the BLE master device and the BLE slave device, and transmits data packets while sending the corresponding preset number to each BLE slave device in each communication gap, so that the BLE master device can send a preset number of data packets to each slave device in each BLE communication gap, and can more efficiently utilize the BLE communication gap, reduce the transmission time of the BLE master device to transmit files to multiple slave devices, thereby increasing the OTA upgrade speed when performing OTA upgrades on the BLE slave device and improving the user experience. In addition, the present invention also provides a BLE-based data transmission device, a BLE master device, and a computer-readable storage medium, which also have the above-mentioned beneficial effects. BRIEF DESCRIPTION OF THE DRAWINGS

[0037] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on the provided drawings without paying creative work.

[0038] Figure 1 A flow chart of a BLE-based data transmission method provided by an embodiment of the present invention;

[0039] Figure 2 A schematic diagram of the system structure of another BLE-based data transmission method provided by an embodiment of the present invention;

[0040] Figure 3 A flowchart of another BLE-based data transmission method provided by an embodiment of the present invention;

[0041] Figure 4 A flowchart of another BLE-based data transmission method provided by an embodiment of the present invention;

[0042] Figure 5 A structural block diagram of a BLE-based data transmission device provided by an embodiment of the present invention;

[0043] Figure 6 A schematic diagram of the structure of a BLE master device provided by an embodiment of the present invention;

[0044] Figure 7 A schematic diagram of the specific structure of a BLE master device provided by an embodiment of the present invention. DETAILED DESCRIPTION

[0045] In order to make the purpose, technical solution and advantages of the embodiments of the present invention clearer, the technical solution in the embodiments of the present invention will be clearly and completely described below in conjunction with the drawings in the embodiments of the present invention. Obviously, the described embodiments are part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.

[0046] Please refer to Figure 1 , Figure 1 A flow chart of a BLE-based data transmission method provided by an embodiment of the present invention. The method may include:

[0047] Step 101: The BLE master device obtains the simultaneously transmitted files corresponding to each BLE slave device; wherein the number of the BLE slave devices is greater than or equal to 2.

[0048] Among them, the BLE master device in this step can be a device acting as a master device (Master) in a BLE connection, such as a head-mounted display (HMD) in a VR product; the BLE slave device can be a device acting as a slave device (Slave) in a BLE connection, such as a handle that is connected to a head-mounted display (ie, the BLE master device) by BLE.

[0049] Specifically, the simultaneously transmitted file in this step can be a file that the BLE master device needs to send to each BLE slave device simultaneously through the BLE connection, such as an upgrade file for each BLE slave device. The specific content of the simultaneously transmitted file corresponding to each BLE slave device in this embodiment can be set by the designer according to practical scenarios and user needs. For example, the simultaneously transmitted file corresponding to each BLE slave device can be the same file, such as the upgrade file of the BLE slave device when each BLE slave device is OTA upgraded; the simultaneously transmitted files corresponding to each BLE slave device can also be different files corresponding to each other. This embodiment does not impose any restrictions on this.

[0050] Similarly, the specific number of BLE slave devices in this embodiment can be set by the designer according to practical scenarios. For example, the number of BLE slave devices can be 2, for example Figure 2 In the example, two handles (BLE Slave handle 1 and BLE Slave handle 2) are connected to the VR HMD (i.e., the BLE master device) via BLE, or two TWS (True Wireless Stereo) headphones are connected to the charging box (i.e., the BLE master device) via BLE; the number of BLE slave devices can also be a positive integer greater than 2. This embodiment does not impose any restriction on this.

[0051] It should be noted that the specific method for the BLE master device to obtain the corresponding simultaneous transmission files of each BLE slave device in this step can be set by the designer according to practical scenarios and user needs. For example, the simultaneous transmission file is an upgrade file, that is, when the BLE master device in this embodiment simultaneously upgrades each BLE slave device, the BLE master device can obtain the upgrade file (i.e., simultaneous transmission file) of each BLE slave device when it detects that each BLE slave device needs to be upgraded, for example, downloading the upgrade file of each BLE slave device from the server. As long as the BLE master device can obtain the simultaneous transmission file that needs to be transmitted to each BLE slave device simultaneously, this embodiment does not impose any restrictions on this.

[0052] Step 102: utilizing the BLE connection between the BLE master device and the BLE slave device, sending a preset number of simultaneously transmitted data packets corresponding to each BLE slave device in turn during each communication interval; wherein the simultaneously transmitted data packets are data packets corresponding to the simultaneously transmitted files.

[0053] It can be understood that in this step, the BLE master device can use its BLE connection with each BLE slave device to send a preset number of data packets (i.e., simultaneous transmission data packets) of the corresponding simultaneous transmission files to each BLE slave device in each communication gap (i.e., BLE communication gap) in turn to complete the simultaneous transmission of the corresponding simultaneous transmission files of each BLE slave device. That is to say, in this step, the BLE master device can send a preset number of simultaneous transmission data packets to each BLE slave device in turn in each communication gap during the process of sending the corresponding simultaneous transmission files to each BLE slave device, until the corresponding simultaneous transmission files of each BLE slave device are successfully sent.

[0054] Specifically, the simultaneous transmission data packet in this step can be a data packet transmitted during the simultaneous transmission of the file. In this step, the BLE master device can improve the efficiency of the BLE master device sending the simultaneous transmission file to each BLE slave device and reduce the transmission time by sending a preset number of simultaneous transmission data packets to each BLE slave device in each BLE communication gap. In order to further improve the efficiency of file transmission, in this embodiment, the BLE master device can renegotiate the MTU (maximum transmission unit) with each BLE slave device before sending the simultaneous transmission file to each BLE slave device to increase the packet length of the BLE transmission, that is, to increase the data volume of the simultaneous transmission data packet, thereby reducing the number of data packets corresponding to the simultaneous transmission file (i.e., simultaneous transmission data packets); for example, in this embodiment, the BLE master device can disconnect the BLE connection between the BLE master device and each BLE slave device before step 102, and renegotiate the maximum transmission unit of the 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 re-establishes the BLE connection with each BLE slave device and enters step 102; wherein the second packet length is greater than the first packet length.

[0055] Correspondingly, in this embodiment, the BLE master device can, after sending the simultaneous transmission file to each BLE slave device, renegotiate the MTU (maximum transmission unit) with each BLE slave device to restore the packet length of the BLE transmission to the packet length of the normal BLE transmission; for example, in this embodiment, the BLE master device can, after step 102, after successfully sending the corresponding simultaneous transmission files to each BLE slave device, disconnect the BLE connection between the BLE master device and each BLE slave device again, and renegotiate the maximum transmission unit of BLE communication with each BLE slave device to adjust the second packet length to the first packet length.

[0056] It should be noted that the specific settings of the communication gap (i.e., BLE communication gap) in this step and the simultaneous transmission of a preset number of data packets to each BLE slave device in each communication gap can be set by the designer according to practical scenarios and user needs. For example, the communication gap can be the smallest BLE communication gap, such as 7.5ms. In each communication gap, the BLE master device can send the preset number of simultaneous transmission data packets corresponding to each BLE slave device in turn according to the preset time interval, such as the preset time interval can be the quotient of the communication gap and the number of 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 can be 3.75ms, that is, within 7.5ms, at an interval of 3.75ms, the BLE master device first sends a preset number of simultaneous transmission data packets corresponding to a BLE slave device, and then sends a preset number of simultaneous transmission data packets corresponding to another BLE slave device; similarly, when the BLE master device receives the ACK (confirmation character) packet of the BLE slave device, it is also at an interval of 3.75ms to receive the ack packets of the two BLE slave devices respectively to ensure the validity of the data during the transmission process.

[0057] Correspondingly, for the specific numerical setting of the preset number in this embodiment, that is, the number of simultaneous transmission data packets sent by the BLE master device to each BLE slave device in each communication gap, it can be set by the designer. For example, the preset number in this embodiment can be 1, that is, in a 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 the corresponding BLE slave device, the success information (such as an ACK packet) corresponding to the simultaneous transmission data packet returned by the BLE slave device can be received, so as to avoid packet loss or simultaneous transmission file verification errors, and ensure the transmission success rate of the simultaneous transmission file (such as the upgrade file), thereby ensuring the OTA upgrade success rate of the BLE slave device. The preset number in this embodiment can also be a value greater than or equal to 2, and this embodiment does not impose any restrictions on this.

[0058] Specifically, in this step, the BLE master device uses the BLE connection between the BLE master device and the BLE slave device to send the preset number of simultaneous transmission data packets corresponding to each BLE slave device in turn in each communication gap. The specific method can be set by the designer according to the usage scenario and user needs. For example, when the preset number is 1, the BLE master device in this step can obtain the current data packet corresponding to each BLE slave device; send the current data packet corresponding to each BLE slave device in turn in the current communication gap; according to the current data packet success information returned by each BLE slave device, determine whether the simultaneous transmission files corresponding to each BLE slave device are successfully transmitted; if not, execute the step of obtaining the current data packet corresponding to each BLE slave device; if so, it is true that the simultaneous transmission files corresponding to each BLE slave device are successfully transmitted. Among them, the current data packet corresponding to each BLE slave device is any simultaneous transmission data packet of the simultaneous transmission file corresponding to each BLE slave device.

[0059] In this embodiment, the embodiment of the present invention utilizes the BLE connection between the BLE master device and the BLE slave device, and sends a preset number of data packets corresponding to each BLE slave device in turn in each communication gap, so that the BLE master device can send a preset number of data packets to each slave device in each BLE communication gap, and can more efficiently utilize the BLE communication gaps, reduce the transmission time of the BLE master device to transmit files to multiple slave devices, thereby increasing the OTA upgrade speed when performing OTA upgrades on the BLE slave devices and improving the user experience.

[0060] Please refer to Figure 3 , Figure 3 A flowchart of another BLE-based data transmission method provided by an embodiment of the present invention. The method may include:

[0061] Step 201: When the BLE master device detects that each BLE slave device needs to be upgraded, it obtains the upgrade file of each BLE slave device.

[0062] Among them, this embodiment is demonstrated by taking the OTA upgrade of each BLE slave device by the BLE master device as an example, that is, in this embodiment, the BLE master device can improve the OTA upgrade speed of the BLE slave device by simultaneously transmitting the upgrade file to each BLE slave device; for the process of the BLE master device transmitting other files to each BLE slave device, the corresponding setting can be adopted in a manner similar to the method provided in this embodiment, and this embodiment does not impose any restrictions on this.

[0063] Specifically, Figure 2As shown, the BLE master device in this embodiment may be a VR HMD, and the BLE slave devices in this embodiment may be two handles (BLE Slave handle 1 and BLE Slave handle 2) connected to the VR HMD via BLE; in this step, the processor (such as CPU) in the BLE master device may obtain the upgrade file of each BLE slave device when it is detected that each BLE slave device needs to be upgraded.

[0064] Correspondingly, the method provided in this embodiment may further include the BLE master device detecting whether each BLE slave device needs to be upgraded; if so, entering step 201; if not, ending this process or waiting for the next detection of whether each BLE slave device needs to be upgraded. This embodiment does not limit the specific method of the BLE master device detecting whether each BLE slave device needs to be upgraded, such as being implemented in the same or similar manner as the prior art BLE master device upgrade detection method for each BLE slave device.

[0065] Step 202: disconnect the BLE connection between the BLE master device and each BLE slave device, and renegotiate the maximum transmission unit of BLE communication with each BLE slave device, and adjust the original first packet length to a second packet length; wherein the second packet length is greater than the first packet length.

[0066] 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, which can reduce the number of upgrade data packets corresponding to the upgrade file, thereby reducing the transmission time of the upgrade file.

[0067] Specifically, in this step, the BLE master device disconnects the BLE connection between the BLE master device and each BLE slave device, and renegotiates the maximum transmission unit (MTU) of the BLE communication with each BLE slave device, and adjusts the original first packet length to the second packet length. The specific method can be set by the designer according to practical scenarios and user needs. For example, the BLE master device can use its BLE connection with the BLE slave device to send a simultaneous transmission request to each BLE slave device (such as Figure 4 The upgrade request in the BLE master device is used to inform each BLE slave device of the upcoming simultaneous file transfer event; according to the request success information (such as ACK packet) returned by each BLE slave device, the BLE connection between the BLE master device and each BLE slave device is disconnected, and the maximum transmission unit of the BLE communication is renegotiated with each BLE slave device to adjust the MTU from the first packet length of the normal BLE communication to the second packet length of the simultaneous file transfer.

[0068] like Figure 2 and Figure 4As shown, when the CPU of the BLE master device detects that two BLE slave devices (BLE slave) need to be upgraded, the CPU can first send an upgrade request packet to the Bluetooth component (BLEhost) of the BLE master device through wired transmission, so that the BLE Host sends this upgrade event (i.e., simultaneous transmission request) to the two connected BLE slave devices through BLE; after the two BLE slave devices receive this upgrade event, they set the MTU to the size required for the OTA upgrade transmission process (i.e., the second packet length) in order to reduce the total number of packets transmitted by OTA, thereby reducing the upgrade time; when the two BLE slave devices return ACK (i.e., request success information) to the BLE Host, after the BLE Host receives the ACK, the BLE master device or the BLE slave device can actively disconnect Bluetooth and renegotiate the MTU.

[0069] Step 203: After the negotiation is completed, the BLE master device re-establishes the BLE connection with each BLE slave device.

[0070] It is understandable that in this step, the BLE master device can re-establish a BLE connection with each BLE slave device after renegotiating the MTU of BLE communication with each BLE slave device, so as to transmit the upgrade file to each BLE slave device using the re-established BLE connection.

[0071] Step 204: Obtain the current data packet corresponding to each BLE slave device; wherein the current data packet is any upgrade data packet of the upgrade file.

[0072] Specifically, in this step, the BLE master device can obtain an upgrade data packet (i.e., current data packet) of the upgrade file corresponding to each BLE slave device that needs to be sent in the current time interval. The current data packet corresponding to each BLE slave device can be the same upgrade data packet, such as the first upgrade data packet sent to each BLE slave device; the current data packet corresponding to each BLE slave device can also be a different upgrade data packet, such as after the upgrade data packet sent to any BLE slave device fails, the current upgrade data packet corresponding to the BLE slave device can be the upgrade data packet that failed to be sent last time, and the current upgrade data packet corresponding to other BLE slave devices can be the next upgrade data packet to be sent.

[0073] That is to say, in this step, the BLE master device can 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 interval; for example, when the BLE master device sends an upgrade data packet to each BLE slave device for the first time in this step, the first upgrade data packet of the upgrade file can be directly obtained as the current data packet corresponding to each BLE slave device; when the BLE master device sends an upgrade data packet to each BLE slave device thereafter, if the current data packet success information corresponding to the current BLE slave device is received, and the current data packet corresponding to the current BLE slave device If it is not the last data packet of the simultaneously transmitted file (i.e., the upgrade file), the next data packet in the transmission file corresponding to the current BLE slave device is obtained, and the next data packet is used 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, the current data packet in the transmission data packet corresponding to the current BLE slave device is obtained 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 data packet of the simultaneously transmitted file, it can be determined that the upgrade file of the current BLE slave device is successfully transmitted; wherein, the current BLE slave device is any BLE slave device.

[0074] like Figure 2 and Figure 4 As shown, after the BLE Host of the BLE master device renegotiates the MTU with the two BLE slave devices and successfully re-establishes the BLE connection, it notifies the CPU of the BLE master device. In this step, the CPU can prepare the current data packets (upgrade data packets) corresponding to each BLE slave device, and then send them to the two BLE slave devices through the BLE Host.

[0075] Step 205: Send the current data packet corresponding to each BLE slave device in turn during the current communication interval.

[0076] Among them, in this step, the BLE master device can send the current data packet corresponding to each BLE slave device in turn during the current communication interval; Figure 2 and Figure 4 As shown, the CPU of the BLE master device can send the current data packets corresponding to each BLE slave device to the BLE Host, so that the BLE Host can send the current data packets corresponding to each BLE slave device in turn during the current communication interval; for example, when the communication interval is 7.5ms, the 7.5ms of the communication interval can be divided into two 3.75ms, that is, within 7.5ms, the BLE Host sends a packet of upgrade data (i.e., the current data packet) to each of the two BLE slave devices at an interval of 3.75ms.

[0077] Step 206: According to the current data packet success information returned by each BLE slave device, determine whether the upgrade files corresponding to each BLE slave device are successfully transmitted; if not, proceed to step 204; if yes, proceed to step 207.

[0078] It can be understood that in this step, the BLE master device determines whether the upgrade files corresponding to each BLE slave device are successfully transmitted based on the current data packet success information returned by each BLE slave device, and determines whether the upgrade file transmission to each BLE slave device is completed.

[0079] Specifically, in this step, the BLE master device separately or sequentially determines whether the current data packet success information returned by the current BLE slave device is received and determines whether the current data packet corresponding to the current BLE slave device is the last data packet of the file (i.e., the upgrade file) transmitted simultaneously; when the 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 data packet of the upgrade file, it is determined that the upgrade file of the current BLE slave device is successfully transmitted; when the current data packet success information 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 data packet of the upgrade file, it is determined that the upgrade file of the current BLE slave device is not successfully transmitted; thereby determining whether the upgrade files of all BLE slave devices have completed the transmission.

[0080] like Figure 2 and Figure 4 As shown, after the BLE Host of the BLE master device receives the ACK packet of the BLE slave device, it returns the ACK packet to the CPU, and then the CPU determines whether the received ACK packet is successful or failed. If it is successful (that is, the current data packet is successful), the CPU continues to transmit the next upgrade data packet corresponding to the BLE slave device to the BLE Host, otherwise the CPU continues to transmit the current data packet. When transmitting the next upgrade data packet, the CPU needs to determine whether it is the last packet. If it is the last packet, when the CPU receives the successful ACK of the last packet, it determines that the upgrade file transmission of the BLE slave device is successfully completed.

[0081] Step 207: After confirming that the upgrade files corresponding to each BLE slave device are successfully transmitted, the BLE connection between the BLE master device and each BLE slave device is disconnected again, and the maximum transmission unit of BLE communication is renegotiated with each BLE slave device, and the second packet length is adjusted to the first packet length.

[0082] Among them, in this step, after the BLE master device has confirmed that the simultaneously transmitted files corresponding to each BLE slave device have been successfully transmitted, the BLE master device disconnects the BLE connection between the BLE master device and each BLE slave device again, and renegotiates the maximum transmission unit of BLE communication with each BLE slave device. The MTU of BLE communication can be adjusted from the second packet length during upgrade file transmission to the first packet length of normal BLE communication, so as to ensure that the subsequent BLE master device can perform normal BLE communication with each BLE slave device.

[0083] Specifically, in this step, the BLE master device can first send a file transfer completion message (such as Figure 4 The upgrade completion packet in the BLE master device is sent to the BLE slave device to enable the BLE slave device to understand that the upgrade file transfer is complete; then, because the BLE master device or the BLE slave device actively disconnects the BLE connection between the BLE master device and each BLE slave device, and renegotiates the maximum transmission unit of the BLE communication between the BLE master device and each BLE slave device, the second packet length is adjusted to the first packet length. Figure 4 As shown, after the CPU of the BLE master device determines that the upgrade files corresponding to each BLE slave device are successfully transmitted, the BLE Host can send an upgrade completion packet to the two BLE slave devices, so that the two BLE slave devices can restart the upgrade according to the received upgrade completion packet, and actively disconnect the BLE connection, renegotiate the maximum transmission unit (MTU) of the BLE communication with the BLE master device, and adjust the second packet length to the original first packet length.

[0084] Step 208: After the negotiation is completed, the BLE master device re-establishes the BLE connection with each BLE slave device.

[0085] It can be understood that in this step, the BLE master device re-establishes a BLE connection with each BLE slave device whose MTU is the first packet, so that the BLE master device can perform normal BLE communication with each BLE slave device.

[0086] In this embodiment, the embodiment of the present invention can send an upgrade data packet to each BLE slave device in each communication interval by sending the corresponding current data packet to each BLE slave device in sequence during the current communication interval, thereby ensuring that each BLE slave device can receive a reply confirmation from the BLE slave device after sending each upgrade data packet, reducing the occurrence of packet loss or verification errors, ensuring the accuracy of upgrade file transmission, and thus improving the OTA upgrade success rate of the BLE slave device.

[0087] Corresponding to the above method embodiment, an embodiment of the present invention further provides a BLE-based data transmission device. The BLE-based data transmission device described below and the BLE-based data transmission method described above can refer to each other.

[0088] Please refer to Figure 5 , Figure 5 This is a structural block diagram of a BLE-based data transmission device provided by an embodiment of the present invention. The data transmission device is applied to a BLE master device and may include:

[0089] The file acquisition module 10 is used to acquire the simultaneously transmitted files corresponding to each BLE slave device; wherein the number of BLE slave devices is greater than or equal to 2;

[0090] The file transmission module 20 is used to utilize the BLE connection between the BLE master device and the BLE slave device to send a corresponding preset number of simultaneous transmission data packets to each BLE slave device in turn during each communication interval; wherein the simultaneous transmission data packets are data packets corresponding to the simultaneous transmission files.

[0091] Optionally, the device may further include:

[0092] The MTU adjustment module is used to disconnect the BLE connection between the BLE master device and each BLE slave device, and renegotiate the maximum transmission unit of the BLE communication with each BLE slave device, and adjust the original first packet length to the second packet length; wherein the second packet length is greater than the first packet length;

[0093] The BLE reconnection module is used to enable the BLE master device to reestablish the BLE connection with each BLE slave device after the negotiation is completed, and send a start signal to the file transfer module 20.

[0094] Optionally, the MTU adjustment module may include:

[0095] A request sending submodule, used to send a simultaneous transmission request to each BLE slave device by utilizing the BLE connection between the BLE master device and the BLE slave device;

[0096] The disconnection adjustment submodule is used to disconnect the BLE connection between the BLE master device and each BLE slave device according to the request success information returned by each BLE slave device, and renegotiate the maximum transmission unit of BLE communication with each BLE slave device.

[0097] Optionally, the device may further include:

[0098] The MTU recovery module is used to disconnect the BLE connection between the BLE master device and each BLE slave device after successfully sending the corresponding simultaneous transmission files of each BLE slave device, and renegotiate the maximum transmission unit of BLE communication with each BLE slave device, and adjust the second packet length to the first packet length;

[0099] The BLE connection recovery module is used to re-establish the BLE connection between the BLE master device and each BLE slave device after the negotiation is completed.

[0100] Optionally, when the file to be transmitted is an upgrade file, the file acquisition module 10 may be specifically used to acquire the upgrade file of each BLE slave device when it is detected that each BLE slave device needs to be upgraded.

[0101] Optionally, when the preset number is 1, the file transmission module 20 may include:

[0102] The data packet acquisition submodule is used to acquire the current data packet corresponding to each BLE slave device; wherein the current data packet is any simultaneously transmitted data packet;

[0103] The data packet transmission submodule is used to send the current data packet corresponding to each BLE slave device in turn during the current communication interval;

[0104] The transmission judgment submodule is used to judge whether the simultaneous transmission files corresponding to each BLE slave device are successfully transmitted according to the current data packet success information returned by each BLE slave device; if not, a start signal is sent to the data packet acquisition submodule; if so, it is true that the simultaneous transmission files corresponding to each BLE slave device are successfully transmitted.

[0105] Optionally, the data packet acquisition submodule can be specifically used to obtain the next data packet in the transmission data packet corresponding to the current BLE slave device if the current data packet success information 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 data packet for simultaneously transmitting the file, and use the next data packet as the current data packet corresponding to the current BLE slave device; if the current data packet success information corresponding to the current BLE slave device is not received, then obtain the current data packet in the transmission data packet corresponding to the current BLE slave device again; wherein the current BLE slave device is any BLE slave device.

[0106] In this embodiment, the embodiment of the present invention utilizes the BLE connection between the BLE master device and the BLE slave device through the file transfer module 20, and transmits a preset number of data packets corresponding to each BLE slave device in turn in each communication gap, so that the BLE master device can send a preset number of data packets to each slave device in each BLE communication gap, and can more efficiently utilize the BLE communication gap, reduce the transmission time of the BLE master device to transmit files to multiple slave devices, thereby increasing the OTA upgrade speed when performing OTA upgrades on the BLE slave devices and improving the user experience.

[0107] Corresponding to the above method embodiment, the embodiment of the present invention further provides a BLE master device. The BLE master device described below and the BLE-based data transmission method described above can refer to each other.

[0108] Please refer to Figure 6 , Figure 6 A schematic diagram of the structure of a BLE master device provided by an embodiment of the present invention. The BLE master device may include:

[0109] A memory D1, for storing computer programs;

[0110] The processor D2 is used to implement the steps of the BLE-based data transmission method provided in the above method embodiment when executing a computer program.

[0111] For details, please refer to Figure 7 , Figure 7 A specific structural diagram of a BLE master device provided in an embodiment of the present invention, the BLE master device 310 may have relatively large differences due to different configurations or performances, and may include one or more processors (central processing units, CPU) 322 (for example, one or more processors) and memory 332, one or more storage media 330 (for example, one or more mass storage devices) storing application programs 342 or data 344. Among them, the memory 332 and the storage medium 330 can be short-term storage or permanent storage. The program stored in the storage medium 330 may include one or more units (not shown in the figure), and each unit may include a series of instruction operations in the electronic device. Furthermore, the central processor 322 can be configured to communicate with the storage medium 330 to execute a series of instruction operations in the storage medium 330 on the BLE master device 310.

[0112] The 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 and output interfaces 358, and / or one or more operating systems 341. For example, Windows Server™, Mac OS X™, Unix™, Linux™, FreeBSD™, etc. The BLE master device 310 may also include a Bluetooth component.

[0113] Among them, the BLE master device 310 can be specifically a head-mounted display (HMD).

[0114] The steps in the BLE-based data transmission method described above can be implemented by the structure of a BLE master device.

[0115] Corresponding to the above method embodiment, an embodiment of the present invention further provides a computer-readable storage medium. The computer-readable storage medium described below and the BLE-based data transmission method described above can refer to each other.

[0116] A computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the steps of the BLE-based data transmission method provided in the above method embodiment are implemented.

[0117] The computer-readable storage medium may be a USB flash drive, a mobile hard disk, a read-only memory (ROM), a random access memory (RAM), a magnetic disk or an optical disk, or any other readable storage medium that can store program codes.

[0118] The various embodiments in the specification are described in a progressive manner, and each embodiment focuses on the differences from other embodiments. The same or similar parts between the various embodiments can be referred to each other. For the device, BLE master device and computer-readable storage medium disclosed in the embodiment, since they correspond to the method disclosed in the embodiment, the description is relatively simple, and the relevant parts can be referred to the method part description.

[0119] The above is a detailed introduction to a BLE-based data transmission method, apparatus, BLE master device and computer-readable storage medium provided by the present invention. Specific examples are used in this article to illustrate the principles and implementation methods of the present invention. The description of the above embodiments is only used to help understand the method of the present invention and its core idea. It should be pointed out that for ordinary technicians in this technical field, without departing from the principles of the present invention, several improvements and modifications can be made to the present invention, and these improvements and modifications also fall within the scope of protection of the claims of the present invention.

Claims

1. A data transmission method based on BLE, It is characterized in that include: The BLE master device obtains the simultaneously transmitted files corresponding to each BLE slave device; wherein the number of the BLE slave devices is greater than or equal to 2; Disconnecting the BLE connection between the BLE master device and each of the BLE slave devices, and renegotiating the maximum transmission unit of BLE communication with each of the BLE slave devices, 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 re-establishes a BLE connection with each of the BLE slave devices; Utilizing the BLE connection between the BLE master device and the BLE slave device, sending a preset number of simultaneously transmitted data packets corresponding to each of the BLE slave devices in turn in each communication interval; wherein the simultaneously transmitted data packets are data packets corresponding to the simultaneously transmitted files; The method of disconnecting the BLE connection between the BLE master device and each of the BLE slave devices, and renegotiating the maximum transmission unit of BLE communication with each of the BLE slave devices, and adjusting the original first packet length to the second packet length includes: Utilizing the BLE connection between the BLE master device and the BLE slave device, sending a simultaneous transmission request to each of the BLE slave devices; According to the request success information returned by each of the BLE slave devices, disconnect the BLE connection between the BLE master device and each of the BLE slave devices, and renegotiate the maximum transmission unit of BLE communication with each of the BLE slave devices; The method further comprises: utilizing the BLE connection between the BLE master device and the BLE slave device, and after sending a preset number of simultaneous transmission data packets corresponding to each BLE slave device in sequence in each communication interval, the method further comprises: After successfully sending the corresponding simultaneous transmission files of each of the BLE slave devices, disconnecting the BLE connection between the BLE master device and each of the BLE slave devices again, and renegotiating the maximum transmission unit of BLE communication with each of the BLE slave devices, and adjusting the second packet length to the first packet length; After the negotiation is completed, the BLE master device re-establishes a BLE connection with each of the BLE slave devices.

2. The BLE-based data transmission method according to claim 1, It is characterized in that When the simultaneously transmitted file is an upgrade file, the BLE master device obtains the simultaneously transmitted files corresponding to each BLE slave device, including: When the BLE master device detects that each of the BLE slave devices needs to be upgraded, it obtains the upgrade file of each of the BLE slave devices.

3. The BLE-based data transmission method according to claim 1 or 2, It is characterized in that When the preset number is 1, the method of utilizing the BLE connection between the BLE master device and the BLE slave device to sequentially send a preset number of data packets corresponding to each BLE slave device to each BLE slave device in each communication interval simultaneously includes: Obtaining a current data packet corresponding to each of the BLE slave devices; wherein the current data packet is any of the simultaneously transmitted data packets; Sending the current data packets corresponding to each of the BLE slave devices in turn during the current communication interval; According to the current data packet success information returned by each of the BLE slave devices, it is determined whether the simultaneously transmitted files corresponding to each of the BLE slave devices are successfully transmitted; If not, executing the step of obtaining the current data packet corresponding to each of the BLE slave devices; If so, it is true that the simultaneous transmission files corresponding to each of the BLE slave devices are successfully transmitted.

4. The BLE-based data transmission method according to claim 3, It is characterized in that The obtaining of the current data packets corresponding to each of the BLE slave devices 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 data packet of the file transmitted simultaneously, then the next data packet in the transmission data packet corresponding to the current BLE slave device is obtained, and the next data packet is used as the current data packet corresponding to the current BLE slave device; wherein the current BLE slave device is any of the BLE slave devices; If the success information of the current data packet corresponding to the current BLE slave device is not received, the current data packet in the transmission data packet corresponding to the current BLE slave device is obtained again.

5. A data transmission device based on BLE, It is characterized in that Applicable to BLE master devices, including: A file acquisition module, used to acquire the simultaneously transmitted files corresponding to each BLE slave device; wherein the number of the BLE slave devices is greater than or equal to 2; The MTU adjustment module is used to disconnect the BLE connection between the BLE master device and each of the BLE slave devices, and renegotiate the maximum transmission unit of the BLE communication with each of the BLE slave devices, and adjust the original first packet length to a second packet length; wherein the second packet length is greater than the first packet length; A BLE reconnection module, used for re-establishing the BLE connection between the BLE master device and each of the BLE slave devices after the negotiation is completed, and sending a start signal to the file transfer module; A file transmission module, used to utilize the BLE connection between the BLE master device and the BLE slave device to sequentially send a corresponding preset number of simultaneous transmission data packets to each of the BLE slave devices in each communication interval; wherein the simultaneous transmission data packets are data packets corresponding to the simultaneous transmission files; It also includes: an MTU recovery module, which is used to disconnect the BLE connection between the BLE master device and each of the BLE slave devices after successfully sending the corresponding simultaneous transmission files of each of the BLE slave devices, and renegotiate the maximum transmission unit of BLE communication with each of the BLE slave devices, and adjust the second packet length to the first packet length; A BLE connection recovery module, used for re-establishing the BLE connection between the BLE master device and each of the BLE slave devices after the negotiation is completed; Wherein, the MTU adjustment module includes: A request sending submodule, used to send a simultaneous transmission request to each of the BLE slave devices by utilizing the BLE connection between the BLE master device and the BLE slave device; The disconnection adjustment submodule is used to disconnect the BLE connection between the BLE master device and each of the BLE slave devices according to the request success information returned by each of the BLE slave devices, and renegotiate the maximum transmission unit of BLE communication with each of the BLE slave devices.

6. A BLE master device, It is characterized in that include: Memory for storing computer programs; A processor, configured to implement the steps of the BLE-based data transmission method as described in any one of claims 1 to 4 when executing the computer program.

7. A computer-readable storage medium, It is characterized in that The computer-readable storage medium stores a computer program, and when the computer program is executed by the processor, the steps of the BLE-based data transmission method according to any one of claims 1 to 4 are implemented.