[go: up one dir, main page]

CN114928858A - Equipment connection method, device, storage medium and computer equipment - Google Patents

Equipment connection method, device, storage medium and computer equipment Download PDF

Info

Publication number
CN114928858A
CN114928858A CN202210516058.6A CN202210516058A CN114928858A CN 114928858 A CN114928858 A CN 114928858A CN 202210516058 A CN202210516058 A CN 202210516058A CN 114928858 A CN114928858 A CN 114928858A
Authority
CN
China
Prior art keywords
broadcast message
short
range communication
connection
terminal device
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202210516058.6A
Other languages
Chinese (zh)
Inventor
张一旭
范乐宇
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Shenzhen Chenbei Technology Co Ltd
Original Assignee
Shenzhen Chenbei Technology Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Shenzhen Chenbei Technology Co Ltd filed Critical Shenzhen Chenbei Technology Co Ltd
Priority to CN202210516058.6A priority Critical patent/CN114928858A/en
Publication of CN114928858A publication Critical patent/CN114928858A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04WWIRELESS COMMUNICATION NETWORKS
    • H04W24/00Supervisory, monitoring or testing arrangements
    • H04W24/08Testing, supervising or monitoring using real traffic
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04WWIRELESS COMMUNICATION NETWORKS
    • H04W52/00Power management, e.g. Transmission Power Control [TPC] or power classes
    • H04W52/02Power saving arrangements
    • H04W52/0209Power saving arrangements in terminal devices
    • H04W52/0225Power saving arrangements in terminal devices using monitoring of external events, e.g. the presence of a signal
    • H04W52/0248Power saving arrangements in terminal devices using monitoring of external events, e.g. the presence of a signal dependent on the time of the day, e.g. according to expected transmission activity
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04WWIRELESS COMMUNICATION NETWORKS
    • H04W76/00Connection management
    • H04W76/10Connection setup
    • YGENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
    • Y02TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
    • Y02DCLIMATE CHANGE MITIGATION TECHNOLOGIES IN INFORMATION AND COMMUNICATION TECHNOLOGIES [ICT], I.E. INFORMATION AND COMMUNICATION TECHNOLOGIES AIMING AT THE REDUCTION OF THEIR OWN ENERGY USE
    • Y02D30/00Reducing energy consumption in communication networks
    • Y02D30/70Reducing energy consumption in communication networks in wireless communication networks

Landscapes

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

Abstract

本申请涉及通信领域,公开了一种设备连接方法、装置、存储介质、计算机设备,其中方法应用于终端设备,所述终端设备包括第一近距离通信和第二近距离通信,第一近距离通信与第二近距离通信为不同的通信方式;方法包括:按照第一时间间隔检测第一近距离通信的第一广播消息,以及发送第二近距离通信的第二广播消息;第一预设时长内,在未检测到第一广播消息且未接收到针对第二广播消息的连接请求的情况下,则按照预设规则延长第一时间间隔。通过本申请方案,终端设备在至少支持两种近距离通信方式的情况下采用动态的调度方法达到了降低功耗的目的。

Figure 202210516058

The present application relates to the field of communications, and discloses a device connection method, device, storage medium, and computer equipment, wherein the method is applied to terminal equipment, and the terminal equipment includes a first short-range communication and a second short-range communication, and the first short-range communication The communication and the second short-range communication are different communication modes; the method includes: detecting the first broadcast message of the first short-range communication according to the first time interval, and sending the second broadcast message of the second short-range communication; the first preset Within the time period, if the first broadcast message is not detected and the connection request for the second broadcast message is not received, the first time interval is extended according to a preset rule. Through the solution of the present application, the terminal device adopts a dynamic scheduling method under the condition that at least two short-range communication modes are supported to achieve the purpose of reducing power consumption.

Figure 202210516058

Description

一种设备连接方法、装置、存储介质、计算机设备Device connection method, device, storage medium, and computer equipment

技术领域technical field

本申请涉及通信技术领域,尤其涉及一种设备连接方法、装置、存储介质、计算机设备。The present application relates to the field of communication technologies, and in particular, to a device connection method, apparatus, storage medium, and computer equipment.

背景技术Background technique

紫蜂和蓝牙是当前使用非常广泛的两种通信协议。支持紫蜂通信的设备其连接距离远,但不能与仅支持蓝牙通信的设备连接,比如不能与手机直接连接。而支持蓝牙通信的设备其使用便捷,其连接距离较近,但不能与仅支持紫蜂通信的设备连接。而对于同时支持紫蜂和蓝牙两种通信协议的设备,在使用时又会产生功耗过高的问题。ZigBee and Bluetooth are two communication protocols that are currently very widely used. A device that supports Zigbee communication has a long connection distance, but it cannot be connected to a device that only supports Bluetooth communication, for example, it cannot be directly connected to a mobile phone. A device that supports Bluetooth communication is easy to use, and its connection distance is relatively short, but it cannot be connected to a device that only supports Zigbee communication. For a device that supports both Zigbee and Bluetooth communication protocols, the problem of excessive power consumption will occur during use.

发明内容SUMMARY OF THE INVENTION

本发明提供一种设备连接方法、装置、存储介质、计算机设备,旨在解决现有技术下同时支持紫蜂和蓝牙的设备功耗过高的问题。The present invention provides a device connection method, device, storage medium and computer equipment, aiming at solving the problem of excessive power consumption of devices supporting Zigbee and Bluetooth simultaneously in the prior art.

为实现上述目的,本申请第一方面提供一种设备连接方法,其特征在于,应用于终端设备,所述终端设备包括第一近距离通信和第二近距离通信,所述第一近距离通信与所述第二近距离通信为不同的通信方式;In order to achieve the above purpose, a first aspect of the present application provides a device connection method, which is characterized in that it is applied to a terminal device, and the terminal device includes a first short-range communication and a second short-range communication, and the first short-range communication Communication with the second short-range communication is different;

所述方法包括:The method includes:

按照第一时间间隔检测所述第一近距离通信的第一广播消息,以及发送所述第二近距离通信的第二广播消息;Detecting the first broadcast message of the first short-range communication according to the first time interval, and sending the second broadcast message of the second short-range communication;

第一预设时长内,在未检测到所述第一广播消息且未接收到针对所述第二广播消息的连接请求的情况下,则按照预设规则延长所述第一时间间隔。Within the first preset time period, if the first broadcast message is not detected and the connection request for the second broadcast message is not received, the first time interval is extended according to a preset rule.

可选的,所述方法还包括:Optionally, the method further includes:

所述第一预设时长内,在只检测到所述第一广播消息的情况下,向发送所述第一广播消息的第一网关设备发送连接请求,以通过所述第一近距离通信与所述第一网关设备建立连接;Within the first preset time period, when 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 communicate with the device through the first short-range communication. the first gateway device establishes a connection;

所述第一预设时长内,在检测到所述第一广播消息且接收到针对所述第二广播消息的连接请求的情况下,向发送所述第一广播消息的所述第一网关设备发送连接请求,以通过所述第一近距离通信与所述第一网关设备建立连接。Within the first preset time period, when the first broadcast message is detected and a connection request for the second broadcast message is received, the first gateway device that sent the first broadcast message is sent A connection request is sent to establish a connection with the first gateway device through the first short-range communication.

可选的,所述方法还包括:Optionally, the method further includes:

所述第一预设时长内,在未检测到第一广播消息且接收到第二网关设备针对所述第二广播消息发送的连接请求的情况下,则通过所述第二近距离通信与所述第二网关设备建立连接,并且停止检测所述第一近距离通信的广播消息。Within the first preset time period, if the first broadcast message is not detected and the connection request sent by the second gateway device for the second broadcast message is received, the second short-range communication is used to communicate with the The second gateway device establishes a connection, and stops detecting the broadcast message of the first short-range communication.

可选的,所述方法还包括:Optionally, the method further includes:

所述第一预设时长内,在检测到多个第一广播消息的情况下,根据所述多个第一广播消息,从发送第一广播消息的多个第一网关设备中选择信号强度最高的第一网关设备发送连接请求,以通过所述第一近距离通信建立连接。Within the first preset time period, when multiple first broadcast messages are detected, select the highest signal strength from the multiple first gateway devices that send the first broadcast message according to the multiple first broadcast messages. The first gateway device of the device sends a connection request to establish a connection through the first short-range communication.

可选的,所述方法还包括:Optionally, the method further includes:

所述第一预设时长内,在检测到多个第一广播消息的情况下,根据所述多个第一广播消息中每个第一广播消息携带的发送方标识,查询存储的与所述发送方标识对应的第一网关设备的连接次数,向连接次数最少的第一网关设备发送连接请求,以通过所述所述第一近距离通信建立连接。Within the first preset duration, when multiple first broadcast messages are detected, according to the sender identifier carried by each first broadcast message in the multiple first broadcast messages, query the stored information related to the first broadcast message. The sender identifies the number of connections of the corresponding first gateway device, and sends a connection request to the first gateway device with the least number of connections, so as to establish a connection through the first short-range communication.

可选的,所述第一广播消息包括所述第一网关设备的第一验证信息;Optionally, the first broadcast message includes first verification 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:

在所述终端设备对应的第一用户信息与所述第一验证信息相匹配的情况下,执行向发送所述第一广播消息的所述第一网关设备发送连接请求的步骤。In the case that 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 sends the first broadcast message is performed.

可选的,所述连接请求携带所述终端设备的第二验证信息,所述第二验证信息用于在所述第一网关设备确定所述第二验证信息与所述第一网关设备对应的第二用户信息相匹配的情况下向所述终端设备反馈确认建立连接的响应消息。Optionally, the connection request carries second verification information of the terminal device, and the second verification information is used to determine, at the first gateway device, that the second verification information corresponds to the first gateway device. When the second user information matches, a response message confirming the establishment of the connection is fed back to the terminal device.

为实现上述目的,本申请第二方面提供一种设备连接装置,该装置包括:In order to achieve the above object, a second aspect of the present application provides a device connecting device, the device comprising:

收发模块,用于按照第一时间间隔检测第一近距离通信的第一广播消息;a transceiver module, configured to detect the first broadcast message of the first short-range communication according to the first time interval;

所述收发模块,还用于发送第二近距离通信的第二广播消息,所述第一近距离通信与所述第二近距离通信为不同的通信方式;The transceiver module is further configured to send a second broadcast message of a second short-range communication, wherein the first short-range communication and the second short-range communication are in different communication modes;

处理模块,用于第一预设时长内,在未检测到所述第一广播消息且未接收到针对所述第二广播消息的连接请求的情况下,则按照预设规则延长所述第一时间间隔。The processing module is configured to extend the first broadcast message according to a preset rule when the first broadcast message is not detected and the connection request for the second broadcast message is not received within a first preset time period. time interval.

为实现上述目的,本申请第三方面提供一种计算机可读存储介质,所述计算机可读存储介质上存储有计算机程序,所述计算机程序被处理器运行时执行本申请第一方面提供的设备连接方法的步骤。In order to achieve the above object, a third aspect of the present application provides a computer-readable storage medium, where a computer program is stored on the computer-readable storage medium, and when the computer program is run by a processor, the device provided in the first aspect of the present application is executed. The steps of the connection method.

为实现上述目的,本申请第四方面提供一种计算机设备,包括;处理器;存储器,用于存储计算机程序;所述处理器执行计算机程序时,使得处理器执行本申请第一方面提供的设备连接方法的步骤。In order to achieve the above purpose, a fourth aspect of the present application provides a computer device, comprising: a processor; a memory for storing a computer program; when the processor executes the computer program, the processor causes the processor to execute the device provided in the first aspect of the present application The steps of the connection method.

本申请实施例具有如下优点或有益效果:The embodiments of the present application have the following advantages or beneficial effects:

本申请实施例通过对终端设备的第一近距离通信和第二近距离通信进行灵活调度,按照一定的时间间隔检测第一近距离通信的第一广播消息,并发送第二近距离通信的第二广播消息,在预设时间内没有接收到第一广播消息的情况下,延长检测第一广播消息的时间间隔,实现在同时支持两种近距离通信方式的情况下,能够降低功耗。In this embodiment of the present application, by flexibly scheduling the first short-range communication and the second short-range communication of the terminal device, the first broadcast message of the first short-range communication is detected according to a certain time interval, and the first broadcast message of the second short-range communication is sent. Second broadcast message, in the case that the first broadcast message is not received within the preset time, the time interval for detecting the first broadcast message is extended, so that the power consumption can be reduced in the case of simultaneously supporting two short-range communication modes.

附图说明Description of drawings

图1为本申请实施例中设备连接方法应用场景示意图;FIG. 1 is a schematic diagram of an application scenario of a device connection method in an embodiment of the present application;

图2为本申请实施例提供的设备连接方法的流程图;FIG. 2 is a flowchart of a device connection method provided by an embodiment of the present application;

图3为本申请实施例中设备连接方法涉及的另一种流程示意图;FIG. 3 is another schematic flowchart involved in the device connection method in the embodiment of the application;

图4为本申请实施例中设备连接方法涉及的另一种流程示意图;FIG. 4 is another schematic flowchart involved in the device connection method in the embodiment of the present application;

图5为本申请实施例提供的设备连接装置的结构示意图;FIG. 5 is a schematic structural diagram of a device connecting device provided by an embodiment of the present application;

图6为本申请实施例提供的计算机设备的结构示意图。FIG. 6 is a schematic structural diagram of a computer device provided by an embodiment of the present application.

具体实施方式Detailed ways

下面将结合本申请实施例中的附图,对本申请实施例中的技术方案进行描述,显然,所描述的实施例仅仅是本申请一部分实施例,而不是全部的实施例。基于本申请中的实施例,本领域普通技术人员在没有做出创造性劳动前提下所获得的所有其他实施例,都属于本申请保护的范围。The technical solutions in the embodiments of the present application will be described below with reference to the drawings in the embodiments of the present application. Obviously, the described embodiments are only a part of the embodiments of the present application, rather than all the embodiments. Based on the embodiments in the present application, all other embodiments obtained by those of ordinary skill in the art without creative efforts shall fall within the protection scope of the present application.

在本申请实施例中,提供一种设备连接方法,可以应用在支持两种近距离通信方式的终端设备与网关设备建立连接的场景下,请参阅图1,为本申请实施例中设备连接方法应用场景的示意图,如图1所示,本申请的一种实施方式中,本申请的应用场景中包括终端设备101、第一网关设备102、第二网关设备103、控制终端104以及服务器105。终端设备至少包含第一近距离通信模块和第二近距离通信模块,即该终端设备至少支持两种不同的近距离通信方式。终端设备可以为智能传感器、监控摄像头、智能门锁、智能猫眼、电子手表、蓝牙音响、智能插座、扫地机器人、空气净化器、加湿器、车载终端等设备,在此不对具体设备类型做限制。控制终端可以包括但不限于手机、平板电脑等。In this embodiment of the present application, a device connection method is provided, which can be applied in a scenario where a terminal device supporting two short-range communication methods establishes a connection with a gateway device. Please refer to FIG. 1 , which is a device connection method in this embodiment of the present application. A schematic diagram of an application scenario, as shown in FIG. 1 , in an embodiment of the present application, the application scenario of the present application 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, that is, the terminal device supports at least two different short-range communication modes. Terminal devices can be smart sensors, surveillance cameras, smart door locks, smart cat eyes, electronic watches, bluetooth speakers, smart sockets, sweeping robots, air purifiers, humidifiers, vehicle terminals and other devices. There is no specific device type here. The control terminal may include, but is not limited to, a mobile phone, a tablet computer, and the like.

第一近距离通信方式和第二近距离通信方式为两种不同的通信方式。The first short-range communication method and the second short-range communication method are two different communication methods.

优选的,第一近距离通信方式为紫蜂(ZigBee),第二近距离通信方式为蓝牙。Preferably, the first short-range communication method is ZigBee, and the second short-range communication method is Bluetooth.

可选的,第一近距离通信方式还可以为Z-Ware、罗拉(LoRa)、窄带物联网(NarrowBand Internet of Things,NB-IOT)等,第二近距离通信方式还可以为Matter(是一个智能家居开源标准项目)。Optionally, 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 (is a Smart Home Open Source Standards Project).

可选的,终端设备101不包含WIFI模块,所以无法连接到互联网以实现与服务器105间的数据传输,需要连接到第一网关设备102或第二网关设备103或控制终端104,进而实现与服务器105间的数据传输。Optionally, the terminal device 101 does not include a WIFI module, so it cannot be connected to the Internet to realize data transmission with the server 105, and needs to be connected to the first gateway device 102 or the second gateway device 103 or the control terminal 104, and then realize the communication with the server. Data transfer between 105.

在终端设备支持两种近距离通信方式的情况下,虽然能够通过两种近距离通信方式与网关设备建立连接以及传输数据,但由于两种近距离通信同时工作,导致终端设备的功耗较高。本申请通过对两种近距离通信的调度,按照一定的时间间隔检测第一近距离通信的第一广播消息,并发送第二近距离通信的第二广播消息,在预设时间内没有接收到第一广播消息的情况下,延长检测第一广播消息的时间间隔,通过动态的调度方法达到支持两种近距离通信方式并且降低功耗的目的。下面通过图2至图4对本申请提供的方法进行详细介绍。In the case where the terminal device supports two short-range communication methods, although it can establish a connection with the gateway device and transmit data through the two short-range communication methods, the power consumption of the terminal device is relatively high due to the simultaneous operation of the two short-range communication methods. . The present application detects the first broadcast message of the first short-range communication according to a certain time interval by scheduling the two kinds of short-range communication, and sends the second broadcast message of the second short-range communication, and the second broadcast message of the second short-range communication is not received within the preset time In the case of the first broadcast message, the time interval for detecting the first broadcast message is extended, and the purpose of supporting two short-range communication modes and reducing power consumption is achieved through a dynamic scheduling method. The method provided by the present application will be described in detail below with reference to FIG. 2 to FIG. 4 .

请参阅图2,为本申请实施例中设备连接方法的流程示意图,如图2所示,本实施例提供的设备连接方法包括:Please refer to FIG. 2 , which is a schematic flowchart of a device connection method in an embodiment of the present application. As shown in FIG. 2 , the device connection method provided by this embodiment includes:

201、按照第一时间间隔检测第一近距离通信的第一广播消息,以及发送第二近距离通信的第二广播消息。201. Detect the first broadcast message of the first short-range communication according to the first time interval, and send the second broadcast message of the second short-range communication.

第一时间间隔是预先设定的,该时间间隔较短,终端设备以较高的频率对第一近距离通信的第一广播消息进行检测,保证能够在短时间内检测到周围发送该广播消息的设备。例如,第一时间间隔可以设置为1秒。The first time interval is preset, the time interval is short, and the terminal device detects the first broadcast message of the first short-range communication at a relatively high frequency to ensure that the broadcast message can be detected in a short period of time. device of. For example, the first time interval may be set to 1 second.

第一近距离通信的第一广播消息为其他设备通过第一近距离通信方式发送的广播消息,使终端设备能够通过第一广播消息及时发现这些设备。The first broadcast message of the first short-range communication is a broadcast message sent by other devices through the first short-range communication manner, so that the terminal device can discover these devices in time through the first broadcast message.

在对第一近距离通信的第一广播消息进行检测的情况下,终端设备还通过其第二近距离通信模块发送第二广播消息。In the case of detecting the first broadcast message of the first short-range communication, the terminal device also sends the second broadcast message through its second short-range communication module.

可选的,本申请对第二广播消息的发送时间间隔不做限定,可以与第一时间间隔相同,也可以不同。Optionally, the present application does not limit the time interval for sending the second broadcast message, which may be the same as or different from the first time interval.

可选的,第二广播消息包括终端设备需要发送的数据和终端设备的唯一标识。例如,唯一标识可以为该终端设备的媒体存取控制位置(Media Access Control Address,MAC地址)。Optionally, the second broadcast message includes data to be sent by the terminal device and a unique identifier of the terminal device. For example, the unique identifier may be the media access control address (Media Access Control Address, MAC address) of the terminal device.

202、第一预设时长内,在未检测到第一广播消息且未接收到针对第二广播消息的连接请求的情况下,则按照预设规则延长第一时间间隔。202. Within the first preset time period, in the case that the first broadcast message is not detected and the connection request for the second broadcast message is not received, extend the first time interval according to a preset rule.

在第一预设时长内,终端设备按照第一时间间隔检测第一广播消息。在一些可能的实施方式中,若第一预设时长为1分钟,第一时间间隔为1秒,则在最初的1分钟内,该终端设备将以每秒1次的频率对第一广播信号进行检测。Within the first preset time period, the terminal device detects the first broadcast message according to the first time interval. In some possible implementations, if the first preset duration is 1 minute and the first time interval is 1 second, then in the first 1 minute, the terminal device will broadcast the first broadcast signal at a frequency of once per second test.

如果终端设备在第一预设时长内没有检测到其他设备发出的第一广播消息,并且在第一预设时长内没有接收到其他设备在检测到该终端设备发出的第二广播消息后向该终端设备发送的连接请求,则会将其检测第一广播消息的时间间隔按照预设规则进行延长。If the terminal device does not detect the first broadcast message sent by the other device within the first preset time period, and does not receive the second broadcast message sent by the other device after detecting the second broadcast message sent by the terminal device within the first preset time period. For the connection request sent by the terminal device, the time interval for detecting the first broadcast message will be extended according to the preset rule.

进一步的,预设规则是预先设置的第一时间间隔的延长规则。可选的,该规则可以是倍数型延长,例如,原第一时间间隔为1秒,终端设备每隔1秒检测一次第一广播消息;第一次延长后的间隔为2秒,终端设备隔2秒检测一次第一广播消息;第二次延长后的间隔为4秒,终端设备隔4秒检测一次第一广播消息,后续时间间隔依此规则逐渐增延长。可选的,该规则可以是等差型延长,例如,原第一时间间隔为1秒,终端设备每隔1秒检测一次第一广播消息;第一次延长后的间隔为5秒,终端设备隔5秒检测一次第一广播消息;第二次延长后的间隔为9秒,终端设备隔9秒检测一次第一广播消息,后续时间间隔依此规则逐渐增延长。该规则还可以包括其他的延长方式,在此不做限制。通过预设规则将检测第一近距离通信的第一广播消息的第一时间间隔延长,能够有效降低功耗。Further, the preset rule is an extension rule of the preset first time interval. Optionally, the rule can be a multiple extension. For example, if the original first time interval is 1 second, the terminal device detects the first broadcast message every 1 second; the interval after the first extension is 2 seconds, and the terminal device The first broadcast message is detected once every 2 seconds; the interval after the second extension is 4 seconds, the terminal device detects the first broadcast message every 4 seconds, and the subsequent time interval is gradually increased according to this rule. Optionally, the rule can be an arithmetic extension. For example, if the original first time interval is 1 second, the terminal device detects the first broadcast message every 1 second; the interval after the first extension is 5 seconds, and the terminal device detects the first broadcast message every 1 second. The first broadcast message is detected every 5 seconds; the interval after the second extension is 9 seconds, the terminal device detects the first broadcast message every 9 seconds, and the subsequent time interval is gradually increased according to this rule. The rule may also include other extension methods, which are not limited here. Extending the first time interval for detecting the first broadcast message of the first short-range communication through the preset rule can effectively reduce power consumption.

可选的,根据预设规则将第一时间间隔延长到其上限时,终端设备对第一广播消息的检测频率达到较低的水平。例如,当第一时间间隔达到上限时没终端设备对第一广播消息的检测频率为每天4次,即第一时间间隔上限为6小时。可选的,当第一时间间隔达到上限时,在未检测到第一广播消息的情况下会一直保持第一时间间隔的上限。可选的,在第一时间间隔达到上限一段时间后,第一时间间隔会被重置。例如,当某一天内第一时间间隔达到上限时,第二天零点起会自动重置第一时间间隔,检测第一广播消息。Optionally, when the first time interval is extended to its upper limit according to the preset rule, the detection frequency of the first broadcast message by the terminal device reaches a lower level. For example, when the first time interval reaches the upper limit, the detection frequency of the first broadcast message by the terminal device is 4 times a day, that is, the upper limit of the first time interval is 6 hours. Optionally, when the first time interval reaches the upper limit, if the first broadcast message is not detected, the upper limit of the first time interval will always be maintained. Optionally, after the first time interval reaches the upper limit for a period of time, the first time interval will be reset. For example, when the first time interval in a certain day reaches the upper limit, the first time interval will be automatically reset from 0:00 the next day to detect the first broadcast message.

可选的,若终端设备与第一网关设备的连接断开或者若终端设备重启,则重新开始执行本连接方法的步骤201,即按照第一时间间隔检测第一近距离通信的第一广播消息,以及发送第二近距离通信的第二广播消息。重新开始本设备连接方法的步骤201时,第一时间间隔也会被重置。Optionally, if the connection between the terminal device and the first gateway device is disconnected or if the terminal device is restarted, step 201 of the connection method is restarted, that is, the first broadcast message of the first short-range communication is detected according to the first time interval. , and send a second broadcast message of the second short-range communication. When restarting step 201 of the method for connecting the device, the first time interval is also reset.

可选的,若服务器发现有新的第一网关设备添加到用户账号中,则通过控制终端通知用户重启该终端设备,以重新开始执行本设备连接方法的步骤201,与第一网关设备建立连接。Optionally, if the server finds that a new first gateway device is added to the user account, it will notify the user to restart the terminal device through the control terminal, so as to restart the execution of step 201 of the method for connecting this device, and establish a connection with the first gateway device. .

可选的,在本申请实施例中,终端设备在第一近距离通信方式下检测第一广播消息的功耗大于在第二近距离通信方式下发送第二广播消息的功耗,进而通过延长检测第一广播消息的第一时间间隔更能够减少终端设备的功耗。Optionally, in this embodiment of the present application, the power consumption of the terminal device for detecting the first broadcast message in the first short-range communication mode is greater than the power consumption for sending the second broadcast message in the second short-range communication mode, and then by extending the power consumption of the second broadcast message. The first time interval for detecting the first broadcast message can further reduce the power consumption of the terminal device.

203、第一预设时长内,在只检测到第一广播消息的情况下,向发送第一广播消息的第一网关设备发送连接请求,以通过第一近距离通信与第一网关设备建立连接。203. Within the first preset time period, when only the first broadcast message is detected, send a connection request to the first gateway device that sends the first broadcast message, so as to establish a connection with the first gateway device through the first short-range communication .

在一些可能的实施方式中,若终端设备只检测到第一广播消息,而没有检测到其他设备通过在检测到该终端设备发出的第二广播消息后向该终端设备发送的连接请求,则向发送该第一广播消息的第一网关设备发送连接请求,以通过第一近距离通信与第一网关设备建立连接,进而进行数据和/或指令的传输。In some possible implementations, if the terminal device only detects the first broadcast message, but does not detect a connection request sent by other devices to the terminal device after detecting the second broadcast message sent by the terminal device, send the connection request to the terminal device. The first gateway device that sends the first broadcast message sends a connection request, so as to establish a connection with the first gateway device through the first short-range communication, so as to transmit data and/or instructions.

204、第一预设时长内,在检测到第一广播消息且接收到针对第二广播消息的连接请求的情况下,向发送第一广播消息的第一网关设备发送连接请求,以通过第一近距离通信与第一网关设备建立连接。204. Within the first preset time period, in the case where the first broadcast message is detected and a connection request for the second broadcast message is received, send a connection request to the first gateway device that sent the first broadcast message, so as to pass the first broadcast message. The short-range communication establishes a connection with the first gateway device.

在一些可能的实施方式中,若该终端设备检测到第一广播消息,并且接收到其他设备针对第二广播消息发送的连接请求,则会优先响应第一广播消息,向发送第一广播消息的第一网关设备发送连接请求。例如,在第一近距离通信方式为ZigBee,第二近距离通信方式为蓝牙的情况下,ZigBee相比于蓝牙功耗更低,传输距离更远。因此优先选择ZigBee的方式建立连接有利于降低功耗和提高性能。In some possible implementations, if the terminal device detects the first broadcast message and receives a connection request sent by another device for the second broadcast message, it will respond to the first broadcast message preferentially, and send the first broadcast message to the device that sent the first broadcast message. The first gateway device sends a connection request. For example, when the first short-range communication method is ZigBee and the second short-range communication method is Bluetooth, ZigBee has lower power consumption and longer transmission distance than Bluetooth. Therefore, the ZigBee method is preferred to establish a connection, which is beneficial to reduce power consumption and improve performance.

下面对第一预设时长内,检测到第一广播消息并且接收到针对第二广播消息的连接请求的几种情形进行介绍:The following describes several situations in which the first broadcast message is detected and a connection request for the second broadcast message is received within the first preset duration:

(1)在第一种可能的实施方式中,第一预设时长内,终端设备首先接收到针对第二广播消息的连接请求,暂时不进行处理,并且继续检测第一广播消息,第一预设时长内接收到第一广播消息后,发送针对第一广播消息的连接请求。(1) In a first possible implementation manner, within the first preset duration, the terminal device first receives a connection request for the second broadcast message, temporarily does not process it, and continues to detect the first broadcast message, the first preset After receiving the first broadcast message within a set time period, a connection request for the first broadcast message is sent.

(2)在第二种可能的实施方式中,第一预设时长内,终端设备一旦检测到第一广播消息,就发送针对第一广播消息的连接请求。在连接的过程中,即使接收到针对第二广播消息的连接请求,也不进行处理。(2) In a second possible implementation manner, within the 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, no processing is performed.

(3)在第三种可能的实施方式中,第一预设时长内,终端设备同时检测到的第一广播消息,并且接收到针对第二广播消息的连接请求,则只对第一广播消息进行处理,即只发送针对第一广播消息的连接请求。(3) In a third possible implementation manner, within the first preset duration, the terminal device detects the first broadcast message at the same time, and receives a connection request for the second broadcast message, then only the first broadcast message Processing is performed, that is, only the connection request for the first broadcast message is sent.

第一网关设备能够发送第一广播消息,显而易见的,该第一网关设备至少包括了一个第一近距离通信模块。并且该第一网关设备已经通过其他通信方式连接到互联网,包括但不限于WiFi、蜂窝网络等,因而称之为网关设备。The first gateway device can send the first broadcast message. Obviously, the first gateway device includes at least one first short-range communication module. And the first gateway device has been connected to the Internet through other communication means, including but not limited to WiFi, cellular network, etc., so it is called a gateway device.

进一步的,第一网关设备可以是空气净化器、加湿器、温控器等设备。若某一设备至少包括了一个第一近距离通信模块,并且已经连接到互联网,即属于本文中的第一网关设备,所以在此不对设备的类型做限定。Further, the first gateway device may be an air purifier, a humidifier, a thermostat and other devices. If a certain device includes at least one first short-range communication module and has been connected to the Internet, it belongs to the first gateway device in this document, so the type of the device is not limited here.

对于检测到一个第一广播消息的情况,可以参照上述204的具体介绍来执行;接下来对检测到多个第一广播消息的情况进行分别说明,另外由于在检测到多个第一广播消息的情况下无论是否接收到针对第二广播消息的连接请求均优先响应第一广播消息,因此下面描述中将省略对第二广播消息的描述。For the case where one first broadcast message is detected, it can be executed with reference to the specific introduction in 204 above; next, the case where multiple first broadcast messages are detected will be described separately. In this case, regardless of whether a connection request for the second broadcast message is received, the first broadcast message is preferentially responded to, so the description of the second broadcast message will be omitted in the following description.

(1)在第一种可能的实施方式中,第一预设时长内,在检测到多个第一广播消息的情况下,根据多个第一广播消息,从发送第一广播消息的多个第一网关设备中选择信号强度最高的第一网关设备发送连接请求,以通过第一近距离通信建立连接。(1) In a first possible implementation, within the first preset time period, in the case where multiple first broadcast messages are detected, according to the multiple first broadcast messages, the first broadcast message is sent from the multiple The first gateway device with the highest signal strength among the first gateway devices is selected to send a connection request, so as to establish a connection through the first short-range communication.

可选的,终端设备在检测到多个第一广播消息时,会对其中的接收信号的强度指示(Received Signal Strength Indicator,RSSI)进行分析,向其中RSSI最高的第一网关设备发送连接请求。Optionally, when the terminal device detects multiple first broadcast messages, it analyzes the received signal strength indicator (Received Signal Strength Indicator, RSSI) therein, and sends a connection request to the first gateway device with the highest RSSI.

可选的,终端设备在检测到多个第一广播消息时,可以利用RSSI测量与多个发出第一广播消息的第一网关设备之间的距离,向距离最近的第一网关设备发送连接请求。Optionally, when the terminal device detects multiple first broadcast messages, it can use RSSI to measure the distance with multiple first gateway devices that send the first broadcast message, and send a connection request to the closest first gateway device. .

(2)在第二种可能的实施方式中,第一预设时长内,在检测到多个第一广播消息的情况下,根据多个第一广播消息中每个第一广播消息携带的发送方标识,查询存储的与发送方标识对应的第一网关设备的连接次数,向连接次数最少的第一网关设备发送连接请求,以通过第一近距离通信建立连接。在这种实施方式中,如果出现了新的第一网关设备,可以实现优先与新的第一网关设备建立连接。而现有技术中,终端设备与新的网关设备需要通过用户手动操作才能建立连接,因此本申请的这一实施方式可以减少用户的手动操作,提高便捷性。(2) In the second possible implementation manner, within the first preset time period, in the case where multiple first broadcast messages are detected, according to the transmission carried by each first broadcast message in the multiple first broadcast messages Party identification, query the stored connection times of the first gateway device corresponding to the sender identification, and send a connection request to the first gateway device with the least connection times to establish a connection through the first short-range communication. In this embodiment, if a new first gateway device appears, it can be implemented to establish a connection with the new first gateway device preferentially. However, in the prior art, the terminal device and the new gateway device need to be manually operated by the user to establish a connection. Therefore, this embodiment of the present application can reduce the user's manual operation and improve convenience.

例如,终端设备每次与第一网关设备建立连接后,都会将本次的连接信息存储到本地。其中连接信息至少包括第一网关设备的标识和连接次数。在检测到多个第一广播消息的情况下,终端设备可以获取每个广播消息中携带的发送方标识,将发送方标识与本地存储的连接信息进行比对,选择连接次数最少的第一网关设备,向该第一网关设备发送连接请求以建立连接。可选的,连接次数可以为连接成功的次数或者可以为发送连接请求的次数等等。For example, each time the terminal device establishes a connection with the first gateway device, it will store the current connection information locally. The connection information includes at least the identification of the first gateway device and the connection times. In the case of detecting multiple first broadcast messages, the terminal device can obtain the sender identifier carried in each broadcast message, compare the sender identifier with the locally stored connection information, and select the first gateway with the least number of connections device, sending a connection request to the first gateway device to establish a connection. Optionally, the number of connections may be the number of successful connections or the number of times a connection request is sent, and so on.

可选的,该终端设备与第一网关设备建立连接后,可以通过第一近距离通信方式将数据传输到第一网关设备,第一网关设备再通过互联网将数据传输到服务器,使用户能够查看该数据。相反的,用户也可以通过服务器将控制指令通过服务器下达至第一网关设备,再通过第一近距离通信模块将该控制指令传输至该终端设备,以实现对该终端设备进行控制的目的。Optionally, after the terminal device establishes a connection with the first gateway device, it can transmit the data to the first gateway device through the first short-range communication method, and the first gateway device then transmits the data to the server through the Internet, so that the user can view the data. the data. On the contrary, the user can also send the control command to the first gateway device through the server through the server, and then transmit the control command to the terminal device through the first short-range communication module, so as to realize the purpose of controlling the terminal device.

可选的,当终端设备通过第一近距离通信与第一网关设备建立连接后,也可以停止发送第二近距离通信的第二广播消息,以进一步降低功耗。Optionally, after the terminal device establishes a connection with the first gateway device through the first short-range communication, it may also stop sending the second broadcast message of the second short-range communication, so as to further reduce power consumption.

205、第一预设时长内,在未检测到第一广播消息且接收到第二网关设备针对第二广播消息发送的连接请求的情况下,则通过第二近距离通信与第二网关设备建立连接,并且停止检测第一近距离通信的广播消息。205. Within the first preset time period, in the case where the first broadcast message is not detected and the connection request sent by the second gateway device for the second broadcast message is received, establish a connection with the second gateway device through the second short-range communication. connection, and stop detecting the broadcast message of the first short-range communication.

进一步的,第二网关设备需要发送针对第二广播消息的连接请求,所以第二网关设备至少包括了一个第二近距离通信模块。并且该第二网关设备已经通过其他通信方式连接到互联网,包括但不限于WiFi、蜂窝网络等。Further, the second gateway device needs to send a connection request for the second broadcast message, so the second gateway device includes at least one second short-range communication module. And the second gateway device has been connected to the Internet through other communication means, including but not limited to WiFi, cellular network and the like.

进一步可选的,因为终端设备发送的第二广播消息中包括该终端设备的唯一标识,所以第二网关设备能够利用该唯一标识,识别该终端设备。该唯一标识可以在该终端设备添加到用户账号时,上传到服务器。第二网关设备获取到第二广播消息后可以向服务器查询匹配该唯一标识来识别终端设备,或者,第二网关设备提前/定期从服务器获取到并存储了与用户账号对应设备标识之后,可以通过本地查询来识别终端设备。终端设备接收到连接请求后,响应该请求,与发出该连接请求的第二网关设备建立连接。Further optionally, because the second broadcast message sent by the terminal device includes the unique identifier of the terminal device, the second gateway device can use the unique identifier to identify the terminal device. The unique identifier can be uploaded to the server when the terminal device is added to the user account. After acquiring the second broadcast message, the second gateway device can query the server to match the unique identifier to identify the terminal device, or, after the second gateway device acquires and stores the device identifier corresponding to the user account from the server in advance/periodically, it can use Local query to identify end devices. After receiving the connection request, the terminal device responds to the request and establishes a connection with the second gateway device that sent the connection request.

终端设备通过第二近距离通信与第二网关设备建立连接后,停止检测第一近距离通信的广播消息。即该终端设备将会在第二近距离通信的连接期间,暂时关闭第一近距离通信模块。After the terminal device establishes a connection with the second gateway device through the second short-range communication, it stops detecting the broadcast message of the first short-range communication. That is, the terminal device will temporarily turn off the first short-range communication module during the connection period of the second short-range communication.

为了更好地理解上述第二近距离通信连接的技术方案,下面举例说明第二近距离通信连接的应用场景:In order to better understand the technical solution of the second short-range communication connection, the following example illustrates the application scenario of the second short-range communication connection:

若终端设备为温度传感器,第二近距离通信方式为蓝牙。当用户需要查看温度数据,通过手机APP向服务器请求数据,服务器向第二网关设备下达指令,第二网关设备在检测到温度传感器的蓝牙广播并且识别该温度传感器后,向其发送连接请求。温度传感器响应连接请求后与之建立连接,并且将测量到的温度数据发送给第二网关设备,再由第二网关设备将数据上传到服务器。If the terminal device is a temperature sensor, the second short-range communication method is Bluetooth. When the user needs to view the temperature data and requests data from the server through the mobile phone APP, the server sends an instruction to the second gateway device, and the second gateway device sends a connection request to it after detecting the Bluetooth broadcast of the temperature sensor and identifying the temperature sensor. After responding to the connection request, the temperature sensor establishes a connection with it, and sends the measured temperature data to the second gateway device, and the second gateway device uploads the data to the server.

可选的,用户使用的控制终端(手机)也可以通过在检测到第二广播消息后向终端设备发送连接请求,以建立连接,直接通过第二近距离通信的连接获取终端设备中的数据。Optionally, the control terminal (mobile phone) used by the user can also establish a connection by sending a connection request to the terminal device after detecting the second broadcast message, and obtain data in the terminal device directly through the second short-range communication connection.

在一些可能的实施方式中,终端设备在建立起第二近距离通信的连接,完成数据和指令传输后,其第二近距离通信模块将进入休眠状态。第二近距离通信模块一旦进入休眠状态,将断开第二近距离通信的连接。可选的,当第二近距离通信的连接断开后,终端设备的第一近距离通信模块将继续开始工作,其检测第一近距离通信的第一广播消息的时间间隔继续按照第一近距离通信关闭之前的变化规则,接续第一近距离通信模块关闭前的最近一次的第一时间间隔按照预设规则进行延长,然后继续从如图2所示的步骤201开始执行。In some possible implementations, after the terminal device establishes a second short-range communication connection and completes the transmission of data and instructions, its second short-range communication module will enter a sleep state. Once the second short-range communication module enters the sleep state, the connection of the second short-range communication will be disconnected. Optionally, after the connection of the second short-range communication is disconnected, the first short-range communication module of the terminal device will continue to work, and the time interval for detecting the first broadcast message of the first short-range communication continues to follow the first short-range communication. The change rule before the distance communication is turned off is extended according to the preset rule following the latest first time interval before the first short-range communication module is turned off, and then continues to be executed from step 201 as shown in FIG. 2 .

在另一些可能的实施方式中,由于该唯一标识已经在添加到用户账号时上传到服务器,所以在未建立第二近距离通信的连接的情况下,在同一用户账号中的第二网关设备可以通过携带有终端设备需要发送的数据和终端设备的唯一标识的第二广播消息识别该终端设备并且直接解析并且获取其中终端设备需要发送的数据。In some other possible implementations, since the unique identifier has 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 through the second broadcast message carrying the data to be sent by the terminal device and the unique identifier of the terminal device, and directly parse and acquire the data to be sent by the terminal device.

为了更好地理解上述如图2所示的方案,下面将举例对该方案的应用场景进行介绍:In order to better understand the above scheme shown in Figure 2, the following will introduce the application scenarios of the scheme:

在一种家庭应用场景中,终端设备为温度传感器,第一近距离通信为ZigBee,第二近距离通信为蓝牙,第一网关设备为加湿器,第二网关设备为空气净化器。温度传感器、加湿器、空气净化器都已添加到了用户账号中。首先,温度传感器按照预设的第一时间间隔检测ZigBee广播消息,此处假设第一时间间隔为2秒,并且发送蓝牙广播消息。下面将对温度传感器连接的几种情形进行分情况介绍:In a home application scenario, the terminal device is a temperature sensor, the first short-range communication is ZigBee, the second short-range communication is Bluetooth, the first gateway device is a humidifier, and the second gateway device is an air purifier. Temperature sensors, humidifiers, air purifiers have all been added to the user account. First, the temperature sensor detects the ZigBee broadcast message according to a preset first time interval, where the first time interval is assumed to be 2 seconds, and sends a Bluetooth broadcast message. The following will introduce several situations of temperature sensor connection:

(1)在预设的时长内,此处假设为1分钟,如果温度传感器没有检测到ZigBee广播消息并且没有接收到针对其发送的蓝牙广播消息的连接请求,就会按照预设的规则延长检测ZigBee广播消息的时间间隔。此处假设时间间隔以成倍的形式增长。即在一分钟内没有检测到ZigBee广播消息时,隔4秒检测一次,然后隔8秒再检测一次,后续的时间间隔以此类推。(1) Within the preset duration, which is assumed to be 1 minute here, if the temperature sensor does not detect the ZigBee broadcast message and does not receive a connection request for the Bluetooth broadcast message sent by it, it will extend the detection according to the preset rules. The time interval at which ZigBee broadcasts messages. It is assumed here that the time interval grows exponentially. That is, when the ZigBee broadcast message is not detected within one minute, the detection is performed once every 4 seconds, and then once every 8 seconds, and so on for the subsequent time intervals.

(2)如果在1分钟内,温度传感器只检测到了ZigBee广播消息,没有接收到针对蓝牙广播消息的连接请求,则向发送ZigBee广播消息的加湿器发送连接请求,以通过ZigBee与加湿器建立连接。(2) If within 1 minute, the temperature sensor only detects the ZigBee broadcast message and does not receive a connection request for the Bluetooth broadcast message, it sends a connection request to the humidifier that sends the ZigBee broadcast message to establish a connection with the humidifier through ZigBee .

(3)如果在1分钟内,温度传感器既检测到ZigBee广播消息,又接收到针对蓝牙广播消息的连接请求,仍然向发送ZigBee广播消息的加湿器发送连接请求,不对连接请求进行处理。因此,可以理解,如果同时存在加湿器和空气净化器,温度传感器会优先与加湿器建立连接。(3) If the temperature sensor detects both the ZigBee broadcast message and the connection request for the Bluetooth broadcast message within 1 minute, it still sends the connection request to the humidifier that sends the ZigBee broadcast message, and does not process the connection request. Therefore, it can be understood that if a humidifier and an air purifier exist at the same time, the temperature sensor will preferentially establish a connection with the humidifier.

(4)如果在1分钟内,温度传感器没有检测到ZigBee广播消息,但接收到针对蓝牙广播消息的连接请求,则通过蓝牙与空气净化器建立连接。(4) If the temperature sensor does not detect the ZigBee broadcast message within 1 minute, but receives a connection request for the Bluetooth broadcast message, it will establish a connection with the air purifier through Bluetooth.

在本申请实施例中,按照一定的时间间隔检测第一近距离通信的第一广播消息,并发送第二广播消息,根据周围环境中的第一网关和第二网关设备的不同情况对第一近距离通信和第二近距离通信进行动态的调度,达到了支持两种近距离通信方式并且降低功耗的目的。In the embodiment of the present application, the first broadcast message of the first short-range communication is detected according to a certain time interval, and the second broadcast message is sent, and the first The short-range communication and the second short-range communication are dynamically scheduled to achieve the purpose of supporting two short-range communication modes and reducing power consumption.

请参见图3,为本申请实施例中设备连接方法涉及的另一种流程示意图。其中,步骤301至步骤308为终端设备添加到用户账号的流程,主要包括:Please refer to FIG. 3 , which is another schematic flowchart involved in the device connection method in the embodiment of the present application. Wherein, steps 301 to 308 are the process of adding the terminal device to the user account, which mainly includes:

301、用户通过控制终端检测终端设备的第二广播消息。301. The user detects the second broadcast message of the terminal device by controlling the terminal.

302、控制终端与终端设备建立第二近距离通信的连接。302. The control terminal establishes a second short-range communication connection with the terminal device.

具体的,控制终端检测到第二广播消息后,向终端设备发送连接请求,终端设备响应请求,以建立控制终端与终端设备之间的第二近距离通信连接。Specifically, after detecting the second broadcast message, the control terminal sends a connection request to the terminal device, and the terminal device responds to the request to establish a second short-range communication connection between the control terminal and the terminal device.

303、控制终端请求获取终端设备的设备信息。303. The control terminal requests to acquire device information of the terminal device.

具体的,设备信息可以包括媒体存取控制位置(Media Access Control Address,MAC地址)、设备序列号、移动设备识别码(Mobile Equipment Identifier,MEID)中的至少一项。Specifically, the device information may include at least one of a media access control address (Media Access Control Address, MAC address), a device serial number, and a mobile equipment identifier (Mobile Equipment Identifier, MEID).

304、终端设备向控制终端发送终端设备的设备信息。304. The terminal device sends the device information of the terminal device to the control terminal.

305、控制终端将终端设备的设备信息上传至服务器并且请求将终端设备添加到用户账号。305. The control terminal uploads the device information of the terminal device to the server and requests to add the terminal device to the user account.

可选的,在控制终端向服务器发送终端设备的设备信息时,可一并发送请求添加终端设备的用户账号。该用户账号可以为用户在控制终端中手动输入/选择的的账号;或者该用户账号可以为与控制终端绑定的默认账号/首选账号。Optionally, when the control terminal sends the device information of the terminal device to the server, it may also send a request to add the user account of the terminal device. The user account may be an account manually input/selected by the user in the control terminal; or the user account may be a default account/preferred account bound with the control terminal.

或者,可选的,控制终端仅向服务器发送终端设备的设备信息,请求添加终端设备的用户账号可以为与控制终端绑定的默认账号/首选账号。Or, optionally, the control terminal only sends the device information of the terminal device to the server, and the user account requesting to add the terminal device may be the default account/preferred account bound with the control terminal.

306、服务器向控制终端发送与终端设备对应的用户信息。306. The server sends the user information corresponding to the terminal device to the control terminal.

具体的,在服务器同意将终端设备添加到用户账号之后,执行步骤306。Specifically, after the server agrees to add the terminal device to the user account, step 306 is performed.

307、控制终端向终端设备发送与终端设备对应的用户信息。307. The control terminal sends the user information corresponding to the terminal device to the terminal device.

可选的,步骤306中,服务器还可以发送加密算法;相应的,步骤307中,控制终端还可以向终端设备发送该加密算法。Optionally, in step 306, the server may also send the encryption algorithm; correspondingly, in step 307, the control terminal may also send the encryption algorithm to the terminal device.

可选的,用户信息与所添加的用户账号是唯一对应的。例如,添加在同一用户账号中的所有设备对应的用户信息是相同的;添加在不同用户账号中的设备对应的用户信息是不同的。Optionally, the user information uniquely corresponds to the added user account. For example, the user information corresponding to all devices added to the same user account is the same; the user information corresponding to devices added to different user accounts is different.

可选的,加密算法与用户账号是唯一对应的。例如,添加在同一用户账号中的所有设备所采用的加密算法都是相同的。Optionally, the encryption algorithm is uniquely corresponding to the user account. For example, all devices added to the same user account use the same encryption algorithm.

308、终端设备向控制终端响应成功添加到用户账号。308. The terminal device responds to the control terminal that it is successfully added to the user account.

步骤308为可选步骤,为了通知控制终端终端设备是否收到步骤307发送的用户信息。Step 308 is an optional step, in order to notify the control terminal whether the terminal device has received the user information sent in step 307 .

容易理解的是,在步骤302之后,步骤303、304、307、308是通过第二近距离通信方式来传输消息的;以及用户信息(可选的还包括加解密算法)是为了实现终端设备与其他设备(比如、第一网关设备、第二网关设备等不做限定)之间安全通信,以保证相同用户账号下的设备可通信且不同用户账户下的设备无法通信。It is easy to understand that after step 302, steps 303, 304, 307, and 308 transmit messages through the second short-range communication method; and the user information (optionally also includes encryption and decryption algorithms) is to enable the terminal device to communicate with each other. Secure communication between other devices (for example, a first gateway device, a second gateway device, etc. is not limited) to ensure that devices under the same user account can communicate and devices under different user accounts cannot communicate.

可以理解的是,在终端设备加添加至用户账号之后,可执行图2所示实施例。It can be understood that, after the terminal device is added to the user account, the embodiment shown in FIG. 2 can be executed.

(a)在一种可能的实施方式中,在执行图2所示实施例的过程中,终端设备与第一网关设备的具体连接过程如图3的步骤309至311所示。(a) In a possible implementation, in the process of executing the embodiment shown in FIG. 2 , the specific connection process between the terminal device and the first gateway device is as shown in steps 309 to 311 in FIG. 3 .

309、第一网关设备发送第一广播消息。309. The first gateway device sends the first broadcast message.

具体的,第一广播消息包括第一网关设备的第一验证信息。第一验证信息息为第一网关设备添加至某一用户账号后唯一对应的用户信息。Specifically, the first broadcast message includes the first verification information of the first gateway device. The first verification information is uniquely corresponding user information after the first gateway device is added to a certain user account.

可选的,第一广播消息包括第一网关经过加密后的第一验证信息。Optionally, the first broadcast message includes the encrypted first verification information of the first gateway.

与步骤309相应的,终端设备按照第一时间间隔检测第一近距离通信的第一广播消息,以及发送所述第二近距离通信的第二广播消息。具体实现可以参考图2所示实施例的详细说明,在此不再赘述。Corresponding to step 309, the terminal device detects the first broadcast message of the first short-range communication according to the first time interval, and sends the second broadcast message of the second short-range communication. For specific implementation, reference may be made to the detailed description of the embodiment shown in FIG. 2 , which will not be repeated here.

310、若第一验证信息与终端设备本地存储的第二用户信息匹配一致,则向发送第一广播消息的第一网关设备发送连接请求。第二用户信息为终端设备添加至某一用户账号后本地存储的唯一对应的用户信息。310. If the first verification information matches the second user information locally stored in the terminal device, send a connection request to the first gateway device that sent the first broadcast message. The second user information is the unique corresponding user information stored locally after the terminal device is added to a user account.

可选的,若终端设备对第一验证信息进行解密后,与本地存储的第二用户信息信息匹配一致,则向发送第一广播消息的第一网关设备发送连接请求。Optionally, if the terminal device decrypts the first verification information and matches the locally stored second user information information, it sends a connection request to the first gateway device that sent the first broadcast message.

在一种可能的实现方式中,第一预设时长内,在只检测到所述第一广播消息的情况下,若第一验证信息与终端设备本地存储的第二用户匹配一致,则向发送第一广播消息的第一网关设备发送连接请求。在另一种可能的实现方式中,第一预设时长内,在检测到所述第一广播消息且接收到针对所述第二广播消息的连接请求的情况下,若第一验证信息与终端设备本地存储的第二用户信息匹配一致,则向发送第一广播消息的第一网关设备发送连接请求。In a possible implementation manner, within the first preset time period, in the case where only the first broadcast message is detected, if the first verification information matches the second user stored locally by the terminal device, send the message to the sender. The first gateway device of the first broadcast message sends a connection request. In another possible implementation manner, within a first preset time period, when the first broadcast message is detected and a connection request for the second broadcast message is received, if the first verification information and the terminal If the second user information stored locally by the device matches the same, a connection request is sent to the first gateway device that sent the first broadcast message.

311、第一网关设备接收到连接请求后,向终端设备响应确认连接。311. After receiving the connection request, the first gateway device responds to the terminal device to confirm the connection.

(b)在另一种可能的实施方式中,在执行图2所示实施例的过程中,终端设备与第一网关设备的具体连接过程如图4的步骤401至403所示:(b) In another possible implementation, in the process of executing the embodiment shown in FIG. 2 , the specific connection process between the terminal device and the first gateway device is as shown in steps 401 to 403 in FIG. 4 :

401、第一网关设备发送第一广播消息。401. The first gateway device sends a first broadcast message.

与步骤401相应的,终端设备按照第一时间间隔检测第一近距离通信的第一广播消息,以及发送所述第二近距离通信的第二广播消息。具体实现可以参考图2所示实施例的详细说明,在此不再赘述。Corresponding to step 401, the terminal device detects the first broadcast message of the first short-range communication according to the first time interval, and sends the second broadcast message of the second short-range communication. For specific implementation, reference may be made to the detailed description of the embodiment shown in FIG. 2 , which will not be repeated here.

402、终端设备检测到第一广播消息后,向发送第一广播消息的第一网关设备发送连接请求,连接请求中包含了第二验证信息。第二验证信息为终端设备添加至某一用户账号后唯一对应的用户信息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, where the connection request includes the second verification information. The second verification information is the unique corresponding user information after the terminal device is added to a user account

可选的,终端设备检测到第一广播消息后,向发送第一广播消息的第一网关设备发送连接请求,连接请求中包含了经过终端设备加密的第二验证信息。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, where the connection request includes the second verification information encrypted by the terminal device.

在一种可能的实现方式中,第一预设时长内,在只检测到所述第一广播消息的情况下,向发送第一广播消息的第一网关设备发送连接请求。在另一种可能的实现方式中,第一预设时长内,在检测到所述第一广播消息且接收到针对所述第二广播消息的连接请求的情况下,向发送第一广播消息的第一网关设备发送连接请求。In a possible implementation manner, within a first preset time period, when only the first broadcast message is detected, a connection request is sent to the first gateway device that sends the first broadcast message. In another possible implementation manner, within a first preset time period, in the case where the first broadcast message is detected and a connection request for the second broadcast message is received, send the first broadcast message to the sender of the first broadcast message. The first gateway device sends a connection request.

403、若第二验证信息与第一网关设备本地存储的第一用户信息匹配一致,则向终端设备响应确认连接。第一用户信息为第一网关设备添加至某一用户账号后本地存储的唯一对应的用户信息。403. If the second verification information matches the first user information stored locally by the first gateway device, respond to the terminal device to confirm the connection. The first user information is the unique corresponding user information stored locally after the first gateway device is added to a certain user account.

可选的,第一网关设备对第二验证信息解密,若解密后的第二验证信息与本地存储的第一用户信息匹配一致,则向终端设备响应确认连接。Optionally, the first gateway device decrypts the second verification information, and if the decrypted second verification information matches the locally stored first user information, it sends a response to the terminal device to confirm the connection.

可以理解的是,在图2实施例的基础上,终端设备与第一网关设备建立通信连接的方案可以参照图3步骤309与步骤311的介绍;或者可以参照图4步骤401与步骤403的介绍。It can be understood that, on the basis of the embodiment in FIG. 2 , for the solution of establishing a communication connection between the terminal device and the first gateway device, reference may be made to the introduction of steps 309 and 311 in FIG. 3 ; or the introduction of steps 401 and 403 of FIG. 4 may be referred to. .

上述图3和图4所示的方法为终端设备添加到用户账号,以及终端设备与第一网关设备之间进行验证、建立连接的具体过程。二者间通过验证,达到同一用户账号下的设备可以建立连接,而不同用户账号下的设备不能建立连接的目的,保证了连接的安全性。The above-mentioned methods shown in FIG. 3 and FIG. 4 are a specific process of adding a terminal device to a user account, and verifying and establishing a connection between the terminal device and the first gateway device. Through verification between the two, devices under the same user account can establish a connection, but devices under different user accounts cannot establish a connection, which ensures the security of the connection.

请参见图5,为本申请实施例提供的设备连接装置的结构示意图,该设备连接装置包括收发模块501和处理模块502。Please refer to FIG. 5 , which is a schematic structural diagram of an apparatus for connecting devices according to an embodiment of the present application. The apparatus for connecting devices includes a transceiver module 501 and a processing module 502 .

收发模块501,用于按照第一时间间隔检测第一近距离通信的第一广播消息;A transceiver module 501, configured to detect the first broadcast message of the first short-range communication according to the first time interval;

收发模块501,还用于发送第二近距离通信的第二广播消息,第一近距离通信与第二近距离通信为不同的通信方式;The transceiver module 501 is further configured to send a second broadcast message of the second short-range communication, and the first short-range communication and the second short-range communication are different communication modes;

处理模块502,用于第一预设时长内,在未检测到第一广播消息且未接收到针对第二广播消息的连接请求的情况下,则按照预设规则延长第一时间间隔。The processing module 502 is configured to extend the first time interval according to a preset rule when the first broadcast message is not detected and the connection request for the second broadcast message is not received within the first preset time period.

可选的,收发模块501,还用于第一预设时长内,在收发模块501只检测到第一广播消息的情况下,向发送该第一广播消息的第一网关设备发送连接请求,以通过第一近距离通信与所述第一网关设备建立连接。Optionally, the transceiver module 501 is further configured to send a connection request to the first gateway device that sends the first broadcast message when the transceiver module 501 only detects the first broadcast message within the first preset time period, to A connection is established with the first gateway device through the first short-range communication.

可选的,收发模块501,还用于第一预设时长内,在收发模块501检测到第一广播消息且接收到针对第二广播消息的连接请求的情况下,向发送该第一广播消息的第一网关设备发送连接请求,以通过第一近距离通信与所述第一网关设备建立连接。Optionally, the transceiver module 501 is further configured to send the first broadcast message to the sending and receiving module 501 when the transceiver module 501 detects the first broadcast message and receives a connection request for the second broadcast message within the first preset time period. The first gateway device of the device sends a connection request to establish a connection with the first gateway device through the first short-range communication.

可选的,处理模块502,还用于第一预设时长内,在收发模块501未检测到第一广播消息且接受到第二网关设备针对第二广播消息发送的连接请求的情况下,则通过所述第二近距离通信与该第二网关设备建立连接,并且停止检测第一近距离通信的广播消息。Optionally, the processing module 502 is further configured to, within the first preset duration, in the case that the transceiver module 501 does not detect the first broadcast message and receives a connection request sent by the second gateway device for the second broadcast message, then 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.

可选的,收发模块501,还用于第一预设时长内,在收发模块501检测到多个第一广播消息的情况下,根据多个第一广播消息,从发送第一广播消息的多个第一网关设备中选择信号强度最高的第一网关设备发送连接请求,以通过第一近距离通信建立连接。Optionally, the transceiver module 501 is further configured to, within the first preset duration, in the case that the transceiver module 501 detects a plurality of first broadcast messages, according to the plurality of first broadcast messages, send the first broadcast message from the first broadcast message. Among the first gateway devices, the first gateway device with the highest signal strength is selected to send a connection request, so as to establish a connection through the first short-range communication.

可选的,收发模块501,还用于第一预设时长内,在检测到多个第一广播消息的情况下,根据多个第一广播消息中每个第一广播消息携带的发送方标识,查询存储的与所述发送方标识对应的第一网关设备的连接次数,向连接次数最少的第一网关设备发送连接请求,以通过第一近距离通信建立连接。Optionally, the transceiver module 501 is further configured to, within the first preset time period, detect multiple first broadcast messages according to the sender identifier carried by each first broadcast message in the multiple first broadcast messages. , query the stored connection times of the first gateway device corresponding to the identifier of the sender, and send a connection request to the first gateway device with the least connection times, so as to establish a connection through the first short-range communication.

可选的,第一广播消息包括第一网关设备的第一验证信息,收发模块501,在发送第一广播消息的第一网关设备发送连接请求方面,具体用于:Optionally, the first broadcast message includes the first verification information of the first gateway device, and the transceiver module 501 is specifically configured to:

在终端设备对应的第一用户信息与第一验证信息相匹配的情况下,执行向发送该第一广播消息的第一网关设备发送连接请求的步骤。In the case that 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 sends the first broadcast message is performed.

可选的,收发模块501向第一网关设备发送的连接请求携带该终端设备的第二验证信息,第二验证信息用于在第一网关设备确定第二验证信息与第一网关设备对应的第二用户信息相匹配的情况下向该终端设备反馈确认建立连接的响应消息。Optionally, the connection request sent by the transceiver module 501 to the first gateway device carries the second verification information of the terminal device, and the second verification information is used for the first gateway device to determine that the second verification information corresponds to the first gateway device. When the two user information matches, a response message confirming the establishment of the connection is fed back to the terminal device.

其中,该设备连接装置所述功能可以由硬件实现,也可以由硬件执行相应的软件实现。该装置可以是终端设备,也可以设置在终端设备中。The functions of the device connection device may be implemented by hardware, and may also be implemented by hardware executing corresponding software. The apparatus may be a terminal device, or may be set in the terminal device.

可以理解的是,涉及到图5中的各个模块的相关内容在前述方法实施例中已经进行详细描述,具体可以参阅方法实施例中的内容,此处不做赘述。It can be understood that the relevant content related to each module in FIG. 5 has been described in detail in the foregoing method embodiments, and for details, please refer to the content in the method embodiments, which will not be repeated here.

请参见图6,为本实施例提供的计算机设备的结构示意图。该计算机设备具体可以是终端设备。其中计算机设备600可以包括处理器601和存储器602。可选的,还可以进一步包括多媒体组件603、信息输入/信息输出(Input/Output,I/O)接口604以及通信组件605中的一种或多种。Please refer to FIG. 6 , which is a schematic structural diagram of a 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, one or more of a multimedia component 603 , an information input/output (Input/Output, I/O) interface 604 and a communication component 605 may be further included.

其中,处理器601用于控制计算机设备600的整体操作,以完成上述的设备连接方法中的全部或部分步骤;存储器602用于存储各种类型的数据以支持在计算机设备600的操作,这些数据例如可以包括用于在该计算机设备600上操作的任何应用程序或方法的指令,以及应用程序相关的数据。Wherein, 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 above-mentioned device connection method; the memory 602 is used to store various types of data to support the operation of the computer device 600, these data For example, instructions for any application or method operating on the computer device 600 may be included, as well as application-related data.

该存储器602可以由任何类型的易失性或非易失性存储设备或者它们的组合实现,例如静态随机存取存储器(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)、磁存储器、快闪存储器、磁盘或光盘中的一种或多种。The memory 602 can be implemented by any type of volatile or non-volatile storage device or a combination thereof, such as Static Random Access Memory (SRAM), Electrically Erasable Programmable Read-Only Memory (Electrically Erasable) Erasable Programmable Read-Only Memory (EEPROM), Erasable Programmable Read-Only Memory (EPROM), Programmable Read-Only Memory (PROM), Read-Only Memory (Read- One or more of Only Memory, ROM), magnetic memory, flash memory, magnetic disk or optical disk.

多媒体组件603可以包括屏幕和/或音频组件。其中屏幕例如可以是触摸屏,音频组件用于输出和/或输入音频信号。例如,音频组件可以包括一个麦克风,麦克风用于接收外部音频信号。所接收的音频信号可以被进一步存储在存储器602或通过通信组件605发送。音频组件还包括至少一个扬声器,用于输出音频信号。I/O接口604为处理器601和其他接口模块之间提供接口,上述其他接口模块可以是按钮等。这些按钮可以是虚拟按钮或者实体按钮。Multimedia components 603 may include screen and/or audio components. Wherein the screen can be, for example, a touch screen, and the audio component is used for outputting and/or inputting audio signals. For example, the audio component may include a microphone for receiving external audio signals. The received audio signal may be further stored in memory 602 or transmitted through communication component 605 . The audio assembly also includes at least one speaker for outputting audio signals. The I/O interface 604 provides an interface between the processor 601 and other interface modules, and the above-mentioned other interface modules may be buttons and the like. These buttons can be virtual buttons or physical buttons.

通信组件605用于计算机设备600与其他设备之间进行有线或无线通信。本申请的通信方式至少包括第一近距离通信和第二近距离通信,因此相应的该通信组件605至少可以包括:第一近距离通信模块和第二近距离通信模块。Communication component 605 is used for wired or wireless communication between computer device 600 and other devices. The communication method of the present application includes at least the first short-range communication and the second short-range communication, so the corresponding communication component 605 may at least include: a first short-range communication module and a second short-range communication module.

计算机设备600可以被一个或多个应用专用集成电路(ApplicationSpecificIntegrated Circuit,简称ASIC)、数字信号处理器(Digital Signal Processor,简称DSP)、数字信号处理设备(Digital Signal Processing Device,简称DSPD)、可编程逻辑器件(Programmable Logic Device,简称PLD)、现场可编程门阵列(FieldProgrammableGate Array,简称FPGA)、控制器、微控制器、微处理器或其他电子元件实现,用于执行上述实施例给出的设备连接方法。The computer device 600 may be implemented by one or more Application Specific Integrated Circuit (ASIC for short), Digital Signal Processor (DSP for short), Digital Signal Processing Device (DSPD for short), programmable Logic device (Programmable Logic Device, PLD for short), Field Programmable Gate Array (Field Programmable Gate Array, FPGA for short), controller, microcontroller, microprocessor or other electronic components to implement, for executing the device given in the above embodiment connection method.

下面对本申请实施例提供的计算机可读存储介质进行介绍,计算机可读存储介质包括指令,当其在计算机上运行时,使得计算机执行如图2至图4所示的任一种设备连接方法。The computer-readable storage medium provided by the embodiments of the present application will be introduced below. The computer-readable storage medium includes instructions that, when executed on a computer, cause the computer to execute any of the device connection methods shown in FIG. 2 to FIG. 4 .

该计算机可读存储介质可以包括:U盘、移动硬盘、只读存储器(Read-OnlyMemory,ROM)、随机存取存储器(Random Access Memory,RAM)、磁碟或者光盘等各种可以存储程序代码的介质。The computer-readable storage medium may include: a USB flash drive, a removable hard disk, a read-only memory (Read-Only Memory, ROM), a random access memory (Random Access Memory, RAM), a magnetic disk or an optical disk, etc., which can store program codes. medium.

本说明书中各个实施例采用递进的方式描述,每个实施例重点说明的都是与其它实施例的不同之处,各个实施例之间相同或相似部分互相参见即可。对于实施例公开的装置而言,由于其与实施例公开的方法相对应,所以描述的比较简单,相关之处参见方法部分说明即可。The various embodiments in this specification are described in a progressive manner, and each embodiment focuses on the differences from other embodiments, and the same or similar parts between the various embodiments may be referred to each other. As for the device disclosed in the embodiment, since it corresponds to the method disclosed in the embodiment, the description is relatively simple, and the relevant part can be referred to the description of the method.

所属领域的技术人员可以清楚地了解到,为描述的方便和简洁,上述描述的设备连接装置、计算机设备和存储介质的具体工作过程,可以参考前述方法实施例中的对应过程,在此不再赘述。Those skilled in the art can clearly understand that, for the convenience and brevity of description, the specific working process of the device connecting device, computer equipment and storage medium described above can refer to the corresponding process in the foregoing method embodiments, which is not repeated here. Repeat.

在本申请所提供的几个实施例中,应该理解到,所揭露的方法,可以通过其它的方式实现。In the several embodiments provided in this application, it should be understood that the disclosed method may be implemented in other manners.

本领域技术人员还可以进一步意识到,结合本文中所公开的实施例描述的各示例的单元及算法步骤,能够以电子硬件、计算机软件或者二者的结合来实现,为了清楚地说明硬件和软件的可互换性,在上述说明中已经按照功能一般性地描述了各示例的组成及步骤。这些功能究竟以硬件还是软件的方式来执行,取决于技术方案的特定应用和设计约束条件。本领域技术人员可以对每个特定的应用来使用不同方法来实现所描述的功能,但是这种实现不应该认为超出本申请的范围。Those skilled in the art may further realize that the units and algorithm steps of each example described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, computer software, or a combination of the two, in order to clearly illustrate the hardware and software In the above description, the components and steps of each example have been generally described according to their functions. Whether these functions are performed in hardware or software depends on the specific application and design constraints of the technical solution. Skilled artisans may use different approaches to implement the described functionality for each particular application, but such implementations should not be considered beyond the scope of this application.

结合本文中所公开的实施例描述的方法或算法的步骤可以直接用硬件、处理器执行的软件模块,或者二者的结合来实施。软件模块可以置于随机存储器(RAM)、内存、只读存储器(ROM)、电可编程ROM、电可擦除可编程ROM、寄存器、硬盘、可移动磁盘、CD-ROM、或技术领域内所公知的任意其它形式的存储介质中。The steps of a method or algorithm described in conjunction with the embodiments disclosed herein may be directly implemented in hardware, a software module executed by a processor, or a combination of the two. A software module can be placed in random access memory (RAM), internal memory, read only memory (ROM), electrically programmable ROM, electrically erasable programmable ROM, registers, hard disk, removable disk, CD-ROM, or any other in the technical field. in any other known form of storage medium.

最后,还需要说明的是,在本文中,诸如第一和第二等之类的关系属于仅仅用来将一个实体或者操作与另一个实体或者操作区分开来,而不一定要求或者暗示这些实体或操作之间存在任何这种实际的关系或者顺序。而且,术语包括、包含或者其他任何变体意在涵盖非排他性的包含,从而使得包括一系列要素的过程、方法、物品或者设备不仅包括那些要素,而且还包括没有明确列出的其他要素,或者是还包括为这种过程、方法、物品或者设备所固有的要素。Finally, it should also be noted that, in this context, relationships such as first and second, etc., are used only to distinguish one entity or operation from another, and do not necessarily require or imply these entities or that there is any such actual relationship or sequence between operations. Furthermore, the terms including, comprising, or any other variation are intended to cover non-exclusive inclusion such that a process, method, article or device comprising a series of elements includes not only those elements but also other elements not expressly listed, or Yes also includes elements inherent to such a process, method, article or apparatus.

所述作为分离部件说明的单元可以是或者也可以不是物理上分开的,作为单元显示的部件可以是或者也可以不是物理单元,即可以位于一个地方,或者也可以分布到多个网络单元上。可以根据实际的需要选择其中的部分或者全部单元来实现本实施例方案的目的。The units described as separate components may or may not be physically separated, and components displayed as units may or may not be physical units, that is, may be located in one place, or may be distributed to multiple network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the solution in this embodiment.

另外,在本申请各个实施例中的各功能单元可以集成在一个处理单元中,也可以是各个单元单独物理存在,也可以两个或两个以上单元集成在一个单元中。上述集成的单元既可以采用硬件的形式实现,也可以采用软件功能单元的形式实现。In addition, each functional unit in each embodiment of the present application may be integrated into one processing unit, or each unit may exist physically alone, or two or more units may be integrated into one unit. The above-mentioned integrated units may be implemented in the form of hardware, or may be implemented in the form of software functional units.

所述集成的单元如果以软件功能单元的形式实现并作为独立的产品销售或使用时,可以存储在一个计算机可读取存储介质中。基于这样的理解,本申请的技术方案本质上或者说对现有技术做出贡献的部分或者该技术方案的全部或部分可以以软件产品的形式体现出来,该计算机软件产品存储在一个存储介质中,包括若干指令用以使得一台计算机设备(可以是个人计算机,服务器,或者网络设备等)执行本申请各个实施例所述方法的全部或部分步骤。The integrated unit, if implemented in the form of a software functional unit and sold or used as an independent product, may be stored in a computer-readable storage medium. Based on this understanding, the technical solutions of the present application can be embodied in the form of software products in essence, or the parts that contribute to the prior art, or all or part of the technical solutions, and the computer software products are stored in a storage medium , including several instructions for causing 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 the present application.

以上实施例的各技术特征可以进行任意的组合,为使描述简洁,未对上述实施例中的各个技术特征所有可能的组合都进行描述,然而,只要这些技术特征的组合不存在矛盾,都应当认为是本说明书记载的范围。The technical features of the above embodiments can be combined arbitrarily. In order to make the description simple, all possible combinations of the technical features in the above embodiments are not described. However, as long as there is no contradiction in the combination of these technical features It is considered to be the range described in this specification.

以上所述实施例仅表达了本申请的几种实施方式,其描述较为具体和详细,但并不能因此而理解为对本申请专利范围的限制。应当指出的是,对于本领域的普通技术人员来说,在不脱离本申请构思的前提下,还可以做出若干变形和改进,这些都属于本申请的保护范围。因此,本申请专利的保护范围应以所附权利要求为准。The above-mentioned embodiments only represent several embodiments of the present application, and the descriptions thereof are relatively specific and detailed, but should not be construed as a limitation on the scope of the patent of the present application. It should be pointed out that for those skilled in the art, without departing from the concept of the present application, several modifications and improvements can be made, which all belong to the protection scope of the present application. Therefore, the scope of protection of the patent of the present application shall be subject to the appended claims.

Claims (10)

1.一种设备连接方法,其特征在于,应用于终端设备,所述终端设备包括第一近距离通信和第二近距离通信,所述第一近距离通信与所述第二近距离通信为不同的通信方式;1. A device connection method, characterized in that it is applied to a terminal device, and the terminal device includes a first short-range communication and a second short-range communication, and the first short-range communication and the second short-range communication are: different means of communication; 所述方法包括:The method includes: 按照第一时间间隔检测所述第一近距离通信的第一广播消息,以及发送所述第二近距离通信的第二广播消息;Detecting the first broadcast message of the first short-range communication according to the first time interval, and sending the second broadcast message of the second short-range communication; 第一预设时长内,在未检测到所述第一广播消息且未接收到针对所述第二广播消息的连接请求的情况下,则按照预设规则延长所述第一时间间隔。Within the first preset time period, if the first broadcast message is not detected and the connection request for the second broadcast message is not received, the first time interval is extended according to a preset rule. 2.根据权利要求1所述的设备连接方法,其特征在于,所述方法还包括:2. The device connection method according to claim 1, wherein the method further comprises: 所述第一预设时长内,在只检测到所述第一广播消息的情况下,向发送所述第一广播消息的第一网关设备发送连接请求,以通过所述第一近距离通信与所述第一网关设备建立连接;Within the first preset time period, when 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 communicate with the device through the first short-range communication. the first gateway device establishes a connection; 所述第一预设时长内,在检测到所述第一广播消息且接收到针对所述第二广播消息的连接请求的情况下,向发送所述第一广播消息的所述第一网关设备发送连接请求,以通过所述第一近距离通信与所述第一网关设备建立连接。Within the first preset time period, when the first broadcast message is detected and a connection request for the second broadcast message is received, the first gateway device that sent the first broadcast message is sent A connection request is sent to establish a connection with the first gateway device through the first short-range communication. 3.根据权利要求1所述的设备连接方法,其特征在于,所述方法还包括:3. The device connection method according to claim 1, wherein the method further comprises: 所述第一预设时长内,在未检测到第一广播消息且接收到第二网关设备针对所述第二广播消息发送的连接请求的情况下,则通过所述第二近距离通信与所述第二网关设备建立连接,并且停止检测所述第一近距离通信的广播消息。Within the first preset time period, if the first broadcast message is not detected and the connection request sent by the second gateway device for the second broadcast message is received, the second short-range communication is used to communicate with the The second gateway device establishes a connection, and stops detecting the broadcast message of the first short-range communication. 4.根据权利要求1所述的设备连接方法,其特征在于,所述方法还包括:4. The device connection method according to claim 1, wherein the method further comprises: 所述第一预设时长内,在检测到多个第一广播消息的情况下,根据所述多个第一广播消息,从发送第一广播消息的多个第一网关设备中选择信号强度最高的第一网关设备发送连接请求,以通过所述第一近距离通信建立连接。Within the first preset time period, when multiple first broadcast messages are detected, select the highest signal strength from the multiple first gateway devices that send the first broadcast message according to the multiple first broadcast messages. The first gateway device of the device sends a connection request to establish a connection through the first short-range communication. 5.根据权利要求1所述的设备连接方法,其特征在于,所述方法还包括:5. The device connection method according to claim 1, wherein the method further comprises: 所述第一预设时长内,在检测到多个第一广播消息的情况下,根据所述多个第一广播消息中每个第一广播消息携带的发送方标识,查询存储的与所述发送方标识对应的第一网关设备的连接次数,向连接次数最少的第一网关设备发送连接请求,以通过所述第一近距离通信建立连接。Within the first preset duration, when multiple first broadcast messages are detected, according to the sender identifier carried by each first broadcast message in the multiple first broadcast messages, query the stored information related to the first broadcast message. The sender identifies the number of connections of the corresponding first gateway device, and sends a connection request to the first gateway device with the least number of connections, so as to establish a connection through the first short-range communication. 6.根据权利要求2或4或5所述的设备连接方法,其特征在于,所述第一广播消息包括所述第一网关设备的第一验证信息;6. The device connection method according to claim 2, 4 or 5, wherein the first broadcast message comprises first verification 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: 在所述终端设备对应的第一用户信息与所述第一验证信息相匹配的情况下,执行向发送所述第一广播消息的所述第一网关设备发送连接请求的步骤。In the case that 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 sends the first broadcast message is performed. 7.根据权利要求2或4或5所述的设备连接方法,其特征在于,所述连接请求携带所述终端设备的第二验证信息,所述第二验证信息用于在所述第一网关设备确定所述第二验证信息与所述第一网关设备对应的第二用户信息相匹配的情况下向所述终端设备反馈确认建立连接的响应消息。7. The device connection method according to claim 2, 4 or 5, wherein the connection request carries second verification information of the terminal device, and the second verification information is used in the first gateway When the device determines that the second verification information matches the second user information corresponding to the first gateway device, the device feeds back a response message confirming the establishment of the connection to the terminal device. 8.一种设备连接装置,其特征在于,所述装置包括:8. A device connecting device, characterized in that the device comprises: 收发模块,用于按照第一时间间隔检测第一近距离通信的第一广播消息;a transceiver module, configured to detect the first broadcast message of the first short-range communication according to the first time interval; 所述收发模块,还用于发送第二近距离通信的第二广播消息,所述第一近距离通信与所述第二近距离通信为不同的通信方式;The transceiver module is further configured to send a second broadcast message of a second short-range communication, wherein the first short-range communication and the second short-range communication are in different communication modes; 处理模块,用于第一预设时长内,在未检测到所述第一广播消息且未接收到针对所述第二广播消息的连接请求的情况下,则按照预设规则延长所述第一时间间隔。The processing module is configured to extend the first broadcast message according to a preset rule when the first broadcast message is not detected and the connection request for the second broadcast message is not received within a first preset time period. time interval. 9.一种计算机可读存储介质,其特征在于,所述计算机可读存储介质上存储有计算机程序,所述计算机程序被处理器运行时执行如权利要求1至7任一项所述的设备连接方法的步骤。9. A computer-readable storage medium, wherein a computer program is stored on the computer-readable storage medium, and the computer program executes the device according to any one of claims 1 to 7 when the computer program is run by a processor The steps of the connection method. 10.一种计算机设备,包括:10. A computer device comprising: 处理器;processor; 存储器,用于存储计算机程序;memory for storing computer programs; 所述处理器执行计算机程序时,使得处理器执行如权利要求1至7所述方法的步骤。The processor, when executing a computer program, causes the processor to perform the steps of the method as claimed in claims 1 to 7 .
CN202210516058.6A 2022-05-12 2022-05-12 Equipment connection method, device, storage medium and computer equipment Pending CN114928858A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202210516058.6A CN114928858A (en) 2022-05-12 2022-05-12 Equipment connection method, device, storage medium and computer equipment

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202210516058.6A CN114928858A (en) 2022-05-12 2022-05-12 Equipment connection method, device, storage medium and computer equipment

Publications (1)

Publication Number Publication Date
CN114928858A true CN114928858A (en) 2022-08-19

Family

ID=82807813

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202210516058.6A Pending CN114928858A (en) 2022-05-12 2022-05-12 Equipment connection method, device, storage medium and computer equipment

Country Status (1)

Country Link
CN (1) CN114928858A (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN117278985A (en) * 2023-09-21 2023-12-22 上海仪电(集团)有限公司中央研究院 A Matter-based low-power long-distance wireless communication method, system and device

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20160234742A1 (en) * 2013-09-18 2016-08-11 Canon Kabushiki Kaisha Communication apparatus, control method thereof, and program
CN105959040A (en) * 2016-06-21 2016-09-21 上海卓易云汇智能技术有限公司 Method and device for dynamically adjusting BLE Bluetooth connection interval
CN107631732A (en) * 2017-11-02 2018-01-26 武汉大学 Mixing indoor positioning method and system based on bluetooth, Wi Fi and sound wave
CN109975758A (en) * 2019-02-20 2019-07-05 苏州普息导航技术有限公司 Wi-Fi blue tooth integrated base station location system
CN113038440A (en) * 2021-03-15 2021-06-25 杭州涂鸦信息技术有限公司 Communication channel switching method and device, computer equipment and readable storage medium

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20160234742A1 (en) * 2013-09-18 2016-08-11 Canon Kabushiki Kaisha Communication apparatus, control method thereof, and program
CN105959040A (en) * 2016-06-21 2016-09-21 上海卓易云汇智能技术有限公司 Method and device for dynamically adjusting BLE Bluetooth connection interval
CN107631732A (en) * 2017-11-02 2018-01-26 武汉大学 Mixing indoor positioning method and system based on bluetooth, Wi Fi and sound wave
CN109975758A (en) * 2019-02-20 2019-07-05 苏州普息导航技术有限公司 Wi-Fi blue tooth integrated base station location system
CN113038440A (en) * 2021-03-15 2021-06-25 杭州涂鸦信息技术有限公司 Communication channel switching method and device, computer equipment and readable storage medium

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN117278985A (en) * 2023-09-21 2023-12-22 上海仪电(集团)有限公司中央研究院 A Matter-based low-power long-distance wireless communication method, system and device

Similar Documents

Publication Publication Date Title
US11647548B2 (en) Network access method, device, and system
CN109417758B (en) Bluetooth connection method and terminal
CN105453671B (en) method and apparatus for registering wireless device in wireless communication system
US9521642B2 (en) Configuration of a new enrollee device for use in a communication network
US20200136902A1 (en) Network management method and apparatus
US20230147041A1 (en) Pairing Devices Based on Distance
CN111464993B (en) Bluetooth headset pairing method and wireless headset for Bluetooth headset
JP2011254469A (en) Method, device and system for configuring wifi parameter
CN110072236A (en) Equipment connection method, equipment and system
US20140086121A1 (en) Methods and apparatus for controlling a wireless station
EP3442250B1 (en) Data transmission
CN111741509A (en) Network distribution method and device, storage medium and processor
KR20200001799A (en) Apparatus and method for communicating data in network environment based on nan protocol
CN105636161B (en) Access method, apparatus, communication terminal and the wireless network access point of wireless network
CN111163469A (en) Network distribution method of intelligent household appliance, wireless module and intelligent household appliance
CN106648721A (en) Method and device for upgrading software
CN111263377B (en) Network configuration method, device, equipment and system and distribution network testing method and system
CN114928858A (en) Equipment connection method, device, storage medium and computer equipment
CN114786238B (en) Lora terminal equipment network access method, device, terminal equipment, system and storage medium
CN105915416B (en) Information processing method and terminal equipment
CN113595839B (en) Device binding method, terminal device and storage medium
CN111953573B (en) Equipment distribution network processing method, equipment distribution network processing device and intelligent panel
CN113965904A (en) Device registration method, device and storage medium
CN114286338A (en) Equipment network distribution method and device, electronic equipment and storage medium
CN112769762A (en) Distributed efficient Internet of things equipment access method

Legal Events

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