Summary of the invention
The present invention provides a kind of reader drive unit, reader control system and reader driving method; The reader drive unit does not support to discern the problem of various protocols type label in the solution prior art; Perhaps the reader drive unit switches between the different application operation-interface back and forth, causes application and development inconvenience, efficient is low and problem such as cost height.
For solving the problems of the technologies described above, the present invention takes following technical scheme.
A kind of reader drive unit; Comprise communication unit and application operating interface unit; Said application operating interface unit comprises the multi-protocols application operating interface of supporting identification various protocols type label; Wherein, said multi-protocols application operating interface is used to receive calling of upper layer application, carries out information interaction with upper layer application; Said communication unit is used to realize the information interaction between said multi-protocols application operating interface and the reader.
In an embodiment of the present invention, said application operating interface unit also comprises single protocol application operation-interface of one or more support identification form kind protocol type labels.
As in an embodiment of the present invention, said single protocol application operation-interface comprises a kind of in ISO18000-6C protocol application operation-interface, the ISO18000-6B protocol application operation-interface.
In an embodiment of the present invention; This reader drive unit also comprises message processing unit; Said message processing unit comprises coding module and decoder module; Wherein, said coding module is used for becoming the form of bit stream to transfer to said communication unit the information translation from said application operating interface unit; Said decoder module is used for the information translation from said communication unit is become the Message form, and respective transmissions to said application operating interface unit.
In an embodiment of the present invention, said message processing unit also comprises buffer area, is used to store the information from said communication unit, and offers said decoder module.
In an embodiment of the present invention, said message processing unit also comprises the queue processing module, after being used for information with the complete decoding of said decoder module and being added into message queue, offers said application operating interface unit.
In an embodiment of the present invention, said message processing unit comprises that also message searches module, after being used for searching corresponding information from said message queue, offers said application operating interface unit.
In an embodiment of the present invention; This reader drive unit also comprises the reader administrative unit; Said reader administrative unit comprises that reader opens module and reader closing module; Wherein, said reader is opened module and is used for through the relevant parameters object is set, and sets up linking between said communication unit and the reader; Said reader closing module is used to break off linking of said communication unit and reader.
In an embodiment of the present invention, said reader administrative unit also comprises link monitoring module, is used under the reader client mode, monitoring said reader.
In an embodiment of the present invention, said reader administrative unit also comprises the link detecting module, is used to detect the linking status of said reader.
A kind of reader control system; Comprise each described reader drive unit of reader, upper layer application and claim 1 to 10; The multi-protocols application operating interface of the support identification various protocols type label in the said reader drive unit is used to receive calling of upper layer application, carries out information interaction with upper layer application; Communication unit is used to realize the information interaction between said multi-protocols application operating interface and the reader.
A kind of reader driving method; Said method is applied to each described reader drive unit of claim 1 to 10; Said reader driving method comprises: the multi-protocols application operating interface of the support identification various protocols type label in the said reader drive unit receives calling of upper layer application, and carries out information interaction between the upper layer application; Said multi-protocols application operating interface is through carrying out information interaction between communication unit in the said reader drive unit and the reader.
The invention has the beneficial effects as follows: reader drive unit, control system and the method for support identification various protocols type label provided by the invention make that the user need not be confined to operate a kind of protocol type label; Or when the different agreement type label operated; Need between multiple interfaces, switch back and forth; The user only need be through multi-protocols application operating interface provided by the invention; Can discern and operate the different agreement type label, can make different agreement type label reporting information simultaneously, the upper layer application exploitation can be developed operation to the different agreement label through unified application operating interface; Obviously can reduce cost of development, improve the reader work efficiency simultaneously.
Further; In the reader drive unit of the present invention except comprising multi-protocols application operating interface; Can also set up the more common single single protocol application operation-interface of planting the protocol type label of one or more support identifications again; As support to discern the ISO18000-6C protocol application operation-interface of more common ISO18000-6C protocol type label, support the ISO18000-6B protocol application operation-interface of the ISO18000-6B protocol type label that identification is more common etc.Under the situation of the known protocol type that is identified label of user, can in upper layer application, call with this protocol type application corresponding operation-interface and carry out information interaction, improve communication efficiency.Do not know to be identified the protocol type of label the user, or need discern simultaneously under the situation of label of different agreement type, can in upper layer application, call multi-protocols application operating interface and carry out information interaction.
Embodiment
Combine accompanying drawing that the present invention is done further explain through embodiment below.
As shown in Figure 1, be a kind of reader control system that one embodiment of the invention provides, this system comprises upper layer application 1, reader 2 and reader drive unit 3.
Wherein, reader drive unit 3 comprises application operating interface unit 31, communication unit 32, message processing unit 33 and reader administrative unit 34.Application operating interface unit 31 all controls according to the realization of calling of upper layer application 1 with reader administrative unit 34 accordingly.Communication unit 32 is used to realize the information interaction between application operating interface unit 31, message processing unit 33, reader administrative unit 34 and the reader 2.
Upper layer application 1 can be called the application operating interface unit 31 and reader administrative unit 34 in the reader drive unit 3, thereby realizes reader link control, configuration and business operation control.For example reader link control comprise open reader, close reader, the link monitoring under the link detecting, reader service end pattern etc.; Configuration operation control comprises the inquiry configurations, upgrades configurations, acquisition capability; Business operation control comprises the checking of the label of ISO18000-6C protocol type, reading and writing, operation such as locks, kills; To the checking of the label of ISO18000-6B protocol type, reading and writing, operation such as lock, kill; Mixing single to the label of various protocols type is checked, mixing cycle property inventory operation etc., can be used for realizing the secondary development to reader.
Reader 2 can carry out information interaction through primitive interface and reader drive unit 3.
Application operating interface unit 31 comprises the multi-protocols application operating interface 311 of supporting identification various protocols type label, also comprises the ISO18000-6C protocol application operation-interface 312 of supporting identification ISO18000-6C protocol type label, the ISO18000-6B protocol application operation-interface 313 of supporting identification ISO18000-6B protocol type label.Wherein, ISO18000-6C protocol application operation-interface 312 is used to realize that the label of 2 pairs of ISO18000-6C protocol types of reader discerns and business operation, comprises checking label, reading label, writing labels, lock tag, kill business operations such as label.ISO18000-6B protocol application operation-interface 313 is used to realize that the label of 2 pairs of ISO18000-6B protocol types of reader discerns and business operation, comprises checking label, reading label, writing labels, lock tag, kill business operations such as label.Multi-protocols application operating interface 311 is used for the label of various protocols type is discerned and business operation, comprises that the mixing single is checked label, mixing cycle property is checked business operations such as label.According to actual needs, application operating interface unit 31 can also comprise single protocol application operation-interface that other support identification form kind protocol type label.
Multi-protocols application operating interface of the present invention 311, ISO18000-6C protocol application operation-interface 312 and ISO18000-6B protocol application operation-interface 313 all refer to the cover to be the interface of unit; Refer to a cover multi-protocols application operating interface like multi-protocols application operating interface 311, comprise the interface that at least one supports identification various protocols type label.As shown in Figure 2:
Multi-protocols application operating interface 311 comprises and mixes that single is checked interface 311a and mixing cycle property is checked interface 311b etc., be respectively applied for to the label mixing single of various protocols type check label, mixing cycle property is checked tag operational.To realize that the mixing single is checked label is example; After mixing single and checking interface 311a and receive calling of upper layer application 1; Issuing mixing single inventory operation through communication unit 32 orders to reader 2; Receive the operating result that reader 2 returns, operating result is returned to upper layer application 1, accomplish and mix the single inventory operation.
ISO18000-6C protocol application operation-interface 312 comprises that ISO18000-6C checks interface 312a, ISO18000-6C and reads interface 312b, ISO18000-6C and write interface 312c, ISO18000-6C lock port 312d, ISO18000-6C and kill interface 312e etc., is respectively applied for the checking of the label of realizing 2 pairs of ISO18000-6C protocol types of reader, reading and writing, locks, kills operation.Carrying out inventory operation with the label to the ISO18000-6C protocol type is example; After ISO18000-6C checks calling of interface 312a reception upper layer application 1; Carry out information interaction through communication unit 32 and reader 2; After the information of checking that the reader of receiving 2 is returned encapsulates, offer upper layer application 1.
ISO18000-6B protocol application operation-interface 313 comprises that ISO18000-6B checks interface 313a, ISO18000-6B and reads interface 313b, ISO18000-6B and write interface 313c, ISO18000-6B lock port 313d, ISO18000-6B and kill interface 313E etc., is respectively applied for the checking of the label of realizing 2 pairs of ISO18000-6B protocol types of reader, reading and writing, locks, kills operation.
Message processing unit 33 is used for carrying out corresponding encoding and decoding from the information of application operating interface unit 31 and communication unit 32, comprises that coding module 331, decoder module 332, buffer area 333, queue processing module 334 and message searches module 335 etc.
At down direction, the form that coding module 331 is used for the information (like the Message form) from multi-protocols application operating interface 311, ISO18000-6C protocol application operation-interface 312, ISO18000-6B protocol application operation-interface 313 is converted to bit stream transfers to communication unit 32.
At up direction; Decoder module 332 is used for converting the Message form to from the information of communication unit 32 (like bit stream), and respective transmissions protocol application operation-interface 311, ISO18000-6C protocol application operation-interface 312 or ISO18000-6B protocol application operation-interface 313 at the most.
Up direction; Before decoder module 332 is decoded; Can use buffer area 333 to store information (like bit stream) from communication unit 2; Transfer to decoder module 332 after receiving processing according to corresponding accepting state, the accepting state of message comprises three kinds of states such as READY, FRAME_ERROR, NEED_MORE in the buffer area, respectively representative receive a complete frame message, receive wrong, need to continue to receive.After decoder module 332 is accomplished decoding; After can adopting queue processing module 334 that the information of decoder module 332 complete decodings is added into message queue, offer corresponding multi-protocols application operating interface 311, ISO18000-6C protocol application operation-interface 312 or ISO18000-6B protocol application operation-interface 313 according to the order of message queue.
Message is searched after module 335 is used for searching information specific from this message queue, offers corresponding multi-protocols application operating interface 311, ISO18000-6C protocol application operation-interface 312 or ISO18000-6B protocol application operation-interface 313.Can or search for ID number according to information type, can it be deleted from message queue after searching completion.For example; Upper layer application is sent an addROSpec (increasing the RO rule) message through multi-protocols application operating interface 311 and is given reader 2; After receiving, reader 2 returns addROSpecResponse (increasing the RO rule responds) message; At this moment message search module 335 need be from from message queue, searching this addROSpecRespons e message; If ID number of this message with addROSpec message ID number is consistent, then judge and found receiveing the response of addROSpec, extract this addROSpecResponse message to corresponding multi-protocols application operating interface 311; Return to upper layer application 1 through corresponding multi-protocols application operating interface 311, this message of deletion from message queue.
Reader administrative unit 34 is used to manage the linking status of reader 2; Comprise that reader opens module 341, reader closing module 342, link and monitor module 343 and link detecting module 344; Upper layer application 1 and reader 2 carry out when mutual, and reader is opened module 341 and is used for opening communication unit 32 through the relevant parameters object is set; Set up linking between communication unit 32 and the reader, reader closing module 342 is used to break off linking of communication unit 32 and reader 1.
The communication pattern of reader drive unit comprises serial ports pattern and network interface mode; When reader drive unit 3 is realized communicating by letter under the serial ports pattern with reader 2; Upper layer application 1 is called reader administrative unit 34, and reader opens that the relevant parameters object is set to the serial ports parameter in the module 341, and the serial ports that promptly can open communication unit 32 is set up with reader 2 and linked; After link is accomplished, can call reader closing module 342 and break off and the linking of reader 2.Network interface mode comprises reader service end pattern and reader client mode.Under reader service end pattern; After reader 2 starts; Upper layer application 1 is called reader administrative unit 34, and reader opens the IP information that relevant parameters object in the module 341 need to be set to the reader 2 of link, and the network interface that can open communication unit 32 links with these reader 2 realizations; After link was accomplished, upper layer application 1 can be called reader closing module 342 break links.Under the reader client mode, upper layer application 1 is called reader administrative unit 34, utilizes link to monitor module 343 and monitors readers 2 and wait for reader 2 link setups, after link setup is accomplished, can stop link and monitor and break off and the linking of reader 2.
Link detecting module 344 is used for detecting in real time or regularly at link process the linking status of reader 2; Thereby judge current reader 2 quantity that link with upper layer application 1; And whether each reader 2 normally link etc. with upper layer application 1, if certain reader 2 break link then can report upper layer application 1.The preferred detection mode that adopts heartbeat; It is the heartbeat message that link detection module 314 is regularly replied reader 2 in the link process; For example the eartbeat interval time is defaulted as 5s; If do not receive the heartbeat message of reader 2 in 10 seconds then think reader 2 break links, also can regularly send heartbeat messages and await a response by link detecting module 314 to reader 2.
The present invention also provides a kind of reader driving method of supporting to discern the various protocols type label; Particularly; After realizing linking through reader drive unit 3 between upper layer application 1 and the reader 2; At down direction, will convert the form of bit stream from the information (like the Message form) of multi-protocols application operating interface 311, ISO18000-6C protocol application operation-interface 312, ISO18000-6B protocol application operation-interface 313 to, transfer to reader 2; At up direction, will convert the Message form to from the operation information of the bit stream format of reader 2, and offer upper layer application 1 through corresponding interface.
As shown in Figure 3, the process for control reader realization business operation is identified as example with the label to the various protocols type:
S301: before upper layer application 1 communicates with reader 2; Comprise that also reader drive unit 3 and reader 2 set up link process; Communication pattern (serial ports pattern, network interface mode according to reader drive unit 3; Network interface mode comprises reader service end pattern and reader client mode) different, the mode of setting up link is also different:
Under the serial ports pattern, upper layer application 1 is called reader administrative unit 34, and reader opens that the relevant parameters object is set to the serial ports parameter in the module 341, and the serial ports of opening communication unit 32 is set up with reader 2 and linked.
Under the reader client mode, upper layer application 1 is called reader administrative unit 34, starts link and monitors module 343, and link is monitored module 343 and at first called window networking DLL WSAStart initialization Winsock, thereby creates a socket function; Call monitoring of socket function creation; Bind to monitor and be the communication object of socket function appointment; Call listen and wait for link; Call accept and accept link, and generate session socket; Call send () and recv () and carry out session with reader 2.In addition, after link is accomplished, can call closesocke t function and close socket, stop the monitoring to reader 2, disconnection links with reader 2.
Under reader service end pattern; Upper layer application 1 is called reader administrative unit 34; Start reader and open module 341, reader is opened module 341 and is at first called window networking DLL WSAStart initialization Winsock, thereby creates a socket function; Call session of socket function creation; Call connect after the conversation establishing success, reader is opened the IP information that relevant parameters object in the module 341 need to be set to the reader 2 of link; Call send () and recv (), carry out session through communication unit 32 and reader 2; In addition, link can be called the closesocket function through reader closing module 342 and close socket after being accomplished, and disconnection links with reader 2.
After linking successfully; Upper layer application 1 also can be called the configuration operation interface inquiry of reader drive unit 3 and upgrade the basic configuration of reader 2, comprises antenna power, antenna in-place detection, antenna condition inquiry, preceding reverse rate, type of coding, modulation system, communication type parameter, protocol type, device coding, decides parameter commonly used such as chatter frequency.After configuration such as protocol type, antenna power is accomplished, can realize the mutual of professional basic operation message with reader 2.
S302: can call different application operating interfaces to the label of different agreement type; The label that also can call 311 pairs of various protocols types of multi-protocols application operating interface carries out identifying operation; Because this embodiment discerns the label of various protocols type, upper layer application 1 is called multi-protocols application operating interface 311 and is sent business operation message.
S303: this business operation message transfers to communication unit 32 through the form that the coding module 331 in the message processing unit 33 converts bit stream to.
S304: communication unit 32 is issued reader 2 with the business operation message of bit stream format, and reader is carried out corresponding operation, through communication unit 32 return results to message processing unit 33.
S305: the decoder module 332 in the message processing unit 33 will convert the Message form from the operating result of communication unit 32 to, and respective transmissions protocol application operation-interface 311 at the most.
S306: multi-protocols application operating interface 311 operating results with the Message form return to upper layer application 1, and upper layer application 1 confirms that whether operation is successful, finishes an operating process.
Among the present invention; The user only need be through multi-protocols application operating interface provided by the invention; Can discern and operate the different agreement type label, can make different agreement type label reporting information simultaneously, the upper layer application exploitation can be developed operation to the different agreement label through unified application operating interface; Obviously can reduce cost of development, improve the reader work efficiency simultaneously.Further, except comprising multi-protocols application operating interface, can also set up the more common single single protocol application operation-interface of planting the protocol type label of one or more support identifications again in the reader drive unit.Under the situation of the known protocol type that is identified label of user, can in upper layer application, call with this protocol type application corresponding operation-interface and carry out information interaction, improve communication efficiency.Do not know to be identified the protocol type of label the user, or need discern simultaneously under the situation of label of different agreement type, can in upper layer application, call multi-protocols application operating interface and carry out information interaction.
Above content is to combine concrete embodiment to the further explain that the present invention did, and can not assert that practical implementation of the present invention is confined to these explanations.For the those of ordinary skill of technical field under the present invention, under the prerequisite that does not break away from the present invention's design, can also make some simple deduction or replace, all should be regarded as belonging to protection scope of the present invention.