A method and apparatus for reading and writing a data card, and related devices
Through the connection between the server and the client, read and write operations are performed based on the data card status information, which solves the problem of long-term remote reading and writing IC cards in the prior art, and improves read and write efficiency and user experience.
Patent Information
- Application Number
- CN202111489766.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-12-07
- Publication Date
- 2025-06-27
- Estimated Expiration
- 2041-12-07
AI Technical Summary
The prior art takes a long time to read and write IC cards remotely, resulting in poor user experience.
Establish a connection with the client through the server and read and write operations based on the data card status information. The specific steps include: obtaining the data card status information according to the data card operation command. If it is a card to be written, the target data is obtained and sent to the client for writing; if it is a card to be read, the client will read the data card data and store it locally for the server to read.
It effectively improves the reading and writing efficiency of data cards, improves the user experience, and avoids delays caused by the opening of remote ports.
Smart Images

Figure CN114138205B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of computer technology, and particularly to a method and apparatus for reading and writing a data card, a computer device, and a computer-readable storage medium. Background Art
[0002] In a retail store, a card reader is a very important device, mainly used for reading membership cards, bank cards, etc. As Figure 1 shown, Figure 1 FIG. 1 is a timing diagram of remotely reading and writing an IC card in an existing retail POS (Point Of Sale) system. In the case of a remote connection, by opening a port of a remote computer and connecting to the card reader to read and write the IC card. However, due to remote communication, this implementation has a problem of long time consumption when reading and writing the IC card, resulting in a poor user experience. Summary of the Invention
[0003] The purpose of this application is to provide a method for reading and writing a data card, which can effectively improve the efficiency of reading and writing the data card and improve the user experience; another purpose of this application is to provide another method for reading and writing a data card, a data card reading and writing apparatus, a computer device, and a computer-readable storage medium, all of which have the above beneficial effects.
[0004] In a first aspect, this application provides a method for reading and writing a data card, which is applied to a server and includes:
[0005] Obtaining data card status information from a client according to a data card operation command;
[0006] When the data card status information is waiting to write to the card, obtaining target data and sending the target data to the client so that the client writes the target data to the data card;
[0007] When the data card status information is waiting to read the card, reading a first storage directory of the client to obtain read data; wherein, the read data is obtained by the client reading the data card.
[0008] Optionally, the obtaining data card status information from the client according to the data card operation command includes:
[0009] Reading and obtaining the data card status information from a second storage directory of the client according to the data card operation command; wherein, the data card status information is read from the data card by the client after receiving data card connection information.
[0010] Optionally, after reading the first storage directory of the client to obtain the read data, it further includes:
[0011] Send a data reading success instruction to the client, so that the client modifies the data card status information according to the data reading success instruction;
[0012] The above solution further includes:
[0013] When the read data is not obtained from the first storage directory, send a data reading failure instruction to the client, so that the client modifies the data card status information according to the data reading failure instruction.
[0014] Optionally, before obtaining the data card status information from the client according to the data card operation command, it further includes:
[0015] Receive the data card operation command sent by the client based on the data card connection information.
[0016] Optionally, before obtaining the data card status information from the client according to the data card operation command, it further includes:
[0017] Respond to the data card operation command at a preset time interval.
[0018] In a second aspect, the present application also discloses another data card reading and writing method, which is applied to a client and includes:
[0019] When receiving the data card connection information, obtain the data card status information;
[0020] When the data card status information is a card to be read, read the data card to obtain read data, and store the read data in the first storage directory for the server to read;
[0021] When the data card status information is a card to be written, in the case of receiving the target data sent by the server, write the target data into the data card.
[0022] Optionally, the writing the target data into the data card includes:
[0023] Write the target data into the data card through a preset reading and writing tool;
[0024] Then the reading the data card to obtain read data includes:
[0025] Read the data card through the preset reading and writing tool to obtain the read data.
[0026] Optionally, after writing the target data into the data card, it further includes:
[0027] Obtain the write data result feedback by the data card;
[0028] Modify the data card status information according to the written data result.
[0029] In a third aspect, the present application also discloses a data card reading and writing device, which is applied to a server and includes:
[0030] A server information acquisition module, configured to acquire data card status information from a client according to a data card operation command;
[0031] A server card writing module, configured to acquire target data and send the target data to the client when the data card status information is waiting for card writing, so that the client writes the target data into the data card;
[0032] A server card reading module, configured to read a first storage directory of the client to obtain read data when the data card status information is waiting for card reading; wherein, the read data is obtained by the client reading the data card.
[0033] In a fourth aspect, the present application also discloses another data card reading and writing device, which is applied to a client and includes:
[0034] A client information acquisition module, configured to acquire data card status information when receiving data card connection information;
[0035] A client card reading module, configured to read the data card to obtain read data and store the read data in a first storage directory for the server to read when the data card status information is waiting for card reading;
[0036] A client card writing module, configured to write the target data into the data card when receiving the target data sent by the server when the data card status information is waiting for card writing.
[0037] In a fifth aspect, the present application also discloses a computer device, including:
[0038] A memory, configured to store a computer program;
[0039] A processor, configured to implement the steps of any one of the above data card reading and writing methods when executing the computer program.
[0040] In a sixth aspect, the present application also discloses a computer-readable storage medium, on which a computer program is stored, and the computer program implements the steps of any one of the above data card reading and writing methods when executed by a processor.
[0041] In a seventh aspect, the present application also discloses a computer program product, which includes a computer program, and the computer program implements the steps of any one of the above data card reading and writing methods when executed by a processor.
[0042] A data card reading and writing method provided by this application is applied to a server, including obtaining data card status information from a client according to a data card operation command; when the data card status information is a card to be written, obtaining target data and sending the target data to the client so that the client writes the target data into the data card; when the data card status information is a card to be read, reading a first storage directory of the client to obtain read data; wherein, the read data is obtained by the client reading the data card.
[0043] It can be seen that in the data card reading and writing method provided by this application, the server establishes a connection with the client. When a write operation needs to be performed on the data card, the server sends the target data to the client, and the client writes the target data into the data card; when a read operation needs to be performed on the data card, the client directly reads the data card to obtain the read data and stores it locally so that the server can directly read the local storage of the client to obtain the read data. Thus, the reading and writing operations of the data card are directly implemented based on the local client without opening a remote computer port for data card reading and writing, effectively improving the data card reading and writing efficiency and further improving the user experience.
[0044] Another data card reading and writing method, device, computer device, computer-readable storage medium, and computer program product provided by this application all have the above beneficial effects and will not be elaborated here. Description of the Drawings
[0045] To more clearly illustrate the technical solutions in the prior art and the embodiments of this application, the drawings required for description in the prior art and the embodiments of this application will be briefly introduced below. Of course, the drawings related to the embodiments of this application described below are only a part of the embodiments of this application. For those of ordinary skill in the art, without creative efforts, other drawings can be obtained according to the provided drawings, and the other obtained drawings also fall within the protection scope of this application.
[0046] Figure 1 It is a timing diagram of remotely reading and writing an IC card in a retail POS system in the prior art;
[0047] Figure 2 It is a schematic flowchart of a data card reading and writing method provided by this application;
[0048] Figure 3 It is a schematic flowchart of another data card reading and writing method provided by this application;
[0049] Figure 4 It is a reading and writing flowchart of an IC card provided by this application;
[0050] Figure 5 The timing diagram of an IC card reading and writing method provided by this application;
[0051] Figure 6 The structural schematic diagram of a data card reading and writing device provided by this application;
[0052] Figure 7 The structural schematic diagram of another data card reading and writing device provided by this application;
[0053] Figure 8 The structural schematic diagram of a computer device provided by this application. Specific embodiments
[0054] The core of this application is to provide a data card reading and writing method, which can effectively improve the data card reading and writing efficiency and enhance the user experience; another core of this application is to provide another data card reading and writing method, data card reading and writing device, computer device and computer-readable storage medium, all of which have the above beneficial effects.
[0055] In order to describe the technical solutions in the embodiments of this application more clearly and completely, the following will introduce the technical solutions in the embodiments of this application with reference to the accompanying drawings in the embodiments of this application. Obviously, the described embodiments are only a part of the embodiments of this application, rather than all the embodiments. Based on the embodiments in this application, all other embodiments obtained by those of ordinary skill in the art without creative efforts shall fall within the protection scope of this application.
[0056] The embodiments of this application provide a data card reading and writing method.
[0057] Please refer to Figure 2 , Figure 2 which is the flowchart of a data card reading and writing method provided by this application. This data card reading and writing method is applied to the server and may include:
[0058] S101: Obtain the data card status information from the client according to the data card operation command;
[0059] This step aims to realize the acquisition of the data card status information, which is the current status of the data card, including the status of the card to be written and the status of the card to be read. The status of the card to be written indicates that a write operation needs to be performed on the data card currently, and the status of the card to be read indicates that a read operation needs to be performed on the data card currently.
[0060] In the embodiments of this application, the data card is also called an electronic data card and can support the reading and writing of electronic data. For example, the data card includes, but is not limited to, magnetic cards, bar code cards, integrated circuit (IC) cards, and identification (ID) cards.
[0061] In some embodiments, when the server receives a data card operation command, it can obtain the data card status information from the client according to the data card operation command. Here, the client refers to a local client directly connected to the card reader, which can communicate with the server through a connection to achieve data communication; the server connects to the client through a network, which can be a local area network or a wide area network, such as the Internet (such as an edge network, a cloud network, etc.). When the server connects to the client through the Internet, the server is then a remote server, and data card reading and writing are achieved based on the remote connection. For example, in a cashier system, the local client establishes a connection with the remote server to achieve IC card reading and writing operations. The remote server can obtain the status information of the IC card from the local client when receiving the data card operation command, and then achieve the reading and writing operations of the IC card according to the status information. In some embodiments, the remote client can also operate on the remote server, thereby affecting the data card reading and writing process.
[0062] Among them, the data card operation command is used to notify the server that it is necessary to perform reading and writing operations on the data card. Of course, whether it is a read operation or a write operation is not determined thereby, and it needs to be further determined by obtaining the data card status information.
[0063] It should be noted that the client involved in the embodiments of the present application can be provided by a terminal device, and the server involved can be provided by a server. Among them, the server can be an independent physical server, or a server cluster or distributed system composed of multiple physical servers, or a cloud server providing basic cloud computing services such as cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communications, middleware services, domain name services, security services, Content Delivery Network (CDN), and big data and artificial intelligence platforms. The terminal device can be a smart phone, a tablet computer, a laptop computer, a desktop computer, a smart speaker, a smart watch, etc., but is not limited thereto. The terminal device and the server can be directly or indirectly connected through wired or wireless communication methods, which are not limited in the embodiments of the present application.
[0064] In an embodiment of the present application, obtaining the data card status information from the client according to the data card operation command may include: reading and obtaining the data card status information from the second storage directory of the client according to the data card operation command; among them, the data card status information is read and obtained from the data card by the client after receiving the data card connection information.
[0065] The embodiment of the present application provides a method for implementing the reading of data card status information, that is, the server reads the local storage of the client, that is, the above-mentioned second storage directory, to obtain the data card status information. When the client senses the data card connection information, that is, when it senses that a data card is inserted (or connected), it reads the information of the data card to determine its state. For example, if the data card is an empty card, it means that the data card is in the state of waiting to be written, and if the data card is not an empty card, it means that the data card is in the state of waiting to be read. Thus, after obtaining the data card status information, it can be stored in the local second storage directory for the server to read.
[0066] Of course, the above-mentioned second storage directory is only an implementation manner for storing data card status information provided by this preferred embodiment, and is not unique. Any storage medium can be selected to implement the storage of data card status information, and the present application does not make any limitations in this regard.
[0067] In an embodiment of the present application, before obtaining the data card status information from the client according to the data card operation command, it may further include: receiving the data card operation command sent by the client based on the data card connection information.
[0068] The embodiment of the present application provides a method for obtaining a data card operation command, that is, the data card operation command can be sent by the client to the server so that the server can obtain the data card status information based on the data card operation command. As described above, when the client senses the data card connection information, it can determine the data card status information by reading the data card and store it in the second storage directory. Based on this, it can simultaneously send a data card operation command to the server to notify the server to obtain the data card status information.
[0069] In an embodiment of the present application, before obtaining the data card status information from the local client according to the data card operation command, it may further include: responding to the data card operation command at a preset time interval.
[0070] The embodiment of the present application provides another method for obtaining a data card operation command. A timing mechanism can be set for the server so that the server can respond to the data card operation command at a preset time interval, thereby implementing the acquisition of data card status information. Among them, the specific value of the preset time interval does not affect the implementation of this technical solution and can be set by those skilled in the art according to the actual situation. The present application does not make any limitations in this regard.
[0071] It can be understood that one of the above two implementation manners can be selected by those skilled in the art according to actual needs for setting, or both implementation manners can be set at the same time. The present application does not make any limitations in this regard.
[0072] S102: when the data card status information is a card to be written, obtaining target data, and sending the target data to the client, so that the client writes the target data into the data card;
[0073] This step is intended to implement the write operation of the data card. When the data card status information is a card to be written, the server can obtain the target data (i.e., the data information that needs to be written to the data card) and send it to the client; further, the client can send the target data to the data card to implement the client-based data card write operation. Among them, the implementation process of the server obtaining the target data may include: the server initiates a data acquisition request to its corresponding client (i.e., the remote client) based on the data card status information, and the remote client displays the prompt information of the request to obtain the target data on the front-end interface, so that the technician can enter the target data on the front-end interface according to the prompt information, and then the remote client feeds back the target data to the server, thereby realizing the acquisition of the target data on the server. For example, the target data includes but is not limited to user information, financial information, and permission information related to the data card.
[0074] S103: When the data card status information is a card to be read, read the first storage directory of the client to obtain read data; wherein the read data is obtained by the client reading the data card.
[0075] This step is intended to implement the data card read operation. As described above, after the client senses the data card connection information, it can determine the data card status information by reading the data card and store it in the second storage directory. At the same time, when the data card status information is a card to be read, the client can simultaneously read the data information stored in the data card, obtain the read data, and store it locally, that is, store it in the first storage directory. Therefore, when the data card status information is a card to be read, the server can directly read the first storage directory of the client to obtain the read data of the data card. Of course, the above-mentioned first storage directory and the above-mentioned second storage directory can be the same storage directory or different storage directories, and this application does not limit this. After obtaining the read data, the server can store the read data in a specific storage location, such as a database or blockchain, and can also perform corresponding services based on the read data, such as handling banking services.
[0076] In one embodiment of the present application, after reading the first storage directory of the client and obtaining the read data, the method may further include: sending a data read success instruction to the client, so that the client modifies the data card status information according to the data read success instruction.
[0077] The data card reading and writing method provided by the embodiments of the present application aims to implement the function of updating the status information of the data card. After the server obtains the read data, it can send a data reading success instruction to the client. Thus, the client can modify the data card status information from the card to be read to the card read successfully according to the data reading success instruction. Of course, when the server fails to obtain the read data successfully from the client, it can also feedback a data reading failure instruction to the client. Thus, the client can modify the data card status information from the card to be read to the card read failed according to the data reading failure instruction, so that the technical personnel can timely know the read data result of the data card. In addition, in the case of a card reading failure, the client can further output a card reading failure prompt to facilitate the technical personnel to trace the abnormality in time.
[0078] It can be seen that in the data card reading and writing method provided by the present application, the server establishes a connection with the client. When a write operation needs to be performed on the data card, the server sends the target data to the client, and the client writes the target data into the data card; when a read operation needs to be performed on the data card, the client directly reads the data card to obtain the read data and stores it locally, so that the server can directly read the local storage of the client to obtain the read data. Thus, the reading and writing operations of the data card are directly implemented based on the local client without opening the remote computer port for data card reading and writing, effectively improving the data card reading and writing efficiency and further improving the user experience.
[0079] The embodiments of the present application provide another data card reading and writing method.
[0080] Please refer to Figure 3 , Figure 3 which is a schematic flowchart of a data card reading and writing method provided by the present application. The data card reading and writing method is applied to the client and may include:
[0081] S201: When receiving the data card connection information, obtain the data card status information;
[0082] This step aims to obtain the data card status information. When the client senses the data card connection information, that is, when it senses that a data card is inserted (connected), it can read the information of the data card to determine its status. Thus, the data card status information is obtained. Further, the client can locally store the data card status information for the server to read, and then perform corresponding reading and writing operations on the data card.
[0083] S202: When the data card status information is the card to be read, read the data card to obtain the read data and store the read data in the first storage directory for the server to read;
[0084] This step aims to implement the read operation of the data card. When the status information of the data card is waiting to be read, the client can directly read the data card, obtain the corresponding read data, and store it locally, that is, store it in the first storage directory for the server to read.
[0085] S203: When the status information of the data card is waiting to be written, in the case of receiving the target data sent by the server, write the target data into the data card.
[0086] This step aims to implement the write operation of the data card. When the status information of the data card is waiting to be written, the server will send the target data to the client according to the status information of the data card. The target data is the data that needs to be written into the data card. Thus, the client can write the received target data into the data card, thereby completing the write operation of the data card.
[0087] In an embodiment of the present application, the above-mentioned writing the target data into the data card may include: writing the target data into the data card through a preset reading and writing tool; and the above-mentioned reading the data card to obtain the read data may include: reading the data card through a preset reading and writing tool to obtain the read data. For example, the client may store a preset reading and writing tool, and the preset reading and writing tool operates on the SerialPort to achieve data reading and writing.
[0088] It can be understood that the data card reading and writing method provided by the embodiments of the present application aims to implement the reading and writing operations of the data card through the client. When performing the reading and writing operations on the data card through the client, specifically, a preset reading and writing tool in the client can be used to perform the reading and writing operations on the data card. Thus, when performing the write operation on the data card, the target data can be written into the data card by running the preset reading and writing tool; when performing the read operation on the data card, the read data can be obtained by running the preset reading and writing tool to read the data card. Of course, the setting and updating of the above-mentioned data card status information on the client can also be achieved through the preset reading and writing tool.
[0089] Among them, a shared folder can be created on the client to store the preset reading and writing tool in the shared folder. Further, the client can run the preset reading and writing tool through a corresponding plugin. In addition, the data card status information obtained by the client and the read data obtained when performing the read operation on the data card can be stored in different storage directories in the shared folder respectively.
[0090] It should be noted that the above-mentioned preset reading and writing tool integrates both reading and writing functions. However, in some embodiments, it can also be divided into a preset reading tool and a preset writing tool. Among them, the preset reading tool is dedicated to implementing the function of reading data, and the preset writing tool is dedicated to implementing the function of writing data.
[0091] In one embodiment of the present application, after writing the target data to the data card, the following steps may further be included: obtaining the write data result feedback by the data card; modifying the data card status information according to the write data result.
[0092] The data card reading and writing method provided by the embodiments of the present application can implement the update function of the data card status information. After writing the target data to the data card, the data card will feedback the write data result to the client, such as successful card writing or failed card writing. Thus, the client can modify the data card status information according to the write data result. When the write data result is failed card writing, the data card status information can be changed from to-be-written card to failed card writing, and when the write data result is successful card writing, the data card status information can be changed from to-be-written card to successful card writing, so that technicians can timely know the write data result of the data card. In addition, in the case of failed card writing, the client can further output a failed card writing prompt for technicians to timely trace the anomaly.
[0093] It can be seen that for the data card reading and writing method provided by the present application, the server establishes a connection with the client. When a write operation needs to be performed on the data card, the server sends the target data to the client, and the client writes the target data to the data card; when a read operation needs to be performed on the data card, the client directly reads the data card to obtain the read data and stores it locally, so that the server can directly read the local storage of the client to obtain the read data. Thus, the reading and writing operations of the data card are directly implemented based on the local client without opening the remote computer port for data card reading and writing, effectively improving the data card reading and writing efficiency and further improving the user experience.
[0094] Based on the above embodiments, taking an IC card as an example, the embodiments of the present application provide an IC card reading and writing method.
[0095] Please refer to Figure 4 and Figure 5 , Figure 4 which is a flowchart of the reading and writing of an IC card provided by the present application. Among them, the server is a remote server (such as the server of a cash register system), and the client is a local client (such as the client of a cash register system); Figure 5 which is a timing diagram of an IC card reading and writing method provided by the present application. Among them, the S disk shared folder is set on the local client, and the local client is remotely connected to the server (remote server).
[0096] For example, when remotely connecting to a retail POS, a shared folder can be added to the local client. A tool for reading and writing the IC card (preset reading and writing tool) is set in the shared folder, acting as a bridge between the cash register system and the card reader. On this basis, the implementation process of the IC card reading and writing method is as follows:
[0097] (1) Write all parameter information (parameter information of the serial port for inserting the IC card) into the configuration file \\tsclient\s\SerialPort\Setting.ini under the shared folder. Among them, the "SerialPort" directory is manually created in advance, and during the actual operation, the client plugin will automatically create it; "Setting.ini" is the name of the configuration file.
[0098] (2) Transfer the read-write tool to the \\tsclient\s\SerialPort directory (the storage directory for storing the read-write tool, which can be regarded as the third storage directory). If the read-write tool has been transferred to the local client, there is no need to transfer it again.
[0099] (3) The cloud client (the client corresponding to the server, that is, the remote client) plugin runs the read-write tool, and the read-write tool reads the configuration file and restores all parameter information.
[0100] (4) Execute the serial port read operation through the read-write tool, and save the read result in S:\SerialPort\result.ini, and then notify the remote server to read \result.ini.
[0101] (5) If the status value of result.ini is 3: waiting to read card information, the remote server continues to read \\tsclient\s\SerialPort\result.ini, obtains the read data, and displays it on the remote client. At the same time, it notifies the local client that the data reading is successful, and the read-write tool rewrites the status value of result.ini to 4: reading card information successful.
[0102] (6) If the status value of result.ini is 0: waiting to make a card, the remote server obtains the data to be written (corresponding to the target data above) and feeds it back to the local client. The local client writes the data to be written into the IC card through the read-write tool, and rewrites the status value of result.ini to 1: making card successful.
[0103] Among them, the status of result.ini:
[0104] 0: waiting to make a card, 1: making card successful, 2: making card failed, 3: waiting to read card information, 4: reading card information successful, 5: reading card information failed.
[0105] In addition, the remote server can also poll the results of the S drive every 3 to 5 seconds, and notify the read-write tool in the shared folder to perform read and write operations when the status value is 3 or 0. In the above example, the storage directory where result.ini is located is both the first storage directory and the second storage directory.
[0106] It can be seen that in the method for reading and writing an IC card provided by the embodiments of the present application, a connection is established between the server and the client. When a write operation needs to be performed on the IC card, the server sends the target data to the client, and the client writes the target data into the IC card. When a read operation needs to be performed on the IC card, the client directly reads the IC card to obtain the read data and stores it locally, so that the server can directly read the local storage of the client to obtain the read data. Thus, the read and write operations of the IC card are directly implemented based on the local client, without the need to open a remote computer port for IC card reading and writing, effectively improving the IC card reading and writing efficiency and further improving the user experience.
[0107] The embodiments of the present application provide a data card reading and writing device.
[0108] Please refer to Figure 6 , Figure 6 which is a schematic structural diagram of a data card reading and writing device provided by the present application. The data card reading and writing device is applied to a server and may include:
[0109] A server information acquisition module 1, configured to acquire data card status information from a client according to a data card operation command;
[0110] A server card writing module 2, configured to acquire target data and send the target data to the client when the data card status information is to-be-written, so that the client writes the target data into the data card;
[0111] A server card reading module 3, configured to read a first storage directory of the client to obtain read data when the data card status information is to-be-read; wherein, the read data is obtained by the client reading the data card.
[0112] It can be seen that in the data card reading and writing device provided by the embodiments of the present application, a connection is established between the server and the client. When a write operation needs to be performed on the data card, the server sends the target data to the client, and the client writes the target data into the data card. When a read operation needs to be performed on the data card, the client directly reads the data card to obtain the read data and stores it locally, so that the server can directly read the local storage of the client to obtain the read data. Thus, the read and write operations of the data card are directly implemented based on the local client, without the need to open a remote computer port for data card reading and writing, effectively improving the data card reading and writing efficiency and further improving the user experience.
[0113] In an embodiment of the present application, the above-mentioned server information acquisition module 1 may be configured to read and obtain data card status information from a second storage directory of the client according to a data card operation command; wherein, the data card status information is obtained by the client reading from the data card after receiving the data card connection information.
[0114] In an embodiment of the present application, the data card reading and writing device may further include a card reading feedback module, configured to: after reading the first storage directory of the client and obtaining the read data, send a data reading success instruction to the client, so that the client modifies the data card status information according to the data reading success instruction; when the read data is not obtained from the first storage directory, send a data reading failure instruction to the client, so that the client modifies the data card status information according to the data reading failure instruction.
[0115] In an embodiment of the present application, the data card reading and writing device may further include a command receiving module, configured to receive a data card operation command sent by the client based on the data card connection information before obtaining the data card status information from the client according to the data card operation command.
[0116] In an embodiment of the present application, the data card reading and writing device may further include a command response module, configured to respond to the data card operation command at a preset time interval.
[0117] For the introduction of the device provided in the present application, please refer to the above method embodiment.
[0118] An embodiment of the present application provides a data card reading and writing device.
[0119] Please refer to Figure 7 , Figure 7 , which is a schematic structural diagram of another data card reading and writing device provided in the present application. The data card reading and writing device is applied to the client and may include:
[0120] A client information acquisition module 4, configured to acquire data card status information when receiving data card connection information;
[0121] A client card reading module 5, configured to read the data card to obtain read data when the data card status information is to-be-read card, and store the read data in the first storage directory for the server to read;
[0122] A client card writing module 6, configured to write the target data into the data card when the data card status information is to-be-written card and in the case of receiving the target data sent by the server.
[0123] In an embodiment of the present application, the above client card writing module 6 may specifically be configured to write the target data into the data card through a preset reading and writing tool; then the above client card reading module 5 may specifically be configured to read the data card through the preset reading and writing tool to obtain read data.
[0124] In an embodiment of the present application, the data card reading and writing device may further include a card writing feedback module, configured to obtain the write data result fed back by the data card after writing the target data into the data card; modify the data card status information according to the write data result.
[0125] For the introduction of the device provided in this application, please refer to the above method embodiments.
[0126] An embodiment of this application provides a computer device.
[0127] Please refer to Figure 8 , Figure 8 which is a schematic structural diagram of a computer device provided in this application. The computer device may include:
[0128] A memory 11 for storing computer programs;
[0129] A processor 10, which can implement the steps of any of the above data card reading and writing methods when executing the computer program.
[0130] As Figure 8 shown, it is a schematic structural diagram of the composition of a computer device. The computer device may include: a processor 10, a memory 11, a communication interface 12, and a communication bus 13. The processor 10, the memory 11, and the communication interface 12 all complete communication with each other through the communication bus 13.
[0131] In the embodiment of this application, the processor 10 may be a central processing unit (CPU), an application specific integrated circuit, a digital signal processor, a field programmable gate array, or other programmable logic devices, etc.
[0132] The processor 10 can call the program stored in the memory 11. Specifically, the processor 10 can execute the operations in the embodiment of the data card reading and writing method.
[0133] The memory 11 is used to store one or more programs. The program may include program codes, and the program codes include computer operation instructions. In the embodiment of this application, the memory 11 stores at least programs for implementing the following functions:
[0134] Obtain the data card status information from the client according to the data card operation command;
[0135] When the data card status information is waiting to write to the card, obtain the target data and send the target data to the client so that the client can write the target data to the data card;
[0136] When the data card status information is waiting to read the card, read the first storage directory of the client to obtain the read data; wherein, the read data is obtained by the client reading the data card.
[0137] In a possible implementation, the memory 11 may include a program storage area and a data storage area. The program storage area may store an operating system and application programs required for at least one function, etc.; the data storage area may store data created during use.
[0138] In addition, the memory 11 may include high-speed random access memory and may also include non-volatile memory, such as at least one magnetic disk storage device or other volatile solid-state storage devices.
[0139] The communication interface 12 may be an interface of a communication module for connecting to other devices or systems.
[0140] Of course, it should be noted that Figure 8 the structure shown does not constitute a limitation on the computer device in the embodiments of the present application. In practical applications, the computer device may include more or fewer components than Figure 8 those shown, or combine certain components.
[0141] The embodiments of the present application provide a computer-readable storage medium on which a computer program is stored. When the computer program is executed by a processor, the steps of any of the above data card reading and writing methods can be implemented.
[0142] The computer-readable storage medium may include: various media that can store program codes, such as USB flash drives, mobile hard disks, read-only memory (ROM), random access memory (RAM), magnetic disks, or optical discs.
[0143] For the introduction of the computer-readable storage medium provided in the present application, please refer to the above method embodiments, and the present application will not elaborate here.
[0144] The present application also provides a computer program product, which includes a computer program. When the computer program is executed by a processor, the steps of any of the above data card reading and writing methods can be implemented.
[0145] It should be noted that the information (including but not limited to user information, device information, etc.) and data (including but not limited to read data, target data, etc.) involved in the embodiments of the present application are all information and data authorized by the user or fully authorized by all parties, and the processing process of the information and data also complies with the provisions of relevant laws and regulations.
[0146] The various embodiments in the specification are described in a progressive manner. Each embodiment focuses on the differences from other embodiments. For the same or similar parts among the various embodiments, reference can be made to each other. For the devices disclosed in the embodiments, since they correspond to the methods disclosed in the embodiments, the description is relatively simple. For the relevant parts, reference can be made to the description in the method section.
[0147] Those skilled in the art can further realize that the units and algorithm steps of the examples described in conjunction with the embodiments disclosed herein can be implemented by electronic hardware, computer software, or a combination of the two. To clearly illustrate the interchangeability of hardware and software, the components and steps of the examples have been generally described according to their functions in the above description. Whether these functions are executed in a hardware or software manner depends on the specific application and design constraints of the technical solution. Those skilled in the art can use different methods to implement the described functions for each specific application, but such implementation should not be considered to exceed the scope of this application.
[0148] The steps of the methods or algorithms described in conjunction with the embodiments disclosed herein can be directly implemented by hardware, software modules executed by a processor, or a combination of the two. The software modules can be placed in a random access memory (RAM), internal memory, read-only memory (ROM), electrically programmable ROM, electrically erasable programmable ROM, registers, hard disk, removable disk, CD-ROM, or any other form of storage medium well-known in the technical field.
[0149] The technical solutions provided in this application have been introduced in detail above. Specific examples are used herein to elaborate on the principles and implementation manners of this application. The description of the above embodiments is only used to help understand the method and its core idea of this application. It should be noted that for those of ordinary skill in the art in this technical field, without departing from the principle of this application, several improvements and modifications can be made to this application, and these improvements and modifications also fall within the protection scope of this application.
Claims
1. A method for reading and writing a data card, characterized in that Applied to the server side, including: Obtain the data card status information from the second storage directory of the client according to the data card operation command; When the data card status information is waiting to write to the card, obtain the target data and send the target data to the client, so that the client uses the preset reading and writing tool to write the target data to the data card; When the data card status information is waiting to read the card, read the first storage directory of the client to obtain the read data; wherein, the read data is obtained by the client using the preset reading and writing tool to read the data card; The preset reading and writing tool is deployed in the shared folder of the client, and both the first storage directory and the second storage directory are storage directories in the shared folder; Poll the data card status information in the shared folder at preset time intervals, and control the preset reading and writing tool to perform reading and writing operations on the data card according to the data card status information; Wherein, the obtaining of the target data includes: sending a data acquisition request to the remote client, so that the remote client outputs the prompt information about the target data in the data acquisition request to the front-end interface; receiving the target data obtained by the remote client through the front-end interface.
2. The data card reading and writing method according to claim 1, wherein The data card status information is obtained by the client reading from the data card after receiving the data card connection information.
3. The data card reading and writing method according to claim 1, wherein After reading the first storage directory of the client to obtain the read data, it further includes: Sending a data reading success instruction to the client, so that the client modifies the data card status information according to the data reading success instruction; The method further includes: When the read data is not obtained from the first storage directory, sending a data reading failure instruction to the client, so that the client modifies the data card status information according to the data reading failure instruction.
4. The data card reading and writing method according to claim 1, characterized in that Before obtaining the data card status information from the client according to the data card operation command, it further includes: Receiving the data card operation command sent by the client based on the data card connection information.
5. A method for reading and writing a data card, characterized in that, Applied to the client side, including: When receiving the data card connection information, obtain the data card status information and save it to the second storage directory for the server to read; When the data card status information is waiting to read the card, use the preset reading and writing tool to read the data card to obtain the read data, and store the read data in the first storage directory for the server to read; When the data card status information is waiting to write to the card, in the case of receiving the target data sent by the server, use the preset reading and writing tool to write the target data to the data card; The preset reading and writing tool is deployed in the shared folder of the client, and both the first storage directory and the second storage directory are storage directories in the shared folder; Wherein, the process of the server obtaining the target data includes: the server sending a data acquisition request to the remote client, so that the remote client outputs the prompt information about the target data in the data acquisition request to the front-end interface; receiving the target data obtained by the remote client through the front-end interface; The server is also used to poll the status information of the data card in the shared folder at a preset time interval, and control the preset reading and writing tool to perform reading and writing operations on the data card according to the status information of the data card.
6. The data card reading and writing method according to claim 5, wherein After writing the target data to the data card, it further includes: Obtaining the write data result feedback by the data card; Modifying the status information of the data card according to the write data result.
7. A data card reading and writing device, characterized in that, Applied to the server, it includes: A server information acquisition module, configured to acquire the status information of the data card from the second storage directory of the client according to the data card operation command; A server card writing module, configured to, when the status information of the data card is to-be-written, acquire the target data and send the target data to the client, so that the client uses a preset reading and writing tool to write the target data to the data card; A server card reading module, configured to, when the status information of the data card is to-be-read, use the preset reading and writing tool to read the first storage directory of the client to obtain the read data; wherein, the read data is obtained by the client reading the data card; The preset reading and writing tool is deployed in the shared folder of the client, and both the first storage directory and the second storage directory are storage directories in the shared folder; A polling module, configured to poll the status information of the data card in the shared folder at a preset time interval, and control the preset reading and writing tool to perform reading and writing operations on the data card according to the status information of the data card; Wherein, the server card writing module can be specifically configured to send a data acquisition request to a remote client, so that the remote client outputs the prompt information about the target data in the data acquisition request to the front-end interface; and receive the target data acquired by the remote client through the front-end interface.
8. A data card reading and writing device, characterized in that, Applied to the client, it includes: A client information acquisition module, configured to, when receiving the data card connection information, acquire the status information of the data card and save it to the second storage directory for the server to read; A client card reading module, configured to, when the status information of the data card is to-be-read, use a preset reading and writing tool to read the data card to obtain the read data, and store the read data to the first storage directory for the server to read; A client card writing module, configured to, when the status information of the data card is to-be-written, and in the case of receiving the target data sent by the server, use the preset reading and writing tool to write the target data to the data card; The preset reading and writing tool is deployed in the shared folder of the client, and both the first storage directory and the second storage directory are storage directories in the shared folder; Wherein, the process for the server to obtain the target data includes: the server sends a data acquisition request to a remote client, so that the remote client outputs the prompt information about the target data in the data acquisition request to the front-end interface; and receive the target data acquired by the remote client through the front-end interface; The server is further configured to poll the status information of the data card in the shared folder at a preset time interval, and control the preset reading and writing tool to perform reading and writing operations on the data card according to the status information of the data card.
9. A computer device, characterized in that, including: a memory for storing a computer program; a processor for implementing the steps of the data card reading and writing method according to any one of claims 1 to 4, or the steps of the data card reading and writing method according to claim 5 or 6 when executing the computer program.
10. A computer-readable storage medium, characterized in that, A computer program is stored on the computer-readable storage medium, and when the computer program is executed by a processor, the steps of the data card reading and writing method according to any one of claims 1 to 4, or the steps of the data card reading and writing method according to claim 5 or 6 are implemented.
Citation Information
Patent Citations
File exchange based B / S system card reading and writing method
CN103049776A