WO2023061273A1 - 设备连接方法、装置、电子设备以及存储介质 - Google Patents

设备连接方法、装置、电子设备以及存储介质 Download PDF

Info

Publication number
WO2023061273A1
WO2023061273A1 PCT/CN2022/123994 CN2022123994W WO2023061273A1 WO 2023061273 A1 WO2023061273 A1 WO 2023061273A1 CN 2022123994 W CN2022123994 W CN 2022123994W WO 2023061273 A1 WO2023061273 A1 WO 2023061273A1
Authority
WO
WIPO (PCT)
Prior art keywords
electronic device
configuration file
specified
sdp data
connection
Prior art date
Application number
PCT/CN2022/123994
Other languages
English (en)
French (fr)
Inventor
吕生义
Original Assignee
Oppo广东移动通信有限公司
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Oppo广东移动通信有限公司 filed Critical Oppo广东移动通信有限公司
Publication of WO2023061273A1 publication Critical patent/WO2023061273A1/zh

Links

Images

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04WWIRELESS COMMUNICATION NETWORKS
    • H04W76/00Connection management
    • H04W76/10Connection setup
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04WWIRELESS COMMUNICATION NETWORKS
    • H04W4/00Services specially adapted for wireless communication networks; Facilities therefor
    • H04W4/80Services using short range communication, e.g. near-field communication [NFC], radio-frequency identification [RFID] or low energy communication

Definitions

  • the present application relates to the technical field of electronic devices, and more specifically, to a device connection method, device, electronic device, and storage medium.
  • the present application proposes a device connection method, device, electronic device and storage medium to solve the above problems.
  • the embodiment of the present application provides a device connection method, which is applied to a first electronic device, and the method includes: when the first electronic device initiates a specified connection to the second electronic device, from the first electronic device The electronic device locally acquires the SDP data of the specified configuration file, wherein the specified connection is a device connection based on the specified configuration file; based on the SDP data of the specified configuration file, the specification is performed with the second electronic device connect.
  • an embodiment of the present application provides a device connection device, which is applied to a first electronic device, and the device includes: an acquisition module, configured to, when the first electronic device initiates a specified connection to a second electronic device, Obtain the SDP data of the specified configuration file locally from the first electronic device, wherein the specified connection is a device connection based on the specified configuration file; the connection module is used to communicate with the SDP data based on the specified configuration file.
  • the second electronic device performs the designated connection.
  • the embodiment of the present application provides an electronic device, including a memory and a processor, the memory is coupled to the processor, the memory stores instructions, and when the instructions are executed by the processor, the The processor executes the above method.
  • the embodiment of the present application provides a computer-readable storage medium, where program code is stored in the computer-readable storage medium, and the program code can be invoked by a processor to execute the above method.
  • Figure 1 shows a schematic diagram of an application environment that can be used in the device connection method provided by the embodiment of the present application
  • Fig. 2 shows a schematic diagram of another application environment that can be used in the device connection method provided by the embodiment of the present application
  • Fig. 3 shows a schematic diagram of another application environment that can be used in the device connection method provided by the embodiment of the present application
  • Fig. 4 shows a schematic flowchart of a device connection method provided by an embodiment of the present application
  • FIG. 5 shows a schematic flowchart of a device connection method provided by an embodiment of the present application
  • FIG. 6 shows a schematic flowchart of a device connection method provided by an embodiment of the present application
  • FIG. 7 shows a schematic flowchart of a device connection method provided by an embodiment of the present application.
  • FIG. 8 shows a schematic flowchart of a device connection method provided by an embodiment of the present application.
  • FIG. 9 shows a schematic flowchart of a device connection method provided by an embodiment of the present application.
  • FIG. 10 shows a schematic flowchart of a device connection method provided by an embodiment of the present application.
  • FIG. 11 shows a block diagram of a device connection device provided by an embodiment of the present application.
  • FIG. 12 shows a block diagram of an electronic device used to execute a device connection method according to an embodiment of the present application in an embodiment of the present application
  • Fig. 13 shows a storage unit for storing or carrying program codes for realizing the device connection method according to the embodiment of the present application according to the embodiment of the present application.
  • the Service Discovery Protocol (Service Discovery Protocol, SDP), also known as Bluetooth SDP, is used to provide specific meanings for applications in the Bluetooth environment, to discover which services are available and to determine the characteristics of available services.
  • SDP defines a method for an electronic device to discover available Bluetooth server services and characteristics.
  • the PDU of each SDP includes a PDU header (Header) and a PDU-specific parameter (Parameter); the PDU header includes three fields: PDU identifier (PDU ID), transaction identifier (Transaction ID) and parameter length (Parameter Length ).
  • the inventor discovered after long-term research, and proposed the device connection method, device, electronic device and storage medium provided by the embodiment of the present application.
  • the subsequent configuration based on the specified configuration is simplified.
  • the process of file connection process improves the speed of Bluetooth connection.
  • the specific device connection method is described in detail in the subsequent embodiments.
  • the first electronic device 100 may be a user terminal (for example, may be a smart phone), and the second electronic device 200 may be a smart home device, which may include electronic devices such as smart TVs, air conditioners, and curtains.
  • the first electronic device 100 and the second electronic device 200 can perform Bluetooth connect.
  • the first electronic device 100 and the second electronic device 200 have been connected by Bluetooth before, the first electronic device 100 and the second electronic device 200 can be connected back.
  • connection back refers to that the first electronic device 100 sends a page packet to the second electronic device 200 to request to establish a communication connection with the second electronic device 200, and this page is usually called a connection (paging).
  • the operation of connecting/activating the second electronic device 200 is called page.
  • page means that the device (first electronic device) that initiated the connection knows the address of the device to be connected (second electronic device), so it can directly page.
  • the first electronic device 100 may be a user terminal (for example, may be a smart phone), and the second electronic device 200 may be a true wireless Bluetooth headset (true wireless stereo, TWS) device.
  • TWS true wireless stereo
  • the first electronic device 100 and the second electronic device 200 can perform a Bluetooth connection.
  • the TWS Bluetooth earphone device may include an earphone 220 and an earphone box (charging device) 210, and the earphone box 210 may accommodate the earphone 220.
  • the inner wall of the earphone box 210 forms a The accommodating cavity, the earphone 220 can be accommodated in the accommodating cavity of the earphone box 210 .
  • the earphone box 210 can not only provide a cavity for accommodating the earphone 220, but also can communicate with the earphone 220, so as to obtain information such as the power and name of the earphone 220, or the network parameters of the earphone 220, so that the first electronic device can pass through the earphone 220.
  • the box 210 is successfully paired with the earphone 220 and a communication connection is realized.
  • the earphone box 210 is also used for charging the earphone 220 .
  • the earphone 220 when the earphone box 210 is opened, the earphone 220 can be triggered to transmit a Bluetooth low energy (bluetooh low energy, BLE) broadcast, and the first electronic device 100, such as a smart phone, after receiving the BLE broadcast , a Bluetooth connection can be established with the headset 220 based on the BLE broadcast.
  • BLE Bluetooth low energy
  • the first electronic device 100 may be a user terminal (for example, may be a smart phone), and the second electronic device 200 may be a headset in a true wireless Bluetooth headset device.
  • the user terminal 100 When the user terminal 100 is connected to the headset 200, the user terminal 100 and the headset 200 can transmit audio data.
  • the user terminal 100 may transmit the voice data of the calling party to the headset 200, and the headset 200 may transmit the voice data of the calling party to the user terminal 100, etc., which is not limited here.
  • FIG. 4 shows a schematic flowchart of a device connection method provided by an embodiment of the present application.
  • the device connection method is used to store the SDP data of the specified configuration file locally, simplify the subsequent connection process based on the specified configuration file, and improve the speed of the Bluetooth connection.
  • the device connection method is applied to a device connection device 300 as shown in FIG. 11 and an electronic device (first electronic device) 100 ( FIG. 12 ) configured with the device connection device 300 .
  • the following will take electronic equipment as an example to illustrate the specific process of this embodiment.
  • the electronic equipment used in this embodiment can include smart phones, tablet computers, wearable electronic devices, Bluetooth headsets, etc. with Bluetooth connection functions device of.
  • the process shown in Figure 4 will be described in detail below, and the device connection method may specifically include the following steps:
  • Step S110 when the first electronic device initiates a designated connection to the second electronic device, obtain the SDP data of the designated configuration file locally from the first electronic device, wherein the designated connection is based on the designated configuration file device connection.
  • Bluetooth connection When two electronic devices establish a Bluetooth connection (for example, the first electronic device and the second electronic device are establishing a Bluetooth connection in this embodiment), they will obtain the protocol provided by the other device. Only devices using the same protocol can exchange data, just like two people need to speak the same language to have a meaningful conversation. Among them, when the Bluetooth protocol defines a physical wireless connection between two electronic devices, the Bluetooth specification will establish commands and functions that the electronic devices that perform the Bluetooth connection can exchange using Bluetooth technology.
  • the first electronic device and the second electronic device may establish a connection based on a profile when performing a Bluetooth connection.
  • profile can include (mobile phone specification, Head-Set-Profile, HSP), hands-free specification (Hands-Free-Profile, HFP), advanced audio transmission specification (Advanced Audio Distribution Profile, A2DP), audio/video remote control specification, (Audio/Video Remote Control Profile, AVRCP), etc., are not limited here.
  • HSP and HFP Bluetooth specifications are the specifications required for the operation of typical mono Bluetooth electronic devices, and A2DP and AVRCP are important for stereo Bluetooth electronic devices.
  • HSP is a more commonly used configuration in Bluetooth connection. It provides the basic functions required for communication between smartphones and Bluetooth headsets for the current popular support such as Bluetooth headsets and smartphones. After connection and configuration, the Bluetooth headset can be used as the audio input and output interface of the remote device.
  • HFP adds some extended functions on the basis of HSP, and is often used to control smart phones such as car hands-free devices. It quantizes the audio channel modulation using continuously variable slope delta modulation or pulse code logarithmic- or ⁇ -method. Describes how a gateway device can be used by a hands-free device to make and receive calls.
  • a typical configuration such as a car uses a smartphone as a gateway device. Inside the car, the stereo system is used for phone audio, and the microphone installed in the car is used to send output audio during calls.
  • HFP can also be used in situations where a personal computer acts as a smartphone speaker in a home or office environment.
  • A2DP allows the transmission of stereo audio signals (better quality than the mono encryption used for HSP and HFP).
  • A2DP can connect two electronic devices that also support Bluetooth audio transmission to each other, and both can output music like CD sound quality (16bits, 44.1kHz). If one party does not support A2DP, then the audio can only output Handsfree Profile (8bits, 8kHz).
  • AVRCP is used to send commands (such as jump forward, pause and play) from the second electronic device (such as stereo headset) to the first electronic device (such as a computer equipped with MediaPlayer).
  • AVRCP is designed to provide a standard interface for controlling TV, Hi-Fi equipment, etc. This specification is used to allow a single remote control device (or other device) to control all A/V equipment that the user can access. It can work with A2DP or VDP.
  • the first electronic device may initiate a specified connection to the second electronic device.
  • the designated connection may be a device connection based on a designated configuration file, wherein the designated configuration file may be one or a combination of HSP, HFP, A2DP, and AVRCP.
  • the specified connection may be an HSP-based device connection initiated by the first electronic device to the second electronic device; the specified connection may be an A2DP-based device connection initiated by the first electronic device to the second electronic device, etc., which are not limited herein.
  • the first electronic device and the second electronic device need to search for services after the pairing is completed and before connecting, wherein, the process of service search is SDP, that is, the first electronic device needs to execute the SDP process to obtain the second SDP data for electronic devices on that connection.
  • the process of service search is SDP
  • the first electronic device initiates a specified connection to the second electronic device, it can obtain the SDP data of the specified configuration file (hereinafter referred to as profile) locally from the first electronic device, so that the SDP data is no longer used. process to improve the acquisition speed of SDP data.
  • the first electronic device has made a designated connection with the second electronic device before initiating the designated connection to the second electronic device this time, and has obtained the SDP of the designated profile when making the designated connection before data, therefore, the first electronic device can store the SDP data of the specified profile obtained during the specified connection before, so that the SDP data of the specified profile can be obtained directly from the local when the subsequent specified connection is performed, so that the SDP data of the specified profile can be effectively improved.
  • SDP data acquisition speed is a designated connection with the second electronic device before initiating the designated connection to the second electronic device this time, and has obtained the SDP of the designated profile when making the designated connection before data
  • Step S120 Perform the designated connection with the second electronic device based on the SDP data of the designated configuration file.
  • the first electronic device after the first electronic device obtains the SDP data of the specified profile locally, it can perform a specified connection with the second electronic device based on the SDP data of the specified profile, so that the speed of the specified connection can be increased.
  • the first electronic device when the first electronic device initiates a designated connection to the second electronic device, it obtains the SDP data of the designated configuration file locally from the first electronic device, wherein the designated connection is based on the designated configuration file
  • the connection based on the SDP data of the specified configuration file, makes a specified connection with the second electronic device, so that by storing the SDP data of the specified configuration file locally, the process of the subsequent connection process based on the specified configuration file is simplified, and the Bluetooth connection is improved. speed.
  • FIG. 5 shows a schematic flowchart of a device connection method provided by an embodiment of the present application. This method is applied to the above-mentioned electronic equipment, and the flow shown in Figure 5 will be described in detail below, and the device connection method may specifically include the following steps:
  • Step S210 when the first electronic device initiates a designated connection to the second electronic device, obtain the SDP data of the designated configuration file locally from the first electronic device, wherein the designated connection is based on the designated configuration file device connection.
  • Step S220 Perform the designated connection with the second electronic device based on the SDP data of the designated configuration file.
  • step S210-step S220 please refer to step S110-step S120, which will not be repeated here.
  • Step S230 When the SDP data of the designated configuration file is not stored locally in the first electronic device, search for a service from the second electronic device based on the designated configuration file.
  • the first electronic device when the first electronic device initiates a specified connection to the second electronic device, it may determine whether the first electronic device has locally stored SDP data of the specified profile. As a way, the first electronic device can preset the storage area corresponding to the SDP data of the profile, so when the first electronic device initiates a specified connection to the second electronic device, it can determine the storage area of the first electronic device Whether to include the SDP data of the specified profile, so as to reduce the amount of query data.
  • the SDP data of the specified profile can be obtained from the local, and based on the SDP data of the specified profile, the specified profile can be specified with the second electronic device. connect.
  • the service search may be performed on the second electronic device based on the specified profile, that is, when the judgment result indicates that the first electronic device's
  • an SDP service discovery process may be performed to the second electronic device based on the specified profile.
  • Step S240 When the service search is completed, obtain the SDP data of the specified configuration file from the second electronic device.
  • the first electronic device when the first electronic device completes the service search from the second electronic device based on the specified profile, that is, when the first electronic device completes the SDP service discovery process to the second electronic device based on the specified profile, then it can Obtain the SDP data of the specified profile from the second electronic device.
  • Step S250 Perform the designated connection with the second electronic device based on the SDP data of the designated configuration file.
  • the first electronic device after the first electronic device obtains the SDP data of the specified profile from the second electronic device, it can make a specified connection with the second electronic device based on the SDP data of the specified profile, so as to ensure the success of the specified connection Rate.
  • the second electronic device when the SDP data of the specified configuration file is not stored locally in the first electronic device, the second electronic device
  • the method for the device to search for services is to obtain the SDP data of the specified configuration file to perform a specified connection with the second electronic device, so as to ensure the success rate of the Bluetooth connection.
  • FIG. 6 shows a schematic flowchart of a device connection method provided by an embodiment of the present application. The method is applied to the above-mentioned electronic equipment, and the flow shown in FIG. 6 will be described in detail below.
  • the device connection method may specifically include the following steps:
  • Step S310 when the first electronic device initiates a designated connection to the second electronic device, obtain the SDP data of the designated configuration file locally from the first electronic device, wherein the designated connection is based on the designated configuration file device connection.
  • Step S320 Perform the designated connection with the second electronic device based on the SDP data of the designated configuration file.
  • step S310-step S320 please refer to step S110-step S120, which will not be repeated here.
  • Step S330 When the SDP data of the specified configuration file is not stored locally in the first electronic device, perform a service search on the second electronic device based on the specified configuration file.
  • Step S340 When the service search is completed, obtain the SDP data of the specified configuration file from the second electronic device.
  • Step S350 Perform the designated connection with the second electronic device based on the SDP data of the designated configuration file.
  • step S330-step S350 please refer to step S230-step S250, which will not be repeated here.
  • Step S360 Store the SDP data of the specified configuration file locally on the first electronic device.
  • the first electronic device after the first electronic device obtains the SDP data of the specified profile from the second electronic device, it can store the SDP data of the specified profile locally in the first electronic device, so that when the subsequent specified connection is made, it can Obtain the SDP data of the specified profile directly from the local, which can effectively improve the acquisition speed of subsequent SDP data.
  • the first electronic device may not set a storage time limit. Based on this, after the first electronic device stores the SDP data of the specified profile locally on the first electronic device, the SDP data of the specified profile may always be stored locally on the first electronic device.
  • the first electronic device may set a storage time limit. Based on this, after the first electronic device stores the SDP data of the specified profile locally in the first electronic device, the SDP data of the specified profile may be automatically deleted after being stored to the set storage time limit. For example, the first electronic device can set the storage time limit to half a year, then when the first electronic device stores the SDP data of the specified profile in the local area of the first electronic device for half a year, it can automatically store the SDP data in the local area of the first electronic device. Delete the SDP data of the specified profile.
  • the first electronic device may set a storage time limit. Based on this, after the first electronic device stores the SDP data of the specified profile locally in the first electronic device, the SDP data of the specified profile may be stored until the set storage time limit, and then output selection information. Wherein, the selection information is used for the user to choose to delete the SDP data of the specified profile or keep the SDP data of the specified profile. In some implementations, if a deletion instruction is received in which the user chooses to delete the SDP data of the specified profile, the SDP data of the specified profile may be deleted locally in the first electronic device in response to the deletion instruction.
  • the SDP data of the specified profile may be kept locally stored in the first electronic device in response to the retention instruction.
  • an information input box can be displayed, wherein the information input box is used for the user to input the SDP data of the specified profile to continue to store Duration, when the target duration input based on the information input box is received, the SDP data of the specified profile may be stored locally in the first electronic device.
  • the second electronic device when the SDP data of the specified configuration file is not stored locally in the first electronic device, the second electronic device
  • the method for the device to search for services is to obtain the SDP data of the specified configuration file to perform a specified connection with the second electronic device, so as to ensure the success rate of the Bluetooth connection.
  • the SDP data of the specified configuration file is obtained and stored locally to increase the speed of subsequent Bluetooth connections.
  • FIG. 7 shows a schematic flowchart of a device connection method provided by an embodiment of the present application. The method is applied to the above-mentioned electronic equipment, and the flow shown in FIG. 7 will be described in detail below.
  • the device connection method may specifically include the following steps:
  • Step S410 When the first electronic device initiates a designated connection to the second electronic device, obtain the SDP data of the designated configuration file locally from the first electronic device, wherein the designated connection is based on the designated configuration file device connection.
  • Step S420 Perform the designated connection with the second electronic device based on the SDP data of the designated configuration file.
  • step S410-step S420 please refer to step S110-step S120, which will not be repeated here.
  • Step S430 When the SDP data of the specified configuration file is not stored locally in the first electronic device, search for a service from the second electronic device based on the specified configuration file.
  • Step S440 When the service search is completed, obtain the SDP data of the specified configuration file from the second electronic device.
  • Step S450 Perform the designated connection with the second electronic device based on the SDP data of the designated configuration file.
  • step S430-step S450 please refer to step S230-step S250, which will not be repeated here.
  • Step S460 Extracting key data from the SDP data of the specified configuration file, wherein the key data is used to perform the specified connection with the second electronic device.
  • the first electronic device after the first electronic device obtains the SDP data of the specified profile from the second electronic device, it may extract key data from the SDP data of the specified profile. Wherein, the key data is used for designated connection with the second electronic device.
  • the first electronic device after the first electronic device obtains the SDP data of the specified profile from the second electronic device, it can obtain the key data defined by the profile protocol of the specified profile, and according to the key data defined by the profile protocol, from the specified profile Extract key data from SDP data.
  • all the SDP data in the SDP data of the specified profile are key data
  • all the data in the SDP data of the specified profile may be directly extracted.
  • part of the SDP data in the SDP data of the specified profile is key data
  • part of the data (key data) in the SDP data of the specified profile may be extracted.
  • Step S470 Store the key data locally on the first electronic device.
  • the key data may be stored locally in the first electronic device, while the non-key data in the SDP data of the specified profile may not be stored. Based on this, not only the speed and success rate of subsequent Bluetooth connections can be guaranteed. Storage pressure can also be reduced.
  • the second electronic device when the SDP data of the specified configuration file is not stored locally in the first electronic device, the second electronic device The method for the device to search for services is to obtain the SDP data of the specified configuration file to perform a specified connection with the second electronic device, so as to ensure the success rate of the Bluetooth connection.
  • the key data is stored locally to increase the speed of subsequent Bluetooth connections and reduce the pressure on storage capacity.
  • FIG. 8 shows a schematic flowchart of a device connection method provided by an embodiment of the present application. This method is applied to the above-mentioned electronic equipment, and the process shown in Figure 8 will be described in detail below, and the device connection method may specifically include the following steps:
  • Step S510 When the first electronic device initiates a designated connection to the second electronic device, obtain the SDP data of the designated configuration file locally from the first electronic device, wherein the designated connection is based on the designated configuration file device connection.
  • Step S520 Perform the designated connection with the second electronic device based on the SDP data of the designated configuration file.
  • step S510-step S520 please refer to step S110-step S120, which will not be repeated here.
  • Step S530 When the SDP data of the specified configuration file is not stored locally on the first electronic device, perform a service search on the second electronic device based on the specified configuration file.
  • Step S540 When the service search is completed, obtain the SDP data of the specified configuration file from the second electronic device.
  • Step S550 Perform the designated connection with the second electronic device based on the SDP data of the designated configuration file.
  • step S530-step S540 please refer to step S230-step S250, which will not be repeated here.
  • Step S560 Based on the configuration protocol in the specified configuration file, obtain the change of the SDP data of the specified configuration file.
  • the first electronic device after the first electronic device acquires the SDP data of the specified profile from the second electronic device, it can acquire the change of the SDP data of the specified profile based on the configuration protocol in the specified profile.
  • the first electronic device after the first electronic device obtains the SDP data of the specified profile from the second electronic device, it can obtain the profile protocol of the specified profile, wherein the profile protocol defines whether the SDP data of the specified profile is fixed, or Dynamically changing, that is, the change of the SDP data of the specified profile is defined. Therefore, after the profile protocol of the specified profile is obtained, the change of the SDP data of the specified profile can be obtained based on the profile protocol.
  • Step S570 When the change indicates that the SDP data of the specified configuration file is fixed data, store the SDP data of the specified configuration file locally on the first electronic device.
  • the SDP data of the specified profile when it is determined that the change of the SDP data of the specified profile indicates that the SDP data of the specified profile is fixed data, it can be determined that during the subsequent specified connection between the first electronic device and the second electronic device, The SDP data of the specified profile will not change, that is, when the first electronic device subsequently performs a specified connection with the second electronic device, it may also be based on the SDP data of the specified profile. Therefore, the SDP data of the specified profile can be stored locally on the first electronic device, so that the SDP data of the specified profile can be directly acquired from the local when a subsequent specified connection is made, thereby effectively increasing the acquisition speed of subsequent SDP data.
  • Step S580 When the change indicates that the SDP data of the specified configuration file is dynamically changing data, do not store the SDP data of the specified configuration file locally in the first electronic device.
  • the SDP data of the specified profile when it is determined that the change of the SDP data of the specified profile indicates that the SDP data of the specified profile is dynamically changing data, it can be determined that the first electronic device and the second electronic device are in the process of subsequent specified connection , the SDP data of the specified profile will change dynamically, that is, when the first electronic device subsequently performs a specified connection with the second electronic device, it can no longer be based on the SDP data of the specified profile. Therefore, the SDP data of the specified profile may not be stored locally on the first electronic device, so as to reduce the storage pressure of the first electronic device.
  • the second electronic device when the SDP data of the specified configuration file is not stored locally in the first electronic device, the second electronic device The method for the device to search for services is to obtain the SDP data of the specified configuration file to perform a specified connection with the second electronic device, so as to ensure the success rate of the Bluetooth connection.
  • the SDP data of the specified configuration file is fixed data, the SDP data of the specified configuration file is stored locally to improve the success rate of the Bluetooth connection.
  • FIG. 9 shows a schematic flowchart of a device connection method provided by an embodiment of the present application. This method is applied to the above-mentioned electronic equipment, and the process shown in Figure 9 will be described in detail below, and the device connection method may specifically include the following steps:
  • Step S610 When the first electronic device initiates a designated connection to the second electronic device, obtain the SDP data of the designated configuration file locally from the first electronic device, wherein the designated connection is based on the designated configuration file Connection
  • Step S620 Perform the designated connection with the second electronic device based on the SDP data of the designated configuration file.
  • step S610-step S620 please refer to step S110-step S120, which will not be repeated here.
  • Step S630 When the SDP data of the specified configuration file is not stored locally on the first electronic device, perform a service search on the second electronic device based on the specified configuration file.
  • Step S640 When the service search is completed, obtain the SDP data of the specified configuration file from the second electronic device.
  • Step S650 Perform the designated connection with the second electronic device based on the SDP data of the designated configuration file.
  • step S630-step S650 please refer to step S230-step S250, which will not be repeated here.
  • Step S660 When the second electronic device satisfies a preset device condition, store the SDP data of the specified configuration file locally on the first electronic device.
  • the first electronic device may preset and store a preset device condition, and the preset device condition is used as a judgment basis for the second electronic device. Therefore, in this embodiment, after obtaining the SDP data of the specified profile from the second electronic device, the second electronic device can be compared with the preset device conditions to determine whether the second electronic device meets the preset device conditions .
  • the judgment result indicates that the second electronic device satisfies the preset device condition
  • the preset device condition may include that the connection frequency with the first electronic device is greater than the preset connection frequency.
  • the first electronic device after the first electronic device obtains the SDP data of the specified profile from the second electronic device, it can obtain the connection frequency between the first electronic device and the second electronic device, and combine the obtained first electronic device and The connection frequency of the second electronic device is compared with the preset connection frequency to determine whether the connection frequency is greater than the preset connection frequency.
  • the connection frequency is greater than the preset connection frequency
  • the second electronic device is a commonly used electronic device
  • the SDP data of the specified profile can be stored locally in the first electronic device to improve the first electronic device. and the specified connection speed of the second electronic device.
  • connection frequency when it is determined that the connection frequency is not greater than the preset connection frequency, it can be determined that the second electronic device is an electronic device that is not commonly used, and the SDP data of the specified profile may not be stored locally in the first electronic device, so as to reduce the frequency of the second electronic device.
  • Storage pressure of an electronic device may be a connection frequency between the first electronic device and the second electronic device within a preset time period. The preset time period can be calculated in months, weeks, years, etc.
  • the preset device condition may include that the number of connections with the first electronic device is greater than the preset number of connections.
  • the first electronic device after the first electronic device obtains the SDP data of the specified profile from the second electronic device, it can obtain the number of connections between the first electronic device and the second electronic device, and combine the obtained first electronic device and The connection times of the second electronic device are compared with the preset connection times to determine whether the connection times are greater than the preset connection times.
  • the second electronic device is a commonly used electronic device
  • the SDP data of the specified profile can be stored locally in the first electronic device to improve the first electronic device. and the specified connection speed of the second electronic device.
  • the second electronic device is an electronic device that is not commonly used, and the SDP data of the specified profile may not be stored locally in the first electronic device to reduce the number of second electronic devices.
  • Storage pressure of an electronic device may be the number of connections between the first electronic device and the second electronic device within a preset time period. The preset time period can be calculated in months, weeks, years, etc.
  • the preset device condition may include the electronic device to which the first electronic device connects for the first time.
  • the first electronic device may determine whether the second electronic device is the electronic device to which the first electronic device connects for the first time. Wherein, when it is determined that the second electronic device is the electronic device connected to the first electronic device for the first time, it can be considered that the first electronic device and the second electronic device have a high probability of belonging to the same user, and the SDP data of the specified profile can be Stored locally on the first electronic device, so as to increase the specified connection speed between the first electronic device and the second electronic device.
  • the second electronic device when it is determined that the second electronic device is not the electronic device to which the first electronic device connects for the first time, it can be considered that the first electronic device and the second electronic device have a higher probability of belonging to the same user, and the SDP of the specified profile may not be
  • the data is stored locally on the first electronic device, so as to reduce the storage pressure of the first electronic device.
  • the first electronic device may store a Bluetooth connection record, and based on the Bluetooth connection record, determine whether the second electronic device is the electronic device that the first electronic device connects to for the first time.
  • the preset device condition may include that the logged-in account is consistent or associated with the logged-in account of the first electronic device.
  • the first electronic device after the first electronic device obtains the SDP data of the specified profile from the second electronic device, it can obtain the account logged in by the first electronic device and the account logged in by the second electronic device, and determine whether the first electronic device Whether the account logged in by the device is consistent or associated with the account logged in by the second electronic device. Wherein, when it is determined that the account registered by the first electronic device is consistent with or associated with the account registered by the second electronic device, it can be considered that the first electronic device and the second electronic device have a relatively high probability of belonging to the same user.
  • the SDP data of the specified profile is stored locally on the first electronic device, so as to increase the specified connection speed between the first electronic device and the second electronic device.
  • the SDP data of the specified profile may not be stored locally on the first electronic device, so as to reduce the storage pressure of the first electronic device.
  • Step S670 When the second electronic device does not satisfy the preset device condition, acquire a search frequency for performing service search on the second electronic device based on the specified configuration file.
  • the judgment result indicates that the second electronic device does not meet the preset device conditions
  • the search frequency of the first electronic device searching for services from the second electronic device based on the specified profile can be obtained. That is, the frequency at which the first electronic device performs an SDP process to the second electronic device based on the specified profile may be acquired as the search frequency.
  • Step S680 When the search frequency is greater than a preset search frequency, store the SDP data of the specified configuration file locally on the first electronic device.
  • the first electronic device may preset and store a preset search frequency, and the preset search frequency is used as a basis for judging the search frequency for the first electronic device to search for services from the second electronic device based on a specified profile. . Therefore, in this embodiment, after the search frequency is acquired, the search frequency may be compared with the preset search frequency to determine whether the search frequency is greater than the preset search frequency.
  • the search frequency when the search frequency is greater than the preset search frequency, it can be considered that the first electronic device has a higher probability of specifying the connection with the second electronic device, and the SDP data of the specified profile can be stored in the first electronic device's local , so as to increase the success rate of the specified connection between the first electronic device and the second electronic device.
  • the search frequency when the search frequency is not greater than the preset search frequency, it can be considered that the probability of the first electronic device having a specified connection with the second electronic device is low, and the SDP data of the specified profile may not be stored in the first electronic device local, so as to reduce the storage pressure of the first electronic device.
  • the second electronic device when the SDP data of the specified configuration file is not stored locally in the first electronic device, the second electronic device The method for the device to search for services is to obtain the SDP data of the specified configuration file to perform a specified connection with the second electronic device, so as to ensure the success rate of the Bluetooth connection.
  • the second electronic device when the second electronic device satisfies the preset device condition, or when the second electronic device does not meet the preset device condition and the service search frequency of the second electronic device based on the specified configuration file is greater than the preset search frequency , store the SDP of the specified configuration file locally to improve the rationality of the stored SDP.
  • FIG. 10 shows a schematic flowchart of a device connection method provided by an embodiment of the present application. This method is applied to the above-mentioned electronic devices, and the following will describe the flow shown in Figure 10 in detail.
  • the local storage of the first electronic device has target SDP data of multiple configuration files, and the device is connected to The method may specifically include the following steps:
  • Step S710 When the first electronic device initiates a designated connection to the second electronic device, determine a configuration file corresponding to the designated configuration file from the plurality of configuration files.
  • the first electronic device may locally store target SDP data of multiple configuration files.
  • the multiple configuration files include HSP, HFP, A2DP and AVRCP
  • the first electronic device may store HSP SDP data, HFP SDP data, A2DP SDP data and AVRCP SDP data locally.
  • the first electronic device when the first electronic device initiates a designated connection to the second electronic device, it may determine a profile corresponding to the designated profile from multiple profiles stored locally. For example, assuming that multiple profiles include HSP, HFP, A2DP, and AVRCP, if the specified profile is HSP, the HSP corresponding to the specified profile may be determined from HSP, HFP, A2DP, and AVRCP.
  • Step S720 Obtain the SDP data of the configuration file corresponding to the specified configuration file from the local of the first electronic device as the SDP data of the specified configuration file.
  • the SDP data of the profile corresponding to the specified profile may be obtained locally from the first electronic device as the SDP data of the specified profile.
  • the SDP data of the HSP may be obtained locally from the first electronic device as the SDP data of the specified profile.
  • Step S730 Perform the designated connection with the second electronic device based on the SDP data of the designated configuration file.
  • step S730 please refer to step S120, which will not be repeated here.
  • this embodiment also stores SDP data of multiple configuration files locally in the first electronic device, so as to improve various types of Bluetooth The speed of the connection.
  • FIG. 11 shows a block diagram of a device connection device provided by an embodiment of the present application.
  • the device connection device 300 is applied to the above-mentioned electronic devices, and will be described below with respect to the block diagram shown in FIG. 11 .
  • the device connection device 300 includes: an acquisition module 310 and a connection module 320, wherein:
  • the obtaining module 310 is used for the first electronic device to obtain the SDP data of the specified configuration file locally from the first electronic device when the first electronic device initiates a specified connection to the second electronic device, wherein the specified connection is based on the Specifies the device connection for the profile.
  • the target SDP data of multiple configuration files are locally stored in the first electronic device, and the acquisition module 310 includes: a configuration file determination submodule and an acquisition submodule, wherein:
  • the configuration file determining submodule is configured to determine, from the plurality of configuration files, the configuration file corresponding to the designated configuration file when the first electronic device initiates a designated connection to the second electronic device.
  • the acquiring submodule is configured to acquire, from the first electronic device, the SDP data of the configuration file corresponding to the specified configuration file as the SDP data of the specified configuration file.
  • a connection module 320 configured to perform the specified connection with the second electronic device based on the SDP data of the specified configuration file.
  • the device connection apparatus 300 also includes: a service search module, an SDP data acquisition module, and a specified connection module, wherein:
  • a service search module configured to search the second electronic device for services based on the specified configuration file when the SDP data of the specified configuration file is not stored locally in the first electronic device.
  • An SDP data acquisition module configured to acquire the SDP data of the specified configuration file from the second electronic device when the service search is completed.
  • a specified connection module configured to perform the specified connection with the second electronic device based on the SDP data of the specified configuration file.
  • the device connection apparatus 300 also includes: a local storage module, wherein:
  • a local storage module configured to store the SDP data of the specified configuration file locally on the first electronic device.
  • the local storage module includes: a key data extraction submodule and a key data storage submodule, wherein:
  • a key data extraction submodule configured to extract key data from the SDP data of the specified configuration file, wherein the key data is used to perform the specified connection with the second electronic device.
  • a key data storage submodule configured to store the key data locally on the first electronic device.
  • the local storage module includes: a change acquisition submodule, a first storage submodule and a second storage submodule, wherein:
  • the change situation obtaining submodule is used to obtain the change situation of the SDP data of the specified configuration file based on the configuration protocol in the specified configuration file.
  • the first storage submodule is configured to store the SDP data of the specified configuration file locally on the first electronic device when the change indicates that the SDP data of the specified configuration file is fixed data.
  • the second storage submodule is configured to not store the SDP data of the specified configuration file locally on the first electronic device when the change indicates that the SDP data of the specified configuration file is dynamically changing data.
  • the local storage module includes: a third storage submodule, wherein:
  • the third storage submodule is configured to store the SDP data of the specified configuration file locally on the first electronic device when the second electronic device satisfies a preset device condition.
  • the local storage module includes: a search frequency acquisition submodule and a fourth storage submodule, wherein:
  • the search frequency obtaining submodule is configured to obtain a search frequency for performing a service search on the second electronic device based on the specified configuration file when the second electronic device does not meet the preset device conditions.
  • the fourth storage sub-module is configured to store the SDP data of the specified configuration file locally on the first electronic device when the search frequency is greater than a preset search frequency.
  • the coupling between the modules may be electrical, mechanical or other forms of coupling.
  • each functional module in each embodiment of the present application may be integrated into one processing module, each module may exist separately physically, or two or more modules may be integrated into one module.
  • the above-mentioned integrated modules can be implemented in the form of hardware or in the form of software function modules.
  • FIG. 12 shows a structural block diagram of an electronic device 100 provided by an embodiment of the present application.
  • the electronic device 100 may be an electronic device capable of running application programs, such as a smart phone, a tablet computer, and an e-book.
  • the electronic device 100 in this application may include one or more of the following components: a processor 110, a memory 120, and one or more application programs, wherein one or more application programs may be stored in the memory 120 and configured to be executed by a or a plurality of processors 110, and one or more programs are configured to execute the methods described in the foregoing method embodiments.
  • the processor 110 may include one or more processing cores.
  • the processor 110 uses various interfaces and lines to connect various parts of the entire electronic device 100, and executes or executes instructions, programs, code sets or instruction sets stored in the memory 120, and calls data stored in the memory 120 to execute Various functions of the electronic device 100 and processing data.
  • the processor 110 may adopt at least one of Digital Signal Processing (Digital Signal Processing, DSP), Field-Programmable Gate Array (Field-Programmable Gate Array, FPGA), and Programmable Logic Array (Programmable Logic Array, PLA). implemented in the form of hardware.
  • DSP Digital Signal Processing
  • FPGA Field-Programmable Gate Array
  • PLA Programmable Logic Array
  • the processor 110 may integrate one or a combination of a central processing unit (Central Processing Unit, CPU), a graphics processing unit (Graphics Processing Unit, GPU), a modem, and the like.
  • CPU Central Processing Unit
  • GPU Graphics Processing Unit
  • the CPU mainly handles the operating system, user interface and application programs, etc.
  • the GPU is used to render and draw the content to be displayed
  • the modem is used to handle wireless communication. It can be understood that, the above-mentioned modem may not be integrated into the processor 110, but may be realized by a communication chip alone.
  • the memory 120 may include random access memory (Random Access Memory, RAM), and may also include read-only memory (Read-Only Memory).
  • the memory 120 may be used to store instructions, programs, codes, sets of codes, or sets of instructions.
  • the memory 120 may include a program storage area and a data storage area, wherein the program storage area may store instructions for implementing an operating system and instructions for implementing at least one function (such as a touch function, a sound playback function, an image playback function, etc.) , instructions for implementing the following method embodiments, and the like.
  • the storage data area can also store data created during use of the electronic device 100 (such as phonebook, audio and video data, chat record data) and the like.
  • FIG. 13 shows a structural block diagram of a computer-readable storage medium provided by an embodiment of the present application.
  • Program codes are stored in the computer-readable medium 400, and the program codes can be invoked by a processor to execute the methods described in the foregoing method embodiments.
  • the computer readable storage medium 400 may be an electronic memory such as flash memory, EEPROM (Electrically Erasable Programmable Read Only Memory), EPROM, hard disk, or ROM.
  • the computer-readable storage medium 400 includes a non-transitory computer-readable storage medium (non-transitory computer-readable storage medium).
  • the computer-readable storage medium 400 has a storage space for program code 410 for executing any method steps in the above methods. These program codes can be read from or written into one or more computer program products.
  • Program code 410 may, for example, be compressed in a suitable form.
  • the first electronic device when the first electronic device initiates a designated connection to the second electronic device, it acquires the specified configuration file locally from the first electronic device.
  • SDP data wherein the specified connection is a device connection based on a specified configuration file, and based on the SDP data of the specified configuration file, a specified connection is made with the second electronic device, so that by storing the SDP data of the specified configuration file locally, the subsequent The flow during the connection process of the configuration file improves the speed of the Bluetooth connection.

Landscapes

  • Engineering & Computer Science (AREA)
  • Computer Networks & Wireless Communication (AREA)
  • Signal Processing (AREA)
  • Mobile Radio Communication Systems (AREA)
  • Telephone Function (AREA)
  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)

Abstract

本申请公开了一种设备连接方法、装置、电子设备以及存储介质,涉及电子设备技术领域。该方法应用于第一电子设备,该方法包括:第一电子设备在向第二电子设备发起指定连接时,从第一电子设备的本地获取指定配置文件的SDP数据,其中,指定连接为基于指定配置文件的设备连接,基于指定配置文件的SDP数据,与第二电子设备进行指定连接。本申请通过将指定配置文件的SDP数据做本地存储,简化后续基于指定配置文件的连接过程中的流程,提升蓝牙连接的速度。

Description

设备连接方法、装置、电子设备以及存储介质
相关申请的交叉引用
本申请要求于2021年10月15日提交的申请号为CN202111203750.5的中国申请的优先权,其在此出于所有目的通过引用将其全部内容并入本文。
技术领域
本申请涉及电子设备技术领域,更具体地,涉及一种设备连接方法、装置、电子设备以及存储介质。
背景技术
随着科学技术的发展,电子设备的使用越来越广泛,功能越来越多,已经成为人们日常生活中的必备之一。目前,电子设备之间可以通过蓝牙的方式进行连接。
发明内容
鉴于上述问题,本申请提出了一种设备连接方法、装置、电子设备以及存储介质,以解决上述问题。
第一方面,本申请实施例提供了一种设备连接方法,应用于第一电子设备,所述方法包括:所述第一电子设备在向第二电子设备发起指定连接时,从所述第一电子设备的本地获取指定配置文件的SDP数据,其中,所述指定连接为基于所述指定配置文件的设备连接;基于所述指定配置文件的SDP数据,与所述第二电子设备进行所述指定连接。
第二方面,本申请实施例提供了一种设备连接装置,应用于第一电子设备,所述装置包括:获取模块,用于所述第一电子设备在向第二电子设备发起指定连接时,从所述第一电子设备的本地获取指定配置文件的SDP数据,其中,所述指定连接为基于所述指定配置文件的设备连接;连接模块,用于基于所述指定配置文件的SDP数据,与所述第二电子设备进行所述指定连接。
第三方面,本申请实施例提供了一种电子设备,包括存储器和处理器,所述存储器耦接到所述处理器,所述存储器存储指令,当所述指令由所述处理器执行时所述处理器执行上述方法。
第四方面,本申请实施例提供了一种计算机可读取存储介质,所述计算机可读取存储介质中存储有程序代码,所述程序代码可被处理器调用执行上述方法。
附图说明
为了更清楚地说明本申请实施例中的技术方案,下面将对实施例描述中所需要使用的附图作简单地介绍,显而易见地,下面描述中的附图仅仅是本申请的一些实施例,对于本领域技术人员来讲,在不付出创造性劳动的前提下,还可以根据这些附图获得其它的附图。
图1示出了可用于本申请实施例提供的设备连接方法的一种应用环境示意图;
图2示出了可用于本申请实施例提供的设备连接方法的又一种应用环境示意图;
图3示出了可用于本申请实施例提供的设备连接方法的再一种应用环境示意图;
图4示出了本申请一实施例提供的设备连接方法的流程示意图;
图5示出了本申请一实施例提供的设备连接方法的流程示意图;
图6示出了本申请一实施例提供的设备连接方法的流程示意图;
图7示出了本申请一实施例提供的设备连接方法的流程示意图;
图8示出了本申请一实施例提供的设备连接方法的流程示意图;
图9示出了本申请一实施例提供的设备连接方法的流程示意图;
图10示出了本申请一实施例提供的设备连接方法的流程示意图;
图11示出了本申请实施例提供的设备连接装置的模块框图;
图12示出了本申请实施例用于执行根据本申请实施例的设备连接方法的电子设备的框图;
图13示出了本申请实施例的用于保存或者携带实现根据本申请实施例的设备连接方法的程序代码的存储单元。
具体实施方式
为了使本技术领域的人员更好地理解本申请方案,下面将结合本申请实施例中的附图,对本申请实施例中的技术方案进行清楚、完整地描述。
其中,在蓝牙协议栈中,服务发现协议(Service Discovery Protocol,SDP)也叫做蓝牙SDP,用于提供应用程序在蓝牙环境中特定的涵义,用于发现哪个服务可用和决定可用服务的特征。SDP定义了一个电子设备发现可用蓝牙服务器服务和特征的方法。其中,每一个SDP的PDU包括PDU头(Header)和PDU特定的参数(Parameter);PDU头包括三个域:PDU标识符(PDU ID)、事务标识符(Transaction ID)和参数长度(Parameter Length)。
当前,电子设备之间可以通过蓝牙的方式进行连接。但是,某个电子设备在每次与另一电子设备进行蓝牙连接的过程中,都需要对每个指定连接(基于配置文件profile的连接)做SDP流程,来发现该另一电子设备针对该指定连接对应的配置文件的一些服务属性值,从而导致蓝牙连接的过程耗时较长。发明人经过研究发现,由于每次基于蓝牙链路的上层profile在建立蓝牙连接的时候都需要首先做SDP流程,然后再做profile层的连接,那么,如果某个电子设备和另一电子设备上运行多个profile时,则会执行多次的SDP流程,进而会加重蓝牙连接的耗时。
针对上述问题,发明人经过长期的研究发现,并提出了本申请实施例提供的设备连接方法、装置、电子设备以及存储介质,通过将指定配置文件的SDP数据做本地存储,简化后续基于指定配置文件的连接过程中的流程,提升蓝牙连接的速度。其中,具体的设备连接方法在后续的实施例中进行详细的说明。
下面将针对可用于本申请实施例提供的设备连接方法的应用环境进行描述。
如图1所示,第一电子设备100可以是用户终端(例如,可以是智能手机),第二电子设备200可以是智能家居设备,该智能家居设备可以包括智能电视、空调、窗帘等电子设备,在第一电子设备100靠近第二电子设备200,且第一电子设备100和第二电子设备200在一定的距离范围内的时候,则第一电子设备100和第二电子设备200可以进行蓝牙连接。其中,若第一电子设备100和第二电子设备200在之前已经进行过蓝牙连接,则第一电子设备100和第二电子设备200可以进行回连。其中,回连是指,第一电子设备100发送page包至第二电子设备200,以请求建立与第二电子设备200间的通信连接,该page就是通常称为的连接(寻呼),进行连接/激活第二电子设备200的操作就称为page,具体地,page是指发起连接的设备(第一电子设备)知道要连接设备(第二电子设备)的地址,则所以可以直接传呼。
如图2所示,第一电子设备100可以是用户终端(例如,可以是智能手机),第二电子设备200可以是真无线蓝牙耳机(true wireless stereo,TWS)装置,在第二电子设备200靠近第一电子设备100,且第一电子设备100和第二电子设备200在一定的距离范围内的时候,则第一电子设备100和第二电子设备200可以进行蓝牙连接。在本申请一实施例中,该TWS蓝牙耳机装置可以包括耳机220和耳机盒(充电装置)210,耳机盒210可以容纳耳机220,在本申请一实施例中,耳机盒210的壳体内壁形成容纳腔,耳机220可以容纳在该耳机盒210的容纳腔内。另外,耳机盒210不仅可以提供用于容纳耳机220的容纳腔,还可以与耳机220通信,从而能获取耳机220的电量、名称或者耳机220的网络参数等信息,以便第一电子设备能通过耳机盒210与耳机220配对成功并实现通信连接。作为一种实施方式,该耳机盒210还用于为耳机220充电。在本申请一实施例中,在耳机盒210开盖时可以触发耳机220发射蓝牙低功耗(bluetooh low energy,BLE)广播,第一电子设备100,例如智能手机,在接收到该BLE广播后,可以基于该BLE广播与该耳机220建立蓝牙连接。
如图3所示,第一电子设备100可以是用户终端(例如,可以是智能手机),第二电子设备200可以是真无线蓝牙耳机装置中的耳机。当用户终端100与耳机200连接时,则用户终端100与耳机200可以进行音频数据的传输。例如,用户终端100可以将通话对方的语音数据传输至耳机200,耳机200可以将通话己方的语音数据传输至用户终端100等,在此不做限定。
请参阅图4,图4示出了本申请一实施例提供的设备连接方法的流程示意图。该设备连接方法用于通过将指定配置文件的SDP数据做本地存储,简化后续基于指定配置文件的连接过程中的流程,提升蓝牙连接的速度。在具体的实施例中,该设备连接方法应用于如图11所示的设备连接装置300以及配置有设备连接装置300的电子设备(第一电子设备)100(图12)。下面将以电子设备为例,说明本实施例的具体流程,当然,可以理解的,本实施例所应用的电子设备可以包括智能手机、平板电脑、穿戴式电子设备、蓝牙耳机等具有蓝牙连接功能的设备。下面将针对图4所示的流程进行详细的阐述,所述设备连接方法具体可以包括以下步骤:
步骤S110:所述第一电子设备在向第二电子设备发起指定连接时,从所述第一电子设备的本地获取指定配置文件的SDP数据,其中,所述指定连接为基于所述指定配置文件的设备连接。
当两台电子设备建立蓝牙连接(如本实施例中的第一电子设备和第二电子设备在建立蓝牙连接)时,它们会获取对方设备提供的协议。只有使用相同协议的设备才能交换数据,就像两个人要使用相同的语言才能进行有意义的对话一样。其中,当蓝牙协议定义两台电子设备之间的物理无线连接时,蓝牙规格会建立进行蓝牙连接的电子设备能够使用蓝牙技术交换的命令和功能。
在一些实施方式中,第一电子设备和第二电子设备在进行蓝牙连接时,可以建立基于配置文件profile的连接。其中,profile可以包括(手机规格,Head-Set-Profile,HSP)、免提规格(Hands-Free-Profile,HFP)、高级音频传送规格(Advanced Audio Distribution Profile,A2DP)、音频/视频遥控规格,(Audio/Video Remote Control Profile,AVRCP)等,在此不做限定。其中,HSP和HFP蓝牙规格是典型单声道蓝牙电子设备操作所需的规格,A2DP和AVRCP对于立体声蓝牙电子 设备很重要。
其中,HSP是蓝牙连接中较为常用的配置,为当前流行支持如蓝牙耳机与智能手机使用,提供智能手机与蓝牙耳机之间通信所需的基本功能。连接和配置好后,蓝牙耳机可以作为远程设备的音频输入和输出接口。
其中,HFP在HSP的基础上增加了某些扩展功能,常用来让如车载免提装置来控制智能手机。它使用连续可变斜率增量调制或脉冲编码对数一法或μ-法量化音频通道调制。描述了网关设备如何用于供免提设备拨打和接听呼叫。典型配置如汽车使用智能手机作为网关设备。在车内,立体声系统用于电话音频,而车内安装的麦克风则用于通话时发送输出音频。HFP还可用于个人计算机在家中或办公环境中作为智能手机扬声器的情况。
其中,A2DP允许传输立体声音频信号(相比用于HSP和HFP的单声道加密,质量更好)。A2DP能够让两个同样支持蓝牙音效传输的电子设备互相连接,都能输出如CD音质(16bits,44.1kHz)般的音乐。假如有一方不支持A2DP,这时音效就只能输出Handsfree Profile(8bits,8kHz)。
其中,AVRCP用于从第二电子设备(如立体声耳机)向第一电子设备(如装有MediaPlayer的电脑)发送命令(如前跳、暂停和播放)。AVRCP设计用于提供控制TV、Hi-Fi设备等的标准接口。此规格用于许可单个远程控制设备(或其它设备)控制所有用户可以接入的A/V设备。它可以与A2DP或VDP配合使用。
在本实施例中,第一电子设备可以向第二电子设备发起指定连接。其中,指定连接可以为基于指定配置文件的设备连接,其中,该指定配置文件可以为HSP、HFP、A2DP以及AVRCP中的一种或几种的组合。例如,指定连接可以为第一电子设备向第二电子设备发起基于HSP的设备连接;指定连接可以为第一电子设备向第二电子设备发起基于A2DP的设备连接等,在此不做限定。
其中,第一电子设备和第二电子设备在配对完成之后,且进行连接之前都要进行服务的搜索,其中,服务搜索走的流程是SDP,即,第一电子设备需要执行SDP流程获得第二电子设备在该连接的SDP数据。而在本实施例中,第一电子设备在向第二电子设备发起指定连接时,则可以从第一电子设备的本地获取该指定配置文件(后续称profile)的SDP数据,从而不再走SDP流程,提升SDP数据的获取速度。
作为一种方式,第一电子设备在此次向第二电子设备发起指定连接之前,已与第二电子设备之间进行过指定连接,并在之前进行指定连接时已获得过该指定profile的SDP数据,因此,第一电子设备可以将之前进行指定连接时获得的指定profile的SDP数据存在本地,以便在后续进行指定连接时,可以直接从本地获取该指定profile的SDP数据,从而可以有效地提升SDP数据的获取速度。
步骤S120:基于所述指定配置文件的SDP数据,与所述第二电子设备进行所述指定连接。
在一些实施方式中,第一电子设备在从本地获取该指定profile的SDP数据后,则可以基于该指定profile的SDP数据,与第二电子设备进行指定连接,从而可以提升指定连接的速度。
本申请一实施例提供的设备连接方法,第一电子设备在向第二电子设备发起指定连接时,从第一电子设备的本地获取指定配置文件的SDP数据,其中,指定连接为基于指定配置文件的连接,基于指定配置文件的SDP数据,与第二电子设备进行指定连接,从而通过将指定配置文件的SDP数据做本地存储,简化后续基于指定配置文件的连接过程中的流程,提升蓝牙连接的速度。
请参阅图5,图5示出了本申请一实施例提供的设备连接方法的流程示意图。该方法应用于上述电子设备,下面将针对图5所示的流程进行详细的阐述,所述设备连接方法具体可以包括以下步骤:
步骤S210:所述第一电子设备在向第二电子设备发起指定连接时,从所述第一电子设备的本地获取指定配置文件的SDP数据,其中,所述指定连接为基于所述指定配置文件的设备连接。
步骤S220:基于所述指定配置文件的SDP数据,与所述第二电子设备进行所述指定连接。
其中,步骤S210-步骤S220的具体描述请参阅步骤S110-步骤S120,在此不再赘述。
步骤S230:当所述第一电子设备的本地未存储所述指定配置文件的SDP数据时,基于所述指定配置文件向所述第二电子设备进行服务搜索。
在一些实施方式中,第一电子设备在向第二电子设备发起指定连接时,可以判断该第一电子设备的本地是否存储有指定profile的SDP数据。作为一种方式,第一电子设备可以预先设定profile的SDP数据对应的存储区域,因此,当第一电子设备在向第二电子设备发起指定连接时,可以判断该第一电子设备的存储区域中是否包括该指定profile的SDP数据,从而可以减少查询的数据量。
其中,当判断结果表征该第一电子设备的本地存储有指定profile的SDP数据时,则可以从本地获取该指定profile的SDP数据,并基于该指定profile的SDP数据,与第二电子设备进行指定连接。
其中,当判断结果表征该第一电子设备的本地未存储有指定profile的SDP数据时,则可以基于该指定profile向第二电子设备进行服务搜索,即,当判断结果表征该第一电子设备的本地未存储有指定profile 的SDP数据时,则可以基于该指定profile向第二电子设备做SDP服务发现流程。
步骤S240:当所述服务搜索完成时,从所述第二电子设备获取所述指定配置文件的SDP数据。
在一些实施方式中,当第一电子设备基于该指定profile向第二电子设备进行服务搜索完成时,即第一电子设备基于该指定profile向第二电子设备做完SDP服务发现流程时,则可以从第二电子设备获取指定profile的SDP数据。
步骤S250:基于所述指定配置文件的SDP数据,与所述第二电子设备进行所述指定连接。
在一些实施方式中,第一电子设备在从第二电子设备获取该指定profile的SDP数据后,则可以基于该指定profile的SDP数据,与第二电子设备进行指定连接,以保证指定连接的成功率。
本申请一实施例提供的设备连接方法,相较于图4所示的设备连接方法,本实施例还在第一电子设备的本地未存储有指定配置文件的SDP数据时,通过向第二电子设备进行服务搜索的方式,获取指定配置文件的SDP数据以与第二电子设备进行指定连接,以保证蓝牙连接的成功率。
请参阅图6,图6示出了本申请一实施例提供的设备连接方法的流程示意图。该方法应用于上述电子设备,下面将针对图6所示的流程进行详细的阐述,所述设备连接方法具体可以包括以下步骤:
步骤S310:所述第一电子设备在向第二电子设备发起指定连接时,从所述第一电子设备的本地获取指定配置文件的SDP数据,其中,所述指定连接为基于所述指定配置文件的设备连接。
步骤S320:基于所述指定配置文件的SDP数据,与所述第二电子设备进行所述指定连接。
其中,步骤S310-步骤S320的具体描述请参阅步骤S110-步骤S120,在此不再赘述。
步骤S330:当所述第一电子设备的本地未存储所述指定配置文件的SDP数据时,基于所述指定配置文件向所述第二电子设备进行服务搜索。
步骤S340:当所述服务搜索完成时,从所述第二电子设备获取所述指定配置文件的SDP数据。
步骤S350:基于所述指定配置文件的SDP数据,与所述第二电子设备进行所述指定连接。
其中,步骤S330-步骤S350的具体描述请参阅步骤S230-步骤S250,在此不再赘述。
步骤S360:将所述指定配置文件的SDP数据存储在所述第一电子设备的本地。
在一些实施方式中,第一电子设备在从第二电子设备获取指定profile的SDP数据后,则可以将指定profile的SDP数据存储在第一电子设备的本地,以便在后续进行指定连接时,可以直接从本地获取该指定profile的SDP数据,从而可以有效地提升后续SDP数据的获取速度。
作为一种方式,第一电子设备可以不设置存储时限。基于此,第一电子设备在将指定profile的SDP数据存储在第一电子设备的本地后,则该指定profile的SDP数据可以始终存储在该第一电子设备的本地。
作为另一种方式,第一电子设备可以设置存储时限。基于此,第一电子设备在将指定profile的SDP数据存储在第一电子设备的本地后,则该指定profile的SDP数据可以在存储到所设置的存储时限后自动删除。例如,第一电子设备可以设置存储时限为半年,则第一电子设备在将指定profile的SDP数据存储在第一电子设备的本地后的时间达到半年时,则可以在第一电子设备的本地自动删除该指定profile的SDP数据。
作为再一种方式,第一电子设备可以设置存储时限。基于此,第一电子设备在将指定profile的SDP数据存储在第一电子设备的本地后,则该指定profile的SDP数据可以在存储到所设置的存储时限后,可以输出选择信息。其中,该选择信息用于供用户选择删除指定profile的SDP数据或者保留指定profile的SDP数据。在一些实施方式中,若接收到用户选择删除指定profile的SDP数据的删除指令时,则可以响应于该删除指令在第一电子设备的本地删除该指定profile的SDP数据。在一些实施方式中,若接收到用户选择保留指定profile的SDP数据的保留指令时,则可以响应于该保留指令保持指定profile的SDP数据继续存储在第一电子设备的本地。作为一种可实施的方式,若接收到用户选择保留指定profile的SDP数据的保留指令时,则可以显示信息输入框,其中,该信息输入框用于供用户输入指定profile的SDP数据继续存储的时长,在接到基于该信息输入框输入的目标时长时,则可以将指定profile的SDP数据在第一电子设备的本地继续存储该目标时长。
本申请一实施例提供的设备连接方法,相较于图4所示的设备连接方法,本实施例还在第一电子设备的本地未存储有指定配置文件的SDP数据时,通过向第二电子设备进行服务搜索的方式,获取指定配置文件的SDP数据以与第二电子设备进行指定连接,以保证蓝牙连接的成功率。另外,还在获取指定配置文件的SDP数据后存储在本地,以提升后续蓝牙连接的速度。
请参阅图7,图7示出了本申请一实施例提供的设备连接方法的流程示意图。该方法应用于上述电子设备,下面将针对图7所示的流程进行详细的阐述,所述设备连接方法具体可以包括以下步骤:
步骤S410:所述第一电子设备在向第二电子设备发起指定连接时,从所述第一电子设备的本地获取指定配置文件的SDP数据,其中,所述指定连接为基于所述指定配置文件的设备连接。
步骤S420:基于所述指定配置文件的SDP数据,与所述第二电子设备进行所述指定连接。
其中,步骤S410-步骤S420的具体描述请参阅步骤S110-步骤S120,在此不再赘述。
步骤S430:当所述第一电子设备的本地未存储所述指定配置文件的SDP数据时,基于所述指定配置文件向所述第二电子设备进行服务搜索。
步骤S440:当所述服务搜索完成时,从所述第二电子设备获取所述指定配置文件的SDP数据。
步骤S450:基于所述指定配置文件的SDP数据,与所述第二电子设备进行所述指定连接。
其中,步骤S430-步骤S450的具体描述请参阅步骤S230-步骤S250,在此不再赘述。
步骤S460:从所述指定配置文件的SDP数据中提取关键数据,其中,所述关键数据用于与所述第二电子设备进行所述指定连接。
在一些实施方式中,第一电子设备在从第二电子设备获取指定profile的SDP数据后,则可以从指定profile的SDP数据中提取关键数据。其中,该关键数据用于与第二电子设备进行指定连接。作为一种方式,第一电子设备在从第二电子设备获取指定profile的SDP数据后,可以获取指定profile的profile协议所定义的关键数据,并根据该profile协议所定义的关键数据,从指定profile的SDP数据中提取关键数据。
例如,当该指定profile的SDP数据中的所有SDP数据均为关键数据时,则可以直接提取该指定profile的SDP数据中的所有数据。又例如,当该指定profile的SDP数据中的部分SDP数据为关键数据时,则可以提取该指定profile的SDP数据中的部分数据(关键数据)。
步骤S470:将所述关键数据存储在所述第一电子设备的本地。
在一些实施方式中,在从指定profile的SDP数据中提取到关键数据后,可以将关键数据存储在第一电子设备的本地,而指定profile的SDP数据中的非关键数据则可以不存储。基于此,不仅可以保证后续蓝牙连接的速度和成功率。还可以降低存储量压力。
本申请一实施例提供的设备连接方法,相较于图4所示的设备连接方法,本实施例还在第一电子设备的本地未存储有指定配置文件的SDP数据时,通过向第二电子设备进行服务搜索的方式,获取指定配置文件的SDP数据以与第二电子设备进行指定连接,以保证蓝牙连接的成功率。另外,还在获取指定配置文件的SDP数据后将关键数据存储在本地,以提升后续蓝牙连接的速度并降低存储量压力。
请参阅图8,图8示出了本申请一实施例提供的设备连接方法的流程示意图。该方法应用于上述电子设备,下面将针对图8所示的流程进行详细的阐述,所述设备连接方法具体可以包括以下步骤:
步骤S510:所述第一电子设备在向第二电子设备发起指定连接时,从所述第一电子设备的本地获取指定配置文件的SDP数据,其中,所述指定连接为基于所述指定配置文件的设备连接。
步骤S520:基于所述指定配置文件的SDP数据,与所述第二电子设备进行所述指定连接。
其中,步骤S510-步骤S520的具体描述请参阅步骤S110-步骤S120,在此不再赘述。
步骤S530:当所述第一电子设备的本地未存储所述指定配置文件的SDP数据时,基于所述指定配置文件向所述第二电子设备进行服务搜索。
步骤S540:当所述服务搜索完成时,从所述第二电子设备获取所述指定配置文件的SDP数据。
步骤S550:基于所述指定配置文件的SDP数据,与所述第二电子设备进行所述指定连接。
其中,步骤S530-步骤S540的具体描述请参阅步骤S230-步骤S250,在此不再赘述。
步骤S560:基于所述指定配置文件中的配置协议,获取所述指定配置文件的SDP数据的变化情况。
在一些实施方式中,第一电子设备在从第二电子设备获取指定profile的SDP数据后,则可以基于该指定profile中的配置协议,获取指定profile的SDP数据的变化情况。作为一种方式,第一电子设备在从第二电子设备获取指定profile的SDP数据后,可以获取指定profile的profile协议,其中,该profile协议中定义有该指定profile的SDP数据是固定的,还是动态变化的,即,定义有该指定profile的SDP数据的变化情况,因此,在获取指定profile的profile协议后,可以基于该profile协议获取指定profile的SDP数据的变化情况。
步骤S570:当所述变化情况表征所述指定配置文件的SDP数据为固定数据时,将所述指定配置文件的SDP数据存储在所述第一电子设备的本地。
在本实施例中,当确定该指定profile的SDP数据的变化情况表征该指定profile的SDP数据为固定数据时,则可以确定第一电子设备与第二电子设备在后续进行指定连接的过程中,该指定profile的SDP数据不会发生变化,即,第一电子设备在后续与第二电子设备进行指定连接时,也可以基于该指定profile的SDP数据。因此,可以将指定profile的SDP数据存储在第一电子设备的本地,以便在后续进行指定连接时,可以直接从本地获取该指定profile的SDP数据,从而可以有效地提升后续SDP数据的获取速度。
步骤S580:当所述变化情况表征所述指定配置文件的SDP数据为动态变化数据时,不将所述指定配置文件的SDP数据存储在所述第一电子设备的本地。
在本实施例中,当确定该指定profile的SDP数据的变化情况表征该指定profile的SDP数据为动态变化数据时,则可以确定第一电子设备与第二电子设备在后续进行指定连接的过程中,该指定profile的SDP数据会动态发生变化,即,第一电子设备在后续与第二电子设备进行指定连接时,无法再基于该指定profile的SDP数据。因此,可以不将该指定profile的SDP数据存储在第一电子设备的本地,以降低第一电子设备的存储压力。
本申请一实施例提供的设备连接方法,相较于图4所示的设备连接方法,本实施例还在第一电子设备的本地未存储有指定配置文件的SDP数据时,通过向第二电子设备进行服务搜索的方式,获取指定配置文件的SDP数据以与第二电子设备进行指定连接,以保证蓝牙连接的成功率。另外,在指定配置文件的SDP数据为固定数据时,再将指定配置文件的SDP数据存储在本地,以提升蓝牙连接的成功率。
请参阅图9,图9示出了本申请一实施例提供的设备连接方法的流程示意图。该方法应用于上述电子设备,下面将针对图9所示的流程进行详细的阐述,所述设备连接方法具体可以包括以下步骤:
步骤S610:所述第一电子设备在向第二电子设备发起指定连接时,从所述第一电子设备的本地获取指定配置文件的SDP数据,其中,所述指定连接为基于所述指定配置文件的连接
步骤S620:基于所述指定配置文件的SDP数据,与所述第二电子设备进行所述指定连接。
其中,步骤S610-步骤S620的具体描述请参阅步骤S110-步骤S120,在此不再赘述。
步骤S630:当所述第一电子设备的本地未存储所述指定配置文件的SDP数据时,基于所述指定配置文件向所述第二电子设备进行服务搜索。
步骤S640:当所述服务搜索完成时,从所述第二电子设备获取所述指定配置文件的SDP数据。
步骤S650:基于所述指定配置文件的SDP数据,与所述第二电子设备进行所述指定连接。
其中,步骤S630-步骤S650的具体描述请参阅步骤S230-步骤S250,在此不再赘述。
步骤S660:当所述第二电子设备满足预设设备条件时,将所述指定配置文件的SDP数据存储在所述第一电子设备的本地。
在一些实施方式中,第一电子设备可以预先设置并存储有预设设备条件,该预设设备条件用于作为该第二电子设备的判断依据。因此,在本实施例中,在从第二电子设备获取指定profile的SDP数据后,则可以将第二电子设备与预设设备条件进行比较,以判断该第二电子设备是否满足预设设备条件。
其中,当判断结果表征第二电子设备满足预设设备条件时,则可以认为该第二电子设备满足将其指定profile的SDP数据存储在第一电子设备的本地的条件。因此,可以将指定profile的SDP数据存储在第一电子设备的本地。
作为一种方式,预设设备条件可以包括与第一电子设备的连接频率大于预设连接频率。在一些实施方式中,第一电子设备在从第二电子设备获取指定profile的SDP数据后,则可以获取第一电子设备与第二电子设备的连接频率,并将所获取的第一电子设备和第二电子设备的连接频率与预设连接频率进行比较,以判断该连接频率是否大于预设连接频率。其中,当确定该连接频率大于预设连接频率时,则可以确定该第二电子设备为常用的电子设备,可以将指定profile的SDP数据存储在第一电子设备的本地,以提升第一电子设备和第二电子设备的指定连接速度。其中,当确定该连接频率不大于预设连接频率时,则可以确定该第二电子设备为不常用的电子设备,可以不将指定profile的SDP数据存储在第一电子设备的本地,以降低第一电子设备的存储压力。其中,该连接频率可以为在预设的时间周期内,第一电子设备与第二电子设备的连接频率。该预设的时间周期可以以月、周、年等计。
作为一种方式,预设设备条件可以包括与第一电子设备的连接次数大于预设连接次数。在一些实施方式中,第一电子设备在从第二电子设备获取指定profile的SDP数据后,则可以获取第一电子设备与第二电子设备的连接次数,并将所获取的第一电子设备和第二电子设备的连接次数与预设连接次数进行比较,以判断该连接次数是否大于预设连接次数。其中,当确定该连接次数大于预设连接次数时,则可以确定该第二电子设备为常用的电子设备,可以将指定profile的SDP数据存储在第一电子设备的本地,以提升第一电子设备和第二电子设备的指定连接速度。其中,当确定该连接次数不大于预设连接次数时,则可以确定该第二电子设备为不常用的电子设备,可以不将指定profile的SDP数据存储在第一电子设备的本地,以降低第一电子设备的存储压力。其中,该连接次数可以为在预设的时间周期内,第一电子设备与第二电子设备的连接次数。该预设的时间周期可以以月、周、年等计。
作为一种方式,预设设备条件可以包括第一电子设备首次连接的电子设备。在一些实施方式中,第一电子设备在从第二电子设备获取指定profile的SDP数据后,则可以判断该第二电子设备是否为第一电子设备首次连接的电子设备。其中,当确定第二电子设备为第一电子设备首次连接的电子设备时,则可以认为该第一电子设备和第二电子设备有较大的概率同属于一个用户,可以将指定profile的SDP数据存储在第一电子设备的本地,以提升第一电子设备和第二电子设备的指定连接速度。其中,当确定第二电子设备 不是第一电子设备首次连接的电子设备时,则可以认为该第一电子设备和第二电子设备有较大的概率不同属于一个用户,可以不将指定profile的SDP数据存储在第一电子设备的本地,以降低第一电子设备的存储压力。在一些实施方式中,第一电子设备可以存储有蓝牙连接记录,并基于该蓝牙连接记录判断该第二电子设备是否为第一电子设备首次连接的电子设备。
作为一种方式,预设设备条件可以包括所登录的账号与第一电子设备所登录的账号一致或关联。在一些实施方式中,第一电子设备在从第二电子设备获取指定profile的SDP数据后,则可以获取第一电子设备所登录的账号和第二电子设备所登录的账号,并判断第一电子设备所登录的账号和第二电子设备所登录的账号是否一致或关联。其中,当确定第一电子设备所登录的账号与第二电子设备所登录的账号一致或关联时,则可以认为该第一电子设备和第二电子设备有较大的概率同属于一个用户,可以将指定profile的SDP数据存储在第一电子设备的本地,以提升第一电子设备和第二电子设备的指定连接速度。其中,当确定第一电子设备所登录的账号与第二电子设备所登录的账号不一致且不关联时,则可以认为该第一电子设备和第二电子设备有较大的概率不同属于一个用户,可以不将指定profile的SDP数据存储在第一电子设备的本地,以降低第一电子设备的存储压力。
步骤S670:当所述第二电子设备不满足预设设备条件时,获取基于所述指定配置文件向所述第二电子设备进行服务搜索的搜索频率。
其中,在一些实施方式中,当判断结果表征第二电子设备不满足预设设备条件时,则可以认为该第二电子设备不满足将其指定profile的SDP数据存储在第一电子设备的本地的条件。因此,可以不将指定profile的SDP数据存储在第一电子设备的本地。
其中,在一些实施方式中,当当判断结果表征第二电子设备不满足预设设备条件时,则可以认为该第二电子设备疑似不满足将其指定profile的SDP数据存储在第一电子设备的本地的条件,则可以获取该第一电子设备基于指定profile向第二电子设备进行服务搜索的搜索频率。即,可以获取该第一电子设备基于指定profile向第二电子设备做SDP流程的频率,作为搜索频率。
步骤S680:当所述搜索频率大于预设搜索频率时,将所述指定配置文件的SDP数据存储在所述第一电子设备的本地。
在一些实施方式中,第一电子设备可以预先设置并存储有预设搜索频率,该预设搜索频率用于作为第一电子设备基于指定profile向第二电子设备进行服务搜索的搜索频率的判断依据。因此,在本实施例中,在获取搜索频率后,可以将该搜索频率与预设搜索频率进行比较,以判断该搜索频率是否大于预设搜索频率。
其中,当该搜索频率大于预设搜索频率时,则可以认为该第一电子设备与第二电子设备进行指定连接的概率较高,则可以将指定profile的SDP数据存储在第一电子设备的本地,以提升第一电子设备和第二电子设备指定连接的成功率。
其中,当该搜索频率不大于预设搜索频率时,则可以认为该第一电子设备与第二电子设备进行指定连接的概率较低,则可以不将指定profile的SDP数据存储在第一电子设备的本地,以降低第一电子设备的存储压力。
本申请一实施例提供的设备连接方法,相较于图4所示的设备连接方法,本实施例还在第一电子设备的本地未存储有指定配置文件的SDP数据时,通过向第二电子设备进行服务搜索的方式,获取指定配置文件的SDP数据以与第二电子设备进行指定连接,以保证蓝牙连接的成功率。另外,还在第二电子设备满足预设设备条件时,或者,在第二电子设备不满足预设设备条件且基于指定配置文件向第二电子设备进行服务搜索的搜索频率大于预设搜索频率时,将指定配置文件的SDP存储在本地,以提升所存储的SDP的合理性。
请参阅图10,图10示出了本申请一实施例提供的设备连接方法的流程示意图。该方法应用于上述电子设备,下面将针对图10所示的流程进行详细的阐述,于本实施例中,第一电子设备的本地存储有多个配置文件各自的目标SDP数据,所述设备连接方法具体可以包括以下步骤:
步骤S710:所述第一电子设备在向第二电子设备发起指定连接时,从所述多个配置文件中确定与所述指定配置文件对应的配置文件。
在一些实施方式中,第一电子设备的本地可以存储有多个配置文件各自的目标SDP数据。例如,当多个配置文件包括HSP、HFP、A2DP以及AVRCP时,则第一电子设备的本地可以存储有HSP的SDP数据、HFP的SDP数据、A2DP的SDP数据以及AVRCP的SDP数据。
在本实施例中,第一电子设备在向第二电子设备发起指定连接时,则可以从本地存储的多个profile中确定与指定profile对应的profile。例如,假设多个profile包括HSP、HFP、A2DP以及AVRCP,若指定profile为HSP时,则可以从HSP、HFP、A2DP以及AVRCP中确定与指定profile对应的HSP。
步骤S720:从所述第一电子设备的本地,获取与所述指定配置文件对应的配置文件的SDP数据,作为所述指定配置文件的SDP数据。
在一些实施方式中,在确定与所述指定profile对应的profile后,可以从第一电子设备的本地,获取与该指定profile对应的profile的SDP数据,作为该指定profile的SDP数据。例如,在确定与指定profile对应的profile为HSP时,则可以从第一电子设备的本地,获取HSP的SDP数据,作为指定profile的SDP数据。
步骤S730:基于所述指定配置文件的SDP数据,与所述第二电子设备进行所述指定连接。
其中,步骤S730的具体描述请参阅步骤S120,在此不再赘述。
本申请一实施例提供的设备连接方法,相较于图4所示的设备连接方法,本实施例还第一电子设备的本地存储有多个配置文件的SDP数据,以提升各种类型的蓝牙连接的速度。
请参阅图11,图11示出了本申请实施例提供的设备连接装置的模块框图。该设备连接装置300应用于上述电子设备,下面将针对图11所示的框图进行阐述,所述设备连接装置300包括:获取模块310和连接模块320,其中:
获取模块310,用于所述第一电子设备在向第二电子设备发起指定连接时,从所述第一电子设备的本地获取指定配置文件的SDP数据,其中,所述指定连接为基于所述指定配置文件的设备连接。
进一步地,所述第一电子设备的本地存储有多个配置文件各自的目标SDP数据,所述获取模块310包括:配置文件确定子模块和获取子模块,其中:
配置文件确定子模块,用于所述第一电子设备在向第二电子设备发起指定连接时,从所述多个配置文件中确定与所述指定配置文件对应的配置文件。
获取子模块,用于从所述第一电子设备的本地,获取与所述指定配置文件对应的配置文件的SDP数据,作为所述指定配置文件的SDP数据。
连接模块320,用于基于所述指定配置文件的SDP数据,与所述第二电子设备进行所述指定连接。
进一步地,所述设备连接装置300还包括:服务搜索模块、SDP数据获取模块以及指定连接模块,其中:
服务搜索模块,用于当所述第一电子设备的本地未存储所述指定配置文件的SDP数据时,基于所述指定配置文件向所述第二电子设备进行服务搜索。
SDP数据获取模块,用于当所述服务搜索完成时,从所述第二电子设备获取所述指定配置文件的SDP数据。
指定连接模块,用于基于所述指定配置文件的SDP数据,与所述第二电子设备进行所述指定连接。
进一步地,所述设备连接装置300还包括:本地存储模块,其中:
本地存储模块,用于将所述指定配置文件的SDP数据存储在所述第一电子设备的本地。
进一步地,所述本地存储模块包括:关键数据提取子模块和关键数据存储子模块,其中:
关键数据提取子模块,用于从所述指定配置文件的SDP数据中提取关键数据,其中,所述关键数据用于与所述第二电子设备进行所述指定连接。
关键数据存储子模块,用于将所述关键数据存储在所述第一电子设备的本地。
进一步地,所述本地存储模块包括:变化情况获取子模块、第一存储子模块以及第二存储子模块,其中:
变化情况获取子模块,用于基于所述指定配置文件中的配置协议,获取所述指定配置文件的SDP数据的变化情况。
第一存储子模块,用于当所述变化情况表征所述指定配置文件的SDP数据为固定数据时,将所述指定配置文件的SDP数据存储在所述第一电子设备的本地。
第二存储子模块,用于当所述变化情况表征所述指定配置文件的SDP数据为动态变化数据时,不将所述指定配置文件的SDP数据存储在所述第一电子设备的本地。
进一步地,所述本地存储模块包括:第三存储子模块,其中:
第三存储子模块,用于当所述第二电子设备满足预设设备条件时,将所述指定配置文件的SDP数据存储在所述第一电子设备的本地。
进一步地,所述本地存储模块包括:搜索频率获取子模块和第四存储子模块,其中:
搜索频率获取子模块,用于当所述第二电子设备不满足预设设备条件时,获取基于所述指定配置文件向所述第二电子设备进行服务搜索的搜索频率。
第四存储子模块,用于当所述搜索频率大于预设搜索频率时,将所述指定配置文件的SDP数据存储在所述第一电子设备的本地。
所属领域的技术人员可以清楚地了解到,为描述的方便和简洁,上述描述装置和模块的具体工作过程,可以参考前述方法实施例中的对应过程,在此不再赘述。
在本申请所提供的几个实施例中,模块相互之间的耦合可以是电性,机械或其它形式的耦合。
另外,在本申请各个实施例中的各功能模块可以集成在一个处理模块中,也可以是各个模块单 独物理存在,也可以两个或两个以上模块集成在一个模块中。上述集成的模块既可以采用硬件的形式实现,也可以采用软件功能模块的形式实现。
请参阅图12,其示出了本申请实施例提供的一种电子设备100的结构框图。该电子设备100可以是智能手机、平板电脑、电子书等能够运行应用程序的电子设备。本申请中的电子设备100可以包括一个或多个如下部件:处理器110、存储器120以及一个或多个应用程序,其中一个或多个应用程序可以被存储在存储器120中并被配置为由一个或多个处理器110执行,一个或多个程序配置用于执行如前述方法实施例所描述的方法。
其中,处理器110可以包括一个或者多个处理核。处理器110利用各种接口和线路连接整个电子设备100内的各个部分,通过运行或执行存储在存储器120内的指令、程序、代码集或指令集,以及调用存储在存储器120内的数据,执行电子设备100的各种功能和处理数据。可选地,处理器110可以采用数字信号处理(Digital Signal Processing,DSP)、现场可编程门阵列(Field-Programmable Gate Array,FPGA)、可编程逻辑阵列(Programmable Logic Array,PLA)中的至少一种硬件形式来实现。处理器110可集成中央处理器(Central Processing Unit,CPU)、图形处理器(Graphics Processing Unit,GPU)和调制解调器等中的一种或几种的组合。其中,CPU主要处理操作系统、用户界面和应用程序等;GPU用于负责待显示内容的渲染和绘制;调制解调器用于处理无线通信。可以理解的是,上述调制解调器也可以不集成到处理器110中,单独通过一块通信芯片进行实现。
存储器120可以包括随机存储器(Random Access Memory,RAM),也可以包括只读存储器(Read-Only Memory)。存储器120可用于存储指令、程序、代码、代码集或指令集。存储器120可包括存储程序区和存储数据区,其中,存储程序区可存储用于实现操作系统的指令、用于实现至少一个功能的指令(比如触控功能、声音播放功能、图像播放功能等)、用于实现下述各个方法实施例的指令等。存储数据区还可以存储电子设备100在使用中所创建的数据(比如电话本、音视频数据、聊天记录数据)等。
请参阅图13,其示出了本申请实施例提供的一种计算机可读存储介质的结构框图。该计算机可读介质400中存储有程序代码,所述程序代码可被处理器调用执行上述方法实施例中所描述的方法。
计算机可读存储介质400可以是诸如闪存、EEPROM(电可擦除可编程只读存储器)、EPROM、硬盘或者ROM之类的电子存储器。可选地,计算机可读存储介质400包括非易失性计算机可读介质(non-transitory computer-readable storage medium)。计算机可读存储介质400具有执行上述方法中的任何方法步骤的程序代码410的存储空间。这些程序代码可以从一个或者多个计算机程序产品中读出或者写入到这一个或者多个计算机程序产品中。程序代码410可以例如以适当形式进行压缩。
综上所述,本申请实施例提供的设备连接方法、装置、电子设备以及存储介质,第一电子设备在向第二电子设备发起指定连接时,从第一电子设备的本地获取指定配置文件的SDP数据,其中,指定连接为基于指定配置文件的设备连接,基于指定配置文件的SDP数据,与第二电子设备进行指定连接,从而通过将指定配置文件的SDP数据做本地存储,简化后续基于指定配置文件的连接过程中的流程,提升蓝牙连接的速度。
最后应说明的是:以上实施例仅用以说明本申请的技术方案,而非对其限制;尽管参照前述实施例对本申请进行了详细的说明,本领域的普通技术人员当理解:其依然可以对前述各实施例所记载的技术方案进行修改,或者对其中部分技术特征进行等同替换;而这些修改或者替换,并不驱使相应技术方案的本质脱离本申请各实施例技术方案的精神和范围。

Claims (20)

  1. 一种设备连接方法,其特征在于,应用于第一电子设备,所述方法包括:
    所述第一电子设备在向第二电子设备发起指定连接时,从所述第一电子设备的本地获取指定配置文件的SDP数据,其中,所述指定连接为基于所述指定配置文件的设备连接;
    基于所述指定配置文件的SDP数据,与所述第二电子设备进行所述指定连接。
  2. 根据权利要求1所述的方法,其特征在于,所述方法还包括:
    当所述第一电子设备的本地未存储所述指定配置文件的SDP数据时,基于所述指定配置文件向所述第二电子设备进行服务搜索;
    当所述服务搜索完成时,从所述第二电子设备获取所述指定配置文件的SDP数据;
    基于所述指定配置文件的SDP数据,与所述第二电子设备进行所述指定连接。
  3. 根据权利要求2所述的方法,其特征在于,在所述当所述服务搜索完成时,从所述第二电子设备获取所述指定配置文件的SDP数据之后,还包括:
    将所述指定配置文件的SDP数据存储在所述第一电子设备的本地。
  4. 根据权利要求3所述的方法,其特征在于,所述将所述指定配置文件的SDP数据存储在所述第一电子设备的本地,包括:
    从所述指定配置文件的SDP数据中提取关键数据,其中,所述关键数据用于与所述第二电子设备进行所述指定连接;
    将所述关键数据存储在所述第一电子设备的本地。
  5. 根据权利要求3所述的方法,其特征在于,所述将所述指定配置文件的SDP数据存储在所述第一电子设备的本地,包括:
    基于所述指定配置文件中的配置协议,获取所述指定配置文件的SDP数据的变化情况;
    当所述变化情况表征所述指定配置文件的SDP数据为固定数据时,将所述指定配置文件的SDP数据存储在所述第一电子设备的本地;或者
    当所述变化情况表征所述指定配置文件的SDP数据为动态变化数据时,不将所述指定配置文件的SDP数据存储在所述第一电子设备的本地。
  6. 根据权利要求3所述的方法,其特征在于,所述将所述指定配置文件的SDP数据存储在所述第一电子设备的本地,包括:
    当所述第二电子设备满足预设设备条件时,将所述指定配置文件的SDP数据存储在所述第一电子设备的本地。
  7. 根据权利要求6所述的方法,其特征在于,所述方法还包括:
    当所述第二电子设备不满足预设设备条件时,获取基于所述指定配置文件向所述第二电子设备进行服务搜索的搜索频率;
    当所述搜索频率大于预设搜索频率时,将所述指定配置文件的SDP数据存储在所述第一电子设备的本地。
  8. 根据权利要求6所述的方法,其特征在于,所述预设设备条件包括:
    与所述第一电子设备的连接频率大于预设连接频率;
    与所述第一电子设备的连接次数大于预设连接次数;或
    为所述第一电子设备首次连接的电子设备;或
    所登录的账号与所述第一电子设备所登录的账号一致或关联。
  9. 根据权利要求3所述的方法,其特征在于,所述将所述指定配置文件的SDP数据存储在所述第一电子设备的本地,包括:
    将所述指定配置文件的SDP数据始终存储在所述第一电子设备的本地。
  10. 根据权利要求3所述的方法,其特征在于,在所述将所述指定配置文件的SDP数据存储在所述第一电子设备的本地之后,还包括:
    在所述指定配置文件的SDP数据存储到所设置的存储时限后删除。
  11. 根据权利要求10所述的方法,其特征在于,所述在所述指定配置文件的SDP数据存储到所设置的存储时限后删除,包括:
    在所述指定配置文件的SDP数据存储到所设置的存储时限后,输出选择信息,其中,所述选择信息用于供选择删除所述指定配置文件的SDP数据或者保留所述指定配置文件的SDP数据;
    若接收到选择删除所述指定配置文件的SDP数据的删除指令,在所述第一电子设备的本地删除所述指定配置文件的SDP数据;或者
    若接收到选择保留所述指定配置文件的SDP数据的保留指令,在所述第一电子设备的本地保持存 储所述指定配置文件的SDP数据。
  12. 根据权利要求11所述的方法,其特征在于,所述若接收到选择保留所述指定配置文件的SDP数据的保留指令,在所述第一电子设备的本地保持存储所述指定配置文件的SDP数据,包括:
    若接收到选择保留所述指定配置文件的SDP数据的保留指令,显示信息输入框,其中,所述信息输入框用于供输入所述制定配置文件的SDP数据继续存储的时长;
    在接收到基于所述信息输入框的目标时长时,将所述指定配置文件的SDP数据在所述第一电子设备的本地继续存储所述目标时长。
  13. 根据权利要求2所述的方法,其特征在于,所述当所述第一电子设备的本地未存储所述指定配置文件的SDP数据时,基于所述指定配置文件向所述第二电子设备进行服务搜索,包括:
    当所述第一电子设备的存储区域中不包括所述指定配置文件的SDP数据时,基于所述指定配置文件向所述第二电子设备进行服务搜索,其中,所述存储区域用于存储所述指定配置文件的SDP数据。
  14. 根据权利要求1-8任一项所述的方法,其特征在于,所述第一电子设备的本地存储有多个配置文件各自的目标SDP数据,所述所述第一电子设备在向第二电子设备发起指定连接时,从所述第一电子设备的本地获取指定配置文件的SDP数据,包括:
    所述第一电子设备在向第二电子设备发起指定连接时,从所述多个配置文件中确定与所述指定配置文件对应的配置文件;
    从所述第一电子设备的本地,获取与所述指定配置文件对应的配置文件的SDP数据,作为所述指定配置文件的SDP数据。
  15. 根据权利要求1-8任一项所述的方法,其特征在于,所述指定配置文件包括HSP、HFP、A2DP以及AVRCP中的一种或几种的组合。
  16. 一种设备连接装置,其特征在于,应用于第一电子设备,所述装置包括:
    获取模块,用于所述第一电子设备在向第二电子设备发起指定连接时,从所述第一电子设备的本地获取指定配置文件的SDP数据,其中,所述指定连接为基于所述指定配置文件的设备连接;
    连接模块,用于基于所述指定配置文件的SDP数据,与所述第二电子设备进行所述指定连接。
  17. 根据权利要求16所述的装置,其特征在于,所述装置还包括:
    服务搜索模块,用于当所述第一电子设备的本地未存储所述指定配置文件的SDP数据时,基于所述指定配置文件向所述第二电子设备进行服务搜索;
    SDP数据获取模块,用于当所述服务搜索完成时,从所述第二电子设备获取所述指定配置文件的SDP数据;
    指定连接模块,用于基于所述指定配置文件的SDP数据,与所述第二电子设备进行所述指定连接。
  18. 根据权利要求17所述的装置,其特征在于,所述装置还包括:
    本地存储模块,用于将所述指定配置文件的SDP数据存储在所述第一电子设备的本地。
  19. 一种电子设备,其特征在于,包括存储器和处理器,所述存储器耦接到所述处理器,所述存储器存储指令,当所述指令由所述处理器执行时所述处理器执行如权利要求1-15任一项所述的方法。
  20. 一种计算机可读取存储介质,其特征在于,所述计算机可读取存储介质中存储有程序代码,所述程序代码可被处理器调用执行如权利要求1-15任一项所述的方法。
PCT/CN2022/123994 2021-10-15 2022-10-09 设备连接方法、装置、电子设备以及存储介质 WO2023061273A1 (zh)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN202111203750.5A CN113727463B (zh) 2021-10-15 2021-10-15 设备连接方法、装置、电子设备以及存储介质
CN202111203750.5 2021-10-15

Publications (1)

Publication Number Publication Date
WO2023061273A1 true WO2023061273A1 (zh) 2023-04-20

Family

ID=78686005

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2022/123994 WO2023061273A1 (zh) 2021-10-15 2022-10-09 设备连接方法、装置、电子设备以及存储介质

Country Status (2)

Country Link
CN (1) CN113727463B (zh)
WO (1) WO2023061273A1 (zh)

Families Citing this family (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113727463B (zh) * 2021-10-15 2024-05-03 Oppo广东移动通信有限公司 设备连接方法、装置、电子设备以及存储介质

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN104507034A (zh) * 2014-11-24 2015-04-08 小米科技有限责任公司 设备连接方法、装置及终端设备
CN105594272A (zh) * 2013-04-26 2016-05-18 歌拉利旺株式会社 通信设备和蓝牙通信系统
US10356232B1 (en) * 2018-03-22 2019-07-16 Bose Corporation Dual-transceiver wireless calling
CN112868244A (zh) * 2018-11-30 2021-05-28 华为技术有限公司 一种点对多点的数据传输方法及设备
CN113727463A (zh) * 2021-10-15 2021-11-30 Oppo广东移动通信有限公司 设备连接方法、装置、电子设备以及存储介质

Family Cites Families (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US8886118B2 (en) * 2010-05-11 2014-11-11 Plantronics, Inc. Information exchange via bluetooth service discovery protocol service records
KR20180057919A (ko) * 2016-11-23 2018-05-31 전자부품연구원 웨어러블 디바이스 등록 시스템 및 그 방법
CN110784846B (zh) * 2019-10-10 2023-06-27 RealMe重庆移动通信有限公司 车载蓝牙设备识别方法、装置、电子设备及存储介质

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN105594272A (zh) * 2013-04-26 2016-05-18 歌拉利旺株式会社 通信设备和蓝牙通信系统
CN104507034A (zh) * 2014-11-24 2015-04-08 小米科技有限责任公司 设备连接方法、装置及终端设备
US10356232B1 (en) * 2018-03-22 2019-07-16 Bose Corporation Dual-transceiver wireless calling
CN112868244A (zh) * 2018-11-30 2021-05-28 华为技术有限公司 一种点对多点的数据传输方法及设备
CN113727463A (zh) * 2021-10-15 2021-11-30 Oppo广东移动通信有限公司 设备连接方法、装置、电子设备以及存储介质

Also Published As

Publication number Publication date
CN113727463A (zh) 2021-11-30
CN113727463B (zh) 2024-05-03

Similar Documents

Publication Publication Date Title
US11812485B2 (en) Bluetooth communication method and terminal
US9082408B2 (en) Speech recognition using loosely coupled components
US11501779B2 (en) Bluetooth speaker base, method and system for controlling thereof
CN113766477A (zh) 设备连接方法、装置、电子设备及计算机可读介质
WO2021239032A1 (zh) 蓝牙协议连接方法、装置、存储介质及相关设备
CN103391121A (zh) 多设备配对和连接蓝牙设备的方法
US11991612B2 (en) Bluetooth data transmission method and apparatus, terminal and storage medium
CN106982286B (zh) 一种录音方法、设备和计算机可读存储介质
US20210084417A1 (en) Wireless connection onboarding for a hearing device
WO2020073536A1 (zh) 语音切换方法、电子设备及系统
WO2023061273A1 (zh) 设备连接方法、装置、电子设备以及存储介质
WO2023001054A1 (zh) 针对音频播放的优先级配置方法、装置、设备及存储介质
WO2023040517A1 (zh) 音频数据播放方法、装置、电子设备及存储介质
WO2023160212A1 (zh) 连接建立方法、装置、设备、存储介质及程序产品
CN113286284A (zh) 一种终端与蓝牙设备的连接控制方法、装置、设备及介质
CN115119190A (zh) 蓝牙连接方法、装置、计算机设备及可读存储介质
WO2024119947A1 (zh) 蓝牙通信方法、装置、电子设备及计算机可读介质
WO2024016885A1 (zh) 蓝牙连接方法、装置、电子设备及计算机可读存储介质
WO2023088371A1 (zh) 通话方法、系统、电子设备和计算机可读存储介质
CN112312368A (zh) 数据处理方法、装置、设备和存储介质
WO2023005880A1 (zh) 音频控制方法、电子设备、音频设备和存储介质
WO2022247404A1 (zh) 通话控制方法、装置、通话系统、可穿戴设备及可读介质
CN114363876A (zh) 连接建立方法、装置、设备、存储介质及程序产品
WO2021227143A1 (zh) 直连通话方法、核心网设备、移动终端以及存储介质
WO2021120381A1 (zh) 通话网络的切换方法、装置及存储介质

Legal Events

Date Code Title Description
121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 22880212

Country of ref document: EP

Kind code of ref document: A1

NENP Non-entry into the national phase

Ref country code: DE

122 Ep: pct application non-entry in european phase

Ref document number: 22880212

Country of ref document: EP

Kind code of ref document: A1