Coding and decoding device and method for polling information exchangeTechnical Field
The invention relates to the technical field of inspection management, in particular to an encoding and decoding device and method for inspection information exchange.
Background
The current inspection system mostly adopts a mode of reading special equipment of address codes or a simple one-way scanning two-dimensional graphic code mode, inspection information needs to be recorded in a manual mode, and the current inspection system is complex in work, easy to make mistakes and easy to forge; when the system to be inspected and the equipment are connected in a wired or wireless mode in inspection management, hidden management hazards in the aspects of information safety and equipment safety exist; therefore, the conventional inspection system is poor in safety, complex in operation, inconvenient to use and capable of influencing daily work efficiency.
Disclosure of Invention
The invention aims to solve the problems and provides a coding and decoding device which is reasonable in design and safe to use and is used for polling information exchange.
The invention aims to solve the problems and provides a coding and decoding method for routing inspection information exchange, which is reasonable in design and convenient and fast to use.
In order to achieve the purpose, the invention adopts the following technical scheme: the coding and decoding device for polling information exchange comprises a local device and a handheld mobile device, wherein the local device can read information of a field system or equipment through a network interface, the local device is installed on a position or equipment to be polled, the handheld mobile device is connected with a polling system through a wireless network and is communicated with the polling system, signal output between the local fixed device and the handheld mobile device is executed by a signal output device, and signal reading is executed by a signal reading device.
In the coding and decoding device for routing inspection information exchange, the local device comprises a PC (personal computer) end, a built-in screen, a camera, coding and decoding software, graphic code scanning and generating software and a network communication interface, the handheld mobile device comprises a mobile end, a built-in screen, a camera, coding and decoding software, graphic code scanning and generating software and communication software, and the local device and the handheld mobile device read information by an opposite side according to a regular graphic decoding and identifying method after carrying out graphic coding on a synchronous signal, a response signal and information to be transmitted according to a coding rule.
The coding and decoding device for polling information exchange provides a coding and decoding method for polling information exchange, and the method comprises the following steps:
s0, outputting and reading signals by the local fixing device and the handheld mobile device; before use, a user configures parameters of the local fixed device and the handheld mobile device. Presetting a digital modulation code, wherein the length of the digital modulation code is 16 bytes, and when data to be modulated exceeds the length of the digital modulation code, the digital modulation code is recycled, and a user presets a synchronous signal, a data block recombination method of the signal to be transmitted and a key and related parameters for data encryption and decryption in the device;
s1, outputting signals; the signal output device executes the updating of the signal output every 60 seconds;
s2, reading a signal; executed by the signal reading device, reading an output signal of the signal output device:
s3, the signal output device reads the response signal.
In the above coding and decoding method for polling information exchange, the step S1 is mainly divided into the following steps:
s11, encoding a synchronous signal; the method comprises the steps that synchronous signal data start with date and time and comprise date and time, personnel ID, equipment ID, instructions, synchronous signals, online state, response error times, watermark verification and verification codes, wherein the watermark verification in the synchronous signals is CRC (cyclic redundancy check) data of time watermarks in a synchronous signal coding range and needs to be generated when the synchronous signals are formed;
s12, encoding information to be transmitted; the method comprises the steps that information data to be transmitted are composed according to a specified function, random data are filled when the length of the information to be transmitted is insufficient, the length meets the quantity of parameters required by the specified function, watermark check in the information to be transmitted is CRC (cyclic redundancy check) check data of a date-time watermark in a signal range to be transmitted, the data need to be generated when the signal to be transmitted is composed, the information to be transmitted at least comprises the current date and time, a personnel ID (identity), an instruction and response error times, data recombination and encryption are carried out on the information to be transmitted according to a preset rule, and an encryption key is allocated according to the personnel ID and the date;
s13, coding the synchronous signal and the information to be transmitted to form data to be transmitted for digital modulation, namely, calculating the data to be transmitted according to bytes and digital modulation codes;
and S14, carrying out image coding according to the image coding and the watermark rule thereof, and displaying the image coding on the screen of the signal output device.
In the above coding and decoding method for polling information exchange, the step S2 is mainly divided into the following steps:
s21, reading the graphic code; after decoding, carrying out digital demodulation, positioning and scanning a graphic code in a sending area of a signal output device through a camera lens of a signal reading device, converting the graphic code into data according to a rule, decoding by using a digital modulation code and obtaining synchronous signal data and information data to be transmitted according to the rule;
s22, reading a synchronous signal; reading date and time and personnel ID from the obtained data, acquiring equipment ID, instruction codes, synchronous signals, online state, error response times, watermark verification and verification code division block recombination methods, carrying out data verification and data comparison on the instructions, the synchronous signals, the online state, the watermark verification and the synchronous signals, executing a step S24 if the synchronous signal data is correct, stopping reading if the synchronous signal data is wrong, and executing a step S23;
s23, encoding a failure response signal; according to the preset coding rule, carrying out block recombination, digital signal modulation, graphic coding on date and time, personnel ID, instructions, online states, response serial numbers, failure response signals and watermark verification, adding watermarks, displaying the graphic codes on a screen of a signal output device, and executing step S21;
s24, reading information to be transmitted; carrying out data recombination on the information data to be transmitted from the obtained data according to a preset coding rule, comparing watermarks, assigning a decrypted key according to the personnel ID and the date, decrypting to obtain the information data to be transmitted, executing the step S26 if the information data to be transmitted is correct, terminating the reading step if the data comparison is wrong, and executing the step S25;
s25, encoding a failure response signal; combining the current date and time, the personnel ID, the instruction, the online state, the response serial number and the failed response signal according to a preset coding rule, then carrying out block recombination, digital signal modulation and graphic coding, adding a watermark, displaying the graphic coding on a screen of a signal output device, outputting information to the signal output device, and carrying out step S21;
s26, device data processing and action execution; performing data processing and action execution on the read information data to be transmitted according to the instruction;
s27, encoding the response signal; according to the function instruction and the data processing result, the date and time, the personnel ID, the instruction, the online state, the response serial number, the processing result signal and the watermark verification are combined according to a preset coding rule, then block recombination, digital signal modulation and figure coding are carried out, the watermark is added, the figure coding is displayed on a screen of a signal output device, the signal output device outputs the reading success and the information processing result, and the step S210 is carried out.
In the above coding and decoding method for polling information exchange, the step S3 is mainly divided into the following steps:
s31, reading the response signal code by the signal output device; performing block recombination, digital signal demodulation and graphic decoding on the read signal data according to a preset coding rule, performing data comparison on the read watermark check, the personnel ID, the command and the response serial number, executing the step S32 if the read watermark check is wrong, executing the step S12 if the read watermark check is correct, and executing the step S12 if the read response signal code fails in the step S23; executing step S32 if reading step S25 fails to respond to the signal code;
s32, if the signal output device judges that the error frequency reaches 3 times, outputting a fixed error code on a screen of the signal output device, recording and interpreting an error event, locking the program for 3 hours, then performing step S12, and if the error frequency reaches 9 times, locking the program in step S33;
s33, according to the method of step S12, the screen output of the signal output device fixes the error code.
In the above coding and decoding method for routing inspection information exchange, the graphic coding is coded according to word unit, a tree structure is adopted, the trunk is a vertical rectangle, the square block graphic expressed according to data bit is a graphic length unit, the trunk width is 1 unit, the trunk length is 6 units, the other parts of the trunk are black squares, 2 unit graphics at the central position of the trunk are used for placing date and time watermarks, the central position is a bit value of 2 units, wherein 1 is black, 0 is white, the central position is 2 units and then represents a numerical value of 0, then the branch is expressed by a white bit graphic, the central position is 2 units and then represents a numerical value of 1, then the left side of the branch is marked by a white graphic, the right side of the branch is expressed by a black graphic, the central position is 2 units and then represents a numerical value of 2, then the left side of the branch is expressed by a black bitmap, and the right side of the white bit graphic, the numerical value is 3 after the central position is composed of 2 units, and the branch knot is represented by a black graph; the word to be coded has two bits each represented by one branch graph in rectangular shape, two bits representing 0-4 units of value, corresponding branch graphs in 0-4 units length, clockwise branches distributed on two sides of the main trunk and word coding interval of 0.
In the coding and decoding method for routing inspection information exchange, the date and time is divided according to the unit of two-bit length, each two bits are sequentially put in a word at a graphic coding center, each word center position is sequentially put in the whole graphic code arrangement according to the word from left to right and from top to bottom, the put time watermark data is subjected to CRC check, the check value is used as a watermark data comparison value, the comparison value is put in a synchronous signal, a response signal and information to be transmitted according to the range of the watermark, the numerical value is 0 or 2 after 2 units of the center position are formed, then the branch is represented by a white bit graphic, the numerical value is 1 or 3 after 2 units of the center position are formed, and then the branch is represented by a black graphic.
In the coding and decoding method for polling information exchange, the method for recombining the synchronous signal and the response signal is stored in an array with 43200 elements, the method for recombining the information data in blocks is independently placed in an array with 43200 elements, the method for recombining the information data in blocks is taken according to the sequence of every minute, and the method can be recycled after 30 days; the configuration of the initial address A is different in the array corresponding to each personnel ID, the array address offset B is obtained through the calculation of the date and the time according to minutes, and the element position of the array is obtained by A + B, so that the data block recombination method corresponding to the current date and time is obtained;
in the coding and decoding method for routing inspection information exchange, data to be partitioned is two bytes, namely 16-bit length is 1 row for transverse arrangement, data longitudinal bit forms a data block, namely the data is partitioned into 16 blocks, the numbers are 0 to 15, the initial address of a recombination method array is obtained according to different personnel IDs, the offset address of the recombination method is obtained through date and time calculation, then a recombination method value is obtained from the array, the method value is 16-bit data, 4 numerical values which are more than or equal to 0 and less than or equal to 15 can be obtained according to 4-bit length, the 4 numerical values represent the number of the data block to be recombined and exchanged, the 4 numerical values are divided into 2 pairs, and each pair of two data block numbers indicate that the data block is exchanged and recombined; setting mutually corresponding encryption and decryption key arrays on the signal output device and the signal reading device for encryption and decryption in the information exchange process; the length of the key array of the encryption and decryption key array is 8640, namely the key array is replaced for 1 time per hour, the key array is recycled, the personnel ID obtains the initial address A of the key array configured by the user during encryption and decryption, the personnel ID obtains the address increment method of the key array configured by the user, the method value is composed of two bytes, the 1 st byte is an address multiplier factor B, the value range is 1-3, the 2 nd byte is a re-offset address C, the value range is 0-15, the address offset D is calculated by the date, the address offset E is calculated by the time of the day, and the calculation method for taking the key address is as follows: a + D + E.times.B + C.
Compared with the prior art, the invention has the advantages that:
for information safety, an information system and equipment to be inspected are in a physical isolation state with an internet, a mobile phone network, WIFI and the like, namely the information system and the equipment to be inspected do not have wired and wireless communication;
secondly, dynamic updating and checking are carried out on the graphic code, so that the counterfeiting behavior of routing inspection information is effectively avoided;
thirdly, the local fixing device can read and provide necessary information content for automatic inspection tour according to the setting in advance through a network interface, and manual recording operation is reduced;
and fourthly, realizing the access control or automatic login function through device interaction.
And fifthly, the handheld mobile device is connected through a mobile phone network, and the inspection content is automatically transmitted to the inspection system, so that the handheld mobile device can be conveniently authorized, logged out and the like.
Drawings
FIG. 1 is a block diagram of the present invention;
FIG. 2 is a schematic diagram of the structure of image coding and watermark coding in the present invention;
FIG. 3 is a schematic diagram of an example of graphics encoding and watermark encoding in the present invention;
FIG. 4 is a schematic diagram of the data chunking and reassembly method of the present invention;
FIG. 5 is a schematic diagram of a key selection method for encryption and decryption in the present invention;
FIG. 6 is a flowchart of a graphics encoding and decoding method according to the present invention.
In fig. 1, 6 denotes a handheld mobile device, 13 denotes a local fixed device, 14 denotes a communication interface for reading information of localother devices 13, 7 denotes a wireless connection of 6 with the patrol system, 15 denotes a visual reading range of 6 through ascreen 9 of acamera 1 to 13 thereof, 16 denotes a visual reading range of 13 through ascreen 2 of acamera 8 to 6 thereof, 6 is composed of acamera 1, ascreen 2, a scanning anddecoding module 3, acoding module 4, and awireless communication module 5, 13 is composed of acamera 8, ascreen 9, a scanning andreading decoding module 10, acoding module 11, and acommunication module 12.
In fig. 2, 10 and 11 are used for word positioning, 5 is the position of watermark data, and 1, 2, 3, 4, 6, 7, 8 and 9 are the encoding positions of word values.
In fig. 3, a, b, c, and d are used for performing image encoding on the same value according to different watermark data according to an image encoding rule.
In fig. 4, 8 is a word array specific to information, where 1, 2, 3, 4 are specific data words, 9 is data after being reorganized into blocks, where 1, 2, 3, 4 are converted data words, 5 is ID and date and time parameter read and input, 7 is a word array stored for a data block reorganization method, 6 is a data block and reorganization module, 6 reads 5 parameters through 14 to read in the data block reorganization method from 7 by calculation, 6 reads data through 10 from 8 when information output is required, 9 blocks and reorganization data are output through 11 for output, 6 reads data through 12 from receiveddata 9 when information read input is performed, and restores the data tooriginal data 8 through 13.
In fig. 5, 12 is information output device encryption key selection, 13 is information reading device decryption key selection, 4 of 12 is an encryption processing module, 1 is data to be encrypted, 2 is an address increment method value of a key corresponding to a person ID, 6 is an encrypted signal output and reading process, 13 reads the encrypted data, 9 the decryption processing module obtains the person ID and the date and time from 8, obtains the address increment method value of the key corresponding to the person ID from 7, and obtains a key array index value corresponding to the decryption key through 9 operations to obtaindecrypted data 11.
In fig. 6, S0, S11, S12, S13, S14, S2, S21, S22, S23, S24, S25, S26, S27, S3, S31S 32, and S33 are schematic block flow diagrams of the respective steps.
Detailed Description
The present invention will be described in further detail with reference to the accompanying drawings and specific embodiments.
As shown in fig. 1, the codec device for exchanging polling information includes a local device capable of reading information of a field system or equipment through a network interface, and a handheld mobile device, where the local device is installed on a location or equipment to be polled, the handheld mobile device is connected to and communicates with the polling system through a wireless network, and signal output between the localfixed device 13 and the handheld mobile device is performed by a signal output device, and signal reading is performed by a signal reading device.
The local device comprises a PC (personal computer) end, a built-in screen, a camera, coding and decoding software, graphic code scanning and generating software and a network communication interface, the handheld mobile device comprises a mobile end, a built-in screen, a camera, coding and decoding software, graphic code scanning and generating software and communication software, and the local device and the handheld mobile device read information by an opposite side according to a regular graphic decoding and identifying method after graphic coding is carried out on a synchronous signal, a response signal and information to be transmitted according to a coding rule.
As shown in fig. 2 to 6, a coding and decoding method for polling information exchange includes the following steps:
s0, outputting and reading signals by the local fixing device and the handheld mobile device; before use, a user configures parameters of the local fixed device and the handheld mobile device. Presetting a digital modulation code, wherein the length of the digital modulation code is 16 bytes, and when data to be modulated exceeds the length of the digital modulation code, the digital modulation code is recycled, and a user presets a synchronous signal, a data block recombination method of the signal to be transmitted and a key and related parameters for data encryption and decryption in the device;
s1, outputting signals; the signal output device executes the updating of the signal output every 60 seconds;
s2, reading a signal; executed by the signal reading device, reading an output signal of the signal output device:
s3, the signal output device reads the response signal.
Wherein, step S1 is mainly divided into the following steps:
s11, encoding a synchronous signal; the method comprises the steps that synchronous signal data start with date and time and comprise date and time, personnel ID, equipment ID, instructions, synchronous signals, online state, response error times, watermark verification and verification codes, wherein the watermark verification in the synchronous signals is CRC (cyclic redundancy check) data of time watermarks in a synchronous signal coding range and needs to be generated when the synchronous signals are formed;
s12, encoding information to be transmitted; the method comprises the steps that information data to be transmitted are composed according to a specified function, random data are filled when the length of the information to be transmitted is insufficient, the length meets the quantity of parameters required by the specified function, watermark check in the information to be transmitted is CRC (cyclic redundancy check) check data of a date-time watermark in a signal range to be transmitted, the data need to be generated when the signal to be transmitted is composed, the information to be transmitted at least comprises the current date and time, a personnel ID (identity), an instruction and response error times, data recombination and encryption are carried out on the information to be transmitted according to a preset rule, and an encryption key is allocated according to the personnel ID and the date;
s13, coding the synchronous signal and the information to be transmitted to form data to be transmitted for digital modulation, namely, calculating the data to be transmitted according to bytes and digital modulation codes;
and S14, carrying out image coding according to the image coding and the watermark rule thereof, and displaying the image coding on the screen of the signal output device.
Specifically, step S2 is mainly divided into the following steps:
s21, reading the graphic code; after decoding, carrying out digital demodulation, positioning and scanning a graphic code in a sending area of a signal output device through a camera lens of a signal reading device, converting the graphic code into data according to a rule, decoding by using a digital modulation code and obtaining synchronous signal data and information data to be transmitted according to the rule;
s22, reading a synchronous signal; reading date and time and personnel ID from the obtained data, acquiring equipment ID, instruction codes, synchronous signals, online state, error response times, watermark verification and verification code division block recombination methods, carrying out data verification and data comparison on the instructions, the synchronous signals, the online state, the watermark verification and the synchronous signals, executing a step S24 if the synchronous signal data is correct, stopping reading if the synchronous signal data is wrong, and executing a step S23;
s23, encoding a failure response signal; according to the preset coding rule, carrying out block recombination, digital signal modulation, graphic coding on date and time, personnel ID, instructions, online states, response serial numbers, failure response signals and watermark verification, adding watermarks, displaying the graphic codes on a screen of a signal output device, and executing step S21;
s24, reading information to be transmitted; carrying out data recombination on the information data to be transmitted from the obtained data according to a preset coding rule, comparing watermarks, assigning a decrypted key according to the personnel ID and the date, decrypting to obtain the information data to be transmitted, executing the step S26 if the information data to be transmitted is correct, terminating the reading step if the data comparison is wrong, and executing the step S25;
s25, encoding a failure response signal; combining the current date and time, the personnel ID, the instruction, the online state, the response serial number and the failed response signal according to a preset coding rule, then carrying out block recombination, digital signal modulation and graphic coding, adding a watermark, displaying the graphic coding on a screen of a signal output device, outputting information to the signal output device, and carrying out step S21;
s26, device data processing and action execution; performing data processing and action execution on the read information data to be transmitted according to the instruction;
s27, encoding the response signal; according to the function instruction and the data processing result, the date and time, the personnel ID, the instruction, the online state, the response serial number, the processing result signal and the watermark verification are combined according to a preset coding rule, then block recombination, digital signal modulation and figure coding are carried out, the watermark is added, the figure coding is displayed on a screen of a signal output device, the signal output device outputs the reading success and the information processing result, and the step S210 is carried out.
In detail, step S3 is mainly divided into the following steps:
s31, reading the response signal code by the signal output device; performing block recombination, digital signal demodulation and graphic decoding on the read signal data according to a preset coding rule, performing data comparison on the read watermark check, the personnel ID, the command and the response serial number, executing the step S32 if the read watermark check is wrong, executing the step S11 if the read watermark check is correct, and executing the step S11 if the read response signal code fails in the step S23; executing step S32 if reading step S25 fails to respond to the signal code;
s32, if the signal output device judges that the error frequency reaches 3 times, outputting a fixed error code on a screen of the signal output device, recording and interpreting an error event, locking the program for 3 hours, then performing step S11, and if the error frequency reaches 9 times, locking the program in step S33;
s33, according to the method of step S11, the screen output of the signal output device fixes the error code.
More specifically, the graph coding is coded according to the word unit, a tree structure is adopted, a trunk is a vertical rectangle, a square block graph expressed according to data bits is a graph length unit, the width of the trunk is 1 unit, the length of the trunk is 6 units, other parts of the trunk are black squares, 2 unit graphs at the center position of the trunk are used for placing date and time watermarks, the center position is a bit value of 2 units, wherein 1 is black, 0 is white, the numerical value is 0 after 2 units at the center position are combined, then the branch is expressed by a white bit graph, the numerical value is 1 after 2 units at the center position are combined, the left side of the branch is marked by a white graph, the right side of the branch is expressed by a black graph, the numerical value is 2 after 2 units at the center position are combined, the left side of the branch is expressed by a black bitmap, the right side of the white bit graph is expressed, the numerical value is 3 after 2 units at the center position are combined, the branch knots are represented by black figures; the word to be coded has two bits each represented by one branch graph in rectangular shape, two bits representing 0-4 units of value, corresponding branch graphs in 0-4 units length, clockwise branches distributed on two sides of the main trunk and word coding interval of 0.
Further, the date and time are divided according to the length of two bits as a unit, one word is sequentially placed in each two bits at a graphic coding center, each word center position is sequentially placed in the whole graphic code arrangement according to the word from left to right and from top to bottom, CRC (cyclic redundancy check) is carried out on the placed time watermark data, the check value is used as a watermark data comparison value, the comparison value is placed in a synchronous signal, a response signal and information to be transmitted according to the range of the watermark, the numerical value is 0 or 2 after 2 units of the center position are formed, the branch is represented by a white bit graphic, the numerical value is 1 or 3 after 2 units of the center position are formed, and the branch is represented by a black graphic.
Preferably, the method for recombining the synchronous signal and the response signal is stored in an array with 43200 elements, the method for recombining the information data in blocks is independently placed in an array with 43200 elements, the method for recombining the information data in blocks is taken according to the order of every minute, and the information data can be recycled after 30 days; the configuration of the initial address A is different in the array corresponding to each personnel ID, the array address offset B is obtained through the calculation of the date and the time according to minutes, and the element position of the array is obtained by A + B, so that the data block recombination method corresponding to the current date and time is obtained;
furthermore, the data to be divided into two bytes, namely 16-bit length is 1 row for transverse arrangement, the longitudinal bit of the data forms a data block, namely the data is divided into 16 blocks, the serial number is 0 to 15, the initial address of the recombination method array is obtained according to different personnel IDs, the offset address of the recombination method is obtained through date and time calculation, then the recombination method value is obtained from the array, the method value is 16-bit data, 4 numerical values which are more than or equal to 0 and less than or equal to 15 are obtained according to 4-bit length division, the 4 numerical values represent the data block number to be recombined and exchanged, the 4 numerical values are divided into 2 pairs, and each pair of two data block numbers indicate that the data blocks are exchanged and recombined; setting mutually corresponding encryption and decryption key arrays on the signal output device and the signal reading device for encryption and decryption in the information exchange process; the length of the key array of the encryption and decryption key array is 8640, namely the key array is replaced for 1 time per hour, the key array is recycled, the personnel ID obtains the initial address A of the key array configured by the user during encryption and decryption, the personnel ID obtains the address increment method of the key array configured by the user, the method value is composed of two bytes, the 1 st byte is an address multiplier factor B, the value range is 1-3, the 2 nd byte is a re-offset address C, the value range is 0-15, the address offset D is calculated by the date, the address offset E is calculated by the time of the day, and the calculation method for taking the key address is as follows: a + D + E.times.B + C.
In summary, the principle of the present embodiment is: after the local device reads the information to be detected, the local device carries out graphic coding and display on the information to be detected according to the rule and the steps thereof, the handheld mobile device reads the information to be detected through scanning and decoding according to the rule and the steps thereof, and can carry out response feedback of the information reading and processing result state so as to facilitate the local device to carry out the next operation of the information to be transmitted; when the access control is set in the inspection area, the local device can replace access control identification equipment, the handheld mobile device performs response feedback after identifying the access control and sends door opening action requirement information, and the local device sends door opening information to the access control equipment through a network interface after scanning identification; when the inspection area needs manual operation, the local device can replace input equipment, the handheld mobile decoration sends login information after identification and response feedback, the local device automatically logs in to a local system or equipment through a network interface after scanning identification, then the operation is carried out, the tedious login operation and the login password memory are avoided, the operation is convenient, and the safety is good.
The specific embodiments described herein are merely illustrative of the spirit of the invention. Various modifications or additions may be made to the described embodiments or alternatives may be employed by those skilled in the art without departing from the spirit or ambit of the invention as defined in the appended claims.