Bluetooth connection method, electronic equipment and computer readable storage medium
By broadcasting the inquiry request message in the electronic device and sending a confirmation request for the pre-set Bluetooth protocol version number, the problem of failure of the connection between the high-version Bluetooth protocol device and the low-version device is solved, and the success rate and data transmission of Bluetooth connection are improved stability.
Patent Information
- Application Number
- CN202410293149.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-03-13
- Publication Date
- 2025-01-07
- Estimated Expiration
- 2044-03-13
AI Technical Summary
In the prior art, the connection between the high-version Bluetooth protocol device and the low-version Bluetooth protocol device is prone to failure, resulting in the problem of connection failure.
By implementing a Bluetooth connection method in an electronic device, in response to the operation of turning on the Bluetooth function, a query request message is broadcast to discover classic Bluetooth or Bluetooth low power devices, and upon receiving the response, a data connection channel is established and a preset is sent A confirmation request for the Bluetooth protocol version number is determined to ensure that the protocol version numbers on both ends match, thereby improving the connection success rate.
The Bluetooth connection success rate between devices with different versions of Bluetooth protocol is improved, ensuring that media data can be transmitted normally between devices.
Smart Images

Figure CN119277354A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of terminal technology, and in particular to a Bluetooth connection method, an electronic device, and a computer-readable storage medium. Background Art
[0002] Current terminal devices generally support Bluetooth, which enables wireless communication between two terminal devices within a short range. Specifically, two terminal devices can be connected via Bluetooth to achieve functions such as wireless control, data transmission, and media playback, which greatly facilitates people to use terminal devices.
[0003] However, currently, when a terminal device using a higher version of the Bluetooth protocol is connected to a terminal device using a lower version of the Bluetooth protocol, a connection failure problem may occur. Summary of the invention
[0004] In view of this, the present application provides a Bluetooth connection method, an electronic device and a computer-readable storage medium, which can improve the success rate of Bluetooth connection between electronic devices using different versions of Bluetooth protocols.
[0005] In a first aspect, the present application provides a Bluetooth connection method, which is applied to an electronic device, in response to an operation of turning on a Bluetooth function, the electronic device broadcasts an inquiry request message and enters a scanning state, so that a classic Bluetooth device can be discovered through the broadcast inquiry request message, or a low-power Bluetooth device can be discovered through scanning. In the case where the electronic device receives an inquiry response message from a first Bluetooth device, the electronic device scans the first Bluetooth device. In response to the operation of selecting the first Bluetooth device, the electronic device establishes a first data connection channel with the first Bluetooth device. Afterwards, the electronic device can send a first confirmation request to the first Bluetooth device through the first data connection channel, wherein the first confirmation request includes a first Bluetooth protocol version number, the first Bluetooth protocol version number is a pre-set Bluetooth protocol version number, and the pre-set Bluetooth protocol version number is less than the version number of the Bluetooth protocol supported by the electronic device; the first confirmation request is used to request the first Bluetooth device to confirm the Bluetooth protocol version number of the electronic device; and negotiate with the first Bluetooth device a Bluetooth protocol for transmitting media data to transmit the media data through the first data connection channel.
[0006] In some examples, the operation of turning on the Bluetooth function may be a user clicking on a control for turning on the Bluetooth function, etc. In some examples, the operation of selecting the first Bluetooth device may be a user clicking on an identifier of the first Bluetooth device.
[0007] In the above implementation, the first Bluetooth protocol version number is a Bluetooth protocol version number that is pre-set according to the Bluetooth protocol version numbers that can be supported by classic Bluetooth.
[0008] In the above implementation, since the electronic device is the first Bluetooth device scanned by receiving the inquiry response sent back by the first Bluetooth device, the electronic device can confirm that the first Bluetooth device is a classic Bluetooth device. Then, the electronic device can send a first confirmation request including the first Bluetooth protocol version number to the first Bluetooth device. After the first Bluetooth device receives the first confirmation request, if the first Bluetooth protocol version number is large, the first Bluetooth device will not confirm the Bluetooth protocol version number of the electronic device, that is, the first Bluetooth device will not feedback the message to the electronic device based on the first confirmation request. Therefore, the electronic device can send a first confirmation request including a pre-set first Bluetooth protocol version number to ensure that the pre-set first Bluetooth protocol version number is not too large, thereby ensuring that the first Bluetooth device can confirm the Bluetooth protocol version number of the electronic device, and then ensure that the electronic device and the first Bluetooth device can successfully transmit media data. In this way, the success rate of Bluetooth connection between electronic devices using different versions of Bluetooth protocols can be improved.
[0009] In a possible implementation of the first aspect, when the electronic device receives a low-power Bluetooth broadcast message from a second Bluetooth device, in response to the operation of selecting the second Bluetooth device, the electronic device can establish a second data connection channel with the second Bluetooth device, and send a second confirmation request to the second Bluetooth device through the second data connection channel. The second confirmation request includes a second Bluetooth protocol version number, the second Bluetooth protocol version number is the Bluetooth protocol version number of the Bluetooth protocol supported by the electronic device, and the second confirmation request is used to request the second Bluetooth device to confirm the Bluetooth protocol version number of the electronic device. Negotiate with the second Bluetooth device a Bluetooth protocol for transmitting media data to transmit the media data through the second data connection channel.
[0010] In the above implementation, since the electronic device scans the second Bluetooth device by receiving a low-power Bluetooth broadcast message from the second Bluetooth device, the electronic device can confirm that the second Bluetooth device is a low-power Bluetooth device.
[0011] In the above implementation, after the second Bluetooth device receives the second confirmation request, it can directly send feedback based on the second confirmation request to the electronic device. There is no situation where feedback is not sent to the electronic device because the second Bluetooth protocol version number is too large or too small. Therefore, the second Bluetooth protocol version number included in the second confirmation request can be directly the Bluetooth protocol version number of the Bluetooth protocol supported by the electronic device. In this way, the second data connection channel between the electronic device and the second Bluetooth device can be guaranteed to transmit media data.
[0012] In a possible implementation of the first aspect, the electronic device includes a host, a classic Bluetooth controller, and a low-power Bluetooth controller. In response to an operation of turning on a Bluetooth function, the electronic device broadcasts an inquiry request message, and a process of entering a scanning state includes: in response to the operation of turning on the Bluetooth function, the host sends a first command to the classic Bluetooth controller and sends a second command to the low-power Bluetooth controller; in response to the first command, the classic Bluetooth controller broadcasts an inquiry request message; in response to the second command, the low-power Bluetooth controller enters a scanning state.
[0013] In the above implementation process, the host sends the first command and the second command to the classic Bluetooth controller and the low-power Bluetooth controller respectively, so that the classic Bluetooth controller and the low-power Bluetooth controller can respectively execute the action of scanning Bluetooth devices, thereby ensuring that the electronic device can scan classic Bluetooth devices and low-power Bluetooth devices at the same time.
[0014] In a second aspect, the present application provides a Bluetooth connection method, which is applied to an electronic device. In response to an operation of turning on a Bluetooth function, the electronic device can scan Bluetooth devices in a discoverable state. In response to an operation on a target Bluetooth device among the scanned Bluetooth devices, the electronic device establishes a data connection channel with the target Bluetooth device, and sends a confirmation request to the target Bluetooth device through the data connection channel, wherein the confirmation request includes a target Bluetooth protocol version number, and the target Bluetooth protocol version number is related to the protocol type of the Bluetooth protocol of the target Bluetooth device; the confirmation request is used to request the target Bluetooth device to confirm the Bluetooth protocol version number of the electronic device; and negotiate with the target Bluetooth device a Bluetooth protocol for transmitting media data to transmit the media data through the data connection channel.
[0015] In the above implementation, a discoverable Bluetooth device refers to a Bluetooth device that can receive an inquiry request message sent by an electronic device, or a Bluetooth device that can send a low-power Bluetooth broadcast message to an electronic device that enters a scanning state.
[0016] In the above implementation, the target Bluetooth protocol version number included in the request confirmation is related to the protocol type of the Bluetooth protocol of the target Bluetooth device. Therefore, after the electronic device sends the confirmation request through the data connection channel established between the electronic device and the target Bluetooth device, the target Bluetooth device can feedback a message to the electronic device to ensure that the electronic device can continue to communicate with the target Bluetooth device and that media data can be transmitted between the electronic device and the target Bluetooth device through the data connection channel. In this way, the connection success rate between the electronic device and the target Bluetooth device can be improved.
[0017] In a possible implementation of the second aspect, when the protocol type of the Bluetooth protocol of the target Bluetooth device is classic Bluetooth, the target Bluetooth protocol version number is a pre-set Bluetooth protocol version number; when the protocol type of the Bluetooth protocol of the target Bluetooth device is low energy Bluetooth, the target Bluetooth protocol version number is the Bluetooth protocol version number of the Bluetooth protocol of the electronic device.
[0018] In the case where the protocol type of the Bluetooth protocol of the target Bluetooth device is classic Bluetooth, the target Bluetooth device will determine whether the target Bluetooth protocol version number is greater than a preset threshold, and in the case where the target Bluetooth protocol version number is greater than the preset threshold, the target Bluetooth device will not confirm the Bluetooth protocol version number of the electronic device, that is, the target Bluetooth device will not send feedback to the electronic device in response to the confirmation request, so that the electronic device and the target Bluetooth device cannot continue to communicate. Therefore, in the case where the protocol type of the Bluetooth protocol of the target Bluetooth device is classic Bluetooth, the target Bluetooth protocol version number in the confirmation request can be set to a pre-set Bluetooth protocol version number to ensure that the target Bluetooth device will send feedback to the electronic device based on the confirmation request.
[0019] When the protocol type of the Bluetooth protocol of the target Bluetooth device is low-power Bluetooth, the target Bluetooth device will directly feedback a response to the electronic device after receiving the confirmation request. Therefore, when the protocol type of the Bluetooth protocol of the target Bluetooth device is low-power Bluetooth, the target Bluetooth protocol version number in the confirmation request can be directly the Bluetooth protocol version number of the Bluetooth protocol of the electronic device.
[0020] In this way, it can be ensured that the electronic device sends a confirmation request according to the protocol type of the Bluetooth protocol of the target Bluetooth device, so as to ensure that the electronic device can receive a message fed back by the target Bluetooth device based on the confirmation request.
[0021] In a possible implementation of the second aspect, before sending a confirmation request to the target Bluetooth device through the data connection channel, the method further includes: determining the protocol type of the Bluetooth protocol of the target Bluetooth device based on the way the target Bluetooth device is scanned. The way in which the electronic device scans the classic Bluetooth device is different from the way in which the low-power Bluetooth is scanned. Therefore, the electronic device can directly and accurately determine the protocol type of the Bluetooth protocol of the target Bluetooth device based on the way in which the target Bluetooth device is scanned. Thus, a confirmation request is sent according to the protocol type of the target Bluetooth device to ensure communication between the electronic device and the target Bluetooth device.
[0022] In a possible implementation of the second aspect, the process of an electronic device scanning a Bluetooth device in a discoverable state is: the electronic device broadcasts an inquiry request message and enters a scanning state. Among them, the electronic device can scan a classic Bluetooth device by broadcasting an inquiry request message; the electronic device entering the scanning state can scan a low-power Bluetooth device. Afterwards, the electronic device determines the protocol type of the Bluetooth protocol of the target Bluetooth device based on the way of scanning the target Bluetooth device, including: if an inquiry response message sent by the target Bluetooth device is received, the electronic device determines that the protocol type of the Bluetooth protocol of the target Bluetooth device is classic Bluetooth; if a low-power Bluetooth broadcast message sent by the target Bluetooth device is received, the electronic device determines that the protocol type of the Bluetooth protocol of the target Bluetooth device is low-power Bluetooth.
[0023] In this way, the electronic device can determine the protocol type of the Bluetooth protocol of the target Bluetooth device by scanning the target Bluetooth device, so as to send a confirmation request according to the protocol type of the target Bluetooth device to ensure communication between the electronic device and the target Bluetooth device.
[0024] In a possible implementation of the second aspect, the electronic device includes a host, a classic Bluetooth controller and a low-power Bluetooth controller; in response to an operation to turn on the Bluetooth function, the electronic device broadcasts an inquiry request message, and the process of entering a scanning state includes: in response to the operation to turn on the Bluetooth function, the host sends a first command to the classic Bluetooth controller and sends a second command to the low-power Bluetooth controller; in response to the first command, the classic Bluetooth controller broadcasts an inquiry request message; in response to the second command, the low-power Bluetooth controller enters a scanning state.
[0025] In the above implementation process, the host sends the first command and the second command to the classic Bluetooth controller and the low-power Bluetooth controller respectively, so that the classic Bluetooth controller and the low-power Bluetooth controller can respectively execute the action of scanning Bluetooth devices, thereby ensuring that the electronic device can scan classic Bluetooth devices and low-power Bluetooth devices at the same time.
[0026] In a third aspect, the present application provides an electronic device, comprising a Bluetooth module, a memory and one or more processors; the Bluetooth module, the memory and the processor are coupled; the memory is used to store computer program code, and the computer program code comprises computer instructions; when the processor executes the computer instructions, the electronic device executes the method of the first aspect and any possible design method thereof, or the method of the second aspect and any possible involving method thereof.
[0027] In a fourth aspect, the present application provides a computer-readable storage medium comprising computer instructions, which, when executed on an electronic device, causes the electronic device to execute the method of the first aspect and any possible design thereof, or the method of the second aspect and any possible related method thereof.
[0028] In a fifth aspect, the present application provides a computer program product, including a computer program / instruction, which, when executed by a processor, enables the electronic device to execute the method described in the first aspect and any possible design method thereof, or the method described in the second aspect and any possible involving method thereof.
[0029] In a sixth aspect, the present application provides a device, which is included in an electronic device, and the device has the function of implementing the behavior of the electronic device in any of the above aspects and possible implementation methods. The function can be implemented by hardware, or by hardware executing corresponding software. The hardware or software includes at least one module or unit corresponding to the above function. For example, a broadcast module or unit, a scanning module or unit, a determination module or unit, and a storage module or unit, etc.
[0030] In a seventh aspect, an embodiment of the present application provides a chip system, which includes a processor and may also include a memory, for implementing any one of the methods provided in the third to fifth aspects above. The chip system may be composed of a chip, or may include a chip and other discrete devices.
[0031] It can be understood that the electronic device described in the third aspect and any possible design thereof provided above, the computer-readable storage medium described in the fourth aspect, and the computer program product described in the fifth aspect are all used to execute the corresponding methods provided above. Therefore, the beneficial effects that can be achieved can be referred to the beneficial effects in the corresponding methods provided above, and will not be repeated here. BRIEF DESCRIPTION OF THE DRAWINGS
[0032] Figure 1 A schematic diagram of the structure of a Bluetooth communication system provided in an embodiment of the present application;
[0033] Figure 2 A schematic diagram of a Bluetooth connection interaction provided in an embodiment of the present application Figure 1 ;
[0034] Figure 3 A schematic diagram of the structure of an electronic device provided in an embodiment of the present application;
[0035] Figure 4 A schematic diagram of a Bluetooth core system of a Bluetooth device provided in an embodiment of the present application;
[0036] Figure 5A schematic diagram of a flow chart of a Bluetooth connection method provided in an embodiment of the present application;
[0037] Figure 6 An operation diagram of a Bluetooth connection method provided in an embodiment of the present application;
[0038] Figure 7 A schematic diagram of a Bluetooth connection interaction provided in an embodiment of the present application Figure 2 ;
[0039] Figure 8 A schematic diagram of a Bluetooth connection interaction provided in an embodiment of the present application Figure 3 . DETAILED DESCRIPTION
[0040] In the following, the terms "first" and "second" are used only for descriptive purposes and cannot be understood as indicating or implying relative importance or implicitly indicating the number of technical features indicated. Thus, the features defined as "first" and "second" may explicitly or implicitly include one or more of the features. In the description of this embodiment, "at least one" refers to one or more, and "multiple" refers to two or more. "And / or" describes the association relationship of associated objects, indicating that three relationships may exist. For example, A and / or B can represent: A exists alone, A and B exist at the same time, and B exists alone, where A and B can be singular or plural. The character " / " generally indicates that the associated objects before and after are in an "or" relationship. "At least one of the following" or similar expressions refers to any combination of these items, including any combination of single items or plural items. For example, at least one of a, b, or c can represent: a, b, c, ab, ac, bc, or abc, where a, b, c can be single or multiple.
[0041] It should be noted that 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 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.
[0042] Before introducing the embodiments of the present application, the technologies involved in the embodiments of the present application are first introduced in detail.
[0043] Bluetooth is a technology that uses radio waves to achieve short-range wireless communication. Bluetooth technology is often used in scenarios where data transmission between electronic devices is achieved within a short range.
[0044] According to the type of Bluetooth protocol, Bluetooth types generally include classic Bluetooth and Bluetooth low energy (BLE). Among them, classic Bluetooth refers to Bluetooth that supports Bluetooth basic rate or enhanced data rate, so classic Bluetooth is also called BR Bluetooth or EDR Bluetooth. Low energy Bluetooth is also called LE (low energy) Bluetooth.
[0045] Bluetooth devices can be divided into dual-mode Bluetooth devices and single-mode Bluetooth devices according to their support for Bluetooth protocols. Dual-mode Bluetooth devices refer to Bluetooth devices that support both classic Bluetooth and low-power Bluetooth, while single-mode Bluetooth devices refer to Bluetooth devices that only support classic Bluetooth or only support low-power Bluetooth.
[0046] Bluetooth technology can effectively simplify the communication between terminal devices such as desktop computers, laptops and mobile communication terminals. In addition, Bluetooth technology can also simplify the communication between the above devices and the Internet, making the data transmission between these devices and the Internet faster and more efficient. Therefore, most terminal devices currently support Bluetooth function.
[0047] The power consumption of low-power Bluetooth is lower than that of classic Bluetooth, but the transmission speed of classic Bluetooth is higher than that of low-power Bluetooth. Therefore, the type of Bluetooth supported in general terminal devices is determined according to their usage scenarios and usage requirements. For example, in general, terminal devices that require low power consumption, such as smart bracelets, generally support low-power Bluetooth. Bluetooth devices that support low-power Bluetooth can be called low-power Bluetooth devices. Terminal devices that require high transmission speeds and transmit large amounts of data, such as vehicle-mounted devices, generally support classic Bluetooth. Bluetooth devices that support classic Bluetooth can be called classic Bluetooth devices. The above-mentioned low-power Bluetooth devices and classic Bluetooth devices are both called single-mode Bluetooth devices. Terminal devices that are commonly used to connect to different types of Bluetooth devices, such as mobile phones and tablets, generally support both classic Bluetooth and low-power Bluetooth at the same time, and are dual-mode Bluetooth devices.
[0048] like Figure 1 As shown in the figure, the mobile phone is a dual-mode Bluetooth device, the vehicle-mounted device is a classic Bluetooth device, and the smart bracelet is a low-power Bluetooth device. The mobile phone can be connected to the vehicle-mounted device via classic Bluetooth, and can also be connected to the smart bracelet via low-power Bluetooth.
[0049] Generally speaking, a higher version of the Bluetooth protocol is compatible with a lower version of the Bluetooth protocol, so a Bluetooth device using a higher version of the Bluetooth protocol can connect to a Bluetooth device using a lower version of the Bluetooth protocol. Figure 1 The Bluetooth protocol version of the mobile phone is 5.4. Figure 1 The Bluetooth protocol version of the vehicle device is 4.2, and Figure 1 If the Bluetooth protocol version of the smart bracelet is 5.3, the mobile phone and the vehicle-mounted device can be connected via the Bluetooth protocol version 4.2, and the mobile phone and the smart bracelet can be connected via the Bluetooth protocol version 5.3.
[0050] However, currently, when a Bluetooth device using a higher version of the Bluetooth protocol is connected to a Bluetooth device using a lower version of the Bluetooth protocol, there is a problem of connection failure.
[0051] For example, Figure 2 As shown, device M and device N are connected using Bluetooth. The Bluetooth protocol version of device M is version 5.4, and the Bluetooth protocol version of device N is version 4.2. After the inquiry request sent by device M is received by device N, device N sends an inquiry response to device M, which means that device M has discovered device N. After device M receives the inquiry response sent by device N, device M can send a paging request for establishing a data connection channel to device N, and device N feeds back a paging response for establishing a data connection channel to device M, completing the establishment of the data connection channel. After the data connection channel is established, data can be transmitted between device M and device N.
[0052] The above-mentioned data connection channel is also called a physical link. The data connection channel established by Bluetooth technology includes an asynchronous connectionless link (ACL) and a synchronous connection-oriented link (SCO). Among them, ACL is used to transmit data that is not sensitive to time requirements, such as file data, control signaling, etc., and SCO is used to transmit communications that are more sensitive to time, such as voice data. The data connection channel established in the above embodiment may include one physical link, or may include multiple physical links of the same type or different types of physical links. The number of physical links and the type of physical links included in the data connection channel established between two Bluetooth devices are determined by the specific usage scenario.
[0053] like Figure 2As shown, after establishing the data connection channel, device M sends a Bluetooth protocol version number confirmation request A to device N, and the Bluetooth protocol version number confirmation request A includes the version number of the Bluetooth protocol adopted by device M. After device N receives the version number of the Bluetooth protocol adopted by device M, device N compares the size of the Bluetooth protocol version numbers adopted by device M and device N, and determines whether to respond to the Bluetooth protocol version number confirmation request A sent by device M based on the judgment result. Specifically, when device N determines that the version number of the Bluetooth protocol adopted by device N is 4.2, which is lower than the version number of the Bluetooth protocol adopted by device M, 5.4, device N does not respond to the Bluetooth protocol version number confirmation request A sent by device M, thus causing the data connection channel between device M and device N to be disconnected, and subsequent Bluetooth pairing between device M and device N is no longer possible.
[0054] In order to avoid the problem of connection failure between Bluetooth devices, the embodiment of the present application provides the following Bluetooth connection method. After turning on the Bluetooth function, the electronic device can scan other Bluetooth devices. When the user selects the target Bluetooth device in the scanned Bluetooth device, the electronic device can establish a data connection channel for transmitting data between the electronic device and the target Bluetooth device. After that, the electronic device can send a Bluetooth protocol version number confirmation request to the target Bluetooth device through the data connection channel based on the Bluetooth type supported by the target Bluetooth device. The Bluetooth protocol version number included in the Bluetooth protocol version number confirmation request is related to the type of Bluetooth protocol supported by the target Bluetooth device. In the case where the Bluetooth type of the Bluetooth protocol supported by the target Bluetooth device is classic Bluetooth, the Bluetooth protocol version number included in the Bluetooth protocol version number confirmation request is a pre-set first version number. In the case where the Bluetooth type of the Bluetooth protocol supported by the target Bluetooth device is low-power Bluetooth, the Bluetooth protocol version number included in the Bluetooth protocol version number confirmation request is a second version number. Wherein, the second version number is the version number of the Bluetooth protocol adopted by the electronic device.
[0055] In some embodiments, the first version number is less than the second version number.
[0056] In order to better understand the embodiments of the present application, the terminal device provided in the embodiments of the present application is first introduced.
[0057] The Bluetooth connection method provided in the embodiment of the present application can be applied to an electronic device 100. The electronic device 100 can be a mobile phone, a tablet computer, a smart screen, a laptop computer, an ultra-mobile personal computer (UMPC), a netbook, a personal digital assistant (PDA), an artificial intelligence device, or other electronic device with Bluetooth function. The embodiment of the present application does not limit the specific type of the electronic device 100 or the installed operating system.
[0058] Figure 3 1 shows a schematic diagram of the structure of the electronic device 100. 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 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.
[0059] It is to be understood that the structure illustrated in the embodiment of the present invention does not constitute a specific limitation on the electronic device 100. In other embodiments of the present application, the electronic device 100 may include more or fewer components than shown in the figure, or combine some components, or separate some components, or arrange the components differently. The components shown in the figure may be implemented in hardware, software, or a combination of software and hardware.
[0060] The processor 110 may include one or more processing units, for example, the processor 110 may include an application processor (AP), a modem processor, a graphics processor (GPU), an image signal processor (ISP), a controller, a memory, a video codec, a digital signal processor (DSP), a baseband processor, and / or a neural-network processing unit (NPU), etc. Different processing units may be independent devices or integrated into one or more processors.
[0061] The controller may be the nerve center and command center of the electronic device 100. The controller may generate an operation control signal according to the instruction operation code and the timing signal to complete the control of fetching and executing instructions.
[0062] The processor 110 may also be provided with a memory for storing instructions and data. In some embodiments, the memory in the processor 110 is a cache memory. The memory may store instructions or data that the processor 110 has just used or cyclically used. If the processor 110 needs to use the instruction or data again, it may be directly called from the memory. This avoids repeated access, reduces the waiting time of the processor 110, and thus improves the efficiency of the system.
[0063] In some embodiments, the processor 110 may include one or more interfaces. The interface may include an inter-integrated circuit (I2C) interface, an inter-integrated circuit sound (I2S) interface, a pulse code modulation (PCM) interface, a universal asynchronous receiver / transmitter (UART) interface, a mobile industry processor interface (MIPI), a general-purpose input / output (GPIO) interface, a subscriber identity module (SIM) interface, and / or a universal serial bus (USB) interface, etc.
[0064] It is understandable that the electronic device 100 may adopt different interface connection modes in the above embodiments, or a combination of multiple interface connection modes.
[0065] The charging management module 140 is used to receive charging input from a charger. The charger can be a wireless charger or a wired charger. The power management module 141 is used to connect the battery 142, the charging management module 140 and the processor 110. The power management module 141 receives input from the battery 142 and / or the charging management module 140, and provides power to the processor 110, the internal memory 121, the external memory, the display screen 194, the camera 193, and the wireless communication module 160.
[0066] The wireless communication function of the electronic device 100 can be implemented through the antenna 1, the antenna 2, the mobile communication module 150, the wireless communication module 160, the modem processor and the baseband processor.
[0067] Antenna 1 and antenna 2 are used to transmit and receive electromagnetic wave signals. Each antenna in electronic device 100 can be used to cover a single or multiple communication frequency bands. Different antennas can also be reused to improve the utilization of antennas. For example, antenna 1 can be reused as a diversity antenna for a wireless local area network.
[0068] The mobile communication module 150 can provide solutions for wireless communications including 2G / 3G / 4G / 5G, etc., applied to the electronic device 100. The mobile communication module 150 may include at least one filter, a switch, a power amplifier, a low noise amplifier (LNA), etc. The mobile communication module 150 can receive electromagnetic waves from the antenna 1, and filter, amplify, etc. the received electromagnetic waves, and transmit them to the modulation and demodulation processor for demodulation. The mobile communication module 150 can also amplify the signal modulated by the modulation and demodulation processor, and convert it into electromagnetic waves for radiation through the antenna 1.
[0069] The modem processor may include a modulator and a demodulator. The modulator is used to modulate the low-frequency baseband signal to be sent into a medium-high frequency signal. The demodulator is used to demodulate the received electromagnetic wave signal into a low-frequency baseband signal. The demodulator then transmits the demodulated low-frequency baseband signal to the baseband processor for processing. After the low-frequency baseband signal is processed by the baseband processor, it is passed to the application processor. The application processor outputs a sound signal through an audio device (not limited to a speaker 170A, a receiver 170B, etc.), or displays an image or video through a display screen 194.
[0070] The wireless communication module 160 can provide wireless communication solutions for application in the electronic device 100, including wireless local area networks (WLAN) (such as wireless fidelity (Wi-Fi) networks), Bluetooth (BT), global navigation satellite system (GNSS), frequency modulation (FM), near field communication technology (NFC), infrared technology (IR), etc.
[0071] The wireless communication module 160 may be one or more devices integrating at least one communication processing module. The wireless communication module 160 receives electromagnetic waves via the antenna 2, modulates the electromagnetic wave signal and performs filtering, and sends the processed signal to the processor 110. The wireless communication module 160 may also receive a signal to be sent from the processor 110, modulate the signal, amplify the signal, and convert it into an electromagnetic wave for radiation via the antenna 2.
[0072] In some embodiments, the Bluetooth function is specifically implemented by the Bluetooth core system in the electronic device (such as a mobile phone, a smart bracelet, and a car device). In the embodiment of the present application, for ease of understanding, the Bluetooth core system of the electronic device is simplified as Figure 4 The structure shown. Figure 4 As shown in the figure, the Bluetooth core system can be abstracted into a Bluetooth host (HOST), a Bluetooth controller (controller) and a host controller interface (HCI). Among them, the Bluetooth core system of a dual-mode Bluetooth device includes a HOST and two controllers, one of which is a classic Bluetooth controller for performing classic Bluetooth related operations and the other is a low-power Bluetooth controller for performing low-power Bluetooth related operations.
[0073] HOST can be understood as the Bluetooth application layer (User Application). In the case where the electronic device is a mobile phone, the HOST in the Bluetooth core system of the mobile phone can be understood as a Bluetooth application. After the mobile phone receives the corresponding operation of the user on the Bluetooth function, the HOST of the mobile phone can send the corresponding command to the controller in response to the user's operation. Correspondingly, the controller can also be understood as a logical entity Bluetooth chip, which can execute the command issued by the HOST and return the return value event to the HOST.
[0074] Among them, the communication between the HOST and the controller is completed based on HCI. Specifically: the HOST sends commands to the controller through HCI. The event returned by the controller is notified to the HOST through HCI. In other words, HCI plays the role of an intermediate layer. The commands and events transmitted between the HOST and the controller are defined by the HCI protocol in the Bluetooth protocol specification. In addition, the communication between Bluetooth devices is achieved between the controllers of the two Bluetooth devices through air commands. The air commands are defined by the link manager protocol (LMP) or the link layer protocol (LL).
[0075] In some examples, the processor 110 may include the above-mentioned HOST, and the wireless communication module 160 may include the above-mentioned Bluetooth chip. The processor 110 may send a command for scanning and connecting to a Bluetooth device to the wireless communication module 160, and the wireless communication module 160 sends or receives electromagnetic waves through the antenna 2 to scan or connect to a Bluetooth device through electromagnetic waves, thereby realizing a communication connection between the electronic device and other Bluetooth devices.
[0076] The electronic device 100 implements the display function through a GPU, a display screen 194, and an application processor. The GPU is a microprocessor for image processing, which connects the display screen 194 and the application processor. The GPU is used to perform mathematical and geometric calculations for graphics rendering. The processor 110 may include one or more GPUs that execute program instructions to generate or change display information.
[0077] The display screen 194 is used to display images, videos, etc. In some embodiments, the electronic device 100 may include 1 or N display screens 194 , where N is a positive integer greater than 1.
[0078] The electronic device 100 can realize the shooting function through ISP, camera 193, video codec, GPU, display screen 194 and application processor.
[0079] The ISP is used to process data fed back by the camera 193. The camera 193 is used to capture still images or videos.
[0080] In some embodiments, the object generates an optical image through the lens of the camera 193 and projects it onto the photosensitive element. The photosensitive element converts the optical signal into an electrical signal, and then transmits the electrical signal to the ISP to convert it into a digital image signal. The ISP outputs the digital image signal to the DSP for processing. The DSP converts the digital image signal into an image signal in a standard RGB, YUV or other format. In some embodiments, the electronic device 100 may include 1 or N cameras 193, where N is a positive integer greater than 1.
[0081] The digital signal processor is used to process digital signals, and can process not only digital image signals but also other digital signals. For example, when the electronic device 100 is selecting a frequency point, the digital signal processor is used to perform Fourier transform on the frequency point energy.
[0082] Video codecs are used to compress or decompress digital videos. The electronic device 100 may support one or more video codecs. Thus, the electronic device 100 may play or record videos in a variety of coding formats, such as Moving Picture Experts Group (MPEG) 1, MPEG2, MPEG3, MPEG4, etc.
[0083] NPU is a neural network (NN) computing processor. By drawing on the structure of biological neural networks, such as the transmission mode between neurons in the human brain, it can quickly process input information and can also continuously self-learn. Through NPU, applications such as intelligent cognition of electronic device 100 can be realized, such as image recognition, face recognition, voice recognition, text understanding, etc.
[0084] The external memory interface 120 can be used to connect an external memory card, such as a Micro SD card, to expand the storage capacity of the electronic device 100. The external memory card communicates with the processor 110 via the external memory interface 120 to implement a data storage function.
[0085] The internal memory 121 can be used to store computer executable program codes, which include instructions. The processor 110 executes various functional applications and data processing of the electronic device 100 by running the instructions stored in the internal memory 121. The internal memory 121 may include a program storage area and a data storage area. Among them, the program storage area may store an operating system, an application required for at least one function (such as a sound playback function, an image playback function, etc.), etc. The data storage area may store data created during the use of the electronic device 100 (such as audio data, a phone book, etc.), etc. In addition, the internal memory 121 may include a high-speed random access memory, and may also include a non-volatile memory, such as at least one disk storage device, a flash memory device, a universal flash storage (UFS), etc.
[0086] The electronic device 100 can implement audio functions such as music playing and recording through the audio module 170, speakers, receivers, microphones, headphone interfaces, and application processors.
[0087] The audio module 170 is used to convert digital audio information into analog audio signal output, and is also used to convert analog audio input into digital audio signal. The audio module 170 can also be used to encode and decode audio signals. The speaker, also known as the "speaker", is used to convert audio electrical signals into sound signals. The receiver, also known as the "earpiece", is used to convert audio electrical signals into sound signals. The microphone, also known as the "microphone" or "microphone", is used to convert sound signals into electrical signals. The headphone jack is used to connect wired headphones. The headphone jack can be a USB interface 130, or it can be a 3.5mm open mobile terminal platform (OMTP) standard interface, or a cellular telecommunications industry association of the USA (CTIA) standard interface.
[0088] 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 180K, an ambient light sensor, a bone conduction sensor, and the like.
[0089] The touch sensor 180K is also called a "touch panel". The touch sensor 180K can be set on the display screen 194. The touch sensor 180K and the display screen 194 form a touch screen, also called a "touch screen". The touch sensor 180K is used to detect a touch operation acting on or near it. The touch sensor can pass the detected touch operation to the application processor to determine the type of touch event. Visual output related to the touch operation can be provided through the display screen 194.
[0090] Buttons 190 include a power button, a volume button, and the like.
[0091] Motor 191 can generate vibration prompts.
[0092] Indicator 192 may be an indicator light, which may be used to indicate charging status, power changes, messages, missed calls, notifications, etc.
[0093] The SIM card interface 195 is used to connect a SIM card. The SIM card can be connected to or disconnected from the electronic device 100 by inserting or removing the SIM card interface 195. The electronic device 100 can support 1 or N SIM card interfaces, where N is a positive integer greater than 1.
[0094] The following describes the Bluetooth connection method provided in the embodiments of the present application in conjunction with the accompanying drawings.
[0095] Figure 5 A flowchart of a Bluetooth connection method is provided for this application. Figure 5 As shown, the method may include:
[0096] S501: In response to an operation of turning on a Bluetooth function, scanning Bluetooth devices, and determining the Bluetooth type of the Bluetooth protocol supported by the Bluetooth devices.
[0097] In some embodiments, when the electronic device is a dual-mode Bluetooth device, the electronic device can perform classic Bluetooth scanning and low-power Bluetooth scanning at the same time in response to the operation of turning on the Bluetooth function. The following is an example of a mobile phone that is a dual-mode Bluetooth device. Figure 6 As shown, the mobile phone displays the Bluetooth setting interface. In response to the user's operation on the Bluetooth function activation control, such as a click operation, the mobile phone activates the Bluetooth function and initiates a BR scan and a BLE scan. Through scanning, the mobile phone can scan other Bluetooth devices in a discoverable state. Figure 6 As shown, after the Bluetooth function is turned on, the Bluetooth setting interface can display a Bluetooth device list, which includes the identifiers of the scanned Bluetooth devices. If the mobile phone scans device N, device P, and device O, the Bluetooth device list includes device N, device P, and the device name of the device.
[0098] In the above embodiment, the user's operation of turning on the Bluetooth function control can be the operation of turning on the Bluetooth function in this application. In the above embodiment, the action of the electronic device performing classic Bluetooth scanning can be the action of the electronic device of this application broadcasting an inquiry request message, and the action of the electronic device performing low-power Bluetooth scanning can be the action of the electronic device of this application entering a scanning state.
[0099] In some embodiments, the HOST of the electronic device sends a scanning instruction to the controller to discover other Bluetooth devices. In response to the operation of turning on the Bluetooth function, the HOST can send a command to the controller to instruct the controller to scan for Bluetooth devices. After receiving the command to instruct the controller to scan for Bluetooth devices, the controller starts to perform the operation of scanning for Bluetooth devices.
[0100] Table 1 provides a brief comparison between classic Bluetooth and low-power Bluetooth:
[0101] Table 1
[0102]
[0103] It can be seen from Table 1 above that the scanning mode, connection commands used by the host, and controller connection method are different between classic Bluetooth and low-power Bluetooth. Therefore, classic Bluetooth devices can only be connected to classic Bluetooth devices, low-power Bluetooth devices can only be connected to low-power Bluetooth devices, and dual-mode Bluetooth devices can be connected to classic Bluetooth devices and low-power Bluetooth devices.
[0104] Exemplarily, when a classic Bluetooth device scans a Bluetooth device in a discoverable state in an inquiry manner, the classic Bluetooth device sends an inquiry request message to the outside. When a low-power Bluetooth device scans a Bluetooth device in a discoverable state in a low-power scanning manner, the low-power Bluetooth device is in a low-power scanning state and does not send a request to the outside. Accordingly, a classic Bluetooth device in a discoverable state can receive an inquiry request message sent by the classic Bluetooth, so the classic Bluetooth device can scan other classic Bluetooth devices through an inquiry scanning manner. In addition, a low-power Bluetooth device in a discoverable state broadcasts a low-power Bluetooth broadcast message to the outside, so that a low-power Bluetooth device in a low-power scanning state can receive a low-power Bluetooth broadcast message, so the low-power Bluetooth device can scan other low-power Bluetooth devices through a low-power scanning scanning manner.
[0105] That is to say, when the electronic device is a dual-mode Bluetooth device, the electronic device with the Bluetooth function turned on uses two different scanning methods to scan, so as to ensure that the electronic device can scan the classic Bluetooth device and the low-power Bluetooth device in the discoverable state. Correspondingly, when the electronic device is a single-mode Bluetooth device that only supports classic Bluetooth, the electronic device with the Bluetooth function turned on only uses the inquiry scanning method to scan the classic Bluetooth device in the discoverable state. When the electronic device is a single-mode Bluetooth device that only supports low-power Bluetooth, the electronic device with the Bluetooth function turned on only uses the low-power scanning method to scan the low-power Bluetooth device in the discoverable state.
[0106] In some embodiments, when the electronic device is a dual-mode Bluetooth device, in response to the operation of turning on the Bluetooth function, the HOST of the electronic device sends corresponding scanning commands to the classic Bluetooth controller and the low-power Bluetooth controller, respectively, to instruct the classic Bluetooth controller and the low-power Bluetooth controller to scan other Bluetooth devices in a discoverable state, respectively.
[0107] In some examples, the electronic device uses an inquiry scanning method to scan Bluetooth devices. The specific implementation is as follows: the HOST in the electronic device sends a classic Bluetooth scan command to the classic Bluetooth controller to instruct the classic Bluetooth controller to send a classic Bluetooth inquiry request message. Exemplarily, the classic Bluetooth scan command can be an inquiry command (inquiry command), for example, the inquiry command is: 01 04 05 33 8B 9E 0A 00. After receiving the classic Bluetooth scan command, the classic Bluetooth controller sends a classic Bluetooth inquiry request message, for example, a classic Bluetooth inquiry data packet. The format of the classic Bluetooth inquiry data packet is fixed and has no payload. Exemplarily, the format of the classic Bluetooth inquiry data packet is generally an ID packet.
[0108] The classic Bluetooth scan command sent by the HOST to the classic Bluetooth controller is the first command in this application.
[0109] After receiving the classic Bluetooth inquiry request message, the peer Bluetooth device sends a classic Bluetooth inquiry feedback message to the electronic device. The peer Bluetooth device refers to a Bluetooth device that receives the classic Bluetooth inquiry request message sent by the electronic device. It can be understood that the peer Bluetooth device can receive the classic Bluetooth inquiry request message and send a classic Bluetooth inquiry feedback message. Therefore, the peer Bluetooth device is a classic Bluetooth device scanned by the inquiry scanning method.
[0110] In the above embodiment, the peer Bluetooth device may be the first Bluetooth device in the present application, and the classic Bluetooth inquiry request message may be the inquiry request message in the present application.
[0111] Exemplarily, after receiving a classic Bluetooth inquiry data packet of type ID packet, the peer Bluetooth device may reply with a classic Bluetooth inquiry response data packet. For example, the inquiry response data packet replied by the peer Bluetooth device may be an FHS (FHS is the abbreviation of frequency-hopping spread, which means frequency hopping technology in Chinese) packet. The FHS packet is a control packet, which includes the Bluetooth device address and the clock of the Bluetooth device. Generally, a Bluetooth device sends an FHS packet to another Bluetooth device to ensure that the clocks of the two Bluetooth devices are consistent and the frequency hopping is synchronized. In addition, after receiving a data packet sent by another device, the Bluetooth device sends an FHS packet for response to the other Bluetooth device. Specifically, the FHS packet sent by the peer Bluetooth device may be: 10 9C 01F9 FD 78B3 9B D6 70 94 83FB A0 0C 42 5A 28 20 00 00 11 1A.
[0112] Afterwards, the electronic device can receive the classic Bluetooth inquiry feedback message sent by the opposite Bluetooth device. Specifically, the classic Bluetooth controller of the electronic device can receive the classic Bluetooth inquiry feedback data packet sent by the opposite Bluetooth device, and then the classic Bluetooth controller in the electronic device sends the received classic Bluetooth inquiry feedback data packet to the HOST in the electronic device. At this point, the electronic device scans the opposite Bluetooth device.
[0113] In some examples, the specific implementation of the electronic device scanning the Bluetooth device in the low-power scanning manner is as follows: the HOST in the electronic device sends a low-power Bluetooth scan command to the low-power Bluetooth controller to indicate that the low-power Bluetooth controller is in a state of listening to low-power Bluetooth broadcast messages. Exemplarily, the low-power Bluetooth scan command can be a low-power scan (BLE scan) command, and the BLE scan command can be a LE set extended scan enable command (LE setextended scan enable command). For example, the LE set extended scan enable command is: 4220 06 01 00 00 00 00 00. After receiving the low-power Bluetooth scan command, the low-power Bluetooth controller enters a state of listening to low-power Bluetooth broadcast messages. The low-power Bluetooth controller in the state of listening to low-power Bluetooth broadcast messages can listen to low-power Bluetooth broadcast messages sent by other low-power Bluetooth devices in a discoverable state.
[0114] The low-power Bluetooth scan command sent by the HOST to the low-power Bluetooth controller is the second command in this application.
[0115] Among them, the low-power Bluetooth device in the discoverable state can broadcast a low-power Bluetooth broadcast message to the outside at a fixed time. Exemplarily, the low-power Bluetooth broadcast message can be a low-power Bluetooth broadcast packet, such as a connectable undirected adv packet. For example, the connectable undirected adv packet can be: 40 23AB 5D DF 75AC F7 02 01 06 19 16 95FE 58 40 3B 02 66AB 5D DF 75AC F7ED D3 BB 0F DB 7DDC F1 49 33 74D5 EC 49.
[0116] After that, the electronic device can receive the low-power Bluetooth broadcast message broadcasted by the peer Bluetooth device in the discoverable state. Specifically, the low-power Bluetooth controller of the electronic device can monitor the low-power Bluetooth broadcast packet sent by the peer Bluetooth device, and then the low-power Bluetooth controller in the electronic device sends the received low-power Bluetooth broadcast packet to the HOST in the electronic device. At this point, the electronic device scans the peer Bluetooth device.
[0117] Optionally, after the electronic device receives the low-power Bluetooth broadcast message broadcast by the opposite Bluetooth device in the discoverable state, the electronic device can send a scan confirmation message to confirm whether the opposite Bluetooth device is the Bluetooth device that sent the low-power Bluetooth broadcast message. In this way, it can avoid the situation where the opposite Bluetooth device immediately shuts down, turns off the Bluetooth function, or the distance between the opposite Bluetooth device and the electronic device exceeds the preset connection distance after sending the low-power Bluetooth broadcast message, resulting in the electronic device being unable to continue to establish a connection with the opposite Bluetooth device.
[0118] In some examples, after a low-power Bluetooth controller in a state of monitoring low-power Bluetooth broadcast messages receives a low-power Bluetooth broadcast packet, it sends the low-power Bluetooth broadcast packet to the HOST, and then the HOST sends a scan confirmation command to the low-power Bluetooth controller so that the low-power Bluetooth controller can send a scan confirmation message to the opposite Bluetooth device. Exemplarily, the scan confirmation message sent by the low-power Bluetooth controller can be a scan request packet (scan request packet), for example, the scan request packet is: C3 0C 88 23CD 62 73 6B AB 5D DF75AC F7 E6 38 66. After receiving the scan confirmation message, the opposite Bluetooth device replies with a scan response message to the electronic device. Exemplarily, the opposite Bluetooth device replies with a scan response packet (scan response packet) to the electronic device based on the received scan request packet, for example, the scan response packet can be: 44 0A AB 5D DF75AC F7 03FF 8F 03 4F C9 EF.
[0119] In some embodiments, after scanning a Bluetooth device, the electronic device can confirm whether the Bluetooth device is a classic Bluetooth device or a low-power Bluetooth device according to the process of scanning the Bluetooth device. That is, during the process of scanning the Bluetooth device by the electronic device, the electronic device can confirm the Bluetooth type of the Bluetooth protocol supported by the scanned Bluetooth device according to the process of scanning the Bluetooth device.
[0120] In some examples, the electronic device can determine whether the Bluetooth device is a classic Bluetooth device or a low-power Bluetooth device based on the messages exchanged between the Bluetooth device and the electronic device during the process of scanning the Bluetooth device. Exemplarily, the electronic device scans device N and device P. In the process of scanning device N, the electronic device receives the inquiry feedback message sent by device N and confirms that device N has been scanned. Since the inquiry feedback message is an interactive message in the scanning mode of the classic Bluetooth device, the electronic device can confirm that device N is a classic Bluetooth device, that is, confirm that the Bluetooth type of the Bluetooth protocol supported by device N is classic Bluetooth. In the process of scanning device P, the electronic device receives the low-power Bluetooth broadcast message sent by device P and confirms that device P has been scanned. Since the low-power Bluetooth broadcast message is an interactive message in the scanning mode of the low-power Bluetooth device, the electronic device can confirm that device P is a low-power Bluetooth device, that is, confirm that the Bluetooth type of the Bluetooth protocol supported by device N is low-power Bluetooth.
[0121] In the above embodiment, the device N may be the first Bluetooth device in the present application, and the device P may be the second Bluetooth device in the present application.
[0122] S502: In response to the selection operation of the target Bluetooth device, a data connection channel is established with the target Bluetooth device.
[0123] In some embodiments, after the mobile phone scans the Bluetooth devices, the target Bluetooth device can be determined from the scanned Bluetooth devices. Figure 6 As shown, the mobile phone displays a Bluetooth device list in the display interface, and the Bluetooth device list includes the identifiers of all Bluetooth devices scanned by the mobile phone. Afterwards, in response to the user selecting an identifier of a Bluetooth device in the Bluetooth device list, the mobile phone can determine the Bluetooth device selected by the user as the target Bluetooth device. For example, Figure 6 As shown, if the user wants to use device N in the Bluetooth device list as a target Bluetooth device, the user can click the identifier of device N. In response to the user's operation on the identifier of device N, the electronic device can use device N as a target Bluetooth device.
[0124] In some embodiments, after the electronic device determines the target Bluetooth device, it can establish a data connection channel with the target Bluetooth device. Specifically, the electronic device can send a data connection channel establishment request to the target Bluetooth device, and after receiving the data connection channel establishment feedback sent by the target Bluetooth device, establish a data connection channel with the target Bluetooth device.
[0125] According to the relevant contents of the above embodiments, after scanning a Bluetooth device, the electronic device can determine the Bluetooth type of the Bluetooth protocol supported by the Bluetooth device, so the electronic device can also determine the Bluetooth type of the Bluetooth protocol supported by the target Bluetooth device selected by the user. Afterwards, the electronic device can send a request for establishing a data connection channel to the target Bluetooth device according to the Bluetooth type of the Bluetooth protocol supported by the target Bluetooth device.
[0126] In some examples, when the Bluetooth type of the Bluetooth protocol supported by the target Bluetooth device is classic Bluetooth, the specific implementation of the electronic device sending a data connection channel establishment request to the target Bluetooth device is as follows:
[0127] First, the electronic device sends a paging request message to the target Bluetooth device, and the paging request message is used to page the target Bluetooth device. Specifically, the paging request message can be data packet 1, and the data packet 1 includes the low address part (Low Address Part, LAP) of the target Bluetooth device to ensure that the target Bluetooth device can receive data packet 1. Generally, one Bluetooth device corresponds to one LAP, and different Bluetooth devices correspond to different LAPs.
[0128] After receiving the paging request message, the target Bluetooth device feeds back a paging response message to the electronic device. Specifically, the paging response message may be data packet 2, which includes the LAP of the electronic device to ensure that the electronic device can receive data packet 2. The electronic device receives data packet 2, indicating that the target Bluetooth device can establish a data connection channel with the electronic device.
[0129] Afterwards, the electronic device sends a classic Bluetooth connection channel establishment request message to the target Bluetooth device, where the classic Bluetooth connection channel establishment request message is used to request to establish a data connection channel with the target Bluetooth device. Specifically, the classic Bluetooth connection channel establishment request message can be an FHS packet, for example, the FHS packet is: 90 4A 03AA 8B D0 9D 45 11 12 94B5F0 68 0C02 5A 81 0D 43 01B5 81.
[0130] After receiving the classic Bluetooth connection channel establishment request message, the target Bluetooth device feeds back a classic Bluetooth connection channel establishment response message to the electronic device, and the classic Bluetooth connection channel establishment response message is used to indicate that the target Bluetooth device confirms to establish a data connection channel with the electronic device. Specifically, the classic Bluetooth connection channel establishment response message can be data packet 3.
[0131] At this point, the data connection channel between the electronic device and the target Bluetooth device supporting the Bluetooth protocol of classic Bluetooth is successfully established.
[0132] In the above embodiment, the HOST of the electronic device can send a connection establishment message to the classic Bluetooth controller to instruct the classic Bluetooth controller to send a data connection channel establishment request. Exemplarily, according to Table 1 of the above embodiment, the connection command used by the host of the classic Bluetooth is the HCI create connection command, and the controller connection mode of the classic Bluetooth is the paging mode. Then, when the Bluetooth type of the Bluetooth protocol supported by the target Bluetooth device is classic Bluetooth, the connection establishment message sent by the HOST of the electronic device to the classic Bluetooth controller is the HCI create connection command. After the classic Bluetooth controller receives the HCI create connection command, the data connection channel establishment request sent to the target Bluetooth device is a paging request message.
[0133] In the above embodiment, when the Bluetooth type of the Bluetooth protocol supported by the target Bluetooth device is classic Bluetooth, the data connection channel established between the electronic device and the target Bluetooth device is the first data connection channel in this application, and is also the target data connection channel in this application.
[0134] In some examples, when the Bluetooth type of the Bluetooth protocol supported by the target Bluetooth device is Bluetooth low energy, the specific implementation of the electronic device sending a data connection channel establishment request to the target Bluetooth device is as follows:
[0135] First, the electronic device sends a first low-power connection request message to the target Bluetooth device, and the first low-power connection request message is used to indicate that the electronic device is ready to establish a data connection channel with the target Bluetooth device. Exemplarily, the first low-power connection request message sent by the electronic device may include a transmission time, indicating that the electronic device will send the next message at the transmission time. Specifically, the first low-power connection request message can be a connection indication packet, for example, the connection indication packet can be:
[0136] C5 22 38 5F 21 0D E8 74AB 5D DF 75AC F7 C9 B4 85 84 9F CC 31 01
[0137] 16 00 18 00 00 00F4 01 03 08 00FE 1F B0 FA 67 24
[0138] Afterwards, the electronic device continues to send a second low-power connection request message to the target Bluetooth device, and the second low-power connection request message is used to indicate that the electronic device needs to exchange relevant parameters for establishing a data connection channel with the target Bluetooth device. Specifically, the second low-power connection request message can be a link layer control protocol feature exchange message (link layer control protocol feature exchange), and the link layer control protocol feature exchange message can include parameters for the electronic device to establish a data connection channel with the target Bluetooth device. For example, LLCP feature exchange can be: 03 0908FF F9 01F7 FF 00 00 00 4B1F 25.
[0139] After the target Bluetooth device receives the first low-power connection request message, it can prepare to receive the second low-power connection request message according to the first low-power connection request message. Afterwards, after the target Bluetooth device receives the second low-power connection request message, it can feedback a low-power connection response message to the electronic device, and the low-power connection response message is used to indicate that the target Bluetooth device agrees to establish a data connection channel with the electronic device. The low-power connection response message can be a link layer control protocol feature response (link layer control protocol feature respons), for example, LLCP feature respons can be: 0B 09 09 01 00 00 0000 00 00 00 25 86B5.
[0140] At this point, the data connection channel between the electronic device and the target Bluetooth device supporting the Bluetooth low energy protocol is successfully established.
[0141] In the above embodiment, the specific implementation of the electronic device sending the first low-power connection request message to the target Bluetooth device is: the HOST of the electronic device can send a connection establishment message to the low-power Bluetooth controller to instruct the low-power Bluetooth controller to send the first low-power connection request message. Exemplarily, according to Table 1 of the above embodiment, the connection command used by the host of the low-power Bluetooth is a low-power creation connection (LE create connection) command, and the controller connection method of the low-power Bluetooth is a method of sending a connection packet (CONNECT_IND). Then, in the case where the Bluetooth type of the Bluetooth protocol supported by the target Bluetooth device is low-power Bluetooth, the connection establishment message sent by the HOST of the electronic device to the low-power Bluetooth controller is the LE create connection command, and after the low-power Bluetooth controller receives the LE create connection command, the first low-power connection request message sent to the target Bluetooth device is CONNECT_IND.
[0142] In the above embodiment, when the Bluetooth type of the Bluetooth protocol supported by the target Bluetooth device is low-energy Bluetooth, the data connection channel established between the electronic device and the target Bluetooth device is the second data connection channel in this application, and is also the target data connection channel in this application.
[0143] After the data connection channel between the electronic device and the target Bluetooth device is successfully established, the electronic device may execute the following S503:
[0144] S503: Send a Bluetooth protocol version number confirmation request to the target Bluetooth device through the data connection channel, wherein the Bluetooth protocol version number confirmation request is related to the Bluetooth type of the Bluetooth protocol supported by the target Bluetooth device.
[0145] After a data connection channel is established between a classic Bluetooth device and an electronic device, the classic Bluetooth device will determine whether to continue communicating with the electronic device based on whether the version number of the Bluetooth protocol used by the electronic device is greater than the preset Bluetooth protocol version number. In the case where the version number of the Bluetooth protocol used by the electronic device is greater than the preset Bluetooth protocol version number, the classic Bluetooth device will not respond to any subsequent requests sent by the electronic device, which will cause the data connection channel between the electronic device and the classic Bluetooth device to be disconnected due to a long period of no data transmission. After a data connection channel is established between a low-power Bluetooth device and an electronic device, the low-power Bluetooth device will not determine whether to continue communicating with the electronic device based on the version number of the Bluetooth protocol used by the electronic device. In other words, the low-power Bluetooth device will respond to any request sent by the electronic device.
[0146] Based on the above reasons, when executing S503, the electronic device can send a Bluetooth protocol version number confirmation request related to the Bluetooth type of the Bluetooth protocol supported by the target Bluetooth device to the target Bluetooth device, so as to ensure that the target Bluetooth device can continue to respond to requests sent by subsequent electronic devices after receiving the Bluetooth protocol version number confirmation request, so as to ensure that the data connection channel is not disconnected.
[0147] In some embodiments, when the Bluetooth type of the Bluetooth protocol supported by the target Bluetooth device is classic Bluetooth, the Bluetooth protocol version number confirmation request sent by the electronic device to the target Bluetooth device includes a preset Bluetooth protocol version number. When the Bluetooth type of the Bluetooth protocol supported by the target Bluetooth device is low-power Bluetooth, the Bluetooth protocol version number confirmation request sent by the electronic device to the target Bluetooth device includes the Bluetooth version number of the Bluetooth protocol actually adopted by the electronic device.
[0148] The pre-set Bluetooth protocol version number may be determined during the development and testing process based on the preset Bluetooth protocol version numbers that all classic Bluetooth devices can respond to. Specifically, the lowest preset Bluetooth protocol version number may be determined from the preset Bluetooth protocol version numbers that all classic Bluetooth devices can respond to as the pre-set Bluetooth protocol version number.
[0149] For example, during the development and testing process, there are three classic Bluetooth devices, and the Bluetooth protocol versions that each classic Bluetooth device can respond to are 4.1, 4.3, and 5.0, respectively. Among them, 4.1 is the lowest preset Bluetooth protocol version number, so the electronic device can determine that 4.1 is the pre-set Bluetooth protocol version number. Then, when the Bluetooth type of the Bluetooth protocol supported by the target Bluetooth is classic Bluetooth, and the Bluetooth version number of the Bluetooth protocol actually used by the electronic device is 5.4, the Bluetooth protocol version number confirmation request sent by the electronic device to the target Bluetooth device includes the Bluetooth protocol version number 4.1.
[0150] For example, when the Bluetooth type of the Bluetooth protocol supported by the target Bluetooth device is low energy Bluetooth, and the Bluetooth version number of the Bluetooth protocol actually adopted by the electronic device is 5.4, the Bluetooth protocol version number confirmation request sent by the electronic device to the target Bluetooth device includes the Bluetooth protocol version number 5.4.
[0151] In the above embodiment, the electronic device sends a Bluetooth protocol version number confirmation request to the target Bluetooth device through the data connection channel, which is the target confirmation request in this application. When the Bluetooth type of the Bluetooth protocol supported by the target Bluetooth device is classic Bluetooth, the electronic device sends a Bluetooth protocol version number confirmation request to the target Bluetooth device through the data connection channel, which is the first confirmation request in this application; when the Bluetooth type of the Bluetooth protocol supported by the target Bluetooth device is low-power Bluetooth, the electronic device sends a Bluetooth protocol version number confirmation request to the target Bluetooth device through the data connection channel, which is the second confirmation request in this application. The first Bluetooth protocol version number in the first confirmation request is a pre-set Bluetooth protocol version number, and the second Bluetooth protocol version number in the second confirmation request is the Bluetooth protocol version number of the Bluetooth protocol supported by the electronic device.
[0152] S504: In response to receiving a Bluetooth protocol version number confirmation feedback sent by the target Bluetooth device, sending a Bluetooth protocol negotiation request for transmitting media data to the target Bluetooth device.
[0153] S505: In response to receiving the Bluetooth protocol negotiation response sent by the target Bluetooth device, transmit the media data to the target Bluetooth device through the data connection channel.
[0154] In some embodiments, after the electronic device receives the Bluetooth protocol version number confirmation feedback sent by the target Bluetooth device, the electronic device and the target Bluetooth device can also negotiate the Bluetooth protocol used to transmit media data through the data connection channel to ensure that media data can be transmitted normally between the electronic device and the target Bluetooth device.
[0155] Among them, media data refers to the files, pictures, videos, audio and control instructions that the user wants to transfer.
[0156] In some examples, the electronic device determines a lower Bluetooth version number between a Bluetooth version number of a Bluetooth protocol adopted by the electronic device and a Bluetooth version number of a Bluetooth protocol adopted by a target Bluetooth device, and uses the Bluetooth protocol corresponding to the lower Bluetooth version number as the Bluetooth protocol for transmitting media data.
[0157] Exemplarily, the Bluetooth version number of the Bluetooth protocol actually adopted by the electronic device is 5.4, and the Bluetooth version number confirmation feedback received by the electronic device from the target Bluetooth device includes the Bluetooth version number 4.2 of the Bluetooth protocol adopted by the target Bluetooth device. Then, the electronic device can send a Bluetooth protocol negotiation request message to the target Bluetooth device, and the Bluetooth version number of the Bluetooth protocol included in the Bluetooth protocol negotiation request message is 4.2. Afterwards, after receiving the Bluetooth protocol negotiation request message, the target Bluetooth device can send a Bluetooth protocol negotiation response to the electronic device, and the Bluetooth version number of the Bluetooth protocol included in the Bluetooth protocol negotiation response is 4.2, indicating that the target Bluetooth device agrees to use the Bluetooth protocol with Bluetooth version number 4.2 to transmit media data between the target Bluetooth device and the electronic device.
[0158] At this point, the electronic device and the target Bluetooth device can transmit media data through the data connection channel. Figure 6 As shown, in the case where media data can be transmitted between the electronic device and the device N through the data connection channel, in the interface displayed by the electronic device, the identifier of the device N corresponds to the connected identifier.
[0159] It can be understood that the Bluetooth protocol version number included in the Bluetooth protocol version number confirmation request sent by the electronic device to the target Bluetooth device and the Bluetooth protocol version number included in the Bluetooth protocol negotiation request message sent by the electronic device to the target Bluetooth device are unrelated. Specifically, the Bluetooth protocol version number included in the Bluetooth protocol version number confirmation request is related to the Bluetooth type of the target Bluetooth device, while the Bluetooth protocol version number included in the Bluetooth protocol negotiation request message is the lower Bluetooth version number of the Bluetooth protocol adopted by the electronic device and the Bluetooth protocol version number of the Bluetooth protocol adopted by the target Bluetooth device.
[0160] The following, combined Figure 7 This section introduces a classic Bluetooth connection method.
[0161] Figure 7 A schematic diagram of a Bluetooth connection interaction provided in an embodiment of the present application Figure 2 , device M can scan the classic Bluetooth device N, and, when selecting device N as the target Bluetooth device, can establish a Bluetooth connection with device N and transmit media data.
[0162] Device M is a dual-mode Bluetooth device, and device N is a classic Bluetooth device. After device M turns on the Bluetooth function, Figure 7 As shown, device M sends an inquiry request message to the outside to scan for Bluetooth devices in a discoverable state. After the inquiry request message sent by device M is received by device N, device N feeds back an inquiry response message to device M. After device M receives the inquiry response message sent by device N, it can confirm that device N is the scanned Bluetooth device.
[0163] In the above process, since the inquiry response message is a scan confirmation message in the classic Bluetooth scanning Bluetooth device process, the device M can determine that the device N is a classic Bluetooth device.
[0164] After device M scans device N, in response to the user selecting device N as the target Bluetooth device, device M can send a data connection channel establishment request message to device N. Device N receives the data connection channel establishment request message sent by device M and sends a data connection channel establishment response message to device M. At this point, the data connection channel between device M and device N is successfully established.
[0165] Through the data connection channel, device M can send a Bluetooth protocol version number confirmation request to device N. Since device N is a classic Bluetooth device, the Bluetooth protocol version number confirmation request sent by device M to device N includes a preset Bluetooth protocol version number. Exemplarily, when the Bluetooth protocol version number confirmation request sent by device M to device N includes a preset Bluetooth protocol version number of 4.2, device N determines that the Bluetooth version number 4.2 in the Bluetooth protocol version number confirmation request is less than the preset Bluetooth protocol version number 4.3, then device N can respond to any request sent by device M, that is, device N can feedback the Bluetooth protocol version number confirmation feedback to device M. In some examples, the Bluetooth protocol version number confirmation feedback fed back by device N to device M includes the Bluetooth version number of the Bluetooth protocol actually adopted by device N.
[0166] After device M receives the Bluetooth protocol version number confirmation feedback fed back by device N, device M may send a Bluetooth protocol negotiation request to device N to determine the Bluetooth protocol used to transmit media data with device N. In some examples, device M may determine the Bluetooth version number of the Bluetooth protocol in the Bluetooth protocol negotiation request based on the Bluetooth version number of the Bluetooth protocol actually adopted by device M and the Bluetooth version number of the Bluetooth protocol actually adopted by device N.
[0167] After receiving the Bluetooth protocol negotiation request, device N may send a Bluetooth protocol negotiation response to device M, so that device M and device N may transmit media data through the data connection channel.
[0168] In the above embodiment, the device N may be the first Bluetooth device in this application.
[0169] The following, combined Figure 8 This article introduces a low-power Bluetooth connection method.
[0170] Figure 8 A schematic diagram of a Bluetooth connection interaction provided in an embodiment of the present application Figure 3, device M can scan the low-power Bluetooth device P, and, when device P is selected as the target Bluetooth device, a Bluetooth connection can be established with device P and media data can be transmitted.
[0171] Device M is a dual-mode Bluetooth device, and device P is a low-power Bluetooth device. After device M turns on the Bluetooth function, Figure 8 As shown, device M is in a low-power scanning state to receive a low-power Bluetooth broadcast message sent by a Bluetooth device in a discoverable state. After device M receives a low-power Bluetooth broadcast message sent by device P, device M can confirm that device P is a scanned Bluetooth device.
[0172] In the above process, since the low-power Bluetooth broadcast message is a scan confirmation message in the process of the low-power Bluetooth device scanning Bluetooth devices, the device M can determine that the device P is a low-power Bluetooth device.
[0173] After device M scans device P, device M can send a data connection channel establishment request message to device P in response to the user selecting device P as the target Bluetooth device. Device P receives the data connection channel establishment request message sent by device M and sends a data connection channel establishment response message to device M. At this point, the data connection channel between device M and device P is successfully established.
[0174] Through the data connection channel, device M can send a Bluetooth protocol version number confirmation request to device P. Since device P is a low-power Bluetooth device, the Bluetooth protocol version number confirmation request sent by device M to device P includes the Bluetooth protocol version number of the Bluetooth protocol actually adopted by device M. Exemplarily, when the Bluetooth protocol version number confirmation request sent by device M to device P includes the Bluetooth protocol version number of 5.4 of the Bluetooth protocol actually adopted by device M, device P can feed back Bluetooth protocol version number confirmation feedback to device M. In some examples, the Bluetooth protocol version number confirmation feedback fed back by device P to device M includes the Bluetooth version number of the Bluetooth protocol actually adopted by device P.
[0175] After device M receives the Bluetooth protocol version number confirmation feedback fed back by device P, device M may send a Bluetooth protocol negotiation request to device P to determine the Bluetooth protocol used to transmit media data with device P. In some examples, device M may determine the Bluetooth version number of the Bluetooth protocol in the Bluetooth protocol negotiation request based on the Bluetooth version number of the Bluetooth protocol actually adopted by device M and the Bluetooth version number of the Bluetooth protocol actually adopted by device P.
[0176] After receiving the Bluetooth protocol negotiation request, device P may send a Bluetooth protocol negotiation response to device M, so that device M and device P can transmit media data through the data connection channel.
[0177] In the above embodiment, the device P may be the second Bluetooth device in this application.
[0178] In the above embodiment, Figure 7 Only one classic Bluetooth connection process is introduced. Figure 8 Only one low-power Bluetooth connection process is introduced. Since device M is a dual-mode Bluetooth, in response to the operation of turning on the Bluetooth function, device M is still in a low-power scanning state when broadcasting an inquiry request message to the outside. Afterwards, when device M receives an inquiry response message sent by device M, device M regards device N as a scanned Bluetooth device. When device M receives a low-power Bluetooth broadcast message sent by device P, device M regards device P as a scanned Bluetooth device.
[0179] In response to the operation of selecting the target Bluetooth device, device M may send a data connection channel establishment request message to the target Bluetooth device. The specific content of the data connection channel establishment request message sent by device M is related to the Bluetooth type of the target Bluetooth device, which can be seen in the above embodiment and will not be repeated here. In other words, regardless of the Bluetooth type of Bluetooth devices N and P are, device M sends a data connection channel establishment request message to the target Bluetooth device.
[0180] After device M establishes a data connection channel with the target Bluetooth device, device M will send a Bluetooth protocol version number confirmation request to the target Bluetooth device. The specific content and form of the Bluetooth protocol version number confirmation request are related to the Bluetooth type of the target Bluetooth device, which can be seen in the above embodiment and will not be repeated here. In other words, regardless of the Bluetooth type of Bluetooth devices N and P are, device M sends a Bluetooth protocol version number confirmation request to the target Bluetooth device.
[0181] After device M receives the Bluetooth protocol version number confirmation feedback sent by the target Bluetooth device, device M can send a Bluetooth protocol negotiation request to the target Bluetooth device, and after receiving the Bluetooth protocol negotiation response sent by the target Bluetooth device, the Bluetooth protocol in the Bluetooth protocol negotiation request and response can be used to transmit media data. In other words, regardless of the Bluetooth type of device N and device P, device M sends a Bluetooth protocol negotiation request to the target Bluetooth device.
[0182] An embodiment of the present application also provides a computer-readable storage medium, which includes computer instructions. When the computer instructions are executed on the above-mentioned electronic device, the electronic device executes each function or step in the above-mentioned method embodiment.
[0183] The embodiment of the present application also provides a computer program product, including a computer program. When the computer program runs on an electronic device, the electronic device executes each function or step in the above method embodiment.
[0184] Through the description of the above implementation methods, technical personnel in the relevant field can clearly understand that for the convenience and simplicity of description, only the division of the above-mentioned functional modules is used as an example. In actual applications, the above-mentioned functions can be assigned to different functional modules as needed, that is, the internal structure of the device can be divided into different functional modules to complete all or part of the functions described above.
[0185] In the several embodiments provided in the present application, it should be understood that the disclosed devices and methods can be implemented in other ways. For example, the device embodiments described above are only schematic. For example, the division of the modules or units is only a logical function division. There may be other division methods in actual implementation, such as multiple units or components can be combined or integrated into another device, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be through some interfaces, indirect coupling or communication connection of devices or units, which can be electrical, mechanical or other forms.
[0186] The units described as separate components may or may not be physically separated, and the components shown as units may be one physical unit or multiple physical units, that is, they may be located in one place or distributed in multiple different places. Some or all of the units may be selected according to actual needs to achieve the purpose of the present embodiment.
[0187] In addition, each functional unit in each embodiment of the present application may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit. The above-mentioned integrated unit may be implemented in the form of hardware or in the form of software functional units.
[0188] If the integrated unit is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a readable storage medium. Based on this understanding, the technical solution of the embodiment of the present application is essentially or the part that contributes to the prior art or all or part of the technical solution can be embodied in the form of a software product, which is stored in a storage medium, including several instructions to enable a device (which can be a single-chip microcomputer, chip, etc.) or a processor (processor) to perform all or part of the steps of the method described in each embodiment of the present application. The aforementioned storage medium includes: U disk, mobile hard disk, read only memory (ROM), random access memory (RAM), disk or optical disk and other media that can store program code.
[0189] The above contents are only specific implementation methods of the present application, but the protection scope of the present application is not limited thereto. Any changes or substitutions within the technical scope disclosed in the present application shall be included in the protection scope of the present application. Therefore, the protection scope of the present application shall be subject to the protection scope of the claims.
Claims
1. A Bluetooth connection method, characterized in that: Applied to electronic equipment, the method comprises: In response to the operation of turning on the Bluetooth function, broadcasting an inquiry request message and entering a scanning state; receiving an inquiry response message from a first Bluetooth device; In response to the operation of selecting the first Bluetooth device, establishing a first data connection channel with the first Bluetooth device; sending a first confirmation request to the first Bluetooth device through the first data connection channel, wherein the first confirmation request includes a first Bluetooth protocol version number, the first Bluetooth protocol version number is a preset Bluetooth protocol version number, and the preset Bluetooth protocol version number is less than the version number of the Bluetooth protocol supported by the electronic device; the first confirmation request is used to request the first Bluetooth device to confirm the Bluetooth protocol version number of the electronic device; A Bluetooth protocol for transmitting media data is negotiated with the first Bluetooth device to transmit the media data through the first data connection channel.
2. The method according to claim 1, characterized in that The method further comprises: receiving a low power Bluetooth broadcast message from a second Bluetooth device; In response to the operation of selecting the second Bluetooth device, establishing a second data connection channel with the second Bluetooth device; sending a second confirmation request to the second Bluetooth device through the second data connection channel, wherein the second confirmation request includes a second Bluetooth protocol version number, the second Bluetooth protocol version number is a Bluetooth protocol version number of the Bluetooth protocol supported by the electronic device, and the second confirmation request is used to request the second Bluetooth device to confirm the Bluetooth protocol version number of the electronic device; A Bluetooth protocol for transmitting media data is negotiated with the second Bluetooth device to transmit the media data through the second data connection channel.
3. The method according to claim 1 or 2, characterized in that: The electronic device comprises a host, a classic Bluetooth controller and a low-power Bluetooth controller; In response to the operation of turning on the Bluetooth function, a query request message is broadcasted and a scanning state is entered, including: In response to an operation of turning on the Bluetooth function, the host sends a first command to the classic Bluetooth controller and sends a second command to the low-power Bluetooth controller; In response to the first command, the classic Bluetooth controller broadcasts the inquiry request message; In response to the second command, the Bluetooth low energy controller enters the scanning state.
4. A Bluetooth connection method, characterized in that: Applied to electronic equipment, the method comprises: In response to an operation of turning on the Bluetooth function, scanning for a discoverable Bluetooth device; In response to an operation on a target Bluetooth device among the scanned Bluetooth devices, establishing a data connection channel with the target Bluetooth device; Sending a confirmation request to the target Bluetooth device through the data connection channel, wherein the confirmation request includes a target Bluetooth protocol version number, and the target Bluetooth protocol version number is related to the protocol type of the Bluetooth protocol of the target Bluetooth device; the confirmation request is used to request the target Bluetooth device to confirm the Bluetooth protocol version number of the electronic device; A Bluetooth protocol for transmitting media data is negotiated with the target Bluetooth device to transmit the media data through the data connection channel.
5. The method according to claim 4, characterized in that When the protocol type of the Bluetooth protocol of the target Bluetooth device is classic Bluetooth, the target Bluetooth protocol version number is a preset Bluetooth protocol version number; In a case where the protocol type of the Bluetooth protocol of the target Bluetooth device is Bluetooth low energy consumption, the target Bluetooth protocol version number is the Bluetooth protocol version number of the Bluetooth protocol of the electronic device.
6. The method according to claim 4 or 5, characterized in that: Before sending a confirmation request to the target Bluetooth device through the data connection channel, the method further includes: Based on the manner in which the target Bluetooth device is scanned, a protocol type of a Bluetooth protocol of the target Bluetooth device is determined.
7. The method according to claim 6, characterized in that The scanning of the Bluetooth device in a discoverable state includes: Broadcast inquiry request message and enter scanning state; The determining the protocol type of the Bluetooth protocol of the target Bluetooth device based on the manner in which the target Bluetooth device is scanned includes: If the inquiry response message sent by the target Bluetooth device is received, determining that the protocol type of the Bluetooth protocol of the target Bluetooth device is classic Bluetooth; If a low-power Bluetooth broadcast message sent by the target Bluetooth device is received, it is determined that the protocol type of the Bluetooth protocol of the target Bluetooth device is low-power Bluetooth.
8. An electronic device, characterized in that: The electronic device includes a Bluetooth module, a memory and one or more processors; the Bluetooth module, the memory and the processor are coupled; the memory is used to store computer program code, and the computer program code includes computer instructions; when the processor executes the computer instructions, the electronic device executes the method as described in any one of claims 1-3, or 4-7.
9. A computer-readable storage medium, characterized in that: The method comprises computer instructions, which, when executed on an electronic device, cause the electronic device to execute the method as claimed in any one of claims 1-3 or 4-7.
10. A computer program product comprising a computer program / instructions, characterized in that When the computer program / instructions are executed by a processor, the electronic device is caused to perform the method as described in any one of claims 1-3 or 4-7.
Citation Information
Patent Citations
Bluetooth connection control method, electronic device and computer readable storage medium
CN109495871A
Communication method and related device
CN117641256A
Adaptive data transfer using bluetooth
US20140273858A1
Bluetooth system integration module
US20160150352A1
Bluetooth connection method and device
WO2019114303A1
Cited By
Distributed multi-core ad hoc network method
CN120529283A
A distributed multi-core ad hoc network method
CN120529283B