Disclosure of Invention
The embodiment of the application provides an access control data transmission processing method and system based on an RS485 protocol, and aims to at least solve the problem that an old-fashioned access control in the prior art cannot support a two-dimensional code and an IC card simultaneously.
According to one aspect of the application, an access control data transmission processing method based on an RS485 protocol is provided, and comprises the following steps: receiving first data read by an entrance guard reading head, wherein the first data comprises at least one of the following data: data of IC card, two-dimensional code data; converting the first data read by the entrance guard reading head into second data of an RS485 protocol; analyzing the second data, wherein the data of the IC card in the second data is output through a Wiegand protocol, and the two-dimensional code data in the second data is transmitted to a two-dimensional code analyzing server through an Ethernet interface; and determining whether to open the access control according to the IC card data output by the Wagner washing machine or the two-dimensional code analyzed by the two-dimensional code analysis server.
Further, receiving the first data read from the access control read head comprises: and receiving the first data read by the entrance guard reading head through a Wiegand protocol.
Further, converting the first data read by the access control reading head into second data of an RS485 protocol includes: packaging the first data in a predetermined number of bytes in the case that the first data is data of an IC card; converting a protocol identification and a preset number of bytes which are packaged with the first data into second data, wherein the protocol identification is used for indicating that the second data carries the data of the IC card received by using the Wiegand protocol.
Further, the predetermined number of bytes is 4 bytes.
Further, converting the first data read by the access control reading head into second data of an RS485 protocol includes: and converting an indication identifier and the data of the two-dimensional code into the second data under the condition that the first data is the data of the two-dimensional code, wherein the indication identifier is used for indicating that the two-dimensional code data is carried in the second data.
Still provide an entrance guard data transmission processing system based on RS485 agreement in this embodiment, include: the system comprises a converter and a host, wherein the converter is used for receiving first data read by an entrance guard reading head, and the first data comprises at least one of the following data: data of IC card, two-dimensional code data; the converter is also used for converting the first data read by the entrance guard reading head into second data of an RS485 protocol; the host is used for analyzing the second data, wherein the data of the IC card in the second data is output through a Wiegand protocol, and the two-dimensional code data in the second data is transmitted to a two-dimensional code analysis server through an Ethernet interface; the host is used for determining whether to open the access control according to the IC card data output by the Wagner washing machine or the two-dimensional code analyzed by the two-dimensional code analysis server.
Further, the converter is configured to: and receiving the first data read by the entrance guard reading head through a Wiegand protocol.
Further, the host is configured to: packaging the first data in a predetermined number of bytes in the case that the first data is data of an IC card; converting a protocol identification and a preset number of bytes which are packaged with the first data into second data, wherein the protocol identification is used for indicating that the second data carries the data of the IC card received by using the Wiegand protocol.
Further, the predetermined number of bytes is 4 bytes.
Further, the host is configured to: and converting an indication identifier and the data of the two-dimensional code into the second data under the condition that the first data is the data of the two-dimensional code, wherein the indication identifier is used for indicating that the two-dimensional code data is carried in the second data.
In the embodiment of the present application, receiving first data read by an entrance guard reading head is adopted, where the first data includes at least one of: data of IC card, two-dimensional code data; converting the first data read by the entrance guard reading head into second data of an RS485 protocol; analyzing the second data, wherein the data of the IC card in the second data is output through a Wiegand protocol, and the two-dimensional code data in the second data is transmitted to a two-dimensional code analyzing server through an Ethernet interface; and determining whether to open the access control according to the IC card data output by the Wagner washing machine or the two-dimensional code analyzed by the two-dimensional code analysis server. Through the application, the problem that the old-fashioned entrance guard cannot support the two-dimensional code and the IC card simultaneously in the prior art is solved, so that the signal line of the old-fashioned entrance guard system can be used for supporting the two-dimensional code and the IC card simultaneously.
Detailed Description
It should be noted that the embodiments and features of the embodiments in the present application may be combined with each other without conflict. The present application will be described in detail below with reference to the embodiments with reference to the attached drawings.
It should be noted that the steps illustrated in the flowcharts of the figures may be performed in a computer system such as a set of computer-executable instructions and that, although a logical order is illustrated in the flowcharts, in some cases, the steps illustrated or described may be performed in an order different than presented herein.
In this embodiment, an access control data transmission processing method based on an RS485 protocol is provided, and fig. 1 is a flowchart of the access control data transmission processing method based on the RS485 protocol according to the embodiment of the present application, and as shown in fig. 1, the flowchart includes the following steps:
step S102, receiving first data read by an entrance guard reading head, wherein the first data comprises at least one of the following data: data of IC card, two-dimensional code data;
for example, the first data read by the entrance guard reading head may be received through a wiegand protocol.
Step S104, converting the first data read by the entrance guard reading head into second data of an RS485 protocol;
for example, in the case where the first data is data of an IC card, the first data is packaged in a predetermined number of bytes (for example, four bytes); converting a protocol identification and a preset number of bytes which are packaged with the first data into second data, wherein the protocol identification is used for indicating that the second data carries the data of the IC card received by using the Wiegand protocol.
For another example, converting the first data read by the entrance guard reading head into the second data of the RS485 protocol includes: and converting an indication identifier and the data of the two-dimensional code into the second data under the condition that the first data is the data of the two-dimensional code, wherein the indication identifier is used for indicating that the two-dimensional code data is carried in the second data.
Step S106, analyzing the second data, wherein the data of the IC card in the second data is output through a Wiegand protocol, and the two-dimensional code data in the second data is transmitted to a two-dimensional code analyzing server through an Ethernet interface;
and S108, determining whether to open the door access according to the IC card data output by the Wagner washing machine or the two-dimensional code analyzed by the two-dimensional code analysis server.
The problem that an old-fashioned access control system cannot support a two-dimensional code and an IC card simultaneously in the prior art is solved through the steps, so that the signal line of the old-fashioned access control system can support the two-dimensional code and the IC card simultaneously.
Still provide an entrance guard data transmission processing system based on RS485 agreement in this embodiment, include: the system comprises a converter and a host, wherein the converter is used for receiving first data read by an entrance guard reading head, and the first data comprises at least one of the following data: data of IC card, two-dimensional code data; the converter is also used for converting the first data read by the entrance guard reading head into second data of an RS485 protocol; the host is used for analyzing the second data, wherein the data of the IC card in the second data is output through a Wiegand protocol, and the two-dimensional code data in the second data is transmitted to a two-dimensional code analysis server through an Ethernet interface; the host is used for determining whether to open the access control according to the IC card data output by the Wiegand washing machine or the two-dimensional code analyzed by the two-dimensional code analysis server (or called as a two-dimensional code identification server).
The system corresponds to the above method steps, and the description thereof is omitted here. For example, the converter is used for: and receiving the first data read by the entrance guard reading head through a Wiegand protocol.
Optionally, the host is configured to: packaging the first data in a predetermined number of bytes in the case that the first data is data of an IC card; converting a protocol identification and a preset number of bytes which are packaged with the first data into second data, wherein the protocol identification is used for indicating that the second data carries the data of the IC card received by using the Wiegand protocol. Optionally, the host is configured to: and converting an indication identifier and the data of the two-dimensional code into the second data under the condition that the first data is the data of the two-dimensional code, wherein the indication identifier is used for indicating that the two-dimensional code data is carried in the second data.
As an optional added embodiment, if the first data is the two-dimensional code data, the converter sends the two-dimensional code data to the host twice, in order to prevent errors in transmission and conversion of the two-dimensional code data, the host compares the two received two-dimensional code data, and if the two-dimensional code data are the same, the two-dimensional code data in the first data is transmitted to the two-dimensional code identification server. If the two-dimensional code data are different, the data are directly fed back wrongly, and the entrance guard cannot be opened.
As another optional implementation manner, when the host transmits the two-dimensional code data to the two-dimensional code recognition server, a check code is added at the end of the two-dimensional code data, wherein the check code is generated according to the two-dimensional code data and is used for checking the two-dimensional code data. After the two-dimension code recognition server receives the two-dimension code data and the check code, the check code is used for checking the two-dimension code, the two-dimension code data are analyzed under the condition that the check is passed, and the door control cannot be opened due to the fact that data are fed back wrongly under the condition that the check is different.
As another optional mode, when the two-dimensional code recognition server recognizes that the two-dimensional code is a two-dimensional code with door opening authority, the two-dimensional code data is fed back to the host as the two-dimensional code with door opening authority. And the host stores the two-dimensional code data in a white list, and the white list is stored in a memory of the host. When the host receives the two-dimensional code data again, the two-dimensional code data are matched in the white list, if the matching is successful, the two-dimensional code data are confirmed to have door opening authority, and if the matching is failed, the two-dimensional code data are sent to the two-dimensional code identification server, so that the door opening speed can be increased.
As another optional mode, when the two-dimensional code identification server identifies that the two-dimensional code is a two-dimensional code without a door opening authority, the two-dimensional code is fed back to the host as two-dimensional code data without a door opening authority. The host talks the two-dimensional code data and stores the two-dimensional code data in a blacklist, the blacklist is stored in a hard disk of the host, the host firstly matches the two-dimensional code data in the blacklist when receiving the two-dimensional code data, and if the matching is successful, the data is fed back wrongly, and the access control cannot be opened. And if the matching is not successful in the blacklist, matching is carried out in the white list, if the matching is successful, the two-dimensional code data is confirmed to have the door opening authority, and if the matching is failed, the two-dimensional code data is sent to the two-dimensional code identification server.
The two-dimensional code data stored on the hard disk is not easy to delete, if the preset two-dimensional code data needs to be deleted from a blacklist stored on a hard disk of a host, the two-dimensional code data to be deleted can be generated through identity information to be deleted by a two-dimensional code recognition server, then a deletion command is sent to the host, the two-dimensional code data (the two-dimensional code data can be understood as a number formed by 01, and the two-dimensional code can be data for identifying the identity information) are carried in the deletion command, and the host deletes the two-dimensional code data from the blacklist of the hard disk after receiving the deletion command.
An alternative embodiment of the present application is described below with reference to the drawings. In order to simultaneously transmit two-dimensional code data (Ethernet-4 to 8 lines) and IC card swiping data (Wiegand-two lines) by the two-dimensional code of the gate and the devices of the IC card two and the IC card one, the two-dimensional code and the IC card swiping data of the gate must be transmitted by using an original 2-core signal line.
Fig. 2 is a schematic diagram of 485 protocol connection according to an embodiment of the present application, and as shown in fig. 2, in this optional embodiment, a multifunctional controller is used to transmit a two-dimensional code, a two-dimensional code of an IC card two and a two-dimensional code of an IC card one device, and IC card data on a 485 data line through a 485 device, and then data is converted into ethernet data through a host in a weak current (the device in the weak current is called as a host) and transmitted to a two-dimensional code server, and the IC card data is transmitted to an access control panel through a wiegand protocol. Data separation is performed. Meanwhile, the switch of the gate can be controlled or the switch state of the gate can be acquired through IO input and output.
The converter protocol in the present embodiment will be explained. In this embodiment, a baud rate of 9600n81 is used. The converter protocol in this embodiment is as follows.
1. Converter IO port changes and converter 485 sends "< bof >" + "IO number:" + ON/OFF + "< eof >".
ON is low and OFF is high.
For example, < bof > IO1: ON < eof >, < bof > IO1: OFF < eof >.
2. The host sends a command to the converter via 485 in the format of "< bof > ic 34:" +4 byte card number + "< eof >".
'IC' stands for Wiegand IC card, '34': representing the wiegand protocol type,' ic34: ' represents the WG34 protocol, the converter outputs a WG34 signal.
3. The two-dimensional code reading head sends an instruction to the converter through 485 to the host computer, and the sending format is as follows: "< bof > ic 34:" +4 byte card number + "< eof >".
After the host receives the data, the IC card number is analyzed into protocol data of WG34, the protocol data are output through a Wiegand interface of the host, and meanwhile, the data are transmitted to a two-dimensional code server through an Ethernet interface.
4. The host sends an instruction to the converter through 485, and the sending format is as follows: "< bof >" + "IO number:" + ON/OFF + "< eof >".
The converter sets the IO port level, note: the electrical level is normally open and normally closed.
5. The host sends an IO inching instruction to the converter through 485, and the sending format is as follows: "< bof >" + "IO number:" + "500" + "< eof >".
The converter sets the IO port low level for 500ms and then restores the high level, for example, < bof > IO1:500< eof >.
6. The two-dimensional code reading head sends an instruction to the converter through 485 to the host computer, and the sending format is as follows: "< bof > RQ:" + two-dimensional code content + "< eof >".
And after receiving the two-dimension code, the host transparently transmits the two-dimension code to the Ethernet interface, and the two-dimension code server processes the two-dimension code content.
In this embodiment, an electronic device is provided, comprising a memory in which a computer program is stored and a processor configured to run the computer program to perform the method in the above embodiments.
These computer programs may also be loaded onto a computer or other programmable data processing apparatus to cause a series of operational steps to be performed on the computer or other programmable apparatus to produce a computer implemented process such that the instructions which execute on the computer or other programmable apparatus provide steps for implementing the functions specified in the flowchart flow or flows and/or block diagram block or blocks, and corresponding steps may be implemented by different modules.
The programs described above may be run on a processor or may also be stored in memory (or referred to as computer-readable media), which includes both non-transitory and non-transitory, removable and non-removable media, that implement information storage by any method or technology. The information may be computer readable instructions, data structures, modules of a program, or other data. Examples of computer storage media include, but are not limited to, phase change memory (PRAM), Static Random Access Memory (SRAM), Dynamic Random Access Memory (DRAM), other types of Random Access Memory (RAM), Read Only Memory (ROM), Electrically Erasable Programmable Read Only Memory (EEPROM), flash memory or other memory technology, compact disc read only memory (CD-ROM), Digital Versatile Discs (DVD) or other optical storage, magnetic cassettes, magnetic tape magnetic disk storage or other magnetic storage devices, or any other non-transmission medium that can be used to store information that can be accessed by a computing device. As defined herein, computer readable media does not include transitory computer readable media (transmyedia) such as modulated data signals and carrier waves.
The above are merely examples of the present application and are not intended to limit the present application. Various modifications and changes may occur to those skilled in the art. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present application should be included in the scope of the claims of the present application.