From d7dfb805a861c391232f0572ede45e88f1fa9c3b Mon Sep 17 00:00:00 2001 From: Santiago Gimeno Date: Fri, 26 Sep 2014 12:06:50 +0200 Subject: [PATCH] doc: document PCSCLite::close, CardReader::close - Update example accordingly. --- README.md | 10 ++++++++++ examples/example.js | 2 ++ 2 files changed, 12 insertions(+) diff --git a/README.md b/README.md index 4ab7b8b..1e4062e 100644 --- a/README.md +++ b/README.md @@ -67,6 +67,8 @@ pcsc.on('reader', function(reader) { console.log(err); } else { console.log('Data received', data); + reader.close(); + pcsclite.close(); } }); } @@ -101,6 +103,10 @@ The PCSCLite object is an EventEmitter that notifies the existence of Card Reade Emitted whenever a new card reader is detected. +#### pcsclite.close() + +It frees the resources associated with this PCSCLite instance. At a low level it calls [`SCardCancel`](http://pcsclite.alioth.debian.org/pcsc-lite/node21.html) so it stops watching for new readers. + ### Class: CardReader @@ -162,3 +168,7 @@ Wrapper around [`SCardTransmit`](http://pcsclite.alioth.debian.org/pcsc-lite/nod * *output* `Buffer` Wrapper around [`SCardControl`](http://pcsclite.alioth.debian.org/pcsc-lite/node18.html). Sends a command directly to the IFD Handler (reader driver) to be processed by the reader. + +#### reader.close() + +It frees the resources associated with this CardReader instance. At a low level it calls [`SCardCancel`](http://pcsclite.alioth.debian.org/pcsc-lite/node21.html) so it stops watching for the reader status changes. diff --git a/examples/example.js b/examples/example.js index 61acbc2..5654990 100755 --- a/examples/example.js +++ b/examples/example.js @@ -37,6 +37,8 @@ pcsc.on('reader', function(reader) { console.log(err); } else { console.log('Data received', data); + reader.close(); + pcsc.close(); } }); }