The content of the invention
The present invention provides a kind of method, apparatus and system for configuring reader serial communication attribute, so as in server thing
When first not knowing reader communication attribute, server can still be configured to the serial ports attribute information of reader.
Offer scheme of the present invention is as follows:
A kind of method for configuring reader serial communication attribute is the embodiment of the invention provides, including:
Reader receives first message, and the first message is as transmitted by server;
Reader judges the type of the first message, obtains the first judged result;
If the type of first message described in first judgment result displays is to obtain serial ports attribute message, reader will
Current itself serial ports attribute information feeds back to the server;If the type of first message described in first judgment result displays
To set serial ports attribute message, then reader is based on the serial ports attribute information that the first message includes, updates the string of itself
Mouth attribute information.
Preferably, current itself serial ports attribute information is fed back to the server and included by the reader:
Be added to current itself serial ports attribute information in the response message of the first message by the reader;
The response message that the reader will include current itself serial ports attribute information is sent to the server.
Preferably, after current itself serial ports attribute information is fed back to the server by the reader, the side
Method also includes:
Reader is based on the serial ports attribute information that the second message includes for receiving, and updates the serial ports attribute information of itself,
The serial ports attribute information that second message includes, is that serial ports attribute information generation of the server based on reader feedback is concurrent
Give reader.
Preferably, the reader is based on the serial ports attribute information that the first message includes, updates the serial ports of itself
Attribute information includes:
Whether the serial ports attribute information that reader judges the first message and includes meets preset requirement, obtains second and sentences
Disconnected result;
If the serial ports attribute information that first message described in second judgment result displays includes does not meet preset requirement,
Then reader abandons the first message;If the serial ports attribute letter that first message described in second judgment result displays includes
Breath meets preset requirement, then reader is based on the serial ports attribute information that the first message includes, updates the serial ports category of itself
Property information.
The embodiment of the present invention additionally provides a kind of method for configuring reader serial communication attribute, including:
Server sends first message to reader, and the type of the first message includes obtaining serial ports attribute message or sets
Serial ports attribute message is put, the serial ports attribute message is described for making reader feed back to current itself serial ports attribute information
Server, the setting serial ports attribute message, for making reader be based on the serial ports attribute information that the first message includes,
Update the serial ports attribute information of itself.
Preferably, the server sends first message and includes to reader:
Server broadcasts the first message to all readers in subnet.
Preferably, methods described also includes:
Server receives current itself the serial ports attribute information of reader of reader feedback;
Server is modified to current itself the serial ports attribute information of the reader;
Server sends to reader amended serial ports attribute information.
The embodiment of the present invention additionally provides a kind of device for configuring reader serial communication attribute, including:
Receiver module, for receiving first message, the first message is as transmitted by server;
Judge module, the type for judging the first message obtains the first judged result;
Processing module, if disappearing to obtain serial ports attribute for the type of first message described in first judgment result displays
Breath, then feed back to the server by the current serial ports attribute information of reader;If first described in first judgment result displays
To set serial ports attribute message, then the serial ports attribute information for being included based on the first message is updated and read the type of message
The serial ports attribute information of device.
Preferably, the processing module includes:
Adding device, for the current serial ports attribute information of reader to be added in the response message of the first message;
Transmitting element, the response message for will include current itself the serial ports attribute information of reader is sent to the clothes
Business device.
Preferably, the processing module is additionally operable to receive the serial ports attribute letter that the second message includes based on receiver module
Breath, updates the serial ports attribute information of itself, and the serial ports attribute information that second message includes is that server is based on reader
The serial ports attribute information of feedback is generated and sent to reader.
Preferably, the processing module includes:
Whether judging unit, the serial ports attribute information included for judging the first message meets preset requirement, obtains
Take the second judged result;
Processing unit, if the serial ports attribute information included for first message described in second judgment result displays is not
Meet preset requirement, then abandon the first message;If the string that first message described in second judgment result displays includes
Mouth attribute information meets preset requirement, then the serial ports attribute information for being included based on the first message updates the string of reader
Mouth attribute information.
The embodiment of the present invention additionally provides a kind of device for configuring reader serial communication attribute, including:
Sending module, for sending first message to reader, the type of the first message includes obtaining serial ports attribute
Message sets serial ports attribute message, the serial ports attribute message, for making reader that current itself serial ports attribute information is anti-
It is fed to the server, the setting serial ports attribute message, for making reader be based on the serial ports that the first message includes
Attribute information, updates the serial ports attribute information of itself.
Preferably, described device also includes:
Receiver module, current itself the serial ports attribute information of reader for receiving reader feedback;
Modified module, for being modified to current itself the serial ports attribute information of the reader;
The sending module, is additionally operable to send amended serial ports attribute information to reader.
The embodiment of the present invention additionally provide it is a kind of configure the system of reader serial communication attribute, including server and read
Read device;Wherein:
The server, for sending first message to reader, the type of the first message includes obtaining serial ports category
Property message or set serial ports attribute message;
The reader, for receiving the first message of the server transmission, and judges the type of the first message,
If the type of first message described in first judgment result displays is to obtain serial ports attribute message, reader will it is current itself
Serial ports attribute information feeds back to the server;If the type of first message described in first judgment result displays is gone here and there to set
Mouth attribute message, the then serial ports attribute information that reader is included based on the first message updates the serial ports attribute letter of itself
Breath.
From the above as can be seen that the present invention provide the method for configuration reader serial communication attribute, device and be
System, first message is received by reader, and the first message is as transmitted by server;Reader judges the first message
Type, obtain the first judged result;If the type of first message described in first judgment result displays belongs to obtain serial ports
Property message, then reader current itself serial ports attribute information is fed back into the server;If first judgment result displays
To set serial ports attribute message, then reader is based on the serial ports attribute that the first message includes to the type of the first message
Information, updates the serial ports attribute information of itself.So as to break away from the limitation of reader IP address, itself serial ports attribute etc.,
Every attribute of reader is set it is unclear in the case of, can still be configured as correct serial ports attribute information,
Ensure that reader can carry out proper communication with service end under any circumstance.
Specific embodiment
The embodiment of the present invention provides a kind of method for configuring reader serial communication attribute, so as to not know that reader is logical
When letter mode, serial ports attribute, IP address, reader easily can be set to serial communication mode, while can
Serial ports attribute information parameter in modification reader, in order to be consistent reader and upper layer application i.e. server.
As shown in Figure 1, the method can specifically include:
Step 11, reader receives first message, and the first message is as transmitted by server;
Step 12, reader judges the type of the first message, obtains the first judged result;
Step 13, if the type of first message described in first judgment result displays is to obtain serial ports attribute message,
Current itself serial ports attribute information is fed back to the server by reader;If first disappears described in first judgment result displays
To set serial ports attribute message, then reader is based on the serial ports attribute information that the first message includes to the type of breath, updates
The serial ports attribute information of itself.
In the embodiment of the present invention, serial ports attribute information can specifically include serial port baud rate, data bit, stop position, verification
The parameters such as position.Wherein, serial port baud rate is used to represent the bit of transmission per second(bit)Number, such as bit rate are 9600, are represented
Transmission 9600bit per second.Data bit is to weigh the parameter of actual data bits in communication process, when other side's such as server sends one
During individual packet, data bit therein may be 5,7 or 8, depending on the actual information for sending and the situation of communication protocol;Stop
Stop bit is used to represent last position of packet that representative value to be 1,1.5 and 2, is used not only for representing the end of transmission, can be with
For equipment room synchronization;Check bit is a kind of simple verification mode in serial communication, there is odd and even parity check, makes receiving terminal
Have an opportunity to judge whether the information for receiving is correct.
In the embodiment of the present invention, the process that current itself serial ports attribute information is fed back to the server by reader is specific
Can include:
First, be added to current itself serial ports attribute information in the response message of the first message by reader.
Then, reader can will include the response message of current itself serial ports attribute information and send to the server.
It is to be capable of achieving the purpose that reader reports itself current attribute information by above-mentioned steps.
Subsequently, reader is also based on the serial ports attribute information that the second message includes for receiving, and updates the string of itself
Mouth attribute information, the serial ports attribute information that second message includes is that server is based on the serial ports attribute that reader feeds back
Information is generated and sent to reader.
And the serial ports attribute information that the first message includes is based on for reader, update the serial ports attribute letter of itself
The process of breath, can specifically include:
Whether the serial ports attribute information that reader judges the first message and includes meets preset requirement, obtains second and sentences
Disconnected result;
If the serial ports attribute information that first message described in second judgment result displays includes does not meet preset requirement,
Then reader abandons the first message;If the serial ports attribute letter that first message described in second judgment result displays includes
Breath meets preset requirement, then reader is based on the serial ports attribute information that the first message includes, updates the serial ports category of itself
Property information.
After the serial ports attribute information that itself is updated based on the first information, during subsequent communications, reader can be used
Serial ports attribute information after this updates is communicated with server.
Preset requirement involved by the embodiments of the present invention, is specifically as follows the serial ports attribute letter that first message includes
Whether breath can obtain the support of reader hardware, or, whether the serial ports attribute information that first message includes meets correlation
Protocol requirement, etc..
Whether the involved serial ports attribute information for judging the first message and including meets i.e. in the embodiment of the present invention
Whether the process of preset requirement, its essence can be to judge the legal process of the serial ports attribute information that first message includes.
From the content described in step 11, in the embodiment of the present invention, the first message that reader is received is by taking
Transmitted by business device, then visible, before reader receives first message, a kind of configuration that the embodiment of the present invention is provided is read
The method for reading device serial communication attribute, can also specifically include:
Server sends first message to reader, and the type of the first message includes obtaining serial ports attribute message or sets
Serial ports attribute message is put, the serial ports attribute message is described for making reader feed back to current itself serial ports attribute information
Server, the setting serial ports attribute message, for making reader be based on the serial ports attribute information that the first message includes,
Update the serial ports attribute information of itself.
In order to overcome in the prior art, it is necessary to obtain the information such as IP address of reader in advance, can realize server with
Communicate this defect between reader, involved server in the embodiment of the present invention, can be by all readers in subnet
The mode of the first message is broadcasted, first message is sent to multiple readers.
And the reader for receiving first message then can determine that first disappears by the mark carried in first message
Whether breath is destined to itself.
If it is determined that be destined to itself, then reader can be based on the type of first message and carry out subsequent operation.
If it is determined that not being destined to itself, then reader can directly abandon the first message.
And the first message involved by the embodiment of the present invention(Including the second message), then can be by many forms, one
In specific embodiment, concretely UDP(UDP:User Datagram Protocol)Broadcast message.
Meanwhile, after the response message for receiving reader, server by parsing i.e. it can be seen that reader report it is current
Itself serial ports attribute information.If desired the content for receiving broadcast response message is modified, adds the field of serial ports attribute, then
Server now can serial ports attribute as needed to reader be configured, and after being provided with, be handed down to and read accordingly
Read device, then communicated with reader using amended serial ports attribute afterwards.
The method of the configuration reader serial communication attribute that i.e. embodiment of the present invention is provided can also specifically include following
Step:
Server receives current itself the serial ports attribute information of reader of reader feedback;
Server is modified to current itself the serial ports attribute information of the reader;
Server sends to reader amended serial ports attribute information.
The embodiments of the present invention provide method, and for reader, the setting of communication mode only represents that upper strata should
Communicated using which kind of mode between i.e. server and reader, as business operation is communicated using which kind of mode,
No matter which kind of mode is set to, and the ethernet communication function of reader is retained.
In the method that the embodiment of the present invention is provided, have modified in reader for the response process for broadcasting the message, will read
Each attribute for reading device itself is added in the response of broadcast message, while adding in the server for broadcast response message
Treatment, can correctly get each attribute of reader.The communication attributes of serial ports are to be added wherein, in server
End can show the serial ports attribute of the reader, can also be configured the serial ports attribute of reader.
Due in the prior art, for the treatment for broadcasting the message, only the IP address of reader being returned, and it is of the invention
In embodiment, in response message is broadcasted, the field of serial ports attribute is added, by serial port baud rate, data bit, stop position, verification
Position etc. is added in broadcast response message, in addition it is also necessary to ensure that the content of normal response message is not occupied, while change response disappearing
The length of breath, enables server normally to receive response message.
Below, to a kind of method for configuring reader serial communication attribute provided in an embodiment of the present invention is specific real
Existing process is described in detail.
As shown in Figure 2, the process can specifically include:
Step 201, server issues first message.
Udp broadcast message specifically can be issued for server.
Afterwards, the executable step 202 of server, that is, enter and wait reader response status.
Step 203, reader receives first message.
Step 204, reader judges the type of first message.
If the type of first message is to obtain serial ports attribute message, follow-up reader can perform step 208, will currently certainly
Body serial ports attribute information feeds back to the server.
Specifically, reader can be reported to itself current serial ports attribute message by the response message of first message
Server.
If the type of first message is to set serial ports attribute message, follow-up reader can perform step 205, judge first
Whether the serial ports attribute information that message includes meets preset requirement.
If the serial ports attribute information that first message includes does not meet preset requirement, follow-up reader can perform step
206, first message is abandoned.
If the serial ports attribute information that first message includes meets preset requirement, follow-up reader can perform step 207,
Based on the serial ports attribute message in first message, the serial ports attribute information of itself is updated, and in the updated, using newest serial ports
Attribute information is communicated with server.
Step 209, server parsing response message obtains current itself the serial ports attribute of reader that response message includes
Information.
If desired current itself the serial ports attribute information of reader is modified, then server subsequently can perform step 210,
The serial ports attribute information current to reader is modified, and after the modification, step 211 is performed, by amended serial ports attribute
Information is issued to reader, and amended serial ports attribute information is based in order to reader(Similar to step 207, only this
When reader receive be the second message), update the serial ports attribute information of itself, and the serial ports attribute after later use renewal
Information is communicated with server.
By above-mentioned steps, you can when reader communication mode, serial ports attribute, IP address is not known in advance,
Realize the configuration to reader serial ports attribute information.
The embodiment of the present invention additionally provides a kind of device for configuring reader serial communication attribute, as shown in Figure 3, the dress
Putting can specifically include:
Receiver module 31, for receiving first message, the first message is as transmitted by server;
Judge module 32, the type for judging the first message obtains the first judged result;
Processing module 33, if being acquisition serial ports attribute for the type of first message described in first judgment result displays
Message, then feed back to the server by the current serial ports attribute information of reader;If described in first judgment result displays
The type of one message to set serial ports attribute message, then read by the serial ports attribute information for being included based on the first message, renewal
Read the serial ports attribute information of device.
In one embodiment, processing module 33 can specifically include:
Adding device, for the current serial ports attribute information of reader to be added in the response message of the first message;
Transmitting element, the response message for will include current itself the serial ports attribute information of reader is sent to the clothes
Business device.
And in this embodiment, the second message that the processing module 33 is additionally operable to be received based on receiver module 31 includes
Serial ports attribute information, update the serial ports attribute information of itself, the serial ports attribute information that second message includes is service
The serial ports attribute information that device is based on reader feedback is generated and is sent to reader by the second message.
In another specific embodiment, processing module 33 can also specifically include:
Whether judging unit, the serial ports attribute information included for judging the first message meets preset requirement, obtains
Take the second judged result;
Processing unit, if the serial ports attribute information included for first message described in second judgment result displays is not
Meet preset requirement, then abandon the first message;If the string that first message described in second judgment result displays includes
Mouth attribute information meets preset requirement, then the serial ports attribute information for being included based on the first message updates the string of reader
Mouth attribute information.
The embodiment of the present invention additionally provides a kind of device for configuring reader serial communication attribute, as shown in Figure 4, the dress
Putting can specifically include:
Sending module 41, for sending first message to reader, the type of the first message includes obtaining serial ports category
Property message or serial ports attribute message is set, the serial ports attribute message, for making the reader will current itself serial ports attribute information
Feed back to the server, the setting serial ports attribute message, for making reader be based on the string that the first message includes
Mouth attribute information, updates the serial ports attribute information of itself.
In one embodiment, as shown in Figure 4, the device can also specifically include:
Receiver module 42, current itself the serial ports attribute information of reader for receiving reader feedback;
Modified module 43, for being modified to current itself the serial ports attribute information of the reader;
In the embodiment of the present invention, sending module 41 specifically can be also used for sending amended serial ports attribute information to readding
Read device.
The embodiment of the present invention additionally provides a kind of system for configuring reader serial communication attribute, and as shown in Figure 5, this is
System specifically includes server 51 and reader 52;Wherein:
Server 51, for sending first message to reader 52, the type of the first message includes obtaining serial ports category
Property message or set serial ports attribute message;
Reader 52, for the first message that the reception server 51 sends, and judges the type of first message, obtains first
Judged result, if the type of the first judgment result displays first message is to obtain serial ports attribute message, reader 52 will be current
Itself serial ports attribute information feeds back to server 51;If the type of the first judgment result displays first message is setting serial ports attribute
Message, the then serial ports attribute information that reader 52 is included based on first message, updates the serial ports attribute information of itself.
The concrete function and structure of the server 51 being related in the embodiment of the present invention, specifically can refer to the embodiment of the present invention and carry
The method and device of the configuration reader serial communication attribute of confession(As shown in Figure 4)In associated description.
The concrete function and structure of the reader 52 being related in the embodiment of the present invention, specifically can refer to the embodiment of the present invention and carry
The method and device of the configuration reader serial communication attribute of confession(As shown in Figure 3)In associated description.
Method, the apparatus and system of the configuration reader serial communication attribute that the present invention is provided, the is received by reader
One message, the first message is as transmitted by server;Reader judges the type of the first message, obtains first and judges
As a result;If, to obtain serial ports attribute message, reader ought for the type of first message described in first judgment result displays
Preceding itself serial ports attribute information feeds back to the server;If the type of first message is described in first judgment result displays
Serial ports attribute message is set, then reader is based on the serial ports attribute information that the first message includes, updates the serial ports of itself
Attribute information.So as to break away from the limitation of reader IP address, itself serial ports attribute etc., set in the every attribute to reader
Put it is unclear in the case of, can still be configured as correct serial ports attribute information, it is ensured that reader is in any feelings
Proper communication can be carried out under condition with service end.
The above is only embodiments of the present invention, it is noted that come for those skilled in the art
Say, 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 regarded as
Protection scope of the present invention.