CN111131403A - Message coding and decoding method and device for Internet of things equipment - Google Patents

Message coding and decoding method and device for Internet of things equipment Download PDF

Info

Publication number
CN111131403A
CN111131403A CN201911239552.7A CN201911239552A CN111131403A CN 111131403 A CN111131403 A CN 111131403A CN 201911239552 A CN201911239552 A CN 201911239552A CN 111131403 A CN111131403 A CN 111131403A
Authority
CN
China
Prior art keywords
decoding
coding
message
converted
data
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
CN201911239552.7A
Other languages
Chinese (zh)
Inventor
李杰铭
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Shenzhen Mengma Electric Technology Co ltd
Original Assignee
Shenzhen Mengma Electric Technology Co ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Shenzhen Mengma Electric Technology Co ltd filed Critical Shenzhen Mengma Electric Technology Co ltd
Priority to CN201911239552.7A priority Critical patent/CN111131403A/en
Publication of CN111131403A publication Critical patent/CN111131403A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • 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/50Network services
    • H04L67/56Provisioning of proxy services
    • H04L67/565Conversion or adaptation of application format or content
    • 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/08Protocols for interworking; Protocol conversion
    • 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/22Parsing or analysis of headers

Abstract

The invention belongs to the field of communication of the Internet of things, and particularly relates to a message coding and decoding method and device for Internet of things equipment. The embodiment of the invention obtains the processed data to be converted by obtaining the configuration information, the data to be converted and the expected message type, processes the data to be converted, then obtains the node information of the corresponding coding and decoding node from the configuration information according to the expected message type, generates the coding and decoding method according to the node information, and finally performs the corresponding coding and decoding operation on the processed data to be converted according to the generated coding and decoding method to obtain the coding and decoding result.

Description

Message coding and decoding method and device for Internet of things equipment
Technical Field
The invention belongs to the field of communication of the Internet of things, and particularly relates to a message coding and decoding method and device for Internet of things equipment.
Background
With the continuous improvement of the technological development level, the field of the internet of things is a current hotspot. However, many internet of things manufacturers do not have a unified protocol standard, that is, there is a unified standard which is often also in a specific field. Because the internet of things relates to a great number of specific application fields, a great number of message protocols in different forms are brought.
For devices using a message protocol, it also needs to decode the received message to obtain specific information, and when sending the message, it needs to encode the message according to the protocol. This results in that a lot of time and effort of the developer are consumed in the encoding and decoding of the message during the development process, and errors may occur during the encoding and decoding process.
Disclosure of Invention
In view of this, embodiments of the present invention provide a message encoding and decoding method and device for an internet of things device, so as to solve the problems of a large workload in the existing encoding and decoding process and a possibility of errors in the encoding and decoding process.
A first aspect of an embodiment of the present invention provides a message encoding and decoding method for an internet of things device, including:
acquiring configuration information, data to be converted and an expected message type;
processing the data to be converted to obtain processed data to be converted;
acquiring node information of a corresponding coding and decoding node from the configuration information according to the expected message type, and generating a coding and decoding method according to the node information;
and performing corresponding encoding and decoding operations on the processed data to be converted according to the encoding and decoding method to obtain an encoding and decoding result.
Optionally, the generating a coding and decoding method according to the node information includes:
and generating the coding and decoding method according to the node type and the node attribute in the node information.
Optionally, if the coding and decoding node has a child node, the coding and decoding methods of the child node are sequentially obtained, and the coding and decoding methods of the child node are combined to obtain the coding and decoding methods of the coding and decoding node.
Optionally, the processing the data to be converted includes:
in the encoding process, corresponding encoding operation is carried out by acquiring the attribute information of the data to be converted;
and in the decoding process, acquiring the current data to be converted through the zone bit, and performing corresponding decoding operation.
A second aspect of the embodiments of the present invention provides a message encoding and decoding apparatus for an internet of things device, including:
the first acquisition module is used for acquiring configuration information, data to be converted and expected message types;
the processing module is used for processing the data to be converted to obtain processed data to be converted;
a second obtaining module, configured to obtain node information of a corresponding coding and decoding node from the configuration information according to the expected message type, and generate a coding and decoding method according to the node information;
and the result module is used for carrying out corresponding coding and decoding operations on the processed data to be converted according to the coding and decoding method to obtain a coding and decoding result.
Optionally, the message encoding and decoding apparatus for an internet of things device includes:
and the generating module is used for generating the coding and decoding method according to the node type and the node attribute in the node information.
Optionally, the message encoding and decoding apparatus for an internet of things device includes:
and the merging module is used for sequentially acquiring the coding and decoding methods of the child nodes if the coding and decoding nodes have the child nodes, and merging the coding and decoding methods of the child nodes to obtain the coding and decoding methods of the coding and decoding nodes.
Optionally, the message encoding and decoding apparatus for an internet of things device includes:
the encoding module is used for performing corresponding encoding operation by acquiring the attribute information of the data to be converted in the encoding process;
and the decoding module is used for acquiring the current data to be converted through the zone bit in the decoding process and carrying out corresponding decoding operation.
A third aspect of the embodiments of the present invention provides a message codec, including a processor, a memory connected to the processor, and a computer program stored in the memory and executable on the processor, where the processor implements the steps of the message codec method for the internet of things device when executing the computer program.
A fourth aspect of the embodiments of the present invention provides a computer-readable storage medium, where a computer program is stored, and when the computer program is executed by a processor, the steps of the message coding and decoding method for an internet of things device are implemented.
The embodiment of the invention obtains the processed data to be converted by obtaining the configuration information, the data to be converted and the expected message type, processes the data to be converted, then obtains the node information of the corresponding coding and decoding node from the configuration information according to the expected message type, generates the coding and decoding method according to the node information, and finally performs the corresponding coding and decoding operation on the processed data to be converted according to the generated coding and decoding method to obtain the coding and decoding result.
Drawings
In order to more clearly illustrate the technical solutions in the embodiments of the present invention, the drawings needed for the embodiments or the prior art descriptions will be briefly described below, and it is obvious that the drawings in the following description are only some embodiments of the present invention, and it is obvious for those skilled in the art to obtain other drawings without creative efforts.
Fig. 1 is a schematic flowchart of a message encoding and decoding method for internet of things equipment according to an embodiment of the present invention;
fig. 2 is a schematic structural diagram of a message encoding and decoding device of an internet of things device according to an embodiment of the present invention;
fig. 3 is a schematic structural diagram of a message codec according to an embodiment of the present invention.
Detailed Description
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 clearly described below with reference to the drawings in the embodiments of the present invention, and it is obvious that the described embodiments are some embodiments of the present invention, but not all embodiments. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present invention.
The terms "comprises" and "comprising," and any variations thereof, in the description and claims of this invention and the above-described drawings are intended to cover non-exclusive inclusions. For example, a process, method, or system, article, or apparatus that comprises a list of steps or elements is not limited to only those steps or elements listed, but may alternatively include other steps or elements not listed, or inherent to such process, method, article, or apparatus. Furthermore, the terms "first," "second," and "third," etc. are used to distinguish between different objects and are not used to describe a particular order.
As shown in fig. 1, which is a schematic flow chart of a message coding and decoding method for an internet of things device according to an embodiment of the present invention, the message coding and decoding method for an internet of things device may include:
step S101, obtaining configuration information, data to be converted and expected message types.
In a specific application, the message codec may perform a corresponding operation by acquiring the configuration information, the message to be converted, and the expected message type. The configuration information includes information of message protocols supported by all encoding and decoding methods, and the information refers to information required by a data structure and encoding and decoding of the message protocols, and the configuration information can be different according to different message encoding and decoding protocols in actual use; the data to be converted is data waiting for conversion before an encoding process or a decoding process; the expected message type is a message type obtained after an encoding process or a decoding process, and generally represents a protocol of a certain characteristic message, and it can be understood that since there are many protocols supported in the configuration information, when a specific data is subjected to encoding and decoding operations, it is necessary to specify which protocol message type the data is.
By way of example and not limitation, during the encoding process, the data to be converted may be a JSON format character string, where JSON is a lightweight data exchange format, and stores and represents data in a text format completely independent of a programming language. Easy to read and write by human and easy to analyze and generate by machine. The message codec may be a binary message codec. The message codec protocol may be a binary message codec protocol. The specific message format may be a binary message format. The expected message type may be a CLCP type, that is, a CLCP protocol, wherein messages of the CLCP protocol include, but are not limited to, a start field, a stub type, an identification code, a packet length, a version field, a sequence number, and the like.
And S102, processing the data to be converted to obtain the processed data to be converted.
In a specific application, data to be converted acquired in a message codec is subjected to certain processing to obtain processed data to be converted which conforms to the codec operation, and then certain operation is performed.
Optionally, step S102 further includes:
and in the encoding process, corresponding encoding operation is carried out by acquiring the attribute information of the data to be converted.
In a specific application, the acquired data to be converted is processed, for example, in the encoding process, the acquired data to be converted can be converted into a suitable form, then the attribute information in the data to be converted is acquired, and then the corresponding encoding operation is performed. It will be appreciated that the converted data is composed of attribute values, an attribute being an attribute of this data; the protocol is the format of this data.
As an example and not by way of limitation, the data to be converted may be a JSON string, the JSON string is converted into a JSON object, and an attribute value may be quickly obtained according to a name in the attribute information, where the JSON object is a storage manner of a JSON message, and a field value may be conveniently obtained using a field name.
And in the decoding process, acquiring the current data to be converted through the zone bit, and performing corresponding decoding operation.
In a specific application, the acquired data to be converted is processed, for example, in the decoding process, the data currently required to be decoded can be acquired through the flag bits, and then the corresponding decoding operation is performed.
Optionally, the flag bit is a flag field, which identifies the number of bits of the currently parsed field, for example, a binary data of 20Bytes is input, and the flag is initially marked as 0, so that when parsing starts from the header of 20Bytes, and a 2Bytes long reshaped field is parsed, the flag becomes 2, which indicates that the next parsing starts from the second Byte rather than the header.
Step S103, acquiring node information of a corresponding coding and decoding node from the configuration information according to the expected message type, and generating a coding and decoding method according to the node information.
In specific application, the configuration information is obtained from the message coder-decoder, the node information of the corresponding coding and decoding node is obtained from the configuration information according to the expected message type, and the coding and decoding method of the corresponding coding and decoding node is generated according to the node information. The coding and decoding method is obtained through configuration information, and the type of each node in the configuration information corresponds to a coding method; the codec node is a data structure with format, which can be used to describe a specific message format, partial field format in the message or a codec rule, and the message protocol can be described by the data structure. It can be understood that, both the encoding process and the decoding process need to utilize a specific protocol, so both the encoding process and the decoding process need to obtain the expected message type, and the corresponding node can be obtained according to the type of the protocol.
Optionally, there are many types of codec nodes, for example: a field node, which can describe a specific field, such as an integer, a floating point number, a character string, etc.; an object node that can describe an object consisting of a set of different fields, wherein each message is an object; a list node that can describe a list consisting of a set of identical fields; the check node can describe a rule for checking specific data, such as a fixed constant, a check code and the like; the rule node may describe a rule for preprocessing data, and provide an effective environment for other coding and decoding nodes, such as a data length rule, a keyword mapping rule, an ignoring rule, and the like. In this case, the list node may include an object node and a field node in a nested manner; the object node can be nested and contains all types of coding and decoding nodes.
Optionally, step S103 further includes: and generating the coding and decoding method according to the node type and the node attribute in the node information.
In a specific application, configuration information is obtained from a message codec, node information of a corresponding codec node is obtained from the configuration information according to an expected message type, and a codec method of each sub-node is generated according to the node type and the node attribute in the node information.
Optionally, if the coding and decoding node has a child node, the coding and decoding methods of the child node are sequentially obtained, and the coding and decoding methods of the child node are combined to obtain the coding and decoding methods of the coding and decoding node.
In a specific application, if there are children nodes in the coding and decoding nodes, sequentially reading the children nodes in the coding and decoding nodes in a linear manner, then obtaining configuration information from a message coder and decoder, obtaining node information of the corresponding children nodes from the configuration information according to an expected message type, then generating coding and decoding methods of the children nodes according to the node type and node attributes in the node information, and then combining the coding and decoding methods of all the children nodes to obtain the coding and decoding methods of the coding and decoding nodes. The number of the child nodes may be one, or two or more.
And step S104, performing corresponding encoding and decoding operations on the processed data to be converted according to the encoding and decoding method to obtain an encoding and decoding result.
In specific application, the data to be converted after being processed is subjected to coding and decoding operations according to a coding and decoding method corresponding to the coding and decoding node, and a coding and decoding result is obtained.
Optionally, if the encoding is successful, the successful encoding result includes binary data that is encoded; if the encoding result is failed, the failed encoding result includes the reason of the encoding failure, and under the general use condition, the encoding failure description is that the data to be converted has a problem.
Optionally, in the decoding process, the decoding result of the obtained coding and decoding node is a JSON object, and the JSON object is converted into a character string. If the decoding is successful, the successful decoding result comprises the decoded JSON message, namely the JSON character string and possible residual binary data; if the decoding result is failed, the failed decoding result includes the reason of the decoding failure and the remaining binary number.
The embodiment of the invention obtains the processed data to be converted by obtaining the configuration information, the data to be converted and the expected message type, processes the data to be converted, then obtains the node information of the corresponding coding and decoding node from the configuration information according to the expected message type, generates the coding and decoding method according to the node information, and finally performs the corresponding coding and decoding operation on the processed data to be converted according to the generated coding and decoding method to obtain the coding and decoding result.
It should be understood that, the sequence numbers of the steps in the foregoing embodiments do not imply an execution sequence, and the execution sequence of each process should be determined by its function and inherent logic, and should not constitute any limitation to the implementation process of the embodiments of the present invention.
As shown in fig. 2, a message coding and decoding device 2 of an internet of things device according to an embodiment of the present invention is configured to execute method steps in a message coding and decoding method embodiment of the internet of things device, where the message coding and decoding device of the internet of things device may include:
a first obtaining module 201, configured to obtain configuration information, data to be converted, and a desired message type.
In a specific application, the message codec may perform a corresponding operation by acquiring the configuration information, the message to be converted, and the expected message type, and may obtain a corresponding codec node according to the acquired expected message type. The configuration information includes information of message protocols supported by all encoding and decoding methods, and the information refers to information required by a data structure and encoding and decoding of the message protocols, and the configuration information can be different according to different message encoding and decoding protocols in actual use; the data to be converted is data waiting for conversion before an encoding process or a decoding process; the expected message type is a message type obtained after an encoding process or a decoding process, and generally represents a protocol of a certain characteristic message, and it can be understood that since there are many protocols supported in the configuration information, when a specific data is subjected to encoding and decoding operations, it is necessary to specify which protocol message type the data is.
By way of example and not limitation, during the encoding process, the data to be converted may be a JSON format character string, where JSON is a lightweight data exchange format, and stores and represents data in a text format completely independent of a programming language. Easy to read and write by human and easy to analyze and generate by machine. The message codec may be a binary message codec. The message codec protocol may be a binary message codec protocol. The specific message format may be a binary message format. The expected message type may be a CLCP type, that is, a CLCP protocol, wherein messages of the CLCP protocol include, but are not limited to, a start field, a stub type, an identification code, a packet length, a version field, a sequence number, and the like.
The processing module 202 is configured to process the data to be converted to obtain processed data to be converted.
In a specific application, data to be converted acquired in a message codec is subjected to certain processing to obtain processed data to be converted which conforms to the codec operation, and then certain operation is performed.
A second obtaining module 203, configured to obtain node information of a corresponding coding and decoding node from the configuration information according to the expected message type, and generate a coding and decoding method according to the node information.
In specific application, the configuration information is obtained from the message coder-decoder, the node information of the corresponding coding and decoding node is obtained from the configuration information according to the expected message type, and the coding and decoding method of the corresponding coding and decoding node is generated according to the node information. The coding and decoding method is obtained through configuration information, and the type of each node in the configuration information corresponds to a coding method; the codec node is a data structure with format, which can be used to describe a specific message format, partial field format in the message or a codec rule, and the message protocol can be described by the data structure. It can be understood that, both the encoding process and the decoding process need to utilize a specific protocol, so both the encoding process and the decoding process need to obtain the expected message type, and the corresponding node can be obtained according to the type of the protocol.
And a result module 204, configured to perform corresponding encoding and decoding operations on the processed data to be converted according to the encoding and decoding method, so as to obtain an encoding and decoding result.
In specific application, the data to be converted after being processed is subjected to coding and decoding operations according to the coding and decoding method corresponding to each point, and coding and decoding results are obtained.
Optionally, if the encoding is successful, the successful encoding result includes binary data that is encoded; if the encoding result is failed, the failed encoding result includes the reason of the encoding failure, and under the general use condition, the encoding failure description is that the data to be converted has a problem.
Optionally, in the decoding process, the decoding result of the obtained coding and decoding node is a JSON object, and the JSON object is converted into a character string. If the decoding is successful, the successful decoding result comprises the decoded JSON message, namely the JSON character string and possible residual binary data; if the decoding result is failed, the failed decoding result includes the reason of the decoding failure and the remaining binary number.
Optionally, the message encoding and decoding apparatus of the internet of things device further includes:
and the generating module is used for generating the coding and decoding method according to the node type and the node attribute in the node information.
In a specific application, configuration information is obtained from a message codec, node information of a corresponding codec node is obtained from the configuration information according to an expected message type, and a codec method of each sub-node is generated according to the node type and the node attribute in the node information.
Optionally, the message encoding and decoding apparatus of the internet of things device further includes:
and the merging module is used for sequentially acquiring the coding and decoding methods of the child nodes if the coding and decoding nodes have the child nodes, and merging the coding and decoding methods of the child nodes to obtain the coding and decoding methods of the coding and decoding nodes.
In a specific application, if there are children nodes in the coding and decoding nodes, sequentially reading the children nodes in the coding and decoding nodes in a linear manner, then obtaining configuration information from a message coder and decoder, obtaining node information of the corresponding children nodes from the configuration information according to an expected message type, then generating coding and decoding methods of the children nodes according to the node type and node attributes in the node information, and then combining the coding and decoding methods of all the children nodes to obtain the coding and decoding methods of the coding and decoding nodes. The number of the child nodes may be one, or two or more.
Optionally, the message encoding and decoding apparatus of the internet of things device further includes:
and the coding module is used for carrying out corresponding coding operation by acquiring the attribute information of the data to be converted in the coding process.
In a specific application, the acquired data to be converted is processed, for example, in the encoding process, the acquired data to be converted can be converted into a suitable form, then the attribute information in the data to be converted is acquired, and then the corresponding encoding operation is performed. It will be appreciated that the converted data is composed of attribute values, an attribute being an attribute of this data; the protocol is the format of this data.
As an example and not by way of limitation, the data to be converted may be a JSON string, the JSON string is converted into a JSON object, and an attribute value may be quickly obtained according to a name in the attribute information, where the JSON object is a storage manner of a JSON message, and a field value may be conveniently obtained using a field name.
And the decoding module is used for acquiring the current data to be converted through the zone bit in the decoding process and carrying out corresponding decoding operation.
In a specific application, the acquired data to be converted is processed, for example, in the decoding process, the data currently required to be decoded can be acquired through the flag bits, and then the corresponding decoding operation is performed.
The embodiment of the invention obtains the processed data to be converted by obtaining the configuration information, the data to be converted and the expected message type, processes the data to be converted, then obtains the node information of the corresponding coding and decoding node from the configuration information according to the expected message type, generates the coding and decoding method according to the node information, and finally performs the corresponding coding and decoding operation on the processed data to be converted according to the generated coding and decoding method to obtain the coding and decoding result.
As shown in fig. 3, an embodiment of the present invention further provides a message codec 3 including: a processor 300, a memory 301 connected to the processor 300, and a computer program 302 stored in the memory 301 and operable on the processor 300, such as a message codec program of an internet of things device. The processor 300, when executing the computer program 302, implements the steps in the message coding and decoding method embodiments of the internet of things devices, such as the steps S101 to S104 shown in fig. 1. Alternatively, the processor 300, when executing the computer program 302, implements the functions of the modules in the above device embodiments, such as the functions of the modules 201 to 204 shown in fig. 2.
Illustratively, the computer program 302 may be partitioned into one or more modules that are stored in the memory 301 and executed by the processor 300 to implement the present invention. The one or more modules may be a series of computer program instruction segments capable of performing specific functions, which are used to describe the execution of the computer program 302 in the message codec 3. For example, the computer program 302 may be divided into a first obtaining module 201, a processing module 202, a second obtaining module 203, and a result module 204, and the specific functions of the modules are as follows:
a first obtaining module 201, configured to obtain configuration information, data to be converted, and an expected message type;
the processing module 202 is configured to process the data to be converted to obtain processed data to be converted;
a second obtaining module 203, configured to obtain node information of a corresponding coding and decoding node from the configuration information according to the expected message type, and generate a coding and decoding method according to the node information;
and a result module 204, configured to perform corresponding encoding and decoding operations on the processed data to be converted according to the encoding and decoding method, so as to obtain an encoding and decoding result.
The message codec 3 may include, but is not limited to, a processor 300, a memory 301. It will be appreciated by those skilled in the art that fig. 3 is merely an example of the message codec 3 and does not constitute a limitation of the message codec 3 and may comprise more or less components than shown, or combine certain components, or different components, e.g. the message codec may also comprise input output devices, network access devices, buses, etc.
The Processor 300 may be a Central Processing Unit (CPU), other general purpose Processor, a Digital Signal Processor (DSP), an Application Specific Integrated Circuit (ASIC), a Field Programmable Gate Array (FPGA) or other Programmable logic device, discrete Gate or transistor logic, discrete hardware components, etc. A general purpose processor may be a microprocessor or the processor may be any conventional processor or the like.
The memory 301 may be an internal storage unit of the message codec 3, such as a hard disk or a memory of the message codec 3. The memory 301 may also be an external storage device of the message codec 3, such as a plug-in hard disk provided on the message codec 3, a Smart Media Card (SMC), a Secure Digital (SD) Card, a Flash memory Card (Flash Card), and the like. Further, the memory 301 may also include both an internal storage unit of the message codec 3 and an external storage device. The memory 301 is used for storing the computer program and other programs and data required by the message codec. The memory 301 may also be used to temporarily store data that has been output or is to be output.
It will be apparent to those skilled in the art that, for convenience and brevity of description, only the above-mentioned division of the functional units and modules is illustrated, and in practical applications, the above-mentioned function distribution may be performed by different functional units and modules according to needs, that is, the internal structure of the apparatus is divided into different functional units or modules to perform all or part of the above-mentioned functions. Each functional unit and module in the embodiments may be integrated in one processing unit, or each unit may exist alone physically, or two or more units are integrated in one unit, and the integrated unit may be implemented in a form of hardware, or in a form of software functional unit. In addition, specific names of the functional units and modules are only for convenience of distinguishing from each other, and are not used for limiting the protection scope of the present invention. The specific working processes of the units and modules in the system may refer to the corresponding processes in the foregoing method embodiments, and are not described herein again.
In the above embodiments, the descriptions of the respective embodiments have respective emphasis, and reference may be made to the related descriptions of other embodiments for parts that are not described or illustrated in a certain embodiment.
Those of ordinary skill in the art will appreciate that the various illustrative elements and algorithm steps described in connection with the embodiments disclosed herein may be implemented as electronic hardware or combinations of computer software and electronic hardware. Whether such functionality is implemented as hardware or software depends upon the particular application and design constraints imposed on the implementation. Skilled artisans may implement the described functionality in varying ways for each particular application, but such implementation decisions should not be interpreted as causing a departure from the scope of the present invention.
In the embodiments provided in the present invention, it should be understood that the disclosed apparatus/message codec and method may be implemented in other ways. For example, the above-described device/message codec embodiments are merely illustrative, and for example, the division of the modules or units is only one logical function division, and there may be other division manners in actual implementation, 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 module, 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, all or part of the flow of the method according to the embodiments of the present invention may also be implemented by a computer program, which may be stored in a computer-readable storage medium, and when the computer program is executed by a processor, the steps of the method embodiments may be implemented. Wherein the computer program comprises computer program code, which may be in the form of source code, object code, an executable file or some intermediate form, etc. The computer-readable medium may include: any entity or device capable of carrying the computer program code, recording medium, usb disk, removable hard disk, magnetic disk, optical disk, computer Memory, Read-Only Memory (ROM), Random Access Memory (RAM), electrical carrier wave signals, telecommunications signals, software distribution medium, etc. It should be noted that the computer readable medium may contain content that is subject to appropriate increase or decrease as required by legislation and patent practice in jurisdictions, for example, in some jurisdictions, computer readable media does not include electrical carrier signals and telecommunications signals as is required by legislation and patent practice.
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; such modifications and substitutions do not substantially depart from the spirit and scope of the embodiments of the present invention, and are intended to be included within the scope of the present invention.

Claims (10)

1. A message coding and decoding method for Internet of things equipment is characterized by comprising the following steps:
acquiring configuration information, data to be converted and an expected message type;
processing the data to be converted to obtain processed data to be converted;
acquiring node information of a corresponding coding and decoding node from the configuration information according to the expected message type, and generating a coding and decoding method according to the node information;
and performing corresponding encoding and decoding operations on the processed data to be converted according to the encoding and decoding method to obtain an encoding and decoding result.
2. The message coding and decoding method of the internet of things equipment as claimed in claim 1, wherein the generating of the coding and decoding method according to the node information comprises:
and generating the coding and decoding method according to the node type and the node attribute in the node information.
3. The message coding and decoding method of the internet of things equipment as claimed in claim 2, further comprising:
and if the coding and decoding nodes have subnodes, sequentially acquiring coding and decoding methods of the subnodes, and combining the coding and decoding methods of the subnodes to obtain the coding and decoding methods of the coding and decoding nodes.
4. The message coding and decoding method of the internet of things device as claimed in claim 1, wherein the processing the data to be converted comprises:
in the encoding process, corresponding encoding operation is carried out by acquiring the attribute information of the data to be converted;
and in the decoding process, acquiring the current data to be converted through the zone bit, and performing corresponding decoding operation.
5. The utility model provides a message coding and decoding device of thing networking equipment which characterized in that includes:
the first acquisition module is used for acquiring configuration information, data to be converted and expected message types;
the processing module is used for processing the data to be converted to obtain processed data to be converted;
a second obtaining module, configured to obtain node information of a corresponding coding and decoding node from the configuration information according to the expected message type, and generate a coding and decoding method according to the node information;
and the result module is used for carrying out corresponding coding and decoding operations on the processed data to be converted according to the coding and decoding method to obtain a coding and decoding result.
6. The message encoding and decoding device of the internet of things equipment as claimed in claim 5, comprising:
and the generating module is used for generating the coding and decoding method according to the node type and the node attribute in the node information.
7. The message encoding and decoding device of the internet of things equipment as claimed in claim 6, comprising:
and the merging module is used for sequentially acquiring the coding and decoding methods of the child nodes if the coding and decoding nodes have the child nodes, and merging the coding and decoding methods of the child nodes to obtain the coding and decoding methods of the coding and decoding nodes.
8. The message encoding and decoding device of the internet of things equipment as claimed in claim 5, comprising:
the encoding module is used for performing corresponding encoding operation by acquiring the attribute information of the data to be converted in the encoding process;
and the decoding module is used for acquiring the current data to be converted through the zone bit in the decoding process and carrying out corresponding decoding operation.
9. Message codec comprising a processor, a memory connected to the processor, and a computer program stored in the memory and executable on the processor, characterized in that the processor, when executing the computer program, implements the steps of a message codec method of an internet of things device as claimed in any one of claims 1 to 4.
10. A computer-readable storage medium, in which a computer program is stored, which, when being executed by a processor, implements the steps of the message coding and decoding method for an internet of things device according to any one of claims 1 to 4.
CN201911239552.7A 2019-12-06 2019-12-06 Message coding and decoding method and device for Internet of things equipment Pending CN111131403A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201911239552.7A CN111131403A (en) 2019-12-06 2019-12-06 Message coding and decoding method and device for Internet of things equipment

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201911239552.7A CN111131403A (en) 2019-12-06 2019-12-06 Message coding and decoding method and device for Internet of things equipment

Publications (1)

Publication Number Publication Date
CN111131403A true CN111131403A (en) 2020-05-08

Family

ID=70497562

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201911239552.7A Pending CN111131403A (en) 2019-12-06 2019-12-06 Message coding and decoding method and device for Internet of things equipment

Country Status (1)

Country Link
CN (1) CN111131403A (en)

Cited By (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112365388A (en) * 2020-10-15 2021-02-12 潍坊汇金海物联网技术有限公司 Method for realizing intelligent fire fighting based on Internet of things cloud platform
CN112511416A (en) * 2020-11-23 2021-03-16 四川长虹电器股份有限公司 Rule-based data communication protocol conversion system, decoding method and encoding method
CN112600562A (en) * 2020-12-01 2021-04-02 四川虹美智能科技有限公司 Encoding and decoding method and device, computer readable medium and Internet of things equipment
CN113381997A (en) * 2021-06-08 2021-09-10 四川精创国芯科技有限公司 Internet of things universal protocol conversion platform
CN115348330A (en) * 2022-06-21 2022-11-15 武汉船舶通信研究所(中国船舶重工集团公司第七二二研究所) Encoding/decoding device and encoding/decoding method
CN115604365A (en) * 2022-11-15 2023-01-13 南京芯传汇电子科技有限公司(Cn) Data encoding and decoding method and device, electronic equipment and readable storage medium

Citations (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1627757A (en) * 2003-12-12 2005-06-15 华为技术有限公司 Method for realizing general message interpreter
US20080037521A1 (en) * 2006-07-31 2008-02-14 Motorola, Inc. Apparatus and Method for End-to-End Adaptive Frame Packing and Redundancy in a Heterogeneous Network Environment
CN102118225A (en) * 2010-12-28 2011-07-06 北京航空航天大学 Coding-decoding method used for any-bit polynomial division type codes based on multi-index table
CN104468711A (en) * 2014-10-31 2015-03-25 上海融军科技有限公司 Universal data management coding method and system for internet of things
CN105245410A (en) * 2015-11-18 2016-01-13 四川神琥科技有限公司 Data encoding and transmitting method
WO2016029801A1 (en) * 2014-08-28 2016-03-03 华为技术有限公司 Encoding and decoding method, encoding device and decoding device
CN110278286A (en) * 2019-07-12 2019-09-24 四川虹美智能科技有限公司 The method and operation system interacted with internet of things equipment

Patent Citations (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1627757A (en) * 2003-12-12 2005-06-15 华为技术有限公司 Method for realizing general message interpreter
US20080037521A1 (en) * 2006-07-31 2008-02-14 Motorola, Inc. Apparatus and Method for End-to-End Adaptive Frame Packing and Redundancy in a Heterogeneous Network Environment
CN102118225A (en) * 2010-12-28 2011-07-06 北京航空航天大学 Coding-decoding method used for any-bit polynomial division type codes based on multi-index table
WO2016029801A1 (en) * 2014-08-28 2016-03-03 华为技术有限公司 Encoding and decoding method, encoding device and decoding device
CN104468711A (en) * 2014-10-31 2015-03-25 上海融军科技有限公司 Universal data management coding method and system for internet of things
CN105245410A (en) * 2015-11-18 2016-01-13 四川神琥科技有限公司 Data encoding and transmitting method
CN110278286A (en) * 2019-07-12 2019-09-24 四川虹美智能科技有限公司 The method and operation system interacted with internet of things equipment

Cited By (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112365388A (en) * 2020-10-15 2021-02-12 潍坊汇金海物联网技术有限公司 Method for realizing intelligent fire fighting based on Internet of things cloud platform
CN112511416A (en) * 2020-11-23 2021-03-16 四川长虹电器股份有限公司 Rule-based data communication protocol conversion system, decoding method and encoding method
CN112600562A (en) * 2020-12-01 2021-04-02 四川虹美智能科技有限公司 Encoding and decoding method and device, computer readable medium and Internet of things equipment
CN113381997A (en) * 2021-06-08 2021-09-10 四川精创国芯科技有限公司 Internet of things universal protocol conversion platform
CN115348330A (en) * 2022-06-21 2022-11-15 武汉船舶通信研究所(中国船舶重工集团公司第七二二研究所) Encoding/decoding device and encoding/decoding method
CN115604365A (en) * 2022-11-15 2023-01-13 南京芯传汇电子科技有限公司(Cn) Data encoding and decoding method and device, electronic equipment and readable storage medium
CN115604365B (en) * 2022-11-15 2023-03-10 南京芯传汇电子科技有限公司 Data encoding and decoding method and device, electronic equipment and readable storage medium

Similar Documents

Publication Publication Date Title
CN111131403A (en) Message coding and decoding method and device for Internet of things equipment
CN110597500B (en) Method and device for serialization and deserialization of message structure
CN110445860B (en) Message sending method, device, terminal equipment and storage medium
CN105450232A (en) Encoding method, decoding method, encoding device and decoding device
US8149148B1 (en) Local binary XML string compression
CN109104405B (en) Binary protocol encoding and decoding method and device
US8849726B2 (en) Information processing apparatus and control method for the same
CN110597814B (en) Structured data serialization and deserialization method and device
CN110545106B (en) Method and device for coding time series data
CN110708307B (en) Transcoder generation method and apparatus, electronic device, and storage medium
EP2219117A1 (en) A processing module, a device, and a method for processing of XML data
CN114020272A (en) Serialized encoding and decoding methods and devices and electronic equipment
WO2008156640A2 (en) A method and apparatus for encoding data
US20160259764A1 (en) Grammar generation for simple datatypes
CN110554878A (en) data conversion method, game data processing method and device and server
CN108415894B (en) Report data initialization method and device, computer equipment and storage medium
CN110381056B (en) Netty-based private protocol coding and decoding method and apparatus
CN111708541A (en) Method and device for compiling mirror image file
CN105793842B (en) Conversion method and device between serialized message
CN105808549B (en) Client method for automatically framing and analyzing frames based on mapping file
CN114070470A (en) Encoding and decoding method and device
CN115001628B (en) Data encoding method and device, data decoding method and device and data structure
CN115276889A (en) Decoding processing method, decoding processing device, computer equipment and storage medium
CN113283215B (en) Data confusion method and device based on UTF-32 coding
CN116016296B (en) Binary data processing method, system and equipment based on JSON

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: 20200508

RJ01 Rejection of invention patent application after publication