CN104484292B - A kind of drive device and its method of work suitable for serial equipment - Google Patents

A kind of drive device and its method of work suitable for serial equipment Download PDF

Info

Publication number
CN104484292B
CN104484292B CN201410840549.1A CN201410840549A CN104484292B CN 104484292 B CN104484292 B CN 104484292B CN 201410840549 A CN201410840549 A CN 201410840549A CN 104484292 B CN104484292 B CN 104484292B
Authority
CN
China
Prior art keywords
drive device
data
serial
card
information
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN201410840549.1A
Other languages
Chinese (zh)
Other versions
CN104484292A (en
Inventor
陆舟
于华章
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Feitian Technologies Co Ltd
Original Assignee
Feitian Technologies Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Feitian Technologies Co Ltd filed Critical Feitian Technologies Co Ltd
Priority to CN201410840549.1A priority Critical patent/CN104484292B/en
Publication of CN104484292A publication Critical patent/CN104484292A/en
Application granted granted Critical
Publication of CN104484292B publication Critical patent/CN104484292B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F13/00Interconnection of, or transfer of information or other signals between, memories, input/output devices or central processing units
    • G06F13/10Program control for peripheral devices
    • G06F13/102Program control for peripheral devices where the programme performs an interfacing function, e.g. device driver
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F2213/00Indexing scheme relating to interconnection of, or transfer of information or other signals between, memories, input/output devices or central processing units
    • G06F2213/0002Serial port, e.g. RS232C

Abstract

The invention discloses a kind of drive device and its method of work suitable for serial equipment, by using the drive device based on UMDF on main frame, serial equipment and the PC/SC interfaces of system are mounted, the application program in main frame is enabled to use serial equipment conveniently by PC/SC interfaces, any change need not be done to application program, the reusability of application program is improved.

Description

A kind of drive device and its method of work suitable for serial equipment
Technical field
The present invention relates to communication technical field, more particularly to a kind of drive device and its work side suitable for serial equipment Method.
Background technology
Serial equipment is the external equipment for referring to carry out serial communication with main frame, and a data can be used in serial communication Line, data step-by-step is transmitted successively, and each data occupies a regular time length, it is adaptable to main frame and external equipment it Between telecommunication.Conventional serial equipment has External modem, plotter, serial printer and Bluetooth adapter Deng.
In the prior art, the serial equipment being connected for use with main frame, it usually needs carried out to the application program in main frame Rewrite, cause the reusability of application program poor, it is impossible to easily use serial equipment in application layer.
The content of the invention
The invention provides a kind of drive device and its method of work suitable for serial equipment, to solve to apply Layer easily uses the defect of serial equipment.
The invention provides a kind of method of work of the drive device suitable for serial equipment, applied to including main frame and string In the system of jaws equipment, the main frame is connected with the serial equipment, and system, application program and driving are provided with the main frame Device, after personal computer/smart card PC/SC interfaces of system described in the application call, in the drive device Preset function called by the system, the described method comprises the following steps:
S1, the drive device wait called;
S2, when the preset function in the drive device is called by system, the drive device passes through component object mould Type com interface obtains the control code from system, and the control code is judged, if the control code is default control Code, then perform step S3;If the control code is not default control code, corresponding operation is performed according to the control code, and Return to step S1;
S3, the drive device organize corresponding first serial data according to default control code, by serial ports by institute State first serial data and be sent to serial equipment, com-state is set to original state by the drive device;
S4, the drive device are listened to after reading event, and the second application data is read from processing buffering area, will be described Second application data is sent to system, and return to step S1;
Before the step S4, in addition to:
A1, the drive device monitor Serial Port Event, after data event is listened to, and receive from the serial equipment Second serial data;
The second serial data Cun Chudao is received buffering area by A2, the drive device, to the second serial data Handled, second application data that processing is obtained is written in the processing buffering area, and has read thing described in setting Part;
The step A2, is specifically included:
B1, the drive device are judged the com-state, if original state, then perform step B2;Such as Fruit is state of activation, then performs step B6;If unactivated state, then step B9 is performed;
B2, the drive device are initialized to the reception buffering area, by the second serial data Cun Chudao institutes State reception buffering area;
B3, the drive device are handled the second serial data, by handle obtain described second apply number According to being written in the processing buffering area, judge whether data receive, if it is, performing step B5;Otherwise, step is performed Rapid B4;
Com-state is set to state of activation by B4, the drive device, resets Serial Port Event;
Com-state is set to unactivated state by B5, the drive device, resets Serial Port Event, and read thing described in setting Part;
B6, the drive device will receive buffering area described in the second serial data Cun Chudao, by the second serial The second application data in data is written in the processing buffering area, judges whether data receive, if it is, performing Step B8;Otherwise, step B7 is performed;
B7, the drive device reset Serial Port Event;
The com-state is set to unactivated state by B8, the drive device, resets Serial Port Event;
B9, the drive device reset Serial Port Event.
Present invention also offers a kind of drive device suitable for serial equipment, applied to including main frame and serial equipment In system, the main frame is connected with the serial equipment, and system, application program and drive device are provided with the main frame, when After the personal computer of system described in the application call/smart card PC/SC interfaces, the default letter in the drive device Number is called by the system, and the drive device includes:
First acquisition module, when being called for the preset function in the drive device by system, passes through component object MODEL C OM interfaces obtain the control code from system;
First judge module, for judging the control code that first acquisition module is got;
First processing module, for first judge module judge the control code for default control code when, root According to default control code, corresponding first serial data are organized, the first serial data are sent to by serial ports by serial ports Equipment;
First monitors module, and event has been read for monitoring;
Second processing module, for after the described first monitoring module listens to reading event, being read from processing buffering area The second application data is taken, second application data is sent to system;
Second monitors module, for monitoring Serial Port Event;
First receiving module, is listened to after data event, reception is set from the serial ports used in the described second monitoring module Standby second serial data;
3rd processing module, the second serial data Cun Chudao for first receiving module to be received is received The second serial data are handled by buffering area, and second application data that processing is obtained is written to the processing In buffering area, and event is read described in setting;
First setup module, for the first serial data to be sent into institute by serial ports in the first processing module State after serial equipment, com-state is set to original state;
3rd processing module, including:
First judging submodule, for judging the com-state;
First processing submodule, for judging that the com-state is original state in first judging submodule When, the reception buffering area is initialized, buffering area will be received described in the second serial data Cun Chudao;
Second processing submodule, for handling the second serial data, by handle obtain described second should It is written to data in the processing buffering area, triggers the second judging submodule;
Second judging submodule, for judging whether data receive;
First sets submodule, for after second judging submodule judges that data are not received, by serial ports State is set to state of activation, resets Serial Port Event;After second judging submodule judges that data receiver is finished, by serial ports State is set to unactivated state, resets Serial Port Event, and read event described in setting;
Second processing submodule, for judging that the com-state is state of activation in first judging submodule When, buffering area will be received described in the second serial data Cun Chudao, by the second application data in the second serial data It is written in the processing buffering area, judges whether data receive;
Second sets submodule, for after the second processing submodule judges that data are not received, resetting string Mouth event;After the second processing submodule judges that data receiver is finished, com-state is set to unactivated state, reset Serial Port Event;When it is state of activation that first judging submodule, which judges the com-state, Serial Port Event is reset.
The beneficial effect that the present invention reaches:UMDF (User-Mode Driver are based on by being used on main frame Framework, user model driver framework) drive device, serial equipment and the PC/SC interfaces of system are mounted so that main Application program in machine can use serial equipment conveniently by PC/SC interfaces, it is not necessary to any change is done to application program, Improve the reusability of application program.
Brief description of the drawings
Fig. 1 is the system architecture signal where a kind of drive device suitable for serial equipment in the embodiment of the present invention Figure;
Fig. 2 and Fig. 3 be the embodiment of the present invention in a kind of drive device suitable for serial equipment method of work flow Figure;
Fig. 4 be the embodiment of the present invention in a kind of drive device suitable for serial equipment serial ports watcher thread work Flow chart;
Fig. 5 be the embodiment of the present invention in a kind of drive device suitable for serial equipment structural representation.
Embodiment
Below in conjunction with the accompanying drawing in the embodiment of the present invention, the technical scheme in the embodiment of the present invention is carried out clear, complete Site preparation is described, it is clear that described embodiment is only a part of embodiment of the invention, rather than whole embodiments.It is based on Embodiment in the present invention, it is every other that those of ordinary skill in the art are obtained under the premise of creative work is not made Embodiment, belongs to the scope of protection of the invention.
The embodiments of the invention provide a kind of method of work of the drive device suitable for serial equipment, applied to including string In the system of jaws equipment and main frame, serial equipment is connected with main frame, as shown in figure 1, including application program, system and drive in main frame Dynamic device, the drive device is the drive device based on UMDF.After serial equipment is opened, the system loads driving dress in main frame Put, open serial ports;Drive device creates IO queues, the IO queues are by system maintenance by after system loads to system application.Driving Device obtains the data from system by carrying out read operation to input block;By carrying out write operation to output buffer, To system returned data.
PC/SC (the Personal Computer/Smart Card, individual calculus of application call system in main frame Machine/smart card) after interface, I/O message is passed to IO queues by system;After I/O message reaches IO queues, system calls driving to fill Preset function in putting, handles the I/O message.The method of work of above-mentioned drive device, as shown in Figures 2 and 3, including following step Suddenly:
Step 101, drive device waits called.
Step 102, when the preset function in drive device is called by system, drive device obtains the control from system Code and I/O Request.
Specifically, when the preset function in drive device is called by system, drive device passes through COM (Component Object Model, The Component Object Model) interface obtain kernel-driven forwarding control code and I/O Request.Wherein, preset function For ProcessIoControl functions, kernel-driven is WDF (Windows Driver Foundation, the basic structure of form driving Frame).
Step 103, drive device is judged the control code got, if attribute retrieval request, then performs step Rapid 104;If property setting request, then step 113 is performed;If state obtains request, then step 117 is performed;If It is card power-up request, then performs step 118;If plug-in card judges request, then step 122 is performed;If pulling out card judgement Request, then perform step 126;If instruction sends request, then step 130 is performed.
Step 104, drive device is changed to the I/O Request got, obtains request code.
Step 105, drive device is judged request code, if manufacturer's name obtains request, then performs step 106; If IFD (Interface Device, interface equipment) type obtains request, then step 107 is performed;If unit Request is obtained, then performs step 108;If feature description obtains request, then step 109 is performed;If protocol type is obtained Request is taken, then performs step 110;If ATR (Answer To Reset, reset answer) character string obtains request, then perform Step 111;If other, then perform step 112.
Step 106, the manufacturer itself preserved name is written to output buffer, and return to step 101 by drive device.
For example, the manufacturer itself preserved name " Feitian " is written to output buffer by drive device.
Step 107, the IFD type informations itself preserved are written to output buffer, and return to step by drive device 101。
For example, drive device is by the IFD type informations itself preserved, " bR301 Smartcard reader " are written to defeated Go out buffering area.
Step 108, the unit that itself is preserved is written to output buffer, and return to step 101 by drive device.
For example, the unit " 0 " that drive device preserves itself is written to output buffer.
Step 109, the characterization information that itself is preserved is written to output buffer, and return to step by drive device 101。
For example, the characterization information " 0 " that drive device preserves itself is written to output buffer.
Step 110, the Current protocol type information itself preserved is written to output buffer by drive device, and returns to step Rapid 101.
Wherein, Current protocol type information is that the ATR character strings from serial equipment are carried out by drive device to parse Arrive.
For example, drive device the Current protocol type information " SCARD_PROTOCOL_T0 " itself preserved is written to it is defeated Go out buffering area.
Step 111, the ATR character strings itself preserved are written to output buffer, and return to step 101 by drive device.
For example, drive device is by the 4F of 45 4A of ATR character string 3F FA 00 00 81 31 FE of A6 43 itself preserved 50 34 31 56 32 32 31 23 " it is written to output buffer.
Step 112, error code is written to output buffer, and return to step 101 by drive device.
For example, error code " ERROR_NOT_SUPPORTED " is written to output buffer by drive device.
Step 113, drive device reading attributes information from input block, tissue is carried out to attribute information, obtains the First serial data are sent to serial equipment by serial ports, com-state are set into original state, will connect by one serial data Receipts data length is set to zero, after reading event is listened to, and read the second application data from processing buffering area sets as serial ports The standby setting response returned.
Specifically, drive device is combined to the first packet header and attribute information, obtains first serial data.Wherein, belong to Property information include one or more groups of attribute lists, every group of attribute list includes Property ID and property value.
Step 114, drive device is according to setting response to judge whether to set successfully, if it is, performing step 115;It is no Then, step 116 is performed.
Step 115, drive device will set response to be written to output buffer, and itself preservation is updated according to attribute information Attribute data, and return to step 101.
Wherein, attribute data includes manufacturer's name, IFD type informations, unit, characterization information and Current protocol class One or more in type information.
Step 116, drive device will set response to be written to output buffer, and return to step 101.
For example, drive device will set response " ERROR_NOT_SUPPORTED " to be written to output buffer.
Step 117, drive device reads card mode information, card mode information is written into output buffer, and return Return step 101.
For example, drive device reads card mode information " SCARD_ABSENT ", by card mode information " SCARD_ ABSENT " is written to output buffer.
Step 118, drive device tissue electricity instruction, is sent to serial equipment, by serial ports by serial ports by upper electricity instruction State is set to original state, and data accepted length is set into zero, after reading event is listened to, in reading process buffering area Second application data, is preserved the second application data as the ATR character strings that serial equipment is returned.
For example, drive device sends upper electricity instruction " 0,x62 00 00 00 00 00 " to serial equipment, serial equipment is received The ATR character strings " 4F 50 34 31 56 32 32 31 23 of 45 4A of 3F FA 00 00 81 31 FE of A6 43 " of return.
Step 119, drive device judges whether upper electricity success according to ATR character strings, if it is, performing step 120;It is no Then, step 121 is performed.
Step 120, ATR character strings are written to output buffer, and return to step 101 by drive device.
For example, drive device is by the 4F 50 34 31 of 45 4A of ATR character string 3F FA 00 00 81 31 FE of A6 43 56 32 32 31 23 " it is written to output buffer.
Step 121, upper electric failure information is written to output buffer, and return to step 101 by drive device.
For example, upper electric failure information " SCARD_ABSENT " is written to output buffer by drive device.
Step 122, drive device reads card mode information.
For example, drive device reads card mode information " SCARD_PRESENT ".
Step 123, drive device judges whether there is card in serial equipment according to card mode information, if it is, performing Step 124;Otherwise, step 125 is performed.
Specifically, when card mode information is " SCARD_PRESENT ", drive device determines there is card in serial equipment; When card mode information is " SCARD_ABSENT ", drive device is determined in serial equipment without card.
Step 124, plug-in card information is written to output buffer, and return to step 101 by drive device.
For example, plug-in card information " STATUS_SUCCESS " is written to output buffer by drive device.
Step 125, drive device cancels operation, and return to step 101.
Step 126, drive device reads card mode information.
For example, drive device reads card mode information " SCARD_PRESENT ".
Step 127, drive device judges whether there is card in serial equipment according to card mode information, if it is, performing Step 128;Otherwise, step 129 is performed.
Specifically, when card mode information is " SCARD_PRESENT ", drive device determines there is card in serial equipment; When card mode information is " SCARD_ABSENT ", drive device is determined in serial equipment without card.
Step 128, drive device cancels operation, and return to step 101.
Step 129, drive device will pull out card information and be written to output buffer, and return to step 101.
For example, drive device, which will pull out card information " STATUS_SUCCESS ", is written to output buffer.
Step 130, drive device reads the first application data from input block, to the first application data carry out group Knit, obtain first serial data.
Specifically, drive device is read from input block after the first application data, and the first packet header and first are applied Data are combined, and obtain first serial data.Wherein, the length in the first packet header is 10 bytes.
For example, the first application data that drive device is read from input block is " F0 of 00 B0 00 00 ", the One packet header is " 6f 05 00 00 00 00 00 00 00 00 ", and it is " 6f 05 00 00 to organize obtained first serial data 00 00 00 00 00 00 00 B0 00 00 F0”。
Step 131, first serial data are sent to serial equipment by drive device by serial ports, and com-state is set to just Beginning state, zero is set to by data accepted length.
For example, drive device by serial ports by the serial data " B0 of 6f 05 00 00 00 00 00 00 00 00 00 0000 F0 " is sent to serial equipment.
Step 132, drive device is listened to after reading event, the second application data is read from processing buffering area, by the Two application datas are written to output buffer, and return to step 101.
For example, the second application data that drive device reads from processing buffering area and is written in output buffer is:
“00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F 10 11 12 13 14 15 16 17 18 19 1A 1B 1C 1D 1E 1F 20 21 22 23 24 25 26 27 28 29 2A 2B 2C 2D 2E 2F 30 31 32 33 34 35 36 37 38 39 3A 3B 3C 3D 3E 3F 40 41 42 43 44 45 46 47 48 49 4A 4B 4C 4D 4E 4F 50 51 52 53 54 55 56 57 58 59 5A 5B 5C 5D 5E 5F 60 61 62 63 64 65 66 67 68 69 6A 6B 6C 6D 6E 6F 70 71 72 73 74 75 76 77 78 79 7A 7B 7C 7D 7E 7F 80 81 82 83 84 85 86 87 88 89 8A 8B 8C 8D 8E 8F 90 91 92 93 94 95 96 97 98 99 9A 9B 9C 9D 9E 9F A0 A1 A2 A3 A4 A5 A6 A7 A8 A9 AA AB AC AD AE AF B0 B1 B2 B3 B4 B5 B6 B7 B8 B9 BA BB BC BD BE BF C0 C1 C2 C3 C4 C5 C6 C7 C8 C9 CA CB CC CD CE CF D0 D1 D2 D3 D4 D5 D6 D7 D8 D9 DA DB DC DD DE DF E0 E1 E2 E3 E4 E5 E6 E7 E8 E9 EA EB EC ED EE EF”。
It should be noted that being the workflow of the main thread of drive device above.Drive device is also monitored by serial ports Thread receives and handles second serial data, as shown in figure 4, comprising the following steps:
Step 201, drive device monitors Serial Port Event.
Step 202, after data event is listened to, drive device receives second serial data.
Step 203, drive device is judged com-state, if original state, then performs step 204;If It is state of activation, then performs step 212;If unactivated state, then step 218 is performed.
Step 204, drive device is initialized to receiving buffering area, and the second serial data Cun Chudao received is connect Receive buffering area.
For example, the second serial data that drive device is received and stored in reception buffering area are:“80 f0 00 00 00 00 00 00 00 00 00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F 10 11 12 13 14 15 16 17 18 19 1A 1B 1C 1D 1E 1F 20 21 22 23 24 25 26 27 28 29 2A 2B 2C 2D 2E 2F 30 31 32 33 34 35 36 37 38 39 3A 3B 3C 3D 3E 3F 40 41 42 43 44 45 46 47 48 49 4A 4B 4C 4D 4E 4F 50 51 52 53 54 55 56 57 58 59 5A 5B 5C 5D 5E 5F 60 61 62 63 64 65 66 67 68 69 6A 6B 6C 6D 6E 6F 70 71 72 73 74 75 76 77 78 79 7A 7B 7C 7D 7E 7F 80 81 82 83 84”。
Step 205, drive device obtains valid data length from second serial data, and valid data length is protected Deposit.
In the present embodiment, drive device is by the second byte, the 3rd byte, nybble and the 5th word in second serial data The data of section are used as valid data length.
For example, second serial data are " 80 f0 00 00 00 00 00 00 00 00 00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F 10 11 12 13 14 15 16 17 18 19 1A 1B 1C 1D 1E 1F 20 21 22 23 24 25 26 27 28 29 2A 2B 2C 2D 2E 2F 30 31 32 33 34 35 36 37 38 39 3A 3B 3C 3D 3E 3F 40 41 42 43 44 45 46 47 48 49 4A 4B 4C 4D 4E 4F 50 51 52 53 54 55 56 57 58 59 5A 5B 5C 5D 5E 5F 60 61 62 63 64 65 66 67 68 69 6A 6B 6C 6D The 7A 7B 7C 7D 7E 7F 80 81 82 83 84 of 6E 6F 70 71 72 73 74 75 76 77 78 79 ", driving dress Put and regard the data " f0 00 00 00 " of the second byte, the 3rd byte, nybble and the 5th byte as valid data length.
Step 206, drive device judges whether plug information comprising card in second serial data, if it is, performing Step 207;Otherwise, step 208 is performed.
Specifically, drive device judges whether the data of most latter two byte of second serial data are card plug letter Breath, if it is, determining in second serial data comprising card plug information;Otherwise, it determines not including in second serial data Card plugs information.Wherein, card plug information can be plug-in card information or pull out card information.
For example, plug-in card information is " 50 03 ", card information is pulled out for " 50 02 ", second serial data are:“80 f0 00 00 00 00 00 00 00 00 00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F 10 11 12 13 14 15 16 17 18 19 1A 1B 1C 1D 1E 1F 20 21 22 23 24 25 26 27 28 29 2A 2B 2C 2D 2E 2F 30 31 32 33 34 35 36 37 38 39 3A 3B 3C 3D 3E 3F 40 41 42 43 44 45 46 47 48 49 4A 4B 4C 4D 4E 4F 50 51 52 53 54 55 56 57 58 59 5A 5B 5C 5D 5E 5F 60 61 62 63 64 65 66 67 68 69 6A 6B 6C 6D 6E 6F 70 71 72 73 74 75 76 77 78 79 7A 7B 7C 7D 7E 7F 80 81 82 83 84 ", then drive device, which can determine that, does not include card plug information in second serial data.
Step 207, drive device plugs information updating card mode information according to card, and performs step 208.
Specifically, if card plug information is plug-in card information, card mode information updating is to have card-like by drive device State;If card plug information is pulls out card information, card mode information updating is without card-like state by drive device.
Step 208, drive device is handled second serial data, and the second application data that processing is obtained is written to Handle in buffering area, data accepted length is updated according to the length of the second application data.
Specifically, if plugging information comprising card in second serial data, drive device will be removed in second serial data The data that card plugs outside information and the second packet header are written in processing buffering area as the second application data, will receive number The length of the second application data is added according to length, the data accepted length after renewal is used as;If in second serial data not Information is plugged comprising card, drive device regard the data in second serial data in addition to the second packet header as the second application data It is written in processing buffering area, data accepted length is added to the length of the second application data, the reception after renewal is used as Data length.
In the present embodiment, the second packet header be second serial data in preceding ten bytes data.
For example, second serial data are " 80 f0 00 00 00 00 00 00 00 00 00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F 10 11 12 13 14 15 16 17 18 19 1A 1B 1C 1D 1E 1F 20 21 22 23 24 25 26 27 28 29 2A 2B 2C 2D 2E 2F 30 31 32 33 34 35 36 37 38 39 3A 3B 3C 3D 3E 3F 40 41 42 43 44 45 46 47 48 49 4A 4B 4C 4D 4E 4F 50 51 52 53 54 55 56 57 58 59 5A 5B 5C 5D 5E 5F 60 61 62 63 64 65 66 67 68 69 6A 6B 6C 6D During the 7A 7B 7C 7D 7E 7F 80 81 82 83 84 of 6E 6F 70 71 72 73 74 75 76 77 78 79 ", second Do not include card in serial data and plug information, drive device will remove " 80 f0 00 00 00 in above-mentioned second serial data 00 00 00 00 00 " data after are written in processing buffering area as the second application data.
Step 209, drive device judges whether data accepted length is less than valid data length, if it is, performing Step 210;Otherwise, step 211 is performed.
Step 210, com-state is set to state of activation by drive device, resets Serial Port Event, and return to step 201.
Step 211, com-state is set to unactivated state by drive device, and event has been read in setting, resets Serial Port Event, and Return to step 201.
Step 212, drive device judges whether plug information comprising card in second serial data, if it is, performing Step 213;Otherwise, step 214 is performed.
Wherein, card plug information can be plug-in card information or pull out card information.
For example, plug-in card information is " 50 03 ", card information is pulled out for " 50 02 ", second serial data are:“85 86 87 88 89 8A 8B 8C 8D 8E 8F 90 91 92 93 94 95 96 97 98 99 9A 9B 9C 9D 9E 9F A0 A1 A2 A3 A4 A5 A6 A7 A8 A9 AA AB AC AD AE AF B0 B1 B2 B3 B4 B5 B6 B7 B8 B9 BA BB BC BD BE BF C0 C1 C2 C3 C4 C5 C6 C7 C8 C9 CA CB CC CD CE CF D0 D1 D2 D3 D4 D5 D6 D7 D8 D9 DA DB DC DD DE DF E0 E1 E2 E3 E4 E5 E6 E7 E8 E9 EA EB EC ED EE EF 50 02 ", then drive device, which can determine that, includes card plug information in second serial data.
Step 213, drive device plugs information updating card mode information according to card, card will be removed in second serial data Data outside piece plug information are written in processing buffering area as the second application data, according to the length of the second application data Data accepted length is updated, and performs step 215.
For example, second serial data are " 85 86 87 88 89 8A 8B 8C 8D 8E 8F 90 91 92 93 94 95 96 97 98 99 9A 9B 9C 9D 9E 9F A0 A1 A2 A3 A4 A5 A6 A7 A8 A9 AA AB AC AD AE AF B0 B1 B2 B3 B4 B5 B6 B7 B8 B9 BA BB BC BD BE BF C0 C1 C2 C3 C4 C5 C6 C7 C8 C9 CA CB CC CD CE CF D0 D1 D2 D3 D4 D5 D6 D7 D8 D9 DA DB DC DD DE DF E0 E1 E2 During E3 E4 E5 E6 E7 E8 E9 EA EB EC ED EE EF 50 02 ", drive device is by above-mentioned second serial data The data after " 50 02 " are removed to be written in processing buffering area as the second application data.
Step 214, drive device is written to second serial data as the second application data in processing buffering area, according to The length of second serial data updates data accepted length, and performs step 215.
Specifically, drive device by data accepted length add second serial data length, as after renewal Receive data length.
Step 215, drive device judges whether data accepted length is less than valid data length, if it is, performing Step 216;Otherwise, step 217 is performed.
Step 216, drive device resets Serial Port Event, and return to step 201.
Step 217, com-state is set to unactivated state by drive device, and event has been read in setting, resets Serial Port Event, and Return to step 201.
Step 218, drive device judges whether plug information comprising card in second serial data, if it is, performing Step 219;Otherwise, step 220 is performed.
Step 219, drive device obtains card plug information from second serial data, and information updating is plugged according to card Card mode information, and perform step 220.
Step 220, drive device resets Serial Port Event, and return to step 201.
The embodiment of the present invention on main frame by using the drive device based on UMDF, by serial equipment and the PC/ of system SC interfaces are mounted so that the application program in main frame can be conveniently by PC/SC interface interchange serial equipments, it is not necessary to correspondence Any change is made of program, the reusability of application program is improved.
Based on the method for work of the above-mentioned drive device suitable for serial equipment, the embodiment of the present invention additionally provides a kind of suitable For the drive device of serial equipment, applied in the system including main frame and serial equipment, main frame is connected with serial equipment, main System, application program and drive device are installed, after the PC/SC interfaces of application call system, in drive device in machine Preset function called by system.Above-mentioned drive device, as shown in figure 5, including:
First acquisition module 510, when being called for the preset function in drive device by system, passes through component object mould Type com interface obtains the control code from system;
Specifically, above-mentioned first acquisition module 510, is called specifically for the preset function in drive device by system When, the control code that kernel-driven is forwarded is obtained by com interface.
Wherein, kernel-driven is WDF.
First judge module 520, for judging the control code that the first acquisition module 510 is got;
First processing module 530, for the first judge module 520 judge control code for default control code when, according to Default control code, organizes corresponding first serial data, first serial data is sent into serial equipment by serial ports;
Wherein, above-mentioned default control code can be card power-up request, and the second application data is ATR character strings;
Correspondingly, above-mentioned first processing module 530, specifically for judging that control code is card in the first judge module 520 During piece power-up request, upper electricity instruction is sent to serial equipment by tissue electricity instruction by serial ports.
Above-mentioned default control code can also send request for instruction;
Correspondingly, above-mentioned first processing module 530, including:
The first tissue submodule, for when the first judge module 520 judges that control code sends request for instruction, to coming Tissue is carried out from the first application data of system, first serial data are obtained;
First sending submodule, the first serial data for being obtained the first tissue submodule tissue by serial ports are sent To serial equipment.
First monitors module 540, and event has been read for monitoring;
Second processing module 550, for after the first monitoring module 540 listens to reading event, from processing buffering area The second application data is read, the second application data is sent to system;
Specifically, above-mentioned Second processing module 550, specifically for first monitoring module 540 listen to reading event after, The second application data is read from processing buffering area, by writing the second application data to output buffer, number is applied by second According to being sent to system.
Wherein, above-mentioned default control code can be property setting request, and the second application data responds to set;
Correspondingly, above-mentioned first processing module 530, including:
Minor microstructure submodule, for when it is property setting request that the first judge module 520, which judges control code, to coming Tissue is carried out from the attribute information of system, first serial data are obtained;
Second sending submodule, the first serial data for being obtained minor microstructure submodule tissue by serial ports are sent To serial equipment;
Above-mentioned Second processing module 550, specifically for after the first monitoring module 540 listens to reading event, from processing Read in buffering area and response is set, according to setting response to judge whether to set successfully, if it is, being by setting response to be sent to System, the attribute data of itself preservation is updated according to attribute information;Otherwise, response will be set to be sent to system.
Second monitors module 560, for monitoring Serial Port Event;
First receiving module 570, listens to after data event used in the second monitoring module 560, receives and come from serial equipment Second serial data;
3rd processing module 580, the second serial data Cun Chudao for the first receiving module 570 to be received receives slow Area is rushed, second serial data are handled, the second application data that processing is obtained is written in processing buffering area, and is set Event is read.
Specifically, above-mentioned 3rd processing module 580, specifically for the second serial for receiving the first receiving module 570 Data Cun Chudao receives buffering area, and when plugging information comprising card in second serial data, information updating is plugged according to card Data in second serial data in addition to card plugs information and the second packet header are applied number by card mode information as second Handled according to being written in buffering area;When not including card plug information in second serial data, it will be removed in second serial data Data outside second packet header are written in processing buffering area as the second application data.
Further, above-mentioned drive device, in addition to:
Second acquisition module, for by reading input block, obtaining the first application data from system.
Correspondingly, above-mentioned the first tissue submodule, specifically for judging that control code is instruction in the first judge module 520 When sending request, the first packet header and the first application data are combined, first serial data are obtained.
Further, above-mentioned drive device, in addition to:
3rd acquisition module, for by reading input block, obtaining the attribute information from system.
Correspondingly, above-mentioned minor microstructure submodule, specifically for being combined to the first packet header and attribute information, obtains One serial data.
Further, above-mentioned drive device, in addition to:
First setup module, sets for first serial data to be sent into serial ports by serial ports in first processing module 530 After standby, com-state is set to original state;
Correspondingly, above-mentioned 3rd processing module 580, including:
First judging submodule, for judging com-state;
First processing submodule, for when it is original state that the first judging submodule, which judges com-state, to receiving Buffering area is initialized, and second serial data Cun Chudao is received into buffering area;
Second processing submodule, for handling second serial data, the second application data that processing is obtained is write Enter into processing buffering area, trigger the second judging submodule;
Second judging submodule, for judging whether data receive;
First sets submodule, for after the second judging submodule judges that data are not received, by com-state State of activation is set to, Serial Port Event is reset;After the second judging submodule judges that data receiver is finished, com-state is set to Unactivated state, resets Serial Port Event, and event has been read in setting;
Second processing submodule, for when it is state of activation that the first judging submodule, which judges com-state, by second The second application data in second serial data is written in processing buffering area, sentenced to buffering area is received by serial data storage Whether disconnected data receive;
Second sets submodule, for after second processing submodule judges that data are not received, resetting serial ports thing Part;After second processing submodule judges that data receiver is finished, com-state is set to unactivated state, serial ports thing is reset Part;When it is state of activation that the first judging submodule, which judges com-state, Serial Port Event is reset.
Further, above-mentioned drive device, in addition to:
Second setup module, sets for first serial data to be sent into serial ports by serial ports in first processing module 530 After standby, data accepted length is set to zero;
Correspondingly, above-mentioned first processing submodule, is additionally operable to from second serial data obtain valid data length, to having Effect data length is preserved;
Above-mentioned 3rd processing module 580, in addition to:
Submodule is updated, the length renewal for handling the second obtained application data according to second processing submodule has connect Receive data length;
Above-mentioned second judging submodule, specifically for judging whether data accepted length is less than valid data length, such as It is really, it is determined that data are not received;Otherwise, it determines data receiver is finished.
Further, above-mentioned 3rd processing module 580, in addition to:
3rd processing submodule, for judging whether comprising card plug information in second serial data, if it is, root Information updating card mode information is plugged according to card;
Correspondingly, above-mentioned second processing submodule, specifically for second serial data Cun Chudao is received into buffering area, judges Whether information is plugged in second serial data comprising card;If plugging information comprising card, information updating is plugged according to card Card mode information, the data in second serial data in addition to card plugs information are write everywhere as the second application data Manage in buffering area, judge whether data receive;If plugging information not comprising card, second serial data are regard as second Application data is written in processing buffering area, judges whether data receive.
Further, above-mentioned drive device, in addition to:
Fourth processing module, for when the first judge module 520 judges that control code obtains request for state, reading card Status information, system is sent to by card mode information.
Further, above-mentioned drive device, in addition to:
5th processing module, for when the first judge module 520 judges that control code judges to ask for plug-in card, reading card Status information, according to card mode information, judges whether there is card in serial equipment, if it is, plug-in card information is sent into system; Otherwise, operation is cancelled.
Further, above-mentioned drive device, in addition to:
6th processing module, when judging request for judging control code in the first judge module 520 to pull out card, reads card Status information, according to card mode information, judges whether there is card in serial equipment, if it is, cancelling operation;Otherwise, it will pull out Card information is sent to system.
Further, above-mentioned drive device, in addition to:
7th processing module, for when the first judge module 520 judges control code for attribute retrieval request, to getting The I/O Request from system changed, obtain request code, request code judged;If request code is manufacturer's name acquisition Request, then be sent to system by the manufacturer's name itself preserved;, will if request code, which is interface equipment IFD types, obtains request The IFD type informations itself preserved are sent to system;If request code, which is unit, obtains request, by setting that itself is preserved Standby unit is sent to system;If request code is feature, description obtains request, and the characterization information itself preserved is sent To system;If request code, which is protocol type, obtains request, the Current protocol type information that itself is preserved is sent to system; If request code, which is ATR character strings, obtains request, the ATR character strings that itself is preserved are sent to system.
The embodiment of the present invention on main frame by using the drive device based on UMDF, by serial equipment and the PC/ of system SC interfaces are mounted so that the application program in main frame can be conveniently by PC/SC interface interchange serial equipments, it is not necessary to correspondence Any change is made of program, the reusability of application program is improved.
Hardware, computing device can be directly used with reference to the step in the method that the embodiments described herein is described Software module, or the two combination are implemented.Software module can be placed in random access memory (RAM), internal memory, read-only storage (ROM), electrically programmable ROM, electrically erasable ROM, register, hard disk, moveable magnetic disc, CD-ROM or technical field In any other form of storage medium well known to interior.
The foregoing is only a specific embodiment of the invention, but protection scope of the present invention is not limited thereto, any Those familiar with the art the invention discloses technical scope in, change or replacement can be readily occurred in, should all be contained Cover within protection scope of the present invention.Therefore, protection scope of the present invention described should be defined by scope of the claims.

Claims (36)

1. the method for work of a kind of drive device suitable for serial equipment, it is characterised in that applied to including main frame and serial ports In the system of equipment, the main frame is connected with the serial equipment, and system, application program and driving dress are provided with the main frame Put, after personal computer/smart card PC/SC interfaces of system described in the application call, in the drive device Preset function is called by the system, the described method comprises the following steps:
S1, the drive device wait called;
S2, when the preset function in the drive device is called by the system, the drive device passes through component object mould Type com interface obtains the control code from the system, and the control code is judged, if the control code is default control Code processed, then perform step S3;If the control code is not default control code, corresponding operation is performed according to the control code, And return to step S1;
S3, the drive device organize corresponding first serial data according to default control code, by serial ports by described the One serial data is sent to the serial equipment, and com-state is set to original state by the drive device;
S4, the drive device are listened to after reading event, the second application data are read from processing buffering area, by described second Application data is sent to the system, and return to step S1;
Before the step S4, in addition to:
A1, the drive device monitor Serial Port Event, after data event is listened to, and receive second from the serial equipment Serial data;
The second serial data Cun Chudao is received buffering area by A2, the drive device, and the second serial data are carried out Processing, second application data that processing is obtained is written in the processing buffering area, and has read event described in setting;
The step A2, is specifically included:
B1, the drive device are judged the com-state, if original state, then perform step B2;If State of activation, then perform step B6;If unactivated state, then step B9 is performed;
B2, the drive device are initialized to the reception buffering area, will be connect described in the second serial data Cun Chudao Receive buffering area;
B3, the drive device are handled the second serial data, and second application data that processing is obtained is write Enter into the processing buffering area, judge whether data receive, if it is, performing step B5;Otherwise, step is performed B4;
Com-state is set to state of activation by B4, the drive device, resets Serial Port Event;
Com-state is set to unactivated state by B5, the drive device, resets Serial Port Event, and read event described in setting;
B6, the drive device will receive buffering area described in the second serial data Cun Chudao, by the second serial data In the second application data be written to it is described processing buffering area in, judge whether data receive, if it is, execution step B8;Otherwise, step B7 is performed;
B7, the drive device reset Serial Port Event;
The com-state is set to unactivated state by B8, the drive device, resets Serial Port Event;
B9, the drive device reset Serial Port Event.
2. the method as described in claim 1, it is characterised in that second application data is sent to institute by the drive device System is stated, is specially:
Second application data is sent to by the drive device by writing second application data to output buffer The system.
3. the method as described in claim 1, it is characterised in that the drive device to the second serial data at Reason, second application data that processing is obtained is written in the processing buffering area, is specially:
If plugging information comprising card in the second serial data, the drive device plugs information more according to the card New card mode information, using the data in the second serial data in addition to the card plugs information and the second packet header as Second application data is written in the processing buffering area;
If not including card in the second serial data plugs information, the drive device is by the second serial data Data in addition to the second packet header are written in the processing buffering area as second application data.
4. the method as described in claim 1, it is characterised in that the default control code is card power-up request, described second Application data is reset answer ATR character string;
The step S3, be specially:
The drive device tissue electricity instruction, the serial equipment is sent to by serial ports by the upper electricity instruction.
5. the method as described in claim 1, it is characterised in that the default control code sends request for instruction;
The step S3, be specially:
The drive device carries out tissue to the first application data from the system, obtains the first serial data, leads to Cross serial ports and the first serial data are sent to the serial equipment.
6. method as claimed in claim 5, it is characterised in that before the step S3, in addition to:
The drive device obtains the first application data from the system by reading input block.
7. method as claimed in claim 5, it is characterised in that the drive device is to the first application data carry out group Knit, be specially:
The drive device is combined to the first packet header and first application data, obtains the first serial data.
8. the method as described in claim 1, it is characterised in that the default control code is property setting request, described second Application data responds to set;
The step S3, be specially:
The drive device carries out tissue to the attribute information from the system, obtains the first serial data, passes through string The first serial data are sent to the serial equipment by mouth;
The step S4, be specially:
The drive device is listened to after reading event, and reading described set from the processing buffering area responds, according to described Set response to judge whether to set successfully, if it is, the setting response is sent into system, according to the attribute information more The new attribute data itself preserved;Otherwise, the setting response is sent to the system.
9. method as claimed in claim 8, it is characterised in that before the step S3, in addition to:
The drive device obtains the attribute information from the system by reading input block.
10. method as claimed in claim 8, it is characterised in that the drive device carries out tissue, tool to the attribute information Body is:
The drive device is combined to the first packet header and the attribute information, obtains the first serial data.
11. the method as described in claim 1, it is characterised in that the drive device is obtained by com interface and comes from the system The control code of system, be specially:
The drive device obtains the control code that kernel-driven is forwarded by com interface.
12. method as claimed in claim 11, it is characterised in that the kernel-driven is form driving base frame WDF.
13. the method as described in claim 1, it is characterised in that the drive device is by serial ports by the first serial number According to being sent to after the serial equipment, in addition to:
Data accepted length is set to zero by the drive device;
The step B2, in addition to:
The drive device obtains valid data length from the second serial data, and the valid data length is protected Deposit;
The drive device is handled the second serial data, after obtaining second application data, in addition to:
The drive device updates the data accepted length according to the length of second application data;
Before the drive device judges whether data receive, in addition to:
The drive device updates the data accepted length according to the length of second application data;
The drive device judges whether data receive, and is specially:
The drive device judges whether the data accepted length is less than valid data length, if it is, determining data Do not receive;Otherwise, it determines data receiver is finished.
14. the method as described in claim 1, it is characterised in that after the step B2, in addition to:
The drive device judges whether plug information comprising card in the second serial data, if it is, according to described Card plugs information updating card mode information, and performs step B3;Otherwise, step B3 is performed;
The step B6, is specifically included:
The drive device will receive buffering area described in the second serial data Cun Chudao, judge in the second serial data Whether information is plugged comprising card;
If plugging information comprising card, the drive device plugs information updating card mode information according to the card, will Data in the second serial data in addition to the card plugs information are written to described as second application data Handle in buffering area, judge whether data receive, if it is, performing step B8;Otherwise, step B7 is performed;
If plugging information not comprising card, the drive device regard the second serial data as second application data It is written in the processing buffering area, judges whether data receive, if it is, performs step B8;Otherwise, step is performed B7;
Before the step B9, in addition to:
The drive device judges in the second serial data whether to plug information comprising card, if it is, from described the The card plug information is obtained in two serial datas, information updating card mode information is plugged according to the card, and perform Step B9;Otherwise, step B9 is performed.
15. the method as described in claim 1, it is characterised in that
After the drive device is judged the control code, in addition to:
If the control code, which is state, obtains request, the drive device reads card mode information, by the card mode Information is sent to the system, and return to step S1.
16. the method as described in claim 1, it is characterised in that after the drive device is judged the control code, Also include:
If the control code, which is plug-in card, judges request, the drive device reads card mode information, according to the card-like State information, judges whether there is card in the serial equipment, if it is, plug-in card information is sent to the system by the drive device System, and return to step S1;Otherwise, the drive device cancels operation, and return to step S1.
17. the method as described in claim 1, it is characterised in that after the drive device is judged the control code, Also include:
If the control code is to pull out card to judge request, the drive device reads card mode information, according to the card-like State information, judges whether there is card in the serial equipment, if it is, cancel operation, and return to step S1;Otherwise, card will be pulled out Information is sent to the system, and return to step S1.
18. the method as described in claim 1, it is characterised in that after the drive device is judged the control code, Also include:
If the control code is attribute retrieval request, the drive device is entered to the I/O Request from the system got Row conversion, obtains request code, the request code is judged;
If the request code, which is manufacturer's name, obtains request, the manufacturer itself preserved name is sent to the system by the drive device System, and return to step S1;
If the request code, which is interface equipment IFD types, obtains request, the drive device believes the IFD types itself preserved Breath is sent to the system, and return to step S1;
If the request code, which is unit, obtains request, the unit that itself is preserved is sent to institute by the drive device State system, and return to step S1;
If the request code, which is feature description, obtains request, the drive device sends the characterization information itself preserved To the system, and return to step S1;
If the request code, which is protocol type, obtains request, the drive device is by the Current protocol type information itself preserved It is sent to the system, and return to step S1;
If the request code, which is ATR character strings, obtains request, the ATR character strings itself preserved are sent to by the drive device The system, and return to step S1.
19. a kind of drive device suitable for serial equipment, it is characterised in that applied to including the system of main frame and serial equipment In, the main frame is connected with the serial equipment, system, application program and drive device is provided with the main frame, when described After the personal computer of system described in application call/smart card PC/SC interfaces, the preset function quilt in the drive device The system is called, and the drive device includes:
First acquisition module, when being called for the preset function in the drive device by system, passes through The Component Object Model Com interface obtains the control code from the system;
First judge module, for judging the control code that first acquisition module is got;
First processing module, for when first judge module judges the control code for default control code, according to institute Default control code is stated, corresponding first serial data is organized, the first serial data is sent to by the serial ports by serial ports Equipment;
First monitors module, and event has been read for monitoring;
Second processing module, for after the described first monitoring module listens to reading event, the to be read from processing buffering area Two application datas, the system is sent to by second application data;
Second monitors module, for monitoring Serial Port Event;
First receiving module, listens to after data event used in the described second monitoring module, receives from the serial equipment Second serial data;
3rd processing module, the second serial data Cun Chudao for first receiving module to be received, which is received, to be buffered The second serial data are handled by area, and second application data that processing is obtained is written to the processing and buffered Qu Zhong, and read event described in setting;
First setup module, for the first serial data to be sent into the string by serial ports in the first processing module After jaws equipment, com-state is set to original state;
3rd processing module, including:
First judging submodule, for judging the com-state;
First processing submodule, it is right for when it is original state that first judging submodule, which judges the com-state, The reception buffering area is initialized, and will receive buffering area described in the second serial data Cun Chudao;
Second processing submodule, for handling the second serial data, by handle obtain described second apply number According to being written in the processing buffering area, the second judging submodule is triggered;
Second judging submodule, for judging whether data receive;
First sets submodule, for after second judging submodule judges that data are not received, by com-state State of activation is set to, Serial Port Event is reset;After second judging submodule judges that data receiver is finished, by com-state Unactivated state is set to, Serial Port Event is reset, and event has been read described in setting;
Second processing submodule, for when it is state of activation that first judging submodule, which judges the com-state, inciting somebody to action Buffering area is received described in the second serial data Cun Chudao, the second application data in the second serial data is written to In the processing buffering area, judge whether data receive;
Second sets submodule, for after the second processing submodule judges that data are not received, resetting serial ports thing Part;After the second processing submodule judges that data receiver is finished, com-state is set to unactivated state, serial ports is reset Event;When it is state of activation that first judging submodule, which judges the com-state, Serial Port Event is reset.
20. drive device as claimed in claim 19, it is characterised in that the Second processing module, specifically for described First monitoring module is listened to after reading event, second application data is read from the processing buffering area, by defeated Go out buffering area and write second application data, second application data is sent to the system.
21. drive device as claimed in claim 19, it is characterised in that
3rd processing module, specifically for the second serial data Cun Chudao for receiving first receiving module Buffering area is received, when plugging information comprising card in the second serial data, information updating card is plugged according to the card Piece status information, using the data in the second serial data in addition to the card plugs information and the second packet header as described Second application data is written in the processing buffering area;When not including card plug information in the second serial data, The data in the second serial data in addition to the second packet header are written into the processing as second application data to delay Rush in area.
22. drive device as claimed in claim 19, it is characterised in that the default control code is card power-up request, institute The second application data is stated for reset answer ATR character string;
The first processing module, specifically for judging that the control code is card power-up request in first judge module When, the upper electricity instruction is sent to the serial equipment by tissue electricity instruction by serial ports.
23. drive device as claimed in claim 19, it is characterised in that the default control code sends request for instruction;
The first processing module, including:
The first tissue submodule, it is right for when first judge module judges that the control code sends request for instruction The first application data from the system carries out tissue, obtains the first serial data;
First sending submodule, for the first serial data for being obtained the first tissue submodule tissue by serial ports It is sent to the serial equipment.
24. drive device as claimed in claim 23, it is characterised in that also include:
Second acquisition module, for by reading input block, obtaining the first application data from the system.
25. drive device as claimed in claim 23, it is characterised in that the first tissue submodule, specifically in institute State the first judge module and judge the control code to instruct during transmission request, the first packet header and first application data are entered Row combination, obtains the first serial data.
26. drive device as claimed in claim 19, it is characterised in that the default control code is property setting request, institute The second application data is stated to respond to set;
The first processing module, including:
Minor microstructure submodule, it is right for when it is property setting request that first judge module, which judges the control code, Attribute information from the system carries out tissue, obtains the first serial data;
Second sending submodule, for the first serial data for being obtained the minor microstructure submodule tissue by serial ports It is sent to the serial equipment;
The Second processing module, it is slow from the processing specifically for after the described first monitoring module listens to reading event Rush in area and read the setting response, judge whether to set successfully according to the setting response, if it is, described set is rung System should be sent to, the attribute data of itself preservation is updated according to the attribute information;Otherwise, the setting response is sent to The system.
27. drive device as claimed in claim 26, it is characterised in that also include:
3rd acquisition module, for by reading input block, obtaining the attribute information from the system.
28. drive device as claimed in claim 26, it is characterised in that the minor microstructure submodule, specifically for One packet header and the attribute information are combined, and obtain the first serial data.
29. drive device as claimed in claim 19, it is characterised in that first acquisition module, specifically for described When preset function in drive device is called by the system, the control code that kernel-driven is forwarded is obtained by com interface.
30. drive device as claimed in claim 29, it is characterised in that the kernel-driven is that form drives base frame WDF。
31. drive device as claimed in claim 19, it is characterised in that also include:
Second setup module, for the first serial data to be sent into the string by serial ports in the first processing module After jaws equipment, data accepted length is set to zero;
The first processing submodule, is additionally operable to from the second serial data obtain valid data length, to described effective Data length is preserved;
3rd processing module, in addition to:
Submodule is updated, the length for handling obtained second application data according to the second processing submodule updates The data accepted length;
Second judging submodule, specifically for judging whether the data accepted length is less than valid data length, such as It is really, it is determined that data are not received;Otherwise, it determines data receiver is finished.
32. drive device as claimed in claim 19, it is characterised in that the 3rd processing module, in addition to:
3rd processing submodule, for judging whether comprising card plug information in the second serial data, if it is, root Information updating card mode information is plugged according to the card;
The second processing submodule, specifically for will receive buffering area described in the second serial data Cun Chudao, judges institute State in second serial data and whether plug information comprising card;If plugging information comprising card, plugged and believed according to the card Breath updates card mode information, regard the data in the second serial data in addition to the card plugs information as described the Two application datas are written in the processing buffering area, judge whether data receive;If plugging information not comprising card, It is written to the second serial data as the second application data in the processing buffering area, judges whether data have received Finish.
33. drive device as claimed in claim 19, it is characterised in that also include:
Fourth processing module, for when first judge module judges that the control code obtains request for state, reading card Piece status information, the system is sent to by the card mode information.
34. drive device as claimed in claim 19, it is characterised in that also include:
5th processing module, for when first judge module judges that the control code judges to ask for plug-in card, reading card Piece status information, according to the card mode information, judges whether there is card in the serial equipment, if it is, by plug-in card information It is sent to the system;Otherwise, operation is cancelled.
35. drive device as claimed in claim 19, it is characterised in that also include:
6th processing module, when judging request for judging the control code in first judge module to pull out card, reads card Piece status information, according to the card mode information, judges whether there is card in the serial equipment, if it is, cancelling operation; Otherwise, card information will be pulled out and is sent to the system.
36. drive device as claimed in claim 19, it is characterised in that also include:
7th processing module, for when first judge module judges the control code for attribute retrieval request, to obtaining To the I/O Request from the system changed, obtain request code, the request code judged;If the request Code is that manufacturer's name obtains request, then the manufacturer's name itself preserved is sent into the system;Set if the request code is interface Standby IFD types obtain request, then the IFD type informations preserved itself are sent to the system;If the request code is to set Standby unit obtains request, then the unit preserved itself is sent to the system;If the request code is feature description Request is obtained, then the characterization information preserved itself is sent to the system;Obtained if the request code is protocol type Request is taken, then the Current protocol type information preserved itself is sent to the system;If the request code is ATR character strings Request is obtained, then the ATR character strings preserved itself are sent to the system.
CN201410840549.1A 2014-12-30 2014-12-30 A kind of drive device and its method of work suitable for serial equipment Active CN104484292B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201410840549.1A CN104484292B (en) 2014-12-30 2014-12-30 A kind of drive device and its method of work suitable for serial equipment

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201410840549.1A CN104484292B (en) 2014-12-30 2014-12-30 A kind of drive device and its method of work suitable for serial equipment

Publications (2)

Publication Number Publication Date
CN104484292A CN104484292A (en) 2015-04-01
CN104484292B true CN104484292B (en) 2017-08-11

Family

ID=52758835

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201410840549.1A Active CN104484292B (en) 2014-12-30 2014-12-30 A kind of drive device and its method of work suitable for serial equipment

Country Status (1)

Country Link
CN (1) CN104484292B (en)

Families Citing this family (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN107992367B (en) * 2017-10-20 2020-09-25 河南平高电气股份有限公司 Modbus serial port data processing method
CN108897529A (en) * 2018-06-19 2018-11-27 深圳众为兴技术股份有限公司 A kind of development approach of PCI motion control card driving

Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101639771A (en) * 2008-07-30 2010-02-03 许燕 Method for converting HID interface to PC/SC interface
CN101719212A (en) * 2009-12-11 2010-06-02 北京飞天诚信科技有限公司 Identification method and device of serial-port card reader

Family Cites Families (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
EP2339493A1 (en) * 2009-12-22 2011-06-29 Gemalto SA Authenticating human interface device

Patent Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101639771A (en) * 2008-07-30 2010-02-03 许燕 Method for converting HID interface to PC/SC interface
CN101719212A (en) * 2009-12-11 2010-06-02 北京飞天诚信科技有限公司 Identification method and device of serial-port card reader

Also Published As

Publication number Publication date
CN104484292A (en) 2015-04-01

Similar Documents

Publication Publication Date Title
CN107203626A (en) A kind of BPM method and system
CN104461716B (en) The access method and multi-core heterogeneous system of a kind of multi-core heterogeneous system
CN107180444A (en) A kind of animation producing method, device, terminal and system
CN104484292B (en) A kind of drive device and its method of work suitable for serial equipment
CN107861688A (en) A kind of data-erasure method, terminal and readable storage medium storing program for executing
CN106445480B (en) Command Line Interface display methods and device
CN107341039A (en) Method, main frame and the system being managed under a kind of virtual environment to USB device
CN108304121A (en) The control method and device of PowerPoint
CN103809502B (en) Controller and recording medium
CN104468232B (en) The method and system of network equipments configuration are completed using xml document and mib
CN107135189A (en) A kind of file transmitting method and physical machine
CN104144405B (en) User's card file method for remote management and system
CN106681760A (en) Transaction processing method and device based on client engineering project management system
CN108052289A (en) Method, set-top box and the storage medium of data processing
CN106809752A (en) Boom hoisting
CN1319324C (en) Implement method for network management system operation
CN106445516A (en) Method and device for loading external WLAN card drive
CN107147698A (en) The tele-control system of intelligent switch, method and apparatus
CN206595038U (en) A kind of speech recognition control system
CN109039777A (en) A kind of wifi equipment and its match network method
CN105808461B (en) A kind of USB composite system and method
CN206283523U (en) A kind of CNC intelligent gateways and application system
CN107729171A (en) Adaptive Activiation method, device, terminal device and the storage medium of USB interface
CN205924162U (en) Surgery robot's motor control system
CN104320254B (en) A kind of method of work for the intelligent cipher key equipment for supporting expansion interface

Legal Events

Date Code Title Description
C06 Publication
PB01 Publication
C10 Entry into substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant