Bluetooth connection method, electronic device and computer program product
By using the Bluetooth control layer in dual -system electronic equipment, the problem of easy interruption of Bluetooth connection when the operating system is switched, and realized the continuity of data transmission and the non -perception operating system switching of the remote device.
Patent Information
- Application Number
- CN202411521998.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-10-29
- Publication Date
- 2025-01-24
AI Technical Summary
In dual-system electronic devices, Bluetooth connection is easily interrupted when switching the operating system, affecting data transmission.
Through the first operating system and the second operating system, the Bluetooth control layer is shared to ensure that the second operating system always keeps communication with the Bluetooth control layer during system switching to avoid interruption.
It does not affect the Bluetooth connection when the operating system is switched to ensure the continuity of the data transmission, so that the remote device does not perceive the operating system switch during data transmission.
Smart Images

Figure CN119364564A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the technical field of Bluetooth communication, and in particular to a Bluetooth connection method, electronic device and computer program product. Background Art
[0002] In the conventional technology, when an electronic device equipped with dual systems performs Bluetooth communication with a remote device, the Bluetooth connection may be completely interrupted as the two operating systems switch. In the conventional method, the Bluetooth connection in the dual systems is completely separated and runs independently. That is, when the Bluetooth connection is implemented on the first operating system, the processor (CPU) running the first operating system communicates directly with the Bluetooth chip. Correspondingly, when the Bluetooth connection is implemented on the second operating system, the processor (CPU) running the second operating system also communicates directly with the Bluetooth chip. Since there is only one Bluetooth chip at the bottom, when the operating system is switched, it is necessary to first close the Bluetooth connection of the operating system being run, and then initialize and establish the Bluetooth connection of another operating system. However, in the gap process of closing the Bluetooth connection of the operating system and then initializing and establishing the Bluetooth connection of another operating system, the Bluetooth connection will be completely interrupted, affecting data transmission. Therefore, how to not affect the use of the remote device when switching the operating system is a technical problem that needs to be solved urgently. Summary of the invention
[0003] In view of at least one of the above technical problems existing in the prior art, this application is proposed. According to one aspect of this application, a Bluetooth connection method is provided, which is applied to an electronic device with a dual operating system, wherein the electronic device includes a first processor and a second processor, wherein the first processor is used to run a first operating system, and the second processor is used to run a second operating system, wherein the first processor is connected to the second processor in communication, and the second processor is connected to the Bluetooth control layer in communication; the method includes:
[0004] In response to the first Bluetooth connection instruction, controlling the second operating system to establish a Bluetooth connection with a remote device through the Bluetooth control layer;
[0005] Obtaining a first system switching instruction, and establishing a first communication connection between the first operating system and the second operating system according to the first system switching instruction, so as to send and receive data packets between the first operating system and the Bluetooth control layer through the second operating system;
[0006] Obtaining a second system switching instruction, and establishing a second communication connection within the second operating system according to the second system switching instruction, so as to send and receive data packets between an application layer of the second operating system and the Bluetooth control layer through the second operating system;
[0007] Wherein, the power consumption of the second processor is lower than the power consumption of the second processor.
[0008] The Bluetooth connection method of the embodiment of the present application shares the Bluetooth control layer through the first operating system and the second operating system. When the electronic device responds to the system switching instruction and switches from running the second operating system to running the first operating system, or from running the first operating system to running the second operating system, the second operating system is always in a communication connection state with the Bluetooth control layer, and there will be no communication interruption, thereby avoiding the situation where the Bluetooth service is completely interrupted when the system is switched. The second operating system and the remote device can maintain data transmission, and the remote device is unaware of the switching of operating systems when transmitting data with the second operating system, which will not affect the normal use of the remote device.
[0009] Another aspect of an embodiment of the present application provides an electronic device, the electronic device comprising a first processor and a second processor, the first processor is used to run a first operating system, the second processor is used to run a second operating system, the first processor is communicatively connected to the second processor, and the second processor is communicatively connected to a Bluetooth control layer;
[0010] The electronic device further comprises a memory, in which a computer program is stored. When the computer program is executed by the at least two processors, the at least two processors execute the steps of the Bluetooth connection method as described above.
[0011] According to the Bluetooth connection method of the embodiment of the present application, when the electronic device performs system switching, the second processor is always in a communication connection state with the Bluetooth control layer, and no communication interruption occurs, thereby avoiding a complete interruption of the Bluetooth service during system switching.
[0012] On the other hand, an embodiment of the present application provides a computer program product, including a computer program, which implements the steps of the Bluetooth connection method described above when executed by a processor.
[0013] When the Bluetooth connection method of the embodiment of the present application issues a switching instruction between the first operating system and the second operating system, the second operating system is always in a communication connection state with the Bluetooth control layer, and the second operating system and the remote device can maintain data transmission, thereby avoiding a complete interruption of the Bluetooth service when the system is switched.
[0014] The Bluetooth connection method of the embodiment of the present application shares the Bluetooth control layer through the first operating system and the second operating system. When the electronic device responds to the system switching instruction and switches from running the second operating system to running the first operating system, or from running the first operating system to running the second operating system, the second operating system is always in a communication connection state with the Bluetooth control layer, and there will be no communication interruption, thereby avoiding the situation where the Bluetooth service is completely interrupted when the system is switched. The second operating system and the remote device can maintain data transmission, and the remote device is unaware of the switching of operating systems when transmitting data with the second operating system, which will not affect the normal use of the remote device. BRIEF DESCRIPTION OF THE DRAWINGS
[0015] In order to more clearly illustrate the technical solutions in the embodiments of the present application, the drawings required for use in the description of the embodiments will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative labor.
[0016] Figure 1 A schematic diagram showing the architecture of a Bluetooth module according to an embodiment of the present application is shown;
[0017] Figure 2 A schematic flow chart showing a Bluetooth connection method according to an embodiment of the present application;
[0018] Figure 3 A schematic flowchart of step S201 according to an embodiment of the present application is shown;
[0019] Figure 4 A schematic flowchart of step S202 according to an embodiment of the present application is shown;
[0020] Figure 5 A schematic flowchart of step S202 according to another embodiment of the present application is shown;
[0021] Figure 6 A schematic diagram showing an electronic device establishing a Bluetooth connection with a remote device when running a first operating system according to an embodiment of the present application;
[0022] Figure 7 A schematic flowchart of step S202 according to another embodiment of the present application is shown;
[0023] Figure 8 A schematic flowchart of step S202 according to another embodiment of the present application is shown;
[0024] Fig. 9A schematic diagram showing an electronic device establishing a Bluetooth connection with a remote device when running a first operating system according to another embodiment of the present application;
[0025] Fig.10 A schematic flowchart of step S203 according to an embodiment of the present application is shown;
[0026] Fig.11 A schematic flow chart showing step S203 according to another embodiment of the present application is shown;
[0027] Fig.12 A schematic diagram showing the restoration of connection of each layer when switching the operating system according to an embodiment of the present application;
[0028] Fig.13 A schematic block diagram showing a method for connecting a device via Bluetooth according to an embodiment of the present application is shown;
[0029] Fig.14 A schematic block diagram of an electronic device according to an embodiment of the present application is shown. DETAILED DESCRIPTION
[0030] In order to enable those skilled in the art to better understand the technical solutions of the embodiments of the present application, the technical solutions in the embodiments of the present application will be clearly and completely described below in conjunction with the drawings in the embodiments of the present application. Obviously, the described embodiments are only part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of this application.
[0031] Figure 1 Schematic diagram of the architecture of the Bluetooth module in the embodiment of the present application. Figure 1As shown, the Bluetooth module includes a Bluetooth application layer (BT App), a Bluetooth protocol stack interface layer (BTIF) and a Bluetooth protocol stack (Bluedroid). The Bluetooth application layer (BTApp) includes an application framework, which includes various applications (Apps) and Android Bluetooth (android.bluetooth). The Bluetooth protocol stack interface layer (BTIF) includes a Bluetooth protocol stack thread (BluetoothStack Process) and a local interface (Java Native Interface, JNI), wherein the Bluetooth protocol stack thread (Bluetooth Stack Process) includes a Bluetooth adapter service (Bluetooth Adapter Service), a Bluetooth profile service (Bluetooth Profile Services) and a Bluetooth profile (Bluetooth Profiles).
[0032] Continue to combine Figure 1 In the Bluetooth protocol stack (Bluedroid), it includes the Bluetooth Native Stack (Bluetooth NativeStack), the Hardware Abstract Layer Interface Definition Language Interface (HIDL Interfaces) and the Vendor Implementation Interface (Vendor Implementation), wherein the Bluetooth protocol stack (Bluedroid) includes Bluetooth profiles (BluetoothProfiles) and Bluetooth Hardware Abstract Layer Interface Clients (Bluetooth HAL Clients); the Vendor Implementation Interface (Vendor Implementation) includes the Bluetooth controller. The Bluetooth Native Stack (Bluetooth Native Stack) and the Hardware Abstract Layer Interface Definition Language Interface (HIDL Interfaces) are connected in communication via the Hardware Abstract Layer Interface Definition Language (HAL Interface definition language, HIDL), and the Hardware Abstract Layer Interface Definition Language (HIDL Interfaces) and the Vendor Implementation Interface (Vendor Implementation) are connected in communication.
[0033] With the development of science and technology, Bluetooth technology has been widely used. However, when Bluetooth technology is applied to mobile smart devices such as watches and mobile phones, the power consumption is often large due to the large size of the whole system. In the industry, it is often solved by installing dual Bluetooth systems (host) on electronic devices. The solution mainly includes the following steps / modules: two sets of Bluetooth systems (host) (also referred to as Bluetooth modules in this article). For example, install an Android system and then install a real-time operating system (RTOS), which runs on the first processor (large core) and the second processor (small core) in the system-on-chip (SoC), respectively. Switching is done through business. For example, when the application level needs to listen to music and other audio and video services, it will switch to the Android (Android) of the first processor (large core), run the Bluetooth system (host) of the first processor (large core), and give full play to the performance of the system to obtain a better experience. When the application service only maintains the connection and transmits lightweight services, such as text message chat, short message notification display, etc., the operating system is switched to the real-time operating system (RTOS) of the second processor (small core), and the second processor (small core) Bluetooth (host) is run, and low power consumption is operated. However, there are still some problems with the dual Bluetooth system (host) switching, that is, during the Bluetooth system switching process, the Bluetooth system may be disconnected from the connected remote device, resulting in data transmission interruption, thereby reducing the user experience.
[0034] Therefore, based on at least one of the aforementioned technical problems, the present application provides a Bluetooth connection method, which is applied to an electronic device with a dual operating system, the electronic device comprising a first processor and a second processor, the first processor being used to run a first operating system, the second processor being used to run a second operating system, the first processor being communicatively connected to the second processor, and the second processor being communicatively connected to a Bluetooth control layer; the method comprising: in response to a first Bluetooth connection instruction, controlling the second operating system to establish a Bluetooth connection with a remote device through the Bluetooth control layer; obtaining a first system switching instruction, and establishing a first communication connection between the first operating system and the second operating system according to the first system switching instruction, so as to send and receive data packets between the first operating system and the Bluetooth control layer through the second operating system; obtaining a second system switching instruction, and establishing a second communication connection within the second operating system according to the second system switching instruction, so as to send and receive data packets between the application layer of the second operating system and the Bluetooth control layer through the second operating system; wherein the power consumption of the second processor is lower than the power consumption of the second processor. The Bluetooth connection method of the embodiment of the present application shares the Bluetooth control layer through the first operating system and the second operating system. When the electronic device responds to the system switching instruction and switches from running the second operating system to running the first operating system, or from running the first operating system to running the second operating system, the second operating system is always in a communication connection state with the Bluetooth control layer, and there will be no communication interruption, thereby avoiding the situation where the Bluetooth service is completely interrupted when the system is switched. The second operating system and the remote device can maintain data transmission, and the remote device is unaware of the switching of operating systems when transmitting data with the second operating system, which will not affect the normal use of the remote device.
[0035] The Bluetooth connection method of an embodiment of the present application is applied to an electronic device with a dual operating system, wherein the electronic device includes a first processor and a second processor, wherein the first processor is used to run a first operating system, and the second processor is used to run a second operating system, wherein the first processor is communicatively connected to the second processor, and the second processor is communicatively connected to a Bluetooth control layer (BT controller).
[0036] Here, the electronic device can be any terminal device such as a mobile phone, a tablet computer, a PDA (Personal Digital Assistant), a wearable device (smart watch, etc.), a smart home, etc.
[0037] The electronic device in the embodiment of the present application includes at least 2 processors. The embodiment of the present application does not limit the number, name and type of processors. For example, the processor may include but is not limited to the following processing units: application processor (AP), microcontroller unit (MCU), graphics processor (Graphics Processing Unit, GPU), image signal processor (Image Signal Processor, ISP), digital signal processor (Digital Signal Processor, DSP), or neural network processor (neural-network processing unit, NPU), etc. Different processors can be independent devices or integrated in one or more processors.
[0038] In one embodiment of the present application, the first operating system includes an Android system (Android), and the second operating system includes a real-time operating system (Real Time Operating System, RTOS).
[0039] The Android system of the embodiment of the present application runs on the first processor (large core), and the real-time operating system runs on the second processor (small core). In the embodiment of the present application, the real-time operating system (RTOS) can be a ThreadX system, which is suitable for embedded applications, has the characteristics of small scale, strong real-time performance, high reliability, and easy to use, and supports a large number of processors and system-on-chips (SoC), including embedded processors (ARM), central processing units with reduced instruction set architecture (PowerPC), etc. Some lightweight applications can run on the second processor to save power consumption.
[0040] Figure 2 A schematic flow chart of a Bluetooth connection method according to an embodiment of the present application is shown; Figure 2 As shown, the Bluetooth connection method 200 according to the embodiment of the present application may include the following steps S201, S202 and S203:
[0041] Step S201, in response to a first Bluetooth connection instruction, controlling the second operating system to establish a Bluetooth connection with a remote device through the Bluetooth control layer.
[0042] Combination Figure 6 and Fig. 9When the electronic device establishes a Bluetooth connection with the remote device, the second Bluetooth module (Host2) in the second operating system (RTOS) maintains a connection with the Bluetooth control layer (BT controller) through the second connection layer (HCI). When the electronic device establishes a Bluetooth connection with the remote device, the Bluetooth control layer (BT controller) establishes a connection with the remote device, thereby achieving the purpose of establishing a Bluetooth connection between the second operating system and the remote device. It is worth noting that at this time, only the second connection layer in the second Bluetooth module establishes a Bluetooth connection with the remote device, and the second connection layer does not necessarily receive or send (hereinafter referred to as transceiver) data to the second Bluetooth application layer.
[0043] Among them, the Host Controller Interface (HCI) is used to standardize the communication protocol and communication commands between the host and the controller.
[0044] In the embodiment of the present application, only one Bluetooth control layer (BT controller) is set, so that no matter whether the first operating system or the second operating system is currently running, the Bluetooth control layer (BT controller) and the remote device always maintain Bluetooth connection and data transmission without disconnection.
[0045] like Figure 3 As shown, in step S201, in response to the first Bluetooth connection instruction, controlling the second operating system to establish a Bluetooth connection with a remote device through the Bluetooth control layer (BT controller) includes step A1:
[0046] In step A1, the second host controller interface (HCI) of the second Bluetooth module (Host2) establishes the Bluetooth connection with the remote device through the Bluetooth control layer (BT controller) to send and receive data packets to the remote device.
[0047] In the embodiments of the present application, it can be considered that the first Bluetooth module and the second Bluetooth module share a Bluetooth control layer (BT controller). When switching between the first Bluetooth module and the second Bluetooth module, the second host control interface (Host Controller Interface, HCI) in the second Bluetooth module always remains connected to the Bluetooth control layer (BT controller), and the Bluetooth control layer (BT controller) always maintains a Bluetooth connection with the remote device. Therefore, when the first Bluetooth module and the second Bluetooth module are switched, the Bluetooth connection and data transmission will not be interrupted.
[0048] In one embodiment of the present application, Fig.11 As shown, the method further comprises step D3:
[0049] In step D3, when switching the operating system, the parameters, status and fields of each layer of the switched Bluetooth module are obtained, and the parameters, status and fields of each layer are migrated to the target Bluetooth module, so that the target Bluetooth module is restored to the same parameters, status and fields layer by layer.
[0050] In the embodiments of the present application, Fig.12 As shown, it is a schematic diagram of the restoration of connection of each layer when switching the operating system in the embodiment of the present application. When switching the operating system, the context (including parameters, status and fields of each layer) of the Bluetooth module of the switched operating system is first extracted and sent to the destination Bluetooth module. The destination Bluetooth module (Host) restores the connection layer by layer according to the context of each layer, and then performs data layer switching.
[0051] For example, when switching operating systems, the switched operating system is the first operating system, and the target operating system is the second operating system, or the switched Bluetooth module is the first Bluetooth module, and the target Bluetooth module is the second Bluetooth module. When switching, extract the context of each layer of the first Bluetooth module of the first operating system (including parameters, states, and fields of each layer), and send these contexts to each layer of the second Bluetooth module, so that each layer of the second Bluetooth module is restored to the same context layer by layer (including parameters, states, and fields of each layer). In this way, the data received by the second host control interface is sent to the Bluetooth application layer of the second Bluetooth module.
[0052] For another example, when switching operating systems, the switched operating system is the second operating system, and the target operating system is the first operating system, or the switched Bluetooth module is the second Bluetooth module, and the target Bluetooth module is the first Bluetooth module. When switching, extract the context of each layer of the second Bluetooth module of the second operating system (including parameters, status and fields of each layer), send these contexts to each layer of the first Bluetooth module, so that each layer of the first Bluetooth module is restored to the same context (including parameters, status and fields of each layer) layer by layer. In this way, the data received by the second host control interface is sent to the first host control interface of the first Bluetooth module, and the first host control interface sends the data to the first Bluetooth application layer through the first Bluetooth protocol stack; or, the data received by the second host control interface is sent to the second Bluetooth protocol stack, and the second Bluetooth protocol stack sends the data to the Bluetooth protocol stack interface layer, and sends the data to the first Bluetooth application layer.
[0053] In one example, the condition for triggering the operating system switch may be, for example, a physical button set outside the electronic device or a virtual button on the touch screen of the electronic device; one of the operating systems may also be set as the default operating system, and when the set conditions are met, the operating system is switched, and the switching of the Bluetooth module is triggered at the same time, and other trigger conditions may also be set. Those skilled in the art should know that all examples that meet the purpose of the invention of this application should be within the scope of protection of this application, and are not limited here.
[0054] When the first communication connection or the second communication connection is established, the second host control interface maintains a communication connection and data transmission with the Bluetooth control layer.
[0055] Step S202, obtaining a first system switching instruction, and establishing a first communication connection between the first operating system and the second operating system according to the first system switching instruction, so as to send and receive data packets between the first operating system and the Bluetooth control layer through the second operating system.
[0056] In one embodiment of the present application, Figure 4 As shown, step S202 of obtaining a first system switching instruction, establishing a first communication connection between the first operating system and the second operating system according to the first system switching instruction, so as to send and receive data packets between the first operating system and the Bluetooth control layer through the second operating system, includes step B1 and step B2:
[0057] In step B1, the first system switching instruction is obtained;
[0058] In step B2, based on the first system switching instruction, after the second host controller interface (HCI) of the second Bluetooth module (host) receives and sends the data packet, the data packet is received and sent to the first host control interface (HCI) of the first Bluetooth module (host), so that the first host controller interface (HCI) receives and sends the data packet to the first Bluetooth application layer (BT APP) through the first Bluetooth protocol stack (bluedroid).
[0059] Generally, an Android Bluetooth system (also referred to as a Bluetooth module in this article) may include a host and a controller. For ease of understanding of this application, the host is also used to refer to the Bluetooth module in this article.
[0060] In one embodiment of the present application, Figure 6As shown, it is a schematic diagram of an electronic device of an embodiment of the present application establishing a Bluetooth connection with a remote device when running a first operating system. The first Bluetooth module (Host1) of the first operating system includes a first Bluetooth application layer (BT APP), a first Bluetooth protocol stack (bluedroid) and a first host controller interface (Host Controller Interface, HCI). Among them, the first host controller interface (Host Controller Interface, HCI) is adapted to be connected with the second host controller interface (Host Controller Interface, HCI) of the second Bluetooth module (HOST2) of the second processor (small core) in an inter-process communication (IPC) manner. When the first Bluetooth module (Host1) is selected to run or the second Bluetooth module is switched to the first Bluetooth module, the second host controller interface (Host Controller Interface, HCI) of the second Bluetooth module (Host2) will bypass (bypass) Bluetooth data to the first host controller interface (Host Controller Interface, HCI) of the first Bluetooth module (Host1), so that the first host controller interface (Host Controller Interface, HCI) sends data to the first Bluetooth application layer (BT APP) through the first Bluetooth protocol stack (bluedroid).
[0061] In one example, if Figure 5 As shown, step S202 of establishing a first communication connection between the first operating system and the second operating system further includes step B3:
[0062] In step B3, the second host control interface sends the parameters, status and fields of each layer of the second Bluetooth module to the first host control interface, so that the first host control interface sends the parameters, status and fields of each layer to the first Bluetooth protocol stack.
[0063] The first Bluetooth protocol stack receives a connection request sent by the first Bluetooth application layer to establish the first communication connection, and sends a response to the first Bluetooth application layer indicating that the connection has been successfully established.
[0064] In one embodiment of the present application, the power consumption of the first processor is greater than that of the second processor. Since the second host controller interface (HCI) is connected to the Bluetooth control layer (BT controller) instead of the first host controller interface (HCI) being connected to the Bluetooth control layer, and the second host controller interface (HCI) being arranged on the second processor, it is more power-saving to keep the second host controller interface (HCI) connected to the Bluetooth control layer than to keep the first host controller interface (HCI) connected to the Bluetooth control layer.
[0065] In another embodiment of the present application, Figure 7 As shown, step S202 of obtaining a first system switching instruction, establishing a first communication connection between the first operating system and the second operating system according to the first system switching instruction, so as to send and receive data packets between the first operating system and the Bluetooth control layer through the second operating system, includes step C1 and step C2:
[0066] In step C1, the first system switching instruction is obtained;
[0067] In step C2, based on the first system switching instruction, after the second host control interface sends and receives the data packet, it sends and receives the data packet to the second Bluetooth protocol stack, so that the second Bluetooth protocol stack bypasses the data packet to the first Bluetooth protocol stack, and the first Bluetooth protocol stack sends and receives the data packet to the first Bluetooth application layer.
[0068] In one example, if Figure 8 As shown, step S202 of establishing a first communication connection between the first operating system and the second operating system further includes step C3:
[0069] In step C3, the second host control interface (HCI) sends the parameters, status and fields of each layer of the second Bluetooth module to the second Bluetooth protocol stack, so that the second Bluetooth protocol stack sends the parameters, status and fields of each layer to the first Bluetooth protocol stack.
[0070] The first Bluetooth protocol stack receives a connection request sent by the first Bluetooth application layer to establish the first communication connection, and sends a response to the first Bluetooth application layer indicating that the connection has been successfully established.
[0071] like Fig. 9 As shown, it is a schematic diagram of an electronic device of another embodiment of the present application establishing a Bluetooth connection with a remote device when running a first operating system. The first Bluetooth module (HOST1) of the first operating system includes a first Bluetooth application layer (i.e., Android BT APP) and a Bluetooth protocol stack interface layer (BTIF). Among them, the Bluetooth protocol stack interface layer (BTIF) is adapted to be connected with the Bluetooth protocol stack (STACK) layer of the second Bluetooth module (HOST2) of the second processor (small core) in an inter-process communication (IPC) manner. When the first Bluetooth module (HOST1) is selected to run or the second Bluetooth module is switched to the first Bluetooth module, the Bluetooth protocol stack (STACK) layer of the second Bluetooth module (HOST2) bypasses (bypasses) Bluetooth data to the Bluetooth protocol stack interface layer (BTIF) of the first Bluetooth module (HOST1), so that the Bluetooth protocol stack interface layer (BTIF) sends data to the first Bluetooth application layer.
[0072] Step S203, obtaining a second system switching instruction, and establishing a second communication connection within the second operating system according to the second system switching instruction, so as to send and receive data packets between the application layer of the second operating system and the Bluetooth control layer through the second operating system.
[0073] Wherein, the power consumption of the second processor is lower than the power consumption of the second processor.
[0074] In one embodiment of the present application, Fig.10 As shown, step S203 of obtaining a second system switching instruction and establishing a second communication connection within the second operating system according to the second system switching instruction, so as to send and receive data packets between the application layer of the second operating system and the Bluetooth control layer through the second operating system, includes step D1 and step D2:
[0075] In step D1, the second system switching instruction is obtained;
[0076] In step D2, based on the second system switching instruction, the second host control interface bypasses the data packet to the second Bluetooth application layer via the second Bluetooth protocol stack.
[0077] Combination Figure 6 and Fig. 9When the second operating system is running or the first operating system is switched to the second operating system, the second host controller interface (HCI) of the second Bluetooth module (HOST2) connects the data to the local upper layer second Bluetooth protocol stack (BT STACK), and the second Bluetooth protocol stack (BT STACK) then sends the data to the second Bluetooth application layer (BT APP). The same is true when the electronic device sends data to the remote device via Bluetooth connection, which will not be repeated here.
[0078] In an embodiment of the present application, when establishing the first communication connection or the second communication connection, or when the first operating system and the second operating system are switched, the second host control interface maintains a communication connection and data transmission with the Bluetooth control layer, and the Bluetooth control layer and the remote device also maintain a Bluetooth connection and data transmission, so that even if the operating system is switching, the data transmission is not interrupted, the second host control interface and the remote device always maintain data transmission, and the remote device is unaware of the switching of the operating system when transmitting data with the second host control interface, which will not affect the normal use of the remote device.
[0079] In one embodiment of the present application, the method further includes step E1 and step E2:
[0080] In step E1, after establishing a first communication connection between the first operating system and the second operating system according to the first system switching instruction, the second communication connection is disconnected; and
[0081] In step E2, after establishing a second communication connection inside the second operating system according to the second system switching instruction, the first communication connection is disconnected.
[0082] In fact, when the first operating system switches to the second operating system, or when the first Bluetooth module switches to the second Bluetooth module, while establishing the second communication connection, it is necessary to disconnect the data transmission between the second host controller interface (HostController Interface, HCI) and the first Bluetooth module (Host1).
[0083] Similarly, when the second operating system switches to the first operating system, or when the second Bluetooth module switches to the first Bluetooth module, while establishing the first communication connection, it is necessary to disconnect the data transmission between the second host controller interface (HostController Interface, HCI) and the second Bluetooth protocol stack (STACK).
[0084] Among them, establishing the second communication connection within the second operating system and disconnecting the first communication connection are synchronization processes; establishing the first communication connection between the first operating system and the second operating system and disconnecting the second communication connection are also synchronization processes.
[0085] In the embodiment of the present application, even when switching between operating systems, establishing a new communication connection and disconnecting an old communication connection can be completed synchronously, so that the data transmission process is not interrupted and data transmission is still maintained.
[0086] Combine the following Fig.13 The Bluetooth connection device 1300 of the present application is described, wherein: Fig.13 A schematic block diagram of a Bluetooth connection device 1300 according to an embodiment of the present application is shown.
[0087] The Bluetooth connection device of the embodiment of the present application is applied to an electronic device with a dual operating system, the electronic device includes a first processor and a second processor, the first processor is used to run a first operating system, the second processor is used to run a second operating system, the first processor is communicatively connected with the second processor, and the second processor is communicatively connected with a Bluetooth control layer (BT controller); the device includes a Bluetooth connection module 1301, a first communication connection module 1302 and a second communication connection module 1303:
[0088] A Bluetooth connection module 1301, configured to control the second operating system to establish a Bluetooth connection with a remote device through the Bluetooth control layer (BT controller) in response to a first Bluetooth connection instruction;
[0089] The first communication connection module 1302 is used to obtain a first system switching instruction, and establish a first communication connection between the first operating system and the second operating system according to the first system switching instruction, so that the second operating system forwards the data packets received and sent through the Bluetooth connection to the first operating system;
[0090] The second communication connection module 1303 is used to obtain a second system switching instruction, and establish a second communication connection inside the second operating system according to the second system switching instruction, so that the second operating system forwards the data packets received and sent through the Bluetooth connection to the application layer;
[0091] Wherein, the power consumption of the second processor is lower than the power consumption of the second processor.
[0092] Combine the following Fig.14 The electronic device of the present application is described, wherein: Fig.14 A schematic block diagram of an electronic device according to an embodiment of the present application is shown.
[0093] like Fig.14 As shown, the electronic device 1400 includes: one or more memories 1401 and at least two processors 1402 and 1403, wherein the memory 1401 stores a computer program executed by the processor 1402 and / or the processor 1403, and when the computer program is executed by the processor 1402 and / or the processor 1403, the processor 1402 and / or the processor 1403 executes the Bluetooth connection method described above.
[0094] The electronic device 1400 may be part or all of a computer device that can implement the Bluetooth connection method through software, hardware, or a combination of software and hardware.
[0095] like Fig.14 As shown, the electronic device 1400 includes one or more memories 1401, at least two processors 1402 and 1403, a display (not shown) and a communication interface, etc. These components are interconnected through a bus system and / or other forms of connection mechanisms (not shown). It should be noted that Fig.14 The components and structures of the electronic device 1400 shown are merely exemplary and non-limiting. The electronic device 1400 may also have other components and structures as required.
[0096] The memory 1401 is used to store various data and executable program instructions generated during the operation of the relevant Bluetooth connection method, such as for storing various application programs or algorithms for implementing various specific functions. It can include one or more computer program products, and the computer program product can include various forms of computer-readable storage media, such as volatile memory and / or non-volatile memory. The volatile memory can include, for example, a random access memory (RAM) and / or a cache memory (cache), etc. The non-volatile memory can include, for example, a read-only memory (ROM), a hard disk, a flash memory, etc.
[0097] Processor 1402 and / or processor 1403 can be configured to perform various operation steps in the Bluetooth connection method described in each embodiment of the present application. In some embodiments, processor 402 can be a processing device including more than one general-purpose processing device, such as a microprocessor, a central processing unit (CPU), a graphics processing unit (GPU), etc. More specifically, the processor can be a complex instruction set computing (CISC) microprocessor, a reduced instruction set computing (RISC) microprocessor, a very long instruction word (VLIW) microprocessor, a processor running other instruction sets, or a processor running a combination of instruction sets. The processor can also be more than one special processing device, such as an application-specific integrated circuit (ASIC), a field programmable gate array (FPGA), a digital signal processor (DSP), a system-on-chip (SoC), etc. In addition, processor 402 can be set separately for Bluetooth connection, or it can be shared with other functional modules, and the present application does not limit this.
[0098] In one example, the electronic device 1400 also includes an output device that can output various information (such as images or sounds) to the outside (such as a user), and can include one or more of a display device, a speaker, and the like.
[0099] The communication interface can be an interface of any currently known communication protocol, such as a wired interface or a wireless interface, wherein the communication interface may include one or more serial ports, USB interfaces, Ethernet ports, WiFi, wired networks, DVI interfaces, device integrated interconnect modules or other suitable ports, interfaces, or connections.
[0100] In addition, according to an embodiment of the present application, a storage medium is also provided, on which program instructions are stored, and when the program instructions are executed by a computer or a processor, the corresponding steps of the Bluetooth connection method of the embodiment of the present application are executed. The storage medium may include, for example, a memory card of a smart phone, a storage component of a tablet computer, a hard disk of a personal computer, a read-only memory (ROM), an erasable programmable read-only memory (EPROM), a portable compact disk read-only memory (CD-ROM), a USB memory, or any combination of the above storage media.
[0101] The Bluetooth connection device, electronic device and storage medium of the embodiments of the present application can implement the aforementioned Bluetooth connection method, and therefore have the same advantages as the aforementioned Bluetooth connection method.
[0102] Although example embodiments have been described herein with reference to the accompanying drawings, it should be understood that the above example embodiments are merely exemplary and are not intended to limit the scope of the present application to this. Those of ordinary skill in the art may make various changes and modifications therein without departing from the scope and spirit of the present application. All these changes and modifications are intended to be included within the scope of the present application as required by the appended claims.
[0103] Those of ordinary skill in the art will appreciate that the units and algorithm steps of each example described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, or a combination of computer software and electronic hardware. Whether these functions are performed in hardware or software depends on the specific application and design constraints of the technical solution. Professional and technical personnel can use different methods to implement the described functions for each specific application, but such implementation should not be considered to be beyond the scope of this application.
[0104] In the several embodiments provided in this application, it should be understood that the disclosed devices and methods can be implemented in other ways. For example, the device embodiments described above are only schematic, for example, the division of the units is only a logical function division, and there may be other division methods in actual implementation, such as multiple units or components can be combined or integrated into another device, or some features can be ignored or not executed.
[0105] In the description provided herein, a large number of specific details are described. However, it is understood that the embodiments of the present application can be practiced without these specific details. In some instances, well-known methods, structures and techniques are not shown in detail so as not to obscure the understanding of this description.
[0106] Similarly, it should be understood that in order to streamline the present application and help understand one or more of the various inventive aspects, in the description of the exemplary embodiments of the present application, the various features of the present application are sometimes grouped together into a single embodiment, figure, or description thereof. However, the method of the present application should not be interpreted as reflecting the following intention: the claimed application requires more features than the features clearly stated in each claim. More specifically, as reflected in the corresponding claims, the inventive point is that the corresponding technical problem can be solved with features less than all the features of a single disclosed embodiment. Therefore, the claims following the specific embodiment are hereby explicitly incorporated into the specific embodiment, wherein each claim itself serves as a separate embodiment of the present application.
[0107] It will be understood by those skilled in the art that, except for mutually exclusive features, all features disclosed in this specification (including the accompanying claims, abstracts and drawings) and all processes or units of any method or device disclosed in this specification may be combined in any combination. Unless otherwise expressly stated, each feature disclosed in this specification (including the accompanying claims, abstracts and drawings) may be replaced by an alternative feature that provides the same, equivalent or similar purpose.
[0108] In addition, those skilled in the art will appreciate that, although some embodiments described herein include certain features included in other embodiments but not other features, the combination of features of different embodiments is meant to be within the scope of the present application and form different embodiments. For example, in the claims, any one of the claimed embodiments can be used in any combination.
[0109] The various component embodiments of the present application can be implemented in hardware, or in software modules running on one or more processors, or in a combination thereof. It should be understood by those skilled in the art that a microprocessor or digital signal processor (DSP) can be used in practice to implement some or all functions of some modules according to the embodiments of the present application. The application can also be implemented as a device program (e.g., computer program and computer program product) for executing a part or all of the methods described herein. Such a program implementing the present application can be stored on a computer-readable medium, or can have the form of one or more signals. Such a signal can be downloaded from an Internet website, or provided on a carrier signal, or provided in any other form.
[0110] It should be noted that the above embodiments illustrate the present application rather than limit the present application, and that those skilled in the art may design alternative embodiments without departing from the scope of the appended claims. In the claims, any reference symbol between brackets should not be constructed as a limitation to the claims. The word "comprising" does not exclude the presence of elements or steps not listed in the claims. The word "one" or "an" preceding an element does not exclude the presence of multiple such elements. The present application may be implemented by means of hardware including several different elements and by means of a suitably programmed computer. In a unit claim that lists several devices, several of these devices may be embodied by the same hardware item. The use of the words first, second, and third, etc. does not indicate any order. These words may be interpreted as names.
[0111] The above is only a specific implementation or description of a specific implementation of the present application, and the protection scope of the present application is not limited thereto. Any technician familiar with the technical field can easily think of changes or substitutions within the technical scope disclosed in the present application, which should be included in the protection scope of the present application. The protection scope of the present application shall be based on the protection scope of the claims.
Claims
1. A Bluetooth connection method, characterized in that: Applied to an electronic device with a dual operating system, the electronic device includes a first processor and a second processor, the first processor is used to run a first operating system, the second processor is used to run a second operating system, the first processor is communicatively connected to the second processor, and the second processor is communicatively connected to a Bluetooth control layer; the method includes: In response to the first Bluetooth connection instruction, controlling the second operating system to establish a Bluetooth connection with a remote device through the Bluetooth control layer; Obtaining a first system switching instruction, and establishing a first communication connection between the first operating system and the second operating system according to the first system switching instruction, so as to send and receive data packets between the first operating system and the Bluetooth control layer through the second operating system; Obtaining a second system switching instruction, and establishing a second communication connection within the second operating system according to the second system switching instruction, so as to send and receive data packets between an application layer of the second operating system and the Bluetooth control layer through the second operating system; Wherein, the power consumption of the second processor is lower than the power consumption of the second processor.
2. The method according to claim 1, characterized in that: The first operating system includes a first Bluetooth module, which includes, from top to bottom, a first Bluetooth application layer, a first Bluetooth protocol stack and a first host control interface; the second operating system includes a second Bluetooth module, which includes, from top to bottom, a second Bluetooth application layer, a second Bluetooth protocol stack and a second host control interface; wherein, the first host control interface is communicatively connected with the second host control interface, and / or the first Bluetooth protocol stack is communicatively connected with the second Bluetooth protocol stack; and the second host control interface is communicatively connected with the Bluetooth control layer.
3. The method according to claim 2, characterized in that In response to the first Bluetooth connection instruction, controlling the second operating system to establish a Bluetooth connection with a remote device through the Bluetooth control layer includes: The second host control interface of the second Bluetooth module establishes the Bluetooth connection with the remote device through the Bluetooth control layer to send and receive data packets to the remote device.
4. The method according to claim 3, characterized in that The method further comprises: When switching the operating system, the parameters, status and fields of each layer of the switched Bluetooth module are obtained, and the parameters, status and fields of each layer are migrated to the target Bluetooth module, so that the target Bluetooth module is restored to the same parameters, status and fields layer by layer.
5. The method according to claim 4, characterized in that Acquiring a first system switching instruction, and establishing a first communication connection between the first operating system and the second operating system according to the first system switching instruction, so as to send and receive data packets between the first operating system and the Bluetooth control layer through the second operating system, including: Obtaining the first system switching instruction; Based on the first system switching instruction, after the second host control interface of the second Bluetooth module sends and receives the data packet, the data packet is sent and received to the first host control interface of the first Bluetooth module, so that the first host control interface sends and receives the data packet to the first Bluetooth application layer through the first Bluetooth protocol stack.
6. The method according to claim 5, characterized in that Establishing a first communication connection between the first operating system and the second operating system includes: The second host control interface sends the parameters, status and fields of each layer of the second Bluetooth module to the first host control interface, so that the first host control interface sends the parameters, status and fields of each layer to the first Bluetooth protocol stack; The first Bluetooth protocol stack receives a connection request sent by the first Bluetooth application layer to establish the first communication connection, and sends a response to the first Bluetooth application layer indicating that the connection has been successfully established.
7. The method according to claim 4, characterized in that Acquiring a first system switching instruction, and establishing a first communication connection between the first operating system and the second operating system according to the first system switching instruction, so as to send and receive data packets between the first operating system and the Bluetooth control layer through the second operating system, including: Obtaining the first system switching instruction; Based on the first system switching instruction, after the second host control interface sends and receives the data packet, it sends and receives the data packet to the second Bluetooth protocol stack, so that the second Bluetooth protocol stack bypasses the data packet to the first Bluetooth protocol stack, and the first Bluetooth protocol stack sends and receives the data packet to the first Bluetooth application layer.
8. The method according to claim 7, characterized in that Establishing a first communication connection between the first operating system and the second operating system includes: The second host controls the interface to send the parameters, status and fields of each layer of the second Bluetooth module to the second Bluetooth protocol stack, so that the second Bluetooth protocol stack sends the parameters, status and fields of each layer to the first Bluetooth protocol stack; The first Bluetooth protocol stack receives a connection request sent by the first Bluetooth application layer to establish the first communication connection, and sends a response to the first Bluetooth application layer indicating that the connection has been successfully established.
9. The method according to claim 5 or 7, characterized in that: Acquiring a second system switching instruction, and establishing a second communication connection within the second operating system according to the second system switching instruction, so as to send and receive data packets between the application layer of the second operating system and the Bluetooth control layer through the second operating system, including: Obtaining the second system switching instruction; Based on the second system switching instruction, the second host control interface bypasses the data packet to the second Bluetooth application layer via the second Bluetooth protocol stack.
10. The method according to claim 1, characterized in that The method further comprises: After establishing a first communication connection between the first operating system and the second operating system according to the first system switching instruction, disconnecting the second communication connection; and After establishing a second communication connection inside the second operating system according to the second system switching instruction, the first communication connection is disconnected.
11. The method according to claim 10, characterized in that in, Establishing the second communication connection within the second operating system and disconnecting the first communication connection is a synchronization process; establishing the first communication connection between the first operating system and the second operating system and disconnecting the second communication connection is also a synchronization process.
12. The method according to claim 1, characterized in that When the first communication connection or the second communication connection is established, the second host control interface maintains a communication connection and data transmission with the Bluetooth control layer.
13. The method according to claim 1, characterized in that The first operating system includes an Android system, and the second operating system includes a real-time operating system.
14. An electronic device, characterized in that: The electronic device comprises a first processor and a second processor, the first processor is used to run a first operating system, the second processor is used to run a second operating system, the first processor is communicatively connected to the second processor, and the second processor is communicatively connected to a Bluetooth control layer; The electronic device further comprises a memory, wherein a computer program is stored in the memory, and when the computer program is executed by the at least two processors, the at least two processors execute the steps of the Bluetooth connection method according to any one of claims 1 to 13.
15. A computer program product comprising a computer program, characterized in that When the computer program is executed by a processor, the steps of the Bluetooth connection method according to any one of claims 1 to 13 are implemented.
Citation Information
Cited By
Bluetooth connection method, electronic device, and computer program product
WO2026091565A1