CN110971704B - Data transmission method and device based on JSON configuration file - Google Patents

Data transmission method and device based on JSON configuration file Download PDF

Info

Publication number
CN110971704B
CN110971704B CN201911269524.XA CN201911269524A CN110971704B CN 110971704 B CN110971704 B CN 110971704B CN 201911269524 A CN201911269524 A CN 201911269524A CN 110971704 B CN110971704 B CN 110971704B
Authority
CN
China
Prior art keywords
data
configuration file
internet
data frame
sent
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.)
Active
Application number
CN201911269524.XA
Other languages
Chinese (zh)
Other versions
CN110971704A (en
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.)
DBAPPSecurity Co Ltd
Original Assignee
DBAPPSecurity 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 DBAPPSecurity Co Ltd filed Critical DBAPPSecurity Co Ltd
Priority to CN201911269524.XA priority Critical patent/CN110971704B/en
Publication of CN110971704A publication Critical patent/CN110971704A/en
Application granted granted Critical
Publication of CN110971704B publication Critical patent/CN110971704B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

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/02Protocols based on web technology, e.g. hypertext transfer protocol [HTTP]
    • 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/2866Architectures; Arrangements
    • H04L67/30Profiles

Landscapes

  • Engineering & Computer Science (AREA)
  • Computer Networks & Wireless Communication (AREA)
  • Signal Processing (AREA)
  • Health & Medical Sciences (AREA)
  • Computing Systems (AREA)
  • General Health & Medical Sciences (AREA)
  • Medical Informatics (AREA)
  • Information Transfer Between Computers (AREA)

Abstract

The application discloses a data transmission method, a device, service processing equipment and a readable storage medium based on JSON configuration files, which comprises the following steps: loading a configuration file in a JSON format, wherein the configuration file is used for describing a binary protocol of the equipment of the Internet of things; when data is sent, text data to be sent to the Internet of things equipment is coded according to the configuration file to obtain a data frame of a binary protocol, and the data frame is sent to the Internet of things equipment; when data is received, a data frame of a binary protocol sent by the Internet of things equipment is received, and the data frame is decoded according to the configuration file to obtain text data. Therefore, the scheme only needs to define the configuration file in the JSON format in advance, can finish the decoding and encoding of binary data under the condition of not modifying codes, is convenient to access various self-defined Internet of things equipment protocols, and improves the data transmission efficiency.

Description

Data transmission method and device based on JSON configuration file
Technical Field
The present application relates to the field of communications technologies, and in particular, to a data transmission method and apparatus based on JSON configuration files, a service processing device, and a readable storage medium.
Background
The internet of things is a complex network system, the application field is spread throughout all industries, such as smart cities, smart homes, smart factories and the like, a plurality of terminal devices are resource-limited, only a small amount of memory space and limited computing capacity are provided, and a set of unified communication protocol is difficult to be applied to all devices. Meanwhile, each manufacturer often has a set of communication protocols which can be customized for safety and other considerations.
Traditional web services often employ the http protocol, which is too heavy for most internet of things terminals. Protocols of various devices of various manufacturers are often different, which causes inconvenience for accessing the device to the platform of the internet of things, and corresponding codes are required to be compiled for adaptation when a new device is accessed, which is complicated and complex.
Therefore, different communication protocols are often adopted by different internet of things devices, and a code needs to be modified according to the current protocol every time a protocol is accessed in the conventional data transmission scheme, so that the universality is poor.
Disclosure of Invention
The application aims to provide a data transmission method and device based on a JSON configuration file, a service processing device and a readable storage medium, which are used for solving the problem that a traditional data transmission scheme needs to modify codes according to a current protocol every time a protocol is accessed, and the universality is poor. The specific scheme is as follows:
in a first aspect, the present application provides a data transmission method based on JSON configuration files, which is applied to service processing devices, and includes:
loading a configuration file in a JSON format, wherein the configuration file is used for describing a binary protocol of the equipment of the Internet of things;
when data is sent, text data to be sent to the Internet of things equipment is coded according to the configuration file to obtain a data frame of the binary protocol, and the data frame is sent to the Internet of things equipment;
and when receiving data, receiving the data frame of the binary protocol sent by the Internet of things equipment, and decoding the data frame according to the configuration file to obtain text data.
Preferably, the decoding the data frame according to the configuration file to obtain text data includes:
and decoding the data frame according to the configuration file and the encoding and decoding process of the responsibility chain mode to obtain text data.
Preferably, the loading the configuration file in the JSON format includes:
loading a configuration file in a JSON format, wherein the configuration file comprises a data verification mode, a data frame template and an encryption and decryption algorithm, and the data frame template is used for describing a plurality of fields forming the data frame and the arrangement sequence among the fields.
Preferably, the decoding the data frame according to the configuration file to obtain text data includes:
checking the data frame according to a check code in the data frame and a data check mode in the configuration file;
if the verification is passed, splitting the data frame into a data header, a data length and a data load according to a data frame template in the configuration file;
decrypting the data load according to an encryption and decryption algorithm in the configuration file;
and decoding the decrypted data load to obtain text data.
Preferably, the configuration file further includes identification information of a binary protocol, and the loading of the configuration file in the JSON format includes:
before data transmission, determining identification information of a binary protocol of the Internet of things equipment to be subjected to data interaction;
and loading a corresponding configuration file in a JSON format according to the identification information.
Preferably, the encoding the text data to be sent to the internet of things device to obtain the data frame of the binary protocol includes:
encoding text data to be sent to the Internet of things equipment to obtain a data load;
encrypting the data load according to an encryption and decryption algorithm in the configuration file;
generating a data length and a data header for the encrypted data load according to the data frame template in the configuration file;
generating a check code for the encrypted data load according to the data check mode in the configuration file;
and combining the encrypted data load, the data length, the data head and the check code to obtain the data frame of the binary protocol.
Preferably, the data verification method is a cyclic redundancy verification method, and generating a check code for the encrypted data payload includes:
and generating a check code for the encrypted data load by using a cyclic redundancy check mode.
In a second aspect, the present application provides a data transmission apparatus based on JSON configuration file, which is applied to a service processing device, and includes:
a file loading module: the configuration file is used for loading a JSON format and is used for describing a binary protocol of the equipment of the Internet of things;
the coding module: the data processing device is used for coding text data to be sent to the Internet of things equipment according to the configuration file when sending data to obtain a data frame of the binary protocol and sending the data frame to the Internet of things equipment;
a decoding module: and the data frame of the binary protocol sent by the internet of things equipment is received when the data is received, and the data frame is decoded according to the configuration file to obtain text data.
In a third aspect, the present application provides a service processing device, including:
a memory: for storing a computer program;
a processor: for executing the computer program to implement the steps of a JSON profile-based data transfer method as described above.
In a fourth aspect, the present application provides a readable storage medium having stored thereon a computer program for implementing the steps of a JSON profile-based data transfer method as described above when executed by a processor.
The data transmission method based on the JSON configuration file provided by the application is applied to business processing equipment and comprises the following steps: loading a configuration file in a JSON format, wherein the configuration file is used for describing a binary protocol of the equipment of the Internet of things; when data is sent, text data to be sent to the Internet of things equipment is coded according to the configuration file to obtain a data frame of a binary protocol, and the data frame is sent to the Internet of things equipment; when receiving data, receiving a data frame of a binary protocol sent by the Internet of things equipment, and decoding the data frame according to the configuration file to obtain text data. Therefore, the method can finish binary data decoding and encoding without modifying codes by only defining the configuration file in the JSON format in advance, is convenient to access various self-defined Internet of things equipment protocols, and improves the data transmission efficiency.
In addition, the present application also provides a data transmission device, a service processing device and a readable storage medium based on the JSON configuration file, and the technical effect corresponds to the technical effect of the above method, which is not described herein again.
Drawings
For a clearer explanation of the embodiments or technical solutions of the prior art of the present application, the drawings needed for the description of the embodiments or prior art will be briefly described below, it is obvious that the drawings in the following description are only some embodiments of the present application, and for those skilled in the art, other drawings can be obtained according to these drawings without creative efforts.
Fig. 1 is a flowchart illustrating a first implementation of a data transmission method based on JSON configuration files according to an embodiment of the present disclosure;
fig. 2 is a schematic diagram of a coding and decoding flow of a first embodiment of a data transmission method based on JSON configuration files according to the present application;
fig. 3 is a flowchart illustrating an implementation of a second embodiment of a data transmission method based on JSON configuration files according to the present application;
FIG. 4 is a functional block diagram of an embodiment of a JSON configuration file-based data transmission apparatus provided in the present application;
fig. 5 is a schematic structural diagram of an embodiment of a service processing device provided in the present application.
Detailed Description
The core of the application is to provide a data transmission method and device based on JSON configuration files, service processing equipment and a readable storage medium, binary data decoding and encoding can be completed under the condition of not modifying codes by introducing the configuration files in the JSON format, various self-defined Internet of things equipment protocols can be conveniently accessed, and data transmission efficiency is improved.
In order that those skilled in the art will better understand the disclosure, the following detailed description will be given with reference to the accompanying drawings. It is to be understood that the embodiments described are only a few embodiments of the present application and 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 application.
Referring to fig. 1, a first embodiment of a data transmission method based on a JSON configuration file provided in the present application is introduced, where the first embodiment is applied to a service processing device, and includes:
s101, loading a configuration file in a JSON format, wherein the configuration file is used for describing a binary protocol of the equipment of the Internet of things;
s102, when data are sent, encoding text data to be sent to the Internet of things equipment according to the configuration file to obtain a data frame of the binary protocol, and sending the data frame to the Internet of things equipment;
s103, when receiving data, receiving the data frame of the binary protocol sent by the Internet of things equipment, and decoding the data frame according to the configuration file to obtain text data.
The binary protocol is actually a stream of bytes, usually including a header (header) and a body (body), and the length of the header is fixed, including the length of the body, so that a complete binary data can be parsed from the data stream. Table 1 is a typical binary protocol:
TABLE 1
header Length Data CRC
1Byte 2Byte Length Byte 2Byte
The header is used to identify the protocol start, Length is the Length of the Data in the message body, and for Data integrity, a corresponding check code (CRC) is also added, and the Data part is encrypted. The transmission of data based on the binary protocol reduces redundant data, but the readability of the binary protocol data is poor.
Text data is text protocol data, and a text protocol is generally data consisting of a string of ACSII characters including numbers, upper and lower case letters, a percentile, a carriage return (\\ r), a line feed (\\ n), and spaces. The purpose of the text protocol is to facilitate understanding and reading of people. When a developer debugs, the developer can quickly and accurately see what happens at that time, and the problem is better solved. However, in order to facilitate the parsing, the text protocol has to add some redundant characters for separating the commands, which reduces the transmission efficiency of the text protocol data.
Therefore, in this embodiment, a json (javascript Object notification) is used to describe a customized binary protocol of an internet of things device manufacturer in advance, when the system is started, a configuration file is loaded into a memory first, in a subsequent data transmission process, binary protocol data with poor readability is analyzed according to the configuration file, and finally decoded into text data with good readability, and in an encoding process, the file data is encoded into the binary protocol data according to the configuration file for transmission. The configuration file comprises a data verification mode, a data frame template and an encryption and decryption algorithm, wherein the data frame template is used for describing a plurality of fields forming the data frame and the arrangement sequence among the fields. Therefore, the embodiment can greatly reduce the development time of protocol access while ensuring the data transmission efficiency, and has good universality.
The JSON described above is a lightweight data exchange format that stores and represents data in a text format that is completely independent of the programming language. JSON has a simple and clear hierarchical structure, is easy to read and write by people, and is easy to analyze and generate by machines, so that the JSON becomes an ideal data exchange language.
As described above, the present embodiment writes the configuration file in the JSON format, and on this basis, as a preferred embodiment, the present embodiment uses a chain of responsibility mode to implement a codec conversion process between binary protocol data and text protocol data. The responsibility chain mode is an object behavior mode, association is used as much as possible to replace class inheritance according to the principle of 'synthesis multiplexing', and the object behavior mode can be said to be a good behavior mode. The responsibility chain design mode is a mode for separating a request sender and a request processor, does not need to relate to the details of request processing, and only sends the request along a path as if so, so that the request sender and the request processor are decoupled.
According to the encoding and decoding process of the responsibility chain mode, as shown in fig. 2, the decoding the data frame according to the configuration file to obtain the text data includes the following steps: verifying the data frame according to a verification code in the data frame and a data verification mode in the configuration file; if the verification is passed, splitting the data frame into a data header, a data length and a data load according to a data frame template in the configuration file; decrypting the data load according to an encryption and decryption algorithm in the configuration file; and decoding the decrypted data load to obtain text data.
Correspondingly, as shown in fig. 2, the encoding the text data to be sent to the internet of things device to obtain the data frame of the binary protocol includes the following steps: encoding text data to be sent to the Internet of things equipment to obtain data loads; encrypting the data load according to an encryption and decryption algorithm in the configuration file; generating a data length and a data header for the encrypted data load according to the data frame template in the configuration file; generating a check code for the encrypted data load according to the data check mode in the configuration file; and combining the encrypted data load, the data length, the data head and the check code to obtain the data frame of the binary protocol.
The data transmission method based on the JSON configuration file provided in this embodiment is applied to a service processing device, and includes: loading a configuration file in a JSON format, wherein the configuration file is used for describing a binary protocol of the equipment of the Internet of things; when data is sent, text data to be sent to the Internet of things equipment is coded according to the configuration file to obtain a data frame of a binary protocol, and the data frame is sent to the Internet of things equipment; when receiving data, receiving a data frame of a binary protocol sent by the Internet of things equipment, and decoding the data frame according to the configuration file to obtain text data. Therefore, the method can finish binary data decoding and coding without modifying codes by only defining the configuration file in the JSON format in advance, is convenient to access various self-defined Internet of things equipment protocols, and improves the data transmission efficiency.
An embodiment two of the data transmission method based on the JSON configuration file provided by the present application is described in detail below, and the embodiment two is implemented based on the foregoing embodiment one, and is expanded to a certain extent on the basis of the embodiment one.
Referring to fig. 3, the second embodiment is applied to a service processing device, and includes:
s301, before data transmission, determining identification information of a binary protocol of the Internet of things equipment to be subjected to data interaction;
s302, loading a corresponding configuration file in a JSON format to a memory according to the identification information; the configuration file is used for describing a binary protocol of the Internet of things equipment; skipping to S303 when sending data, and skipping to S308 when receiving data;
s303, encoding text data to be sent to the Internet of things equipment to obtain a data load;
s304, encrypting the data load according to an encryption and decryption algorithm in the configuration file;
s305, generating a data length and a data header for the encrypted data load according to the data frame template in the configuration file;
s306, generating a check code for the encrypted data load according to the data check mode in the configuration file;
s307, the encrypted data load, the data length, the data head and the check code are combined to obtain a data frame of the binary protocol; sending the data frame to the Internet of things equipment;
s308, receiving a data frame of a binary protocol sent by the Internet of things equipment;
s309, verifying the data frame according to a verification code in the data frame and a data verification mode in the configuration file; if the verification is passed, jumping to S310;
s310, splitting the data frame into a data header, a data length and a data load according to a data frame template in the configuration file;
s311, decrypting the data load according to the encryption and decryption algorithm in the configuration file;
and S312, decoding the decrypted data load to obtain text data.
The present embodiment describes the implementation of the scheme by taking the following configuration files as examples, and in practical applications, various modifications or extensions may be made on the basis of the above configuration files. Specifically, the configuration file is as follows:
Figure BDA0002313775320000081
Figure BDA0002313775320000091
Figure BDA0002313775320000101
protocol in the configuration file represents binary protocol identification information; encryption represents an encryption and decryption mode; crc represents a data check mode; the data represents a protocol data part. The data includes four fields of head (data header), length (data length), payload (data payload), and crc (check code). In each field, name represents the field name; size indicates the number of bytes occupied by the field; the format represents a field format, and specifically can include multiple formats such as int, bcd, string and hex; the type indicates the field type, and specifically, there may be a normal type, a repeat type, and the like, where normal indicates a normal type, repeat indicates that the field is a loop field, and when the type is repeat, count indicates the number of loops of the field. In this embodiment, payload includes two parts, time and temperature, where time is the time in the data and temperature represents the temperature in the data.
In this embodiment, the encoding and decoding process in the responsibility chain mode is used to realize the conversion between the binary protocol data and the text protocol data, and the specific encoding and decoding process includes four processing links: the method comprises the following steps of message verification, woody book analysis, data load encryption and decryption and message coding and decoding, and the four processes are introduced below respectively.
Message checking: in the decoding stage, the message check mainly checks whether a frame is damaged in the transmission process of data, for example, a bit error occurs, 0 changes to 1 or 1 changes to 0, and generally adopts check modes such as cyclic redundancy check and the like; the encoding process is to calculate the check code according to the data load to be transmitted, and to combine the check code with the data load to be transmitted. In the embodiment, a data verification mode is obtained according to the configuration file, whether the message is wrong is verified in the decoding stage, if the message is wrong, the message is abandoned, and if the message is wrong, the data is transmitted to the next processing link; and the encoding stage calculates the crc check bit at the moment and adds the crc check bit into the data.
Template analysis: according to the configuration file, the decoding stage is to divide the binary string into fields such as a data header, a data length, a data load and the like in sequence, and the specific fields are different according to the different configuration files; in the encoding stage, the data length is calculated according to the data load, and a data head is added to transmit to the next processing link.
According to the configuration file, the following can be obtained through template analysis:
Figure BDA0002313775320000111
it will be appreciated that at this point the data payload portion has not yet been parsed. The encoding process is the reverse process, and the data is encoded into AA0925012501AC32 BB.
Data load encryption and decryption: in the decoding stage, the decryption is carried out according to the decryption mode and the secret key in the configuration file; for safety, the data payload is generally encrypted to prevent the data from being intercepted and analyzed, so the data payload is encrypted in the encoding stage, and the encrypted data is transmitted to the next processing link.
Message encoding and decoding: in the stage of finally analyzing the data in the decoding process, after the decrypted data load is obtained, the required fields are sequentially analyzed according to the data length and the type defined by the configuration file and then are transmitted to the service processing module; the encoding process is to assemble the received service data according to the sequence and type defined by the configuration file, and then to transmit to the next stage for encryption.
According to the configuration format of the data payload in the configuration file, the final data in the readable text format is obtained, as shown in the following example:
Figure BDA0002313775320000112
as can be seen, the data transmission method based on the JSON configuration file provided in this embodiment is applied to a service processing device, and includes: loading a pre-created configuration file for describing a binary protocol of the Internet of things equipment, and performing encoding and decoding according to the configuration file by using an encoding and decoding process of a responsibility chain mode, wherein the encoding and decoding process comprises the following four processing links: message checking, template analysis, data encryption and decryption and message analysis. Specifically, the decoding process converts binary protocol data into text format data with good readability, and the encoding process converts file format data into binary data for network transmission. Because the internet of things terminals are various and limited in resources, each manufacturer often has a self-defined binary format data protocol, hard decoding is required when the internet of things terminals access a cloud platform, and the code universality is poor. According to the method provided by the embodiment, binary data decoding and encoding can be completed without modifying codes by only defining the configuration file in the JSON format in advance, various self-defined Internet of things protocols can be accessed conveniently, and the data transmission efficiency is improved.
In the following, a data transmission device based on a JSON configuration file provided in an embodiment of the present application is introduced, and a data transmission device based on a JSON configuration file described below and a data transmission method based on a JSON configuration file described above may be referred to correspondingly.
As shown in fig. 4, the data transmission apparatus is applied to a service processing device, and includes:
the file loading module 401: the configuration file is used for loading a JSON format and is used for describing a binary protocol of the equipment of the Internet of things;
the encoding module 402: the data frame is used for coding text data to be sent to the Internet of things equipment according to the configuration file when the data is sent, obtaining a data frame of the binary protocol, and sending the data frame to the Internet of things equipment;
the decoding module 403: and the data frame of the binary protocol sent by the internet of things equipment is received when the data is received, and the data frame is decoded according to the configuration file to obtain text data.
The JSON-profile-based data transmission apparatus of this embodiment is used to implement the aforementioned JSON-profile-based data transmission method, and therefore specific implementation in the apparatus can be seen in the foregoing embodiment parts of the JSON-profile-based data transmission method, for example, the file loading module 401, the encoding module 402, and the decoding module 403, which are respectively used to implement steps S101, S102, and S103 in the aforementioned JSON-profile-based data transmission method. Therefore, specific embodiments thereof may be referred to in the description of the corresponding respective partial embodiments, and will not be described herein.
In addition, since the data transmission apparatus based on the JSON profile of this embodiment is used to implement the foregoing data transmission method based on the JSON profile, the role thereof corresponds to that of the foregoing method, and details thereof are not repeated here.
In addition, the present application further provides a service processing device, as shown in fig. 5, including:
the memory 100: for storing a computer program;
the processor 200: for executing the computer program to implement the steps of a JSON profile-based data transfer method as described above.
Finally, the present application provides a readable storage medium having stored thereon a computer program for implementing the steps of a JSON profile based data transfer method as described above when executed by a processor.
The embodiments are described in a progressive manner, each embodiment focuses on differences from other embodiments, and the same or similar parts among the embodiments are referred to each other. The device disclosed by the embodiment corresponds to the method disclosed by the embodiment, so that the description is simple, and the relevant points can be referred to the method part for description.
The steps of a method or algorithm described in connection with the embodiments disclosed herein may be embodied directly in hardware, in a software module executed by a processor, or in a combination of the two. A software module may reside in Random Access Memory (RAM), memory, Read Only Memory (ROM), electrically programmable ROM, electrically erasable programmable ROM, registers, hard disk, a removable disk, a CD-ROM, or any other form of storage medium known in the art.
The above detailed descriptions of the solutions provided in the present application, and the specific examples applied herein are set forth to explain the principles and implementations of the present application, and the above descriptions of the examples are only used to help understand the method and its core ideas of the present application; meanwhile, for a person skilled in the art, according to the idea of the present application, the specific implementation manner and the application scope may be changed, and in summary, the content of the present specification should not be construed as a limitation to the present application.

Claims (10)

1. A data transmission method based on JSON configuration files is characterized in that the method is applied to business processing equipment and comprises the following steps:
loading a configuration file in a JSON format, wherein the configuration file is used for describing a binary protocol of the equipment of the Internet of things;
when data is sent, text data to be sent to the Internet of things equipment is coded according to the configuration file to obtain a data frame of the binary protocol, and the data frame is sent to the Internet of things equipment;
and when receiving data, receiving the data frame of the binary protocol sent by the equipment of the Internet of things, and decoding the data frame according to the configuration file to obtain text data.
2. The method of claim 1, wherein said decoding said data frame according to said configuration file to obtain text data comprises:
and decoding the data frame according to the configuration file and the encoding and decoding process of the responsibility chain mode to obtain text data.
3. The method of claim 2, wherein the loading a configuration file in JSON format comprises:
loading a configuration file in a JSON format, wherein the configuration file comprises a data verification mode, a data frame template and an encryption and decryption algorithm, and the data frame template is used for describing a plurality of fields forming the data frame and the arrangement sequence among the fields.
4. The method of claim 3, wherein said decoding the data frame according to the configuration file to obtain text data comprises:
checking the data frame according to a check code in the data frame and a data check mode in the configuration file;
if the verification is passed, splitting the data frame into a data header, a data length and a data load according to a data frame template in the configuration file;
decrypting the data load according to an encryption and decryption algorithm in the configuration file;
and decoding the decrypted data load to obtain text data.
5. The method of claim 3, wherein the configuration file further includes identification information of a binary protocol, and wherein the loading of the configuration file in the JSON format comprises:
before data transmission, determining identification information of a binary protocol of the Internet of things equipment to be subjected to data interaction;
and loading a corresponding configuration file in the JSON format according to the identification information.
6. The method of claim 3, wherein the encoding the text data to be sent to the Internet of things device to obtain the data frame of the binary protocol comprises:
encoding text data to be sent to the Internet of things equipment to obtain a data load;
encrypting the data load according to an encryption and decryption algorithm in the configuration file;
generating a data length and a data header for the encrypted data load according to the data frame template in the configuration file;
generating a check code for the encrypted data load according to the data check mode in the configuration file;
and combining the encrypted data load, the data length, the data head and the check code to obtain the data frame of the binary protocol.
7. The method of claim 6, wherein the data check mode is a cyclic redundancy check mode, and wherein generating a check code for the encrypted data payload comprises:
and generating a check code for the encrypted data load by using a cyclic redundancy check mode.
8. A data transmission device based on JSON configuration files is applied to business processing equipment and comprises the following components:
a file loading module: the configuration file is used for loading a JSON format and is used for describing a binary protocol of the equipment of the Internet of things;
the coding module: the data processing device is used for coding text data to be sent to the Internet of things equipment according to the configuration file when sending data to obtain a data frame of the binary protocol and sending the data frame to the Internet of things equipment;
a decoding module: and the data frame of the binary protocol sent by the internet of things equipment is received when the data is received, and the data frame is decoded according to the configuration file to obtain text data.
9. A traffic processing device, comprising:
a memory: for storing a computer program;
a processor: steps for executing the computer program to implement a JSON profile-based data transfer method as claimed in any of claims 1 to 7.
10. A readable storage medium, having stored thereon a computer program for implementing the steps of a JSON profile based data transfer method according to any one of claims 1 to 7 when being executed by a processor.
CN201911269524.XA 2019-12-11 2019-12-11 Data transmission method and device based on JSON configuration file Active CN110971704B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201911269524.XA CN110971704B (en) 2019-12-11 2019-12-11 Data transmission method and device based on JSON configuration file

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201911269524.XA CN110971704B (en) 2019-12-11 2019-12-11 Data transmission method and device based on JSON configuration file

Publications (2)

Publication Number Publication Date
CN110971704A CN110971704A (en) 2020-04-07
CN110971704B true CN110971704B (en) 2022-07-19

Family

ID=70033761

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201911269524.XA Active CN110971704B (en) 2019-12-11 2019-12-11 Data transmission method and device based on JSON configuration file

Country Status (1)

Country Link
CN (1) CN110971704B (en)

Families Citing this family (17)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN111364154B (en) * 2020-04-28 2021-01-19 江苏科瑞德智控自动化科技有限公司 Reconfigurable loom control system and method
CN113691484A (en) * 2020-05-19 2021-11-23 华为技术有限公司 Apparatus and method for protocol adaptation
CN111741072B (en) * 2020-05-27 2021-10-12 清华大学 Low-bandwidth high-security data transmission method based on equipment virtualization
CN112215452A (en) * 2020-07-28 2021-01-12 智维云图(上海)智能科技有限公司 Intelligent fire-fighting remote monitoring method and system and safety assessment method
CN112104660A (en) * 2020-09-18 2020-12-18 国网浙江省电力有限公司 Data transmission method, related equipment and readable storage medium
CN114449006A (en) * 2020-10-20 2022-05-06 广州展闰数域科技有限公司 Signal transmitting board
CN112333186B (en) * 2020-11-03 2022-11-29 平安普惠企业管理有限公司 Data communication method, device, equipment and storage medium
CN112714162A (en) * 2020-12-22 2021-04-27 上海上实龙创智能科技股份有限公司 Netty-based Internet of things communication system and method
CN112751875A (en) * 2020-12-31 2021-05-04 北京天融信网络安全技术有限公司 Equipment control method and device, electronic equipment and storage medium
CN113037848B (en) * 2021-03-18 2024-03-15 上海哔哩哔哩科技有限公司 File uploading method and system
CN113381997A (en) * 2021-06-08 2021-09-10 四川精创国芯科技有限公司 Internet of things universal protocol conversion platform
CN113422765B (en) * 2021-06-18 2023-04-07 杭州深渡科技有限公司 Data transmission method and device of Internet of things equipment and Internet of things equipment
CN113726762A (en) * 2021-08-27 2021-11-30 四川长虹网络科技有限责任公司 Internet of things equipment protocol analysis method based on configuration file
CN115378854B (en) * 2022-07-07 2023-11-14 浙江众合科技股份有限公司 Binary data message modification method based on custom JSON rule
CN115190379B (en) * 2022-07-28 2024-04-02 国核信息科技有限公司 Split wind power vibration monitoring data transmission method and monitoring device
CN116016296B (en) * 2022-12-19 2024-03-26 四川九洲电器集团有限责任公司 Binary data processing method, system and equipment based on JSON
CN117729172A (en) * 2024-02-18 2024-03-19 成都深瑞同华科技有限公司 Data transmission method, device and storage medium in isolated network environment

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN107704567A (en) * 2017-09-29 2018-02-16 郑州云海信息技术有限公司 A kind of analytic method of binary file, device, equipment and storage medium
CN108156222A (en) * 2017-12-06 2018-06-12 广东温氏食品集团股份有限公司 A kind of gateway system and method based on cultivation Internet of Things
CN109981676A (en) * 2019-04-08 2019-07-05 陈鹏 One kind being based on the customized Internet of Things information interacting method of binary system analysis protocol
CN110278216A (en) * 2019-07-26 2019-09-24 福州大学 Intelligent road lamp management system and method based on NB-IoT
WO2019212756A1 (en) * 2018-05-03 2019-11-07 T-Mobile Usa, Inc. Reducing network protocol overhead

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN107704567A (en) * 2017-09-29 2018-02-16 郑州云海信息技术有限公司 A kind of analytic method of binary file, device, equipment and storage medium
CN108156222A (en) * 2017-12-06 2018-06-12 广东温氏食品集团股份有限公司 A kind of gateway system and method based on cultivation Internet of Things
WO2019212756A1 (en) * 2018-05-03 2019-11-07 T-Mobile Usa, Inc. Reducing network protocol overhead
CN109981676A (en) * 2019-04-08 2019-07-05 陈鹏 One kind being based on the customized Internet of Things information interacting method of binary system analysis protocol
CN110278216A (en) * 2019-07-26 2019-09-24 福州大学 Intelligent road lamp management system and method based on NB-IoT

Also Published As

Publication number Publication date
CN110971704A (en) 2020-04-07

Similar Documents

Publication Publication Date Title
CN110971704B (en) Data transmission method and device based on JSON configuration file
US9952952B2 (en) Distributed storage of data
CA3090716A1 (en) Two-dimensional code generation and identification
JP2005530266A (en) Method and apparatus for structured streaming of XML documents
CN102300256B (en) Method and device for feeding back header compression and feedback information
CN101610268B (en) Implementation method and equipment of keyword filtration
CN111262876B (en) Data processing method, device and equipment based on block chain and storage medium
CN112333186B (en) Data communication method, device, equipment and storage medium
CN108241576B (en) Interface testing method and system
CN111131403A (en) Message coding and decoding method and device for Internet of things equipment
US20010043616A1 (en) Transcoding in data communications
CN114051006A (en) Data transmission method, data transmission device, computer equipment and storage medium
JP7282895B2 (en) Data retransmission decoding method, device, system and communication device
US10282400B2 (en) Grammar generation for simple datatypes
CN114333862B (en) Audio encoding method, decoding method, device, equipment, storage medium and product
CN109428676B (en) Method and device for synchronizing forward error correction coding and decoding modes
CN113517982B (en) Password generation method, password execution method and terminal
CN106209942A (en) A kind of data compression transmission method and system and terminal thereof and server
CN112188211A (en) Transcoding implementation method and device
CN112803950A (en) Data compression method, device and equipment and computer storage medium
CN115955516A (en) Protocol decoding method and device based on communication protocol universal description
CN101605019A (en) Be used for effectively transmitting the system and method for electronic information
CN105808549A (en) Client method for automatic framing and frame analysis on basis of mapping files
CN110517045B (en) Block chain data processing method, device, equipment and storage medium
US10880731B2 (en) System and method for enhanced diversity and network coding (eDC-NC)

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
GR01 Patent grant
GR01 Patent grant