Bluetooth communication method and system and electronic equipment
By detecting the end of the call service and disconnecting the HFP connection, the problem of increasing power consumption when the mobile phone receives the hangup request after establishing the HFP connection is solved, and the power consumption is reduced when there is no call service.
Patent Information
- Application Number
- CN202311389966.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2023-10-25
- Publication Date
- 2025-05-06
AI Technical Summary
When the phone establishes an HFP connection with a wearable Bluetooth device, if the phone receives a request to hang up the phone before the connection is established, it will cause an increase in power consumption.
By detecting whether the call service has ended and disconnecting the HFP connection when the call service is over, ensuring that the connection is normally disconnected when there is no call service and reducing power consumption.
It realizes disconnecting the HFP connection in time when there is no call service, reducing the power consumption between the wearable device and the smartphone.
Smart Images

Figure CN119946591A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of Bluetooth technology, and in particular to a Bluetooth communication method, system and electronic device. Background Art
[0002] With the continuous development of wireless technology, Bluetooth technology has been widely used in wearable devices such as headphones, bracelets, smart watches and other devices. Bluetooth devices usually support the Hands-free Profile (HFP), which defines the hands-free device (such as wearable Bluetooth devices, car-mounted Bluetooth devices, etc.) to control phone-related operations, for example, Bluetooth devices answer calls, hang up calls, reject calls, control the volume of the phone, display car signals, operator information, etc. At present, wearable Bluetooth devices use a method of dynamically establishing an HFP connection. The process of a mobile phone dynamically establishing an HFP connection is: when the mobile phone receives an incoming call instruction, the mobile phone establishes an HFP connection with the wearable Bluetooth device. When the mobile phone receives a hang-up instruction, the electronic device disconnects the HFP connection with the wearable Bluetooth device.
[0003] When the mobile phone receives an incoming call instruction, the mobile phone and the wearable Bluetooth device start to establish an HFP connection. However, if the mobile phone receives a request to hang up the call sent by the caller before the HFP connection is established, after the mobile phone ends the call service with the caller, the power consumption of the mobile phone and the wearable Bluetooth device will increase. Summary of the invention
[0004] In order to solve the above technical problems, the present application provides a Bluetooth communication method and electronic device, so that the HFP connection between the wearable device and the smartphone can be disconnected normally when there is no call service, thereby reducing the power consumption of the wearable device and the smartphone.
[0005] In the first aspect, the present application provides a method for Bluetooth communication, which is applied to a first electronic device, wherein Bluetooth pairing has been completed between the first electronic device and the second electronic device, and the method comprises: in response to an incoming call instruction sent by the second electronic device, establishing a hands-free protocol HFP connection, wherein the HFP connection is used to conduct a call service with the second electronic device; if the HFP connection is successfully established, detecting whether the call service with the second electronic device has ended; if it is detected that the call service with the second electronic device has ended, disconnecting the HFP connection. Among them, the completion of Bluetooth pairing can be understood as the establishment of a Bluetooth channel or the establishment of a Bluetooth connection.
[0006] In this way, the Bluetooth pairing process between the first electronic device (such as a smart watch, bracelet, etc.) and the second electronic device (such as the called mobile phone A) includes: after the Bluetooth function of the first electronic device and the second electronic device is turned on, the second electronic device performs a Bluetooth scan, and after the second electronic device finds the first electronic device through Bluetooth scanning, the information of the discovered second electronic device (such as the identification of the second electronic device) can be displayed on the display interface of the second electronic device, and the second electronic device responds to the Bluetooth pairing operation input by the user (such as clicking the pairing control in the page) and successfully establishes a Bluetooth connection with the first electronic device. When the first electronic device successfully establishes a Bluetooth connection with the second electronic device, it indicates that the Bluetooth pairing of the first electronic device and the second electronic device has been completed. The first electronic device establishes an HFP connection, and the HFP connection is used for a call service with the second electronic device, and the call service includes a service for the first electronic device to interact with the second electronic device for voice data. In this example, the first electronic device can be triggered to detect whether the call service with the second electronic device has ended when it detects that the HFP connection is successfully established. When the first electronic device detects that the call service with the second electronic device (such as mobile phone A) has ended, the HFP connection is disconnected, so that when the second electronic device (such as mobile phone A) receives a hang-up signal from other devices (such as mobile phone B that initiated the phone call) before the second electronic device (such as mobile phone A) successfully establishes the HFP connection (that is, the second electronic device cannot send a hang-up instruction to the first electronic device), the first electronic device can still disconnect the HFP connection in time. Since the HFP connection between the first electronic device and the second electronic device can be disconnected in time when there is no call service, the power consumption between the first electronic device and the second electronic device is reduced.
[0007] According to the first aspect, detecting whether the call service with the second electronic device has ended includes: detecting whether the call link established with the second electronic device is interrupted; and determining that the call service with the second electronic device has ended when the call link is detected to be interrupted. In this way, the call service data between the first electronic device and the second electronic device needs to be transmitted through the call link (i.e., SCO link), and the first electronic device can quickly determine whether the call service between the first electronic device and the second electronic device has ended by detecting whether the SCO link is interrupted.
[0008] According to the first aspect, before establishing a hands-free protocol HFP connection in response to an incoming call instruction sent by the second electronic device, the method further includes: the first electronic device receives the incoming call instruction sent by the second electronic device through a Bluetooth serial port protocol SPP link. In this way, when the first electronic device can obtain the incoming call instruction sent by the second electronic device through the SPP link after the Bluetooth channel is established and before the HFP connection is established, the method of obtaining the incoming call instruction is stable and safe.
[0009] According to the first aspect, before establishing a hands-free protocol HFP connection in response to an incoming call instruction sent by a second electronic device, the method further includes: the first electronic device receives the incoming call instruction sent by the second electronic device through a broadcast transmission channel. In this way, when the second electronic device transmits the incoming call instruction to the first electronic device by means of a broadcast message, the method of transmitting the incoming call instruction in this way is simple and convenient.
[0010] According to the first aspect, before disconnecting the HFP connection, the method further includes: sending a first request to the second electronic device, the first request is used to request the second electronic device to agree to disconnect the HFP connection, the second electronic device responds to the first request, returns a first response to the first electronic device, and changes the call audio indication on the display interface of the second electronic device from a first state to a second state, the first state is used to indicate that the call audio channel of the second electronic device is in an open state, and the second state is used to indicate that the call audio channel is in a closed state; receiving the first response, disconnecting the HFP connection. In this way, the first electronic device sends the first request to the second electronic device, and the second electronic device responds to the first request and updates the state of the call audio indication from an open state to a closed state, thereby promptly prompting the user that the HFP connection is disconnected.
[0011] According to the first aspect, the method further includes: if it is detected that the call service with the second electronic device has not ended, maintaining the HFP connection; in response to the call hang-up instruction sent by the first electronic device, sending a first request to the second electronic device, the first request is used to request the second electronic device to agree to disconnect the HFP connection, the second electronic device responds to the first request, returns a first response to the first electronic device, and changes the call audio indication of the display interface in the second electronic device from a first state to a second state, the first state is used to indicate that the call audio channel of the second electronic device is in an open state, and the second state is used to indicate that the call audio channel is in a closed state; receiving the first response, disconnecting the HFP connection. In this way, after the first electronic device establishes the HFP connection, if it detects that the call service with the second electronic device has not ended, it can disconnect the HFP connection between the first electronic device and the second electronic device according to the call hang-up instruction sent by the second electronic device, thereby increasing the scenarios to which the Bluetooth communication method in this application can be applied.
[0012] According to a first aspect, the first electronic device includes: a smart watch or a wristband.
[0013] In a second aspect, the present application provides a Bluetooth communication system, the system comprising a first electronic device and a second electronic device, the first electronic device and the second electronic device having completed Bluetooth pairing; the second electronic device, configured to: send an incoming call instruction to the first electronic device in response to a call request sent by a third electronic device; the first electronic device, configured to: establish a hands-free protocol HFP connection in response to the incoming call instruction sent by the second electronic device, the HFP connection being used to conduct a call service with the second electronic device; the second electronic device, configured to: receive a call hang-up request sent by the third electronic device before the HFP connection is successfully established; and terminate the call service in response to the call hang-up request; the first electronic device, configured to: detect whether the call service with the second electronic device has been terminated if the HFP connection is successfully established; and disconnect the HFP connection if it is detected that the call service with the second electronic device has been terminated.
[0014] In this way, the Bluetooth pairing process between the first electronic device (such as a smart watch, a bracelet, etc.) and the second electronic device (such as the called mobile phone A) includes: after the first electronic device and the second electronic device turn on the Bluetooth function, the second electronic device performs a Bluetooth scan, and after the second electronic device finds the first electronic device through Bluetooth scanning, the information of the discovered second electronic device (such as the model of the second electronic device) can be displayed on the display interface of the second electronic device, and the second electronic device responds to the Bluetooth pairing operation input by the user (such as clicking the pairing control in the page) and successfully establishes a Bluetooth connection with the first electronic device. When the first electronic device successfully establishes a Bluetooth connection with the second electronic device, it indicates that the first electronic device and the second electronic device have completed Bluetooth pairing. The HFP connection established by the first electronic device is used for a call service with the second electronic device, and the call service includes a service for the first electronic device and the second electronic device to interact with voice data. In this example, the first electronic device can be a trigger to detect whether the call service with the second electronic device is ended when the HFP connection is successfully established. In the case where the second electronic device in the Bluetooth communication system receives a request to hang up the call sent by the third electronic device before the HFP connection is established, even if the first electronic device cannot receive the message of the end of the call service sent by the second electronic device, the HFP connection can be disconnected in time to reduce the power consumption of the first electronic device and the second electronic device.
[0015] According to the second aspect, the second electronic device is further used to: when detecting that the HFP connection is successfully established, change the call audio indication on the display interface of the second electronic device from the second state to the first state, the first state is used to indicate that the call audio channel of the second electronic device is in the open state, and the second state is used to indicate that the call audio channel is in the closed state; the first electronic device is further used to: when detecting that the call service with the second electronic device has ended, send a first request to the second electronic device, the first request is used to request the second electronic device to agree to disconnect the HFP connection; the second electronic device is further used to: in response to the first request, return a first response to the first electronic device; change the call audio indication on the display interface of the second electronic device from the first state to the second state; the first electronic device is further used to: disconnect the HFP connection after receiving the first response. In this way, the second electronic device can timely update the status of the HFP connection and prompt the user in time.
[0016] In a third aspect, the present application provides an electronic device comprising: one or more processors; a memory; and one or more computer programs, wherein the one or more computer programs are stored in the memory, and when the computer programs are executed by the one or more processors, the electronic device executes the Bluetooth communication method corresponding to the first aspect and any one of the implementation methods of the first aspect.
[0017] The third aspect and any implementation of the third aspect correspond to the first aspect and any implementation of the first aspect respectively. The technical effects corresponding to the second aspect and any implementation of the second aspect can refer to the technical effects corresponding to the first aspect and any implementation of the first aspect, which will not be repeated here.
[0018] In a fourth aspect, the present application provides a computer-readable medium for storing a computer program. When the computer program is executed on an electronic device, the electronic device executes the Bluetooth communication method corresponding to the above-mentioned first aspect and any one of the implementations of the first aspect.
[0019] In a fifth aspect, the present application provides a chip system, a processor, for calling and running a computer program from a memory, so that an electronic device equipped with the chip system executes the Bluetooth communication method corresponding to the first aspect and any implementation method of the first aspect. BRIEF DESCRIPTION OF THE DRAWINGS
[0020] In order to more clearly illustrate the technical solutions of the embodiments of the present application, the drawings required for use in the description of the embodiments of the present application 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.
[0021] Figure 1 is a schematic diagram exemplarily illustrating an application scenario of a Bluetooth communication method;
[0022] Figure 2 is a schematic diagram showing the structure of an electronic device 100;
[0023] Figure 3 is a schematic structural diagram of a wearable device 200 exemplarily shown;
[0024] Figure 4 is a software structure block diagram of a wearable device 200 exemplarily shown;
[0025] Figure 5a is an exemplary process of establishing an HFP connection between two Bluetooth devices;
[0026] Figure 5b is a flowchart showing an exemplary establishment of an RFCOMM connection between two Bluetooth devices;
[0027] Figure 5c is a schematic diagram showing an exemplary AT interaction between two Bluetooth devices;
[0028] Figure 6 is an exemplary process of dynamically establishing an HFP connection between two Bluetooth devices;
[0029] Figure 7 is a schematic diagram showing, by way of example, whether a link for transmitting call audio is connected in a mobile phone;
[0030] Figure 8 is a schematic diagram showing an exemplary case where a mobile phone receives a call hang-up request before an RFCOMM connection is established;
[0031] Fig. 9 is a flowchart exemplarily showing a method for Bluetooth communication;
[0032] Fig.10 The diagram is a schematic diagram showing, by way of example, whether a link for transmitting call audio is connected in a mobile phone. DETAILED DESCRIPTION
[0033] The following will be combined with the drawings in the embodiments of the present application to clearly and completely describe the technical solutions in the embodiments of the present application. Obviously, the described embodiments are 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.
[0034] The term "and / or" in this article is merely a description of the association relationship of associated objects, indicating that three relationships may exist. For example, A and / or B can mean: A exists alone, A and B exist at the same time, and B exists alone.
[0035] The terms "first" and "second" in the description and claims of the embodiments of the present application are used to distinguish different objects rather than to describe a specific order of objects. For example, a first target object and a second target object are used to distinguish different target objects rather than to describe a specific order of target objects.
[0036] In the embodiments of the present application, words such as "exemplary" or "for example" are used to indicate examples, illustrations or descriptions. Any embodiment or design described as "exemplary" or "for example" in the embodiments of the present application should not be interpreted as being more preferred or more advantageous than other embodiments or designs. Specifically, the use of words such as "exemplary" or "for example" is intended to present related concepts in a specific way.
[0037] In the description of the embodiments of the present application, unless otherwise specified, the meaning of "multiple" refers to two or more than two. For example, multiple processing units refer to two or more processing units; multiple systems refer to two or more systems.
[0038] In the description of the embodiments of the present application, the names of the various instructions and / or commands and / or instructions and / or information and / or signaling and / or messages are only examples. In the specific implementation process, they can also be replaced with other names according to the actual scenario. The explanation of the names and terms in the actual implementation can also refer to the explanation in the Bluetooth Hands-Free Profile (HFP). The uppercase and lowercase letters and spaces in the embodiments of the present application are only examples, and the specific provisions in the standard protocol shall prevail.
[0039] Before explaining the establishment of HFP connection by Bluetooth in this application, some technical terms involved in this application are explained.
[0040] (1) Service Discovery Protocol (SDP). SDP plays a vital role in the Bluetooth technology framework and is the basis of all user modes. Bluetooth devices can use SDP to query device information and service types, thereby establishing corresponding connections between Bluetooth devices. SDP can use L2CAP as the transport layer protocol.
[0041] (2) Radio Frequency Communication (RFCOMM) protocol: The RFCOMM protocol is a simple transmission protocol that provides serial port emulation through the L2CAP protocol. RFCOMM solves the problem of how to ensure a complete communication path between applications on two different devices and maintain a communication segment between them. During the HFP connection process, RFCOMM ensures a complete communication path between two different communication devices.
[0042] (3) Logical Link Control and Adaptation Protocol (L2CAP): L2CAP is the core protocol in the Bluetooth system and is used within the data link layer Bluetooth protocol stack. It uses protocol multiplexing, segmentation and reassembly operations, and group abstraction to provide connection and connectionless data services to higher-level protocols (such as SDP and RFCOMM). L2CAP allows higher-level protocols and applications to send and receive L2CAP data packets, and uses the concept of channels to establish different paths between different applications on Bluetooth devices.
[0043] (4) Asynchronous connectionless (ACL) link: The ACL link is an asynchronous connectionless link, which is mainly used for packet data transmission. Bluetooth operation commands are transmitted through this link.
[0044] (5) Synchronous Connection Oriented (SCO) link: This SCO link is used for synchronous voice transmission between Bluetooth devices.
[0045] After the two Bluetooth devices are paired and connected, an ACL link has been successfully established between the two Bluetooth devices. On the basis of the establishment of the ACL link, an L2CAP link is established between the two devices. The two Bluetooth devices can negotiate through the L2CAP link, such as negotiating the channel endpoint information of the device receiving the configuration response packet to establish an RFCOMM connection. L2CAP supports high-level protocol multiplexing, such as high-level protocols: RFCOMM and SDP. That is, SDP and RFCOMM are established on the basis of L2CAP. The HFP connection between the two Bluetooth devices is established based on the RFCOMM connection, and the RFCOMM connection can be used for AT command interaction between the two Bluetooth devices. When the AT command interaction between the two Bluetooth devices is completed, the HFP connection between the two devices is established. The two Bluetooth devices can talk through the HFP connection. For example, when a first electronic device (such as a smart watch) and a second electronic device (such as a mobile phone) establish an HFP connection and the second electronic device continues to receive a call request from a third electronic device, the second electronic device can send an incoming call instruction to the first electronic device, and the first electronic device responds to the incoming call instruction and establishes a SCO link for transmitting call data based on the HFP connection. In this example, the first electronic device may be a smart watch or a bracelet; the second electronic device and the third electronic device may be a mobile phone, a smart watch supporting telephone functions, etc.
[0046] The Bluetooth communication method provided in the present application is applied to an electronic device, wherein a Bluetooth module is installed inside the electronic device to provide a Bluetooth communication function. The electronic device may be a wearable device. Figure 1 This is a schematic diagram of an application scenario of a Bluetooth communication method exemplified in this application. In this example, the electronic device (i.e., the first electronic device) to which the Bluetooth communication method of this application is applied is a smart watch 200, and the second electronic device is a mobile phone 100. Figure 1 As shown, the mobile phone 100 establishes a Bluetooth connection with the smart watch 200.
[0047] Figure 2 This is a schematic diagram of the structure of an electronic device 100 shown in an embodiment of the present application. It should be understood that: Figure 2 The electronic device 100 shown is only one example of an electronic device, and the electronic device 100 may have more or fewer components than shown in the drawings, may combine two or more components, or may have a different configuration of components. Figure 2 The various components shown in the figure can be implemented in hardware, software, or a combination of hardware and software including one or more signal processing and / or application specific integrated circuits. In this example, the electronic device 100 is taken as an example of a mobile phone.
[0048] The electronic device 100 may include: a processor 110, an external memory interface 120, an internal memory 121, a universal serial bus (USB) interface 130, a charging management module 140, a power management module 141, a battery 142, an antenna 1, an antenna 2, a mobile communication module 150, a wireless communication module 160, an audio module 170, a speaker 170A, a receiver 170B, a microphone 170C, an earphone interface 170D, a sensor module 180, a button 190, a motor 191, an indicator 192, a camera 193, a display screen 194, and a subscriber identification module (SIM) card interface 195, etc. The sensor module 180 may include a pressure sensor, a gyroscope sensor, an air pressure sensor, a magnetic sensor, an acceleration sensor, a distance sensor, a proximity light sensor, a fingerprint sensor, a temperature sensor, a touch sensor, an ambient light sensor, a bone conduction sensor, etc.
[0049] Figure 3 This is a schematic diagram of the structure of a wearable device 200 shown in an embodiment of the present application.
[0050] The wearable device 200 may include at least one processor 201, at least one memory 202, a wireless communication module 203, an audio module 204, at least one speaker 205, at least one microphone 206, and a power module 207.
[0051] The memory 202 may be used to store application program codes.
[0052] The processor 201 can be used to execute the above application code and call related modules to implement the functions of the wearable device 200 in the embodiment of the present application.
[0053] The wireless communication module 203 can be used to support data exchange between the wearable device 200 and its electronic device 100 using wireless communications such as BT, WLAN (such as Wi-Fi), Zigbee, FM, NFC, IR, or general 2.4G / 5G wireless communication technologies.
[0054] In some embodiments, the wireless communication module 203 can be a Bluetooth chip. The wearable device 200 can be paired with the Bluetooth chip of the electronic device 100 through the Bluetooth chip and establish a wireless connection to realize wireless communication and business processing between the wearable device 200 and the electronic device 100 through the wireless connection. Generally, the Bluetooth chip can support basic rate (BR) / enhanced data rate (EDR) Bluetooth and BLE, for example, it can receive / send paging information, receive / send BLE broadcast messages, etc. Bluetooth 203 can also be a Bluetooth transceiver. The wearable device 200 can establish a wireless connection with the electronic device 100 through the Bluetooth transceiver to realize short-range data exchange between the two. For example, exchange audio data, exchange control data, etc.
[0055] In addition, the wireless communication module 203 may further include an antenna, receive electromagnetic wave signals via the antenna, frequency modulate and filter the electromagnetic wave signals, and send the processed signals to the processor 201 .
[0056] The audio module 204 is used to convert digital audio information into analog audio signal output, and also used to convert analog audio input into digital audio signal. The audio module 204 may also include an encoder and a decoder for encoding and decoding audio signals.
[0057] At least one speaker 205, which may also be referred to as a "receiver", may be used to convert an audio signal into a sound signal and play it. For example, when the wearable device 200 is used as an audio output device of the electronic device 100, the speaker 205 may convert the received audio signal into a sound signal and play it.
[0058] At least one microphone (Mic) 206, which may also be referred to as a "microphone" or "microphone", is used to convert a sound signal into an audio electrical signal. For example, when the wearable device 200 is used as an audio input device of the electronic device 100, when the user is speaking (such as talking on the phone or sending a voice message), the microphone 206 can collect the user's voice signal and convert it into an audio electrical signal. The above audio electrical signal can also be described as audio data.
[0059] The power module 207 can be used to provide system power for the wearable device 200, power each module of the wearable device 200, and support the wearable device 200 to receive charging input, etc. The power module 207 can include a power management unit (PMU) and a battery.
[0060] Figure 4It is a software structure block diagram of the wearable device 200 according to an embodiment of the present application.
[0061] The layered architecture of the wearable device 200 divides the software into several layers, each with a clear role and division of labor. The layers communicate with each other through software interfaces. In some embodiments, the Android system is divided into four layers, from top to bottom: the application layer, the application framework layer, the hardware abstraction layer (HAL), and the kernel layer. It is understandable that Figure 4 The layers in the software structure and the components contained in each layer do not constitute a specific limitation on the wearable device 200. In other embodiments of the present application, the wearable device 200 may include more or fewer layers than shown in the figure, and each layer may include more or fewer components, which is not limited in the present application.
[0062] like Figure 4 As shown, the application layer can include a series of application packages. The application package can include call, Bluetooth, camera, gallery, calendar, short message, short message and other applications. The application framework layer provides application programming interface (API) and programming framework for the applications in the application layer. The application framework layer includes some pre-defined functions.
[0063] like Figure 4 As shown, the application framework layer may include an HFP state machine, a window manager, a resource manager, a content provider, a view system, a phone manager, a notification manager, and the like.
[0064] The HFP state machine is a mathematical model used to represent the finite states of the HFP connection and the transitions and actions between these states.
[0065] The window manager is used to manage window programs. The window manager can obtain the display screen size, determine whether there is a status bar, lock the screen, capture the screen, etc.
[0066] The resource manager provides various resources for applications, such as localized strings, icons, images, layout files, video files, and so on.
[0067] Content providers are used to store and retrieve data and make it accessible to applications. The data may include videos, images, audio, calls made and received, browsing history and bookmarks, phone books, etc.
[0068] The view system includes visual controls, such as controls for displaying text, controls for displaying images, etc. The view system can be used to build applications. A display interface can be composed of one or more views. For example, a display interface including a text notification icon can include a view for displaying text and a view for displaying images.
[0069] The phone manager is used to provide communication functions of the electronic device 200, such as management of call status (including connecting, hanging up, etc.).
[0070] The notification manager enables applications to display notification information in the status bar. It can be used to convey notification-type messages and can disappear automatically after a short stay without user interaction. For example, the notification manager is used to notify download completion, message reminders, etc. The notification manager can also be a notification that appears in the system top status bar in the form of a chart or scroll bar text, such as notifications of applications running in the background, or a notification that appears on the screen in the form of a dialog window. For example, a text message is displayed in the status bar, a prompt sound is emitted, an electronic device vibrates, an indicator light flashes, etc.
[0071] HAL can include the Bluetooth protocol stack, which can include multiple layers of Bluetooth protocols. Each layer of the protocol defines the functions to be completed and the packet format of the used data to ensure the interoperability between Bluetooth devices. The transmission of Bluetooth audio data relies on the Bluetooth protocol. The Bluetooth protocol adopts a layered structure, forming the Bluetooth protocol stack from the bottom layer to the top layer. The protocols in the Bluetooth protocol system are divided into core protocols, cable replacement protocols, telephone transmission control protocols and optional protocols according to the attention level of the application layer control protocol (Session Initiation Protocol, SIG). Among them, the Bluetooth core protocol is composed of Bluetooth-specific protocols formulated by SIG, including baseband protocol, link management protocol (Link Manager Protocol, LMP), L2CAP and SDP. L2CAP works in parallel with LMP. SDP plays a vital role in the Bluetooth technology framework. It is the basis of all user modes. Using SDP, you can query device information and service types, so as to establish corresponding connections between Bluetooth devices.
[0072] The kernel layer is the layer between hardware and software. The kernel layer contains at least Bluetooth driver, display driver, camera driver, audio driver, sensor driver, etc.
[0073] The following describes in detail the process of establishing a Bluetooth connection between the mobile phone 100 and the smart watch 200.
[0074] Figure 1The mobile phone 100 can establish a Bluetooth connection with the smart watch 200 through wireless communication technology, and the Bluetooth connection technology can be traditional Bluetooth or Bluetooth low energy (BLE) technology.
[0075] If the Bluetooth of the mobile phone 100 is not turned on, the user can turn on the Bluetooth of the mobile phone 100 (such as the user turns on the Bluetooth switch in the Bluetooth setting interface of the mobile phone). In response to the user turning on the Bluetooth, the mobile phone 100 turns on the Bluetooth and sets the Bluetooth switch to the on state. Assuming that the Bluetooth of the smart watch 200 is turned on, when the mobile phone turns on the Bluetooth, the mobile phone will search for matching Bluetooth devices within the scanning range. In this example, the Bluetooth setting interface of the mobile phone shows that the devices that can be paired include the smart watch 200. In response to the user clicking the logo of the smart watch 200, the mobile phone establishes a Bluetooth connection with the smart watch 200. The specific process of establishing the Bluetooth channel can refer to the existing method, which will not be repeated here.
[0076] Usually, when the mobile phone 100 and the smart watch 200 establish a Bluetooth connection, an HFP connection is established, and the HFP connection can be used to transmit call service data, such as voice data sent by the opposite end (ie, the incoming call device) received by the mobile phone in real time.
[0077] Combine the following Figure 5a The process of establishing an HFP connection between the mobile phone 100 and the smart watch 200 is described in detail.
[0078] like Figure 5a As shown, of the two Bluetooth devices establishing the HFP connection, one device acts as an audio gateway (AudioGateway, AG), and the other Bluetooth device acts as a hands-free device (Hands-free, HF). In this example, the mobile phone 100 acts as an AG, and the wearable device (such as a smart watch) acts as a HF.
[0079] For example, during the Bluetooth pairing process between the mobile phone and the smart watch, an ACL link is established between the mobile phone and the smart watch. When the pairing connection between the mobile phone and the smart watch is successful, the ACL link has been successfully established between the mobile phone and the smart watch.
[0080] In one example, when the mobile phone is the party initiating the HFP connection request, after the mobile phone and the smart watch successfully establish an ACL link, the mobile phone establishes an L2CAP link. The mobile phone can negotiate with the smart watch through the L2CAP link. The negotiated information may include: Maximum Transmission Unit (Maximum Transmission Unit), Destination Channel ID (Destination CID), Source Channel ID (Source CID) and other information. Destination CID is used to indicate the channel endpoint of the device that receives the Configuration Request message. Source CID indicates the channel endpoint of the device that receives the Configuration Response packet. After the mobile phone obtains the above-mentioned negotiated information, it can send an HFP service query request to the smart watch, that is, execute step 501.
[0081] In one example, when the smartwatch is the party initiating the HFP connection request, after the mobile phone and the smartwatch successfully establish an ACL link, the smartwatch establishes an L2CAP link. The smartwatch can negotiate with the mobile phone through the L2CAP link, and the negotiation information is not repeated. After the smartwatch obtains the negotiation information, it can send an HFP service query request to the mobile phone.
[0082] Step 501: The mobile phone discovers the HFP service through SDP.
[0083] Exemplarily, when a mobile phone is the party initiating an HFP connection request, the mobile phone queries the smart watch through SDP which service functions it supports. Specifically, the Bluetooth module of the mobile phone can send a first SDP request message to the smart watch, and the first SDP request message contains relevant information about the service that the mobile phone needs to query. In this example, the first SDP request message may contain relevant information about the HFP service that needs to be queried (such as service name, attributes, etc.). The Bluetooth module of the smart watch responds to the SDP request message, queries the services supported by the current smart watch, and returns the query result to the Bluetooth module of the mobile phone. The query result includes information about the services supported by the smart watch. For example, the service list may include: information about supporting HFP services (such as service name, attributes, etc.). In this example, HFP service refers to the service function that supports HFP in the device.
[0084] If the query result indicates that the smart watch supports the HFP service, step 502 is executed. The smart watch can control mobile phone calls through the HFP service, such as answering calls, hanging up calls, rejecting calls, etc. If the query result indicates that the smart watch does not support the HFP service, the establishment of the HFP connection is stopped. Optionally, the query result may include but is not limited to information on services such as support for HFP, Bluetooth audio transmission model protocol (advanced audio distribution profile, A2DP), etc. Optionally, the query result may also include version information of the HFP protocol, etc.
[0085] In another example, when the smart watch is the party initiating the HFP connection request, the smart watch queries the mobile phone through SDP which service functions are supported. The Bluetooth module of the smart watch can send a second SDP request message to the mobile phone, and the second SDP request message contains relevant information about the service that the smart watch needs to query. In this example, the second SDP request message can contain relevant information about the HFP service that needs to be queried (such as service name, attributes, etc.). The Bluetooth module of the mobile phone responds to the second SDP request message, queries the services supported by the current mobile phone, and returns the query result to the Bluetooth module of the smart watch. The query result includes information about the services supported by the mobile phone. For example, the service list may include: information about supporting HFP services (such as service name, attributes, etc.), and the smart watch determines to execute the establishment of an HFP connection.
[0086] In this example, the mobile phone is used as the party initiating the HFP connection request. When the mobile phone confirms that the smart watch supports the HFP service, it determines to establish the HFP connection. Since the HFP connection depends on the RFCOMM connection, the mobile phone needs to establish the RFCOMM connection before establishing the HFP connection, that is, execute step 502.
[0087] Step 502: Establish an RFCOMM connection between the mobile phone and the smart watch.
[0088] For example, the Bluetooth module in the mobile phone initiates an RFCOMM connection request to the smart watch through the L2CAP link. Figure 5b Steps shown:
[0089] Step 5021: The mobile phone sends the first control frame through the L2CAP link.
[0090] Specifically, the first control frame sent by the mobile phone through the RFCOMM exclusive L2CAP channel is a Start Asynchronous Balanced Mode (SABM) frame. The SABM frame is a bottom-level control frame used to request the peer device to establish a channel (such as Channel 0) on the RFCOMM layer, which can be understood as a connection establishment command.
[0091] Step 5022: The smart watch returns a first unnumbered acknowledgement (UA) frame in response to the first control frame.
[0092] Specifically, the smart watch responds to the first control frame, determines to establish a connection, and returns a UA frame to the mobile phone to indicate that the establishment of the RFCOMM channel Channel 0 has been completed. The channel is a control channel used to transmit unnumbered information with header check (UIH) frames carrying control messages and commands.
[0093] Step 5023: The mobile phone and the smart watch negotiate parameters.
[0094] Specifically, the mobile phone and the smart watch negotiate the parameters of the data transmission channel. The mobile phone can send a parameter negotiation command (PN Command) to the smart watch. The parameters of the negotiation command include the priority of the channel to be established, the maximum frame length, etc. The smart phone responds to the PN Command and returns a PN response (i.e., PN Response) to the mobile phone. The parameters of the PN response include the priority of the channel to be established, the maximum frame length, etc.
[0095] Step 5024: The mobile phone sends a second control frame through the L2CAP link to connect the data link.
[0096] Specifically, after the mobile phone and the smart watch complete parameter negotiation, the mobile phone can send a second control frame to the smart watch to establish a user data channel. The second control frame is a SABM frame, and the second SABM frame is used to request the establishment of a user data channel (such as Channel 1).
[0097] Step 5025: The smart watch returns a second UA frame in response to the second control frame.
[0098] Specifically, the smart watch responds to the second control frame, determines to establish a connection, and returns a second UA frame to the mobile phone to indicate that the user data channel has been established. The mobile phone uses a UIH frame to transmit an AT command on the user data channel.
[0099] Similarly, in some other embodiments, the smart watch can request the mobile phone to establish an RFCOMM connection. Figure 5b The process is similar to Figure 5b The process shown includes:
[0100] Step 5021-1: The smart watch sends the first control frame to the mobile phone through the L2CAP link.
[0101] Step 5022-2: The mobile phone returns a first UA frame to the smart watch in response to the first control frame.
[0102] Step 5023-3: The mobile phone and the smart watch negotiate parameters.
[0103] Step 5024-4: The smart watch sends a second control frame to the mobile phone through the L2CAP link to connect the data link.
[0104] Step 5025-4: The mobile phone returns a second UA frame to the smart watch in response to the second control frame.
[0105] Step 503: AT command interaction is performed between the mobile phone and the smart watch.
[0106] For example, after the RFCOMM connection between the mobile phone and the smart watch is established, the mobile phone and the smart watch perform a service level connection (SLC) initialization process. The initialization process is the process of AT command interaction between the mobile phone and the smart watch on the RFCOMM connection. When the AT command interaction between the mobile phone and the smart watch is completed, the SLC is established. Figure 5c Schematic diagram of AT interaction between mobile phone and smart watch.
[0107] Step 5031: The mobile phone and the smart watch mutually confirm the features supported by the HFP connection through AT commands.
[0108] Specifically, smart watches (i.e. Figure 5c HF) to the mobile phone (i.e. Figure 5c AG in the example) sends the first command, which is "AT+BRSF=<HF supported features> " to inform the AG of the features it supports. The smart watch responds to this command with "+BRSF=<AG supported features> ", to inform HF of the features it supports, that is, the AT+BRSF command is used for HF and AG to inform each other of the features supported by each other. AG completes the interaction and sends an OK command to HF.
[0109] Step 5032: The mobile phone and the smart watch negotiate the encoder via AT commands.
[0110] Specifically, if the mobile phone and the smart watch confirm through the AT+BRSF command that both parties support the encoder negotiation feature, the smart watch sends "AT+BAC=<HF available codecs> ", to inform the mobile phone of the encoder it supports, and AG replies with an OK command.
[0111] This step 5032 is an optional step.
[0112] Step 5033: The smart watch determines the indicators supported by the mobile phone and the order of the indicators.
[0113] Specifically, the smart watch sends a test command "AT+CIND=?" to the mobile phone to inquire about the indicators supported by the mobile phone and the order of each indicator. The mobile phone responds to the command with "+CIND:", and after the response, replies to the HF with an OK instruction.
[0114] When the smart watch receives the necessary AG indicators and the order information of each AG indicator, it sends a "+CIND?" read command to the mobile phone to read the current status of the indicators supported by AG. AG responds with "+CIND:", and after the response, it replies with an OK command to HF.
[0115] Step 5034: The smart watch enables each AG indicator.
[0116] Specifically, the smart watch sends "AT+CMER" to the mobile phone to instruct the mobile phone to enable each indicator. After the mobile phone enables each indicator, it replies with an OK command to the HF. If the status of an indicator in the mobile phone changes, the AG can send "+CIEV" to inform the HF, and the HF updates the status of the acquired AG indicator.
[0117] Step 5035: The smart watch queries the mobile phone for features supported by three-way calling.
[0118] Specifically, if the mobile phone and the smart watch confirm that both parties support three-way calling through the AT+BRSF command, the "AT+CHLD=?" command is sent to the mobile phone. The mobile phone responds to the command with "+CHLD:" to inform the mobile phone of the call waiting and multi-party service information supported by AG, and after the response, it replies to the HF with an OK command.
[0119] Step 5036: The smart watch obtains the indicator characteristics supported by AG.
[0120] Specifically, if the smart watch supports the indicator feature, the smart watch checks the +BRSF response to see if the AG also supports the HF indicator feature. If both the HF and AG support the HF indicator feature, the HF shall send “AT+BIND=<HFsupported HF indicators> " command to inform the mobile phone of the specified number of the indicator supported in HF, and the AG should respond with OK.
[0121] After HF provides AG with the HF indicators it supports, HF shall send the "AT+BIND=?" command to inquire about the HF indicator information supported by AG. AG responds with "+BIND", which is a list of all HF indicators supported by AG, and replies with the OK command.
[0122] The HF sends "AT+BIND?" to inquire about the HF indicators enabled by the AG. The AG responds to the command with "+BIND", which is a list of all HF indicators supported by the AG, and replies with an OK command.
[0123] It should be noted that Figure 5c The dashed lines are optional steps.
[0124] After the above AT command interaction is completed, the SLC is established, that is, the HFP connection is established. The smart watch can obtain the call service data of the mobile phone through the HFP connection, that is, the smart watch can answer the phone call.
[0125] When the mobile phone receives a call request from another device, the mobile phone can send a ringing instruction to the smart watch through the HFP connection. When the smart watch responds to the user's answering operation, the smart watch can receive voice data transmitted by the mobile phone through the HFP connection.
[0126] In some embodiments, after the mobile phone and the smart watch establish a Bluetooth connection and an HFP connection, the mobile phone can establish a SCO link with the smart watch. The SCO link is used to transmit call audio between Bluetooth devices. The SCO link depends on the HFP connection.
[0127] When the HFP connection between the mobile phone and the smart watch remains for a long time, the three-party chat software in the mobile phone will directly establish a SCO link between the mobile phone and the smart watch. If the call function of the three-party application of the mobile phone is enabled (such as voice calls or video calls or sending chat voice messages), and the user specifies that the device to receive the call service data is the mobile phone (such as the user clicks the answer button on the mobile phone), the mobile phone needs to disconnect the SCO link first so that the receiving device can be replaced with the mobile phone. However, for security reasons, the three-party chat software will re-establish the SCO link between the Bluetooth devices. In the process of repeatedly disconnecting the SCO link, it will cause delays in the mobile phone's signal reception, such as delays in the mobile phone's voice input and missing words when receiving voice messages. In addition, maintaining an HFP connection between the mobile phone and the smart watch for a long time will also increase the power consumption of the Bluetooth device.
[0128] In order to solve the problem of signal reception delay of the mobile phone, a dynamic HFP connection can be established between Bluetooth devices (such as mobile phones and smart watches). Specifically, when the Bluetooth device establishes a Bluetooth connection, an HFP connection will also be established. When the HFP connection is established and there is no call service, the HFP connection is disconnected. When the mobile phone detects a call request, the HFP connection is established again, and when a call hang-up request is detected, the smart watch is instructed to disconnect the HFP connection to reduce the power consumption of the Bluetooth device.
[0129] Figure 6 The process of dynamically establishing an HFP connection between Bluetooth devices is exemplified, specifically including:
[0130] Step 601: In response to an incoming call, the mobile phone notifies the smart watch of the incoming call.
[0131] In this example, AG takes a mobile phone as an example, and HF takes a smart watch as an example. In this example, during the Bluetooth pairing connection between the mobile phone and the smart watch, an ACL link is established between the mobile phone and the smart watch. When the pairing connection between the mobile phone and the smart watch is successful, the ACL link has been successfully established between the mobile phone and the smart watch. After the Bluetooth pairing between the mobile phone and the smart watch is completed, the mobile phone and the smart watch can be triggered to establish an HFP connection. If the mobile phone does not receive a call request at this time, the mobile phone can instruct the smart watch to disconnect the HFP connection. After the HFP connection between the mobile phone and the smart watch is disconnected, when the second electronic device (such as the second electronic device is mobile phone A) receives a call request from a third electronic device (such as the third electronic device is mobile phone B), the second electronic device can send an incoming call notification to the smart watch in response to the call request. The incoming call notification is used to indicate that the second electronic device has received the incoming call request. Optionally, after the Bluetooth connection is established between the second electronic device and the smart watch, the mobile phone can transmit the notification to the smart watch through the SPP Bluetooth serial communication (Serial Port Profile) link. SPP is a serial communication protocol based on Bluetooth technology. This protocol is one of the communication standards determined by the Bluetooth SIG, which enables Bluetooth devices to have data communication capabilities similar to traditional serial ports, such as transmitting notification messages.
[0132] Figure 7 FIG. 1 is a schematic diagram showing, in an exemplary manner, whether a link for transmitting call audio is connected in a mobile phone. Figure 7 As shown in 7a of FIG. 7 , the Bluetooth device interface 701 of the mobile phone includes a first display frame 702 and a second display frame 703. The first display frame 702 is used to display the name of the device currently connected to the mobile phone and the type of the connected Bluetooth device (as shown in 7b, the device type is a smart watch). The second display frame 703 is used to indicate whether the link for transmitting the call audio is connected. The second display frame 703 includes an indication switch 704, as shown in FIG. Figure 7 As shown in 7a, the indicator switch is in the off state, indicating that the link currently used to transmit the call audio (ie, the call audio channel) is in a disconnected state.
[0133] Step 602: The smart watch negotiates with the mobile phone.
[0134] For example, when the smart watch receives a call notification sent by the mobile phone, the smart watch can establish an L2CAP link and initiate a negotiation request to the mobile phone. The negotiated information may include information such as the maximum transmission unit (Maximum Transmission Unit), Destination CID, and Source CID.
[0135] Step 603: The smart watch discovers the HFP service through SDP.
[0136] This step is similar to step 501. The relevant process can refer to the description in step 501 and will not be repeated here.
[0137] Step 604: Establish an RFCOMM connection between the mobile phone and the smart watch.
[0138] This step is similar to step 502. The relevant process can refer to the description in step 502 and will not be described again here.
[0139] Step 605: AT command interaction is performed between the mobile phone and the smart watch.
[0140] This step is similar to step 503. The relevant process can refer to the description in step 503 and will not be described again here.
[0141] When the mobile phone detects that the HFP connection is established, it can prompt that the connection for transmitting the call audio has been established, for example, Figure 7 As shown in 7b of FIG. 7 , the Bluetooth device interface 701 of the mobile phone includes a first display frame 702 and a second display frame 703. The first display frame 702 is used to display the name of the device currently connected to the mobile phone and the type of the connected Bluetooth device (as shown in 7b, the device type is a smart watch). The indicator switch 704 in the second display frame 703 indicates that the link currently used to transmit the call audio is in a connected state.
[0142] Step 606: In response to the request to hang up the call, the mobile phone notifies the smart watch that the call is ended.
[0143] Specifically, after the mobile phone and the smart watch establish a Bluetooth connection and an HFP connection, the mobile phone establishes a SCO link on the HFP connection to transmit call audio with the smart watch through the SCO link. After the mobile phone continues to receive call requests, and the mobile phone and the smart watch determine that the smart watch supports synchronous ringing during the AT interaction process, the mobile phone can send a ringing instruction (such as AT String: RING) to the smart watch until the smart watch answers the call or rejects the call. If the user determines that the smart watch answers the call, the call audio between the mobile phone and the smart watch is transmitted through the SCO link. For example, after receiving the call audio sent by mobile phone B (the third electronic device), mobile phone A (i.e., the second electronic device) transmits the call audio to the smart watch (i.e., the first electronic device) through the SCO link. The smart watch plays the call audio and transmits the call audio input by the user to mobile phone A through the SCO link. Mobile phone A sends the call audio transmitted by the smart watch to mobile phone B, thereby realizing the function of the smart watch and mobile phone B talking. When mobile phone B hangs up the call, mobile phone A responds to the hang-up signal sent by mobile phone B, and mobile phone A sends a call ending AT command (such as AT String:+CIEV:2,0) to the smart watch through the RFCOMM connection to notify the smart watch that the call is over.
[0144] Step 607: In response to the notification of call end, the smart watch sends a request to disconnect the HFP connection to the mobile phone.
[0145] Specifically, the smart watch sends a request to disconnect the HFP connection to the mobile phone in response to the AT command of the call end. The request to disconnect the HFP connection can use a Disconnect Command ("DISC") frame. The smart watch notifies the mobile phone through the DISC frame that it wants to disconnect the RFCOMM connection.
[0146] Step 608: The mobile phone receives the request sent by the smart watch and returns a first response to the smart watch.
[0147] Specifically, when the mobile phone receives the request, if the mobile phone also wants to disconnect the RFCOMM connection, it responds with a UA frame and returns an OK command to the smart watch.
[0148] Optionally, when the mobile phone returns the first response to the smart watch, it may also prompt that the connection for transmitting the call audio has been disconnected, for example, Figure 7 As shown in FIG. 7 a , the indication switch 704 in the second display frame 703 indicates that the link currently used to transmit the call audio is in a disconnected state.
[0149] Step 609: The smart watch disconnects the HFP connection in response to the first response.
[0150] Specifically, the smart watch receives the UA frame and performs an operation of disconnecting the RFCOMM connection. Since the HFP connection depends on the RFCOMM connection, when the RFCOMM connection is disconnected, the HFP connection is also necessarily disconnected.
[0151] In this example, when the mobile phone receives a phone call, the HFP connection is established; when the phone is hung up, the HFP connection is disconnected. This method of dynamically establishing the HFP connection does not cause a delay when the mobile phone answers a call.
[0152] Figure 8 The diagram shows a mobile phone receiving a call hang-up request before the RFCOMM connection is established. The scenario includes:
[0153] Step 801: In response to an incoming call, the mobile phone notifies the smart watch of the incoming call.
[0154] Step 802: The smart watch negotiates with the mobile phone.
[0155] Step 803: The smart watch discovers the HFP service through SDP.
[0156] Step 804: Establish an RFCOMM connection between the mobile phone and the smart watch.
[0157] Step 805: AT command interaction is performed between the mobile phone and the smart watch.
[0158] The process from step 801 to step 805 is similar to that of step 601 to step 605. For the related process, reference may be made to the description in step 601 to step 605, which will not be repeated here.
[0159] like Figure 8 As shown, before the RFCOMM connection is established, the second electronic device (such as a mobile phone) receives a call hang-up request, and the second electronic device sends an AT command to end the call (such as AT String:+CIEV:2,0) to the first electronic device (such as a smart watch). The AT command needs to be transmitted through the RFCOMM connection. Since the RFCOMM connection has not been established at this time, the mobile phone cannot transmit the AT command to end the call to the smart watch through the RFCOMM connection, resulting in the smart watch being unable to receive the AT command to end the call sent by the mobile phone. Since the smart watch did not receive the AT command to end the call sent by the mobile phone, the smart watch will not execute the operation of disconnecting the HFP connection (that is, it will not execute the command shown in the figure). Figure 6 607~609 in the steps), resulting in the HFP connection between the mobile phone and the smart watch being in a connected state for a long time, until the next normal call, the smart watch can perform the operation of disconnecting the HFP connection after receiving the AT command of the call end normally. The HFP connection between the mobile phone and the smart watch cannot be disconnected in time, which increases the duration of the HFP connection and increases the power consumption of Bluetooth devices (such as mobile phones and smart watches). In addition, when the HFP connection between the mobile phone and the smart watch remains for a long time, the three-party chat software in the mobile phone will directly establish a SCO link between the mobile phone and the smart watch. If the call function of the three-party application of the mobile phone is enabled (such as voice call or video call or sending chat voice information), and the user specifies that the device to receive the call service data is the mobile phone (such as the user clicks the answer button on the mobile phone), the mobile phone needs to disconnect the SCO link first so that the radio device is replaced with the mobile phone. However, for the sake of security mechanism, the three-party chat software will establish the SCO link between the Bluetooth devices again. In the process of repeatedly disconnecting the SCO link, it will cause the problem of delay in the mobile phone receiving the signal, such as the problem of voice input delay of the mobile phone and the problem of missing words when receiving voice messages. That is to say, when the HFP connection cannot be disconnected in time, the dynamic HFP connection will not be able to solve the problem of delay in receiving signals.
[0160] The embodiment of the present application provides a method for Bluetooth communication, which is applied to a Bluetooth device, which can be a wearable device such as a smart watch, a bracelet, etc. In this example, a smart watch is used as an example for explanation. The smart watch receives a call notification sent by a mobile phone and performs an operation of establishing an HFP connection; when the HFP connection is established, it detects whether the current call service is interrupted. If so, the HFP connection is disconnected. This method allows the smart watch to normally disconnect the HFP connection even if the mobile phone receives an instruction to hang up the call before the HFP connection is established, thereby reducing the power consumption of the Bluetooth device.
[0161] Fig. 9 The flowchart of a method for Bluetooth communication is shown as an example, comprising:
[0162] Step 901: In response to an incoming call, the mobile phone notifies the smart watch of the incoming call.
[0163] In this example, AG takes a mobile phone as an example, and HF takes a smart watch as an example. The mobile phone and the smart watch support Bluetooth function. If no Bluetooth connection is established between the mobile phone and the smart watch, and the Bluetooth function of the smart watch is turned on by default, the user clicks the Bluetooth switch in the Bluetooth setting interface of the mobile phone, and the mobile phone responds to the click operation and starts Bluetooth. The mobile phone can query pairable Bluetooth devices within the search range, and in response to the user clicking the identification information of the smart watch, it pairs and connects with the smart watch via Bluetooth. During the Bluetooth pairing process between the mobile phone and the smart watch, an ACL link is established between the mobile phone and the smart watch. When the pairing connection between the mobile phone and the smart watch is successful, an ACL link has been successfully established between the mobile phone and the smart watch. After the Bluetooth pairing between the mobile phone and the smart watch is completed, the mobile phone and the smart watch can be triggered to establish an HFP connection.
[0164] Optionally, when the mobile phone and the smart watch have established a Bluetooth connection and an HFP connection and the mobile phone has not received a call request, the mobile phone can notify the smart watch to disconnect the HFP connection, and the smart watch responds to the notification and performs an operation of disconnecting the HFP connection. The mobile phone can also directly perform the operation of disconnecting the HFP connection, that is, the mobile phone directly sends a DISC frame to the smart watch through the RFCOMM connection, the smart watch responds with a UA frame and returns an OK instruction to the mobile phone, and the mobile phone responds to the UA frame, disconnects the RFCOMM connection, and completes the operation of disconnecting the HFP connection.
[0165] When the mobile phone and the smart watch are in a Bluetooth connection state and there is no HFP connection between the mobile phone and the smart watch, the mobile phone receives a call request sent by other devices and can send a call notification to the smart watch. The call notification is used to indicate that the mobile phone has received the call request. Since the current mobile phone has established a Bluetooth connection with the smart watch, the mobile phone can transmit the call notification to the smart watch through the SPP link. Optionally, if the mobile phone and the smart watch support the broadcast function, the mobile phone can send a broadcast message, which carries the call notification. The smart watch receives the broadcast message and obtains the call notification from the broadcast message.
[0166] The smart watch determines to execute step 902 in response to the call request.
[0167] Step 902: The smart watch negotiates with the mobile phone.
[0168] For example, when the smart watch receives a call notification from a mobile phone, the smart watch establishes an L2CAP link and initiates a negotiation request to the mobile phone, so that it can negotiate with the mobile phone. The negotiated information may include the maximum transmission unit (Maximum Transmission Unit), Destination CID, Source CID and other information.
[0169] Step 903: The smart watch discovers the HFP service through SDP.
[0170] Exemplarily, the smart watch queries which service functions the mobile phone supports through SDP. Specifically, the Bluetooth module of the smart watch can send a second SDP request message to the mobile phone, and the second SDP request message contains relevant information about the service that the smart watch needs to query. In this example, the second SDP request message can contain relevant information about the HFP service that needs to be queried (such as service name, attributes, etc.). The Bluetooth module of the mobile phone responds to the second SDP request message, queries the services supported by the current mobile phone, and returns the query result to the Bluetooth module of the smart watch. The query result includes information about the services supported by the mobile phone. For example, the service list may include: information about supporting HFP services (such as service name, attributes, etc.), and the smart watch determines to execute the establishment of an HFP connection. Since the HFP connection depends on the RFCOMM connection, the mobile phone needs to establish an RFCOMM connection before establishing the HFP connection, that is, execute step 904.
[0171] Before the RFCOMM connection between the mobile phone and the smart watch is established, if the mobile phone receives a request to hang up the call, it generates an AT command to end the call (such as AT String:+CIEV:2,0). This AT command needs to be transmitted through the RFCOMM connection. At this time, the RFCOMM connection has not been successfully established, and the mobile phone cannot transmit the AT command to end the call to the smart watch.
[0172] Since the smart watch cannot receive the AT command for ending the call, the HFP connection establishment process will run normally, that is, when the smart watch finds that the mobile phone supports the HFP service, the smart watch determines to execute step 904.
[0173] Step 904: Establish an RFCOMM connection between the mobile phone and the smart watch.
[0174] In this example, the smart watch determines to establish an RFCOMM connection with the mobile phone. The specific establishment process can refer to step 502 and will not be described again here.
[0175] Step 905: AT command interaction is performed between the mobile phone and the smart watch.
[0176] This step is similar to step 503. The relevant process can refer to the description in step 503 and will not be described again here.
[0177] When the AT command interaction is completed between the smart watch and the mobile phone, the mobile phone and the smart watch determine that the HFP connection between the mobile phone and the smart watch is established. Figure 7 Similar to 7b in, the mobile phone detects that the HFP connection between the mobile phone and the smart watch is established, and the indication switch in the second prompt box 703 is turned on to indicate that the channel for transmitting the call audio of the current mobile phone has been successfully established.
[0178] It should be noted that the above steps 901 to 905 are the process of the first electronic device establishing a hands-free protocol HFP connection in response to the incoming call instruction sent by the second electronic device.
[0179] In one example, when the HFP connection is established and the phone continues to receive call requests, the phone can send an AT command to the smart watch to notify the smart watch of the current status of the phone, and return an OK command without the smart watch. For example, the phone can send an incoming call command to the smart watch, such as: AT String:+CIEV:2,1, which is used to indicate that the phone has received a call request. After the phone sends the incoming call command to the smart watch, it can also establish a SCO link based on the HFP connection. The phone will repeatedly send a ringing command (such as AT String:RING) to the smart watch through the RFCOMM connection until the smart watch answers the call or rejects the call. If the smart watch supports the synchronous ringing function, the smart watch receives the ringing command and plays the ringtone on the phone through the SCO link. If the smart watch does not support the synchronous ringing function, the smart watch receives the ringing command and the smart watch rings in a preset manner (such as silent vibration of the smart watch). In this example, the SCO link is used to synchronously transmit real-time call audio between the phone and the watch.
[0180] In this example, before the RFCOMM connection between the mobile phone and the smart watch is established, the mobile phone receives a request to hang up the phone. In response to the request to hang up the phone, the mobile phone generates an AT command to end the call (AT String:+CIEV:2,0), and the mobile phone executes the operation of sending the AT command to end the call. Since the RFCOMM connection between the mobile phone and the smart watch has not been successfully established at this time, the mobile phone cannot transmit the AT command to end the call through the RFCOMM connection, resulting in the failure of the mobile phone to send the AT command to end the call. When the mobile phone completes the establishment of the HFP connection, since the mobile phone side no longer receives phone calls, the mobile phone will no longer send incoming call instructions (such as AT String:+CIEV:2,1) to the smart watch, and the mobile phone will not establish a SCO link based on the HFP connection.
[0181] In this example, in order to avoid the problem of the smart watch not receiving the interruption instruction sent by the mobile phone and continuing to maintain the HFP connection, the smart watch can detect whether the call service with the mobile phone has ended when the HFP connection is successfully established, that is, execute step 906. Optionally, the smart watch can detect whether the call service with the mobile phone has ended when it detects that the HFP connection is established. For example, the smart watch detects that the AT command interaction is completed and the SLC is established, that is, it is determined that the HFP connection is detected to be established.
[0182] Step 906: The smart watch detects whether the call service is ended. If so, execute step 907.
[0183] In this example, the smart watch can detect whether the call service between the smart watch and the mobile phone is ended by detecting whether there is a call connection between the smart watch and the mobile phone.
[0184] Since the call audio between the mobile phone and the smart watch is transmitted via the SCO link, in this example, the smart watch can detect whether the SCO link exists, and determine whether the call service between the smart watch and the mobile phone has ended based on the detection result. When the smart watch detects that the SCO link between the smart watch and the mobile phone is interrupted (i.e., there is no SCO link), it is determined that the call service between the smart watch and the mobile phone has ended, and step 907 can be executed; if the smart watch detects that the SCO link between the smart watch and the mobile phone is not interrupted (i.e., there is a SCO link), the smart watch does not perform any processing.
[0185] Step 907: The smart watch sends a request to disconnect the HFP connection to the mobile phone.
[0186] Exemplarily, after the smart watch determines that the call service is over, it can send a disconnection control frame to the mobile phone, and the disconnection control frame is a DISC frame to notify the mobile phone that the smart watch wants to disconnect the RFCOMM connection. Establishing an RFCOMM connection is to create a control channel and a user data channel. The DSIC frame includes the channel number of the channel (i.e., the control channel and the user data channel) of the RFCOMM connection in the smart watch.
[0187] Step 908: The mobile phone receives the request sent by the smart watch and returns a first response to the smart watch.
[0188] For example, after receiving the DISC frame sent by the smart watch, the mobile phone determines that a request to hang up the call has been received (such as other devices stop calling the mobile phone, and the mobile phone receives a request to hang up the call), and the mobile phone determines that it wants to disconnect the RFCOMM connection, returns a UA frame to the smart watch, and returns an OK instruction. The UA frame includes the channel number of the channel (i.e., the control channel and the user data channel) of the RFCOMM connection in the mobile phone.
[0189] After returning the UA frame, the mobile phone can also update the status of the call audio indication, for example, Fig.10 As shown in 10a, when the mobile phone detects that the HFP connection with the smart watch is established, the indicator switch 1003 displayed on the Bluetooth setting interface 1001 of the mobile phone is in the on state. When the mobile phone receives a request to disconnect the HFP connection sent by the smart watch, the mobile phone can change the state of the call audio indicator, such as Fig.10 As shown in 10b, the mobile phone turns off the indication switch 1003 to indicate that the call audio channel between the mobile phone and the smart watch is closed.
[0190] Step 909: The smart watch disconnects the HFP connection in response to the first response.
[0191] Exemplarily, when the smart watch receives the UA frame returned by the mobile phone, it performs the operation of disconnecting the RFCOMM connection. The process of the smart watch disconnecting the RFCOMM connection is as follows: the smart watch releases the RFCOMM channel (including the control channel and the user data channel) on the smart watch side to restore the channel to an idle state. In addition, when the mobile phone returns the UA frame, it releases the channel of the RFCOMM connection on the mobile phone side.
[0192] In this example, when the smartwatch detects that the HFP connection with the mobile phone is established, it detects whether there is a call link at present. If it is determined that there is no call link, the smartwatch disconnects the HFP connection. This method can effectively avoid the problem that when the mobile phone receives a hang-up instruction from the other end of the phone call before the HFP connection is established, the mobile phone cannot transmit the call end instruction to the smartwatch through the HFP connection, resulting in the HFP connection being unable to be disconnected. Since the HFP connection can be disconnected in time, the power consumption between the smartwatch and the mobile phone is reduced.
[0193] It should be noted that if the smart watch does not detect the end of the call service with the mobile phone, step 907 will not be executed. When the second electronic device receives the request from the third electronic device to hang up the call, the second electronic device generates an interrupt instruction and transmits it to the first electronic device (such as a smart watch) through the RFCOMM connection in the HFP connection. The smart watch responds to the interrupt instruction and sends a request to disconnect the HFP connection. The second electronic device receives the request sent by the first electronic device and returns a first response to the first electronic device. The first electronic device disconnects the HFP connection in response to the first response.
[0194] That is, when the smart watch does not detect the end of the call service with the mobile phone, the following can be used: Figure 6 Disconnect the HFP connection as shown in .
[0195] It is understandable that, in order to realize the above functions, the electronic device includes hardware and / or software modules corresponding to the execution of each function. In combination with the algorithm steps of each example described in the embodiments disclosed herein, the present application can be implemented in the form of hardware or a combination of hardware and computer software. Whether a function is executed in the form of hardware or computer software driving hardware depends on the specific application and design constraints of the technical solution. Those skilled in the art can use different methods to implement the described functions for each specific application in combination with the embodiments, but such implementation should not be considered to be beyond the scope of the present application.
[0196] This embodiment also provides a computer storage medium, in which computer instructions are stored. When the computer instructions are executed on an electronic device, the electronic device executes the above-mentioned related method steps to implement the Bluetooth communication method in the above-mentioned embodiment. The storage medium includes: a U disk, a mobile hard disk, a read only memory (ROM), a random access memory (RAM), a magnetic disk or an optical disk, and other media that can store program codes.
[0197] This embodiment further provides a computer program product. When the computer program product is run on a computer, the computer is enabled to execute the above-mentioned related steps to implement the Bluetooth communication method in the above-mentioned embodiment.
[0198] The embodiment of the present application also provides a chip system, which includes at least one processor and at least one interface circuit. The processor and the interface circuit can be interconnected by lines. For example, the interface circuit can be used to receive signals from other devices (such as a memory of an electronic device). For another example, the interface circuit can be used to send signals to other devices (such as a processor or a touch screen of an electronic device). Exemplarily, the interface circuit can read instructions stored in the memory and send the instructions to the processor. When the instruction is executed by the processor, the electronic device equipped with the chip system executes the steps of each module in the above embodiment. Of course, the chip system can also include other discrete devices, which is not specifically limited in the embodiment of the present application.
[0199] Among them, the electronic device, computer storage medium, computer program product or chip system provided in this embodiment is used to execute the corresponding method provided above. Therefore, the beneficial effects that can be achieved can refer to the beneficial effects in the corresponding method provided above and will not be repeated here.
[0200] Any content of each embodiment of the present application, as well as any content of the same embodiment, can be freely combined. Any combination of the above content is within the scope of the present application.
[0201] The embodiments of the present application are described above in conjunction with the accompanying drawings, but the present application is not limited to the above-mentioned specific implementation methods. The above-mentioned specific implementation methods are merely illustrative and not restrictive. Under the guidance of the present application, ordinary technicians in this field can also make many forms without departing from the purpose of the present application and the scope of protection of the claims, all of which are within the protection of the present application.
Claims
1. A Bluetooth communication method, characterized in that: Applied to a first electronic device, the first electronic device has completed Bluetooth pairing with a second electronic device, and the method includes: In response to an incoming call instruction sent by the second electronic device, establishing a hands-free protocol HFP connection, wherein the HFP connection is used to conduct a call service with the second electronic device; In the case where the HFP connection is successfully established, detecting whether the call service with the second electronic device has ended; When it is detected that the call service with the second electronic device has ended, the HFP connection is disconnected.
2. The method according to claim 1, characterized in that The detecting whether the call service with the second electronic device has ended includes: Detecting whether the call link established with the second electronic device is interrupted; In the case where it is detected that the call link is interrupted, it is determined that the call service with the second electronic device has been detected to be ended.
3. The method according to claim 1, characterized in that Before establishing a hands-free protocol HFP connection in response to an incoming call instruction sent by the second electronic device, the method further includes: The first electronic device receives the incoming call instruction sent by the second electronic device through a Bluetooth Serial Port Protocol (SPP) link.
4. The method according to claim 1, characterized in that: Before establishing a hands-free protocol HFP connection in response to an incoming call instruction sent by the second electronic device, the method further includes: The first electronic device receives the incoming call instruction sent by the second electronic device through a broadcast transmission channel.
5. The method according to claim 1, characterized in that Before disconnecting the HFP connection, the method further includes: Sending a first request to the second electronic device, the first request being used to request the second electronic device to agree to disconnect the HFP connection, the second electronic device returning a first response to the first electronic device in response to the first request, and changing a call audio indication on a display interface of the second electronic device from a first state to a second state, the first state being used to indicate that a call audio channel of the second electronic device is in an open state, and the second state being used to indicate that the call audio channel is in a closed state; Upon receiving the first response, the HFP connection is disconnected.
6. The method according to claim 5, characterized in that The method further comprises: If it is detected that the call service with the second electronic device has not been terminated, maintaining the HFP connection; In response to the call hang-up instruction sent by the first electronic device, a first request is sent to the second electronic device, the first request is used to request the second electronic device to agree to disconnect the HFP connection, the second electronic device responds to the first request, returns a first response to the first electronic device, and changes the call audio indication on the display interface of the second electronic device from a first state to a second state, the first state is used to indicate that the call audio channel of the second electronic device is in an open state, and the second state is used to indicate that the call audio channel is in a closed state; Upon receiving the first response, the HFP connection is disconnected.
7. The method according to claim 1, characterized in that The first electronic device includes: a smart watch or a wristband.
8. A Bluetooth communication system, characterized in that: The system includes a first electronic device and a second electronic device, wherein the first electronic device and the second electronic device have completed Bluetooth pairing; The second electronic device is used for: In response to a call request sent by a third electronic device, sending an incoming call instruction to the first electronic device; The first electronic device is used for: In response to the incoming call instruction sent by the second electronic device, establishing a hands-free protocol HFP connection, wherein the HFP connection is used to conduct a call service with the second electronic device; The second electronic device is used for: Before the HFP connection is successfully established, receiving a call hang-up request sent by the third electronic device; In response to the call hang-up request, ending the call service; The first electronic device is used for: In the case where the HFP connection is successfully established, detecting whether the call service with the second electronic device has ended; When it is detected that the call service with the second electronic device has ended, the HFP connection is disconnected.
9. The system according to claim 8, characterized in that The second electronic device is further used for: When the HFP connection is successfully established, changing the call audio indication on the display interface of the second electronic device from a second state to a first state, wherein the first state is used to indicate that the call audio channel of the second electronic device is in an open state, and the second state is used to indicate that the call audio channel is in a closed state; The first electronic device is further used for: When it is detected that the call service with the second electronic device has ended, sending a first request to the second electronic device, wherein the first request is used to request the second electronic device to agree to disconnect the HFP connection; The second electronic device is further used for: In response to the first request, returning a first response to the first electronic device; changing the call audio indication on the display interface of the second electronic device from the first state to the second state; The first electronic device is further used for: Upon receiving the first response, the HFP connection is disconnected.
10. An electronic device, characterized in that: include: a memory and a processor, the memory being coupled to the processor; The memory stores program instructions, and when the program instructions are executed by the processor, the electronic device executes the Bluetooth communication method according to any one of claims 1 to 7.
11. A computer-readable storage medium comprising a computer program, characterized in that: When the computer program is executed on an electronic device, the electronic device is enabled to execute the Bluetooth communication method according to any one of claims 1 to 7.
12. A chip system, characterized in that: It includes a processor for calling and running a computer program from a memory, so that an electronic device equipped with the chip system executes the Bluetooth communication method described in any one of claims 1 to 7.
Citation Information
Patent Citations
Communication control method, device and system and readable storage medium
CN110248345A
Conversation method, device and system
CN113923612A
Bluetooth communication method and system and wearable equipment
CN114079892A
Bluetooth communicator, short range wireless communicator and program
CN1764213A
Dual-transceiver wireless calling
US10356232B1