Summary of the invention
In view of this, fundamental purpose of the present invention is to provide a kind of tag data process method and device, and the burden of energy mitigation system deal with data is avoided the generation of redundant data.
For achieving the above object, technical scheme of the present invention is achieved in that
The invention provides a kind of tag data process method, this method comprises:
The reception label information, according to the label data that the label information renewal of current reception is preserved, the tag state behind definite reception label information is that effective label sends to the upper strata processing with tag state.
In the such scheme, described label information according to current reception upgrades label data and comprises: have, preserved tag state for effectively and preserved label when out of date if determine the label of current reception, the tag state that receives label is labeled as accumulation, upgrades label data; Determining to have preserved label does not have when expired, receives that tag state still is effective behind the label; Have, preserved tag state for accumulation and preserved label when expired if determine the label of current reception, upgrade label data, determining to have preserved label does not have will receive the label number of times and add 1 when expired; If the label of determining current reception then writes down label data for reading for the first time.
In the such scheme, the label of described definite current reception has existed and has comprised: according to the product electronic code epc sign indicating number in the label information that receives, the label information that inquiry is preserved, if the epc sign indicating number in the label information of preserving has identical with epc sign indicating number in the label information that receives, then definite label exists; Describedly determine to have preserved that label is out of date to be comprised: obtain current reading tag time and time interval of reading tag time recently,, determine that then label is out of date if interval greater than timeout value.
In the such scheme, the tag state behind described definite reception label information comprises: after determining to receive label, receive the label number of times greater than frequency threshold value, then tag state is effective; Determine to receive the label number of times less than frequency threshold value, determine that further label does not repeat to read, then the state of label is effectively, otherwise the state of label is accumulation.
In the such scheme, this method further comprises: the label data that inquiry is regularly preserved, it is expired to define label, and the label data of described label is removed.
The present invention also provides a kind of tag data process device, and this device comprises: smoothing processing module, unblock formation module, data are preserved module;
The smoothing processing module is used to receive label information, according to the label information of current reception more new data preserve label data in the module, determine to receive the tag state behind the label information, be that effective label sends to unblock formation module with tag state;
Unblock formation module is used to receive label and sends to the upper strata;
Data are preserved module, are used to preserve label data.
In the such scheme, this device further comprises: label cleaning module, timer; Timer is used for periodically timing, and timing time arrives, notified tag cleaning module; Label cleaning module, being used for specified data preservation module has label expired, removes the label data of described label.
This shows, adopt method of the present invention and device, according to the time interval and the reception label number of times of current reading tag time with the nearest reading tag time, determine tag state, only sending tag state is effective label, so, can avoid repeating reading, mispronounce, the generation of skip label, the burden of mitigation system deal with data; Further, regularly expired label is cleared up, can when reducing redundant data, be avoided internal memory to reveal.
Embodiment
Basic thought of the present invention is: adapter sends to the tag data process device with the label information of the equipment that read write line sends, the tag data process device upgrades label data according to the label information of current reception, tag state behind definite reception label information is that handle on effective label transmission upper strata with tag state.
Wherein, described adapter and read write line are the equipment in the rfid system; Described label information comprises: the time of label, reading tag, product electronic code (epc) sign indicating number etc.; Described label is the data message of equipment itself; The unique identification sign indicating number that described epc sign indicating number is a label; Described label data comprises: described label data comprises label, epc sign indicating number, tag state, reception label number of times, the reading tag time first time, nearest reading tag time, current reading tag time etc.; Described tag state comprises effectively, accumulation etc.
The present invention is described in detail below by the drawings and specific embodiments.
A kind of tag data process method that the present invention proposes, as shown in Figure 1, concrete steps are as follows:
Step 101, adapter send to the tag data process device with the label information of the equipment that read write line sends;
Wherein, described tag data process device is used to receive the label information that adapter sends between adapter and upper strata, and label is sent to the upper strata after treatment again.
Here, described processing refers to the operation that subsequent step carries out; Adapter receives the label information of the device label of read write line transmission, sends to the tag data process device after the parsing, and the label information with data stream form sign after the described parsing is converted to the discernible label information of upper layer application.
Step 102, tag data process device are upgraded the local label data of preserving according to the label information of current reception, determine to receive the tag state behind the label;
Here, described tag data process device upgrades the local label data of preserving according to the label information of current reception, the tag state behind definite reception label, and detailed process may further comprise the steps as shown in Figure 2:
Step 1021: the tag data process device determines whether the label self of current reception exists, if exist, receives this label before illustrating, then execution in step 1022; If there is no, explanation is to receive this label, execution in step 1027 for the first time;
Wherein, whether already present detailed process is the label self of described definite current reception: the tag data process device is searched the epc sign indicating number of the local label information of preserving, whether have the epc sign indicating number identical with the epc sign indicating number of the label information of reception, if having, then the label of current reception exists; Otherwise the label of current reception does not exist;
Step 1022: upgrade the label time, judge whether the tag state of having preserved label is effectively, if effectively, then execution in step 1023; Otherwise, execution in step 1025;
Here, the described renewal label time comprises: with the current reading tag time mark in the label data is the nearest reading tag time; With the reading tag time mark in the label information is current reading tag time in the label data;
Described judge tag state whether effectively detailed process be: the tag data process device reads the local tag state of preserving, and checks whether described tag state is effective; Wherein, the described tag state of having preserved label is: the tag state of the label behind the reception label information, before the reception label information, by the tag data process device according to the time that receives label number of times and current reading tag with the time interval of the time of reading tag is determined for the first time, if receive the label number of times, be effective then with this label greater than frequency threshold value or interval greater than time threshold.
Receive the label number of times greater than frequency threshold value, illustrate repeatedly to receive this label, avoided mispronouncing the possibility of label; Interval greater than time threshold, illustrate that this label is not to read once more in the short time, has avoided the possibility that repeats to read; Described frequency threshold value and time threshold can set up on their own as required;
When the tag data process device will receive label for the first time, the reading tag time in the label information, perhaps, the reading tag time mark that will change in the label information after the accumulation state was reading tag time for the first time; Simultaneously, the tag data process device keeps the reading tag time in the label information that receives label for the last time, be labeled as the current reading tag time, the reading tag time mark in the label information of the label that the time of the last reception of distance label is nearest is the nearest reading tag time; For example, the tag data process device receives the label information of label for the first time, with the reading tag time mark in the label information is the reading tag time first time, nearest reading tag time and current reading tag time, when receiving the label information of described label for the second time, with the reading tag time mark in the label information is the current reading tag time, when receiving the label information of described label for the third time, the reading tag time in the label information that is received is for the third time covered the current reading tag time, the current reading tag time covers the nearest reading tag time, promptly the reading tag time mark in the label information that receives for the third time is the current reading tag time, and the reading tag time in the label information of reading to receive for the second time is the nearest reading tag time.
Step 1023: whether label has been preserved in judgement expired, if label is expired, then execution in step 1024; Otherwise, execution in step 10211, label does not have expired, and the tag state behind the reception label still is effective;
Here, describedly judge whether expired detailed process is label: reading the reading tag time that receives in the label information is the current reading tag time, and read the local nearest reading tag time of preserving, the current reading tag time is deducted the nearest reading tag time, and acquisition time compares the time interval and timeout value at interval, if interval greater than timeout value, illustrate that this label is not read for a long time, it is expired to have preserved label, and then execution in step 1024; Otherwise, execution in step 10211, having preserved label does not have expiredly, and the tag state that receives behind the label still is effective;
Step 1024: tag state is labeled as accumulation state, upgrades label data simultaneously, execution in step 1026 then;
Here, described renewal comprises: the reading tag time mark in the label information of current reception is the reading tag time first time, current reading tag time, nearest reading tag time;
Step 1025: whether label has been preserved in judgement expired, if it is out of date to have preserved label, then needs to restart accumulation, upgrades label data, execution in step 1026; Otherwise having preserved label does not have expiredly, and the reception label number of times in the label data is added 1, and execution in step 1028 then;
Step 1026: the reception label number of times in the label data is counted initial value 1, and execution in step 1028 then;
Step 1027: the record label data, execution in step 1028 then;
Here, described record label data is: preserve label, to receive the label number of times and count initial value 1, and simultaneously tag state will be labeled as accumulation, be the reading tag time first time, nearest reading tag time, current reading tag time with the reading tag time mark in the label information;
Step 1028: judge whether to receive the label number of times greater than frequency threshold value, if greater than frequency threshold value, then execution in step 10211, and tag state is labeled as effectively; Otherwise execution in step 1029;
Step 1029: judge whether label is repeated to read, if not, then execution in step 10211, and tag state is labeled as effectively; Otherwise, execution in step 10210, this tag state still is accumulation, flow process finishes;
The described detailed process that repeats to read that judges whether is: read current reading tag time and the reading tag time first time, the current reading tag time is deducted the reading tag time for the first time, acquisition time at interval, the size that compares the time interval and time threshold, if interval greater than time threshold, then label is not repeated to read, and then the state of label is effective; Otherwise label is repeated to read, and tag state still is accumulation, and flow process finishes;
Step 103, be that effective label joins the unblock formation of presetting, give the upper strata with the label distribution in the unblock formation then, carry out subsequent treatment tag state.
Here, tag state is effectively, and label is joined the unblock formation of presetting, and unblock formation this moment can realize the multithreading processing.When the tag data process device added the unblock formation with label, CPU can forbid in the unblock formation, the reading of the memory field that label adds, can read in other memory fields, label in the unblock formation sends to the upper strata, when can realize writing label, and reading tag.
Further, the tag data process device regularly reads the local label data of preserving, according to the current reading tag time in the label data and the current time of system, obtain the current time of system and the time interval of current reading tag time, compare with timeout value, if interval greater than timeout value, then this label is expired, with the label data deletion of this label, otherwise, do not process.
Based on above method, the invention allows for a kind of tag data process device, as shown in Figure 3, this device comprises: smoothing processing module 301, unblock formation module 302, data are preserved module 303;
Smoothing processing module 301, be used to receive the label information that adapter is sent, according to the label information of current reception more new data preserve label data in the module 303, determine to receive the tag state behind the label information, be that effective label sends to unblock formation module 302 with tag state;
Wherein, described adapter is an existing device, links to each other with tag data process device of the present invention, is used to receive the label information that read write line sends, and sends to smoothing processing module 301 after the parsing; Comprise time, epc sign indicating number of label, reading tag etc. in the described label information;
Unblock formation module 302 is used for that label is sent to the upper strata and carries out subsequent treatment;
Wherein, the unblock formation can realize the multithreading processing, when label is added the unblock formation, CPU can forbid in the unblock formation, adding the reading of memory field of label, and the data in other memory fields can be read, when so just can realize writing label, reading tag.
Data are preserved module 303, are used to preserve label data;
Wherein, described label data comprises label, epc sign indicating number, tag state, reception label number of times, the reading tag time first time, nearest reading tag time, current reading tag time etc.; Described tag state comprises effectively, accumulation etc.
Smoothing processing module 301 specifically is used for, according to the epc sign indicating number in the label information of current reception, search data and preserve epc sign indicating number in the label data that module 303 preserves, if there is the epc sign indicating number in the label information of epc sign indicating number and reception in the label data identical, then the label that is received has existed, upgrades the label time; Otherwise label is for reading for the first time the record label data.
Wherein, the described renewal label time comprises that with the current reading tag time mark in the label data be the nearest reading tag time; With the reading tag time mark in the label information is current reading tag time in the label data; Described record label data is: preserve label, to receive the label number of times and count initial value 1, simultaneously tag state being labeled as accumulation, is the reading tag time first time, nearest reading tag time, current reading tag time with the reading tag time mark in the label information.
Smoothing processing module 301 also is used for, according to current reading tag time in the label data and nearest reading tag time, and the acquisition time interval, if interval greater than timeout value, then label is expired; Otherwise label does not have expired.
Smoothing processing module 301 also is used for, if the label of current reception exists, the tag state of having preserved label is for effectively, determines to have preserved label when expired, and tag state is labeled as accumulation, upgrades label data simultaneously; Determining to have preserved label does not have expiredly, and then tag state still is effective; The tag state of having preserved label is accumulation, determines to have preserved label when expired, needs accumulation again, upgrades label data, and determining to have preserved label does not have to receive the label number of times and add 1 when expired; If the label of current reception is for reading for the first time the record label data.
Smoothing processing module 301 also is used for, and determines to receive the label number of times greater than frequency threshold value, then tag state is labeled as effectively; If determine to receive the label number of times less than frequency threshold value, whether the time interval of further judging current reading tag time and the reading tag time first time, then is labeled as tag state effectively if interval greater than time threshold greater than time threshold, otherwise tag state is accumulation.
This device further comprises: label cleaning module 304, timer 305;
Timer 305 is used for periodically timing, arrives timing time, notified tag cleaning module 304; Described timing time can be set as required;
Label cleaning module 304, be used for notice according to timer 305, data query is preserved the current reading tag time of the label data in the module 303 and the current time of system, acquisition time at interval, if interval greater than timeout value, then that this label is expired, with the label data deletion of this label, otherwise, be left intact.
The above is preferred embodiment of the present invention only, is not to be used to limit protection scope of the present invention, all any modifications of being done within the spirit and principles in the present invention, is equal to and replaces and improvement etc., all should be included within protection scope of the present invention.