WO2025260847A1 - Collaborative processing method and apparatus for multiple bluetooth hosts, device, and storage medium - Google Patents
Collaborative processing method and apparatus for multiple bluetooth hosts, device, and storage mediumInfo
- Publication number
- WO2025260847A1 WO2025260847A1 PCT/CN2025/081693 CN2025081693W WO2025260847A1 WO 2025260847 A1 WO2025260847 A1 WO 2025260847A1 CN 2025081693 W CN2025081693 W CN 2025081693W WO 2025260847 A1 WO2025260847 A1 WO 2025260847A1
- Authority
- WO
- WIPO (PCT)
- Prior art keywords
- bluetooth
- bluetooth host
- host
- operation information
- instruction
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Pending
Links
Classifications
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04W—WIRELESS COMMUNICATION NETWORKS
- H04W4/00—Services specially adapted for wireless communication networks; Facilities therefor
- H04W4/80—Services using short range communication, e.g. near-field communication [NFC], radio-frequency identification [RFID] or low energy communication
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04W—WIRELESS COMMUNICATION NETWORKS
- H04W76/00—Connection management
- H04W76/10—Connection setup
- H04W76/14—Direct-mode setup
Definitions
- This application relates to the field of communication technology, and in particular to a method, apparatus, device and storage medium for collaborative processing of multiple Bluetooth hosts.
- Bluetooth communication technology In the field of communication technology, Bluetooth communication technology, with its characteristics of standardization, low power consumption, and multiple connections, has been widely used in various fields, such as smart homes, smartphones, wearable devices, and automotive infotainment systems.
- devices with multiple Bluetooth hosts coexisting collaboratively, since all multiple Bluetooth hosts interact with the same Bluetooth controller on the device, collaborative processing is required among the multiple Bluetooth hosts to avoid conflicts arising from simultaneous interactions.
- multiple Bluetooth hosts collaborate using a negotiated time-sharing working mode.
- the first Bluetooth host has control of the Bluetooth controller, it interacts with the Bluetooth controller, and the second Bluetooth host is not working. After the first Bluetooth host finishes its work, it hands over control to the second Bluetooth host, and the second Bluetooth host begins to interact with the Bluetooth controller, at which point the first Bluetooth host stops working.
- the aforementioned negotiated time-sharing working mode requires switching control of the Bluetooth controller back and forth between two Bluetooth hosts. Only one Bluetooth host can work at a time, resulting in low efficiency of the Bluetooth system and making it unsuitable for scenarios where multiple Bluetooth hosts work in parallel.
- This application provides a method, apparatus, device, and storage medium for collaborative processing of multiple Bluetooth hosts, used to enable multiple Bluetooth hosts to work in parallel.
- a collaborative processing method for multiple Bluetooth hosts includes: before a first Bluetooth host executes a first operation instruction, acquiring first operation information of a second Bluetooth host, the first operation information indicating the operation state of the second Bluetooth host; and, if the operation state of the second Bluetooth host does not conflict with the first operation instruction, interacting with a Bluetooth controller to execute the first operation instruction.
- the second Bluetooth host and the first Bluetooth host are connected to the same Bluetooth controller, meaning this method is applicable to scenarios where two Bluetooth hosts coexist.
- this method is also applicable to scenarios where two or more Bluetooth hosts coexist.
- the first Bluetooth host first obtains the operation information of the second Bluetooth host. This means the second Bluetooth host can work simultaneously with the first Bluetooth host. Only after confirming there is no conflict will the operation command be executed, rather than executing it directly. This avoids conflicts caused by multiple Bluetooth hosts executing operation commands simultaneously, achieving orderly scheduling of operation commands and thus enabling parallel operation of multiple Bluetooth hosts.
- the operation status can indicate the execution status of the operation command.
- the operation status includes "operating,” "operation completed,” or "idle.”
- the first operation information includes a first flag indicating that the operation status of the second Bluetooth host is "operation completed”; or, the first operation information includes a second flag indicating that the operation status of the second Bluetooth host is "idle.”
- the absence of conflict between the operation status of the second Bluetooth host and the first operation command means that the execution status of the second Bluetooth host's operation command does not affect the execution of the first Bluetooth host's first operation command.
- the second Bluetooth host does not execute operation commands that conflict with the first operation command, resulting in a higher success rate for the first Bluetooth host to execute the first operation command under these conflict-free conditions.
- the method of obtaining the first operation information of the second Bluetooth host may include: sending a first query instruction to the second Bluetooth host, the first query instruction being used by the second Bluetooth host to send the first operation information of the second Bluetooth host to the first Bluetooth host; and receiving the first operation information sent by the second Bluetooth host.
- the operation information of the other Bluetooth host is obtained, realizing collaborative interaction between multiple Bluetooth hosts. Since the first operation information obtained by querying is the operation information of the other Bluetooth host's response, the accuracy of the first operation information can be guaranteed, making the reliability of the obtained first operation information higher.
- the first query command is used by the second Bluetooth host to send first operation information to the first Bluetooth host when there is no conflict between the second Bluetooth host's operating state and the first operation command.
- the first operation information indicates that there is no conflict between the second Bluetooth host's operating state and the first operation command.
- a response is only sent when there is no conflict between the second Bluetooth host's operating state and the first operation command, avoiding the need to resend the query command if a conflict arises between the response's operating state and the first operation command. That is, one query command is sent for each operation command, and the operation command can be executed only after a response to the query command, ensuring that no conflict occurs where operation commands are executed simultaneously.
- a second operation message is sent to the second Bluetooth host.
- the second operation message instructs the first Bluetooth host to complete the execution of the first operation instruction.
- the first Bluetooth host records collaboration information, which indicates first operation information of the second Bluetooth host.
- obtaining the first operation information of the second Bluetooth host can include reading the collaboration information recorded by the first Bluetooth host to obtain the first operation information of the second Bluetooth host.
- the first operation information can be obtained quickly, improving the efficiency of obtaining the first operation information.
- coordination information is recorded before acquiring the first operation information of the second Bluetooth host.
- a second query command is received, which is sent before the second Bluetooth host executes the second operation command; third operation information is sent to the second Bluetooth host, indicating that the operation status of the first Bluetooth host does not conflict with the second operation command; and fourth operation information is recorded on the first Bluetooth host as coordination information, indicating that the second Bluetooth host is executing the second operation command.
- a fifth operation information is received, which is sent to the first Bluetooth host after the second operation command has been executed, indicating that the second Bluetooth host has completed the second operation command; and the fifth operation information of the second Bluetooth host is recorded on the first Bluetooth host as coordination information.
- the second Bluetooth host before executing the second operation command, the second Bluetooth host also queries the first Bluetooth host for its operation information. Since the second Bluetooth host begins executing the second operation command after the first Bluetooth host responds with the third operation information, the fourth operation information indicating that the second Bluetooth host is executing the second operation command can be recorded as coordination information. Furthermore, the second Bluetooth host will also notify the first Bluetooth host after completing the second operation command; therefore, the fifth operation information indicating that the second Bluetooth host has completed the second operation command can be recorded as coordination information. This achieves real-time recording of coordination information, enabling real-time synchronization of operation information among multiple Bluetooth hosts.
- the absence of conflict between the operating state of the second Bluetooth host and the first operation instruction includes: the second Bluetooth host not executing an operation instruction of the same type as the first operation instruction. This approach avoids multiple Bluetooth hosts simultaneously executing the same type of operation instruction, while allowing different types of operation instructions to be executed simultaneously without interference between them.
- the absence of conflict between the operating state of the second Bluetooth host and the first operation instruction includes: the second Bluetooth host not executing any operation instruction. This approach avoids multiple Bluetooth hosts simultaneously executing the same or different types of operation instructions, further preventing any potential conflicts.
- the first operation instruction is used to update the scanning parameters of the Bluetooth controller
- the first operation information includes the first scanning parameters of the second Bluetooth host.
- the interaction with the Bluetooth controller may include: if the second scanning parameters of the first Bluetooth host are greater than or equal to the scanning range indicated by the first scanning parameters, sending the second scanning parameters to the Bluetooth controller, the second scanning parameters being used by the Bluetooth controller to update the scanning parameters to the second scanning parameters; or, if the second scanning parameters are less than the scanning range indicated by the first scanning parameters, sending the first scanning parameters to the Bluetooth controller, the first scanning parameters being used by the Bluetooth controller to update the scanning parameters to the first scanning parameters.
- multiple Bluetooth hosts can not only exchange scanning status but also scanning parameters.
- the scanning parameters of multiple Bluetooth hosts can be uniformly updated to the scanning parameters with the largest scanning range among the multiple Bluetooth hosts. This makes the scanning range of the Bluetooth controller based on the updated scanning parameters larger than the scanning range of each Bluetooth host's scanning parameters.
- multiple Bluetooth hosts can reuse the scanning resources of the Bluetooth controller. That is, the scanning data of the Bluetooth controller based on the updated scanning parameters can be used by the first Bluetooth host and the second Bluetooth host at the same time.
- the first operation instruction is used to establish a Bluetooth connection
- the first operation information includes a first number of Bluetooth connections established by the second Bluetooth host.
- the first number is used to control a second number of Bluetooth connections established by the first Bluetooth host, and the sum of the second number and the first number is less than or equal to a reference number of Bluetooth connections established by the Bluetooth controller.
- the first Bluetooth host before the first Bluetooth host executes the first operation command, it is also necessary to determine the working state of the second Bluetooth host. That is, if the second Bluetooth host is in the "exit from sleep” state, the operation information of the second Bluetooth host is obtained. If the operating state of the second Bluetooth host does not conflict with the first operation command, it interacts with the Bluetooth controller to execute the first operation command.
- the second Bluetooth host being in the "exit from sleep” state indicates that the second Bluetooth host is working, which is a scenario of multiple Bluetooth hosts working in parallel. The operation information of the second Bluetooth host is only obtained in a parallel working scenario to avoid conflicts caused by multiple Bluetooth hosts working in parallel.
- the second Bluetooth host when the second Bluetooth host is in sleep mode, it directly interacts with the Bluetooth controller to execute the first operation command, without needing to obtain the operation information of the second Bluetooth host.
- the second Bluetooth host being in sleep mode indicates that it is not working, thus operating in a single Bluetooth host scenario, allowing for direct operation execution and saving the overhead of collaborative processing.
- a multi-Bluetooth host collaborative processing apparatus for executing the method in the first aspect or any possible implementation thereof.
- the multi-Bluetooth host collaborative processing apparatus includes modules for executing the method in the first aspect or any possible implementation thereof.
- the apparatus includes:
- the acquisition module is used to acquire the first operation information of the second Bluetooth host before the first Bluetooth host executes the first operation instruction.
- the second Bluetooth host and the first Bluetooth host are connected to the same Bluetooth controller.
- the first operation information indicates the operation status of the second Bluetooth host.
- the execution module is used to interact with the Bluetooth controller to execute the first operation command when there is no conflict between the operation state of the second Bluetooth host and the first operation command.
- the acquisition module is configured to send a first query instruction to the second Bluetooth host, the first query instruction being used by the second Bluetooth host to send first operation information of the second Bluetooth host to the first Bluetooth host; and to receive the first operation information sent by the second Bluetooth host.
- the device further includes: a first transmitting module, configured to send second operation information to a second Bluetooth host upon completion of the execution of the first operation instruction, wherein the second operation information instructs the first Bluetooth host to complete the execution of the first operation instruction.
- a first transmitting module configured to send second operation information to a second Bluetooth host upon completion of the execution of the first operation instruction, wherein the second operation information instructs the first Bluetooth host to complete the execution of the first operation instruction.
- the first Bluetooth host records coordination information that indicates first operational information of the second Bluetooth host.
- the device further includes: a receiving module for receiving a second query instruction, the second query instruction being sent before the second Bluetooth host executes the second operation instruction; a second sending module for sending third operation information to the second Bluetooth host, the third operation information indicating that the operation status of the first Bluetooth host does not conflict with the second operation instruction; and a recording module for recording fourth operation information as coordination information on the first Bluetooth host, the fourth operation information indicating that the second Bluetooth host is executing the second operation instruction.
- the receiving module is further configured to receive fifth operation information, which is sent to the first Bluetooth host after the second operation instruction has been completed, and the fifth operation information instructs the second Bluetooth host to complete the second operation instruction; the recording module is further configured to record the fifth operation information as coordination information in the first Bluetooth host.
- the fact that the operating state of the second Bluetooth host does not conflict with the first operating instruction includes: the second Bluetooth host does not execute an operating instruction of the same type as the first operating instruction, or the second Bluetooth host does not execute any operating instruction.
- the first operation instruction is used to update the scanning parameters of the Bluetooth controller, and the first operation information includes the first scanning parameters of the second Bluetooth host;
- the execution module is used to send the second scanning parameters to the Bluetooth controller when the second scanning parameters of the first Bluetooth host are greater than or equal to the scanning range indicated by the first scanning parameters, and the second scanning parameters are used by the Bluetooth controller to update the scanning parameters to the second scanning parameters; or, when the second scanning parameters are less than the scanning range indicated by the first scanning parameters, the first scanning parameters are sent to the Bluetooth controller, and the first scanning parameters are used by the Bluetooth controller to update the scanning parameters to the first scanning parameters.
- the first operation instruction is used to establish a Bluetooth connection
- the first operation information includes a first number of Bluetooth connections established by the second Bluetooth host.
- the first number is used to control a second number of Bluetooth connections established by the first Bluetooth host, and the sum of the second number and the first number is less than or equal to a reference number of Bluetooth connections established by the Bluetooth controller.
- the acquisition module is used to acquire the operation information of the second Bluetooth host when the second Bluetooth host is in the working state of exiting sleep.
- a terminal device comprising: a processor coupled to a memory, the memory storing at least one program instruction or code, the at least one program instruction or code being loaded and executed by the processor to enable the terminal device to implement the multi-Bluetooth host collaborative processing method as described in the first aspect or any one of the first aspects.
- the processor may be one or more, and the memory may be one or more.
- the memory may be integrated with the processor, or the memory may be separated from the processor.
- the memory can be a non-transitory memory, such as read-only memory (ROM), which can be integrated with the processor on the same chip or set on different chips.
- ROM read-only memory
- This application does not limit the type of memory or the way the memory and processor are set.
- a computer-readable storage medium storing at least one instruction, the instruction being loaded and executed by a processor to enable a computer to implement the methods in the above aspects.
- a computer program comprising: computer program code, which, when executed by a computer, causes the computer to perform the methods described in the above aspects.
- a chip including a processor for retrieving and executing instructions stored in a memory, causing a communication device on which the chip is mounted to perform the methods described in the preceding aspects.
- another chip comprising: an input interface, an output interface, a processor, and a memory, wherein the input interface, the output interface, the processor, and the memory are connected via an internal connection path, and the processor is used to execute code in the memory, wherein when the code is executed, the processor is used to perform the methods in the foregoing aspects.
- the multi-Bluetooth host collaborative processing device mentioned in the second aspect can be the chip mentioned in the sixth or seventh aspect, or the multi-Bluetooth host collaborative processing device can also be the terminal device mentioned in the third aspect.
- Figure 1 is a schematic diagram of a multi-Bluetooth application scenario provided by an embodiment of this application.
- FIG. 2 is a schematic diagram of a Bluetooth communication system provided in an embodiment of this application.
- FIG. 3 is a flowchart of a collaborative processing method for multiple Bluetooth hosts provided in an embodiment of this application;
- FIG. 4 is a flowchart of another collaborative processing method for multiple Bluetooth hosts provided in an embodiment of this application.
- Figure 5 is an interactive schematic diagram of a collaborative processing method for multiple Bluetooth hosts provided in an embodiment of this application.
- Figure 6 is an interactive schematic diagram of another collaborative processing method for multiple Bluetooth hosts provided in an embodiment of this application.
- Figure 7 is a schematic diagram of the structure of a collaborative processing device for multiple Bluetooth hosts provided in an embodiment of this application.
- Figure 8 is a structural schematic diagram of a terminal device provided in an embodiment of this application.
- Figure 9 is a schematic diagram of the structure of another terminal device provided in an embodiment of this application.
- Figure 10 is a schematic diagram of a terminal system architecture provided in an embodiment of this application.
- Bluetooth communication devices with Bluetooth communication capabilities are becoming increasingly common.
- the device's processor needs to process Bluetooth data for a long time, leading to a sharp increase in device power consumption. Therefore, to reduce the overall power consumption of devices, the technology of multiple Bluetooth hosts coexisting has emerged.
- two Bluetooth hosts are deployed on the device's main processor and coprocessor, respectively, with each Bluetooth host running its own Bluetooth application.
- the Bluetooth hosts can wirelessly connect to at least one Bluetooth peripheral via Bluetooth technology, thereby enabling data transmission and communication functions.
- Bluetooth peripherals include, but are not limited to, Bluetooth headsets, Bluetooth mice, Bluetooth keyboards, Bluetooth speakers, or Bluetooth printers.
- the main processor typically has a high clock speed and high power consumption, while the coprocessor typically has a low clock speed and low power consumption.
- long-running or high-load Bluetooth applications are offloaded from the main processor to the coprocessor, reducing the main processor's workload and thereby lowering the overall power consumption of the device and optimizing its battery life.
- a Bluetooth system architecture typically consists of two parts: a Bluetooth host and a Bluetooth controller.
- the Bluetooth host and controller can be deployed on two different chips.
- the Bluetooth host and controller interact via a Host Controller Interface (HCI) protocol, for example, by sending commands or transmitting data.
- HCI Host Controller Interface
- the Bluetooth host is a logical entity defined as all layers below the non-core configuration file and above the HCI interface, while the Bluetooth controller is a logical entity defined as all layers below the HCI interface.
- HCI Host Controller Interface
- the Bluetooth host is a logical entity defined as all layers below the non-core configuration file and above the HCI interface
- the Bluetooth controller is a logical entity defined as all layers below the HCI interface.
- For devices with multiple Bluetooth hosts coexisting multiple Bluetooth hosts interact with the same Bluetooth controller through their respective HCI interfaces; that is, the Bluetooth controller has dual HCI interfaces. Therefore, if multiple Bluetooth hosts interact with the Bluetooth controller simultaneously, conflicts will occur.
- Bluetooth host A initially gains control of the Bluetooth controller and engages in HCI data exchange with it. After completing the HCI data exchange, Bluetooth host A sends a command to the Bluetooth controller to switch control, and the controller responds. Upon receiving the response, Bluetooth host A sends a request to Bluetooth host B to relinquish control, and B responds. Bluetooth host B then sends a command to the Bluetooth controller to acquire control, and the controller responds. Thus, Bluetooth host B gains control of the Bluetooth controller and engages in HCI data exchange with it. In other words, when Bluetooth host A on the main processor is working, Bluetooth host B on the coprocessor is not working.
- the method of using dual Bluetooth hosts to control the Bluetooth controller in a time-sharing manner can solve the problem of conflict in the coexistence of dual Bluetooth hosts.
- the two Bluetooth hosts need to switch control of the Bluetooth controller back and forth.
- one Bluetooth host exclusively holds control of the Bluetooth controller, while the other Bluetooth host completely loses control.
- the second Bluetooth host passively receives control from the first Bluetooth host and cannot actively acquire control. Once it gains control, since the other Bluetooth host is no longer working, it can directly execute the operation command upon initiation. Therefore, this method is only suitable for scenarios where dual Bluetooth hosts do not need to work simultaneously, such as single Bluetooth applications, and is not suitable for scenarios where dual Bluetooth hosts work in parallel, such as multi-Bluetooth applications.
- the two Bluetooth hosts deployed on the main processor and coprocessor have a master-slave relationship.
- the master Bluetooth host deployed on the main processor controls the slave Bluetooth host on the coprocessor to conduct Bluetooth communication by issuing commands. This results in a clear master-slave relationship between the two Bluetooth hosts.
- the Bluetooth host on the coprocessor has little autonomy and can only execute the commands issued by the main processor. It does not have the ability to work independently and is still not suitable for scenarios with multiple Bluetooth applications, that is, scenarios where two Bluetooth hosts work in parallel.
- This application provides a collaborative processing method for dual Bluetooth hosts, enabling parallel operation of two Bluetooth hosts.
- This method is applicable to communication scenarios involving multiple Bluetooth applications. Such scenarios may include multiple Bluetooth communication devices, each of which performs Bluetooth services with other Bluetooth communication devices. These services are triggered by multiple Bluetooth applications on any given Bluetooth communication device. These applications are deployed on at least two Bluetooth hosts of any given Bluetooth communication device and require parallel operation, i.e., there is a need for parallel operation of two Bluetooth hosts.
- the terminal device can be a personal computer (PC), mobile phone, anti-loss device, wireless headset, wearable device, pocket PC (PPC), tablet computer, virtual reality (VR) terminal device, augmented reality (AR) terminal device, 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, or IoT terminal, etc.
- PC personal computer
- mobile phone anti-loss device
- wireless headset wireless headset
- wearable device wearable device
- pocket PC PPC
- tablet computer tablet computer
- VR virtual reality
- AR augmented reality terminal device
- 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
- IoT terminal IoT terminal
- the multiple Bluetooth communication devices are a mobile phone, an anti-loss device, wireless earphones, and a portable Android device (PAD).
- the mobile phone's multiple Bluetooth hosts can conduct personal full-scenario services with multiple Bluetooth peripherals such as the anti-loss device, wireless earphones, and PAD.
- the service scenarios can include the following typical scenarios: after the mobile phone discovers the PAD, it may trigger a Bluetooth connection and Bluetooth data transmission, completing the update of information between the two ends of the data device; the wireless earphones, after being opened, are scanned and discovered by the mobile phone, requiring a Bluetooth connection; when a user uses the anti-loss device to find a lost device, the mobile phone needs to initiate a Bluetooth scan to discover the anti-loss device, and after discovery, the mobile phone connects to the anti-loss device via Bluetooth.
- the aforementioned business scenarios are triggered by multiple Bluetooth applications.
- the Bluetooth connection of the PAD is automatically triggered by the mobile phone's soft bus networking going online;
- the Bluetooth connection of the wireless headset is automatically triggered by the mobile phone's audio software in the background;
- the Bluetooth connection of the anti-loss device may be triggered by the user operating the mobile phone and by the mobile phone's network search function, or it may be automatically triggered by the mobile phone's network search function in the background.
- Bluetooth applications such as soft bus, audio software, and network search, based on considerations of mobile phone power consumption, Bluetooth applications that need to run for a long time are deployed on the Bluetooth host of the low-power coprocessor, while other Bluetooth applications may be deployed on the Bluetooth host of the main processor.
- the multi-Bluetooth host collaborative processing method provided in this application embodiment can be executed by a Bluetooth communication device, which can be a Bluetooth Low Energy (BLE) device, such as the mobile phone shown in Figure 1.
- the Bluetooth communication device can deploy a Bluetooth communication system, which includes multiple Bluetooth hosts and a Bluetooth controller.
- Figure 2 is a schematic diagram of the structure of a Bluetooth communication system provided in this application embodiment.
- the hardware module of the Bluetooth communication system includes processor A, processor B, and a Bluetooth chip, while the software module includes Bluetooth host A, Bluetooth host B, and a Bluetooth controller.
- Bluetooth host A is deployed on processor A
- Bluetooth host B is deployed on processor B
- the Bluetooth controller is deployed on the Bluetooth chip.
- processor A and processor B are two different processors, not two cores of the same processor.
- Processor A can be an application processor (AP), belonging to the main processor;
- processor B can be a sensor hub (SH), belonging to the coprocessor.
- AP application processor
- SH sensor hub
- Bluetooth Host A and Bluetooth Host B are the host computer components, responsible for controlling the Bluetooth controller's operating mode and processing the data reported by the Bluetooth controller.
- Bluetooth Host A essentially represents the Bluetooth-related components in the main architecture of the Bluetooth communication device, i.e., the Bluetooth-related components in the operating system of processor A;
- Bluetooth Host B represents the Bluetooth-related components in the operating system of processor B.
- the operating systems for Bluetooth Host A and Bluetooth Host B can be heterogeneous.
- Bluetooth Host A and Bluetooth Host B respectively include the Bluetooth application, Bluetooth protocol stack, and Bluetooth interface driver.
- the Bluetooth controller is the slave computer component, responsible for connecting with other Bluetooth communication devices to achieve signal transmission and data exchange.
- the Bluetooth controller includes the Bluetooth interface driver; other modules included in the Bluetooth controller are the same as those in related technologies and will not be described further.
- Bluetooth applications broadly refer to applications that rely on the Bluetooth protocol to complete communication services. For example, distributed soft bus applications use Bluetooth discovery, Bluetooth connection, or Bluetooth transmission functions for device discovery and information synchronization, while network search applications use Bluetooth broadcasting and Bluetooth connection functions for device discovery.
- the Bluetooth application running on Bluetooth host A can be the same as or different from the Bluetooth application running on Bluetooth host B.
- the Bluetooth protocol stack contains implementations of the Bluetooth protocols defined in the Bluetooth specification. Optionally, this includes, but is not limited to, implementations and encapsulations of Bluetooth protocols such as the Logical Link Control and Adaptation Protocol (L2CAP) and the Generic Attribute Profile (GATT), providing a Bluetooth interface for Bluetooth applications.
- L2CAP Logical Link Control and Adaptation Protocol
- GATT Generic Attribute Profile
- the Bluetooth interface provides a standardized way to implement Bluetooth communication, making it easier to develop Bluetooth applications and enabling interoperability between different Bluetooth communication devices.
- a coordination module is added to the Bluetooth protocol stack.
- This module implements coordination logic between different Bluetooth protocol stacks in a multi-Bluetooth host Bluetooth communication system, preventing conflicts arising from concurrent operation of different Bluetooth protocol stacks.
- a connection is established between the Bluetooth controller's Bluetooth interface driver and the Bluetooth host's Bluetooth interface driver, providing a pathway between the Bluetooth host and the Bluetooth controller.
- the Bluetooth interface driver is an HCI interface driver.
- FIG 3 is a flowchart of a collaborative processing method for multiple Bluetooth hosts provided in an embodiment of this application.
- This method is executed by a Bluetooth communication device, which can be a mobile phone as shown in Figure 1.
- the Bluetooth communication device is equipped with a Bluetooth communication system, which includes multiple Bluetooth hosts and at least one Bluetooth controller.
- the multiple Bluetooth hosts can be deployed on the same processor or on different processors.
- This embodiment of the application uses a first Bluetooth host and a second Bluetooth host connected to the same Bluetooth controller as an example.
- the Bluetooth communication system can be as shown in Figure 2, where the first Bluetooth host is Bluetooth host A as shown in Figure 2, and the second Bluetooth host is Bluetooth host B as shown in Figure 2; or, the first Bluetooth host is Bluetooth host B as shown in Figure 2, and the second Bluetooth host is Bluetooth host A as shown in Figure 2.
- the collaborative processing method for multiple Bluetooth hosts includes, but is not limited to, the following steps 301 and 302.
- Step 301 Before the first Bluetooth host executes the first operation instruction, the first operation information of the second Bluetooth host is obtained, and the first operation information indicates the operation status of the second Bluetooth host.
- the second Bluetooth host and the first Bluetooth host are connected to the same Bluetooth controller, representing a multi-Bluetooth host coexistence scenario.
- the first Bluetooth host initiates a first operation command, indicating that its working state is "exiting sleep,” meaning it is currently operating.
- the working state of the first Bluetooth host can be determined by the working state of the first processor. For instance, if the first processor's working state is "exiting sleep,” meaning it is currently operating, then the working state of the first Bluetooth host is determined to be "exiting sleep.”
- the first Bluetooth host executes the first operation command, it is also necessary to determine the working state of the second Bluetooth host. That is, if the working state of the second Bluetooth host is "out of sleep," the operation information of the second Bluetooth host is obtained.
- the working state of the second Bluetooth host being "out of sleep” indicates that the second Bluetooth host is working, which is a scenario of multiple Bluetooth hosts working in parallel.
- the operation information of the second Bluetooth host is only obtained in a parallel working scenario to avoid conflicts caused by multiple Bluetooth hosts working in parallel.
- the second Bluetooth host when the second Bluetooth host is in a sleep state, it directly interacts with the Bluetooth controller to execute the first operation command without needing to obtain the first operation information of the second Bluetooth host. Therefore, it is unnecessary to determine whether the operation state of the second Bluetooth host conflicts with the first operation command.
- the second Bluetooth host being in a sleep state indicates that the second Bluetooth host is not working, thus it is a single Bluetooth host scenario, and the operation can be executed directly, saving the overhead of collaborative processing.
- the working state of the second Bluetooth host can be determined by the working state of the second processor. For example, if the working state of the second processor is "exiting sleep" (i.e., the second processor is working), then the working state of the second Bluetooth host is determined to be “exiting sleep”; if the working state of the second processor is "entering sleep” (i.e., the second processor is not working), then the working state of the second Bluetooth host is determined to be "entering sleep”.
- the processor entering sleep mode can reduce the power consumption of the Bluetooth communication device.
- the acquired first operation information of the second Bluetooth host can indicate the operation state of the second Bluetooth host, and the operation state can indicate the execution status of the operation command.
- the operation state includes operating, operation completed, or idle.
- the first operation information includes a first flag, which indicates that the operation state of the second Bluetooth host is operation completed; or, the first operation information includes a second flag, which indicates that the operation state of the second Bluetooth host is idle.
- the type of operation state may also be different for different types of operation commands. For example, if the operation command is a scanning type, the operation state is a scanning state, which may include scanning, scanning completed, or idle; if the operation command is a connection type, the operation state is a connection establishment state, which may include connection establishment, connection establishment completed, or idle.
- this application embodiment does not limit the method of obtaining the first operation information of the second Bluetooth host, and includes, but is not limited to, the following two methods.
- Method 1 Send a first query command to the second Bluetooth host.
- the first query command is used by the second Bluetooth host to send first operation information of the second Bluetooth host to the first Bluetooth host; and receive the first operation information sent by the second Bluetooth host.
- the operation information of the other Bluetooth host is obtained by sending a query command to the other Bluetooth host, realizing collaborative interaction between multiple Bluetooth hosts. Since the first operation information obtained through the query method is the latest operation information responded by the other Bluetooth host, the accuracy of the obtained first operation information can be guaranteed.
- the interaction between multiple Bluetooth hosts can be implemented by a collaborative module on the Bluetooth host.
- the first Bluetooth host sends a first query command to the second Bluetooth host, and the first query command is used by the second Bluetooth host to send its first operation information to the first Bluetooth host; the first Bluetooth host receives the first operation information sent by the second Bluetooth host.
- the second Bluetooth host may immediately send its first operation information to the first Bluetooth host.
- the operation status indicated by the first operation information may or may not conflict with the first operation command.
- the second Bluetooth host may also send its first operation information to the first Bluetooth host if its operation status does not conflict with the first operation command.
- the first operation information will definitely indicate that the operation status of the second Bluetooth host does not conflict with the first operation command. That is, if the second Bluetooth host is executing an operation command or an operation command of the same type as the first operation command, the second Bluetooth host will not respond to the first query command and will wait for the operation command to complete before responding.
- a response is only initiated when the operating state of the second Bluetooth host does not conflict with the first operation command, thus avoiding the need to resend the query command due to a conflict between the responded operating state and the first operation command.
- an operation command sends only one query command, and the operation command can begin execution upon receiving a response to the query command, ensuring that no conflict occurs where operation commands are executed simultaneously.
- Method 2 Read the collaboration information recorded by the first Bluetooth host to obtain the first operation information of the second Bluetooth host.
- the first Bluetooth host records collaboration information, which in turn indicates the first operation information of the second Bluetooth host. Therefore, by recording the operation information of the other Bluetooth host, the first operation information can be quickly obtained, improving the efficiency of its acquisition.
- the method by which the first Bluetooth host records the collaboration information may include: receiving a second query command, which is sent before the second Bluetooth host executes the second operation command; sending third operation information to the second Bluetooth host, the third operation information indicating that the operation status of the first Bluetooth host does not conflict with the second operation command; and recording fourth operation information as collaboration information on the first Bluetooth host, the fourth operation information indicating that the second Bluetooth host is executing the second operation command.
- receiving fifth operation information which is sent to the first Bluetooth host after the second operation command has been executed, the fifth operation information indicating that the second Bluetooth host has completed the second operation command; and recording the fifth operation information of the second Bluetooth host as collaboration information on the first Bluetooth host.
- the second Bluetooth host before executing the second operation command, the second Bluetooth host also queries the first Bluetooth host for its operation information. Since the second Bluetooth host begins executing the second operation command after the first Bluetooth host responds with the third operation information, the fourth operation information indicating that the second Bluetooth host is executing the second operation command can be recorded as coordination information. Furthermore, the second Bluetooth host will also notify the first Bluetooth host after completing the second operation command; therefore, the fifth operation information indicating that the second Bluetooth host has completed the second operation command can be recorded as coordination information. This achieves real-time recording of coordination information, enabling real-time synchronization of operation information among multiple Bluetooth hosts.
- Step 302 If there is no conflict between the operation state of the second Bluetooth host and the first operation command, interact with the Bluetooth controller to execute the first operation command.
- a conflict can be determined based on the operation status of the second Bluetooth host indicated by the first operation information. That is, if there is no conflict between the operation status of the second Bluetooth host and the first operation command, the system interacts with the Bluetooth controller to execute the first operation command; if there is a conflict between the operation status of the second Bluetooth host and the first operation command, the system obtains the operation information of the second Bluetooth host again, until the obtained operation information indicates that the operation status of the second Bluetooth host does not conflict with the first operation command, and then interacts with the Bluetooth controller to execute the first operation command.
- the first Bluetooth host interacts with the Bluetooth controller to execute the first operation command. Executing the first operation command can refer to executing the operation corresponding to the first operation command.
- a second operation message is sent to the second Bluetooth host.
- the second operation message instructs the first Bluetooth host to complete the execution of the first operation command.
- the absence of conflict between the operation state of the second Bluetooth host and the first operation instruction means that the execution of the operation instruction by the second Bluetooth host does not affect the execution of the first operation instruction by the first Bluetooth host.
- the second Bluetooth host does not execute an operation instruction that conflicts with the first operation instruction, resulting in a higher success rate for the first Bluetooth host to execute the first operation instruction under these conflict-free conditions.
- the absence of conflict between the operation state of the second Bluetooth host and the first operation instruction includes: the second Bluetooth host does not execute an operation instruction of the same type as the first operation instruction. In this approach, multiple Bluetooth hosts can avoid simultaneously executing the same type of operation instruction, while different types of operation instructions can be executed simultaneously, preventing mutual interference between different types of operation instructions.
- the absence of conflict between the operation state of the second Bluetooth host and the first operation instruction includes: the second Bluetooth host does not execute any operation instruction.
- the second Bluetooth host does not execute any operation instruction.
- multiple Bluetooth hosts can avoid simultaneously executing the same or different types of operation instructions, better preventing any potential conflicts.
- the types of the first operation instruction include broadcast type, scan type, connection type, and transmission type, etc.
- the first operation instruction is the scan type.
- the operation information indicates the scan parameters in addition to the scan status.
- the scan parameters include at least one of scan type, scan window, scan interval, timeout, scan filter, scan power, or scan mode.
- the scanning types include active scanning and passive scanning.
- active scanning mode the device periodically sends scan requests to obtain broadcast data from surrounding BLE devices, while in passive scanning mode, the device can only receive broadcast data from surrounding BLE devices.
- the scan window refers to the duration of each scan. Generally, a larger scan window allows for more broadcast data to be received, but it increases power consumption and scan time.
- the scan interval is the time interval between two scans.
- the timeout period is the period after which the device stops scanning if no target device is found.
- the timeout setting should be adjusted according to the actual scenario and requirements.
- Scan filtering can filter scan results based on device name, device address, etc., to reduce unnecessary scan results.
- the scan power setting affects the signal strength of the device during scanning, thus affecting the scanning distance and power consumption.
- Scanning modes include low-power mode, balanced mode, and low-latency mode. Low-power mode can save power to some extent but reduces the scan success rate, while low-latency mode can improve the scan success rate but consume
- the first operational information includes a first scanning parameter of the second Bluetooth host.
- the interaction with the Bluetooth controller may include: if the second scanning parameter of the first Bluetooth host is greater than or equal to the scanning range indicated by the first scanning parameter, sending the second scanning parameter to the Bluetooth controller, the second scanning parameter being used by the Bluetooth controller to update the scanning parameters to the second scanning parameter; or, if the second scanning parameter is less than the scanning range indicated by the first scanning parameter, sending the first scanning parameter to the Bluetooth controller, the first scanning parameter being used by the Bluetooth controller to update the scanning parameters to the first scanning parameter.
- the first scanning parameters of the second Bluetooth host refer to the scanning parameters that the second Bluetooth host needs to scan using the Bluetooth controller, i.e., the scanning data that the second Bluetooth host needs to scan using the Bluetooth controller according to the first scanning parameters;
- the second scanning parameters of the first Bluetooth host refer to the scanning parameters that the first Bluetooth host needs to scan using the Bluetooth controller, i.e., the scanning data that the first Bluetooth host needs to scan using the Bluetooth controller according to the second scanning parameters. Therefore, multiple Bluetooth hosts can not only exchange scanning status but also scanning parameters. When the scanning parameters of multiple Bluetooth hosts differ, the scanning parameters of the Bluetooth controller can be uniformly updated to the scanning parameters with the largest scanning range among the multiple Bluetooth hosts.
- the scanning range of the Bluetooth controller based on the updated scanning parameters is larger than the scanning range of each Bluetooth host's scanning parameters, thereby enabling multiple Bluetooth hosts to reuse the scanning resources of the Bluetooth controller.
- the scanning data scanned by the Bluetooth controller based on the updated scanning parameters can be used by both the first and second Bluetooth hosts simultaneously.
- the first operation command is a connection type.
- the operation information indicates not only the connection status but also the number of connections.
- the first operation information includes a first number of Bluetooth connections established by the second Bluetooth host, the first number being used to control a second number of Bluetooth connections established by the first Bluetooth host, and the sum of the second number and the first number being less than or equal to a reference number of Bluetooth connections established by the Bluetooth controller.
- the reference number may refer to the maximum number of connections supported by the Bluetooth chip in which the Bluetooth controller resides.
- the first Bluetooth host and the second Bluetooth host can also interact to achieve collaborative resource allocation.
- the number of concurrent broadcasts supported by the Bluetooth controller is obtained; a broadcast quantity is allocated to the second Bluetooth host, enabling the second Bluetooth host to broadcast based on the allocated broadcast quantity.
- a first read command for broadcast resources is sent to the Bluetooth controller, whereby the Bluetooth controller sends the concurrent broadcast quantity to the first Bluetooth host, i.e., responds to the first read command; the concurrent broadcast quantity sent by the Bluetooth controller is received; a broadcast quantity is allocated to the second Bluetooth host, and the allocated broadcast quantity is sent to the second Bluetooth host, with the second Bluetooth host responding to the first Bluetooth host.
- collaborative allocation of broadcast resources among multiple Bluetooth hosts is achieved.
- the number of transmission buffers supported by the Bluetooth controller is obtained; a number of buffers is allocated to the second Bluetooth host so that the second Bluetooth host can transmit based on the allocated number of buffers.
- a second read instruction for buffer resources is sent to the Bluetooth controller, which is used by the Bluetooth controller to send the number of transmission buffers to the first Bluetooth host, i.e., to respond to the second read instruction; the number of transmission buffers sent by the Bluetooth controller is received; a number of buffers is allocated to the second Bluetooth host, and the allocated number of buffers is sent to the second Bluetooth host, with the second Bluetooth host responding to the first Bluetooth host. This achieves collaborative allocation of transmission buffer resources among multiple Bluetooth hosts.
- multiple Bluetooth hosts achieve orderly scheduling of operation commands by exchanging operation information, avoiding coexistence conflicts in scenarios where multiple Bluetooth hosts work in parallel.
- the first Bluetooth host as an example, during operation, each time the first Bluetooth host initiates an operation command, it first obtains the operation information of the second Bluetooth host. That is, the second Bluetooth host can work simultaneously with the first Bluetooth host, and only executes the operation command after confirming there is no conflict, rather than executing the command directly.
- the collaborative processing method of the second Bluetooth host during operation is the same as that of the first Bluetooth host.
- the Bluetooth communication system of the Bluetooth communication device includes a third Bluetooth host in addition to a first Bluetooth host and a second Bluetooth host.
- the device besides acquiring the first operation information of the second Bluetooth host, the device also acquires sixth operation information of the third Bluetooth host, which indicates the operation state of the third Bluetooth host. Furthermore, if neither the operation state of the second nor the operation state of the third Bluetooth host conflicts with the first operation command, the device interacts with the Bluetooth controller to execute the first operation command.
- the implementation method for acquiring the sixth operation information of the third Bluetooth host is the same as the implementation method for acquiring the first operation information of the second Bluetooth host described above, and will not be repeated here.
- the Bluetooth application starts an operation command on the Bluetooth host A side.
- This operation command includes, but is not limited to, updating scanning parameters or establishing a Bluetooth connection.
- the Bluetooth protocol stack on the Bluetooth host A side first queries the operation status of Bluetooth host B.
- the collaboration module on the Bluetooth host A side sends a query command to the collaboration module on the Bluetooth host B side to check the operation status.
- the coordination module on Bluetooth host B After receiving the query command, the coordination module on Bluetooth host B first determines the operation status of Bluetooth host B. If Bluetooth host B is currently executing an operation command, it waits for Bluetooth host B to complete the currently executing operation command before returning the operation status of Bluetooth host B to Bluetooth host A; that is, the coordination module of Bluetooth host B responds to the operation status. If Bluetooth host B is not currently executing an operation command, the coordination module on Bluetooth host B immediately returns the operation status of Bluetooth host B to Bluetooth host A. Optionally, in addition to responding to the operation status, it also responds to the operation parameters, that is, it also returns the operation parameters of Bluetooth host B, such as scan parameters, to Bluetooth host A. After responding to the operation status, the coordination module on Bluetooth host B also records the operation status of Bluetooth host A as "operating".
- Bluetooth host A After receiving the operation status response from Bluetooth host B, the collaboration module on Bluetooth host A continues to execute the start operation command. Once Bluetooth host A completes the operation command, its collaboration module notifies its collaboration module on Bluetooth host B that the operation is complete. Upon receiving this notification, Bluetooth host B's collaboration module records the operation status of Bluetooth host A as "operation complete.”
- the collaboration module on the Bluetooth host B side records the operation status of the Bluetooth host A side.
- the Bluetooth application launch operation command on the Bluetooth host B side includes, but is not limited to, Bluetooth scanning or Bluetooth connection.
- the Bluetooth protocol stack on the Bluetooth host B side first queries the operation status of the Bluetooth host A. Then, it first queries the operation status of the Bluetooth host A recorded in the collaboration module on the Bluetooth host B side; if it is in operation, the Bluetooth host B must wait for the operation status of the Bluetooth host A to change to operation completed before executing the operation command; if the operation is completed, the Bluetooth host B can execute the operation command immediately.
- Dual-stack is short for dual Bluetooth protocol stacks, and dual-stack interaction refers to the interaction between the collaborative modules of the two stacks. Through interaction, the two stacks can mutually sense the scan state and scan parameters, realize coordinated and orderly scheduling of scans, and unify the scan parameters.
- the process of Bluetooth host A and Bluetooth host B simultaneously updating scan parameters is illustrated with an example.
- the Bluetooth application on Bluetooth host A initiates an update of the scan parameters to the Bluetooth protocol stack on Bluetooth host A; the scan parameter to be updated is scan parameter A.
- the Bluetooth application on Bluetooth host B also initiates an update of the scan parameters to the Bluetooth protocol stack on Bluetooth host B; the scan parameter to be updated is scan parameter B.
- the Bluetooth protocol stack on Bluetooth host A before executing the scan parameter update operation, the Bluetooth protocol stack on Bluetooth host A first queries the scan status and scan parameters on Bluetooth host B. For example, it can send a query command from the coordination module on Bluetooth host A to the coordination module on Bluetooth host B. Upon receiving the query command, the Bluetooth protocol stack on Bluetooth host B, being in the process of updating the scan parameters, waits for the update to complete before responding to the Bluetooth protocol stack on Bluetooth host A with the scan status and scan parameters. The scan status indicates that the operation is complete.
- the process of Bluetooth host B updating the scan parameters involves the Bluetooth protocol stack on Bluetooth host B setting scan parameter B to the Bluetooth controller. After updating the scan parameters to scan parameter B, the Bluetooth controller responds to the Bluetooth protocol stack on Bluetooth host B with a success message. Finally, the Bluetooth protocol stack on Bluetooth host B sends feedback to the Bluetooth application on Bluetooth host B indicating successful scan parameter update.
- the Bluetooth protocol stack on host A After receiving a response from Bluetooth host B, the Bluetooth protocol stack on host A determines that the scanning status on host B is complete, meaning that updating the scan parameters will not conflict with the operation command on host B. Therefore, the Bluetooth protocol stack on host A begins the scan parameter update operation. Specifically, the Bluetooth protocol stack on host A compares the scan parameter A to be updated with the scan parameter B returned by host B, determining the larger of the two as the normalized scan parameter (either A or B). The Bluetooth protocol stack on host A sets this normalized scan parameter to the Bluetooth controller. After updating the scan parameters to the normalized scan parameter, the Bluetooth controller acknowledges success to the Bluetooth protocol stack on host A, and the Bluetooth protocol stack on host A then reports the successful update to the Bluetooth application on host A.
- the Bluetooth protocol stack on Bluetooth host A also notifies the Bluetooth protocol stack on Bluetooth host B of the scan status and normalized scan parameters.
- the scan status indicates that the operation is complete, and the Bluetooth protocol stack on Bluetooth host B records the scan parameters as the normalized scan parameters. This achieves conflict-free scanning and normalized scan parameters for Bluetooth host A and Bluetooth host B in parallel operation scenarios.
- the Bluetooth chip stops processing connection requests from the Bluetooth protocol stack once it is in the connection initiating state. If both stacks execute the Bluetooth connection establishment operation simultaneously, a connection conflict will occur, causing the Bluetooth application to fail to establish a Bluetooth connection, thus failing to meet the connection requirements of multiple Bluetooth hosts working in parallel. Therefore, this embodiment adds dual-stack interaction at the connection conflict point. Through interaction, the connection states of the two stacks are mutually sensed, that is, the connection states of the two stacks are coordinated, thereby achieving orderly scheduling of connection coordination and achieving a conflict-free connection.
- the Bluetooth application on Bluetooth host A initiates the Bluetooth connection establishment operation to the Bluetooth protocol stack on Bluetooth host A.
- the Bluetooth protocol stack on Bluetooth host A first queries the connection status on Bluetooth host B, for example, by sending a query command from the coordination module on Bluetooth host A to the coordination module on Bluetooth host B.
- the Bluetooth protocol stack on Bluetooth host B since not currently performing a connection operation, directly responds to the Bluetooth protocol stack on Bluetooth host A with a connection status of "idle".
- the Bluetooth protocol stack on Bluetooth host B records the connection status on Bluetooth host A as "in operation”.
- the Bluetooth protocol stack on Bluetooth host A After receiving the connection establishment status response, the Bluetooth protocol stack on Bluetooth host A determines that the connection establishment state on Bluetooth host B is idle, meaning that performing the Bluetooth connection establishment operation now will not cause a scanning conflict with the operation command on Bluetooth host B. Therefore, the Bluetooth protocol stack on Bluetooth host A begins the Bluetooth connection establishment operation. Specifically, the Bluetooth protocol stack on Bluetooth host A sends a connection establishment request to the Bluetooth controller. The Bluetooth controller, based on the connection establishment request, enters the initiating state to establish the Bluetooth connection. After the Bluetooth connection is successfully established, the Bluetooth controller acknowledges the connection success to the Bluetooth protocol stack on Bluetooth host A, and the Bluetooth protocol stack on Bluetooth host A sends feedback on the connection success to the Bluetooth application on Bluetooth host A. The Bluetooth protocol stack on Bluetooth host A also notifies the Bluetooth protocol stack on Bluetooth host B of the connection status and normalized scan parameters. The connection status indicates that the operation is complete.
- the Bluetooth application on Bluetooth host B also initiates its own Bluetooth connection establishment operation.
- the Bluetooth protocol stack on Bluetooth host B queries the connection status of Bluetooth host A recorded in its stack. If the connection status of Bluetooth host A is "in operation,” the Bluetooth protocol stack on Bluetooth host B waits, pausing the connection establishment operation. If the connection status of Bluetooth host A is "operation completed,” the Bluetooth protocol stack on Bluetooth host B begins the connection establishment operation.
- Bluetooth host B's Bluetooth protocol stack sends a connection request to the Bluetooth controller.
- the Bluetooth controller enters the initiating state based on the connection request to establish the Bluetooth connection.
- the Bluetooth controller acknowledges the successful connection to Bluetooth host B's Bluetooth protocol stack, and Bluetooth host B's Bluetooth protocol stack then sends feedback on the successful connection to Bluetooth host B's Bluetooth application. This achieves a conflict-free connection between Bluetooth host A and Bluetooth host B in a parallel working scenario.
- the method provided in this application adds an operation status interaction mechanism between the Bluetooth protocol stacks of multiple Bluetooth hosts. This allows for interaction mechanisms such as operation status query, response, and notification between the two stacks at operation command conflict points, achieving mutual awareness of the operation status between the two stacks and enabling orderly scheduling of operation commands. Furthermore, a resource reuse mechanism is added between the two stacks, allowing for the exchange of scan parameters at operation command conflict points, i.e., mutual awareness of scan parameters, with the scan parameters being unified by the Bluetooth protocol stack that last performed the scan parameter update operation. A resource allocation mechanism is added between the two stacks, enabling the notification of the number of connections and the number of reassigned buffers to the peer Bluetooth protocol stack after a successful Bluetooth connection establishment. A dynamic coordination mechanism is added between the two stacks, allowing the Bluetooth protocol stack to perceive the processor status of the other Bluetooth protocol stack; entering sleep mode stops coordination, and exiting sleep mode resumes coordination.
- FIG. 7 is a schematic diagram of the structure of a multi-Bluetooth host collaborative processing device provided in an embodiment of this application.
- This device is applied to a Bluetooth communication device, which is the Bluetooth communication device shown in Figure 3 above.
- the multi-Bluetooth host collaborative processing device shown in Figure 7 can perform all or part of the operations performed by the Bluetooth communication device. It should be understood that the device may include more additional modules than the modules shown or omit some of the modules shown. Embodiments of this application do not limit this.
- the device includes:
- the acquisition module 701 is used to acquire the first operation information of the second Bluetooth host before the first Bluetooth host executes the first operation instruction.
- the second Bluetooth host and the first Bluetooth host are connected to the same Bluetooth controller.
- the first operation information indicates the operation status of the second Bluetooth host.
- the execution module 702 is used to interact with the Bluetooth controller to execute the first operation command when there is no conflict between the operation state of the second Bluetooth host and the first operation command.
- the acquisition module 701 is used to send a first query instruction to the second Bluetooth host, the first query instruction being used by the second Bluetooth host to send first operation information of the second Bluetooth host to the first Bluetooth host; and to receive the first operation information sent by the second Bluetooth host.
- the device further includes: a first transmitting module, configured to send second operation information to a second Bluetooth host upon completion of the execution of the first operation instruction, wherein the second operation information instructs the first Bluetooth host to complete the execution of the first operation instruction.
- a first transmitting module configured to send second operation information to a second Bluetooth host upon completion of the execution of the first operation instruction, wherein the second operation information instructs the first Bluetooth host to complete the execution of the first operation instruction.
- the first Bluetooth host records coordination information that indicates first operational information of the second Bluetooth host.
- the device further includes: a receiving module for receiving a second query instruction, the second query instruction being sent before the second Bluetooth host executes the second operation instruction; a second sending module for sending third operation information to the second Bluetooth host, the third operation information indicating that the operation status of the first Bluetooth host does not conflict with the second operation instruction; and a recording module for recording fourth operation information as coordination information on the first Bluetooth host, the fourth operation information indicating that the second Bluetooth host is executing the second operation instruction.
- the receiving module is further configured to receive fifth operation information, which is sent to the first Bluetooth host after the second operation instruction has been completed, and the fifth operation information instructs the second Bluetooth host to complete the second operation instruction; the recording module is further configured to record the fifth operation information as coordination information in the first Bluetooth host.
- the fact that the operating state of the second Bluetooth host does not conflict with the first operating instruction includes: the second Bluetooth host does not execute an operating instruction of the same type as the first operating instruction, or the second Bluetooth host does not execute any operating instruction.
- the first operation instruction is used to update the scanning parameters of the Bluetooth controller, and the first operation information includes the first scanning parameters of the second Bluetooth host;
- the execution module 702 is used to send the second scanning parameters to the Bluetooth controller when the second scanning parameters of the first Bluetooth host are greater than or equal to the scanning range indicated by the first scanning parameters, and the second scanning parameters are used by the Bluetooth controller to update the scanning parameters to the second scanning parameters; or, when the second scanning parameters are less than the scanning range indicated by the first scanning parameters, the first scanning parameters are sent to the Bluetooth controller, and the first scanning parameters are used by the Bluetooth controller to update the scanning parameters to the first scanning parameters.
- the first operation instruction is used to establish a Bluetooth connection
- the first operation information includes a first number of Bluetooth connections established by the second Bluetooth host.
- the first number is used to control a second number of Bluetooth connections established by the first Bluetooth host, and the sum of the second number and the first number is less than or equal to a reference number of Bluetooth connections established by the Bluetooth controller.
- the acquisition module 701 is used to acquire the operation information of the second Bluetooth host when the second Bluetooth host is in the working state of exiting sleep.
- the device shown in Figure 7 is only illustrated by the division of the above-described functional modules. In practical applications, the functions can be assigned to different functional modules as needed, that is, the internal structure of the device can be divided into different functional modules to complete all or part of the functions described above. Furthermore, the device and method embodiments provided in the above embodiments belong to the same concept, and their specific implementation process and beneficial effects are detailed in the method embodiments, and will not be repeated here.
- This application provides a terminal device for performing the operations involved in the multi-Bluetooth host collaborative processing method shown in FIG3.
- the structural schematic diagram of the terminal device can be as shown in FIG8.
- the terminal device can be, for example, a smartphone, tablet computer, vehicle terminal, laptop computer, or desktop computer.
- the terminal device may also be referred to as user equipment, portable terminal, laptop terminal, desktop terminal, or other names.
- a terminal device typically includes a processor 801 and a memory 802.
- Processor 801 may include one or more processing cores, such as a quad-core processor, an octa-core processor, etc.
- Processor 801 may be implemented using at least one hardware form selected from DSP (Digital Signal Processing), FPGA (Field-Programmable Gate Array), and PLA (Programmable Logic Array).
- Processor 801 may also include a main processor and a coprocessor.
- the main processor also known as a CPU (Central Processing Unit), is used to process data in the wake-up state; the coprocessor is a low-power processor used to process data in the standby state.
- processor 801 may integrate a GPU (Graphics Processing Unit), which is responsible for rendering and drawing the content to be displayed on the screen.
- processor 801 may also include an AI (Artificial Intelligence) processor, which is used to handle computational operations related to machine learning.
- AI Artificial Intelligence
- the memory 802 may include one or more computer-readable storage media, which may be non-transitory.
- the memory 802 may also include high-speed random access memory and non-volatile memory, such as one or more disk storage devices or flash memory devices.
- the non-transitory computer-readable storage media in the memory 802 is used to store at least one instruction, which is executed by the processor 801 to implement the electronic account opening method provided in the method embodiments of this application.
- the terminal may also optionally include: a peripheral device interface 803 and at least one peripheral device.
- the processor 801, memory 802, and peripheral device interface 803 can be connected via a bus or signal line.
- Each peripheral device can be connected to the peripheral device interface 803 via a bus, signal line, or circuit board.
- the peripheral device includes at least one of: a radio frequency circuit 804, a display screen 805, a camera assembly 806, an audio circuit 807, and a power supply 808.
- Peripheral device interface 803 can be used to connect at least one I/O (Input/Output) related peripheral device to processor 801 and memory 802.
- processor 801, memory 802 and peripheral device interface 803 are integrated on the same chip or circuit board; in some other embodiments, any one or two of processor 801, memory 802 and peripheral device interface 803 can be implemented on separate chips or circuit boards, which is not limited in this embodiment.
- the radio frequency (RF) circuit 804 is used to receive and transmit RF (Radio Frequency) signals, also known as electromagnetic signals.
- the RF circuit 804 communicates with communication networks and other communication devices via electromagnetic signals.
- the RF circuit 804 converts electrical signals into electromagnetic signals for transmission, or converts received electromagnetic signals back into electrical signals.
- the RF circuit 804 includes: an antenna system, an RF transceiver, one or more amplifiers, a tuner, an oscillator, a digital signal processor, a codec chipset, a user identity module card, etc.
- the RF circuit 804 can communicate with other terminals through at least one wireless communication protocol.
- This wireless communication protocol includes, but is not limited to: metropolitan area networks (MANs), various generations of mobile communication networks (2G, 3G, 4G, and 5G), wireless local area networks (WLANs), and/or Wireless Fidelity (WiFi) networks.
- MANs metropolitan area networks
- 2G, 3G, 4G, and 5G various generations of mobile communication networks
- WLANs wireless local area networks
- WiFi Wireless Fidelity
- the RF circuit 804 may also include circuitry related to NFC (Near Field Communication), which is not limited in this application.
- NFC Near Field Communication
- Display screen 805 is used to display a UI (User Interface). This UI may include graphics, text, icons, videos, and any combination thereof. When display screen 805 is a touch display screen, it also has the ability to collect touch signals on or above its surface. These touch signals can be input as control signals to processor 801 for processing. In this case, display screen 805 can also be used to provide virtual buttons and/or a virtual keyboard, also known as soft buttons and/or a soft keyboard.
- UI User Interface
- display screen 805 there may be one display screen 805, located on the front panel of the terminal; in other embodiments, there may be at least two display screens, respectively located on different surfaces of the terminal or in a folded design; in still other embodiments, display screen 805 may be a flexible display screen, located on a curved or folded surface of the terminal. Furthermore, display screen 805 may be configured as a non-rectangular irregular shape, i.e., a non-rectangular screen. Display screen 805 may be made of materials such as LCD (Liquid Crystal Display) or OLED (Organic Light-Emitting Diode).
- LCD Liquid Crystal Display
- OLED Organic Light-Emitting Diode
- the camera assembly 806 is used to acquire images or videos.
- the camera assembly 806 includes a front-facing camera and a rear-facing camera.
- the front-facing camera is located on the front panel of the terminal, and the rear-facing camera is located on the back of the terminal.
- there are at least two rear-facing cameras which are any one of a main camera, a depth-sensing camera, a wide-angle camera, and a telephoto camera, to achieve background blurring by fusion of the main camera and the depth-sensing camera, panoramic shooting by fusion of the main camera and the wide-angle camera, VR (Virtual Reality) shooting, or other fusion shooting functions.
- the camera assembly 806 may also include a flash.
- the flash can be a single-color temperature flash or a dual-color temperature flash.
- a dual-color temperature flash refers to a combination of a warm-light flash and a cool-light flash, which can be used for light compensation at different color temperatures.
- the audio circuit 807 may include a microphone and a speaker.
- the microphone is used to collect sound waves from the user and the environment, converting the sound waves into electrical signals that are input to the processor 801 for processing, or input to the radio frequency circuit 804 for voice communication. For stereo sound acquisition or noise reduction purposes, multiple microphones may be used, each positioned at a different location on the terminal.
- the microphone may also be an array microphone or an omnidirectional microphone.
- the speaker is used to convert the electrical signals from the processor 801 or the radio frequency circuit 804 into sound waves.
- the speaker may be a conventional diaphragm speaker or a piezoelectric ceramic speaker. When the speaker is a piezoelectric ceramic speaker, it can convert electrical signals not only into audible sound waves but also into inaudible sound waves for purposes such as distance measurement.
- the audio circuit 807 may also include a headphone jack.
- Power supply 808 is used to power the various components in the terminal.
- Power supply 808 can be AC power, DC power, a disposable battery, or a rechargeable battery.
- the rechargeable battery can support wired or wireless charging.
- the rechargeable battery can also be used to support fast charging technology.
- the terminal further includes one or more sensors 809.
- the one or more sensors 809 include, but are not limited to: an accelerometer 810, a gyroscope 811, a pressure sensor 812, an optical sensor 813, and a proximity sensor 814.
- Accelerometer 810 can detect the magnitude of acceleration along the three coordinate axes of a coordinate system established by the terminal. For example, accelerometer 810 can be used to detect the components of gravitational acceleration along the three coordinate axes.
- Processor 801 can control display screen 805 to display the user interface in either a landscape or portrait view based on the gravitational acceleration signal acquired by accelerometer 810. Accelerometer 810 can also be used for games or for acquiring user motion data.
- the gyroscope sensor 811 can detect the terminal's orientation and rotation angle.
- the gyroscope sensor 811 in conjunction with the accelerometer sensor 810, can collect the user's 3D movements on the terminal.
- the processor 801 can perform the following functions: motion sensing (e.g., changing the UI based on the user's tilt), image stabilization during shooting, game control, and inertial navigation.
- the pressure sensor 812 can be disposed on the side bezel of the terminal and/or on the lower layer of the display screen 805. When the pressure sensor 812 is disposed on the side bezel of the terminal, it can detect the user's grip signal on the terminal, and the processor 801 can perform left/right hand recognition or quick operation based on the grip signal collected by the pressure sensor 812. When the pressure sensor 812 is disposed on the lower layer of the display screen 805, the processor 801 can control the operable controls on the UI interface based on the user's pressure operation on the display screen 805.
- the operable controls include at least one of button controls, scroll bar controls, icon controls, and menu controls.
- An optical sensor 813 is used to collect ambient light intensity.
- the processor 801 can control the display brightness of the display screen 805 based on the ambient light intensity collected by the optical sensor 813. Specifically, when the ambient light intensity is high, the display brightness of the display screen 805 is increased; when the ambient light intensity is low, the display brightness of the display screen 805 is decreased.
- the processor 801 can also dynamically adjust the shooting parameters of the camera assembly 806 based on the ambient light intensity collected by the optical sensor 813.
- the proximity sensor 814 also known as a distance sensor, is typically installed on the front panel of the terminal.
- the proximity sensor 814 is used to detect the distance between the user and the front of the terminal.
- the processor 801 controls the display screen 805 to switch from a screen-on state to a screen-off state; when the proximity sensor 814 detects that the distance between the user and the front of the terminal is gradually increasing, the processor 801 controls the display screen 805 to switch from a screen-off state to a screen-on state.
- FIG. 8 does not constitute a limitation on the computer device and may include more or fewer components than shown, or combine certain components, or employ different component arrangements.
- the structural diagram of the terminal device can also be as shown in Figure 9.
- the terminal device can be, for example, a smartphone, tablet computer, vehicle terminal, laptop computer, or desktop computer.
- the terminal device may also be referred to as user equipment, portable terminal, laptop terminal, desktop terminal, or other names.
- the terminal device includes a processor 110.
- the processor 110 is connected to the external memory interface 120, internal memory 121, universal serial bus (USB) interface 130, power management module 141, mobile communication module 150, wireless communication module 160, audio module 170, sensor module 180, button 190, motor 191, indicator 192, cameras 1 to N 193, display screens 1 to N 194, and SIM card interfaces 1 to N 195.
- N is a positive integer.
- the charging input is connected to the USB interface 130, which is also connected to the charging management module 140, the battery 142, and the power management module 141.
- the mobile communication module 150 includes various generations of mobile communication networks (2G/3G/4G/5G), and the wireless communication module 160 includes various wireless communication protocols, such as Bluetooth (BT), wireless local area networks (WLAN), global navigation satellite system (GNSS), NFC, infrared radiation (IR), or frequency modulation (FM).
- BT Bluetooth
- WLAN wireless local area networks
- GNSS global navigation satellite system
- NFC infrared radiation
- FM frequency modulation
- the mobile communication module 150 communicates via antenna 1
- the wireless communication module 160 communicates via antenna 2.
- the audio module 170 is connected to the speaker 170A, receiver 170B, microphone 170C, and headphone jack 170D.
- the sensor module 180 includes, but is not limited to, a pressure sensor 180A, a gyroscope sensor 180B, a barometric pressure sensor 180C, a magnetic sensor 180D, an accelerometer 180E, a proximity sensor 180F, a proximity light sensor 180G, a fingerprint sensor 180H, a temperature sensor 180J, a touch sensor 180K, an ambient light sensor 180L, and a bone conduction sensor 180M.
- the modules shown in Figure 9 can be referred to the descriptions in Figure 8, which will not be repeated here.
- the number of processors 801 in Figure 8 can be multiple.
- the connection method of any processor 801 is shown in Figure 8.
- Two processors 801 among the multiple processors 801 can correspond to processor A and processor B shown in Figure 2, respectively.
- the peripheral device interface 803 can also connect to a Bluetooth chip, corresponding to the Bluetooth chip shown in Figure 2.
- the number of processors 110 in Figure 9 can be multiple.
- the connection method of any processor 110 is shown in Figure 9. Two processors 110 among the multiple processors 110 can correspond to processor A and processor B shown in Figure 2, respectively.
- the wireless communication module 150 includes a Bluetooth chip
- the wireless communication module 150 corresponds to the Bluetooth chip shown in Figure 2.
- Figure 10 is a schematic diagram of a terminal system architecture provided in an embodiment of this application.
- the terminal system architecture includes an application layer, an application framework layer, system libraries, and a kernel library.
- the application layer includes, but is not limited to, applications for camera, calendar, music, map, WLAN, gallery, Bluetooth, video, call, live streaming, and SMS.
- the application framework layer includes, but is not limited to, a window manager, content provider, phone manager, notification manager, resource manager, and view system.
- the system library includes, but is not limited to, various libraries such as a surface manager, 3D graphics processing library, 2D graphics engine, and media library, as well as the system runtime environment.
- the kernel library includes, but is not limited to, display driver, camera driver, audio driver, and sensor driver.
- the Bluetooth application shown in Figure 2 can be mapped to the application layer shown in Figure 10, that is, the Bluetooth in the application layer shown in Figure 10; the Bluetooth protocol stack shown in Figure 2 can be mapped to the system library shown in Figure 10, so the system library shown in Figure 10 also includes the Bluetooth protocol stack; the Bluetooth interface driver shown in Figure 2 can be mapped to the kernel layer shown in Figure 10, so the kernel layer shown in Figure 10 also includes the Bluetooth interface driver.
- processor can be a CPU, or other general-purpose processors, digital signal processors (DSPs), application-specific integrated circuits (ASICs), field-programmable gate arrays (FPGAs), or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc.
- DSPs digital signal processors
- ASICs application-specific integrated circuits
- FPGAs field-programmable gate arrays
- General-purpose processors can be microprocessors or any conventional processor. It is worth noting that the processor can be a processor supporting Advanced Reduced Instruction Set Computing (RISC) machines (ARM) architecture.
- RISC Reduced Instruction Set Computing
- the memory described above may include read-only memory and random access memory, and provide instructions and data to the processor.
- the memory may also include non-volatile random access memory.
- the memory may also store device type information.
- the memory can be volatile or non-volatile, or may include both.
- the non-volatile memory can be read-only memory (ROM), programmable read-only memory (PROM), erasable programmable read-only memory (EPROM), electrically erasable programmable read-only memory (EEPROM), or flash memory.
- the volatile memory can be random access memory (RAM), which serves as an external cache.
- RAM random access memory
- SRAM static random access memory
- DRAM dynamic random access memory
- SDRAM synchronous dynamic random access memory
- DDR SDRAM double data rate synchronous dynamic random access memory
- ESDRAM enhanced synchronous dynamic random access memory
- SLDRAM synchronous linked dynamic random access memory
- DR RAM direct rambus RAM
- This application also provides a computer-readable storage medium storing at least one instruction, which is loaded and executed by a processor to enable the computer to implement any of the above-described multi-Bluetooth host collaborative processing methods.
- This application also provides a computer program (product) that, when executed by a computer, causes the processor or computer to perform the corresponding steps and/or processes in the above method embodiments.
- This application also provides a chip, including a processor, for calling and executing instructions stored in a memory, causing a communication device equipped with the chip to perform any of the above-described multi-Bluetooth host collaborative processing methods.
- This application embodiment also provides another chip, including: an input interface, an output interface, a processor, and a memory.
- the input interface, output interface, processor, and memory are connected through an internal connection path.
- the processor is used to execute code in the memory. When the code is executed, the processor is used to execute any of the above-mentioned multi-Bluetooth host collaborative processing methods.
- implementation can be achieved, in whole or in part, through software, hardware, firmware, or any combination thereof.
- software When implemented in software, it can be implemented, in whole or in part, as a computer program product.
- a computer program product includes 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 this application is generated.
- the computer can be a general-purpose computer, a special-purpose computer, a computer network, or other programmable device.
- the computer instructions can be stored in a computer-readable storage medium or transmitted from one computer-readable storage medium to another.
- computer instructions can be transmitted from one website, computer, server, or data center to another website, computer, server, or data center via wired (e.g., coaxial cable, fiber optic, digital subscriber line) or wireless (e.g., infrared, wireless, microwave, etc.) means.
- the computer-readable storage medium can be any available medium that a computer can access or a data storage device such as a server or data center that integrates one or more available media.
- the available medium can be a magnetic medium (e.g., floppy disk, hard disk, magnetic tape), an optical medium (e.g., DVD), or a semiconductor medium (e.g., solid-state disk), etc.
- This computer program product includes one or more computer program instructions.
- the methods of this application embodiment can be described in the context of machine-executable instructions, such as program modules that execute on a device on a real or virtual processor of the target.
- program modules include routines, programs, libraries, objects, classes, components, data structures, etc., which perform specific tasks or implement specific abstract data structures.
- the functionality of program modules can be combined or divided among the described program modules.
- the machine-executable instructions for the program modules can execute within a local or distributed device. In a distributed device, the program modules can reside on both local and remote storage media.
- Computer program code used to implement the methods of the embodiments of this application may be written in one or more programming languages.
- This computer program code may be provided to a processor of a general-purpose computer, a special-purpose computer, or other programmable data processing apparatus, such that when executed by the computer or other programmable data processing apparatus, the program code causes the functions/operations specified in the flowcharts and/or block diagrams to be implemented.
- the program code may be executed entirely on a computer, partially on a computer, as a standalone software package, partially on a computer and partially on a remote computer, or entirely on a remote computer or server.
- computer program code or related data may be carried by any suitable carrier to enable a device, apparatus, or processor to perform the various processes and operations described above.
- suitable carriers include signals, computer-readable media, etc.
- Examples of signals may include electrical, optical, radio, sound, or other forms of propagation signals, such as carrier waves, infrared signals, etc.
- a machine-readable medium can be any tangible medium that contains or stores programs for or relating to an instruction execution system, apparatus, or device.
- a machine-readable medium can be a machine-readable signal medium or a machine-readable storage medium.
- Machine-readable media can include, but are not limited to, electronic, magnetic, optical, electromagnetic, infrared, or semiconductor systems, apparatus, or devices, or any suitable combination thereof. More detailed examples of machine-readable storage media include electrical connections with one or more wires, portable computer disks, hard disks, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM or flash memory), optical storage devices, magnetic storage devices, or any suitable combination thereof.
- the disclosed systems, devices, and methods can be implemented in other ways.
- the device embodiments described above are merely illustrative; for instance, the division of modules is only a logical functional division, and in actual implementation, there may be other division methods.
- multiple modules or components may be combined or integrated into another system, or some features may be ignored or not executed.
- the couplings or direct couplings or communication connections shown or discussed may be indirect couplings or communication connections through some interfaces, devices, or modules, or they may be electrical, mechanical, or other forms of connection.
- the modules described as separate components may or may not be physically separate.
- the components shown as modules may or may not be physical modules; that is, they may be located in one place or distributed across multiple network modules. Some or all of the modules can be selected to achieve the purpose of the embodiments of this application, depending on actual needs.
- the functional modules in the various embodiments of this application can be integrated into one processing module, or each module can exist physically separately, or two or more modules can be integrated into one module.
- the integrated modules described above can be implemented in hardware or as software functional modules.
- the integrated module is implemented as a software functional module and sold or used as an independent product, it can be stored in a computer-readable storage medium.
- This computer software product is stored in a storage medium 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 in the various embodiments of this application.
- the aforementioned storage medium includes various media capable of storing program code, such as USB flash drives, portable hard drives, read-only memory (ROM), random access memory (RAM), magnetic disks, or optical disks.
- first,” “second,” etc. are used to distinguish identical or similar items that have substantially the same function and purpose. It should be understood that there is no logical or temporal dependency between “first,” “second,” and “nth,” nor does it limit the quantity or order of execution. It should also be understood that although the following description uses the terms “first,” “second,” etc., to describe various elements, these elements should not be limited by the terms. These terms are merely used to distinguish one element from another. For example, without departing from the scope of various examples, a first image can be referred to as a second image, and similarly, a second image can be referred to as a first image. Both the first image and the second image can be images, and in some cases, they can be separate and distinct images.
- sequence number of each process does not imply the order of execution.
- the execution order of each process should be determined by its function and internal logic, and should not constitute any limitation on the implementation process of the embodiments of this application.
- the term “at least one” means one or more, and the term “multiple” means two or more.
- multiple second messages refer to two or more second messages.
- system and “network” are often used interchangeably in this document.
- determining B based on A does not mean determining B solely based on A; B can also be determined based on A and/or other information.
Landscapes
- Engineering & Computer Science (AREA)
- Computer Networks & Wireless Communication (AREA)
- Signal Processing (AREA)
- Mobile Radio Communication Systems (AREA)
Abstract
Description
本申请要求于2024年06月20日提交的申请号为202410807944.3、发明名称为“多蓝牙主机的协同处理方法、装置、设备及存储介质”的中国专利申请的优先权,其全部内容通过引用结合在本申请中。This application claims priority to Chinese Patent Application No. 202410807944.3, filed on June 20, 2024, entitled “Cooperative Processing Method, Apparatus, Device and Storage Medium for Multiple Bluetooth Hosts”, the entire contents of which are incorporated herein by reference.
本申请涉及通信技术领域,特别涉及多蓝牙主机的协同处理方法、装置、设备及存储介质。This application relates to the field of communication technology, and in particular to a method, apparatus, device and storage medium for collaborative processing of multiple Bluetooth hosts.
在通信技术领域,蓝牙通信技术凭借其标准化、低功耗、多连接等特点,已经广泛应用于各种领域,例如,智能家居、智能手机、可穿戴设备、汽车信息娱乐系统等领域。其中,针对多蓝牙主机协作共存的设备,由于多蓝牙主机均与设备上的同一蓝牙控制器进行交互工作,因此,为避免多蓝牙主机同时与蓝牙控制器交互的共存冲突问题,多蓝牙主机之间需要进行协同处理。In the field of communication technology, Bluetooth communication technology, with its characteristics of standardization, low power consumption, and multiple connections, has been widely used in various fields, such as smart homes, smartphones, wearable devices, and automotive infotainment systems. However, for devices with multiple Bluetooth hosts coexisting collaboratively, since all multiple Bluetooth hosts interact with the same Bluetooth controller on the device, collaborative processing is required among the multiple Bluetooth hosts to avoid conflicts arising from simultaneous interactions.
相关技术中,多蓝牙主机之间采用协商分时工作模式进行协同处理。以双蓝牙主机为例,在第一蓝牙主机具有蓝牙控制器的控制权的情况下,第一蓝牙主机与蓝牙控制器进行交互工作,此时第二蓝牙主机不工作;第一蓝牙主机工作完成后向第二蓝牙主机交接控制权,第二蓝牙主机开始与蓝牙控制器进行交互工作,此时第一蓝牙主机停止工作。In related technologies, multiple Bluetooth hosts collaborate using a negotiated time-sharing working mode. Taking dual Bluetooth hosts as an example, when the first Bluetooth host has control of the Bluetooth controller, it interacts with the Bluetooth controller, and the second Bluetooth host is not working. After the first Bluetooth host finishes its work, it hands over control to the second Bluetooth host, and the second Bluetooth host begins to interact with the Bluetooth controller, at which point the first Bluetooth host stops working.
但是,上述协商分时工作模式,需要在两个蓝牙主机之间来回切换蓝牙控制器的控制权,同一时间仅一个蓝牙主机可以工作,使得蓝牙系统工作效率较低,且不适用于多蓝牙主机并行工作的场景。However, the aforementioned negotiated time-sharing working mode requires switching control of the Bluetooth controller back and forth between two Bluetooth hosts. Only one Bluetooth host can work at a time, resulting in low efficiency of the Bluetooth system and making it unsuitable for scenarios where multiple Bluetooth hosts work in parallel.
本申请提供了一种多蓝牙主机的协同处理方法、装置、设备及存储介质,用于实现多蓝牙主机并行工作。This application provides a method, apparatus, device, and storage medium for collaborative processing of multiple Bluetooth hosts, used to enable multiple Bluetooth hosts to work in parallel.
第一方面,提供了一种多蓝牙主机的协同处理方法,该方法包括:在第一蓝牙主机执行第一操作指令之前,获取第二蓝牙主机的第一操作信息,第一操作信息指示第二蓝牙主机的操作状态;在第二蓝牙主机的操作状态与第一操作指令不存在冲突的情况下,与蓝牙控制器交互,以执行第一操作指令。其中,第二蓝牙主机和第一蓝牙主机连接同一蓝牙控制器,即该方法适用于双蓝牙主机共存场景。此外,第一蓝牙主机或第二蓝牙主机的数量可以为两个或两个以上,则该方法也适用于两个以上的多蓝牙主机共存场景。Firstly, a collaborative processing method for multiple Bluetooth hosts is provided. This method includes: before a first Bluetooth host executes a first operation instruction, acquiring first operation information of a second Bluetooth host, the first operation information indicating the operation state of the second Bluetooth host; and, if the operation state of the second Bluetooth host does not conflict with the first operation instruction, interacting with a Bluetooth controller to execute the first operation instruction. The second Bluetooth host and the first Bluetooth host are connected to the same Bluetooth controller, meaning this method is applicable to scenarios where two Bluetooth hosts coexist. Furthermore, if the number of first or second Bluetooth hosts can be two or more, then this method is also applicable to scenarios where two or more Bluetooth hosts coexist.
该方法中,以第一蓝牙主机为例,第一蓝牙主机在工作过程中,每次启动操作指令,是先获取第二蓝牙主机的操作信息,即第二蓝牙主机可以与第一蓝牙主机同时工作,在确定无冲突的情况下才执行操作指令,而不是直接执行指令。由此,能够避免多蓝牙主机同时执行操作指令的冲突问题,实现操作指令的有序调度,进而实现多蓝牙主机的并行工作。In this method, taking the first Bluetooth host as an example, during operation, each time an operation command is initiated, the first Bluetooth host first obtains the operation information of the second Bluetooth host. This means the second Bluetooth host can work simultaneously with the first Bluetooth host. Only after confirming there is no conflict will the operation command be executed, rather than executing it directly. This avoids conflicts caused by multiple Bluetooth hosts executing operation commands simultaneously, achieving orderly scheduling of operation commands and thus enabling parallel operation of multiple Bluetooth hosts.
其中,操作状态可以指示操作指令的执行情况。可选地,操作状态包括正在操作、操作完成或者空闲等。例如,第一操作信息包括第一标记,第一标记用于指示第二蓝牙主机的操作状态为操作完成;或者,第一操作信息包括第二标记,第二标记用于指示第二蓝牙主机的操作状态为空闲。第二蓝牙主机的操作状态与第一操作指令不存在冲突是指,第二蓝牙主机的操作指令的执行情况不对第一蓝牙主机执行第一操作指令造成影响,例如,第二蓝牙主机未执行与第一操作指令存在冲突的操作指令,使得第一蓝牙主机在该不存在冲突的情况下执行第一操作指令的成功率较高。The operation status can indicate the execution status of the operation command. Optionally, the operation status includes "operating," "operation completed," or "idle." For example, the first operation information includes a first flag indicating that the operation status of the second Bluetooth host is "operation completed"; or, the first operation information includes a second flag indicating that the operation status of the second Bluetooth host is "idle." The absence of conflict between the operation status of the second Bluetooth host and the first operation command means that the execution status of the second Bluetooth host's operation command does not affect the execution of the first Bluetooth host's first operation command. For example, the second Bluetooth host does not execute operation commands that conflict with the first operation command, resulting in a higher success rate for the first Bluetooth host to execute the first operation command under these conflict-free conditions.
在一种可能的实施方式中,获取第二蓝牙主机的第一操作信息的方式可以包括:向第二蓝牙主机发送第一查询指令,第一查询指令用于第二蓝牙主机向第一蓝牙主机发送第二蓝牙主机的第一操作信息;接收第二蓝牙主机发送的第一操作信息。In one possible implementation, the method of obtaining the first operation information of the second Bluetooth host may include: sending a first query instruction to the second Bluetooth host, the first query instruction being used by the second Bluetooth host to send the first operation information of the second Bluetooth host to the first Bluetooth host; and receiving the first operation information sent by the second Bluetooth host.
通过向对方蓝牙主机发送查询指令的方式来获取对方蓝牙主机的操作信息,实现了多蓝牙主机之间的协同交互,且由于通过查询方式获取的第一操作信息是对方蓝牙主机应答的操作信息,能够保证获取的第一操作信息的准确性,使得获取的第一操作信息的可靠性更高。By sending a query command to the other Bluetooth host, the operation information of the other Bluetooth host is obtained, realizing collaborative interaction between multiple Bluetooth hosts. Since the first operation information obtained by querying is the operation information of the other Bluetooth host's response, the accuracy of the first operation information can be guaranteed, making the reliability of the obtained first operation information higher.
可选地,第一查询指令用于第二蓝牙主机在第二蓝牙主机的操作状态与第一操作指令不存在冲突的情况下,向第一蓝牙主机发送第二蓝牙主机的第一操作信息,则第一操作信息指示第二蓝牙主机的操作状态与第一操作指令不存在冲突。在该方式中,直至第二蓝牙主机的操作状态与第一操作指令不存在冲突才进行应答,避免应答的操作状态与第一操作指令存在冲突导致的查询指令的再次发送。即一个操作指令发送一次查询指令,即可在查询指令被应答开始执行操作指令,且保证不会发生操作指令同时执行的冲突。Optionally, the first query command is used by the second Bluetooth host to send first operation information to the first Bluetooth host when there is no conflict between the second Bluetooth host's operating state and the first operation command. The first operation information indicates that there is no conflict between the second Bluetooth host's operating state and the first operation command. In this method, a response is only sent when there is no conflict between the second Bluetooth host's operating state and the first operation command, avoiding the need to resend the query command if a conflict arises between the response's operating state and the first operation command. That is, one query command is sent for each operation command, and the operation command can be executed only after a response to the query command, ensuring that no conflict occurs where operation commands are executed simultaneously.
在一种可能的实施方式中,执行第一操作指令之后,在第一操作指令执行完成的情况下,向第二蓝牙主机发送第二操作信息,第二操作信息指示第一蓝牙主机执行完成第一操作指令。由此,通过协同交互实现了多蓝牙主机之间的操作信息的同步。In one possible implementation, after executing the first operation instruction, upon completion of the first operation instruction, a second operation message is sent to the second Bluetooth host. The second operation message instructs the first Bluetooth host to complete the execution of the first operation instruction. Thus, synchronization of operation information among multiple Bluetooth hosts is achieved through collaborative interaction.
在一种可能的实施方式中,第一蓝牙主机记录有协同信息,协同信息指示第二蓝牙主机的第一操作信息。在该情况下,获取第二蓝牙主机的第一操作信息的方式可以包括:读取第一蓝牙主机记录的协同信息,得到第二蓝牙主机的第一操作信息。通过记录对方蓝牙主机的操作信息的方式,可以实现第一操作信息的快速获取,提高第一操作信息的获取效率。In one possible implementation, the first Bluetooth host records collaboration information, which indicates first operation information of the second Bluetooth host. In this case, obtaining the first operation information of the second Bluetooth host can include reading the collaboration information recorded by the first Bluetooth host to obtain the first operation information of the second Bluetooth host. By recording the operation information of the other Bluetooth host, the first operation information can be obtained quickly, improving the efficiency of obtaining the first operation information.
在一种可能的实施方式中,获取第二蓝牙主机的第一操作信息之前,提前记录协同信息。可选地,接收第二查询指令,第二查询指令是在第二蓝牙主机执行第二操作指令之前发送的;向第二蓝牙主机发送第三操作信息,第三操作信息指示第一蓝牙主机的操作状态与第二操作指令不存在冲突;将第四操作信息作为协同信息记录在第一蓝牙主机,第四操作信息指示第二蓝牙主机正在执行第二操作指令。或者,接收第五操作信息,第五操作信息是在第二操作指令执行完成的情况下向第一蓝牙主机发送的,第五操作信息指示第二蓝牙主机执行完成第二操作指令;将第二蓝牙主机的第五操作信息作为协同信息记录在第一蓝牙主机。In one possible implementation, coordination information is recorded before acquiring the first operation information of the second Bluetooth host. Optionally, a second query command is received, which is sent before the second Bluetooth host executes the second operation command; third operation information is sent to the second Bluetooth host, indicating that the operation status of the first Bluetooth host does not conflict with the second operation command; and fourth operation information is recorded on the first Bluetooth host as coordination information, indicating that the second Bluetooth host is executing the second operation command. Alternatively, a fifth operation information is received, which is sent to the first Bluetooth host after the second operation command has been executed, indicating that the second Bluetooth host has completed the second operation command; and the fifth operation information of the second Bluetooth host is recorded on the first Bluetooth host as coordination information.
在该情况下,第二蓝牙主机在执行第二操作指令之前,也向第一蓝牙主机查询第一蓝牙主机的操作信息。由于第一蓝牙主机应答第三操作信息后,第二蓝牙主机开始执行第二操作指令,因此,可以将指示第二蓝牙主机正在执行第二操作指令的第四操作信息作为协同信息进行记录。此外,第二蓝牙主机在执行完成第二操作指令之后也会向第一蓝牙主机通知,因此,可以将指示第二蓝牙主机执行完成第二操作指令的第五操作信息作为协同信息进行记录。由此,实现了协同信息的实时记录,使得多蓝牙主机之间可以实时同步操作信息。In this scenario, before executing the second operation command, the second Bluetooth host also queries the first Bluetooth host for its operation information. Since the second Bluetooth host begins executing the second operation command after the first Bluetooth host responds with the third operation information, the fourth operation information indicating that the second Bluetooth host is executing the second operation command can be recorded as coordination information. Furthermore, the second Bluetooth host will also notify the first Bluetooth host after completing the second operation command; therefore, the fifth operation information indicating that the second Bluetooth host has completed the second operation command can be recorded as coordination information. This achieves real-time recording of coordination information, enabling real-time synchronization of operation information among multiple Bluetooth hosts.
在一种可能的实施方式中,第二蓝牙主机的操作状态与第一操作指令不存在冲突包括:第二蓝牙主机未执行与第一操作指令的类型相同的操作指令。在该方式中,可以避免多蓝牙主机同时执行同类型的操作指令,而不同类型的操作指令可以同时执行,使得不同类型的操作指令之间不互相影响。或者,第二蓝牙主机的操作状态与第一操作指令不存在冲突包括:第二蓝牙主机未执行任何操作指令。在该方式中,可以避免多蓝牙主机同时执行同类型或不同类型的操作指令,更好的避免任何冲突的可能情况发生。In one possible implementation, the absence of conflict between the operating state of the second Bluetooth host and the first operation instruction includes: the second Bluetooth host not executing an operation instruction of the same type as the first operation instruction. This approach avoids multiple Bluetooth hosts simultaneously executing the same type of operation instruction, while allowing different types of operation instructions to be executed simultaneously without interference between them. Alternatively, the absence of conflict between the operating state of the second Bluetooth host and the first operation instruction includes: the second Bluetooth host not executing any operation instruction. This approach avoids multiple Bluetooth hosts simultaneously executing the same or different types of operation instructions, further preventing any potential conflicts.
在一种可能的实施方式中,第一操作指令用于更新蓝牙控制器的扫描参数,第一操作信息包括第二蓝牙主机的第一扫描参数。在该情况下,与蓝牙控制器交互的方式可以包括:在第一蓝牙主机的第二扫描参数大于或等于第一扫描参数指示的扫描范围的情况下,向蓝牙控制器发送第二扫描参数,第二扫描参数用于蓝牙控制器将扫描参数更新为第二扫描参数;或者,在第二扫描参数小于第一扫描参数指示的扫描范围的情况下,向蓝牙控制器发送第一扫描参数,第一扫描参数用于蓝牙控制器将扫描参数更新为第一扫描参数。In one possible implementation, the first operation instruction is used to update the scanning parameters of the Bluetooth controller, and the first operation information includes the first scanning parameters of the second Bluetooth host. In this case, the interaction with the Bluetooth controller may include: if the second scanning parameters of the first Bluetooth host are greater than or equal to the scanning range indicated by the first scanning parameters, sending the second scanning parameters to the Bluetooth controller, the second scanning parameters being used by the Bluetooth controller to update the scanning parameters to the second scanning parameters; or, if the second scanning parameters are less than the scanning range indicated by the first scanning parameters, sending the first scanning parameters to the Bluetooth controller, the first scanning parameters being used by the Bluetooth controller to update the scanning parameters to the first scanning parameters.
由此,多蓝牙主机之间不仅可以交互扫描状态,还可以交互扫描参数,在多蓝牙主机之间的扫描参数不同的情况下,可以使蓝牙控制器的扫描参数统一更新为多蓝牙主机中扫描范围最大的扫描参数,使得蓝牙控制器基于更新后的扫描参数进行扫描的扫描范围大于每一蓝牙主机的扫描参数的扫描范围,进而使得多蓝牙主机能够复用蓝牙控制器的扫描资源,即蓝牙控制器基于更新后的扫描参数进行扫描的扫描数据可以同时被第一蓝牙主机和第二蓝牙主机使用。Therefore, multiple Bluetooth hosts can not only exchange scanning status but also scanning parameters. When the scanning parameters of multiple Bluetooth hosts are different, the scanning parameters of the Bluetooth controller can be uniformly updated to the scanning parameters with the largest scanning range among the multiple Bluetooth hosts. This makes the scanning range of the Bluetooth controller based on the updated scanning parameters larger than the scanning range of each Bluetooth host's scanning parameters. As a result, multiple Bluetooth hosts can reuse the scanning resources of the Bluetooth controller. That is, the scanning data of the Bluetooth controller based on the updated scanning parameters can be used by the first Bluetooth host and the second Bluetooth host at the same time.
在一种可能的实施方式中,第一操作指令用于建立蓝牙连接,第一操作信息包括第二蓝牙主机建立的蓝牙连接的第一数量,第一数量用于控制第一蓝牙主机建立的蓝牙连接的第二数量,第二数量与第一数量之和小于或等于蓝牙控制器建立蓝牙连接的参考数量。由此,多蓝牙主机之间不仅可以交互连接状态,还可以交互连接数量,实现多蓝牙主机之间的连接资源的合理分配。In one possible implementation, the first operation instruction is used to establish a Bluetooth connection, and the first operation information includes a first number of Bluetooth connections established by the second Bluetooth host. The first number is used to control a second number of Bluetooth connections established by the first Bluetooth host, and the sum of the second number and the first number is less than or equal to a reference number of Bluetooth connections established by the Bluetooth controller. Thus, multiple Bluetooth hosts can not only exchange connection statuses but also exchange connection counts, achieving a reasonable allocation of connection resources among multiple Bluetooth hosts.
在一种可能的实施方式中,在第一蓝牙主机执行第一操作指令之前,还需确定第二蓝牙主机的工作状态,即在第二蓝牙主机的工作状态为退出休眠的情况下,获取第二蓝牙主机的操作信息;在第二蓝牙主机的操作状态与第一操作指令不存在冲突的情况下,与蓝牙控制器交互,以执行第一操作指令。其中,第二蓝牙主机的工作状态为退出休眠即表示第二蓝牙主机正在工作,则处于多蓝牙主机并行工作的场景,在并行工作场景下才获取第二蓝牙主机的操作信息,以避免多蓝牙主机并行工作的冲突问题。In one possible implementation, before the first Bluetooth host executes the first operation command, it is also necessary to determine the working state of the second Bluetooth host. That is, if the second Bluetooth host is in the "exit from sleep" state, the operation information of the second Bluetooth host is obtained. If the operating state of the second Bluetooth host does not conflict with the first operation command, it interacts with the Bluetooth controller to execute the first operation command. Here, the second Bluetooth host being in the "exit from sleep" state indicates that the second Bluetooth host is working, which is a scenario of multiple Bluetooth hosts working in parallel. The operation information of the second Bluetooth host is only obtained in a parallel working scenario to avoid conflicts caused by multiple Bluetooth hosts working in parallel.
在另一种可能的实施方式中,在第二蓝牙主机的工作状态为进入休眠的情况下,直接与蓝牙控制器交互,以执行第一操作指令,即无需获取第二蓝牙主机的操作信息。其中,第二蓝牙主机的工作状态为进入休眠即表示第二蓝牙主机不工作,则处于单蓝牙主机的场景,因而直接执行操作即可,节省了协同处理带来的开销。In another possible implementation, when the second Bluetooth host is in sleep mode, it directly interacts with the Bluetooth controller to execute the first operation command, without needing to obtain the operation information of the second Bluetooth host. Here, the second Bluetooth host being in sleep mode indicates that it is not working, thus operating in a single Bluetooth host scenario, allowing for direct operation execution and saving the overhead of collaborative processing.
第二方面,提供了一种多蓝牙主机的协同处理装置,用于执行第一方面或第一方面的任意一种可能的实现方式中的方法。具体地,该多蓝牙主机的协同处理装置包括用于执行第一方面或第一方面的任意一种可能的实现方式中的方法的模块。在一种可能的实施方式中,该装置包括:Secondly, a multi-Bluetooth host collaborative processing apparatus is provided for executing the method in the first aspect or any possible implementation thereof. Specifically, the multi-Bluetooth host collaborative processing apparatus includes modules for executing the method in the first aspect or any possible implementation thereof. In one possible implementation, the apparatus includes:
获取模块,用于在第一蓝牙主机执行第一操作指令之前,获取第二蓝牙主机的第一操作信息,第二蓝牙主机和第一蓝牙主机连接同一蓝牙控制器,第一操作信息指示第二蓝牙主机的操作状态;The acquisition module is used to acquire the first operation information of the second Bluetooth host before the first Bluetooth host executes the first operation instruction. The second Bluetooth host and the first Bluetooth host are connected to the same Bluetooth controller. The first operation information indicates the operation status of the second Bluetooth host.
执行模块,用于在第二蓝牙主机的操作状态与第一操作指令不存在冲突的情况下,与蓝牙控制器交互,以执行第一操作指令。The execution module is used to interact with the Bluetooth controller to execute the first operation command when there is no conflict between the operation state of the second Bluetooth host and the first operation command.
在一种可能的实施方式中,获取模块,用于向第二蓝牙主机发送第一查询指令,第一查询指令用于第二蓝牙主机向第一蓝牙主机发送第二蓝牙主机的第一操作信息;接收第二蓝牙主机发送的第一操作信息。In one possible implementation, the acquisition module is configured to send a first query instruction to the second Bluetooth host, the first query instruction being used by the second Bluetooth host to send first operation information of the second Bluetooth host to the first Bluetooth host; and to receive the first operation information sent by the second Bluetooth host.
在一种可能的实施方式中,该装置还包括:第一发送模块,用于在第一操作指令执行完成的情况下,向第二蓝牙主机发送第二操作信息,第二操作信息指示第一蓝牙主机执行完成第一操作指令。In one possible implementation, the device further includes: a first transmitting module, configured to send second operation information to a second Bluetooth host upon completion of the execution of the first operation instruction, wherein the second operation information instructs the first Bluetooth host to complete the execution of the first operation instruction.
在一种可能的实施方式中,第一蓝牙主机记录有协同信息,协同信息指示第二蓝牙主机的第一操作信息。In one possible implementation, the first Bluetooth host records coordination information that indicates first operational information of the second Bluetooth host.
在一种可能的实施方式中,该装置还包括:接收模块,用于接收第二查询指令,第二查询指令是在第二蓝牙主机执行第二操作指令之前发送的;第二发送模块,用于向第二蓝牙主机发送第三操作信息,第三操作信息指示第一蓝牙主机的操作状态与第二操作指令不存在冲突;记录模块,用于将第四操作信息作为协同信息记录在第一蓝牙主机,第四操作信息指示第二蓝牙主机正在执行第二操作指令。In one possible implementation, the device further includes: a receiving module for receiving a second query instruction, the second query instruction being sent before the second Bluetooth host executes the second operation instruction; a second sending module for sending third operation information to the second Bluetooth host, the third operation information indicating that the operation status of the first Bluetooth host does not conflict with the second operation instruction; and a recording module for recording fourth operation information as coordination information on the first Bluetooth host, the fourth operation information indicating that the second Bluetooth host is executing the second operation instruction.
在一种可能的实施方式中,接收模块,还用于接收第五操作信息,第五操作信息是在第二操作指令执行完成的情况下向第一蓝牙主机发送的,第五操作信息指示第二蓝牙主机执行完成第二操作指令;记录模块,还用于将第五操作信息作为协同信息记录在第一蓝牙主机。In one possible implementation, the receiving module is further configured to receive fifth operation information, which is sent to the first Bluetooth host after the second operation instruction has been completed, and the fifth operation information instructs the second Bluetooth host to complete the second operation instruction; the recording module is further configured to record the fifth operation information as coordination information in the first Bluetooth host.
在一种可能的实施方式中,第二蓝牙主机的操作状态与第一操作指令不存在冲突包括:第二蓝牙主机未执行与第一操作指令的类型相同的操作指令,或者,第二蓝牙主机未执行任何操作指令。In one possible implementation, the fact that the operating state of the second Bluetooth host does not conflict with the first operating instruction includes: the second Bluetooth host does not execute an operating instruction of the same type as the first operating instruction, or the second Bluetooth host does not execute any operating instruction.
在一种可能的实施方式中,第一操作指令用于更新蓝牙控制器的扫描参数,第一操作信息包括第二蓝牙主机的第一扫描参数;执行模块,用于在第一蓝牙主机的第二扫描参数大于或等于第一扫描参数指示的扫描范围的情况下,向蓝牙控制器发送第二扫描参数,第二扫描参数用于蓝牙控制器将扫描参数更新为第二扫描参数;或者,在第二扫描参数小于第一扫描参数指示的扫描范围的情况下,向蓝牙控制器发送第一扫描参数,第一扫描参数用于蓝牙控制器将扫描参数更新为第一扫描参数。In one possible implementation, the first operation instruction is used to update the scanning parameters of the Bluetooth controller, and the first operation information includes the first scanning parameters of the second Bluetooth host; the execution module is used to send the second scanning parameters to the Bluetooth controller when the second scanning parameters of the first Bluetooth host are greater than or equal to the scanning range indicated by the first scanning parameters, and the second scanning parameters are used by the Bluetooth controller to update the scanning parameters to the second scanning parameters; or, when the second scanning parameters are less than the scanning range indicated by the first scanning parameters, the first scanning parameters are sent to the Bluetooth controller, and the first scanning parameters are used by the Bluetooth controller to update the scanning parameters to the first scanning parameters.
在一种可能的实施方式中,第一操作指令用于建立蓝牙连接,第一操作信息包括第二蓝牙主机建立的蓝牙连接的第一数量,第一数量用于控制第一蓝牙主机建立的蓝牙连接的第二数量,第二数量与第一数量之和小于或等于蓝牙控制器建立蓝牙连接的参考数量。In one possible implementation, the first operation instruction is used to establish a Bluetooth connection, and the first operation information includes a first number of Bluetooth connections established by the second Bluetooth host. The first number is used to control a second number of Bluetooth connections established by the first Bluetooth host, and the sum of the second number and the first number is less than or equal to a reference number of Bluetooth connections established by the Bluetooth controller.
在一种可能的实施方式中,获取模块,用于在第二蓝牙主机的工作状态为退出休眠的情况下,获取第二蓝牙主机的操作信息。In one possible implementation, the acquisition module is used to acquire the operation information of the second Bluetooth host when the second Bluetooth host is in the working state of exiting sleep.
第三方面,提供了一种终端设备,该终端设备包括:处理器,所述处理器与存储器耦合,所述存储器中存储有至少一条程序指令或代码,所述至少一条程序指令或代码由所述处理器加载并执行,以使所述终端设备实现如上第一方面或第一方面任一所述的多蓝牙主机的协同处理方法。Thirdly, a terminal device is provided, comprising: a processor coupled to a memory, the memory storing at least one program instruction or code, the at least one program instruction or code being loaded and executed by the processor to enable the terminal device to implement the multi-Bluetooth host collaborative processing method as described in the first aspect or any one of the first aspects.
可选地,所述处理器为一个或多个,所述存储器为一个或多个。Optionally, the processor may be one or more, and the memory may be one or more.
可选地,所述存储器可以与所述处理器集成在一起,或者所述存储器与处理器分离设置。Optionally, the memory may be integrated with the processor, or the memory may be separated from the processor.
在具体实现过程中,存储器可以为非瞬时性(non-transitory)存储器,例如只读存储器(readonly memory,ROM),其可以与处理器集成在同一块芯片上,也可以分别设置在不同的芯片上,本申请对存储器的类型以及存储器与处理器的设置方式不做限定。In the specific implementation process, the memory can be a non-transitory memory, such as read-only memory (ROM), which can be integrated with the processor on the same chip or set on different chips. This application does not limit the type of memory or the way the memory and processor are set.
第四方面,提供了一种计算机可读存储介质,所述存储介质中存储有至少一条指令,所述指令由处理器加载并执行,以使计算机实现上述各方面中的方法。Fourthly, a computer-readable storage medium is provided, the storage medium storing at least one instruction, the instruction being loaded and executed by a processor to enable a computer to implement the methods in the above aspects.
第五方面,提供了一种计算机程序(产品),所述计算机程序(产品)包括:计算机程序代码,当所述计算机程序代码被计算机运行时,使得所述计算机执行上述各方面中的方法。Fifthly, a computer program (product) is provided, the computer program (product) comprising: computer program code, which, when executed by a computer, causes the computer to perform the methods described in the above aspects.
第六方面,提供了一种芯片,包括处理器,用于从存储器中调用并运行所述存储器中存储的指令,使得安装有所述芯片的通信设备执行上述各方面中的方法。In a sixth aspect, a chip is provided, including a processor for retrieving and executing instructions stored in a memory, causing a communication device on which the chip is mounted to perform the methods described in the preceding aspects.
第七方面,提供另一种芯片,包括:输入接口、输出接口、处理器和存储器,所述输入接口、输出接口、所述处理器以及所述存储器之间通过内部连接通路相连,所述处理器用于执行所述存储器中的代码,当所述代码被执行时,所述处理器用于执行上述各方面中的方法。In a seventh aspect, another chip is provided, comprising: an input interface, an output interface, a processor, and a memory, wherein the input interface, the output interface, the processor, and the memory are connected via an internal connection path, and the processor is used to execute code in the memory, wherein when the code is executed, the processor is used to perform the methods in the foregoing aspects.
应当理解的是,本申请的第二方面至第七方面技术方案及对应的可能的实施方式所取得的有益效果可以参见上述对第一方面及其对应的可能的实施方式的技术效果,此处不再赘述。此外,上述第二方面提及的多蓝牙主机的协同处理装置可以为第六方面或第七方面提及的芯片,或者多蓝牙主机的协同处理装置还可以为第三方面提及的终端设备。It should be understood that the beneficial effects achieved by the technical solutions of the second to seventh aspects of this application and their corresponding possible implementations can be found in the technical effects of the first aspect and its corresponding possible implementations described above, and will not be repeated here. Furthermore, the multi-Bluetooth host collaborative processing device mentioned in the second aspect can be the chip mentioned in the sixth or seventh aspect, or the multi-Bluetooth host collaborative processing device can also be the terminal device mentioned in the third aspect.
图1为本申请实施例提供的一种多蓝牙应用场景的示意图;Figure 1 is a schematic diagram of a multi-Bluetooth application scenario provided by an embodiment of this application;
图2为本申请实施例提供的一种蓝牙通信系统的结构示意图;Figure 2 is a schematic diagram of a Bluetooth communication system provided in an embodiment of this application;
图3为本申请实施例提供的一种多蓝牙主机的协同处理方法的流程图;Figure 3 is a flowchart of a collaborative processing method for multiple Bluetooth hosts provided in an embodiment of this application;
图4为本申请实施例提供的另一种多蓝牙主机的协同处理方法的流程图;Figure 4 is a flowchart of another collaborative processing method for multiple Bluetooth hosts provided in an embodiment of this application;
图5为本申请实施例提供的一种多蓝牙主机的协同处理方法的交互示意图;Figure 5 is an interactive schematic diagram of a collaborative processing method for multiple Bluetooth hosts provided in an embodiment of this application;
图6为本申请实施例提供的另一种多蓝牙主机的协同处理方法的交互示意图;Figure 6 is an interactive schematic diagram of another collaborative processing method for multiple Bluetooth hosts provided in an embodiment of this application;
图7为本申请实施例提供的一种多蓝牙主机的协同处理装置的结构示意图;Figure 7 is a schematic diagram of the structure of a collaborative processing device for multiple Bluetooth hosts provided in an embodiment of this application;
图8为本申请实施例提供的一种终端设备的结构示意图;Figure 8 is a structural schematic diagram of a terminal device provided in an embodiment of this application;
图9为本申请实施例提供的另一种终端设备的结构示意图;Figure 9 is a schematic diagram of the structure of another terminal device provided in an embodiment of this application;
图10为本申请实施例提供的一种终端系统架构的示意图。Figure 10 is a schematic diagram of a terminal system architecture provided in an embodiment of this application.
为使本申请的目的、技术方案和优点更加清楚,下面将结合附图对本申请实施方式作进一步地详细描述。To make the objectives, technical solutions, and advantages of this application clearer, the embodiments of this application will be described in further detail below with reference to the accompanying drawings.
随着蓝牙通信的发展,具有蓝牙通信功能的设备越来越普遍。在实际应用中,在蓝牙通信系统长时间运行的情况下,设备的处理器需要长时间处理蓝牙数据,设备能耗会急剧增加。因此,为了降低设备的整机能耗,多蓝牙主机协作共存的技术应运而生。以双蓝牙主机协作共存为例,两个蓝牙主机在设备的主处理器和协处理器上分别部署,每个蓝牙主机运行各自的蓝牙应用。蓝牙主机通过蓝牙技术可以与至少一个蓝牙外设无线连接,从而实现数据传输和通信功能,蓝牙外设包括但不限于蓝牙耳机、蓝牙鼠标、蓝牙键盘、蓝牙音箱或蓝牙打印机等。其中,主处理器一般主频高、能耗高,协处理器一般主频低、能耗低。由此,将长时间运行的蓝牙应用或者高负载的蓝牙应用由主处理器卸载到协处理器,以减少主处理器的工作时长,从而降低设备的整机能耗,优化设备的续航。With the development of Bluetooth communication, devices with Bluetooth communication capabilities are becoming increasingly common. In practical applications, when a Bluetooth communication system runs for extended periods, the device's processor needs to process Bluetooth data for a long time, leading to a sharp increase in device power consumption. Therefore, to reduce the overall power consumption of devices, the technology of multiple Bluetooth hosts coexisting has emerged. Taking dual Bluetooth host coexistence as an example, two Bluetooth hosts are deployed on the device's main processor and coprocessor, respectively, with each Bluetooth host running its own Bluetooth application. The Bluetooth hosts can wirelessly connect to at least one Bluetooth peripheral via Bluetooth technology, thereby enabling data transmission and communication functions. Bluetooth peripherals include, but are not limited to, Bluetooth headsets, Bluetooth mice, Bluetooth keyboards, Bluetooth speakers, or Bluetooth printers. The main processor typically has a high clock speed and high power consumption, while the coprocessor typically has a low clock speed and low power consumption. Thus, long-running or high-load Bluetooth applications are offloaded from the main processor to the coprocessor, reducing the main processor's workload and thereby lowering the overall power consumption of the device and optimizing its battery life.
蓝牙系统架构通常包括两个部分,分别是蓝牙主机和蓝牙控制器。可选地,蓝牙主机和蓝牙控制器可以部署在两个不同的芯片上,蓝牙主机和蓝牙控制器之间通过主机控制接口协议(host controller interface,HCI)接口进行交互,例如,发送指令或传输数据。蓝牙主机(host)是一个逻辑实体,定义为非核心配置文件以下与HCI接口以上的所有层,蓝牙控制器(controller)是定义为HCI接口以下所有层的逻辑实体。针对多蓝牙主机协作共存的设备来说,多个蓝牙主机分别通过HCI接口与同一个蓝牙控制器交互,即蓝牙控制器包括双HCI接口。由此,若多个蓝牙主机同时与蓝牙控制器交互,则会造成冲突。A Bluetooth system architecture typically consists of two parts: a Bluetooth host and a Bluetooth controller. Optionally, the Bluetooth host and controller can be deployed on two different chips. The Bluetooth host and controller interact via a Host Controller Interface (HCI) protocol, for example, by sending commands or transmitting data. The Bluetooth host is a logical entity defined as all layers below the non-core configuration file and above the HCI interface, while the Bluetooth controller is a logical entity defined as all layers below the HCI interface. For devices with multiple Bluetooth hosts coexisting, multiple Bluetooth hosts interact with the same Bluetooth controller through their respective HCI interfaces; that is, the Bluetooth controller has dual HCI interfaces. Therefore, if multiple Bluetooth hosts interact with the Bluetooth controller simultaneously, conflicts will occur.
相关技术一中,主处理器和协处理器上部署的两个蓝牙主机协商分时工作。例如,蓝牙主机A首先拥有蓝牙控制器的控制权,蓝牙主机A与蓝牙控制器进行HCI数据交互;蓝牙主机A完成HCI数据交互后,向蓝牙控制器发送切换控制权的指令,蓝牙控制器应答蓝牙主机A;蓝牙主机A收到应答后,向蓝牙主机B发送交接控制权的请求,蓝牙主机B应答蓝牙主机A;蓝牙主机B向蓝牙控制器发送获取控制权的指令,蓝牙控制器应答蓝牙主机B;由此,蓝牙主机B拥有蓝牙控制器的控制权,蓝牙主机B与蓝牙控制器进行HCI数据交互。也就是说,主处理器上的蓝牙主机A工作时,协处理器上的蓝牙主机B不工作。In one related technology, two Bluetooth hosts deployed on the main processor and coprocessor negotiate time-sharing operation. For example, Bluetooth host A initially gains control of the Bluetooth controller and engages in HCI data exchange with it. After completing the HCI data exchange, Bluetooth host A sends a command to the Bluetooth controller to switch control, and the controller responds. Upon receiving the response, Bluetooth host A sends a request to Bluetooth host B to relinquish control, and B responds. Bluetooth host B then sends a command to the Bluetooth controller to acquire control, and the controller responds. Thus, Bluetooth host B gains control of the Bluetooth controller and engages in HCI data exchange with it. In other words, when Bluetooth host A on the main processor is working, Bluetooth host B on the coprocessor is not working.
上述相关技术一中,采用双蓝牙主机分时控制蓝牙控制器的方式,能够解决双蓝牙主机共存冲突问题。但是,双蓝牙主机之间需要来回切换蓝牙控制器的控制权,同一个时刻一个蓝牙主机独占蓝牙控制器的控制权,另外一个蓝牙主机完全失去控制权。且第二蓝牙主机是被动接收第一蓝牙主机交接的控制权,并不能主动获取控制权,在具有控制权后,由于另一蓝牙主机已经不工作,所以在启动操作指令的情况下直接执行操作指令即可。因此,该方式仅能适用不需要双蓝牙主机同时工作的场景,例如单蓝牙应用的场景,而不适用于双蓝牙主机并行工作的场景,例如多蓝牙应用的场景。In the aforementioned related technology one, the method of using dual Bluetooth hosts to control the Bluetooth controller in a time-sharing manner can solve the problem of conflict in the coexistence of dual Bluetooth hosts. However, the two Bluetooth hosts need to switch control of the Bluetooth controller back and forth. At any given time, one Bluetooth host exclusively holds control of the Bluetooth controller, while the other Bluetooth host completely loses control. Furthermore, the second Bluetooth host passively receives control from the first Bluetooth host and cannot actively acquire control. Once it gains control, since the other Bluetooth host is no longer working, it can directly execute the operation command upon initiation. Therefore, this method is only suitable for scenarios where dual Bluetooth hosts do not need to work simultaneously, such as single Bluetooth applications, and is not suitable for scenarios where dual Bluetooth hosts work in parallel, such as multi-Bluetooth applications.
相关技术二中,主处理器和协处理器上部署的两个蓝牙主机存在主从关系,主处理器上部署的主蓝牙主机通过下发指令控制协处理器上的从蓝牙主机进行蓝牙通信。使得双蓝牙主机之间存在明显的主从关系,协处理器上的蓝牙主机的自主权小,仅能执行主处理器下发的指令任务,不具备自主工作能力,仍不适用于多蓝牙应用的场景,即仍不适用于双蓝牙主机并行工作的场景。In related technology two, the two Bluetooth hosts deployed on the main processor and coprocessor have a master-slave relationship. The master Bluetooth host deployed on the main processor controls the slave Bluetooth host on the coprocessor to conduct Bluetooth communication by issuing commands. This results in a clear master-slave relationship between the two Bluetooth hosts. The Bluetooth host on the coprocessor has little autonomy and can only execute the commands issued by the main processor. It does not have the ability to work independently and is still not suitable for scenarios with multiple Bluetooth applications, that is, scenarios where two Bluetooth hosts work in parallel.
本申请实施例提供了一种双蓝牙主机的协同处理方法,用于实现双蓝牙主机的并行工作。该双蓝牙主机的协同处理方法可以适用于多蓝牙应用的通信场景,多蓝牙应用的通信场景中可以包括多个蓝牙通信设备,任一蓝牙通信设备与其他蓝牙通信设备分别进行蓝牙业务,蓝牙业务由任一蓝牙通信设备的多个蓝牙应用触发,多个蓝牙应用部署在任一蓝牙通信设备的至少两个蓝牙主机上且存在并行运行的需求,即存在双蓝牙主机并行工作的需求。This application provides a collaborative processing method for dual Bluetooth hosts, enabling parallel operation of two Bluetooth hosts. This method is applicable to communication scenarios involving multiple Bluetooth applications. Such scenarios may include multiple Bluetooth communication devices, each of which performs Bluetooth services with other Bluetooth communication devices. These services are triggered by multiple Bluetooth applications on any given Bluetooth communication device. These applications are deployed on at least two Bluetooth hosts of any given Bluetooth communication device and require parallel operation, i.e., there is a need for parallel operation of two Bluetooth hosts.
本申请实施例不对蓝牙通信设备的类型进行限定,可以为任意的具有蓝牙通信功能的终端设备。可选地,终端设备可以是个人计算机(personal computer,PC)、手机、防丢器、无线耳机、可穿戴设备、掌上电脑(pocket PC,PPC)、平板电脑、虚拟现实(virtual reality,VR)终端设备、增强现实(augmented reality,AR)终端设备、无人驾驶(self-driving)中的无线终端、远程手术(remote medical surgery)中的无线终端、智能电网(smart grid)中的无线终端、运输安全(transportation safety)中的无线终端、智慧城市(smart city)中的无线终端、智慧家庭(smart home)中的无线终端或物联终端等等。This application does not limit the type of Bluetooth communication device; it can be any terminal device with Bluetooth communication functionality. Optionally, the terminal device can be a personal computer (PC), mobile phone, anti-loss device, wireless headset, wearable device, pocket PC (PPC), tablet computer, virtual reality (VR) terminal device, augmented reality (AR) terminal device, 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, or IoT terminal, etc.
示例性地,参见图1所示的多蓝牙应用场景的示意图,多个蓝牙通信设备分别为手机、防丢器、无线耳机和平板电脑(portable android device,PAD)。如图1所示,以手机为中心,手机的多蓝牙主机可以与防丢器、无线耳机和PAD等多个蓝牙外设进行个人全场景业务。业务场景可以包含如下几种典型场景:手机发现PAD后,可能触发蓝牙连接与蓝牙数据传输,完成数据双端设备信息更新;无线耳机开盖后的被手机扫描发现,需要进行蓝牙连接;用户通过防丢器查找遗落设备的情况下,需要手机启动蓝牙扫描以发现防丢器,发现后手机通过蓝牙连接防丢器。For example, referring to Figure 1, which illustrates a multi-Bluetooth application scenario, the multiple Bluetooth communication devices are a mobile phone, an anti-loss device, wireless earphones, and a portable Android device (PAD). As shown in Figure 1, with the mobile phone as the center, the mobile phone's multiple Bluetooth hosts can conduct personal full-scenario services with multiple Bluetooth peripherals such as the anti-loss device, wireless earphones, and PAD. The service scenarios can include the following typical scenarios: after the mobile phone discovers the PAD, it may trigger a Bluetooth connection and Bluetooth data transmission, completing the update of information between the two ends of the data device; the wireless earphones, after being opened, are scanned and discovered by the mobile phone, requiring a Bluetooth connection; when a user uses the anti-loss device to find a lost device, the mobile phone needs to initiate a Bluetooth scan to discover the anti-loss device, and after discovery, the mobile phone connects to the anti-loss device via Bluetooth.
上述业务场景由多个蓝牙应用触发,比如PAD的蓝牙连接由手机的软总线组网上线自动触发;无线耳机的蓝牙连接由手机的音频软件后台自动触发;防丢器的蓝牙连接可能是用户操作手机且由手机的查找网络触发,也可能是手机的查找网络后台自动触发。对于软总线、音频软件和查找网络等蓝牙应用,基于手机功耗的考虑,需要长期运行的蓝牙应用被部署在低功耗的协处理器的蓝牙主机上,其他蓝牙应用可能被部署在主处理器的蓝牙主机上。The aforementioned business scenarios are triggered by multiple Bluetooth applications. For example, the Bluetooth connection of the PAD is automatically triggered by the mobile phone's soft bus networking going online; the Bluetooth connection of the wireless headset is automatically triggered by the mobile phone's audio software in the background; the Bluetooth connection of the anti-loss device may be triggered by the user operating the mobile phone and by the mobile phone's network search function, or it may be automatically triggered by the mobile phone's network search function in the background. For Bluetooth applications such as soft bus, audio software, and network search, based on considerations of mobile phone power consumption, Bluetooth applications that need to run for a long time are deployed on the Bluetooth host of the low-power coprocessor, while other Bluetooth applications may be deployed on the Bluetooth host of the main processor.
本申请实施例提供的多蓝牙主机的协同处理方法可以由蓝牙通信设备执行,蓝牙通信设备可以为低功耗蓝牙(bluetooth low energy,BLE)设备,例如,图1所示的手机。蓝牙通信设备可以部署蓝牙通信系统,蓝牙通信系统包括多个蓝牙主机和蓝牙控制器。示例性地,图2为本申请实施例提供的一种蓝牙通信系统的结构示意图,如图2所示,该蓝牙通信系统的硬件模块包括处理器A、处理器B和蓝牙芯片,软件模块包括蓝牙主机A、蓝牙主机B和蓝牙控制器。蓝牙主机A部署在处理器A,蓝牙主机B部署在处理器B,蓝牙控制器部署在蓝牙芯片。示例性地,处理器A和处理器B是两个不同的处理器,不是一个处理器中的两个核心。处理器A可以为应用处理器(application processor,AP),属于主处理器;处理器B可以为传感器中枢(sensor hub,SH),属于协处理器。The multi-Bluetooth host collaborative processing method provided in this application embodiment can be executed by a Bluetooth communication device, which can be a Bluetooth Low Energy (BLE) device, such as the mobile phone shown in Figure 1. The Bluetooth communication device can deploy a Bluetooth communication system, which includes multiple Bluetooth hosts and a Bluetooth controller. For example, Figure 2 is a schematic diagram of the structure of a Bluetooth communication system provided in this application embodiment. As shown in Figure 2, the hardware module of the Bluetooth communication system includes processor A, processor B, and a Bluetooth chip, while the software module includes Bluetooth host A, Bluetooth host B, and a Bluetooth controller. Bluetooth host A is deployed on processor A, Bluetooth host B is deployed on processor B, and the Bluetooth controller is deployed on the Bluetooth chip. For example, processor A and processor B are two different processors, not two cores of the same processor. Processor A can be an application processor (AP), belonging to the main processor; processor B can be a sensor hub (SH), belonging to the coprocessor.
其中,蓝牙主机A和蓝牙主机B是蓝牙通信系统中的上位机部分,负责对蓝牙控制器的工作模式进行控制以及处理蓝牙控制器上报的数据。蓝牙主机A相当于是蓝牙通信设备的主架构中与蓝牙相关的内容,即处理器A的操作系统中与蓝牙相关的内容;蓝牙主机B则是处理器B的操作系统中与蓝牙相关的内容,蓝牙主机A对应的操作系统和蓝牙主机B对应的操作系统可以是异构的。如图2所示,蓝牙主机A和蓝牙主机B分别包括蓝牙应用、蓝牙协议栈和蓝牙接口驱动。蓝牙控制器是蓝牙通信系统中的下位机部分,负责与其他蓝牙通信设备进行连接,实现信号传输和数据交换。蓝牙控制器包括蓝牙接口驱动,至于蓝牙控制器包括的其他模块与相关技术相同,不再赘述。In this system, Bluetooth Host A and Bluetooth Host B are the host computer components, responsible for controlling the Bluetooth controller's operating mode and processing the data reported by the Bluetooth controller. Bluetooth Host A essentially represents the Bluetooth-related components in the main architecture of the Bluetooth communication device, i.e., the Bluetooth-related components in the operating system of processor A; Bluetooth Host B represents the Bluetooth-related components in the operating system of processor B. The operating systems for Bluetooth Host A and Bluetooth Host B can be heterogeneous. As shown in Figure 2, Bluetooth Host A and Bluetooth Host B respectively include the Bluetooth application, Bluetooth protocol stack, and Bluetooth interface driver. The Bluetooth controller is the slave computer component, responsible for connecting with other Bluetooth communication devices to achieve signal transmission and data exchange. The Bluetooth controller includes the Bluetooth interface driver; other modules included in the Bluetooth controller are the same as those in related technologies and will not be described further.
蓝牙应用泛指需要依赖蓝牙协议完成通信业务的应用,比如分布式软总线应用使用蓝牙发现、蓝牙连接或蓝牙传输等功能进行设备发现和信息同步,查找网络应用使用蓝牙广播、蓝牙连接等功能进行设备查找。蓝牙主机A运行的蓝牙应用和蓝牙主机B运行的蓝牙应用可以相同,也可以不同。蓝牙协议栈包含蓝牙规范定义的蓝牙协议的实现,可选地,包括但不限于逻辑链路控制与适配层(logical link control and adaptation protocol,L2CAP)、普通属性协议(generic attribute profile,GATT)等蓝牙协议的实现与封装,为蓝牙应用提供蓝牙接口。蓝牙接口提供了一种标准化的方式来实现蓝牙通信,通过使用蓝牙接口可以更轻松地开发蓝牙应用程序,并且可以在不同的蓝牙通信设备之间进行互操作。Bluetooth applications broadly refer to applications that rely on the Bluetooth protocol to complete communication services. For example, distributed soft bus applications use Bluetooth discovery, Bluetooth connection, or Bluetooth transmission functions for device discovery and information synchronization, while network search applications use Bluetooth broadcasting and Bluetooth connection functions for device discovery. The Bluetooth application running on Bluetooth host A can be the same as or different from the Bluetooth application running on Bluetooth host B. The Bluetooth protocol stack contains implementations of the Bluetooth protocols defined in the Bluetooth specification. Optionally, this includes, but is not limited to, implementations and encapsulations of Bluetooth protocols such as the Logical Link Control and Adaptation Protocol (L2CAP) and the Generic Attribute Profile (GATT), providing a Bluetooth interface for Bluetooth applications. The Bluetooth interface provides a standardized way to implement Bluetooth communication, making it easier to develop Bluetooth applications and enabling interoperability between different Bluetooth communication devices.
在本申请实施例中,蓝牙协议栈中新增了协同模块,协同模块用于实现多蓝牙主机的蓝牙通信系统中的不同蓝牙协议栈之间的协同逻辑,避免不同蓝牙协议栈之间的并发工作发生冲突。蓝牙控制器的蓝牙接口驱动与蓝牙主机的蓝牙接口驱动之间连接,用于提供蓝牙主机与蓝牙控制器之间通路的驱动程序。例如,蓝牙接口驱动为HCI接口驱动。In this embodiment, a coordination module is added to the Bluetooth protocol stack. This module implements coordination logic between different Bluetooth protocol stacks in a multi-Bluetooth host Bluetooth communication system, preventing conflicts arising from concurrent operation of different Bluetooth protocol stacks. A connection is established between the Bluetooth controller's Bluetooth interface driver and the Bluetooth host's Bluetooth interface driver, providing a pathway between the Bluetooth host and the Bluetooth controller. For example, the Bluetooth interface driver is an HCI interface driver.
图3为本申请实施例提供的一种多蓝牙主机的协同处理方法的流程图,该方法由蓝牙通信设备执行,蓝牙通信设备可以图1所示的手机。蓝牙通信设备上部署有蓝牙通信系统,蓝牙通信系统包括多个蓝牙主机和至少一个蓝牙控制器,多个蓝牙主机可以部署在同一个处理器上,也可以部署在不同的处理器上。本申请实施例以连接同一蓝牙控制器的第一蓝牙主机和第二蓝牙主机为例进行说明。例如,蓝牙通信系统可以如图2所示,第一蓝牙主机可以图2所示的蓝牙主机A,第二蓝牙主机为图2所示的蓝牙主机B;或者,第一蓝牙主机可以图2所示的蓝牙主机B,第二蓝牙主机为图2所示的蓝牙主机A。如图3所示,该多蓝牙主机的协同处理方法包括但不限于如下步骤301和步骤302。Figure 3 is a flowchart of a collaborative processing method for multiple Bluetooth hosts provided in an embodiment of this application. This method is executed by a Bluetooth communication device, which can be a mobile phone as shown in Figure 1. The Bluetooth communication device is equipped with a Bluetooth communication system, which includes multiple Bluetooth hosts and at least one Bluetooth controller. The multiple Bluetooth hosts can be deployed on the same processor or on different processors. This embodiment of the application uses a first Bluetooth host and a second Bluetooth host connected to the same Bluetooth controller as an example. For example, the Bluetooth communication system can be as shown in Figure 2, where the first Bluetooth host is Bluetooth host A as shown in Figure 2, and the second Bluetooth host is Bluetooth host B as shown in Figure 2; or, the first Bluetooth host is Bluetooth host B as shown in Figure 2, and the second Bluetooth host is Bluetooth host A as shown in Figure 2. As shown in Figure 3, the collaborative processing method for multiple Bluetooth hosts includes, but is not limited to, the following steps 301 and 302.
步骤301,在第一蓝牙主机执行第一操作指令之前,获取第二蓝牙主机的第一操作信息,第一操作信息指示第二蓝牙主机的操作状态。Step 301: Before the first Bluetooth host executes the first operation instruction, the first operation information of the second Bluetooth host is obtained, and the first operation information indicates the operation status of the second Bluetooth host.
其中,第二蓝牙主机和第一蓝牙主机连接同一蓝牙控制器,即多蓝牙主机共存场景。第一蓝牙主机启动第一操作指令表示第一蓝牙主机的工作状态为退出休眠,则第一蓝牙主机正在工作。以第一蓝牙主机部署在蓝牙通信设备的第一处理器为例,第一蓝牙主机的工作状态可以由第一处理器的工作状态确定。例如,若第一处理器的工作状态为退出休眠即第一处理器正在工作,则确定第一蓝牙主机的工作状态为退出休眠。In this scenario, the second Bluetooth host and the first Bluetooth host are connected to the same Bluetooth controller, representing a multi-Bluetooth host coexistence scenario. The first Bluetooth host initiates a first operation command, indicating that its working state is "exiting sleep," meaning it is currently operating. Taking the first Bluetooth host deployed on the first processor of the Bluetooth communication device as an example, the working state of the first Bluetooth host can be determined by the working state of the first processor. For instance, if the first processor's working state is "exiting sleep," meaning it is currently operating, then the working state of the first Bluetooth host is determined to be "exiting sleep."
在一种可能的实施方式中,在第一蓝牙主机执行第一操作指令之前,还需确定第二蓝牙主机的工作状态,即在第二蓝牙主机的工作状态为退出休眠的情况下,获取第二蓝牙主机的操作信息。其中,第二蓝牙主机的工作状态为退出休眠即表示第二蓝牙主机正在工作,则处于多蓝牙主机并行工作的场景,在并行工作场景下才获取第二蓝牙主机的操作信息,以避免多蓝牙主机并行工作的冲突问题。In one possible implementation, before the first Bluetooth host executes the first operation command, it is also necessary to determine the working state of the second Bluetooth host. That is, if the working state of the second Bluetooth host is "out of sleep," the operation information of the second Bluetooth host is obtained. Here, the working state of the second Bluetooth host being "out of sleep" indicates that the second Bluetooth host is working, which is a scenario of multiple Bluetooth hosts working in parallel. The operation information of the second Bluetooth host is only obtained in a parallel working scenario to avoid conflicts caused by multiple Bluetooth hosts working in parallel.
在另一种可能的实施方式中,在第二蓝牙主机的工作状态为进入休眠的情况下,直接与蓝牙控制器交互,以执行第一操作指令,而无需获取第二蓝牙主机的第一操作信息,也就无需判断第二蓝牙主机的操作状态是否与第一操作指令存在冲突。其中,第二蓝牙主机的工作状态为进入休眠即表示第二蓝牙主机不工作,则处于单蓝牙主机的场景,因而直接执行操作即可,节省了协同处理带来的开销。In another possible implementation, when the second Bluetooth host is in a sleep state, it directly interacts with the Bluetooth controller to execute the first operation command without needing to obtain the first operation information of the second Bluetooth host. Therefore, it is unnecessary to determine whether the operation state of the second Bluetooth host conflicts with the first operation command. Here, the second Bluetooth host being in a sleep state indicates that the second Bluetooth host is not working, thus it is a single Bluetooth host scenario, and the operation can be executed directly, saving the overhead of collaborative processing.
以第二蓝牙主机部署在蓝牙通信设备的第二处理器为例,第二蓝牙主机的工作状态可以由第二处理器的工作状态确定。例如,若第二处理器的工作状态为退出休眠即第二处理器正在工作,则确定第二蓝牙主机的工作状态为退出休眠;若第二处理器的工作状态为进入休眠即第二处理器不工作,则确定第二蓝牙主机的工作状态为进入休眠。处理器进入休眠可以降低蓝牙通信设备的功耗。Taking the second Bluetooth host deployed in the second processor of the Bluetooth communication device as an example, the working state of the second Bluetooth host can be determined by the working state of the second processor. For example, if the working state of the second processor is "exiting sleep" (i.e., the second processor is working), then the working state of the second Bluetooth host is determined to be "exiting sleep"; if the working state of the second processor is "entering sleep" (i.e., the second processor is not working), then the working state of the second Bluetooth host is determined to be "entering sleep". The processor entering sleep mode can reduce the power consumption of the Bluetooth communication device.
在本申请实施例中,获取的第二蓝牙主机的第一操作信息可以指示第二蓝牙主机的操作状态,操作状态可以指示操作指令的执行情况。可选地,操作状态包括正在操作、操作完成或者空闲等。例如,第一操作信息包括第一标记,第一标记用于指示第二蓝牙主机的操作状态为操作完成;或者,第一操作信息包括第二标记,第二标记用于指示第二蓝牙主机的操作状态为空闲。对于不同类型的操作指令,操作状态的类型也可能不同,例如,若操作指令为扫描类型,则操作状态为扫描状态,扫描状态可以包括正在扫描、扫描完成或空闲等;若操作指令为连接类型,则操作状态为建连状态,连接状态可以包括正在建连、建连完成或空闲等。In this embodiment, the acquired first operation information of the second Bluetooth host can indicate the operation state of the second Bluetooth host, and the operation state can indicate the execution status of the operation command. Optionally, the operation state includes operating, operation completed, or idle. For example, the first operation information includes a first flag, which indicates that the operation state of the second Bluetooth host is operation completed; or, the first operation information includes a second flag, which indicates that the operation state of the second Bluetooth host is idle. The type of operation state may also be different for different types of operation commands. For example, if the operation command is a scanning type, the operation state is a scanning state, which may include scanning, scanning completed, or idle; if the operation command is a connection type, the operation state is a connection establishment state, which may include connection establishment, connection establishment completed, or idle.
可选地,对于获取第二蓝牙主机的第一操作信息的方式本申请实施例不做限定,包括但不限于如下两种。Optionally, this application embodiment does not limit the method of obtaining the first operation information of the second Bluetooth host, and includes, but is not limited to, the following two methods.
方式一,向第二蓝牙主机发送第一查询指令,第一查询指令用于第二蓝牙主机向第一蓝牙主机发送第二蓝牙主机的第一操作信息;接收第二蓝牙主机发送的第一操作信息。Method 1: Send a first query command to the second Bluetooth host. The first query command is used by the second Bluetooth host to send first operation information of the second Bluetooth host to the first Bluetooth host; and receive the first operation information sent by the second Bluetooth host.
在该方式一中,通过向对方蓝牙主机发送查询指令的方式来获取对方蓝牙主机的操作信息,实现了多蓝牙主机之间的协同交互,且由于通过查询方式获取的第一操作信息是对方蓝牙主机应答的最新操作信息,能够保证获取的第一操作信息的准确性。以图2所示的蓝牙主机为例,多蓝牙主机之间的交互可以由蓝牙主机上的协同模块实现。可选地,通过第一蓝牙主机向第二蓝牙主机发送第一查询指令,第一查询指令用于第二蓝牙主机向第一蓝牙主机发送第二蓝牙主机的第一操作信息;通过第一蓝牙主机接收第二蓝牙主机发送的第一操作信息。In this first method, the operation information of the other Bluetooth host is obtained by sending a query command to the other Bluetooth host, realizing collaborative interaction between multiple Bluetooth hosts. Since the first operation information obtained through the query method is the latest operation information responded by the other Bluetooth host, the accuracy of the obtained first operation information can be guaranteed. Taking the Bluetooth host shown in Figure 2 as an example, the interaction between multiple Bluetooth hosts can be implemented by a collaborative module on the Bluetooth host. Optionally, the first Bluetooth host sends a first query command to the second Bluetooth host, and the first query command is used by the second Bluetooth host to send its first operation information to the first Bluetooth host; the first Bluetooth host receives the first operation information sent by the second Bluetooth host.
可选地,第二蓝牙主机在接收到第一查询指令后,可以立即向第一蓝牙主机发送第二蓝牙主机的第一操作信息,此时的第一操作信息指示的操作状态与第一操作指令可能存在冲突也可能不存在冲突。或者,第二蓝牙主机在接收到第一查询指令后,也可以在第二蓝牙主机的操作状态与第一操作指令不存在冲突的情况下,向第一蓝牙主机发送第二蓝牙主机的第一操作信息,此时的第一操作信息一定指示第二蓝牙主机的操作状态与第一操作指令不存在冲突。也就是说,若第二蓝牙主机正在执行操作指令或者正在执行与第一操作指令类型相同的操作指令,则第二蓝牙主机不应答第一查询指令,等待操作指令执行完成再应答第一查询指令。Optionally, after receiving the first query command, the second Bluetooth host may immediately send its first operation information to the first Bluetooth host. The operation status indicated by the first operation information may or may not conflict with the first operation command. Alternatively, after receiving the first query command, the second Bluetooth host may also send its first operation information to the first Bluetooth host if its operation status does not conflict with the first operation command. In this case, the first operation information will definitely indicate that the operation status of the second Bluetooth host does not conflict with the first operation command. That is, if the second Bluetooth host is executing an operation command or an operation command of the same type as the first operation command, the second Bluetooth host will not respond to the first query command and will wait for the operation command to complete before responding.
在该方式中,直至第二蓝牙主机的操作状态与第一操作指令不存在冲突才进行应答,避免应答的操作状态与第一操作指令存在冲突导致的查询指令的再次发送。即一个操作指令发送一次查询指令,即可在查询指令被应答开始执行操作指令,且保证不会发生操作指令同时执行的冲突。In this method, a response is only initiated when the operating state of the second Bluetooth host does not conflict with the first operation command, thus avoiding the need to resend the query command due to a conflict between the responded operating state and the first operation command. In other words, an operation command sends only one query command, and the operation command can begin execution upon receiving a response to the query command, ensuring that no conflict occurs where operation commands are executed simultaneously.
方式二,读取第一蓝牙主机记录的协同信息,得到第二蓝牙主机的第一操作信息。Method 2: Read the collaboration information recorded by the first Bluetooth host to obtain the first operation information of the second Bluetooth host.
在方式二下,第一蓝牙主机记录有协同信息,协同信息指示第二蓝牙主机的第一操作信息。由此,通过记录对方蓝牙主机的操作信息的方式,可以实现第一操作信息的快速获取,提高第一操作信息的获取效率。In Method 2, the first Bluetooth host records collaboration information, which in turn indicates the first operation information of the second Bluetooth host. Therefore, by recording the operation information of the other Bluetooth host, the first operation information can be quickly obtained, improving the efficiency of its acquisition.
可选地,第一蓝牙主机记录的协同信息的方式可以包括:接收第二查询指令,第二查询指令是在第二蓝牙主机执行第二操作指令之前发送的;向第二蓝牙主机发送第三操作信息,第三操作信息指示第一蓝牙主机的操作状态与第二操作指令不存在冲突;将第四操作信息作为协同信息记录在第一蓝牙主机,第四操作信息指示第二蓝牙主机正在执行第二操作指令。或者,接收第五操作信息,第五操作信息是在第二操作指令执行完成的情况下向第一蓝牙主机发送的,第五操作信息指示第二蓝牙主机执行完成第二操作指令;将第二蓝牙主机的第五操作信息作为协同信息记录在第一蓝牙主机。Optionally, the method by which the first Bluetooth host records the collaboration information may include: receiving a second query command, which is sent before the second Bluetooth host executes the second operation command; sending third operation information to the second Bluetooth host, the third operation information indicating that the operation status of the first Bluetooth host does not conflict with the second operation command; and recording fourth operation information as collaboration information on the first Bluetooth host, the fourth operation information indicating that the second Bluetooth host is executing the second operation command. Alternatively, receiving fifth operation information, which is sent to the first Bluetooth host after the second operation command has been executed, the fifth operation information indicating that the second Bluetooth host has completed the second operation command; and recording the fifth operation information of the second Bluetooth host as collaboration information on the first Bluetooth host.
在该情况下,第二蓝牙主机在执行第二操作指令之前,也向第一蓝牙主机查询第一蓝牙主机的操作信息。由于第一蓝牙主机应答第三操作信息后,第二蓝牙主机开始执行第二操作指令,因此,可以将指示第二蓝牙主机正在执行第二操作指令的第四操作信息作为协同信息进行记录。此外,第二蓝牙主机在执行完成第二操作指令之后也会向第一蓝牙主机通知,因此,可以将指示第二蓝牙主机执行完成第二操作指令的第五操作信息作为协同信息进行记录。由此,实现了协同信息的实时记录,使得多蓝牙主机之间可以实时同步操作信息。In this scenario, before executing the second operation command, the second Bluetooth host also queries the first Bluetooth host for its operation information. Since the second Bluetooth host begins executing the second operation command after the first Bluetooth host responds with the third operation information, the fourth operation information indicating that the second Bluetooth host is executing the second operation command can be recorded as coordination information. Furthermore, the second Bluetooth host will also notify the first Bluetooth host after completing the second operation command; therefore, the fifth operation information indicating that the second Bluetooth host has completed the second operation command can be recorded as coordination information. This achieves real-time recording of coordination information, enabling real-time synchronization of operation information among multiple Bluetooth hosts.
步骤302,在第二蓝牙主机的操作状态与第一操作指令不存在冲突的情况下,与蓝牙控制器交互,以执行第一操作指令。Step 302: If there is no conflict between the operation state of the second Bluetooth host and the first operation command, interact with the Bluetooth controller to execute the first operation command.
在获取到第二蓝牙主机的第一操作信息之后,即可根据第一操作信息指示的第二蓝牙主机的操作状态判断是否存在冲突。也即在第二蓝牙主机的操作状态与第一操作指令不存在冲突的情况下,与蓝牙控制器交互,以执行第一操作指令;在第二蓝牙主机的操作状态与第一操作指令存在冲突的情况下,再次获取第二蓝牙主机的操作信息,直至获取的操作信息指示的第二蓝牙主机的操作状态与第一操作指令不存在冲突后,与蓝牙控制器交互,以执行第一操作指令。可选地,通过第一蓝牙主机与蓝牙控制器交互,以执行第一操作指令。执行第一操作指令可以是指执行第一操作指令对应的操作。After obtaining the first operation information of the second Bluetooth host, a conflict can be determined based on the operation status of the second Bluetooth host indicated by the first operation information. That is, if there is no conflict between the operation status of the second Bluetooth host and the first operation command, the system interacts with the Bluetooth controller to execute the first operation command; if there is a conflict between the operation status of the second Bluetooth host and the first operation command, the system obtains the operation information of the second Bluetooth host again, until the obtained operation information indicates that the operation status of the second Bluetooth host does not conflict with the first operation command, and then interacts with the Bluetooth controller to execute the first operation command. Optionally, the first Bluetooth host interacts with the Bluetooth controller to execute the first operation command. Executing the first operation command can refer to executing the operation corresponding to the first operation command.
在一种可能的实施方式中,在与蓝牙控制器交互,以执行第一操作指令之后,在第一操作指令执行完成的情况下,向第二蓝牙主机发送第二操作信息,第二操作信息指示第一蓝牙主机执行完成第一操作指令。由此,通过协同交互实现了多蓝牙主机之间的操作信息的同步。In one possible implementation, after interacting with the Bluetooth controller to execute a first operation command, upon completion of the first operation command execution, a second operation message is sent to the second Bluetooth host. The second operation message instructs the first Bluetooth host to complete the execution of the first operation command. Thus, synchronization of operation information among multiple Bluetooth hosts is achieved through collaborative interaction.
在本申请实施例中,第二蓝牙主机的操作状态与第一操作指令不存在冲突是指,第二蓝牙主机的操作指令的执行情况不对第一蓝牙主机执行第一操作指令造成影响,例如,第二蓝牙主机未执行与第一操作指令存在冲突的操作指令,使得第一蓝牙主机在该不存在冲突的情况下执行第一操作指令的成功率较高。可选地,第二蓝牙主机的操作状态与第一操作指令不存在冲突包括:第二蓝牙主机未执行与第一操作指令的类型相同的操作指令。在该方式中,可以避免多蓝牙主机同时执行同类型的操作指令,而不同类型的操作指令可以同时执行,使得不同类型的操作指令之间不互相影响。或者,第二蓝牙主机的操作状态与第一操作指令不存在冲突包括:第二蓝牙主机未执行任何操作指令。在该方式中,可以避免多蓝牙主机同时执行同类型或不同类型的操作指令,更好的避免任何冲突的可能情况发生。第一操作指令的类型包括广播类型、扫描类型、连接类型和传输类型等。In this embodiment, the absence of conflict between the operation state of the second Bluetooth host and the first operation instruction means that the execution of the operation instruction by the second Bluetooth host does not affect the execution of the first operation instruction by the first Bluetooth host. For example, the second Bluetooth host does not execute an operation instruction that conflicts with the first operation instruction, resulting in a higher success rate for the first Bluetooth host to execute the first operation instruction under these conflict-free conditions. Optionally, the absence of conflict between the operation state of the second Bluetooth host and the first operation instruction includes: the second Bluetooth host does not execute an operation instruction of the same type as the first operation instruction. In this approach, multiple Bluetooth hosts can avoid simultaneously executing the same type of operation instruction, while different types of operation instructions can be executed simultaneously, preventing mutual interference between different types of operation instructions. Alternatively, the absence of conflict between the operation state of the second Bluetooth host and the first operation instruction includes: the second Bluetooth host does not execute any operation instruction. In this approach, multiple Bluetooth hosts can avoid simultaneously executing the same or different types of operation instructions, better preventing any potential conflicts. The types of the first operation instruction include broadcast type, scan type, connection type, and transmission type, etc.
在第一操作指令用于更新蓝牙控制器的扫描参数的情况下,第一操作指令为扫描类型。在该情况下,操作信息除了指示扫描状态之外还指示扫描参数。扫描参数包括扫描类型、扫描窗口、扫描间隔、超时时间、扫描过滤、扫描功率或扫描模式中的至少一个。When the first operation instruction is used to update the scanning parameters of the Bluetooth controller, the first operation instruction is the scan type. In this case, the operation information indicates the scan parameters in addition to the scan status. The scan parameters include at least one of scan type, scan window, scan interval, timeout, scan filter, scan power, or scan mode.
其中,扫描类型包括主动扫描或被动扫描,在主动扫描模式下,设备会周期性发送扫描请求,以获取周围BLE设备的广播数据,而在被动扫描模式下,设备只能接收周围BLE设备的广播数据。扫描窗口是指设备每一次扫描的持续时间。通常情况下,扫描窗口越大,可以接收到的广播数据越多,但会增加功耗和延长扫描时间。扫描间隔是指设备在两次扫描之间的时间间隔。超时时间是指设备在扫描时间达到超时时间后,如果没有扫描到目标设备,则会停止扫描。超时时间的设置应根据实际场景和需求进行调整。扫描过滤可以根据设备名称、设备地址等信息对扫描结果进行过滤,以减少不必要的扫描结果。扫描功率的设置影响设备在扫描时的信号强度,从而影响设备的扫描距离和功耗。扫描模式包括低功耗模式、平衡模式和低延迟模式。低功耗模式能够在一定程度上节约功耗,但会降低扫描的成功率,而低延迟模式则能够提高扫描的成功率,但会消耗更多的功耗。The scanning types include active scanning and passive scanning. In active scanning mode, the device periodically sends scan requests to obtain broadcast data from surrounding BLE devices, while in passive scanning mode, the device can only receive broadcast data from surrounding BLE devices. The scan window refers to the duration of each scan. Generally, a larger scan window allows for more broadcast data to be received, but it increases power consumption and scan time. The scan interval is the time interval between two scans. The timeout period is the period after which the device stops scanning if no target device is found. The timeout setting should be adjusted according to the actual scenario and requirements. Scan filtering can filter scan results based on device name, device address, etc., to reduce unnecessary scan results. The scan power setting affects the signal strength of the device during scanning, thus affecting the scanning distance and power consumption. Scanning modes include low-power mode, balanced mode, and low-latency mode. Low-power mode can save power to some extent but reduces the scan success rate, while low-latency mode can improve the scan success rate but consumes more power.
在一种可能的实施方式中,第一操作信息包括第二蓝牙主机的第一扫描参数。在该情况下,与蓝牙控制器交互的方式可以包括:在第一蓝牙主机的第二扫描参数大于或等于第一扫描参数指示的扫描范围的情况下,向蓝牙控制器发送第二扫描参数,第二扫描参数用于蓝牙控制器将扫描参数更新为第二扫描参数;或者,在第二扫描参数小于第一扫描参数指示的扫描范围的情况下,向蓝牙控制器发送第一扫描参数,第一扫描参数用于蓝牙控制器将扫描参数更新为第一扫描参数。In one possible implementation, the first operational information includes a first scanning parameter of the second Bluetooth host. In this case, the interaction with the Bluetooth controller may include: if the second scanning parameter of the first Bluetooth host is greater than or equal to the scanning range indicated by the first scanning parameter, sending the second scanning parameter to the Bluetooth controller, the second scanning parameter being used by the Bluetooth controller to update the scanning parameters to the second scanning parameter; or, if the second scanning parameter is less than the scanning range indicated by the first scanning parameter, sending the first scanning parameter to the Bluetooth controller, the first scanning parameter being used by the Bluetooth controller to update the scanning parameters to the first scanning parameter.
其中,第二蓝牙主机的第一扫描参数是指第二蓝牙主机需要蓝牙控制器进行扫描的扫描参数,即第二蓝牙主机需要使用蓝牙控制器按照第一扫描参数进行扫描的扫描数据;第一蓝牙主机的第二扫描参数是指第一蓝牙主机需要蓝牙控制器进行扫描的扫描参数,即第一蓝牙主机需要使用蓝牙控制器按照第二扫描参数进行扫描的扫描数据。由此,多蓝牙主机之间不仅可以交互扫描状态,还可以交互扫描参数,在多蓝牙主机之间的扫描参数不同的情况下,可以使蓝牙控制器的扫描参数统一更新为多蓝牙主机中扫描范围最大的扫描参数,使得蓝牙控制器基于更新后的扫描参数进行扫描的扫描范围大于每一蓝牙主机的扫描参数的扫描范围,进而使得多蓝牙主机能够复用蓝牙控制器的扫描资源,即蓝牙控制器基于更新后的扫描参数进行扫描的扫描数据可以同时被第一蓝牙主机和第二蓝牙主机使用。In this system, the first scanning parameters of the second Bluetooth host refer to the scanning parameters that the second Bluetooth host needs to scan using the Bluetooth controller, i.e., the scanning data that the second Bluetooth host needs to scan using the Bluetooth controller according to the first scanning parameters; the second scanning parameters of the first Bluetooth host refer to the scanning parameters that the first Bluetooth host needs to scan using the Bluetooth controller, i.e., the scanning data that the first Bluetooth host needs to scan using the Bluetooth controller according to the second scanning parameters. Therefore, multiple Bluetooth hosts can not only exchange scanning status but also scanning parameters. When the scanning parameters of multiple Bluetooth hosts differ, the scanning parameters of the Bluetooth controller can be uniformly updated to the scanning parameters with the largest scanning range among the multiple Bluetooth hosts. This ensures that the scanning range of the Bluetooth controller based on the updated scanning parameters is larger than the scanning range of each Bluetooth host's scanning parameters, thereby enabling multiple Bluetooth hosts to reuse the scanning resources of the Bluetooth controller. In other words, the scanning data scanned by the Bluetooth controller based on the updated scanning parameters can be used by both the first and second Bluetooth hosts simultaneously.
在第一操作指令用于建立蓝牙连接的情况下,第一操作指令为连接类型。在该情况下,操作信息除了指示建连状态之外还指示连接数量。在一种可能的实施方式中,第一操作信息包括第二蓝牙主机建立的蓝牙连接的第一数量,第一数量用于控制第一蓝牙主机建立的蓝牙连接的第二数量,第二数量与第一数量之和小于或等于蓝牙控制器建立蓝牙连接的参考数量。参考数量可以是指蓝牙控制器所在的蓝牙芯片所支持的最大连接数量。由此,多蓝牙主机之间不仅可以交互连接状态,还可以交互连接数量,实现多蓝牙主机之间的连接资源的合理分配。When the first operation command is used to establish a Bluetooth connection, the first operation command is a connection type. In this case, the operation information indicates not only the connection status but also the number of connections. In one possible implementation, the first operation information includes a first number of Bluetooth connections established by the second Bluetooth host, the first number being used to control a second number of Bluetooth connections established by the first Bluetooth host, and the sum of the second number and the first number being less than or equal to a reference number of Bluetooth connections established by the Bluetooth controller. The reference number may refer to the maximum number of connections supported by the Bluetooth chip in which the Bluetooth controller resides. Thus, multiple Bluetooth hosts can not only exchange connection statuses but also exchange connection numbers, achieving a reasonable allocation of connection resources among multiple Bluetooth hosts.
除了上述执行操作指令之外,第一蓝牙主机与第二蓝牙主机之间还可以交互实现资源协同分配。在一种可能的实施方式中,以通过第一蓝牙主机实现与第二蓝牙主机的资源协同分配为例,获取蓝牙控制器支持的并发广播数量;向第二蓝牙主机分配广播数量,以使第二蓝牙主机基于分配的广播数量进行广播。可选地,向蓝牙控制器发送广播资源的第一读取指令,第一读取指令用于蓝牙控制器向第一蓝牙主机发送并发广播数量,即应答第一读取指令;接收蓝牙控制器发送的并发广播数量;为第二蓝牙主机分配广播数量,并向第二蓝牙主机发送分配的广播数量,第二蓝牙主机对第一蓝牙主机进行应答。由此,实现多蓝牙主机的广播资源的协同分配。In addition to executing the aforementioned operation commands, the first Bluetooth host and the second Bluetooth host can also interact to achieve collaborative resource allocation. In one possible implementation, taking the collaborative resource allocation between the first and second Bluetooth hosts as an example, the number of concurrent broadcasts supported by the Bluetooth controller is obtained; a broadcast quantity is allocated to the second Bluetooth host, enabling the second Bluetooth host to broadcast based on the allocated broadcast quantity. Optionally, a first read command for broadcast resources is sent to the Bluetooth controller, whereby the Bluetooth controller sends the concurrent broadcast quantity to the first Bluetooth host, i.e., responds to the first read command; the concurrent broadcast quantity sent by the Bluetooth controller is received; a broadcast quantity is allocated to the second Bluetooth host, and the allocated broadcast quantity is sent to the second Bluetooth host, with the second Bluetooth host responding to the first Bluetooth host. Thus, collaborative allocation of broadcast resources among multiple Bluetooth hosts is achieved.
在一种可能的实施方式中,获取蓝牙控制器支持的传输缓存(buffer)数量;向第二蓝牙主机分配buffer数量,以使第二蓝牙主机基于分配buffer数量进行传输。可选地,向蓝牙控制器发送buffer资源的第二读取指令,第二读取指令用于蓝牙控制器向第一蓝牙主机发送传输buffer数量,即应答第二读取指令;接收蓝牙控制器发送的传输buffer数量;为第二蓝牙主机分配buffer数量,并向第二蓝牙主机发送分配的buffer数量,第二蓝牙主机对第一蓝牙主机进行应答。由此,实现多蓝牙主机的传输buffer资源的协同分配。In one possible implementation, the number of transmission buffers supported by the Bluetooth controller is obtained; a number of buffers is allocated to the second Bluetooth host so that the second Bluetooth host can transmit based on the allocated number of buffers. Optionally, a second read instruction for buffer resources is sent to the Bluetooth controller, which is used by the Bluetooth controller to send the number of transmission buffers to the first Bluetooth host, i.e., to respond to the second read instruction; the number of transmission buffers sent by the Bluetooth controller is received; a number of buffers is allocated to the second Bluetooth host, and the allocated number of buffers is sent to the second Bluetooth host, with the second Bluetooth host responding to the first Bluetooth host. This achieves collaborative allocation of transmission buffer resources among multiple Bluetooth hosts.
由此,通过上述步骤301和步骤302,多蓝牙主机之间通过交互操作信息的方式,实现操作指令的有序调度,避免多蓝牙主机并行工作场景下的共存冲突问题。以第一蓝牙主机为例,第一蓝牙主机在工作过程中,每次启动操作指令,是先获取第二蓝牙主机的操作信息,即第二蓝牙主机可以与第一蓝牙主机同时工作,在确定无冲突的情况下才执行操作指令,而不是直接执行指令。第二蓝牙主机在工作过程中的协同处理方式与第一蓝牙主机的协同处理方式相同。由此,能够避免多蓝牙主机同时执行操作指令的冲突问题,进而实现多蓝牙主机的并行工作。Therefore, through steps 301 and 302 above, multiple Bluetooth hosts achieve orderly scheduling of operation commands by exchanging operation information, avoiding coexistence conflicts in scenarios where multiple Bluetooth hosts work in parallel. Taking the first Bluetooth host as an example, during operation, each time the first Bluetooth host initiates an operation command, it first obtains the operation information of the second Bluetooth host. That is, the second Bluetooth host can work simultaneously with the first Bluetooth host, and only executes the operation command after confirming there is no conflict, rather than executing the command directly. The collaborative processing method of the second Bluetooth host during operation is the same as that of the first Bluetooth host. Thus, the conflict problem of multiple Bluetooth hosts executing operation commands simultaneously can be avoided, thereby enabling multiple Bluetooth hosts to work in parallel.
在一种可能的实施方式中,蓝牙通信设备的蓝牙通信系统除了包括第一蓝牙主机和第二蓝牙主机之外,还包括第三蓝牙主机,则除了获取第二蓝牙主机的第一操作信息之外,还获取第三蓝牙主机的第六操作信息,第六操作信息指示第三蓝牙主机的操作状态。进而,在第二蓝牙主机的操作状态和第三蓝牙主机的操作状态均与第一操作指令不存在冲突的情况下,与蓝牙控制器交互,以执行第一操作指令。获取第三蓝牙主机的第六操作信息的实施方式与上述获取第二蓝牙主机的第一操作信息的实施方式相同,此处不再赘述。In one possible implementation, the Bluetooth communication system of the Bluetooth communication device includes a third Bluetooth host in addition to a first Bluetooth host and a second Bluetooth host. In this case, besides acquiring the first operation information of the second Bluetooth host, the device also acquires sixth operation information of the third Bluetooth host, which indicates the operation state of the third Bluetooth host. Furthermore, if neither the operation state of the second nor the operation state of the third Bluetooth host conflicts with the first operation command, the device interacts with the Bluetooth controller to execute the first operation command. The implementation method for acquiring the sixth operation information of the third Bluetooth host is the same as the implementation method for acquiring the first operation information of the second Bluetooth host described above, and will not be repeated here.
下面,以蓝牙通信设备部署的蓝牙通信系统为图2所示的蓝牙通信系统为例,以蓝牙主机A、蓝牙主机B和蓝牙控制器交互执行该方法为例,结合图4所示的流程图,对本申请实施例提供的多蓝牙主机的协同处理方法进行举例说明。如图4所示,蓝牙主机A侧的蓝牙应用启动操作指令,操作指令包括但不限于更新扫描参数或建立蓝牙连接等。蓝牙主机A侧的蓝牙协议栈在执行该启动的操作指令之前,先查询蓝牙主机B的操作状态。进而,蓝牙主机A侧的协同模块向蓝牙主机B侧的协同模块发送用于查询操作状态的查询指令。The following example uses the Bluetooth communication system shown in Figure 2, where Bluetooth communication devices are deployed, and illustrates the method of multi-Bluetooth host collaboration provided in this application by taking the interaction between Bluetooth host A, Bluetooth host B, and the Bluetooth controller as an example, and referring to the flowchart shown in Figure 4. As shown in Figure 4, the Bluetooth application starts an operation command on the Bluetooth host A side. This operation command includes, but is not limited to, updating scanning parameters or establishing a Bluetooth connection. Before executing the start operation command, the Bluetooth protocol stack on the Bluetooth host A side first queries the operation status of Bluetooth host B. Then, the collaboration module on the Bluetooth host A side sends a query command to the collaboration module on the Bluetooth host B side to check the operation status.
蓝牙主机B侧的协同模块收到查询指令后,先判断蓝牙主机B的操作状态;如果蓝牙主机B当前正在执行操作指令,需要等待蓝牙主机B完成当前正在执行的操作指令,然后蓝牙主机B侧的协同模块再向蓝牙主机A返回蓝牙主机B的操作状态,即蓝牙主机B的协同模块应答操作状态;如果蓝牙主机B当前未在执行操作指令,则蓝牙主机B侧的协同模块立即向蓝牙主机A返回蓝牙主机B的操作状态。可选地,在应答操作状态的基础上,还应答操作参数,即还向蓝牙主机A返回蓝牙主机B的操作参数,例如,扫描参数。蓝牙主机B侧的协同模块应答操作状态之后,还记录蓝牙主机A的操作状态为正在操作。After receiving the query command, the coordination module on Bluetooth host B first determines the operation status of Bluetooth host B. If Bluetooth host B is currently executing an operation command, it waits for Bluetooth host B to complete the currently executing operation command before returning the operation status of Bluetooth host B to Bluetooth host A; that is, the coordination module of Bluetooth host B responds to the operation status. If Bluetooth host B is not currently executing an operation command, the coordination module on Bluetooth host B immediately returns the operation status of Bluetooth host B to Bluetooth host A. Optionally, in addition to responding to the operation status, it also responds to the operation parameters, that is, it also returns the operation parameters of Bluetooth host B, such as scan parameters, to Bluetooth host A. After responding to the operation status, the coordination module on Bluetooth host B also records the operation status of Bluetooth host A as "operating".
蓝牙主机A侧的协同模块收到蓝牙主机B应答的操作状态后,继续执行启动的操作指令。在蓝牙主机A操作完成该操作指令后,蓝牙主机A侧的协同模块通知蓝牙主机B侧的协同模块蓝牙主机A操作完成。蓝牙主机B侧的协同模块收到通知后,记录蓝牙主机A侧的操作状态为操作完成。After receiving the operation status response from Bluetooth host B, the collaboration module on Bluetooth host A continues to execute the start operation command. Once Bluetooth host A completes the operation command, its collaboration module notifies its collaboration module on Bluetooth host B that the operation is complete. Upon receiving this notification, Bluetooth host B's collaboration module records the operation status of Bluetooth host A as "operation complete."
由此,蓝牙主机B侧的协同模块记录有蓝牙主机A侧的操作状态。蓝牙主机B侧的蓝牙应用启动操作指令,操作指令包括但不限于蓝牙扫描或蓝牙连接等。蓝牙主机B侧的蓝牙协议栈在执行该启动的操作指令之前,先查询蓝牙主机A的操作状态。进而,首先查询蓝牙主机B侧的协同模块中记录的蓝牙主机A的操作状态;如果是正在操作,则蓝牙主机B需等蓝牙主机A的操作状态变为操作完成后再执行操作指令;如果是操作完成,则蓝牙主机B可以立即执行操作指令。Therefore, the collaboration module on the Bluetooth host B side records the operation status of the Bluetooth host A side. The Bluetooth application launch operation command on the Bluetooth host B side includes, but is not limited to, Bluetooth scanning or Bluetooth connection. Before executing this launch operation command, the Bluetooth protocol stack on the Bluetooth host B side first queries the operation status of the Bluetooth host A. Then, it first queries the operation status of the Bluetooth host A recorded in the collaboration module on the Bluetooth host B side; if it is in operation, the Bluetooth host B must wait for the operation status of the Bluetooth host A to change to operation completed before executing the operation command; if the operation is completed, the Bluetooth host B can execute the operation command immediately.
在操作指令为更新扫描参数的情况下,受蓝牙芯片仅能设置一组扫描参数的约束,蓝牙主机A和蓝牙主机B若同时修改扫描参数,则会出现参数覆盖或者扫描状态错误的冲突情况,不能满足多蓝牙主机并行工作的扫描需求。因此,本申请实施例通过在扫描冲突点增加双栈交互,双栈是双蓝牙协议栈的简称,双栈交互则是双栈的协同模块之间的交互,通过交互使得双栈之间互感扫描状态与扫描参数,实现扫描协同有序调度,扫描参数归一。When the operation command is to update scan parameters, due to the constraint that the Bluetooth chip can only set one set of scan parameters, if Bluetooth host A and Bluetooth host B modify the scan parameters simultaneously, conflicts such as parameter overwriting or scan state errors will occur, which cannot meet the scanning requirements of multiple Bluetooth hosts working in parallel. Therefore, this embodiment adds dual-stack interaction at the scan conflict point. Dual-stack is short for dual Bluetooth protocol stacks, and dual-stack interaction refers to the interaction between the collaborative modules of the two stacks. Through interaction, the two stacks can mutually sense the scan state and scan parameters, realize coordinated and orderly scheduling of scans, and unify the scan parameters.
结合图5所示的扫描协同的时序流程图,对蓝牙主机A和蓝牙主机B同时更新扫描参数的过程进行举例说明。蓝牙主机A侧的蓝牙应用向蓝牙主机A侧的蓝牙协议栈启动更新扫描参数,待更新的扫描参数为扫描参数A。在蓝牙主机A侧的蓝牙协议栈与蓝牙控制器交互期间,蓝牙主机B侧的蓝牙应用也向蓝牙主机B侧的蓝牙协议栈启动更新扫描参数,待更新的扫描参数为扫描参数B。Referring to the timing flowchart of the scan coordination shown in Figure 5, the process of Bluetooth host A and Bluetooth host B simultaneously updating scan parameters is illustrated with an example. The Bluetooth application on Bluetooth host A initiates an update of the scan parameters to the Bluetooth protocol stack on Bluetooth host A; the scan parameter to be updated is scan parameter A. During the interaction between the Bluetooth protocol stack on Bluetooth host A and the Bluetooth controller, the Bluetooth application on Bluetooth host B also initiates an update of the scan parameters to the Bluetooth protocol stack on Bluetooth host B; the scan parameter to be updated is scan parameter B.
在该情况下,蓝牙主机A侧的蓝牙协议栈在执行更新扫描参数的操作之前,先查询蓝牙主机B侧的扫描状态和扫描参数,例如,通过蓝牙主机A侧的协同模块向蓝牙主机B侧的协同模块发送查询指令。蓝牙主机B侧的蓝牙协议栈收到查询指令后,由于蓝牙主机B侧正在执行更新扫描操作,则等待更新扫描参数的操作完成后,向蓝牙主机A侧的蓝牙协议栈应答扫描状态和扫描参数,扫描状态即为操作完成。蓝牙主机B执行更新扫描参数操作的过程即为,蓝牙主机B侧的蓝牙协议栈向蓝牙控制器设置扫描参数B,蓝牙控制器在将扫描参数更新为扫描参数B后,向蓝牙主机B侧的蓝牙协议栈应答设置成功,蓝牙主机B侧的蓝牙协议栈向蓝牙主机B侧的蓝牙应用反馈更新扫描参数成功。In this scenario, before executing the scan parameter update operation, the Bluetooth protocol stack on Bluetooth host A first queries the scan status and scan parameters on Bluetooth host B. For example, it can send a query command from the coordination module on Bluetooth host A to the coordination module on Bluetooth host B. Upon receiving the query command, the Bluetooth protocol stack on Bluetooth host B, being in the process of updating the scan parameters, waits for the update to complete before responding to the Bluetooth protocol stack on Bluetooth host A with the scan status and scan parameters. The scan status indicates that the operation is complete. The process of Bluetooth host B updating the scan parameters involves the Bluetooth protocol stack on Bluetooth host B setting scan parameter B to the Bluetooth controller. After updating the scan parameters to scan parameter B, the Bluetooth controller responds to the Bluetooth protocol stack on Bluetooth host B with a success message. Finally, the Bluetooth protocol stack on Bluetooth host B sends feedback to the Bluetooth application on Bluetooth host B indicating successful scan parameter update.
蓝牙主机A侧的蓝牙协议栈收到蓝牙主机B的应答后,确定蓝牙主机B侧的扫描状态为操作完成,即确定现在执行更新扫描参数的操作不会与蓝牙主机B侧的操作指令发生扫描冲突,则蓝牙主机A侧的蓝牙协议栈开始执行更新扫描参数的操作。其中,蓝牙主机A侧的蓝牙协议栈对比蓝牙主机A侧待更新的扫描参数A与蓝牙主机B侧反馈的扫描参数B,确定扫描参数A和扫描参数B中较大的扫描参数为归一扫描参数,也即归一扫描参数为扫描参数A或扫描参数B。蓝牙主机A侧的蓝牙协议栈向蓝牙控制器设置该归一扫描参数,蓝牙控制器在将扫描参数更新为归一扫描参数后,向蓝牙主机A侧的蓝牙协议栈应答设置成功,蓝牙主机A侧的蓝牙协议栈向蓝牙主机A侧的蓝牙应用反馈更新扫描参数成功。蓝牙主机A侧的蓝牙协议栈还向蓝牙主机B侧的蓝牙协议栈通知扫描状态和归一扫描参数,扫描状态即为操作完成,蓝牙主机B侧的蓝牙协议栈记录扫描参数为该归一扫描参数。由此,实现了蓝牙主机A和蓝牙主机B在并行工作场景下的无冲突扫描以及扫描参数归一。After receiving a response from Bluetooth host B, the Bluetooth protocol stack on host A determines that the scanning status on host B is complete, meaning that updating the scan parameters will not conflict with the operation command on host B. Therefore, the Bluetooth protocol stack on host A begins the scan parameter update operation. Specifically, the Bluetooth protocol stack on host A compares the scan parameter A to be updated with the scan parameter B returned by host B, determining the larger of the two as the normalized scan parameter (either A or B). The Bluetooth protocol stack on host A sets this normalized scan parameter to the Bluetooth controller. After updating the scan parameters to the normalized scan parameter, the Bluetooth controller acknowledges success to the Bluetooth protocol stack on host A, and the Bluetooth protocol stack on host A then reports the successful update to the Bluetooth application on host A. The Bluetooth protocol stack on Bluetooth host A also notifies the Bluetooth protocol stack on Bluetooth host B of the scan status and normalized scan parameters. The scan status indicates that the operation is complete, and the Bluetooth protocol stack on Bluetooth host B records the scan parameters as the normalized scan parameters. This achieves conflict-free scanning and normalized scan parameters for Bluetooth host A and Bluetooth host B in parallel operation scenarios.
在操作指令为建立蓝牙连接的情况下,受蓝牙芯片处于连接启动(initiating)状态后就不再处理蓝牙协议栈的连接请求的约束,若双栈同时执行该建立蓝牙连接的操作,则会出现连接冲突,导致蓝牙应用的蓝牙连接建立失败,不能满足多蓝牙主机并行工作的连接需求。因此,本申请实施例通过在连接冲突点增加双栈交互,通过交互实现双栈之间互感连接状态,也即实现双栈连接状态的协同,进而实现连接协同有序调度,达成无冲突连接。When the operation command is to establish a Bluetooth connection, the Bluetooth chip stops processing connection requests from the Bluetooth protocol stack once it is in the connection initiating state. If both stacks execute the Bluetooth connection establishment operation simultaneously, a connection conflict will occur, causing the Bluetooth application to fail to establish a Bluetooth connection, thus failing to meet the connection requirements of multiple Bluetooth hosts working in parallel. Therefore, this embodiment adds dual-stack interaction at the connection conflict point. Through interaction, the connection states of the two stacks are mutually sensed, that is, the connection states of the two stacks are coordinated, thereby achieving orderly scheduling of connection coordination and achieving a conflict-free connection.
结合图6所示的连接协同的时序流程图,对蓝牙主机A和蓝牙主机B同时建立蓝牙连接的过程进行举例说明。蓝牙主机A侧的蓝牙应用向蓝牙主机A侧的蓝牙协议栈启动建立蓝牙连接的操作。在该情况下,蓝牙主机A侧的蓝牙协议栈在执行建立蓝牙连接的操作之前,先查询蓝牙主机B侧的连接状态,例如,通过蓝牙主机A侧的协同模块向蓝牙主机B侧的协同模块发送查询指令。蓝牙主机B侧的蓝牙协议栈收到查询指令后,由于蓝牙主机B侧未正在执行连接操作,则直接向蓝牙主机A侧的蓝牙协议栈应答建连状态,建连状态即为空闲。可选地,蓝牙主机B侧的蓝牙协议栈基于应答的建连状态,记录在蓝牙主机A侧的建连状态是正在操作中。Referring to the timing flowchart of the connection coordination shown in Figure 6, the process of Bluetooth host A and Bluetooth host B simultaneously establishing a Bluetooth connection is illustrated with an example. The Bluetooth application on Bluetooth host A initiates the Bluetooth connection establishment operation to the Bluetooth protocol stack on Bluetooth host A. In this case, before executing the Bluetooth connection establishment operation, the Bluetooth protocol stack on Bluetooth host A first queries the connection status on Bluetooth host B, for example, by sending a query command from the coordination module on Bluetooth host A to the coordination module on Bluetooth host B. After receiving the query command, the Bluetooth protocol stack on Bluetooth host B, since not currently performing a connection operation, directly responds to the Bluetooth protocol stack on Bluetooth host A with a connection status of "idle". Optionally, based on the responded connection status, the Bluetooth protocol stack on Bluetooth host B records the connection status on Bluetooth host A as "in operation".
蓝牙主机A侧的蓝牙协议栈接收应答的建连状态后,确定蓝牙主机B侧的建连状态为空闲,即确定现在执行建立蓝牙连接的操作不会与蓝牙主机B侧的操作指令发生扫描冲突,则蓝牙主机A侧的蓝牙协议栈开始执行建立蓝牙连接的操作。即蓝牙主机A侧的蓝牙协议栈向蓝牙控制器发送建连请求,蓝牙控制器基于建连请求进入initiating状态实现蓝牙连接的建立,在蓝牙连接建立成功后,蓝牙控制器向蓝牙主机A侧的蓝牙协议栈应答建连成功,蓝牙主机A侧的蓝牙协议栈向蓝牙主机A侧的蓝牙应用反馈建连成功。蓝牙主机A侧的蓝牙协议栈还向蓝牙主机B侧的蓝牙协议栈通知连接状态和归一扫描参数,连接状态即为操作完成。After receiving the connection establishment status response, the Bluetooth protocol stack on Bluetooth host A determines that the connection establishment state on Bluetooth host B is idle, meaning that performing the Bluetooth connection establishment operation now will not cause a scanning conflict with the operation command on Bluetooth host B. Therefore, the Bluetooth protocol stack on Bluetooth host A begins the Bluetooth connection establishment operation. Specifically, the Bluetooth protocol stack on Bluetooth host A sends a connection establishment request to the Bluetooth controller. The Bluetooth controller, based on the connection establishment request, enters the initiating state to establish the Bluetooth connection. After the Bluetooth connection is successfully established, the Bluetooth controller acknowledges the connection success to the Bluetooth protocol stack on Bluetooth host A, and the Bluetooth protocol stack on Bluetooth host A sends feedback on the connection success to the Bluetooth application on Bluetooth host A. The Bluetooth protocol stack on Bluetooth host A also notifies the Bluetooth protocol stack on Bluetooth host B of the connection status and normalized scan parameters. The connection status indicates that the operation is complete.
在上述蓝牙主机A侧的蓝牙协议栈执行建立蓝牙连接的操作的过程中,蓝牙主机B侧的蓝牙应用也向蓝牙主机B侧的蓝牙协议栈启动建立蓝牙连接的操作。蓝牙主机B侧的蓝牙协议栈在执行建立蓝牙连接的操作之前,查询蓝牙主机B侧的蓝牙协议栈中记录的蓝牙主机A的连接状态,若蓝牙主机A的连接状态为正在操作中,蓝牙主机B侧的蓝牙协议栈等待,即暂停执行建立蓝牙连接的操作;若蓝牙主机A的连接状态为操作完成,蓝牙主机B侧的蓝牙协议栈开始执行建立蓝牙连接的操作。During the Bluetooth connection establishment process performed by the Bluetooth protocol stack on Bluetooth host A, the Bluetooth application on Bluetooth host B also initiates its own Bluetooth connection establishment operation. Before performing the connection establishment operation, the Bluetooth protocol stack on Bluetooth host B queries the connection status of Bluetooth host A recorded in its stack. If the connection status of Bluetooth host A is "in operation," the Bluetooth protocol stack on Bluetooth host B waits, pausing the connection establishment operation. If the connection status of Bluetooth host A is "operation completed," the Bluetooth protocol stack on Bluetooth host B begins the connection establishment operation.
蓝牙主机B侧的蓝牙协议栈开始执行建立蓝牙连接的操作的过程即为,蓝牙主机B侧的蓝牙协议栈向蓝牙控制器发送建连请求,蓝牙控制器基于建连请求进入initiating状态实现蓝牙连接的建立,在蓝牙连接建立成功后,蓝牙控制器向蓝牙主机B侧的蓝牙协议栈应答建连成功,蓝牙主机B侧的蓝牙协议栈向蓝牙主机B侧的蓝牙应用反馈建连成功。由此,实现了蓝牙主机A和蓝牙主机B在并行工作场景下的无冲突连接。The process of Bluetooth host B's Bluetooth protocol stack initiating the Bluetooth connection establishment operation is as follows: Bluetooth host B's Bluetooth protocol stack sends a connection request to the Bluetooth controller. The Bluetooth controller enters the initiating state based on the connection request to establish the Bluetooth connection. After the Bluetooth connection is successfully established, the Bluetooth controller acknowledges the successful connection to Bluetooth host B's Bluetooth protocol stack, and Bluetooth host B's Bluetooth protocol stack then sends feedback on the successful connection to Bluetooth host B's Bluetooth application. This achieves a conflict-free connection between Bluetooth host A and Bluetooth host B in a parallel working scenario.
综上,本申请实施例提供的方法,多蓝牙主机的蓝牙协议栈之间新增操作状态的交互机制,以使在操作指令冲突点可以发起双栈之间的操作状态查询、应答与通知等交互机制,达到双栈互感操作状态,进行双栈操作指令的有序调度。并且双栈之间新增复用资源机制,以使在操作指令冲突点,双栈之间可以进行扫描参数的交互,即互感扫描参数,并由最后执行更新扫描参数操作的蓝牙协议栈进行扫描参数归一。双栈连接之间新增资源分配机制,以使蓝牙连接建立成功后,可以通知对端蓝牙协议栈连接数量,并携带重分配的buffer数量。双栈之间新增动态协同机制,以使蓝牙协议栈感知另外一个蓝牙协议栈的处理器状态,进入休眠则停止协同;退出休眠,则恢复协同。In summary, the method provided in this application adds an operation status interaction mechanism between the Bluetooth protocol stacks of multiple Bluetooth hosts. This allows for interaction mechanisms such as operation status query, response, and notification between the two stacks at operation command conflict points, achieving mutual awareness of the operation status between the two stacks and enabling orderly scheduling of operation commands. Furthermore, a resource reuse mechanism is added between the two stacks, allowing for the exchange of scan parameters at operation command conflict points, i.e., mutual awareness of scan parameters, with the scan parameters being unified by the Bluetooth protocol stack that last performed the scan parameter update operation. A resource allocation mechanism is added between the two stacks, enabling the notification of the number of connections and the number of reassigned buffers to the peer Bluetooth protocol stack after a successful Bluetooth connection establishment. A dynamic coordination mechanism is added between the two stacks, allowing the Bluetooth protocol stack to perceive the processor status of the other Bluetooth protocol stack; entering sleep mode stops coordination, and exiting sleep mode resumes coordination.
以上介绍了本申请实施例的多蓝牙主机的协同处理方法,与上述方法对应,本申请实施例还提供了多蓝牙主机的协同处理装置。图7是本申请实施例提供的一种多蓝牙主机的协同处理装置的结构示意图,该装置应用于蓝牙通信设备,该蓝牙通信设备为上述图3所示的蓝牙通信设备。基于图7所示的如下多个模块,该图7所示的多蓝牙主机的协同处理装置能够执行蓝牙通信设备所执行的全部或部分操作。应理解到,该装置可以包括比所示模块更多的附加模块或者省略其中所示的一部分模块,本申请实施例对此并不进行限制。如图7所示,该装置包括:The above describes a multi-Bluetooth host collaborative processing method according to embodiments of this application. Corresponding to the above method, embodiments of this application also provide a multi-Bluetooth host collaborative processing device. Figure 7 is a schematic diagram of the structure of a multi-Bluetooth host collaborative processing device provided in an embodiment of this application. This device is applied to a Bluetooth communication device, which is the Bluetooth communication device shown in Figure 3 above. Based on the following modules shown in Figure 7, the multi-Bluetooth host collaborative processing device shown in Figure 7 can perform all or part of the operations performed by the Bluetooth communication device. It should be understood that the device may include more additional modules than the modules shown or omit some of the modules shown. Embodiments of this application do not limit this. As shown in Figure 7, the device includes:
获取模块701,用于在第一蓝牙主机执行第一操作指令之前,获取第二蓝牙主机的第一操作信息,第二蓝牙主机和第一蓝牙主机连接同一蓝牙控制器,第一操作信息指示第二蓝牙主机的操作状态;The acquisition module 701 is used to acquire the first operation information of the second Bluetooth host before the first Bluetooth host executes the first operation instruction. The second Bluetooth host and the first Bluetooth host are connected to the same Bluetooth controller. The first operation information indicates the operation status of the second Bluetooth host.
执行模块702,用于在第二蓝牙主机的操作状态与第一操作指令不存在冲突的情况下,与蓝牙控制器交互,以执行第一操作指令。The execution module 702 is used to interact with the Bluetooth controller to execute the first operation command when there is no conflict between the operation state of the second Bluetooth host and the first operation command.
在一种可能的实施方式中,获取模块701,用于向第二蓝牙主机发送第一查询指令,第一查询指令用于第二蓝牙主机向第一蓝牙主机发送第二蓝牙主机的第一操作信息;接收第二蓝牙主机发送的第一操作信息。In one possible implementation, the acquisition module 701 is used to send a first query instruction to the second Bluetooth host, the first query instruction being used by the second Bluetooth host to send first operation information of the second Bluetooth host to the first Bluetooth host; and to receive the first operation information sent by the second Bluetooth host.
在一种可能的实施方式中,该装置还包括:第一发送模块,用于在第一操作指令执行完成的情况下,向第二蓝牙主机发送第二操作信息,第二操作信息指示第一蓝牙主机执行完成第一操作指令。In one possible implementation, the device further includes: a first transmitting module, configured to send second operation information to a second Bluetooth host upon completion of the execution of the first operation instruction, wherein the second operation information instructs the first Bluetooth host to complete the execution of the first operation instruction.
在一种可能的实施方式中,第一蓝牙主机记录有协同信息,协同信息指示第二蓝牙主机的第一操作信息。In one possible implementation, the first Bluetooth host records coordination information that indicates first operational information of the second Bluetooth host.
在一种可能的实施方式中,该装置还包括:接收模块,用于接收第二查询指令,第二查询指令是在第二蓝牙主机执行第二操作指令之前发送的;第二发送模块,用于向第二蓝牙主机发送第三操作信息,第三操作信息指示第一蓝牙主机的操作状态与第二操作指令不存在冲突;记录模块,用于将第四操作信息作为协同信息记录在第一蓝牙主机,第四操作信息指示第二蓝牙主机正在执行第二操作指令。In one possible implementation, the device further includes: a receiving module for receiving a second query instruction, the second query instruction being sent before the second Bluetooth host executes the second operation instruction; a second sending module for sending third operation information to the second Bluetooth host, the third operation information indicating that the operation status of the first Bluetooth host does not conflict with the second operation instruction; and a recording module for recording fourth operation information as coordination information on the first Bluetooth host, the fourth operation information indicating that the second Bluetooth host is executing the second operation instruction.
在一种可能的实施方式中,接收模块,还用于接收第五操作信息,第五操作信息是在第二操作指令执行完成的情况下向第一蓝牙主机发送的,第五操作信息指示第二蓝牙主机执行完成第二操作指令;记录模块,还用于将第五操作信息作为协同信息记录在第一蓝牙主机。In one possible implementation, the receiving module is further configured to receive fifth operation information, which is sent to the first Bluetooth host after the second operation instruction has been completed, and the fifth operation information instructs the second Bluetooth host to complete the second operation instruction; the recording module is further configured to record the fifth operation information as coordination information in the first Bluetooth host.
在一种可能的实施方式中,第二蓝牙主机的操作状态与第一操作指令不存在冲突包括:第二蓝牙主机未执行与第一操作指令的类型相同的操作指令,或者,第二蓝牙主机未执行任何操作指令。In one possible implementation, the fact that the operating state of the second Bluetooth host does not conflict with the first operating instruction includes: the second Bluetooth host does not execute an operating instruction of the same type as the first operating instruction, or the second Bluetooth host does not execute any operating instruction.
在一种可能的实施方式中,第一操作指令用于更新蓝牙控制器的扫描参数,第一操作信息包括第二蓝牙主机的第一扫描参数;执行模块702,用于在第一蓝牙主机的第二扫描参数大于或等于第一扫描参数指示的扫描范围的情况下,向蓝牙控制器发送第二扫描参数,第二扫描参数用于蓝牙控制器将扫描参数更新为第二扫描参数;或者,在第二扫描参数小于第一扫描参数指示的扫描范围的情况下,向蓝牙控制器发送第一扫描参数,第一扫描参数用于蓝牙控制器将扫描参数更新为第一扫描参数。In one possible implementation, the first operation instruction is used to update the scanning parameters of the Bluetooth controller, and the first operation information includes the first scanning parameters of the second Bluetooth host; the execution module 702 is used to send the second scanning parameters to the Bluetooth controller when the second scanning parameters of the first Bluetooth host are greater than or equal to the scanning range indicated by the first scanning parameters, and the second scanning parameters are used by the Bluetooth controller to update the scanning parameters to the second scanning parameters; or, when the second scanning parameters are less than the scanning range indicated by the first scanning parameters, the first scanning parameters are sent to the Bluetooth controller, and the first scanning parameters are used by the Bluetooth controller to update the scanning parameters to the first scanning parameters.
在一种可能的实施方式中,第一操作指令用于建立蓝牙连接,第一操作信息包括第二蓝牙主机建立的蓝牙连接的第一数量,第一数量用于控制第一蓝牙主机建立的蓝牙连接的第二数量,第二数量与第一数量之和小于或等于蓝牙控制器建立蓝牙连接的参考数量。In one possible implementation, the first operation instruction is used to establish a Bluetooth connection, and the first operation information includes a first number of Bluetooth connections established by the second Bluetooth host. The first number is used to control a second number of Bluetooth connections established by the first Bluetooth host, and the sum of the second number and the first number is less than or equal to a reference number of Bluetooth connections established by the Bluetooth controller.
在一种可能的实施方式中,获取模块701,用于在第二蓝牙主机的工作状态为退出休眠的情况下,获取第二蓝牙主机的操作信息。In one possible implementation, the acquisition module 701 is used to acquire the operation information of the second Bluetooth host when the second Bluetooth host is in the working state of exiting sleep.
应理解的是,上述图7提供的装置在实现其功能时,仅以上述各功能模块的划分进行举例说明,实际应用中,可以根据需要而将上述功能分配由不同的功能模块完成,即将设备的内部结构划分成不同的功能模块,以完成以上描述的全部或者部分功能。另外,上述实施例提供的装置与方法实施例属于同一构思,其具体实现过程以及有益效果详见方法实施例,这里不再赘述。It should be understood that the device shown in Figure 7 is only illustrated by the division of the above-described functional modules. In practical applications, the functions can be assigned to different functional modules as needed, that is, the internal structure of the device can be divided into different functional modules to complete all or part of the functions described above. Furthermore, the device and method embodiments provided in the above embodiments belong to the same concept, and their specific implementation process and beneficial effects are detailed in the method embodiments, and will not be repeated here.
本申请实施例提供了一种终端设备,该终端设备用于执行上述图3所示的多蓝牙主机的协同处理方法所涉及的操作。可选地,该终端设备的结构示意图可以如图8所示。在图8所示的终端设备的结构示意图中,该终端设备例如可以是:智能手机、平板电脑、车载终端、笔记本电脑或台式电脑。终端设备还可能被称为用户设备、便携式终端、膝上型终端、台式终端等其他名称。This application provides a terminal device for performing the operations involved in the multi-Bluetooth host collaborative processing method shown in FIG3. Optionally, the structural schematic diagram of the terminal device can be as shown in FIG8. In the structural schematic diagram of the terminal device shown in FIG8, the terminal device can be, for example, a smartphone, tablet computer, vehicle terminal, laptop computer, or desktop computer. The terminal device may also be referred to as user equipment, portable terminal, laptop terminal, desktop terminal, or other names.
通常,终端设备包括有:处理器801和存储器802。Typically, a terminal device includes a processor 801 and a memory 802.
处理器801可以包括一个或多个处理核心,比如4核心处理器、8核心处理器等。处理器801可以采用DSP(Digital Signal Processing,数字信号处理)、FPGA(Field-Programmable Gate Array,现场可编程门阵列)、PLA(Programmable Logic Array,可编程逻辑阵列)中的至少一种硬件形式来实现。处理器801也可以包括主处理器和协处理器,主处理器是用于对在唤醒状态下的数据进行处理的处理器,也称CPU(Central Processing Unit,中央处理器);协处理器是用于对在待机状态下的数据进行处理的低功耗处理器。在一些实施例中,处理器801可以集成有GPU(Graphics Processing Unit,图像处理器),GPU用于负责显示屏所需要显示的内容的渲染和绘制。一些实施例中,处理器801还可以包括AI(Artificial Intelligence,人工智能)处理器,该AI处理器用于处理有关机器学习的计算操作。Processor 801 may include one or more processing cores, such as a quad-core processor, an octa-core processor, etc. Processor 801 may be implemented using at least one hardware form selected from DSP (Digital Signal Processing), FPGA (Field-Programmable Gate Array), and PLA (Programmable Logic Array). Processor 801 may also include a main processor and a coprocessor. The main processor, also known as a CPU (Central Processing Unit), is used to process data in the wake-up state; the coprocessor is a low-power processor used to process data in the standby state. In some embodiments, processor 801 may integrate a GPU (Graphics Processing Unit), which is responsible for rendering and drawing the content to be displayed on the screen. In some embodiments, processor 801 may also include an AI (Artificial Intelligence) processor, which is used to handle computational operations related to machine learning.
存储器802可以包括一个或多个计算机可读存储介质,该计算机可读存储介质可以是非暂态的。存储器802还可包括高速随机存取存储器,以及非易失性存储器,比如一个或多个磁盘存储设备、闪存存储设备。在一些实施例中,存储器802中的非暂态的计算机可读存储介质用于存储至少一个指令,该至少一个指令用于被处理器801所执行以实现本申请中方法实施例提供的电子账户的开户方法。The memory 802 may include one or more computer-readable storage media, which may be non-transitory. The memory 802 may also include high-speed random access memory and non-volatile memory, such as one or more disk storage devices or flash memory devices. In some embodiments, the non-transitory computer-readable storage media in the memory 802 is used to store at least one instruction, which is executed by the processor 801 to implement the electronic account opening method provided in the method embodiments of this application.
在一些实施例中,终端还可选包括有:外围设备接口803和至少一个外围设备。处理器801、存储器802和外围设备接口803之间可以通过总线或信号线相连。各个外围设备可以通过总线、信号线或电路板与外围设备接口803相连。具体地,外围设备包括:射频电路804、显示屏805、摄像头组件806、音频电路807和电源808中的至少一种。In some embodiments, the terminal may also optionally include: a peripheral device interface 803 and at least one peripheral device. The processor 801, memory 802, and peripheral device interface 803 can be connected via a bus or signal line. Each peripheral device can be connected to the peripheral device interface 803 via a bus, signal line, or circuit board. Specifically, the peripheral device includes at least one of: a radio frequency circuit 804, a display screen 805, a camera assembly 806, an audio circuit 807, and a power supply 808.
外围设备接口803可被用于将I/O(Input/Output,输入/输出)相关的至少一个外围设备连接到处理器801和存储器802。在一些实施例中,处理器801、存储器802和外围设备接口803被集成在同一芯片或电路板上;在一些其他实施例中,处理器801、存储器802和外围设备接口803中的任意一个或两个可以在单独的芯片或电路板上实现,本实施例对此不加以限定。Peripheral device interface 803 can be used to connect at least one I/O (Input/Output) related peripheral device to processor 801 and memory 802. In some embodiments, processor 801, memory 802 and peripheral device interface 803 are integrated on the same chip or circuit board; in some other embodiments, any one or two of processor 801, memory 802 and peripheral device interface 803 can be implemented on separate chips or circuit boards, which is not limited in this embodiment.
射频电路804用于接收和发射RF(Radio Frequency,射频)信号,也称电磁信号。射频电路804通过电磁信号与通信网络以及其他通信设备进行通信。射频电路804将电信号转换为电磁信号进行发送,或者,将接收到的电磁信号转换为电信号。可选地,射频电路804包括:天线系统、RF收发器、一个或多个放大器、调谐器、振荡器、数字信号处理器、编解码芯片组、用户身份模块卡等等。射频电路804可以通过至少一种无线通信协议来与其它终端进行通信。该无线通信协议包括但不限于:城域网、各代移动通信网络(2G、3G、4G及5G)、无线局域网和/或无线保真(Wireless Fidelity,WiFi)网络。在一些实施例中,射频电路804还可以包括NFC(Near FieldCommunication,近距离无线通信)有关的电路,本申请对此不加以限定。The radio frequency (RF) circuit 804 is used to receive and transmit RF (Radio Frequency) signals, also known as electromagnetic signals. The RF circuit 804 communicates with communication networks and other communication devices via electromagnetic signals. The RF circuit 804 converts electrical signals into electromagnetic signals for transmission, or converts received electromagnetic signals back into electrical signals. Optionally, the RF circuit 804 includes: an antenna system, an RF transceiver, one or more amplifiers, a tuner, an oscillator, a digital signal processor, a codec chipset, a user identity module card, etc. The RF circuit 804 can communicate with other terminals through at least one wireless communication protocol. This wireless communication protocol includes, but is not limited to: metropolitan area networks (MANs), various generations of mobile communication networks (2G, 3G, 4G, and 5G), wireless local area networks (WLANs), and/or Wireless Fidelity (WiFi) networks. In some embodiments, the RF circuit 804 may also include circuitry related to NFC (Near Field Communication), which is not limited in this application.
显示屏805用于显示UI(User Interface,用户界面)。该UI可以包括图形、文本、图标、视频及其它们的任意组合。当显示屏805是触摸显示屏时,显示屏805还具有采集在显示屏805的表面或表面上方的触摸信号的能力。该触摸信号可以作为控制信号输入至处理器801进行处理。此时,显示屏805还可以用于提供虚拟按钮和/或虚拟键盘,也称软按钮和/或软键盘。在一些实施例中,显示屏805可以为一个,设置在终端的前面板;在另一些实施例中,显示屏805可以为至少两个,分别设置在终端的不同表面或呈折叠设计;在再一些实施例中,显示屏805可以是柔性显示屏,设置在终端的弯曲表面上或折叠面上。甚至,显示屏805还可以设置成非矩形的不规则图形,也即异形屏。显示屏805可以采用LCD(Liquid Crystal Display,液晶显示屏)、OLED(Organic Light-Emitting Diode,有机发光二极管)等材质制备。Display screen 805 is used to display a UI (User Interface). This UI may include graphics, text, icons, videos, and any combination thereof. When display screen 805 is a touch display screen, it also has the ability to collect touch signals on or above its surface. These touch signals can be input as control signals to processor 801 for processing. In this case, display screen 805 can also be used to provide virtual buttons and/or a virtual keyboard, also known as soft buttons and/or a soft keyboard. In some embodiments, there may be one display screen 805, located on the front panel of the terminal; in other embodiments, there may be at least two display screens, respectively located on different surfaces of the terminal or in a folded design; in still other embodiments, display screen 805 may be a flexible display screen, located on a curved or folded surface of the terminal. Furthermore, display screen 805 may be configured as a non-rectangular irregular shape, i.e., a non-rectangular screen. Display screen 805 may be made of materials such as LCD (Liquid Crystal Display) or OLED (Organic Light-Emitting Diode).
摄像头组件806用于采集图像或视频。可选地,摄像头组件806包括前置摄像头和后置摄像头。通常,前置摄像头设置在终端的前面板,后置摄像头设置在终端的背面。在一些实施例中,后置摄像头为至少两个,分别为主摄像头、景深摄像头、广角摄像头、长焦摄像头中的任意一种,以实现主摄像头和景深摄像头融合实现背景虚化功能、主摄像头和广角摄像头融合实现全景拍摄以及VR(Virtual Reality,虚拟现实)拍摄功能或者其它融合拍摄功能。在一些实施例中,摄像头组件806还可以包括闪光灯。闪光灯可以是单色温闪光灯,也可以是双色温闪光灯。双色温闪光灯是指暖光闪光灯和冷光闪光灯的组合,可以用于不同色温下的光线补偿。The camera assembly 806 is used to acquire images or videos. Optionally, the camera assembly 806 includes a front-facing camera and a rear-facing camera. Typically, the front-facing camera is located on the front panel of the terminal, and the rear-facing camera is located on the back of the terminal. In some embodiments, there are at least two rear-facing cameras, which are any one of a main camera, a depth-sensing camera, a wide-angle camera, and a telephoto camera, to achieve background blurring by fusion of the main camera and the depth-sensing camera, panoramic shooting by fusion of the main camera and the wide-angle camera, VR (Virtual Reality) shooting, or other fusion shooting functions. In some embodiments, the camera assembly 806 may also include a flash. The flash can be a single-color temperature flash or a dual-color temperature flash. A dual-color temperature flash refers to a combination of a warm-light flash and a cool-light flash, which can be used for light compensation at different color temperatures.
音频电路807可以包括麦克风和扬声器。麦克风用于采集用户及环境的声波,并将声波转换为电信号输入至处理器801进行处理,或者输入至射频电路804以实现语音通信。出于立体声采集或降噪的目的,麦克风可以为多个,分别设置在终端的不同部位。麦克风还可以是阵列麦克风或全向采集型麦克风。扬声器则用于将来自处理器801或射频电路804的电信号转换为声波。扬声器可以是传统的薄膜扬声器,也可以是压电陶瓷扬声器。当扬声器是压电陶瓷扬声器时,不仅可以将电信号转换为人类可听见的声波,也可以将电信号转换为人类听不见的声波以进行测距等用途。在一些实施例中,音频电路807还可以包括耳机插孔。The audio circuit 807 may include a microphone and a speaker. The microphone is used to collect sound waves from the user and the environment, converting the sound waves into electrical signals that are input to the processor 801 for processing, or input to the radio frequency circuit 804 for voice communication. For stereo sound acquisition or noise reduction purposes, multiple microphones may be used, each positioned at a different location on the terminal. The microphone may also be an array microphone or an omnidirectional microphone. The speaker is used to convert the electrical signals from the processor 801 or the radio frequency circuit 804 into sound waves. The speaker may be a conventional diaphragm speaker or a piezoelectric ceramic speaker. When the speaker is a piezoelectric ceramic speaker, it can convert electrical signals not only into audible sound waves but also into inaudible sound waves for purposes such as distance measurement. In some embodiments, the audio circuit 807 may also include a headphone jack.
电源808用于为终端中的各个组件进行供电。电源808可以是交流电、直流电、一次性电池或可充电电池。当电源808包括可充电电池时,该可充电电池可以支持有线充电或无线充电。该可充电电池还可以用于支持快充技术。Power supply 808 is used to power the various components in the terminal. Power supply 808 can be AC power, DC power, a disposable battery, or a rechargeable battery. When power supply 808 includes a rechargeable battery, the rechargeable battery can support wired or wireless charging. The rechargeable battery can also be used to support fast charging technology.
在一些实施例中,终端还包括有一个或多个传感器809。该一个或多个传感器809包括但不限于:加速度传感器810、陀螺仪传感器811、压力传感器812、光学传感器813以及接近传感器814。In some embodiments, the terminal further includes one or more sensors 809. The one or more sensors 809 include, but are not limited to: an accelerometer 810, a gyroscope 811, a pressure sensor 812, an optical sensor 813, and a proximity sensor 814.
加速度传感器810可以检测以终端建立的坐标系的三个坐标轴上的加速度大小。比如,加速度传感器810可以用于检测重力加速度在三个坐标轴上的分量。处理器801可以根据加速度传感器810采集的重力加速度信号,控制显示屏805以横向视图或纵向视图进行用户界面的显示。加速度传感器810还可以用于游戏或者用户的运动数据的采集。Accelerometer 810 can detect the magnitude of acceleration along the three coordinate axes of a coordinate system established by the terminal. For example, accelerometer 810 can be used to detect the components of gravitational acceleration along the three coordinate axes. Processor 801 can control display screen 805 to display the user interface in either a landscape or portrait view based on the gravitational acceleration signal acquired by accelerometer 810. Accelerometer 810 can also be used for games or for acquiring user motion data.
陀螺仪传感器811可以检测终端的机体方向及转动角度,陀螺仪传感器811可以与加速度传感器810协同采集用户对终端的3D动作。处理器801根据陀螺仪传感器811采集的数据,可以实现如下功能:动作感应(比如根据用户的倾斜操作来改变UI)、拍摄时的图像稳定、游戏控制以及惯性导航。The gyroscope sensor 811 can detect the terminal's orientation and rotation angle. The gyroscope sensor 811, in conjunction with the accelerometer sensor 810, can collect the user's 3D movements on the terminal. Based on the data collected by the gyroscope sensor 811, the processor 801 can perform the following functions: motion sensing (e.g., changing the UI based on the user's tilt), image stabilization during shooting, game control, and inertial navigation.
压力传感器812可以设置在终端的侧边框和/或显示屏805的下层。当压力传感器812设置在终端的侧边框时,可以检测用户对终端的握持信号,由处理器801根据压力传感器812采集的握持信号进行左右手识别或快捷操作。当压力传感器812设置在显示屏805的下层时,由处理器801根据用户对显示屏805的压力操作,实现对UI界面上的可操作性控件进行控制。可操作性控件包括按钮控件、滚动条控件、图标控件、菜单控件中的至少一种。The pressure sensor 812 can be disposed on the side bezel of the terminal and/or on the lower layer of the display screen 805. When the pressure sensor 812 is disposed on the side bezel of the terminal, it can detect the user's grip signal on the terminal, and the processor 801 can perform left/right hand recognition or quick operation based on the grip signal collected by the pressure sensor 812. When the pressure sensor 812 is disposed on the lower layer of the display screen 805, the processor 801 can control the operable controls on the UI interface based on the user's pressure operation on the display screen 805. The operable controls include at least one of button controls, scroll bar controls, icon controls, and menu controls.
光学传感器813用于采集环境光强度。在一个实施例中,处理器801可以根据光学传感器813采集的环境光强度,控制显示屏805的显示亮度。具体地,当环境光强度较高时,调高显示屏805的显示亮度;当环境光强度较低时,调低显示屏805的显示亮度。在另一个实施例中,处理器801还可以根据光学传感器813采集的环境光强度,动态调整摄像头组件806的拍摄参数。An optical sensor 813 is used to collect ambient light intensity. In one embodiment, the processor 801 can control the display brightness of the display screen 805 based on the ambient light intensity collected by the optical sensor 813. Specifically, when the ambient light intensity is high, the display brightness of the display screen 805 is increased; when the ambient light intensity is low, the display brightness of the display screen 805 is decreased. In another embodiment, the processor 801 can also dynamically adjust the shooting parameters of the camera assembly 806 based on the ambient light intensity collected by the optical sensor 813.
接近传感器814,也称距离传感器,通常设置在终端的前面板。接近传感器814用于采集用户与终端的正面之间的距离。在一个实施例中,当接近传感器814检测到用户与终端的正面之间的距离逐渐变小时,由处理器801控制显示屏805从亮屏状态切换为息屏状态;当接近传感器814检测到用户与终端的正面之间的距离逐渐变大时,由处理器801控制显示屏805从息屏状态切换为亮屏状态。The proximity sensor 814, also known as a distance sensor, is typically installed on the front panel of the terminal. The proximity sensor 814 is used to detect the distance between the user and the front of the terminal. In one embodiment, when the proximity sensor 814 detects that the distance between the user and the front of the terminal is gradually decreasing, the processor 801 controls the display screen 805 to switch from a screen-on state to a screen-off state; when the proximity sensor 814 detects that the distance between the user and the front of the terminal is gradually increasing, the processor 801 controls the display screen 805 to switch from a screen-off state to a screen-on state.
本领域技术人员可以理解,图8中示出的结构并不构成对计算机设备的限定,可以包括比图示更多或更少的组件,或者组合某些组件,或者采用不同的组件布置。Those skilled in the art will understand that the structure shown in Figure 8 does not constitute a limitation on the computer device and may include more or fewer components than shown, or combine certain components, or employ different component arrangements.
可选地,该终端设备的结构示意图也可以如图9所示。在图9所示的终端设备的结构示意图中,该终端设备例如可以是:智能手机、平板电脑、车载终端、笔记本电脑或台式电脑。终端设备还可能被称为用户设备、便携式终端、膝上型终端、台式终端等其他名称。如图9所示,终端设备包括有:处理器110。Optionally, the structural diagram of the terminal device can also be as shown in Figure 9. In the structural diagram of the terminal device shown in Figure 9, the terminal device can be, for example, a smartphone, tablet computer, vehicle terminal, laptop computer, or desktop computer. The terminal device may also be referred to as user equipment, portable terminal, laptop terminal, desktop terminal, or other names. As shown in Figure 9, the terminal device includes a processor 110.
处理器110分别与外部存储器接口120、内部存储器121、通用串行总线(universal serial bus,USB)接口130、电源管理模块141、移动通信模块150、无线通信模块160、音频模块170、传感器模块180、按键190、马达191、指示器192、摄像头1~N193、显示屏1~N194和SIM卡接口1~N195连接。其中,N为正整数。The processor 110 is connected to the external memory interface 120, internal memory 121, universal serial bus (USB) interface 130, power management module 141, mobile communication module 150, wireless communication module 160, audio module 170, sensor module 180, button 190, motor 191, indicator 192, cameras 1 to N 193, display screens 1 to N 194, and SIM card interfaces 1 to N 195. Here, N is a positive integer.
充电输入到USB接口130,USB接口130还与充电管理模块140、电池142和电源管理模块141连接。移动通信模块150包括各代移动通信网络(2G/3G/4G/5G),无线通信模块160包括各种无线通信协议,例如,蓝牙(bluetooth,BT)、无线局域网(wireless local area networks,WLAN)、全球导航卫星系统(global navigation satellite system,GNSS)、NFC、红外线(InfraredRadiation,IR)或调频(frequency modulation,FM)等。移动通信模块150通过天线1进行通信,无线通信模块160通过天线2进行通信。The charging input is connected to the USB interface 130, which is also connected to the charging management module 140, the battery 142, and the power management module 141. The mobile communication module 150 includes various generations of mobile communication networks (2G/3G/4G/5G), and the wireless communication module 160 includes various wireless communication protocols, such as Bluetooth (BT), wireless local area networks (WLAN), global navigation satellite system (GNSS), NFC, infrared radiation (IR), or frequency modulation (FM). The mobile communication module 150 communicates via antenna 1, and the wireless communication module 160 communicates via antenna 2.
音频模块170分别与扬声器170A、受话器170B、麦克风170C、耳机接口170D连接。传感器模块180包括但不限于压力传感器180A、陀螺仪传感器180B、气压传感器180C、磁传感器180D、加速度传感器180E、距离传感器180F、接近光传感器180G、指纹传感器180H、温度传感器180J、触摸传感器180K、环境光传感器180L和骨传导传感器180M。图9所示的模块可以参见图8所示的相关内容的介绍,此处不再赘述。The audio module 170 is connected to the speaker 170A, receiver 170B, microphone 170C, and headphone jack 170D. The sensor module 180 includes, but is not limited to, a pressure sensor 180A, a gyroscope sensor 180B, a barometric pressure sensor 180C, a magnetic sensor 180D, an accelerometer 180E, a proximity sensor 180F, a proximity light sensor 180G, a fingerprint sensor 180H, a temperature sensor 180J, a touch sensor 180K, an ambient light sensor 180L, and a bone conduction sensor 180M. The modules shown in Figure 9 can be referred to the descriptions in Figure 8, which will not be repeated here.
针对图8或图9所示的终端设备。图8中的处理器801的数量可以为多个,任一处理器801的连接方式可参见图8所示的连接方式,多个处理器801中的两个处理器801可以分别对应图2所示的处理器A和处理器B。其中,外围设备接口803还可以连接蓝牙芯片,即对应图2所示的蓝牙芯片。图9中的处理器110的数量可以为多个,任一处理器110的连接方式可参见图9所示的连接方式,多个处理器110中的两个处理器110可以分别对应图2所示的处理器A和处理器B。其中,在无线通信模块150包括BT的情况下,无线通信模块150对应图2所示的蓝牙芯片。For the terminal device shown in Figure 8 or Figure 9. The number of processors 801 in Figure 8 can be multiple. The connection method of any processor 801 is shown in Figure 8. Two processors 801 among the multiple processors 801 can correspond to processor A and processor B shown in Figure 2, respectively. The peripheral device interface 803 can also connect to a Bluetooth chip, corresponding to the Bluetooth chip shown in Figure 2. The number of processors 110 in Figure 9 can be multiple. The connection method of any processor 110 is shown in Figure 9. Two processors 110 among the multiple processors 110 can correspond to processor A and processor B shown in Figure 2, respectively. Where the wireless communication module 150 includes a Bluetooth chip, the wireless communication module 150 corresponds to the Bluetooth chip shown in Figure 2.
图10为本申请实施例提供的一种终端系统架构的示意图。如图10所示,终端系统架构包括应用程序层、应用程序框架层、系统库和内核库。应用程序层包括但不限于相机、日历、音乐、地图、WLAN、图库、蓝牙、视频、通话、直播、短信息等。应用程序框架层包括但不限于窗口管理器、内容提供器、电话管理器、通知管理器、资源管理器、视图系统等。系统库包括但不限于表面管理器、三维图形处理库、二维图形引擎、媒体库等各种库以及系统运行环境。内核库包括但不限于显示驱动、摄像头驱动、音频驱动、传感器驱动等。Figure 10 is a schematic diagram of a terminal system architecture provided in an embodiment of this application. As shown in Figure 10, the terminal system architecture includes an application layer, an application framework layer, system libraries, and a kernel library. The application layer includes, but is not limited to, applications for camera, calendar, music, map, WLAN, gallery, Bluetooth, video, call, live streaming, and SMS. The application framework layer includes, but is not limited to, a window manager, content provider, phone manager, notification manager, resource manager, and view system. The system library includes, but is not limited to, various libraries such as a surface manager, 3D graphics processing library, 2D graphics engine, and media library, as well as the system runtime environment. The kernel library includes, but is not limited to, display driver, camera driver, audio driver, and sensor driver.
针对图10所示的终端系统架构,图2所示的蓝牙应用可以对应到图10所示的应用程序层,即图10所示的应用程序层中的蓝牙;图2所示的蓝牙协议栈可以对应到图10所示的系统库,则图10所示的系统库还包括蓝牙协议栈;图2所示的蓝牙接口驱动可以对应到图10所示的内核层,则图10所示的内核层还包括蓝牙接口驱动。Regarding the terminal system architecture shown in Figure 10, the Bluetooth application shown in Figure 2 can be mapped to the application layer shown in Figure 10, that is, the Bluetooth in the application layer shown in Figure 10; the Bluetooth protocol stack shown in Figure 2 can be mapped to the system library shown in Figure 10, so the system library shown in Figure 10 also includes the Bluetooth protocol stack; the Bluetooth interface driver shown in Figure 2 can be mapped to the kernel layer shown in Figure 10, so the kernel layer shown in Figure 10 also includes the Bluetooth interface driver.
应理解的是,上述处理器可以是CPU,还可以是其他通用处理器、数字信号处理器(digital signal processing,DSP)、专用集成电路(application specific integrated circuit,ASIC)、现场可编程门阵列(field-programmable gate array,FPGA)或者其他可编程逻辑器件、分立门或者晶体管逻辑器件、分立硬件组件等。通用处理器可以是微处理器或者是任何常规的处理器等。值得说明的是,处理器可以是支持进阶精简指令集机器(advanced RISC machines,ARM)架构的处理器。It should be understood that the aforementioned processor can be a CPU, or other general-purpose processors, digital signal processors (DSPs), application-specific integrated circuits (ASICs), field-programmable gate arrays (FPGAs), or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. General-purpose processors can be microprocessors or any conventional processor. It is worth noting that the processor can be a processor supporting Advanced Reduced Instruction Set Computing (RISC) machines (ARM) architecture.
进一步地,在一种可选的实施例中,上述存储器可以包括只读存储器和随机存取存储器,并向处理器提供指令和数据。存储器还可以包括非易失性随机存取存储器。例如,存储器还可以存储设备类型的信息。Furthermore, in an alternative embodiment, the memory described above may include read-only memory and random access memory, and provide instructions and data to the processor. The memory may also include non-volatile random access memory. For example, the memory may also store device type information.
该存储器可以是易失性存储器或非易失性存储器,或可包括易失性和非易失性存储器两者。其中,非易失性存储器可以是只读存储器(read-only memory,ROM)、可编程只读存储器(programmable ROM,PROM)、可擦除可编程只读存储器(erasable PROM,EPROM)、电可擦除可编程只读存储器(electrically EPROM,EEPROM)或闪存。易失性存储器可以是随机存取存储器(randomaccess memory,RAM),其用作外部高速缓存。通过示例性但不是限制性说明,许多形式的RAM可用。例如,静态随机存取存储器(static RAM,SRAM)、动态随机存取存储器(dynamic randomaccess memory,DRAM)、同步动态随机存取存储器(synchronous DRAM,SDRAM)、双倍数据速率同步动态随机存取存储器(doubledata rate SDRAM,DDR SDRAM)、增强型同步动态随机存取存储器(enhancedSDRAM,ESDRAM)、同步连接动态随机存取存储器(synchlink DRAM,SLDRAM)和直接内存总线随机存取存储器(direct rambus RAM,DR RAM)。The memory can be volatile or non-volatile, or may include both. The non-volatile memory can be read-only memory (ROM), programmable read-only memory (PROM), erasable programmable read-only memory (EPROM), electrically erasable programmable read-only memory (EEPROM), or flash memory. The volatile memory can be random access memory (RAM), which serves as an external cache. Many forms of RAM are available by way of example, but not limitation. Examples include static random access memory (SRAM), dynamic random access memory (DRAM), synchronous dynamic random access memory (SDRAM), double data rate synchronous dynamic random access memory (DDR SDRAM), enhanced synchronous dynamic random access memory (ESDRAM), synchronous linked dynamic random access memory (SLDRAM), and direct rambus RAM (DR RAM).
本申请实施例还提供了一种计算机可读存储介质,存储介质中存储有至少一条指令,指令由处理器加载并执行,以使计算机实现如上任一的多蓝牙主机的协同处理方法。This application also provides a computer-readable storage medium storing at least one instruction, which is loaded and executed by a processor to enable the computer to implement any of the above-described multi-Bluetooth host collaborative processing methods.
本申请实施例还提供了一种计算机程序(产品),当计算机程序被计算机执行时,可以使得处理器或计算机执行上述方法实施例中对应的各个步骤和/或流程。This application also provides a computer program (product) that, when executed by a computer, causes the processor or computer to perform the corresponding steps and/or processes in the above method embodiments.
本申请实施例还提供了一种芯片,包括处理器,用于从存储器中调用并运行存储器中存储的指令,使得安装有芯片的通信设备执行如上任一的多蓝牙主机的协同处理方法。This application also provides a chip, including a processor, for calling and executing instructions stored in a memory, causing a communication device equipped with the chip to perform any of the above-described multi-Bluetooth host collaborative processing methods.
本申请实施例还提供另一种芯片,包括:输入接口、输出接口、处理器和存储器,输入接口、输出接口、处理器以及存储器之间通过内部连接通路相连,处理器用于执行存储器中的代码,当代码被执行时,处理器用于执行如上任一的多蓝牙主机的协同处理方法。This application embodiment also provides another chip, including: an input interface, an output interface, a processor, and a memory. The input interface, output interface, processor, and memory are connected through an internal connection path. The processor is used to execute code in the memory. When the code is executed, the processor is used to execute any of the above-mentioned multi-Bluetooth host collaborative processing methods.
在上述实施例中,可以全部或部分地通过软件、硬件、固件或者其任意组合来实现。当使用软件实现时,可以全部或部分地以计算机程序产品的形式实现。计算机程序产品包括一个或多个计算机指令。在计算机上加载和执行计算机程序指令时,全部或部分地产生按照本申请的流程或功能。计算机可以是通用计算机、专用计算机、计算机网络、或者其他可编程装置。计算机指令可以存储在计算机可读存储介质中,或者从一个计算机可读存储介质向另一个计算机可读存储介质传输,例如,计算机指令可以从一个网站站点、计算机、服务器或数据中心通过有线(例如同轴电缆、光纤、数字用户线)或无线(例如红外、无线、微波等)方式向另一个网站站点、计算机、服务器或数据中心进行传输。计算机可读存储介质可以是计算机能够存取的任何可用介质或者是包含一个或多个可用介质集成的服务器、数据中心等数据存储设备。可用介质可以是磁性介质,(例如,软盘、硬盘、磁带)、光介质(例如,DVD)、或者半导体介质(例如,固态硬盘(solid state disk))等。In the above embodiments, implementation can be achieved, in whole or in part, through software, hardware, firmware, or any combination thereof. When implemented in software, it can be implemented, in whole or in part, as a computer program product. A computer program product includes 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 this application is generated. The computer can be a general-purpose computer, a special-purpose computer, a computer network, or other programmable device. The computer instructions can be stored in a computer-readable storage medium or transmitted from one computer-readable storage medium to another. For example, computer instructions can be transmitted from one website, computer, server, or data center to another website, computer, server, or data center via wired (e.g., coaxial cable, fiber optic, digital subscriber line) or wireless (e.g., infrared, wireless, microwave, etc.) means. The computer-readable storage medium can be any available medium that a computer can access or a data storage device such as a server or data center that integrates one or more available media. The available medium can be a magnetic medium (e.g., floppy disk, hard disk, magnetic tape), an optical medium (e.g., DVD), or a semiconductor medium (e.g., solid-state disk), etc.
本领域普通技术人员可以意识到,结合本文中所公开的实施例中描述的各方法步骤和模块,能够以软件、硬件、固件或者其任意组合来实现,为了清楚地说明硬件和软件的可互换性,在上述说明中已经按照功能一般性地描述了各实施例的步骤及组成。这些功能究竟以硬件还是软件方式来执行,取决于技术方案的特定应用和设计约束条件。本领域普通技术人员可以对每个特定的应用来使用不同方法来实现所描述的功能,但是这种实现不应认为超出本申请的范围。Those skilled in the art will recognize that the method steps and modules described in conjunction with the embodiments disclosed herein can be implemented in software, hardware, firmware, or any combination thereof. To clearly illustrate the interchangeability of hardware and software, the steps and components of each embodiment have been generally described in terms of functionality in the foregoing description. Whether these functions are implemented in hardware or software 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.
本领域普通技术人员可以理解实现上述实施例的全部或部分步骤可以通过硬件来完成,也可以通过程序来指令相关的硬件完成,该程序可以存储于一种计算机可读存储介质中,上述提到的存储介质可以是只读存储器,磁盘或光盘等。Those skilled in the art will understand that all or part of the steps of the above embodiments can be implemented by hardware or by a program instructing related hardware. The program can be stored in a computer-readable storage medium, such as a read-only memory, a disk, or an optical disk.
当使用软件实现时,可以全部或部分地以计算机程序产品的形式实现。该计算机程序产品包括一个或多个计算机程序指令。作为示例,本申请实施例的方法可以在机器可执行指令的上下文中被描述,机器可执行指令诸如包括在目标的真实或者虚拟处理器上的器件中执行的程序模块中。一般而言,程序模块包括例程、程序、库、对象、类、组件、数据结构等,其执行特定的任务或者实现特定的抽象数据结构。在各实施例中,程序模块的功能可以在所描述的程序模块之间合并或者分割。用于程序模块的机器可执行指令可以在本地或者分布式设备内执行。在分布式设备中,程序模块可以位于本地和远程存储介质二者中。When implemented using software, it can be implemented wholly or partially as a computer program product. This computer program product includes one or more computer program instructions. As an example, the methods of this application embodiment can be described in the context of machine-executable instructions, such as program modules that execute on a device on a real or virtual processor of the target. Generally, program modules include routines, programs, libraries, objects, classes, components, data structures, etc., which perform specific tasks or implement specific abstract data structures. In various embodiments, the functionality of program modules can be combined or divided among the described program modules. The machine-executable instructions for the program modules can execute within a local or distributed device. In a distributed device, the program modules can reside on both local and remote storage media.
用于实现本申请实施例的方法的计算机程序代码可以用一种或多种编程语言编写。这些计算机程序代码可以提供给通用计算机、专用计算机或其他可编程的数据处理装置的处理器,使得程序代码在被计算机或其他可编程的数据处理装置执行的时候,引起在流程图和/或框图中规定的功能/操作被实施。程序代码可以完全在计算机上、部分在计算机上、作为独立的软件包、部分在计算机上且部分在远程计算机上或完全在远程计算机或服务器上执行。Computer program code used to implement the methods of the embodiments of this application may be written in one or more programming languages. This computer program code may be provided to a processor of a general-purpose computer, a special-purpose computer, or other programmable data processing apparatus, such that when executed by the computer or other programmable data processing apparatus, the program code causes the functions/operations specified in the flowcharts and/or block diagrams to be implemented. The program code may be executed entirely on a computer, partially on a computer, as a standalone software package, partially on a computer and partially on a remote computer, or entirely on a remote computer or server.
在本申请实施例的上下文中,计算机程序代码或者相关数据可以由任意适当载体承载,以使得设备、装置或者处理器能够执行上文描述的各种处理和操作。载体的示例包括信号、计算机可读介质等等。In the context of the embodiments of this application, computer program code or related data may be carried by any suitable carrier to enable a device, apparatus, or processor to perform the various processes and operations described above. Examples of carriers include signals, computer-readable media, etc.
信号的示例可以包括电、光、无线电、声音或其它形式的传播信号,诸如载波、红外信号等。Examples of signals may include electrical, optical, radio, sound, or other forms of propagation signals, such as carrier waves, infrared signals, etc.
机器可读介质可以是包含或存储用于或有关于指令执行系统、装置或设备的程序的任何有形介质。机器可读介质可以是机器可读信号介质或机器可读存储介质。机器可读介质可以包括但不限于电子的、磁的、光学的、电磁的、红外的或半导体系统、装置或设备,或其任意合适的组合。机器可读存储介质的更详细示例包括带有一根或多根导线的电气连接、便携式计算机磁盘、硬盘、随机存储存取器(RAM)、只读存储器(ROM)、可擦除可编程只读存储器(EPROM或闪存)、光存储设备、磁存储设备,或其任意合适的组合。A machine-readable medium can be any tangible medium that contains or stores programs for or relating to an instruction execution system, apparatus, or device. A machine-readable medium can be a machine-readable signal medium or a machine-readable storage medium. Machine-readable media can include, but are not limited to, electronic, magnetic, optical, electromagnetic, infrared, or semiconductor systems, apparatus, or devices, or any suitable combination thereof. More detailed examples of machine-readable storage media include electrical connections with one or more wires, portable computer disks, hard disks, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM or flash memory), optical storage devices, magnetic storage devices, or any suitable combination thereof.
所属领域的技术人员可以清楚地了解到,为了描述的方便和简洁,上述描述的系统、设备和模块的具体工作过程,可以参见前述方法实施例中的对应过程,在此不再赘述。Those skilled in the art will clearly understand that, for the sake of convenience and brevity, the specific working processes of the systems, devices, and modules described above can be found in the corresponding processes in the foregoing method embodiments, and will not be repeated here.
在本申请所提供的几个实施例中,应该理解到,所揭露的系统、设备和方法,可以通过其它的方式实现。例如,以上所描述的设备实施例仅仅是示意性的,例如,该模块的划分,仅仅为一种逻辑功能划分,实际实现时可以有另外的划分方式,例如多个模块或组件可以结合或者可以集成到另一个系统,或一些特征可以忽略,或不执行。另外,所显示或讨论的相互之间的耦合或直接耦合或通信连接可以是通过一些接口、设备或模块的间接耦合或通信连接,也可以是电的,机械的或其它的形式连接。In the embodiments provided in this application, it should be understood that the disclosed systems, devices, and methods can be implemented in other ways. For example, the device embodiments described above are merely illustrative; for instance, the division of modules is only a logical functional division, and in actual implementation, there may be other division methods. For example, multiple modules or components may be combined or integrated into another system, or some features may be ignored or not executed. Furthermore, the couplings or direct couplings or communication connections shown or discussed may be indirect couplings or communication connections through some interfaces, devices, or modules, or they may be electrical, mechanical, or other forms of connection.
该作为分离部件说明的模块可以是或者也可以不是物理上分开的,作为模块显示的部件可以是或者也可以不是物理模块,即可以位于一个地方,或者也可以分布到多个网络模块上。可以根据实际的需要选择其中的部分或者全部模块来实现本申请实施例方案的目的。The modules described as separate components may or may not be physically separate. The components shown as modules may or may not be physical modules; that is, they may be located in one place or distributed across multiple network modules. Some or all of the modules can be selected to achieve the purpose of the embodiments of this application, depending on actual needs.
另外,在本申请各个实施例中的各功能模块可以集成在一个处理模块中,也可以是各个模块单独物理存在,也可以是两个或两个以上模块集成在一个模块中。上述集成的模块既可以采用硬件的形式实现,也可以采用软件功能模块的形式实现。Furthermore, the functional modules in the various embodiments of this application can be integrated into one processing module, or each module can exist physically separately, or two or more modules can be integrated into one module. The integrated modules described above can be implemented in hardware or as software functional modules.
该集成的模块如果以软件功能模块的形式实现并作为独立的产品销售或使用时,可以存储在一个计算机可读存储介质中。基于这样的理解,本申请的技术方案本质上或者说对现有技术做出贡献的部分,或者该技术方案的全部或部分可以以软件产品的形式体现出来,该计算机软件产品存储在一个存储介质中,包括若干指令用以使得一台计算机设备(可以是个人计算机,服务器,或者网络设备等)执行本申请各个实施例中方法的全部或部分步骤。而前述的存储介质包括:U盘、移动硬盘、只读存储器(read-only memory,ROM)、随机存取存储器(random access memory,RAM)、磁碟或者光盘等各种可以存储程序代码的介质。If the integrated module is implemented as a software functional module and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of this application, in essence, or the part that contributes to the prior art, or all or part of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium 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 in the various embodiments of this application. The aforementioned storage medium includes various media capable of storing program code, such as USB flash drives, portable hard drives, read-only memory (ROM), random access memory (RAM), magnetic disks, or optical disks.
本申请中术语“第一”“第二”等字样用于对作用和功能基本相同的相同项或相似项进行区分,应理解,“第一”、“第二”、“第n”之间不具有逻辑或时序上的依赖关系,也不对数量和执行顺序进行限定。还应理解,尽管以下描述使用术语第一、第二等来描述各种元素,但这些元素不应受术语的限制。这些术语只是用于将一元素与另一元素区别分开。例如,在不脱离各种示例的范围的情况下,第一图像可以被称为第二图像,并且类似地,第二图像可以被称为第一图像。第一图像和第二图像都可以是图像,并且在某些情况下,可以是单独且不同的图像。In this application, the terms "first," "second," etc., are used to distinguish identical or similar items that have substantially the same function and purpose. It should be understood that there is no logical or temporal dependency between "first," "second," and "nth," nor does it limit the quantity or order of execution. It should also be understood that although the following description uses the terms "first," "second," etc., to describe various elements, these elements should not be limited by the terms. These terms are merely used to distinguish one element from another. For example, without departing from the scope of various examples, a first image can be referred to as a second image, and similarly, a second image can be referred to as a first image. Both the first image and the second image can be images, and in some cases, they can be separate and distinct images.
还应理解,在本申请的各个实施例中,各个过程的序号的大小并不意味着执行顺序的先后,各过程的执行顺序应以其功能和内在逻辑确定,而不应对本申请实施例的实施过程构成任何限定。It should also be understood that, in the various embodiments of this application, the sequence number of each process does not imply the order of execution. The execution order of each process should be determined by its function and internal logic, and should not constitute any limitation on the implementation process of the embodiments of this application.
本申请中术语“至少一个”的含义是指一个或多个,本申请中术语“多个”的含义是指两个或两个以上,例如,多个第二报文是指两个或两个以上的第二报文。本文中术语“系统”和“网络”经常可互换使用。In this application, the term "at least one" means one or more, and the term "multiple" means two or more. For example, multiple second messages refer to two or more second messages. The terms "system" and "network" are often used interchangeably in this document.
应理解,在本文中对各种所述示例的描述中所使用的术语只是为了描述特定示例,而并非旨在进行限制。如在对各种所述示例的描述和所附权利要求书中所使用的那样,单数形式“一个(“a”,“an”)”和“该”旨在也包括复数形式,除非上下文另外明确地指示。It should be understood that the terminology used in the description of the various examples herein is for the purpose of describing particular examples only and is not intended to be limiting. As used in the description of the various examples and the appended claims, the singular forms “a” and “the” are intended to include the plural forms as well, unless the context clearly indicates otherwise.
还应理解,本文中所使用的术语“和/或”是指并且涵盖相关联的所列出的项目中的一个或多个项目的任何和全部可能的组合。术语“和/或”,是一种描述关联对象的关联关系,表示可以存在三种关系,例如,A和/或B,可以表示:单独存在A,同时存在A和B,单独存在B这三种情况。另外,本申请中的字符“/”,一般表示前后关联对象是一种“或”的关系。It should also be understood that the term "and/or" as used herein refers to and covers any and all possible combinations of one or more of the associated listed items. The term "and/or" describes an association 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. Additionally, the character "/" in this application generally indicates that the preceding and following related objects are in an "or" relationship.
还应理解,术语“包括”(也称“includes”、“including”、“comprises”和/或“comprising”)当在本说明书中使用时指定存在所陈述的特征、整数、步骤、操作、元素、和/或部件,但是并不排除存在或添加一个或多个其他特征、整数、步骤、操作、元素、部件、和/或其分组。It should also be understood that the term “comprising” (also referred to as “includes”, “including”, “comprises” and/or “comprising”) as used in this specification specifies the presence of the stated features, integers, steps, operations, elements, and/or components, but does not exclude the presence or addition of one or more other features, integers, steps, operations, elements, components, and/or groups thereof.
还应理解,术语“若”和“如果”可被解释为意指“当...时”(“when”或“upon”)或“响应于确定”或“响应于检测到”。类似地,根据上下文,短语“若确定...”或“若检测到[所陈述的条件或事件]”可被解释为意指“在确定...时”或“响应于确定...”或“在检测到[所陈述的条件或事件]时”或“响应于检测到[所陈述的条件或事件]”。It should also be understood that the terms “if” and “if” can be interpreted as meaning “when” or “upon”, or “in response to determination” or “in response to detection”. Similarly, depending on the context, the phrases “if determination…” or “if detection [the stated condition or event]” can be interpreted as meaning “when determination…”, or “in response to determination…”, or “when detection [the stated condition or event]” or “in response to detection [the stated condition or event]”.
应理解,根据A确定B并不意味着仅仅根据A确定B,还可以根据A和/或其它信息确定B。It should be understood that determining B based on A does not mean determining B solely based on A; B can also be determined based on A and/or other information.
还应理解,说明书通篇中提到的“一个实施例”、“一实施例”、“一种可能的实现方式”意味着与实施例或实现方式有关的特定特征、结构或特性包括在本申请的至少一个实施例中。因此,在整个说明书各处出现的“在一个实施例中”或“在一实施例中”、“一种可能的实现方式”未必一定指相同的实施例。此外,这些特定的特征、结构或特性可以任意适合的方式结合在一个或多个实施例中。It should also be understood that the phrases "an embodiment," "an embodiment," and "a possible implementation" used throughout the specification mean that a specific feature, structure, or characteristic related to an embodiment or implementation is included in at least one embodiment of this application. Therefore, the phrases "in an embodiment," "an embodiment," or "a possible implementation" appearing throughout the specification do not necessarily refer to the same embodiment. Furthermore, these specific features, structures, or characteristics can be combined in any suitable manner in one or more embodiments.
以上描述仅为本申请的可选实施例,并不用以限制本申请,凡在本申请的原则之内,所作的任何修改、等同替换、改进等,均应包含在本申请的保护范围之内。The above description is only an optional embodiment of this application and is not intended to limit this application. Any modifications, equivalent substitutions, improvements, etc., made within the principles of this application should be included within the protection scope of this application.
Claims (14)
Applications Claiming Priority (2)
| Application Number | Priority Date | Filing Date | Title |
|---|---|---|---|
| CN202410807944.3A CN121194158A (en) | 2024-06-20 | 2024-06-20 | Methods, apparatus, devices and storage media for collaborative processing of multiple Bluetooth hosts |
| CN202410807944.3 | 2024-06-20 |
Publications (1)
| Publication Number | Publication Date |
|---|---|
| WO2025260847A1 true WO2025260847A1 (en) | 2025-12-26 |
Family
ID=98091911
Family Applications (1)
| Application Number | Title | Priority Date | Filing Date |
|---|---|---|---|
| PCT/CN2025/081693 Pending WO2025260847A1 (en) | 2024-06-20 | 2025-03-10 | Collaborative processing method and apparatus for multiple bluetooth hosts, device, and storage medium |
Country Status (2)
| Country | Link |
|---|---|
| CN (2) | CN121194161A (en) |
| WO (1) | WO2025260847A1 (en) |
Citations (6)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| CN105472773A (en) * | 2015-01-13 | 2016-04-06 | 深圳Tcl数字技术有限公司 | Method and host for multi-bluetooth device communication |
| CN111083684A (en) * | 2019-12-23 | 2020-04-28 | 维沃移动通信有限公司 | Method for controlling electronic equipment and electronic equipment |
| CN116193413A (en) * | 2023-04-27 | 2023-05-30 | 江西斐耳科技有限公司 | A bluetooth connection method, system, storage medium and device |
| US20230189366A1 (en) * | 2020-08-13 | 2023-06-15 | Huawei Technologies Co., Ltd. | Bluetooth Communication Method, Terminal Device, and Computer-Readable Storage Medium |
| CN117858052A (en) * | 2022-09-30 | 2024-04-09 | Oppo广东移动通信有限公司 | Bluetooth equipment connection method and terminal equipment |
| CN117956371A (en) * | 2022-10-20 | 2024-04-30 | 荣耀终端有限公司 | Audio service recovery processing method, electronic device and computer storage medium |
-
2024
- 2024-06-20 CN CN202511028109.0A patent/CN121194161A/en active Pending
- 2024-06-20 CN CN202410807944.3A patent/CN121194158A/en active Pending
-
2025
- 2025-03-10 WO PCT/CN2025/081693 patent/WO2025260847A1/en active Pending
Patent Citations (6)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| CN105472773A (en) * | 2015-01-13 | 2016-04-06 | 深圳Tcl数字技术有限公司 | Method and host for multi-bluetooth device communication |
| CN111083684A (en) * | 2019-12-23 | 2020-04-28 | 维沃移动通信有限公司 | Method for controlling electronic equipment and electronic equipment |
| US20230189366A1 (en) * | 2020-08-13 | 2023-06-15 | Huawei Technologies Co., Ltd. | Bluetooth Communication Method, Terminal Device, and Computer-Readable Storage Medium |
| CN117858052A (en) * | 2022-09-30 | 2024-04-09 | Oppo广东移动通信有限公司 | Bluetooth equipment connection method and terminal equipment |
| CN117956371A (en) * | 2022-10-20 | 2024-04-30 | 荣耀终端有限公司 | Audio service recovery processing method, electronic device and computer storage medium |
| CN116193413A (en) * | 2023-04-27 | 2023-05-30 | 江西斐耳科技有限公司 | A bluetooth connection method, system, storage medium and device |
Also Published As
| Publication number | Publication date |
|---|---|
| CN121194161A (en) | 2025-12-23 |
| CN121194158A (en) | 2025-12-23 |
Similar Documents
| Publication | Publication Date | Title |
|---|---|---|
| EP3982247A1 (en) | Screen projection method and electronic device | |
| US20220342850A1 (en) | Data transmission method and related device | |
| EP4084486B1 (en) | Cross-device content projection method, and electronic device | |
| US20220304094A1 (en) | Bluetooth Reconnection Method and Related Apparatus | |
| WO2022228048A1 (en) | Method for interaction between electronic devices and electronic device | |
| WO2022100304A1 (en) | Method and apparatus for transferring application content across devices, and electronic device | |
| US20220408505A1 (en) | Bluetooth Connection Method and Electronic Device | |
| WO2022048500A1 (en) | Display method, and device | |
| CN113115439B (en) | Positioning method and related equipment | |
| WO2022042656A1 (en) | Interface display method, and device | |
| WO2022028537A1 (en) | Device recognition method and related apparatus | |
| CN116156044A (en) | Device coordination method and related device | |
| WO2021135734A1 (en) | Method for transmitting file in application, and electronic device and system | |
| WO2022007944A1 (en) | Device control method, and related apparatus | |
| WO2022042770A1 (en) | Method for controlling communication service state, terminal device and readable storage medium | |
| WO2021218544A1 (en) | Wireless connection providing system, method, and electronic apparatus | |
| CN112130788A (en) | A content sharing method and device thereof | |
| WO2023029983A1 (en) | Control content dragging method and system, and electronic device | |
| US20240370218A1 (en) | Screen sharing method and related device | |
| JP2024545558A (en) | Cross-device navigation task synchronization method and apparatus, device, and storage medium | |
| WO2022262387A1 (en) | Volume management method and electronic device | |
| CN115437719A (en) | Cross-operating-system calling method and device and electronic equipment | |
| WO2022152174A1 (en) | Screen projection method and electronic device | |
| WO2025119190A1 (en) | Multi-device coordination method and related apparatus | |
| WO2025260847A1 (en) | Collaborative processing method and apparatus for multiple bluetooth hosts, device, and storage medium |