CN113677039B - Bluetooth-based device connection method and device, electronic device and storage medium - Google Patents

Bluetooth-based device connection method and device, electronic device and storage medium Download PDF

Info

Publication number
CN113677039B
CN113677039B CN202110956404.8A CN202110956404A CN113677039B CN 113677039 B CN113677039 B CN 113677039B CN 202110956404 A CN202110956404 A CN 202110956404A CN 113677039 B CN113677039 B CN 113677039B
Authority
CN
China
Prior art keywords
bluetooth
authentication mode
bluetooth module
electronic device
module
Prior art date
Legal status (The legal status 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 status listed.)
Active
Application number
CN202110956404.8A
Other languages
Chinese (zh)
Other versions
CN113677039A (en
Inventor
吕生义
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Guangdong Oppo Mobile Telecommunications Corp Ltd
Original Assignee
Guangdong Oppo Mobile Telecommunications Corp Ltd
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 Guangdong Oppo Mobile Telecommunications Corp Ltd filed Critical Guangdong Oppo Mobile Telecommunications Corp Ltd
Priority to CN202110956404.8A priority Critical patent/CN113677039B/en
Publication of CN113677039A publication Critical patent/CN113677039A/en
Priority to PCT/CN2022/113716 priority patent/WO2023020617A1/en
Application granted granted Critical
Publication of CN113677039B publication Critical patent/CN113677039B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04WWIRELESS COMMUNICATION NETWORKS
    • H04W76/00Connection management
    • H04W76/10Connection setup
    • H04W76/14Direct-mode setup
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04WWIRELESS COMMUNICATION NETWORKS
    • H04W12/00Security arrangements; Authentication; Protecting privacy or anonymity
    • H04W12/06Authentication
    • 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
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04WWIRELESS COMMUNICATION NETWORKS
    • H04W76/00Connection management
    • H04W76/40Connection management for selective distribution or broadcast
    • YGENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
    • Y02TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
    • Y02DCLIMATE CHANGE MITIGATION TECHNOLOGIES IN INFORMATION AND COMMUNICATION TECHNOLOGIES [ICT], I.E. INFORMATION AND COMMUNICATION TECHNOLOGIES AIMING AT THE REDUCTION OF THEIR OWN ENERGY USE
    • Y02D30/00Reducing energy consumption in communication networks
    • Y02D30/70Reducing energy consumption in communication networks in wireless communication networks

Landscapes

  • Engineering & Computer Science (AREA)
  • Computer Networks & Wireless Communication (AREA)
  • Signal Processing (AREA)
  • Computer Security & Cryptography (AREA)
  • Mobile Radio Communication Systems (AREA)

Abstract

The application relates to a Bluetooth-based device connection method and device, electronic equipment and a storage medium, and belongs to the technical field of terminals. The method comprises the following steps: generating a first broadcast data packet based on an authentication mode of the first Bluetooth module; broadcasting a first broadcast data packet through a second Bluetooth module, wherein the first Bluetooth module and the second Bluetooth module adopt different Bluetooth modes, and the first broadcast data packet indicates to initiate Bluetooth connection based on an authentication mode; and responding to a Bluetooth connection request sent by the electronic equipment based on an authentication mode, and establishing Bluetooth connection with the electronic equipment. Through this scheme, when establishing bluetooth connection with the first bluetooth module of first electronic equipment, second electronic equipment need not to initiate the flow of confirming first bluetooth module's authentication mode at bluetooth in-process paired, has simplified the step of establishing bluetooth connection, and then has improved bluetooth connection's speed.

Description

Bluetooth-based device connection method and device, electronic device and storage medium
Technical Field
The embodiment of the application relates to the technical field of terminals, in particular to a Bluetooth-based device connection method and device, electronic equipment and a storage medium.
Background
For a dual mode bluetooth electronic device, the electronic device includes two bluetooth modules. Namely a Basic Rate/enhanced Rate (ENHANCED DATA RATE, BR/EDR) bluetooth module and a bluetooth low energy (Bluetooh Low Energy, BLE) module. When the BR/EDR module establishes Bluetooth connection with other electronic equipment, the other electronic equipment needs to determine an authentication mode of the BR/EDR module in a pairing stage, identity authentication is performed through the authentication mode, and Bluetooth connection is established after the identity authentication is passed.
In the related art, the process of the electronic device obtaining the authentication mode of the BR/EDR module includes: the electronic device sends a device name acquisition request (Remote Name Request, RNR) to the BR/EDR module, acquires a request response message fed back by the BR/EDR module aiming at the NRN, and determines an authentication mode of the BR/EDR module based on the request response message.
In the related art, the electronic device needs to determine the authentication mode of the BR/EDR module by initiating the RNR, which results in complicated process of establishing the bluetooth connection and low bluetooth connection efficiency.
Disclosure of Invention
The embodiment of the application provides a Bluetooth-based device connection method and device, electronic equipment and a storage medium, which can improve the efficiency of Bluetooth connection. The technical scheme is as follows:
In one aspect, there is provided a bluetooth-based device connection method, the method including:
generating a first broadcast data packet based on an authentication mode of the first Bluetooth module;
Broadcasting the first broadcast data packet through a second Bluetooth module, wherein the first Bluetooth module and the second Bluetooth module adopt different Bluetooth modes, and the first broadcast data packet indicates to initiate Bluetooth connection based on the authentication mode;
and responding to a Bluetooth connection request sent by the electronic equipment based on the authentication mode, and establishing Bluetooth connection with the electronic equipment.
In another aspect, there is provided a bluetooth-based device connection apparatus, the apparatus comprising:
the generation module is used for generating a first broadcast data packet based on the authentication mode of the first Bluetooth module;
The broadcasting module is used for broadcasting the first broadcasting data packet through the second Bluetooth module, the first Bluetooth module and the second Bluetooth module adopt different Bluetooth modes, and the first broadcasting data packet indicates to initiate Bluetooth connection based on the authentication mode;
and the Bluetooth connection module is used for responding to a Bluetooth connection request sent by the electronic equipment based on the authentication mode and establishing Bluetooth connection with the electronic equipment.
In another aspect, an electronic device is provided that includes a processor and a memory; the memory stores at least one program code for execution by the processor to implement the bluetooth-based device connection method as described in the above aspects.
In another aspect, a computer readable storage medium is provided, the storage medium storing at least one program code for execution by a processor to implement the bluetooth-based device connection method as described in the above aspect.
In another aspect, there is also provided a computer program product storing at least one program code loaded and executed by a processor to implement the bluetooth-based device connection method of the above aspect.
In the embodiment of the application, the first broadcast data packet added with the target field of the authentication mode of the first Bluetooth module is broadcast through the second Bluetooth module, so that the second electronic device can acquire the authentication mode of the first Bluetooth module through the first broadcast data packet, and the second electronic device does not need to initiate the process of determining the authentication mode of the first Bluetooth module in the process of Bluetooth pairing when establishing Bluetooth connection with the first Bluetooth module of the first electronic device, thereby simplifying the step of establishing Bluetooth connection and further improving the speed of Bluetooth connection.
Drawings
FIG. 1 illustrates a schematic diagram of an implementation environment involved in a Bluetooth-based device connection method, according to an exemplary embodiment of the present application;
FIG. 2 illustrates a flowchart of a Bluetooth-based device connection method, according to an exemplary embodiment of the present application;
FIG. 3 illustrates a flowchart of a Bluetooth-based device connection method, according to an exemplary embodiment of the present application;
FIG. 4 illustrates a flowchart of a Bluetooth-based device connection method, according to an exemplary embodiment of the present application;
FIG. 5 illustrates a flowchart of a Bluetooth-based device connection method, according to an exemplary embodiment of the present application;
FIG. 6 illustrates a block diagram of a Bluetooth-based device connection apparatus according to an exemplary embodiment of the present application;
fig. 7 shows a schematic structural diagram of an electronic device according to an exemplary embodiment of the present application.
Detailed Description
For the purpose of making the objects, technical solutions and advantages of the present application more apparent, the embodiments of the present application will be described in further detail with reference to the accompanying drawings.
References herein to "a plurality" means two or more. "and/or", describes an association relationship of an association object, and indicates that there may be three relationships, for example, a and/or B, and may indicate: a exists alone, A and B exist together, and B exists alone. The character "/" generally indicates that the context-dependent object is an "or" relationship. The information such as the broadcast data packet, the equipment identifier and the like related to the application can be information authorized by a user or fully authorized by each party.
Referring to fig. 1, fig. 1 is a schematic diagram illustrating an implementation environment related to a bluetooth-based device connection method according to an exemplary embodiment of the present application. Referring to fig. 1, the implementation environment includes a plurality of first electronic devices and at least one second electronic device. Taking a first electronic device and a second electronic device as an example, the first electronic device can establish bluetooth connection with the second electronic device within a preset range. The first electronic device is a dual-mode Bluetooth device, and the second electronic device is a dual-mode Bluetooth device or a single-mode Bluetooth device.
The dual-mode Bluetooth device refers to an electronic device comprising Bluetooth modules in different modes. For example, the different modes of bluetooth modules are Basic Rate/enhanced Rate (Basic Rate/ENHANCED DATA RATE, BR/EDR) bluetooth module and bluetooth low energy (Bluetooh Low Energy, BLE) module. The single-mode Bluetooth device refers to an electronic device comprising a Bluetooth module, for example, the Bluetooth module is a BR/EDR Bluetooth module; or the bluetooth module is a BLE module.
The BLE module and the BR/EDR Bluetooth module of the first electronic device can be connected with the Bluetooth module in the second electronic device in a Bluetooth mode, and identity authentication is needed in the Bluetooth connection process of the BLE module and the BR/EDR Bluetooth module with the second electronic device. The BLE module establishes a bluetooth connection with a bluetooth module of the second electronic device by broadcasting the broadcast data packet. Correspondingly, after receiving the broadcast data packet of the BLE module of the first electronic device, the second electronic device initiates Bluetooth connection to the BLE Bluetooth module based on the default authentication mode of the BLE module. And the BR/EDR Bluetooth module establishes Bluetooth connection with the Bluetooth module of the second electronic device by receiving a Bluetooth search request sent by the second electronic device. Correspondingly, the second electronic equipment sends a Bluetooth search request, the first electronic equipment sends a scanning response message to the second electronic equipment after receiving the Bluetooth search request, the second electronic equipment obtains an authentication mode of the BR/EDR Bluetooth module of the first electronic equipment after receiving the scanning response message, and Bluetooth connection is initiated to the BR/EDR Bluetooth module based on the authentication mode.
It should be noted that the second electronic device is an electronic device within a preset range of the first electronic device. The preset range is set according to the range of the bluetooth module broadcast message in the first electronic device and the second electronic device, and in the embodiment of the present application, the preset range is not specifically limited.
The first electronic device and the second electronic device are both electronic devices with Bluetooth modules. For example, each of the first electronic device and the second electronic device may be at least one of a mobile phone, a tablet computer, a PC (Personal Computer, a personal computer), or a wearable device, etc. mounted with a bluetooth module. It should be noted that the first electronic device and the second electronic device are the same type of electronic device or different types of electronic devices. For example, the first electronic device is a bluetooth headset, and the second electronic device is a mobile phone or the like.
Referring to fig. 2, a flowchart of a bluetooth-based device connection method according to an exemplary embodiment of the present application is shown. The execution main body in the embodiment of the application is the first electronic device, and can also be a Bluetooth module of the first electronic device, a processor of the first electronic device, an operating system of the first electronic device, or the like. The method comprises the following steps:
Step S21: the first electronic device generates a first broadcast data packet based on an authentication mode of the first Bluetooth module.
The first Bluetooth module is a BR/EDR Bluetooth module. The first broadcast packet includes a target field indicating an authentication mode of the first bluetooth module.
In this step, the first electronic device determines an authentication method of the first bluetooth module, determines the target field based on the first authentication method, and adds the target field to the second broadcast packet to obtain the first broadcast packet. Referring to fig. 3, the process is implemented by the following steps S21-1 to S21-2, including:
Step S21-1: the first electronic device determines a target field based on the authentication mode, the target field representing the authentication mode of the first bluetooth module.
The authentication mode of the first Bluetooth module is used for carrying out identity authentication on the second electronic equipment based on the authentication mode in the Bluetooth pairing stage, so that whether pairing is successful or not is determined, and Bluetooth connection is established when pairing is successful. The number and type of authentication methods are set as needed, and for example, the authentication methods include a Secure simple pairing (Secure SIMPLE PAIRING, SSP) authentication method and a personal identification number (Personal Identification Number, PIN) code authentication method.
In this step, the first electronic device determines the value of the target field according to the authentication mode of the first bluetooth module. For example, in the case where the authentication method is a secure simple pairing SSP authentication method, the target field is set to a first value; in the case where the authentication method is a personal identification number PIN authentication method, the target field is set to a second value.
The first value and the second value are different, and the first value and the second value are set according to needs, and in the embodiment of the present disclosure, the first value and the second value are not specifically limited. For example, the first value is 1 and the second value is 0.
For example, referring to fig. 4, the first electronic device determines whether the first bluetooth module supports the SSP authentication method, if the first bluetooth module supports the SSP authentication method, the value of the target field is set to a first value, and if the first bluetooth module does not support the SSP authentication method, the value of the target field is set to a second value. And adding the target field with the set value into the second broadcast data packet to obtain a first broadcast data packet so as to be capable of broadcasting the first broadcast data packet.
It should be noted that, the first electronic device determines the target fields corresponding to different authentication modes according to the correspondence between the target fields and the authentication modes. Correspondingly, the first electronic device stores the corresponding relation between the authentication mode and the target field in advance, so that the first electronic device can determine the target field corresponding to the authentication mode of the first Bluetooth module from the corresponding relation between the authentication mode and the target field based on the authentication mode of the first Bluetooth module. For example, in the case that the authentication method is an SSP authentication method, the first electronic device determines that the target field is a first numerical value based on a correspondence between the authentication method and the target field; and under the condition that the authentication mode is a PIN authentication mode, the first electronic device determines that the target field is a second numerical value based on the corresponding relation between the authentication mode and the target field.
In the implementation manner, the authentication mode of the first Bluetooth module is represented by different values of the target field, so that the process of determining the authentication mode of the first Bluetooth module is simplified, and the efficiency of establishing Bluetooth connection is improved.
The second electronic device may store the correspondence between the target field and the authentication mode in advance, or the second electronic device may call the correspondence between the target field stored in the server and the authentication mode from other electronic devices, so that the second electronic device may determine the authentication mode of the first bluetooth module from the correspondence between the target field and the authentication mode according to the target field. For example, in the case that the target field is the first value, the other electronic device determines that the authentication mode is an SSP authentication mode based on the correspondence between the target field and the authentication mode; and under the condition that the target field is the second value, other electronic equipment determines that the authentication mode is a PIN authentication mode based on the corresponding relation between the target field and the authentication mode. The principle of the preset correspondence relation or the setting mode of the correspondence relation called from other electronic devices is the same, and will not be described herein.
Step S21-2: the first electronic device adds the target field to the target field position of the second broadcast data packet to obtain the first broadcast data packet.
In this step, a target field position is determined in the second broadcast data packet, and a target field is added to the target field position to obtain the first broadcast data packet.
In the implementation manner, the target field is added in the second broadcast data packet to obtain the first broadcast data packet capable of indicating the authentication mode of the first Bluetooth module, so that the second electronic device can acquire the authentication mode of the first Bluetooth module through the first broadcast data packet, and further, when the second electronic device establishes Bluetooth connection with the first Bluetooth module of the first electronic device, the process of determining the authentication mode of the first Bluetooth module is not required to be initiated in the Bluetooth pairing process, the step of establishing Bluetooth connection is simplified, and the speed of Bluetooth connection is further improved.
Before this step, the first electronic device determines an authentication mode of the first bluetooth module, and the process includes: the first electronic equipment acquires attribute information of the first Bluetooth module; the first electronic equipment analyzes the attribute information to obtain an authentication mode of the first Bluetooth module.
It should be noted that, the first electronic device executes the step of determining the authentication mode of the first bluetooth module after the bluetooth function is started, caches the authentication mode of the first bluetooth module locally, and deletes the cached authentication mode of the first bluetooth module after the bluetooth function is closed. Or the first electronic equipment obtains the authentication mode of the first Bluetooth module once when leaving the factory, the authentication mode is stored locally, and when the Bluetooth function is started, the authentication mode of the first Bluetooth module is obtained from the local storage. The process of the first electronic device obtaining the authentication mode of the first bluetooth module is the same as the principle of the first electronic device obtaining the authentication mode of the first bluetooth module based on the attribute information, which is not described herein again.
In the implementation mode, the authentication mode of the first Bluetooth module is acquired through the attribute information of the first Bluetooth module, so that the accuracy of the acquired authentication mode of the first Bluetooth module is ensured.
Step S22: the first electronic device broadcasts a first broadcast data packet through the second Bluetooth module, the first Bluetooth module and the second Bluetooth module adopt different Bluetooth modes, and the first broadcast data packet indicates to initiate Bluetooth connection based on an authentication mode.
The second Bluetooth module is a BLE Bluetooth module, wherein the second Bluetooth module periodically broadcasts and broadcasts the first broadcast data packet. The broadcasting period is set as required, and in the embodiment of the present application, the broadcasting period is not particularly limited. For example, the broadcasting period is 1s, 3s, 5s, or the like.
In the implementation manner, the first broadcast data packet is broadcast through the autonomous broadcast function of the BLE Bluetooth module, and the target field representing the authentication mode of the first Bluetooth module is added in the first broadcast data packet, so that the authentication mode of the first Bluetooth module is broadcast to the second electronic equipment, and when the second electronic equipment establishes Bluetooth connection with the first Bluetooth module, the authentication mode of the first Bluetooth module is not required to be acquired again in the pairing process, and the efficiency of establishing Bluetooth connection is improved.
The first broadcast data packet indicates an authentication mode of the first bluetooth module. The second electronic device scans the broadcasted first broadcast data packet, analyzes the scanned first broadcast data packet to obtain a plurality of fields of the first broadcast data packet, determines a target field from the plurality of fields, determines an authentication mode of the first Bluetooth module based on the target field, and sends a pairing request to the first electronic device based on the authentication mode of the first Bluetooth module, wherein the pairing request is used for requesting the first Bluetooth module of the first electronic device to perform Bluetooth pairing.
It should be noted that, in the process of broadcasting the first broadcast data through the second bluetooth module, the first electronic device may broadcast the first broadcast data packet on one channel, or may broadcast the first data packet on a plurality of channels respectively. Therefore, the first data packet is broadcast through a plurality of channels, so that the first electronic equipment can scan the first data packet, and the success rate of Bluetooth connection between the first Bluetooth module and the second electronic equipment is improved.
Step S23: and responding to a Bluetooth connection request sent by the second electronic equipment based on the authentication mode, and establishing Bluetooth connection between the first electronic equipment and the second electronic equipment.
Referring to fig. 5, the second electronic device transmits a bluetooth connection request to the first electronic device based on the first broadcast packet. Correspondingly, in the step, the first electronic equipment receives a Bluetooth connection request sent by the second electronic equipment, performs identity authentication on the first electronic equipment based on the Bluetooth connection request, and establishes Bluetooth connection with the second electronic equipment under the condition that authentication is passed. The process is realized by the following steps S23-1 to S23-2, including:
S23-1: and responding to the Bluetooth connection request sent by the second electronic equipment, and authenticating the second electronic equipment by the first electronic equipment based on the authentication mode.
In response to a bluetooth connection operation with a first bluetooth module of the first electronic device, the second electronic device establishes a bluetooth connection with the first bluetooth module of the first electronic device based on an authentication manner of the first bluetooth module.
The Bluetooth connection operation is based on the operation triggered by the second electronic device and is used for requesting to establish Bluetooth connection with the first Bluetooth module of the first electronic device. In some embodiments, the second electronic device displays device identifiers of the plurality of first electronic devices, and in response to detecting a trigger operation on the device identifiers of the first electronic devices, the second electronic device sends a bluetooth connection request to the first electronic devices. The triggering operation may be a clicking operation of a device identifier of the first electronic device, or the like.
In this step, when the second electronic device establishes bluetooth connection with the first bluetooth module of the first electronic device, the second electronic device invokes a target field in the first broadcast packet, determines an authentication mode of the first bluetooth module through the target field, sends a pairing request to the first electronic device based on the authentication mode, and authenticates the second electronic device based on the authentication mode of the first bluetooth module.
Under the condition that the second electronic device stores the corresponding relation between the first electronic device and the target field, the second electronic device determines the corresponding authentication mode of the first electronic device from the corresponding relation between the device identifier and the authentication mode according to the device identifier of the first electronic device corresponding to the Bluetooth connection operation. The process is as follows: the second electronic equipment determines a target field corresponding to the first electronic equipment from a plurality of stored target fields based on the corresponding relation between the equipment identification and the target field according to the equipment identification of the first electronic equipment.
In the implementation manner, the target field corresponding to the first electronic device is determined based on the corresponding relation between the device identifier and the target field through the device identifier of the first electronic device, so that the authentication mode corresponding to the first Bluetooth module corresponding to the Bluetooth connection can be rapidly and accurately determined under the condition that a plurality of target fields are stored in the second electronic device, and the efficiency of establishing the Bluetooth connection is improved.
S23-2: and the first electronic equipment establishes Bluetooth connection with the second electronic equipment under the condition that the identity authentication of the second electronic equipment is passed.
With continued reference to fig. 5, after the authentication is passed, the first electronic device sends a pairing success notification to the second electronic device, the second electronic device sends a connection request to the first electronic device based on the pairing success notification, the first electronic device receives the connection request, and a bluetooth connection is established with the second electronic device based on the connection request.
In the implementation manner, in the process of establishing the Bluetooth connection with the first Bluetooth module of the first electronic device, the authentication mode of the first Bluetooth module is determined through the target field, so that the Bluetooth connection with the first Bluetooth module can be established based on the authentication at the time, and the efficiency of establishing the Bluetooth connection is improved.
The second electronic device deletes the authentication mode of the first bluetooth module scanned this time from the local after establishing bluetooth connection with the first electronic device, and redetermines the authentication mode of the first bluetooth module when scanning next time. Or the second electronic device reserves the authentication mode corresponding to the first electronic device in the scanning, and the authentication mode of the existing first Bluetooth module is not determined again in the next scanning.
Another point to be described is that, with continued reference to fig. 6, in a process of establishing a bluetooth connection between a second electronic device and a first bluetooth module of a first electronic device for the second electronic device that does not store a target field, the second electronic device sends a device name acquisition request to the first electronic device, and determines an authentication manner of the first bluetooth module of the first electronic device based on the device name acquisition request, where the process is implemented by the following steps (1) - (6), including:
(1) In response to a bluetooth connection operation with the first electronic device, the second electronic device transmits a device name acquisition request to the first electronic device without storing a target field corresponding to the first bluetooth module of the first electronic device.
And after the second electronic device scans the first broadcast data packet, when the first broadcast data packet does not comprise the target field, responding to Bluetooth connection operation with the first electronic device, and sending a device name acquisition request to the first electronic device by the second electronic device.
The device name acquisition request (RNR, remote Name Request) is used to acquire the device name of the first electronic device.
(2) And the first electronic equipment receives the equipment name acquisition request sent by the second electronic equipment.
The device name acquisition request is sent by the electronic device without determining an authentication mode from the first broadcast data packet.
In this step, a temporary bluetooth connection is established between the second electronic device and the first electronic device, the temporary bluetooth connection being used by the second electronic device to obtain the device name of the first electronic device. The first electronic device receives a name acquisition request sent by the first electronic device through the temporary Bluetooth connection.
(3) The first electronic device generates a request response message based on the authentication mode of the first Bluetooth module.
The response message carries device information of the first electronic device, where the device information indicates an authentication mode of the first bluetooth module.
When the first electronic device generates a request response message, feature information (feature) to be exchanged with the second electronic device is added to the request response message, wherein the feature comprises device information of the first electronic device, and the device information is used for indicating an authentication mode of a first Bluetooth module of the first electronic device. For example, the device information includes protocol version information of a bluetooth connection protocol of the first bluetooth module, where different version information corresponds to different authentication modes, and in this step, the first electronic device adds the protocol version of the bluetooth connection protocol used by the first bluetooth module to the request response message.
(4) The first electronic device sends the request response message to the second electronic device.
The first electronic device sends the request reply message to the second electronic device via the temporary bluetooth connection.
(5) The second electronic device receives the request response message sent by the first electronic device.
The second electronic device receives the request response message sent by the first electronic device through the temporary Bluetooth connection.
(6) The second electronic device determines an authentication mode of a first Bluetooth module in the first electronic device from the corresponding relation between the device information and the authentication mode based on the device information of the first electronic device carried in the request response message.
In this step, after receiving the request response message, the second electronic device analyzes the request response message to obtain device information carried in the request response message, and determines an authentication mode of the first bluetooth module in the first electronic device based on a correspondence between the device information and the authentication mode.
For example, the device information includes protocol version information of a bluetooth connection protocol of the first bluetooth module, where different version information corresponds to different authentication modes, and in this step, the second electronic device determines, based on the request response message, a protocol version of the bluetooth connection protocol used by the first bluetooth module, and determines an authentication mode of the first bluetooth module from a correspondence between the protocol version and the authentication mode.
In the implementation manner, under the condition that the second electronic device does not determine the authentication manner of the first Bluetooth module from the first broadcast data packet, the second electronic device obtains the authentication manner of the first Bluetooth module by sending a device name obtaining request to the first electronic device, so that under the condition that the second electronic device does not determine the authentication manner of the first Bluetooth module from the first broadcast data packet, the authentication manner of the first Bluetooth module can also be obtained, thereby ensuring that the second electronic device and the first electronic device establish Bluetooth connection, and improving the success rate of Bluetooth connection.
In the embodiment of the application, the first broadcast data packet added with the target field of the authentication mode of the first Bluetooth module is broadcast through the second Bluetooth module, so that the second electronic device can acquire the authentication mode of the first Bluetooth module through the first broadcast data packet, and the second electronic device does not need to initiate the process of determining the authentication mode of the first Bluetooth module in the process of Bluetooth pairing when establishing Bluetooth connection with the first Bluetooth module of the first electronic device, thereby simplifying the step of establishing Bluetooth connection and further improving the speed of Bluetooth connection.
Referring to fig. 6, a block diagram of a bluetooth-based device connection apparatus according to an exemplary embodiment of the present application is shown. The apparatus may be implemented as all or part of a processor by software, hardware, or a combination of both. The device comprises:
a generating module 601, configured to generate a first broadcast packet based on an authentication manner of the first bluetooth module;
The broadcasting module 602 is configured to broadcast the first broadcast packet through a second bluetooth module, where the first bluetooth module and the second bluetooth module adopt different bluetooth modes, and the first broadcast packet indicates to initiate bluetooth connection based on the authentication mode;
the bluetooth connection module 603 is configured to establish a bluetooth connection with the electronic device in response to a bluetooth connection request sent by the electronic device based on the authentication method.
In some embodiments, the generating module 601 includes:
the determining unit is used for determining a target field based on the authentication mode, wherein the target field represents the authentication mode of the first Bluetooth module;
and the adding unit is used for adding the target field to the target field position of the second broadcast data packet to obtain the first broadcast data packet.
In some embodiments, the determining unit is configured to set the target field to a first value in a case where the authentication method is a secure simple pairing SSP authentication method; and setting the target field to be a second value when the authentication mode is a personal identification number PIN authentication mode, wherein the first value is different from the second value.
In some embodiments, the apparatus further comprises:
the acquisition module is used for acquiring attribute information of the first Bluetooth module;
and the analysis module is used for analyzing the attribute information to obtain the authentication mode of the first Bluetooth module.
In some embodiments, the bluetooth connection module 603 includes:
an authentication unit, configured to authenticate the electronic device based on the authentication method in response to a bluetooth connection request sent by the electronic device;
And the Bluetooth connection unit is used for establishing Bluetooth connection with the electronic equipment under the condition that the identity authentication of the electronic equipment is passed.
In some embodiments, the apparatus further comprises:
The receiving module is used for receiving an equipment name acquisition request sent by the electronic equipment, wherein the equipment name acquisition request is sent by the electronic equipment under the condition that an authentication mode is not determined from the first broadcast data packet;
A generating module 601, configured to generate a request response message based on an authentication manner of the first bluetooth module;
and the sending module is used for sending the request response message to the electronic equipment, wherein the response message carries equipment information of the electronic equipment, and the equipment information represents an authentication mode of the first Bluetooth module.
In some embodiments, the first bluetooth module is a basic rate/enhanced rate BR/EDR bluetooth module and the second bluetooth module is a bluetooth low energy BLE module.
In the embodiment of the application, the first broadcast data packet added with the target field of the authentication mode of the first Bluetooth module is broadcast through the second Bluetooth module, so that the second electronic device can acquire the authentication mode of the first Bluetooth module through the first broadcast data packet, and the second electronic device does not need to initiate the process of determining the authentication mode of the first Bluetooth module in the process of Bluetooth pairing when establishing Bluetooth connection with the first Bluetooth module of the first electronic device, thereby simplifying the step of establishing Bluetooth connection and further improving the speed of Bluetooth connection.
Referring to fig. 7, a block diagram of an electronic device according to an exemplary embodiment of the present application is shown. The electronic device 700 is an electronic device with a bluetooth module. For example, the electronic device 700 may be a cell phone, tablet, wearable device, bluetooth headset, or the like. The electronic device 700 of the present application may include one or more of the following components: processor 710, memory 720, and bluetooth module 730.
Processor 710 may include one or more processing cores. The processor 710 utilizes various interfaces and lines to connect various portions of the overall electronic device 700, perform various functions of the electronic device 700, and process data by executing or executing program code, programs, code sets, or program code sets stored in the memory 720, and invoking data stored in the memory 720. Alternatively, the processor 710 may be implemented in hardware in at least one of digital signal Processing (DIGITAL SIGNAL Processing, DSP), field-Programmable gate array (Field-Programmable GATE ARRAY, FPGA), programmable logic array (Programmable Logic Array, PLA). The processor 710 may integrate one or a combination of several of a central processing unit (Central Processing Unit, CPU), an image processor (Graphics Processing Unit, GPU), a neural network processor (Neural-network Processing Unit, NPU), and a modem, etc. The CPU mainly processes an operating system, a user interface, an application program and the like; the GPU is used for rendering and drawing the content required to be displayed by the display screen; the NPU is used for realizing an artificial intelligence (ARTIFICIAL INTELLIGENCE, AI) function; the modem is used to handle wireless communications. It will be appreciated that the modem may not be integrated into the processor 710 and may be implemented by a single chip.
The Memory 720 may include random access Memory (Random Access Memory, RAM) or Read-Only Memory (ROM). Optionally, the memory 720 includes a non-transitory computer-readable medium (non-transitory computer-readable storage medium). Memory 720 may be used to store program code, programs, code sets, or program code sets. The memory 720 may include a stored program area and a stored data area, wherein the stored program area may store program code for implementing an operating system, program code for at least one function (such as a touch function, a sound playing function, an image playing function, etc.), program code for implementing the various method embodiments described below, etc.; the storage data area may store data (e.g., audio data, phonebook) created according to the use of the electronic device 700, etc.
The bluetooth module 730 is used to establish connection with bluetooth modules of other electronic devices, broadcast and receive bluetooth signals. For example, the bluetooth module 730 may be a bluetooth host (host), or the like.
In some embodiments, the electronic device 700 also includes a display screen. The display screen is a display component for displaying a user interface. Optionally, the display screen is a display screen with a touch function, and through the touch function, a user can perform touch operation on the display screen by using any suitable object such as a finger, a touch pen, and the like.
The display screen is typically disposed on a front panel of the electronic device 700. The display screen may be designed as a full screen, a curved screen, a contoured screen, a double-sided screen, or a folded screen. The display screen can also be designed into a combination of a full screen and a curved screen, a combination of a special-shaped screen and a curved screen, and the like, which is not limited in this embodiment.
In addition, those skilled in the art will appreciate that the configuration of the electronic device 700 shown in the above-described figures does not constitute a limitation of the electronic device 700, and the electronic device 700 may include more or less components than illustrated, or may combine certain components, or may have a different arrangement of components. For example, the electronic device 700 further includes a microphone, a speaker, a radio frequency circuit, an input unit, a sensor, an audio circuit, a wireless fidelity (WIRELESS FIDELITY, wi-Fi) module, a power supply, and the like, which are not described herein.
Embodiments of the present application also provide a computer readable medium storing at least one program code loaded and executed by the processor to implement the bluetooth-based device connection method as shown in the various embodiments above.
Embodiments of the present application also provide a computer program product storing at least one program code loaded and executed by the processor to implement the bluetooth-based device connection method as shown in the various embodiments above.
In some embodiments, a computer program according to an embodiment of the present application may be deployed to be executed on one computer device or on multiple computer devices located at one site or on multiple computer devices distributed across multiple sites and interconnected by a communication network, where the multiple computer devices distributed across multiple sites and interconnected by a communication network may constitute a blockchain system.
Those skilled in the art will appreciate that in one or more of the examples described above, the functions described in the embodiments of the present application may be implemented in hardware, software, firmware, or any combination thereof. When implemented in software, these functions may be stored on or transmitted over as one or more program codes or code on a computer-readable medium. Computer-readable media includes both computer storage media and communication media including any medium that facilitates transfer of a computer program from one place to another. A storage media may be any available media that can be accessed by a general purpose or special purpose computer.
The foregoing description of the preferred embodiments of the present application is not intended to limit the application, but rather, the application is to be construed as limited to the appended claims.

Claims (8)

1. A method for bluetooth based device connection, the method comprising:
setting a target field as a first numerical value under the condition that the authentication mode of the first Bluetooth module is a safe and simple pairing SSP authentication mode, wherein the target field represents the authentication mode of the first Bluetooth module;
Setting the target field to be a second value when the authentication mode is a personal identification number PIN authentication mode, wherein the first value is different from the second value;
Adding the target field to the target field position of the second broadcast data packet to obtain a first broadcast data packet;
Broadcasting the first broadcast data packet through a second Bluetooth module, wherein the first Bluetooth module and the second Bluetooth module adopt different Bluetooth modes, and the first broadcast data packet indicates to initiate Bluetooth connection based on the authentication mode;
and responding to a Bluetooth connection request sent by the electronic equipment based on the authentication mode, and establishing Bluetooth connection with the electronic equipment.
2. The method according to claim 1, wherein the method further comprises:
Acquiring attribute information of the first Bluetooth module;
and analyzing the attribute information to obtain an authentication mode of the first Bluetooth module.
3. The method according to claim 1, wherein the establishing a bluetooth connection with the electronic device in response to a bluetooth connection request sent by the electronic device based on the authentication method includes:
responding to a Bluetooth connection request sent by the electronic equipment, and authenticating the electronic equipment based on the authentication mode;
and under the condition that the identity authentication of the electronic equipment is passed, establishing Bluetooth connection with the electronic equipment.
4. The method according to claim 1, wherein the method further comprises:
Receiving an equipment name acquisition request sent by the electronic equipment, wherein the equipment name acquisition request is sent by the electronic equipment under the condition that an authentication mode is not determined from the first broadcast data packet;
Generating a request response message based on the authentication mode of the first Bluetooth module;
and sending the request response message to the electronic equipment, wherein the request response message carries equipment information of the electronic equipment, and the equipment information represents an authentication mode of the first Bluetooth module.
5. The method of any of claims 1-4, wherein the first bluetooth module is a basic rate/enhanced rate BR/EDR bluetooth module and the second bluetooth module is a bluetooth low energy BLE module.
6. A bluetooth-based device connection apparatus, the apparatus comprising:
The generating module is used for setting a target field as a first numerical value under the condition that the authentication mode of the first Bluetooth module is a safe and simple pairing SSP authentication mode, wherein the target field represents the authentication mode of the first Bluetooth module; setting the target field to be a second value when the authentication mode is a personal identification number PIN authentication mode, wherein the first value is different from the second value; adding the target field to the target field position of the second broadcast data packet to obtain a first broadcast data packet;
The broadcasting module is used for broadcasting the first broadcasting data packet through the second Bluetooth module, the first Bluetooth module and the second Bluetooth module adopt different Bluetooth modes, and the first broadcasting data packet indicates to initiate Bluetooth connection based on the authentication mode;
and the Bluetooth connection module is used for responding to a Bluetooth connection request sent by the electronic equipment based on the authentication mode and establishing Bluetooth connection with the electronic equipment.
7. An electronic device comprising a processor and a memory; the memory stores at least one program code for execution by the processor to implement the bluetooth-based device connection method according to any one of claims 1 to 5.
8. A computer readable storage medium storing at least one program code for execution by a processor to implement the bluetooth based device connection method of any one of claims 1 to 5.
CN202110956404.8A 2021-08-19 2021-08-19 Bluetooth-based device connection method and device, electronic device and storage medium Active CN113677039B (en)

Priority Applications (2)

Application Number Priority Date Filing Date Title
CN202110956404.8A CN113677039B (en) 2021-08-19 2021-08-19 Bluetooth-based device connection method and device, electronic device and storage medium
PCT/CN2022/113716 WO2023020617A1 (en) 2021-08-19 2022-08-19 Bluetooth-based device connection method and apparatus, electronic device, and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202110956404.8A CN113677039B (en) 2021-08-19 2021-08-19 Bluetooth-based device connection method and device, electronic device and storage medium

Publications (2)

Publication Number Publication Date
CN113677039A CN113677039A (en) 2021-11-19
CN113677039B true CN113677039B (en) 2024-05-03

Family

ID=78544215

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202110956404.8A Active CN113677039B (en) 2021-08-19 2021-08-19 Bluetooth-based device connection method and device, electronic device and storage medium

Country Status (2)

Country Link
CN (1) CN113677039B (en)
WO (1) WO2023020617A1 (en)

Families Citing this family (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113677039B (en) * 2021-08-19 2024-05-03 Oppo广东移动通信有限公司 Bluetooth-based device connection method and device, electronic device and storage medium

Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN109788461A (en) * 2017-11-15 2019-05-21 深圳市优必选科技有限公司 Bluetooth dual mode data communication means and device
WO2021043286A1 (en) * 2019-09-06 2021-03-11 华为技术有限公司 Bluetooth connection method and electronic device
EP3806342A1 (en) * 2018-08-01 2021-04-14 Huawei Technologies Co., Ltd. Bluetooth communication method, and dual-mode bluetooth terminal

Family Cites Families (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US9961484B2 (en) * 2016-01-22 2018-05-01 Lg Electronics Inc. Method and apparatus for controlling a device using bluetooth technology
CN108924805B (en) * 2018-07-13 2021-05-14 杭州网易云音乐科技有限公司 Bluetooth connection method, medium, first electronic device, second electronic device and computing device
CN113225693B (en) * 2019-04-18 2022-04-15 华为技术有限公司 Bluetooth connection method, equipment and system
CN113677039B (en) * 2021-08-19 2024-05-03 Oppo广东移动通信有限公司 Bluetooth-based device connection method and device, electronic device and storage medium

Patent Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN109788461A (en) * 2017-11-15 2019-05-21 深圳市优必选科技有限公司 Bluetooth dual mode data communication means and device
EP3806342A1 (en) * 2018-08-01 2021-04-14 Huawei Technologies Co., Ltd. Bluetooth communication method, and dual-mode bluetooth terminal
WO2021043286A1 (en) * 2019-09-06 2021-03-11 华为技术有限公司 Bluetooth connection method and electronic device

Also Published As

Publication number Publication date
WO2023020617A1 (en) 2023-02-23
CN113677039A (en) 2021-11-19

Similar Documents

Publication Publication Date Title
CN110582078B (en) Bluetooth pairing method and device, storage medium and electronic equipment
CN105704837B (en) Method and equipment for establishing wireless connection
CN105744466B (en) A kind of connection method of Bluetooth device and bluetooth equipment
RU2549521C2 (en) Indirect communication between devices
CN110032512B (en) Debugging method of small program, related equipment and terminal
CN112020048B (en) Bluetooth device pairing method, device and storage medium
CN105100141B (en) Multimedia content network sharing method, apparatus and system
WO2023020618A1 (en) Bluetooth-based device connection method and apparatus, electronic device and storage medium
CN111431734A (en) Network distribution method of intelligent equipment and related device
CN112312586A (en) WiFi direct connection establishing method, device, equipment and storage medium
CN112887952B (en) Method and device for connecting Bluetooth device and terminal, and electronic device
CN109886670B (en) Payment method, device, system, mobile terminal, payment machine and server
CN111356117A (en) Voice interaction method and Bluetooth device
CN113489630A (en) Network distribution method, device, storage medium and electronic terminal
CN114844657A (en) Website login method, communication system and electronic equipment
CN113677039B (en) Bluetooth-based device connection method and device, electronic device and storage medium
CN111970676B (en) WiFi hot spot access method, device, equipment and storage medium
CN107317828B (en) File downloading method and device
CN109600340B (en) Operation authorization method, device, terminal and server
CN113490194A (en) Bluetooth-based equipment connection method and device, electronic equipment and storage medium
CN111831367A (en) Application operation method, wearable device and device with storage function
CN104766599A (en) Intelligent music beat interaction equipment
CN115278624A (en) Information updating method and device, audio sharing method and system and electronic equipment
CN111601364B (en) Method for sending and receiving network identification information and communication equipment
CN111615219B (en) PC5 link establishing method, equipment and system

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant