A kind of data transfer device based on Internet of ThingsTechnical field
The present invention relates to internet of things field, specially a kind of data transfer device based on Internet of Things.
Background technique
Internet of Things is the important component of generation information technology and the important development stage of information age, is cared forName Si Yi, Internet of Things are exactly the connected internet of object object, and application innovation is the core of Internet of Things development, in the application of Internet of Things,It needs to carry out transmission operation to data using the data transfer device of Internet of Things.
Traditional data transfer device based on Internet of Things, safety is not high, and is difficult to the reality according to data wellLength change be segmented when transmission mode (if relatively excessive for number of fragments, can because component head and component tail are excessive andCaused data length additional amount is relatively excessive, if number of fragments is relatively too small, if there is individual data missing, needs againThe data of conversion are too long), use while reducing working efficiency to user is made troubles.
Summary of the invention
(1) the technical issues of solving
In view of the deficiencies of the prior art, it the present invention provides a kind of data transfer device based on Internet of Things, solves based on objectThe data transfer device safety of networking is not high, and is difficult to the side being segmented when changing and transmit according to the physical length of data wellFormula (if relatively excessive for number of fragments, can because of component head and component tail it is excessive caused by data length additional amount phaseTo excessive, if number of fragments is relatively too small, if there is individual data missing, the data for needing to convert again are too long) the problem of.
(2) technical solution
In order to achieve the above object, the present invention is achieved by the following technical programs: a kind of data conversion side based on Internet of ThingsMethod, which comprises the steps of:
S1, data generate: data sending terminal generates body of data and reads detects table end to end, examines end to end according to setting rule selectionThe cell in table is surveyed, this element lattice are set as current cell, and integral data (integral data is generated by current cellFormat are as follows: head detected value+body of data+tail detected value+particular value);
S2, data encryption: integral data encryption is become by encryption data by des encryption algorithm;
S3, data compression: encryption data is collapsed into compressed data by DEFLATE compress mode;
S4, data statistics: the length of compressed data is counted, and reads segments judgement table, and according to safety index andLength statistical value corresponding segments number judgement table finds out current corresponding segments;
S5, segmental machining: compressed data is divided into several segment datas according to single component, and generates segment data (segment dataFormat are as follows: component head+segment data+number of components+component tail);
S6, data A/D conversion and transmission: segment data is converted to by electric signal by A/D converter, and is passed by data lineIt send;
S7, data receiver and D/A are converted: electric signal is received and passes through D/A converter by receiving end converts electrical signals to segmentationData;
S8, Data Detection and recombination: whether just the fragment header, segmentation tail and segments of segment data are judged by segmentsReally, it if correctly, segment data is combined into compressed data again according to segments judgement table, if incorrect, is sent out to dataSending end sends wrong data, and data sending terminal is sent out the segment data of respective components number by the number of components in wrong data againIt send, then re-starts step S8;
S9, algorithm decompression: the compressed data in step S8 is decompressed by way of DEFLATE decompression as integral data;
S10, body of data are extracted: head detected value, tail detected value and the particular value in integral data obtained in step S9 are mentionedIt takes and compares detection table end to end, if meeting detection table end to end, a detected value, tail detected value and particular value are removed, to obtainBody of data issues to data sending terminal if not being inconsistent syncephalon detected value, tail detected value and particular value and retransmits request.
Preferably, in S1, the sheet format of detection end to end is as follows: row: head detected value;Column: tail detected value;Cell:Particular value.
Preferably, in S1, the setting rule is is starting point from detection table upper left side first cell end to end, oftenThe secondary lattice selecting unit lattice that move right add the line number of cell if current cell is in detects the most right place of table end to endIt is selected since Far Left together, when selection tail detection the last one cell of table lower right to the end, reselects upper left sideFirst cell, recycled with this.
Preferably, in S4, the segments judges that sheet format is as follows: row: length statistical value;Column: safety index;UnitLattice: segments.
Preferably, in S4, the segments includes: single component, component, number of components, component head and component tail.
Preferably, in S4, the safety index needs user to be previously set, if not setting, uses default value.
Preferably, in S8, the format of the wrong data are as follows: error code+number of components.
(3) beneficial effect
The present invention provides a kind of data transfer devices based on Internet of Things.Have it is following the utility model has the advantages that
The data transfer device based on Internet of Things judges table by segments and detects the use of table end to end, so that data turnIt is reasonably segmented when changing according to the length of data, and by detecting twice, while the data of transmission is encrypted and pressedContracting, strengthens the safety of data, while it is (right to can be very good the mode being segmented when changing and transmit according to the physical length of dataIf relatively excessive in number of fragments, can because of component head and component tail it is excessive caused by data length additional amount with respect to mistakeGreatly, if number of fragments is relatively too small, if there is individual data missing, the data for needing to convert again are too long), improve work effectThe use for the person of being convenient to use while rate.
Specific embodiment
Described embodiments are only a part of the embodiments of the present invention, instead of all the embodiments.Based on the present inventionIn embodiment, every other implementation obtained by those of ordinary skill in the art without making creative effortsExample, shall fall within the protection scope of the present invention.
A kind of data transfer device based on Internet of Things, which comprises the steps of:
S1, data generate: data sending terminal generates body of data and reads detects table end to end, examines end to end according to setting rule selectionThe cell in table is surveyed, this element lattice are set as current cell, and integral data (integral data is generated by current cellFormat are as follows: head detected value+body of data+tail detected value+particular value;Detection sheet format is as follows end to end: row: head detected value;Column:Tail detected value;Cell: particular value;Setting rule is is starting point from detection table upper left side first cell end to end, every timeMove right a lattice selecting unit lattice, if current cell is in detects the most right place of table end to end, the line number of cell is added oneAnd selected since Far Left, when selection tail detection the last one cell of table lower right to the end, reselect upper leftFirst cell is recycled with this), wherein head detected value, tail detected value and particular value are three bytes (24)Binary system ordered series of numbers;
S2, data encryption: integral data encryption is become by encryption data by des encryption algorithm;
S3, data compression: encryption data is collapsed into compressed data by DEFLATE compress mode;
S4, data statistics: the length of compressed data is counted, and reads segments judgement table, and according to safety index andLength statistical value corresponding segments number judgement table finds out current corresponding segments, and (segments judges that sheet format is as follows: row: length systemEvaluation;Column: safety index;Cell: segments;Segments includes: single component, component, number of components, component head and componentTail;Safety index needs user to be previously set, if not setting, uses default value), wherein segments is three bytes (two14) binary system ordered series of numbers;
S5, segmental machining: compressed data is divided into several segment datas according to single component, and generates segment data (segment dataFormat are as follows: component head+segment data+number of components+component tail), wherein component head and component tail are three bytes (24Position) binary system ordered series of numbers, number of components be five bytes (40) binary system ordered series of numbers;
S6, data A/D conversion and transmission: segment data is converted to by electric signal by A/D converter, and is passed by data lineIt send;
S7, data receiver and D/A are converted: electric signal is received and passes through D/A converter by receiving end converts electrical signals to segmentationData;
S8, Data Detection and recombination: whether just the fragment header, segmentation tail and segments of segment data are judged by segmentsReally, it if correctly, segment data is combined into compressed data again according to segments judgement table, if incorrect, is sent out to dataSending end sends wrong data, and data sending terminal is sent out the segment data of respective components number by the number of components in wrong data againIt send, then re-starts the format of step S8(wrong data are as follows: error code+number of components);
S9, algorithm decompression: the compressed data in step S8 is decompressed by way of DEFLATE decompression as integral data;
S10, body of data are extracted: head detected value, tail detected value and the particular value in integral data obtained in step S9 are mentionedIt takes and compares detection table end to end, if meeting detection table end to end, a detected value, tail detected value and particular value are removed, to obtainBody of data issues to data sending terminal if not being inconsistent syncephalon detected value, tail detected value and particular value and retransmits request.
In conclusion should data transfer device based on Internet of Things, made by segments judgement table and end to end detection tableWith so that being reasonably segmented when data conversion according to the length of data, and by detecting twice, while to the data of transmissionWhen being encrypted and compressed, strengthen the safety of data, while can be very good to change transmission according to the physical length of dataSegmentation mode (if relatively excessive for number of fragments, can because of component head and component tail it is excessive caused by data lengthAdditional amount is relatively excessive, if number of fragments is relatively too small, if there is individual data missing, and the data mistake that needs to convert againIt is long), the use for the person of being convenient to use while improving working efficiency.
It although an embodiment of the present invention has been shown and described, for the ordinary skill in the art, can be withA variety of variations, modification, replacement can be carried out to these embodiments without departing from the principles and spirit of the present invention by understandingAnd modification, the scope of the present invention is defined by the appended.