Summary of the invention
The invention provides a kind of method, Apparatus and system that configures reader serial communication attribute, thereby when server is not known reader communication attribute in advance, server still can be configured to the serial ports attribute information of reader.
The invention provides scheme as follows:
The embodiment of the present invention provides a kind of method that configures reader serial communication attribute, comprising:
Reader receives the first message, and described the first message is sent by server;
Reader judges the type of described the first message, obtains the first judged result;
If the type of the first message is for obtaining serial ports attribute message described in described the first judgment result displays, reader feeds back to described server by current self serial ports attribute information; If the type of the first message is for serial ports attribute message is set described in described the first judgment result displays, the serial ports attribute information that reader comprises based on described the first message, upgrades self serial ports attribute information.
Preferably, described reader feeds back to described server by current self serial ports attribute information and comprises:
Described reader is added into current self serial ports attribute information in the response message of described the first message;
Described reader is sent to described server by the response message that includes current self serial ports attribute information.
Preferably, after described reader feeds back to described server by current self serial ports attribute information, described method also comprises:
The second message serial ports attribute information that comprise of reader based on receiving, upgrades self serial ports attribute information, and the serial ports attribute information that described the second message comprises, is that the serial ports attribute information of server based on reader feedback generates and sends to reader.
Preferably, the serial ports attribute information that described reader comprises based on described the first message, the serial ports attribute information that upgrades self comprises:
Reader judges that whether the serial ports attribute information that described the first message comprises meets preset requirement, obtains the second judged result;
If the serial ports attribute information that described in described the second judgment result displays, the first message comprises does not meet preset requirement, reader is abandoned described the first message; If the serial ports attribute information that described in described the second judgment result displays, the first message comprises meets preset requirement, the serial ports attribute information that reader comprises based on described the first message, upgrades self serial ports attribute information.
The embodiment of the present invention also provides a kind of method that configures reader serial communication attribute, comprising:
Server sends the first message to reader, the type of described the first message comprises to be obtained serial ports attribute message or serial ports attribute message is set, described serial ports attribute message, be used for making reader that current self serial ports attribute information is fed back to described server, the described serial ports attribute message that arranges, for the serial ports attribute information that reader is comprised based on described the first message, upgrade the serial ports attribute information of self.
Preferably, described server sends the first message to reader and comprises:
Server is broadcasted described the first message to all readers in subnet.
Preferably, described method also comprises:
Server receives current self the serial ports attribute information of the reader of reader feedback;
Server is modified to current self the serial ports attribute information of described reader;
Server is sent to reader by amended serial ports attribute information.
The embodiment of the present invention also provides a kind of device that configures reader serial communication attribute, comprising:
Receiver module, for receiving the first message, described the first message is sent by server;
Judge module, for judging the type of described the first message, obtains the first judged result;
Processing module, if for the type of the first message described in described the first judgment result displays for obtaining serial ports attribute message, current reader serial ports attribute information is fed back to described server; If the type of the first message is for serial ports attribute message is set described in described the first judgment result displays, the serial ports attribute information comprising based on described the first message, the serial ports attribute information of renewal reader.
Preferably, described processing module comprises:
Adding device, for being added into current reader serial ports attribute information the response message of described the first message;
Transmitting element, for being sent to described server by the response message that includes current self the serial ports attribute information of reader.
Preferably, the serial ports attribute information that described processing module also comprises for receive the second message based on receiver module, upgrade the serial ports attribute information of self, the serial ports attribute information that described the second message comprises is that the serial ports attribute information of server based on reader feedback generates and sends to reader.
Preferably, described processing module comprises:
Judging unit, for judging that whether the serial ports attribute information that described the first message comprises meets preset requirement, obtains the second judged result;
Processing unit, if the serial ports attribute information comprising for the first message described in described the second judgment result displays does not meet preset requirement, abandons described the first message; If the serial ports attribute information that described in described the second judgment result displays, the first message comprises meets preset requirement, the serial ports attribute information comprising based on described the first message, the serial ports attribute information of renewal reader.
The embodiment of the present invention also provides a kind of device that configures reader serial communication attribute, comprising:
Sending module, for sending the first message to reader, the type of described the first message comprises to be obtained serial ports attribute message or serial ports attribute message is set, described serial ports attribute message, be used for making reader that current self serial ports attribute information is fed back to described server, the described serial ports attribute message that arranges, for the serial ports attribute information that reader is comprised based on described the first message, upgrades the serial ports attribute information of self.
Preferably, described device also comprises:
Receiver module, for receiving current self the serial ports attribute information of the reader of reader feedback;
Modified module, for modifying to current self the serial ports attribute information of described reader;
Described sending module, also for being sent to reader by amended serial ports attribute information.
The embodiment of the present invention also provides a kind of system that configures reader serial communication attribute, comprises server and reader; Wherein:
Described server, for send the first message to reader, the type of described the first message comprises to be obtained serial ports attribute message or serial ports attribute message is set;
Described reader, the first message sending for receiving described server, and judge the type of described the first message, if the type of the first message is for obtaining serial ports attribute message described in described the first judgment result displays, reader feeds back to described server by current self serial ports attribute information; If the type of the first message is for serial ports attribute message is set described in described the first judgment result displays, the serial ports attribute information that reader comprises based on described the first message, upgrades self serial ports attribute information.
From the above, can find out, method, the Apparatus and system of configuration reader serial communication attribute provided by the invention, receive the first message by reader, and described the first message is sent by server; Reader judges the type of described the first message, obtains the first judged result; If the type of the first message is for obtaining serial ports attribute message described in described the first judgment result displays, reader feeds back to described server by current self serial ports attribute information; If the type of the first message is for serial ports attribute message is set described in described the first judgment result displays, the serial ports attribute information that reader comprises based on described the first message, upgrades self serial ports attribute information.Thereby broken away from the restriction of reader IP address, self serial ports attribute etc., to every setup of attribute of reader all in unclear situation, still can be configured as correct serial ports attribute information, guarantee that reader under any circumstance all can carry out proper communication with service end.
Embodiment
The embodiment of the present invention provides a kind of method that configures reader serial communication attribute, thereby do not knowing in the situations such as reader communication mode, serial ports attribute, IP address, reader is set to serial communication mode easily, can revise the serial ports attribute information parameter in reader, be that server is consistent so that make reader and upper layer application simultaneously.
As shown in Figure 1, the method specifically can comprise:
Step 11, reader receives the first message, and described the first message is sent by server;
Step 12, reader judges the type of described the first message, obtains the first judged result;
Step 13, if the type of the first message is for obtaining serial ports attribute message described in described the first judgment result displays, reader feeds back to described server by current self serial ports attribute information; If the type of the first message is for serial ports attribute message is set described in described the first judgment result displays, the serial ports attribute information that reader comprises based on described the first message, upgrades self serial ports attribute information.
In the embodiment of the present invention, serial ports attribute information specifically can comprise the parameters such as serial ports baud rate, data bit, position of rest, check digit.Wherein, serial ports baud rate is for representing bit (bit) number of transmission per second, and for example bit rate is 9600, represents transmission 9600bit per second.Data bit is to weigh the parameter of actual data bits in communication process, and when the other side is when for example server sends a packets of information, data bit wherein may be 5,7 or 8, depends on the information of actual transmission and the situation of communication protocol; Position of rest is for representing last position of packets of information, and representative value is 1,1.5 and 2, not only, for representing the end of transmission, can also be used to equipment room synchronous; Check digit is a kind of simple verification mode in serial communication, has odd and even parity check, makes receiving terminal have an opportunity to judge that whether the information receiving is correct.
In the embodiment of the present invention, the process that reader feeds back to described server by current self serial ports attribute information specifically can comprise:
First, reader is added into current self serial ports attribute information in the response message of described the first message.
Then, reader can be sent to described server by the response message that includes current self serial ports attribute information.
By above-mentioned steps, can realize reader and report the object of self current attribute information.
Follow-up, reader can also be based on receiving the serial ports attribute information that comprises of the second message, upgrade the serial ports attribute information of self, the serial ports attribute information that described the second message comprises, is that the serial ports attribute information of server based on reader feedback generates and sends to reader.
And the serial ports attribute information comprising based on described the first message for reader upgrades the process of the serial ports attribute information of self, specifically can comprise:
Reader judges that whether the serial ports attribute information that described the first message comprises meets preset requirement, obtains the second judged result;
If the serial ports attribute information that described in described the second judgment result displays, the first message comprises does not meet preset requirement, reader is abandoned described the first message; If the serial ports attribute information that described in described the second judgment result displays, the first message comprises meets preset requirement, the serial ports attribute information that reader comprises based on described the first message, upgrades self serial ports attribute information.
Upgrading based on the first information after the serial ports attribute information of self, in subsequent communications process, serial ports attribute information and server after reader can use this to upgrade carry out communication.
The preset requirement that the invention described above embodiment is related, be specifically as follows the support whether serial ports attribute information that the first message comprises can obtain reader hardware, or whether the serial ports attribute information that the first message comprises meets related protocol requirement, etc.
Be the process that in the embodiment of the present invention, whether the related serial ports attribute information that judges that described the first message comprises meets preset requirement, its essence can be the whether legal process of serial ports attribute information that judges that the first message comprises.
The content of being recorded from step 11, in the embodiment of the present invention, the first message that reader receives is to be sent by server, so visible, before reader receives the first message, a kind of method that configures reader serial communication attribute that the embodiment of the present invention provides, specifically can also comprise:
Server sends the first message to reader, the type of described the first message comprises to be obtained serial ports attribute message or serial ports attribute message is set, described serial ports attribute message, be used for making reader that current self serial ports attribute information is fed back to described server, the described serial ports attribute message that arranges, for the serial ports attribute information that reader is comprised based on described the first message, upgrade the serial ports attribute information of self.
In order to overcome in prior art, must obtain in advance the information such as the IP address of reader, can realize this defect of communicating by letter between server and reader, related server in the embodiment of the present invention, the mode that can broadcast by all readers in subnet described the first message, sends the first message to multiple readers.
The reader that receives the first message can be by a sign of carrying in the first message, determines whether the first message sends to self.
If determine and send to self, reader can carry out subsequent operation based on the type of the first message.
If determine and do not send to self, reader can directly be abandoned this first message.
And related the first message (comprising the second message) of the embodiment of the present invention can, by many forms, in one embodiment, specifically can be User Datagram Protoco (UDP) (UDP:User Datagram Protocol) broadcast.
, receiving after the response message of reader, server is by resolving current self the serial ports attribute information that can see that reader reports meanwhile.If desired the content of accepting broadcast response message is modified, add the field of serial ports attribute, server now can arrange the serial ports attribute of reader as required, and after having arranged, be handed down to corresponding reader, adopt afterwards amended serial ports attribute and reader to carry out communication.
The method that is the configuration reader serial communication attribute that provides of the embodiment of the present invention specifically can also comprise the following steps:
Server receives current self the serial ports attribute information of the reader of reader feedback;
Server is modified to current self the serial ports attribute information of described reader;
Server is sent to reader by amended serial ports attribute information.
The invention described above embodiment institute supplying method, for reader, the setting of communication mode only represents upper layer application is between server and reader, to adopt which kind of mode to communicate, which kind of mode is business operation uses communicate, no matter be set to which kind of mode, the ethernet communication function of reader is retained.
The method providing in the embodiment of the present invention, revised the response process for broadcast in reader, the various attributes of reader self are added in replying of broadcast, in server, add the processing for broadcast response message simultaneously, can correctly get the various attributes of reader.The communication attributes of serial ports is added wherein, can show the serial ports attribute of this reader at server end, also the serial ports attribute of configurable reader.
In prior art, for the processing of broadcast, only that the IP address of reader is returned, and in the embodiment of the present invention, in broadcast response message, add the field of serial ports attribute, serial ports baud rate, data bit, position of rest, check digit etc. are added in broadcast response message, also need the content of guaranteeing normal response message not occupied, revise the length of response message simultaneously, make server can normally receive response message.
A specific implementation process of a kind of method that configures reader serial communication attribute below, the embodiment of the present invention being provided is described in detail.
As shown in Figure 2, this process specifically can comprise:
Step 201, server issues the first message.
The concrete server that can be issues udp broadcast message.
Afterwards, server can perform step 202, enters and waits for reader response status.
Step 203, reader receives the first message.
Step 204, reader judges the type of the first message.
If the type of the first message is for obtaining serial ports attribute message, follow-up reader can perform step 208, and current self serial ports attribute information is fed back to described server.
Concrete, reader can pass through the response message of the first message, and self current serial ports attribute message is reported to server.
If the type of the first message is for arranging serial ports attribute message, follow-up reader can perform step 205, judges whether the serial ports attribute information that the first message comprises meets preset requirement.
If the serial ports attribute information that the first message comprises does not meet preset requirement, follow-up reader can perform step 206, and the first message is abandoned.
If the serial ports attribute information that the first message comprises meets preset requirement, follow-up reader can perform step 207, and the serial ports attribute message based in the first message is upgraded self serial ports attribute information, and after renewal, adopt up-to-date serial ports attribute information and server to carry out communication.
Step 209, server parses response message, obtains current self the serial ports attribute information of reader that response message comprises.
If desired current self the serial ports attribute information of reader is modified, server is follow-up performs step 210, the serial ports attribute information that reader is current is modified, and after modification, execution step 211, amended serial ports attribute information is issued to reader, so that reader (is similar to step 207 based on amended serial ports attribute information, what only now reader received is the second message), upgrade the serial ports attribute information of self, and serial ports attribute information and server after later use upgrades communicate.
By above-mentioned steps, can not know in advance in the situations such as reader communication mode, serial ports attribute, IP address, realize the configuration to reader serial ports attribute information.
The embodiment of the present invention also provides a kind of device that configures reader serial communication attribute, and as shown in Figure 3, this device specifically can comprise:
Receiver module 31, for receiving the first message, described the first message is sent by server;
Judge module 32, for judging the type of described the first message, obtains the first judged result;
Processing module 33, if for the type of the first message described in described the first judgment result displays for obtaining serial ports attribute message, current reader serial ports attribute information is fed back to described server; If the type of the first message is for serial ports attribute message is set described in described the first judgment result displays, the serial ports attribute information comprising based on described the first message, the serial ports attribute information of renewal reader.
In one embodiment, processing module 33 specifically can comprise:
Adding device, for being added into current reader serial ports attribute information the response message of described the first message;
Transmitting element, for being sent to described server by the response message that includes current self the serial ports attribute information of reader.
And in this embodiment, the serial ports attribute information that described processing module 33 also comprises for the second message receiving based on receiver module 31, upgrade the serial ports attribute information of self, the serial ports attribute information that described the second message comprises is that the serial ports attribute information of server based on reader feedback generates and send to reader by the second message.
In another specific embodiment, processing module 33 specifically can also comprise:
Judging unit, for judging that whether the serial ports attribute information that described the first message comprises meets preset requirement, obtains the second judged result;
Processing unit, if the serial ports attribute information comprising for the first message described in described the second judgment result displays does not meet preset requirement, abandons described the first message; If the serial ports attribute information that described in described the second judgment result displays, the first message comprises meets preset requirement, the serial ports attribute information comprising based on described the first message, the serial ports attribute information of renewal reader.
The embodiment of the present invention also provides a kind of device that configures reader serial communication attribute, and as shown in Figure 4, this device specifically can comprise:
Sending module 41, for sending the first message to reader, the type of described the first message comprises to be obtained serial ports attribute message or serial ports attribute message is set, described serial ports attribute message, be used for making reader that current self serial ports attribute information is fed back to described server, the described serial ports attribute message that arranges, for the serial ports attribute information that reader is comprised based on described the first message, upgrades the serial ports attribute information of self.
In one embodiment, as shown in Figure 4, this device specifically can also comprise:
Receiver module 42, for receiving current self the serial ports attribute information of the reader of reader feedback;
Modified module 43, for modifying to current self the serial ports attribute information of described reader;
In the embodiment of the present invention, sending module 41 specifically can also be used for amended serial ports attribute information to be sent to reader.
The embodiment of the present invention also provides a kind of system that configures reader serial communication attribute, and as shown in Figure 5, this system specifically comprises server 51 and reader 52; Wherein:
Server 51, for sending the first message to reader 52, the type of described the first message comprises to be obtained serial ports attribute message or serial ports attribute message is set;
Reader 52, be used for the first message that reception server 51 sends, and judge the type of the first message, obtain the first judged result, if the type of first judgment result displays the first message is for obtaining serial ports attribute message, reader 52 feeds back to server 51 by current self serial ports attribute information; If the type of first judgment result displays the first message is for serial ports attribute message is set, the serial ports attribute information that reader 52 comprises based on the first message, upgrades self serial ports attribute information.
Concrete function and the structure of the server 51 relating in the embodiment of the present invention, the associated description in method and the device (as shown in Figure 4) of the configuration reader serial communication attribute that specifically can provide with reference to the embodiment of the present invention.
Concrete function and the structure of the reader 52 relating in the embodiment of the present invention, the associated description in method and the device (as shown in Figure 3) of the configuration reader serial communication attribute that specifically can provide with reference to the embodiment of the present invention.
Method, the Apparatus and system of configuration reader serial communication attribute provided by the invention, receive the first message by reader, and described the first message is sent by server; Reader judges the type of described the first message, obtains the first judged result; If the type of the first message is for obtaining serial ports attribute message described in described the first judgment result displays, reader feeds back to described server by current self serial ports attribute information; If the type of the first message is for serial ports attribute message is set described in described the first judgment result displays, the serial ports attribute information that reader comprises based on described the first message, upgrades self serial ports attribute information.Thereby broken away from the restriction of reader IP address, self serial ports attribute etc., to every setup of attribute of reader all in unclear situation, still can be configured as correct serial ports attribute information, guarantee that reader under any circumstance all can carry out proper communication with service end.
The above is only embodiments of the present invention; it should be pointed out that for those skilled in the art, under the premise without departing from the principles of the invention; can also make some improvements and modifications, these improvements and modifications also should be considered as protection scope of the present invention.