Data transmission method and device, electronic equipment, storage medium and program product

By determining the number of interval packages based on the signal strength in BLE data transmission, and waiting for the confirmation package in the terminal device, the transmission of the BLE data transmission has been solved, and the stability of the BLE data transmission is poor, and the improvement of the data packet integrity and the transmission efficiency are improved.

CN119364326AInactive Publication Date: 2025-01-24深圳毕加索电子有限公司
View PDF 6 Cites 0 Cited by

Patent Information

Application Number
CN202411921286.7
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-12-25
Publication Date
2025-01-24
Estimated Expiration
Not applicable · inactive patent

AI Technical Summary

Technical Problem

BLE data transmission is poor, and it is prone to packet loss problems, resulting in file corruption, and limiting the use of BLE.

Method used

By determining the number of interval packets based on the current signal strength in the terminal device, the terminal device waits for the confirmation packet from the Bluetooth device when the sent data packets reach the first preset number, ensuring the integrity of the data packet, and continues transmission after receiving the confirmation packet. packets until a second preset number is reached or a stop message is received.

Benefits of technology

The reliability of the BLE transmission file is achieved, the lack of files is avoided, the efficiency of the transmission file is improved, and the phenomenon of over time is reduced.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119364326A_ABST
    Figure CN119364326A_ABST
Patent Text Reader

Abstract

The invention relates to the technical field of wireless communication, and discloses a data transmission method and device, electronic equipment, a storage medium and a program product. The number of the interval packets is used for indicating that the terminal equipment waits for acknowledgement packets from the Bluetooth equipment when the number of the sent data packets reaches a first preset number; sending a transmission request message to the Bluetooth device; after a request response message from the Bluetooth device is received, reading a second preset number of data packets formed by packaging the file to be transmitted; continuously sending a first preset number of data packets to the Bluetooth device, and waiting for an acknowledgement packet; and after the acknowledgement packet is received, returning to the step of continuously sending the first preset number of data packets to the Bluetooth device until the sent data packets reach the second preset number or the stop message is received. According to the invention, the file transmission efficiency can be improved while the stable file transmission between the terminal equipment and the Bluetooth equipment is ensured.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of wireless communication technology, and in particular to a data transmission method, device, electronic equipment, storage medium and program product. Background Art

[0002] Compared with classic Bluetooth, Bluetooth Low Energy (BLE) can reduce power consumption and cost while maintaining the same communication range. Devices such as wearable devices and smart homes can access BLE to transmit data with terminal devices with control functions.

[0003] However, due to the transmission bandwidth and transmission distance of BLE technology, the processing power of Bluetooth devices, and the complex wireless environment, BLE data transmission stability is poor, and problems such as data packet loss are prone to occur during data transmission, which can lead to file corruption and limit the use scenarios of BLE. Summary of the invention

[0004] In view of this, the present invention provides a data transmission method, device, electronic device, storage medium and program product to improve the problem of data packet loss during BLE data transmission.

[0005] In a first aspect, the present invention provides a data transmission method, which is applied to a terminal device with a Bluetooth function, and the terminal device is communicatively connected with the Bluetooth device, and the method comprises: determining the number of interval packets according to the current signal strength, the number of interval packets being used to instruct the terminal device to wait for a confirmation packet from the Bluetooth device when the number of data packets sent reaches a first preset number; sending a transmission request message to the Bluetooth device, the transmission request message being used to request the Bluetooth device to receive data, and being used to instruct the Bluetooth device to send a confirmation packet to the terminal device when the number of received data packets reaches a first preset number; after receiving the request response message from the Bluetooth device, reading a second preset number of data packets formed by encapsulating the file to be transmitted, the second preset number being greater than the first preset number; continuously sending a first preset number of data packets to the Bluetooth device, and waiting for a confirmation packet; after receiving the confirmation packet, returning to the step of continuously sending the first preset number of data packets to the Bluetooth device, until the number of data packets sent reaches a second preset number or a stop message is received.

[0006] In the data transmission method provided in this embodiment, the terminal device continues to transmit the data packet only after receiving the confirmation packet from the Bluetooth device, which can ensure the integrity of the data packet received by the Bluetooth device, avoid file loss, and achieve the reliability of BLE transmission files. In addition, in the data transmission method provided in this embodiment, the terminal device also determines the number of interval packets according to the current signal strength. The terminal device waits for the confirmation packet only after continuously sending the first preset number of data packets according to the number of interval packets, instead of waiting for the confirmation packet every time a data packet is sent, which can improve the efficiency of file transmission.

[0007] In an optional embodiment, a second preset number of data packets are set with sequence numbers. After continuously sending the first preset number of data packets to the Bluetooth device, the method also includes: receiving a retransmission request message from the Bluetooth device, the retransmission request message including the sequence number of the lost data packet; and resending the lost data packet to the Bluetooth device according to the sequence number of the lost data packet.

[0008] In this embodiment, the Bluetooth device sets a timeout duration, and when a first preset number of data packets are not received within the preset duration, a retransmission request message is sent to the terminal device to retrieve the lost data packets, thereby avoiding the problem of packet loss.

[0009] In an optional embodiment, after continuously sending a first preset number of data packets to the Bluetooth device, the method further includes: updating the number of interval packets based on the number of retransmission request messages received, the updated number of interval packets being used to instruct the terminal device to wait for a confirmation packet when the next number of data packets sent reaches a third preset number, the third preset number being different from the first preset number; sending an update message to the Bluetooth device, the update message being used to instruct the Bluetooth device to send a confirmation packet to the terminal device when the next number of data packets received reaches the third preset number.

[0010] In this embodiment, during the transmission process, the number of interval packets is dynamically adjusted according to the packet loss situation, which can not only reduce the waiting time for confirmation and improve the transmission efficiency, but also avoid a large number of timeout retransmission phenomena.

[0011] In an optional implementation, the request response message includes the sequence number of the data packet required by the Bluetooth device, and continuously sending a first preset number of data packets to the Bluetooth device includes: continuously sending a first preset number of data packets to the Bluetooth device according to the sequence number of the data packet required by the Bluetooth device.

[0012] In this embodiment, the request response message sent by the Bluetooth device to the terminal device includes the sequence number of the data packet required by the Bluetooth device, which can avoid repeated transmission of the data packet corresponding to the file to be transmitted and realize breakpoint resume.

[0013] In an optional implementation, after continuously sending a first preset number of data packets to the Bluetooth device, the method further includes: caching the sent first preset number of data packets in a cache module; and after receiving a confirmation packet, deleting the cached data in the cache module.

[0014] In this embodiment, the data packet is stored in the cache module in case of timeout retransmission. When retransmission is required, it can be retransmitted quickly and discarded after the Bluetooth device confirms successful reception.

[0015] In a second aspect, the present invention provides a data transmission method, which is applied to a Bluetooth device, wherein the Bluetooth device is communicatively connected to a terminal device having a Bluetooth function, and the method comprises: receiving a transmission request message from the terminal device, the transmission request message being used to request the Bluetooth device to receive data, and being used to instruct the Bluetooth device to send a confirmation packet to the terminal device when the number of received data packets reaches a first preset number; sending a request response message to the terminal device; receiving a data packet from the terminal device; and sending a confirmation packet to the terminal device after the number of received data packets reaches a first preset number.

[0016] In an optional embodiment, the data packet is set with a serial number. When receiving the data packet from the terminal device, the method also includes: when a first preset number of data packets are not received within a preset time length, sending a retransmission request message to the terminal device, the retransmission request message includes the serial number of the lost data packet.

[0017] In an optional embodiment, the data packets are provided with sequence numbers, and the sequence numbers of a first preset number of data packets sent by the terminal device are continuous. When receiving data packets from the terminal device, the method further includes: determining whether the sequence number of the currently received data packet and the sequence number of the last received data packet are continuous; if they are not continuous, confirming the sequence number of the missing data packet; if a fourth preset number of data packets received thereafter are not the missing data packets, sending a retransmission request message to the terminal device, and the fourth preset number is less than the first preset number.

[0018] The data transmission method provided in this embodiment is that after receiving a data packet, the Bluetooth device determines whether the sequence number of the currently received data packet and the sequence number of the last received data packet are continuous. If they are not continuous, the sequence number of the missing data packet is confirmed, and if a fourth preset number of data packets received thereafter are not the missing data packets, a retransmission request message is sent to the terminal device. The lost data packet can be determined in time and the lost data packet can be retrieved without waiting for the timeout period to arrive, which can reduce a lot of waiting time for the timeout and further improve the data transmission efficiency.

[0019] In a third aspect, the present invention provides a data transmission device, which includes: a first determination module, used to determine the number of interval packets according to the current signal strength, the number of interval packets is used to instruct the terminal device to wait for a confirmation packet from the Bluetooth device when the number of data packets sent reaches a first preset number; a first sending module, used to send a transmission request message to the Bluetooth device, the transmission request message is used to request the Bluetooth device to receive data, and is used to instruct the Bluetooth device to send a confirmation packet to the terminal device when the number of received data packets reaches a first preset number; a reading module, used to read a second preset number of data packets encapsulated by the file to be transmitted after receiving a request response message from the Bluetooth device, the second preset number is greater than the first preset number; a second sending module, used to continuously send a first preset number of data packets to the Bluetooth device and wait for a confirmation packet; a processing module, used to return to the step of continuously sending the first preset number of data packets to the Bluetooth device after receiving the confirmation packet, until the number of data packets sent reaches the second preset number or a stop message is received.

[0020] In an optional embodiment, the second preset number of data packets are set with serial numbers, and the device also includes: a third receiving module, used to receive a retransmission request message from a Bluetooth device, the retransmission request message including the serial number of the lost data packet; a fifth sending module, used to resend the lost data packet to the Bluetooth device according to the serial number of the lost data packet.

[0021] In an optional embodiment, the device also includes: an update module, used to update the number of interval packets according to the number of retransmission request messages received, the updated number of interval packets is used to instruct the terminal device to wait for a confirmation packet when the next time the number of data packets sent reaches a third preset number, the third preset number is different from the first preset number; a sixth sending module, used to send an update message to the Bluetooth device, the update message is used to instruct the Bluetooth device to send a confirmation packet to the terminal device when the next time the number of data packets received reaches the third preset number.

[0022] In an optional implementation, the request response message includes the sequence number of the data packet required by the Bluetooth device, and the second sending module includes: a first sending unit, used to continuously send a first preset number of data packets to the Bluetooth device according to the sequence number of the data packet required by the Bluetooth device.

[0023] In an optional implementation, the device further includes: a storage module, configured to cache the first preset number of sent data packets in a cache module; and a deletion module, configured to delete cached data in the cache module after receiving a confirmation packet.

[0024] In a fourth aspect, the present invention provides a data transmission device, comprising: a first receiving module, used to receive a transmission request message from a terminal device, the transmission request message is used to request a Bluetooth device to receive data, and is used to instruct the Bluetooth device to send a confirmation packet to the terminal device when the received data packets reach a first preset number; a third sending module, used to send a request response message to the terminal device; a second receiving module, used to receive data packets from the terminal device; and a fourth sending module, used to send a confirmation packet to the terminal device after the number of received data packets reaches a first preset number.

[0025] In an optional embodiment, the data packet is set with a serial number, and the device also includes: a seventh sending module, which is used to send a retransmission request message to the terminal device when a first preset number of data packets are not received within a preset time period, and the retransmission request message includes the serial number of the lost data packet.

[0026] In an optional embodiment, the data packets are set with sequence numbers, and the sequence numbers of the first preset number of data packets sent by the terminal device are continuous. The device also includes: a second determination module, used to determine whether the sequence number of the currently received data packet and the sequence number of the last received data packet are continuous; a second determination module, used to confirm the sequence number of the missing data packet when they are not continuous; an eighth sending module, used to send a retransmission request message to the terminal device if a fourth preset number of data packets received thereafter are not missing data packets, and the fourth preset number is less than the first preset number.

[0027] In a fifth aspect, the present invention provides an electronic device comprising: a memory and a processor, the memory and the processor being communicatively connected to each other, computer instructions being stored in the memory, and the processor executing the method of the above-mentioned first aspect or any corresponding embodiment thereof, or executing the method of the above-mentioned second aspect or any corresponding embodiment thereof by executing the computer instructions.

[0028] In a sixth aspect, the present invention provides a computer-readable storage medium having computer instructions stored thereon, the computer instructions being used to enable a computer to execute the method of the first aspect or any corresponding embodiment thereof, or to execute the method of the second aspect or any corresponding embodiment thereof.

[0029] In a seventh aspect, the present invention provides a computer program product, comprising computer instructions, wherein the computer instructions are used to enable a computer to execute the method of the above-mentioned first aspect or any corresponding embodiment thereof, or to execute the method of the above-mentioned second aspect or any corresponding embodiment thereof. BRIEF DESCRIPTION OF THE DRAWINGS

[0030] In order to more clearly illustrate the specific embodiments of the present invention or the technical solutions in the related technologies, the drawings required for use in the specific embodiments or the related technical descriptions will be briefly introduced below. Obviously, the drawings described below are some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.

[0031] Figure 1 is a flow chart of a data transmission method according to an embodiment of the present invention; Figure 2 is a flow chart of another data transmission method according to an embodiment of the present invention; Figure 3 is a flow chart of another data transmission method according to an embodiment of the present invention; Figure 4 is a flow chart of another data transmission method according to an embodiment of the present invention; Figure 5 is a structural block diagram of a data transmission device according to an embodiment of the present invention; Figure 6 is a structural block diagram of another data transmission device according to an embodiment of the present invention; Figure 7 It is a schematic diagram of the hardware structure of the electronic device according to an embodiment of the present invention. DETAILED DESCRIPTION

[0032] 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 those skilled in the art without creative work are within the scope of protection of the present invention.

[0033] Bluetooth is a wireless technology standard that enables short-range data exchange between fixed and mobile devices. With the development of Bluetooth wireless communication technology, BLE has achieved low power consumption based on traditional Bluetooth technology, allowing Bluetooth devices to work with extremely low power consumption.

[0034] BLE has the advantages of fast speed, low power consumption and simple connection. It is suitable for small amounts of data transmission, such as some control instructions, device data, etc. However, affected by device performance and environmental factors, file transmission may cause packet loss, disorder, etc., which may damage files and make it difficult to meet file transmission requirements, limiting the use scenarios of BLE.

[0035] In view of this, the present invention provides a data transmission method, which can achieve the reliability of BLE transmission files, and by determining the number of interval packets, it can improve the efficiency of file transmission while ensuring stable file transmission between a terminal device and a Bluetooth device.

[0036] The data transmission method provided by the present invention can be applied between a terminal device and a Bluetooth device. The terminal device can be an electronic device with a Bluetooth function, such as a mobile phone, a tablet, a laptop computer or a computer. The Bluetooth function can be a low-power Bluetooth function. The Bluetooth device can be a wearable device (such as a smart watch, smart glasses), a smart home (such as a smart speaker, a sweeping robot, a smart door lock, a smart air conditioner) or a vehicle-mounted device, etc., which can perform Bluetooth transmission with the above-mentioned terminal device.

[0037] According to an embodiment of the present invention, an embodiment of a data transmission method is provided. It should be noted that the steps shown in the flowchart of the accompanying drawings can be executed in a terminal device or a Bluetooth device such as a set of computer executable instructions, and although a logical order is shown in the flowchart, in some cases, the steps shown or described can be executed in an order different from that shown here.

[0038] In this embodiment, a data transmission method is provided, which can be used between the above-mentioned terminal device and the Bluetooth device, wherein before data transmission, the terminal device and the Bluetooth device both start the low-power Bluetooth service and establish a low-power Bluetooth connection. Figure 1 is a flow chart of a data transmission method according to an embodiment of the present invention. Figure 1 As shown, the method comprises the following steps: Step S101: The terminal device determines the number of interval packets according to the current signal strength.

[0039] The number of interval packets is used to instruct the terminal device to wait for a confirmation packet from the Bluetooth device when the number of data packets sent reaches a first preset number, and the current signal strength refers to the signal strength between the terminal device and the connected Bluetooth device at the current moment.

[0040] Specifically, the first preset number is determined based on the current signal strength, and the first preset number may be positively correlated with the current signal strength, that is, the greater the current signal strength, the greater the first preset number. For example, if the current signal strength is good, the first preset number may be set to 10; if the current signal strength is average, the first preset number may be set to 5.

[0041] The unit of signal strength is decibel milliwatt (dBm). Generally speaking, the stronger the signal strength, the larger the dBm value. For example, around -40dBm indicates good signal strength, while around -90dBm indicates weak signal strength. However, the specific signal strength range and corresponding connection quality may vary depending on factors such as the device and environment.

[0042] It should be understood that after the terminal device and the Bluetooth device establish a connection, the current signal strength can be determined through the received signal strength indication (RSSI).

[0043] Step S102: The terminal device sends a transmission request message to the Bluetooth device. Correspondingly, the Bluetooth device receives the transmission request message from the terminal device.

[0044] The transmission request message is used to request the Bluetooth device to receive data, and is used to instruct the Bluetooth device to send a confirmation packet to the terminal device when the received data packets reach a first preset number. The confirmation packet can be a data packet containing a specific field, which is used to indicate to the terminal device that the Bluetooth device has successfully received the first preset number of data packets sent.

[0045] Specifically, the terminal device may inquire the Bluetooth device whether the transmission operation can be performed through a transmission request message, and may inform the Bluetooth device of the number of intervals for replying a confirmation packet after receiving a data packet.

[0046] Step S103: the Bluetooth device sends a request response message to the terminal device. Correspondingly, the terminal device receives the request response message from the Bluetooth device.

[0047] Specifically, after receiving the transmission request message, if the Bluetooth device supports the requested transmission content and has sufficient resources to process it, it can send a request response message to the terminal device and record the number of interval packets. The request response message is used to indicate to the terminal device that the transmission content can be received.

[0048] Step S104: after receiving the request response message from the Bluetooth device, the terminal device reads a second preset number of data packets encapsulated from the file to be transmitted.

[0049] Among them, the second preset number is greater than the first preset number, the file to be transmitted can be a firmware upgrade package, etc., and the terminal device transmits the file can be used for firmware upgrade of devices such as Linux or a single-chip microcomputer.

[0050] For example, due to the limitations of transmission rate and connection stability, the file transmitted from the terminal device to the Bluetooth device is generally less than or equal to 20 MB.

[0051] Specifically, after BLE5.0, the maximum valid data that can be carried by each data packet may be 247 bytes. After the terminal device reads the file to be transmitted, the file to be transmitted can be encapsulated into a second preset number of data packets.

[0052] The second preset number is determined based on the size of the file to be transmitted and the number of bytes that the data packet can carry. For example, if the file to be transmitted is M bytes and the number of bytes that the data packet can carry is A, then the second preset number N=M / A. If M is not divisible by A, then N needs to be increased by 1. In addition, if the data packet carries a sequence number, the number of bytes B required for the sequence number needs to be considered, and the second preset number N=M / (AB).

[0053] Step S105, the terminal device continuously sends a first preset number of data packets to the Bluetooth device and waits for a confirmation packet. Correspondingly, the Bluetooth device receives the data packets from the terminal device.

[0054] Step S106: After the number of received data packets reaches a first preset number, the Bluetooth device sends a confirmation packet to the terminal device. Accordingly, the terminal device receives the confirmation packet from the Bluetooth device.

[0055] Step S107, after receiving the confirmation packet, the terminal device returns to the step of continuously sending a first preset number of data packets to the Bluetooth device until the sent data packets reach a second preset number or a stop message is received.

[0056] Specifically, after acquiring the second preset number of data packets, the terminal device continuously sends the first preset number of data packets to the Bluetooth device, and then stops sending and waits for the confirmation packet from the Bluetooth device. Correspondingly, the Bluetooth device receives the data packets and determines the number of received data packets. If the number reaches the first preset number, it sends a confirmation packet to the terminal device, and the confirmation packet is used to indicate to the terminal device that data transmission can continue. After receiving the confirmation packet, the terminal device continues to send the first preset number of data packets to the Bluetooth device, and then waits for the confirmation packet until the sent data packets reach the second preset number or a stop message is received.

[0057] The stop message may be a message instructing to stop transmission generated by the terminal device after detecting a connection interruption or failure, or may be a message instructing to stop transmission sent by the Bluetooth device to the terminal device due to a failure or connection interruption.

[0058] In the data transmission method provided in this embodiment, the terminal device continues to transmit the data packet only after receiving the confirmation packet from the Bluetooth device, which can ensure the integrity of the data packet received by the Bluetooth device, avoid file loss, and achieve the reliability of BLE transmission files. In addition, in the data transmission method provided in this embodiment, the terminal device also determines the number of interval packets according to the current signal strength. The terminal device waits for the confirmation packet only after continuously sending the first preset number of data packets according to the number of interval packets, instead of waiting for the confirmation packet every time a data packet is sent, which can improve the efficiency of file transmission.

[0059] In this embodiment, a data transmission method is provided, which can be used for the above-mentioned terminal device and Bluetooth device. The second preset number of data packets is provided with a serial number, and the serial number is used to distinguish different data packets. The serial number can be a field or a number, etc., which is not specifically limited in the present invention. Figure 2 is a flow chart of a data transmission method according to an embodiment of the present invention. Figure 2 As shown, the method comprises the following steps: Step S201: The terminal device determines the number of interval packets according to the current signal strength.

[0060] For details, please see Figure 1 Step S101 of the illustrated embodiment will not be described in detail here.

[0061] Step S202: The terminal device sends a transmission request message to the Bluetooth device. Correspondingly, the Bluetooth device receives the transmission request message from the terminal device.

[0062] For details, please see Figure 1 Step S102 of the illustrated embodiment will not be described in detail here.

[0063] Step S203: The Bluetooth device sends a request response message to the terminal device. Correspondingly, the terminal device receives the request response message from the Bluetooth device.

[0064] The request response message includes the sequence number of the data packet required by the Bluetooth device.

[0065] Step S204: after receiving the request response message from the Bluetooth device, the terminal device reads a second preset number of data packets encapsulated from the file to be transmitted.

[0066] Step S205: the terminal device continuously sends a first preset number of data packets to the Bluetooth device according to the sequence number of the data packet required by the Bluetooth device, and waits for a confirmation packet. Accordingly, the Bluetooth device receives the data packet from the terminal device.

[0067] Specifically, when data is transmitted, it does not always start from the beginning. It may start from the last interruption point. When the transmission is resumed from the breakpoint, when the Bluetooth device sends a request response message to the terminal device, the sequence number of the data packet required by the Bluetooth device can be included in the request response message to avoid repeated transmission of the data packets corresponding to the file to be transmitted.

[0068] For example, if the 1000th data packet was received last time but not fully transmitted, this time you can directly start sending from the 1001th data packet to achieve breakpoint resume.

[0069] Step S206: The terminal device buffers the first preset number of sent data packets in a buffer module.

[0070] Specifically, after the terminal device continuously sends a first preset number of data packets to the Bluetooth device, it will not immediately discard the sent data packets, but store these data packets in a cache module in case of timeout retransmission. When retransmission is needed, it can be quickly retransmitted and will not be discarded until the Bluetooth device confirms successful reception.

[0071] Step S207: When the Bluetooth device does not receive the first preset number of data packets within the preset time period, the Bluetooth device sends a retransmission request message to the terminal device. Accordingly, the terminal device receives the retransmission request message from the Bluetooth device.

[0072] Among them, the retransmission request message includes the sequence number of the lost data packet, and the Bluetooth device is pre-configured with a preset duration (i.e., timeout duration). The preset duration can be configured by the designer according to requirements. For example, the preset duration can be 5s or 10s, etc., which is not specifically limited in the present invention.

[0073] Specifically, after the terminal device sends a first preset number of data packets to the Bluetooth device, the Bluetooth device receives the data packets. If the number of data packets received within the preset time period does not reach the first preset number, the sequence number of the lost data packet is determined, and a retransmission request message is sent to the terminal device. The retransmission request message is used to request the terminal device to send the lost data packet again.

[0074] Step S208: The terminal device resends the lost data packet to the Bluetooth device according to the sequence number of the lost data packet. Correspondingly, the Bluetooth device receives the lost data packet.

[0075] Specifically, after receiving the retransmission request message, the terminal device can determine the sequence number of the lost data packet from the retransmission request message, and then obtain the lost data packet from the cache module and resend the data packet to the Bluetooth device.

[0076] Step S209: When the Bluetooth device receives the first preset number of data packets within the preset time period, the Bluetooth device sends a confirmation packet to the terminal device. Accordingly, the terminal device receives the confirmation packet from the Bluetooth device.

[0077] Specifically, after the number of data packets received by the Bluetooth device within a preset time reaches a first preset number, the data packets can be arranged in sequence according to the sequence numbers of the data packets, and the arranged data packets can be written into a file, and a confirmation packet can be sent to the terminal device, and the timeout duration can be reset.

[0078] Step S210: After receiving the confirmation packet, the terminal device deletes the cache data in the cache module.

[0079] Specifically, after receiving the confirmation packet, the terminal device indicates that the Bluetooth device has successfully received the first preset number of data packets sent. At this time, the cached data in the cache module is deleted to release the memory of the cache module.

[0080] Step S211, after receiving the confirmation packet, the terminal device returns to the step of continuously sending a first preset number of data packets to the Bluetooth device until the sent data packets reach a second preset number or a stop message is received.

[0081] Specifically, after receiving the confirmation packet, the terminal device can update the sequence number of the first preset number of data packets to be transmitted, and continue to send the first preset number of data packets to the Bluetooth device, repeating the above process until all data packets are sent or a stop message caused by signal interruption is received.

[0082] Step S212: The terminal device updates the number of interval packets according to the number of retransmission request messages received.

[0083] Step S213: the terminal device sends an update message to the Bluetooth device. Correspondingly, the Bluetooth device receives the update message from the terminal device.

[0084] Specifically, when the second preset number is large, for example, the second preset number is greater than 100, when the terminal device continuously sends the first preset number of data packets to the Bluetooth device, the terminal device will also update the number of interval packets according to the number of retransmission request messages received, and send an update message to the Bluetooth device.

[0085] The updated interval packet number is used to instruct the terminal device to wait for the confirmation packet when the data packets sent next time reach the third preset number, and the update message is used to instruct the Bluetooth device to send a confirmation packet to the terminal device when the data packets received next time reach the third preset number. The third preset number is different from the first preset number, and the third preset number can be greater than the first preset number or less than the first preset number.

[0086] For example, if the terminal device does not receive a retransmission request message within a preset time period (such as 1min or 3min, etc.), or the retransmission request message is less than a preset value (such as 1 or 2), it indicates that the current BLE signal is good, and the number of interval packets is updated so that the third preset number is greater than the first preset number; if the number of retransmission request messages received within the preset time period is greater than the preset value, the number of interval packets is updated so that the third preset number is less than the first preset number.

[0087] That is, during the data transmission process, according to the packet loss situation, the number of interval packets to reply is dynamically adjusted. For example, if there is no packet loss and retransmission for a long time, the original definition of replying a confirmation packet every 5 packets can be changed to replying a confirmation packet every 10 packets, which can reduce the waiting time for confirmation and speed up the transmission efficiency. On the contrary, if the packet loss phenomenon is more frequent, the size of the interval packet should be reduced to avoid a large number of timeout retransmission phenomena.

[0088] The data transmission method provided in this embodiment sets a sequence number for the data packet, which enables the Bluetooth device to arrange the data packets in the order of the sequence numbers of the data packets after receiving the first preset number of data packets, so as to avoid multiple data packets being out of order and causing the inability to recognize the file, and the Bluetooth device sets a timeout duration, and when the first preset number of data packets are not received within the preset duration, a retransmission request message is sent to the terminal device to reacquire the lost data packets, which can avoid the problem of packet loss. In addition, during the transmission process, this embodiment dynamically adjusts the number of interval packets according to the packet loss situation, which can not only reduce the waiting time for confirmation and improve the transmission efficiency, but also avoid a large number of timeout retransmission phenomena.

[0089] In this embodiment, a data transmission method is provided, which can be used for the above-mentioned terminal device and Bluetooth device. The second preset number of data packets are set with sequence numbers, and the sequence numbers of the first preset number of data packets sent by the terminal device are continuous. Figure 3 is a flow chart of another data transmission method according to an embodiment of the present invention. Figure 3 As shown, the method comprises the following steps: Step S301: The terminal device determines the number of interval packets according to the current signal strength.

[0090] For details, please see Figure 1 Step S101 of the illustrated embodiment will not be described in detail here.

[0091] Step S302: The terminal device sends a transmission request message to the Bluetooth device. Correspondingly, the Bluetooth device receives the transmission request message from the terminal device.

[0092] For details, please see Figure 1 Step S102 of the illustrated embodiment will not be described in detail here.

[0093] Step S303: The Bluetooth device sends a request response message to the terminal device. Correspondingly, the terminal device receives the request response message from the Bluetooth device.

[0094] For details, please see Figure 1 Step S103 of the illustrated embodiment will not be described in detail here.

[0095] Step S304: after receiving the request response message from the Bluetooth device, the terminal device reads a second preset number of data packets encapsulated from the file to be transmitted.

[0096] For details, please see Figure 1 Step S104 of the illustrated embodiment will not be described in detail here.

[0097] Step S305: The terminal device continuously sends a first preset number of data packets to the Bluetooth device and waits for a confirmation packet. Accordingly, the Bluetooth device receives the data packets from the terminal device.

[0098] Specifically, the data packet is set with a sequence number, and the terminal device sends a first preset number of data packets to the Bluetooth device in sequence based on the sequence number, and then waits for the confirmation packet. The sequence number is used to distinguish different data packets, and the sequence number can be a field or a number, etc., which is not specifically limited in this application.

[0099] For example, the second preset number is 20, the sequence number of the second preset number can be 1 to 20, and the first preset number is 5. The terminal device can first send data packets with sequence numbers 1 to 5 to the Bluetooth device. After receiving the confirmation message, it can continue to send data packets with sequence numbers 6 to 10 to the Bluetooth device. After receiving the confirmation message again, repeat the above process until all data packets are sent to the Bluetooth device.

[0100] Step S306: The Bluetooth device determines whether the sequence number of the currently received data packet is continuous with the sequence number of the last received data packet.

[0101] Step S307: When the Bluetooth device is discontinuous, it confirms the sequence number of the missing data packet.

[0102] Step S308: If the fourth preset number of data packets received thereafter are not missing data packets, the Bluetooth device sends a retransmission request message to the terminal device. Accordingly, the terminal device receives the retransmission request message from the Bluetooth device.

[0103] Among them, the retransmission request message includes the sequence number of the lost data packet, the fourth preset number is less than the first preset number, and the fourth preset number can be configured by the terminal device based on the first preset number. For example, if the first preset number is 5, the fourth preset number can be 2 or 3.

[0104] Specifically, when receiving a first preset number of data packets, the Bluetooth device determines whether the sequence number of the currently received data packet and the sequence number of the previously received data packet are continuous. If not, the sequence number of the missing data packet is determined and the data packets continue to be received. If the fourth preset number of data packets subsequently received are not missing data packets, a retransmission request message is sent to the terminal device. If they are continuous, the data packets are continued to be received until the number of received data packets reaches the first preset number, and step S210 is executed.

[0105] For example, the first preset number is 5, the fourth preset number is 2, and the terminal device sends data packets with sequence numbers 6 to 10 to the Bluetooth device in sequence. According to the receiving order, the first data packet received by the Bluetooth device is the data packet with sequence number 6, and the second data packet received should be the data packet with sequence number 7. At this time, if the second data packet received by the Bluetooth device is the data packet with sequence number 8, it can be determined that the sequence numbers of the two adjacent data packets are not continuous and the data packet with sequence number 7 is missing. If data packets with sequence numbers 9 and 10 are received in sequence thereafter, it is considered that the data packet with sequence number 7 is lost, and a retransmission request message is sent to the terminal device.

[0106] Step S309: The terminal device resends the lost data packet to the Bluetooth device according to the sequence number of the lost data packet.

[0107] Specifically, after receiving the retransmission request message, the terminal device can determine the sequence number of the lost data packet from the retransmission request message, and then resend the lost data packet to the Bluetooth device.

[0108] Step S310: After the number of received data packets reaches a first preset number, the Bluetooth device sends a confirmation packet to the terminal device. Accordingly, the terminal device receives the confirmation packet from the Bluetooth device.

[0109] For details, please see Figure 1 Step S106 of the illustrated embodiment will not be described in detail here.

[0110] Step S311, after receiving the confirmation packet, the terminal device returns to the step of continuously sending a first preset number of data packets to the Bluetooth device until the sent data packets reach a second preset number or a stop message is received.

[0111] Specifically, after receiving the confirmation packet, the terminal device updates the sequence number of the data packet, and then continues to send a first preset number of data packets until all the data packets are sent or a stop message is received.

[0112] The data transmission method provided in this embodiment is that after receiving a data packet, the Bluetooth device determines whether the sequence number of the currently received data packet and the sequence number of the last received data packet are continuous. If they are not continuous, the sequence number of the missing data packet is confirmed, and if a fourth preset number of data packets received thereafter are not the missing data packets, a retransmission request message is sent to the terminal device. The lost data packet can be determined in time and the lost data packet can be retrieved without waiting for the timeout period to arrive, which can reduce a lot of waiting time for the timeout and further improve the data transmission efficiency.

[0113] The data transmission method provided by the present invention is described below by taking the first preset number being 5, the second preset number being 20, the fourth preset number being 2, and the sequence numbers of the data packets being 1 to 20 as an example.

[0114] like Figure 4 As shown, when data is transmitted, first, the terminal device and the Bluetooth device establish a BLE connection. Secondly, the terminal device determines the number of interval packets based on the signal strength and sends a transmission request message to the Bluetooth device. After receiving the transmission request message, the Bluetooth device records the number of interval packets and sends a request response message to the terminal device.

[0115] Again, the terminal device receives the request response message, and then continuously sends 5 data packets to the Bluetooth device (at this time, the sequence numbers of the data packets can be 1 to 5), and the 5 data packets are cached in the cache module. At this time, if the Bluetooth device does not receive 5 data packets within the preset time length, it determines the sequence number of the lost data packet and sends a retransmission request message to the terminal device. The retransmission request message includes the sequence number of the lost data packet. After receiving the retransmission request message, the terminal device obtains the lost data packet from the cache module and resends the lost data packet to the Bluetooth device.

[0116] If the Bluetooth device receives 5 data packets within the preset time length, it reorganizes the file according to the sequence number order of the data packets and sends a confirmation packet to the terminal device. After receiving the confirmation packet, the terminal device deletes the cached data in the cache module and continues to send 5 data packets to the Bluetooth device (at this time, the sequence numbers of the data packets can be 6 to 10). The above process is repeated until all data packets with sequence numbers 1 to 20 are sent to the Bluetooth device, or a stop message is received.

[0117] When the terminal device transmits data packets to the Bluetooth device, the terminal device will also dynamically adjust the number of interval packets according to the number of retransmission request messages received, and send an update message carrying the updated number of interval packets to the Bluetooth device.

[0118] In the above implementation, the retransmission strategy can also be optimized according to the sequence number of the data packet. For example, when the Bluetooth device is receiving 5 data packets, it determines whether the sequence number of the currently received data packet and the sequence number of the last received data packet are continuous. If they are not continuous, it determines the sequence number of the missing data packet and continues to receive data packets. If the two subsequently received data packets are not the missing data packets, a retransmission request message is sent to the terminal device.

[0119] In this embodiment, a data transmission device is also provided, which is used to implement the above-mentioned embodiments and preferred implementation modes, and the descriptions that have been made will not be repeated. As used below, the term "module" can implement a combination of software and / or hardware of a predetermined function. Although the devices described in the following embodiments are preferably implemented in software, the implementation of hardware, or a combination of software and hardware, is also possible and conceivable.

[0120] This embodiment provides a data transmission device, such as Figure 5 As shown, including: A first determination module 501 is used to determine the number of interval packets according to the current signal strength, and the number of interval packets is used to instruct the terminal device to wait for a confirmation packet from the Bluetooth device when the number of data packets sent reaches a first preset number; A first sending module 502, configured to send a transmission request message to a Bluetooth device, wherein the transmission request message is used to request the Bluetooth device to receive data, and is used to instruct the Bluetooth device to send a confirmation packet to the terminal device when the number of received data packets reaches a first preset number; A reading module 503 is used to read a second preset number of data packets formed by encapsulating the file to be transmitted after receiving the request response message from the Bluetooth device, where the second preset number is greater than the first preset number; The second sending module 504 is used to continuously send a first preset number of data packets to the Bluetooth device and wait for a confirmation packet; The processing module 505 is used to return to the step of continuously sending a first preset number of data packets to the Bluetooth device after receiving the confirmation packet, until the sent data packets reach a second preset number or a stop message is received.

[0121] In some optional implementations, the second preset number of data packets are provided with serial numbers, and the apparatus further comprises: A third receiving module, configured to receive a retransmission request message from a Bluetooth device, wherein the retransmission request message includes a sequence number of a lost data packet; The fifth sending module is used to resend the lost data packet to the Bluetooth device according to the sequence number of the lost data packet.

[0122] In some optional embodiments, the device further comprises: An updating module, used for updating the number of interval packets according to the number of retransmission request messages received, wherein the updated number of interval packets is used for instructing the terminal device to wait for a confirmation packet when the number of data packets sent next time reaches a third preset number, and the third preset number is different from the first preset number; The sixth sending module is used to send an update message to the Bluetooth device, where the update message is used to instruct the Bluetooth device to send a confirmation packet to the terminal device when the next time the number of data packets received reaches a third preset number.

[0123] In some optional implementations, the request response message includes the sequence number of the data packet required by the Bluetooth device, and the second sending module includes: The first sending unit is used to continuously send a first preset number of data packets to the Bluetooth device according to the sequence number of the data packet required by the Bluetooth device.

[0124] In some optional embodiments, the device further comprises: A storage module, used for caching a first preset number of sent data packets in a cache module; The deletion module deletes the cache data in the cache module after receiving the confirmation packet.

[0125] This embodiment provides a data transmission device, such as Figure 6 As shown, including: The first receiving module 601 is used to receive a transmission request message from a terminal device, where the transmission request message is used to request a Bluetooth device to receive data, and is used to instruct the Bluetooth device to send a confirmation packet to the terminal device when the number of received data packets reaches a first preset number; The third sending module 602 is used to send a request response message to the terminal device; The second receiving module 603 is used to receive a data packet from a terminal device; The fourth sending module 604 is used to send a confirmation packet to the terminal device after the number of received data packets reaches a first preset number.

[0126] In some optional implementations, the data packet is provided with a serial number, and the apparatus further comprises: The seventh sending module is used to send a retransmission request message to the terminal device when the first preset number of data packets are not received within a preset time period, and the retransmission request message includes the sequence number of the lost data packet.

[0127] In some optional implementations, the data packets are provided with sequence numbers, and the sequence numbers of the first preset number of data packets sent by the terminal device are continuous, and the apparatus further includes: A second determination module, used to determine whether the sequence number of the currently received data packet is continuous with the sequence number of the last received data packet; A second determination module, used to confirm the sequence number of the missing data packet when it is discontinuous; The eighth sending module is used to send a retransmission request message to the terminal device if a fourth preset number of data packets received thereafter are not missing data packets, and the fourth preset number is less than the first preset number.

[0128] The further functional description of each of the above modules and units is the same as that of the above corresponding embodiments and will not be repeated here.

[0129] The data transmission device in this embodiment is presented in the form of a functional unit, where the unit refers to an application specific integrated circuit (ASIC), a processor and memory that executes one or more software or fixed programs, and / or other devices that can provide the above functions.

[0130] The embodiment of the present invention further provides an electronic device, such as Figure 7 As shown, the electronic device includes: one or more processors 710, a memory 720, and interfaces for connecting various components, including high-speed interfaces and low-speed interfaces. The various components are connected to each other using different buses for communication, and can be installed on a common mainboard or installed in other ways as needed. The processor can process instructions executed in the electronic device, including instructions stored in or on the memory to display graphical information of the GUI on an external input / output device (such as a display device coupled to the interface). In some optional embodiments, if necessary, multiple processors and / or multiple buses can be used together with multiple memories and multiple memories. Similarly, multiple electronic devices can be connected, and each device provides some necessary operations (for example, as a server array, a group of blade servers, or a multi-processor system). Figure 7 A processor 710 is taken as an example.

[0131] The processor 710 may be a central processing unit, a network processor or a combination thereof. The processor 710 may further include a hardware chip. The hardware chip may be a dedicated integrated circuit, a programmable logic device or a combination thereof. The programmable logic device may be a complex programmable logic device, a field programmable logic gate array, a general purpose array logic or any combination thereof.

[0132] The memory 720 stores instructions executable by at least one processor 710, so that the at least one processor 710 executes the method shown in the above embodiment.

[0133] The memory 720 may include a program storage area and a data storage area, wherein the program storage area may store an operating system, an application required for at least one function; the data storage area may store data created according to the use of the electronic device, etc. In addition, the memory 720 may include a high-speed random access memory, and may also include a non-transient memory, such as at least one disk storage device, a flash memory device, or other non-transient solid-state storage device. In some optional embodiments, the memory 720 may optionally include a memory remotely arranged relative to the processor 710, and these remote memories may be connected to the electronic device via a network. Examples of the above-mentioned network include, but are not limited to, the Internet, an intranet, a local area network, a mobile communication network, and combinations thereof.

[0134] The memory 720 may include a volatile memory, such as a random access memory; the memory may also include a non-volatile memory, such as a flash memory, a hard disk or a solid state drive; the memory 720 may also include a combination of the above types of memory.

[0135] The electronic device also includes a communication interface 730, which is used for the electronic device to communicate with other devices or a communication network.

[0136] The embodiment of the present invention also provides a computer-readable storage medium. The method according to the embodiment of the present invention can be implemented in hardware, firmware, or can be implemented as a computer code that can be recorded in a storage medium, or can be implemented as a computer code that is originally stored in a remote storage medium or a non-temporary machine-readable storage medium and will be stored in a local storage medium through a network download, so that the method described herein can be stored in such software processing on a storage medium using a general-purpose computer, a dedicated processor, or programmable or dedicated hardware. Among them, the storage medium can be a magnetic disk, an optical disk, a read-only storage memory, a random access memory, a flash memory, a hard disk or a solid-state hard disk, etc.; further, the storage medium can also include a combination of the above types of memories. It can be understood that a computer, a processor, a microprocessor controller, or programmable hardware includes a storage component that can store or receive software or computer code. When the software or computer code is accessed and executed by a computer, a processor, or hardware, the method shown in the above embodiment is implemented.

[0137] A part of the present invention may be applied as a computer program product, such as a computer program instruction, which, when executed by a computer, can call or provide the method and / or technical solution according to the present invention through the operation of the computer. Those skilled in the art should understand that the existence of the computer program instruction in a computer-readable medium includes, but is not limited to, a source file, an executable file, an installation package file, etc., and accordingly, the way in which the computer program instruction is executed by the computer includes, but is not limited to: the computer directly executes the instruction, or the computer compiles the instruction and then executes the corresponding compiled program, or the computer reads and executes the instruction, or the computer reads and installs the instruction and then executes the corresponding installed program. Here, the computer-readable medium may be any available computer-readable storage medium or communication medium accessible to the computer.

[0138] It should be understood that the various parts of the present invention can be implemented by hardware, software, firmware or a combination thereof. In the above-mentioned embodiment, multiple steps or methods can be implemented by software or firmware stored in a memory and executed by a suitable instruction execution system. For example, if implemented by hardware, as in another embodiment, it can be implemented by any one of the following technologies known in the art or their combination: a discrete logic circuit having a logic gate circuit for implementing a logic function for a data signal, a dedicated integrated circuit having a suitable combination of logic gate circuits, a programmable gate array (PGA), a field programmable gate array (FPGA), etc.

[0139] In the description of this specification, the description with reference to the terms "this embodiment", "one embodiment", "some embodiments", "example", "specific example", or "some examples" means that the specific features, structures, materials or characteristics described in conjunction with the embodiment or example are included in at least one embodiment or example of the present invention. In this specification, the schematic representations of the above terms do not necessarily refer to the same embodiment or example. Moreover, the specific features, structures, materials or characteristics described may be combined in any one or more embodiments or examples in a suitable manner. In addition, those skilled in the art may combine and combine the different embodiments or examples described in this specification and the features of the different embodiments or examples, unless they are contradictory.

[0140] In addition, the terms "first" and "second" are used for descriptive purposes only and should not be understood as indicating or implying relative importance or implicitly indicating the number of the indicated technical features. Therefore, the features defined as "first" and "second" may explicitly or implicitly include at least one of the features. In the description of the present invention, the meaning of "plurality" is at least two, such as two, three, etc., unless otherwise clearly and specifically defined.

[0141] Although the embodiments of the present invention have been described in conjunction with the accompanying drawings, those skilled in the art may make various modifications and variations without departing from the spirit and scope of the present invention, and such modifications and variations are all within the scope defined by the present invention.

Claims

1. A data transmission method, characterized in that: The method is applied to a terminal device having a Bluetooth function, the terminal device is communicatively connected with a Bluetooth device, and the method comprises: Determine the number of interval packets according to the current signal strength, wherein the number of interval packets is used to instruct the terminal device to wait for a confirmation packet from the Bluetooth device when the number of data packets sent reaches a first preset number; Sending a transmission request message to the Bluetooth device, wherein the transmission request message is used to request the Bluetooth device to receive data and to instruct the Bluetooth device to send the confirmation packet to the terminal device when the received data packets reach the first preset number; After receiving the request response message from the Bluetooth device, reading a second preset number of data packets formed by encapsulating the file to be transmitted, the second preset number being greater than the first preset number; continuously sending the first preset number of data packets to the Bluetooth device, and waiting for the confirmation packet; After receiving the confirmation packet, return to the step of continuously sending the first preset number of data packets to the Bluetooth device until the sent data packets reach the second preset number or a stop message is received.

2. The method according to claim 1, characterized in that: The second preset number of data packets are provided with serial numbers, and after continuously sending the first preset number of data packets to the Bluetooth device, the method further includes: receiving a retransmission request message from the Bluetooth device, wherein the retransmission request message includes a sequence number of a lost data packet; Resend the lost data packet to the Bluetooth device according to the sequence number of the lost data packet.

3. The method according to claim 2, characterized in that After continuously sending the first preset number of data packets to the Bluetooth device, the method further includes: updating the number of interval packets according to the number of retransmission request messages received, wherein the updated number of interval packets is used to instruct the terminal device to wait for the confirmation packet when the number of data packets sent next time reaches a third preset number, and the third preset number is different from the first preset number; An update message is sent to the Bluetooth device, where the update message is used to instruct the Bluetooth device to send the confirmation packet to the terminal device when the next time the number of data packets received reaches the third preset number.

4. The method according to claim 2 or 3, characterized in that: The request response message includes the sequence number of the data packet required by the Bluetooth device, and continuously sending the first preset number of data packets to the Bluetooth device includes: The first preset number of data packets are continuously sent to the Bluetooth device according to the sequence numbers of the data packets required by the Bluetooth device.

5. The method according to any one of claims 1 to 3, characterized in that After continuously sending the first preset number of data packets to the Bluetooth device, the method further includes: Buffering the first preset number of sent data packets in a buffer module; After receiving the confirmation packet, the cache data in the cache module is deleted.

6. A data transmission method, characterized in that: The method is applied to a Bluetooth device, the Bluetooth device is communicatively connected with a terminal device having a Bluetooth function, and the method comprises: receiving a transmission request message from the terminal device, the transmission request message being used to request the Bluetooth device to receive data and being used to instruct the Bluetooth device to send a confirmation packet to the terminal device when the number of received data packets reaches a first preset number; Sending a request response message to the terminal device; receiving a data packet from the terminal device; After the number of received data packets reaches the first preset number, the confirmation packet is sent to the terminal device.

7. The method according to claim 6, characterized in that The data packet is provided with a serial number. When receiving the data packet from the terminal device, the method further comprises: When the first preset number of data packets are not received within a preset time period, a retransmission request message is sent to the terminal device, and the retransmission request message includes the sequence number of the lost data packet.

8. The method according to claim 6, characterized in that The data packets are provided with sequence numbers, and the sequence numbers of the first preset number of data packets sent by the terminal device are continuous. When receiving the data packets from the terminal device, the method further includes: Determine whether the sequence number of the currently received data packet is continuous with the sequence number of the last received data packet; In case of discontinuity, confirm the sequence number of the missing data packet; If a fourth preset number of data packets received thereafter are not missing data packets, a retransmission request message is sent to the terminal device, and the fourth preset number is less than the first preset number.

9. A data transmission device, characterized in that: The device comprises: A first determination module, used to determine the number of interval packets according to the current signal strength, wherein the number of interval packets is used to instruct the terminal device to wait for a confirmation packet from the Bluetooth device when the number of data packets sent reaches a first preset number; a first sending module, configured to send a transmission request message to the Bluetooth device, wherein the transmission request message is used to request the Bluetooth device to receive data, and to instruct the Bluetooth device to send the confirmation packet to the terminal device when the number of received data packets reaches the first preset number; A reading module, configured to read a second preset number of data packets formed by encapsulating the file to be transmitted after receiving the request response message from the Bluetooth device, wherein the second preset number is greater than the first preset number; A second sending module, used for continuously sending the first preset number of data packets to the Bluetooth device and waiting for the confirmation packet; The processing module is used for returning to the step of continuously sending the first preset number of data packets to the Bluetooth device after receiving the confirmation packet, until the sent data packets reach the second preset number or a stop message is received.

10. A data transmission device, characterized in that: The device comprises: A first receiving module, used for receiving a transmission request message from a terminal device, wherein the transmission request message is used for requesting a Bluetooth device to receive data, and for instructing the Bluetooth device to send a confirmation packet to the terminal device when the number of received data packets reaches a first preset number; A third sending module, used to send a request response message to the terminal device; A second receiving module, used to receive a data packet from the terminal device; The fourth sending module is used to send the confirmation packet to the terminal device after the number of received data packets reaches the first preset number.

11. An electronic device, characterized in that: include: A memory and a processor, wherein the memory and the processor are communicatively connected to each other, the memory stores computer instructions, and the processor executes the method of any one of claims 1 to 5 or the method of any one of claims 6 to 8 by executing the computer instructions.

12. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores computer instructions, and the computer instructions are used to enable an electronic device to execute the method of any one of claims 1 to 5, or execute the method of any one of claims 6 to 8.

13. A computer program product, characterized in that The method comprises computer instructions, wherein the computer instructions are used to cause an electronic device to execute the method according to any one of claims 1 to 5, or to execute the method according to any one of claims 6 to 8.

Citation Information

Patent Citations

  • Method for preventing data loss

    CN103716133A

  • BLE Bluetooth-based program update methods, electronic device, and mobile terminal

    CN109640302A

  • Data transmission method and device, electronic equipment, storage medium and product

    CN115001541A

  • Method and device for processing retransmission request, data sending end equipment and storage medium

    CN116137560A

  • Data transmission method and device

    CN118118948A