Bluetooth communication method and device, electronic equipment, medium and computer program product

By judging the stability of the communication environment based on the signal strength difference during the sniffing cycle, reducing the number of sniffing attempts of Bluetooth devices, the problem of high power consumption in sniffing mode is solved, and resource saving and battery life are achieved Improvement.

CN119071768APending Publication Date: 2024-12-03VIVO MOBILE COMM CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411193704.5
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-08-28
Publication Date
2024-12-03

AI Technical Summary

Technical Problem

In sniffing mode, Bluetooth devices consume a lot of power due to continuous sniffing attempts, especially in battery-powered portable devices, where unnecessary power consumption is wasteful.

Method used

By judging the stability of the communication environment based on the signal strength difference during the sniffing cycle, stop sending the sniffing request message when the difference is less than or equal to the predetermined threshold, reduce unnecessary sniffing attempts and reduce the power consumption of the Bluetooth device. .

Benefits of technology

It effectively saves the resources of Bluetooth devices, extends the battery life of the device, reduces the waste of power consumption, and improves the stability of the communication environment.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119071768A_ABST
    Figure CN119071768A_ABST
Patent Text Reader

Abstract

The invention discloses a Bluetooth communication method and device, electronic equipment, a medium and a computer program product, and belongs to the technical field of communication. The method comprises the following steps: in a first sniffing period, sending a sniffing request message to a second Bluetooth device; under the condition that a sniffing response message of the second Bluetooth device is received, a first difference value is obtained based on the first signal strength and the second signal strength, and the first signal strength and the second signal strength are signal strength between the first Bluetooth device and the second Bluetooth device at different time; and when the first difference value is smaller than or equal to a preset threshold value, in the first sniffing period, stopping sending the sniffing request message to the second Bluetooth device.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application belongs to the field of communication technology, and specifically relates to a Bluetooth communication method, device, electronic device, medium and computer program product. Background Art

[0002] Sniff Attempt refers to the action taken by a Bluetooth device to maintain low power consumption mode when connected. It can be understood that in Bluetooth wireless communication, Sniff Mode is a low power consumption communication mode that can reduce the power consumption of Bluetooth devices by establishing periodic communication intervals between Bluetooth devices. That is, in Sniff Mode, a Bluetooth device can be in a low power consumption state for a period of time, and then wake up and communicate at a specified time.

[0003] However, in the sniffing mode, regardless of whether a response message from another device is sniffed, the Bluetooth device will perform multiple sniffing attempts according to preset rules, resulting in high energy consumption of the Bluetooth device. Summary of the invention

[0004] The purpose of the embodiments of the present application is to provide a Bluetooth communication method, apparatus, electronic device, medium and computer program product, which can reduce the power consumption of Bluetooth devices to save Bluetooth device resources.

[0005] In a first aspect, an embodiment of the present application provides a Bluetooth communication method, which is applied to a first Bluetooth device, the method comprising: sending a sniff request message to a second Bluetooth device within a first sniffing cycle; upon receiving a sniff response message from the second Bluetooth device, obtaining a first difference based on a first signal strength and a second signal strength, the first signal strength and the second signal strength being the signal strengths between the first Bluetooth device and the second Bluetooth device at different times; and stopping sending the sniff request message to the second Bluetooth device within the first sniffing cycle when the first difference is less than or equal to a predetermined threshold.

[0006] In the second aspect, an embodiment of the present application provides a Bluetooth communication device, which is applied to a first Bluetooth device, and the device includes: a sending module, a receiving module and a processing module; the sending module is used to send a sniff request message to a second Bluetooth device within a first sniffing cycle; the processing module is used to obtain a first difference based on a first signal strength and a second signal strength when the receiving module receives a sniff response message from the second Bluetooth device, the first signal strength and the second signal strength being the signal strengths between the Bluetooth communication device and the second Bluetooth device at different times; the sending module is also used to stop sending the sniff request message to the second Bluetooth device within the first sniffing cycle when the first difference obtained by the processing module is less than or equal to a predetermined threshold.

[0007] In a third aspect, an embodiment of the present application provides an electronic device, which includes a processor and a memory, wherein the memory stores programs or instructions that can be run on the processor, and when the program or instructions are executed by the processor, the steps of the method described in the first aspect are implemented.

[0008] In a fourth aspect, an embodiment of the present application provides a readable storage medium, on which a program or instruction is stored, and when the program or instruction is executed by a processor, the steps of the method described in the first aspect are implemented.

[0009] In a fifth aspect, an embodiment of the present application provides a chip, comprising a processor and a communication interface, wherein the communication interface is coupled to the processor, and the processor is used to run a program or instruction to implement the method described in the first aspect.

[0010] In a sixth aspect, an embodiment of the present application provides a computer program product, which is stored in a storage medium and is executed by at least one processor to implement the method described in the first aspect.

[0011] In an embodiment of the present application, a sniff request message is sent to a second Bluetooth device in a first sniffing cycle; when a sniff response message of the second Bluetooth device is received, a first difference is obtained based on the first signal strength and the second signal strength, and the first signal strength and the second signal strength are the signal strengths between the Bluetooth communication device and the second Bluetooth device at different times; when the first difference is less than or equal to a predetermined threshold, the sniff request message is stopped from being sent to the second Bluetooth device in the first sniffing cycle. Through this scheme, when the Bluetooth device sniffs in the sniffing cycle and receives a response message from other Bluetooth devices, the Bluetooth device can judge whether the signal strength of the communication has changed significantly by the difference in signal strength between the other Bluetooth devices at different times. When the difference is small, it is considered that the signal strength of the communication has not changed much, and it is determined that the other Bluetooth device is in a connected state, and the communication environment is relatively stable. Therefore, the Bluetooth device can no longer send a sniff request message in the sniffing cycle, and the power consumption of the Bluetooth device is reduced by reducing the number of unnecessary sniff request messages, saving the resources of the Bluetooth device. BRIEF DESCRIPTION OF THE DRAWINGS

[0012] Figure 1 This is a N provided in the embodiment of the present application. sniff attempt =1 sniffing timing flow chart;

[0013] Figure 2 This is a N provided in the embodiment of the present application. sniff attempt =3 sniffing timing flow chart;

[0014] Figure 3 It is one of the flow charts of a Bluetooth communication method provided in an embodiment of the present application;

[0015] Figure 4 This is the second flowchart of a Bluetooth communication method provided in an embodiment of the present application;

[0016] Figure 5 This is the third flowchart of a Bluetooth communication method provided in an embodiment of the present application;

[0017] Figure 6 This is a fourth flowchart of a Bluetooth communication method provided in an embodiment of the present application;

[0018] Figure 7 is a schematic diagram of the structure of a Bluetooth communication device provided in an embodiment of the present application;

[0019] Figure 8 This is one of the hardware structure diagrams of an electronic device provided in an embodiment of the present application;

[0020] Fig. 9 This is the second schematic diagram of the hardware structure of an electronic device provided in an embodiment of the present application. DETAILED DESCRIPTION

[0021] The following will be combined with the drawings in the embodiments of the present application to clearly describe the technical solutions in the embodiments of the present application. Obviously, the described embodiments are part of the embodiments of the present application, rather than all the embodiments. All other embodiments obtained by ordinary technicians in this field based on the embodiments in the present application belong to the scope of protection of this application.

[0022] The terms "first", "second", etc. in the specification of the present application are used to distinguish similar objects, and are not used to describe a specific order or sequence. It should be understood that the terms used in this way can be interchangeable under appropriate circumstances, so that the embodiments of the present application can be implemented in an order other than those illustrated or described here, and the objects distinguished by "first", "second", etc. are generally of one type, and the number of objects is not limited. For example, the first object can be one or more. In addition, "and / or" in the specification represents at least one of the connected objects, and the character " / " generally indicates that the objects associated with each other are in an "or" relationship.

[0023] The terms "at least one (item)", "at least one of" and the like in the specification of the present application refer to any one, any two or a combination of more than two of the objects contained therein. For example, at least one (item) of a, b, and c can be represented by: "a", "b", "c", "a and b", "a and c", "b and c" and "a, b and c", where a, b, and c can be single or multiple. Similarly, "at least two (items)" refers to two or more, and its meaning is similar to that of "at least one (item)". The logo in the present application is text, symbol, image, etc. used to indicate information, and logos or other containers can be used as carriers for displaying information, including but not limited to text logos, image logos, symbol logos, etc.

[0024] The following, in conjunction with the accompanying drawings, describes in detail the Bluetooth communication method, device, electronic device, medium and computer program product provided in the embodiments of the present application through specific embodiments and their application scenarios.

[0025] The Bluetooth communication method, apparatus, electronic device, medium and computer program product provided in the embodiments of the present application can be applicable to scenarios in which multiple Bluetooth devices are connected to communicate, especially scenarios in which after multiple Bluetooth devices establish a connection, they are in sniffing mode to sniff to maintain the connection.

[0026] When a Bluetooth device is in sniffing mode, the Bluetooth device needs to sniff to detect whether there is a data transmission request from other devices. In order to ensure the effect and stability of sniffing, the Bluetooth device usually performs multiple sniffing attempts until it succeeds.

[0027] Typically, each time a Bluetooth device makes a sniffing attempt, it may first enter the sniffing mode and perform sniffing at a specified time point; if no data transmission request from other Bluetooth devices is detected, the device will continue to wait and perform the next sniffing attempt; if a data transmission request from other Bluetooth devices is detected, the Bluetooth device will wake up and communicate at a specified time point; if the Bluetooth device successfully communicates with the other Bluetooth devices, the sniffing attempt ends; if the sniffing attempt fails, the Bluetooth device will continue to perform sniffing attempts until it succeeds.

[0028] It is understandable that in actual applications, the number and time interval of sniffing attempts can usually be set according to factors such as specific application requirements and device performance to ensure the effect and stability of sniffing.

[0029] A first Bluetooth device is connected to a second Bluetooth device, the first Bluetooth device is a master device, the second Bluetooth device is a slave device, and the number of time slots N used for data transmission between the first Bluetooth device and the second Bluetooth device is sniff attempt For example. Figure 1 Shows Nsniff attempt Schematic diagram of the sniffing timing flow when =1. Figure 1 The P in the figure represents a POLL request message sent by the first Bluetooth device, and the N represents that after receiving the POLL request message, the second Bluetooth device sends a negative acknowledgment (NACK) message to the first Bluetooth device. Figure 1 As shown, due to N sniff attempt =1, only one interaction between the first Bluetooth device and the second Bluetooth device is required between adjacent anchor points to exit the sniffing attempt event and stop sending the sniffing request message. It can be understood that the first Bluetooth device can continue to perform the next sniffing attempt at the next anchor point.

[0030] A first Bluetooth device is connected to a second Bluetooth device, and the number of time slots N used for data transmission between the first Bluetooth device and the second Bluetooth device sniff attempt For example. Figure 2 Shows N sniff attempt Schematic diagram of the sniffing timing flow when =3. Figure 2 The number of time slots between adjacent anchor points is T sniff =6, P represents the POLL request message sent by the first Bluetooth device, and N represents that after receiving the POLL request message, the second Bluetooth device sends a negative acknowledgment (NACK) message to the first Bluetooth device. Figure 2 As shown, due to N sniff attempt =3, the first Bluetooth device and the second Bluetooth device need to perform three interactions between adjacent anchor points before the sniffing attempt event can be exited. That is, the first Bluetooth device initiates the first sniffing attempt at clock value 0, and receives the NACK reception frame returned by the second Bluetooth device at clock value 1; then, the first Bluetooth device initiates the second sniffing attempt at clock value 2, and receives the NACK reception frame returned by the second Bluetooth device at clock value 3; then, the first Bluetooth device initiates the second sniffing attempt at clock value 4, and receives the NACK reception frame returned by the third Bluetooth device at clock value 5; finally, the first Bluetooth device exits the sniffing timeout counter N. sniff timeout When reached, exit the sniff attempt process.

[0031] It is understandable that an anchor point is a time slot boundary that defines the period during which a device listens to its master device for data transmission; through the anchor point, the clocks of the master device and the slave device can be aligned. And since the master device can only send data to the slave device in even time slots, the number of time slots T sniff between adjacent anchor points must be an even integer greater than zero. In addition, since the slave device will listen for the master device's transmission in the time slots used for data transmission between the first Bluetooth device and the second Bluetooth device, the number of time slots N sniff attempt used for data transmission between the first Bluetooth device and the second Bluetooth device should be the number of time slots representing that the clock value is divisible by 2, that is, its value needs to satisfy 1 ≤ N sniff attempt ≤ (T sniff / 2). Finally, after the slave device with the value of the sniff timeout counter N sniff timeout receives a data packet containing its own logical transport address LT_ADDR, the slave device continues to listen for the number of master - slave device packets in the master - slave device time slots. When a data packet is received or the exchange lasts long enough, at the next sniff anchor point, the sniff timeout counter will restart.

[0032] In Bluetooth wireless communication, Bluetooth devices need to enter the sniff mode in specific scenarios to listen for and respond to possible incoming signals. Therefore, in the sniff mode, Bluetooth devices will make a fixed number of sniff attempts according to preset rules to ensure capturing the required data packets in a complex environment. However, traditional sniffing mechanisms often mean that even if a response message (such as a NACK signal) is received in the first sniff, the Bluetooth device will still persist in performing the remaining sniff attempts, which undoubtedly increases the power consumption of the device, especially in battery - powered portable devices.

[0033] That is to say, the value N of the sniff attempt is set to satisfy 1 ≤ N ≤ (Tsniff / 2). Usually, all N attempts set must be executed. Even if the master device receives a response message from the slave device in the m - th (m < N) sniff phase, the remaining (N - m) sniffs must still be executed. Therefore, it may cause unnecessary waste of the power consumption of Bluetooth devices.

[0034] In the Bluetooth communication method provided in the embodiment of the present application, when the Bluetooth device sniffs during the sniffing cycle and receives a response message from another Bluetooth device, the Bluetooth device can determine whether the signal strength of the communication has changed significantly by the difference in signal strength between the Bluetooth device and the other Bluetooth device at different times. When the difference is small, it is considered that the signal strength of the communication has not changed much, and it is determined that the other Bluetooth device is in a connected state and the communication environment is relatively stable. Therefore, the Bluetooth device can no longer send a sniffing request message during the sniffing cycle, and the power consumption of the Bluetooth device is reduced by reducing the number of unnecessary sniffing request messages, thereby saving the resources of the Bluetooth device.

[0035] The execution subject of the Bluetooth communication method provided in the embodiment of the present application may be a Bluetooth communication device. Exemplarily, the Bluetooth communication device may be an electronic device, or a component in the electronic device, such as an integrated circuit or a chip. For example, the electronic device may include a Bluetooth device, and the Bluetooth communication method provided in the embodiment of the present application will be exemplarily described below using a Bluetooth device as an example.

[0036] The present application embodiment provides a Bluetooth communication method, Figure 3 FIG. 1 is a flowchart of a Bluetooth communication method provided by an embodiment of the present application, which can be applied to a first Bluetooth device. Figure 3 As shown, the Bluetooth communication method provided in the embodiment of the present application may include the following steps 301 to 303.

[0037] Step 301: The first Bluetooth device sends a sniffing request message to the second Bluetooth device within a first sniffing cycle.

[0038] In some embodiments of the present application, the first Bluetooth device and the second Bluetooth device may be electronic devices with Bluetooth functions.

[0039] Exemplarily, the first Bluetooth device may be a tablet with a Bluetooth function, and the second Bluetooth device may be a Bluetooth headset.

[0040] Exemplarily, the first Bluetooth device may be a mobile phone with Bluetooth function, and the second Bluetooth device may be a smart bracelet.

[0041] In some embodiments of the present application, when the Bluetooth device is in the sniffing mode, the Bluetooth device can start sniffing at a specified time point within a sniffing cycle and count the number of sniffs until the predetermined number of sniffs is reached and the sniffing is stopped.

[0042] In some embodiments of the present application, the first sniffing cycle may be any sniffing cycle of the first Bluetooth device in the sniffing mode. In other words, for each sniffing cycle, the first Bluetooth device may execute the Bluetooth communication method provided in the embodiment of the present application to reduce the power consumption of the first Bluetooth device in the sniffing mode.

[0043] In some embodiments of the present application, the first Bluetooth device may perform a fixed number of sniffing attempts in the first sniffing cycle to determine whether the second Bluetooth device is still in a connected state.

[0044] In some embodiments of the present application, when performing a sniffing attempt, the first Bluetooth device may send a sniffing request message to the second Bluetooth device to obtain a response message from the second Bluetooth device, thereby determining that the second Bluetooth device is in a connected state when receiving the response message from the second Bluetooth device.

[0045] Exemplarily, assuming that the first sniffing cycle includes 10 sniffing attempts, the first Bluetooth device may send 10 sniffing request messages to the second Bluetooth device within the first sniffing cycle to obtain a response message from the second Bluetooth device.

[0046] In some embodiments of the present application, the response message of the second Bluetooth device may be an Acknowledgment (ACK) message or a Negative Acknowledgment (NACK) message, which is not specifically limited in the embodiments of the present application.

[0047] It is understandable that when the first Bluetooth device receives the response message from the second Bluetooth device, the first Bluetooth device can confirm that the second Bluetooth device is still connected. In other words, at this time, the first Bluetooth device can confirm that the second Bluetooth device is online and can perform data transmission with the second Bluetooth device.

[0048] In some embodiments of the present application, the sniff request message may include but is not limited to: the number of time slots and time intervals transmitted between the first Bluetooth device and the second Bluetooth device, anchor points, and the number of time slots between adjacent anchor points.

[0049] It can be understood that the settings of these parameters included in the above sniff request message can be used to provide a benchmark for the communication between the second Bluetooth device and the first Bluetooth device, which can affect the subsequent communication efficiency and power consumption.

[0050] In some embodiments of the present application, the parameters included in the sniff request message may be initialized and set by the first Bluetooth device according to the required service state; may be the default of the first Bluetooth device; or may be manually set by the user. The embodiments of the present application are not specifically limited.

[0051] In some embodiments of the present application, the first Bluetooth device can start a sniffing process at a specified time point in the sniffing mode and send a sniffing request message to the second Bluetooth device.

[0052] Step 302: When the first Bluetooth device receives a sniff response message from the second Bluetooth device, the first Bluetooth device obtains a first difference based on the first signal strength and the second signal strength.

[0053] The first signal strength and the second signal strength are signal strengths between the first Bluetooth device and the second Bluetooth device at different times.

[0054] In some embodiments of the present application, after receiving the sniff request message from the first Bluetooth device, the second Bluetooth device may perform an operation corresponding to the sniff request message and return a response message to the first Bluetooth device.

[0055] Exemplarily, after receiving the sniff request message from the first Bluetooth device, the second Bluetooth device can set the communication parameters in the second Bluetooth device according to the parameters contained in the sniff request message, and return a response message to the first Bluetooth device to prepare for the communication between the first Bluetooth device and the second Bluetooth device.

[0056] It is understandable that the above response message can be a confirmation of the sniff request message of the first Bluetooth device by the second Bluetooth device, so as to inform the first Bluetooth device that the second Bluetooth device has received the sniff request message and is ready to communicate. In other words, the response message can indicate that the second Bluetooth device has successfully received the sniff request message and understood the instruction of the first Bluetooth device.

[0057] Thus, when the Bluetooth device is in the sniffing mode, the communication connection can be maintained by the interaction of the sniffing request message and the response message. Thus, the Bluetooth device can stop sending the sniffing request message in time to save the power consumption of the Bluetooth device.

[0058] In some embodiments of the present application, the above signal strength can be used to indicate the quality of the communication environment between the first Bluetooth device and the second Bluetooth device. It can be understood that the stronger the signal strength, the better the communication environment, and the more accurate and clear the received signal; conversely, the weaker the signal strength, the worse the communication environment, and the easier it is for the received signal to be lost and other abnormal situations.

[0059] In some embodiments of the present application, the first difference may be used to indicate the degree of difference between signal strengths at different times.

[0060] In some embodiments of the present application, the first difference may be a difference obtained by subtracting the second signal strength from the first signal strength, or a difference obtained by subtracting the first signal strength from the second signal strength, or an absolute difference between the first signal strength and the second signal strength. This embodiment of the present application is not specifically limited.

[0061] In some embodiments of the present application, the first Bluetooth device may obtain signal strengths at two different times, and determine the degree of change in the communication environment through the difference between the signal strengths at the two different times.

[0062] It is understandable that, in different communication environments, the signal strength of the data transmission between the first Bluetooth device and the second Bluetooth device will also be different. Therefore, the smaller the difference between the signal strengths at the two different moments, the more similar the communication environments at the two different moments are, the smaller the degree of change of the communication environments at the two different moments is, the more stable the communication environment is, and the more suitable it is for data transmission; the larger the difference between the signal strengths at the two different moments, the more different the communication environments at the two different moments are, the greater the degree of change of the communication environments at the two different moments is, the more unstable the communication environment is, and the less suitable it is for data transmission.

[0063] It should be noted that, for other descriptions of the first signal strength and the second signal strength, reference may be made to the detailed descriptions in the following steps 304 to 307. To avoid repetition, they will not be described again here.

[0064] In this way, the first Bluetooth device can obtain the first difference value through the two signal strengths between the first Bluetooth device and the second Bluetooth device at different times, so that the first Bluetooth device can judge the stability of the communication environment more accurately.

[0065] In some embodiments of the present application, Figure 3 ,like Figure 4 As shown, the above step 302 may also include the following step 302a.

[0066] Step 302a: When the first Bluetooth device receives the sniff response message from the second Bluetooth device and the number of first time slots is greater than or equal to 2, the first Bluetooth device obtains a first difference based on the first signal strength and the second signal strength.

[0067] The first time slot may be a time slot used for data transmission between the first Bluetooth device and the second Bluetooth device.

[0068] In some embodiments of the present application, since the first Bluetooth device usually sends data to the second Bluetooth device in an even time slot, the first Bluetooth device can perform more than one sniffing attempt when the number of time slots used for data transmission between the first Bluetooth device and the second Bluetooth device is greater than or equal to 2. Therefore, in this case, the first Bluetooth device may perform redundant sniffing attempts, resulting in both the first Bluetooth device and the second Bluetooth device performing sending and receiving actions, resulting in a waste of power consumption of the first Bluetooth device and the second Bluetooth device. In this way, the first Bluetooth device can obtain the first signal strength and the second signal strength at different times respectively when the number of the first time slots is greater than or equal to 2 to determine the stability of the communication environment.

[0069] In some embodiments of the present application, when the number of time slots used for data transmission between the first Bluetooth device and the second Bluetooth device is equal to 1, it can be understood that the first Bluetooth device can set a sniffing attempt at this time. Therefore, the first Bluetooth device can directly perform the sniffing attempt according to the rules in the original sniffing mode to ensure that the signal of the response message is captured in a single sniffing attempt.

[0070] In this way, since the first Bluetooth device can obtain the first difference only when it is determined that more than one sniffing attempt can be made when the number of time slots used for data transmission between the first Bluetooth device and the second Bluetooth device is greater than or equal to 2, it can avoid the first Bluetooth device obtaining the first difference unnecessarily, thereby wasting power consumption of the first Bluetooth device.

[0071] Step 303: When the first difference is less than or equal to a predetermined threshold, the first Bluetooth device stops sending a sniffing request message to the second Bluetooth device within the first sniffing cycle.

[0072] In some embodiments of the present application, the above-mentioned first difference being less than or equal to the predetermined threshold value can be understood as: the difference between the first signal strength and the second signal strength is small, and the first Bluetooth device can determine that the communication environment at different times is relatively similar, that is, the degree of change in the communication environment is small, and the stability of the communication environment is high, and the communication environment at this time is suitable for data transmission. In this way, the first Bluetooth device can determine that the first Bluetooth device and the second Bluetooth device are still connected and the communication environment is good after receiving the response message of the second Bluetooth device and determining that the current communication environment is relatively stable. Therefore, the first Bluetooth device can no longer perform the remaining sniffing attempts, and the second Bluetooth device does not need to respond again after receiving the sniffing request message of the first Bluetooth device again. Thereby saving the power consumption of the first Bluetooth device and the second Bluetooth device, and extending the battery life of the first Bluetooth device and the second Bluetooth device.

[0073] Exemplarily, take the case where the first sniffing cycle includes 10 sniffing attempts, the first signal strength is 90dB, the second signal strength is 80dB, the predetermined threshold is 20dB, and the first difference is the absolute difference between the first signal strength and the second signal strength. Assume that the first Bluetooth device receives a response message from the second Bluetooth device during the second sniffing attempt. At this time, the first Bluetooth device can determine, based on the first signal strength and the second signal strength, that the absolute difference between the first signal strength and the second signal strength is 10dB, which is less than the predetermined threshold of 20dB. In this way, the first Bluetooth device can confirm that the second Bluetooth device is in a connected state and the communication environment is relatively stable, and the first Bluetooth device can stop sending the remaining 8 sniffing request messages within the first sniffing cycle.

[0074] It should be noted that when the first Bluetooth device stops sending the sniff request message, the second Bluetooth device may also stop replying the response message and enter a sleep state to extend the battery life.

[0075] It is understandable that, since the first Bluetooth device determines that the current communication environment is sufficiently stable, after the first Bluetooth device stops sending the sniffing request message, the first Bluetooth device will no longer send messages to the second Bluetooth device. At this time, both the first Bluetooth device and the second Bluetooth device can enter a low power consumption state to save power consumption.

[0076] In some embodiments of the present application, the above-mentioned predetermined threshold may be a default threshold of the first Bluetooth device, or may be determined by the first Bluetooth device according to the service between the first Bluetooth device and the second Bluetooth device, or may be manually set by the user of the first Bluetooth device. This embodiment of the present application does not specifically limit this.

[0077] In the Bluetooth communication method provided by the embodiment of the present application, when the Bluetooth device sniffs during the sniffing cycle and receives a response message from another Bluetooth device, the Bluetooth device can judge whether the signal strength of the communication has changed significantly by the difference in signal strength between the Bluetooth device and the other Bluetooth device at different times. When the difference is small, it is considered that the signal strength of the communication has not changed much, and it is determined that the other Bluetooth device is in a connected state and the communication environment is relatively stable. Therefore, the Bluetooth device can no longer send a sniffing request message during the sniffing cycle, and the power consumption of the Bluetooth device is reduced by reducing the number of unnecessary sniffing request messages, thereby saving the resources of the Bluetooth device.

[0078] In some embodiments of the present application, the first signal strength and the second signal strength may be average signal strengths between the first Bluetooth device and the second Bluetooth device in different time periods.

[0079] In some embodiments of the present application, before the above step 302, the Bluetooth communication method provided by the embodiment of the present application may also include the following steps 304 and 305.

[0080] Step 304: When the first Bluetooth device receives the sniff response message from the second Bluetooth device, the first Bluetooth device obtains the first signal strength within the first time period.

[0081] The first time period may be any time period before the last sniff response message from the second Bluetooth device is received.

[0082] In some embodiments of the present application, the first Bluetooth device may obtain an average signal strength in a first time period as the first signal strength.

[0083] Exemplarily, the first Bluetooth device may obtain the signal strength per second in the first time period, and then average the signal strength per second in the first time period to obtain the first signal strength.

[0084] It is understandable that in order to more accurately judge the communication environment during the sniffing attempt, the first Bluetooth device can obtain the first signal strength before sending the sniffing request message, and obtain the second signal strength after receiving the response message sent by the second Bluetooth device, and judge the stability of the communication environment by the difference between the first signal strength and the second signal strength. In other words, the first Bluetooth device can obtain the signal strength before and after a sniffing attempt to judge the stability of the communication environment.

[0085] Step 305: The first Bluetooth device obtains a second signal strength within a second time period.

[0086] The second time period may be any time period after the sniff response message of the second Bluetooth device is received last time.

[0087] In some embodiments of the present application, the first Bluetooth device may obtain an average signal strength in the second time period as the second signal strength.

[0088] Exemplarily, the first Bluetooth device may obtain the signal strength per second in the second time period, and then average the signal strength per second in the second time period to obtain the second signal strength.

[0089] It should be noted that the above steps 304 and 305 may be performed before step 301 , may be performed after step 301 , or may be performed simultaneously with step 301 .

[0090] In this way, the first Bluetooth device can accurately judge the stability of the current communication environment by obtaining the difference in average signal strength between the first Bluetooth device and the second Bluetooth device in different time periods, thereby improving the accuracy of obtaining signal strength.

[0091] In some embodiments of the present application, the first signal strength and the second signal strength may be signal strengths between the first Bluetooth device and the second Bluetooth device at different times.

[0092] In some embodiments of the present application, before the above step 302, the Bluetooth communication method provided by the embodiment of the present application may also include the following steps 306 and 307.

[0093] Step 306: The first Bluetooth device obtains a first signal strength at a first moment.

[0094] The first time may be any time before the last sniff request message is sent to the second Bluetooth device.

[0095] Exemplarily, the first moment may be one second before the first Bluetooth device sends the sniff request message. That is, the first Bluetooth device may first obtain the first signal strength and then send the sniff request message.

[0096] Exemplarily, the first time may be 10 seconds before the first Bluetooth device sends the sniff request message, that is, the first Bluetooth device may send the sniff request message 10 seconds after acquiring the first signal strength.

[0097] Step 307: The first Bluetooth device obtains a second signal strength at a second time, where the second time is any time after the first Bluetooth device receives a sniff response message from the second Bluetooth device.

[0098] Exemplarily, the second time may be 1 second after the first Bluetooth device receives the sniff response message from the second Bluetooth device. That is, the first Bluetooth device may obtain the second signal strength immediately after receiving the sniff response message from the second Bluetooth device.

[0099] Exemplarily, the second time may be 10 seconds after the first Bluetooth device receives the sniff response message from the second Bluetooth device. That is, the first Bluetooth device may obtain the second signal strength 10 seconds after receiving the sniff response message from the second Bluetooth device.

[0100] It should be noted that the above steps 306 and 307 may be performed before step 301 , after step 301 , or simultaneously with step 301 .

[0101] In this way, the first Bluetooth device can accurately judge the stability of the current communication environment by obtaining the difference in average signal strength between the first Bluetooth device and the second Bluetooth device at different times, thereby improving the accuracy of obtaining signal strength.

[0102] In some embodiments of the present application, Figure 3 ,like Figure 5 As shown, before the above step 301, the Bluetooth communication method provided in the embodiment of the present application may further include the following steps 308 and 309.

[0103] Step 308: The first Bluetooth device obtains communication environment parameters at the target time.

[0104] The first communication environment parameter may include at least one of the following: a signal quality parameter between the first Bluetooth device and the second Bluetooth device, a position relationship parameter between the first Bluetooth device and the second Bluetooth device, and a Bluetooth transmission power of the first Bluetooth device.

[0105] In some embodiments of the present application, the target time may be a target period or a target moment, which is not specifically limited in the embodiments of the present application.

[0106] In some embodiments of the present application, the signal quality parameter between the first Bluetooth device and the second Bluetooth device may indicate the clarity and stability of the signal received by the first Bluetooth device from the second Bluetooth device, which may reflect the degree of noise, interference and distortion in signal transmission. It is understood that a higher signal quality indicates that the received signal is clearer and more stable, with less interference and distortion; conversely, a lower signal quality indicates that the received signal is more blurred and unstable, with more interference and distortion.

[0107] In some embodiments of the present application, the signal quality parameter between the first Bluetooth device and the second Bluetooth device may be a signal quality parameter of a most recently received signal stored in the first Bluetooth device.

[0108] In some embodiments of the present application, when a first Bluetooth device and a second Bluetooth device establish a connection for the first time and do not start communication, the first Bluetooth device may use a default signal quality parameter as a signal quality parameter between the first Bluetooth device and the second Bluetooth device.

[0109] In some embodiments of the present application, the position relationship parameter between the first Bluetooth device and the second Bluetooth device may indicate a relative position relationship between the first Bluetooth device and the second Bluetooth device.

[0110] Exemplarily, the position relationship parameter between the first Bluetooth device and the second Bluetooth device may indicate the distance between the first Bluetooth device and the second Bluetooth device.

[0111] In some embodiments of the present application, the relative position relationship between the first Bluetooth device and the second Bluetooth device can be measured by the first Bluetooth device, or can be obtained by the first Bluetooth device and the second Bluetooth device through the interaction of position information. This embodiment of the present application is not specifically limited.

[0112] Step 309: The first Bluetooth device calculates the target signal strength based on the communication environment parameters at the target time.

[0113] In some embodiments of the present application, when the target time is the first time, the target signal strength may be the first signal strength.

[0114] In some embodiments of the present application, when the target time is the second time, the target signal strength may be the second signal strength.

[0115] In some embodiments of the present application, the first Bluetooth device may calculate the target signal strength based on the communication environment parameters at the target time by the following formula (1):

[0116]

[0117] Among them, U can represent the target signal strength; R can represent the signal quality between the first Bluetooth device and the second Bluetooth device; P can represent the distance between the first Bluetooth device and the second Bluetooth device; W can represent the Bluetooth power of the first Bluetooth device; a, b, c, and d are constant coefficients, which can be determined according to the hardware conditions of the first Bluetooth device and the second Bluetooth device.

[0118] It should be noted that the first Bluetooth device can select one or more of the communication environment parameters for calculation according to the actual parameter acquisition situation; the communication environment parameters that are not acquired can be set to zero and substituted into formula (1) for calculation to obtain the corresponding signal strength.

[0119] It should be noted that in actual implementation, the constant coefficients a, b, c, and d in formula (1) may be assigned corresponding physical units, so that the unit of the signal strength finally calculated may be dB.

[0120] In some embodiments of the present application, after obtaining the first signal strength, the first Bluetooth device may store the first signal strength first, and after obtaining the second signal strength, the first Bluetooth device may compare the two to obtain a first difference.

[0121] In some embodiments of the present application, the first Bluetooth device may establish a mapping relationship between signal strength and communication environment parameters, and store the obtained signal strength by storing the mapping relationship.

[0122] In some embodiments of the present application, the first Bluetooth device may store the target signal strength locally, upload it to the cloud for storage, or store it in any other possible manner. The embodiments of the present application are not specifically limited.

[0123] In this way, since the first Bluetooth device can accurately obtain the corresponding signal strength through at least one of the signal quality parameters between the first Bluetooth device and the second Bluetooth device, the position relationship parameters between the first Bluetooth device and the second Bluetooth device, and the Bluetooth power parameter of the first Bluetooth device, the first Bluetooth device can judge the stability of the current communication environment in real time, thereby improving the accuracy of obtaining the signal strength.

[0124] In some embodiments of the present application, after the above step 302, the Bluetooth communication method provided by the embodiment of the present application may further include the following step 310.

[0125] Step 310: When the first difference is greater than a predetermined threshold, the first Bluetooth device continues to send a sniffing request message to the second Bluetooth device within the first sniffing cycle.

[0126] In some embodiments of the present application, when the first difference is greater than a predetermined threshold, the first Bluetooth device can determine that the communication environment at different times is different, that is, the current communication environment has changed. Therefore, in order to cope with such a change, the first device can continue to sniff in the sniffing mode until the first difference is less than or equal to the predetermined threshold, so that the first Bluetooth device and the second Bluetooth device can adjust in time during the change of the communication environment to maintain the stability and reliability of communication.

[0127] Exemplarily, take the case where the first sniffing cycle includes 10 sniffing attempts, the first signal strength is 50dB, the second signal strength is 80dB, the predetermined threshold is 20dB, and the first difference is the absolute difference between the first signal strength and the second signal strength. Assume that the first Bluetooth device receives a response message from the second Bluetooth device during the fifth sniffing attempt. At this time, the first Bluetooth device can determine that the absolute difference between the first signal strength and the second signal strength is 30dB, which is greater than the predetermined threshold of 20dB, based on the first signal strength and the second signal strength. In this way, the first Bluetooth device can confirm that although the second Bluetooth device is in a connected state, the communication environment is relatively unstable, and the connection between the first Bluetooth device and the second Bluetooth device may be disconnected at any time. Therefore, the first Bluetooth device can continue to send the remaining 5 sniffing request messages to the second Bluetooth device within the first sniffing cycle.

[0128] In some embodiments of the present application, the above-mentioned continuing to send the sniffing request message to the second Bluetooth device may refer to the first Bluetooth device continuing to send a message to the second Bluetooth device to notify the second Bluetooth device that the current communication environment has changed. Thus, the first Bluetooth device and the second Bluetooth device can perform a new round of sniffing attempts to re-evaluate the communication environment and adjust the communication strategy.

[0129] In some embodiments of the present application, while the first Bluetooth device continues to send a sniff request message to the second Bluetooth device, the first Bluetooth device can again obtain the signal strength at different times, so that when the difference in signal strength at different times is less than or equal to a predetermined threshold, the first Bluetooth device can promptly stop sending the sniff request message to the second Bluetooth device to reduce the power consumption of the Bluetooth device.

[0130] In this way, when the communication environment is unstable, the first Bluetooth device can continue to send a sniff request message to the second Bluetooth device within the first sniffing cycle, so that the first Bluetooth device and the second Bluetooth device can still maintain connection performance when the communication environment is unstable.

[0131] Each of the above-mentioned method embodiments, or various possible implementation methods in each method embodiment can be executed separately, or any two or more of them can be executed in combination with each other. The specific implementation method can be determined according to actual usage requirements, and the embodiments of the present application do not limit this.

[0132] The following is a specific example to illustrate the Bluetooth communication method provided in the embodiment of the present application.

[0133] like Figure 6 As shown, taking the first signal strength as RR1, the second signal strength as RR2, the first Bluetooth device as the master device (Master), the second Bluetooth device as the slave device (Slave), and the response message including a NACK packet as an example, the Bluetooth communication method may include the following steps 401 to 407.

[0134] Step 401: The master device starts the sniffing process.

[0135] The master device can set initialization parameters according to the service status, such as the number of slots and time intervals, anchor points, and the number of time slots between adjacent anchor points. sniff And other parameters.

[0136] Step 402: The master device obtains RR1.

[0137] The master device can obtain the current signal quality r1, the position relationship Pb1 between the slave device and the Bluetooth power parameter w1, and calculate RR1 using the above formula (1). The function U(r1, Pb1, w1) is used to establish the signal strength mapping RR1, and then the RR1 is stored locally.

[0138] Step 403: The master device sends a sniff request message to the slave device.

[0139] The sniff request message may include the initialization parameters set in the above step 401 to provide a communication benchmark for the slave device and a basis for subsequent communication environment stability evaluation.

[0140] Step 404: The slave device replies a NACK packet to the master device.

[0141] Step 405: The master device obtains RR2.

[0142] The master device can obtain the signal quality r2, position relationship Pb2, and power parameter w2 between the master device and the slave device again. It can be understood that these new parameters reflect the real-time status of the current communication environment. The master device can use the same function U(r2, Pb2, w2) to establish a new signal strength map RR2.

[0143] It can be understood that by continuously updating the signal strength, the master device can evaluate changes in the communication environment in real time, providing a basis for subsequent communication strategy adjustments.

[0144] Step 406: The master device obtains a first difference based on RR1 and RR2.

[0145] The master device may obtain the first difference by comparing changes in signal strength.

[0146] If the first difference is less than or equal to the predetermined threshold, it may indicate that the signal strength change is within an acceptable range and the communication environment is relatively stable; if the first difference is greater than the predetermined threshold, it may indicate that the signal strength has changed significantly, which may mean that the communication environment has changed.

[0147] Step 407: When the first difference is less than or equal to a predetermined threshold, the master device stops sending the sniff request message to the slave device; when the first difference is greater than the predetermined threshold, the master device continues to send the sniff request message to the slave device within the first sniff cycle.

[0148] In this way, when a Bluetooth device sniffs and receives a response message from another Bluetooth device during a sniffing cycle, the Bluetooth device can determine whether the signal strength of the communication has changed significantly by comparing the difference in signal strength between the Bluetooth device and the other Bluetooth device at different times. If the difference is small, it is considered that the signal strength of the communication has not changed much, and the other Bluetooth device is determined to be in a connected state and the communication environment is relatively stable. Thus, the Bluetooth device can stop sending sniffing request messages during the sniffing cycle, and the power consumption of the Bluetooth device is reduced by reducing the number of unnecessary sniffing request messages, thereby saving resources of the Bluetooth device.

[0149] The Bluetooth communication method provided in the embodiment of the present application can be executed by a Bluetooth communication device. In the embodiment of the present application, a Bluetooth communication device executing the Bluetooth communication method is taken as an example to illustrate the Bluetooth communication device provided in the embodiment of the present application.

[0150] Figure 7 FIG. 1 shows a possible structural diagram of a Bluetooth communication device involved in an embodiment of the present application. Figure 7 As shown, the Bluetooth communication device 70 may include: a sending module 71 , a processing module 72 and a receiving module 73 .

[0151] Among them, the sending module 71 is used to send a sniff request message to the second Bluetooth device within the first sniffing cycle; the processing module 72 is used to obtain a first difference based on the first signal strength and the second signal strength when the receiving module 73 receives a sniff response message from the second Bluetooth device, the first signal strength and the second signal strength being the signal strengths between the first Bluetooth device and the second Bluetooth device at different times; and, when the first difference is less than or equal to a predetermined threshold, stop sending the sniff request message to the second Bluetooth device within the first sniffing cycle.

[0152] In a possible implementation, the first signal strength and the second signal strength are average signal strengths between the first Bluetooth device and the second Bluetooth device in different time periods;

[0153] The above-mentioned processing module 72 is also used to obtain the first signal strength within a first time period before obtaining the first difference based on the first signal strength and the second signal strength, and the first time period is any time period before the last sniffing response message of the second Bluetooth device is received; and it is also used to obtain the second signal strength within a second time period, and the second time period is any time period after the last sniffing response message of the second Bluetooth device is received.

[0154] In a possible implementation, the first signal strength and the second signal strength are signal strengths between the first Bluetooth device and the second Bluetooth device at different times;

[0155] The above-mentioned processing module 72 is also used to obtain the first signal strength at a first moment before obtaining the first difference based on the first signal strength and the second signal strength, the first moment being any moment before the last sniffing request message is sent to the second Bluetooth device; and is also used to obtain the second signal strength at a second moment, the second moment being any moment after the last sniffing response message is received from the second Bluetooth device.

[0156] In a possible implementation, the processing module 72 is further configured to obtain a communication environment parameter at a target time before obtaining the first difference based on the first signal strength and the second signal strength;

[0157] and, further used to calculate the target signal strength based on the communication environment parameters at the target time;

[0158] The communication environment parameter includes at least one of the following: a signal quality parameter between the first Bluetooth device and the second Bluetooth device, a position relationship parameter between the first Bluetooth device and the second Bluetooth device, and a Bluetooth transmission power of the first Bluetooth device;

[0159] The target time is the first time, and the target signal strength is the first signal strength; or, the target time is the second time, and the target signal strength is the second signal strength.

[0160] In a possible implementation, the processing module 72 is specifically configured to obtain a first difference based on the first signal strength and the second signal strength when the number of the first time slots is greater than or equal to 2;

[0161] The first time slot is a time slot used for data transmission between the first Bluetooth device and the second Bluetooth device.

[0162] In a possible implementation, the sending module 71 is further configured to continue sending the sniffing request message to the second Bluetooth device within the first sniffing cycle when the first difference is greater than a predetermined threshold.

[0163] The embodiment of the present application provides a Bluetooth communication device. When the Bluetooth communication device sniffs during a sniffing cycle and receives a response message from another Bluetooth device, the Bluetooth communication device can determine whether the signal strength of the communication has changed significantly by comparing the difference in signal strength between the other Bluetooth devices at different times. When the difference is small, it is considered that the signal strength of the communication has not changed much, and it is determined that the other Bluetooth device is in a connected state and the communication environment is relatively stable. Therefore, the Bluetooth communication device can no longer send a sniffing request message during the sniffing cycle, and the power consumption of the Bluetooth device is reduced by reducing the number of unnecessary sniffing request messages, thereby saving resources of the Bluetooth device.

[0164] The Bluetooth communication device in the embodiment of the present application can be an electronic device, or a component in an electronic device, such as an integrated circuit or a chip. The electronic device can be a terminal, or other devices other than a terminal. Exemplarily, the electronic device can be a mobile phone, a tablet computer, a laptop computer, a PDA, a vehicle-mounted electronic device, a mobile Internet device (Mobile Internet Device, MID), an augmented reality (augmented reality, AR) / virtual reality (virtual reality, VR) device, a robot, a wearable device, an ultra-mobile personal computer (ultra-mobile personal computer, UMPC), a netbook or a personal digital assistant (personal digital assistant, PDA), etc., and can also be a server, a network attached storage (Network Attached Storage, NAS), a personal computer (personal computer, PC), a television (television, TV), a teller machine or a self-service machine, etc., which is not specifically limited in the embodiment of the present application.

[0165] The Bluetooth communication device in the embodiment of the present application may be a device having an operating system. The operating system may be an Android operating system, an iOS operating system, or other possible operating systems, which are not specifically limited in the embodiment of the present application.

[0166] The Bluetooth communication device provided in the embodiment of the present application can implement various processes implemented in the above-mentioned Bluetooth communication method embodiment and achieve the same technical effect. To avoid repetition, it will not be repeated here.

[0167] Alternatively, if Figure 8 As shown, an embodiment of the present application also provides an electronic device 800, including a processor 801 and a memory 802, wherein the memory 802 stores programs or instructions that can be executed on the processor 801, and when the program or instructions are executed by the processor 801, the various steps of the above-mentioned Bluetooth communication method embodiment are implemented, and the same technical effect can be achieved. To avoid repetition, they are not described here.

[0168] It should be noted that the electronic devices in the embodiments of the present application include the mobile electronic devices and non-mobile electronic devices mentioned above.

[0169] Fig. 9 A schematic diagram of the hardware structure of an electronic device to implement an embodiment of the present application.

[0170] The electronic device 1000 includes but is not limited to: a radio frequency unit 1001, a network module 1002, an audio output unit 1003, an input unit 1004, a sensor 1005, a display unit 1006, a user input unit 1007, an interface unit 1008, a memory 1009, and a processor 1010 and other components.

[0171] Those skilled in the art will appreciate that the electronic device 1000 may also include a power source (such as a battery) for supplying power to each component, and the power source may be logically connected to the processor 1010 through a power management system, thereby implementing functions such as managing charging, discharging, and power consumption management through the power management system. Fig. 9 The electronic device structure shown in the figure does not constitute a limitation on the electronic device. The electronic device may include more or fewer components than shown in the figure, or combine certain components, or arrange the components differently, which will not be described in detail here.

[0172] Among them, the radio frequency unit 1001 is used to send a sniff request message to the second Bluetooth device within the first sniffing cycle; the processor 1010 is used to obtain a first difference based on the first signal strength and the second signal strength when the radio frequency unit 1001 receives a sniff response message from the second Bluetooth device, the first signal strength and the second signal strength being the signal strengths between the first Bluetooth device and the second Bluetooth device at different times; and, when the first difference is less than or equal to a predetermined threshold, stop sending the sniff request message to the second Bluetooth device within the first sniffing cycle.

[0173] In a possible implementation, the first signal strength and the second signal strength are average signal strengths between the first Bluetooth device and the second Bluetooth device in different time periods;

[0174] The above-mentioned processor 1010 is also used to obtain the first signal strength within a first time period before obtaining the first difference based on the first signal strength and the second signal strength, and the first time period is any time period before the last sniffing response message of the second Bluetooth device is received; and it is also used to obtain the second signal strength within a second time period, and the second time period is any time period after the last sniffing response message of the second Bluetooth device is received.

[0175] In a possible implementation, the first signal strength and the second signal strength are signal strengths between the first Bluetooth device and the second Bluetooth device at different times;

[0176] The above-mentioned processor 1010 is also used to obtain the first signal strength at a first moment before obtaining the first difference based on the first signal strength and the second signal strength, the first moment being any moment before the last sniffing request message is sent to the second Bluetooth device; and, also used to obtain the second signal strength at a second moment, the second moment being any moment after the last sniffing response message is received from the second Bluetooth device.

[0177] In a possible implementation, the processor 1010 is further configured to obtain a communication environment parameter at a target time before obtaining the first difference based on the first signal strength and the second signal strength;

[0178] and, further used to calculate the target signal strength based on the communication environment parameters at the target time;

[0179] The communication environment parameter includes at least one of the following: a signal quality parameter between the first Bluetooth device and the second Bluetooth device, a position relationship parameter between the first Bluetooth device and the second Bluetooth device, and a Bluetooth transmission power of the first Bluetooth device;

[0180] The target time is the first time, and the target signal strength is the first signal strength; or, the target time is the second time, and the target signal strength is the second signal strength.

[0181] In a possible implementation, the processor 1010 is specifically configured to obtain a first difference based on the first signal strength and the second signal strength when the number of the first time slots is greater than or equal to 2;

[0182] The first time slot is a time slot used for data transmission between the first Bluetooth device and the second Bluetooth device.

[0183] In a possible implementation, the radio frequency unit 1001 is further configured to continue sending a sniff request message to the second Bluetooth device within the first sniffing cycle when the first difference is greater than a predetermined threshold.

[0184] The embodiment of the present application provides an electronic device. When the electronic device sniffs during a sniffing cycle and receives a response message from another Bluetooth device, the electronic device can determine whether the signal strength of the communication has changed by the difference in signal strength between the other Bluetooth devices at different times. When the difference is small, it is considered that the signal strength of the communication has not changed much, and it is determined that the other Bluetooth device is in a connected state and the communication environment is relatively stable. Therefore, the electronic device can no longer send a sniffing request message during the sniffing cycle, and the power consumption of the Bluetooth device is reduced by reducing the number of unnecessary sniffing request messages, thereby saving the resources of the Bluetooth device.

[0185] It should be understood that in the embodiment of the present application, the input unit 1004 may include a graphics processor (Graphics Processing Unit, GPU) 10041 and a microphone 10042, and the graphics processor 10041 processes the image data of the static picture or video obtained by the image capture device (such as a camera) in the video capture mode or the image capture mode. The display unit 1006 may include a display panel 10061, and the display panel 10061 may be configured in the form of a liquid crystal display, an organic light emitting diode, etc. The user input unit 1007 includes a touch panel 10071 and at least one of other input devices 10072. The touch panel 10071 is also called a touch screen. The touch panel 10071 may include two parts: a touch detection device and a touch controller. Other input devices 10072 may include, but are not limited to, a physical keyboard, function keys (such as volume control keys, switch keys, etc.), a trackball, a mouse, and a joystick, which will not be repeated here.

[0186] The memory 1009 can be used to store software programs and various data. The memory 1009 may mainly include a first storage area for storing programs or instructions and a second storage area for storing data, wherein the first storage area may store an operating system, an application program or instructions required for at least one function (such as a sound playback function, an image playback function, etc.), etc. In addition, the memory 1009 may include a volatile memory or a non-volatile memory, or the memory 1009 may include both volatile and non-volatile memories. Among them, the non-volatile memory may be a read-only memory (ROM), a programmable read-only memory (PROM), an erasable programmable read-only memory (EPROM), an electrically erasable programmable read-only memory (EEPROM), or a flash memory. The volatile memory may be a random access memory (RAM), a static random access memory (SRAM), a dynamic random access memory (DRAM), a synchronous dynamic random access memory (SDRAM), a double data rate synchronous dynamic random access memory (DDRSDRAM), an enhanced synchronous dynamic random access memory (ESDRAM), a synchronous link dynamic random access memory (SLDRAM) and a direct memory bus random access memory (DRRAM). The memory 1009 in the embodiment of the present application includes but is not limited to these and any other suitable types of memory.

[0187] The processor 1010 may include one or more processing units; optionally, the processor 1010 integrates an application processor and a modem processor, wherein the application processor mainly processes operations related to an operating system, a user interface, and application programs, and the modem processor mainly processes wireless communication signals, such as a baseband processor. It is understandable that the modem processor may not be integrated into the processor 1010.

[0188] An embodiment of the present application also provides a readable storage medium, on which a program or instruction is stored. When the program or instruction is executed by a processor, the various processes of the above-mentioned Bluetooth communication method embodiment are implemented and the same technical effect can be achieved. To avoid repetition, it will not be repeated here.

[0189] The processor is the processor in the electronic device described in the above embodiment. The readable storage medium includes a computer readable storage medium, such as a computer read-only memory ROM, a random access memory RAM, a magnetic disk or an optical disk.

[0190] An embodiment of the present application further provides a chip, which includes a processor and a communication interface, wherein the communication interface is coupled to the processor, and the processor is used to run programs or instructions to implement the various processes of the above-mentioned Bluetooth communication method embodiment, and can achieve the same technical effect. To avoid repetition, it will not be repeated here.

[0191] It should be understood that the chip mentioned in the embodiments of the present application can also be called a system-level chip, a system chip, a chip system or a system-on-chip chip, etc.

[0192] An embodiment of the present application provides a computer program product, which is stored in a storage medium. The program product is executed by at least one processor to implement the various processes of the above-mentioned Bluetooth communication method embodiment and can achieve the same technical effect. To avoid repetition, it will not be repeated here.

[0193] It should be noted that, in this article, the terms "comprise", "include" or any other variant thereof are intended to cover non-exclusive inclusion, so that the process, method, article or device including a series of elements includes not only those elements, but also includes other elements not explicitly listed, or also includes elements inherent to such process, method, article or device. In the absence of further restrictions, the elements defined by the sentence "comprise one..." do not exclude the presence of other identical elements in the process, method, article or device including the element. In addition, it should be pointed out that the scope of the methods and devices in the embodiments of the present application is not limited to performing functions in the order shown or discussed, and may also include performing functions in a substantially simultaneous manner or in reverse order according to the functions involved, for example, the described method may be performed in an order different from that described, and various steps may also be added, omitted, or combined. In addition, the features described with reference to certain examples may be combined in other examples.

[0194] Through the description of the above implementation methods, those skilled in the art can clearly understand that the above-mentioned embodiment methods can be implemented by means of software plus a necessary general hardware platform, and of course by hardware, but in many cases the former is a better implementation method. Based on such an understanding, the technical solution of the present application, or the part that contributes to the prior art, can be embodied in the form of a computer software product, which is stored in a storage medium (such as ROM / RAM, a disk, or an optical disk), and includes a number of instructions for a terminal (which can be a mobile phone, a computer, a server, or a network device, etc.) to execute the methods described in each embodiment of the present application.

[0195] The embodiments of the present application are described above in conjunction with the accompanying drawings, but the present application is not limited to the above-mentioned specific implementation methods. The above-mentioned specific implementation methods are merely illustrative and not restrictive. Under the guidance of the present application, ordinary technicians in this field can also make many forms without departing from the purpose of the present application and the scope of protection of the claims, all of which are within the protection of the present application.

Claims

1. A Bluetooth communication method, characterized in that: Applied to a first Bluetooth device, the method includes: In the first sniffing cycle, sending a sniffing request message to the second Bluetooth device; When receiving the sniff response message of the second Bluetooth device, obtaining a first difference based on the first signal strength and the second signal strength, where the first signal strength and the second signal strength are signal strengths between the first Bluetooth device and the second Bluetooth device at different times; When the first difference is less than or equal to a predetermined threshold, stopping sending the sniffing request message to the second Bluetooth device within the first sniffing cycle.

2. The method according to claim 1, characterized in that The first signal strength and the second signal strength are average signal strengths between the first Bluetooth device and the second Bluetooth device in different time periods; Before obtaining the first difference based on the first signal strength and the second signal strength, the method further includes: Acquire the first signal strength within a first time period, where the first time period is any time period before the sniffing response message of the second Bluetooth device is last received; The second signal strength within a second time period is obtained, where the second time period is any time period after the sniff response message from the second Bluetooth device is last received.

3. The method according to claim 1, characterized in that The first signal strength and the second signal strength are signal strengths between the first Bluetooth device and the second Bluetooth device at different times; Before obtaining the first difference based on the first signal strength and the second signal strength, the method further includes: Acquire the first signal strength at a first moment, where the first moment is any moment before the last sniffing request message is sent to the second Bluetooth device; The second signal strength at a second time is obtained, where the second time is any time after the sniff response message of the second Bluetooth device is last received.

4. The method according to claim 1, characterized in that: Before obtaining the first difference based on the first signal strength and the second signal strength, the method further includes: Obtain communication environment parameters at target time; Calculating the target signal strength based on the communication environment parameters at the target time; The communication environment parameter includes at least one of the following: a signal quality parameter between the first Bluetooth device and the second Bluetooth device, a position relationship parameter between the first Bluetooth device and the second Bluetooth device, and a Bluetooth transmission power of the first Bluetooth device; The target time is the first time, and the target signal strength is the first signal strength; or, the target time is the second time, and the target signal strength is the second signal strength.

5. The method according to claim 1, characterized in that: The obtaining a first difference based on the first signal strength and the second signal strength includes: When the number of the first time slots is greater than or equal to 2, obtaining a first difference based on the first signal strength and the second signal strength; The first time slot is a time slot used for data transmission between the first Bluetooth device and the second Bluetooth device.

6. The method according to claim 1, characterized in that The method further comprises: When the first difference is greater than the predetermined threshold, the sniffing request message continues to be sent to the second Bluetooth device during the first sniffing cycle.

7. A Bluetooth communication device, characterized in that: The device comprises: a sending module, a receiving module and a processing module; The sending module is used to send a sniffing request message to the second Bluetooth device within the first sniffing cycle; The processing module is configured to obtain a first difference value based on a first signal strength and a second signal strength when the receiving module receives a sniff response message from the second Bluetooth device, wherein the first signal strength and the second signal strength are signal strengths between the Bluetooth communication device and the second Bluetooth device at different times; The sending module is further configured to stop sending the sniffing request message to the second Bluetooth device within the first sniffing cycle when the first difference value acquired by the processing module is less than or equal to a predetermined threshold.

8. The device according to claim 7, characterized in that The processing module is further configured to obtain the first difference based on the first signal strength and the second signal strength. Acquire a first communication environment parameter at a target time; Calculating the target signal strength based on the communication environment parameters at the target time; The first communication environment parameter includes at least one of the following: a signal quality parameter between the Bluetooth communication device and the second Bluetooth device, a position relationship parameter between the Bluetooth communication device and the second Bluetooth device, and a Bluetooth transmission power of the Bluetooth communication device; The target time is the first time, and the target signal strength is the first signal strength; or, the target time is the second time, and the target signal strength is the second signal strength.

9. An electronic device, characterized in that: The method comprises a processor and a memory, wherein the memory stores a program or instruction that can be run on the processor, and when the program or instruction is executed by the processor, the steps of the Bluetooth communication method according to any one of claims 1 to 6 are implemented.

10. A readable storage medium, characterized in that: The readable storage medium stores a program or instruction, and when the program or instruction is executed by a processor, the steps of the Bluetooth communication method according to any one of claims 1 to 6 are implemented.

11. A computer program product, wherein the computer program product is stored in a storage medium and is executed by at least one processor to implement the steps of the Bluetooth communication method according to any one of claims 1 to 6.