Summary of the invention
The invention provides a kind of reader drive unit, reader control system and reader driving method, solve the problem that reader drive unit in prior art does not support to identify various protocols type label, or reader drive unit switches back and forth between different application operation-interface, cause application and development inconvenience, the low and high in cost of production problem of efficiency.
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, described application operating interface unit comprises the multi-protocols application operating interface supporting to identify various protocols type label, wherein, described multi-protocols application operating interface, for receiving calling of upper layer application, carries out information interaction with upper layer application; Described communication unit is for realizing the information interaction between described multi-protocols application operating interface and reader.
In an embodiment of the present invention, described application operating interface unit also comprises one or more single protocol application operation-interface supporting to identify single protocol type label.
As in an embodiment of the present invention, described single protocol application operation-interface comprises the one in ISO18000-6C protocol application operation-interface, ISO18000-6B protocol application operation-interface.
In an embodiment of the present invention, this reader drive unit also comprises message processing unit, described message processing unit comprises coding module and decoder module, wherein, described coding module is used for the format transmission extremely described communication unit information from described application operating interface unit being converted to bit stream; Described decoder module is used for converting the information from described communication unit to Message form, and respective transmissions is to described application operating interface unit.
In an embodiment of the present invention, described message processing unit also comprises buffer area, for storing the information from described communication unit, and is supplied to described decoder module.
In an embodiment of the present invention, described message processing unit also comprises queue processing module, after the information of complete for described decoder module decoding is added into message queue, is supplied to described application operating interface unit.
In an embodiment of the present invention, described message processing unit also comprises message and searches module, for search corresponding information from described message queue after, is supplied to described application operating interface unit.
In an embodiment of the present invention, this reader drive unit also comprises reader administrative unit, described reader administrative unit comprises reader and opens module and reader closing module, wherein, described reader opens module for by arranging corresponding parameter object, sets up linking between described communication unit with reader; Described reader closing module is for disconnecting linking of described communication unit and reader.
In an embodiment of the present invention, described reader administrative unit also comprises link monitoring module, for monitoring described reader under reader client mode.
In an embodiment of the present invention, described reader administrative unit also comprises link detection module, for detecting the linking status of described reader.
A kind of reader control system, comprise reader, upper layer application and the reader drive unit described in any one of claim 1 to 10, the multi-protocols application operating interface of the support identification various protocols type label in described reader drive unit, for receiving calling of upper layer application, carries out information interaction with upper layer application; Communication unit is for realizing the information interaction between described multi-protocols application operating interface and reader.
A kind of reader driving method, described method is applied to the reader drive unit described in any one of claim 1 to 10, described reader driving method comprises: calling of the multi-protocols application operating interface upper layer application of the support identification various protocols type label in described reader drive unit, and carries out information interaction between upper layer application; Described multi-protocols application operating interface is by carrying out information interaction between the communication unit in described reader drive unit and reader.
The invention has the beneficial effects as follows: the reader drive unit supporting to identify various protocols type label provided by the invention, control system and method make user need not be confined to operate a kind of protocol type label, or when different agreement type label is operated, need to switch back and forth between multiple interfaces, user only need by multi-protocols application operating interface provided by the invention, can identify different agreement type label and operate, different agreement type label reporting information simultaneously can be made, upper layer application exploitation can develop operation by unified application operating interface to different agreement label, obviously cost of development can be reduced, improve reader work efficiency simultaneously.
Further, in reader drive unit of the present invention except comprising multi-protocols application operating interface, single protocol application operation-interface of the common single protocol type label of one or more support identification can also be set up again, as the ISO18000-6C protocol application operation-interface of the ISO18000-6C protocol type label of supporting identification common, support the ISO18000-6B protocol application operation-interface etc. of the ISO18000-6B protocol type label that identification is common.When user is known be identified the protocol type of label, the application operating interface corresponding to this protocol type can be called carry out information interaction in upper layer application, improve communication efficiency.Do not know user the protocol type being identified label, or when needing the label simultaneously identifying different agreement type, multi-protocols application operating interface can be called carry out information interaction in upper layer application.
Embodiment
By reference to the accompanying drawings the present invention is described in further detail below by embodiment.
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 and reader administrative unit 34 all operate control accordingly according to the realization of calling of upper layer application 1.Communication unit 32 is for realizing application operating interface unit 31, message processing unit 33, information interaction between reader administrative unit 34 and reader 2.
Upper layer application 1 can call application operating interface unit 31 in reader drive unit 3 and reader administrative unit 34, thus realize that reader link controls, configuration and business operation control.Such as reader link control to comprise open reader, close reader, link detecting, link monitoring etc. under reader service end pattern; Configuration operation controls to comprise inquiry configurations, upgrade configurations, acquisition capability; Business operation controls to comprise to the checking of the label of ISO18000-6C protocol type, reading and writing, lock, the operation such as to kill, to the checking of the label of ISO18000-6B protocol type, reading and writing, lock, the operation such as to kill, the mixing single of the label of various protocols type is checked, mixing cycle inventory operation etc., can be used for realizing the secondary development to reader.
Reader 2 can carry out information interaction by primitive interface and reader drive unit 3.
Application operating interface unit 31 comprises the multi-protocols application operating interface 311 supporting to identify various protocols type label, also comprises the ISO18000-6C protocol application operation-interface 312 supporting to identify ISO18000-6C protocol type label, the ISO18000-6B protocol application operation-interface 313 supporting to identify ISO18000-6B protocol type label.Wherein, ISO18000-6C protocol application operation-interface 312 identifies and business operation for the label realizing reader 2 pairs of ISO18000-6C protocol types, comprises checking label, reading label, writing labels, lock tag, kill the business operations such as label.ISO18000-6B protocol application operation-interface 313 identifies and business operation for the label realizing reader 2 pairs of ISO18000-6B protocol types, comprises checking label, reading label, writing labels, lock tag, kill the business operations such as label.Multi-protocols application operating interface 311 is for identifying and business operation the label of various protocols type, and single checks label, mixing cycle checks the business operations such as label to comprise mixing.According to actual needs, application operating interface unit 31 can also comprise single protocol application operation-interface that other support to identify single protocol type label.
Multi-protocols application operating interface 311 of the present invention, ISO18000-6C protocol application operation-interface 312 and ISO18000-6B protocol application operation-interface 313 all refer to the interface in units of overlapping, as multi-protocols application operating interface 311 refers to a set of multi-protocols application operating interface, comprise the interface that at least one supports to identify various protocols type label.As shown in Figure 2:
Multi-protocols application operating interface 311 comprises mixing single and checks interface 311a and mixing cycle checks interface 311b etc., is respectively used to carry out the label of various protocols type that mixing single checks label, mixing cycle checks tag operational.Label is checked to realize mixing single, mixing single is checked after interface 311a receives calling of upper layer application 1, the order of mixing single inventory operation is issued to reader 2 by communication unit 32, receive the operating result that reader 2 returns, operating result is returned to upper layer application 1, complete mixing single inventory operation.
ISO18000-6C protocol application operation-interface 312 comprises ISO18000-6C and checks interface 312a, ISO18000-6C and read interface 312b, ISO18000-6C and write interface 312c, ISO18000-6C lock port 312d, ISO18000-6C and kill interface 312e etc., is respectively used to the checking of the label realizing reader 2 pairs of ISO18000-6C protocol types, reading and writing, locks, kills operation.To carry out inventory operation to the label of ISO18000-6C protocol type, after ISO18000-6C checks calling of interface 312a reception upper layer application 1, information interaction is carried out by communication unit 32 and reader 2, after the information of checking returned the reader 2 received encapsulates, be supplied to upper layer application 1.
ISO18000-6B protocol application operation-interface 313 comprises ISO18000-6B and checks interface 313a, ISO18000-6B and read interface 313b, ISO18000-6B and write interface 313c, ISO18000-6B lock port 313d, ISO18000-6B and kill interface 313E etc., is respectively used to the checking of the label realizing reader 2 pairs of ISO18000-6B protocol types, reading and writing, locks, kills operation.
Message processing unit 33, for carrying out corresponding encoding and decoding to the information from application operating interface unit 31 and communication unit 32, comprises coding module 331, decoder module 332, buffer area 333, queue processing module 334 and message and searches module 335 etc.
At down direction, coding module 331 is for converting the format transmission of bit stream to communication unit 32 by the information (as Message form) from multi-protocols application operating interface 311, ISO18000-6C protocol application operation-interface 312, ISO18000-6B protocol application operation-interface 313.
At up direction, decoder module 332 is for converting the information (as bit stream) from communication unit 32 to Message form, 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 store from communication unit 2 information (as bit stream), decoder module 332 is transferred to after carrying out reception process according to corresponding accepting state, in buffer area, the accepting state of message comprises three kinds of states such as READY, FRAME_ERROR, NEED_MORE, and representative receives a complete frame message, receives mistake, need continue to receive respectively.After decoder module 332 completes decoding, after can adopting queue processing module 334 that the information of complete for decoder module 332 decoding is added into message queue, be supplied to 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 searches module 335 for after search specific information from this message queue, is supplied to corresponding multi-protocols application operating interface 311, ISO18000-6C protocol application operation-interface 312 or ISO18000-6B protocol application operation-interface 313.Can search according to information type or No. ID, it can be deleted from message queue after having searched.Such as, upper layer application sends an addROSpec (increasing RO rule) message to reader 2 by multi-protocols application operating interface 311, reader 2 returns addROSpecResponse (increasing RO rule to respond) message after receiving, at this moment message searches module 335 needs from searching this addROSpecRespons e message from message queue, if this message No. ID consistent with No. ID of addROSpec message, then judge to have found receiveing the response of addROSpec, extract this addROSpecResponse message to corresponding multi-protocols application operating interface 311, upper layer application 1 is returned to by corresponding multi-protocols application operating interface 311, this message is deleted from message queue.
Reader administrative unit 34 is for managing the linking status of reader 2, comprise reader and open module 341, reader closing module 342, link monitoring module 343 and link detection module 344, when upper layer application 1 and reader 2 carry out mutual, reader opens module 341 for by arranging corresponding parameter object, open communication unit 32, set up linking between communication unit 32 with reader, reader closing module 342 is for disconnecting 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 and reader 2 realize communicating under serial ports pattern, upper layer application 1 calls reader administrative unit 34, reader is opened corresponding parameter object in module 341 and be set to serial ports parameter, namely serial ports and the reader 2 that can open communication unit 32 establish the link, after having linked, reader closing module 342 can be called and disconnect 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 calls reader administrative unit 34, and reader is opened the IP information that corresponding parameter object in module 341 is set to the reader 2 needing link, the network interface can opening communication unit 32 realizes linking with this reader 2, after having linked, upper layer application 1 can call reader closing module 342 break link.Under reader client mode, upper layer application 1 calls reader administrative unit 34, utilizes link to monitor module 343 and monitors reader 2 and wait for reader 2 link setup, after link setup completes, link can be stopped to monitor and disconnect and the linking of reader 2.
Link detection module 344 is for linking status that is real-time in link process or periodic detection reader 2, thus judge current reader 2 quantity linked with upper layer application 1, and whether each reader 2 normally links with upper layer application 1, if certain reader 2 break link, can report upper layer application 1.The detection mode of preferred employing heartbeat, namely link process link detection module 314 regularly replys the heartbeat message of reader 2, the such as eartbeat interval time is defaulted as 5s, if do not receive the heartbeat message of reader 2 in 10 seconds, think and also can regularly send reader 2 break link heartbeat message to reader 2 by link detection module 314 and await a response.
The present invention also provides a kind of reader driving method supporting to identify various protocols type label, particularly, after realizing linking by reader drive unit 3 between upper layer application 1 with reader 2, at down direction, information (as 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 the form of bit stream, transfer to reader 2; At up direction, convert the operation information of the bit stream format from reader 2 to Message form, and be supplied to upper layer application 1 by corresponding interface.
As shown in Figure 3, the process of business operation is realized for controlling reader, to be identified as example to the label of various protocols type:
S301: before upper layer application 1 communicates with reader 2, also comprise reader drive unit 3 and establish the link process with reader 2, according to communication pattern (serial ports pattern, the network interface mode of reader drive unit 3, network interface mode comprises reader service end pattern and reader client mode) different, the mode established the link is also different:
Under serial ports pattern, upper layer application 1 calls reader administrative unit 34, and reader is opened corresponding parameter object in module 341 and be set to serial ports parameter, serial ports and the reader 2 of opening communication unit 32 establish the link.
Under reader client mode, upper layer application 1 calls reader administrative unit 34, and start link and monitor module 343, link is monitored module 343 and first called window networking DLL (dynamic link library) WSAStart initialization Winsock, thus creates a socket function; Call socket function creation one monitoring; The communication object that binding monitoring is specified for socket function; Call listen etc. to be linked; Call accept and accept link, and generate session socket; Call send () and recv () to conversate with reader 2.In addition, after link completes, 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 calls reader administrative unit 34, start reader and open module 341, reader is opened module 341 and is first called window networking DLL (dynamic link library) WSAStart initialization Winsock, thus creates a socket function; Call the session of socket function creation; Call connect after conversation establishing success, reader is opened the IP information that corresponding parameter object in module 341 is set to the reader 2 needing link; Call send () and recv (), conversated by communication unit 32 and reader 2; In addition, after having linked, can call closesocket function by reader closing module 342 and close socket, disconnection links with reader 2.
Link successfully, upper layer application 1 also can be called the configuration operation interface polls of reader drive unit 3 and upgrade the basic configuration of reader 2, comprises antenna power, antenna detection in place, antenna condition inquiry, front reverse rate, type of coding, modulation system, communication type parameter, protocol type, device coding, determines the Common Parameters such as chatter frequency.After protocol type, antenna power etc. have configured, the mutual of business basic operation message can be realized with reader 2.
S302: different application operating interfaces can be called for the label of different agreement type, the label that also can call multi-protocols application operating interface 311 pairs of various protocols types carries out identifying operation, because this embodiment identifies 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: the coding module 331 of this business operation message in message processing unit 33 converts the format transmission of bit stream to communication unit 32.
S304: the business operation message of bit stream format is issued reader 2 by communication unit 32, reader performs corresponding operation, returns operating result to message processing unit 33 by communication unit 32.
S305: the decoder module 332 in message processing unit 33 converts the operating result from communication unit 32 to Message form, and respective transmissions protocol application operation-interface 311 at the most.
S306: the operating result of Message form is returned to upper layer application 1 by multi-protocols application operating interface 311, whether upper layer application 1 determination operation is successful, terminates an operating process.
In the present invention, user only need by multi-protocols application operating interface provided by the invention, can identify different agreement type label and operate, different agreement type label reporting information simultaneously can be made, upper layer application exploitation can develop operation by unified application operating interface to different agreement label, obviously can reduce cost of development, improve reader work efficiency simultaneously.Further, in reader drive unit except comprising multi-protocols application operating interface, single protocol application operation-interface of the common single protocol type label of one or more support identification can also be set up again.When user is known be identified the protocol type of label, the application operating interface corresponding to this protocol type can be called carry out information interaction in upper layer application, improve communication efficiency.Do not know user the protocol type being identified label, or when needing the label simultaneously identifying different agreement type, multi-protocols application operating interface can be called carry out information interaction in upper layer application.
Above content is in conjunction with concrete embodiment further description made for the present invention, can not assert that specific embodiment of the invention is confined to these explanations.For general technical staff of the technical field of the invention, without departing from the inventive concept of the premise, some simple deduction or replace can also be made, all should be considered as belonging to protection scope of the present invention.