CN112291344A - Data transmission method and device of Internet of things - Google Patents

Data transmission method and device of Internet of things Download PDF

Info

Publication number
CN112291344A
CN112291344A CN202011178590.9A CN202011178590A CN112291344A CN 112291344 A CN112291344 A CN 112291344A CN 202011178590 A CN202011178590 A CN 202011178590A CN 112291344 A CN112291344 A CN 112291344A
Authority
CN
China
Prior art keywords
internet
things
xml file
data transmission
json 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
CN202011178590.9A
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.)
Changzhou Weiyizhi Technology Co Ltd
Original Assignee
Changzhou Weiyizhi 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 Changzhou Weiyizhi Technology Co Ltd filed Critical Changzhou Weiyizhi Technology Co Ltd
Priority to CN202011178590.9A priority Critical patent/CN112291344A/en
Publication of CN112291344A publication Critical patent/CN112291344A/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/50Network services
    • H04L67/56Provisioning of proxy services
    • H04L67/565Conversion or adaptation of application format or content
    • GPHYSICS
    • G16INFORMATION AND COMMUNICATION TECHNOLOGY [ICT] SPECIALLY ADAPTED FOR SPECIFIC APPLICATION FIELDS
    • G16YINFORMATION AND COMMUNICATION TECHNOLOGY SPECIALLY ADAPTED FOR THE INTERNET OF THINGS [IoT]
    • G16Y10/00Economic sectors
    • G16Y10/75Information technology; Communication
    • 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

Abstract

The invention provides a data transmission method and a data transmission device of an Internet of things, wherein the method comprises the following steps: uploading JSON data to a server of the Internet of things through a client of the Internet of things; after the JSON data are uploaded to a service end of the Internet of things, the JSON data are analyzed; acquiring an XML file format; and generating an XML file according to the XML file format and the analyzed JSON data. According to the data transmission method of the Internet of things, the occupied bandwidth and the occupied memory in the data transmission process are greatly reduced.

Description

Data transmission method and device of Internet of things
Technical Field
The invention relates to the technical field of the Internet of things, in particular to a data transmission method and a data transmission device of the Internet of things.
Background
In the related art, in a data transmission system of the internet of things, a client in the internet of things generally directly transmits an XML file to a server and stores the XML file in a database, however, when data transmission is performed in this way, both the occupied bandwidth and the memory are large.
Disclosure of Invention
In order to solve the technical problems, the invention provides a data transmission method of the internet of things, which greatly reduces the occupied bandwidth and the occupied memory in the data transmission process.
The technical scheme adopted by the invention is as follows:
a data transmission method of the Internet of things comprises the following steps: uploading JSON data to a server of the Internet of things through a client of the Internet of things; after the JSON data are uploaded to a service end of the Internet of things, the JSON data are analyzed; acquiring an XML file format; and generating an XML file according to the XML file format and the analyzed JSON data.
The obtaining of the XML file format comprises: and setting a formatting style by creating an Output Format object to obtain an XML file Format.
The generating an XML file according to the XML file format and the parsed JSON data includes: writing the XML file format and the analyzed JSON data into a corresponding file stream by creating an XML Writer object; and writing the file stream into a corresponding file by adopting a file operation tool class so as to generate the XML file.
A data transmission device of the internet of things, comprising: the uploading module is used for uploading JSON data to a server of the Internet of things through the client of the Internet of things; the analysis module is used for analyzing the JSON data after the JSON data are uploaded to a service end of the Internet of things; the acquisition module is used for acquiring an XML file format; and the generating module is used for generating the XML file according to the XML file format and the analyzed JSON data.
The acquisition module is specifically configured to: and setting a formatting style by creating an Output Format object to obtain an XML file Format.
The generation module is specifically configured to: writing the XML file format and the analyzed JSON data into a corresponding file stream by creating an XML Writer object; and writing the file stream into a corresponding file by adopting a file operation tool class so as to generate the XML file.
A computer device comprises a memory, a processor and a computer program which is stored on the memory and can run on the processor, wherein when the processor executes the computer program, the data transmission method of the Internet of things is realized.
A non-transitory computer-readable storage medium, on which a computer program is stored, which, when executed by a processor, implements the data transmission method of the internet of things described above.
The invention has the beneficial effects that:
according to the invention, the client of the Internet of things uploads the JSON data to the server of the Internet of things, and then the JSON data is converted into the corresponding XML file, so that the bandwidth and the memory occupied in the data transmission process are greatly reduced.
Drawings
Fig. 1 is a flowchart of a data transmission method of the internet of things according to an embodiment of the present invention;
fig. 2 is a logic diagram of a data transmission method of the internet of things according to an embodiment of the invention;
fig. 3 is a schematic block diagram of a data transmission device of the internet of things according to an embodiment of the present invention.
Detailed Description
The technical solutions in the embodiments of the present invention will be clearly and completely described below with reference to the drawings in the embodiments of the present invention, and it is obvious that the described embodiments are only a part of the embodiments of the present invention, and not all of the 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.
Fig. 1 is a flowchart of a deep learning-based spam detection classification method according to an embodiment of the present invention.
As shown in fig. 1, the data transmission method of the internet of things according to the embodiment of the present invention may include the following steps:
and S1, uploading JSON data to a server of the Internet of things through the client of the Internet of things.
Specifically, as shown in fig. 2, when a client of the internet of things uploads to a server of the internet of things, JavaScript object Notation (JSON) data of an XML (Extensible Markup Language) file needs to be converted, the JSON data may be JSON character strings in any format, and it needs to be noted that, in order to facilitate subsequent flow conversion to XML operation, an incoming character string may be converted into a designated JSON object, that is, the JSON data may also be a corresponding JSON object.
It should be noted that, after receiving the JSON data uploaded by the client, the user server in the server may feed back a result to the client, for example, the JSON data is successfully uploaded.
And S2, after the JSON data are uploaded to a service end of the Internet of things, the JSON data are analyzed.
Specifically, as shown in fig. 2, after receiving JSON data uploaded by the client, the user server in the server may further continue to transmit data to the file server, so that the operation of converting XML and landing on a file is completed through the file server. At this time, the JSON data may be parsed in a recursive manner through the file server. Specifically, whether the current node is JSON array data or not can be judged, if yes, the JSON data is further analyzed in a recursion mode, wherein each recursion sequentially judges whether the current node is a key value node or not, and if yes, the current node is added into an Element node.
S3, obtaining the XML file format.
According to one embodiment of the invention, obtaining the XML file format comprises: and setting a formatting style by creating an Output Format object to obtain an XML file Format.
Further, the XML file Format may be obtained through the file server, and specifically, the Format style may be set by creating an Output Format object, for example, setting an indentation/removing original XML header information, or setting custom XML header information. It should be noted that, for flexibility and versatility, the system has a default standard format style and header information, wherein, the universal xml header information can be defined through the dom4j framework, and the default header information can be: <? 1.0 encoding UTF-8 standby yes? >; <? xml-style ═ text/css "href ═ style. Certainly, the user can also set the formatting style and the header information by a custom parameter transmission mode according to different service requirements and scenes.
And S4, generating an XML file according to the XML file format and the analyzed JSON data.
According to an embodiment of the present invention, generating an XML file according to an XML file format and parsed JSON data includes: writing the XML file format and the analyzed JSON data into a corresponding file stream by creating an XML Writer object; and writing the file stream into a corresponding file by adopting a file operation tool class so as to generate the XML file.
Specifically, the XML file can be generated according to the XML file format and the parsed JSON data through the file server. Specifically, an XML File Format (Output Format) and the parsed JSON data can be written into a corresponding File stream by creating an XML writer object, and then the File stream is written into a corresponding File by using a File operation tool class, for example, by using a write String To File in File operations classes FileUtils, so as To generate an XML File. The file server side can feed back a result to the user server side after generating the XML file, and the user server side feeds back the result to the client side.
It should be noted that, as a possible implementation manner, after the XML file is generated, the server may further parse the XML file into corresponding JSON data and store the JSON data in the database, and when the file needs to be used, the JSON data may be directly converted into the XML file and transmitted to the client, so that the transmission pressure and the transmission speed of the disk IO are reduced.
Therefore, the JSON data is uploaded to the service end of the Internet of things through the client end of the Internet of things, and then the JSON data is converted into XML files with different protocols, so that the occupied bandwidth and the occupied memory in the data transmission process are reduced, and the universality and the flexibility of the system are improved.
In summary, according to the data transmission method of the internet of things in the embodiment of the present invention, the JSON data is uploaded to the server of the internet of things through the client of the internet of things, and after the JSON data is uploaded to the server of the internet of things, the JSON data is analyzed, and an XML file format is obtained, and an XML file is generated according to the XML file format and the analyzed JSON data, so that bandwidth and memory occupied in the data transmission process are greatly reduced.
Corresponding to the data transmission method of the internet of things in the embodiment, the invention further provides a data transmission device of the internet of things.
As shown in fig. 3, the data transmission apparatus of the internet of things according to the embodiment of the present invention may include an uploading module 100, an analyzing module 200, an obtaining module 300, and a generating module 400.
The uploading module 100 is used for uploading JSON data to a server of the internet of things through a client of the internet of things; the analysis module 200 is used for analyzing the JSON data after the JSON data is uploaded to a service end of the internet of things; the obtaining module 300 is configured to obtain an XML file format; the generating module 400 is configured to generate an XML file according to the XML file format and the parsed JSON data.
According to an embodiment of the present invention, the obtaining module is specifically configured to: and setting a formatting style by creating an Output Format object to obtain an XML file Format.
According to an embodiment of the present invention, the generating module is specifically configured to: writing the XML file format and the analyzed JSON data into a corresponding file stream by creating an XML Writer object; and writing the file stream into a corresponding file by adopting a file operation tool class so as to generate the XML file.
It should be noted that, for a more specific implementation of the data transmission device of the internet of things according to the embodiment of the present invention, reference may be made to the above-mentioned embodiment of the data transmission method of the internet of things, and details are not described here again.
According to the data transmission device of the internet of things, the uploading module uploads the JSON data to the service end of the internet of things through the client side of the internet of things, the JSON data is analyzed after being uploaded to the service end of the internet of things through the analyzing module, the XML file format is obtained through the obtaining module, and the XML file is generated through the generating module according to the XML file format and the analyzed JSON data, so that the bandwidth and the memory occupied in the data transmission process are greatly reduced.
The invention further provides a computer device corresponding to the embodiment.
The computer device of the embodiment of the invention comprises a memory, a processor and a computer program which is stored on the memory and can run on the processor, and when the processor executes the program, the data transmission method of the Internet of things of the embodiment is realized.
According to the computer equipment provided by the embodiment of the invention, the occupied bandwidth and the occupied memory in the data transmission process can be greatly reduced. .
The invention also provides a non-transitory computer readable storage medium corresponding to the above embodiment.
A non-transitory computer-readable storage medium according to an embodiment of the present invention stores thereon a computer program, which, when executed by a processor, implements the data transmission method for the internet of things described above.
According to the non-transitory computer readable storage medium provided by the embodiment of the invention, the occupied bandwidth and the occupied memory in the data transmission process can be greatly reduced.
In the description of the present invention, the terms "first" and "second" are used for descriptive purposes only and are not to be construed as indicating or implying relative importance or implying any number of technical features indicated. Thus, a feature defined as "first" or "second" may explicitly or implicitly include one or more of that feature. The meaning of "plurality" is two or more unless specifically limited otherwise.
In the present invention, unless otherwise expressly stated or limited, the terms "mounted," "connected," "secured," and the like are to be construed broadly and can, for example, be fixedly connected, detachably connected, or integrally formed; can be mechanically or electrically connected; either directly or indirectly through intervening media, either internally or in any other relationship. The specific meanings of the above terms in the present invention can be understood by those skilled in the art according to specific situations.
In the present invention, unless otherwise expressly stated or limited, the first feature "on" or "under" the second feature may be directly contacting the first and second features or indirectly contacting the first and second features through an intermediate. Also, a first feature "on," "over," and "above" a second feature may be directly or diagonally above the second feature, or may simply indicate that the first feature is at a higher level than the second feature. A first feature being "under," "below," and "beneath" a second feature may be directly under or obliquely under the first feature, or may simply mean that the first feature is at a lesser elevation than the second feature.
In the description herein, references to the description of the term "one embodiment," "some embodiments," "an example," "a specific example," or "some examples," etc., mean that a particular feature, structure, material, or characteristic described in connection with the embodiment or example is included in at least one embodiment or example of the invention. In this specification, the schematic representations of the terms used above are not necessarily intended to refer to the same embodiment or example. Furthermore, the particular features, structures, materials, or characteristics described may be combined in any suitable manner in any one or more embodiments or examples. Furthermore, various embodiments or examples and features of different embodiments or examples described in this specification can be combined and combined by one skilled in the art without contradiction.
Any process or method descriptions in flow charts or otherwise described herein may be understood as representing modules, segments, or portions of code which include one or more executable instructions for implementing specific logical functions or steps of the process, and alternate implementations are included within the scope of the preferred embodiment of the present invention in which functions may be executed out of order from that shown or discussed, including substantially concurrently or in reverse order, depending on the functionality involved, as would be understood by those reasonably skilled in the art of the present invention.
The logic and/or steps represented in the flowcharts or otherwise described herein, e.g., an ordered listing of executable instructions that can be considered to implement logical functions, can be embodied in any computer-readable medium for use by or in connection with an instruction execution system, apparatus, or device, such as a computer-based system, processor-containing system, or other system that can fetch the instructions from the instruction execution system, apparatus, or device and execute the instructions. For the purposes of this description, a "computer-readable medium" can be any means that can contain, store, communicate, propagate, or transport the program for use by or in connection with the instruction execution system, apparatus, or device. More specific examples (a non-exhaustive list) of the computer-readable medium would include the following: an electrical connection (electronic device) having one or more wires, a portable computer diskette (magnetic device), a Random Access Memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber device, and a portable compact disc read-only memory (CDROM). Additionally, the computer-readable medium could even be paper or another suitable medium upon which the program is printed, as the program can be electronically captured, via for instance optical scanning of the paper or other medium, then compiled, interpreted or otherwise processed in a suitable manner if necessary, and then stored in a computer memory.
It should be understood that portions of the present invention may be implemented in hardware, software, firmware, or a combination thereof. In the above embodiments, the various steps or methods may be implemented in software or firmware stored in memory and executed by a suitable instruction execution system. For example, if implemented in hardware, as in another embodiment, any one or combination of the following techniques, which are known in the art, may be used: a discrete logic circuit having a logic gate circuit for implementing a logic function on a data signal, an application specific integrated circuit having an appropriate combinational logic gate circuit, a Programmable Gate Array (PGA), a Field Programmable Gate Array (FPGA), or the like.
It will be understood by those skilled in the art that all or part of the steps carried by the method for implementing the above embodiments may be implemented by hardware related to instructions of a program, which may be stored in a computer readable storage medium, and when the program is executed, the program includes one or a combination of the steps of the method embodiments.
In addition, functional units in the embodiments of the present invention may be integrated into one processing module, or each unit may exist alone physically, or two or more units are integrated into one module. The integrated module can be realized in a hardware mode, and can also be realized in a software functional module mode. The integrated module, if implemented in the form of a software functional module and sold or used as a stand-alone product, may also be stored in a computer readable storage medium.
The storage medium mentioned above may be a read-only memory, a magnetic or optical disk, etc. Although embodiments of the present invention have been shown and described above, it is understood that the above embodiments are exemplary and should not be construed as limiting the present invention, and that variations, modifications, substitutions and alterations can be made to the above embodiments by those of ordinary skill in the art within the scope of the present invention.

Claims (8)

1. A data transmission method of the Internet of things is characterized by comprising the following steps:
uploading JSON data to a server of the Internet of things through the client of the Internet of things;
after the JSON data are uploaded to a service end of the Internet of things, analyzing the JSON data;
acquiring an XML file format;
and generating an XML file according to the XML file format and the analyzed JSON data.
2. The data transmission method of the internet of things as claimed in claim 1, wherein the obtaining the XML file format comprises:
and setting a formatting style by creating an Output Format object to obtain an XML file Format.
3. The data transmission method of the internet of things according to claim 1, wherein the generating an XML file according to the XML file format and the parsed JSON data comprises:
writing the XML file format and the analyzed JSON data into a corresponding file stream by creating an XML Writer object;
and writing the file stream into a corresponding file by adopting a file operation tool class so as to generate the XML file.
4. A data transmission device of the Internet of things is characterized by comprising:
the uploading module is used for uploading JSON data to a server of the Internet of things through the client of the Internet of things;
the analysis module is used for analyzing the JSON data after the JSON data are uploaded to a service end of the Internet of things;
the acquisition module is used for acquiring an XML file format;
and the generating module is used for generating the XML file according to the XML file format and the analyzed JSON data.
5. The data transmission device of the internet of things of claim 4, wherein the acquisition module is specifically configured to:
and setting a formatting style by creating an Output Format object to obtain an XML file Format.
6. The data transmission device of the internet of things of claim 4, wherein the generation module is specifically configured to:
writing the XML file format and the analyzed JSON data into a corresponding file stream by creating an XML Writer object;
and writing the file stream into a corresponding file by adopting a file operation tool class so as to generate the XML file.
7. A computer device comprising a memory, a processor and a computer program stored on the memory and executable on the processor, characterized in that the processor, when executing the computer program, implements a data transmission method of the internet of things according to any one of claims 1-3.
8. A non-transitory computer-readable storage medium, on which a computer program is stored, which, when executed by a processor, implements a method for data transmission of the internet of things according to any one of claims 1 to 3.
CN202011178590.9A 2020-10-29 2020-10-29 Data transmission method and device of Internet of things Pending CN112291344A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202011178590.9A CN112291344A (en) 2020-10-29 2020-10-29 Data transmission method and device of Internet of things

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202011178590.9A CN112291344A (en) 2020-10-29 2020-10-29 Data transmission method and device of Internet of things

Publications (1)

Publication Number Publication Date
CN112291344A true CN112291344A (en) 2021-01-29

Family

ID=74372818

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202011178590.9A Pending CN112291344A (en) 2020-10-29 2020-10-29 Data transmission method and device of Internet of things

Country Status (1)

Country Link
CN (1) CN112291344A (en)

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN105930410A (en) * 2016-04-18 2016-09-07 南京邮电大学 Data service bus architecture used for data transmission of Internet of Things
CN106725422A (en) * 2016-11-30 2017-05-31 南京大学 Based on ECG detecting, display and the integral system for uploading
CN108989367A (en) * 2017-05-31 2018-12-11 深圳市中兴微电子技术有限公司 A kind of Internet of Things communication means, equipment and system
CN110660395A (en) * 2019-08-26 2020-01-07 天津开心生活科技有限公司 Safety report generation method and device based on voice recognition

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN105930410A (en) * 2016-04-18 2016-09-07 南京邮电大学 Data service bus architecture used for data transmission of Internet of Things
CN106725422A (en) * 2016-11-30 2017-05-31 南京大学 Based on ECG detecting, display and the integral system for uploading
CN108989367A (en) * 2017-05-31 2018-12-11 深圳市中兴微电子技术有限公司 A kind of Internet of Things communication means, equipment and system
CN110660395A (en) * 2019-08-26 2020-01-07 天津开心生活科技有限公司 Safety report generation method and device based on voice recognition

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
诚信天下: "JSON对象与XML相互转换工具类", 《博客园》 *

Similar Documents

Publication Publication Date Title
US20130198272A1 (en) Operation log storage system, device, and program
EP1482420A1 (en) System and method for processing data of measurement instruments
CN110019067B (en) Log analysis method and system
CN110708307A (en) Transcoder generation method and apparatus, electronic device, and storage medium
CN115511890A (en) Analysis system for large-flow data of special-shaped network interface
CN105550179A (en) Webpage collection method and browser plug-in
US20040103374A1 (en) Function extension type browser, browser component, program and recording medium
CN111464515A (en) Data conversion method, device, equipment and storage medium
CN115136256A (en) Information processing method, information processing apparatus, information processing program, and recording medium
CN109358845B (en) Method, tool and storage medium for writing JS code based on XMPP protocol
CN112291344A (en) Data transmission method and device of Internet of things
CN111865881A (en) Interface conversion method, device, medium and computer equipment
CN111143310B (en) Log recording method and device and readable storage medium
CN111767161A (en) Remote calling depth recognition method and device, computer equipment and readable storage medium
CN115277871A (en) Data transmission method, data analysis method, electronic device, and storage medium
CN111538666B (en) Method, device, computer equipment and storage medium for collecting test results in batches
CN113032287A (en) Multi-component performance testing method and system supporting distribution
CN109739808B (en) Method, system and related equipment for converting format of automobile data stream recording file
CN113568876A (en) Method and device for automatically generating DBC file
CN113778886B (en) Processing method and device for test cases
US20230185495A1 (en) Printing device performing resource monitoring process to increase amount of available space of memory
CN115396343B (en) Front-end page performance detection method and device, computer equipment and storage medium
CN113542086B (en) CAN signal initial position calculation method and DBC file generation method
CN115809115A (en) Configuration method for recording original data of experimental equipment
CN112114779B (en) Method, system, device, electronic equipment and storage medium for processing dynamic effect object

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

RJ01 Rejection of invention patent application after publication