A device connection method, apparatus, storage medium, and computer device
By flexibly scheduling the time interval detection and broadcast message sending of Zifeng and Bluetooth communication in the terminal device, the problem of excessive power consumption when used simultaneously is solved, achieving power reduction and connection flexibility.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- SHENZHEN CHENBEI TECH CO LTD
- Filing Date
- 2022-05-12
- Publication Date
- 2026-04-17
AI Technical Summary
In existing technologies, devices that support both the Zifeng and Bluetooth communication protocols suffer from excessive power consumption when used simultaneously.
By employing a flexible scheduling method for first and second near-field communication in the terminal device, broadcast messages of the first near-field communication are detected at certain time intervals, and the detection time interval is extended if no message is received within a preset time, the two communication methods are dynamically scheduled to reduce power consumption.
While supporting two short-range communication methods, it effectively reduces the power consumption of terminal devices, while maintaining the flexibility and efficiency of device connectivity.
Smart Images

Figure CN114928858B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of communication technology, and in particular to a device connection method, apparatus, storage medium, and computer equipment. Background Technology
[0002] Wi-Fi and Bluetooth are two widely used communication protocols. Devices supporting Wi-Fi have a long connection range but cannot connect to devices that only support Bluetooth, such as mobile phones. Devices supporting Bluetooth are convenient to use and have a shorter connection range, but cannot connect to devices that only support Wi-Fi. Devices that support both Wi-Fi and Bluetooth can experience excessive power consumption during use. Summary of the Invention
[0003] This invention provides a device connection method, apparatus, storage medium, and computer device, aiming to solve the problem of excessive power consumption in devices that simultaneously support both Bumblebee and Bluetooth in the prior art.
[0004] To achieve the above objectives, the first aspect of this application provides a device connection method, characterized in that it is applied to a terminal device, the terminal device including a first near-field communication and a second near-field communication, wherein the first near-field communication and the second near-field communication are different communication methods;
[0005] The method includes:
[0006] The first broadcast message of the first near-field communication is detected according to the first time interval, and the second broadcast message of the second near-field communication is sent.
[0007] If, within a first preset time period, the first time interval is extended according to a preset rule if neither the first broadcast message is detected nor a connection request for the second broadcast message is received.
[0008] Optionally, the method further includes:
[0009] Within the first preset time period, if only the first broadcast message is detected, a connection request is sent to the first gateway device that sent the first broadcast message, so as to establish a connection with the first gateway device through the first short-range communication;
[0010] Within the first preset time period, if the first broadcast message is detected and a connection request for the second broadcast message is received, a connection request is sent to the first gateway device that sent the first broadcast message, so as to establish a connection with the first gateway device through the first short-range communication.
[0011] Optionally, the method further includes:
[0012] If, within the first preset time period, no first broadcast message is detected and a connection request is received from the second gateway device in response to the second broadcast message, a connection is established with the second gateway device via the second short-range communication, and the detection of broadcast messages from the first short-range communication is stopped.
[0013] Optionally, the method further includes:
[0014] Within the first preset time period, if multiple first broadcast messages are detected, the first gateway device with the highest signal strength is selected from the multiple first gateway devices that sent the first broadcast messages to send a connection request, so as to establish a connection through the first short-range communication.
[0015] Optionally, the method further includes:
[0016] Within the first preset time period, if multiple first broadcast messages are detected, based on the sender identifier carried in each of the multiple first broadcast messages, the number of connections of the first gateway device corresponding to the sender identifier is queried, and a connection request is sent to the first gateway device with the fewest connection counts, so as to establish a connection through the first near-field communication.
[0017] Optionally, the first broadcast message includes the first authentication information of the first gateway device;
[0018] The terminal device sends a connection request to the first gateway device that sent the first broadcast message, including:
[0019] If the first user information corresponding to the terminal device matches the first verification information, the step of sending a connection request to the first gateway device that sent the first broadcast message is executed.
[0020] Optionally, the connection request carries second verification information of the terminal device. The second verification information is used to send a response message confirming the establishment of a connection to the terminal device when the first gateway device determines that the second verification information matches the second user information corresponding to the first gateway device.
[0021] To achieve the above objectives, a second aspect of this application provides a device connection apparatus, the apparatus comprising:
[0022] The transceiver module is used to detect the first broadcast message of the first near-field communication according to a first time interval;
[0023] The transceiver module is also used to send a second broadcast message for the second short-range communication, wherein the first short-range communication and the second short-range communication are different communication methods;
[0024] The processing module is configured to extend the first time interval according to a preset rule if, within a first preset time period, neither the first broadcast message is detected nor a connection request for the second broadcast message is received.
[0025] To achieve the above objectives, a third aspect of this application provides a computer-readable storage medium storing a computer program, which, when executed by a processor, performs the steps of the device connection method provided in the first aspect of this application.
[0026] To achieve the above objectives, a fourth aspect of this application provides a computer device, including: a processor; and a memory for storing a computer program; wherein when the processor executes the computer program, it causes the processor to perform the steps of the device connection method provided in the first aspect of this application.
[0027] The embodiments of this application have the following advantages or beneficial effects:
[0028] This application embodiment flexibly schedules the first and second near-field communications of the terminal device, detects the first broadcast message of the first near-field communication at a certain time interval, and sends the second broadcast message of the second near-field communication. If the first broadcast message is not received within a preset time, the time interval for detecting the first broadcast message is extended, thereby reducing power consumption while supporting two near-field communication methods simultaneously. Attached Figure Description
[0029] Figure 1 This is a schematic diagram illustrating the application scenario of the device connection method in the embodiments of this application;
[0030] Figure 2 A flowchart illustrating the device connection method provided in this application embodiment;
[0031] Figure 3 This is a schematic diagram of another process involved in the device connection method in the embodiments of this application;
[0032] Figure 4 This is a schematic diagram of another process involved in the device connection method in the embodiments of this application;
[0033] Figure 5 This is a schematic diagram of the structure of the device connection apparatus provided in the embodiments of this application;
[0034] Figure 6 A schematic diagram of the structure of a computer device provided in an embodiment of this application. Detailed Implementation
[0035] The technical solutions of the embodiments of this application will now be described with reference to the accompanying drawings. Obviously, the described embodiments are only a part of the embodiments of this application, and not all of them. All other embodiments obtained by those skilled in the art based on the embodiments of this application without creative effort are within the scope of protection of this application.
[0036] This application provides a device connection method that can be applied to scenarios where a terminal device supporting two short-range communication methods establishes a connection with a gateway device. Please refer to [link to relevant documentation]. Figure 1 This is a schematic diagram illustrating an application scenario of the device connection method in this application embodiment, such as... Figure 1 As shown, in one embodiment of this application, the application scenario includes a terminal device 101, a first gateway device 102, a second gateway device 103, a control terminal 104, and a server 105. The terminal device includes at least a first short-range communication module and a second short-range communication module, meaning the terminal device supports at least two different short-range communication methods. The terminal device can be a smart sensor, surveillance camera, smart door lock, smart peephole, smart watch, Bluetooth speaker, smart socket, robot vacuum cleaner, air purifier, humidifier, vehicle terminal, etc., without limiting the specific device type. The control terminal can include, but is not limited to, mobile phones, tablets, etc.
[0037] The first and second short-range communication methods are two different communication methods.
[0038] Preferably, the first short-range communication method is ZigBee, and the second short-range communication method is Bluetooth.
[0039] Alternatively, the first short-range communication method can also be Z-Ware, LoRa, Narrowband Internet of Things (NB-IoT), etc., and the second short-range communication method can also be Matter (an open-source standard project for smart homes).
[0040] Optionally, terminal device 101 does not include a WIFI module, so it cannot connect to the Internet to achieve data transmission with server 105. It needs to connect to the first gateway device 102 or the second gateway device 103 or the control terminal 104 to achieve data transmission with server 105.
[0041] When a terminal device supports two short-range communication methods, although it can establish a connection and transmit data with the gateway device through both methods, the simultaneous operation of the two short-range communications leads to high power consumption. This application addresses this by scheduling the two short-range communications, detecting a first broadcast message for the first short-range communication at regular time intervals, and sending a second broadcast message for the second short-range communication. If the first broadcast message is not received within a preset time, the time interval for detecting the first broadcast message is extended. This dynamic scheduling method achieves the goal of supporting two short-range communication methods while reducing power consumption. The following describes... Figures 2 to 4 The method provided in this application is described in detail.
[0042] Please see Figure 2 This is a flowchart illustrating the device connection method in an embodiment of this application. Figure 2 As shown, the device connection method provided in this embodiment includes:
[0043] 201. Detect the first broadcast message of the first near-field communication according to the first time interval, and send the second broadcast message of the second near-field communication.
[0044] The first time interval is preset and is relatively short. The terminal device detects the first broadcast message of the first near-field communication at a high frequency to ensure that it can detect the surrounding devices that sent the broadcast message within a short time. For example, the first time interval can be set to 1 second.
[0045] The first broadcast message of the first short-range communication is a broadcast message sent by other devices through the first short-range communication method, enabling the terminal device to discover these devices in a timely manner through the first broadcast message.
[0046] While detecting the first broadcast message of the first near-field communication, the terminal device also sends a second broadcast message through its second near-field communication module.
[0047] Optionally, this application does not limit the time interval for sending the second broadcast message; it can be the same as or different from the first time interval.
[0048] Optionally, the second broadcast message includes the data the terminal device needs to send and the terminal device's unique identifier. For example, the unique identifier could be the terminal device's Media Access Control Address (MAC address).
[0049] 202. If no first broadcast message is detected and no connection request for the second broadcast message is received within the first preset time period, the first time interval shall be extended according to the preset rules.
[0050] Within a first preset duration, the terminal device detects the first broadcast message at a first time interval. In some possible implementations, if the first preset duration is 1 minute and the first time interval is 1 second, then within the first minute, the terminal device will detect the first broadcast signal at a frequency of once per second.
[0051] If a terminal device does not detect a first broadcast message from another device within a first preset time period, and does not receive a connection request from another device after detecting a second broadcast message from the terminal device within the first preset time period, the time interval for detecting the first broadcast message will be extended according to a preset rule.
[0052] Furthermore, the preset rule is a pre-set extension rule for the first time interval. Optionally, this rule can be a multiple extension, for example, if the original first time interval is 1 second, and the terminal device detects the first broadcast message every 1 second; after the first extension, the interval is 2 seconds, and the terminal device detects the first broadcast message every 2 seconds; after the second extension, the interval is 4 seconds, and the terminal device detects the first broadcast message every 4 seconds, with subsequent time intervals gradually increasing in this manner. Optionally, this rule can be an arithmetic extension, for example, if the original first time interval is 1 second, and the terminal device detects the first broadcast message every 1 second; after the first extension, the interval is 5 seconds, and the terminal device detects the first broadcast message every 5 seconds; after the second extension, the interval is 9 seconds, and the terminal device detects the first broadcast message every 9 seconds, with subsequent time intervals gradually increasing in this manner. This rule can also include other extension methods, which are not limited here. By extending the first time interval for detecting the first broadcast message of the first near-field communication using the preset rule, power consumption can be effectively reduced.
[0053] Optionally, when the first time interval is extended to its upper limit according to preset rules, the detection frequency of the first broadcast message by the terminal device reaches a low level. For example, when the first time interval reaches its upper limit, the detection frequency of the first broadcast message by the terminal device is 4 times per day, that is, the upper limit of the first time interval is 6 hours. Optionally, when the first time interval reaches its upper limit, the upper limit of the first time interval will be maintained indefinitely if no first broadcast message is detected. Optionally, after the first time interval reaches its upper limit for a period of time, the first time interval will be reset. For example, when the first time interval reaches its upper limit on a certain day, the first time interval will be automatically reset from midnight the next day, and the first broadcast message will be detected.
[0054] Optionally, if the connection between the terminal device and the first gateway device is lost, or if the terminal device restarts, step 201 of this connection method is restarted, that is, detecting the first broadcast message of the first near-field communication and sending the second broadcast message of the second near-field communication according to the first time interval. When step 201 of this device connection method is restarted, the first time interval is also reset.
[0055] Optionally, if the server discovers that a new first gateway device has been added to the user's account, it will notify the user via the control terminal to restart the terminal device in order to restart the execution of step 201 of the device connection method and establish a connection with the first gateway device.
[0056] Optionally, in this embodiment, the power consumption of the terminal device in detecting the first broadcast message in the first near-field communication mode is greater than the power consumption of sending the second broadcast message in the second near-field communication mode. Therefore, by extending the first time interval for detecting the first broadcast message, the power consumption of the terminal device can be further reduced.
[0057] 203. Within a first preset time period, if only the first broadcast message is detected, a connection request is sent to the first gateway device that sent the first broadcast message, so as to establish a connection with the first gateway device through the first short-range communication.
[0058] In some possible implementations, if the terminal device only detects the first broadcast message and does not detect a connection request sent to the terminal device by other devices after detecting the second broadcast message sent by the terminal device, then the terminal device sends a connection request to the first gateway device that sent the first broadcast message, so as to establish a connection with the first gateway device through the first short-range communication, and then transmit data and / or instructions.
[0059] 204. Within a first preset time period, if a first broadcast message is detected and a connection request for a second broadcast message is received, a connection request is sent to the first gateway device that sent the first broadcast message, so as to establish a connection with the first gateway device through the first short-range communication.
[0060] In some possible implementations, if the terminal device detects the first broadcast message and receives a connection request from another device in response to the second broadcast message, it will prioritize responding to the first broadcast message and send a connection request to the first gateway device that sent the first broadcast message. For example, if the first short-range communication method is ZigBee and the second short-range communication method is Bluetooth, ZigBee has lower power consumption and a longer transmission distance than Bluetooth. Therefore, prioritizing ZigBee to establish a connection helps reduce power consumption and improve performance.
[0061] The following describes several scenarios where a first broadcast message is detected and a connection request for a second broadcast message is received within the first preset time period:
[0062] (1) In a first possible implementation, within a first preset time period, the terminal device first receives a connection request for the second broadcast message, does not process it temporarily, and continues to detect the first broadcast message. After receiving the first broadcast message within the first preset time period, it sends a connection request for the first broadcast message.
[0063] (2) In a second possible implementation, within a first preset time period, once the terminal device detects the first broadcast message, it sends a connection request for the first broadcast message. During the connection process, even if a connection request for the second broadcast message is received, it is not processed.
[0064] (3) In the third possible implementation, if the terminal device detects the first broadcast message and receives a connection request for the second broadcast message within the first preset time period, then only the first broadcast message is processed, that is, only the connection request for the first broadcast message is sent.
[0065] The first gateway device is capable of sending a first broadcast message. Clearly, this first gateway device includes at least a first short-range communication module. Furthermore, this first gateway device is already connected to the Internet via other communication methods, including but not limited to WiFi and cellular networks, and is therefore referred to as a gateway device.
[0066] Furthermore, the first gateway device can be an air purifier, humidifier, thermostat, or other similar device. If a device includes at least one first short-range communication module and is already connected to the Internet, it falls under the category of the first gateway device in this paper, so the type of device is not limited here.
[0067] For the case where a first broadcast message is detected, please refer to the specific description in section 204 above. Next, the cases where multiple first broadcast messages are detected will be explained separately. In addition, since the first broadcast message is responded to first regardless of whether a connection request for a second broadcast message is received when multiple first broadcast messages are detected, the description of the second broadcast message will be omitted in the following description.
[0068] (1) In a first possible implementation, within a first preset time period, if multiple first broadcast messages are detected, the first gateway device with the highest signal strength is selected from the multiple first gateway devices that sent the first broadcast messages to send a connection request so as to establish a connection through the first short-range communication.
[0069] Optionally, when a terminal device detects multiple first broadcast messages, it analyzes the Received Signal Strength Indicator (RSSI) among them and sends a connection request to the first gateway device with the highest RSSI.
[0070] Optionally, when a terminal device detects multiple first broadcast messages, it can use RSSI to measure the distance between itself and the multiple first gateway devices that sent the first broadcast messages, and send a connection request to the nearest first gateway device.
[0071] (2) In a second possible implementation, within a first preset time period, if multiple first broadcast messages are detected, the system queries the stored connection count of the first gateway device corresponding to each sender identifier based on the sender identifier carried in each of the multiple first broadcast messages, and sends a connection request to the first gateway device with the fewest connection counts to establish a connection through first short-range communication. In this implementation, if a new first gateway device appears, it can prioritize establishing a connection with the new first gateway device. In the prior art, the terminal device needs to manually operate the user to establish a connection with the new gateway device. Therefore, this implementation of the present application can reduce the user's manual operation and improve convenience.
[0072] For example, each time a terminal device establishes a connection with the first gateway device, it stores the connection information locally. This connection information includes at least the identifier of the first gateway device and the number of connections. If multiple first broadcast messages are detected, the terminal device can obtain the sender identifier carried in each broadcast message, compare the sender identifier with the locally stored connection information, select the first gateway device with the fewest connection attempts, and send a connection request to that first gateway device to establish a connection. Optionally, the number of connections can be the number of successful connections or the number of connection requests sent, etc.
[0073] Optionally, after establishing a connection with the first gateway device, the terminal device can transmit data to the first gateway device via a first short-range communication method. The first gateway device then transmits the data to a server via the Internet, allowing the user to view the data. Conversely, the user can also send control commands to the first gateway device through the server, and then transmit the control commands to the terminal device via the first short-range communication module, thereby achieving the purpose of controlling the terminal device.
[0074] Optionally, once the terminal device establishes a connection with the first gateway device through the first short-range communication, it can also stop sending the second broadcast message of the second short-range communication to further reduce power consumption.
[0075] 205. If, within a first preset time period, no first broadcast message is detected and a connection request is received from the second gateway device in response to the second broadcast message, a connection is established with the second gateway device via the second short-range communication, and the detection of broadcast messages from the first short-range communication is stopped.
[0076] Furthermore, the second gateway device needs to send a connection request in response to the second broadcast message, therefore the second gateway device includes at least a second short-range communication module. And this second gateway device is already connected to the Internet via other communication methods, including but not limited to WiFi, cellular networks, etc.
[0077] Optionally, because the second broadcast message sent by the terminal device includes a unique identifier for the terminal device, the second gateway device can use this unique identifier to identify the terminal device. This unique identifier can be uploaded to the server when the terminal device is added to the user account. After receiving the second broadcast message, the second gateway device can query the server to match the unique identifier to identify the terminal device. Alternatively, after obtaining and storing the device identifier corresponding to the user account from the server in advance / periodically, the second gateway device can identify the terminal device through local query. Upon receiving a connection request, the terminal device responds to the request and establishes a connection with the second gateway device that issued the connection request.
[0078] After the terminal device establishes a connection with the second gateway device via the second short-range communication, it stops detecting broadcast messages from the first short-range communication. That is, the terminal device will temporarily disable the first short-range communication module during the second short-range communication connection.
[0079] To better understand the technical solution of the second short-range communication connection described above, the following examples illustrate its application scenarios:
[0080] If the terminal device is a temperature sensor, the second short-range communication method is Bluetooth. When a user needs to view temperature data, they request data from the server via a mobile app. The server then sends a command to the second gateway device. After detecting and recognizing the temperature sensor's Bluetooth broadcast, the second gateway device sends a connection request. The temperature sensor responds to the connection request, establishes a connection, and sends the measured temperature data to the second gateway device, which then uploads the data to the server.
[0081] Optionally, the user's control terminal (mobile phone) can also establish a connection by sending a connection request to the terminal device after detecting the second broadcast message, and directly obtain data from the terminal device through the second short-range communication connection.
[0082] In some possible implementations, after establishing a second short-range communication connection and completing data and command transmission, the terminal device's second short-range communication module will enter a sleep state. Once the second short-range communication module enters a sleep state, it will disconnect the second short-range communication connection. Optionally, when the second short-range communication connection is disconnected, the terminal device's first short-range communication module will continue to operate. The time interval for detecting the first broadcast message of the first short-range communication will continue to follow the change rule before the first short-range communication was closed, continuing from the most recent first time interval before the first short-range communication module was closed, extended according to a preset rule, and then continuing from... Figure 2 Step 201 shown will begin execution.
[0083] In some other possible implementations, since the unique identifier has already been uploaded to the server when it is added to the user account, the second gateway device in the same user account can identify the terminal device by a second broadcast message carrying the data that the terminal device needs to send and the unique identifier of the terminal device, and directly parse and obtain the data that the terminal device needs to send, even if a second short-range communication connection has not been established.
[0084] To better understand the above, Figure 2 The following will illustrate the application scenarios of the proposed solution:
[0085] In a home application scenario, the terminal device is a temperature sensor, the first short-range communication method is ZigBee, the second short-range communication method is Bluetooth, the first gateway device is a humidifier, and the second gateway device is an air purifier. The temperature sensor, humidifier, and air purifier have all been added to the user's account. First, the temperature sensor detects ZigBee broadcast messages at a preset first time interval (let's assume the first time interval is 2 seconds) and sends a Bluetooth broadcast message. The following will describe several scenarios for the temperature sensor connection:
[0086] (1) Within a preset time period, assumed to be 1 minute, if the temperature sensor does not detect a ZigBee broadcast message and does not receive a connection request for a Bluetooth broadcast message sent to it, the time interval for detecting ZigBee broadcast messages will be extended according to a preset rule. It is assumed here that the time interval increases exponentially. That is, if no ZigBee broadcast message is detected within one minute, it will be detected once every 4 seconds, then once every 8 seconds, and so on for subsequent time intervals.
[0087] (2) If the temperature sensor detects only the ZigBee broadcast message within 1 minute and does not receive a connection request for the Bluetooth broadcast message, then a connection request is sent to the humidifier that sent the ZigBee broadcast message in order to establish a connection with the humidifier via ZigBee.
[0088] (3) If, within one minute, the temperature sensor detects both a ZigBee broadcast message and a connection request for a Bluetooth broadcast message, it will still send a connection request to the humidifier that sent the ZigBee broadcast message and will not process the connection request. Therefore, it can be understood that if both a humidifier and an air purifier are present, the temperature sensor will prioritize establishing a connection with the humidifier.
[0089] (4) If the temperature sensor does not detect a ZigBee broadcast message within 1 minute, but receives a connection request for a Bluetooth broadcast message, then a connection is established with the air purifier via Bluetooth.
[0090] In this embodiment, a first broadcast message of the first near-field communication is detected at certain time intervals, and a second broadcast message is sent. The first near-field communication and the second near-field communication are dynamically scheduled according to the different situations of the first gateway and the second gateway devices in the surrounding environment, thereby achieving the purpose of supporting two near-field communication methods and reducing power consumption.
[0091] Please see Figure 3 This is a schematic diagram of another process involving the device connection method in this application embodiment. Steps 301 to 308 constitute the process of adding the terminal device to the user account, mainly including:
[0092] 301. The user detects the second broadcast message of the terminal device through the control terminal.
[0093] 302. The control terminal establishes a second short-range communication connection with the terminal equipment.
[0094] Specifically, after the control terminal detects the second broadcast message, it sends a connection request to the terminal device. The terminal device responds to the request to establish a second short-range communication connection between the control terminal and the terminal device.
[0095] 303. The control terminal requests to obtain device information of the terminal device.
[0096] Specifically, device information may include at least one of the following: Media Access Control Address (MAC address), device serial number, and Mobile Equipment Identifier (MEID).
[0097] 304. The terminal device sends its device information to the control terminal.
[0098] 305. The control terminal uploads the device information of the terminal device to the server and requests that the terminal device be added to the user account.
[0099] Optionally, when the control terminal sends the terminal device information to the server, it can also send a request to add the terminal device's user account. This user account can be an account manually entered / selected by the user in the control terminal; or it can be a default / preferred account bound to the control terminal.
[0100] Alternatively, the control terminal may send only the device information of the terminal device to the server, and the user account requesting the addition of the terminal device may be the default / preferred account bound to the control terminal.
[0101] 306. The server sends user information corresponding to the terminal device to the control terminal.
[0102] Specifically, after the server agrees to add the terminal device to the user account, step 306 is executed.
[0103] 307. The control terminal sends user information corresponding to the terminal device to the terminal device.
[0104] Optionally, in step 306, the server may also send an encryption algorithm; correspondingly, in step 307, the control terminal may also send the encryption algorithm to the terminal device.
[0105] Optionally, the user information must uniquely correspond to the added user account. For example, all devices added to the same user account have the same user information; devices added to different user accounts have different user information.
[0106] Optionally, the encryption algorithm is uniquely associated with a user account. For example, all devices added to the same user account use the same encryption algorithm.
[0107] 308. The terminal device responded to the control terminal that the user account was successfully added.
[0108] Step 308 is an optional step, used to notify the control terminal whether the terminal device has received the user information sent in step 307.
[0109] It is easy to understand that after step 302, steps 303, 304, 307, and 308 transmit messages through the second near-field communication method; and user information (optionally including encryption and decryption algorithms) is to enable secure communication between the terminal device and other devices (such as the first gateway device, the second gateway device, etc., without limitation), so as to ensure that devices under the same user account can communicate and devices under different user accounts cannot communicate.
[0110] Understandably, after a user account is added to a terminal device, it can be executed. Figure 2 The illustrated embodiment.
[0111] (a) In one possible implementation, during execution Figure 2 In the illustrated embodiment, the specific connection process between the terminal device and the first gateway device is as follows: Figure 3 Steps 309 to 311 are shown.
[0112] 309. The first gateway device sends the first broadcast message.
[0113] Specifically, the first broadcast message includes the first verification information of the first gateway device. The first verification information is the unique user information added to a user account by the first gateway device.
[0114] Optionally, the first broadcast message includes first authentication information encrypted by the first gateway.
[0115] Corresponding to step 309, the terminal device detects the first broadcast message of the first near-field communication according to the first time interval, and sends the second broadcast message of the second near-field communication. For specific implementation details, please refer to... Figure 2 The detailed description of the illustrated embodiments will not be repeated here.
[0116] 310. If the first verification information matches the second user information stored locally on the terminal device, a connection request is sent to the first gateway device that sent the first broadcast message. The second user information is the unique corresponding user information stored locally on the terminal device after it has been added to a user account.
[0117] Optionally, if the terminal device decrypts the first verification information and finds that it matches the second user information stored locally, it sends a connection request to the first gateway device that sent the first broadcast message.
[0118] In one possible implementation, within a first preset time period, if the first verification information matches the second user information stored locally on the terminal device when only the first broadcast message is detected, a connection request is sent to the first gateway device that sent the first broadcast message. In another possible implementation, within the first preset time period, if the first broadcast message is detected and a connection request for the second broadcast message is received, and if the first verification information matches the second user information stored locally on the terminal device, a connection request is sent to the first gateway device that sent the first broadcast message.
[0119] 311. After receiving the connection request, the first gateway device responds to the terminal device to confirm the connection.
[0120] (b) In another possible implementation, during execution Figure 2 In the illustrated embodiment, the specific connection process between the terminal device and the first gateway device is as follows: Figure 4 Steps 401 to 403 are shown below:
[0121] 401. The first gateway device sends the first broadcast message.
[0122] Corresponding to step 401, the terminal device detects the first broadcast message of the first near-field communication according to the first time interval, and sends the second broadcast message of the second near-field communication. For specific implementation details, please refer to... Figure 2 The detailed description of the illustrated embodiments will not be repeated here.
[0123] 402. After detecting the first broadcast message, the terminal device sends a connection request to the first gateway device that sent the first broadcast message. The connection request includes second verification information. The second verification information is the unique user information that the terminal device adds to a user account.
[0124] Optionally, after detecting the first broadcast message, the terminal device sends a connection request to the first gateway device that sent the first broadcast message. The connection request contains second authentication information encrypted by the terminal device.
[0125] In one possible implementation, within a first preset time period, if only the first broadcast message is detected, a connection request is sent to the first gateway device that sent the first broadcast message. In another possible implementation, within the first preset time period, if the first broadcast message is detected and a connection request for the second broadcast message is received, a connection request is sent to the first gateway device that sent the first broadcast message.
[0126] 403. If the second verification information matches the first user information stored locally on the first gateway device, a connection confirmation response is sent to the terminal device. The first user information is the unique corresponding user information stored locally on the first gateway device after a user account is added to it.
[0127] Optionally, the first gateway device decrypts the second verification information. If the decrypted second verification information matches the first user information stored locally, it sends a connection confirmation response to the terminal device.
[0128] Understandably, in Figure 2 Based on the embodiments, the scheme for establishing a communication connection between the terminal device and the first gateway device can be referred to Figure 3 The descriptions of steps 309 and 311; or you can refer to Figure 4 Introduction to steps 401 and 403.
[0129] The above Figure 3 and Figure 4 The method shown describes the specific process of adding a terminal device to a user account and the authentication and connection establishment between the terminal device and the first gateway device. Through authentication, devices under the same user account can establish a connection, while devices under different user accounts cannot, thus ensuring connection security.
[0130] Please see Figure 5 This is a schematic diagram of the device connection device provided in the embodiment of this application. The device connection device includes a transceiver module 501 and a processing module 502.
[0131] Transceiver module 501 is used to detect a first broadcast message of the first near-field communication according to a first time interval;
[0132] The transceiver module 501 is also used to send a second broadcast message for the second short-range communication, wherein the first short-range communication and the second short-range communication are different communication methods;
[0133] The processing module 502 is used to extend the first time interval according to a preset rule if no first broadcast message is detected and no connection request for the second broadcast message is received within a first preset time period.
[0134] Optionally, the transceiver module 501 is also configured to, within a first preset time period, send a connection request to the first gateway device that sent the first broadcast message when the transceiver module 501 only detects the first broadcast message, so as to establish a connection with the first gateway device through the first short-range communication.
[0135] Optionally, the transceiver module 501 is further configured to, within a first preset time period, when the transceiver module 501 detects the first broadcast message and receives a connection request for the second broadcast message, send a connection request to the first gateway device that sent the first broadcast message, so as to establish a connection with the first gateway device through the first short-range communication.
[0136] Optionally, the processing module 502 is further configured to, within a first preset time period, if the transceiver module 501 does not detect the first broadcast message and receives a connection request sent by the second gateway device in response to the second broadcast message, establish a connection with the second gateway device through the second short-range communication and stop detecting the broadcast message of the first short-range communication.
[0137] Optionally, the transceiver module 501 is also used to, within a first preset time period, when the transceiver module 501 detects multiple first broadcast messages, select the first gateway device with the highest signal strength from among the multiple first gateway devices that sent the first broadcast messages and send a connection request to establish a connection through the first short-range communication.
[0138] Optionally, the transceiver module 501 is further configured to, within a first preset time period, if multiple first broadcast messages are detected, query the stored connection count of the first gateway device corresponding to the sender identifier carried in each of the multiple first broadcast messages, and send a connection request to the first gateway device with the fewest connection counts, so as to establish a connection through the first near-field communication.
[0139] Optionally, the first broadcast message includes the first authentication information of the first gateway device. The transceiver module 501, in sending the connection request from the first gateway device sending the first broadcast message, is specifically used for:
[0140] If the first user information corresponding to the terminal device matches the first verification information, the step of sending a connection request to the first gateway device that sent the first broadcast message is executed.
[0141] Optionally, the transceiver module 501 sends a connection request to the first gateway device carrying the second authentication information of the terminal device. The second authentication information is used to send a response message confirming the establishment of the connection to the terminal device when the first gateway device determines that the second authentication information matches the second user information corresponding to the first gateway device.
[0142] The functions of the device connection mechanism can be implemented in hardware or by hardware executing corresponding software. This device can be a terminal device or be installed within a terminal device.
[0143] Understandably, this involves Figure 5The relevant content of each module has been described in detail in the aforementioned method embodiments, and can be found in the content of the method embodiments. It will not be repeated here.
[0144] Please see Figure 6 This is a schematic diagram of the structure of the computer device provided in this embodiment. Specifically, the computer device may be a terminal device. The computer device 600 may include a processor 601 and a memory 602. Optionally, it may further include one or more of the following: a multimedia component 603, an input / output (I / O) interface 604, and a communication component 605.
[0145] The processor 601 is used to control the overall operation of the computer device 600 to complete all or part of the steps in the device connection method described above; the memory 602 is used to store various types of data to support the operation of the computer device 600, such data may include instructions for any application or method to operate on the computer device 600, as well as application-related data.
[0146] The memory 602 can be implemented by any type of volatile or non-volatile storage device or a combination thereof, such as one or more of static random access memory (SRAM), electrically erasable programmable read-only memory (EEPROM), erasable programmable read-only memory (EPROM), programmable read-only memory (PROM), read-only memory (ROM), magnetic storage, flash memory, magnetic disk, or optical disk.
[0147] Multimedia component 603 may include a screen and / or an audio component. The screen may be, for example, a touchscreen, and the audio component is used to output and / or input audio signals. For example, the audio component may include a microphone for receiving external audio signals. The received audio signals may be further stored in memory 602 or transmitted via communication component 605. The audio component also includes at least one speaker for outputting audio signals. I / O interface 604 provides an interface between processor 601 and other interface modules, which may be buttons, etc. These buttons may be virtual buttons or physical buttons.
[0148] The communication component 605 is used for wired or wireless communication between the computer device 600 and other devices. The communication methods of this application include at least a first short-range communication and a second short-range communication; therefore, the corresponding communication component 605 may include at least: a first short-range communication module and a second short-range communication module.
[0149] The computer device 600 may be implemented by one or more application-specific integrated circuits (ASICs), digital signal processors (DSPs), digital signal processing devices (DSPDs), programmable logic devices (PLDs), field-programmable gate arrays (FPGAs), controllers, microcontrollers, microprocessors, or other electronic components to execute the device connection method given in the above embodiments.
[0150] The following describes the computer-readable storage medium provided in the embodiments of this application. The computer-readable storage medium includes instructions that, when executed on a computer, cause the computer to perform actions such as... Figures 2 to 4 Any of the device connection methods shown.
[0151] The computer-readable storage medium may include various media capable of storing program code, such as USB flash drives, portable hard drives, read-only memory (ROM), random access memory (RAM), magnetic disks, or optical disks.
[0152] The various embodiments in this specification are described in a progressive manner, with each embodiment focusing on its differences from other embodiments. Similar or identical parts between embodiments can be referred to interchangeably. For the apparatus disclosed in the embodiments, since it corresponds to the method disclosed in the embodiments, the description is relatively simple; relevant parts can be referred to in the method section.
[0153] Those skilled in the art will clearly understand that, for the sake of convenience and brevity, the specific working processes of the device connection apparatus, computer equipment, and storage medium described above can be referred to the corresponding processes in the foregoing method embodiments, and will not be repeated here.
[0154] In the several embodiments provided in this application, it should be understood that the disclosed methods can be implemented in other ways.
[0155] Those skilled in the art will further recognize that the units and algorithm steps of the various examples described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, computer software, or a combination of both. To clearly illustrate the interchangeability of hardware and software, the components and steps of the various examples have been generally described in terms of functionality in the foregoing description. Whether these functions are implemented in hardware or software depends on the specific application and design constraints of the technical solution. Those skilled in the art can use different methods to implement the described functions for each specific application, but such implementation should not be considered beyond the scope of this application.
[0156] The steps of the methods or algorithms described in conjunction with the embodiments disclosed herein can be implemented directly by hardware, a software module executed by a processor, or a combination of both. The software module can be located in random access memory (RAM), main memory, read-only memory (ROM), electrically programmable ROM, electrically erasable programmable ROM, registers, hard disk, removable disk, CD-ROM, or any other form of storage medium known in the art.
[0157] Finally, it should be noted that in this document, relationships such as "first" and "second" are used merely to distinguish one entity or operation from another, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Furthermore, the terms "include," "contain," or any other variations are intended to cover non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such a process, method, article, or apparatus.
[0158] The units described as separate components may or may not be physically separate. The components shown as units may or may not be physical units; that is, they may be located in one place or distributed across multiple network units. Some or all of the units can be selected to achieve the purpose of this embodiment according to actual needs.
[0159] Furthermore, the functional units in the various embodiments of this application can be integrated into one processing unit, or each unit can exist physically separately, or two or more units can be integrated into one unit. The integrated unit can be implemented in hardware or as a software functional unit.
[0160] If the integrated unit is implemented as a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of this application, in essence, or the part that contributes to the prior art, or all or part of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions to cause a computer device (which may be a personal computer, a server, or a network device, etc.) to execute all or part of the steps of the methods described in the various embodiments of this application.
[0161] The technical features of the above embodiments can be combined in any way. For the sake of brevity, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this specification.
[0162] The embodiments described above are merely illustrative of several implementation methods of this application, and while the descriptions are specific and detailed, they should not be construed as limiting the scope of this patent application. It should be noted that those skilled in the art can make various modifications and improvements without departing from the concept of this application, and these all fall within the protection scope of this application. Therefore, the protection scope of this patent application should be determined by the appended claims.
Claims
1. A device connection method characterized by, Applied to a terminal device, the terminal device includes a first near-field communication and a second near-field communication, wherein the first near-field communication and the second near-field communication are different communication methods; The method includes: The first broadcast message of the first near-field communication is detected according to the first time interval, and the second broadcast message of the second near-field communication is sent. If, within a first preset time period, the first time interval is extended according to a preset rule if neither the first broadcast message is detected nor a connection request for the second broadcast message is received.
2. The device connection method according to claim 1, wherein The method further includes: Within the first preset time period, if only the first broadcast message is detected, a connection request is sent to the first gateway device that sent the first broadcast message, so as to establish a connection with the first gateway device through the first short-range communication; Within the first preset time period, if the first broadcast message is detected and a connection request for the second broadcast message is received, a connection request is sent to the first gateway device that sent the first broadcast message, so as to establish a connection with the first gateway device through the first short-range communication.
3. The device connection method according to claim 1, wherein The method further includes: If, within the first preset time period, no first broadcast message is detected and a connection request is received from the second gateway device in response to the second broadcast message, a connection is established with the second gateway device via the second short-range communication, and the detection of broadcast messages from the first short-range communication is stopped.
4. The device connection method according to claim 1, wherein The method further includes: Within the first preset time period, if multiple first broadcast messages are detected, the first gateway device with the highest signal strength is selected from the multiple first gateway devices that sent the first broadcast messages to send a connection request, so as to establish a connection through the first short-range communication.
5. The device connection method according to claim 1, wherein The method further includes: Within the first preset time period, if multiple first broadcast messages are detected, based on the sender identifier carried in each of the multiple first broadcast messages, the number of connections of the first gateway device corresponding to the sender identifier is queried in the storage, and a connection request is sent to the first gateway device with the fewest connection times, so as to establish a connection through the first short-range communication.
6. The device connection method according to claim 2, 4, or 5, characterized in that, The first broadcast message includes the first authentication information of the first gateway device; The terminal device sends a connection request to the first gateway device that sent the first broadcast message, including: If the first user information corresponding to the terminal device matches the first verification information, the step of sending a connection request to the first gateway device that sent the first broadcast message is executed.
7. The device connection method according to claim 2 or 4 or 5, characterized by, The connection request carries the second verification information of the terminal device. The second verification information is used to send a response message confirming the establishment of the connection to the terminal device when the first gateway device determines that the second verification information matches the second user information corresponding to the first gateway device.
8. A device connection apparatus, characterized by comprising: The device includes: The transceiver module is used to detect the first broadcast message of the first near-field communication according to a first time interval; The transceiver module is also used to send a second broadcast message for the second short-range communication, wherein the first short-range communication and the second short-range communication are different communication methods; The processing module is configured to extend the first time interval according to a preset rule if, within a first preset time period, neither the first broadcast message is detected nor a connection request for the second broadcast message is received.
9. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores a computer program that, when executed by a processor, performs the steps of the device connection method as described in any one of claims 1 to 7.
10. A computer device, comprising: processor; Memory, used to store computer programs; When the processor executes a computer program, it causes the processor to perform the steps of the method as described in any one of claims 1 to 7.
Citation Information
Patent Citations
Method and device for dynamically adjusting BLE Bluetooth connection interval
CN105959040A
Wi-Fi Bluetooth integrated base station positioning system
CN109975758A