Summary of the invention
Fundamental purpose of the present invention is to provide a kind of communicator and method of radio frequency identification equipment interface layer, to address the above problem at least.
According to a further aspect in the invention, a kind of communicator of radio frequency identification equipment interface layer is provided, has comprised:
Connect and safeguard the pond; Be used to store the information of all connections to be set up and each said connection; And read the information of each said connection to be set up successively, if the pattern of the said connection of reading is a Passive Mode, then trigger the connection receiver; If the pattern of the said connection of reading is an aggressive mode, then the trigger equipment connector; Said equipment connector; Be used for initiating connection request to RFID equipment according to the information of the said connection of reading; After detecting the response message that said RFID equipment returns; Set up said connection request and ask the connection of setting up, seize the resource of message handling device, with the data processing event registration of the said connection of setting up to said message handling device; Said connection receiver; Be used to monitor the connection request incident, after receiving the connection request incident, set up the connection that said connection request incident is asked; Seize the resource of said message handling device, with the data processing event registration of this connection of setting up to said message handling device; Said message handling device is used to monitor the data processing incident that is registered to wherein, and after listening to said data processing incident, the processing said data processing events.
Further, said equipment connector comprises: connect the initiated event audiomonitor, be used to detect the response message of said connection request, and after detecting said response message, trigger connection initiated event treatment pond; Said connection initiated event treatment pond is used to accomplish said connection request and asks the establishment of connection operation of setting up, and seizes the resource of said message handling device, with the data processing event registration of the said connection of setting up to said message handling device.
Further, said connection initiated event treatment pond also is used for after accomplishing establishment of connection that said connection request ask to set up and operating, and upgrades said connection and safeguards that the said connection request of storing in the pond asks the information of the connection of foundation.
Further, said connection receiver comprises: connect the reception event sniffer, be used for the information according to the said connection of reading; Monitor predetermined port; Detect the connection request incident from said port, and when listening to the connection request incident, trigger to connect receiving treatment pond; Said connection receives treatment pond, is used to handle said connection request incident, sets up the connection that said connection request incident is asked, and seizes the resource of said message handling device, with the data processing event registration of this connection of setting up to said message handling device.
Further, said connection receives treatment pond and also is used for after setting up the connection that said connection request incident asked, and upgrades said connection and safeguards that the said connection request of storing in the pond asks the information of the connection of foundation.
Further, said message handling device is used for said data processing incident is divided into a plurality of child-operations, carries out each said child-operation respectively in order.
Further, said message handling device comprises: the data processing event sniffer, be used to monitor the data processing incident that is registered to said message handling device, and when listening to said data processing incident, trigger messages is handled scheduler module; Said Message Processing scheduler module is used for dispatching a thread of preset a plurality of threads, processing said data processing events.
According to an aspect of the present invention; A kind of communication means of radio frequency identification equipment interface layer is provided, has comprised: step 1, read the information that a connection to be set up of storing in the pond is safeguarded in connection; If the pattern of said connection is an aggressive mode; Then execution in step 2, if the pattern of said connection is a Passive Mode, and execution in step 3; Step 2; Equipment connector is initiated the connection request to RFID equipment according to the information of said connection; After detecting the response message that said RFID equipment returns, set up said connection, seize the resource of message handling device then; The data processing event registration of the said connection of setting up is arrived said message handling device, execution in step 4; Step 3; Connect the information of receiver according to said connection; Monitor predetermined port, after receiving the connection request incident, set up the connection that said connection request incident is asked; Seize the resource of said message handling device, with the data processing event registration of this connection of setting up to said message handling device; Step 4, said message handling device is monitored and is registered to data processing incident wherein, and after listening to said data processing incident, the processing said data processing events.
Further, said equipment connector is after setting up said connection, and said method also comprises: said equipment connector upgrades the information that the connection that the said connection request of storing in the pond asks to set up is safeguarded in said connection.
Further, said connection receiver is set up after the connection that said connection request incident asked, and said method also comprises: said connection receiver upgrades the information that the connection that the said connection request of storing in the pond asks to set up is safeguarded in said connection.
Further, the said data processing incident of said message processor processes comprises: said message handling device is divided into a plurality of child-operations with said data processing incident, and a thread that calls in preset a plurality of threads is carried out each said child-operation in order respectively.
Further, a plurality of said child-operations comprise: read, resolve, encapsulate and distribute.
Through the present invention; In the RFID application server through equipment connector be connected receiver and initiate connection request respectively and receive connection request; RFID equipment can only be as client or service end in the prior art thereby solved; And can not be simultaneously as the problem of client and service end, and then optimized the network service performance, can satisfy the demand of different scenes.
Embodiment
Hereinafter will and combine embodiment to specify the present invention with reference to accompanying drawing.Need to prove that under the situation of not conflicting, embodiment and the characteristic among the embodiment among the application can make up each other.
According to the embodiment of the invention a kind of communicator of RFID device interface layer is provided, this device is positioned at RFID application server side, and Fig. 1 is the structural representation according to the communicator of the RFID device interface layer of the embodiment of the invention; As shown in Figure 1; This device mainly comprises: connect and safeguard pond 11, be used to store the information of all connections to be set up and each connection, and read the information of each connection to be set up successively; If the pattern of the connection of reading is a Passive Mode; Then trigger connection receiver 13, if the pattern of the connection of reading is an aggressive mode, then the trigger equipment connector 12; Equipment connector 12; Be used for initiating connection request to RFID equipment according to the information of the connection of reading; After detecting the response message that RFID equipment returns; Connect request institute ask the connection of setting up, and seizes the resource of message handling device 14, and the data processing event registration of the connection of foundation is arrived message handling device 14; Said connection receiver 13; Be used to monitor the connection request incident, after receiving the connection request incident, the connection that the request event that connects is asked; Seize the resource of message handling device 14, with the data processing event registration of this connection of setting up to message handling device 14; Message handling device 14 is used to monitor the data processing incident that is registered to wherein, and after listening to the data processing incident, the deal with data processing events.
The said apparatus that provides through the embodiment of the invention; Through equipment connector 12 being set and being connected receiver 13 in RFID application server side; Can initiate connection request respectively and receive connection request, thereby can realize the function of RFID equipment while as client and service end.And; It is tactful that said apparatus supports the connection of RFID equipment mixings link setup pattern to set up, and safeguards that through unified connection the pond manages, and use unified message handling device that connection is handled; The equipment that has guaranteed on the one hand different communication modes can both be set up with application and be connected; Make the connection of different mode can carry out unified maintenance and processing on the other hand, reduced the development difficulty of system maintenance different mode connection and the complexity of system, and effectively improved the performance of system.
Generally speaking, connect and to safeguard that various differences of storage in the pond 11 wait to set up the information of connection and each connection of connected mode, in the embodiment of the embodiment of the invention; The information of each connection can be with device number and link No. as the unique identification information that is connected, and certainly, connects and safeguards in the pond 11 and can also store other information; For example; Can also preserve the socket handle (being used for sign connects) in the corresponding connection, and the information of corresponding RF ID equipment (for example, reader).
Preferred implementation in the embodiment of the invention; As shown in Figure 2; Equipment connector 12 can comprise and connect initiated event audiomonitor 122 and be connected initiated event treatment pond 124, wherein, connect the response message that initiated event audiomonitor 122 is used to detect connection request; And after detecting response message, trigger connection initiated event treatment pond 124; Connect initiated event treatment pond 124, be used to accomplish connection request and ask the establishment of connection operation of setting up, and seize the resource of message handling device 14, the data processing event registration of the connection of foundation is arrived message handling device 14.
In practical application; After equipment connector 12 initiates to connect; Connect initiated event audiomonitor 122 and be responsible for monitoring the connection initiated event; Etc. to be connected be created as merit after, connect initiated event audiomonitor 122 in a single day to detect connection event, just give the thread process in the connection initiated event treatment pond 124 with connection event.
In a preferred implementation of the embodiment of the invention; Connect initiated event treatment pond 124 and can also be used for after accomplishing the establishment of connection operation that connection request ask to set up, upgrade to connect and safeguard that the connection request of storing in the pond 11 asks the information of the connection of foundation.Be about to connect and to safeguard that the state of this connection of storage is updated in the pond 11 and connect, and, can also the relevant information that should connect (for example, the IP address of RFID equipment etc.) be stored in to connect and safeguard in the pond 11.
In another preferred embodiment of the embodiment of the invention, as shown in Figure 2, connect receiver 13 and can comprise that connection receives event sniffer 132 and is connected reception treatment pond 134.Wherein, connect the information that event sniffer 132 is used for safeguarding according to connection the connection that read in pond 11 that receives, monitor predetermined port, detect the connection request incident, and when listening to the connection request incident, trigger to connect receiving treatment pond 134 from port; Connect to receive treatment pond 134 and be used to handle the connection request incident, the resource of message handling device 14 is seized in the connection that the request event that connects is asked, with the data processing event registration of this connection of setting up to message handling device 14.In order to reach better effect, connection receives treatment pond 134 and also is used for after the connection that the request event that connects is asked, and upgrades to connect the information that the connection request of safeguarding storage in the pond 11 is asked the connection of foundation.Wherein, connect the identification informations such as port numbers that can comprise the port that needs are monitored in the information of safeguarding the connection that read in pond 11.
Invent effect preferably in order to reach, as shown in Figure 2, message handling device 14 can comprise data processing event sniffer 142 and Message Processing scheduler module 144.Wherein, data processing event sniffer 142 is used to monitor the data processing incident that is registered to message handling device 14, and when listening to the data processing incident, trigger messages is handled scheduler module 144; Message Processing scheduler module 144 is used for dispatching a thread of preset a plurality of threads, processing said data processing events.
The said apparatus that provides through the embodiment of the invention; Through equipment connector be connected receiver and seize the scheduling strategy of message processor processes time; Avoided under the concurrent situation of height, because the high loaded process of message handling device, and can't respond the event registration request that newly connects; Simultaneously, because therefore the request number of event action, to seizing of message handling device, can't cause very big influence to message processing performance far below the request number of Message Processing incident, improved the transfer velocity of connection processing simultaneously.
In a preferred implementation of the embodiment of the invention; Message handling device 14 can be divided into a plurality of child-operations with the data processing incident; And then carry out each said child-operation respectively in order, for example, data processing event sniffer 142 is responsible for monitoring the Message Processing incident on connecting; After detecting the Message Processing incident; Just the Message Processing incident is transferred to the Message Processing scheduler module and handle 144, the byte streams that Message Processing scheduler module 144 is responsible for that network is connected read, parsing, encapsulation operation, and result is distributed to higher level's application processes the most at last.Through this embodiment; The different disposal step of the message in many connections is carried out simultaneously, thereby made full use of the performance of processor multinuclear, accelerate the treatment scheme of message; Improve the handling capacity of Message Processing effectively, significantly promoted the handling property of network communication layer.
Fig. 3 is the process flow diagram according to the communication means of the RFID device interface layer of the embodiment of the invention, and is as shown in Figure 3, and the communication means of the RFID device interface layer in the embodiment of the invention comprises:
Step S302 reads and connects the information safeguard a connection to be set up of storing in the pond, if the pattern that connects is an aggressive mode, and execution in step S304 then, if the pattern that connects is a Passive Mode, execution in step S306;
For example, can be according to whether having specified the IP address that connects to judge that with port numbers this pattern that is connected is active module or passive module in the information of the connection of reading.Wherein, connect and to safeguard that the link information in the pond can be added by upper layer application.
In the embodiment in embodiments of the present invention, when connect pattern when being aggressive mode, can to carry out initialization to connecting parameter earlier, initiate again to connect, and simultaneously this connection be registered in the connection initiated event audiomonitor of equipment connector.
Step S304; Equipment connector is initiated the connection request to RFID equipment according to the information of this connection; After detecting the response message that RFID equipment returns, connect, seize the resource of message handling device then; The data processing event registration of the connection of setting up is arrived message handling device, execution in step S308;
Safeguard the link information real-time update of storing in the pond in order to make to connect, in the present embodiment, equipment connector can upgrade to connect and safeguard that the connection request of storing in the pond asks the information of the connection of foundation after connecting.
Wherein, Can be provided with one in the equipment connector connects the initiated event audiomonitor and is connected the initiated event treatment pond; Connect the initiated event audiomonitor after detecting the connection initiated event; Give the connection initiated event treatment pond of being responsible for accomplishing attended operation with this incident, after connection initiated event treatment pond is accomplished this establishment of connection, attempt the processing time of seizing message handling device.After the processing time that gets access to message handling device, connect data processing event registration that the initiated event treatment pond will connect simultaneously in the data processing event sniffer of message handling device, again execution in step S308.
Step S306 connects receiver according to the information that connects, and monitors predetermined port; After receiving the connection request incident; The resource of message handling device is seized in the connection that the request event that connects is asked, with the data processing event registration of this connection of setting up to message handling device;
For example; Can receive event sniffer monitoring connection request incident by the connection that connects in the receiver; After listening to the connection request incident, give the connection reception event handling pond of being responsible for receiving connection processing with this incident, connect reception event handling pond after accomplishing the operation that receives connection; Corresponding link information in the updating maintenance pond simultaneously, and attempt processing time of seizing message handling device.After the processing time that gets access to message handling device, the data processing event registration that connection reception event handling pond will connect is in the data processing event sniffer of message handling device.
Equally, safeguard the link information real-time update of storing in the pond, after the connection that the request event that connects is asked, to connect receiver and also upgrade simultaneously to connect and safeguard that the connection request of storing in the pond asks the information of the connection of foundation in order to make to connect.
Step S308, message handling device is monitored and is registered to data processing incident wherein, and after listening to the data processing incident, the deal with data processing events.
In embodiment of the invention embodiment, message processor processes data processing incident can be divided into the data processing incident mode of a plurality of child-operations, and preferably, preset Thread Count is identical with suboperand.For example; A thread that calls in preset a plurality of threads is carried out each said child-operation in order respectively, and wherein, a plurality of child-operations comprise: carry out simultaneously thereby read, resolve, encapsulate and distribute the different disposal step that can make many message that are connected; Make full use of the performance of modern processors multinuclear; Accelerate the treatment scheme of message, improved the handling capacity of Message Processing effectively, significantly promoted the handling property of network communication layer.And the mode of a plurality of child-operations can adopt the data that needs are handled to carry out the level Four streamline to handle; The data processing incident of this connection that at first will be received by the data processing event sniffer is handed to the Message Processing scheduler module; Distributing to preset a plurality of threads by the Message Processing scheduler module again handles in order; For example, message handling device can may further comprise the steps the processing of one of them data processing incident:
Step 1, the first order that gets into the level Four streamline is handled: read network bytes stream, and will read the result and deposit in the buffer memory;
Step 2, handle the second level that gets into the level Four streamline: the byte stream with in the buffer memory resolves to Frame;
Step 3, the third level that gets into the level Four streamline is handled: the Frame with parsing is packaged into message object;
Step 4, the fourth stage that gets into the level Four streamline is handled: with packaged message, be distributed to the application on upper strata, for being used as further processing.
Fig. 4 is according to the schematic flow sheet that connects of the mixed mode in the preferred embodiment of the present invention, and in conjunction with Fig. 2, in embodiments of the present invention, for the RFID equipment of the mixing link setup pattern that the present invention supported, it connects method for building up and mainly may further comprise the steps:
Step 401: after the system start-up, flow process begins;
Step 402: obtain to connect and safeguard the link information to be set up in the pond, wherein, all wait that the relevant information of setting up connection can be responsible for interpolation by upper layer application;
Step 403: judge whether specified the IP address and the port numbers that connect in the link information that gets access to,, be regarded as being dynamically connected, enter into step 404,, be regarded as initiatively connecting, enter into step 408 if specify if do not specify;
Step 404: connect the connection that receiver is created Passive Mode;
Step 405: registration connects the reception incident to connecting event sniffer, the request of connecting of waiting facilities of receiving;
Step 406: listen to after the connection reception incident, connect the operation that receives the completion connection foundation of event handling pond;
Step 407: according to the situation of reality connection, and upgrade after the link information in the connection pool, enter into step 411;
Step 408: equipment connector is created the connection of aggressive mode;
Step 409: initiate connection request, and registration connects initiated event to connecting the initiated event audiomonitor, the link setup response of waiting facilities to equipment;
Step 410: obtain after the response of equipment, connect the initiated event treatment pond and accomplish establishment of connection;
Step 411: seize the processing events of message event processor, make it discharge resource;
Step 412: with the Message Processing event registration to the message event processor;
Step 413: the resource of release message event handler, it is returned to the message event processor;
Step 414: judge the running status of system,, turn back to step 402, otherwise enter into step 415 if system continues operation;
Step 415: stop to handle, flow process finishes.
Fig. 5 is the message handling device preemptive policy synoptic diagram according to the embodiment of the invention; As shown in Figure 5; Set up successful equipment connector or connect receiver for connecting, message handling device is handled according to following flow chart of data processing its connection initiated event that reports or connection reception incident:
Step 501: after the system start-up, flow process begins;
Step 502: obtain the deal with data resource requirement;
Step 503: monitor the Message Processing incident that connects, after the reporting message to be connected, the Message Processing incident that listens to is met at the Message Processing pond handle;
Step 504: Message Processing pond processing messages;
Step 505: detect whether equipment connector to be arranged or connect receiver and seize the resource that it occupies, seize request if exist, then execution in step 506, if there is not the request of seizing, then execution in step 507;
Step 506: discharge the resource of being occupied, suspend and handle;
Step 507: judge the running status of system,, turn back to step 502, otherwise enter into step 508 if system continues operation;
Step 508: stop to handle, flow process finishes.
Fig. 6 is the structural representation of Message Processing level Four streamline according to the preferred embodiment of the invention; As shown in Figure 6; The structure of the Message Processing level Four streamline that the Message Processing scheduler module in the message handling device of the embodiment of the invention adopts is handled the Message Processing incident that is reported to message handling device, specifically comprises:
The process of the processing of message is split as FOUR EASY STEPS, is respectively: read, resolve, encapsulate and distribute, wherein, read operation is responsible for the byte stream that fetch equipment sends, and with its buffer memory; Parse operation is responsible for scanning the data in the buffer memory, searches frame head, postamble, resolves a frame; Encapsulation operation is responsible for frame data are packaged into required object of upper layer application or structure; Distribution operation is responsible for that packaged object or structure are consigned to upper layer application and is handled.
In the embodiment of the embodiment of the invention, need whole message processing procedure be divided into four steps and handle, though for single message parse; Its processing speed is slower than direct processing, but under the situation concurrent at the message height, that data volume is big, the processing of pipeline system just demonstrates its advantage; For example, in the processing time of average a piece of news, be about 1/4 of original message process mode; Can increase the handling capacity of system effectively, improve the network performance of system.
From above description, can find out that the present invention has realized following technique effect:
Safeguard the mode that the pond is managed through supporting RFID equipment to mix the pattern and the unified connection that connect; The method of using unified message handling device that connection is handled simultaneously; Adopt the communicator of radio frequency identification equipment interface layer; The equipment that has guaranteed on the one hand different communication modes can both be set up with application and be connected; Make the connection of different mode can carry out unified maintenance and processing on the other hand, thereby reduced the development difficulty of system maintenance different mode connection and the complexity of system, and effectively improved the performance of system.And, in embodiments of the present invention, by equipment connector be connected receiver and seize the message processor processes time, thereby avoided under the concurrent situation of height because the high loaded process of message handling device, and can't respond the event registration request that newly connects; Simultaneously, because therefore the request number of event action, to seizing of message handling device, can't cause very big influence to message processing performance far below the request number of Message Processing incident, improved the transfer velocity of connection processing simultaneously.In addition, in the embodiment of the invention, when the data processing events is handled; The treatment scheme of data processing incident (being message) is split a plurality of substeps, and introduce the tupe of multi-stage pipeline, the different disposal step of the message in many connections is carried out simultaneously; Make full use of the performance of modern processors multinuclear; Accelerate the treatment scheme of message, improved the handling capacity of Message Processing effectively, significantly promoted the handling property of network communication layer.
Obviously, it is apparent to those skilled in the art that above-mentioned each module of the present invention or each step can realize with the general calculation device; They can concentrate on the single calculation element; Perhaps be distributed on the network that a plurality of calculation element forms, alternatively, they can be realized with the executable program code of calculation element; Thereby; Can they be stored in the memory storage and carry out, and in some cases, can carry out step shown or that describe with the order that is different from here by calculation element; Perhaps they are made into each integrated circuit modules respectively, perhaps a plurality of modules in them or step are made into the single integrated circuit module and realize.Like this, the present invention is not restricted to any specific hardware and software combination.
The above is merely the preferred embodiments of the present invention, is not limited to the present invention, and for a person skilled in the art, the present invention can have various changes and variation.All within spirit of the present invention and principle, any modification of being done, be equal to replacement, improvement etc., all should be included within protection scope of the present invention.