[go: up one dir, main page]

CN118741501A - Information interaction method, cloud, device and readable storage medium - Google Patents

Information interaction method, cloud, device and readable storage medium Download PDF

Info

Publication number
CN118741501A
CN118741501A CN202411092543.0A CN202411092543A CN118741501A CN 118741501 A CN118741501 A CN 118741501A CN 202411092543 A CN202411092543 A CN 202411092543A CN 118741501 A CN118741501 A CN 118741501A
Authority
CN
China
Prior art keywords
wireless communication
communication device
instruction
gateway
cloud
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
CN202411092543.0A
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.)
Guangdong Hotata Smart Home Co Ltd
Original Assignee
Guangdong Hotata Smart Home 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 Guangdong Hotata Smart Home Co Ltd filed Critical Guangdong Hotata Smart Home Co Ltd
Priority to CN202411092543.0A priority Critical patent/CN118741501A/en
Publication of CN118741501A publication Critical patent/CN118741501A/en
Pending legal-status Critical Current

Links

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04WWIRELESS COMMUNICATION NETWORKS
    • H04W12/00Security arrangements; Authentication; Protecting privacy or anonymity
    • H04W12/03Protecting confidentiality, e.g. by encryption
    • H04W12/037Protecting confidentiality, e.g. by encryption of the control plane, e.g. signalling traffic
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04WWIRELESS COMMUNICATION NETWORKS
    • H04W88/00Devices specially adapted for wireless communication networks, e.g. terminals, base stations or access point devices
    • H04W88/16Gateway arrangements
    • YGENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
    • Y02TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
    • Y02DCLIMATE CHANGE MITIGATION TECHNOLOGIES IN INFORMATION AND COMMUNICATION TECHNOLOGIES [ICT], I.E. INFORMATION AND COMMUNICATION TECHNOLOGIES AIMING AT THE REDUCTION OF THEIR OWN ENERGY USE
    • Y02D30/00Reducing energy consumption in communication networks
    • Y02D30/70Reducing energy consumption in communication networks in wireless communication networks

Landscapes

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

Abstract

本申请实施例提供了一种信息交互方法、云端、设备及可读存储介质,涉及智能设备领域,应用于云端,该方法包括:确定第一指令、待交互的目标无线通信设备的设备标识和设备密钥;第一指令用于指示目标无线通信设备执行第一操作;根据加密算法和设备密钥对第一指令进行加密;根据设备标识确定目标无线通信设备对应的目标主题,并向目标主题发布加密后的第一指令,以使得订阅目标主题的网关接收加密后的第一指令,向目标无线通信设备转发加密后的第一指令;接收网关转发的第一响应信息;第一响应信息是目标无线通信设备根据设备密钥对加密后的第一指令解密成功,执行第一操作后发送的。本申请实施例提高了信息交互的安全性,减轻了网关的工作量。

The embodiment of the present application provides an information interaction method, a cloud, a device and a readable storage medium, which relates to the field of smart devices and is applied to the cloud. The method includes: determining a first instruction, a device identifier and a device key of a target wireless communication device to be interacted; the first instruction is used to instruct the target wireless communication device to perform a first operation; encrypting the first instruction according to an encryption algorithm and a device key; determining a target topic corresponding to the target wireless communication device according to the device identifier, and publishing the encrypted first instruction to the target topic, so that a gateway subscribed to the target topic receives the encrypted first instruction and forwards the encrypted first instruction to the target wireless communication device; receiving a first response message forwarded by the gateway; the first response message is sent by the target wireless communication device after successfully decrypting the encrypted first instruction according to the device key and performing the first operation. The embodiment of the present application improves the security of information interaction and reduces the workload of the gateway.

Description

信息交互方法、云端、设备及可读存储介质Information interaction method, cloud, device and readable storage medium

技术领域Technical Field

本申请涉及智能设备技术领域,具体而言,本申请涉及一种信息交互方法、云端、设备及可读存储介质。The present application relates to the technical field of smart devices. Specifically, the present application relates to an information interaction method, a cloud, a device and a readable storage medium.

背景技术Background Art

随着物联网技术的发展,越来越多的无线通信设备通过网关接入网络,实现远程控制和数据传输,对于大量使用无线通信设备的场景,通常都会与网关搭配使用,通常在云端与无线通信设备之间进行交互的信息,都需要先经由网关的解析与处理,然后再被发送至无线通信设备或云端。With the development of Internet of Things technology, more and more wireless communication devices are connected to the network through gateways to achieve remote control and data transmission. For scenarios where a large number of wireless communication devices are used, they are usually used in conjunction with gateways. Usually, the information interacting between the cloud and the wireless communication device needs to be parsed and processed by the gateway before being sent to the wireless communication device or the cloud.

然而,相关技术中存在云端与无线通信设备之间的交互安全性差和网关工作量大的问题。However, the related technology has the problems of poor interaction security between the cloud and wireless communication devices and heavy workload of the gateway.

发明内容Summary of the invention

本申请实施例提供了一种信息交互方法、云端、设备及可读存储介质,用于解决云端与无线通信设备之间的交互安全性差和网关工作量大的问题的技术问题。The embodiments of the present application provide an information interaction method, a cloud, a device and a readable storage medium, which are used to solve the technical problems of poor interaction security between the cloud and wireless communication devices and heavy gateway workload.

根据本申请实施例的第一方面,提供了一种信息交互方法,应用于云端,该方法包括:According to a first aspect of an embodiment of the present application, there is provided an information interaction method, which is applied to a cloud, and the method includes:

确定第一指令、待交互的目标无线通信设备的设备标识和设备密钥;所述第一指令用于指示目标无线通信设备执行相应的第一操作;Determine a first instruction, a device identification and a device key of a target wireless communication device to be interacted with; the first instruction is used to instruct the target wireless communication device to perform a corresponding first operation;

根据预设加密算法和设备密钥对第一指令进行加密;Encrypting the first instruction according to a preset encryption algorithm and a device key;

根据设备标识确定目标无线通信设备对应的目标主题,并向目标主题发布加密后的第一指令,以使得订阅目标主题的网关接收加密后的第一指令,并向目标主题对应的目标无线通信设备转发加密后的第一指令;Determine a target topic corresponding to the target wireless communication device according to the device identifier, and publish the encrypted first instruction to the target topic, so that a gateway subscribed to the target topic receives the encrypted first instruction and forwards the encrypted first instruction to the target wireless communication device corresponding to the target topic;

接收网关转发的由目标无线通信设备发送的第一响应信息;第一响应信息是目标无线通信设备根据设备密钥对加密后的第一指令解密成功,并执行第一指令相应的第一操作后发送的;receiving a first response message sent by a target wireless communication device and forwarded by the gateway; the first response message is sent by the target wireless communication device after successfully decrypting the encrypted first instruction according to the device key and executing a first operation corresponding to the first instruction;

其中,设备密钥和目标主题均为目标无线通信设备在云端注册时确定的。Among them, the device key and the target subject are both determined when the target wireless communication device is registered in the cloud.

根据本申请实施例的第二方面,提供了一种信息交互方法,应用于无线通信设备,该方法包括:According to a second aspect of an embodiment of the present application, there is provided an information interaction method, which is applied to a wireless communication device, and the method includes:

接收网关转发的由云端发送的加密后的第一指令;加密后的第一指令为云端根据无线通信设备的设备密钥和预设加密算法对第一指令进行加密得到的,设备密钥为无线通信设备在云端注册时确定的;The encrypted first instruction sent by the cloud and forwarded by the receiving gateway is obtained by encrypting the first instruction by the cloud according to the device key of the wireless communication device and a preset encryption algorithm, and the device key is determined when the wireless communication device is registered in the cloud;

根据本地缓存的设备密钥对加密后的第一指令进行解密,获得第一指令;Decrypting the encrypted first instruction according to the locally cached device key to obtain the first instruction;

在根据第一指令执行相应的第一操作后,通过网关向云端发送第一响应信息;第一响应信息用于指示设备已完成第一指令相应的第一操作。After executing the corresponding first operation according to the first instruction, a first response message is sent to the cloud through the gateway; the first response message is used to indicate that the device has completed the first operation corresponding to the first instruction.

在一个可能的实现方式中,接收网关转发的由云端发送的加密后的第一指令之前,无线通信设备首次启动时,通过串口读取烧录在无线通信设备上的产品标识和对应的产品密钥;In a possible implementation, before receiving the encrypted first instruction sent by the cloud and forwarded by the gateway, when the wireless communication device is started for the first time, the product identification and the corresponding product key burned on the wireless communication device are read through the serial port;

通过网关向云端发送注册请求,以使得云端在接收注册请求后,若确定第一列表中记录有产品标识和对应的产品密钥,则根据预设生成方法生成并存储无线通信设备的设备标识和设备密钥;注册请求包括产品标识和对应的产品密钥;Sending a registration request to the cloud through the gateway, so that after receiving the registration request, if the cloud determines that the product identifier and the corresponding product key are recorded in the first list, the cloud generates and stores the device identifier and the device key of the wireless communication device according to a preset generation method; the registration request includes the product identifier and the corresponding product key;

接收云端通过预设加密通道发送的设备标识和设备密钥。Receive the device ID and device key sent by the cloud through a preset encrypted channel.

在又一个可能的实现方式中,接收云端通过预设加密通道发送的设备标识和设备密钥之后,确定上行信息,通过预设加密算法和设备标识对上行信息进行加密;In yet another possible implementation, after receiving the device identification and the device key sent by the cloud through a preset encryption channel, uplink information is determined, and the uplink information is encrypted using a preset encryption algorithm and the device identification;

向网关发送加密后的上行信息和上行属性数据,以使得网关接收加密后的上行信息和上行属性数据后,将加密后的上行信息发送至云端;Sending the encrypted uplink information and uplink attribute data to the gateway, so that after receiving the encrypted uplink information and uplink attribute data, the gateway sends the encrypted uplink information to the cloud;

上行属性数据用于指示网关向云端发送信息。The uplink attribute data is used to instruct the gateway to send information to the cloud.

根据本申请实施例的第三方面,提供了一种云端,该装置包括:According to a third aspect of an embodiment of the present application, a cloud is provided, the device comprising:

确定模块,用于确定第一指令、待交互的目标无线通信设备的设备标识和设备密钥;第一指令用于指示目标无线通信设备执行相应的第一操作;A determination module, used to determine a first instruction, a device identification and a device key of a target wireless communication device to be interacted with; the first instruction is used to instruct the target wireless communication device to perform a corresponding first operation;

加密模块,用于根据预设加密算法和设备密钥对第一指令进行加密;An encryption module, used to encrypt the first instruction according to a preset encryption algorithm and a device key;

发布模块,用于根据设备标识确定目标无线通信设备对应的目标主题,并向目标主题发布加密后的第一指令,以使得订阅目标主题的网关接收加密后的第一指令,并向目标主题对应的目标无线通信设备转发加密后的第一指令;A publishing module, used to determine a target topic corresponding to a target wireless communication device according to a device identifier, and publish an encrypted first instruction to the target topic, so that a gateway subscribed to the target topic receives the encrypted first instruction and forwards the encrypted first instruction to a target wireless communication device corresponding to the target topic;

第一接收模块,用于接收网关转发的由目标无线通信设备发送的第一响应信息;第一响应信息是目标无线通信设备根据设备密钥对加密后的第一指令解密成功,并执行第一指令相应的第一操作后发送的;A first receiving module is used to receive a first response message sent by a target wireless communication device and forwarded by a gateway; the first response message is sent after the target wireless communication device successfully decrypts the encrypted first instruction according to the device key and executes a first operation corresponding to the first instruction;

其中,设备密钥和目标主题均为目标无线通信设备在云端注册时确定的。Among them, the device key and the target subject are both determined when the target wireless communication device is registered in the cloud.

根据本申请实施例的第四方面,提供了一种无线通信设备,该装置包括:According to a fourth aspect of an embodiment of the present application, a wireless communication device is provided, the device comprising:

第二接收模块,用于接收网关转发的由云端发送的加密后的第一指令;加密后的第一指令为云端根据无线通信设备的设备密钥和预设加密算法对第一指令进行加密得到的,设备密钥为无线通信设备在云端注册时确定的;A second receiving module is used to receive the encrypted first instruction sent by the cloud and forwarded by the gateway; the encrypted first instruction is obtained by the cloud encrypting the first instruction according to the device key of the wireless communication device and a preset encryption algorithm, and the device key is determined when the wireless communication device is registered in the cloud;

解密模块,用于根据本地缓存的设备密钥对加密后的第一指令进行解密,获得第一指令;A decryption module, used to decrypt the encrypted first instruction according to the locally cached device key to obtain the first instruction;

发送模块,用于在根据第一指令执行相应的第一操作后,通过网关向云端发送第一响应信息;第一响应信息用于指示设备已完成第一指令相应的第一操作。The sending module is used to send a first response message to the cloud through the gateway after executing the corresponding first operation according to the first instruction; the first response message is used to indicate that the device has completed the first operation corresponding to the first instruction.

根据本申请实施例的第五方面,提供了一种电子设备,该电子设备包括存储器、处理器及存储在存储器上的计算机程序,处理器执行程序时实现如第一方面所提供的方法的步骤。According to a fifth aspect of an embodiment of the present application, an electronic device is provided, which includes a memory, a processor, and a computer program stored in the memory, and when the processor executes the program, the steps of the method provided in the first aspect are implemented.

根据本申请实施例的第六方面,提供了一种计算机可读存储介质,其上存储有计算机程序,该计算机程序被处理器执行时实现如第一方面所提供的方法的步骤。According to a sixth aspect of an embodiment of the present application, a computer-readable storage medium is provided, on which a computer program is stored. When the computer program is executed by a processor, the steps of the method provided in the first aspect are implemented.

本申请实施例提供的技术方案带来的有益效果是:The beneficial effects of the technical solution provided by the embodiment of the present application are:

本申请实施例提供的信息交互方法,通过确定用于指示目标无线通信设备执行相应的第一操作的第一指令,待交互的目标无线通信设备在云端注册时为其分配的设备标识和设备密钥,根据设备密钥和预设加密算法对第一指令进行加密,得到加密后的第一指令,根据设备标识确定目标无线通信设备对应的目标主题,并向目标主题发布加密后的第一指令,以使得订阅目标主题的网关能够及时接收到加密后的第一指令,并向目标主题对应的目标无线通信设备转发加密后的第一指令,当云端接收到第一响应信息时,说明目标无线通信设备根据分配的设备密钥对加密后的第一指令解密成功,且完成了相应的第一操作,由于参与加密的设备密钥是在注册时由云端分配的,具有唯一性,因此,实现了只有分配了设备密钥的目标无线通信设备才能对加密后的第一指令进行解密,保证了第一指令在信息传输过程中的安全,同时,网关在上述信息交互过程中只执行了接收加密后的第一指令,以及将加密后的第一指令转发至目标无线通信设备的操作,没有对加密后的第一指令进行任何处理,大大减轻了网关的业务量。The information interaction method provided by the embodiment of the present application determines a first instruction for instructing a target wireless communication device to perform a corresponding first operation, a device identifier and a device key assigned to the target wireless communication device to be interacted with when it is registered in the cloud, encrypts the first instruction according to the device key and a preset encryption algorithm to obtain an encrypted first instruction, determines a target topic corresponding to the target wireless communication device according to the device identifier, and publishes the encrypted first instruction to the target topic, so that a gateway subscribed to the target topic can receive the encrypted first instruction in time, and forward the encrypted first instruction to the target wireless communication device corresponding to the target topic. When the cloud receives the first response information, it indicates that the target wireless communication device has successfully decrypted the encrypted first instruction according to the assigned device key and completed the corresponding first operation. Since the device key involved in the encryption is assigned by the cloud during registration and is unique, it is realized that only the target wireless communication device assigned with the device key can decrypt the encrypted first instruction, thereby ensuring the security of the first instruction during the information transmission process. At the same time, the gateway only performs the operations of receiving the encrypted first instruction and forwarding the encrypted first instruction to the target wireless communication device in the above-mentioned information interaction process, and does not perform any processing on the encrypted first instruction, thereby greatly reducing the business volume of the gateway.

附图说明BRIEF DESCRIPTION OF THE DRAWINGS

为了更清楚地说明本申请实施例中的技术方案,下面将对本申请实施例描述中所需要使用的附图作简单地介绍。In order to more clearly illustrate the technical solutions in the embodiments of the present application, the drawings required for use in describing the embodiments of the present application are briefly introduced below.

图1为本申请实施例提供的实现信息交互方法的系统架构示意图;FIG1 is a schematic diagram of a system architecture for implementing an information interaction method provided in an embodiment of the present application;

图2为本申请实施例提供的一种应用于云端的信息交互方法的流程示意图;FIG2 is a schematic diagram of a flow chart of an information interaction method applied to the cloud provided in an embodiment of the present application;

图3为本申请实施例提供的一种信息交互方法中的无线通信设备的注册方法的流程示意图;FIG3 is a schematic flow chart of a registration method for a wireless communication device in an information interaction method provided in an embodiment of the present application;

图4为本申请实施例提供的一种信息交互方法中的交互信息的数据格式的示意图;FIG4 is a schematic diagram of a data format of interactive information in an information interaction method provided in an embodiment of the present application;

图5为本申请实施例提供的一种信息交互方法中的确定网关可订阅的主题的方法的流程示意图;5 is a flow chart of a method for determining topics that a gateway can subscribe to in an information interaction method provided in an embodiment of the present application;

图6为本申请实施例提供的一种应用于无线通信设备的信息交互方法的流程示意图;FIG6 is a flow chart of an information interaction method applied to a wireless communication device provided in an embodiment of the present application;

图7为本申请实施例提供的一种无线通信设备的信息交互方法的交互流程示意图;FIG7 is a schematic diagram of an interaction flow of an information interaction method of a wireless communication device provided in an embodiment of the present application;

图8为本申请实施例提供的一种云端的结构示意图;FIG8 is a schematic diagram of a cloud structure provided by an embodiment of the present application;

图9为本申请实施例提供的一种无线通信设备的结构示意图;FIG9 is a schematic diagram of the structure of a wireless communication device provided in an embodiment of the present application;

图10为本申请实施例提供的一种电子设备的结构示意图。FIG. 10 is a schematic diagram of the structure of an electronic device provided in an embodiment of the present application.

具体实施方式DETAILED DESCRIPTION

下面结合本申请中的附图描述本申请的实施例。应理解,下面结合附图所阐述的实施方式,是用于解释本申请实施例的技术方案的示例性描述,对本申请实施例的技术方案不构成限制。The embodiments of the present application are described below in conjunction with the drawings in the present application. It should be understood that the implementation methods described below in conjunction with the drawings are exemplary descriptions for explaining the technical solutions of the embodiments of the present application and do not constitute a limitation on the technical solutions of the embodiments of the present application.

本技术领域技术人员可以理解,除非特意声明,这里使用的单数形式 “一”、“一个”和“该”也可包括复数形式。应该进一步理解的是,本申请实施例所使用的术语“包括”以及“包含”是指相应特征可以实现为所呈现的特征、信息、数据、步骤、操作、元件和/或组件,但不排除实现为本技术领域所支持其他特征、信息、数据、步骤、操作、元件、组件和/或它们的组合等。应该理解,当我们称一个元件被“连接”或“耦接”到另一元件时,该一个元件可以直接连接或耦接到另一元件,也可以指该一个元件和另一元件通过中间元件建立连接关系。此外,这里使用的“连接”或 “耦接”可以包括无线连接或无线耦接。这里使用的术语“和/或”指示该术语所限定的项目中的至少一个,例如“A和/或B”可以实现为“A”,或者实现为“B”,或者实现为“A和B”。It will be understood by those skilled in the art that, unless specifically stated, the singular forms "one", "an" and "the" used herein may also include plural forms. It should be further understood that the terms "including" and "comprising" used in the embodiments of the present application refer to that the corresponding features can be implemented as the presented features, information, data, steps, operations, elements and/or components, but do not exclude the implementation as other features, information, data, steps, operations, elements, components and/or combinations thereof supported by the technical field, etc. It should be understood that when we say that an element is "connected" or "coupled" to another element, the one element may be directly connected or coupled to the other element, or it may refer to that the one element and the other element establish a connection relationship through an intermediate element. In addition, the "connection" or "coupling" used herein may include wireless connection or wireless coupling. The term "and/or" used herein indicates at least one of the items defined by the term, for example, "A and/or B" may be implemented as "A", or as "B", or as "A and B".

下面对相关技术进行说明:在相关技术中的云端与无线通信设备的信息交互中,为了开发便捷,同一个系统中的无线通信设备通常都是使用同一种信息加密方式,并且使用共同的密钥,因此导致,当一个无线通信设备被破解后,同一系统中的所有设备都会被同时破解,存在安全性低的问题,另外,由于在相关技术中网关在接收到来自云端或者无线通信设备的交互信息时,通常会先对信息进行解析,然后再进行各种业务处理,最好再发送至无线通信设备或者云端,因此,当有新的无线设备或网关接入时,网关需要根据新的无线通信设备进行业务开发,需要无线通信设备、网关和云端进行数据流通,导致了网关开发复杂度高以及业务量大的问题。The following is an explanation of the relevant technology: In the information interaction between the cloud and the wireless communication device in the relevant technology, in order to facilitate development, the wireless communication devices in the same system usually use the same information encryption method and use a common key. As a result, when a wireless communication device is cracked, all devices in the same system will be cracked at the same time, resulting in a low security problem. In addition, in the relevant technology, when the gateway receives the interactive information from the cloud or wireless communication device, it usually parses the information first, and then performs various business processing, and preferably sends it to the wireless communication device or the cloud. Therefore, when a new wireless device or gateway is connected, the gateway needs to develop business according to the new wireless communication device, and data needs to be circulated among the wireless communication device, the gateway and the cloud, resulting in high complexity in gateway development and large business volume.

针对相关技术中所存在的上述至少一个技术问题或需要改善的地方,本申请提出一种信息交互方法,该方案实现了只有分配了设备密钥的目标无线通信设备才能对加密后的第一指令进行解密,保证了第一指令在信息传输过程中的安全,同时,网关在上述信息交互过程中只执行了接收加密后的第一指令,以及将加密后的第一指令转发至目标无线通信设备的操作,没有对加密后的第一指令进行任何处理,大大减轻了网关的业务量。In response to at least one of the above-mentioned technical problems or areas that need improvement in the related technology, the present application proposes an information interaction method, which implements that only the target wireless communication device that is assigned a device key can decrypt the encrypted first instruction, thereby ensuring the security of the first instruction during the information transmission process. At the same time, the gateway only executes the operations of receiving the encrypted first instruction and forwarding the encrypted first instruction to the target wireless communication device during the above-mentioned information interaction process, without performing any processing on the encrypted first instruction, thereby greatly reducing the gateway's business volume.

下面通过对几个示例性实施方式的描述,对本申请实施例的技术方案以及本申请的技术方案产生的技术效果进行说明。需要指出的是,下述实施方式之间可以相互参考、借鉴或结合,对于不同实施方式中相同的术语、相似的特征以及相似的实施步骤等,不再重复描述。The following describes several exemplary embodiments to illustrate the technical solutions of the embodiments of the present application and the technical effects produced by the technical solutions of the present application. It should be noted that the following embodiments can refer to, draw on or combine with each other, and the same terms, similar features and similar implementation steps in different embodiments will not be described repeatedly.

图1为本申请实施例提供的实现信息交互方法的系统架构示意图,其中该系统架构包括:无线通信设备120、云端140和网关160。FIG1 is a schematic diagram of a system architecture for implementing an information interaction method provided in an embodiment of the present application, wherein the system architecture includes: a wireless communication device 120 , a cloud 140 , and a gateway 160 .

无线通信设备120安装和运行有信息交互方法的应用程序,无线通信设备120,用于接收和解密加密后的第一指令,并根据第一指令执行相应的第一操作。The wireless communication device 120 installs and runs an application program having an information interaction method. The wireless communication device 120 is used to receive and decrypt the encrypted first instruction, and perform a corresponding first operation according to the first instruction.

网关160用于转发加密后的第一指令,与无线通信设备120和云端140进行信息交互。The gateway 160 is used to forward the encrypted first instruction and perform information exchange with the wireless communication device 120 and the cloud 140 .

云端140包括一台服务器、多台服务器、云计算平台和虚拟化中心中的至少一种。示意性的,服务器140包括处理器144和存储器142,存储器142包括显示模块1421、控制模块1422和接收模块1423。服务器140用于为信息交互方法的应用程序提供后台服务。The cloud 140 includes at least one of a server, multiple servers, a cloud computing platform, and a virtualization center. Schematically, the server 140 includes a processor 144 and a memory 142, and the memory 142 includes a display module 1421, a control module 1422, and a receiving module 1423. The server 140 is used to provide background services for the application of the information interaction method.

可选的,无线通信设备的设备类型包括:智能手机、平板电脑、电子书阅读器、动态影像专家压缩标准音频层3(MovingPicture Experts Group Audio Layer III,MP3)播放器、动态影像专家压缩标准音频层面4(Moving Picture Experts Group Audio Layer IV,MP4)播放器、膝上型便携计算机和台式计算机中的至少一种。Optionally, the device types of the wireless communication device include: at least one of a smart phone, a tablet computer, an e-book reader, a Moving Picture Experts Group Audio Layer III (MP3) player, a Moving Picture Experts Group Audio Layer IV (MP4) player, a laptop computer and a desktop computer.

本领域技术人员可以知晓,上述无线通信设备的数量可以更多或更少。比如上述无线通信设备可以仅为一个,或者上述无线通信设备为几十个或几百个,或者更多数量。本申请实施例对无线通信设备的数量和设备类型不加以限定。Those skilled in the art will appreciate that the number of the wireless communication devices may be more or less. For example, the number of the wireless communication devices may be only one, or the number of the wireless communication devices may be dozens or hundreds, or more. The embodiment of the present application does not limit the number and type of wireless communication devices.

本申请实施例中提供了一种信息交互方法,应用于云端,如图2所示,该方法包括:An information interaction method is provided in an embodiment of the present application and is applied to the cloud. As shown in FIG2 , the method includes:

S101,确定第一指令、待交互的目标无线通信设备的设备标识和设备密钥。S101, determining a first instruction, a device identification and a device key of a target wireless communication device to be interacted with.

在本申请实施例中,无线通信设备是指能够通过无线技术进行数据传输和通信的设备。这些设备利用无线电波或其他无线技术,在没有通过物理接口连接的情况下进行信息交换,无线通信设备可以是具备蓝牙功能、zigbee等低功耗近场通信设备:如智能门锁、智能灯以及智能晾衣杆。In the embodiments of the present application, wireless communication devices refer to devices that can transmit and communicate data through wireless technology. These devices use radio waves or other wireless technologies to exchange information without being connected through a physical interface. Wireless communication devices can be low-power near-field communication devices with Bluetooth, Zigbee, etc., such as smart door locks, smart lights, and smart clothes drying poles.

在本申请实施例中第一指令是用于指示目标无线通信设备执行相应的第一操作的指令,例如控制温度的指令、调节高度的指令、调节灯光的指令等;第一操作是指根据第一指令的指示,无线通信设备相应执行的操作,例如第一指令为将温度调至20°的指令,那么相应的第一操作为无线通信设备将当前温度调整至20°。In the embodiment of the present application, the first instruction is an instruction for instructing the target wireless communication device to perform a corresponding first operation, such as an instruction for controlling the temperature, an instruction for adjusting the height, an instruction for adjusting the light, etc.; the first operation refers to the operation performed by the wireless communication device according to the instruction of the first instruction. For example, the first instruction is an instruction to adjust the temperature to 20°, then the corresponding first operation is that the wireless communication device adjusts the current temperature to 20°.

在本申请实施例中,设备密钥和设备标识为目标无线通信设备在云端注册时确定的;在无线通信设备在云端进行注册时,会被分配一个设备标识,用于云端识别和区分不同的设备,通常是一个字符串或数字,由云端生成,并在无线通信设备注册时分配给无线通信设备,设备密钥是一个用于认证和加密的机密信息,由云端生成并分配给设备,用于确保只有知道密钥的无线通信设备可以与云端进行通信和交互,使用设备密钥对设备和平台之间的通信进行加密,保护数据的隐私和完整性。In an embodiment of the present application, the device key and device identifier are determined when the target wireless communication device is registered in the cloud; when the wireless communication device is registered in the cloud, a device identifier is assigned to the cloud for identifying and distinguishing different devices, which is usually a string or number generated by the cloud and assigned to the wireless communication device when the wireless communication device is registered. The device key is confidential information used for authentication and encryption, generated by the cloud and assigned to the device, to ensure that only wireless communication devices that know the key can communicate and interact with the cloud, and use the device key to encrypt communications between the device and the platform to protect the privacy and integrity of the data.

在本申请实施例中,云端根据用户通过应用程序发送的包括第一指令设备标识的控制需求,确定第一指令,并从已在云端注册的无线通信设备中确定出待交互的目标无线通信设备的设备标识和设备密钥;例如,用户通过应用程序下发关闭车辆门锁的第一指令,应用程序将上述关闭车辆门锁的第一指令同车辆的设备标识一起作为控制需求发送至云端,云端接收上述控制需求后确定出第一指令和待交互的目标无线通信设备的设备标识,然后云端根据设备标识和已存储的设备标识和设备密钥的对应关系中确定设备密钥。In an embodiment of the present application, the cloud determines the first instruction based on the control requirement including the first instruction device identification sent by the user through the application, and determines the device identification and device key of the target wireless communication device to be interacted from the wireless communication devices registered in the cloud; for example, the user sends a first instruction to close the vehicle door lock through the application, and the application sends the first instruction to close the vehicle door lock together with the vehicle's device identification as a control requirement to the cloud. After receiving the above control requirement, the cloud determines the first instruction and the device identification of the target wireless communication device to be interacted, and then the cloud determines the device key based on the correspondence between the device identification and the stored device identification and device key.

S102,根据预设加密算法和设备密钥对第一指令进行加密。S102: Encrypt the first instruction according to a preset encryption algorithm and a device key.

在本申请实施例中,云端根据目标无线通信设备的设备密钥与预设加密算法,对第一指令进行加密,获得加密后的第一指令,其中,预设加密算法可以是对称加密算法,如AES ECB Zero 128bits加密算法。In an embodiment of the present application, the cloud encrypts the first instruction according to the device key of the target wireless communication device and a preset encryption algorithm to obtain the encrypted first instruction, wherein the preset encryption algorithm may be a symmetric encryption algorithm, such as the AES ECB Zero 128bits encryption algorithm.

S103,根据设备标识确定目标无线通信设备对应的目标主题,并向目标主题发布加密后的第一指令。S103, determining a target topic corresponding to the target wireless communication device according to the device identifier, and issuing an encrypted first instruction to the target topic.

在本申请实施例中,目标主题为目标无线通信设备在云端注册时确定的;在目标无线通信设备注册时,云端为目标无线通信设备分配目标主题,并直接将设备标识映射到目标无线通信设备对应的目标主题,因此,可以在确定设备标识之后,根据设备标识确定目标无线通信设备对应的目标主题,从而将加密后的第一指令发布到目标主题,通过目标主题可以将加密后的第一指令准确的传输到目标无线通信设备,确保加密后的第一指令的有效传输和处理。In an embodiment of the present application, the target topic is determined when the target wireless communication device is registered in the cloud; when the target wireless communication device is registered, the cloud assigns a target topic to the target wireless communication device, and directly maps the device identifier to the target topic corresponding to the target wireless communication device. Therefore, after determining the device identifier, the target topic corresponding to the target wireless communication device can be determined according to the device identifier, thereby publishing the encrypted first instruction to the target topic. The encrypted first instruction can be accurately transmitted to the target wireless communication device through the target topic, ensuring the effective transmission and processing of the encrypted first instruction.

在本申请实施例中,发布到目标主题的信息,只能由订阅上述目标主题的网关接收到,因此,可以确保信息消息只被特定订阅了该主题的设备接收到。这种方式有助于保护消息的安全性和隐私性,防止未授权的设备访问数据。In the embodiment of the present application, the information published to the target topic can only be received by the gateway that subscribes to the target topic, so it can be ensured that the information message is only received by the device that specifically subscribes to the topic. This method helps to protect the security and privacy of the message and prevent unauthorized devices from accessing the data.

在本申请实施例中,向目标主题发布加密后的第一指令,以使得订阅目标主题的网关接收加密后的第一指令,并向目标主题对应的目标无线通信设备转发加密后的第一指令。In an embodiment of the present application, an encrypted first instruction is published to a target topic, so that a gateway subscribed to the target topic receives the encrypted first instruction and forwards the encrypted first instruction to a target wireless communication device corresponding to the target topic.

在本申请实施例中,由于云端与无线通信设备之间的交互需要通过网关来中转,且各网关负责中转的无线通信设备不相同,因此,网关需要在云端订阅无线通信设备对应的主题来接收云端发送至无线通信设备的信息,从而将信息转发至对应的无线通信设备。In an embodiment of the present application, since the interaction between the cloud and the wireless communication device needs to be transferred through the gateway, and the wireless communication devices that each gateway is responsible for transferring are different, the gateway needs to subscribe to the topic corresponding to the wireless communication device in the cloud to receive information sent by the cloud to the wireless communication device, thereby forwarding the information to the corresponding wireless communication device.

在本申请实施例中,云端发布到对应的目标主题的加密后的第一指令,会被订阅上述目标主题的网关接收,网关接收到来自订阅的目标主题的加密后的第一指令后,根据目标主题对应的目标无线通信设备,确定加密后的第一指令的接收方,然后向目标无线通信设备转发加密后的第一指令。In an embodiment of the present application, the encrypted first instruction published by the cloud to the corresponding target topic will be received by the gateway subscribed to the above target topic. After the gateway receives the encrypted first instruction from the subscribed target topic, it determines the recipient of the encrypted first instruction based on the target wireless communication device corresponding to the target topic, and then forwards the encrypted first instruction to the target wireless communication device.

S104,接收网关转发的由目标无线通信设备发送的第一响应信息。S104: Receive first response information sent by the target wireless communication device and forwarded by the gateway.

在本申请实施例中第一响应信息是目标无线通信设备根据设备密钥对加密后的第一指令解密成功,并执行第一指令相应的第一操作后发送的。In the embodiment of the present application, the first response information is sent after the target wireless communication device successfully decrypts the encrypted first instruction according to the device key and executes the first operation corresponding to the first instruction.

在本申请实施例中,云端接收网关发送的第一响应信息,第一响应信息是目标无线通信设备根据设备密钥对加密后的第一指令解密后,且根据第一指令成功执行相应的第一操作后发送至云端的信息,云端接收到第一响应信息后,可以确认下发的指令已被执行。In an embodiment of the present application, the cloud receives a first response message sent by the gateway. The first response message is information sent to the cloud after the target wireless communication device decrypts the encrypted first instruction according to the device key and successfully executes the corresponding first operation according to the first instruction. After the cloud receives the first response message, it can confirm that the issued instruction has been executed.

本申请实施例提供的应用于云端的信息交互方法,通过确定用于指示目标无线通信设备执行相应的第一操作的第一指令,待交互的目标无线通信设备在云端注册时为其分配的设备标识和设备密钥,根据设备密钥和预设加密算法对第一指令进行加密,得到加密后的第一指令,根据设备标识确定目标无线通信设备对应的目标主题,并向目标主题发布加密后的第一指令,以使得订阅目标主题的网关能够及时接收到加密后的第一指令,并向目标主题对应的目标无线通信设备转发加密后的第一指令,当云端接收到第一响应信息时,说明目标无线通信设备根据分配的设备密钥对加密后的第一指令解密成功,且完成了相应的第一操作,由于参与加密的设备密钥是在注册时由云端分配的,具有唯一性,因此,实现了只有分配了设备密钥的目标无线通信设备才能对加密后的第一指令进行解密,保证了第一指令在信息传输过程中的安全,同时,网关在上述信息交互过程中只执行了接收加密后的第一指令,以及将加密后的第一指令转发至目标无线通信设备的操作,没有对加密后的第一指令进行任何处理,大大减轻了网关的业务量。The information interaction method applied to the cloud provided by the embodiment of the present application determines a first instruction for instructing a target wireless communication device to perform a corresponding first operation, a device identifier and a device key assigned to the target wireless communication device to be interacted when it is registered in the cloud, encrypts the first instruction according to the device key and a preset encryption algorithm to obtain the encrypted first instruction, determines the target topic corresponding to the target wireless communication device according to the device identifier, and publishes the encrypted first instruction to the target topic, so that a gateway subscribed to the target topic can receive the encrypted first instruction in time, and forward the encrypted first instruction to the target wireless communication device corresponding to the target topic. When the cloud receives the first response information, it indicates that the target wireless communication device successfully decrypts the encrypted first instruction according to the assigned device key and completes the corresponding first operation. Since the device key involved in the encryption is assigned by the cloud during registration and is unique, it is realized that only the target wireless communication device assigned the device key can decrypt the encrypted first instruction, thereby ensuring the security of the first instruction during the information transmission process. At the same time, the gateway only performs the operations of receiving the encrypted first instruction and forwarding the encrypted first instruction to the target wireless communication device in the above-mentioned information interaction process, and does not perform any processing on the encrypted first instruction, which greatly reduces the business volume of the gateway.

在上述各实施例的基础上,作为一种可选实施例,无线通信设备的注册流程如图3所示,具体内容如下:Based on the above embodiments, as an optional embodiment, the registration process of the wireless communication device is shown in FIG3 , and the specific contents are as follows:

S201,接收网关转发的由目标无线通信设备发送的注册请求;S201, receiving a registration request sent by a target wireless communication device and forwarded by a gateway;

S202,若确定第一列表中存在上述目标无线通信设备的产品标识和产品密钥,则生成并存储目标无线通信设备的设备标识和设备密钥;第一列表用于记录允许注册的无线通信设备的产品标识和产品密钥;S202, if it is determined that the product identification and product key of the target wireless communication device exist in the first list, then generate and store the device identification and device key of the target wireless communication device; the first list is used to record the product identification and product key of the wireless communication device that is allowed to be registered;

S203,根据目标无线通信设备的设备标识,配置目标无线通信设备的目标主题;S203, configuring a target topic of the target wireless communication device according to the device identification of the target wireless communication device;

S204,通过预设加密通道向目标无线通信设备发送设备标识和设备密钥。S204: Send the device identification and the device key to the target wireless communication device through a preset encryption channel.

在本申请实施例中,无线通信设备接入物联网时,需要在云端进行注册,注册成功的无线通信设备才能接收云端下发的指令以及向云端上传信息,因此,在向无线通信设备下发指令时需要先完成无线通信设备的注册,云端接收无线通信设备发送的设备请求,根据设备请求确定无线通信设备能否注册成功。In an embodiment of the present application, when a wireless communication device is connected to the Internet of Things, it needs to be registered in the cloud. Only a successfully registered wireless communication device can receive instructions issued by the cloud and upload information to the cloud. Therefore, when issuing instructions to the wireless communication device, the registration of the wireless communication device must be completed first. The cloud receives the device request sent by the wireless communication device and determines whether the wireless communication device can be successfully registered based on the device request.

在本申请实施例中,注册请求包括目标无线通信设备的产品标识和产品密钥;产品标识用于标识同一型号的无线通信设备,产品密钥用于同一型号的无线通信设备进行身份验证,即在同一型号的所有无线通信设备上烧录相同的产品标识和产品密钥,产品标识和产品密钥通常由无线通信设备的生产商提供。In an embodiment of the present application, the registration request includes the product identification and product key of the target wireless communication device; the product identification is used to identify wireless communication devices of the same model, and the product key is used to authenticate the same model of wireless communication devices, that is, the same product identification and product key are burned on all wireless communication devices of the same model, and the product identification and product key are usually provided by the manufacturer of the wireless communication device.

在本申请实施例中的S201中,云端接收网关转发的目标无线通信设备的注册请求,注册请求包括目标无线通信设备的产品标识和产品密钥。In S201 in the embodiment of the present application, the cloud receives a registration request of a target wireless communication device forwarded by a gateway, where the registration request includes a product identification and a product key of the target wireless communication device.

在本申请实施例中,无线通信设备通过通信能力验证、安全性评估、互操作性测试、性能测试和合规性认证才允许在云端进行注册,无线通信设备在正式投入市场时需要进行上述检验,由于第一列表用于记录允许注册的无线通信设备的产品标识和产品密钥,因此,检验通过的无线通信设备的产品标识和产品密钥会被记录在无线通信设备的第一列表中,以使得后续烧录有相同产品标识和产品密钥的无线通信设备在发起注册请求时,允许上述无线通信设备的注册请求通过。In an embodiment of the present application, a wireless communication device is allowed to register in the cloud only after passing communication capability verification, security assessment, interoperability testing, performance testing and compliance certification. The above-mentioned inspections are required when the wireless communication device is officially put on the market. Since the first list is used to record the product identification and product key of the wireless communication device that is allowed to register, the product identification and product key of the wireless communication device that has passed the inspection will be recorded in the first list of the wireless communication device, so that when a subsequent wireless communication device with the same product identification and product key is burned to initiate a registration request, the registration request of the above-mentioned wireless communication device will be allowed to pass.

在本申请实施例中,由于分配至目标无线通信设备的设备标识必须是整个云端中唯一的,因此,可以根据预定义的分配策略和规则为无线通信设备分配设备标识。In the embodiment of the present application, since the device identifier assigned to the target wireless communication device must be unique in the entire cloud, the device identifier can be assigned to the wireless communication device according to predefined allocation strategies and rules.

在本申请实施例中,设备密钥通常是一个加密的字符串或数值,云端通常会使用对称机密算法、非对称加密算法、哈希函数或者安全的随机数生成算法生成密钥,确保设备密钥的熵值高,难以被破解。In the embodiment of the present application, the device key is usually an encrypted string or numeric value. The cloud usually uses a symmetric encryption algorithm, an asymmetric encryption algorithm, a hash function or a secure random number generation algorithm to generate the key to ensure that the entropy value of the device key is high and difficult to crack.

在本申请实施例的S202中,云端若确定第一列表中存在目标无线通信设备的产品标识和产品密钥,说明目标无线通信设备所属型号的设备允许在云端注册,因此允许目标无线通信设备在云端进行注册,云端为目标无线通信设备分配设备标识和设备密钥,并建立设备标识和设备密钥的映射关系,以使得云端能准确识别目标无线通信设备,并通过设备密钥对云端与目标无线通信设备之间的交互信息进行加密。In S202 of the embodiment of the present application, if the cloud determines that the product identification and product key of the target wireless communication device exist in the first list, it means that the device model of the target wireless communication device is allowed to be registered in the cloud, and therefore the target wireless communication device is allowed to be registered in the cloud. The cloud assigns a device identification and a device key to the target wireless communication device, and establishes a mapping relationship between the device identification and the device key, so that the cloud can accurately identify the target wireless communication device, and encrypt the interaction information between the cloud and the target wireless communication device through the device key.

在本申请实施例中,云端会预定义设备主题的主题结构,主题结构通常由一个或多个层级组成的路径,例如devices/{device_id}/data,其中,{device_id}由具体的设备标识进行替换,定义好的主题用于发布需要发布至对应无线通信设备的信息。In an embodiment of the present application, the cloud will predefine the topic structure of the device topic. The topic structure is usually composed of a path consisting of one or more levels, such as devices/{device_id}/data, where {device_id} is replaced by a specific device identifier. The defined topic is used to publish information that needs to be published to the corresponding wireless communication device.

在本申请实施例中,云端根据设备标识配置目标无线通信设备的目标主题,是为了有效的管理与目标无线通信设备之间的信息通信,确保信息能准确、安全地进行传递。In the embodiment of the present application, the cloud configures the target topic of the target wireless communication device according to the device identification in order to effectively manage the information communication with the target wireless communication device and ensure that the information can be transmitted accurately and securely.

在本申请实施例的S203中,根据目标无线通信设备的设备标识,配置目标无线通信设备的目标主题,配置好的目标无线通信设备的目标主题之后,云端会等待网关向云端发起对目标主题的订阅请求,在网关订阅上述目标主题之后,网关通过上述目标主题能获取云端想要发送至目标无线通信设备的信息。In S203 of the embodiment of the present application, the target topic of the target wireless communication device is configured according to the device identification of the target wireless communication device. After the target topic of the target wireless communication device is configured, the cloud will wait for the gateway to initiate a subscription request to the cloud for the target topic. After the gateway subscribes to the above target topic, the gateway can obtain the information that the cloud wants to send to the target wireless communication device through the above target topic.

在本申请实施例中,云端在为目标无线通信设备分配设备密钥后,需要安全地将设备密钥传输给设备,因此,云端会在设备注册时选择一个预设加密通道,用于传输设备密钥和设备标识给目标无线通信设备,预设加密通道可以是安全的通信协议。例如使用HTTPS(超文本传输安全协议,Hypertext Transfer Protocol Secure)或TLS(传输层安全性协议,Transport Layer Security)进行设备密钥传输。In the embodiment of the present application, after the cloud allocates a device key to the target wireless communication device, it needs to securely transmit the device key to the device. Therefore, the cloud will select a preset encryption channel when the device is registered to transmit the device key and the device identifier to the target wireless communication device. The preset encryption channel can be a secure communication protocol. For example, HTTPS (Hypertext Transfer Protocol Secure) or TLS (Transport Layer Security) is used to transmit the device key.

在本申请实施例的S204中,设备密钥在传输过程中会被加密,防止中间人攻击和窃听,加密后的设备密钥和设备标识通过预设加密通道被传输至目标无线通信设备。In S204 of the embodiment of the present application, the device key will be encrypted during the transmission process to prevent man-in-the-middle attacks and eavesdropping, and the encrypted device key and device identification are transmitted to the target wireless communication device through a preset encryption channel.

在上述方案中,在接收到目标无线通信设备发送的注册请求之后,会根据注册请求中携带的产品标识和产品密钥确定目标无线通信设备是否允许进行注册,在第一列表中记录有产品标识和对应的产品密钥时,则说明无线通信设备已通过合法性等相关验证,允许注册,因此,为目标无线通信设备分配唯一设备标识和设备密钥,并根据设备标识配置目标无线通信设备的目标主题,最后通过预设加密通道向目标无线通信设备发送设备标识和密钥,通过产品标识和产品密钥的检验,保证了只有允许注册的无线通信设备才能进行注册,避免了与不合规的无线通信设备进行交互,并且在发送分配的设备标识和设备密钥时,通过预设加密通道进行传输,以使得用于转发信息的网关不参与设备密钥的传输,提高了云端与无线通信设备进行信息交互的安全性。In the above scheme, after receiving the registration request sent by the target wireless communication device, it is determined whether the target wireless communication device is allowed to register based on the product identification and product key carried in the registration request. When the product identification and the corresponding product key are recorded in the first list, it means that the wireless communication device has passed the relevant verification such as legality and is allowed to register. Therefore, a unique device identification and device key are assigned to the target wireless communication device, and the target subject of the target wireless communication device is configured according to the device identification. Finally, the device identification and key are sent to the target wireless communication device through a preset encrypted channel. Through the inspection of the product identification and product key, it is ensured that only wireless communication devices that are allowed to register can register, avoiding interaction with non-compliant wireless communication devices. When sending the assigned device identification and device key, they are transmitted through the preset encrypted channel so that the gateway used to forward information does not participate in the transmission of the device key, thereby improving the security of information interaction between the cloud and the wireless communication device.

在上述各实施例的基础上,作为一种可选实施例,向目标主题发布加密后的第一指令和下行属性数据,以使得网关确定加密后的第一指令携带下行属性数据时,向目标主题对应的目标无线通信设备转发加密后的第一指令;其中,下行属性数据用于指示网关向无线通信设备发送指令。Based on the above embodiments, as an optional embodiment, an encrypted first instruction and downlink attribute data are published to a target subject, so that when the gateway determines that the encrypted first instruction carries the downlink attribute data, the encrypted first instruction is forwarded to the target wireless communication device corresponding to the target subject; wherein the downlink attribute data is used to instruct the gateway to send instructions to the wireless communication device.

在本申请实施例中,下行属性数据属于透传属性,是设备物模型中的一个属性,下行属性数据是云端用来向无线通信设备发送指令或者控制信息的属性,当网关确定接收的信息携带有下行属性数据时,网关就知道此时要将接收到信息发送至设备。In the embodiment of the present application, the downlink attribute data belongs to the transparent transmission attribute and is an attribute in the device object model. The downlink attribute data is an attribute used by the cloud to send instructions or control information to the wireless communication device. When the gateway determines that the received information carries downlink attribute data, the gateway knows that the received information must be sent to the device at this time.

在本申请实施例中,云端向目标主题发送加密后的第一指令和下行属性数据,网关发布在订阅的目标主题中的加密后的第一指令和下行属性数据后,根据下行属性数据确定要将加密后的第一指令下发至无线通信设备,根据目标主题对应的设备标识,确定接收加密后的第一指令的目标无线通信设备,然后直接将加密后的第一指令发送至目标无线通信设备。In an embodiment of the present application, the cloud sends an encrypted first instruction and downlink attribute data to the target topic. After the gateway publishes the encrypted first instruction and downlink attribute data in the subscribed target topic, it determines to send the encrypted first instruction to the wireless communication device based on the downlink attribute data, determines the target wireless communication device to receive the encrypted first instruction based on the device identifier corresponding to the target topic, and then directly sends the encrypted first instruction to the target wireless communication device.

在上述方案中,在云端向目标主题发布加密后的第一指令时,还会携带下行属性数据,以使得网关在订阅的主题接收到信息时,根据下行属性数据能确定需要将加密后的第一指令发送至对应的目标无线通信设备,保证了云端与无线通信设备信息交互的及时性和准确性。In the above scheme, when the cloud publishes the encrypted first instruction to the target topic, it will also carry downlink attribute data, so that when the gateway receives information from the subscribed topic, it can determine the need to send the encrypted first instruction to the corresponding target wireless communication device based on the downlink attribute data, thereby ensuring the timeliness and accuracy of information interaction between the cloud and the wireless communication device.

在上述各实施例的基础上,作为一种可选实施例,第一指令包括:业务标识和指令序号;业务标识用于区分不同的业务,指令序号用于区分同一业务的不同指令。Based on the above embodiments, as an optional embodiment, the first instruction includes: a service identifier and an instruction serial number; the service identifier is used to distinguish different services, and the instruction serial number is used to distinguish different instructions for the same service.

在本申请实施例中,无线通信设备与云端之间的交互信息均为蓝牙模组透传业务协议数据格式,如图4所示,交互信息的格式由4+N字节组成,第一个字节为同步头,第二个字节用于表示设备类型,第三个字节用于表示加密类型,第四个字节用于表示消息体长度,第4+n字节用于表示具体命令(指令)和消息内容,第5+N字节由校验和组成。In the embodiment of the present application, the interactive information between the wireless communication device and the cloud is in the Bluetooth module transparent transmission service protocol data format, as shown in Figure 4, the format of the interactive information consists of 4+N bytes, the first byte is the synchronization header, the second byte is used to indicate the device type, the third byte is used to indicate the encryption type, the fourth byte is used to indicate the message body length, the 4th+n bytes are used to indicate the specific command (instruction) and message content, and the 5th+N bytes are composed of a checksum.

在本申请实施例中,第一指令包括业务标识,业务标识用于区分不同的业务,例如业务标识A用于表征温度调节业务,业务标识B表征摄像头启用业务,通过不同的业务标识可以确定当前云端指示无线通信设备所执行的业务。In an embodiment of the present application, the first instruction includes a service identifier, which is used to distinguish different services. For example, service identifier A is used to represent the temperature adjustment service, and service identifier B represents the camera activation service. Different service identifiers can be used to determine the service that the cloud currently instructs the wireless communication device to perform.

在本申请实施例中,第一指令中包括指令序号,指令需要用于区分同一业务的不同指令,例如当前需要批量的添加指纹,那么就需要对上述添加指纹业务中的每一次指纹添加进行区分,因此通过指令序号来让无线通信设备对不同的指纹添加进行区分。In an embodiment of the present application, the first instruction includes an instruction serial number, and the instruction needs to be used to distinguish different instructions for the same service. For example, if fingerprints need to be added in batches, then each fingerprint addition in the above-mentioned fingerprint adding service needs to be distinguished. Therefore, the instruction serial number is used to allow the wireless communication device to distinguish different fingerprint additions.

在一个例子中,业务标识为0XA4,对应的功能为下发WiFi信息,通讯方向为云端到网关,下行的第一指令的数据注解为:同步头-设备类型、加密类型-消息体长度-业务标识-WiFi账号长度-WiFi账号-密码长度-密码内容-校验和,相应的上行回复数据为同步头-设备类型-加密类型-消息体长度-业务标识-结果-校验和。In an example, the business identifier is 0XA4, the corresponding function is to send WiFi information, the communication direction is from the cloud to the gateway, and the data annotation of the first downstream instruction is: synchronization header-device type, encryption type-message body length-business identifier-WiFi account length-WiFi account-password length-password content-checksum, and the corresponding uplink reply data is synchronization header-device type-encryption type-message body length-business identifier-result-checksum.

在一个例子中,指纹添加业务对应的业务标识为C,现在需要批量对5个人的指纹进行添加,分别生成了三个第一个指令,按照时间顺序,生成的第一个第一指令中的业务标识为C,指令序号为1、生成的第二个第一指令中的业务标识为C,指令序号为2,生成的第三个第一指令的业务标识为C,指令序号为3,以使得目标无线通信设备接收到同一业务的第一指令时,也能根据指令序号对不同的第一指令进行区分。In an example, the service identifier corresponding to the fingerprint adding service is C. Now the fingerprints of 5 people need to be added in batches, and three first instructions are generated respectively. In chronological order, the service identifier in the first first instruction generated is C, and the instruction sequence number is 1, the service identifier in the second first instruction generated is C, and the instruction sequence number is 2, and the service identifier of the third first instruction generated is C, and the instruction sequence number is 3, so that when the target wireless communication device receives the first instruction of the same service, it can also distinguish different first instructions according to the instruction sequence number.

在上述方案中,发送至目标无线通信设备的第一指令中,有用于区分业务的业务标识,以使得解析第一指令的无线通信设备能执行准确的操作,并且由于第一指令还包括指令序号,也保证了在某一时刻指示无线通信设备多次执行同一业务时,也能对下发的第一指令进行区分。In the above scheme, the first instruction sent to the target wireless communication device contains a service identifier for distinguishing the service, so that the wireless communication device that parses the first instruction can perform accurate operations, and because the first instruction also includes an instruction serial number, it is also ensured that when the wireless communication device is instructed to execute the same service multiple times at a certain moment, the issued first instruction can also be distinguished.

在本申请实施例中,由于第一指令下发后需要接收无线通信设备返回的回复信息来确认第一指令的执行情况,例如当同一个指令下发两次时,通常情况的流程为下发指令,接收回复,下发指令,接收回复,即当一个指令处理完成且情况具体执行情况之后,才会再下发指令,然而在本申请中,使用了指令序号来对让下发的指令信息携带唯一指令序号标识,从而可以在还没接收到第一个指令的回复的情况下,继续下发第二个指令,让云端能够异步处理数据,加快了数据的处理速度。In an embodiment of the present application, after the first instruction is issued, it is necessary to receive a reply message returned by the wireless communication device to confirm the execution status of the first instruction. For example, when the same instruction is issued twice, the normal process is to issue an instruction, receive a reply, issue an instruction, and receive a reply. That is, when an instruction is processed and the specific execution status is completed, the instruction will be issued again. However, in the present application, the instruction serial number is used to allow the issued instruction information to carry a unique instruction serial number identification, so that the second instruction can be issued before receiving a reply to the first instruction, so that the cloud can process data asynchronously, thereby speeding up the data processing speed.

在上述各实施例的基础上,作为一种可选实施例,确定网关可订阅的主题的方法如图5所示,具体内容包括:Based on the above embodiments, as an optional embodiment, a method for determining a topic that a gateway can subscribe to is shown in FIG5 , and the specific contents include:

S301,周期性获取各网关绑定的设备组的设备组标识以及各网关采集的各无线通信设备的广播信息;广播信息包括相应无线通信设备的设备标识、信号强度和相应无线通信设备绑定的设备组的设备组标识;S301, periodically obtaining the device group identifier of the device group bound to each gateway and the broadcast information of each wireless communication device collected by each gateway; the broadcast information includes the device identifier of the corresponding wireless communication device, the signal strength and the device group identifier of the device group bound to the corresponding wireless communication device;

S302,对于每个周期,根据各网关绑定的设备组的设备组标识,结合各无线通信设备绑定的设备组的设备组标识,确定各个无线通信设备在当前周期对应的参考网关,每个无线通信设备与对应的参考网关绑定相同的设备组标识;S302, for each cycle, according to the device group identifier of the device group bound to each gateway, combined with the device group identifier of the device group bound to each wireless communication device, determine the reference gateway corresponding to each wireless communication device in the current cycle, and each wireless communication device is bound to the same device group identifier as the corresponding reference gateway;

S303,对于每个周期,根据各参考网关采集的无线通信设备的当前周期的信号强度,将最大信号强度对应的参考网关作为无线通信设备当前周期对应的目标网关,并在目标网关对应的当前周期的可控信息列表中记录无线通信设备的设备标识;可控信息列表用于记录网关可连接设备的设备标识;S303, for each cycle, based on the signal strength of the current cycle of the wireless communication device collected by each reference gateway, the reference gateway corresponding to the maximum signal strength is used as the target gateway corresponding to the current cycle of the wireless communication device, and the device identification of the wireless communication device is recorded in the controllable information list of the current cycle corresponding to the target gateway; the controllable information list is used to record the device identification of the device that the gateway can connect to;

S304,对于每个目标网关,若目标网关对应的当前周期的可控信息列表与上一周期的可控信息列表不一致,则向目标网关发送对应的当前周期的可控信息列表,以使得网关根据当前周期的可控信息列表向云端发送各可连接设备对应主题的订阅请求;S304: For each target gateway, if the controllable information list of the current cycle corresponding to the target gateway is inconsistent with the controllable information list of the previous cycle, the corresponding controllable information list of the current cycle is sent to the target gateway, so that the gateway sends a subscription request for the corresponding topic of each connectable device to the cloud according to the controllable information list of the current cycle;

S305,接收网关发送的主题订阅请求;主题订阅请求中包括设备标识;S305, receiving a topic subscription request sent by the gateway; the topic subscription request includes a device identifier;

S306,若网关对应的当前周期的可控信息列表中记录有设备标识,则向网关返回订阅成功信息。S306: If the device identifier is recorded in the controllable information list of the current period corresponding to the gateway, a subscription success message is returned to the gateway.

在本申请实施例中,本申请实施例的广播信息可以包括无线通信设备的设备标识、信号强度和无线通信设备绑定的设备组的设备组标识中的至少一者。In the embodiment of the present application, the broadcast information of the embodiment of the present application may include at least one of a device identification of the wireless communication device, a signal strength, and a device group identification of a device group to which the wireless communication device is bound.

在本申请实施例中,广播信息中的信号强度是指网关接收到无线通信设备时的信号强度,信号强度用于评估设备之间的连接质量,无线通信设备的信号强度可以用来帮助云端选择无线通信设备的最佳网关,以提供最佳的无线连接。In an embodiment of the present application, the signal strength in the broadcast information refers to the signal strength when the gateway receives the wireless communication device. The signal strength is used to evaluate the connection quality between devices. The signal strength of the wireless communication device can be used to help the cloud select the best gateway for the wireless communication device to provide the best wireless connection.

在本申请实施例中,无线通信设备绑定的设备组的设备组标识,设备组是对不同无线通信设备的分类,属于同一设备组的无线通信设备指的是同一类的无线通信设备,例如,可以根据无线通信设备的生产商来进行划分,那么同一生产商的无线通信设备属于同一设备组,拥有相同的设备组标识,确定各网关绑定的设备组的设备组标识,即确定各网关的所属设备组。In an embodiment of the present application, the device group identifier of the device group to which the wireless communication device is bound, the device group is a classification of different wireless communication devices, and the wireless communication devices belonging to the same device group refer to the same type of wireless communication devices. For example, the wireless communication devices can be divided according to the manufacturer of the wireless communication devices. Then, the wireless communication devices of the same manufacturer belong to the same device group and have the same device group identifier. The device group identifier of the device group to which each gateway is bound is determined, that is, the device group to which each gateway belongs is determined.

在本申请实施例中,无线通信设备在网关的广播信息扫描范围内,网关就能扫描到无线通信设备的广播信息,因此,网关与无线通信设备之间只要在广播信息可扫描范围内,不同的网关可以接收到同一无线通信设备广播的广播信息。In an embodiment of the present application, when the wireless communication device is within the broadcast information scanning range of the gateway, the gateway can scan the broadcast information of the wireless communication device. Therefore, as long as the gateway and the wireless communication device are within the broadcast information scanning range, different gateways can receive the broadcast information broadcast by the same wireless communication device.

在本申请实施例中,云端接收各网关采集的各无线通信设备的广播信息,由于同一无线通信设备的广播信息会被不同网关扫描到,且不同的网关所处的位置不同,那么不同的网关扫描到的同一广播信息中的信号强度均不相同,云端通过接收网关上传的无线通信设备的广播信息,可以了解无线通信设备所属的分类、无线通信设备与扫描到的网关之间的信号强度。In an embodiment of the present application, the cloud receives broadcast information of each wireless communication device collected by each gateway. Since the broadcast information of the same wireless communication device will be scanned by different gateways and different gateways are located at different locations, the signal strengths in the same broadcast information scanned by different gateways are different. By receiving the broadcast information of the wireless communication device uploaded by the gateway, the cloud can understand the category of the wireless communication device and the signal strength between the wireless communication device and the scanned gateway.

在本申请实施例中,网关会周期性扫描无线通信设备,从而获取到无线通信设备的广播信息并上传至云端,相应的,云端周期性接收各网关上传的各无线通信设备的广播信息,从而根据最新的广播信息对网关的可连接无线通信设备进行调整。In an embodiment of the present application, the gateway periodically scans the wireless communication devices to obtain the broadcast information of the wireless communication devices and upload it to the cloud. Correspondingly, the cloud periodically receives the broadcast information of each wireless communication device uploaded by each gateway, thereby adjusting the gateway's connectable wireless communication devices according to the latest broadcast information.

在本申请实施例的S301中,云端周期性获取各网关绑定的设备组的设备组标识和各网关采集的各无线通信设备的广播信息,根据获取的上述信息可以及时的对网关的可连接设备进行调整。In S301 of the embodiment of the present application, the cloud periodically obtains the device group identifier of the device group bound to each gateway and the broadcast information of each wireless communication device collected by each gateway, and the connectable devices of the gateway can be adjusted in time according to the above information obtained.

在本申请实施例的S302中,在每个周期获取到广播信息后,根据各网关的设备组标识和各无线通信设备的设备组标识,确定与无线通信设备的设备组标识一致的网关,即确定各无线通信设备对应的参考网关。In S302 of the embodiment of the present application, after the broadcast information is obtained in each cycle, the gateway consistent with the device group identifier of the wireless communication device is determined according to the device group identifier of each gateway and the device group identifier of each wireless communication device, that is, the reference gateway corresponding to each wireless communication device is determined.

在一个例子中,网关A、网关B和网关C均上传了无线通信设备的广播信息,网关A、网关B和网关C绑定的设备组的设备组标识分别为S1、S2和S1,通过解析广播信息得到无线通信设备绑定的设备组的设备组标识为S1,那么可以确定无线通信设备对应的参考网关为网关A和网关C。In an example, gateway A, gateway B and gateway C all upload broadcast information of wireless communication devices. The device group identifiers of the device groups bound to gateway A, gateway B and gateway C are S1, S2 and S1 respectively. By parsing the broadcast information, the device group identifier of the device group bound to the wireless communication device is S1. Then, it can be determined that the reference gateways corresponding to the wireless communication devices are gateway A and gateway C.

在本申请实施例的S303中,由于同一无线通信设备可能存在多个对应的参考网关,因此,根据各参考网关上传的广播信息中的信号强度,确定与无线通信设备之间信号强度最强的网关作为目标网关,以使得目标网关在无线通信设备需要进行信息交互时,目标网关能与无线通信设备进行蓝牙连接;确定了各无线通信设备的目标网关之后,将无线通信设备的设备标识记录在目标网关的可控信息列表中,从而可以根据记录了设备标识的可控信息列表可以确定各网关当前周期可连接的所有无线通信设备。In S303 of the embodiment of the present application, since there may be multiple corresponding reference gateways for the same wireless communication device, the gateway with the strongest signal strength with the wireless communication device is determined as the target gateway based on the signal strength in the broadcast information uploaded by each reference gateway, so that when the wireless communication device needs to interact with information, the target gateway can establish a Bluetooth connection with the wireless communication device; after determining the target gateway for each wireless communication device, the device identification of the wireless communication device is recorded in the controllable information list of the target gateway, so that all wireless communication devices that can be connected to each gateway in the current period can be determined based on the controllable information list that records the device identification.

在本申请实施例的S304中,由于每个周期都会生成一个可控信息列表,因此,若目标网关对应的当前周期的可控信息列表与上一周期的可控信息列表不一致,说明目标网关当前周期可连接的无线通信设备发生了变化,目标网关需要按照当前周期的可控信息列表与无线通信设备进行连接,并且还需要根据当前周期的可控信息列表项云端发送可连接设备对应主题的订阅请求,因此,向目标网关发送对应的当前周期的可控信息列表。In S304 of the embodiment of the present application, since a controllable information list is generated in each cycle, if the controllable information list of the current cycle corresponding to the target gateway is inconsistent with the controllable information list of the previous cycle, it means that the wireless communication device that can be connected to the target gateway in the current cycle has changed. The target gateway needs to connect to the wireless communication device according to the controllable information list of the current cycle, and also needs to send a subscription request for the corresponding topic of the connectable device to the cloud according to the controllable information list item of the current cycle. Therefore, the corresponding controllable information list of the current cycle is sent to the target gateway.

在本申请实施例的S305中,由于网关收到当前周期的可控信息列表后,会确定可控信息列表中是否存在自己没有订阅的无线通信设备对应的主题,若存在,那么需要及时向云端发起上述无线通信设备对应主题的主题订阅请求,避免无法及时接收到云端发送至上述无线通信设备的交互信息,因此,云端会接收到网关发送的包含无线通信设备的设备标识主题订阅请求。In S305 of the embodiment of the present application, after the gateway receives the controllable information list of the current period, it will determine whether there is a topic corresponding to the wireless communication device to which it has not subscribed in the controllable information list. If so, it is necessary to promptly initiate a topic subscription request for the topic corresponding to the above-mentioned wireless communication device to the cloud to avoid failure to promptly receive the interactive information sent by the cloud to the above-mentioned wireless communication device. Therefore, the cloud will receive the topic subscription request containing the device identification of the wireless communication device sent by the gateway.

在本申请实施例的S306中,为了避免网关订阅到无法进行连接的无线通信设备的主题,云端确定网关对应的当前周期的可控信息列表中是否存储有主题订阅请求中携带的设备标识,若有,则说明可以允许网关订阅对应的主题,因此,通过网关的主题订阅请求,并向网关返回订阅成功信息。In S306 of the embodiment of the present application, in order to prevent the gateway from subscribing to the topic of a wireless communication device that cannot be connected, the cloud determines whether the device identifier carried in the topic subscription request is stored in the controllable information list of the current period corresponding to the gateway. If so, it means that the gateway can be allowed to subscribe to the corresponding topic. Therefore, the topic subscription request of the gateway is passed, and the subscription success information is returned to the gateway.

在上述方案中,通过接收各网关上报的各无线通信设备的广播信息,可以动态的对各网关可连接的无线通信设备进行更新,根据网关预先绑定的设备组的设备组标识,以及网关上报的无线通信设备预先绑定的设备组的设备组标识,将设备组标识一致的网关作为无线通信设备的参考网关,由于无线通信设备的广播信息可能同时被多个网关上报,因此,选择接收的广播信息中信号强度最大的网关,作为无线通信设备的目标网关,即可连接的网关,并将无线通信设备的设备标识写入可控信息列表,从而可以得到各网关对应的当前周期的可连接设备,在当前周期可控信息列表与上一周期可控信息列表不一致时,说明当前需要订阅的无线通信设备的主题发生了改变,因此,将可控信息列表发送到网关,以使得网关根据可控信息列表向云端发起可连接设备的主题订阅请求,保证网关能及时获取云端针对可连接设备发送的指令,并转发至对应的无线通信设备。实现了动态的对可控信息列表进行调整,并且网关能根据最新可控信息列表订阅主题。In the above scheme, by receiving the broadcast information of each wireless communication device reported by each gateway, the wireless communication devices that can be connected to each gateway can be dynamically updated. According to the device group identifier of the device group pre-bound by the gateway and the device group identifier of the device group pre-bound by the wireless communication device reported by the gateway, the gateway with the same device group identifier is used as the reference gateway of the wireless communication device. Since the broadcast information of the wireless communication device may be reported by multiple gateways at the same time, the gateway with the largest signal strength in the received broadcast information is selected as the target gateway of the wireless communication device, that is, the connectable gateway, and the device identifier of the wireless communication device is written into the controllable information list, so that the connectable devices of the current period corresponding to each gateway can be obtained. When the controllable information list of the current period is inconsistent with the controllable information list of the previous period, it means that the topic of the wireless communication device that needs to be subscribed has changed. Therefore, the controllable information list is sent to the gateway, so that the gateway initiates a topic subscription request for the connectable device to the cloud according to the controllable information list, ensuring that the gateway can timely obtain the instructions sent by the cloud for the connectable device and forward them to the corresponding wireless communication device. The controllable information list is dynamically adjusted, and the gateway can subscribe to the topic according to the latest controllable information list.

本申请实施例中提供了一种信息交互方法,应用于无线通信设备,如图6所示,该方法包括:An information interaction method is provided in an embodiment of the present application and is applied to a wireless communication device. As shown in FIG6 , the method includes:

S401,接收网关转发的由云端发送的加密后的第一指令。S401, receiving the encrypted first instruction sent by the cloud and forwarded by the gateway.

在本申请实施例中,加密后的第一指令为云端根据无线通信设备的设备密钥和预设加密算法对第一指令进行加密得到的,设备密钥为无线通信设备在云端注册时确定的。In an embodiment of the present application, the encrypted first instruction is obtained by encrypting the first instruction in the cloud according to the device key of the wireless communication device and a preset encryption algorithm, and the device key is determined when the wireless communication device is registered in the cloud.

在本申请实施例中,设备密钥和设备标识为目标无线通信设备在云端注册时确定的;在无线通信设备在云端进行注册时,会被分配一个设备标识,用于云端识别和区分不同的设备,通常是一个字符串或数字,由云端生成,并在无线通信设备注册时分配给无线通信设备,设备密钥是一个用于认证和加密的机密信息,由云端生成并分配给设备,用于确保只有知道密钥的无线通信设备可以与云端进行通信和交互,使用设备密钥对设备和平台之间的通信进行加密,保护数据的隐私和完整性。In an embodiment of the present application, the device key and device identifier are determined when the target wireless communication device is registered in the cloud; when the wireless communication device is registered in the cloud, a device identifier is assigned to the cloud for identifying and distinguishing different devices, which is usually a string or number generated by the cloud and assigned to the wireless communication device when the wireless communication device is registered. The device key is confidential information used for authentication and encryption, generated by the cloud and assigned to the device, to ensure that only wireless communication devices that know the key can communicate and interact with the cloud, and use the device key to encrypt communications between the device and the platform to protect the privacy and integrity of the data.

在本申请实施例中,网关接收到云端发布的加密后的第一指令后,将接收的加密后的第一指令转发至无线通信设备,从而无线通信设备接收网关转发的加密后的第一指令。In an embodiment of the present application, after receiving the encrypted first instruction issued by the cloud, the gateway forwards the received encrypted first instruction to the wireless communication device, so that the wireless communication device receives the encrypted first instruction forwarded by the gateway.

S402,根据本地缓存的设备密钥对加密后的第一指令进行解密,获得第一指令。S402: Decrypt the encrypted first instruction according to the locally cached device key to obtain the first instruction.

在本申请实施例中,由于加密后的第一指令是云端根据分配至无线通信设备的设备密钥加密得到的,因此,无线通信设备根据注册时云端返回的设备标识对加密后的第一指令进行解密,得到第一指令。In an embodiment of the present application, since the encrypted first instruction is encrypted by the cloud according to the device key assigned to the wireless communication device, the wireless communication device decrypts the encrypted first instruction according to the device identifier returned by the cloud during registration to obtain the first instruction.

S403,在根据第一指令执行相应的第一操作后,通过网关向云端发送第一响应信息。S403: After executing the corresponding first operation according to the first instruction, sending a first response message to the cloud through the gateway.

在本申请实施中,第一响应信息用于指示设备已完成第一指令相应的第一操作。In the implementation of the present application, the first response information is used to indicate that the device has completed the first operation corresponding to the first instruction.

在本申请实施例中第一指令是用于指示目标无线通信设备执行相应的第一操作的指令,例如控制温度的指令、调节高度的指令、调节灯光的指令等;第一操作是指根据第一指令的指示,无线通信设备相应执行的操作,例如第一指令为将温度调至20°的指令,那么相应的第一操作为无线通信设备将当前温度调整至20°。In the embodiment of the present application, the first instruction is an instruction for instructing the target wireless communication device to perform a corresponding first operation, such as an instruction for controlling the temperature, an instruction for adjusting the height, an instruction for adjusting the light, etc.; the first operation refers to the operation performed by the wireless communication device according to the instruction of the first instruction. For example, the first instruction is an instruction to adjust the temperature to 20°, then the corresponding first operation is that the wireless communication device adjusts the current temperature to 20°.

在本申请实施例中,无线通信设备根据第一指令执行相应的第一操作,在完成第一操作后,通过网关向云端发送第一响应信息,第一响应信息是为了告知云端当前已完成第一指令对应的第一操作。In an embodiment of the present application, the wireless communication device executes a corresponding first operation according to a first instruction, and after completing the first operation, sends a first response message to the cloud through a gateway. The first response message is to inform the cloud that the first operation corresponding to the first instruction has been completed.

本申请实施例提供的应用于无线通信设备的信息交互方法,通过接收加密后的第一指令,根据在云端注册时云端分配的设备密钥对加密后的第一指令进行解密,从而可以获得第一指令,实现了只有分配了相应设备密钥的无线通信设备才能对加密后的第一指令进行解密,保证了第一指令在信息传输过程中的安全。,并且在根据第一指令执行相应的操作后,通过网关发送第一响应信息,让云端及时了解指令的执行情况。The information interaction method applied to the wireless communication device provided in the embodiment of the present application receives the encrypted first instruction, and decrypts the encrypted first instruction according to the device key assigned by the cloud when registering in the cloud, so as to obtain the first instruction, so that only the wireless communication device assigned the corresponding device key can decrypt the encrypted first instruction, and ensure the security of the first instruction during the information transmission process. After executing the corresponding operation according to the first instruction, the first response information is sent through the gateway, so that the cloud can timely understand the execution status of the instruction.

在上述各实施例的基础上,作为一种可选实施例,接收网关转发的由云端发送的加密后的第一指令之前,无线通信设备首次启动时,通过串口读取烧录在无线通信设备上的产品标识和对应的产品密钥;通过网关向云端发送注册请求,以使得云端在接收注册请求后,若确定第一列表中记录有产品标识和对应的产品密钥,则根据预设生成方法生成并存储无线通信设备的设备标识和设备密钥;注册请求包括产品标识和对应的产品密钥;接收云端通过预设加密通道发送的设备标识和设备密钥。On the basis of the above embodiments, as an optional embodiment, before receiving the encrypted first instruction sent by the cloud and forwarded by the gateway, when the wireless communication device is started for the first time, the product identification and the corresponding product key burned on the wireless communication device are read through the serial port; a registration request is sent to the cloud through the gateway, so that after the cloud receives the registration request, if it determines that the product identification and the corresponding product key are recorded in the first list, the device identification and device key of the wireless communication device are generated and stored according to a preset generation method; the registration request includes the product identification and the corresponding product key; and the device identification and device key sent by the cloud through a preset encrypted channel are received.

在本申请实施例中,无线通信设备在使用之前,需要在云端进行注册,无线通信设备再向云端发送注册请求之前,通过串口获取烧录在无线通信设备上的产品标识和对应的产品密钥,产品标识用于标识同一型号的无线通信设备,产品密钥用于在注册时进行身份验证,产品标识和产品密钥通常由无线通信设备的生产商提供。In an embodiment of the present application, the wireless communication device needs to be registered in the cloud before use. Before the wireless communication device sends a registration request to the cloud, it obtains the product identification and the corresponding product key burned on the wireless communication device through the serial port. The product identification is used to identify wireless communication devices of the same model, and the product key is used for identity authentication during registration. The product identification and product key are usually provided by the manufacturer of the wireless communication device.

在本申请实施例中,无线通信设备向网关发送携带产品标识和产品密钥的注册请求,网关接收到无线通信设备发送的注册请求后,直接将注册请求转发至云端,云端在接收到注册请求之后,云端若确定第一列表中存在目标无线通信设备的产品标识和产品密钥,说明目标无线通信设备所属型号的设备允许在云端注册,因此允许目标无线通信设备在云端进行注册,云端为目标无线通信设备分配设备标识和设备密钥,并建立设备标识和设备密钥的映射关系。In an embodiment of the present application, the wireless communication device sends a registration request carrying a product identification and a product key to the gateway. After receiving the registration request sent by the wireless communication device, the gateway directly forwards the registration request to the cloud. After receiving the registration request, if the cloud determines that the product identification and product key of the target wireless communication device exist in the first list, it means that the device model of the target wireless communication device is allowed to be registered in the cloud. Therefore, the target wireless communication device is allowed to register in the cloud. The cloud assigns a device identification and a device key to the target wireless communication device, and establishes a mapping relationship between the device identification and the device key.

在上述方案中,无线通信设备在发起注册请求时,通过串口获取烧录在设备上的产品标识和产品密钥,并同注册请求一起发送至云端,供云端能根据烧录的产品标识和产品密钥确认设备的合法性,从而完成设备在云端的注册,并分配到相应的设备标识和设备密钥,从而能够在后续通过密钥对与云端之间进行信息交互的内容进行加密和解密,提高信息交互的安全性。In the above scheme, when the wireless communication device initiates a registration request, it obtains the product identification and product key burned on the device through the serial port, and sends them to the cloud together with the registration request, so that the cloud can confirm the legitimacy of the device based on the burned product identification and product key, thereby completing the registration of the device in the cloud and allocating the corresponding device identification and device key, so that the content of information exchange between the device and the cloud can be encrypted and decrypted through the key in the future, thereby improving the security of information interaction.

在上述各实施例的基础上,作为一种可选实施例,接收云端通过预设加密通道发送的设备标识和设备密钥之后,确定上行信息,通过预设加密算法和设备标识对上行信息进行加密;向网关发送加密后的上行信息和上行属性数据,以使得网关接收加密后的上行信息和上行属性数据后,将加密后的上行信息发送至云端;上行属性数据用于指示网关向云端发送信息。Based on the above embodiments, as an optional embodiment, after receiving the device identification and device key sent by the cloud through a preset encryption channel, the uplink information is determined, and the uplink information is encrypted by a preset encryption algorithm and the device identification; the encrypted uplink information and uplink attribute data are sent to the gateway, so that after the gateway receives the encrypted uplink information and the uplink attribute data, the encrypted uplink information is sent to the cloud; the uplink attribute data is used to instruct the gateway to send information to the cloud.

在本申请实施例中,无线通信设备向云端发送的信息均称为上行信息,无线通信设备可以通过对称加密算法和设备密钥对上行信息进行加密,例如使用AES ECB Zero128bits加密算法和设备密钥对上行信息进行加密。In the embodiment of the present application, the information sent by the wireless communication device to the cloud is called uplink information. The wireless communication device can encrypt the uplink information using a symmetric encryption algorithm and a device key, for example, using an AES ECB Zero128bits encryption algorithm and a device key to encrypt the uplink information.

在本申请实施例中,上行属性数据属于透传属性,是设备物模型中的一个属性,与下行属性数据作为一对属性使用,上行属性数据是无线通信设备用来向云端发送信息的属性,当网关确定接收的信息携带有上行属性数据时,网关就知道此时要将接收到信息发送至云端。In the embodiment of the present application, the uplink attribute data belongs to the transparent transmission attribute, which is an attribute in the device object model and is used as a pair of attributes with the downlink attribute data. The uplink attribute data is an attribute used by the wireless communication device to send information to the cloud. When the gateway determines that the received information carries the uplink attribute data, the gateway knows that the received information must be sent to the cloud at this time.

在本申请实施例中,无线通信设备向网关发送上行信息和上行属性数据,网关在接收到上行属性数据时,确定此时需要将上行信息发送至云端。In an embodiment of the present application, the wireless communication device sends uplink information and uplink attribute data to the gateway. When the gateway receives the uplink attribute data, it determines that the uplink information needs to be sent to the cloud at this time.

在上述方案中,无线通信设备在接收到云端分配的设备密钥后,设备在需要向云端发送上行信息时,可以先根据设备密钥对上行信息进行加密,然后同上行属性数据一同发送至网关,以使得网关在接收上行属性数据时,确定当前的信息时需要发送之后云端的,从而将加密后的上行信息直接转发至云端不对加密后的第一指令进行任何处理,大大减轻了网关的业务量,也保证了设备与云端之间交互的安全性。In the above scheme, after the wireless communication device receives the device key assigned by the cloud, when the device needs to send uplink information to the cloud, the device can first encrypt the uplink information according to the device key, and then send it to the gateway together with the uplink attribute data, so that when the gateway receives the uplink attribute data, it determines that the current information needs to be sent to the cloud later, and then forwards the encrypted uplink information directly to the cloud without performing any processing on the encrypted first instruction, which greatly reduces the gateway's business volume and ensures the security of the interaction between the device and the cloud.

在本申请实施例中,提供了一种信息交互方法,交互流程示意图,如图7所示,具体内容如下:In an embodiment of the present application, an information interaction method is provided, and a schematic diagram of the interaction process is shown in FIG7 . The specific contents are as follows:

S501、无线通信设备通过网关发送携带产品标识和产品密钥的注册请求;S501, the wireless communication device sends a registration request carrying a product identification and a product key through a gateway;

S502、若确定第一列表中存在无线通信设备的产品标识和产品密钥,则云端生成并存储无线通信设备的产品标识和设备密钥,根据无线通信设备的设备标识,配置无线通信设备的主题;S502: If it is determined that the product identification and product key of the wireless communication device exist in the first list, the cloud generates and stores the product identification and device key of the wireless communication device, and configures the theme of the wireless communication device according to the device identification of the wireless communication device;

S504、云端通过预设加密通道向无线通信设备发送设备标识和设备密钥;S504, the cloud sends the device identification and device key to the wireless communication device through a preset encryption channel;

S505、云端确定第一指令、待交互的无线通信设备的设备标识和设备密钥;S505, the cloud determines the first instruction, the device identification and the device key of the wireless communication device to be interacted;

S506、云端根据预设加密算法和设备密钥对第一指令进行加密,获得加密后的第一指令,并将加密后的第一指令与下行属性数据一同发布到无线通信设备对应的主题;S506: The cloud encrypts the first instruction according to a preset encryption algorithm and a device key to obtain the encrypted first instruction, and publishes the encrypted first instruction together with the downlink attribute data to a topic corresponding to the wireless communication device;

S507、网关从订阅的主题中获取加密后的第一指令和下行属性数据;S507, the gateway obtains the encrypted first instruction and downlink attribute data from the subscribed topic;

S508、根据下行属性数据将加密后的第一指令转发到主题对应的无线通信设备;S508, forwarding the encrypted first instruction to the wireless communication device corresponding to the topic according to the downlink attribute data;

S509、无线通信设备根据本地缓存的设备密钥对加密后的第一指令进行解密,获得第一指令;S509, the wireless communication device decrypts the encrypted first instruction according to the locally cached device key to obtain the first instruction;

S510、无线通信设备根据第一指令执行相应的第一操作,在完成第一操作后,生成第一响应信息;S510, the wireless communication device performs a corresponding first operation according to the first instruction, and generates first response information after completing the first operation;

S511、无线通信设备向网关发送第一响应信息;S511, the wireless communication device sends a first response message to the gateway;

S512,网关向云端转发第一响应信息。S512, the gateway forwards the first response information to the cloud.

本申请实施例提供的信息交互方法,网关只作为一个信息的中转站,根据订阅的无线通信设备的主题获取需要下发至无线通信设备的加密后的第一指令,然后直接将信息转发至对应的无线通信设备,不需要解析信息,然后再进行各种业务处理,只需执行转发操作即可,网关职责单一工作量小,并且由于网关只需要对无线通信设备与云端之间的交互信息进行转发,因此,当物联网系统中增加无线通信设备之后,也不需要更改网关的任务代码,只需要在后端完成云端与无线通信设备的指令对接,即可完成开发工作,大大的减少了开发复杂度与开发工作量,另外,由于交互的信息的加密与解密是根据各设备注册时分配的设备密钥执行的,每个设备的设备密钥各不相同,即使一个设备被强行破解,其他设备也不会受到影响,提高了云端与无线通信设备之间信息交互的安全性。In the information interaction method provided in the embodiment of the present application, the gateway only serves as a transfer station for information. It obtains the encrypted first instruction that needs to be sent to the wireless communication device according to the topic of the subscribed wireless communication device, and then directly forwards the information to the corresponding wireless communication device. There is no need to parse the information and then perform various business processing. It only needs to execute the forwarding operation. The gateway has a single responsibility and a small workload. Moreover, since the gateway only needs to forward the interactive information between the wireless communication device and the cloud, when the wireless communication device is added to the Internet of Things system, there is no need to change the task code of the gateway. It is only necessary to complete the command docking between the cloud and the wireless communication device at the back end to complete the development work, which greatly reduces the development complexity and development workload. In addition, since the encryption and decryption of the interactive information are performed according to the device key assigned to each device when it is registered, the device key of each device is different. Even if one device is forcibly cracked, other devices will not be affected, thereby improving the security of information interaction between the cloud and the wireless communication device.

本申请实施例提供了一种云端,如图8所示,该装置80可以包括确定模块801、加密模块802、发布模块803以及第一接收模块804,其中,The embodiment of the present application provides a cloud, as shown in FIG8 , the device 80 may include a determination module 801 , an encryption module 802 , a publishing module 803 and a first receiving module 804 , wherein:

确定模块801,用于确定第一指令、待交互的目标无线通信设备的设备标识和设备密钥;第一指令用于指示目标无线通信设备执行相应的第一操作;A determination module 801 is used to determine a first instruction, a device identification and a device key of a target wireless communication device to be interacted with; the first instruction is used to instruct the target wireless communication device to perform a corresponding first operation;

加密模块802,用于根据预设加密算法和设备密钥对第一指令进行加密;The encryption module 802 is used to encrypt the first instruction according to a preset encryption algorithm and a device key;

发布模块803,用于根据设备标识确定目标无线通信设备对应的目标主题,并向目标主题发布加密后的第一指令,以使得订阅目标主题的网关接收加密后的第一指令,并向目标主题对应的目标无线通信设备转发加密后的第一指令;A publishing module 803 is used to determine a target topic corresponding to a target wireless communication device according to a device identifier, and publish an encrypted first instruction to the target topic, so that a gateway subscribed to the target topic receives the encrypted first instruction and forwards the encrypted first instruction to a target wireless communication device corresponding to the target topic;

第一接收模块804,用于接收网关转发的由目标无线通信设备发送的第一响应信息;第一响应信息是目标无线通信设备根据设备密钥对加密后的第一指令解密成功,并执行第一指令相应的第一操作后发送的;The first receiving module 804 is used to receive the first response information sent by the target wireless communication device and forwarded by the gateway; the first response information is sent by the target wireless communication device after successfully decrypting the encrypted first instruction according to the device key and executing the first operation corresponding to the first instruction;

其中,设备密钥和目标主题均为目标无线通信设备在云端注册时确定的。Among them, the device key and the target subject are both determined when the target wireless communication device is registered in the cloud.

本申请实施例提供了一种无线通信设备,如图9所示,该装置90可以包括第二接收模块901、解密模块902、发送模块903,其中,The embodiment of the present application provides a wireless communication device. As shown in FIG9 , the device 90 may include a second receiving module 901, a decryption module 902, and a sending module 903, wherein:

第二接收模块901,用于接收网关转发的由云端发送的加密后的第一指令;加密后的第一指令为云端根据无线通信设备的设备密钥和预设加密算法对第一指令进行加密得到的,设备密钥为无线通信设备在云端注册时确定的;The second receiving module 901 is used to receive the encrypted first instruction sent by the cloud and forwarded by the gateway; the encrypted first instruction is obtained by the cloud encrypting the first instruction according to the device key of the wireless communication device and a preset encryption algorithm, and the device key is determined when the wireless communication device is registered in the cloud;

解密模块902,用于根据本地缓存的设备密钥对加密后的第一指令进行解密,获得第一指令;A decryption module 902, configured to decrypt the encrypted first instruction according to a locally cached device key to obtain the first instruction;

发送模块903,用于在根据第一指令执行相应的第一操作后,通过网关向云端发送第一响应信息;第一响应信息用于指示设备已完成第一指令相应的第一操作。The sending module 903 is used to send a first response message to the cloud through the gateway after executing the corresponding first operation according to the first instruction; the first response information is used to indicate that the device has completed the first operation corresponding to the first instruction.

本申请实施例中提供了一种电子设备(计算机装置/设备/系统),包括存储器、处理器及存储在存储器上的计算机程序,该处理器执行上述计算机程序以实现信息交互方法的步骤,与相关技术相比可实现。An embodiment of the present application provides an electronic device (computer device/equipment/system), including a memory, a processor, and a computer program stored in the memory, and the processor executes the above-mentioned computer program to implement the steps of the information interaction method, which can be implemented compared with the related art.

在一个可选实施例中提供了一种电子设备,如图10所示,图10所示的电子设备4000包括:处理器4001和存储器4003。其中,处理器4001和存储器4003相连,如通过总线4002相连。可选地,电子设备4000还可以包括收发器4004,收发器4004可以用于该电子设备与其他电子设备之间的数据交互,如数据的发送和/或数据的接收等。需要说明的是,实际应用中收发器4004不限于一个,该电子设备4000的结构并不构成对本申请实施例的限定。In an optional embodiment, an electronic device is provided, as shown in FIG10 , and the electronic device 4000 shown in FIG10 includes: a processor 4001 and a memory 4003. The processor 4001 and the memory 4003 are connected, such as through a bus 4002. Optionally, the electronic device 4000 may also include a transceiver 4004, and the transceiver 4004 may be used for data interaction between the electronic device and other electronic devices, such as data transmission and/or data reception. It should be noted that in actual applications, the transceiver 4004 is not limited to one, and the structure of the electronic device 4000 does not constitute a limitation on the embodiments of the present application.

处理器4001可以是CPU(Central Processing Unit,中央处理器),通用处理器,DSP(Digital Signal Processor,数据信号处理器),ASIC(Application SpecificIntegrated Circuit,专用集成电路),FPGA(Field Programmable Gate Array,现场可编程门阵列)或者其他可编程逻辑器件、晶体管逻辑器件、硬件部件或者其任意组合。其可以实现或执行结合本申请公开内容所描述的各种示例性的逻辑方框,模块和电路。处理器4001也可以是实现计算功能的组合,例如包含一个或多个微处理器组合,DSP和微处理器的组合等。Processor 4001 may be a CPU (Central Processing Unit), a general-purpose processor, a DSP (Digital Signal Processor), an ASIC (Application Specific Integrated Circuit), an FPGA (Field Programmable Gate Array) or other programmable logic devices, transistor logic devices, hardware components or any combination thereof. It may implement or execute various exemplary logic blocks, modules and circuits described in conjunction with the disclosure of this application. Processor 4001 may also be a combination that implements computing functions, such as a combination of one or more microprocessors, a combination of a DSP and a microprocessor, etc.

总线4002可包括一通路,在上述组件之间传送信息。总线4002可以是PCI(Peripheral Component Interconnect,外设部件互连标准)总线或EISA(ExtendedIndustry Standard Architecture,扩展工业标准结构)总线等。总线4002可以分为地址总线、数据总线、控制总线等。为便于表示,图10中仅用一条粗线表示,但并不表示仅有一根总线或一种类型的总线。The bus 4002 may include a path for transmitting information between the above components. The bus 4002 may be a PCI (Peripheral Component Interconnect) bus or an EISA (Extended Industry Standard Architecture) bus. The bus 4002 may be divided into an address bus, a data bus, a control bus, etc. For ease of representation, FIG10 only uses one thick line, but does not mean that there is only one bus or one type of bus.

存储器4003可以是ROM(Read Only Memory,只读存储器)或可存储静态信息和指令的其他类型的静态存储设备,RAM(Random Access Memory,随机存取存储器)或者可存储信息和指令的其他类型的动态存储设备,也可以是EEPROM(Electrically ErasableProgrammable Read Only Memory,电可擦可编程只读存储器)、CD-ROM(Compact DiscRead Only Memory,只读光盘)或其他光盘存储、光碟存储(包括压缩光碟、激光碟、光碟、数字通用光碟、蓝光光碟等)、磁盘存储介质、其他磁存储设备、或者能够用于携带或存储计算机程序并能够由计算机读取的任何其他介质,在此不做限定。The memory 4003 may be a ROM (Read Only Memory) or other types of static storage devices that can store static information and instructions, a RAM (Random Access Memory) or other types of dynamic storage devices that can store information and instructions, or an EEPROM (Electrically Erasable Programmable Read Only Memory), a CD-ROM (Compact Disc Read Only Memory) or other optical disk storage, optical disk storage (including compressed optical disk, laser disk, optical disk, digital versatile disk, Blu-ray disk, etc.), magnetic disk storage media, other magnetic storage devices, or any other medium that can be used to carry or store computer programs and can be read by a computer, without limitation herein.

存储器4003用于存储执行本申请实施例的计算机程序,并由处理器4001来控制执行。处理器4001用于执行存储器4003中存储的计算机程序,以实现前述方法实施例所示的步骤。The memory 4003 is used to store the computer program for executing the embodiment of the present application, and the execution is controlled by the processor 4001. The processor 4001 is used to execute the computer program stored in the memory 4003 to implement the steps shown in the above method embodiment.

其中,电子设备包可以包括但不限于诸如移动电话、笔记本电脑、数字广播接收器、PDA(个人数字助理)、PAD(平板电脑)、PMP(便携式多媒体播放器)、车载终端(例如车载导航终端)等等的移动终端以及诸如数字TV、台式计算机等等的固定终端。图10所示的电子设备仅仅是一个示例,不应对本公开实施例的功能和使用范围带来任何限制。The electronic device package may include but is not limited to mobile terminals such as mobile phones, laptop computers, digital broadcast receivers, PDAs (personal digital assistants), PADs (tablet computers), PMPs (portable multimedia players), vehicle-mounted terminals (such as vehicle-mounted navigation terminals), etc., and fixed terminals such as digital TVs, desktop computers, etc. The electronic device shown in FIG10 is only an example and should not bring any limitation to the functions and scope of use of the embodiments of the present disclosure.

本申请实施例提供了一种计算机可读存储介质,该计算机可读存储介质上存储有计算机程序,计算机程序被处理器执行时可实现前述方法实施例的步骤及相应内容。与现有技术相比可实现:提高了信息交互的安全性,减轻了网关的工作量。The embodiment of the present application provides a computer-readable storage medium, on which a computer program is stored, and when the computer program is executed by a processor, the steps and corresponding contents of the aforementioned method embodiment can be implemented. Compared with the prior art, the following can be achieved: the security of information interaction is improved, and the workload of the gateway is reduced.

需要说明的是,本公开上述的计算机可读介质可以是计算机可读信号介质或者计算机可读介质或者是上述两者的任意组合。计算机可读存储介质例如可以是——但不限于——电、磁、光、电磁、红外线、或半导体的系统、装置或器件,或者任意以上的组合。计算机可读存储介质的更具体的例子可以包括但不限于:具有一个或多个导线的电连接、便携式计算机磁盘、硬盘、随机访问存储器(RAM)、只读存储器(ROM)、可擦式可编程只读存储器(EPROM或闪存)、光纤、便携式紧凑磁盘只读存储器(CD-ROM)、光存储器件、磁存储器件、或者上述的任意合适的组合。在本公开中,计算机可读存储介质可以是任何包含或存储程序的有形介质,该程序可以被指令执行系统、装置或者器件使用或者与其结合使用。而在本公开中,计算机可读信号介质可以包括在基带中或者作为载波一部分传播的数据信号,其中承载了计算机可读的程序代码。这种传播的数据信号可以采用多种形式,包括但不限于电磁信号、光信号或上述的任意合适的组合。计算机可读信号介质还可以是计算机可读存储介质以外的任何计算机可读介质,该计算机可读信号介质可以发送、传播或者传输用于由指令执行系统、装置或者器件使用或者与其结合使用的程序。计算机可读介质上包含的程序代码可以用任何适当的介质传输,包括但不限于:电线、光缆、RF(射频)等等,或者上述的任意合适的组合。It should be noted that the computer-readable medium mentioned above in the present disclosure may be a computer-readable signal medium or a computer-readable medium or any combination of the above two. The computer-readable storage medium may be, for example, but not limited to, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, device or device, or any combination of the above. More specific examples of computer-readable storage media may include, but are not limited to: an electrical connection with one or more wires, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the above. In the present disclosure, a computer-readable storage medium may be any tangible medium containing or storing a program that can be used by or in combination with an instruction execution system, device or device. In the present disclosure, a computer-readable signal medium may include a data signal propagated in a baseband or as part of a carrier wave, which carries a computer-readable program code. This propagated data signal may take a variety of forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination of the above. Computer readable signal media may also be any computer readable medium other than computer readable storage media, which may send, propagate or transmit a program for use by or in conjunction with an instruction execution system, apparatus or device. The program code contained on the computer readable medium may be transmitted using any appropriate medium, including but not limited to: wires, optical cables, RF (radio frequency), etc., or any suitable combination of the above.

本申请实施例还提供了一种计算机程序产品,包括计算机程序,计算机程序被处理器执行时可实现前述方法实施例的步骤及相应内容。与现有技术相比可实现:提高了信息交互的安全性,减轻了网关的工作量。The embodiment of the present application also provides a computer program product, including a computer program, which can implement the steps and corresponding contents of the aforementioned method embodiment when executed by a processor. Compared with the prior art, it can achieve: improving the security of information interaction and reducing the workload of the gateway.

本申请的说明书和权利要求书及上述附图中的术语“第一”、“第二”、“第三”、“第四”、“1”、“2”等(如果存在)是用于区别类似的对象,而不必用于描述特定的顺序或先后次序。应该理解这样使用的数据在适当情况下可以互换,以便这里描述的本申请的实施例能够以除图示或文字描述以外的顺序实施。The terms "first", "second", "third", "fourth", "1", "2", etc. (if any) in the specification and claims of this application and the above-mentioned drawings are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequence. It should be understood that the numbers used in this way can be interchanged where appropriate, so that the embodiments of the present application described herein can be implemented in an order other than that shown or described in the drawings.

应该理解的是,虽然本申请实施例的流程图中通过箭头指示各个操作步骤,但是这些步骤的实施顺序并不受限于箭头所指示的顺序。除非本文中有明确的说明,否则在本申请实施例的一些实施场景中,各流程图中的实施步骤可以按照需求以其他的顺序执行。此外,各流程图中的部分或全部步骤基于实际的实施场景,可以包括多个子步骤或者多个阶段。这些子步骤或者阶段中的部分或全部可以在同一时刻被执行,这些子步骤或者阶段中的每个子步骤或者阶段也可以分别在不同的时刻被执行。在执行时刻不同的场景下,这些子步骤或者阶段的执行顺序可以根据需求灵活配置,本申请实施例对此不限制。It should be understood that, although each operation step is indicated by arrows in the flowchart of the embodiment of the present application, the implementation order of these steps is not limited to the order indicated by the arrows. Unless clearly stated herein, in some implementation scenarios of the embodiment of the present application, the implementation steps in each flowchart can be performed in other orders according to demand. In addition, some or all of the steps in each flowchart may include multiple sub-steps or multiple stages based on actual implementation scenarios. Some or all of these sub-steps or stages may be executed at the same time, and each sub-step or stage in these sub-steps or stages may also be executed at different times respectively. In different scenarios at the execution time, the execution order of these sub-steps or stages may be flexibly configured according to demand, and the embodiment of the present application does not limit this.

以上仅是本申请部分实施场景的可选实施方式,应当指出,对于本技术领域的普通技术人员来说,在不脱离本申请的方案技术构思的前提下,采用基于本申请技术思想的其他类似实施手段,同样属于本申请实施例的保护范畴。The above are only optional implementation methods for some implementation scenarios of the present application. It should be pointed out that for ordinary technicians in this technical field, without departing from the technical concept of the scheme of the present application, other similar implementation methods based on the technical ideas of the present application are also within the protection scope of the embodiments of the present application.

Claims (12)

1.一种信息交互方法,其特征在于,应用于云端,包括:1. An information interaction method, characterized in that it is applied in the cloud, comprising: 确定第一指令、待交互的目标无线通信设备的设备标识和设备密钥;所述第一指令用于指示目标无线通信设备执行相应的第一操作;Determine a first instruction, a device identification and a device key of a target wireless communication device to be interacted with; the first instruction is used to instruct the target wireless communication device to perform a corresponding first operation; 根据预设加密算法和所述设备密钥对所述第一指令进行加密;Encrypting the first instruction according to a preset encryption algorithm and the device key; 根据所述设备标识确定所述目标无线通信设备对应的目标主题,并向所述目标主题发布加密后的第一指令,以使得订阅所述目标主题的网关接收所述加密后的第一指令,并向所述目标主题对应的目标无线通信设备转发所述加密后的第一指令;Determine a target topic corresponding to the target wireless communication device according to the device identifier, and publish an encrypted first instruction to the target topic, so that a gateway subscribed to the target topic receives the encrypted first instruction and forwards the encrypted first instruction to the target wireless communication device corresponding to the target topic; 接收网关转发的由所述目标无线通信设备发送的第一响应信息;所述第一响应信息是所述目标无线通信设备根据所述设备密钥对所述加密后的第一指令解密成功,并执行所述第一指令相应的第一操作后发送的;receiving a first response message sent by the target wireless communication device and forwarded by the gateway; the first response message is sent by the target wireless communication device after successfully decrypting the encrypted first instruction according to the device key and executing a first operation corresponding to the first instruction; 其中,所述设备密钥和目标主题均为所述目标无线通信设备在所述云端注册时确定的。The device key and the target subject are both determined when the target wireless communication device is registered in the cloud. 2.根据权利要求1所述的方法,其特征在于,所述确定第一指令、待交互的目标无线通信设备的设备标识和设备密钥,之前还包括:2. The method according to claim 1, characterized in that the determining the first instruction, the device identification and the device key of the target wireless communication device to be interacted with, further comprises: 接收网关转发的由所述目标无线通信设备发送的注册请求;所述注册请求包括所述目标无线通信设备的产品标识和产品密钥;receiving a registration request sent by the target wireless communication device and forwarded by a gateway; the registration request includes a product identification and a product key of the target wireless communication device; 若确定第一列表中存在所述目标无线通信设备的产品标识和产品密钥,则生成并存储所述目标无线通信设备的设备标识和设备密钥;所述第一列表用于记录允许注册的无线通信设备的产品标识和产品密钥;If it is determined that the product identification and product key of the target wireless communication device exist in the first list, then generating and storing the device identification and device key of the target wireless communication device; the first list is used to record the product identification and product key of the wireless communication device that is allowed to be registered; 根据所述目标无线通信设备的设备标识,配置所述目标无线通信设备的目标主题;According to the device identification of the target wireless communication device, configuring the target subject of the target wireless communication device; 通过预设加密通道向所述目标无线通信设备发送所述设备标识和设备密钥。The device identification and the device key are sent to the target wireless communication device through a preset encryption channel. 3.根据权利要求1所述的方法,其特征在于,所述向所述目标主题发布加密后的第一指令,包括:3. The method according to claim 1, characterized in that the issuing of the encrypted first instruction to the target subject comprises: 向所述目标主题发布加密后的第一指令和下行属性数据,以使得所述网关确定所述加密后的第一指令携带下行属性数据时,向所述目标主题对应的目标无线通信设备转发所述加密后的第一指令;Publishing the encrypted first instruction and downlink attribute data to the target topic, so that when the gateway determines that the encrypted first instruction carries the downlink attribute data, the gateway forwards the encrypted first instruction to the target wireless communication device corresponding to the target topic; 其中,所述下行属性数据用于指示所述网关向无线通信设备发送指令。The downlink attribute data is used to instruct the gateway to send instructions to the wireless communication device. 4.根据权利要求1所述的方法,其特征在于,所述第一指令包括:业务标识和指令序号;4. The method according to claim 1, characterized in that the first instruction comprises: a service identifier and an instruction sequence number; 所述业务标识用于区分不同的业务,所述指令序号用于区分同一业务的不同指令。The service identifier is used to distinguish different services, and the instruction sequence number is used to distinguish different instructions for the same service. 5.根据权利要求1所述的方法,其特征在于,所述方法还包括:5. The method according to claim 1, characterized in that the method further comprises: 周期性获取各网关绑定的设备组的设备组标识以及各网关采集的各无线通信设备的广播信息;所述广播信息包括相应无线通信设备的设备标识、信号强度和相应无线通信设备绑定的设备组的设备组标识;Periodically obtain the device group identifier of the device group bound to each gateway and the broadcast information of each wireless communication device collected by each gateway; the broadcast information includes the device identifier of the corresponding wireless communication device, the signal strength and the device group identifier of the device group bound to the corresponding wireless communication device; 对于每个周期,根据各网关绑定的设备组的设备组标识,结合各无线通信设备绑定的设备组的设备组标识,确定各个无线通信设备在当前周期对应的参考网关,每个无线通信设备与对应的参考网关绑定相同的设备组标识;For each cycle, the reference gateway corresponding to each wireless communication device in the current cycle is determined according to the device group identifier of the device group bound to each gateway and the device group identifier of the device group bound to each wireless communication device, and each wireless communication device is bound to the same device group identifier as the corresponding reference gateway; 对于每个周期,根据各参考网关采集的所述无线通信设备的当前周期的信号强度,将最大信号强度对应的参考网关作为所述无线通信设备当前周期对应的目标网关,并在所述目标网关对应的当前周期的可控信息列表中记录所述无线通信设备的设备标识;所述可控信息列表用于记录网关可连接设备的设备标识;For each cycle, according to the signal strength of the current cycle of the wireless communication device collected by each reference gateway, the reference gateway corresponding to the maximum signal strength is used as the target gateway corresponding to the current cycle of the wireless communication device, and the device identification of the wireless communication device is recorded in the controllable information list of the current cycle corresponding to the target gateway; the controllable information list is used to record the device identification of the device that the gateway can connect to; 对于每个目标网关,若所述目标网关对应的当前周期的可控信息列表与上一周期的可控信息列表不一致,则向所述目标网关发送对应的当前周期的可控信息列表,以使得所述网关根据所述当前周期的可控信息列表向所述云端发送各可连接设备对应主题的订阅请求;For each target gateway, if the controllable information list of the current cycle corresponding to the target gateway is inconsistent with the controllable information list of the previous cycle, the corresponding controllable information list of the current cycle is sent to the target gateway, so that the gateway sends a subscription request for the topic corresponding to each connectable device to the cloud according to the controllable information list of the current cycle; 接收网关发送的主题订阅请求;所述主题订阅请求中包括设备标识;Receiving a topic subscription request sent by a gateway; the topic subscription request includes a device identifier; 若所述网关对应的当前周期的可控信息列表中记录有所述设备标识,则向所述网关返回订阅成功信息。If the device identifier is recorded in the controllable information list of the current period corresponding to the gateway, a subscription success message is returned to the gateway. 6.一种信息交互方法,其特征在于,应用于无线通信设备,包括:6. An information interaction method, characterized in that it is applied to a wireless communication device, comprising: 接收网关转发的由云端发送的加密后的第一指令;所述加密后的第一指令为云端根据所述无线通信设备的设备密钥和预设加密算法对第一指令进行加密得到的,所述设备密钥为所述无线通信设备在所述云端注册时确定的;The receiving gateway forwards an encrypted first instruction sent by the cloud; the encrypted first instruction is obtained by encrypting the first instruction by the cloud according to the device key of the wireless communication device and a preset encryption algorithm, and the device key is determined when the wireless communication device is registered on the cloud; 根据本地缓存的设备密钥对所述加密后的第一指令进行解密,获得第一指令;Decrypting the encrypted first instruction according to the locally cached device key to obtain the first instruction; 在根据所述第一指令执行相应的第一操作后,通过网关向所述云端发送第一响应信息;所述第一响应信息用于指示所述设备已完成所述第一指令相应的第一操作。After executing the corresponding first operation according to the first instruction, a first response message is sent to the cloud through the gateway; the first response message is used to indicate that the device has completed the first operation corresponding to the first instruction. 7.根据权利要求6所述的方法,其特征在于,所述接收网关转发的由云端发送的加密后的第一指令,之前还包括:7. The method according to claim 6, characterized in that the receiving gateway forwards the encrypted first instruction sent by the cloud, before that, further comprises: 所述无线通信设备首次启动时,通过串口读取烧录在所述无线通信设备上的产品标识和对应的产品密钥;When the wireless communication device is started for the first time, the product identification and the corresponding product key burned into the wireless communication device are read through the serial port; 通过网关向所述云端发送注册请求,以使得所述云端在接收所述注册请求后,若确定第一列表中记录有所述产品标识和对应的产品密钥,则根据预设生成方法生成并存储所述无线通信设备的设备标识和设备密钥;所述注册请求包括所述产品标识和对应的产品密钥;Sending a registration request to the cloud through the gateway, so that after receiving the registration request, if the cloud determines that the product identifier and the corresponding product key are recorded in the first list, the cloud generates and stores the device identifier and the device key of the wireless communication device according to a preset generation method; the registration request includes the product identifier and the corresponding product key; 接收所述云端通过预设加密通道发送的所述设备标识和设备密钥。Receive the device identification and device key sent by the cloud through a preset encryption channel. 8.根据权利要求7所述的方法,其特征在于,所述接收所述云端通过预设加密通道发送的所述设备标识和设备密钥,之后还包括:8. The method according to claim 7, characterized in that the receiving of the device identification and device key sent by the cloud through a preset encryption channel further comprises: 确定上行信息,通过预设加密算法和所述设备标识对所述上行信息进行加密;Determine uplink information, and encrypt the uplink information using a preset encryption algorithm and the device identifier; 向所述网关发送所述加密后的上行信息和上行属性数据,以使得所述网关接收所述加密后的上行信息和上行属性数据后,将所述加密后的上行信息发送至所述云端;Sending the encrypted uplink information and uplink attribute data to the gateway, so that after receiving the encrypted uplink information and uplink attribute data, the gateway sends the encrypted uplink information to the cloud; 所述上行属性数据用于指示所述网关向所述云端发送信息。The uplink attribute data is used to instruct the gateway to send information to the cloud. 9.一种云端,其特征在于,包括:9. A cloud, characterized by comprising: 确定模块,用于确定第一指令、待交互的目标无线通信设备的设备标识和设备密钥;所述第一指令用于指示目标无线通信设备执行相应的第一操作;A determination module, used to determine a first instruction, a device identification and a device key of a target wireless communication device to be interacted with; the first instruction is used to instruct the target wireless communication device to perform a corresponding first operation; 加密模块,用于根据预设加密算法和所述设备密钥对所述第一指令进行加密;An encryption module, used for encrypting the first instruction according to a preset encryption algorithm and the device key; 发布模块,用于根据所述设备标识确定所述目标无线通信设备对应的目标主题,并向所述目标主题发布加密后的第一指令,以使得订阅所述目标主题的网关接收所述加密后的第一指令,并向所述目标主题对应的目标无线通信设备转发所述加密后的第一指令;a publishing module, configured to determine a target topic corresponding to the target wireless communication device according to the device identifier, and publish the encrypted first instruction to the target topic, so that a gateway subscribed to the target topic receives the encrypted first instruction and forwards the encrypted first instruction to the target wireless communication device corresponding to the target topic; 第一接收模块,用于接收网关转发的由所述目标无线通信设备发送的第一响应信息;所述第一响应信息是所述目标无线通信设备根据所述设备密钥对所述加密后的第一指令解密成功,并执行所述第一指令相应的第一操作后发送的;A first receiving module is used to receive a first response message sent by the target wireless communication device and forwarded by the gateway; the first response message is sent by the target wireless communication device after successfully decrypting the encrypted first instruction according to the device key and executing a first operation corresponding to the first instruction; 其中,所述设备密钥和目标主题均为所述目标无线通信设备在所述云端注册时确定的。The device key and the target subject are both determined when the target wireless communication device is registered in the cloud. 10.一种无线通信设备,其特征在于,包括:10. A wireless communication device, comprising: 第二接收模块,用于接收网关转发的由云端发送的加密后的第一指令;所述加密后的第一指令为云端根据所述无线通信设备的设备密钥和预设加密算法对第一指令进行加密得到的,所述设备密钥为所述无线通信设备在所述云端注册时确定的;A second receiving module is used to receive an encrypted first instruction sent by the cloud and forwarded by the gateway; the encrypted first instruction is obtained by the cloud encrypting the first instruction according to the device key of the wireless communication device and a preset encryption algorithm, and the device key is determined when the wireless communication device is registered on the cloud; 解密模块,用于根据本地缓存的设备密钥对所述加密后的第一指令进行解密,获得第一指令;A decryption module, used to decrypt the encrypted first instruction according to the locally cached device key to obtain the first instruction; 发送模块,用于在根据所述第一指令执行相应的第一操作后,通过网关向所述云端发送第一响应信息;所述第一响应信息用于指示所述设备已完成所述第一指令相应的第一操作。A sending module is used to send a first response message to the cloud through a gateway after executing a corresponding first operation according to the first instruction; the first response message is used to indicate that the device has completed the first operation corresponding to the first instruction. 11.一种电子设备,包括存储器、处理器及存储在存储器上的计算机程序,其特征在于,所述处理器执行所述计算机程序以实现权利要求1-8任一项所述方法的步骤。11. An electronic device comprising a memory, a processor and a computer program stored in the memory, wherein the processor executes the computer program to implement the steps of the method according to any one of claims 1 to 8. 12.一种计算机可读存储介质,其上存储有计算机程序,其特征在于,所述计算机程序被处理器执行时实现权利要求1-8任一项所述方法的步骤。12. A computer-readable storage medium having a computer program stored thereon, wherein when the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 8 are implemented.
CN202411092543.0A 2024-08-09 2024-08-09 Information interaction method, cloud, device and readable storage medium Pending CN118741501A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202411092543.0A CN118741501A (en) 2024-08-09 2024-08-09 Information interaction method, cloud, device and readable storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202411092543.0A CN118741501A (en) 2024-08-09 2024-08-09 Information interaction method, cloud, device and readable storage medium

Publications (1)

Publication Number Publication Date
CN118741501A true CN118741501A (en) 2024-10-01

Family

ID=92849165

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202411092543.0A Pending CN118741501A (en) 2024-08-09 2024-08-09 Information interaction method, cloud, device and readable storage medium

Country Status (1)

Country Link
CN (1) CN118741501A (en)

Similar Documents

Publication Publication Date Title
US10230696B2 (en) System, apparatus and method for managing lifecycle of secure publish-subscribe system
US11303431B2 (en) Method and system for performing SSL handshake
JP4061288B2 (en) WEB service system, requester, SOAP message intermediate processing device, requester request SOAP message processing method, requestor response SOAP message processing method, SOAP message intermediate processing device request SOAP message processing method, SOAP message intermediate SOAP message processing method and program for response of processing device
WO2019200965A1 (en) Method and apparatus for connecting to wireless access point
US20150264724A1 (en) Method and system of establishing wireless communication connection
CN108512846A (en) Mutual authentication method and device between a kind of terminal and server
US20190268764A1 (en) Data transmission method, apparatus, and system
CN114762290B (en) Method and electronic device for managing digital keys
JP2016540462A (en) Key configuration method, system, and apparatus
CN109309650B (en) Method, terminal device and network device for processing data
US20160261414A1 (en) Secure authentication of remote equipment
CN102687482A (en) Distributed authentication with data cloud
CN113613227B (en) Data transmission method and device of Bluetooth equipment, storage medium and electronic device
EP4412152A1 (en) Authentication method and communication apparatus
US20240388568A1 (en) Efficient and secure universal/app links
CN113535852A (en) File processing method, file access method, device and system based on block chain
CN114095277A (en) Power distribution network secure communication method, secure access device and readable storage medium
WO2014089968A1 (en) Virtual machine system data encryption method and device
CN118741501A (en) Information interaction method, cloud, device and readable storage medium
WO2023226778A1 (en) Identity authentication method and apparatus, and electronic device and computer-readable storage medium
CN115362664B (en) Communication methods, devices and equipment based on the Internet of Things
CN115174062B (en) Cloud service authentication method, device, equipment and storage medium
CN103795698A (en) Method for verifying network location of terminal device and networked device for verifying network location of terminal device
CN113626777B (en) Identity authentication method, storage medium and electronic device
CN115396226A (en) Data transmission method, device and storage medium

Legal Events

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