Bluetooth communication method and device, electronic equipment and storage medium

By monitoring the type of Bluetooth process and using a locking mechanism to prioritize the scheduling of important processes, the latency problem caused by polling scheduling is solved, thereby improving the performance and stability of Bluetooth communication.

CN121968066APending Publication Date: 2026-05-01SPREADTRUM SEMICON(CHENGDU) CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
SPREADTRUM SEMICON(CHENGDU) CO LTD
Filing Date
2026-02-27
Publication Date
2026-05-01

AI Technical Summary

Technical Problem

In Bluetooth communication, polling scheduling causes important Bluetooth processes to be delayed, resulting in poor communication performance.

Method used

By monitoring the scheduling time of the Bluetooth process, the type of the real-time Bluetooth process is determined, and its scheduling is paused when it is determined to be a delayable process. A locking mechanism is used to prioritize the scheduling of important target Bluetooth processes until they are completed, and then the scheduling of the real-time Bluetooth process is resumed.

Benefits of technology

It improves Bluetooth communication performance, ensures timely processing of important Bluetooth processes, avoids delays and interruptions, and enhances the overall functional stability of the system.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121968066A_ABST
    Figure CN121968066A_ABST
Patent Text Reader

Abstract

The embodiment of the invention provides a Bluetooth communication method and device, electronic equipment and a storage medium. In response to monitoring that the scheduling moment of the target Bluetooth process arrives, determining a real-time Bluetooth process currently scheduled by the terminal device; determining a process type corresponding to the real-time Bluetooth process, wherein the process type is a delayable process or a non-delayable process; if the process type is a delayable process, pausing scheduling of the real-time Bluetooth process, and scheduling the target Bluetooth process through a lock mechanism; and recovering the scheduling of the real-time Bluetooth process until the scheduling of the target Bluetooth process is completed. According to the scheme, the scheduling sequence of the important target Bluetooth process is dynamically decided according to the process type of the real-time Bluetooth process, so that the important target Bluetooth process is preferentially processed, and the Bluetooth communication performance is improved.
Need to check novelty before this filing date? Find Prior Art

Description

Bluetooth communication methods, devices, electronic devices and storage media Technical Field

[0001] This application relates to the field of communication technology, and in particular to a Bluetooth communication method, apparatus, electronic device and storage medium. Background Technology

[0002] With the rapid development of Bluetooth technology, Bluetooth devices are being used in a wider range of scenarios, such as low power consumption, high sound quality support, and multi-device connectivity in audio transmission.

[0003] Bluetooth technology involves multiple Bluetooth processes. In scenarios where multiple Bluetooth processes coexist, how to schedule these processes is crucial for achieving high-performance Bluetooth communication. One related technology involves polling to schedule multiple Bluetooth processes.

[0004] However, polling scheduling can cause important Bluetooth processes to be delayed, leading to low Bluetooth communication performance. Summary of the Invention

[0005] This application provides Bluetooth communication methods, devices, electronic devices, and storage media to improve Bluetooth communication performance.

[0006] In a first aspect, embodiments of this application provide a Bluetooth communication method, comprising: in response to detecting the arrival of the scheduling time of a target Bluetooth process, determining a real-time Bluetooth process currently being scheduled by a terminal device; determining the process type corresponding to the real-time Bluetooth process, wherein the process type is a deferred process or a non-deferred process; if the process type is a deferred process, pausing the scheduling of the real-time Bluetooth process and scheduling the target Bluetooth process through a locking mechanism; and resuming the scheduling of the real-time Bluetooth process until the scheduling of the target Bluetooth process is completed.

[0007] In one possible implementation, determining the process type corresponding to the real-time Bluetooth process includes: determining the process identifier of the real-time Bluetooth process, the current load of the real-time Bluetooth process, and a load threshold; determining the load type of the real-time Bluetooth process based on the current load and the load threshold, wherein the load type indicates whether the real-time Bluetooth process is a high-load Bluetooth process; and determining the process type based on the process identifier and the load type.

[0008] In one possible implementation, after pausing the real-time Bluetooth process, the method further includes: determining a first identifier and a pause timestamp corresponding to the real-time Bluetooth process; generating a pause record based on the first identifier and the pause timestamp; and storing the pause record in a pause record queue.

[0009] In one possible implementation, resuming the real-time Bluetooth process includes: detecting whether the pause record queue is empty; if the pause record queue is not empty, extracting the pause record from the pause record queue and clearing the pause record from the pause record queue; extracting the first identifier from the pause record; determining the corresponding real-time Bluetooth process based on the first identifier, and resuming the real-time Bluetooth process.

[0010] In one possible implementation, scheduling the target Bluetooth process via a locking mechanism includes: determining a global scheduling identifier variable; updating the global scheduling identifier variable to indicate that the target Bluetooth process is being scheduled; and scheduling the target Bluetooth process via a locking mechanism.

[0011] In one possible implementation, scheduling the target Bluetooth process via a locking mechanism includes: sending a lock request for a hardware spinlock to a wireless radio frequency unit to reserve the radio frequency resources of the wireless radio frequency unit for Bluetooth services during data packet transmission of the target Bluetooth process, wherein the Bluetooth service and the wireless network service share the wireless radio frequency unit; scheduling the target Bluetooth process; and releasing the hardware spinlock after scheduling is completed.

[0012] In one possible implementation, after sending a lock request for a hardware spinlock to the wireless radio frequency unit, the method further includes: monitoring the interference intensity of the wireless network service on the wireless radio frequency unit; if the interference intensity is greater than or equal to an intensity threshold, extending the duration of the lock request; and if the interference intensity is less than the intensity threshold, shortening the duration of the lock request.

[0013] Secondly, embodiments of this application provide a Bluetooth communication device, comprising: a determining module, configured to determine a real-time Bluetooth process currently being scheduled by a terminal device in response to the arrival of a scheduling time for a target Bluetooth process; an identifying module, configured to determine the process type corresponding to the real-time Bluetooth process, wherein the process type is a delayable process or a non-delayable process; a scheduling module, configured to pause scheduling of the real-time Bluetooth process and schedule the target Bluetooth process through a locking mechanism if the process type is a delayable process; and a recovery module, configured to resume scheduling of the real-time Bluetooth process after the scheduling of the target Bluetooth process is completed.

[0014] In one possible implementation, the identification module is specifically configured to determine the process identifier of the real-time Bluetooth process, the current load of the real-time Bluetooth process, and the load threshold; the identification module is further configured to determine the load type of the real-time Bluetooth process based on the current load and the load threshold, wherein the load type indicates whether the real-time Bluetooth process is a high-load Bluetooth process; the identification module is further configured to determine the process type based on the process identifier and the load type.

[0015] In one possible implementation, the device further includes: a storage module, configured to determine a first identifier and a pause timestamp corresponding to the real-time Bluetooth process; the storage module is further configured to generate a pause record based on the first identifier and the pause timestamp; and the storage module is further configured to store the pause record in a pause record queue.

[0016] In one possible implementation, the apparatus further includes: an execution module, configured to detect whether the pause record queue is empty; the execution module is further configured to, if the pause record queue is not empty, extract the pause record from the pause record queue and clear the pause record from the pause record queue; the execution module is further configured to extract the first identifier from the pause record; the execution module is further configured to, based on the first identifier, determine the corresponding real-time Bluetooth process and resume scheduling the real-time Bluetooth process.

[0017] In one possible implementation, the apparatus further includes: a processing module for determining a global scheduling identifier variable; the processing module is further configured to update the global scheduling identifier variable to indicate that the target Bluetooth process is being scheduled; the processing module is further configured to schedule the target Bluetooth process via a locking mechanism.

[0018] In one possible implementation, the processing module is specifically configured to send a lock request for a hardware spinlock to the wireless radio frequency unit, so as to reserve the radio frequency resources of the wireless radio frequency unit in the Bluetooth service during the data packet transmission of the target Bluetooth process, wherein the Bluetooth service and the wireless network service share the wireless radio frequency unit; the processing module is further configured to schedule the target Bluetooth process and release the hardware spinlock after the scheduling is completed.

[0019] In one possible implementation, the apparatus further includes: an adjustment module for monitoring the interference intensity of the wireless network service on the wireless radio frequency unit; the adjustment module is further configured to extend the duration of the lock request if the interference intensity is greater than or equal to an intensity threshold; the adjustment module is further configured to shorten the duration of the lock request if the interference intensity is less than the intensity threshold.

[0020] Thirdly, embodiments of this application provide a Bluetooth communication device, including: a memory and a processor;

[0021] The memory stores computer-executed instructions;

[0022] The processor executes computer execution instructions stored in the memory, causing the processor to perform the first aspect and / or various possible implementations of the first aspect as described above.

[0023] Fourthly, embodiments of this application provide a non-volatile computer-readable storage medium storing computer-executable instructions, which, when executed by a processor, are used to implement the first aspect and / or various possible implementations of the first aspect.

[0024] Fifthly, embodiments of this application provide a computer program product, including a computer program that, when executed by a processor, implements the first aspect and / or various possible implementations of the first aspect.

[0025] The Bluetooth communication method, apparatus, electronic device, and storage medium provided in this application include: in response to detecting the arrival of the scheduling time of a target Bluetooth process, determining the real-time Bluetooth process currently being scheduled by the terminal device; determining the process type corresponding to the real-time Bluetooth process, wherein the process type is a deferred process or a non-deferred process; if the process type is a deferred process, pausing the scheduling of the real-time Bluetooth process and scheduling the target Bluetooth process through a locking mechanism; and resuming the scheduling of the real-time Bluetooth process after the scheduling of the target Bluetooth process is completed. This solution dynamically determines the scheduling order of important target Bluetooth processes based on the process type of the real-time Bluetooth process, prioritizing the processing of important target Bluetooth processes, thereby improving Bluetooth communication performance. Attached Figure Description

[0026] The accompanying drawings, which are incorporated in and form part of this specification, illustrate embodiments consistent with this application and, together with the description, serve to explain the principles of this application.

[0027] Figure 1 is a schematic diagram of an application scenario of a Bluetooth communication method provided in an embodiment of this application;

[0028] Figure 2 is a schematic diagram of a scenario where multiple Bluetooth processes coexist, as provided in an embodiment of this application.

[0029] Figure 3 is a schematic diagram of Bluetooth process collaboration provided in an embodiment of this application;

[0030] Figure 4 is a flowchart illustrating a Bluetooth communication method provided in an embodiment of this application;

[0031] Figure 5 is a flowchart illustrating another Bluetooth communication method provided in an embodiment of this application;

[0032] Figure 6 is a schematic diagram of the scheduling target Bluetooth process provided in an embodiment of this application;

[0033] Figure 7 is a schematic diagram of the scheduling target Bluetooth process provided in an embodiment of this application;

[0034] Figure 8 is a schematic diagram of the Bluetooth communication scheduling process provided in an embodiment of this application;

[0035] Figure 9 is a schematic diagram of a Bluetooth communication device provided in an embodiment of this application;

[0036] Figure 10 is a schematic diagram of another Bluetooth communication device provided in an embodiment of this application;

[0037] Figure 11 is a schematic diagram of the structure of an electronic device provided in an embodiment of this application.

[0038] The accompanying drawings illustrate specific embodiments of this application, which will be described in more detail below. These drawings and descriptions are not intended to limit the scope of the concept in any way, but rather to illustrate the concept of this application to those skilled in the art through reference to particular embodiments. Detailed Implementation

[0039] Exemplary embodiments will now be described in detail, examples of which are illustrated in the accompanying drawings. When the following description relates to the drawings, unless otherwise indicated, the same numbers in different drawings denote the same or similar elements. The embodiments described in the following exemplary embodiments do not represent all embodiments consistent with this application. Rather, they are merely examples of apparatuses and methods consistent with some aspects of this application as detailed in the appended claims.

[0040] 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, ac, bc, or abc, where a, b, and c can be single or multiple.

[0041] It should be noted that the phrase "at...time" in the embodiments of this application can refer to the instant at which a certain situation occurs, or to a period of time after the occurrence of a certain situation; the embodiments of this application do not specifically limit this. Furthermore, the display interface provided in the embodiments of this application is merely an example, and the display interface may include more or less content.

[0042] 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, stored data, displayed data, etc.) involved in this application are all information and data authorized by the user or fully authorized by all parties. Furthermore, the collection, use, processing, transmission, provision, disclosure, and application of related data all comply with relevant laws, regulations, and standards, necessary confidentiality measures have been taken, they do not violate public order and good morals, and corresponding operation entry points are provided for users to choose to authorize or refuse.

[0043] It should be noted that the Bluetooth communication method, apparatus, electronic device and storage medium of this application can be used in the field of communication technology, or in any field other than communication. The application field of the Bluetooth communication method, apparatus, electronic device and storage medium of this application is not limited.

[0044] Figure 1 is a schematic diagram of an application scenario of a Bluetooth communication method provided in an embodiment of this application. The following example illustrates the scenario: A Bluetooth device includes multiple Bluetooth processes: Bluetooth process A, Bluetooth process B, and Bluetooth process C. The Bluetooth processes are scheduled sequentially through radio frequency resources to achieve Bluetooth communication corresponding to each Bluetooth process.

[0045] Among them, the Bluetooth procedure is a series of standardized operation procedures defined in the Bluetooth protocol to complete a specific communication task.

[0046] For example, the Bluetooth process includes, but is not limited to, at least one of the following: Extended Advertising (EXT ADV), Classic Bluetooth Scan Inquiry, Bluetooth Low Energy Scan (LE Scan), Periodic Advertising (periodic ADV), and Broadcast Isochronous Group Music (BIG music).

[0047] Figure 2 illustrates a scenario where multiple Bluetooth processes coexist. These processes are scheduled according to preset periods and synchronization points to achieve Bluetooth communication. The Extended Broadcast Interval (ADV) represents the design period between two consecutive extended broadcasts. The Bluetooth Low Energy (BLE) Broadcast Audio Interval (BIG) represents the design period between two consecutive BLE audio broadcasts. The periodic ADV anchor marks the start of the periodic broadcast period; Bluetooth receiving devices must synchronize with the periodic ADV anchor to receive audio. The BLE audio anchor marks the start of the BLE audio period; Bluetooth receiving devices must synchronize with the BLE audio anchor to play audio without stuttering.

[0048] Referring to Figure 2, in related technologies, when the preset extended broadcast scheduling time (EXT ADV instant) arrives, the RF channel may be occupied by a Bluetooth Low Energy (BLE) scan. The extended broadcast must wait for the BLE scan to complete, causing it to be unable to schedule on time, resulting in a delay. Since the synchronization of periodic broadcasts and BLE broadcast audio directly or indirectly depends on the timely occurrence of the extended broadcast, the delay in the extended broadcast directly causes the synchronization time points of both periodic broadcasts and BLE broadcast audio to be shifted backward, disrupting the periodic timing of the entire communication chain.

[0049] Figure 3 illustrates the Bluetooth collaboration process. Extended Broadcast, as the initiator of the entire synchronization chain, periodically broadcasts a signal to announce its existence. Extended Broadcast sends an AUX_ADV_IND data packet, which includes the synchronization packet window offset `syncPacketWindowOffset`. This offset indicates the offset at which the receiving device will receive the next data packet; the timing precision of the synchronization packet window offset can be 30µs or 300µs. Periodic broadcasts occur at the precise moment calculated from the synchronization packet window offset. Periodic Broadcast also sends an AUX_SYNC_IND data packet, which includes all the parameters required for Bluetooth Low Energy audio broadcast (such as audio encoding format, encryption key, timing information, etc.). After successfully acquiring and parsing the AUX_SYNC_IND data packet, the receiving device can use the parameters to synchronize and decode high-quality synchronized audio streams.

[0050] Therefore, whether the extended broadcast is scheduled properly affects other Bluetooth processes. Polling scheduling can cause the extended broadcast to be delayed for too long, which in turn leads to low Bluetooth communication performance.

[0051] The Bluetooth communication method provided in this application aims to solve the above-mentioned technical problems in related technologies.

[0052] The technical solution of this application and how the technical solution of this application solves the above-mentioned technical problems are described in detail below with specific embodiments. These specific embodiments can be combined with each other, and the same or similar concepts or processes may not be described again in some embodiments. The embodiments of this application will now be described with reference to the accompanying drawings.

[0053] Figure 4 is a flowchart illustrating a Bluetooth communication method provided in an embodiment of this application. The method includes the following steps:

[0054] S401. In response to the arrival of the scheduling time of the target Bluetooth process, determine the real-time Bluetooth process that the terminal device is currently scheduling.

[0055] The executing entity of this application may be a terminal device with Bluetooth functionality.

[0056] As an example, the Bluetooth communication method is applied to a terminal device, or a chip or chip module within a terminal device.

[0057] For example, the terminal device continuously monitors a target Bluetooth process defined in the Bluetooth protocol, which has a preset scheduling time instant. When the arrival of the target Bluetooth process is detected, subsequent scheduling decisions are triggered.

[0058] For example, a real-time Bluetooth process is the Bluetooth process that the terminal device is currently scheduling.

[0059] Optionally, the target Bluetooth procedure can be an important Bluetooth procedure such as extended broadcast or periodic broadcast.

[0060] With the help of scenario examples, the delay of the target Bluetooth process can affect Bluetooth communication and lead to a decrease in Bluetooth communication performance. Flexible scheduling can be used to prioritize the target Bluetooth process.

[0061] S402. Determine the process type corresponding to the real-time Bluetooth process. The process type is either a delayable process or a non-delayable process.

[0062] For example, the process type is used to indicate whether the real-time Bluetooth process is an important, high-priority Bluetooth process, thereby determining whether the real-time Bluetooth process can be delayed.

[0063] For example, a deferred process refers to a process with a preset scheduling time, but the scheduling time can be postponed, such as a Bluetooth Low Energy scan. The scheduling of a deferred process is flexible and can be interrupted by a higher-priority Bluetooth process.

[0064] For example, a non-delayable process is a high-importance Bluetooth process defined by the Bluetooth protocol specification that cannot be interrupted by other Bluetooth processes.

[0065] With scenario examples, it is shown that by accurately identifying the process type of the real-time Bluetooth process, the scheduling order can be accurately adjusted to avoid interrupting important Bluetooth processes and affecting Bluetooth communication performance.

[0066] S403. If the process type is a delayable process, then pause the scheduling of the real-time Bluetooth process and schedule the target Bluetooth process through a locking mechanism.

[0067] For example, if a target Bluetooth process is detected and the real-time Bluetooth process is a delayable process, then the real-time Bluetooth process is paused. This avoids both the negative impact of pausing the real-time Bluetooth process and the delay of the important target Bluetooth process, thereby improving Bluetooth communication performance.

[0068] In practical applications, Bluetooth communication and wireless network communication (such as Wi-Fi) share the radio frequency resources of the terminal device. Pausing the scheduling of the real-time Bluetooth process can prevent the real-time Bluetooth process from affecting the target Bluetooth process; however, wireless network communication can still interfere with the target Bluetooth process.

[0069] With the help of scenario examples, active wireless network communication services and channel congestion increase the probability of data collisions or retransmissions, which may cause the actual execution time of the target Bluetooth process to exceed expectations.

[0070] For example, a locking mechanism is used to exclusively reserve radio frequency resources, preventing Wi-Fi from interrupting the real-time Bluetooth process. In other words, the locking mechanism solves the problem of external resource contention between Bluetooth and Wi-Fi.

[0071] Optionally, the locking mechanism can be a hardware spinlock.

[0072] S404. Once the target Bluetooth process scheduling is completed, resume scheduling the real-time Bluetooth process.

[0073] Optionally, the target Bluetooth process is considered complete when the entire radio frequency transaction of the target Bluetooth process has been confirmed as finished. At this point, the lock is released, and the target Bluetooth process no longer occupies radio frequency resources.

[0074] For example, the process of resuming scheduling involves querying the context information of the previously saved suspended process, reloading it into the scheduling queue, and continuing execution from the point where it was interrupted.

[0075] With scenario examples, after ensuring the timeliness and reliability of high-priority services, low-priority services that have been preempted can continue seamlessly, ensuring that the overall function of the system is not affected and maintaining the normal operation of multiple services coexisting.

[0076] The Bluetooth communication method provided in this application, in response to the arrival of the scheduling time of the target Bluetooth process, determines the real-time Bluetooth process currently being scheduled by the terminal device; determines the process type corresponding to the real-time Bluetooth process, which is either a deferred process or a non-deferred process; if the process type is a deferred process, the scheduling of the real-time Bluetooth process is paused, and the target Bluetooth process is scheduled through a locking mechanism; the scheduling of the real-time Bluetooth process is resumed only after the scheduling of the target Bluetooth process is completed. This scheme dynamically determines the scheduling order of important target Bluetooth processes based on the process type of the real-time Bluetooth process, prioritizing the processing of important target Bluetooth processes, thereby improving Bluetooth communication performance.

[0077] Based on any of the above embodiments, the detailed process of Bluetooth communication will be described below with reference to Figure 5.

[0078] Figure 5 is a flowchart illustrating another Bluetooth communication method provided in an embodiment of this application. As shown in Figure 5, the method includes:

[0079] S501, In response to the arrival of the scheduling time of the target Bluetooth process, determine the real-time Bluetooth process that the terminal device is currently scheduling.

[0080] It should be noted that the execution process of S501 is the same as that of S401, and will not be repeated here.

[0081] S502, determine the process identifier of the real-time Bluetooth process, the current load of the real-time Bluetooth process, and the load threshold.

[0082] For example, a unique process identifier is pre-configured for each Bluetooth process, and different Bluetooth processes are distinguished by the process identifier.

[0083] For example, the current load represents the actual usage of system resources by the real-time Bluetooth process at the current moment.

[0084] Optionally, the current load includes, but is not limited to, at least one of the following: data throughput, processor utilization, or buffer utilization.

[0085] For example, the load threshold is a preset threshold value used to distinguish between high load and low load.

[0086] S503. Based on the current load and load threshold, determine the load type of the real-time Bluetooth process. The load type indicates whether the real-time Bluetooth process is a high-load Bluetooth process.

[0087] For example, load is dynamically assessed by comparing the current load with a load threshold. If the current load consistently exceeds the load threshold, the real-time Bluetooth process is determined to be a high-load Bluetooth process.

[0088] S504. Determine the process type based on the process identifier and load type.

[0089] For example, the priority of a real-time Bluetooth process is determined based on the process identifier.

[0090] Optionally, real-time Bluetooth processes that perform critical or intensive tasks can be assigned high priority.

[0091] For example, the process type corresponding to a real-time Bluetooth process can be determined by combining priority and load type.

[0092] With the example of the scenario, if the real-time Bluetooth process is a high-priority and high-load Bluetooth process, then the process type is determined to be a non-delayable process to avoid affecting important Bluetooth communications.

[0093] Based on the above implementation methods, by using multi-dimensional discrimination, we ensure that important Bluetooth processes are executed first, thereby improving Bluetooth communication performance.

[0094] S505. If the process type is a delayable process, then pause the scheduling of the real-time Bluetooth process.

[0095] One feasible implementation, after pausing the real-time Bluetooth scheduling process, may further include: determining the first identifier and pause timestamp corresponding to the real-time Bluetooth process; generating a pause record based on the first identifier and pause timestamp; and storing the pause record in a pause record queue.

[0096] For example, the first identifier serves as a unique identifier for the suspended Bluetooth process. The first identifier explicitly indicates which Bluetooth process has been suspended.

[0097] Optionally, the first identifier can be an identifier or type code pointing to a specific Bluetooth process instance.

[0098] For example, a pause timestamp records the precise moment when the pause action occurred.

[0099] For example, the first identifier and the pause timestamp are encapsulated into a structured data entry, namely the pause record. The pause record is the core basis for subsequent recovery operations.

[0100] Optionally, generating a pause record is an atomic operation, ensuring that the pause record is consistent with the suspended state of the real-time Bluetooth process.

[0101] For example, the pause record queue is a specific storage area maintained by the system that stores pause records.

[0102] Optionally, the pause record queue can be managed according to a "first-in, first-out" management strategy.

[0103] S506. Determine the global scheduling identifier variable.

[0104] For example, the global scheduling identifier variable is a software variable stored in shared memory that can be accessed by multiple related modules within the system.

[0105] For example, the global scheduler is a unique status indicator for the currently running scheduled task.

[0106] With the help of scenario examples, the global scheduling flag variable can be: "Idle", "Scheduling LE Scan", "Scheduling EXT ADV", "Scheduling periodic ADV", etc.

[0107] S507. Update the global scheduling flag variable to indicate that the target Bluetooth process is being scheduled.

[0108] For example, the value of the global scheduling flag variable is updated in an atomic operation to indicate "scheduling target Bluetooth process".

[0109] For example, updating the global scheduling identifier occurs before the target Bluetooth scheduling process, thus standardizing a scheduling action as a single transaction. This ensures that other modules see a consistent state with the actual situation in a multi-core or interrupt-driven environment, avoiding logical errors caused by operational conflicts.

[0110] Based on the above implementation, when scheduling anomalies, deadlocks, or performance issues occur, the global scheduling flag variable provides a transient state snapshot. Debugging tools or logs can read it to immediately know what the system was attempting to execute at the time of the failure, thereby reducing the difficulty of problem localization.

[0111] S508 schedules the target Bluetooth process through a locking mechanism.

[0112] For example, the lock mechanism-related processes are executed only after the global scheduling identifier variable has been updated.

[0113] The process of scheduling the target Bluetooth will be explained below with reference to Figure 6.

[0114] Figure 6 is a schematic diagram of the target Bluetooth scheduling process provided in an embodiment of this application. As shown in Figure 6, during the Bluetooth process polling scheduling process, if the arrival of a target Bluetooth process, such as the extended broadcast scheduling time (EXTADV instant), is detected during the LE Scan transmission and reception interval, the LE Scan scheduling is immediately paused, and preemptive scheduling of the extended broadcast is performed. The global scheduling flag variable is updated, and the preempted LE Scan is recorded in the pause record queue.

[0115] Comparing Figures 2 and 4, it can be seen that preemptive scheduling can promptly schedule important and temporarily arriving target Bluetooth processes, thereby improving Bluetooth communication performance.

[0116] One feasible implementation method is to schedule the target Bluetooth process through a locking mechanism, including: sending a lock request for a hardware spinlock to the radio frequency unit to reserve the radio frequency resources of the radio frequency unit for Bluetooth service during the data packet transmission of the target Bluetooth process, wherein the Bluetooth service and the wireless network service share the radio frequency unit; scheduling the target Bluetooth process, and releasing the hardware spinlock after the scheduling is completed.

[0117] For example, the wireless radio frequency unit is a physical radio frequency front-end hardware, and the hardware spinlock is a hardware-implemented mutex integrated into the Bluetooth and WIFI coexistence management module (which can be a hardware arbiter or coprocessor).

[0118] Send a lock request for a hardware spinlock to the wireless radio frequency unit to instruct that the right to use radio frequency resources be forcibly reserved for the Bluetooth service during the data packet transmission of the target Bluetooth process that is about to begin.

[0119] For example, this is executed after successfully acquiring the hardware spinlock. Holding the lock means that the Bluetooth side has been authorized by the coexistence management module. During the lock holding period, the transmission requests from the WIFI side will be blocked or delayed by the hardware logic and will not be able to preempt radio frequency resources.

[0120] For example, under the protection of the lock, the complete transmission process of the target Bluetooth procedure begins. This includes acquiring data from the protocol stack, baseband processing, and finally driving the RF front end to transmit data packets at the specified power and frequency. This process completely avoids the risk of interruption by Wi-Fi services during transmission.

[0121] For example, the criterion for determining the completion of scheduling is to confirm that the data packets of the target Bluetooth process have been completely transmitted.

[0122] For example, after scheduling is completed, a release command is sent to the coexistence management module. The hardware spinlock is released, the exclusive state of the radio frequency resources ends, the coexistence management module resumes normal logic, and allows the WIFI service to request and use the resources in the next time window.

[0123] The process of scheduling the target Bluetooth will be explained below with reference to Figure 7.

[0124] Figure 7 is a schematic diagram of the target Bluetooth scheduling process provided in an embodiment of this application. As shown in Figure 7, it is pre-agreed that during the target Bluetooth process, such as when Extended Broadcast (EXT ADV) is executed, the radio frequency resources can only be switched back to the Wi-Fi service after the Wi-Fi service detects the release of the lock. After the Extended Broadcast performs the locking operation, the radio frequency resources are locked on the Bluetooth side until the Extended Broadcast is completely transmitted before the lock is released, thereby avoiding conflicts between the Wi-Fi service and the Bluetooth service.

[0125] The Bluetooth communication scheduling process will now be explained with reference to Figure 8.

[0126] Figure 8 is a schematic diagram of the Bluetooth communication scheduling process provided in an embodiment of this application. As shown in Figure 8, multiple Bluetooth processes are scheduled in a round-robin fashion, and the scheduling time of the target Bluetooth process is checked. If it has not arrived, the multiple Bluetooth processes are scheduled in a round-robin fashion. If it has arrived, the target Bluetooth process is preemptively scheduled and locked. After the target Bluetooth process is scheduled, the lock is released and the multiple Bluetooth processes are scheduled in a round-robin fashion again.

[0127] In this feasible implementation, a protection window established at the physical layer through a locking mechanism ensures that the target Bluetooth process data packets can be transmitted completely and without interruption or loss, thereby improving Bluetooth communication performance.

[0128] One feasible implementation, after sending a hardware spinlock lock request to the wireless radio frequency unit, may further include: monitoring the interference intensity of wireless network services on the wireless radio frequency unit; if the interference intensity is greater than or equal to an intensity threshold, extending the duration of the lock request; if the interference intensity is less than the intensity threshold, shortening the duration of the lock request.

[0129] For example, interference intensity is a quantitative indicator used to assess the strength of competition for radio frequency resources by Wi-Fi services at any given moment.

[0130] Optionally, the interference strength can be obtained by the following methods: by obtaining it through the status register of the coexistence management module, by obtaining it through real-time monitoring of the bit error rate or signal quality of the Bluetooth link, or by determining it by counting the number of times the WIFI service attempts to preempt the Bluetooth time slot in the recent period.

[0131] For example, interference strength greater than or equal to the strength threshold indicates active Wi-Fi traffic, channel congestion, and a significantly increased probability of data collisions or the need for preamble retransmission. This may cause the actual reliable transmission time of the target Bluetooth process to exceed the theoretical minimum. Extending the lockout duration adds a safety margin to data transmission to cope with transmission delays, rate drops, or instantaneous retransmissions that may occur in high-interference environments, ensuring that even under the worst-case scenario, the target Bluetooth process's data packets have sufficient time to complete a complete and reliable transmission.

[0132] For example, if the interference intensity is greater than or equal to the intensity threshold, it indicates that the Wi-Fi activity is slight, the channel is relatively idle, and the transmission process is highly likely to be successful. In this case, if a fixed long protection window designed for high-interference environments is still used, a meaningless period of resource idleness will occur after the data packet is successfully transmitted. Shortening the lockout duration allows the RF resources to be released immediately after the transmission is confirmed, making them available for other services, thereby improving resource turnover and overall system efficiency.

[0133] This feasible implementation avoids resource waste in low-interference scenarios and prevents transmission failures and subsequent retransmissions due to insufficient protection in high-interference scenarios by dynamically adjusting the duration of lock requests. This improves Bluetooth communication performance.

[0134] S509. Once the target Bluetooth process scheduling is completed, resume scheduling the real-time Bluetooth process.

[0135] One feasible implementation method is to resume the real-time Bluetooth scheduling process by: detecting whether the pause record queue is empty; if the pause record queue is not empty, retrieving pause records from the pause record queue and clearing the pause records from the pause record queue; retrieving a first identifier from the pause record; determining the corresponding real-time Bluetooth process based on the first identifier and resuming the real-time Bluetooth scheduling process.

[0136] For example, checking whether the paused recording queue is empty is used as a safety trigger condition for the resumption operation. After the target Bluetooth process is completed, the paused recording queue is checked first.

[0137] If the pause record queue is empty, it means there are no suspended tasks that need to be resumed, and subsequent scheduling will be executed in sequence.

[0138] If the pause record queue is not empty, it means that at least one preempted task is suspended. Following the first-in, first-out (FIFO) principle, the earliest stored record is retrieved from the head of the pause record queue.

[0139] For example, the paused record is parsed to extract the first identifier. Based on the first identifier, a unique corresponding real-time Bluetooth process can be determined, and the real-time Bluetooth process can be resumed.

[0140] In this feasible implementation, the recovery scheduling is paired with the preemption record mechanism to ensure that each preemption has one and only one corresponding recovery, and the recovery state is accurate, thereby improving Bluetooth communication performance.

[0141] Figure 9 is a schematic diagram of a Bluetooth communication device provided in an embodiment of this application. As shown in Figure 9, the Bluetooth communication device 90 may include: a determination module 91, an identification module 92, a scheduling module 93, and a recovery module 94.

[0142] The determination module 91 is used to determine the real-time Bluetooth process that the terminal device is currently scheduling in response to the arrival of the scheduling time of the detected target Bluetooth process;

[0143] The identification module 92 is used to determine the process type corresponding to the real-time Bluetooth process, which is either a delayable process or a non-delayable process.

[0144] The scheduling module 93 is used to pause the scheduling of the real-time Bluetooth process and schedule the target Bluetooth process through a locking mechanism if the process type is a delayable process.

[0145] Recovery module 94 is used to resume the real-time Bluetooth process until the target Bluetooth process is completed.

[0146] Optionally, the determining module 91 may execute S401 in the embodiment of FIG4.

[0147] Optionally, the identification module 92 may execute S402 in the embodiment of FIG4.

[0148] Optionally, the scheduling module 93 can execute S403 in the embodiment of FIG4.

[0149] Optionally, the recovery module 94 can execute S404 in the embodiment of FIG4.

[0150] It should be noted that the Bluetooth communication device shown in the embodiments of this application can execute the technical solutions shown in the above method embodiments, and its implementation principle and beneficial effects are similar, so they will not be described again here.

[0151] In one possible implementation, the identification module 92 is specifically used for:

[0152] Determine the process identifier, current load, and load threshold of the real-time Bluetooth process;

[0153] Based on the current load and load threshold, determine the load type of the real-time Bluetooth process. The load type indicates whether the real-time Bluetooth process is a high-load Bluetooth process.

[0154] Determine the process type based on the process identifier and load type.

[0155] Figure 10 is a schematic diagram of another Bluetooth communication device provided in an embodiment of this application. Based on the embodiment shown in Figure 9, as shown in Figure 10, the Bluetooth communication device 90 further includes: a storage module 95, an execution module 96, a processing module 97, and an adjustment module 98.

[0156] Storage module 95, used for:

[0157] Determine the first identifier and pause timestamp corresponding to the real-time Bluetooth process;

[0158] Generate a pause record based on the first identifier and the pause timestamp;

[0159] Store paused records in the paused record queue.

[0160] Execution module 96 is used for:

[0161] Check if the pause record queue is empty;

[0162] If the pause record queue is not empty, then retrieve pause records from the pause record queue and clear pause records from the pause record queue;

[0163] Extract the first identifier from the pause record;

[0164] The corresponding real-time Bluetooth process is determined based on the first identifier, and the real-time Bluetooth process is resumed.

[0165] Processing module 97 is used for:

[0166] Determine the global scheduling identifier variable;

[0167] Update the global scheduling flag variable to indicate that the target Bluetooth process is being scheduled.

[0168] The target Bluetooth process is scheduled through a locking mechanism.

[0169] In one possible implementation, the processing module 97 is specifically used for:

[0170] Send a lock request for a hardware spinlock to the radio frequency unit to reserve the radio frequency resources of the radio frequency unit for Bluetooth service during the data packet transmission of the target Bluetooth process. The Bluetooth service and the wireless network service share the radio frequency unit.

[0171] Schedule the target Bluetooth process and release the hardware spinlock after scheduling is complete.

[0172] Adjustment module 98 is used for:

[0173] Monitor the interference intensity of wireless network services on the wireless radio frequency unit;

[0174] If the interference intensity is greater than or equal to the intensity threshold, the duration of the lock request will be extended.

[0175] If the interference intensity is less than the intensity threshold, the duration of the lock request is shortened.

[0176] Figure 11 is a schematic diagram of the structure of an electronic device provided in an embodiment of this application. As shown in Figure 11, the electronic device includes:

[0177] The electronic device includes a processor 291 and a memory 292; it may also include a communication interface 293 and a bus 294. The processor 291, memory 292, and communication interface 293 can communicate with each other via the bus 294. The communication interface 293 can be used for information transmission. The processor 291 can invoke logical instructions stored in the memory 292 to execute the methods of the above embodiments.

[0178] Furthermore, the logic instructions in the aforementioned memory 292 can be implemented as software functional units and, when sold or used as independent products, can be stored in a computer-readable storage medium.

[0179] The memory 292, as a non-volatile computer-readable storage medium, can be used to store software programs and computer-executable programs, such as program instructions / modules corresponding to the methods in the embodiments of this application. The processor 291 executes functional applications and data processing by running the software programs, instructions, and modules stored in the memory 292, that is, it implements the methods in the above-described method embodiments.

[0180] The memory 292 may include a program storage area and a data storage area. The program storage area may store the operating system and application programs required for at least one function; the data storage area may store data created based on the use of the terminal device. Furthermore, the memory 292 may include high-speed random access memory and may also include non-volatile memory.

[0181] This application provides a non-volatile computer-readable storage medium storing computer-executable instructions, which, when executed by a processor, are used to implement the method as described in the foregoing embodiments.

[0182] This application provides a computer program product, including a computer program that, when executed by a processor, implements the method as described in the foregoing embodiments.

[0183] This application provides a chip, which includes at least one processor and an interface circuit. The interface circuit and the at least one processor are connected, and the processor executes the method of the aforementioned embodiment by running program instructions.

[0184] It should be noted that, for the sake of simplicity, the foregoing method embodiments are all described as a series of actions. However, those skilled in the art should understand that this application is not limited to the described order of actions, as some steps may be performed in other orders or simultaneously according to this application. Furthermore, those skilled in the art should also understand that the embodiments described in the specification are all optional embodiments, and the actions and modules involved are not necessarily essential to this application.

[0185] It should be further noted that although the steps in the flowchart are shown sequentially according to the arrows, these steps are not necessarily executed in the order indicated by the arrows. Unless explicitly stated herein, there is no strict order restriction on the execution of these steps; they can be executed in other orders. Moreover, at least some steps in the flowchart may include multiple sub-steps or multiple stages, which do not necessarily complete at the same time but can be executed at different times. The execution order of these sub-steps or stages is also not necessarily sequential but can be alternated or carried out in turn with other steps or at least some of the sub-steps or stages of other steps.

[0186] It should be understood that the above-described device embodiments are merely illustrative, and the device of this application can also be implemented in other ways. For example, the division of units / modules in the above embodiments is only a logical functional division, and there may be other division methods in actual implementation. For example, multiple units, modules, or components may be combined, or integrated into another system, or some features may be ignored or not executed.

[0187] Furthermore, unless otherwise specified, the functional units / modules in the various embodiments of this application can be integrated into one unit / module, or each unit / module can exist physically separately, or two or more units / modules can be integrated together. The integrated units / modules described above can be implemented in hardware or as software program modules.

[0188] When integrated units / modules are implemented in hardware, the hardware can be digital circuits, analog circuits, etc. The physical implementation of the hardware structure includes, but is not limited to, transistors, memristors, etc. The processor can be any suitable hardware processor, such as CPU, GPU, FPGA, DSP, and ASIC. The storage unit can be any suitable magnetic or magneto-optical storage medium, such as Resistive Random Access Memory (RRAM), Dynamic Random Access Memory (DRAM), Static Random Access Memory (SRAM), Enhanced Dynamic Random Access Memory (EDRAM), High-Bandwidth Memory (HBM), Hybrid Memory Cube (HMC), etc.

[0189] If the integrated unit / module is implemented as a software program module and sold or used as an independent product, it can be stored in a computer-readable storage device (CMD). Based on this understanding, the technical solution of this application, in essence, or the part that contributes to related technologies, or all or part of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a memory and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute all or part of the steps of the methods of the various embodiments of this application. The aforementioned memory includes various media capable of storing program code, such as a USB flash drive, read-only memory (ROM), random access memory (RAM), portable hard drive, magnetic disk, or optical disk.

[0190] In the above embodiments, the descriptions of each embodiment have their own emphasis. For parts not described in detail in a certain embodiment, please refer to the relevant descriptions of other embodiments. The technical features of the above embodiments can be combined arbitrarily. For the sake of brevity, not all possible combinations of the technical features in the above embodiments are described. However, as long as the combination of these technical features does not contradict each other, it should be considered within the scope of this specification.

[0191] Other embodiments of this application will readily occur to those skilled in the art upon consideration of the specification and practice of the invention disclosed herein. This application is intended to cover any variations, uses, or adaptations of this application that follow the general principles of this application and include common knowledge or customary techniques in the art not disclosed herein. The specification and examples are to be considered exemplary only, and the true scope and spirit of this application are indicated by the claims.

[0192] It should be understood that this application is not limited to the precise structure described above and shown in the accompanying drawings, and various modifications and changes can be made without departing from its scope. The scope of this application is limited only by the appended claims.

Claims

1. A Bluetooth communication method, characterized in that, include: In response to the arrival of the scheduling time of the target Bluetooth process, determine the real-time Bluetooth process that the terminal device is currently scheduling; The process type corresponding to the real-time Bluetooth process is determined, and the process type is either a delayable process or a non-delayable process; if the process type is a delayable process, the scheduling of the real-time Bluetooth process is paused, and the target Bluetooth process is scheduled through a locking mechanism; until the scheduling of the target Bluetooth process is completed, the scheduling of the real-time Bluetooth process is resumed.

2. The method according to claim 1, characterized in that, Determining the process type corresponding to the real-time Bluetooth process includes: determining the process identifier of the real-time Bluetooth process, the current load of the real-time Bluetooth process, and the load threshold; determining the load type of the real-time Bluetooth process based on the current load and the load threshold, wherein the load type indicates whether the real-time Bluetooth process is a high-load Bluetooth process; and determining the process type based on the process identifier and the load type.

3. The method according to claim 1, characterized in that, After pausing the real-time Bluetooth process, the method further includes: determining a first identifier and a pause timestamp corresponding to the real-time Bluetooth process; generating a pause record based on the first identifier and the pause timestamp; and storing the pause record in a pause record queue.

4. The method according to claim 3, characterized in that, Resuming the real-time Bluetooth process includes: detecting whether the pause record queue is empty; if the pause record queue is not empty, extracting the pause record from the pause record queue and clearing the pause record from the pause record queue; extracting the first identifier from the pause record; determining the corresponding real-time Bluetooth process based on the first identifier, and resuming the scheduling of the real-time Bluetooth process.

5. The method according to any one of claims 1-4, characterized in that, Scheduling the target Bluetooth process using a locking mechanism includes: determining a global scheduling identifier variable; updating the global scheduling identifier variable to indicate that the target Bluetooth process is being scheduled; and scheduling the target Bluetooth process using a locking mechanism.

6. The method according to claim 5, characterized in that, Scheduling the target Bluetooth process via a locking mechanism includes: sending a lock request for a hardware spinlock to the radio frequency unit to reserve the radio frequency resources of the radio frequency unit in the Bluetooth service during the data packet transmission of the target Bluetooth process, wherein the Bluetooth service and the wireless network service share the radio frequency unit; scheduling the target Bluetooth process, and releasing the hardware spinlock after scheduling is completed.

7. The method according to claim 6, characterized in that, After sending a hardware spinlock lock request to the wireless radio frequency unit, the method further includes: monitoring the interference intensity of the wireless network service on the wireless radio frequency unit; if the interference intensity is greater than or equal to an intensity threshold, extending the duration of the lock request; if the interference intensity is less than the intensity threshold, shortening the duration of the lock request.

8. A Bluetooth communication device, characterized in that, include: The determination module is used to determine the real-time Bluetooth process that the terminal device is currently scheduling in response to the arrival of the scheduling time of the detected target Bluetooth process; The identification module is used to determine the process type corresponding to the real-time Bluetooth process, wherein the process type is a delayable process or a non-delayable process; the scheduling module is used to pause the scheduling of the real-time Bluetooth process and schedule the target Bluetooth process through a locking mechanism if the process type is a delayable process; the recovery module is used to resume the scheduling of the real-time Bluetooth process after the scheduling of the target Bluetooth process is completed.

9. An electronic device, characterized in that, include: A processor, and a memory communicatively connected to the processor; The memory stores computer-executable instructions; the processor executes the computer-executable instructions stored in the memory to implement the method as described in any one of claims 1-7.

10. A non-volatile computer-readable storage medium, characterized in that, The non-volatile computer-readable storage medium stores computer-executable instructions, which, when executed by a processor, are used to implement the method as described in any one of claims 1-7.