Data conversion method based on Internet of thingsTechnical Field
The invention relates to the technical field of Internet of things, in particular to a data conversion method based on the Internet of things.
Background
The internet of things is an important component of a new generation of information technology and an important development stage of the information era, as the name suggests, the internet of things is the internet connected with objects, application innovation is the core of the development of the internet of things, and in the application of the internet of things, a data conversion method of the internet of things is needed to be used for data transmission operation.
The traditional data conversion method based on the internet of things is low in safety and difficult to change a segmentation mode during transmission according to the actual length of data (if the number of segments is too large, the data length addition amount caused by too many component heads and component tails is too large, and if the number of segments is too small, single data is lost, and data needing to be converted again is too long), so that inconvenience is brought to a user while the working efficiency is reduced.
Disclosure of Invention
Technical problem to be solved
Aiming at the defects of the prior art, the invention provides a data conversion method based on the Internet of things, which solves the problems that the data conversion method based on the Internet of things is not high in safety and is difficult to change a segmentation mode during transmission according to the actual length of data (if the number of segments is relatively overlarge, the additional quantity of the data length caused by the overlarge number of component heads and component tails is relatively overlarge, and if the number of segments is relatively undersize, single data is lost, and the data which needs to be converted again is overlong).
(II) technical scheme
In order to achieve the purpose, the invention is realized by the following technical scheme: a data conversion method based on the Internet of things is characterized by comprising the following steps:
s1, data generation: the data sending end generates a data body and reads the head and tail detection table, the cells in the head and tail detection table are selected according to the set rule, the cells are set as the current cells, the integrated data are generated through the current cells, and the format of the integrated data is as follows: a head detection value + a data body + a tail detection value + a specific value;
s2, data encryption: encrypting the integrated data into encrypted data through a DES encryption algorithm;
s3, data compression: the encrypted data is compressed into compressed data by a DEFLATE compression mode;
s4, data statistics: counting the length of the compressed data, reading a segment number judgment table, and solving the current corresponding segment number according to the segment number judgment table corresponding to the safety index and the length statistic value;
s5, segmented processing: dividing the compressed data into a plurality of segments of data according to a single component, and generating segmented data, wherein the format of the segmented data is as follows: component head + segment data + component number + component tail;
s6, data A/D conversion and transmission: converting the segment data into an electrical signal through an A/D converter and transmitting through a data line;
s7, data receiving and D/A conversion: the receiving end receives the electric signal and converts the electric signal into segmented data through a D/A converter;
s8, data detection and recombination: judging whether the component head, the component number and the component tail of the segmented data are correct or not through the segment number, if so, re-combining the segmented data into compressed data according to a segment number judgment table, if not, sending error data to a data sending end, retransmitting the segmented data of the corresponding segment number through the segment number in the error data by the data sending end, and then re-performing the step S8;
s9, carrying out algorithm decompression: decompressing the compressed data in the step S8 into integrated data by means of DEFLATE decompression;
s10, data ontology extraction: and (4) extracting the head detection value, the tail detection value and the specific value in the integrated data obtained in the step (S9) and comparing the head detection value, the tail detection value and the specific value with a head-tail detection table, removing the head detection value, the tail detection value and the specific value if the head detection value, the tail detection value and the specific value are in accordance with the head-tail detection table, so that a data body is obtained, and sending a resending request to the data sending end if the head detection value, the tail detection.
Preferably, in S1, the format of the head-to-tail detection table is as follows: line: detecting a head value; the method comprises the following steps: tail detection value; cell: specific values.
Preferably, in S1, the setting rule is that the first cell at the top left of the head and tail detection table is used as a starting point, the cell is selected by moving one cell to the right each time, if the current cell is at the rightmost position of the head and tail detection table, the row number of the cell is added together and the cell is selected from the leftmost side, and when the last cell at the bottom right of the head and tail detection table is selected, the first cell at the top left is selected again, so as to loop.
Preferably, in S4, the table format for judging the number of segments is as follows: line: a length statistic; the method comprises the following steps: a safety index; cell: the number of segments.
Preferably, in S4, the segment number includes: single component, component number, component head, and component tail.
Preferably, in S4, the safety index needs to be set by the user in advance, and if not, a default value is used.
Preferably, in S8, the format of the error data is: error code + number of components.
(III) advantageous effects
The invention provides a data conversion method based on the Internet of things. The method has the following beneficial effects:
this data conversion method based on thing networking, through the use of segmentation number judgment table and head and the tail detection table, carry out reasonable segmentation according to the length of data during making data conversion, and through twice detection, encrypt and compress the data of transmission simultaneously, the security of data has been strengthened, the segmentation mode during transmission is changed according to the actual length of data that simultaneously can be fine (to if segmentation quantity is too big relatively, can be because the data length addition volume that component head and component tail are too much and lead to is too big relatively, if segmentation quantity is too small relatively, then if single data disappearance appears, the data overlength that need reconvert), the use that has made things convenient for the user when improving work efficiency.
Detailed Description
The described embodiments are only some embodiments of the invention, 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.
A data conversion method based on the Internet of things is characterized by comprising the following steps:
s1, data generation: the data sending end generates a data body and reads a head and tail detection table, selects a cell in the head and tail detection table according to a set rule, sets the cell as a current cell, and generates integrated data through the current cell (the format of the integrated data is that the head detection value + the data body + the tail detection value + a specific value, the format of the head and tail detection table is that a line is a head detection value, a line is a tail detection value, a cell is a specific value, the set rule is that the first cell at the upper left of the head and tail detection table is used as a starting point, the cell is selected by moving one cell at each time, if the current cell is at the rightmost position of the head and tail detection table, the line number of the cell is added and selected from the leftmost side, when the last cell at the lower right of the head and tail detection table is selected, the first cell at the upper left side is selected again, and the cycle is, wherein the head detection value, the tail detection value and the specific value are binary sequences of three bytes (twenty-four bits);
s2, data encryption: encrypting the integrated data into encrypted data through a DES encryption algorithm;
s3, data compression: the encrypted data is compressed into compressed data by a DEFLATE compression mode;
s4, data statistics: counting the length of the compressed data, reading a segment number judgment table, and solving the current corresponding segment number according to the security index and the segment number judgment table corresponding to the length statistic value (the format of the segment number judgment table is as follows: the row: the length statistic value; the column: the security index; the unit cell: the segment number; the segment number includes a single component, a component number, a component head and a component tail; the security index needs to be set by a user in advance, if not, a default value is used), wherein the segment number is a binary number column of three bytes (twenty-four bits);
s5, segmented processing: dividing the compressed data into a plurality of segments of data according to a single component, and generating segmented data (the format of the segmented data is: component head + segment data + component number + component tail), wherein the component head and the component tail are binary series of three bytes (twenty-four bits), and the component number is binary series of five bytes (forty bits);
s6, data A/D conversion and transmission: converting the segment data into an electrical signal through an A/D converter and transmitting through a data line;
s7, data receiving and D/A conversion: the receiving end receives the electric signal and converts the electric signal into segmented data through a D/A converter;
s8, data detection and recombination: judging whether the component head, the component number and the component tail of the segmented data are correct or not through the segment number, if so, re-combining the segmented data into compressed data according to a segment number judgment table, if not, sending error data to a data sending end, retransmitting the segmented data of the corresponding segment number through the segment number in the error data by the data sending end, and then re-performing the step S8 (the format of the error data is: error code + the segment number);
s9, carrying out algorithm decompression: decompressing the compressed data in the step S8 into integrated data by means of DEFLATE decompression;
s10, data ontology extraction: and (4) extracting the head detection value, the tail detection value and the specific value in the integrated data obtained in the step (S9) and comparing the head detection value, the tail detection value and the specific value with a head-tail detection table, removing the head detection value, the tail detection value and the specific value if the head detection value, the tail detection value and the specific value are in accordance with the head-tail detection table, so that a data body is obtained, and sending a resending request to the data sending end if the head detection value, the tail detection.
To sum up, the data conversion method based on the internet of things enables reasonable segmentation according to the length of data during data conversion through the use of the segmentation number judgment table and the head and tail detection table, and through twice detection, the transmitted data are encrypted and compressed at the same time, so that the safety of the data is enhanced, meanwhile, the segmentation mode during transmission can be changed well according to the actual length of the data (if the number of segments is relatively too large, the data length addition amount caused by too many component heads and component tails is relatively too large, and if the number of segments is relatively too small, single data is lost, the data needing to be converted again is too long), the work efficiency is improved, and meanwhile, the use of a user is facilitated.
Although embodiments of the present invention have been shown and described, it will be appreciated by those skilled in the art that changes, modifications, substitutions and alterations can be made in these embodiments without departing from the principles and spirit of the invention, the scope of which is defined in the appended claims and their equivalents.