Data transmission method, receiving method, communication device and computer storage medium

By adjusting the data packet transmission time according to the time slot mode in the sniff interval between Bluetooth devices, the problem of transmission synchronization when electronic devices are connected to multiple devices is solved, and efficient data transmission and bandwidth saving are achieved.

CN114337889BActive Publication Date: 2024-09-20MEDIATEK SINGAPORE PTE LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202011059897.7
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2020-09-30
Publication Date
2024-09-20
Estimated Expiration
2040-09-30

AI Technical Summary

Technical Problem

The existing A2DP transmission protocol cannot effectively solve the transmission synchronization problem when electronic devices are connected to multiple communication devices, resulting in incomplete data packets or transmission failures, occupying bandwidth resources, and affecting transmission performance.

Method used

Using a Bluetooth-based data transmission method, establish a communication connection with the second device, determine the sniff interval, and start sending data packets in the even or odd time slots of the sniff interval to ensure that the transmission duration of the data packet is greater than or equal to 2 time slots. To achieve synchronous transmission between devices and save bandwidth resources.

Benefits of technology

It realizes the synchronization of data sending and receiving between electronic devices, saves bandwidth resources, improves data transmission efficiency, and ensures the integrity and successful transmission of data packets.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN114337889B
    Figure CN114337889B
Patent Text Reader

Abstract

The present application provides a Bluetooth-based data transmission method, a Bluetooth-based data receiving method, a communication device, and a computer storage medium. The data transmission method is implemented on a first device, and the data transmission method includes: establishing a communication connection with a second device; determining a sniff interval, wherein the sniff interval includes a sniff wake-up window; entering sniff mode; sending a first data packet to the second device in the sniff, and the transmission duration of the first data packet is greater than or equal to 2 time slots. Among them, sending a data packet to the second device in the sniff interval includes: starting to send a data packet to the second device in an even time slot of the sniff interval; or starting to send a data packet to the second device in an odd time slot of the sniff interval. Through the data transmission method of the present application, it is possible to achieve synchronous transmission and reception between electronic devices and save bandwidth resources.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of mobile communication technology, and in particular to a data transmission method, device, electronic device and computer storage medium. Background Art

[0002] Bluetooth is widely used in smart speakers, home entertainment devices, and personal media devices. In the scenario of playing high-quality audio via Bluetooth, Bluetooth A2DP (Advanced Audio Distribution Profile) is generally required.

[0003] In actual usage scenarios, an electronic device often needs to connect to multiple devices of the same or different types at the same time. In addition to Bluetooth connection, electronic devices may also be connected to other devices through other wireless connection methods such as WIFI connection and LTE connection. The existing A2DP transmission protocol is mainly aimed at data transmission when an electronic device is connected to a single Bluetooth device. It cannot solve the problem of transmission synchronization when an electronic device is connected to multiple communication devices. It may cause incomplete or unsuccessful sending and receiving of data packets by Bluetooth devices, and occupy more bandwidth resources in the transmission link, affecting transmission performance. Summary of the invention

[0004] The present application provides a data transmission method, device, electronic device and computer storage medium, and the main technical problem to be solved is how to solve the problem of transmission synchronization when an electronic device is connected to multiple communication devices.

[0005] The present invention provides a data transmission method based on Bluetooth, which is implemented on a first device and includes: establishing a communication connection with a second device; determining a breathing sniff interval, and sending indication information of the sniff interval to the second device; entering a sniff mode; sending a data packet to the second device in the sniff interval, wherein the transmission time length of the data packet is greater than or equal to 2 time slots, wherein sending the data packet to the second device in the sniff interval includes: sending the data packet to the second device starting from an even-numbered time slot of the sniff interval; or sending the data packet to the second device starting from an odd-numbered time slot of the sniff interval.

[0006] The sending of the data packet to the second device starting from the even time slot of the sniff interval includes: sending a first data packet to the second device at the anchor point of the sniff interval.

[0007] The present invention provides a data receiving method based on Bluetooth, comprising: a second device establishes a communication connection with a first device; the second device receives a notification message sent by the first device, the notification message includes indication information of a sniff interval; the second device enters a sniff mode; the second device receives a data packet sent by the second device in the sniff interval, the transmission time length of the data packet is greater than or equal to 2 time slots, wherein the second device receives the data packet sent by the second device in the sniff interval comprises: starting to receive the data packet sent by the second device in an odd-numbered time slot of the sniff interval; or starting to receive the data packet sent by the second device in an even-numbered time slot of the sniff interval.

[0008] Wherein, the data packet sent by the second device is received starting from the even time slots of the sniff interval: the second device receives the first data packet sent by the second device at the anchor point of the sniff interval.

[0009] The present invention provides a communication device, which includes: a transceiver, which is used to establish a communication connection with a second device; a processor, which determines a breathing sniff interval, sends indication information of the sniff interval to the second device via the transceiver, enters a sniff mode, and starts sending data packets to the second device in the even time slots of the sniff interval, or starts sending data packets to the second device in the odd time slots of the sniff interval, and the transmission time length of the data packet is greater than or equal to 2 time slots.

[0010] The present invention provides a communication device, comprising a transceiver and a processor, wherein the transceiver is used to establish a communication connection with a first device; the processor is used to receive a notification message sent by the first device via the transceiver, the notification message including indication information of a sniff interval; enter a sniff mode; and receive a data packet sent by the second device starting from an odd time slot of the sniff interval or starting from an even time slot of the sniff interval via the transceiver, wherein the transmission time length of the data packet is greater than or equal to 2 time slots.

[0011] The present invention provides a computer storage medium, which is used to store program instructions, and the program instructions enable a processor to execute the above-mentioned Bluetooth-based data transmission method or the above-mentioned Bluetooth-based data receiving method.

[0012] Through the data transmission method of the present application, by starting to send a data packet with a transmission duration greater than or equal to 2 time slots to the second device in the even time slot or odd time slot of the sniff interval, it is possible to achieve synchronous transmission and reception between electronic devices and save bandwidth resources. BRIEF DESCRIPTION OF THE DRAWINGS

[0013] In order to more clearly illustrate the technical solutions in the embodiments of the present invention, the following briefly introduces the drawings required for describing the embodiments. Obviously, the drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without creative work. Among them:

[0014] Figure 1 It is a transmission timing diagram of multiple connections in the prior art;

[0015] Figure 2 It is a flowchart of the first embodiment of the data transmission method provided by the present application;

[0016] Figure 3 It is a transmission timing diagram of multiple connections provided by this application;

[0017] Figure 4 is a flowchart of a second embodiment of a Bluetooth-based data transmission method provided by the present application;

[0018] Figure 5 is a flowchart of a third embodiment of a Bluetooth-based data transmission method provided by the present application;

[0019] Figure 6 is a flowchart of a fourth embodiment of a Bluetooth-based data transmission method provided by the present application;

[0020] Figure 7 is a flowchart of a fifth embodiment of a Bluetooth-based data transmission method provided by the present application;

[0021] Figure 8 is a flowchart of a sixth embodiment of a Bluetooth-based data transmission method provided by the present application;

[0022] Fig. 9 is a flowchart of the seventh embodiment of the Bluetooth-based data transmission method provided by the present application;

[0023] Fig.10 This application provides Fig. 9 A transmission timing diagram of multiple connections of the illustrated embodiment;

[0024] Fig.11 It is a flowchart of the first embodiment of the Bluetooth-based data receiving method provided by the present application;

[0025] Fig.12 is a flowchart of a second embodiment of a Bluetooth-based data receiving method provided by the present application;

[0026] Fig.13 It is a structural diagram of an embodiment of a communication device provided by the present application;

[0027] Fig.14 It is a structural diagram of an embodiment of a communication device provided by the present application;

[0028] Fig.15 It is a structural diagram of an embodiment of a computer storage medium provided by the present application. Specific implementation methods

[0029] The following will be combined with the drawings in the embodiments of the present application to clearly and completely describe the technical solutions in the embodiments of the present application. Obviously, the described embodiments are only part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of this application.

[0030] In addition to A2DP, there are also HFP (Hands-free Profile, Bluetooth hands-free specification), HID (Human Interface Device Profile, human-machine interface device specification), OPP (Object Push Profile, object storage specification), HOGP (HID Over GATT Profile, specification based on the general attribute protocol to implement HID) and other transmission protocols, which are applied in various smart devices and usage scenarios. Different types of devices can realize data transmission through the above different types of transmission protocols or the same type of transmission protocols.

[0031] In actual usage scenarios, an electronic device often needs to connect to multiple different devices at the same time, and use multiple different transmission protocols at the same time, which is often called multi-link. When an electronic device is connected to multiple devices at the same time, there are different transmission protocols or wireless connection methods. At this time, one of the two devices that need to transmit A2DP audio data may be processing other transmission tasks, making A2DP unable to send and receive audio data packets, occupying more bandwidth and affecting Bluetooth transmission performance.

[0032] Please refer to Figure 1 , Figure 1 It is a transmission timing diagram of multiple connections in the prior art. Figure 1Device 2 is an electronic device, device 1 is a Bluetooth device connected to the electronic device, and device 3 is another device connected to the electronic device. The Bluetooth device and the electronic device transmit data packets via the A2DP transmission protocol, where the electronic device can be called an A2DP source, the Bluetooth device can be called an A2DP sink, and the other devices and the electronic device transmit data packets via the OPP transmission protocol. Figure 1 In the timing of the electronic device shown, the A2DP time period is when the electronic device transmits data packets to the Bluetooth device, and the OPP time period is when the electronic device transmits data packets to other devices. In the timing of the Bluetooth device, the A2DP time period is when the electronic device receives data packets from the electronic device, and the OPP time period is when the electronic device receives data packets from other devices.

[0033] When the A2DP time period of the electronic device coincides with the A2DP time period of the Bluetooth device, the audio data packet can be transmitted normally. Figure 1 The A2DP time period of the electronic device overlaps less with the A2DP time period of the Bluetooth device, which results in a certain degree of waste of bandwidth of the electronic device and the Bluetooth device, and may also affect the transmission of other devices.

[0034] To solve the above problems, the present application provides a Bluetooth-based data transmission method, which includes: establishing a communication connection with a second device; determining a breathing sniff interval, and sending indication information of the sniff interval to the second device; entering sniff mode; and sending a data packet to the second device in the sniff interval, wherein the transmission duration of the data packet is greater than or equal to 2 time slots.

[0035] The sniff interval is the time period during which the slave device wakes up periodically to listen to information from the master device. That is, the slave device wakes up every time period to listen to information from the master device.

[0036] The first device may be a master device and the second device may be a slave device. In this case, the first device may start sending a data packet in an even time slot and receive a response message (ACK or NACK) from the second device to the data packet in the next odd time slot after the data packet is sent.

[0037] Alternatively, the first device may be a slave device and the second device may be a master device. In this case, the first device may start sending a data packet in an odd time slot and receive a response message (ACK or NACK) from the second device to the data packet in the next even time slot after the data packet is sent. In one embodiment, the second device first sends an empty packet, such as a polling packet, in an even time slot. After the first device receives the empty packet, it starts sending a data packet in an odd time slot.

[0038] as follows Figure 2-Figure 8 The embodiment is described by taking the example that the first device is a master device and the second device is a slave device.

[0039] Please refer to Figure 2 and Figure 3 , Figure 2 is a flowchart of a first embodiment of a Bluetooth-based data transmission method provided by the present application, Figure 3 : is a transmission timing diagram of multiple connections provided by the present application. The Bluetooth-based data transmission method of this embodiment is applied to an electronic device, such as a first device. The electronic device may be a terminal device such as a smart phone, a tablet computer, a laptop computer, a computer, or a wearable device, and the second device connected to the first device may be a common wireless device such as a Bluetooth headset, a Bluetooth speaker, etc. on the market.

[0040] like Figure 2 As shown, the data transmission method based on Bluetooth in this embodiment specifically includes the following steps:

[0041] S201: Establish a communication connection with a second device.

[0042] The first device may establish an ACL (Access Control List) link connection with the second device. In one embodiment, the initial communication connection between the first device and the second device may default to active mode. Figure 3 Device 1 in the example, and the second device is Figure 3 Device 2 in.

[0043] S202: Determine a sniff interval, where the sniff interval includes a sniff wake-up window, and send indication information of the sniff interval to the second device.

[0044] In one implementation, the first device may determine the sniff interval based on information of a data packet to be transmitted between the first device and the second device, wherein the information of the data packet includes a time interval for generating the data packet, and wherein the sniff interval may be a multiple of the time interval for generating the data packet.

[0045] After the first device establishes a communication connection with the second device, the first device obtains information about a data packet to be transmitted to the second device. For example, when the second device is a Bluetooth device, the first device obtains information about an audio data packet to be transmitted between the first device and the Bluetooth device.

[0046] Specifically, the first device generates a data packet, and determines the sniff interval according to the time interval of generating the data packet. For example, if an A2DP data packet is generated every 20ms, the sniff interval can be determined to be 20ms, or the sniff interval can be determined to be 40ms. When the sniff interval is 20ms, one A2DP data packet needs to be sent in the sniff wake-up window, and when the sniff interval is 40ms, two A2DP data packets need to be sent in the sniff wake-up window. Figure 3 The time slot 0 to time slot 31 in the sniff interval is a sniff interval. The data packet generation time interval is the interval between the time points of generating two consecutive data packets when encoding the original data stream to generate multiple consecutive data packets, for example, the interval between the time point of generating the first data packet and the time point of generating the second data packet.

[0047] The longer the time interval between the generation of the A2DP data packets is, the lower the bit rate of the A2DP data packets is; the shorter the time interval between the generation of the A2DP data packets is, the higher the bit rate of the A2DP data packets is; the bit rate can be negotiated between the first device and the second device. The higher the bit rate, the better the sound quality played by the second device after receiving the data packet, and the lower the bit rate, the worse the sound quality played by the second device after receiving the data packet.

[0048] Furthermore, the sniff interval includes a sniff wake-up window. In one embodiment, the time starting point of the sniff interval is the same as the time starting point of the sniff wake-up window. The sniff wake-up window is the communication transmission time for transmitting data packets between the first device and the second device. During the time outside the sniff wake-up window in the sniff interval, the second device can enter a suspended state or a dormant state, reducing the workload of the second device and freeing up CPU processing resources. The length of the sniff wake-up window is variable.

[0049] Optionally, in this step, the first device may receive the sniff interval suggested by the second device, and determine the sniff interval based on information of the data packet to be transmitted between the first device and the second device. If the sniff interval suggested by the first device basically matches the sniff interval determined by the second device, the sniff interval determined in step S201 may be the sniff interval suggested by the second device, and the first device sends an indication message to the second device indicating the use of the sniff interval and sniff wake-up window suggested by the second device. If the sniff interval suggested by the first device does not match the sniff interval determined by the second device, the first device sends an indication message to the second device indicating the sniff interval and sniff wake-up window determined by itself, wherein the sniff interval suggested by the first device basically matches the sniff interval determined by the second device, which means that the difference between the sniff interval suggested by the first device and the sniff interval determined by the second device is within a predetermined time range.

[0050] S203: Enter sniff mode.

[0051] The ACL link connection mode between the first device and the second device is switched from the active mode to the sniff mode (breathing mode).

[0052] S204: Send a first data packet to the second device at the anchor point of the sniff interval, where the transmission duration of the first data packet is greater than or equal to 2 time slots.

[0053] The sniff interval anchor point can be called the sniff anchor point. Figure 3 In the timing diagram of , the first device sends a first data packet based on the A2DP transmission protocol within the three time slots of time slot 0 to time slot 2, and the second device receives the first data packet within the three time slots of time slot 0 to time slot 2. In this embodiment, the first device starts to send data packets to the second device in even time slots, such as Figure 3 As shown, a data packet is sent to the second device in time slot 0 and time slot 4; the first device receives a response message (such as ACK or NACK) from the second device to the sent data packet in the next odd time slot after the first device finishes sending the data packet, as shown in FIG. Figure 3 As shown, a response message to the transmitted data packet is received from the second device at time slot 3 and time slot 7.

[0054] The embodiment of the present invention sets the sniff interval and the sniff wake-up window to agree on the start time of communication transmission between the first device and the second device, for example, at the anchor point of the sniff interval, which can effectively ensure that the transmission of the first device is synchronized with the reception of the second device, saving broadband resources. Among them, the duration of the first device transmitting the first data packet is set to be greater than or equal to 2 time slots, which can increase the amount of data transmitted each time, which is conducive to improving the efficiency of data transmission.

[0055] The sniff wake-up window in the first sniff interval may have a maximum length or may not have a maximum length. When the sniff wake-up window in the first sniff interval has a maximum length, the maximum length may be a preset length or may be determined by the first device before entering the sniff mode. The maximum length of the sniff wake-up window refers to the maximum duration of data communication that can be performed in the sniff interval. If the first device has no data packets to be transmitted in the sniff interval, the sniff wake-up window may end before the maximum duration is reached. Please continue to refer to Figure 4 , Figure 4 : is a flowchart of the second embodiment of the Bluetooth-based data transmission method provided by the present application. Specifically, it includes the following steps:

[0056] S401: Establish a communication connection with a second device.

[0057] S402: Determine a sniff interval and determine a maximum length of a sniff wake-up window, wherein the sniff interval includes the sniff wake-up window, and wherein the information of the data packet includes the size of the data packet.

[0058] The method for determining the sniff interval may be the same as that in the first embodiment, and will not be described in detail herein.

[0059] Optionally, when determining the maximum length of the sniff wake-up window in the sniff interval, the first device may determine the maximum length of the sniff wake-up window according to the predetermined number of data packets to be transmitted in a sniff interval, the transmission duration of each data packet to be transmitted, and the number of retransmissions of each data packet to be transmitted, wherein the maximum length of the sniff wake-up window is greater than the sum of the transmission duration of each data packet to be transmitted and the retransmission duration of each data packet to be transmitted predetermined in the sniff interval, wherein the retransmission duration of the data packet to be transmitted is equal to the product of the number of retransmissions of the data packet to be transmitted and the transmission duration of the data packet to be transmitted. For example, if the time interval for generating data packets is 20ms and the sniff interval is 40ms, then 2 data packets need to be transmitted in a sniff wake-up window, and the maximum length of the sniff wake-up window should be greater than: the number of data packets to be transmitted*transmission duration, plus the sum of the number of data packets to be transmitted*retransmission duration. For example, assuming that the number of retransmissions is 1, the estimated time for the first device to send a data packet to the second device and receive a response message from the second device is 3.75ms, then the estimated time for retransmitting the data packet and receiving a response message for the retransmitted data packet is also 3.75ms. Assuming that the first device needs to send 2 data packets in the sniff window, the maximum length of the sniff wake-up window needs to be greater than 15ms.

[0060] S403: Enter sniff mode.

[0061] S404: Send a first data packet to the second device at the anchor point of the sniff interval, where the transmission duration of the first data packet is greater than or equal to 2 time slots.

[0062] Please continue reading Figure 5 , Figure 5 : is a flowchart of the third embodiment of the Bluetooth-based data transmission method provided by the present application. Specifically, it includes the following steps:

[0063] S501-S504 are similar to S201-S204, or similar to S401-S404, and will not be described in detail here.

[0064] S505: Receive response information from the second device, and when the response message indicates that the first data packet is not successfully received, retransmit the first data packet in the sniff wake-up window.

[0065] The first device starts to send data packet 1 to the second device in an even time slot (e.g., an anchor point), and receives a response message from the second device to the sent data packet 1 in the next odd time slot after the first device finishes sending data packet 1. When the response message indicates that the second device has not successfully received data packet 1, the first device starts to retransmit data packet 1 to the second device in the next even time slot of the odd time slot. Figure 3 In the timing diagram, the first device sends data packet 1 based on the A2DP transmission protocol in three time slots from time slot 0 to time slot 2, and the second device receives data packet 1 in three time slots from time slot 0 to time slot 2. Figure 3 The first device receives the response information of the second device in time slot 3. When the response information indicates that data packet 1 is not successfully received, that is, NACK information, it means that the previous transmission of data packet 1 has failed. The first device retransmits data packet 1, that is, retransmits data packet 1 in three time slots from time slot 4 to time slot 6.

[0066] Please continue reading Figure 6 , Figure 6 : is a flowchart of the fourth embodiment of the Bluetooth-based data transmission method provided by the present application. Specifically, it includes the following steps:

[0067] S601-S604 are similar to S201-S204, or similar to S401-S404, and will not be described in detail here.

[0068] S605: If no response message indicating that the second device successfully receives the first data packet is received within the sniff wake-up window, the first data packet is retransmitted to the second device at the anchor point in the next sniff interval.

[0069] For example, in Figure 3 In the timing diagram, the first device sends data packet 1 based on the A2DP transmission protocol in three time slots from time slot 0 to time slot 2, and the second device receives data packet 1 in three time slots from time slot 0 to time slot 2. Figure 3 The first device receives the response information of the second device in time slot 3. When the response information indicates that data packet 1 is not successfully received, that is, NACK information, it means that the previous data packet 1 transmission failed, then the first device retransmits the data packet 1, that is, retransmits the data packet 1 in three time slots from time slot 4 to time slot 6. Figure 3 The first device receives the response information of the second device in time slot 7 in the sniff interval. When the response information indicates that the data packet 1 is not successfully received and the maximum length of the sniff wake-up window has been reached, the first device starts retransmission at the anchor point of the sniff interval in the next sniff interval, such as Figure 3 The data packet 1 that failed to be transmitted in the sniff interval starts to be retransmitted at the time slot 32 in the sniff interval, thereby ensuring that the data between the first device and the second device can be completely and successfully transmitted.

[0070] For example, in Figure 3 In the timing diagram, the first device sends data packet 1 based on the A2DP transmission protocol in three time slots from time slot 0 to time slot 2, and the second device receives data packet 1 in three time slots from time slot 0 to time slot 2. Figure 3 The first device receives the response information of the second device in time slot 3. When the response information indicates that the data packet 1 is successfully received, that is, the ACK information, it means that the previous data packet 1 is successfully transmitted. Then the first device sends data packet 2, that is, sends data packet 2 in three time slots from time slot 4 to time slot 6. Figure 3 The first device receives the response information of the second device in the time slot 7 in the sniff interval. When the response information indicates that the data packet 2 is not successfully received and the maximum length of the sniff wake-up window has been reached, the first device sets the sniff interval anchor point in the next sniff interval, such as Figure 3 The data packet 2 that failed to be transmitted in the sniff interval starts to be retransmitted at the time slot 32 in the sniff interval, thereby ensuring that the data between the first device and the second device can be completely and successfully transmitted.

[0071] Please continue reading Figure 7 , Figure 7 : is a flowchart of the fifth embodiment of the Bluetooth-based data transmission method provided by the present application. Specifically, it includes the following steps:

[0072] S701-S704 are similar to S201-S204, or similar to S401-S404, and will not be described in detail here.

[0073] S705: When the first device stops sending data packets to the second device, the first device remains in the sniff mode.

[0074] S706: When the first device resumes sending the data packet to the second device, the first device sends the data packet to the second device at the anchor point of the sniff interval.

[0075] Since the first device remains in sniff mode when it suspends sending data packets to the second device, when it resumes sending data packets to the second device, the first device can use the previously determined sniff interval and sniff wake-up window without having to redetermine the sniff interval and sniff wake-up window. In this way, when the first device resumes sending data packets to the second device, it can send data to the second device immediately.

[0076] Please continue reading Figure 8 , Figure 8 : is a flowchart of the sixth embodiment of the Bluetooth-based data transmission method provided by the present application. Specifically, it includes the following steps:

[0077] S801: Establish a communication connection with a second device.

[0078] S802: Determine the maximum length of the sniff interval and the sniff wake-up window, wherein the sniff interval includes the sniff wake-up window, and send indication information of the sniff interval to the second device.

[0079] S803: Enter sniff mode.

[0080] S804: Send a first data packet to the second device at the anchor point of the sniff interval, where the transmission duration of the first data packet is greater than or equal to 2 time slots.

[0081] S805: Establish a communication connection with a third device.

[0082] Among them, the third device is Figure 3 Device 3 in the first device. The first device can establish an ACL (Access Control List) link connection with the third device. After the ACL link connection is established, the communication between the first device and the third device can be switched to a sniff mode (breathing mode), or the communication connection between the first device and the third device can also be maintained in an active mode.

[0083] S806: Send a second data packet to the third device within the sniff interval after the sniff wake-up window ends.

[0084] The first device may send a data packet to the third device after the sniff wake-up window ends and before the anchor point of the next sniff interval. Figure 3 The time slots 8 to 31 in the ...

[0085] Optionally, the first device can flexibly adjust the data packet type according to the interference situation in the environment. When the interference is relatively small, a data packet of the first data type can be selected, such as a 3-DH5 data packet. When the interference is relatively large, a data packet of the second data type can be selected, such as a 2-DH5 data packet, wherein a data packet of the first data type carries more data than a data packet of the second data type.

[0086] as follows Fig. 9 The embodiment of the present invention is described by taking the first device as a slave device and the second device as a master device as an example. The main difference between the first device as a slave device and the second device as a master and the previous embodiment in which the first device as a master device and the second device as a slave device is that the first device can start sending a data packet at an odd time slot and receive a response message from the second device to the data packet at the next even time slot after the data packet is sent. Specifically, the following steps are included:

[0087] S901: Establish a communication connection with a second device.

[0088] S902: Determine a sniff interval, where the sniff interval includes a sniff wake-up window, and send indication information of the sniff interval to the second device.

[0089] S903: Enter sniff mode.

[0090] S904: Start receiving an empty packet sent by the second device at the anchor point of the sniff interval, such as Poll, and send a first data packet to the second device in the next odd time slot after completing receiving the empty packet. The transmission duration of the first data packet is greater than or equal to 2 time slots.

[0091] like Fig.10 As shown, the first device is a slave device, which receives an empty packet sent by the second device in time slot 0 of the sniff interval, starts sending data packet 1 to the second device in time slot 1, and receives a response message from the second device to data packet 1 in the next even-numbered time slot after the end of sending data packet 1, that is, time slot 4. If the response message is ACK, data packet 2 is sent to the second device in time slot 5, and a response message from the second device to data packet 2 is received in the next even-numbered time slot after the end of sending data packet 2, that is, time slot 8. If the response message is NACK, data packet 1 is retransmitted to the second device in time slot 5, and a response message from the second device to the retransmitted data packet 1 is received in the next even-numbered time slot after the end of retransmitting data packet 1, that is, time slot 8.

[0092] This application provides a method for receiving data based on Bluetooth. Fig.11 , Fig.11 The data receiving method based on Bluetooth of the present application is applied to a second device, such as a Bluetooth device, which can be a common wireless device such as a Bluetooth headset or a Bluetooth speaker on the market.

[0093] like Fig.11 As shown, the Bluetooth-based data receiving method of this embodiment specifically includes the following steps:

[0094] S1101: The second device establishes a communication connection with the first device.

[0095] S1102: The second device receives a notification message sent by the first device, wherein the notification message includes: indication information of the sniff interval and the sniff wake-up window. Optionally, the notification message also includes: indication information of the maximum length of the sniff wake-up window.

[0096] S1103: Enter sniff mode;

[0097] S1104: Receive a first data packet sent by a first device in the sniff interval, where a transmission duration of the first data packet is greater than or equal to 2 time slots.

[0098] The first device may be a master device, and the second device may be a slave device. In this case, the second device may start receiving a data packet in an even time slot, and send a response message (ACK or NACK) of the second device to the data packet in the next odd time slot after completing the reception of the data packet. For example, the second device starts receiving the first data packet at the anchor point of the sniff interval.

[0099] Alternatively, the first device may be a slave device, and the second device may be a master device. In this case, the second device may start receiving a data packet in an odd time slot, and send a response message (ACK or NACK) of the second device to the data packet in the next even time slot after completing the reception of the data packet. For example, the second device starts receiving the first data packet in time slot 1. In one embodiment, before the second device starts receiving the first data packet in time slot 1, the second device sends an empty packet, such as a poll packet, to the first device.

[0100] Please continue reading Fig.12 , Fig.12 1 is a flow chart of a fourth embodiment of a Bluetooth-based data transmission method provided by the present application. In this embodiment, the first device is a master device and the second device is a slave device. Specifically, the following steps are included:

[0101] S1201-S1204 are similar to S1101-S1104 and will not be described again here.

[0102] S1205: When the first device stops sending data packets to the second device, the second device remains in the sniff mode.

[0103] S1206: When the first device resumes sending data packets to the second device, the second device receives the data packets sent by the first device at the anchor point of the sniff interval.

[0104] Optionally, when the first device is a slave device and the second device is a master device, in step S1206, when the first device resumes sending data packets to the second device, the second device receives data packets sent by the first device in odd time slots of the sniff interval.

[0105] In order to implement the Bluetooth-based data transmission method of the above embodiment, this application proposes a communication device. Fig.13, Fig.13 1 is a schematic diagram of the structure of an embodiment of a communication device provided by the present application. Fig.13 As shown, the communication device 1300 of this embodiment may include:

[0106] The transceiver 1301 is used to establish a communication connection with a second device;

[0107] Processor 1302 determines a sniff interval, wherein the sniff interval includes a sniff wake-up window, enters a sniff mode, notifies the sniff interval and the indication information of the sniff wake-up window via the transceiver, and sends a first data packet to the second device in the sniff interval, wherein the transmission duration of the first data packet is greater than or equal to 2 time slots.

[0108] The communication device may be a master device, and the second device may be a slave device. In this case, the communication device may start sending a data packet at an even time slot, and receive a response message (ACK or NACK) from the second device to the data packet at the next odd time slot after the data packet is sent. For example, the communication device starts sending the first data packet at the anchor point.

[0109] Alternatively, the communication device may be a slave device and the second device may be a master device. In this case, the communication device may start sending a data packet in an odd time slot and receive a response message (ACK or NACK) from the second device to the data packet in the next even time slot after the data packet is sent.

[0110] It may also include:

[0111] The memory 1303 stores a computer program, and the processor 1302 can be used to execute the computer program to implement the above operations.

[0112] When determining the sniff interval, the processor 1302 determines the sniff interval based on information about the data packet to be transmitted between the second device, wherein the information about the data packet to be transmitted includes a generation time interval of the data packet to be transmitted, and wherein the sniff interval is a multiple of the generation time interval of the data packet.

[0113] Optionally, the processor 1302 is further capable of: determining the maximum length of the sniff wake-up window according to the predetermined number of data packets to be transmitted, the transmission duration of each data packet to be transmitted and the number of retransmissions of each data packet to be transmitted, wherein the maximum length of the sniff wake-up window is greater than the predetermined sum of the transmission duration of each data packet to be transmitted in the sniff interval and the retransmission duration of each data packet to be transmitted, wherein the retransmission duration of the data packet to be transmitted is equal to the product of the number of retransmissions of the data packet to be transmitted and the transmission duration of the data packet to be transmitted. Determining the maximum length of the sniff wake-up window can cause the sniff wake-up window to end when the maximum length is reached, so that communication can be carried out with other communication devices within the non-sniff wake-up window time of the sniff interval, so that when the first device establishes multiple links, communication can be carried out with other communication devices in real time.

[0114] Optionally, the processor is further capable of: maintaining the sniff mode when pausing to send data packets to the second device. This method can make: when resuming to send data packets to the second device, the first device can use the previously determined sniff interval and sniff wake-up window without redetermining the sniff interval and sniff wake-up window, so that when the first device resumes sending data packets to the second device, data can be sent to the second device immediately.

[0115] Optionally, the transceiver is further used to establish a communication connection with a third device; the processor is further used to send a second data packet to the third device via the transceiver after the sniff wake-up window ends within the sniff interval. This method can enable: when the first device establishes multiple links, it can communicate with other communication devices in real time.

[0116] In which, the processor can also perform a data packet retransmission function through the transceiver: when the data packet is sent to the second device starting in the even time slot of the sniff interval, a response message from the second device is received in the next odd time slot after the data packet is sent, and when the response message indicates that the data packet is not successfully received, the data packet is retransmitted in the next even time slot; when the data packet is sent to the second device starting in the odd time slot of the sniff interval, a response message from the second device is received in the next even time slot after the data packet is sent, and when the response message indicates that the data packet is not successfully received, the data packet is retransmitted in the next odd time slot.

[0117] The processor may also execute other functions of the first device in the above method embodiment through the transceiver, which will not be described in detail here.

[0118] In this embodiment, the processor 1302 may also be referred to as a CPU (Central Processing Unit). The processor 1302 may be an integrated circuit chip having signal processing capabilities. The processor 1302 may also be a general-purpose processor, a digital signal processor (DSP), an application-specific integrated circuit (ASIC), a field programmable gate array (FPGA) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components. A general-purpose processor may be a microprocessor or the processor 1302 may also be any conventional processor, etc.

[0119] In order to implement the Bluetooth-based data receiving method of the above embodiment, the present application proposes a communication device. Fig.14 , Fig.14 1 is a schematic diagram of the structure of an embodiment of a communication device provided by the present application. Fig.14 As shown, the communication device 1400 of this embodiment may include:

[0120] The transceiver 1401 is used to establish a communication connection with the first device;

[0121] Processor 1402 is used to receive a notification message sent by the first device, the notification message including indication information of a sniff interval; enter sniff mode; receive a data packet sent by the second device via the transceiver in the sniff interval, the transmission duration of the data packet being greater than or equal to 2 time slots; wherein, the data packet sent by the second device is received starting from an odd-numbered time slot of the sniff interval; or, the data packet sent by the second device is received starting from an even-numbered time slot of the sniff interval.

[0122] It may also include:

[0123] The memory 1403 stores a computer program, and the processor 1302 can be used to execute the computer program to implement the above operations.

[0124] The processor in the communication device provided in this embodiment can perform the operations in each embodiment of the above-mentioned Bluetooth-based data receiving method through a transceiver, which will not be described in detail here.

[0125] The present application also provides a computer storage medium, such as Fig.15 As shown, the computer storage medium 1500 is used to store a program, and when the program is executed by the processor, it is used to implement the method in the embodiment of the data transmission method based on Bluetooth or the embodiment of the data receiving method based on Bluetooth of the present application.

[0126] The method involved in the embodiment of the data transmission method based on Bluetooth of the present application, when implemented in the form of a software functional unit and sold or used as an independent product, can be stored in a device, such as a computer-readable storage medium. Based on such an understanding, the technical solution of the present application is essentially or the part that contributes to the prior art or all or part of the technical solution can be embodied in the form of a software product, and the computer software product is stored in a storage medium, including several instructions for a computer device (which can be a personal computer, a server, or a network device, etc.) or a processor (processor) to perform all or part of the steps of the method described in each implementation method of the present invention. The aforementioned storage medium includes: U disk, mobile hard disk, read-only memory (ROM, Read-Only Memory), random access memory (RAM, Random Access Memory), disk or optical disk and other media that can store program codes.

[0127] The above description is only the implementation method of the present application, and does not limit the patent scope of the present application. Any equivalent structure or equivalent process transformation made using the contents of the present application specification and drawings, or directly or indirectly used in other related technical fields, are also included in the patent protection scope of the present application.

Claims

1. A data transmission method based on Bluetooth, It is characterized in that The data transmission method is implemented on a first device, and the data transmission method includes: establishing a communication connection with a second device; Enter sniff mode; Sending a data packet to the second device in a sniff interval, wherein the transmission duration of the data packet is greater than or equal to 2 time slots; the sniff interval includes a sniff wake-up window; and the anchor point of the sniff interval is the start of the sniff wake-up window; Wherein, sending a data packet to the second device in the sniff interval includes: Starting to send the data packet to the second device in an even time slot of the sniff interval within the sniff wake-up window; or, Starting to send the data packet to the second device in the odd time slots of the sniff interval within the sniff wake-up window; receiving a response message from the second device, and when the response message indicates that the data packet is not successfully received, retransmitting the data packet in the sniff wake-up window; The receiving of response information from the second device, and when the response message indicates that the data packet is not successfully received, retransmitting the data packet in the sniff wake-up window includes: When the data packet is sent to the second device starting in the even time slot of the sniff interval, receiving a response message from the second device in the next odd time slot after the data packet is sent, and when the response message indicates that the data packet is not successfully received, retransmitting the data packet in the next even time slot; When the data packet is sent to the second device starting in the odd time slot of the sniff interval, a response message is received from the second device in the next even time slot after the data packet is sent. When the response message indicates that the data packet is not successfully received, the data packet is retransmitted in the next odd time slot.

2. The data transmission method based on Bluetooth according to claim 1, It is characterized in that Also includes: Determine a sniff interval, and send indication information of the sniff interval to the second device; Determining the sniff interval includes: Determine a sniff interval based on information of the data packet to be transmitted between the second device, wherein the information of the data packet to be transmitted includes a time interval for generating the data packet to be transmitted, and wherein the sniff interval is a multiple of the time interval for generating the data packet to be transmitted.

3. The data transmission method based on Bluetooth according to claim 1, It is characterized in that The data transmission method further comprises: The maximum length of the sniff wake-up window is determined based on the predetermined number of data packets to be transmitted in the sniff interval, the transmission duration of each data packet to be transmitted, and the number of retransmissions of each data packet to be transmitted, wherein the maximum length of the sniff wake-up window is greater than the sum of the predetermined transmission duration of each data packet to be transmitted in the sniff interval and the retransmission duration of each data packet to be transmitted, wherein the retransmission duration of the data packet to be transmitted is equal to the product of the number of retransmissions of the data packet to be transmitted and the transmission duration of the data packet to be transmitted.

4. The data transmission method based on Bluetooth according to claim 1, It is characterized in that The data transmission method further comprises: If no response message indicating that the second device successfully receives the data packet is received within the sniff wake-up window, the data packet is retransmitted to the second device in the next sniff interval.

5. The data transmission method based on Bluetooth according to claim 1, It is characterized in that The data transmission method further comprises: When the sending of the data packet to the second device is suspended, the sniff mode is maintained.

6. The data transmission method based on Bluetooth according to claim 1, It is characterized in that The data transmission method further comprises: Establishing a communication connection with a third device; Sending a data packet of the third device to the third device within the sniff interval after the sniff wake-up window ends.

7. The data transmission method based on Bluetooth according to claim 1, It is characterized in that The step of sending a data packet to the second device in the sniff interval is specifically: The data packet is sent to the second device in the sniff interval based on an Advanced Audio Distribution Profile (A2DP) transmission protocol.

8. The data transmission method based on Bluetooth according to claim 1, It is characterized in that The sending of the data packet to the second device starting at an even time slot of the sniff interval within the sniff wake-up window includes: The first data packet starts to be sent to the second device at the anchor point of the sniff interval.

9. A data receiving method based on Bluetooth, It is characterized in that include: The second device establishes a communication connection with the first device; The second device enters sniff mode; The second device receives a data packet sent by the first device in a sniff interval, wherein the transmission duration of the data packet is greater than or equal to 2 time slots; the sniff interval includes a sniff wake-up window; and the anchor point of the sniff interval is the beginning of the sniff wake-up window; The receiving, by the second device, of the data packet sent by the first device in the sniff interval includes: Start receiving the data packet sent by the first device in the odd time slots of the sniff interval within the sniff wake-up window; or, Start receiving the data packet sent by the first device in the even time slots of the sniff interval within the sniff wake-up window; When the second device starts to receive the data packet sent by the first device in the even time slot of the sniff interval, the second device sends a response message of the data packet to the second device in the next odd time slot after completing receiving the data packet; if the response message indicates that the second device has not successfully received the data packet, the second device receives the data packet retransmitted by the first device in the next even time slot; When the second device starts to receive the data packet sent by the first device in the odd time slot of the sniff interval, it sends a response message of the second device to the data packet in the next even time slot after completing the reception of the data packet; if the response message indicates that the second device has not successfully received the data packet, it receives the data packet retransmitted by the first device in the next odd time slot.

10. The Bluetooth-based data receiving method according to claim 9, It is characterized in that When receiving data packets from the first device is suspended, remaining in the sniff mode; It also includes: the second device receiving a notification message sent by the first device, wherein the notification message includes indication information of the sniff interval.

11. The Bluetooth-based data receiving method according to claim 9, It is characterized in that Starting to receive the data packet sent by the first device in the even time slots of the sniff interval within the sniff wake-up window includes: The first data packet sent by the first device begins to be received at the anchor point of the sniff interval.

12. A communication device, It is characterized in that The communication device comprises: a transceiver, configured to establish a communication connection with a second device; The processor enters the sniff mode, and sends a data packet to the second device in the sniff interval, wherein the transmission time of the data packet is greater than or equal to 2 time slots; the sniff interval includes a sniff wake-up window; the anchor point of the sniff interval is the beginning of the sniff wake-up window; wherein sending the data packet to the second device in the sniff interval includes: sending the data packet to the second device starting from the even time slot of the sniff interval in the sniff wake-up window; or sending the data packet to the second device starting from the odd time slot of the sniff interval in the sniff wake-up window. packet; when the data packet is sent to the second device at the beginning of the even time slot of the sniff interval, a response message from the second device is received at the next odd time slot after the sending of the data packet is finished, and when the response message indicates that the second device has not successfully received the data packet, the data packet is retransmitted at the next even time slot; when the data packet is sent to the second device at the beginning of the odd time slot of the sniff interval, a response message from the second device is received at the next even time slot after the sending of the data packet is finished, and when the response message indicates that the second device has not successfully received the data packet, the data packet is retransmitted at the next odd time slot.

13. The communication device according to claim 12, It is characterized in that The processor determines the sniff interval, sends indication information of the sniff interval to the second device via the transceiver, and when determining the sniff interval, determines the sniff interval based on information of the data packet to be transmitted between the processor and the second device, wherein the information of the data packet to be transmitted includes a time interval for generating the data packet to be transmitted, and wherein the sniff interval is a multiple of the time interval for generating the data packet.

14. The communication device according to claim 12, It is characterized in that The processor is further capable of remaining in the sniff mode while pausing sending of data packets to the second device.

15. A communication device, It is characterized in that The communication device comprises: a transceiver, configured to establish a communication connection with the first device; The processor enters the sniff mode; receives a data packet sent by the first device via the transceiver in the sniff interval, wherein the transmission time of the data packet is greater than or equal to 2 time slots; the sniff interval includes a sniff wake-up window; the anchor point of the sniff interval is the beginning of the sniff wake-up window; wherein receiving the data packet sent by the first device in the sniff interval includes: starting to receive the data packet sent by the first device in the odd time slots of the sniff interval within the sniff wake-up window; or starting to receive the data packet sent by the first device in the even time slots of the sniff interval within the sniff wake-up window; when the sniff interval is When the odd time slot of the sniff interval starts to receive the data packet sent by the first device, the communication device sends a response message to the data packet in the next even time slot after completing the reception of the data packet; if the response message indicates that the communication device has not successfully received the data packet, the data packet retransmitted by the first device is received in the next odd time slot; when the even time slot of the sniff interval starts to receive the data packet sent by the first device, the communication device sends a response message to the data packet in the next odd time slot after completing the reception of the data packet; if the response message indicates that the communication device has not successfully received the data packet, the data packet retransmitted by the first device is received in the next even time slot.

16. A computer storage medium, It is characterized in that The computer storage medium is used to store program instructions, and the program instructions enable the processor to execute the Bluetooth-based data transmission method according to any one of claims 1 to 8 or the Bluetooth-based data receiving method according to any one of claims 9 to 11.