Behaviours: gen_server.
Tracks the available readers and cards on the system, providing functions for listing the current state as well as subscribing to changes.
1> pcsc_card_db:list_readers(). {ok,[<<"Yubico YubiKey OTP+FIDO+CCID 00 00">>, <<"Alcor Micro AU9560 01 00">>, <<"ACS ACR122U PICC Interface 02 00">>]} 2> pcsc_card_db:get_reader_state(<<"ACS ACR122U PICC Interface 02 00">>). {ok,[empty]} 3> pcsc_card_db:monitor_cards(#{in_reader => #{name_contains => <<"ACS">>}}). {ok,#Ref<0.2854622174.861143041.134395>} 4> flush(). ok 5> flush(). Shell got {pcsc_card,inserted,#Ref<0.2854622174.861143041.134395>, <<"ACS ACR122U PICC Interface 02 00">>, <<59,129,128,1,128,128>>} ok 6> flush(). Shell got {pcsc_card,removed,#Ref<0.2854622174.861143041.134395>, <<"ACS ACR122U PICC Interface 02 00">>} ok
card_filter() = #{atr => binary(), atr_prefix => binary(), atr_contains => binary(), in_reader => reader_filter()}
A filter for selecting which cards to receive events about.
card_monitor_msg() = {pcsc_card, inserted, reference(), RdrName::binary(), ATR::binary()} | {pcsc_card, removed, reference(), RdrName::binary()}
Messages sent to a subscriber who has called monitor_cards() when a card is inserted or removed on the system.
reader_filter() = #{name => binary(), name_prefix => binary(), name_contains => binary()}
A filter for selecting which readers to receive events about.
reader_monitor_msg() = {pcsc_reader, available | unavailable, reference(), RdrName::binary()}
Messages sent to a subscriber who has called monitor_readers() when a card reader becomes available or ceases to be.
demonitor_cards/1 | Cancels a subscription set up by a call to monitor_cards/1 . |
demonitor_readers/1 | Cancels a subscription set up by a call to monitor_readers/1 . |
get_reader_atr/1 | Retrieves the last known ATR sent by a card in a particular card reader. |
get_reader_state/1 | Retrieves the last known status of a particular card reader, including whether it has a card inserted and whether it is busy. |
list_cards/0 | Lists available cards on the system, with their reader names and ATRs. |
list_readers/0 | Returns the current list of card readers on the system, whether they contain a card or not. |
monitor_cards/1 | Subscribes the calling process to notifications about changes to the set of available cards on the system. |
monitor_readers/1 | Subscribes the calling process to notifications about changes to the set of available readers on the system. |
demonitor_cards(Ref::reference()) -> ok | {error, term()}
Cancels a subscription set up by a call to monitor_cards/1
.
demonitor_readers(Ref::reference()) -> ok | {error, term()}
Cancels a subscription set up by a call to monitor_readers/1
.
get_reader_atr(RdrName::pcsc:rdrname()) -> {ok, binary()} | {error, term()}
Retrieves the last known ATR sent by a card in a particular card reader.
get_reader_state(RdrName::pcsc:rdrname()) -> {ok, [pcsc:rdrstate()]} | {error, term()}
Retrieves the last known status of a particular card reader, including whether it has a card inserted and whether it is busy.
list_cards() -> {ok, [{pcsc:rdrname(), ATR::binary()}]} | {error, term()}
Lists available cards on the system, with their reader names and ATRs.
list_readers() -> {ok, [pcsc:rdrname()]} | {error, term()}
Returns the current list of card readers on the system, whether they contain a card or not.
monitor_cards(Filter::card_filter()) -> {ok, reference()} | {error, term()}
Subscribes the calling process to notifications about changes to the
set of available cards on the system. Messages received by callers
are of the type card_monitor_msg()
. Returns a reference
value which can be used to identify messages sent by this subscription
and also useful with demonitor_cards/1
monitor_readers(Filter::reader_filter()) -> {ok, reference()} | {error, term()}
Subscribes the calling process to notifications about changes to the
set of available readers on the system. Messages received by callers
are of the type reader_monitor_msg()
. Returns a reference
value which can be used to identify messages sent by this subscription
and also useful with demonitor_readers/1
Generated by EDoc