Bluetooth connection establishment method and device, electronic equipment and storage medium
By sending Bluetooth pairing requests and receiving EIR data, we determine the SDP version number and obtaining application specification profiles from the preset files, it solves the problem of cumbersome Bluetooth connection establishment operations and improves the efficiency of Bluetooth connection establishment.
Patent Information
- Application Number
- CN202311001914.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2023-08-09
- Publication Date
- 2025-02-18
AI Technical Summary
In the prior art, the operation of establishing Bluetooth connections between Bluetooth devices is cumbersome, resulting in low efficiency in establishing Bluetooth connections.
The Service Discovery Protocol SDP version number supported by the second Bluetooth device is determined by sending a Bluetooth pairing request to the second Bluetooth device to be connected and receiving its returned extended query response EIR data. When it is determined that the second Bluetooth device is a preset device, an application specification profile associated with the SDP version number and device identification is obtained from the preset file, and a Bluetooth connection is established with the second Bluetooth device based on the profile.
The establishment operation of Bluetooth connection is simplified, and the establishment efficiency of Bluetooth connection is improved, so that the preset file is more convenient to obtain information for establishing a Bluetooth connection with the second Bluetooth device.
Smart Images

Figure CN119485582A_ABST
Abstract
Description
Technical Field
[0001] The present disclosure relates to the technical field of Bluetooth communication, and in particular to a method, device, electronic device and storage medium for establishing a Bluetooth connection. Background Art
[0002] Bluetooth is one of the most widely used wireless communication protocols currently, mainly for short-distance communication. Its advantages are low power consumption and relatively fast transmission speed. Bluetooth connection refers to the wireless communication link established between two or more Bluetooth devices. Through Bluetooth connection, different Bluetooth devices can transmit and communicate data within a short distance.
[0003] In the related art, it is necessary to first obtain the application profile information supported by the Bluetooth device through a complete Service Discovery Protocol (SDP) process in order to establish a connection between different Bluetooth devices.
[0004] In this manner, the operation of establishing a Bluetooth connection between Bluetooth devices is relatively complicated, which results in a low efficiency in establishing the Bluetooth connection. Summary of the invention
[0005] The present disclosure proposes a method, device, electronic device, storage medium and computer program product for establishing a Bluetooth connection, aiming to solve the technical problems in the related art at least to a certain extent.
[0006] An embodiment of the first aspect of the present disclosure proposes a method for establishing a Bluetooth connection, which is executed by a first Bluetooth device, and includes: sending a Bluetooth pairing request to a second Bluetooth device to be connected; receiving extended query response EIR data returned by the second Bluetooth device, wherein the EIR data includes a first service discovery protocol SDP version number supported by the second Bluetooth device; when it is determined that the second Bluetooth device is a preset device, obtaining a first application specification profile associated with the first SDP version number and an identifier of the second Bluetooth device from a preset file; and establishing a Bluetooth connection with the second Bluetooth device based on the first profile.
[0007] An embodiment of the second aspect of the present disclosure proposes a method for establishing a Bluetooth connection, which is executed by a second Bluetooth device, and includes: receiving a Bluetooth pairing request sent by a first Bluetooth device; sending an extended query response EIR data to the first Bluetooth device, wherein the EIR data includes a first service discovery protocol SDP version number supported by the second Bluetooth device; and establishing a Bluetooth connection with the first Bluetooth device based on a first application specification profile associated with the first SDP version number when no SDP search request sent by the first Bluetooth device is received.
[0008] An embodiment of the third aspect of the present disclosure proposes a device for establishing a Bluetooth connection, including: a first sending module, used to send a Bluetooth pairing request to a second Bluetooth device to be connected; a first receiving module, used to receive an extended query response EIR data returned by the second Bluetooth device, wherein the EIR data includes a first service discovery protocol SDP version number supported by the second Bluetooth device; an acquisition module, used to obtain a first application specification profile associated with the first SDP version number and an identifier of the second Bluetooth device from a preset file when it is determined that the second Bluetooth device is a preset device; and a first establishment module, used to establish a Bluetooth connection with the second Bluetooth device based on the first profile.
[0009] An embodiment of the fourth aspect of the present disclosure proposes a device for establishing a Bluetooth connection, including: a second receiving module, used to receive a Bluetooth pairing request sent by a first Bluetooth device; a second sending module, used to send an extended query response EIR data to the first Bluetooth device, wherein the EIR data includes a first service discovery protocol SDP version number supported by the second Bluetooth device; and a second establishing module, used to establish a Bluetooth connection with the first Bluetooth device based on a first application specification profile associated with the first SDP version number when an SDP search request sent by the first Bluetooth device is not received.
[0010] The fifth aspect of the present disclosure proposes an electronic device, comprising: a processor; a memory for storing instructions executable by the processor; wherein the processor is configured to execute the instructions to implement a method for establishing a Bluetooth connection.
[0011] The sixth aspect embodiment of the present disclosure proposes a computer-readable storage medium. When the instructions in the computer-readable storage medium are executed by the processor of the electronic device, the electronic device can execute a method for establishing a Bluetooth connection.
[0012] The seventh aspect embodiment of the present disclosure proposes a computer program product, including a computer program, characterized in that the computer program is executed by a processor to establish a Bluetooth connection.
[0013] The method, device, electronic device, storage medium and computer program product for establishing a Bluetooth connection proposed in this embodiment have at least the following beneficial effects: the first Bluetooth device sends a Bluetooth pairing request to the second Bluetooth device to be connected, and receives the extended query response EIR data returned by the second Bluetooth device, wherein the EIR data includes the first service discovery protocol SDP version number supported by the second Bluetooth device. When it is determined that the second Bluetooth device is a preset device, the first application specification profile associated with the first SDP version number and the identifier of the second Bluetooth device is obtained from a preset file, and a Bluetooth connection is established with the second Bluetooth device based on the first profile, so that the information for establishing a Bluetooth connection with the second Bluetooth device can be more conveniently obtained based on the preset file, thereby simplifying the operation of establishing a Bluetooth connection and effectively improving the efficiency of establishing a Bluetooth connection. Furthermore, the technical problem that the operation of establishing a Bluetooth connection between Bluetooth devices is cumbersome, resulting in low efficiency in establishing a Bluetooth connection, which exists in the prior art, is solved.
[0014] Additional aspects and advantages of the present disclosure will be given in part in the following description and in part will be obvious from the following description or learned through practice of the present disclosure. BRIEF DESCRIPTION OF THE DRAWINGS
[0015] The above and / or additional aspects and advantages of the present disclosure will become apparent and easily understood from the following description of the embodiments in conjunction with the accompanying drawings, in which:
[0016] Figure 1 is a flowchart of a method for establishing a Bluetooth connection according to the first embodiment of the present disclosure;
[0017] Figure 2 is a flowchart of a method for establishing a Bluetooth connection according to a second embodiment of the present disclosure;
[0018] Figure 3 is a flowchart of a method for establishing a Bluetooth connection according to a third embodiment of the present disclosure;
[0019] Figure 4 is a flowchart of a method for establishing a Bluetooth connection according to a fourth embodiment of the present disclosure;
[0020] Figure 5 is a block diagram of a device for establishing a Bluetooth connection according to the present disclosure;
[0021] Figure 6 is a block diagram of another device for establishing a Bluetooth connection according to the present disclosure;
[0022] Figure 7 A block diagram of an exemplary electronic device suitable for implementing embodiments of the present disclosure is shown. DETAILED DESCRIPTION
[0023] Embodiments of the present disclosure are described in detail below, and examples of the embodiments are shown in the accompanying drawings, wherein the same or similar reference numerals throughout represent the same or similar elements or elements having the same or similar functions. The embodiments described below with reference to the accompanying drawings are exemplary and are only used to explain the present disclosure, and are not to be construed as limitations of the present disclosure. On the contrary, the embodiments of the present disclosure include all changes, modifications, and equivalents that fall within the spirit and connotation of the appended claims.
[0024] It should be noted that the executor of the method for establishing a Bluetooth connection in this embodiment may be a device for establishing a Bluetooth connection, which may be implemented by software and / or hardware, and which may be configured in an electronic device, which may include but is not limited to a terminal, a server, etc.
[0025] It should be noted that the process of obtaining, storing, using, and processing information in the disclosed technical solution complies with the relevant provisions of national laws and regulations and does not violate public order and good morals.
[0026] Figure 1 is a flow chart of a method for establishing a Bluetooth connection according to the first embodiment of the present disclosure, such as Figure 1 As shown, the method includes:
[0027] S101: Sending a Bluetooth pairing request to a second Bluetooth device to be connected.
[0028] The Bluetooth connection establishment method of the disclosed embodiment is executed by a first Bluetooth device. The first Bluetooth device can be any electronic device with Bluetooth communication function, such as a mobile phone, a tablet computer, or a computer. In order to facilitate the specific description of the Bluetooth connection establishment method of the disclosed embodiment, the disclosed embodiment will take the first Bluetooth device being a mobile phone as an example to specifically explain the disclosed embodiment without limiting this.
[0029] The method for establishing a Bluetooth connection described in the embodiment of the present disclosure can be used to establish a Bluetooth connection between a first Bluetooth device and a second Bluetooth device. The second Bluetooth device can be any electronic device with Bluetooth communication function, such as a Bluetooth headset, a Bluetooth speaker, etc. In order to facilitate the specific description of the method for establishing a Bluetooth connection in the embodiment of the present disclosure, the embodiment of the present disclosure will take the second Bluetooth device being a Bluetooth headset as an example to specifically explain the embodiment of the present disclosure, without limiting this.
[0030] When the first Bluetooth device attempts to perform Bluetooth pairing with the second Bluetooth device, the first Bluetooth device will generate and send a Bluetooth pairing request to the second Bluetooth device.
[0031] S102: Receive extended inquiry response EIR data returned by the second Bluetooth device, wherein the EIR data includes a first service discovery protocol SDP version number supported by the second Bluetooth device.
[0032] Among them, Extended Inquiry Response (EIR) data refers to the data broadcast by a Bluetooth device when a pairing request is made. When a Bluetooth device is detectable or discoverable by other devices, it will periodically broadcast its EIR data so that other Bluetooth devices can detect it and pair or communicate with it.
[0033] In the disclosed embodiment, after receiving the Bluetooth pairing request sent by the first device, the second Bluetooth device may broadcast its own EIR data to the first device, so that the first Bluetooth device can obtain the EIR data broadcast by the second Bluetooth device.
[0034] Among them, the Service Discovery Protocol (SDP) is a protocol used to discover and describe services between Bluetooth devices. The EIR data includes the Service Discovery Protocol SDP version number supported by the second Bluetooth device. The first SDP version number can be used to identify the SDP version supported by the second Bluetooth device.
[0035] That is to say, in the embodiment of the present disclosure, the first Bluetooth device may receive the EIR data returned by the second device based on the Bluetooth pairing request, and then, may parse the EIR data to obtain the first SDP version number supported by the second Bluetooth device, and then, may trigger the execution of a subsequent Bluetooth connection establishment method based on the first SDP version number. For details, please refer to the subsequent embodiments and will not be repeated here.
[0036] S103: When it is determined that the second Bluetooth device is a preset device, a first application specification profile associated with the first SDP version number and the identifier of the second Bluetooth device is obtained from a preset file.
[0037] Among them, the Bluetooth device of a certain device type supported by the first Bluetooth device that is pre-configured in the first Bluetooth device, or the Bluetooth device can be called a preset device. The preset device can be a Bluetooth device that has previously established a Bluetooth connection with the first Bluetooth device, or can be a Bluetooth device that has not previously established a Bluetooth connection with the first Bluetooth device, and there is no restriction on this.
[0038] The file pre-configured in the first Bluetooth device and containing information such as the preset devices supported for connection and the different application specifications (profiles) supported by the first Bluetooth device is the preset file.
[0039] The identifier of the second Bluetooth device may be used to identify a unique Bluetooth device, and the identifier may be, for example, a device serial number, a device name, etc., which is not limited.
[0040] Among them, different Profiles cover Bluetooth protocols and features related to specific functions and specifications, such as phone calls, audio playback, etc. Different Bluetooth devices need to support corresponding profiles to establish a Bluetooth connection. When establishing a Bluetooth connection, Profile matching will be performed between Bluetooth devices to determine whether the Bluetooth devices can communicate and exchange data with each other.
[0041] That is to say, in the embodiment of the present disclosure, the first Bluetooth device can pre-configure a preset file containing a Bluetooth device of a certain device type that it supports connecting, or preset device information of the Bluetooth device, and information such as different application specification profiles, and then, when receiving the extended query response EIR data returned by the second Bluetooth device, the identifier of the second Bluetooth device can be determined. Then, when the preset file contains the identifier of the second Bluetooth device, the second Bluetooth device can be determined to be the preset device, and when it is determined that the second Bluetooth device is the preset device, the first application specification profile associated with the first SDP version number and the identifier of the second Bluetooth device can be queried from the preset file.
[0042] In an embodiment of the present disclosure, querying a first application specification profile associated with a first SDP version number and an identifier of a second Bluetooth device from a preset file may be querying a service universally unique identifier (Universally Unique Identifier, UUID) associated with a first SDP version number and an identifier of a second Bluetooth device from a preset file, and the service UUID may be used to identify the corresponding first profile.
[0043] It should be noted that SDP with different version numbers can support different profiles, so the corresponding Profile can be determined according to the SDP version number, thereby ensuring compatibility between Bluetooth devices during connection and communication, and being able to correctly understand and process each other's service functions and characteristics. Accordingly, different Bluetooth devices may have different functions and application scenarios, so the corresponding Profile can be determined according to the Bluetooth device identifier, ensuring that Bluetooth devices can know the functions supported by each other when establishing a Bluetooth connection, and select the appropriate specifications for communication.
[0044] Therefore, in the embodiment of the present disclosure, the profile corresponding to the first SDP version number can be queried from a preset file, and then, the first application specification profile corresponding to the identifier of the second Bluetooth device can be determined from the profile corresponding to the first SDP version number based on the identifier of the second Bluetooth device, thereby ensuring that the first Bluetooth device and the second Bluetooth device can communicate normally and securely and interact according to the expected functions.
[0045] S104: Establishing a Bluetooth connection with a second Bluetooth device based on the first profile.
[0046] In the embodiment of the present disclosure, after the first Bluetooth device obtains the first application specification profile associated with the first SDP version number and the identifier of the second Bluetooth device from a preset file, the first Bluetooth device can establish a Bluetooth connection with the second Bluetooth device based on the first profile, so that the first Bluetooth device and the second Bluetooth device can communicate with each other and exchange data based on the commonly supported first profile.
[0047] In the disclosed embodiment, the first Bluetooth device sends a Bluetooth pairing request to the second Bluetooth device to be connected, and receives an extended query response EIR data returned by the second Bluetooth device, wherein the EIR data includes a first service discovery protocol SDP version number supported by the second Bluetooth device. When it is determined that the second Bluetooth device is a preset device, a first application specification profile associated with the first SDP version number and an identifier of the second Bluetooth device is obtained from a preset file, and a Bluetooth connection is established with the second Bluetooth device based on the first profile, so that information for establishing a Bluetooth connection with the second Bluetooth device can be more conveniently obtained based on the preset file, thereby simplifying the operation of establishing a Bluetooth connection and effectively improving the efficiency of establishing a Bluetooth connection.
[0048] Figure 2 is a flow chart of a method for establishing a Bluetooth connection according to a second embodiment of the present disclosure, such as Figure 2 As shown, the method includes:
[0049] S201: Sending a Bluetooth pairing request to a second Bluetooth device to be connected.
[0050] S202: Receive extended inquiry response EIR data returned by the second Bluetooth device, wherein the EIR data includes a first service discovery protocol SDP version number supported by the second Bluetooth device.
[0051] The specific description of S201 - S202 can be found in the above embodiment, which will not be repeated here.
[0052] S203: Determine whether the second Bluetooth device supports the SDP-free search function based on the first information in the EIR data.
[0053] The SDP-free search function refers to a function in which the second Bluetooth device can search and obtain service information provided by the Bluetooth device without using SDP when establishing a Bluetooth connection.
[0054] Among them, the first information refers to part of the information in the EIR data used to describe whether the second Bluetooth device supports the SDP-free search function. The first information can be, for example, the device specifications, device manuals, developer documents, etc. of the second Bluetooth device, and there is no limitation on this.
[0055] That is to say, in the embodiment of the present disclosure, after receiving the EIR data returned by the second Bluetooth device, the first Bluetooth device may determine the first information in the EIR data, and determine whether the second Bluetooth device supports the SDP-free search function based on the recorded content in the first information.
[0056] S204: When the second Bluetooth device supports the SDP-free search function, determine whether the identifier of the second Bluetooth device matches any device identifier in the preset list.
[0057] The preset list of the first Bluetooth device may include multiple Bluetooth devices, and the multiple Bluetooth devices in the preset list may be preset Bluetooth devices that support establishing a Bluetooth connection with the first Bluetooth device.
[0058] Each Bluetooth device may have a corresponding unique device identifier, and the device identifier may specifically be, for example, a device serial number, a device name, etc., without limitation.
[0059] That is to say, in the embodiment of the present disclosure, when it is determined that the second Bluetooth device supports the SDP-free search function, the identifier of the second Bluetooth device may be compared with each device identifier in the preset list in turn, and when it is determined that the identifier of the second Bluetooth device is the same as any device identifier in the preset list, it is determined that the identifier of the second Bluetooth device matches the device identifier, and when the identifier of the second Bluetooth device is different from each device identifier, it is determined that the identifier of the second Bluetooth device does not match any device identifier.
[0060] S205: When the identifier of the second Bluetooth device matches any device identifier, determine that the second Bluetooth device is a preset device.
[0061] The embodiment of the present disclosure can determine that the second Bluetooth device is a preset device when it is determined that the identifier of the second Bluetooth device matches any device identifier, so that the first Bluetooth device can accurately determine whether the second Bluetooth device is a preset device based on the matching result between the device identifier of the second Bluetooth device and the device identifier.
[0062] S206: When it is determined that the second Bluetooth device is a preset device, obtain a first application specification profile associated with the first SDP version number and the identifier of the second Bluetooth device from a preset file.
[0063] The specific description of S206 can be found in the above embodiment, which will not be repeated here.
[0064] S207: Load the identifier of the second Bluetooth device, the first SDP version number, and the first profile to the specified path.
[0065] Among them, all the information required to establish a Bluetooth connection will be written into a file. Then, the first Bluetooth device can obtain all the information required to establish a Bluetooth connection based on the file. The file can record the information required by multiple Bluetooth devices to establish a Bluetooth connection. In order to facilitate the Bluetooth devices to accurately call their corresponding information, the information required by each Bluetooth device to establish a Bluetooth connection can be stored in the file under a specified path corresponding to the Bluetooth device.
[0066] Therefore, in the embodiment of the present disclosure, the corresponding Bluetooth device may store the identification, first SDP version number and first profile of the second Bluetooth device in a file under a designated path corresponding to the second Bluetooth device after determining the identification, first SDP version number and first profile of the second Bluetooth device. Thus, the first Bluetooth device can conveniently read the information used to establish a Bluetooth connection with the second Bluetooth device.
[0067] S208: Establishing a Bluetooth connection with a second Bluetooth device based on the first profile.
[0068] The specific description of S208 can be found in the above embodiment, which will not be repeated here.
[0069] S209: When the second Bluetooth device does not support the SDP-free search function, or when the identifier of the second Bluetooth device does not match each identifier in the preset list, obtain the second SDP version number and the second profile supported by the second Bluetooth device through the SDP search service.
[0070] In the disclosed embodiment, the identifier of the second Bluetooth device may be compared with each device identifier in a preset list in turn, and when the identifier of the second Bluetooth device is different from each device identifier, it is determined that the identifier of the second Bluetooth device does not match any device identifier.
[0071] That is to say, in the embodiment of the present disclosure, the first Bluetooth device may determine the first information in the EIR data after receiving the EIR data returned by the second Bluetooth device, and determine whether the second Bluetooth device supports the SDP-free search function based on the recorded content in the first information, and when the second Bluetooth device does not support the SDP-free search function, or when the identifier of the second Bluetooth device does not match each identifier in the preset list, obtain the second SDP version number and second profile supported by the second Bluetooth device through the SDP search service.
[0072] Specifically, the first Bluetooth device may enable the Bluetooth SDP search function and perform an SDP search, which causes the first Bluetooth device to send an SDP query request to the second Bluetooth device, so that the second Bluetooth device returns an SDP response, and the first Bluetooth device may extract the required information (the second SDP version number and the second profile) from the SDP response.
[0073] S210: Receive a profile update instruction, where the profile update instruction includes a third profile, a third SDP version number, and a device identifier.
[0074] The profile update instruction may be an instruction sent by the cloud for the first Bluetooth device to update the previously acquired Bluetooth device, and the SDP version number and profile of the Bluetooth device.
[0075] The profile included in the Bluetooth update instruction is the third profile, and the SDP version number is the third SDP version number.
[0076] S211: Based on the device identification and the third SDP version number, traverse the preset files.
[0077] In the disclosed embodiment, after receiving the profile update instruction, the first Bluetooth device may traverse the preset files to see whether the same device identifier and third SDP version number are stored based on the third SDP version number and device identifier in the profile update instruction.
[0078] S212: When the preset file does not include the device identifier and the third SDP version number, the device identifier, the third SDP version number and the third profile are associated and stored in the preset file.
[0079] In the embodiment of the present disclosure, when it is determined that the preset file does not contain the device identification and the third SDP version number, the device identification, the third SDP version number and the third profile can be associated and stored in the preset file, and then the first Bluetooth device can be able to directly read the third SDP version number and the third profile of the Bluetooth device corresponding to the device identification from the preset file, thereby facilitating the first Bluetooth device to quickly establish a Bluetooth connection with the Bluetooth device corresponding to the device identification.
[0080] S213: When the preset file includes the device identifier and the third SDP version number, the fourth profile associated with the device identifier and the third SDP version number in the preset file is replaced with the third profile.
[0081] The profile included in the preset file is the fourth profile, and the fourth profile is the same as or different from the first profile.
[0082] In the embodiment of the present disclosure, when it is determined that the preset file contains the device identification and the third SDP version number, the fourth profile associated with the device identification and the third SDP version number can be determined from the preset file, and then the fourth profile can be updated to the third profile. Thus, the fourth profile associated with the device identification and the third SDP version number in the preset file can be updated in time, so that new functions and features can be introduced. By updating the profile in time, a better user experience and more function options can be obtained when establishing a Bluetooth connection.
[0083] In the embodiment of the present disclosure, the first Bluetooth device sends a Bluetooth pairing request to the second Bluetooth device to be connected, and receives an extended query response EIR data returned by the second Bluetooth device, wherein the EIR data includes a first service discovery protocol SDP version number supported by the second Bluetooth device, and then determines whether the second Bluetooth device supports the SDP-free search function based on the first information in the EIR data, and if the second Bluetooth device supports the SDP-free search function, determines whether the identifier of the second Bluetooth device matches any device identifier in a preset list, and if the identifier of the second Bluetooth device matches any device identifier, determines that the second Bluetooth device is a preset device, so that the first Bluetooth device can accurately determine whether the second Bluetooth device is a preset device based on the matching result between the device identifier and the device identifier of the second Bluetooth device, and then, if it is determined that the second Bluetooth device is a preset device, obtains a first application specification profile associated with the first SDP version number and the identifier of the second Bluetooth device from a preset file, and loads the identifier of the second Bluetooth device, the first SDP version number and the first profile to a specified path, thereby, ... obtains a first application specification profile associated with the first SDP version number and the identifier of the second Bluetooth device from a preset file, and loads the identifier of the second Bluetooth device, the first SDP version number and the first profile to a specified path, thereby, A Bluetooth device can conveniently read information used to establish a Bluetooth connection with a second Bluetooth device, and then establish a Bluetooth connection with the second Bluetooth device based on a first profile, thereby simplifying the operation of establishing a Bluetooth connection and effectively improving the efficiency of establishing a Bluetooth connection, and then receive a profile update instruction, wherein the profile update instruction includes a third profile, a third SDP version number and a device identifier, and based on the device identifier and the third SDP version number, traverse a preset file, and then, if the preset file does not contain the device identifier and the third SDP version number, the device identifier, the third SDP version number and the third profile are associated and stored in the preset file, thereby facilitating the first Bluetooth device to subsequently quickly establish a Bluetooth connection with the Bluetooth device corresponding to the device identifier, and then, if the preset file contains the device identifier and the third SDP version number, the third profile is used to replace the fourth profile associated with the device identifier and the third SDP version number in the preset file. By timely updating the profile, a better user experience and more functional options can be obtained when establishing a Bluetooth connection.
[0084] Figure 3 is a flow chart of a method for establishing a Bluetooth connection according to a third embodiment of the present disclosure, such as Figure 3 As shown, the method includes:
[0085] S301: Receive a Bluetooth pairing request sent by a first Bluetooth device.
[0086] The Bluetooth connection establishment method of the disclosed embodiment is executed by a second Bluetooth device. The second Bluetooth device can be any electronic device with Bluetooth communication function, such as a mobile phone, a tablet computer, or a computer. In order to facilitate the specific description of the Bluetooth connection establishment method of the disclosed embodiment, the disclosed embodiment will take the second Bluetooth device as a Bluetooth headset as an example to specifically explain the disclosed embodiment without limiting this.
[0087] The method for establishing a Bluetooth connection described in the embodiment of the present disclosure can be used to establish a Bluetooth connection between a first Bluetooth device and a second Bluetooth device. The first Bluetooth device can be any electronic device with Bluetooth communication function, such as a Bluetooth headset, a Bluetooth speaker, etc. In order to facilitate the specific description of the method for establishing a Bluetooth connection in the embodiment of the present disclosure, the embodiment of the present disclosure will take the first Bluetooth device as a mobile phone as an example to specifically explain the embodiment of the present disclosure, without limiting this.
[0088] When the first Bluetooth device attempts to perform Bluetooth pairing with the second Bluetooth device, the second Bluetooth device can receive the Bluetooth pairing request sent by the first Bluetooth device.
[0089] S302: Sending extended inquiry response EIR data to the first Bluetooth device, wherein the EIR data includes a first service discovery protocol SDP version number supported by the second Bluetooth device.
[0090] Among them, Extended Inquiry Response (EIR) data refers to the data broadcast by a Bluetooth device when a pairing request is made. When a Bluetooth device is detectable or discoverable by other devices, it will periodically broadcast its EIR data so that other Bluetooth devices can detect it and pair or communicate with it.
[0091] In the embodiment of the present disclosure, after receiving the Bluetooth pairing request sent by the first device, the second Bluetooth device can broadcast its own EIR data to send the extended query response EIR data to the first Bluetooth device.
[0092] Among them, the Service Discovery Protocol (SDP) is a protocol used to discover and describe services between Bluetooth devices. The EIR data includes the Service Discovery Protocol SDP version number supported by the second Bluetooth device. The first SDP version number can be used to identify the SDP version supported by the second Bluetooth device.
[0093] S303: When the SDP search request sent by the first Bluetooth device is not received, a Bluetooth connection is established with the first Bluetooth device based on the first application specification profile associated with the first SDP version number.
[0094] The SDP search request is made by the first Bluetooth device and is a request for using the SDP to search for and obtain service information provided by the second Bluetooth device.
[0095] Among them, different Profiles cover Bluetooth protocols and features related to specific functions and specifications, such as phone calls, audio playback, etc. Different Bluetooth devices need to support corresponding profiles to establish a Bluetooth connection. When establishing a Bluetooth connection, Profile matching will be performed between Bluetooth devices to determine whether the Bluetooth devices can communicate and exchange data with each other.
[0096] The Profile supported by the second Bluetooth device is the first profile.
[0097] In the embodiment of the present disclosure, when the second Bluetooth device does not receive the SDP search request sent by the first Bluetooth device, it means that the first Bluetooth device can directly obtain the first application specification profile associated with the first SDP version number based on its preset file, so that the second Bluetooth device does not need to perform SDP interaction with the first Bluetooth device, that is, it can directly establish a Bluetooth connection with the first Bluetooth device based on the first application specification profile associated with the first SDP version number.
[0098] In the disclosed embodiment, the second Bluetooth device receives a Bluetooth pairing request sent by the first Bluetooth device, and then sends an extended query response EIR data to the first Bluetooth device, wherein the EIR data includes a first service discovery protocol SDP version number supported by the second Bluetooth device, and establishes a Bluetooth connection with the first Bluetooth device based on the first application specification profile associated with the first SDP version number without receiving an SDP search request sent by the first Bluetooth device. Thus, a Bluetooth connection can be established with the first Bluetooth device without responding to the SDP search request, thereby simplifying the operation of establishing the Bluetooth connection and effectively improving the efficiency of establishing the Bluetooth connection.
[0099] Figure 4 is a flow chart of a method for establishing a Bluetooth connection according to a fourth embodiment of the present disclosure, such as Figure 4 As shown, the method includes:
[0100] S401: Receive a Bluetooth pairing request sent by a first Bluetooth device.
[0101] The specific description of S401 can be found in the above embodiment, which will not be repeated here.
[0102] S402: Generate first information in the EIR data based on whether the second Bluetooth device supports the SDP-free search function.
[0103] S403: Sending extended inquiry response EIR data to the first Bluetooth device, wherein the EIR data includes a first service discovery protocol SDP version number supported by the second Bluetooth device.
[0104] S404: When the SDP search request sent by the first Bluetooth device is not received, a Bluetooth connection is established with the first Bluetooth device based on the first application specification profile associated with the first SDP version number.
[0105] The specific description of S403 - S404 can be found in the above embodiment, which will not be repeated here.
[0106] S405: Receive a profile update instruction, wherein the profile update instruction includes a second profile and a second SDP version number.
[0107] The profile update instruction may be an instruction sent by the cloud for the second Bluetooth device to update its SDP version number and profile.
[0108] The profile included in the Bluetooth update instruction is the second profile, and the SDP version number is the second SDP version number.
[0109] S406: Use the second profile and the second SDP version number to replace the first profile and the first SDP version number.
[0110] In the embodiment of the present disclosure, after receiving the profile update instruction, the second Bluetooth device can replace the first profile and the first SDP version number based on the second profile and the second SDP version number in the profile update instruction. By timely updating the profile, a better user experience and more functional options can be obtained when establishing a Bluetooth connection.
[0111] In the disclosed embodiment of the present invention, the second Bluetooth device receives a Bluetooth pairing request sent by the first Bluetooth device, and then sends an extended query response EIR data to the first Bluetooth device, wherein the EIR data includes a first service discovery protocol SDP version number supported by the second Bluetooth device, and establishes a Bluetooth connection with the first Bluetooth device based on a first application specification profile associated with the first SDP version number without receiving an SDP search request sent by the first Bluetooth device. Thus, it is possible to establish a Bluetooth connection with the first Bluetooth device without responding to the SDP search request, thereby simplifying the operation of establishing a Bluetooth connection and effectively improving the efficiency of establishing a Bluetooth connection. Thereafter, it is possible to receive a profile update instruction, wherein the profile update instruction includes a second profile and a second SDP version number, and use the second profile and the second SDP version number to replace the first profile and the first SDP version number. By timely updating the profile, a better user experience and more functional options can be obtained when establishing a Bluetooth connection.
[0112] Figure 5 is a block diagram of a device for establishing a Bluetooth connection according to the present disclosure, such as Figure 5 As shown, the Bluetooth connection establishing device 50 includes:
[0113] A first sending module 501 is used to send a Bluetooth pairing request to a second Bluetooth device to be connected;
[0114] The first receiving module 502 is used to receive the extended query response EIR data returned by the second Bluetooth device, wherein the EIR data includes a first service discovery protocol SDP version number supported by the second Bluetooth device;
[0115] The acquisition module 503 is used to acquire, when it is determined that the second Bluetooth device is a preset device, a first application specification profile associated with the first SDP version number and the identifier of the second Bluetooth device from a preset file;
[0116] The first establishing module 504 is configured to establish a Bluetooth connection with a second Bluetooth device based on the first profile.
[0117] In some embodiments of the present disclosure, the acquisition module 503 is further used to:
[0118] Determine, based on the first information in the EIR data, whether the second Bluetooth device supports the SDP-free search function;
[0119] In the case where the second Bluetooth device supports the SDP-free search function, determining whether the identifier of the second Bluetooth device matches any device identifier in the preset list;
[0120] When the identifier of the second Bluetooth device matches any device identifier, the second Bluetooth device is determined to be a preset device.
[0121] In some embodiments of the present disclosure, the first receiving module 502 is further configured to:
[0122] After receiving the extended query response EIR data returned by the second Bluetooth device, if the second Bluetooth device does not support the SDP-free search function, or if the identifier of the second Bluetooth device does not match each identifier in the preset list, the second SDP version number and second profile supported by the second Bluetooth device are obtained through the SDP search service.
[0123] In some embodiments of the present disclosure, the acquisition module 503 is further used to:
[0124] After obtaining the first application specification profile associated with the first SDP version number and the identifier of the second Bluetooth device from the preset file, the identifier of the second Bluetooth device, the first SDP version number and the first profile are loaded into the designated path.
[0125] In some embodiments of the present disclosure, the Bluetooth connection establishing device 50 further includes:
[0126] A first updating module, configured to receive a profile updating instruction, wherein the profile updating instruction includes a third profile, a third SDP version number, and a device identifier;
[0127] Based on the device identifier and the third SDP version number, traverse the preset files;
[0128] When the preset file does not include the device identifier and the third SDP version number, the device identifier, the third SDP version number and the third profile are associated and stored in the preset file.
[0129] In some embodiments of the present disclosure, the first update module is further configured to:
[0130] After traversing the preset file, if the preset file contains the device identifier and the third SDP version number, the fourth profile associated with the device identifier and the third SDP version number in the preset file is replaced with the third profile.
[0131] In this embodiment, the first Bluetooth device sends a Bluetooth pairing request to the second Bluetooth device to be connected, and receives an extended query response EIR data returned by the second Bluetooth device, wherein the EIR data includes a first service discovery protocol SDP version number supported by the second Bluetooth device. When it is determined that the second Bluetooth device is a preset device, a first application specification profile associated with the first SDP version number and the identifier of the second Bluetooth device is obtained from a preset file, and a Bluetooth connection is established with the second Bluetooth device based on the first profile, so that information for establishing a Bluetooth connection with the second Bluetooth device can be more conveniently obtained based on the preset file, thereby simplifying the operation of establishing a Bluetooth connection and effectively improving the efficiency of establishing a Bluetooth connection.
[0132] Figure 6 is a block diagram of another device for establishing a Bluetooth connection according to the present disclosure, such as Figure 6 As shown, the Bluetooth connection establishing device 60 includes:
[0133] The second receiving module 601 is used to receive a Bluetooth pairing request sent by the first Bluetooth device;
[0134] The second sending module 602 is used to send extended inquiry response EIR data to the first Bluetooth device, wherein the EIR data includes a first service discovery protocol SDP version number supported by the second Bluetooth device;
[0135] The second establishing module 603 is configured to establish a Bluetooth connection with the first Bluetooth device based on a first application specification profile associated with a first SDP version number when no SDP search request is received from the first Bluetooth device.
[0136] In some embodiments of the present disclosure, the second sending module 602 is further configured to:
[0137] Before sending the extended inquiry response EIR data to the first Bluetooth device, first information in the EIR data is generated based on whether the second Bluetooth device supports the SDP-free search function.
[0138] In some embodiments of the present disclosure, the Bluetooth connection establishing device 60 further includes:
[0139] receiving a profile update instruction, wherein the profile update instruction includes a second profile and a second SDP version number;
[0140] The first profile and the first SDP version number are replaced by the second profile and the second SDP version number.
[0141] In the disclosed embodiment, the second Bluetooth device receives a Bluetooth pairing request sent by the first Bluetooth device, and then sends an extended query response EIR data to the first Bluetooth device, wherein the EIR data includes a first service discovery protocol SDP version number supported by the second Bluetooth device, and establishes a Bluetooth connection with the first Bluetooth device based on the first application specification profile associated with the first SDP version number without receiving an SDP search request sent by the first Bluetooth device. Thus, a Bluetooth connection can be established with the first Bluetooth device without responding to the SDP search request, thereby simplifying the operation of establishing the Bluetooth connection and effectively improving the efficiency of establishing the Bluetooth connection.
[0142] According to an embodiment of the present disclosure, the present disclosure also provides an electronic device, a computer-readable storage medium, and a computer program product.
[0143] Figure 7 A block diagram of an exemplary electronic device suitable for implementing embodiments of the present disclosure is shown.
[0144] Figure 7 The electronic device 12 shown is only an example and should not bring any limitation to the functions and scope of use of the embodiments of the present disclosure.
[0145] like Figure 7 As shown, the electronic device 12 is in the form of a general purpose computing device. The components of the electronic device 12 may include, but are not limited to: one or more processors or processing units 16, a memory 28, and a bus 18 that connects various system components (including the memory 28 and the processing unit 16).
[0146] The bus 18 represents one or more of several types of bus structures, including a memory bus or memory controller, a peripheral bus, a graphics acceleration port, a processor or a local bus using any of a variety of bus structures. For example, these architectures include but are not limited to Industry Standard Architecture (ISA) bus, Micro Channel Architecture (MAC) bus, Enhanced ISA bus, Video Electronics Standards Association (VESA) local bus and Peripheral Component Interconnection (PCI) bus.
[0147] The electronic device 12 typically includes a variety of computer system readable media. These media can be any available media that can be accessed by the electronic device 12, including volatile and non-volatile media, removable and non-removable media.
[0148] The memory 28 may include computer system readable media in the form of volatile memory, such as random access memory (RAM) 30 and / or cache memory 32. The electronic device 12 may further include other removable / non-removable, volatile / non-volatile computer system storage media. By way of example only, the storage system 34 may be used to read and write non-removable, non-volatile magnetic media ( Figure 7 Not shown, often called a "hard drive").
[0149] although Figure 7 Not shown in the figure, a disk drive for reading and writing a removable non-volatile disk (e.g., a "floppy disk"), and an optical disk drive for reading and writing a removable non-volatile optical disk (e.g., a compact disc read only memory (hereinafter referred to as: CD-ROM), a digital versatile disc read only memory (hereinafter referred to as: DVD-ROM) or other optical media) may be provided. In these cases, each drive may be connected to the bus 18 via one or more data medium interfaces. The memory 28 may include at least one program product having a set (e.g., at least one) of program modules that are configured to perform the functions of the various embodiments of the present disclosure.
[0150] A program / utility 40 having a set (at least one) of program modules 42 may be stored, for example, in the memory 28, such program modules 42 including but not limited to an operating system, one or more application programs, other program modules, and program data, each of which or some combination may include an implementation of a network environment. The program modules 42 generally perform the functions and / or methods of the embodiments described in the present disclosure.
[0151] The electronic device 12 may also communicate with one or more external devices 14 (e.g., keyboard, pointing device, display 24, etc.), may also communicate with one or more devices that enable the human body to interact with the electronic device 12, and / or communicate with any device that enables the electronic device 12 to communicate with one or more other computing devices (e.g., network card, modem, etc.). Such communication may be performed through an input / output (I / O) interface 22. In addition, the electronic device 12 may also communicate with one or more networks (e.g., a local area network (LAN), a wide area network (WAN), and / or a public network, such as the Internet) through a network adapter 20. As shown, the network adapter 20 communicates with other modules of the electronic device 12 through a bus 18. It should be understood that, although not shown in the figure, other hardware and / or software modules may be used in conjunction with the electronic device 12, including but not limited to: microcode, device drivers, redundant processing units, external disk drive arrays, RAID systems, tape drives, and data backup storage systems.
[0152] The processing unit 16 executes various functional applications and parameter information determination by running the program stored in the memory 28, such as implementing the method for establishing the business Bluetooth connection mentioned in the above embodiment, or implementing the method for acquiring the business data mentioned in the above embodiment.
[0153] It should be noted that, in the description of the present disclosure, the terms "first", "second", etc. are only used for descriptive purposes and cannot be understood as indicating or implying relative importance. In addition, in the description of the present disclosure, unless otherwise specified, the meaning of "plurality" is two or more.
[0154] Any process or method description in a flowchart or otherwise described herein may be understood to represent a module, segment or portion of code that includes one or more executable instructions for implementing the steps of a specific logical function or process, and the scope of the preferred embodiments of the present disclosure includes alternative implementations in which functions may not be performed in the order shown or discussed, including performing functions in a substantially simultaneous manner or in the reverse order depending on the functions involved, which should be understood by those skilled in the art to which the embodiments of the present disclosure belong.
[0155] It should be understood that the various parts of the present disclosure can be implemented in hardware, software, firmware or a combination thereof. In the above-mentioned embodiments, multiple steps or methods can be implemented in software or firmware stored in a memory and executed by a suitable instruction execution system. For example, if implemented in hardware, as in another embodiment, it can be implemented by any one of the following technologies known in the art or their combination: a discrete logic circuit having a logic gate circuit for implementing a logic function for a data signal, a dedicated integrated circuit having a suitable combination of logic gate circuits, a programmable gate array (PGA), a field programmable gate array (FPGA), etc.
[0156] A person of ordinary skill in the art may understand that all or part of the steps in the method for implementing the above-mentioned embodiment may be completed by instructing related hardware through a program, and the program may be stored in a computer-readable storage medium, which, when executed, includes one or a combination of the steps of the method embodiment.
[0157] In addition, each functional unit in each embodiment of the present disclosure may be integrated into a processing module, or each unit may exist physically separately, or two or more units may be integrated into one module. The above-mentioned integrated module may be implemented in the form of hardware or in the form of a software functional module. If the integrated module is implemented in the form of a software functional module and sold or used as an independent product, it may also be stored in a computer-readable storage medium.
[0158] The storage medium mentioned above can be a read-only memory, a magnetic disk or an optical disk, etc.
[0159] In the description of this specification, the description with reference to the terms "one embodiment", "some embodiments", "example", "specific example", or "some examples" means that the specific features, structures, materials or characteristics described in conjunction with the embodiment or example are included in at least one embodiment or example of the present disclosure. In this specification, the schematic representation of the above terms does not necessarily refer to the same embodiment or example. Moreover, the specific features, structures, materials or characteristics described may be combined in any one or more embodiments or examples in a suitable manner.
[0160] Although the embodiments of the present disclosure have been shown and described above, it is to be understood that the above embodiments are exemplary and are not to be construed as limitations of the present disclosure. A person skilled in the art may change, modify, replace and vary the above embodiments within the scope of the present disclosure.
Claims
1. A method for establishing a Bluetooth connection, characterized in that: The method is performed by a first Bluetooth device, and the method includes: Sending a Bluetooth pairing request to a second Bluetooth device to be connected; Receive extended query response EIR data returned by the second Bluetooth device, wherein the EIR data includes a first service discovery protocol SDP version number supported by the second Bluetooth device; When it is determined that the second Bluetooth device is a preset device, obtaining a first application specification profile associated with the first SDP version number and the identifier of the second Bluetooth device from a preset file; Based on the first profile, establish a Bluetooth connection with the second Bluetooth device.
2. The method according to claim 1, characterized in that The determining that the second Bluetooth device is a preset device includes: Determine, based on the first information in the EIR data, whether the second Bluetooth device supports an SDP-free search function; In the case where the second Bluetooth device supports the SDP-free search function, determining whether the identifier of the second Bluetooth device matches any device identifier in a preset list; When the identifier of the second Bluetooth device matches any device identifier, it is determined that the second Bluetooth device is a preset device.
3. The method according to claim 2, characterized in that After receiving the extended inquiry response EIR data returned by the second Bluetooth device, the method further includes: When the second Bluetooth device does not support the SDP-free search function, or when the identifier of the second Bluetooth device does not match each identifier in the preset list, the second SDP version number and the second profile supported by the second Bluetooth device are obtained through the SDP search service.
4. The method according to claim 1, characterized in that After acquiring the first application specification profile associated with the first SDP version number and the identifier of the second Bluetooth device from the preset file, the method further includes: The identifier of the second Bluetooth device, the first SDP version number and the first profile are loaded into a specified path.
5. The method according to any one of claims 1 to 4, characterized in that: The method further comprises: receiving a profile update instruction, wherein the profile update instruction includes a third profile, a third SDP version number, and a device identifier; Based on the device identifier and the third SDP version number, traverse the preset files; In a case where the preset file does not include the device identifier and the third SDP version number, the device identifier, the third SDP version number and the third profile are associated and stored in the preset file.
6. The method according to claim 5, characterized in that After traversing the preset files, the method further includes: In a case where the preset file includes the device identifier and the third SDP version number, the fourth profile associated with the device identifier and the third SDP version number in the preset file is replaced by the third profile.
7. A method for establishing a Bluetooth connection, characterized in that: The method is performed by a second Bluetooth device, and the method includes: Receiving a Bluetooth pairing request sent by a first Bluetooth device; Sending an extended inquiry response EIR data to the first Bluetooth device, wherein the EIR data includes a first service discovery protocol SDP version number supported by the second Bluetooth device; In a case where the SDP search request sent by the first Bluetooth device is not received, a Bluetooth connection is established with the first Bluetooth device based on a first application specification profile associated with the first SDP version number.
8. The method according to claim 7, characterized in that Before sending the extended inquiry response EIR data to the first Bluetooth device, the method further includes: Based on whether the second Bluetooth device supports the SDP-free search function, the first information in the EIR data is generated.
9. The method according to claim 7 or 8, characterized in that The method further comprises: receiving a profile update instruction, wherein the profile update instruction includes a second profile and a second SDP version number; The first profile and the first SDP version number are replaced by the second profile and the second SDP version number.
10. A device for establishing a Bluetooth connection, characterized in that: The device comprises: A first sending module, used for sending a Bluetooth pairing request to a second Bluetooth device to be connected; A first receiving module is used to receive extended query response EIR data returned by the second Bluetooth device, wherein the EIR data includes a first service discovery protocol SDP version number supported by the second Bluetooth device; an acquisition module, configured to acquire, when determining that the second Bluetooth device is a preset device, a first application specification profile associated with the first SDP version number and an identifier of the second Bluetooth device from a preset file; The first establishing module is used to establish a Bluetooth connection with the second Bluetooth device based on the first profile.
11. A device for establishing a Bluetooth connection, characterized in that: The device comprises: A second receiving module, used to receive a Bluetooth pairing request sent by the first Bluetooth device; A second sending module is used to send an extended inquiry response EIR data to the first Bluetooth device, wherein the EIR data includes a first service discovery protocol SDP version number supported by the second Bluetooth device; The second establishing module is used to establish a Bluetooth connection with the first Bluetooth device based on the first application specification profile associated with the first SDP version number when the SDP search request sent by the first Bluetooth device is not received.
12. An electronic device, characterized in that: include: processor; a memory for storing instructions executable by the processor; The processor is configured to execute the instructions to implement the method according to any one of claims 1 to 9.
13. A computer-readable storage medium, when instructions in the computer-readable storage medium are executed by a processor of an electronic device, the electronic device is enabled to execute the method according to any one of claims 1 to 9.
Citation Information
Cited By
Bluetooth low-power-consumption connection processing method and system, central equipment and storage medium
CN121568242A