forked from LudovicRousseau/node-pcsc
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathexample.js
More file actions
executable file
·29 lines (26 loc) · 1.46 KB
/
example.js
File metadata and controls
executable file
·29 lines (26 loc) · 1.46 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
#!/usr/bin/env node
/******************************************************************************
* *
* @file test.js *
* @author Clément Désiles <clement.desiles@telecomsante.com> *
* @date 2013/02/13 *
* @licence MIT *
* *
* Sample to test the nodejs bindings to PCSC *
* *
*****************************************************************************/
var fork = require('child_process').fork;
var pcsc = fork('./lib/node-pcsc.js');
pcsc.on('message', function(evt) {
// Show info when state switch to present
if(evt.reader.status == 'SCARD_STATE_PRESENT'){
console.log(evt.reader.name);
if (evt.reader.type) console.log('-> type:', evt.reader.type);
if (evt.card.name) console.log('-> card:', evt.card.name);
if (evt.card.ATR) console.log('-> card ATR:', evt.card.ATR);
if (evt.card.Protocol) console.log('-> card Protocol:', evt.card.Protocol);
if (evt.card.err) console.log('-> card transmit err:', evt.card.err);
if (evt.card.UID) console.log('-> card UID:', evt.card.UID);
console.log(evt);
}
});