CardReader status event should return the ATR
- Of the inserted card. - Refactoring of the code that creates a Buffer instance into a separate function. - Update the example and README - It fixes bug #2
This commit is contained in:
@@ -33,11 +33,11 @@ Example
|
||||
reader.on('status', function(status) {
|
||||
console.log('Status(', this.name, '):', status);
|
||||
/* check what has changed */
|
||||
var changes = this.status ^ status;
|
||||
var changes = this.state ^ status.state;
|
||||
if (changes) {
|
||||
if ((changes & this.SCARD_STATE_EMPTY) && (status & this.SCARD_STATE_EMPTY)) {
|
||||
if ((changes & this.SCARD_STATE_EMPTY) && (status.state & this.SCARD_STATE_EMPTY)) {
|
||||
console.log("card removed");/* card removed */
|
||||
} else if ((changes & this.SCARD_STATE_PRESENT) && (status & this.SCARD_STATE_PRESENT)) {
|
||||
} else if ((changes & this.SCARD_STATE_PRESENT) && (status.state & this.SCARD_STATE_PRESENT)) {
|
||||
console.log("card inserted");/* card inserted */
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user