Equipment connection method

By generating a specific service identifier for uniquely identifying the slave connection service in the master device, the problem that a single service UUID cannot accurately identify multiple slave devices is solved, and the accurate connection between the master device and the slave device is achieved.

CN119946905APending Publication Date: 2025-05-06LENOVO (BEIJING) LTD
View PDF 0 Cites 1 Cited by

Patent Information

Application Number
CN202510127961.7
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-01-27
Publication Date
2025-05-06

AI Technical Summary

Technical Problem

In the presence of multiple slave devices, a single service UUID prevents the master from accurately identifying the slave device, resulting in the problem of misconnection.

Method used

By pre-creating a specific service identifier for uniquely identifying the slave connection service in the master device and carrying the identifier in the slave device's device discovery request, the master device can accurately identify the slave device based on the identifier.

Benefits of technology

It effectively avoids misconnection problems caused by device identification errors, ensuring that the master device can accurately identify and connect to the target slave device.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119946905A_ABST
    Figure CN119946905A_ABST
Patent Text Reader

Abstract

The invention discloses a device connection method, and relates to the technical field of short-distance communication, and the method comprises the steps: obtaining a device discovery request initiated by a second device; the device discovery request comprises a first service identifier; the first service identifier is a service identifier which is pre-generated by the first equipment and is used for uniquely identifying the connection service of the second equipment; and based on the first service identifier, executing first connection processing with the second equipment so as to establish communication connection with the second equipment.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the technical field of short-distance communication, and in particular to a device connection method. Background Art

[0002] When a short-distance connection such as Bluetooth connection is made between a PC (Personal Computer) and a master or slave device such as a mobile phone based on a connection service such as SmartConnect, the PC needs to connect to it based on the SmartConnect service UUID (Universally Unique Identifier) ​​broadcast by the slave device such as the mobile phone. However, when faced with multiple slave devices such as multiple mobile phones, a single service UUID makes it impossible for a master device such as a PC to accurately identify the slave device, which has the defect of being easily connected to other slave devices by mistake. Summary of the invention

[0003] To this end, this application discloses the following technical solutions:

[0004] A device connection method, applied to a first device, comprising:

[0005] Obtaining a device discovery request initiated by a second device; the device discovery request includes a first service identifier; the first service identifier is a service identifier pre-generated by the first device for uniquely identifying a connection service of the second device;

[0006] Based on the first service identifier, a first connection process is performed with the second device to establish a communication connection with the second device.

[0007] Optionally, the device connection method further includes:

[0008] Obtaining a device discovery request initiated by a third device; the device discovery request initiated by the third device includes a second service identifier;

[0009] Based on the second service identifier, performing a first connection process with the third device to establish a communication connection with the third device;

[0010] Among them, the second service identifier is a service identifier pre-generated by the first device for uniquely identifying the connection service of the third device; the connection service of the third device and the connection service of the second device are the same connection service, and the second service identifier is different from the first service identifier.

[0011] Optionally, the second device and the third device include the same third service identifier;

[0012] The second device and the third device can respectively exchange service data provided by the service indicated by the third service identifier with the first device based on corresponding communication connections.

[0013] Optionally, the device connection method, before obtaining the device discovery request initiated by the second device, further includes:

[0014] In response to obtaining a device adding request for adding a device, the first service identifier is generated to uniquely identify the connection service of the second device to be added, and an electronic information code containing the first service identifier is generated and displayed.

[0015] Optionally, the performing a first connection process with the second device based on the first service identifier includes:

[0016] If the device is not paired with the second device, performing pairing processing with the second device based on the first service identifier, establishing a communication connection with the second device based on the second device address of the second device obtained through the pairing processing, and performing a first recording processing; the first recording processing is used to record the mapping relationship information between the first service identifier and the second device address;

[0017] If pairing with the second device is completed, a second device address of the second device is obtained based on the first service identifier and the mapping relationship information, and a communication connection with the second device is established based on the second device address.

[0018] Optionally, the device discovery request further includes a second device identifier of the second device, and the first record processing is used to record mapping relationship information between the first service identifier and the second device address and the second device identifier;

[0019] In the case where pairing with the second device is completed, before obtaining a device discovery request initiated by the second device, the method further includes:

[0020] In response to selecting a second device identifier for indicating the second device from the paired device identifier set corresponding to the first device, the first service identifier corresponding to the second device identifier is obtained based on the mapping relationship information, so as to monitor a device discovery request initiated by the second device based on the first service identifier.

[0021] Optionally, the device connection method further includes:

[0022] In the case where the pairing with the second device has been completed, if the second device identifier is lost in the paired device identifier set, a device discovery request initiated by the second device is monitored, and in response to the device discovery request initiated by the second device being monitored, the pairing process with the second device is re-executed based on the first service identifier in the device discovery request.

[0023] A device connection method, applied to a second device, the method comprising:

[0024] Initiate a device discovery request; the device discovery request includes a first service identifier; the first service identifier is a service identifier pre-generated by the first device for uniquely identifying a connection service of the second device;

[0025] A second connection process is performed with the first device based on the first service identifier to establish a communication connection with the first device.

[0026] Optionally, before initiating the device discovery request, the method further includes:

[0027] The first service identifier is obtained based on the electronic information code including the first service identifier displayed by the first device.

[0028] Optionally, the performing of the second connection processing with the first device includes:

[0029] If the device is not paired with the first device, performing pairing processing with the first device based on the first service identifier, establishing a communication connection with the first device based on the first device address of the first device obtained through the pairing processing, and performing a second recording processing; the second recording processing is used to record the mapping relationship information between the first service identifier and the first device address;

[0030] If pairing with the first device is completed, a first device address of the first device is obtained based on the first service identifier and the mapping relationship information, and a communication connection with the first device is established based on the first device address.

[0031] A device connection device, applied to a first device, comprising:

[0032] An acquisition module, configured to obtain a device discovery request initiated by a second device; the device discovery request includes a first service identifier; the first service identifier is a service identifier pre-generated by the first device for uniquely identifying a connection service of the second device;

[0033] The first connection processing module is used to perform a first connection processing with the second device based on the first service identifier to establish a communication connection with the second device.

[0034] An electronic device, comprising:

[0035] Memory, used to store computer instruction sets;

[0036] A processor is used to implement the device connection method applied to the first device or the device connection method applied to the second device as provided in any one of the above items by executing the computer instruction set in the memory.

[0037] A storage medium carrying one or more computer instruction sets, which, when executed by an electronic device, can enable the electronic device to implement a device connection method applied to a first device or a device connection method applied to a second device as described in any one of the above items. BRIEF DESCRIPTION OF THE DRAWINGS

[0038] In order to more clearly illustrate the technical solutions in the embodiments of the present application or the related technologies, the drawings required for use in the embodiments or the related technical descriptions are briefly introduced below. Obviously, the drawings described below are merely embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on the provided drawings without paying any creative work.

[0039] Figure 1 is a flow chart of a device connection method applied to a first device provided by the present application;

[0040] Figure 2 is another flow chart of a device connection method applied to a first device provided by the present application;

[0041] Figure 3 is a flow chart of a device connection method applied to a second device provided by the present application;

[0042] Figure 4 This is an example diagram of a master-slave device connection scenario provided by this application;

[0043] Figure 5 This is a flowchart for establishing a Bluetooth connection between a PC and a mobile phone in the first connection initiation pairing scenario provided by this application;

[0044] Figure 6 This is a flowchart for establishing a Bluetooth connection between a PC and a mobile phone in the case of device pairing loss recovery provided by this application;

[0045] Figure 7This is a flowchart for establishing a Bluetooth connection between a PC and a mobile phone in a paired state provided by this application;

[0046] Figure 8 is a structural diagram of a device connection device applied to a first device provided by the present application;

[0047] Fig. 9 is a structural diagram of a device connection apparatus provided by the present application and applied to a second device;

[0048] Fig.10 It is a structural diagram of the electronic device provided in this application. DETAILED DESCRIPTION

[0049] The following will be combined with the drawings in the embodiments of the present application to clearly and completely describe the technical solutions in the embodiments of the present application. Obviously, the described embodiments are only part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of this application.

[0050] The embodiment of the present application provides a device connection method for solving the problem that in the scenario of establishing a connection between a master and a slave device in the known technology, when facing multiple slave devices such as multiple mobile phones, a single service UUID makes it impossible for a master device such as a PC to accurately identify the slave device, which easily leads to a misconnection. The device connection method provided in the embodiment of the present application can be applied to electronic devices in many general or special computing device environments or configurations, such as: personal computers, server computers, handheld devices or portable devices, tablet devices, multi-processor devices, etc.

[0051] The device connection method includes a device connection method applied to a first device and a device connection method applied to a second device. The first device and the second device are used as a master device and a slave device in a short-distance communication connection application scenario, respectively, and specifically can be but not limited to a user PC and a smart phone, respectively.

[0052] The short-range communication connection may be, but is not limited to, a Bluetooth connection, a Wi-Fi connection, etc. The present application embodiment will mainly take the Bluetooth connection as an example to illustrate the solution.

[0053] See also Figure 1 As shown in the method flow chart, the device connection method applied to the first device provided in the embodiment of the present application may include the following steps 101 to 102, which are described in detail below.

[0054] Step 101: Obtain a device discovery request initiated by a second device; the device discovery request includes a first service identifier; the first service identifier is a service identifier pre-generated by the first device for uniquely identifying a connection service of the second device.

[0055] Optionally, the second device may initiate a device discovery request via a broadcast message, where the broadcast message may be, but is not limited to, a Bluetooth broadcast message. For example, a mobile phone may initiate a device discovery request via a Bluetooth broadcast message.

[0056] The connection service of the second device may be, but is not limited to, a SmartConnect deployed on the second device that can be used to establish a connection between the second device as a slave device and the master device.

[0057] The device discovery request initiated by the second device should include the service identifier of the connection service of the second device, such as the UUID of the SmartConnect of the second device. In order to overcome the defect in the known technology that when facing multiple slave devices such as multiple mobile phones, a single service UUID makes it impossible for master devices such as PCs to accurately identify slave devices, which may easily lead to incorrect connection to other slave devices, the embodiment of the present application pre-generates a first service identifier for the connection service of the second device for the first device to uniquely identify the second device.

[0058] Optionally, the first service identifier may be a random UUID generated by the first device, such as a random UUID generated by a PC for the mobile phone to be connected and used to uniquely identify the connection service SmartConnect on the mobile phone, so as to distinguish it from the fixed UUID of the connection service SmartConnect in the known technology.

[0059] The random UUID or other first service identifier is used to replace the original fixed UUID of the connection service such as SmartConnect, and the first service identifier is carried in the device discovery request of the second device, so that the master device such as the first device can accurately identify the second device based on the first service identifier in the device discovery request, avoiding mistaken connection to other slave devices.

[0060] Step 102: Based on the first service identifier, perform a first connection process with the second device to establish a communication connection with the second device.

[0061] After receiving the device discovery request from the second device, the first device parses the device discovery request and accurately identifies the second device based on the parsed first service identifier, and then performs a first connection processing with the second device based on the first service identifier to establish a communication connection with the second device.

[0062] Taking Bluetooth connection as an example, the first device (master device) can specifically discover the Bluetooth broadcast message initiated by the second device (slave device) by scanning the Bluetooth broadcast signal. The Bluetooth broadcast message is also the device discovery request, and then parse the first service identifier in the Bluetooth broadcast message, and then establish a Bluetooth connection with the second device based on the first service identifier.

[0063] To summarize, the device connection method provided in the embodiment of the present application is aimed at the short-distance connection scenario between master and slave devices. By pre-generating a first service identifier for the second device as a slave device to uniquely identify its (the second device) connection service in advance in the first device as the master device, and replacing the original fixed service identifier of the connection service of the second device with the first service identifier and carrying it in the device discovery request of the second device, the first device can accurately identify the second device based on the first service identifier, and then establish a communication connection with the second device, avoiding accidental connection to other slave devices. Therefore, the present application solves the problem of incorrect connection caused by the known technology in the master-slave device connection scenario when facing multiple slave devices such as multiple mobile phones, because the single service UUID makes it impossible for master devices such as PCs to accurately identify slave devices.

[0064] In an alternative embodiment, see Figure 2 As shown in the flow chart of the device connection method applied to the first device, the device connection method applied to the first device provided by the present application may further include the following processing before step 101:

[0065] Step 201: In response to obtaining a device adding request for adding a device, generate the first service identifier for uniquely identifying the connection service of the second device to be added, and generate and display an electronic information code containing the first service identifier.

[0066] Optionally, the device adding request may be a request for adding a device triggered by a user performing a device adding operation on a connection service of the first device.

[0067] The connection service of the first device may be, but is not limited to, a SmartConnect deployed on the first device that can be used to establish a connection with a slave device using the first device as a master device.

[0068] When a user needs to establish a communication connection between a second device (slave device) such as a smartphone and a first device (master device) such as a PC, optionally, a device adding operation can be performed on the connection service of the first device, such as clicking the "Add Device" button on the SmartConnect interface of the PC to trigger a device adding request based on the operation.

[0069] In response to obtaining the device adding request, the first device generates the first service identifier, for example, generates a random UUID, to uniquely identify the connection service of the second device to be added, and generates an electronic information code containing the first service identifier to display it.

[0070] The electronic information code may be, but is not limited to, a QR code.

[0071] The second device can obtain the first service identifier by scanning the electronic information code, so as to subsequently construct a device discovery request based on the first service identifier. For example, a second electronic device such as a mobile phone can obtain the random UUID by scanning a QR code containing a random UUID generated and displayed by a PC, and can subsequently construct a Bluetooth broadcast message for device discovery based on the random UUID.

[0072] This embodiment generates a first service identifier for the second device that is used to uniquely identify its (the second device's) connection service based on a device adding operation, so that in a master-slave device connection scenario, each slave device can have a specific service identifier that can uniquely identify its connection service, thereby facilitating the master device to accurately identify each slave device based on the specific service identifier corresponding to each slave device, thereby effectively avoiding the problem of incorrect connection of slave devices.

[0073] In an optional embodiment, step 102 in the device connection method applied to the first device provided in the present application, that is, performing the first connection process with the second device based on the first service identifier, can be implemented to include the following processes:

[0074] 11) If not paired with the second device, perform pairing processing with the second device based on the first service identifier, establish a communication connection with the second device based on the second device address of the second device obtained through the pairing processing, and perform first recording processing.

[0075] Among them, if the first device is not paired with the second device, the first device can first perform a pairing process with the second device based on the first service identifier, obtain the second device address of the second device through the pairing process with the second device, and then establish a communication connection with the second device based on the second device address, and perform a first record process.

[0076] Specifically, when not paired with the second device, the first device may initiate a pairing request to the second device based on the parsed first service identifier, and perform a subsequent pairing process with the second device. Through the pairing process, the first device may obtain the second device address of the second device, and the second device address may be, but is not limited to, the MAC address of the second device. After pairing is completed, the first device may further initiate a connection request, such as a Bluetooth connection request, to the second device based on the second device address, and perform a connection process with the second device based on the initiated connection request to establish a communication connection with the second device.

[0077] The first recording process is used to record the mapping relationship information between the first service identifier and the second device address on the first device, for example, recording the mapping relationship information between the random UUID of the mobile phone and the MAC address of the mobile phone on the main device such as the PC. For ease of description, this embodiment refers to the mapping relationship information as the first mapping relationship information.

[0078] 12) If pairing with the second device is completed, obtain a second device address of the second device based on the first service identifier and the mapping relationship information, and establish a communication connection with the second device based on the second device address.

[0079] If the first device has completed pairing with the second device, the first device can directly extract the second device address of the second device from the first mapping relationship information based on the resolved first service identifier (the first service identifier is resolved from the device discovery request of the second device), such as extracting the MAC address of the second device from the first mapping relationship information, and then establish a communication connection with the second device based on the second device address, such as establishing a Bluetooth connection with a second device such as a mobile phone.

[0080] This embodiment performs a first connection process with the second device based on the first service identifier when the first device is not paired with the second device or is paired with the second device, so that the first device can accurately identify the second device through the first service identifier, thereby effectively avoiding the problem of the first device being mistakenly connected to other devices due to device identification error.

[0081] In an optional embodiment, the device discovery request initiated by the second device may include not only the first service identifier but also the second device identifier of the second device.

[0082] The second device identifier can be but is not limited to the name of the second device. Taking the communication connection as a Bluetooth connection as an example, the second device identifier can be but is not limited to the Bluetooth name of the second device, such as the Bluetooth name of a mobile phone. The first record processing can be specifically used to record the mapping relationship information between the first service identifier of the second device and the second device address and the second device identifier. The mapping relationship information is the first mapping relationship information described above, that is, in this embodiment, the first mapping relationship information specifically represents the mapping relationship between the first service identifier of the second device and the second device address and the second device identifier.

[0083] In practical applications, the first device as the master device can maintain a paired device identification set, which includes the device identifications of each slave device paired with the first device, such as the Bluetooth names of each paired device. Each paired device identification in the set corresponds to a specific mapping relationship information, which is used to characterize the mapping relationship between the device identification, service identification (such as random UUID) and device address of the corresponding paired device.

[0084] The paired device identification set may be implemented in the form of a list or array, but is not limited to it. For example, a paired Bluetooth device list is maintained on a first device such as a PC, and the list may include the Bluetooth names of each mobile phone or other slave device that has been paired with the first device such as the PC.

[0085] If the first device has completed pairing with the second device, before the first device obtains a device discovery request initiated by the second device, the device connection method applied to the first device provided in the present application may further include the following processing:

[0086] In response to selecting a second device identifier for indicating the second device from the paired device identifier set corresponding to the first device, the first service identifier corresponding to the second device identifier is obtained based on the first mapping relationship information, so as to monitor a device discovery request initiated by the second device based on the first service identifier.

[0087] Specifically, if the first device has been paired with the second device, when the user needs to establish a connection between the second device and the first device, the second device identifier of the second device to be connected can be selected from the paired device identifier set of the first device, and the first device can listen to the device discovery request initiated by the second device in a targeted manner based on the second device identifier selected by the user. Subsequently, after listening to the device discovery request initiated by the second device, the first device can obtain the second device address of the second device from the first mapping relationship information, such as obtaining the MAC address of the second device, based on the first service identifier carried in the device discovery request or the second device identifier selected by the user, and then establish a communication connection with the second device based on the second device address.

[0088] Exemplary, taking Bluetooth connection as an example, the user can specifically select the desired target paired device from the list of paired Bluetooth devices on the PC (such as a list of Bluetooth names of paired mobile phones), for example, by clicking on the Bluetooth name of the desired target paired device. After that, the PC listens for the device discovery request initiated by the target paired device, and in response to the device discovery request of the target paired device listened to, obtains the MAC address of the target paired device from the recorded mapping relationship information based on the random UUID in the device discovery request or the Bluetooth name selected by the user, and then establishes a Bluetooth connection with the paired device based on the obtained MAC address.

[0089] This embodiment records the mapping relationship between the service identifier, device identifier and device address of the paired device (slave device) on the first device and maintains the paired device identifier set. This allows the user to directly select the target slave device to be connected from the paired device identifier set of the first device when it is necessary to establish a communication connection between the target slave device and the first device, so as to support the first device to listen to the device discovery request of the target slave device in a targeted manner based on the selection result, and in response to the device discovery request of the target slave device being listened to, quickly establish a communication connection with the target slave device based on the recorded device address of the target slave device, thereby improving the efficiency of establishing communication connection between the master and slave devices and reducing the time consumption.

[0090] In an optional embodiment, the device connection method applied to the first device provided by the present application may further include the following processing:

[0091] In the case where the pairing with the second device has been completed, if the second device identifier is lost in the paired device identifier set, a device discovery request initiated by the second device is monitored, and in response to the device discovery request initiated by the second device being monitored, the pairing process with the second device is re-executed based on the first service identifier in the device discovery request.

[0092] In actual applications, due to an erroneous operation, such as an erroneous operation by a user on SmartConnect of the first device, a device identifier in the paired device identifier set of the first device may be deleted, resulting in the loss of a device identifier in the paired device identifier set.

[0093] In this case, when the first device listens to the device discovery request of the slave device whose device identifier has been lost, it can re-execute the pairing process with the slave device, and by re-executing the pairing process with the slave device, the device identifier of the slave device is re-added to the paired device identifier set of the first device.

[0094] For the second device, when the first device has completed pairing with the second device, if the second device identifier of the second device is lost in the paired device identifier set of the first device, the first device may, when monitoring a device discovery request initiated by the second device, re-execute the pairing process with the second device based on the first service identifier carried in the device discovery request. For example, the first device initiates a pairing request to the second device to execute the pairing process with the second device, thereby completing the re-pairing process with the second device, and based on the re-pairing process with the second device, the second device identifier of the second device is re-added to the paired device identifier set of the first device, and at the same time, a communication connection with the second device may be established based on the second device address of the second device.

[0095] For example, after the Bluetooth name of a mobile phone is lost in the PC's paired Bluetooth device list, the PC can re-execute the pairing process with the mobile phone based on the random UUID carried in the message when monitoring the Bluetooth broadcast message of the mobile phone, and add the Bluetooth name of the mobile phone carried in the message to the PC's paired Bluetooth device list again. At the same time, it can establish a Bluetooth connection with the mobile phone based on the MAC address of the mobile phone.

[0096] It should be noted that, when the first device has completed pairing with a slave device and the device identifier of the slave device is lost in the paired device identifier set of the first device, the mapping relationship information corresponding to the slave device (mapping relationship information between the service identifier and the slave device identifier, and the slave device address) will not be lost, but will remain in the first device. Therefore, after the first device completes re-pairing with the slave device, there is no need to re-record the mapping relationship information corresponding to the slave device.

[0097] In the event that the device identifier of a paired slave device is lost in the paired device identifier set of the first device, this embodiment can enable the first device to re-add the device identifier of the slave device to the paired device identifier set of the first device by re-performing the pairing process between the first device and the slave device. This makes it convenient to quickly and efficiently establish a communication connection between the first device and the slave device by directly selecting the device identifier of the slave device from the paired device identifier set of the first device when there is a subsequent connection demand between the first device and the slave device.

[0098] In an optional embodiment, the device connection method applied to the first device provided in the present application may further include the following steps 21)-22):

[0099] 21) Obtaining a device discovery request initiated by a third device; the device discovery request initiated by the third device includes a second service identifier.

[0100] Among them, the second service identifier is a service identifier pre-generated by the first device for uniquely identifying the connection service of the third device; the connection service of the third device and the connection service of the second device are the same connection service, and the second service identifier is different from the first service identifier.

[0101] That is to say, for each slave device that needs to be connected to the first device (master device), the first device can generate a specific service identifier for the connection service of the slave device to uniquely identify it, so that the first device can accurately identify the corresponding slave device based on the specific service identifier. For example, the first device such as a PC generates a random UUID for SmartConnect that uniquely identifies each mobile phone to be connected, so that the PC can accurately identify the corresponding mobile phone based on the random UUID generated for each mobile phone.

[0102] Each slave device can use the same connection service to establish a connection with the master device, but each slave device identifies the same connection service based on a different specific service identifier, so that the first device can accurately identify each slave device and establish a communication connection with it based on the specific service identifier corresponding to each slave device, avoiding incorrect connection due to device identification error.

[0103] During implementation, similar to the operation method for the second device, for the third device, the device adding request can also be triggered by performing the device adding operation on the first device, so that the first device responds to the device adding request, generates a second service identifier such as a random UUID for the third device to be added, and generates and displays an electronic information code containing the second service identifier, such as a QR code containing the random UUID, so that the third device can obtain the second service identifier such as the random UUID by scanning the code.

[0104] 22) Based on the second service identifier, perform a first connection process with the third device to establish a communication connection with the third device.

[0105] Wherein, if the first device is not paired with the third device, the first device performs a pairing process with the third device based on the second service identifier, establishes a communication connection with the third device based on the third device address of the third device obtained through the pairing process, and performs a first recording process; here, the first recording process is used to record the mapping relationship information between the second service identifier and the third device address;

[0106] If pairing with the third device is completed, the first device obtains the third device address of the third device based on the second service identifier and the above-mentioned mapping relationship information, and establishes a communication connection with the third device based on the third device address.

[0107] In actual applications, the first device serving as a master device can establish a communication connection with another slave device after canceling the communication connection with a slave device, or can continue to establish a communication connection with other slave devices based on actual device connection requirements when a communication connection has been established with one / multiple slave devices; and when the first device needs to establish a communication connection with multiple slave devices, a communication connection such as a Bluetooth connection can be established between the first device and the multiple slave devices in a serial or parallel manner, and there is no limitation on this, which can be determined based on actual application conditions.

[0108] In summary, in this embodiment, by having the first device generate a specific service identifier for uniquely identifying the connection service of the slave device for each slave device that needs to connect, the first device can accurately identify each slave device based on the corresponding specific service identifier, thereby ensuring that in the scenario of connecting to a single slave device or multiple slave devices, the first device can accurately identify and connect to each slave device that initiates a device discovery request, thereby avoiding the problem of incorrect connection caused by misidentification of the device.

[0109] In an optional embodiment, each slave device connected to the first device (master device), such as the second device and the third device, further includes the same third service identifier.

[0110] The service indicated by the third service identifier can perform service data exchange between the slave device and the first device based on the communication connection between the slave device and the first device.

[0111] Correspondingly, the second device and the third device can respectively exchange service data provided by the service indicated by the third service identifier with the first device based on corresponding communication connections.

[0112] For the convenience of description, in this embodiment, the service indicated by the third service identifier is referred to as an upper layer service of the connection service.

[0113] Taking the communication connection as a Bluetooth connection as an example, the service indicated by the third service identifier, that is, the upper-layer service, may include various Bluetooth services, specifically including but not limited to general access service, general attribute service, device information service, battery service, heart rate service, healthy body temperature service, blood pressure service, ambient light service, instant alarm service, scanning parameter service, etc., some or all of the Bluetooth services.

[0114] Each of these upper-layer services corresponds to a unique identifier UUID, and the same upper-layer service deployed on different slave devices corresponds to the same UUID. In actual applications, the specific service identifier corresponding to the connection service of each slave device and the service identifier of the upper-layer service can be combined to jointly identify the upper-layer service of each specific slave device. For example, the random UUID of the second device and the UUID of the battery service are used to identify the battery service of the second device, and the random UUID of the third device and the UUID of the battery service are used to identify the battery service of the third device.

[0115] This embodiment deploys an upper-layer service on each slave device that can perform service data interaction between the slave device and the master device based on the communication connection between the slave device and the master device, and combines the specific service identifier corresponding to the connection service of each slave device and the service identifier of the upper-layer service to jointly identify the upper-layer service of each slave device. This can support master devices such as the first device to effectively distinguish the same upper-layer service of different slave devices, thereby achieving accurate service data interaction between the master device and different slave devices, and will not cause erroneous service data interaction with other devices due to misidentification of the slave device.

[0116] See also Figure 3 As shown in the method flow chart, the device connection method applied to the second device provided in the embodiment of the present application may include the following steps 301 to 302, which are described below respectively.

[0117] Step 301: Initiate a device discovery request; the device discovery request includes a first service identifier; the first service identifier is a service identifier pre-generated by the first device for uniquely identifying a connection service of the second device.

[0118] The second device is used as a slave device in a master-slave device connection scenario.

[0119] Optionally, the second device may specifically initiate a device discovery request via a broadcast message, such as initiating a device discovery request via a Bluetooth broadcast message.

[0120] The device discovery request includes the first service identifier, and in addition, optionally, may also include a second device identifier of a second device, such as a Bluetooth name of the second device.

[0121] The second device can obtain the first service identifier by scanning an electronic information code, such as a QR code, containing the first service identifier displayed by the first device, so as to uniquely identify the connection service of the second device based on the first service identifier.

[0122] Step 302: Perform a second connection process with the first device based on the first service identifier to establish a communication connection with the first device.

[0123] Among them, if the second device is not paired with the first device, a pairing process is performed between the second device and the first device based on the first service identifier, a communication connection is established between the second device and the first device based on the first device address of the first device obtained through the pairing process, and a second record process is performed.

[0124] Specifically, when the second device is not paired with the first device, the first device may initiate a pairing request for the second device based on the first service identifier in the device discovery request, and the second device executes the pairing process with the first device in response to the pairing request of the first device, thereby completing the pairing between the second device and the first device. On this basis, the second record processing is performed, and the second record processing is used to record the mapping relationship information between the first service identifier and the first device address on the second device. For ease of description, the embodiment of the present application refers to the mapping relationship information as the second mapping relationship information.

[0125] If the second device has completed pairing with the first device, the first device address of the first device is obtained based on the first service identifier and the second mapping relationship information, and a communication connection with the first device is established based on the first device address.

[0126] The first device address of the first device may be a MAC address of the first device, such as a MAC address of a PC.

[0127] Similar to maintaining a device identification set of paired slave devices on the first device, the second device can maintain the device identification sets of its corresponding paired master devices, such as a list of Bluetooth names of each paired PC, to facilitate the subsequent selection of the desired target master device when the second device has a connection request with a target master device, thereby quickly establishing a communication connection with the target master device.

[0128] Optionally, the device identification and device address of the main device may be obtained by the second device through a pairing process with the main device.

[0129] In actual applications, the connection scenarios between the master device and the slave devices can be one-to-one, one-to-many, many-to-one or many-to-many connection scenarios. Figure 4As shown in the schematic diagram, when multiple slave devices are involved, since each slave device obtains a specific service identifier (such as a random UUID) for uniquely identifying the connection service of the slave device from the master device to be connected, it can ensure that the master device can accurately identify each slave device, effectively avoiding the problem of incorrect connection to other slave devices due to misidentification of the slave device.

[0130] To summarize, the device connection method applied to the second device provided in this embodiment uniquely identifies the connection service of the second device based on the first service identifier pre-generated by the first device, and establishes a communication connection with the first device based on the first service identifier rather than the original fixed identifier of the connection service, thereby supporting the first device to effectively identify the second device based on the first service identifier, thereby avoiding the problem of the first device being mistakenly connected to other devices due to misidentification of the second device.

[0131] Based on the solution of the embodiments of the present application, the connection scenarios between the master device and the slave device, such as between a PC and a user's mobile phone, can be divided into three types: establishing a connection based on initiating pairing during the first connection, establishing a connection when the device pairing is lost and recovered, and establishing a connection when already paired.

[0132] The following takes the first device (master device) and the second device (slave device) as a PC and a user's mobile phone, and establishes a Bluetooth connection between the PC and the mobile phone as an example to illustrate the process of establishing a connection in the above three scenarios.

[0133] 1. Establish a connection based on initiating pairing when connecting for the first time

[0134] See also Figure 5 The flowchart for establishing a Bluetooth connection between a PC and a mobile phone in the first connection initiation pairing scenario shown in the figure mainly includes:

[0135] 1. The PC generates a random UUID and stores it in the QR code;

[0136] 2. The mobile phone obtains the random UUID by scanning the QR code and establishes a service to initiate a Bluetooth broadcast message. The Bluetooth broadcast message includes the random UUID and may also include the Bluetooth identifier of the mobile phone;

[0137] 3. After receiving the Bluetooth broadcast message, the PC starts Bluetooth pairing with the mobile phone;

[0138] 4. After pairing is successful, a Bluetooth connection is established between the mobile phone and the PC, and the mapping relationship between the random UUID and the device address of the peer device is saved. At the same time, the corresponding paired device list can be maintained.

[0139] Optionally, the PC may save the mapping relationship between the random UUID and the MAC address of the mobile phone and the Bluetooth identifier of the mobile phone, and the mobile phone may save the mapping relationship between the random UUID and the MAC address of the PC and the Bluetooth identifier of the PC.

[0140] For a more detailed implementation process of establishing a Bluetooth connection between the PC and the mobile phone in this scenario, see Figure 5 shown.

[0141] 2. Establishing a connection when device pairing is lost and restored

[0142] See also Figure 6 The flowchart of establishing a Bluetooth connection between a PC and a mobile phone in the case of device pairing loss recovery shown in the figure mainly includes:

[0143] 1. When the PC starts a connection service such as SmartConnect and selects the Bluetooth ID of the mobile phone to be connected, it is found that the Bluetooth ID of the mobile phone is missing;

[0144] 2. The PC monitors the random UUID broadcast by the mobile phone through Bluetooth broadcast messages (device discovery requests);

[0145] 3. After monitoring the broadcast message carrying the random UUID of the mobile phone, the PC re-sends a pairing request to the mobile phone to re-pair with the mobile phone;

[0146] 4. After pairing is successful, a Bluetooth connection is established between the PC and the mobile phone. At the same time, the PC's paired device list is updated, and the blue label of the mobile phone is added back to the PC's paired device list.

[0147] For a more detailed implementation process of establishing a Bluetooth connection between the PC and the mobile phone in this scenario, see Figure 6 shown.

[0148] 3. Establishing a connection when paired

[0149] See also Figure 7 In the paired case shown in the figure, the implementation flow chart of establishing a Bluetooth connection between a PC and a mobile phone mainly includes:

[0150] 1. The PC selects the mobile phone to be connected in the paired device list, obtains the random UUID used by the mobile phone (saved after the first successful connection), and monitors its broadcast messages.

[0151] 2. The mobile phone switches to the PC to be connected, obtains the corresponding random UUID (saved after the first successful connection), establishes the service and initiates a broadcast message (device discovery request);

[0152] 3. The PC receives the broadcast message sent by the mobile phone and initiates a connection.

[0153] For a more detailed implementation process of establishing a Bluetooth connection between the PC and the mobile phone in this scenario, see Figure 7 shown.

[0154] in, Figure 6 and Figure 7 The APP here refers to the APP used to provide the connection service such as SmartConnect.

[0155] Regardless of the scenario, the PC can accurately identify and connect the mobile phone based on the random UUID corresponding to each mobile phone, avoiding the problem of misidentification and misconnection of the mobile phone.

[0156] Corresponding to the device connection method applied to the first device, the embodiment of the present application also provides a device connection device applied to the first device, see Figure 8 As shown in the composition structure diagram, the device connection device applied to the first device includes:

[0157] An acquisition module 801 is configured to obtain a device discovery request initiated by a second device; the device discovery request includes a first service identifier; the first service identifier is a service identifier pre-generated by the first device for uniquely identifying a connection service of the second device;

[0158] The first connection processing module 802 is used to perform a first connection process with the second device based on the first service identifier to establish a communication connection with the second device.

[0159] In an optional implementation manner, the acquisition module 801 is further used to: obtain a device discovery request initiated by a third device; the device discovery request initiated by the third device includes the second service identifier;

[0160] The first connection processing module 802 is further used to: perform a first connection processing with the third device based on the second service identifier to establish a communication connection with the third device;

[0161] Among them, the second service identifier is a service identifier pre-generated by the first device for uniquely identifying the connection service of the third device; the connection service of the third device and the connection service of the second device are the same connection service, and the second service identifier is different from the first service identifier.

[0162] In an optional implementation manner, the second device and the third device include the same third service identifier;

[0163] The second device and the third device can respectively exchange service data provided by the service indicated by the third service identifier with the first device based on corresponding communication connections.

[0164] In an optional embodiment, the above-mentioned device also includes a generation and display module, which is used to generate the first service identifier in response to obtaining a device addition request for adding a device before obtaining a device discovery request initiated by the second device, so as to uniquely identify the connection service of the second device to be added, and generate and display an electronic information code containing the first service identifier.

[0165] In an optional implementation manner, the first connection processing module 802, when performing the first connection processing with the second device based on the first service identifier, is specifically configured to:

[0166] If the device is not paired with the second device, performing pairing processing with the second device based on the first service identifier, establishing a communication connection with the second device based on the second device address of the second device obtained through the pairing processing, and performing a first recording processing; the first recording processing is used to record the mapping relationship information between the first service identifier and the second device address;

[0167] If pairing with the second device is completed, a second device address of the second device is obtained based on the first service identifier and the mapping relationship information, and a communication connection with the second device is established based on the second device address.

[0168] In an optional implementation manner, the device discovery request further includes a second device identifier of the second device, and the first record processing is used to record mapping relationship information between the first service identifier and the second device address and the second device identifier;

[0169] The acquisition module 801 is also used for: when pairing with the second device has been completed, before obtaining the device discovery request initiated by the second device, in response to selecting a second device identifier indicating the second device from the paired device identifier set corresponding to the first device, obtaining the first service identifier corresponding to the second device identifier based on the mapping relationship information, so as to monitor the device discovery request initiated by the second device based on the first service identifier.

[0170] In an optional embodiment, the first connection processing module 802 is further used to: when pairing with the second device has been completed, if the second device identifier is lost in the paired device identifier set, listen to the device discovery request initiated by the second device, and in response to listening to the device discovery request initiated by the second device, re-execute the pairing process with the second device based on the first service identifier in the device discovery request.

[0171] Corresponding to the device connection method applied to the second device, the embodiment of the present application also provides a device connection device applied to the second device, see Fig. 9 As shown in the composition structure diagram, the device connection device applied to the second device includes:

[0172] The initiating module 901 is used to initiate a device discovery request; the device discovery request includes a first service identifier; the first service identifier is a service identifier pre-generated by the first device for uniquely identifying a connection service of the second device;

[0173] The second connection processing module 902 is used to perform a second connection process with the first device based on the first service identifier to establish a communication connection with the first device.

[0174] In an optional implementation, the apparatus further includes an acquisition module, which is used to obtain the first service identifier based on an electronic information code including the first service identifier displayed by the first device before initiating a device discovery request.

[0175] In an optional implementation manner, the second connection processing module 902 is specifically configured to:

[0176] If the device is not paired with the first device, performing pairing processing with the first device based on the first service identifier, establishing a communication connection with the first device based on the first device address of the first device obtained through the pairing processing, and performing a second recording processing; the second recording processing is used to record the mapping relationship information between the first service identifier and the first device address;

[0177] If pairing with the first device is completed, a first device address of the first device is obtained based on the first service identifier and the mapping relationship information, and a communication connection with the first device is established based on the first device address.

[0178] The present application also discloses an electronic device, the composition structure of the electronic device, such as Fig.10 As shown, including at least:

[0179] A memory 10, for storing a computer instruction set;

[0180] A set of computer instructions can be implemented in the form of a computer program.

[0181] The processor 20 is used to implement the device connection method applied to the first device or the device connection method applied to the second device as provided in any of the above method embodiments by executing the computer instruction set in the memory.

[0182] The processor 20 can be a central processing unit (CPU), an application-specific integrated circuit (ASIC), a digital signal processor (DSP), an application-specific integrated circuit (ASIC), a field programmable gate array (FPGA), a neural network processor (NPU), a deep learning processor (DPU) or other programmable logic devices, etc.

[0183] Optionally, the electronic device also includes storage resources such as memory and cache.

[0184] Optionally, the electronic device also includes a camera assembly, and / or is connected to an external camera assembly.

[0185] In addition, the electronic device may also include components such as a communication interface and a communication bus. The memory, the processor and the communication interface communicate with each other through the communication bus.

[0186] The communication interface is used for communication between electronic devices and other devices. The communication bus can be a Peripheral Component Interconnect (PCI) bus or an Extended Industry Standard Architecture (EISA) bus, etc. The communication bus can be divided into an address bus, a data bus, a control bus, etc.

[0187] An embodiment of the present application also discloses a storage medium, which carries one or more computer instruction sets. When the one or more computer instruction sets are executed by an electronic device, the electronic device can implement a device connection method applied to a first device or a device connection method applied to a second device as provided in any of the method embodiments above.

[0188] It should be noted that the various embodiments in this specification are described in a progressive manner, and each embodiment focuses on the differences from other embodiments. The same or similar parts between the various embodiments can be referenced to each other.

[0189] For the convenience of description, the above system or device is described by dividing it into various modules or units according to its functions. Of course, when implementing the present application, the functions of each unit can be implemented in the same or multiple software and / or hardware.

[0190] It can be known from the description of the above implementation methods that those skilled in the art can clearly understand that the present application can be implemented by means of software plus a necessary general hardware platform. Based on such an understanding, the technical solution of the present application can be essentially or the part that makes a creative contribution can be embodied in the form of a software product, which can be stored in a storage medium such as ROM / RAM, a disk, an optical disk, etc., including several instructions for enabling a computer device (which can be a personal computer, a server, or a network device, etc.) to execute the methods described in each embodiment of the present application or some parts of the embodiments.

[0191] Finally, it should be noted that, in this article, relational terms such as first, second, third and fourth are used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Moreover, the terms "include", "comprise" or any other variants thereof are intended to cover non-exclusive inclusion, so that a process, method, article or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or device. In the absence of further restrictions, the elements defined by the statement "comprise a ..." do not exclude the presence of other identical elements in the process, method, article or device including the elements.

[0192] The above is only a preferred implementation of the present application. It should be pointed out that for ordinary technicians in this technical field, several improvements and modifications can be made without departing from the principles of the present application. These improvements and modifications should also be regarded as the scope of protection of the present application.

Claims

1. A device connection method, applied to a first device, the method comprising: Obtaining a device discovery request initiated by a second device; The device discovery request includes a first service identifier; The first service identifier is a service identifier pre-generated by the first device and used to uniquely identify the connection service of the second device; Based on the first service identifier, a first connection process is performed with the second device to establish a communication connection with the second device.

2. The device connection method according to claim 1, further comprising: Obtaining a device discovery request initiated by a third device; The device discovery request initiated by the third device includes the second service identifier; Based on the second service identifier, performing a first connection process with the third device to establish a communication connection with the third device; Among them, the second service identifier is a service identifier pre-generated by the first device for uniquely identifying the connection service of the third device; the connection service of the third device and the connection service of the second device are the same connection service, and the second service identifier is different from the first service identifier.

3. The device connection method according to claim 2, wherein the second device and the third device include the same third service identifier; The second device and the third device can respectively exchange service data provided by the service indicated by the third service identifier with the first device based on corresponding communication connections.

4. The device connection method according to claim 1, before obtaining the device discovery request initiated by the second device, further comprising: In response to obtaining a device adding request for adding a device, the first service identifier is generated to uniquely identify the connection service of the second device to be added, and an electronic information code containing the first service identifier is generated and displayed.

5. The device connection method according to claim 1, wherein the step of performing a first connection process with the second device based on the first service identifier comprises: If the device is not paired with the second device, performing pairing processing with the second device based on the first service identifier, establishing a communication connection with the second device based on the second device address of the second device obtained through the pairing processing, and performing a first recording processing; the first recording processing is used to record the mapping relationship information between the first service identifier and the second device address; If pairing with the second device is completed, a second device address of the second device is obtained based on the first service identifier and the mapping relationship information, and a communication connection with the second device is established based on the second device address.

6. The device connection method according to claim 5, wherein the device discovery request further comprises a second device identifier of the second device, and the first record processing is used to record the mapping relationship information between the first service identifier and the second device address and the second device identifier; In the case where pairing with the second device has been completed, before obtaining a device discovery request initiated by the second device, the method further includes: In response to selecting a second device identifier for indicating the second device from the paired device identifier set corresponding to the first device, the first service identifier corresponding to the second device identifier is obtained based on the mapping relationship information, so as to monitor a device discovery request initiated by the second device based on the first service identifier.

7. The device connection method according to claim 6, further comprising: In the case where the pairing with the second device has been completed, if the second device identifier is lost in the paired device identifier set, a device discovery request initiated by the second device is monitored, and in response to the device discovery request initiated by the second device being monitored, the pairing process with the second device is re-executed based on the first service identifier in the device discovery request.

8. A device connection method, applied to a second device, the method comprising: Initiate a device discovery request; The device discovery request includes a first service identifier; The first service identifier is a service identifier pre-generated by the first device and used to uniquely identify the connection service of the second device; A second connection process is performed with the first device based on the first service identifier to establish a communication connection with the first device.

9. The device connection method according to claim 8, before initiating the device discovery request, further comprising: The first service identifier is obtained based on the electronic information code including the first service identifier displayed by the first device.

10. The device connection method according to claim 8, wherein the performing of the second connection process with the first device comprises: If the device is not paired with the first device, performing pairing processing with the first device based on the first service identifier, establishing a communication connection with the first device based on the first device address of the first device obtained through the pairing processing, and performing a second recording processing; the second recording processing is used to record the mapping relationship information between the first service identifier and the first device address; If pairing with the first device is completed, a first device address of the first device is obtained based on the first service identifier and the mapping relationship information, and a communication connection with the first device is established based on the first device address.

Citation Information

Cited By

  • Device connection method

    WO2026158171A1