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:
Santiago Gimeno
2013-07-04 22:50:18 +02:00
parent c98f7bc2de
commit 3f2a1b5e4e
5 changed files with 42 additions and 18 deletions

View File

@@ -36,12 +36,17 @@ module.exports = function() {
var r = new CardReader(name);
readers_aux.push(r);
p.emit('reader', r);
r.get_status(function(e, status) {
r.get_status(function(e, state, atr) {
if (e) {
r.emit('error', e);
} else {
var status = { state : state };
if (atr) {
status.atr = atr;
}
r.emit('status', status);
r.status = status;
r.state = state;
}
});
}