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

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

Info

Publication number
CN113677039A
CN113677039A CN202110956404.8A CN202110956404A CN113677039A CN 113677039 A CN113677039 A CN 113677039A CN 202110956404 A CN202110956404 A CN 202110956404A CN 113677039 A CN113677039 A CN 113677039A
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.)
Granted
Application number
CN202110956404.8A
Other languages
Chinese (zh)
Other versions
CN113677039B (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
Priority claimed from CN202110956404.8A external-priority 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

Images

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

Abstract

The application relates to a Bluetooth-based equipment 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 the 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 the authentication mode, and establishing Bluetooth connection with the electronic equipment. Through the scheme, when the second electronic device establishes the Bluetooth connection with the first Bluetooth module of the first electronic device, the process of determining the authentication mode of the first Bluetooth module does not need to be initiated in the Bluetooth pairing process, the step of establishing the Bluetooth connection is simplified, and the Bluetooth connection speed is further improved.

Description

Bluetooth-based equipment connection method and device, electronic equipment 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, an electronic device and a storage medium.
Background
For a dual mode bluetooth electronic device, the electronic device includes two bluetooth modules. Namely a Basic Rate/Enhanced Data Rate (BR/EDR) bluetooth module and a Bluetooth Low Energy (BLE) module. When the BR/EDR module is in Bluetooth connection with other electronic equipment, the other electronic equipment is required to determine the authentication mode of the BR/EDR module in the pairing stage, identity authentication is carried out through the authentication mode, and after the identity authentication is passed, Bluetooth connection is established.
In the related art, the process of acquiring the authentication mode of the BR/EDR module by the electronic device includes: the electronic equipment sends a device Name acquisition 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 the 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 a cumbersome process of establishing the bluetooth connection and low efficiency of the bluetooth connection.
Disclosure of Invention
The embodiment of the application provides a device connection method and device based on Bluetooth, an electronic device and a storage medium, and the Bluetooth connection efficiency can be improved. The technical scheme is as follows:
in one aspect, a bluetooth-based device connection method is provided, the method including:
generating a first broadcast data packet based on the 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 including:
the generating module is used for generating a first broadcast data packet based on the authentication mode of the first Bluetooth module;
a broadcast module, configured to broadcast the first broadcast packet through a second bluetooth module, where the first bluetooth module and the second bluetooth module use different bluetooth modes, and the first broadcast packet indicates to initiate a 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, the 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 as described in the above aspect.
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, a computer program product is provided, which stores at least one program code, which is 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 when the second electronic device establishes bluetooth connection with the first bluetooth module of the first electronic device, a process of determining the authentication mode of the first bluetooth module does not need to be initiated in a bluetooth pairing process, steps of establishing bluetooth connection are simplified, and the speed of bluetooth connection is further improved.
Drawings
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;
FIG. 2 illustrates a flowchart of a Bluetooth-based device connection method in accordance with an exemplary embodiment of the present application;
FIG. 3 illustrates a flowchart of a Bluetooth-based device connection method in accordance with an exemplary embodiment of the present application;
FIG. 4 illustrates a flowchart of a Bluetooth-based device connection method in accordance with an exemplary embodiment of the present application;
FIG. 5 illustrates a flowchart of a Bluetooth-based device connection method in accordance with an exemplary embodiment of the present application;
fig. 6 is a block diagram illustrating a structure 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
To make the objects, technical solutions and advantages of the present application more clear, embodiments of the present application will be described in further detail below with reference to the accompanying drawings.
Reference herein to "a plurality" means two or more. "and/or" describes the association relationship of the associated objects, meaning that there may be three relationships, e.g., a and/or B, which may mean: a exists alone, A and B exist simultaneously, and B exists alone. The character "/" generally indicates that the former and latter associated objects are in an "or" relationship. The broadcast data packet, the device identifier and other information referred by the present application may be information authorized by the 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 for explanation, the first electronic device can establish a 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 including Bluetooth modules in different modes. For example, the bluetooth modules in different modes are a Basic Rate/Enhanced Data Rate (BR/EDR) bluetooth module and a Bluetooth Low Energy (BLE) module. A single mode bluetooth device refers to an electronic device that includes a bluetooth module, for example, 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 process that the BLE module and the BR/EDR Bluetooth module are connected with the second electronic device in a Bluetooth mode. The BLE module establishes Bluetooth connection with a Bluetooth module of the second electronic device through 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 a bluetooth connection to the BLE bluetooth module based on the default authentication mode of the BLE module. 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 device sends a Bluetooth search request, the first electronic device sends a scanning response message to the second electronic device after receiving the Bluetooth search request, the second electronic device obtains the authentication mode of the BR/EDR Bluetooth module of the first electronic device after receiving the scanning response message, and the 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 a range of the bluetooth module broadcast message in the first electronic device and the second electronic device, and in this embodiment, 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, the first electronic device and the second electronic device may each be at least one of a mobile phone, a tablet Computer, a PC (Personal Computer), or a wearable device, in which a bluetooth module is installed. 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.
Referring to fig. 2, a flowchart illustrating a bluetooth-based device connection method according to an exemplary embodiment of the present application is shown. The execution subject in the embodiment of the present application is the first electronic device, and may also be a bluetooth module of the first electronic device, a processor of the first electronic device, or an operating system of the first electronic device. The method comprises the following steps:
step S21: the first electronic equipment generates a first broadcast data packet based on the authentication mode of the first Bluetooth module.
Wherein, first bluetooth module is 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, wherein the target field represents the authentication mode of the first Bluetooth module.
The authentication mode of the first Bluetooth module is used for authenticating the identity of 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 types of the authentication methods are set as needed, and the authentication methods include, for example, a Secure Simple Pairing (SSP) authentication method and a 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 that the authentication mode is a secure simple pairing SSP authentication mode, setting the target field to be a first value; and if the authentication mode is a personal identification number PIN authentication mode, setting the target field as a second numerical value.
The first numerical value and the second numerical value are different and are set according to needs, and in the embodiment of the disclosure, the first numerical value and the second numerical value are not particularly 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 mode, sets the value of the target field to a first value if the first bluetooth module supports the SSP authentication mode, and sets the value of the target field to a second value if the first bluetooth module does not support the SSP authentication mode. And adding the target field with the set value into a second broadcast data packet to obtain a first broadcast data packet so as to broadcast the first broadcast data packet.
It should be noted that, the first electronic device determines the target fields corresponding to different authentication manners according to the corresponding relationship between the target fields and the authentication manners. 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, when the authentication mode is the SSP authentication mode, the first electronic device determines that the target field is the first numerical value based on the corresponding relationship between the authentication mode and the target field; and under the condition that the authentication mode is the PIN authentication mode, the first electronic equipment 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 mode, 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.
It should be noted that, the second electronic device may also store the corresponding relationship between the target field and the authentication method in advance, or the second electronic device invokes the corresponding relationship between the target field and the authentication method stored in the server from another electronic device, so that the second electronic device can determine the authentication method of the first bluetooth module from the corresponding relationship between the target field and the authentication method according to the target field. For example, when the target field is the first value, the other electronic device determines that the authentication mode is the 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 numerical value, the other electronic equipment determines that the authentication mode is the PIN authentication mode based on the corresponding relation between the target field and the authentication mode. The principles of the setting modes of the correspondence stored in advance or the correspondence called from other electronic devices are the same, and are not described herein again.
Step S21-2: and the first electronic equipment adds the target field into the target field position of the second broadcast data packet to obtain the first broadcast data packet.
In this step, the position of the target field is determined in the second broadcast packet, and the target field is added to the position of the target field to obtain the first broadcast packet.
In the implementation mode, 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 the bluetooth connection with the first bluetooth module of the first electronic device, the process of determining the authentication mode of the first bluetooth module does not need to be initiated in the process of bluetooth pairing, the step of establishing the 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 the attribute information of the first Bluetooth module; the first electronic device 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 turned off. Or the first electronic device obtains the authentication mode of the first bluetooth module once when leaving the factory, stores the authentication mode in the local, and obtains the authentication mode of the first bluetooth module from the local storage when the bluetooth function is started. The process of acquiring the authentication mode of the first bluetooth module by the first electronic device is the same as the principle of acquiring the authentication mode of the first bluetooth module based on the attribute information by the first electronic device, and is not repeated here.
In the implementation mode, the authentication mode of the first Bluetooth module is acquired through the attribute information of the first Bluetooth module, and the accuracy of the acquired authentication mode of the first Bluetooth module is ensured.
Step S22: the first electronic equipment 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 that Bluetooth connection is initiated based on an authentication mode.
The second Bluetooth module is a BLE Bluetooth module, wherein the second Bluetooth module broadcasts the first broadcast data packet periodically. The broadcast period is set as needed, and in the embodiment of the present application, the broadcast period is not specifically limited. For example, the broadcast period is 1s, 3s, 5s, or the like.
In this implementation manner, the first broadcast data packet is broadcast through the autonomous broadcast function of the BLE bluetooth module, and since the target field indicating the authentication manner of the first bluetooth module is added to the first broadcast data packet, the authentication manner of the first bluetooth module is broadcast to the second electronic device, so that when the second electronic device establishes bluetooth connection with the first bluetooth module, the authentication manner of the first bluetooth module does not need to be acquired again in the pairing process, and the efficiency of establishing bluetooth connection is improved.
The first broadcast 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 carry out 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 broadcast the first broadcast data packet on a plurality of channels, respectively. Therefore, the first data packet is broadcasted through the plurality of channels, 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 this step, the first electronic device receives a bluetooth connection request sent by the second electronic device, performs identity authentication on the first electronic device based on the bluetooth connection request, and establishes bluetooth connection with the second electronic device when the 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.
And responding to the Bluetooth connection operation with the first Bluetooth module of the first electronic equipment, and establishing Bluetooth connection with the first Bluetooth module of the first electronic equipment by the second electronic equipment based on the authentication mode of the first Bluetooth module.
The Bluetooth connection operation is an operation triggered based on 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, a plurality of device identifications of the first electronic devices are exposed in the second electronic device, and in response to detecting a trigger operation on the device identifications 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 click operation on 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 method of the first bluetooth module through the target field, sends a pairing request to the first electronic device based on the authentication method, and authenticates the second electronic device based on the authentication method of the first bluetooth module.
And under the condition that the second electronic equipment stores the corresponding relation between the first electronic equipment and the target field, the second electronic equipment determines the authentication mode corresponding to the first electronic equipment from the corresponding relation between the equipment identification and the authentication mode according to the equipment identification of the first electronic equipment corresponding to the Bluetooth connection operation. The process is as follows: and the second electronic equipment determines a target field corresponding to the first electronic equipment from the stored multiple 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 this implementation manner, the target field corresponding to the first electronic device is determined based on the corresponding relationship between the device identifier and the target field through the device identifier of the first electronic device, so that the authentication manner corresponding to the first bluetooth module corresponding to the bluetooth connection can be quickly and accurately determined under the condition that the second electronic device stores a plurality of target fields, and the efficiency of establishing the bluetooth connection is further improved.
S23-2: and the first electronic equipment establishes Bluetooth connection with the second electronic equipment under the condition that the second electronic equipment passes the identity authentication.
With 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, and the first electronic device receives the connection request and establishes a bluetooth connection with the second electronic device based on the connection request.
In the implementation mode, 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 at that time based on the authentication, and the efficiency of establishing the Bluetooth connection is improved.
It should be noted that, after establishing a bluetooth connection with the first electronic device, the second electronic device locally deletes the authentication method of the first bluetooth module scanned this time, and re-determines the authentication method of the first bluetooth module during the next scanning. Or the second electronic device reserves the authentication mode corresponding to the first electronic device scanned this time, and the existing authentication mode of the first bluetooth module is not determined again in the next scanning.
Another point to be explained is that, with continued reference to fig. 6, in a process that, for a second electronic device that does not store a target field, the second electronic device establishes a bluetooth connection with a first bluetooth module of the first electronic device, the second electronic device sends a device name acquisition request to the first electronic device, and determines an authentication method 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), and includes:
(1) in response to the Bluetooth connection operation with the first electronic device, the second electronic device sends a device name acquisition request to the first electronic device when the target field corresponding to the first Bluetooth module of the first electronic device is not stored.
And after scanning the first broadcast data packet, when the second electronic device determines that the first broadcast data packet does not contain the target field, responding to the 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) is used to acquire a 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 the authentication method from the first broadcast packet.
In this step, a temporary bluetooth connection is established between the second electronic device and the first electronic device, where the temporary bluetooth connection is used for the second electronic device to obtain the device name of the first electronic device. And the first electronic equipment receives the name acquisition request sent by the first electronic equipment through the temporary Bluetooth connection.
(3) The first electronic equipment generates a request response message based on the authentication mode of the first Bluetooth module.
The response message carries equipment information of the first electronic equipment, and the equipment information represents an authentication mode of the first Bluetooth module.
When the first electronic device generates the request response message, feature information (feature) which needs to be exchanged with the second electronic device is added to the request response message, wherein the feature includes 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 manners, 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 through the temporary bluetooth connection.
(5) And the second electronic equipment receives the request response message sent by the first electronic equipment.
And the second electronic equipment receives the request response message sent by the first electronic equipment through the temporary Bluetooth connection.
(6) And the second electronic equipment determines the authentication mode of the first Bluetooth module in the first electronic equipment from the corresponding relation between the equipment information and the authentication mode based on the equipment information of the first electronic equipment carried in the request response message.
In this step, after receiving the request response message, the second electronic device parses the request response message to obtain the device information carried in the request response message, and determines the authentication mode of the first bluetooth module in the first electronic device based on the 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 manners, in this step, the second electronic device determines a protocol version of the bluetooth connection protocol used by the first bluetooth module based on the request response message, and determines the authentication manner of the first bluetooth module from a correspondence between the protocol version and the authentication manner.
In this implementation manner, when the second electronic device does not determine the authentication method of the first bluetooth module from the first broadcast data packet, the second electronic device obtains the authentication method of the first bluetooth module by sending a device name obtaining request to the first electronic device, so that the authentication method of the first bluetooth module can be obtained even when the second electronic device does not determine the authentication method of the first bluetooth module from the first broadcast data packet, thereby ensuring that the second electronic device establishes bluetooth connection with the first electronic device, 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 when the second electronic device establishes bluetooth connection with the first bluetooth module of the first electronic device, a process of determining the authentication mode of the first bluetooth module does not need to be initiated in a bluetooth pairing process, steps of establishing bluetooth connection are simplified, and the speed of bluetooth connection is further improved.
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, in software, hardware, or a combination of both. The device includes:
a generating module 601, configured to generate a first broadcast data packet based on an authentication method of the first bluetooth module;
a broadcasting module 602, configured to broadcast the first broadcast packet through a second bluetooth module, where the first bluetooth module and the second bluetooth module use different bluetooth modes, and the first broadcast packet indicates to initiate a 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 manner.
In some embodiments, the generating module 601 includes:
a determining unit, configured to determine a target field based on the authentication manner, where the target field indicates an authentication manner of the first bluetooth module;
and the adding unit is used for adding the target field into 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 if the authentication mode is a secure simple pairing SSP authentication mode; and in the case that the authentication mode is a personal identification number PIN authentication mode, setting the target field to be a second numerical value, wherein the first numerical value is different from the second numerical value.
In some embodiments, the apparatus further comprises:
the acquisition module is used for acquiring the 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:
the authentication unit is used for responding to the Bluetooth connection request sent by the electronic equipment and authenticating the electronic equipment based on the authentication mode;
and the Bluetooth connection unit is used for establishing Bluetooth connection with the electronic equipment under the condition that the electronic equipment passes the identity authentication.
In some embodiments, the apparatus further comprises:
a receiving module, configured to receive an apparatus name acquisition request sent by the electronic apparatus, where the apparatus name acquisition request is sent by the electronic apparatus when the authentication manner is not determined from the first broadcast packet;
a generating module 601, configured to generate a request response message based on the 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 the 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 when the second electronic device establishes bluetooth connection with the first bluetooth module of the first electronic device, a process of determining the authentication mode of the first bluetooth module does not need to be initiated in a bluetooth pairing process, steps of establishing bluetooth connection are simplified, and the speed of bluetooth connection is further improved.
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 having a bluetooth module. For example, the electronic device 700 may be a cell phone, a tablet, a wearable device, a bluetooth headset, and the like. The electronic device 700 in 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 connects various parts within the overall wireless communication module 700 using various interfaces and lines, performs various functions of the electronic device 700 and processes data by running or executing program code, programs, code sets, or program code sets stored in the memory 720 and calling data stored in the memory 720. Alternatively, the processor 710 may be implemented in hardware using at least one of Digital Signal Processing (DSP), Field-Programmable Gate Array (FPGA), and Programmable Logic Array (PLA). The processor 710 may integrate one or more of a Central Processing Unit (CPU), a Graphics Processing Unit (GPU), a Neural-Network Processing Unit (NPU), a modem, and the like. Wherein, 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 (AI) function; the modem is used to handle wireless communications. It is understood that the modem may not be integrated into the processor 710, but may be implemented by a single chip.
The Memory 720 may include a Random Access Memory (RAM) or a Read-Only Memory (ROM). Optionally, the memory 720 includes a non-transitory computer-readable medium. The 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 various method embodiments described below, and the like; the storage data area may store data (such as audio data, a phonebook) created according to the use of the electronic device 700, and the like.
The bluetooth module 730 is used for establishing connection with bluetooth modules of other electronic devices, broadcasting and receiving 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. A 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 may use any suitable object such as a finger or a touch pen to perform a touch operation on the display screen.
The display screen is typically provided on the front panel of the electronic device 700. The display screen may be designed as a full-face screen, curved screen, odd-shaped screen, double-face screen, or folding screen. The display screen may also be designed as a combination of a full screen and a curved screen, a combination of a special 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 illustrated in the above-described figures does not constitute a limitation of the electronic device 700, and that the electronic device 700 may include more or fewer components than illustrated, or combine certain components, or arrange different 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 (Wi-Fi) module, a power supply, and other components, which are not described herein again.
The present embodiments also provide a computer-readable medium, which stores at least one program code, and the at least one program code is loaded and executed by the processor to implement the bluetooth-based device connection method as shown in the above embodiments.
The present application further provides a computer program product, where at least one program code is stored, and the at least one program code is loaded and executed by the processor to implement the bluetooth-based device connection method as shown in the above embodiments.
In some embodiments, the computer program according to the embodiments of the present application may be deployed to be executed on one computer device or on multiple computer devices located at one site, or may be executed on multiple computer devices distributed at multiple sites and interconnected by a communication network, and the multiple computer devices distributed at the multiple sites and interconnected by the communication network may constitute a block chain system.
Those skilled in the art will recognize 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, the 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 above description is only exemplary of the present application and should not be taken as limiting, as any modification, equivalent replacement, or improvement made within the spirit and principle of the present application should be included in the protection scope of the present application.

Claims (10)

1. A Bluetooth-based device connection method, the method comprising:
generating a first broadcast data packet based on the 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.
2. The method of claim 1, wherein generating the first broadcast packet based on the authentication mode of the first bluetooth module comprises:
determining a target field based on the authentication mode, wherein the target field represents the authentication mode of the first Bluetooth module;
and adding the target field into the target field position of a second broadcast data packet to obtain the first broadcast data packet.
3. The method of claim 2, wherein determining the target field based on the authentication manner comprises:
setting the target field as a first numerical value under the condition that the authentication mode is a safe and simple pairing SSP authentication mode;
and when the authentication mode is a Personal Identification Number (PIN) authentication mode, setting the target field to be a second numerical value, wherein the first numerical value is different from the second numerical value.
4. The method of claim 1, further comprising:
acquiring attribute information of the first Bluetooth module;
and analyzing the attribute information to obtain the authentication mode of the first Bluetooth module.
5. The method according to claim 1, wherein the establishing a bluetooth connection with the electronic device in response to the bluetooth connection request sent by the electronic device based on the authentication manner comprises:
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 passes, establishing Bluetooth connection with the electronic equipment.
6. The method of claim 1, further comprising:
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 the 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 response message carries equipment information of the electronic equipment, and the equipment information represents an authentication mode of the first Bluetooth module.
7. The method according to any of claims 1-6, 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.
8. An apparatus for bluetooth-based device connection, the apparatus comprising:
the generating module is used for generating a first broadcast data packet based on the authentication mode of the first Bluetooth module;
a broadcast module, configured to broadcast the first broadcast packet through a second bluetooth module, where the first bluetooth module and the second bluetooth module use different bluetooth modes, and the first broadcast packet indicates to initiate a 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.
9. 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 as claimed in any one of claims 1 to 7.
10. 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 7.
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 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 Bluetooth-based device connection method and device, electronic device and storage medium

Publications (2)

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

Family

ID=

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2023020617A1 (en) * 2021-08-19 2023-02-23 Oppo广东移动通信有限公司 Bluetooth-based device connection method and apparatus, 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

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

Cited By (1)

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

Also Published As

Publication number Publication date
WO2023020617A1 (en) 2023-02-23

Similar Documents

Publication Publication Date Title
US10142845B2 (en) Network connection method and apparatus, and computer storage medium
CN110032512B (en) Debugging method of small program, related equipment and terminal
CN105704837B (en) Method and equipment for establishing wireless connection
CN112312586B (en) WiFi direct connection establishing method, device, equipment and storage medium
CN105100141B (en) Multimedia content network sharing method, apparatus and system
CN104092723B (en) Document down loading method, Apparatus and system
CN109699019B (en) Broadcast scanning method, device, electronic equipment and storage medium
WO2023020618A1 (en) Bluetooth-based device connection method and apparatus, electronic device and storage medium
CN112887952B (en) Method and device for connecting Bluetooth device and terminal, and electronic device
WO2020156255A1 (en) Payment method, device, system, mobile terminal, payment machine, and server
CN113055864A (en) Bluetooth connection method, device, storage medium and electronic equipment
CN108650671B (en) Method, device, mobile terminal, storage medium and system for establishing Bluetooth connection
WO2018145477A1 (en) Network access method and terminal
CN104581993A (en) Wireless connection building method, data transmission method and terminal
CN106445743A (en) Data backup transmission method and mobile terminal
CN111356117A (en) Voice interaction method and Bluetooth device
US11166141B2 (en) Electronic device and method for displaying inquiry list of external electronic device in Bluetooth™ network environment
CN111970676B (en) WiFi hot spot access method, device, equipment and storage medium
CN108270764B (en) Application login method, server and mobile terminal
CN109600340B (en) Operation authorization method, device, terminal and server
CN111641938B (en) Wireless pairing connection method and device, host and slave
CN113677039B (en) Bluetooth-based device connection method and device, electronic device and storage medium
CN108616873B (en) Data transmission method, information transmission method, device, mobile equipment and storage medium
CN113677039A (en) Bluetooth-based equipment connection method and device, electronic equipment and storage medium
CN112040057B (en) Device control method, device, electronic device, control system and storage medium

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