CN112637190A - Data generation method based on COAP protocol, electronic device and readable storage medium - Google Patents

Data generation method based on COAP protocol, electronic device and readable storage medium Download PDF

Info

Publication number
CN112637190A
CN112637190A CN202011512005.4A CN202011512005A CN112637190A CN 112637190 A CN112637190 A CN 112637190A CN 202011512005 A CN202011512005 A CN 202011512005A CN 112637190 A CN112637190 A CN 112637190A
Authority
CN
China
Prior art keywords
data
internet
coap
data packet
electronic device
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202011512005.4A
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 Genius Technology Co Ltd
Original Assignee
Guangdong Genius Technology Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Guangdong Genius Technology Co Ltd filed Critical Guangdong Genius Technology Co Ltd
Priority to CN202011512005.4A priority Critical patent/CN112637190A/en
Publication of CN112637190A publication Critical patent/CN112637190A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L69/00Network arrangements, protocols or services independent of the application payload and not provided for in the other groups of this subclass
    • H04L69/06Notations for structuring of protocol data, e.g. abstract syntax notation one [ASN.1]
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L1/00Arrangements for detecting or preventing errors in the information received
    • H04L1/004Arrangements for detecting or preventing errors in the information received by using forward error control
    • H04L1/0056Systems characterized by the type of code used
    • H04L1/0061Error detection codes
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L67/00Network arrangements or protocols for supporting network services or applications
    • H04L67/01Protocols
    • H04L67/12Protocols specially adapted for proprietary or special-purpose networking environments, e.g. medical networks, sensor networks, networks in vehicles or remote metering networks
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L67/00Network arrangements or protocols for supporting network services or applications
    • H04L67/01Protocols
    • H04L67/12Protocols specially adapted for proprietary or special-purpose networking environments, e.g. medical networks, sensor networks, networks in vehicles or remote metering networks
    • H04L67/125Protocols specially adapted for proprietary or special-purpose networking environments, e.g. medical networks, sensor networks, networks in vehicles or remote metering networks involving control of end-device applications over a network

Abstract

The embodiment of the invention discloses a data generation method based on a COAP protocol, electronic equipment and a readable storage medium, which are used for connecting at least two control nodes through an Internet of things module by the electronic equipment, so that the using number of the Internet of things module in the electronic equipment is reduced, and the cost is effectively saved. The method provided by the embodiment of the invention is applied to an Internet of things system, the Internet of things system comprises a COAP server and an Internet of things module, the Internet of things module is connected with at least two control nodes through a controller, and the method can comprise the following steps: the electronic equipment generates a data packet according to a COAP protocol, wherein the data packet comprises data content, and the data content is Modbus RTU frame format data; the electronic device is the COAP server or the Internet of things module.

Description

Data generation method based on COAP protocol, electronic device and readable storage medium
Technical Field
The present invention relates to the field of electronic device applications, and in particular, to a data generation method based on a COAP protocol, an electronic device, and a readable storage medium.
Background
With the rapid development of the Internet of Things technology, the narrowband Band Internet of Things (NB-IoT) technology has become one of the hot spots of the Internet of Things communication technology due to its advantages of low power consumption, wide coverage and massive connection. Since the NB-IoT technology has a low transmission rate and is limited by a small space of a Random Access Memory (RAM) of the internet of things device, the size of the adopted communication protocol packet needs to be as small as possible. The Constrained Application Protocol (COAP) is one of the communication protocols commonly used in NB-IoT technology, and has the advantages of lightweight Protocol packet and minimum length of only 4 bytes (B).
In the prior art, a narrowband internet of things product based on a COAP protocol usually adopts a point-to-multipoint communication mode, a COAP server is used as a host, a plurality of NB-IoT modules are used as slaves, and a header source IP and destination IP setting implementation method is adopted for data communication between the host and different slaves. However, the disadvantage of this method is that each internet of things device, i.e. the control node or the sensing node, needs to be connected with one NB-IoT module, which results in too high hardware cost of the electronic device.
Disclosure of Invention
The embodiment of the invention provides a data generation method based on a COAP protocol, electronic equipment and a readable storage medium, which are used for connecting at least two control nodes through an Internet of things module by the electronic equipment, so that the using number of the Internet of things module in the electronic equipment is reduced, and the cost is effectively saved.
In view of this, a first aspect of the embodiments of the present invention provides a data generation method based on a COAP protocol, where the method is applied to an internet of things system, where the internet of things system includes a COAP server and an internet of things module, and the internet of things module is connected to at least two control nodes through a controller, and the method may include:
the electronic equipment generates a data packet according to a COAP protocol, wherein the data packet comprises data content, and the data content is Modbus RTU frame format data;
wherein, this electronic equipment is this COAP server, or, this thing networking module.
Optionally, the generating, by the electronic device, a data packet according to a COAP protocol includes: under the condition that the electronic equipment is the internet of things module, the electronic equipment generates a first data packet according to a COAP protocol, wherein the first data packet comprises first data content, and the first data content is first Modbus RTU frame format data; the first Modbus RTU frame format data comprises a first data parameter and a first CRC check code; the first data parameter comprises a first equipment number, a first function number, a first register initial address, a first register unit length, a first byte number and first actual data; or, in the case that the electronic device is the COAP server, the electronic device generates a second data packet according to a COAP protocol, where the second data packet includes second data content, and the second data content is second Modbus RTU frame format data; the second Modbus RTU frame format data comprises a second data parameter and a second CRC check code; the second data parameter includes a second device number, a second function number, a second register start address, a second register unit length, a second byte number, and second actual data.
Optionally, the first device number is used for the controller to assign respective serial numbers ID to the at least two control nodes.
Optionally, in a case that the electronic device is the internet of things module, the method further includes: the electronic equipment uploads the first data packet to the COAP server; and/or the electronic equipment transmits the first data packet to the at least two control nodes through the controller.
Optionally, in a case that the electronic device is the internet of things module, the method further includes: the electronic equipment receives a second data packet sent by the COAP server; the electronic equipment generates a third CRC code according to the second data parameter; the electronic device confirms that the second data packet is correct if the second CRC check code and the third CRC check code match successfully.
Optionally, in a case that the electronic device is the internet of things module, the method further includes: the electronic equipment receives data information sent by a first control node through the controller, and the at least two control nodes comprise the first control node.
Optionally, in a case that the electronic device is the COAP server, the method further includes: and the electronic equipment issues the second data packet to the Internet of things module.
Optionally, in a case that the electronic device is the COAP server, the method further includes: the electronic equipment receives a first data packet sent by the Internet of things module; the electronic equipment generates a fourth CRC according to the first data parameter; the electronic device confirms that the first data packet is correct if the first CRC check code and the fourth CRC check code match successfully.
A second aspect of the embodiments of the present invention provides an electronic device, where the electronic device is applied to an internet of things system, where the internet of things system includes a COAP server and an internet of things module, the internet of things module is connected to at least two control nodes through a controller, and the electronic device is the COAP server, or the internet of things module, and the electronic device may include a processing module and a transceiver module:
the processing module is used for generating a data packet according to a COAP protocol, wherein the data packet comprises data content, and the data content is Modbus RTU frame format data.
Optionally, the processing module is specifically configured to generate a first data packet according to a COAP protocol when the electronic device is the internet of things module, where the first data packet includes first data content, and the first data content is data in a first Modbus RTU frame format; the first Modbus RTU frame format data comprises a first data parameter and a first CRC check code; the first data parameter comprises a first equipment number, a first function number, a first register initial address, a first register unit length, a first byte number and first actual data; or, in a case that the electronic device is the COAP server, generating a second data packet according to a COAP protocol, where the second data packet includes second data content, and the second data content is second Modbus RTU frame format data; the second Modbus RTU frame format data comprises a second data parameter and a second CRC check code; the second data parameter includes a second device number, a second function number, a second register start address, a second register unit length, a second byte number, and second actual data.
Optionally, the first device number is used for the controller to assign respective serial numbers ID to the at least two control nodes.
Optionally, in a case that the electronic device is the internet of things module, the transceiver module is specifically configured to upload the first data packet to the COAP server; and/or transmitting the first data packet to the at least two control nodes through the controller.
Optionally, in a case that the electronic device is the internet of things module, the transceiver module is further configured to receive a second data packet sent by the COAP server;
the processing module is further configured to generate a third CRC check code according to the second data parameter; and confirming that the second data packet is correct if the second CRC check code and the third CRC check code are matched successfully.
Optionally, in a case that the electronic device is the internet of things module, the transceiver module is further configured to receive, by the controller, data information sent by the first control node, where the at least two control nodes include the first control node.
Optionally, in the case that the electronic device is the COAP server, the transceiver module is specifically configured to issue the second data packet to the internet of things module.
Optionally, in a case that the electronic device is the COAP server, the transceiver module is further configured to receive a first data packet sent by the internet of things module;
the processing module is further configured to generate a fourth CRC check code according to the first data parameter; and confirming that the first data packet is correct under the condition that the first CRC check code and the fourth CRC check code are matched successfully.
A third aspect of an embodiment of the present invention provides an electronic device, where the electronic device is applied to an internet of things system, the internet of things system includes a COAP server and an internet of things module, the internet of things module is connected to at least two control nodes through a controller, and the electronic device is the COAP server, or the internet of things module, and the electronic device may include:
a memory storing executable program code;
and a processor coupled to the memory;
the processor calls the executable program code stored in the memory for performing the method according to the first aspect of the embodiment of the present invention.
A fourth aspect of embodiments of the present invention provides a computer-readable storage medium, on which a computer program is stored, which, when executed by a processor, implements the method according to the first aspect of embodiments of the present invention.
A fifth aspect of the embodiments of the present invention discloses a computer program product, which, when running on a computer, causes the computer to execute any one of the methods disclosed in the first aspect of the embodiments of the present invention.
A sixth aspect of the present embodiment discloses an application publishing platform, where the application publishing platform is configured to publish a computer program product, where when the computer program product runs on a computer, the computer is caused to execute any one of the methods disclosed in the first aspect of the present embodiment.
According to the technical scheme, the embodiment of the invention has the following advantages:
the method in the embodiment of the application is applied to an Internet of things system, the Internet of things system comprises a COAP server and an Internet of things module, the Internet of things module is connected with at least two control nodes through a controller, and the method comprises the following steps: the electronic equipment generates a data packet according to a COAP protocol, wherein the data packet comprises data content, and the data content is Modbus RTU frame format data; wherein, this electronic equipment is this COAP server, or, this thing networking module. Therefore, the electronic equipment can be connected with at least two control nodes through the Internet of things module, so that the using quantity of the Internet of things modules in the electronic equipment is reduced, and the cost is effectively saved.
Drawings
In order to more clearly illustrate the technical solutions of the embodiments of the present invention, the following briefly introduces the embodiments and the drawings used in the description of the prior art, and obviously, the drawings in the following description are only some embodiments of the present invention, and other drawings can be obtained according to the drawings.
FIG. 1 is a diagram of an embodiment of a COAP packet in a COAP protocol in the prior art;
fig. 2 is a diagram illustrating an embodiment of a point-to-multipoint communication mode based on the COAP protocol in the prior art;
FIG. 3 is a diagram of an embodiment of a COAP packet in a COAP protocol according to the present invention;
fig. 4 is a diagram illustrating an embodiment of a point-to-multipoint communication mode based on the COAP protocol according to the embodiment of the present invention;
FIG. 5 is a schematic diagram of an embodiment of a data generation method based on a COAP protocol in the embodiment of the present invention;
fig. 6 is a schematic diagram of another embodiment of a data generation method based on the COAP protocol in the embodiment of the present invention;
FIG. 7 is a diagram of an embodiment of an electronic device in an embodiment of the invention;
fig. 8 is a schematic diagram of another embodiment of the electronic device in the embodiment of the present invention.
Detailed Description
The embodiment of the invention provides a data generation method based on a COAP protocol, electronic equipment and a readable storage medium, which are used for enabling the electronic equipment to be connected with at least two control nodes through an Internet of things module, so that the using number of the Internet of things module in the electronic equipment is reduced, and the cost is effectively saved.
In order to make the technical solutions of the present invention better understood by those skilled in the art, the technical solutions in the embodiments of the present invention will be described below with reference to the drawings in the embodiments of the present invention, and it is obvious that the described embodiments are only a part of the embodiments of the present invention, and not all embodiments. The embodiments based on the present invention should fall into the protection scope of the present invention.
It should be noted that the terms "first", "second", "third", "fourth", and the like in the description and the claims of the present invention are used for distinguishing different objects, and are not used for describing a specific order. The terms "comprises," "comprising," and any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, method, system, article, or apparatus that comprises a list of steps or elements is not necessarily limited to those steps or elements expressly listed, but may include other steps or elements not expressly listed or inherent to such process, method, article, or apparatus.
It should be noted that, the Internet of Things referred to in this embodiment may be a system corresponding to a narrowband Internet of Things (NB-IoT), which may be referred to as a narrowband Internet of Things system, that is, an NB-IoT system; the module corresponding to the narrowband internet of things may be referred to as a narrowband internet of things module, that is, an NB-IoT module, and is not specifically limited herein.
It should be noted that the COAP protocol involved in this embodiment may be referred to as COAP protocol frame format; the Modbus RTU protocol may be referred to as a Modbus RTU protocol frame format, and is not specifically limited herein.
The Modbus RTU protocol may include data parameters and Cyclic Redundancy Check (CRC) Check codes; the data parameters include a device number, a function number, a register start address, a register unit length, a byte number, and data. The CRC check code may include at least one of: CRC-8, CRC-12, CRC-16, CRC-CCITT, CRC-32, and CRC-32C, and are not particularly limited herein.
The device number is an address code in a Modbus RTU protocol, and the assignable device ID addresses of the control nodes are 0 to 255. This byte indicates that the NB-IoT module addressed by the user will receive the information sent by the COAP server. Each NB-IoT module must have a unique address code and only slaves that conform to the address code can respond to the loopback information. When the NB-IoT modules loop back information, the loop-back data all start with their respective address codes.
It should be noted that, as shown in fig. 1, a diagram is shown for illustrating an embodiment of a COAP packet in a COAP protocol in the prior art. The COAP packet generated by the electronic device according to the COAP protocol may include a Version number (Version, Ver), a message Type (Type, T), a COAP identifier Length (TKL), a request method or response status word (Code), a message number (MessagelD), an identifier specific content (Token), message Options (Options), 11111111111, and data content.
The COAP protocol specifies 4 different T messages: CON (0) message, NON (1) message, ACK (2) message and RST (3) message; there are two functionally similar identifiers in the COAP protocol: message ID and Token, each Message containing a Message ID, but Token is not necessary for the Message.
Fig. 2 is a schematic diagram illustrating an embodiment of a point-to-multipoint communication mode of a narrowband internet of things product based on a COAP protocol in the prior art. Wherein n is a positive integer greater than 1. It can be understood that in the prior art communication mode, one NB-IoT module can generally connect only 1 control node, and therefore, when multiple NB-IoT modules communicate with the COAP server at the same time, if the number of communications of the NB-IoT modules is greater, the packet loss rate of the message packets transmitted by the NB-IoT modules is also greater, thereby affecting the reliability of data transmission.
It is understood that the COAP packet in fig. 2 may be generated by a COAP server or by an NB-IoT module, and both the COAP server and the NB-IoT module follow COAP protocol. The controller in fig. 2 has a data processing function, and may be a Microcontroller Unit (MCU) or a controller other than the MCU; the data of the control node may be collected by a sensor, or may be collected by other collection devices, which is not specifically limited herein.
Fig. 3 is a schematic diagram of an embodiment of a COAP packet in a COAP protocol according to an embodiment of the present invention. It can be understood that, except that the data content of the COAP data packet generated by the electronic device according to the COAP protocol is data in the Modbus RTU frame format, other constituent content of the data packet remains unchanged, and details are not described herein again.
The Modbus RTU protocol frame format can contain data parameters and CRC check codes; the data parameters include a device number, a function number, a register start address, a register unit length, a byte number, and data. Wherein, the device number is used for the controller to distribute respective serial number IDs for the at least two control nodes. In fig. 3, the COAP protocol in the prior art and the Modbus RTU protocol are fused to obtain the fused COAP protocol, i.e. the COAP protocol of the present invention. The COAP data packet of the COAP protocol contains data in a Modbus RTU protocol frame format, so that the use number of NB-IoT modules is reduced, and meanwhile, the cost is effectively saved.
Fig. 4 is a schematic diagram illustrating an embodiment of a point-to-multipoint communication mode based on the COAP protocol in the embodiment of the present invention. Wherein n is a positive integer greater than 1. It can be understood that, in the communication mode of this embodiment, one NB-IoT module is generally connected to at least two control nodes, so that when more than one control node uploads data to the NB-IoT module at the same time, some data packets are not lost, thereby effectively improving the reliability of data transmission.
It should be noted that the NB-IoT module is generally connected to at least two control nodes, and may be connected to the at least two control nodes through one controller, or may be connected to the at least two control nodes through at least two controllers, respectively, which is not limited herein. It can be appreciated that, for cost saving, it is generally sufficient for one NB-IoT module to connect at least two control nodes through one controller. The controller in fig. 3 is substantially the same as the controller described in fig. 2, and details thereof are not repeated herein.
In the embodiment of the invention, the data generation method based on the COAP protocol is applied to an NB-IoT system, the NB-IoT system comprises a COAP server and an NB-IoT module, and the NB-IoT module is connected with at least two control nodes through a controller. The method can comprise the following steps: the electronic equipment generates a data packet according to the COAP protocol, wherein the data packet comprises data content, and the data content is Modbus RTU frame format data. Wherein the electronic device is the COAP server or the NB-IoT module.
Wherein the NB-IoT module connects at least two control nodes through a controller. The controller is used for distributing an equipment ID to each control node and packaging the acquired/transmitted data in a Modbus RTU frame format. Namely, the controller not only controls the control node or collects/issues data, but also edits the format of the Modbus RTU frame, and then integrates the edited Modbus RTU frame format through the NB-IoT module. It can be understood that, because the NB-IoT module has low data processing capability, if the controller does not encapsulate the Modbus RTU frame format, it cannot perform verification, so that the controller encapsulates the Modbus RTU frame format, so as to effectively improve the accuracy of the data content.
The process of encapsulating the Modbus RTU frame format by the controller is as follows: the controller is responsible for data acquisition, packages the data according to a modbus RTU frame format, and uploads the data to the NB-IoT module through a serial port; the NB-IoT module integrates the received Modbus RTU frame data into a COAP data packet and uploads the Modbus RTU frame data to a COAP server in a wireless mode. Wherein, the uploading mode follows the COAP protocol.
Example one
In the case that the electronic device is an NB-IoT module, as shown in fig. 5, an embodiment of the data generation method based on the COAP protocol in the embodiment of the present invention is shown in a schematic view, and the method is applied to an NB-IoT system, where the NB-IoT system includes a COAP server and an NB-IoT module, and the NB-IoT module connects at least two control nodes through a controller, and the method may include:
501. the NB-IoT module generates a first packet according to a COAP protocol.
The first data packet comprises first data content, and the first data content is first Modbus RTU frame format data; the first Modbus RTU frame format data comprises a first data parameter and a first CRC check code; the first data parameter comprises a first device number, a first function number, a first register start address, a first register unit length, a first byte number and first actual data. The first device number is used for the controller to distribute respective serial number IDs for the at least two control nodes.
Note that the serial number ID may be referred to as a serial number identifier. Illustratively, the sequence number identification may be 0x01-0 xFF.
502. The NB-IoT module uploads the first data packet to the COAP server.
503. The COAP server receives a first data packet sent by the NB-IoT module.
504. And the COAP server generates a fourth CRC check code according to the first data parameter.
505. And the COAP server confirms that the first data packet is correct under the condition that the first CRC check code and the fourth CRC check code are matched successfully.
It can be understood that, the COAP server processes the first data content through the CRC algorithm to obtain the fourth check code, and then matches the obtained first check code sent by the NB-IoT module with the fourth check code to determine whether the data content is correct, which effectively improves the accuracy of the data content.
Optionally, after the COAP server confirms that the first data packet is correct, the method further includes: the COAP server outputs the first data content.
Wherein the COAP server may output the first data content in at least one of a voice format, a text format, or an animation format.
506. The NB-IoT module issues the first data packet to the at least two control nodes through the controller.
Wherein the at least two control nodes comprise the first control node.
507. And the first control node receives the first data packet sent by the NB-IoT module through the controller.
508. The first control node uploads first data content to the NB-IoT module through the controller.
It will be appreciated that the first data content may be the data content actually to be transmitted. The first data content may be data collected by a sensor, or may be data for performing a corresponding action according to a received instruction, which is not specifically limited herein.
509. The NB-IoT module receives first data content sent by a first control node through a controller.
As can be appreciated, the first data content is for the NB-IoT module to generate a first data packet based on the first data content.
It should be noted that, in the present embodiment, the steps 501 to 505, and the steps 501 to 506 to 509 have no timing limitation.
The method in the embodiment of the application is applied to an NB-IoT system, the NB-IoT system comprises a COAP server and an NB-IoT module, the NB-IoT module is connected with at least two control nodes through a controller, and the method comprises the following steps: the NB-IoT module generates a first data packet according to a COAP protocol and uploads the first data packet to the COAP server; the COAP server receives a first data packet sent by the NB-IoT module, and generates a fourth CRC check code according to a first data parameter in the first data packet; the COAP server confirms that the first data packet is correct if the first CRC check code and the fourth CRC check code match successfully. Or, the NB-IoT module issues the first data packet to the first control node, or receives the first data content uploaded by the first control node. In this way, not only can one NB-IoT module be connected to at least two control nodes, reducing the number of NB-IoT modules used in the electronic device and effectively saving the cost, but also the COAP server checks the first data packet uploaded by the NB-IoT module, effectively improving the reliability of uploading/issuing the first data content, and thus improving the accuracy of the first data content.
Example two
In the case that the electronic device is a COAP server, as shown in fig. 6, which is another embodiment of the data generating method based on the COAP protocol in the embodiment of the present invention, the method is applied to an NB-IoT system, where the NB-IoT system includes the COAP server and an NB-IoT module, and the NB-IoT module connects at least two control nodes through a controller, and the method may include:
601. and the COAP server generates a second data packet according to the COAP protocol.
The second data packet comprises second data content, and the second data content is second Modbus RTU frame format data; the second Modbus RTU frame format data comprises a second data parameter and a second CRC check code; the second data parameter comprises a second device number, a second function number, a second register start address, a second register unit length, a second byte number and second actual data.
602. And the COAP server issues the second data packet to the NB-IoT module.
603. The NB-IoT module receives a second data packet sent by the COAP server.
604. The NB-IoT module generates a third CRC check code according to the second data parameter.
605. The NB-IoT module confirms that the second packet is correct if the second CRC check code and the third CRC check code match successfully.
It can be understood that the NB-IoT module processes the second data content through the CRC algorithm to obtain the third check code, and then matches the second check code sent by the COAP server with the third check code to determine whether the data content is correct, thereby also effectively improving the accuracy of the data content.
The method in the embodiment of the application is applied to an NB-IoT system, the NB-IoT system comprises a COAP server and an NB-IoT module, the NB-IoT module is connected with at least two control nodes through a controller, and the method comprises the following steps: the COAP server generates a second data packet according to a COAP protocol and issues the second data packet to the NB-IoT module; the NB-IoT module receives a second data packet sent by the COAP server and generates a third CRC check code according to a second data parameter included in the second data packet; the NB-IoT module confirms that the second packet is correct if the second CRC check code and the third CRC check code match successfully. In this way, not only can one NB-IoT module be connected to at least two control nodes, reducing the number of NB-IoT modules used in the electronic device and effectively saving the cost, but also the COAP server checks the second data packet uploaded by the NB-IoT module, effectively improving the reliability of uploading/issuing the second data content, and thus improving the accuracy of the second data content.
As shown in fig. 7, which is a schematic view of an embodiment of an electronic device in an embodiment of the present invention, the electronic device is applied to an internet of things system, the internet of things system includes a COAP server and an internet of things module, the internet of things module is connected to at least two control nodes through a controller, the electronic device is the COAP server, or the internet of things module, and the electronic device may include: a processing module 701 and a transceiver module 702;
a processing module 701, configured to generate a data packet according to a COAP protocol, where the data packet includes data content, and the data content is data in a Modbus RTU frame format;
wherein, this electronic equipment is this COAP server, or, this thing networking module.
Alternatively, in some embodiments of the present invention,
the processing module 701 is specifically configured to, when the electronic device is the internet of things module, generate a first data packet according to a COAP protocol, where the first data packet includes first data content, and the first data content is first Modbus RTU frame format data; the first Modbus RTU frame format data comprises a first data parameter and a first CRC check code; the first data parameter comprises a first equipment number, a first function number, a first register initial address, a first register unit length, a first byte number and first actual data; or, in a case that the electronic device is the COAP server, generating a second data packet according to a COAP protocol, where the second data packet includes second data content, and the second data content is second Modbus RTU frame format data; the second Modbus RTU frame format data comprises a second data parameter and a second CRC check code; the second data parameter includes a second device number, a second function number, a second register start address, a second register unit length, a second byte number, and second actual data.
Alternatively, in some embodiments of the present invention,
the first device number is used for the controller to allocate respective serial numbers ID to the at least two control nodes.
Alternatively, in some embodiments of the present invention,
in the case that the electronic device is the internet of things module, the transceiver module 702 is specifically configured to upload the first data packet to the COAP server; and/or transmitting the first data packet to the at least two control nodes through the controller.
Alternatively, in some embodiments of the present invention,
in the case that the electronic device is the internet of things module, the transceiver module 702 is further configured to receive a second data packet sent by the COAP server;
the processing module 701 is further configured to generate a third CRC check code according to the second data parameter; and confirming that the second data packet is correct if the second CRC check code and the third CRC check code are matched successfully.
Alternatively, in some embodiments of the present invention,
in a case that the electronic device is the internet of things module, the transceiver module 702 is further configured to receive, through the controller, data information sent by a first control node, where the at least two control nodes include the first control node.
Alternatively, in some embodiments of the present invention,
in the case that the electronic device is the COAP server, the transceiver module 702 is specifically configured to issue the second data packet to the internet of things module.
Alternatively, in some embodiments of the present invention,
in the case that the electronic device is the COAP server, the transceiver module 702 is further configured to receive a first data packet sent by the internet of things module;
the processing module 701 is further configured to generate a fourth CRC check code according to the first data parameter; and confirming that the first data packet is correct under the condition that the first CRC check code and the fourth CRC check code are matched successfully.
As shown in fig. 8, which is a schematic view of another embodiment of an electronic device in an embodiment of the present invention, the electronic device is applied to an internet of things system, the internet of things system includes a COAP server and an internet of things module, the internet of things module is connected to at least two control nodes through a controller, the electronic device is the COAP server, or the internet of things module, and the electronic device may include: a memory 801 and a processor 802;
a processor 802, configured to generate a data packet according to a COAP protocol, where the data packet includes data content, and the data content is data in a Modbus RTU frame format;
wherein, this electronic equipment is this COAP server, or, this thing networking module.
Optionally, the processor 802 further has the following functions:
under the condition that the electronic equipment is the internet of things module, generating a first data packet according to a COAP protocol, wherein the first data packet comprises first data content, and the first data content is first Modbus RTU frame format data; the first Modbus RTU frame format data comprises a first data parameter and a first CRC check code; the first data parameter comprises a first equipment number, a first function number, a first register initial address, a first register unit length, a first byte number and first actual data; or, in a case that the electronic device is the COAP server, generating a second data packet according to a COAP protocol, where the second data packet includes second data content, and the second data content is second Modbus RTU frame format data; the second Modbus RTU frame format data comprises a second data parameter and a second CRC check code; the second data parameter includes a second device number, a second function number, a second register start address, a second register unit length, a second byte number, and second actual data.
Optionally, the processor 802 further has the following functions:
the first device number is used for the controller to allocate respective serial numbers ID to the at least two control nodes.
Optionally, the processor 802 further has the following functions:
uploading the first data packet to the COAP server under the condition that the electronic equipment is the Internet of things module; and/or transmitting the first data packet to the at least two control nodes through the controller.
Optionally, the processor 802 further has the following functions:
receiving a second data packet sent by the COAP server under the condition that the electronic equipment is the Internet of things module; generating a third CRC check code according to the second data parameter; and confirming that the second data packet is correct if the second CRC check code and the third CRC check code are matched successfully.
Optionally, the processor 802 further has the following functions:
under the condition that the electronic equipment is the internet of things module, data information sent by a first control node is received through the controller, and the at least two control nodes comprise the first control node.
Optionally, the processor 802 further has the following functions:
and under the condition that the electronic equipment is the COAP server, transmitting the second data packet to the Internet of things module.
Optionally, the processor 802 further has the following functions:
under the condition that the electronic equipment is the COAP server, receiving a first data packet sent by the Internet of things module; generating a fourth CRC check code according to the first data parameter; and confirming that the first data packet is correct under the condition that the first CRC check code and the fourth CRC check code are matched successfully.
The memory 801 stores processing procedures and processing results of the processor 802.
In the above embodiments, the implementation may be wholly or partially realized by software, hardware, firmware, or any combination thereof. When implemented in software, may be implemented in whole or in part in the form of a computer program product.
The computer program product includes one or more computer instructions. When loaded and executed on a computer, cause the flow or functions described in accordance with the embodiments of the invention, in whole or in part. The computer may be a general purpose computer, a special purpose computer, a network of computers, or other programmable device. The computer instructions may be stored in a computer readable storage medium or transmitted from one computer readable storage medium to another, for example, from one website site, computer, server, or data center to another website site, computer, server, or data center via wired (e.g., coaxial cable, fiber optic, Digital Subscriber Line (DSL)) or wireless (e.g., infrared, wireless, microwave, etc.). The computer-readable storage medium can be any available medium that a computer can store or a data storage device, such as a server, a data center, etc., that is integrated with one or more available media. The usable medium may be a magnetic medium (e.g., floppy Disk, hard Disk, magnetic tape), an optical medium (e.g., DVD), or a semiconductor medium (e.g., Solid State Disk (SSD)), among others.
It is clear to those skilled in the art that, for convenience and brevity of description, the specific working processes of the above-described systems, apparatuses and units may refer to the corresponding processes in the foregoing method embodiments, and are not described herein again.
In the embodiments provided in the present invention, it should be understood that the disclosed system, apparatus and method may be implemented in other ways. For example, the above-described apparatus embodiments are merely illustrative, and for example, the division of the units is only one logical division, and other divisions may be realized in practice, for example, a plurality of units or components may be combined or integrated into another system, or some features may be omitted, or not executed. In addition, the shown or discussed mutual coupling or direct coupling or communication connection may be an indirect coupling or communication connection through some interfaces, devices or units, and may be in an electrical, mechanical or other form.
The units described as separate parts may or may not be physically separate, and parts displayed as units may or may not be physical units, may be located in one place, or may be distributed on a plurality of network units. Some or all of the units can be selected according to actual needs to achieve the purpose of the solution of the embodiment.
In addition, functional units in the embodiments of the present invention may be integrated into one processing unit, or each unit may exist alone physically, or two or more units are integrated into one unit. The integrated unit can be realized in a form of hardware, and can also be realized in a form of a software functional unit.
The integrated unit, if implemented in the form of a software functional unit 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 may 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 personal computer, a server, or a network device) 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: various media capable of storing program codes, such as a usb disk, a removable hard disk, a Read-Only Memory (ROM), a Random Access Memory (RAM), a magnetic disk, or an optical disk.
The above-mentioned embodiments are only used for illustrating the technical solutions of the present invention, and not for limiting the same; although the present invention has been described in detail with reference to the foregoing embodiments, it will be understood by those of ordinary skill in the art that: the technical solutions described in the foregoing embodiments may still be modified, or some technical features may be equivalently replaced; and such modifications or substitutions do not depart from the spirit and scope of the corresponding technical solutions of the embodiments of the present invention.

Claims (10)

1. A data generation method based on a COAP protocol is applied to an Internet of things system, the Internet of things system comprises a COAP server and an Internet of things module, the Internet of things module is connected with at least two control nodes through a controller, and the method comprises the following steps:
the electronic equipment generates a data packet according to a COAP protocol, wherein the data packet comprises data content, and the data content is Modbus RTU frame format data;
the electronic device is the COAP server or the Internet of things module.
2. The method of claim 1, wherein the electronic device generates the data packet according to a COAP protocol, comprising:
under the condition that the electronic equipment is the internet of things module, the electronic equipment generates a first data packet according to a COAP protocol, wherein the first data packet comprises first data content, and the first data content is first Modbus RTU frame format data; the first Modbus RTU frame format data comprises a first data parameter and a first CRC check code; the first data parameter comprises a first equipment number, a first function number, a first register initial address, a first register unit length, a first byte number and first actual data; or the like, or, alternatively,
under the condition that the electronic equipment is the COAP server, the electronic equipment generates a second data packet according to a COAP protocol, wherein the second data packet comprises second data content, and the second data content is second Modbus RTU frame format data; the second Modbus RTU frame format data comprises a second data parameter and a second CRC check code; the second data parameter comprises a second device number, a second function number, a second register start address, a second register unit length, a second byte number and second actual data.
3. The method of claim 2, wherein the first device number is used for the controller to assign respective sequence numbers, IDs, to the at least two control nodes.
4. The method of claim 2 or 3, wherein in the case that the electronic device is the IOT module, the method further comprises:
the electronic equipment uploads the first data packet to the COAP server;
and/or the presence of a gas in the gas,
and the electronic equipment transmits the first data packet to the at least two control nodes through the controller.
5. The method of claim 4, further comprising:
the electronic equipment receives a second data packet sent by the COAP server;
the electronic equipment generates a third CRC according to the second data parameter;
the electronic device confirms that the second data packet is correct if the second CRC check code and the third CRC check code match successfully.
6. The method of claim 4, further comprising:
the electronic equipment receives first data content sent by a first control node through the controller, and the at least two control nodes comprise the first control node.
7. The method according to claim 2 or 3, wherein, in case the electronic device is the COAP server, the method further comprises:
and the electronic equipment issues the second data packet to the Internet of things module.
8. The method of claim 7, further comprising:
the electronic equipment receives a first data packet sent by the Internet of things module;
the electronic equipment generates a fourth CRC according to the first data parameter;
the electronic device confirms that the first data packet is correct if the first CRC check code and the fourth CRC check code match successfully.
9. An electronic device, wherein the electronic device is applied to an internet of things system, the internet of things system includes a COAP server and an internet of things module, the internet of things module is connected to at least two control nodes through a controller, the electronic device is the COAP server, or the internet of things module, and the electronic device includes:
and the processing module is used for generating a data packet according to a COAP protocol, wherein the data packet comprises data content, and the data content is Modbus RTU frame format data.
10. An electronic device, wherein the electronic device is applied to an internet of things system, the internet of things system includes a COAP server and an internet of things module, the internet of things module is connected to at least two control nodes through a controller, the electronic device is the COAP server, or the internet of things module, and the electronic device includes:
a memory storing executable program code;
and a processor coupled to the memory;
the processor calls the executable program code stored in the memory for performing the method of any one of claims 1-8.
CN202011512005.4A 2020-12-18 2020-12-18 Data generation method based on COAP protocol, electronic device and readable storage medium Pending CN112637190A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202011512005.4A CN112637190A (en) 2020-12-18 2020-12-18 Data generation method based on COAP protocol, electronic device and readable storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202011512005.4A CN112637190A (en) 2020-12-18 2020-12-18 Data generation method based on COAP protocol, electronic device and readable storage medium

Publications (1)

Publication Number Publication Date
CN112637190A true CN112637190A (en) 2021-04-09

Family

ID=75317769

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202011512005.4A Pending CN112637190A (en) 2020-12-18 2020-12-18 Data generation method based on COAP protocol, electronic device and readable storage medium

Country Status (1)

Country Link
CN (1) CN112637190A (en)

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN106209812A (en) * 2016-07-04 2016-12-07 深圳市得润车联科技有限公司 A kind of method of internet-of-things terminal platform data encapsulation
CN108989367A (en) * 2017-05-31 2018-12-11 深圳市中兴微电子技术有限公司 A kind of Internet of Things communication means, equipment and system
CN110336825A (en) * 2019-07-10 2019-10-15 广东工业大学 A kind of multiprotocol network fusion method and device based on IPv6 gateway
CN110417713A (en) * 2018-04-28 2019-11-05 广东亿迅科技有限公司 A kind of equipment data transmission method and device based on Internet of Things
CN110501944A (en) * 2019-08-21 2019-11-26 东北大学秦皇岛分校 Production of hydrocarbons intelligent monitor system and method based on NB-IoT

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN106209812A (en) * 2016-07-04 2016-12-07 深圳市得润车联科技有限公司 A kind of method of internet-of-things terminal platform data encapsulation
CN108989367A (en) * 2017-05-31 2018-12-11 深圳市中兴微电子技术有限公司 A kind of Internet of Things communication means, equipment and system
CN110417713A (en) * 2018-04-28 2019-11-05 广东亿迅科技有限公司 A kind of equipment data transmission method and device based on Internet of Things
CN110336825A (en) * 2019-07-10 2019-10-15 广东工业大学 A kind of multiprotocol network fusion method and device based on IPv6 gateway
CN110501944A (en) * 2019-08-21 2019-11-26 东北大学秦皇岛分校 Production of hydrocarbons intelligent monitor system and method based on NB-IoT

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
张康: "基于 CoAP 协议的数据采集系统设计与实现", 《中国优秀硕士论文全文数据库信息科技辑》 *

Similar Documents

Publication Publication Date Title
CN108965484B (en) Internet of things data transmission method, system and terminal
CN109768970B (en) Configurable universal protocol generation method
KR100605177B1 (en) Connection handling apparatus of home network management system
CN111083161A (en) Data transmission processing method and device and Internet of things equipment
US6697366B1 (en) Ethernet memory management system and methods for operation thereof
US11563832B2 (en) Data sending method and device, data receiving method and device, and system
CN104521219A (en) Message tunneling in industrial networks
US10833952B2 (en) Introducing latency and delay for test or debug purposes in a SAN environment
JP2017503405A (en) Method, switch and controller for processing address resolution protocol messages
CN106603506B (en) Data communication method, device and system based on multi-field bus
CN110213756A (en) A kind of data transmission method, device and its relevant device
KR20170033592A (en) Method and apparatus for transmitting/receiving data in a communication system
EP1035682A1 (en) Method and bus interface employing a memory in an integrated circuit for linking a bus with an application device
US7961614B2 (en) Information processing device, information processing method, and recording medium for reducing consumption of memory capacity
CN113676386B (en) FC-AE-1553 bus protocol message communication system
CN112737995B (en) Method, device and equipment for processing Ethernet frame and storage medium
CN108460044B (en) Data processing method and device
CN112637190A (en) Data generation method based on COAP protocol, electronic device and readable storage medium
CN114827967B (en) Software updating method, bluetooth device and storage medium
CN112422485A (en) Communication method and device of transmission control protocol
CN112019358A (en) Network configuration method, device, equipment and system
CN108334424B (en) Method for filtering redundant data of network communication management platform based on LPWAN technology
CN106713008B (en) The method that a kind of pair of EOC local-side device is tested for the property
EP3591535B1 (en) Addressing mechanism
CN114584630B (en) Communication method and device based on field bus protocol

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
RJ01 Rejection of invention patent application after publication

Application publication date: 20210409

RJ01 Rejection of invention patent application after publication