Detailed Description
The technical solutions in the embodiments of the present application will be clearly and completely described below with reference to the drawings in the embodiments of the present application, and it is obvious that the described embodiments are only a part of the embodiments of the present application, and not all of the embodiments.
The components of the embodiments of the present application, generally described and illustrated in the figures herein, can be arranged and designed in a wide variety of different configurations. Thus, the following detailed description of the embodiments of the present application, presented in the accompanying drawings, is not intended to limit the scope of the claimed application, but is merely representative of selected embodiments of the application. All other embodiments, which can be derived by a person skilled in the art from the embodiments of the present application without making any creative effort, shall fall within the protection scope of the present application.
Hereinafter, the terms "including", "having", and their derivatives, which may be used in various embodiments of the present application, are intended to indicate only specific features, numbers, steps, operations, elements, components, or combinations of the foregoing, and should not be construed as first excluding the existence of, or adding to, one or more other features, numbers, steps, operations, elements, components, or combinations of the foregoing.
Furthermore, the terms "first," "second," "third," and the like are used solely to distinguish one from another and are not to be construed as indicating or implying relative importance.
Unless otherwise defined, all terms (including technical and scientific terms) used herein have the same meaning as commonly understood by one of ordinary skill in the art to which the various embodiments of this application belong. The terms (such as those defined in commonly used dictionaries) should be interpreted as having a meaning that is consistent with their contextual meaning in the relevant art and will not be interpreted in an idealized or overly formal sense unless expressly so defined herein in various embodiments.
The prior art provides a method for representing the state of an industrial production system by using synthetic data obtained by dividing each independent index into sections according to manual experience and weighting and summing the sections. In this way, besides that the manual experience value is difficult to interpret and cannot be quantified, since the industrial production often involves a lot of links, and each experienced operator is only familiar with each link, the experience values of the whole system are difficult to be efficiently connected, and the experience values between the links may be inconsistent. The industrial production system is often influenced by natural conditions such as seasons, climate and the like, artificial experience often has certain hysteresis, and the change of experience values caused by the change of the natural conditions is difficult to capture in time. In summary, the effect of the comprehensive state characterization of the industrial production system in the prior art is poor.
Example 1
The embodiment of the disclosure provides a method for registering a sub-device in the Internet of things. The method is applied to a cloud server which is in communication connection with a gateway device.
Specifically, referring to fig. 1, the method for registering the slave device in the internet of things includes:
step S101, receiving a self-registration request of the sub-device from the gateway device.
In one embodiment, the self-registration request of the child device includes: the gateway equipment comprises gateway information, sub-equipment information, a random number and first signature information, wherein the first signature information is generated by the gateway equipment according to the gateway information, the sub-equipment information, the random number and a first pre-acquired sub-equipment model password.
Specifically, referring to fig. 2, fig. 2 is a schematic diagram illustrating an architecture of the internet of things provided in this embodiment. The internet of things comprises afirst sub-device 201, asecond sub-device 202, agateway device 203 and acloud server 204, wherein thegateway device 203 is in communication connection with thecloud server 204, for example, thegateway device 203 and thecloud server 204 establish communication connection through MQTT, and other communication connection modes can be adopted, which is not limited herein. Thecloud server 204 is an execution main body for realizing various services of the service platform of the internet of things, and can realize data control management services. Thefirst sub-device 201 and thesecond sub-device 202 may be in communication connection with thegateway device 203, and thefirst sub-device 201 and thesecond sub-device 202 may indirectly communicate with thecloud server 204 through thegateway device 203. Thecloud server 204 receives the sub-device self-registration request from thegateway device 203, performs self-registration request processing according to the sub-device self-registration request, generates registration information if the sub-device self-registration is successful, thecloud server 204 sends the registration information to thegateway device 203, and thegateway device 203 receives the registration information and stores the registration information.
In this embodiment, the gateway information may include a gateway model identifier and a gateway model password, the sub-device information may include a sub-device model identifier and a sub-device model password, and the random number is a randomly generated random number for signature.
The gateway device is preset with a first sub-device model password, and the generation process of the first signature information may include the following steps:
splicing the gateway information, the sub-device information and the random number according to a preset sequencing rule to obtain first tagging content;
and signing the first signed content by adopting a first sub-equipment model password through a preset signature algorithm to obtain the first signature information.
In this embodiment, the preset sorting rule may be alphabetical sorting of the gateway information and the sub-device information. For example, the first signature information is generated as follows: (1) and sequencing the transmission parameters according to an alphabetic order, and then sequentially splicing the parameters and the values to obtain tagged contents, wherein the transmission parameters comprise gateway information, sub-equipment information and the like, and the transmission parameters do not comprise a signature method (signMethod). (2) For the signed content, signature calculation is carried out by a signed algorithm specified by the signMethod and using a subdevice model cipher (subdellsecret) value of the subdevice: md5(submodel secret & signed content). (3) And taking the calculation result as the value of sign.
The sign value calculation method is exemplified as follows:
md5(subModelSecret&action=subRegister&modelName=gatewayModel001&msgId=4d28c20295d343259a73ad9cab12b502&subModelName=subModel001&subSN=subSN001&tenantId=tenant001&ts=1578032957090)。
where md5 denotes an md5 cryptographic algorithm, subModelSecret denotes a sub-device model password, and "action = subRegister & modelName = gatewayModel001& msgidd =4d28c20295d343259a73ad9cab12b502& subModelName = subModel001& subSN = subSN001& tenentandid = tent 001& ts = 1578032957090" denotes tagged content.
Referring to fig. 3, fig. 3 is another schematic diagram of the architecture of the internet of things, and fig. 3 shows asub-device 301, agateway device 203, acloud server 204, and auser 304. The sub-device model identification and the sub-device serial number can be preset in thesub-device 301, the gateway information and the sub-device information are preset in thegateway device 203, the sub-device model can be created in the cloud server through user operation, and a user can control a self-registration switch of the sub-device model through operating the cloud server and set the sub-device model identification and the sub-device model password by losing the sub-device model. In fig. 3, thegateway device 203 is communicatively connected to thecloud server 204, thegateway device 203 has previously registered a subscription topic (topic) with thecloud server 204, and after thechild device 301 establishes a communication connection with thegateway device 203, thegateway device 203 may initiate a child device self-registration request to thecloud server 204.
It should be noted that, for the case that the sub-device does not preset the sub-device model password, the following processing may be performed:
(1) the sub-device model identifiers and passwords are preset in thegateway device 203, and the method is suitable for the situation that the sub-device models connected with thegateway device 203 are relatively fixed and the security is relatively high.
(2) A sub-device model password is preset in thegateway device 203 for all sub-device models to use, and at the same time, thecloud server 204 also needs to set the same sub-device model password for all corresponding sub-device models, and since the sub-device model suitable for the connection of thegateway device 203 may change, the security of the second method is lower than that of the first method. Therefore, a preset mode of multiple sub-device model passwords is provided, and dynamic registration of the sub-devices is facilitated.
And step S102, generating second signature information according to the gateway information, the sub-device information, the random number and a second pre-acquired sub-device model password.
Referring to fig. 3, after receiving the sub-device self-registration request, thecloud server 204 performs a self-registration processing process, specifically including steps of checking the first signature information and establishing a topological relationship between the sub-device and the gateway device.
In one embodiment, step S102 includes the following steps:
splicing the gateway information, the sub-device information and the random number according to a preset sequencing rule to obtain signed content;
and signing the signed content by adopting a second sub-equipment model password through a preset signature algorithm to obtain second signature information.
It should be noted that, the gateway device and the cloud server are preset with the same preset tagging algorithm, for example, the preset tagging algorithm and the preset md5 algorithm are preset, and the preset tagging algorithm is not limited herein. The gateway device and the cloud server are preset with the same preset ordering rule, for example, both are preset with ordering according to letters, and may also be other ordering rules, which is not limited herein. The generation process of the second signature information may refer to the generation process of the first signature information, and is not described herein again to avoid repetition.
In this embodiment, the sub-device model identifier and the sub-device model password are respectively pre-made in the sub-device and the gateway device to generate the signature verification information, so as to ensure the integrity and the security of the transmission parameters.
Step S103, determining whether the first signature information and the second signature information match.
In this embodiment, the cloud server generates second signature information according to the same rule, and compares the first signature information generated by the gateway device, and if the first signature information matches the second signature information, the verification is passed. According to the generation rule of the signature information, all transmission parameters, the sub-device model key and the random number are included, so that the integrity of the parameters transmitted to the cloud server can be verified and the request authentication can be performed through the signature information, and the safety is improved.
And step S104, if the first signature information is matched with the second signature information, establishing a topological relation between the sub-equipment and the gateway equipment according to the sub-equipment information and the gateway information, and generating sub-equipment registration information.
In this embodiment, the sub-device may obtain the corresponding connection information through gateway dynamic registration, and bind the sub-device to the current grid device connected to the sub-device for networking, thereby effectively improving the connection information issuing process of the sub-device, reducing the time for registering and networking the sub-device, and realizing automatic registering and networking of the sub-device.
In an embodiment, if the first signature information and the second signature information do not match, it indicates that the signature verification fails, and the self-registration process cannot be started. Referring to fig. 3 again, if the registration is unsuccessful or no reply occurs after a timeout, thegateway device 203 initiates a retry policy and resends the child device self-registration request to thecloud server 204.
In an embodiment, after the self-registration request of the child device is verified by thecloud server 204, the child device instance is automatically created by using the serial number of the child device as the model identifier of the child device according to the gateway information and the child device information, and then the networking relationship between the child device and the gateway device is created, that is, the registration of the child device is completed, so as to obtain the registration information of the child device. Referring to fig. 3, thecloud server 204 returns registration information of the child device to thegateway device 203 through the MQTT long connection channel, and thegateway device 203 returns the registration information of the child device to thechild device 301. Thesub-device 301 receives the sub-device registration information and stores the sub-device registration information, and the sub-device 301 needs to take the sub-device information when uploading the working conditions, so that thecloud server 204 can conveniently identify the data of thesub-device 301. Through the communication between thegateway device 203 and thecloud server 204, the dynamic registration and the dynamic networking of the sub-device 301 are completed. In this way, thechild device 301 can update the registration information more safely and effectively, and replace the gateway.
In one embodiment, the self-registration request of the child device further includes: a tenant identification;
before the step of creating the topological relation between the sub-device and the gateway device according to the sub-device information and the gateway information in step S104, the method further includes the following steps:
judging whether the sub-device information is registered in the cloud server;
if the sub-equipment information is not registered in the cloud server, judging whether a sub-equipment model corresponding to the tenant identification starts a self-registration function or not;
and if the sub-equipment model corresponding to the tenant identification starts a self-registration function, skipping and executing the step of establishing the topological relation between the sub-equipment and the gateway equipment according to the sub-equipment information and the gateway information.
The Internet of things platform provided by the cloud server can be rented to different users for data processing, the different users correspond to different tenant identifications, and due to the fact that confidentiality and safety performance of the sub-equipment models are different, the users can control whether the sub-equipment models corresponding to the tenant identifications start the self-registration function or not. Specifically, referring to fig. 3 again, if the user opens the self-registration switch of the sub-device model after creating the sub-device model through the cloud server, the sub-device model starts the self-registration function, and the user sets the sub-device model identifier and the sub-device model password of the sub-device model through the cloud server.
In an embodiment, the step of creating a topological relationship between the sub-device and the gateway device according to the sub-device information and the gateway information includes:
using the sub-equipment serial number as a sub-equipment instance identifier, searching a target sub-equipment model according to the sub-equipment instance identifier, and creating a sub-equipment instance under the target sub-equipment model according to the sub-equipment instance identifier;
and creating a topological relation between the sub-equipment and the gateway equipment according to the sub-equipment instance and the gateway information.
Specifically, the gateway device instance may be obtained according to the gateway information, and the gateway device instance may be bound to the sub-device instance to obtain the topological relationship between the sub-device and the grid device. It should be noted that the creation process of the gateway device instance may include the following steps: the cloud server creates a gateway device instance corresponding to a real gateway device in the real physical world according to the gateway information and the gateway device model by creating the gateway device model including all attribute parameters of the gateway device.
In an embodiment, before the step of determining whether the child device information is registered in the cloud server, the method further includes:
creating the sub-equipment model, and starting a self-registration function of the sub-equipment model;
and setting corresponding sub-equipment model identification and sub-equipment model passwords for the sub-equipment model.
In this implementation, the sub-device model is an object model of a class of sub-devices, the sub-device model includes all attribute parameters of the class of sub-devices, multiple sub-device instances can be bound under the sub-device model, each sub-device instance corresponds to a real sub-device in a real physical world, and each sub-device instance is correspondingly provided with a sub-device model identifier and a sub-device model password. The child device model may include: the sub-device models of the sensor class, the sub-device models of the collector class, and the like are not limited herein. In this way, dynamic registration of various sub-devices can be achieved.
In the method for registering a slave device in the internet of things provided by this embodiment, a slave device self-registration request is received from the gateway device; generating second signature information according to the gateway information, the sub-device information, the random number and a pre-acquired second sub-device model password; judging whether the first signature information and the second signature information are matched; and if the first signature information is matched with the second signature information, establishing a topological relation between the sub-equipment and the gateway equipment according to the sub-equipment information and the gateway information, and generating sub-equipment registration information. Therefore, the gateway device is communicated with the cloud server, dynamic registration and dynamic networking of the sub-devices are automatically completed, and automatic networking of the sub-devices in the Internet of things can be realized more safely and effectively.
Example 2
In addition, the embodiment of the disclosure provides a method for registering a sub-device in the internet of things, and the method is applied to a gateway device which is in communication connection with a cloud server.
Specifically, as shown in fig. 4, the method for registering a child device in the internet of things provided by this embodiment includes the following steps:
step S401, gateway information, sub-device information, a random number and a first sub-device model password are obtained.
The method for registering a child device in the internet of things provided by this embodiment may be applied to thegateway device 203 in the architecture diagram of the internet shown in fig. 3. This is explained below with reference to fig. 3. Thegateway device 203 acquires gateway information, where the gateway information includes a gateway model identifier, thegateway device 203 may acquire the sub-device information in a preset manner, or may acquire the sub-device information from the sub-device 301 by establishing a communication connection with the sub-device 301, where the sub-device information includes the sub-device model identifier, thegateway device 203 may generate a random number, and thegateway device 203 may acquire the first sub-device model password in a preset manner.
Step S402, generating first signature information according to the gateway information, the sub-device information, the random number and the first sub-device model password;
in one embodiment, step S402 includes:
splicing the gateway information, the sub-device information and the random number according to a preset sequencing rule to obtain first tagging content;
and signing the first signed content by adopting a first sub-equipment model password through a preset signature algorithm to obtain the first signature information.
It should be noted that, the process of acquiring the first signature information is described inembodiment 1, and for a specific process, reference may be made to the related description ofembodiment 1, and details are not described herein to avoid repetition.
Step S403, generating a sub-device self-registration request according to the gateway information, the sub-device information, the random number, and the first signature information.
Specifically, after thesub-device 301 is connected to thegateway device 203, thegateway device 203 proxies the sub-device 301 to initiate a sub-device self-registration process to thecloud server 204, that is, thegateway device 203 sends a sub-device self-registration request to thecloud server 204, where the sub-device self-registration request carries a gateway model identifier, a tenant identifier, a sub-device serial number, a sub-device model identifier, and a sub-device model password, and is transmitted by using first signature information generated by an MD5 algorithm according to a preset rule.
Step S404, sending the self-registration request of the sub-equipment to the cloud server.
Specifically, thegateway device 203 sends the sub-device self-registration request to thecloud server 204 after generating the sub-device self-registration request.
Step S405, receiving the child device registration information sent by the cloud server, where the child device registration information is generated according to the child device registration method in the internet of things described inembodiment 1.
It should be noted that the registration information of the child device is generated according to the registration method of the child device in the internet of things described inembodiment 1, and specific processes may refer to relevant descriptions inimplementation 1, and in order to avoid repetition, details are not described here.
The gateway device in the embodiment of the present invention has the same function as the gateway device inembodiment 1, the gateway device in the embodiment of the present invention communicates with the child device and the cloud server to complete the self-registration networking of the child device, and the specific process of completing the self-registration networking of the child device may refer to relevant contents inembodiment 1, and is not described again to avoid repetition.
According to the sub-device registration method in the Internet of things, gateway information, sub-device information, a random number and a first sub-device model password are obtained; generating first signature information according to the gateway information, the sub-device information, the random number and the first sub-device model password; generating a sub-device self-registration request according to the gateway information, the sub-device information, the random number and the first signature information; sending the sub-device self-registration request to the cloud server; receiving child device registration information sent by the cloud server, where the child device registration information is generated according to the child device registration method in the internet of things provided inembodiment 1. Therefore, the gateway device is communicated with the cloud server, dynamic registration and dynamic networking of the sub-devices are automatically completed, and automatic networking of the sub-devices in the Internet of things can be realized more safely and effectively.
Example 3
In addition, an embodiment of the present disclosure provides a cloud server, which includes a memory and a processor, where the memory stores a computer program, and the computer program, when running on the processor, executes the method for registering a child device in the internet of things provided inembodiment 1.
The cloud server provided by the embodiment of the present invention may execute the steps of the method for registering a child device in the internet of things inembodiment 1, and details are not repeated for avoiding repetition.
Example 4
In addition, an embodiment of the present disclosure provides a gateway device, which includes a memory and a processor, where the memory stores a computer program, and the computer program, when running on the processor, executes the method for registering a child device in the internet of things provided in embodiment 2.
The cloud server provided by the embodiment of the present invention may execute the steps of the method for registering a child device in the internet of things in embodiment 2, and details are not repeated for avoiding repetition.
Example 5
The present application further provides a computer-readable storage medium, on which a computer program is stored, where the computer program, when executed by a processor, implements the method for registering a child device in an internet of things provided inembodiment 1 or embodiment 2.
In this embodiment, the computer-readable storage medium may be a Read-Only Memory (ROM), a Random Access Memory (RAM), a magnetic disk or an optical disk.
In this embodiment, the computer-readable storage medium may be the method for registering a child device in the internet of things provided inembodiment 1, and is not described herein again to avoid repetition.
In the several embodiments provided in the present application, it should be understood that the disclosed apparatus and method may be implemented in other manners. The apparatus embodiments described above are merely illustrative and, for example, the flowchart and block diagrams in the figures illustrate the architecture, functionality, and operation of possible implementations of apparatus, methods and computer program products according to various embodiments of the present invention. In this regard, each block in the flowchart or block diagrams may represent a module, segment, or portion of code, which comprises one or more executable instructions for implementing the specified logical function(s). It should also be noted that, in alternative implementations, the functions noted in the block may occur out of the order noted in the figures. For example, two blocks shown in succession may, in fact, be executed substantially concurrently, or the blocks may sometimes be executed in the reverse order, depending upon the functionality involved. It will also be noted that each block of the block diagrams and/or flowchart illustration, and combinations of blocks in the block diagrams and/or flowchart illustration, can be implemented by special purpose hardware-based systems that perform the specified functions or acts, or combinations of special purpose hardware and computer instructions.
In addition, each functional module or unit in each embodiment of the present invention may be integrated together to form an independent part, or each module may exist separately, or two or more modules may be integrated to form an independent part.
The functions, if implemented in the form of software functional modules and sold or used as a stand-alone product, may be stored in a computer readable storage medium. Based on such understanding, the technical solution of the present invention or a part of the technical solution that contributes to the prior art in essence can be embodied in the form of a software product, which is stored in a storage medium and includes instructions for causing a computer device (which may be a smart phone, a personal computer, a server, or a network device, etc.) to execute all or part of the steps of the method according to the embodiments of the present invention. And the aforementioned storage medium includes: a U-disk, a removable hard disk, a Read-Only Memory (ROM), a Random Access Memory (RAM), a magnetic disk or an optical disk, and other various media capable of storing program codes.
The above description is only for the specific embodiments of the present invention, but the scope of the present invention is not limited thereto, and any person skilled in the art can easily conceive of the changes or substitutions within the technical scope of the present invention, and all the changes or substitutions should be covered within the scope of the present invention.