Bluetooth communication method, electronic equipment, storage medium and chip system
By increasing the interaction frequency between Bluetooth devices and switching to a high-frequency interaction mode, the problem of easy Bluetooth connection drops was solved, resulting in more stable communication and an improved user experience.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-08-16
- Publication Date
- 2026-03-10
AI Technical Summary
Bluetooth connections are prone to disconnection, affecting user experience, especially in situations with poor signal strength and/or strong environmental interference.
Increase the frequency of interaction between Bluetooth devices by switching to a high-frequency interaction mode or increasing the number of interactions when the signal quality is poor, to ensure communication stability.
Increase the likelihood of successful Bluetooth interactions, enhance communication range and stability, and improve user experience.
Smart Images

Figure CN121645294A_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of terminal technology, and in particular to Bluetooth communication methods, electronic devices, storage media, and chip systems. Background Technology
[0002] Some electronic devices can communicate via Bluetooth, including mobile phones, watches, fitness trackers, and earphones. For example, a mobile phone can establish a connection and communicate with a watch, fitness tracker, or earphone via Bluetooth.
[0003] However, in some scenarios, the Bluetooth connection between two electronic devices may easily break, affecting Bluetooth communication and reducing the user experience. Summary of the Invention
[0004] The Bluetooth communication method, electronic device, storage medium, and chip system provided in this application can increase the likelihood of successful Bluetooth interaction when the signal strength is poor and / or the surrounding environment is heavily interfered with. This is achieved by increasing the number of Bluetooth interaction attempts, i.e., increasing the interaction frequency between Bluetooth devices, thereby enabling stable communication between Bluetooth devices and improving the user experience.
[0005] In a first aspect, embodiments of this application provide a Bluetooth communication method, the method comprising:
[0006] A first electronic device and a second electronic device establish a Bluetooth connection. At a first moment, the first electronic device sends Bluetooth data to the second electronic device at a first frequency. At a second moment, the frequency at which the first electronic device sends Bluetooth data to the second electronic device switches from the first frequency to a second frequency. The second moment is later than the first moment, and the second frequency is higher than the first frequency. The signal quality between the first and second electronic devices at the second moment is worse than the signal quality between them at the first moment. When the signal quality is poor, the electronic devices can increase the interaction frequency between the Bluetooth devices to increase the probability of successful Bluetooth interaction, enabling stable communication between the Bluetooth devices and thus improving the user experience.
[0007] In one possible implementation, the first frequency is a frequency used by the first electronic device when it is in a first mode; the second frequency is another frequency used by the first electronic device when it is in the first mode, or the second frequency is a frequency used by the first electronic device when it is in a second mode; wherein, in the second mode, the interaction frequency between the first and second electronic devices is higher than that in the first mode. In the second mode, because data transmission is required between the first and second electronic devices, the interaction frequency is higher, which can improve the communication capability between the first and second electronic devices. When the communication quality between the first and second electronic devices is poor, increasing the interaction frequency between the electronic devices can increase the probability of successful Bluetooth interaction, thereby increasing the communication distance between the electronic devices.
[0008] In one possible implementation, the method further includes: at a third moment, the frequency at which the first electronic device sends Bluetooth data to the second electronic device changes from a second frequency to a third frequency; wherein the third moment is later than the second moment, and the signal quality between the first and second electronic devices at the third moment is better than the signal quality between the first and second electronic devices at the second moment. When the signal quality between the first and second electronic devices improves, the frequency of Bluetooth data interaction between them can also be adjusted. This allows for flexible adjustment of the frequency of Bluetooth data interaction between the first and second electronic devices according to changes in the actual environment, improving the communication quality between them and thus enhancing the user experience.
[0009] In one possible implementation, at the third moment, the first electronic device is in the second mode, and the third frequency is greater than or equal to the second frequency; or, at the third moment, the first electronic device is in the first mode, and the third frequency is less than or equal to the second frequency. When the first electronic device is in the second mode, it indicates that there is business data interaction between the first and second electronic devices. In this case, the third frequency can be set to the frequency corresponding to the Active mode, thus not affecting the data interaction between the electronic devices and enabling normal business communication. When the second frequency is the frequency of the first mode, if the performance of the first electronic device is good, the third frequency can be equal to the second frequency. This can shorten the interaction interval between the electronic devices, thereby increasing the number of Bluetooth interaction attempts and improving the accuracy of the detection results. If the performance of the first electronic device is poor, the third frequency can be less than the second frequency, thus extending the interaction interval between the electronic devices and reducing the impact on the operating performance of the electronic devices.
[0010] In one possible implementation, the first mode includes the Sniff mode in Bluetooth communication, and the second mode includes the Active mode in Bluetooth communication. In Sniff mode, the interaction frequency between Bluetooth devices can be increased by increasing the number of Bluetooth interaction attempts, thus reducing the occurrence of Bluetooth connection drops and improving user experience. In Active mode, electronic devices can exchange business data, enabling normal business communication. Therefore, selecting the appropriate mode and using a reasonable interaction frequency in different scenarios can improve the communication quality between electronic devices.
[0011] In one possible implementation, the signal quality between the first electronic device and the second electronic device includes one or more of the following: Received Signal Strength Indication (RSSI) between the first and second electronic devices, and the number of available channels between the first and second electronic devices. By using the RSSI and / or the number of available channels, the signal quality between the first and second electronic devices can be determined. This allows for timely and flexible adjustment of the interaction frequency between the first and second electronic devices based on the signal quality, thereby improving the communication stability between them.
[0012] In one possible implementation, the signal quality between the first and second electronic devices at the second time point is worse than that between the first and second electronic devices at the first time point. This includes: the Received Signal Strength Indication (RSSI) value between the first and second electronic devices at the second time point is less than the RSSI value between the first and second electronic devices at the first time point; and / or, the number of available channels between the first and second electronic devices at the second time point is less than the number of available channels between the first and second electronic devices at the first time point. Thus, determining the signal strength based on the trend of RSSI changes over a period of time can reduce inaccurate judgments caused by abnormal jumps in the RSSI value. Similarly, determining the strength of environmental interference based on the trend of the number of available channels over a period of time can also reduce inaccurate judgments caused by abnormal jumps in the number of available channels, thereby making the judgment results more stable and accurate.
[0013] In one possible implementation, the signal quality between the first and second electronic devices at the second moment is worse than that between the first and second electronic devices at the first moment, including: the Received Signal Strength Indication (RSSI) value between the first and second electronic devices at the second moment is less than a first threshold, while the RSSI value between the first and second electronic devices at the first moment is greater than or equal to the first threshold; and / or, the number of available channels between the first and second electronic devices at the second moment is less than a second threshold, while the number of available channels between the first and second electronic devices at the first moment is greater than or equal to the second threshold. Using the first threshold allows for a more intuitive and convenient assessment of signal strength, while using the second threshold also allows for a more convenient and intuitive assessment of the strength of environmental interference. Furthermore, using thresholds makes code implementation easier, and the electronic devices can flexibly adjust the threshold value according to specific circumstances to adapt to different application scenarios.
[0014] Secondly, embodiments of this application provide a Bluetooth communication apparatus, which may be an electronic device, a chip or chip system within an electronic device. The apparatus may include a processing unit. The processing unit is used to implement any processing-related method executed by the electronic device in the first aspect or any possible implementation of the first aspect. When the apparatus is an electronic device, the processing unit may be a processor. The apparatus may further include a storage unit, which may be a memory. The storage unit is used to store instructions, and the processing unit executes the instructions stored in the storage unit to cause the electronic device to implement the method described in the first aspect or any possible implementation of the first aspect. When the apparatus is a chip or chip system within an electronic device, the processing unit may be a processor. The processing unit executes the instructions stored in the storage unit to cause the electronic device to implement the method described in the first aspect or any possible implementation of the first aspect. The storage unit may be a storage unit within the chip (e.g., a register, cache, etc.), or a storage unit located outside the chip within the electronic device (e.g., read-only memory, random access memory, etc.).
[0015] Thirdly, embodiments of this application provide an electronic device including one or more processors and a memory, the memory being coupled to one or more processors, the memory being used to store computer program code, the computer program code including computer instructions, and one or more processors being used to invoke the computer instructions to perform the method described in the first aspect or any possible implementation of the first aspect.
[0016] Fourthly, embodiments of this application provide a computer-readable storage medium storing a computer program or instructions that, when executed on a computer, cause the computer to perform the methods described in the first aspect or any possible implementation thereof.
[0017] Fifthly, embodiments of this application provide a computer program product including a computer program, which, when run on a computer, causes the computer to perform the methods described in the first aspect or any possible implementation thereof.
[0018] Sixthly, this application provides a chip or chip system including at least one processor and a communication interface. The communication interface and the at least one processor are interconnected via a circuit. The at least one processor is used to run computer programs or instructions to perform the methods described in the first aspect or any possible implementation of the first aspect. The communication interface in the chip can be an input / output interface, pins, or circuits, etc.
[0019] In one possible implementation, the chip or chip system described above in this application further includes at least one memory storing instructions. The memory can be an internal storage unit of the chip, such as a register or cache, or it can be a storage unit of the chip itself (e.g., read-only memory, random access memory, etc.).
[0020] It should be understood that the second to sixth aspects of this application correspond to the technical solutions of the first or second aspects of this application, and the beneficial effects achieved by each aspect and the corresponding feasible implementation are similar, and will not be repeated here. Attached Figure Description
[0021] Figure 1 This is a schematic diagram of the structure of an electronic device provided in an embodiment of this application;
[0022] Figure 2 A schematic diagram of a Bluetooth protocol architecture provided for an embodiment of this application;
[0023] Figure 3 A flowchart illustrating a Bluetooth communication method provided in an embodiment of this application;
[0024] Figure 4 A schematic diagram illustrating a Bluetooth communication method provided in an embodiment of this application;
[0025] Figure 5 This is a schematic diagram of the structure of a chip provided in an embodiment of this application. Detailed Implementation
[0026] To facilitate a clear description of the technical solutions in the embodiments of this application, some terms and technologies involved in the embodiments of this application will be briefly introduced below:
[0027] 1. POLL and NULL packets are commonly used packet types in Bluetooth communication, generally used to manage and coordinate the transmission of Bluetooth data.
[0028] For example, taking the establishment of a Bluetooth communication connection between a first electronic device and a second electronic device as an example, the first electronic device can send a query request to the second electronic device. Sending a query request can also be understood as sending a POLL packet to determine whether the second electronic device has data to send or whether it has a status to update.
[0029] After receiving a query request from the first electronic device, if the second electronic device has no data to send or no status to update, it can return an empty response to the first electronic device, which can also be understood as a NULL packet. If the second electronic device has data to send or status to update, it can return data information or status information to the first electronic device.
[0030] After receiving a response from the second electronic device, the first electronic device can process it accordingly based on the content of the response. For example, if the response includes data information or status information, the first electronic device can process this information; if the response is empty, the first electronic device can periodically send query requests to the second electronic device.
[0031] 2. Communication modes in Bluetooth communication:
[0032] Active mode: This refers to the mode in which Bluetooth devices are in operation. In Active mode, Bluetooth devices can remain active and are ready to transmit or receive data at any time. In some scenarios, Active mode can also be called high-frequency interaction mode. A Bluetooth device can be understood as an electronic device capable of Bluetooth communication.
[0033] Sniff mode: This refers to a low-power mode in which Bluetooth devices operate. In Sniff mode, Bluetooth devices can periodically interact to determine if there is data to be transmitted or received. In some scenarios, Sniff mode can also be called low-frequency interaction mode.
[0034] Understandably, in Active mode, the frequency of interaction between Bluetooth devices is higher than in Sniff mode.
[0035] 3. Terminology
[0036] In the embodiments of this application, terms such as "first" and "second" are used to distinguish identical or similar items with substantially the same function and purpose. For example, "first chip" and "second chip" are used only to distinguish different chips and do not limit their order of execution. Those skilled in the art will understand that terms such as "first" and "second" do not limit the quantity or execution order, and that "first" and "second" do not necessarily imply that they are different.
[0037] It should be noted that, in the embodiments of this application, the terms "exemplary" or "for example" are used to indicate examples, illustrations, or descriptions. Any embodiment or design scheme described as "exemplary" or "for example" in this application should not be construed as being more preferred or advantageous than other embodiments or design schemes. Specifically, the use of terms such as "exemplary" or "for example" is intended to present the relevant concepts in a specific manner.
[0038] In this application embodiment, "at least one" refers to one or more, and "more than one" refers to two or more. "And / or" describes the relationship between related objects, indicating that three relationships can exist. For example, A and / or B can represent: A alone, A and B simultaneously, or B alone, where A and B can be singular or plural. The character " / " generally indicates that the preceding and following related objects are in an "or" relationship. "At least one of the following" or similar expressions refer to any combination of these items, including any combination of single or plural items. For example, at least one of a, b, or c can represent: a, b, c, ab, a--c, bc, or abc, where a, b, and c can be single or multiple.
[0039] Bluetooth devices can communicate via Bluetooth and can include mobile phones, watches, fitness trackers, earphones, etc. For example, a mobile phone can establish a connection and communicate with a watch, fitness tracker, or earphone via Bluetooth.
[0040] However, in some scenarios, when two Bluetooth devices that have established a Bluetooth connection are separated by a certain distance, the Bluetooth connection between the two devices may be lost, making data communication impossible and thus affecting the user experience.
[0041] Taking Bluetooth communication between a mobile phone and a watch as an example, this embodiment compares the communication distance between the two devices in different usage scenarios. These scenarios include those where there is data interaction between the phone and watch, and those where they are only connected without data interaction. The data interaction can include voice calls, music playback, etc. The comparison shows that, under the same conditions, the communication distance between the phone and watch with data interaction is greater than the communication distance between them when they are only connected without data interaction.
[0042] Analysis of logs from both usage scenarios revealed that when there was business data interaction, the phone and watch were in Active mode, with frequent interactions, for example, an interaction interval of approximately 25 milliseconds (ms). However, when there was no business data interaction, the phone and watch were in Sniff mode, with less frequent interactions, for example, an interaction interval of approximately 500 ms.
[0043] According to the Bluetooth protocol, the Bluetooth connection is disconnected when the effective interaction interval between the phone and the watch exceeds the monitoring timeout T. supervision At this time, the Bluetooth connection between the phone and the watch is lost. This can also be understood as the connection between the phone and the watch being severed after the last successful interaction. supervision If no further successful interaction occurs within the specified time period, it indicates that the Bluetooth connection between the phone and the watch has been lost.
[0044] To monitor the timeout T supervision Taking 5 seconds as an example, when there is business data interaction, i.e., when the phone and watch are in Active mode, it takes approximately 5 seconds / 25 milliseconds = 200 consecutive failed interactions before the Bluetooth connection between the phone and watch is considered lost. However, when there is no business data interaction, i.e., when the phone and watch are in Sniff mode, it takes approximately 5 seconds / 500 milliseconds = 10 consecutive failed interactions before the Bluetooth connection between the phone and watch is considered lost.
[0045] Probabilistic analysis shows that the number of successful Bluetooth interactions between devices equals the number of Bluetooth interaction attempts multiplied by the probability of a successful interaction. The probability of a successful interaction depends on factors such as signal strength and environmental conditions, which are difficult to control in actual transmission. Therefore, to increase the number of successful Bluetooth interactions, one can increase the number of Bluetooth interaction attempts.
[0046] For example, in Sniff mode between the phone and watch, the analysis data above shows that if the interaction interval between the phone and watch is approximately 500ms, then 10 consecutive failed interactions will result in a Bluetooth connection being lost. If the number of Bluetooth interaction attempts is increased, for example, if the interaction interval between the phone and watch is approximately 25ms, then 200 consecutive failed interactions are required to determine that the Bluetooth connection is lost. In other words, the probability of 200 consecutive failed interactions is less than the probability of 10 consecutive failed interactions.
[0047] In view of this, the Bluetooth communication method provided in this application can increase the probability of successful Bluetooth interaction by increasing the number of Bluetooth interaction attempts when the signal strength is poor and / or the surrounding environment is strongly interfered with, thereby increasing the interaction frequency between Bluetooth devices. This enables stable communication between Bluetooth devices and improves the user experience.
[0048] It is understood that the electronic device in the embodiments of this application can also be any form of terminal device. For example, the electronic device may include the following devices with Bluetooth communication capabilities: mobile phone, tablet computer, PDA, laptop computer, mobile internet device (MID), wearable device, virtual reality (VR) device, augmented reality (AR) device, wireless terminal in industrial control, wireless terminal in self-driving, wireless terminal in remote medical surgery, wireless terminal in smart grid, wireless terminal in transportation safety, wireless terminal in smart city, wireless terminal in smart home, cellular phone, cordless phone, session initiation protocol (SIP) phone, wireless local loop (WLL) station, personal digital assistant (PDA). The embodiments of this application do not limit this to personal assistants (PDAs), handheld devices with wireless communication capabilities, computing devices or other processing devices connected to a wireless modem, in-vehicle devices, wearable devices, electronic devices in 5G networks, or electronic devices in future evolved public land mobile networks (PLMNs).
[0049] By way of example and not limitation, in this embodiment, the electronic device can also be a wearable device. Wearable devices, also known as wearable smart devices, are a general term for devices that utilize wearable technology to intelligently design and develop everyday wearables, such as glasses, gloves, watches, clothing, and shoes. Wearable devices are portable devices that are worn directly on the body or integrated into the user's clothing or accessories. Wearable devices are not merely hardware devices, but also achieve powerful functions through software support, data interaction, and cloud interaction. Broadly speaking, wearable smart devices include those that are feature-rich, large in size, and can achieve complete or partial functions without relying on a smartphone, such as smartwatches or smart glasses, as well as those that focus on a specific type of application function and require the use of other devices such as smartphones, such as various smart bracelets and smart jewelry for vital sign monitoring.
[0050] Furthermore, in this application embodiment, the electronic device can also be an electronic device in the Internet of Things (IoT) system. IoT is an important part of the future development of information technology. Its main technical feature is to connect objects to the network through communication technology, thereby realizing an intelligent network of human-machine interconnection and object-to-object interconnection.
[0051] The electronic equipment in the embodiments of this application may also be referred to as: user equipment (UE), mobile station (MS), mobile terminal (MT), access terminal, user unit, user station, mobile station, mobile station, remote station, remote terminal, mobile device, user terminal, terminal, wireless communication equipment, user agent, or user device, etc.
[0052] In this embodiment, the electronic device or various network devices include a hardware layer, an operating system layer running on top of the hardware layer, and an application layer running on top of the operating system layer. The hardware layer includes hardware such as a central processing unit (CPU), a memory management unit (MMU), and memory (also called main memory). The operating system can be any one or more computer operating systems that implement business processing through processes, such as Linux, Unix, Android, iOS, or Windows. The application layer includes applications such as browsers, address books, word processing software, and instant messaging software.
[0053] For example, Figure 1 A schematic diagram of the electronic device is shown.
[0054] The electronic device may include a processor 110, an external memory interface 120, an internal memory 121, a universal serial bus (USB) interface 130, a charging management module 140, a power management module 141, a battery 142, a wireless communication module 150, and a display screen 160, etc.
[0055] It is understood that the structures illustrated in the embodiments of this application do not constitute a specific limitation on the electronic device. In other embodiments of this application, the electronic device may include more or fewer components than illustrated, or combine some components, or split some components, or have different component arrangements. The illustrated components may include hardware, software, or a combination of software and hardware.
[0056] Processor 110 may include one or more processing units, such as application processors (APs), modem processors, graphics processing units (GPUs), image signal processors (ISPs), controllers, video codecs, digital signal processors (DSPs), baseband processors, and / or neural network processing units (NPUs). These different processing units may be independent devices or integrated into one or more processors. The controller can generate operation control signals based on instruction opcodes and timing signals to control instruction fetching and execution.
[0057] The processor 110 may also include a memory for storing instructions and data. In some embodiments, the memory in the processor 110 is a cache memory. This memory can store instructions or data that the processor 110 has just used or that are used repeatedly. If the processor 110 needs to use the instruction or data again, it can directly retrieve it from the aforementioned memory. This avoids repeated access, reduces the waiting time of the processor 110, and thus improves the efficiency of the system. For example, in the embodiments of this application, the processor 110 can be used to process Bluetooth data, switch interaction modes, and detect signal strength, etc.
[0058] It is understood that the interface connection relationships between the modules illustrated in the embodiments of this application are merely illustrative and do not constitute a limitation on the structure of the electronic device. In other embodiments of this application, the electronic device may also employ different interface connection methods or combinations of multiple interface connection methods as described in the above embodiments.
[0059] The internal memory 121 can be used to store computer executable program code, which includes instructions. The internal memory 121 may include a program storage area and a data storage area. The program storage area may store the operating system, applications required for at least one function, etc. The data storage area may store data created during the use of the electronic device, etc. Furthermore, the internal memory 121 may include high-speed random access memory, and may also include non-volatile memory, such as at least one disk storage device, flash memory device, universal flash storage (UFS), etc. The processor 110 executes various functional applications and data processing of the electronic device by running instructions stored in the internal memory 121 and / or instructions stored in memory disposed in the processor. For example, in this embodiment, the internal memory 121 may be used to store code related to Bluetooth communication, code related to detecting signal strength, and code related to detecting environmental interference strength, etc.
[0060] The wireless communication module 150 can provide solutions for wireless communication applications in electronic devices, including wireless local area networks (WLANs) (such as wireless fidelity (Wi-Fi) networks), Bluetooth (BT), global navigation satellite system (GNSS), frequency modulation (FM), near field communication (NFC), and infrared (IR) technologies. For example, in this embodiment, Bluetooth devices can establish communication connections and transmit data based on the wireless communication module 150.
[0061] The wireless communication module 150 may be one or more devices integrating at least one communication processing module. The wireless communication module 150 receives electromagnetic waves via an antenna, performs frequency modulation and filtering of the electromagnetic wave signal, and sends the processed signal to the processor 110. The wireless communication module 150 may also receive signals to be transmitted from the processor 110, perform frequency modulation and amplification on them, and then convert them into electromagnetic waves for radiation via the antenna.
[0062] Figure 2 This describes the Bluetooth protocol architecture corresponding to Bluetooth communication performed by the Bluetooth devices in this application embodiment. In some embodiments, the Bluetooth protocol architecture may include a Bluetooth protocol layer and a Bluetooth controller (BTC) layer.
[0063] The Bluetooth protocol layer provides an application programming interface (API) for transmitting data to upper-layer applications, and can also maintain some software-level protocols and encryption processes. In some scenarios, the Bluetooth protocol layer can also be called the BT Host layer. For example, in the embodiments of this application, the Bluetooth protocol layer can execute... Figure 3 In step S301 of the corresponding embodiment, the Bluetooth device is detected to be in Active mode or Sniff mode; the Bluetooth protocol layer can also perform... Figure 3 Corresponding to steps S302 and S304 in the embodiment, the current signal strength and the current environmental interference strength are detected; the Bluetooth protocol layer can also perform... Figure 3 In the corresponding embodiments, steps S303 and S305 involve switching the interaction mode between Bluetooth devices.
[0064] The Bluetooth protocol layer may include the generic access profile (GAP), security manager orotocol (SMP), attribute protocol (ATT), generic attribute profile (GATT), service discovery protocol (SDP), and logical link control and adaptation protocol (L2CAP), etc.
[0065] The universal access profile can be used to manage and control the communication process between Bluetooth devices, providing universal access functions for Bluetooth devices, including device discovery, connection, authentication, and service discovery. Through the universal access profile, Bluetooth devices can implement basic communication functions, such as device discovery and connection establishment. For example, in the embodiments of this application, the Bluetooth device can perform... Figure 4 In step S401 of the corresponding embodiment, a Bluetooth connection is established through a universal access configuration file.
[0066] Security management protocols can be used to generate encryption keys and identity keys.
[0067] Attribute protocols can be used for data transmission between Bluetooth devices, enabling efficient business processing and data transfer between them. For example, in the embodiments of this application, the Bluetooth device can perform... Figure 4 In steps S402 and S403 of the corresponding embodiment, Bluetooth data transmission is performed with the device that has established a Bluetooth connection.
[0068] The general properties profile defines how data is exchanged via Bluetooth Low Energy (BLE), enabling different Bluetooth devices to communicate with each other via Bluetooth.
[0069] The Service Discovery Protocol provides a service that allows Bluetooth devices to query and access each other.
[0070] Logical Link Control and Adaptation (LPCA) protocols can group data and provide functions such as protocol multiplexing and Quality of Service (QoS) exchange. LPCA protocols can include channel management and L2CAP resource management. Channel management is used to create, manage, or close L2CAP channels for the transmission of service protocols and application data. L2CAP resource management is used to manage the correct submission of fragmented protocol data units (PDUs).
[0071] The Bluetooth chip control layer can be used to handle low-level operations and hardware interactions in Bluetooth communication. For example, in this embodiment, Bluetooth devices can transmit service data and transfer Sniff or Active modes based on the Bluetooth chip control layer. The Bluetooth chip control layer may include device manager, link manager, baseband resource manager, link controller, and physical layer (PHY).
[0072] Device management can be used to control the general behavior of Bluetooth devices, such as querying devices and connecting to devices.
[0073] Link management can be used to create, modify, and release logical links.
[0074] Baseband resource management can be used to manage all access to radio media.
[0075] Link control can be used to manage Bluetooth baseband resources, including channel selection, time slot allocation, and synchronization, ensuring that data can be correctly transmitted on different logical links. It can also be used to encode and decode Bluetooth data packets.
[0076] The physical layer can be used to send and receive information packets from the physical channel.
[0077] The methods of this application will be described in detail below through specific embodiments. The following embodiments can be combined with each other or implemented independently, and the same or similar concepts or processes may not be described again in some embodiments.
[0078] It is understood that when a Bluetooth communication connection is established between the first Bluetooth device and the second Bluetooth device, the Bluetooth communication method of this application embodiment can be implemented in either of the Bluetooth devices. That is, the first Bluetooth device can execute the Bluetooth communication method of this application embodiment, or the second Bluetooth device can execute the Bluetooth communication method of this application embodiment. This application embodiment does not impose any limitations. For ease of description, the following explanation uses the first Bluetooth device executing the Bluetooth communication method of this application embodiment as an example.
[0079] Figure 3 A flowchart illustrating the first Bluetooth device executing the Bluetooth communication method of this application embodiment is shown.
[0080] S301, The current interaction mode is low-frequency.
[0081] In a possible implementation, the Bluetooth chip control layer of the first Bluetooth device can report the current interaction mode between the Bluetooth devices to the Bluetooth protocol layer. If the Bluetooth protocol layer detects that the current Bluetooth devices are in a low-frequency interaction mode, i.e., Sniff mode, then the Bluetooth protocol layer can execute step S302.
[0082] S302. Detect whether the current signal and / or environment has deteriorated.
[0083] On one hand, the Bluetooth protocol layer can detect whether the communication signal between current Bluetooth devices is weak. The detected signal can include the received signal strength indicator (RSSI). In some scenarios, the received signal strength indicator is also called the signal strength RSSI, which can be used to reflect the strength of the signal. Understandably, a higher RSSI value indicates a stronger signal, and a lower RSSI value indicates a weaker signal.
[0084] On the other hand, the Bluetooth protocol layer can also detect whether the communication environment between Bluetooth devices is poor, which can also be understood as whether the environmental interference between Bluetooth devices is strong. If the Bluetooth devices are subject to strong environmental interference, it indicates that the current communication environment is poor; if the Bluetooth devices are subject to less environmental interference, it indicates that the current communication environment is good. Environmental interference can be judged based on the number of available channels. The number of available channels can be understood as the number of radio frequency channels that Bluetooth devices can use during Bluetooth data exchange. It can be understood that the more available channels, the weaker the environmental interference; the fewer available channels, the stronger the environmental interference.
[0085] In one possible implementation, when the RSSI (Signal Strength Index) value is less than a signal strength threshold, and / or the number of available channels is less than a threshold, it can be determined that the current signal and / or environment has deteriorated. Understandably, an RSSI value less than the signal strength threshold indicates a weak signal strength during Bluetooth communication between devices. A number of available channels less than the available channel threshold indicates strong environmental interference and a poor communication environment during Bluetooth communication between devices.
[0086] The signal strength threshold and the available channel number threshold can both be set according to the actual situation of the Bluetooth device. For example, based on laboratory testing experience, the possible values are approximately -80dBm for the signal strength threshold and approximately 25 for the available channel number threshold. The specific values for the signal strength threshold and the available channel number threshold are not limited in this embodiment.
[0087] In another possible implementation, the Bluetooth protocol layer can also detect the trend of RSSI signal strength changes over a period of time, and / or detect the trend of the number of available channels over a period of time.
[0088] Regarding RSSI (Signal Strength Signal Indicator), if the RSSI gradually weakens over a period of time, and the value of the weakened RSSI is less than the signal strength threshold, it can be determined that the signal strength between Bluetooth devices is weak.
[0089] Regarding the number of available channels, if the number of available channels gradually decreases over a period of time, and the decrease in the number of available channels is less than the threshold for the number of available channels, it can be determined that there is strong environmental interference between Bluetooth devices and the communication environment deteriorates.
[0090] The period for detecting the RSSI signal strength and the period for detecting the number of available channels can be the same or different. The specific periods for detecting the RSSI signal strength and the number of available channels can be set according to the actual situation of the Bluetooth device, and this embodiment does not impose any limitations. For example, the periods for detecting the RSSI signal strength and the number of available channels can be set to approximately 500ms to 1s, respectively.
[0091] Therefore, determining signal strength based on the trend of RSSI changes over a period of time can reduce inaccurate judgments caused by abnormal fluctuations in RSSI values. Similarly, determining the strength of environmental interference based on the trend of available channel count changes over a period of time can also reduce inaccurate judgments caused by abnormal fluctuations in available channel count, thus making the judgment results more stable and accurate.
[0092] Optionally, the period for detecting the signal strength RSSI and the period for detecting the number of available channels can be flexibly set according to the operating performance of the electronic equipment.
[0093] For example, taking the period of RSSI (Resonance Signal Strength Indicator) detection as an example, a relatively large detection period can be set initially. If a decrease in the current signal strength is detected, the detection period can be shortened; if an increase in the current signal strength is detected, the detection period can be extended. Alternatively, if the current electronic device has good operating performance, such as low power consumption, low temperature, and / or large memory space, the RSSI detection period can be set to a relatively small value, thereby increasing the number of detections and improving the accuracy of the detection results. If the current electronic device has poor operating performance, such as high power consumption, high temperature, and / or small memory space, the RSSI detection period can be set to a relatively large value, thereby reducing the number of detections and minimizing the impact on the operating performance of the electronic device.
[0094] Similarly, for the period for detecting the number of available channels, a relatively large detection period can be set initially. If strong interference is detected in the current environment, the detection period can be shortened; if weak interference is detected, the detection period can be extended. Alternatively, if the current electronic device is operating well, for example, with low power consumption, low temperature, and / or large memory space, the period for detecting the number of available channels can be set to a relatively small value, thereby increasing the number of detections and improving the accuracy of the detection results. If the current electronic device is operating poorly, for example, with high power consumption, high temperature, and / or small memory space, the period for detecting the number of available channels can be set to a relatively large value, thereby reducing the impact on the operating performance of the electronic device.
[0095] In possible scenarios, if the RSSI signal strength increases but the number of available channels decreases, or vice versa, it can still be determined that the current Bluetooth communication signal and / or environment has deteriorated. This allows for switching the interaction mode based on the worsening conditions, thereby promptly improving the communication capabilities between Bluetooth devices.
[0096] If the Bluetooth protocol layer detects that the current signal and / or environment has deteriorated, step S303 can be executed.
[0097] If the Bluetooth protocol layer detects that the current signal and / or environment has not deteriorated, step S306 can be executed to continue polling and performing the next detection based on the Bluetooth device establishing a Bluetooth communication connection.
[0098] S303, switch from low-frequency interaction mode to high-frequency interaction mode.
[0099] Switching from a low-frequency interaction mode to a high-frequency interaction mode can include switching from Sniff mode to Active mode, or, in Sniff mode, increasing the interaction frequency between Bluetooth devices. Increasing the interaction frequency between Bluetooth devices can also be understood as shortening the interaction interval between them.
[0100] Understandably, Bluetooth devices interact more frequently in Active mode compared to Sniff mode. For example, in Sniff mode, the interaction interval between Bluetooth devices is approximately 500ms, while in Active mode, it is approximately 25ms. Therefore, switching from Sniff mode to Active mode can shorten the interaction interval between Bluetooth devices, thereby increasing the frequency of interaction.
[0101] Furthermore, in Sniff mode, the frequency of Bluetooth device interactions can be increased by increasing the number of attempts at interaction between the devices. For example, in Sniff mode, the initial interaction interval between Bluetooth devices is approximately 500ms. To increase the interaction frequency, the interaction interval can be set to be less than the initial interval, i.e., less than 500ms. This increases the number of Bluetooth interaction attempts, thereby increasing the number of successful interactions, reducing the likelihood of Bluetooth connection drops, and improving the user experience.
[0102] After switching to high-frequency interaction mode, the Bluetooth protocol layer can execute step S304.
[0103] S304. Check whether the current signal and / or environment have returned to normal.
[0104] The Bluetooth protocol layer can detect whether the current signal and / or environment has returned to normal.
[0105] In one possible implementation, when the RSSI (Signal Strength Index) is greater than or equal to a signal strength threshold, and the number of available channels is greater than or equal to a number of available channels threshold, it can be determined that the current signal and / or environment has returned to normal. Understandably, an RSSI greater than or equal to a signal strength threshold indicates that the signal strength is strong when Bluetooth devices are communicating. A number of available channels greater than or equal to a number of available channels threshold indicates that the environmental interference experienced by Bluetooth devices is weak, and the communication environment is good.
[0106] In another possible implementation, the Bluetooth protocol layer can also detect the trend of RSSI signal strength changes over a period of time, and / or detect the trend of the number of available channels over a period of time.
[0107] Regarding RSSI (Signal Strength Signal Indicator), if RSSI gradually increases over a period of time, and the increased RSSI value is greater than or equal to the signal strength threshold, it can be determined that the signal strength between Bluetooth devices is relatively strong.
[0108] Regarding the number of available channels, if the number of available channels gradually increases over a period of time, and the increase in the number of available channels is greater than or equal to the threshold of available channels, it can be determined that the environmental interference between Bluetooth devices is weak and the communication environment is improving.
[0109] When both the signal strength RSSI and the number of available channels meet their respective judgment conditions, i.e., when both the signal strength RSSI and the number of available channels improve, it can be determined that the current signal and / or environment has returned to normal. For a detailed description of the specific periods for detecting the signal strength RSSI and the number of available channels, please refer to the relevant description in step S302, which will not be repeated here.
[0110] Therefore, determining signal strength based on the trend of RSSI changes over a period of time can reduce inaccurate judgments caused by abnormal fluctuations in RSSI values. Similarly, determining the strength of environmental interference based on the trend of the number of available channels over a period of time can reduce inaccurate judgments caused by abnormal fluctuations in the number of available channels, thus making the judgment results more stable and accurate.
[0111] In a possible implementation, step S302 can be executed in parallel with either step S301 or step S303, and step S304 can also be executed in parallel with either step S301 or step S303. That is, the first thread used to detect the current signal and / or environment, and the second thread used for pattern detection and switching, can be different threads. This allows the first and second threads to execute in parallel, thereby improving detection speed, increasing code execution efficiency, and making the code easier to maintain.
[0112] In a possible implementation, after a Bluetooth connection is established between Bluetooth devices, the first thread can initiate a process to detect the current signal and / or environment. When a deterioration in signal and / or environment is detected, the first thread can send a message to the second thread. This message can indicate the deterioration in signal and / or environment. Subsequently, the second thread can determine whether to switch to Active mode or Sniff mode based on this message and information such as the current communication mode.
[0113] If the Bluetooth protocol layer detects that the current signal and / or environment has returned to normal, step S305 can be executed.
[0114] If the Bluetooth protocol layer detects that the current signal and / or environment has not returned to normal, step S306 can be executed to continue polling and performing the next detection based on the Bluetooth device establishing a Bluetooth communication connection.
[0115] S305, Restore to the previous interaction mode.
[0116] It's understandable that if there's data interaction between Bluetooth devices, reverting to the previous interaction mode can be seen as reverting to Active mode. This way, data interaction between Bluetooth devices can be maintained, allowing for normal business communication. In a possible implementation, a timer can be started when Bluetooth devices begin data interaction. If there's no data interaction between Bluetooth devices within the timer's corresponding time range, then Sniff mode can be entered.
[0117] If there is currently no data exchange between Bluetooth devices, and the signal and / or environment have returned to normal, reverting to the previous interaction mode can be understood as reverting to Sniff mode. In Sniff mode, the interaction interval between Bluetooth devices can be set according to actual conditions, and this application embodiment does not impose limitations. For example, the interaction interval between Bluetooth devices can be set to approximately 500ms. Alternatively, if the Bluetooth devices have good performance, the interaction interval can be shortened to increase the number of Bluetooth interaction attempts and improve the accuracy of the detection results; if the Bluetooth devices have poor performance, the interaction interval can be extended to reduce the impact on the operating performance of electronic devices.
[0118] S306. Continue polling to perform the next test.
[0119] It is understandable that in step S302, when the Bluetooth protocol layer detects that the current signal and / or environment has not deteriorated, the next detection is performed by polling to detect whether the current signal and / or environment has deteriorated. The specific execution process can be referred to the relevant description of step S302, which will not be repeated here.
[0120] In step S304, when the Bluetooth protocol layer detects that the current signal and / or environment has not returned to normal, it continues to poll and perform the next detection to detect whether the current signal and / or environment has returned to normal. The specific execution process can be referred to the relevant description of step S304, which will not be repeated here.
[0121] For a detailed description of the period for polling the RSSI signal strength and the period for polling the number of available channels, please refer to the relevant description in step S302, which will not be repeated here.
[0122] Figure 4 A Bluetooth communication method according to an embodiment of this application is illustrated. The method includes:
[0123] S401, The first electronic device establishes a Bluetooth connection with the second electronic device.
[0124] In this embodiment, the first electronic device and the second electronic device can be any electronic device capable of establishing a Bluetooth communication connection. For example, the first electronic device and the second electronic device can respectively include mobile phones, watches, bracelets, earphones, etc. The first electronic device and the second electronic device can be the same type of electronic device or different types of electronic devices; this embodiment does not limit the types. For example, the first electronic device can be understood as the first Bluetooth device in the above embodiments, and the second electronic device can be understood as the second Bluetooth device in the above embodiments.
[0125] S402. At the first moment, the frequency at which the first electronic device sends Bluetooth data to the second electronic device is the first frequency.
[0126] In this embodiment of the application, the first moment can be understood as the moment when the frequency at which the first electronic device sends Bluetooth data to the second electronic device is the first frequency.
[0127] At the first moment, the Bluetooth data sent by the first electronic device to the second electronic device may include data sent in low-frequency interaction mode, such as POLL packets. The specific Bluetooth data content is not limited in the embodiments of this application.
[0128] S403. At the second moment, the frequency at which the first electronic device sends Bluetooth data to the second electronic device is switched from the first frequency to the second frequency; wherein, the second moment is later than the first moment, the second frequency is higher than the first frequency, and the signal quality between the first electronic device and the second electronic device at the second moment is worse than the signal quality between the first electronic device and the second electronic device at the first moment.
[0129] In this embodiment of the application, the second moment can be understood as the moment when the frequency at which the first electronic device sends Bluetooth data to the second electronic device switches from the first frequency to the second frequency.
[0130] At the second moment, the Bluetooth data sent from the first electronic device to the second electronic device can be any Bluetooth data. For example, the Bluetooth data sent from the first electronic device to the second electronic device may include POLL packets or data related to business interactions. The specific content of the Bluetooth data is not limited in this embodiment.
[0131] Signal quality between the first and second electronic devices can include signal strength (RSSI) and / or the number of available channels. Generally, a higher RSSI value indicates a stronger signal, while a lower RSSI value indicates a weaker signal. A higher number of available channels indicates less environmental interference, while a lower number of available channels indicates stronger environmental interference.
[0132] Switching from the first frequency to the second frequency can be understood as switching from a lower frequency to a higher frequency, or it can be understood as... Figure 3 The corresponding embodiment describes the switch from low-frequency interaction mode to high-frequency interaction mode. For a detailed explanation of the process of switching from low-frequency interaction mode to high-frequency interaction mode, please refer to... Figure 3 The relevant description of step S303 in the corresponding embodiment will not be repeated.
[0133] When signal quality is poor, electronic devices can increase the frequency of interaction between Bluetooth devices to increase the likelihood of successful Bluetooth interaction, enabling stable communication between Bluetooth devices and thus improving the user experience.
[0134] Optional, in Figure 4 Based on the corresponding embodiments, the first frequency is a frequency used when the first electronic device is in the first mode; the second frequency is another frequency used when the first electronic device is in the first mode, or the second frequency is a frequency used when the first electronic device is in the second mode; wherein, in the second mode, the interaction frequency between the first electronic device and the second electronic device is greater than the interaction frequency between the first electronic device and the second electronic device in the first mode.
[0135] The first mode can be understood as a mode in which the interaction frequency between the first electronic device and the second electronic device is relatively low. For example, the first mode may include the Sniff mode in Bluetooth communication, or other low-frequency interaction modes. This application embodiment does not limit this.
[0136] The second mode can be understood as a mode in which the first electronic device and the second electronic device interact more frequently. For example, the second mode may include the Active mode in Bluetooth communication, or other high-frequency interaction modes. This application embodiment does not limit this.
[0137] The second frequency is another frequency used when the first electronic device is in the first mode. It can be understood as increasing the interaction frequency between the first electronic device and the second electronic device in a low-frequency interaction mode, such as Sniff mode. The second frequency is higher than the first frequency.
[0138] The second frequency is a frequency used when the first electronic device is in the second mode. It can be understood as the interaction frequency between the first and second electronic devices in a high-frequency interaction mode, such as Active mode. For details on switching to the second frequency, please refer to [link / reference]. Figure 3 The relevant description of step S303 in the corresponding embodiment will not be repeated.
[0139] Understandably, in the first mode, the reduced data interaction between the first and second electronic devices results in a lower interaction frequency, which helps minimize the impact on the device's performance and improve its battery life. In the second mode, the increased data transmission frequency between the first and second electronic devices enhances their communication capabilities. When the communication quality between the first and second electronic devices is poor, increasing the interaction frequency increases the likelihood of successful Bluetooth interaction, thereby extending the communication distance between them.
[0140] Optional, in Figure 4 Based on the corresponding embodiment, the method further includes: at a third moment, the frequency at which the first electronic device sends Bluetooth data to the second electronic device is switched from the second frequency to the third frequency; wherein the third moment is later than the second moment, and the signal quality between the first electronic device and the second electronic device at the third moment is better than the signal quality between the first electronic device and the second electronic device at the second moment.
[0141] In this embodiment of the application, the third moment can be understood as the moment when the frequency at which the first electronic device sends Bluetooth data to the second electronic device switches from the second frequency to the third frequency.
[0142] Switching to the third frequency can be understood as reverting to the previous interaction mode. For details on the process of switching from the second to the third frequency, please refer to [link / reference needed]. Figure 3 The relevant descriptions in step S305 of the corresponding embodiment will not be repeated here.
[0143] When the signal quality between the first and second electronic devices improves, the frequency of Bluetooth data interaction between them can be adjusted. This allows for flexible adjustment of the Bluetooth data interaction frequency based on changes in the actual environment, improving communication quality and ultimately enhancing the user experience.
[0144] Optional, in Figure 4 Based on the corresponding embodiments, at the third moment, the first electronic device is in the second mode and the third frequency is greater than or equal to the second frequency; or, at the third moment, the first electronic device is in the first mode and the third frequency is less than or equal to the second frequency.
[0145] In this embodiment of the application, the first mode is Sniff mode and the second mode is Active mode, which are taken as examples.
[0146] If the first electronic device is in the second mode, and is in Active mode, it indicates that there is business data interaction between the first and second electronic devices. Therefore, the third frequency can include the frequency corresponding to Active mode. In this way, setting the third frequency to the frequency corresponding to Active mode does not affect data interaction between electronic devices, allowing for normal business communication.
[0147] Understandably, at the third moment, if the first electronic device is in the second mode, and if the second frequency is the frequency used by the first electronic device in Active mode, then the third frequency can be equal to the second frequency for business data interaction. If the second frequency is the frequency used by the first electronic device in Sniff mode, since the interaction frequency in Active mode is greater than the interaction frequency in Sniff mode, the third frequency can be greater than the second frequency.
[0148] If the first electronic device is in the first mode, and the first electronic device is in Sniff mode, it means that the first electronic device and the second electronic device are in a low-frequency interaction mode. Therefore, the third frequency can be the frequency corresponding to Sniff mode.
[0149] It is understandable that, at the third moment, if the first electronic device is in the first mode, and the second frequency is the frequency used by the first electronic device in the Active mode, then since the third frequency is the frequency corresponding to the Sniff mode, the third frequency can be less than the second frequency. If the second frequency is the frequency used by the first electronic device in the Sniff mode, then since the third frequency is the frequency corresponding to the Sniff mode, the third frequency can be equal to or less than the second frequency.
[0150] Optionally, if the second frequency is the Sniff mode frequency, and the first electronic device has good performance, the third frequency can be equal to the second frequency. This can shorten the interaction interval between the electronic devices, thereby increasing the number of Bluetooth interaction attempts and improving the accuracy of the detection results. If the first electronic device has poor performance, the third frequency can be lower than the second frequency. This can prolong the interaction interval between the electronic devices, thereby reducing the impact on the operating performance of the electronic devices.
[0151] For details on the process of switching from the second frequency to the third frequency, please refer to [link / reference]. Figure 3 The relevant descriptions in step S305 of the corresponding embodiment will not be repeated here.
[0152] Optional, in Figure 4 Based on the corresponding embodiments, the first mode includes the Sniff mode in Bluetooth communication, and the second mode includes the Active mode in Bluetooth communication.
[0153] In this embodiment, Sniff mode refers to a low-power mode where electronic devices can periodically interact to determine if there is data to be transmitted or received. Active mode refers to a working mode where electronic devices can remain active and are ready to transmit data at any time.
[0154] Understandably, in Active mode, the frequency of interaction between Bluetooth devices is higher than in Sniff mode.
[0155] In Sniff mode, the frequency of Bluetooth interactions between devices can be increased by increasing the number of Bluetooth interaction attempts, thus reducing the occurrence of Bluetooth connection drops and improving user experience. In Active mode, electronic devices can exchange business data, enabling normal business communication. Therefore, selecting the appropriate mode and using a reasonable interaction frequency in different scenarios can improve the communication quality between electronic devices.
[0156] Optional, in Figure 4Based on the corresponding embodiments, the signal quality between the first electronic device and the second electronic device includes one or more of the following: Received Signal Strength Indication (RSSI) between the first electronic device and the second electronic device, and the number of available channels between the first electronic device and the second electronic device.
[0157] In this embodiment of the application, the Received Signal Strength Indicator (RSSI) can be used to reflect the strength of the signal. It is understood that a larger RSSI value indicates a stronger signal, and a smaller RSSI value indicates a weaker signal.
[0158] The number of available channels can be used to reflect the strength of environmental interference during communication between a first electronic device and a second electronic device. Understandably, a higher number of available channels indicates weaker environmental interference, while a lower number indicates stronger environmental interference.
[0159] By receiving the Signal Strength Indicator (RSSI) and / or the number of available channels, the signal quality between the first electronic device and the second electronic device can be determined. This allows for timely and flexible adjustment of the interaction frequency between the first and second electronic devices based on the signal quality, thereby improving the communication stability between them.
[0160] Optional, in Figure 4 Based on the corresponding embodiments, if the signal quality between the first electronic device and the second electronic device at the second time is worse than the signal quality between the first electronic device and the second electronic device at the first time, it may include: the Received Signal Strength Indication (RSSI) value between the first electronic device and the second electronic device at the second time is less than the RSSI value between the first electronic device and the second electronic device at the first time; and / or, the number of available channels between the first electronic device and the second electronic device at the second time is less than the number of available channels between the first electronic device and the second electronic device at the first time.
[0161] In this embodiment of the application, whether the signal quality between the first electronic device and the second electronic device deteriorates can be referred to... Figure 3 The relevant descriptions in step S302 of the corresponding embodiment will not be repeated here.
[0162] In one possible implementation, the signal quality between the first electronic device and the second electronic device at the first time can be the signal quality detected at the first time; similarly, the signal quality between the first electronic device and the second electronic device at the second time can be the signal quality detected at the second time. It is understandable that using the signal quality at the current moment for judgment is simpler to implement in code and reduces the computational load on the electronic devices.
[0163] In another possible implementation, the signal quality between the first electronic device and the second electronic device at the first time point can be the signal quality detected over a period of time prior to the first time point; similarly, the signal quality between the first electronic device and the second electronic device at the second time point can be the signal quality detected over a period of time prior to the second time point. This signal quality can be the average, maximum, minimum, or predicted trend of the detected signal quality over a period of time, etc., and is not limited in this embodiment. Specifically, the period for detecting the Received Signal Strength Indicator (RSSI) and the period for detecting the number of available channels can be referred to... Figure 3 The relevant descriptions in step S302 of the corresponding embodiment will not be repeated here.
[0164] Therefore, determining signal strength based on the trend of RSSI (Received Signal Strength Indicator) changes over a period of time can reduce inaccurate judgments caused by abnormal fluctuations in the RSSI value. Similarly, determining the strength of environmental interference based on the trend of the number of available channels over a period of time can also reduce inaccurate judgments caused by abnormal fluctuations in the number of available channels, thus making the judgment results more stable and accurate.
[0165] Optional, in Figure 4 Based on the corresponding embodiments, if the signal quality between the first electronic device and the second electronic device at the second time is worse than the signal quality between the first electronic device and the second electronic device at the first time, it may include: the Received Signal Strength Indicator (RSSI) value between the first electronic device and the second electronic device at the second time is less than a first threshold, and the RSSI value between the first electronic device and the second electronic device at the first time is greater than or equal to the first threshold; and / or, the number of available channels between the first electronic device and the second electronic device at the second time is less than a second threshold, and the number of available channels between the first electronic device and the second electronic device at the first time is greater than or equal to the second threshold.
[0166] In this embodiment of the application, the first threshold can be understood as... Figure 3 The signal strength threshold in the corresponding embodiment, specifically the first threshold, can be referred to Figure 3 The relevant description of the signal strength threshold in step S302 of the corresponding embodiment will not be repeated here. The second threshold can be understood as... Figure 3 The available channel number threshold in the corresponding embodiment, and the specific second threshold can be referred to Figure 3 The relevant description of the available channel number threshold in step S302 of the corresponding embodiment will not be repeated here.
[0167] The specific method for determining whether the signal quality deteriorates between the first electronic device and the second electronic device can be found in [reference needed]. Figure 3The relevant descriptions in step S302 of the corresponding embodiment will not be repeated here.
[0168] Understandably, using the first threshold provides a more intuitive and convenient way to determine signal strength, while using the second threshold also makes it easier to intuitively determine the strength of environmental interference. Furthermore, using thresholds makes the code easier to implement, and electronic devices can flexibly adjust the threshold value according to specific circumstances to adapt to different application scenarios.
[0169] It should be noted that the user information (including but not limited to user device information, user personal information, etc.) and data (including but not limited to data used for analysis, data stored, data displayed, etc.) involved in this application are all information and data authorized by the user or fully authorized by all parties. Furthermore, the collection, use and processing of the relevant data must comply with the relevant laws, regulations and standards of the relevant countries and regions, and corresponding operation portals are provided for users to choose to authorize or refuse.
[0170] The foregoing primarily describes the solutions provided by the embodiments of this application from a methodological perspective. To achieve the aforementioned functions, it includes corresponding hardware structures and / or software modules for executing each function. Those skilled in the art should readily recognize that, based on the method steps of the examples described in conjunction with the embodiments disclosed herein, this application can be implemented in hardware or a combination of hardware and computer software. Whether a function is executed in hardware or by computer software driving hardware depends on the specific application and design constraints of the technical solution. Those skilled in the art can use different methods to implement the described functions for each specific application, but such implementation should not be considered beyond the scope of this application.
[0171] This application embodiment can divide the apparatus for implementing the method into functional modules based on the above method examples. For example, each function can be divided into its own functional modules, or two or more functions can be integrated into one processing module. The integrated module can be implemented in hardware or as a software functional module. It should be noted that the module division in this application embodiment is illustrative and only represents one logical functional division; other division methods may be used in actual implementation.
[0172] like Figure 5 The diagram shows a chip structure according to an embodiment of this application. The chip 500 includes one or more processors 501, communication lines 502, communication interfaces 503, and memory 504.
[0173] In some implementations, memory 504 stores elements such as executable modules or data structures, or subsets thereof, or extended sets thereof.
[0174] The methods described in the embodiments of this application can be applied to, or implemented by, processor 501. Processor 501 may be an integrated circuit chip with signal processing capabilities. During implementation, each step of the above methods can be completed by integrated logic circuits in the hardware of processor 501 or by instructions in software form. Processor 501 may be a general-purpose processor (e.g., a microprocessor or conventional processor), a digital signal processor (DSP), an application-specific integrated circuit (ASIC), a field-programmable gate array (FPGA), or other programmable logic devices, discrete gates, transistor logic devices, or discrete hardware components. Processor 501 can implement or execute the various processing-related methods, steps, and logic block diagrams disclosed in the embodiments of this application.
[0175] The steps of the method disclosed in the embodiments of this application can be directly implemented by a hardware decoding processor, or implemented by a combination of hardware and software modules in the decoding processor. The software modules can be located in mature storage media in the art, such as random access memory, read-only memory, programmable read-only memory, or electrically erasable programmable read-only memory (EEPROM). This storage medium is located in memory 504, and the processor 501 reads the information in memory 504 and, in conjunction with its hardware, completes the steps of the above method.
[0176] The processor 501, memory 504 and communication interface 503 can communicate with each other through communication line 502.
[0177] In the above embodiments, the instructions stored in the memory for execution by the processor can be implemented in the form of a computer program product. This computer program product can be pre-written into the memory, or it can be downloaded and installed into the memory as software.
[0178] This application also provides a computer program product comprising one or more computer instructions. When the computer program instructions are loaded and executed on a computer, all or part of the flow or function according to the embodiments of this application is generated. The computer may be a general-purpose computer, a special-purpose computer, a computer network, or other programmable device. The computer instructions may be stored in a computer-readable storage medium or transmitted from one computer-readable storage medium to another. For example, computer instructions may be transmitted from a website site, computer, server, or data center to another website site, computer, server, or data center via wired (e.g., coaxial cable, fiber optic, digital subscriber line (DSL)) or wireless (e.g., infrared, wireless, microwave, etc.) means. The computer-readable storage medium may be any available medium that a computer can store or a data storage device such as a server or data center that integrates one or more available media. For example, available media may include magnetic media (e.g., floppy disk, hard disk, or magnetic tape), optical media (e.g., digital versatile disc (DVD)), or semiconductor media (e.g., solid-state disk (SSD)).
[0179] This application also provides a computer-readable storage medium. The methods described in the above embodiments can be implemented, in whole or in part, by software, hardware, firmware, or any combination thereof. The computer-readable medium may include computer storage media and communication media, and may also include any medium capable of transferring a computer program from one place to another. The storage medium can be any target medium accessible by a computer.
[0180] As one possible design, computer-readable media may include compact disc read-only memory (CD-ROM), RAM, ROM, EEPROM, or other optical disc storage; computer-readable media may also include disk storage or other disk storage devices. Furthermore, any connecting cable may also be appropriately referred to as computer-readable media. For example, if software is transmitted from a website, server, or other remote source using coaxial cable, fiber optic cable, twisted pair, DSL, or wireless technologies such as infrared, radio, and microwave, then coaxial cable, fiber optic cable, twisted pair, DSL, or wireless technologies such as infrared, radio, and microwave are included in the definition of media. As used herein, disks and optical discs include optical discs (CD), laser discs, optical discs, digital versatile discs (DVD), floppy disks, and Blu-ray discs, where disks typically reproduce data magnetically, while optical discs optically reproduce data using lasers.
[0181] This application describes embodiments with reference to flowchart illustrations and / or block diagrams of methods, apparatus (systems), and computer program products according to embodiments of this application. It should be understood that each block of the flowchart illustrations and / or block diagrams, and combinations of blocks in the flowchart illustrations and / or block diagrams, can be implemented by computer program instructions. These computer program instructions can be provided to a processing unit of a general-purpose computer, special-purpose computer, embedded processor, or other programmable data processing apparatus to produce a machine, such that the instructions, which execute via the processing unit of the computer or other programmable data processing apparatus, generate instructions for implementing the flowchart illustrations. Figure 1 One or more processes and / or boxes Figure 1 A device that provides the functions specified in one or more boxes.
Claims
1. A Bluetooth communication method, characterized by, The method comprises: The first electronic device establishes a Bluetooth connection with the second electronic device; At a first time, the first electronic device sends Bluetooth data to the second electronic device at a first frequency; At a second time, the first electronic device sends Bluetooth data to the second electronic device at a second frequency, which is switched from the first frequency; Wherein, the second time is later than the first time, the second frequency is higher than the first frequency, and the signal quality between the first electronic device and the second electronic device corresponding to the second time is worse than the signal quality between the first electronic device and the second electronic device corresponding to the first time.
2. The method of claim 1, wherein, The first frequency is one frequency used when the first electronic device is in a first mode; The second frequency is another frequency used when the first electronic device is in the first mode, or the second frequency is one frequency used when the first electronic device is in a second mode; Wherein, the interaction frequency of the first electronic device and the second electronic device in the second mode is greater than the interaction frequency of the first electronic device and the second electronic device in the first mode.
3. The method according to claim 1 or 2, characterized in that, The method further comprises: At a third time, the first electronic device sends Bluetooth data to the second electronic device at a third frequency, which is switched from the second frequency; Wherein, the third time is later than the second time, and the signal quality between the first electronic device and the second electronic device corresponding to the third time is better than the signal quality between the first electronic device and the second electronic device corresponding to the second time.
4. The method of claim 3, wherein, At the third time, the first electronic device is in the second mode, and the third frequency is greater than or equal to the second frequency; or, at the third time, the first electronic device is in the first mode, and the third frequency is less than or equal to the second frequency.
5. The method according to any one of claims 2-4, characterized in that, The first mode includes a Sniff mode in Bluetooth communication, and the second mode includes an Active mode in Bluetooth communication.
6. The method according to any one of claims 1 to 5, characterized in that, The signal quality between the first electronic device and the second electronic device includes one or more of the following: received signal strength indication (RSSI) between the first electronic device and the second electronic device, and the number of available channels between the first electronic device and the second electronic device.
7. The method of claim 6, wherein, The signal quality between the first electronic device and the second electronic device corresponding to the second time is worse than the signal quality between the first electronic device and the second electronic device corresponding to the first time, which includes: The received signal strength indication (RSSI) value between the first electronic device and the second electronic device corresponding to the second time is less than the received signal strength indication (RSSI) value between the first electronic device and the second electronic device corresponding to the first time; And / or, the number of available channels between the first electronic device and the second electronic device corresponding to the second time is less than the number of available channels between the first electronic device and the second electronic device corresponding to the first time.
8. The method according to claim 6 or 7, characterized in that, The signal quality between the first electronic device and the second electronic device corresponding to the second time is worse than the signal quality between the first electronic device and the second electronic device corresponding to the first time, including: The received signal strength indication (RSSI) value between the first electronic device and the second electronic device corresponding to the second time is less than a first threshold value, and the received signal strength indication (RSSI) value between the first electronic device and the second electronic device corresponding to the first time is greater than or equal to the first threshold value; And / or, the number of available channels between the first electronic device and the second electronic device corresponding to the second time is less than a second threshold value, and the number of available channels between the first electronic device and the second electronic device corresponding to the first time is greater than or equal to the second threshold value.
9. An electronic device, comprising: The electronic device includes one or more processors and a memory; The memory is coupled to the one or more processors, and the memory is configured to store computer program codes including computer instructions, and the one or more processors are configured to invoke the computer instructions to cause the electronic device to perform the method according to any one of claims 1-8.
10. A chip system, characterized by The chip system is applied to an electronic device, and the chip system includes one or more processors configured to invoke computer instructions to cause the electronic device to perform the method according to any one of claims 1-8.