Link and Contact
Website |
Support |
Copyright © Calypso Networks Association, https://calypsonet.org.
This specification is licensed under the Creative Commons Attribution-NoDerivatives 4.0 International (CC BY-ND 4.0).
You are free to share — copy and redistribute this document in any medium or format for any purpose, even commercially — under the following terms:
-
Attribution — You MUST give appropriate credit to the Calypso Networks Association, provide a link to the license, and indicate if changes were made. You MAY do so in any reasonable manner, but not in any way that suggests the Calypso Networks Association endorses you or your use.
-
NoDerivatives — If you remix, transform, or build upon this document, you MAY NOT distribute the modified material.
No additional restrictions — You MAY NOT apply legal terms or technological measures that legally restrict others from doing anything the license permits.
Implementation grant — The NoDerivatives condition above applies to this specification document only — its text, tables and diagrams. It does not restrict the use of the technical information the document contains. The Calypso Networks Association hereby grants everyone an irrevocable, worldwide, royalty-free permission to use the information contained in this specification to design, develop, and distribute software implementations of this API, in any programming language, under the license of their choice.
The full license text is available at https://creativecommons.org/licenses/by-nd/4.0/.
1. Abstract
This document is the official technical specification of the Terminal Reader API standardised by the Calypso Networks Association (CNA). It defines, in a language-agnostic way, the interfaces, classes, enumerations, exceptions, structural relationships and behavioural requirements that any conforming implementation of the Terminal Reader API MUST satisfy.
The Terminal Reader API is part of the broader CNA Terminal API family and acts as the contract through which terminal applications discover card readers, observe card events, select cards and exchange data with them.
Document Status
Reference |
YYMMDD-SP-CNATerminalAPI-Reader |
|---|---|
Short name |
CNA-TR-API |
Version |
3.0.0-SNAPSHOT |
Revision date |
2026-07-20 |
Editor |
Calypso Networks Association |
Source repository |
https://github.com/calypsonet/calypsonet-terminal-reader-uml-api |
Reference license |
Creative Commons Attribution-NoDerivatives 4.0 International (CC BY-ND 4.0) |
| The present document specifies the 3.0.0-SNAPSHOT of the Terminal Reader API. It defines a single, coherent baseline against which conforming implementations are evaluated; the Since column indicates the version in which each member was introduced. |
Revision List
|
This section lists the high-level changes per version. The complete, fine-grained
changelog is maintained in the |
| Version / Date | Modifications |
|---|---|
v3.0.0-SNAPSHOT |
Baseline. |
2. Introduction
2.1. Purpose
The Terminal Reader API defines a standardised set of contracts allowing terminal applications to interact with card readers and the cards presented to them, independently of:
-
the underlying reader hardware (contact, contactless, virtual, etc.),
-
the card technology family (ISO/IEC 7816-4, ISO/IEC 14443, proprietary),
-
the implementation technology of the application (programming language, runtime).
Conforming implementations of this specification MUST allow extension modules (e.g. card-specific APIs such as the
Calypso Card API) to plug in transparently through the Service Provider Interface (SPI) mechanism defined in
reader.selection.spi and reader.transaction.spi.
2.2. Scope
This specification covers:
-
the discovery and basic interrogation of card readers,
-
the observation of reader events related to card presence and selection,
-
the configuration of card detection (RF technologies, detection mode, ECP frame),
-
the description and orchestration of card selection scenarios, including multi-channel scenarios,
-
the abstraction of the physical and logical communication channels established with cards,
-
the contract surface required by card extension modules to interoperate with reader implementations,
-
the management of single-channel and multi-channel card transactions.
The following topics are out of scope:
-
the wire-level protocols used between reader and card (e.g. APDU framing, ISO/IEC 14443 anti-collision),
-
the cryptographic operations performed by or on behalf of the card,
-
the lifecycle and packaging of reader drivers,
-
the user interface presented by the terminal application.
2.3. Conformance
A software product conforms to this specification if and only if:
-
it implements every interface and class defined in Chapter 5 with the operations and semantics prescribed in this document,
-
it raises exceptions exclusively of the types defined in Section 5.5 for the situations described,
-
it preserves the structural relationships described in Chapter 4.
Throughout this specification, the key words MUST, MUST NOT, SHOULD, SHOULD NOT, RECOMMENDED, MAY and OPTIONAL are to be interpreted as described in RFC 2119 and RFC 8174 when, and only when, they appear in all capitals.
In conformance with RFC 2119, SHALL is equivalent to MUST; this specification uses MUST exclusively in order to avoid ambiguity.
2.4. Document Conventions
2.4.1. Naming
Type names follow UpperCamelCase; operation, parameter and enumeration-member names follow lowerCamelCase
except for enumeration values which use UPPER_SNAKE_CASE. Names defined by this specification are reproduced
as-is in the UML class diagram (Section 4.6).
2.4.2. Language-agnostic types
The following symbolic type names are used in operation signatures and are mapped, in each binding, to the closest equivalent native type. Implementations MUST preserve the semantic intent rather than the syntactic form.
| Symbolic type | Description | Typical bindings |
|---|---|---|
|
Sequence of characters, UTF-8 encoded by default. |
|
|
Two-state truth value. |
|
|
Signed 32-bit integer. |
|
|
Signed 64-bit integer. |
|
|
Ordered sequence of octets. |
|
|
Ordered collection of |
|
|
Unordered collection of unique |
|
|
Associative array binding keys of type |
|
|
Indicates that an operation returns no value. |
|
2.4.3. Type tables
Each interface, class, enumeration and exception defined in this document is described by a table of the form:
Name |
The type’s normalized name. |
|---|---|
Kind |
The category of the type (interface, class, enumeration, exception, etc.). |
Namespace |
The namespace in which the type is defined. |
Generics |
The generic type parameter of this type, when applicable. |
Extends |
The type extended by this type, when applicable. |
Implements |
The interface implemented by this type, when applicable. |
Since |
The version of the API in which the type was introduced. |
Purpose |
A normative description of the type’s responsibility. |
See also |
Cross-references to related operations or types, each a hyperlink to the corresponding table. Present only when applicable. |
The Purpose row states, in one or two sentences, the responsibility of the type and the way an instance is obtained. It is meant to be scanned, not read: any content that requires structure or depth — rules, lists, notes, value tables or examples — is placed as prose below the table.
2.4.4. Operation tables
Each operation defined in this document is described by a table of the form:
Signature |
The operation’s language-agnostic signature. |
|---|---|
Since |
The version of the API in which the operation was introduced. |
Description |
A normative description of the operation’s behaviour. |
Parameters |
A description of each input parameter. |
Returns |
A description of the returned value, if any. |
Throws |
A list of exceptional conditions, each mapped to a specific exception type. |
See also |
Cross-references to related operations or types, each a hyperlink to the corresponding table. Present only when applicable. |
2.4.5. Operation contracts
To avoid repetition, the following rules apply to every operation table in Chapter 5 and are therefore not restated for each operation:
-
Non-
nullarguments. Unless explicitly stated otherwise, every input parameter MUST be non-null. An implementation MUST raiseIllegalArgumentExceptionif anullvalue is supplied. This implicitnullcheck is not repeated in the Throws row, which statesNone.when no other exception can occur. -
Non-
nullresults. Unless the return type is marked nullable (T?) or the Returns row states otherwise, an operation returns a non-nullvalue. -
Collections. Unless the return type is marked nullable (
T?), an operation whose return type is a collection (e.g.list,set,map) returns an empty collection rather thannull. -
Fluent composition. Builder-style operations return the current instance so that calls can be chained.
2.4.6. Concurrency
Unless explicitly stated otherwise, the stateful types defined by this specification are not thread-safe. A given instance MUST be accessed from a single thread at a time; concurrent use of the same instance without external synchronisation results in undefined behaviour. Distinct instances MAY be used concurrently.
2.5. References and Resources
2.5.1. Calypso References
References to CNA Terminal APIs designate the indicated major version; any later release within the same major is backward-compatible per that API’s evolution policy.
| Reference | Document |
|---|---|
CNA Terminal API — Definitions (SP-CNATerminalAPI-Definitions), version 1.0, Calypso Networks Association. Provides the |
2.5.2. Normative References
| Reference | Document |
|---|---|
Key words for use in RFCs to Indicate Requirement Levels, S. Bradner, March 1997. |
|
Ambiguity of Uppercase vs Lowercase in RFC 2119 Key Words, B. Leiba, May 2017. |
|
Identification cards — Contactless integrated circuit cards — Proximity cards. |
2.5.3. External Resources
| Resource | Link |
|---|---|
Calypso Networks Association |
|
Terminal APIs website |
|
Terminal APIs documentation |
3. Glossary and Acronyms
3.1. Glossary
| Term | Definition |
|---|---|
Card |
Any physical or virtual smart card that can be presented to a reader for selection and dialog. |
Card Reader |
Hardware or software component capable of detecting cards and exchanging data with them. |
Card Selection |
Sequence of operations used to identify, filter and prepare a card for application-level dialog. |
Logical Channel |
Software-level communication path established with a card after a successful selection. |
Basic Channel |
The default logical channel (channel |
Multi-Channel |
Capability of an ISO/IEC 7816-4 card to host several active logical channels in parallel. |
Physical Channel |
Hardware-level communication path between the reader and the card. |
Observable Reader |
Reader implementation able to notify a registered event handler asynchronously of card-related events. |
Power-on Data |
Data returned by the reader at the moment a card is detected (e.g. ATR, virtual ATR, anti-collision data). |
Card Application |
Application Dedicated File (DF) selected on a card, identified by its AID, as defined in ISO/IEC 7816-4. |
AID |
Application IDentifier as defined in ISO/IEC 7816-4 (5 to 16 bytes). |
APDU |
Application Protocol Data Unit, the message format used between the terminal and the card, as defined in ISO/IEC 7816-3. |
ECP |
Enhanced Contactless Polling, an extended polling mechanism enabling fast card detection in mobile transit deployments. |
RF Technology |
Radio-frequency communication technology used by a contactless reader to detect a card, as defined in ISO/IEC 14443. |
Card Type |
Identified product or transport-protocol family of a detected card. |
SPI |
Service Provider Interface — a set of interfaces designed to be implemented by an extension module. |
3.2. Acronyms
| Abbreviation | Expansion |
|---|---|
AID |
Application IDentifier |
APDU |
Application Protocol Data Unit |
ATR |
Answer To Reset |
CNA |
Calypso Networks Association |
DF |
Dedicated File |
ECP |
Enhanced Contactless Polling |
FCI |
File Control Information |
FCP |
File Control Parameters |
FMD |
File Management Data |
ISO |
International Organization for Standardization |
RF |
Radio Frequency |
RFC |
Request For Comments |
SPI |
Service Provider Interface |
UML |
Unified Modelling Language |
4. Architectural Overview
4.1. Functional positioning
The Terminal Reader API sits between the terminal application and the reader drivers, exposing a stable contract on each side:
4.2. Logical namespaces
| Namespace | Role | Summary |
|---|---|---|
|
Public API |
Entry points of the API and the abstractions used to manipulate readers and the events they produce; exposes
|
|
SPI |
Contracts implemented by the application (as opposed to the reader implementation) when readers are observed. |
|
Public API |
Orchestration of card selection scenarios: the central |
|
SPI |
Contracts implemented by card extensions to plug into the selection machinery. |
|
SPI |
Common contract shared by all card transaction managers exposed by card extensions; its three interfaces form a hierarchy letting each extension anchor its transaction manager at the capability level matching its card model (non-ISO, optionally multi-channel, intrinsically multi-channel). |
4.3. Multi-channel design
The Terminal Reader API explicitly supports ISO/IEC 7816-4 cards that host several active logical channels in parallel.
The design follows a three-tier hierarchy in the reader.transaction.spi namespace:
-
CardTransactionManager— root contract common to every transaction manager, regardless of channel model. -
IsoCardTransactionManager— intermediate contract for ISO/IEC 7816-4 cards for which multi-channel is an optional capability of the underlying card. It exposes the cast operationasMultichannelCardTransactionManagerthat returns aMultichannelCardTransactionManagerwhen the card supports it. -
MultichannelCardTransactionManager— contract for cards that are intrinsically multi-channel by design. Consumer APIs whose target cards are always multi-channel SHOULD stereotype their transaction manager directly on this contract.
4.4. Card selection modes
A card selection scenario — prepared through the CardSelectionManager — can be
operated in two ways, chosen according to the reader capability and the use case.
This section is informative. It gives an end-to-end view of the two modes; the normative behaviour of each
operation is defined in the CardSelectionManager section.
|
- Synchronous (explicit)
-
The card is already present on a
CardReader. The application runs the scenario itself withprocessCardSelectionScenario(orprocessMultichannelCardSelectionScenariofor multi-channel cards) and obtains theCardSelectionResultimmediately. The same entity manages both the selection and the subsequent card processing. - Asynchronous (scheduled / event-driven)
-
On an
ObservableCardReader, the scenario is registered ahead of time withscheduleCardSelectionScenarioand executed automatically by the reader upon card insertion. The outcome is delivered as aCardReaderEventto theCardReaderEventHandler— its type (CARD_MATCHEDorCARD_INSERTED) depending on theCardPresenceNotificationPolicy— and decoded withparseScheduledCardSelectionsResponse. Here the reader drives the selection while the event handler performs the card processing.
The runtime execution of the asynchronous mode — the reader states and transitions — is detailed in Reader observation lifecycle.
4.5. Reader observation lifecycle
An ObservableCardReader tracks card insertion and removal through an internal state
machine. The diagram below gives the integrator a complete view of that lifecycle: how
startCardDetection /
stopCardDetection and
endCardProcessing move the reader between states, when a
CardReaderEvent is produced, and how the DetectionMode and
CardPresenceNotificationPolicy settings steer the flow.
| This section is informative. The state and trigger names shown are internal to the implementation and are not part of the normative API surface; they are provided only to explain the observed runtime behavior. |
The diagram uses the following notation:
Triggers — events that drive the transitions:
-
Application triggers (blue transitions in the diagram):
-
CARD_DETECTION_START_REQUESTED— the application calledstartCardDetection. -
CARD_DETECTION_STOP_REQUESTED— the application calledstopCardDetection(factorized on the composite-state boundary). -
CARD_PROCESSING_ENDED— the application calledendCardProcessing.
-
-
Hardware triggers (red transitions in the diagram):
-
CARD_INSERTED— the monitoring job detected a card. -
CARD_REMOVED— the monitoring job detected card removal.
-
Reader capabilities:
-
[MONITORING_DURING_PROCESSING]— the reader can detect card removal while processing is running, AND card processing is executed in a dedicated thread.
Card eligibility:
-
[CARD_PROCESSABLE]— the inserted card matched at least one case of the card selection scenario, OR the notification policy covers every detected card regardless of selection (CardPresenceNotificationPolicy == ALWAYS). -
[CARD_NON_PROCESSABLE]— the inserted card matched no case of the card selection scenario, AND the notification policy is restricted to matched cards (CardPresenceNotificationPolicy == MATCHED_ONLY).
Detection mode — the active DetectionMode, evaluated when a card-processing cycle ends:
-
[REPEATING]— detection resumes after each card-processing cycle, ready for the next card. -
[SINGLE_SHOT]— detection stops after the first card-processing cycle; a new call tostartCardDetectionis required to detect further cards.
Actions — effect executed on a transition:
-
/ facade.operation()— a public API call (event production or event-handler notification). -
/ driver.operation()— a low-level hardware call (hardware notification). -
/ start job— a monitoring job submitted to the background executor.
4.6. UML class diagram
The following UML class diagram provides a visual representation of the types and relationships defined by this specification:
5. API Specification
5.1. Classes
5.1.1. Reader API Properties
Name |
|
|---|---|
Kind |
Final class |
Namespace |
|
Since |
1.0 |
Purpose |
Exposes the immutable properties of the Terminal Reader API. |
Constants
| Name | Type | Since | Description |
|---|---|---|---|
|
|
1.0 |
String representation of the version of the API implemented by the conforming binding (e.g. |
|
The |
5.2. API Interfaces
5.2.1. Basic Card Selector
Name |
|
|---|---|
Kind |
Interface |
Namespace |
|
Extends |
|
Since |
2.0 |
Purpose |
Basic, technology-agnostic card selector. An instance is obtained via |
BasicCardSelector does not add any operation to CardSelector. It exists to express the
absence of ISO/IEC 7816-4-specific filters at the type level.
The filters carried by a selector restrict the selection process to certain cards. They are all optional and MAY be combined. If no filter is specified, any card that responds when presented to the reader is considered selected. Conversely, when one or more filters are defined, the card is not selected as soon as one of them rejects it.
5.2.2. Card Detection Settings
Name |
|
|---|---|
Kind |
Interface (builder) |
Namespace |
|
Since |
3.0 |
Purpose |
Carries the configuration of a card detection cycle. An instance is obtained via |
CardDetectionSettings exposes setters in builder form: each operation returns the current instance to allow
fluent composition. Setters that are not called default to the values specified below.
Default detection mode |
|
|---|---|
Default RF technologies |
|
Default ECP frame |
none |
Set Detection Mode
Signature |
|
|---|---|
Since |
3.0 |
Description |
Sets the detection mode, which governs the reader’s behaviour once a card-processing cycle has terminated.
With When this setter is not called, the detection mode defaults to |
Parameters |
|
Returns |
The current instance ( |
Throws |
None. |
Set ECP Frame
Signature |
|
|---|---|
Since |
3.0 |
Description |
Provides the ECP (Enhanced Contactless Polling) frame to emit at polling startup. The frame is treated by this specification as opaque binary data constructed by the application in accordance with the relevant ECP specification and transmitted as-is to the reader. Relevant only on readers supporting ECP. If the underlying reader does not support ECP, the provided frame is
silently ignored and a When this setter is not called, no ECP frame is emitted (default none; see the defaults above). |
Parameters |
|
Returns |
The current instance ( |
Throws |
|
Set RF Technologies
Signature |
|
|---|---|
Since |
3.0 |
Description |
Declares the set of RF technologies the reader activates during polling. The Not relevant for contact readers; on such readers, this setter is accepted without effect. When this setter is not called, the reader polls the default set |
Parameters |
|
Returns |
The current instance ( |
Throws |
|
5.2.3. Card Reader
Name |
|
|---|---|
Kind |
Interface |
Namespace |
|
Since |
1.0 |
Purpose |
Represents a card reader capable of driving the underlying hardware to manage card detection. |
Get Name
Signature |
|
|---|---|
Since |
1.0 |
Description |
Returns the name of the reader. |
Returns |
A non-empty |
Throws |
None. |
Is Card Present
Signature |
|
|---|---|
Since |
1.0 |
Description |
Indicates whether a card is currently detected by the reader. What counts as present depends on the reader’s
communication mode (see |
Returns |
|
Throws |
|
Is Contactless
Signature |
|
|---|---|
Since |
1.0 |
Description |
Indicates whether the card communication mode is contactless. |
Returns |
|
Throws |
None. |
5.2.4. Card Reader Event
Name |
|
|---|---|
Kind |
Interface |
Namespace |
|
Since |
1.0 |
Purpose |
Data container describing a change of state observed by a |
A CardReaderEvent carries the origin of the event (the reader name), the event type and, when available, the
card selection response. The circumstances under which each event type is emitted are described in Reader observation lifecycle.
Get Reader Name
Signature |
|
|---|---|
Since |
1.0 |
Description |
Returns the name of the reader that generated the event. |
Returns |
A non-empty |
Throws |
None. |
Get Scheduled Card Selections Response
Signature |
|
|---|---|
Since |
1.0 |
Description |
Returns the response of the selection scenario scheduled on the reader. It is When non- |
Returns |
The scheduled card selections response ( |
Throws |
None. |
5.2.5. Card Reader Provider
Name |
|
|---|---|
Kind |
Interface |
Namespace |
|
Since |
3.0 |
Purpose |
Standardised discovery and access surface for the card readers available in the execution environment. |
The CardReaderProvider is obtained from the ReaderApiFactory. It offers an
implementation-agnostic view over the readers currently registered in the environment. Reader lifecycle (registration and un-registration) is handled by the runtime environment; the provider is a
read-only view reflecting the readers active at the moment of each call.
Find Reader
Signature |
|
|---|---|
Since |
3.0 |
Description |
Returns the first reader whose name matches the supplied regular expression. This lookup is convenient when reader names embed variable elements (serial numbers, USB port index, etc.) that the application cannot hard-code. |
Parameters |
|
Returns |
A |
Throws |
|
Get Reader
Signature |
|
|---|---|
Since |
3.0 |
Description |
Returns the reader whose name exactly matches the supplied string. |
Parameters |
|
Returns |
A |
Throws |
None. |
Get Reader Names
Signature |
|
|---|---|
Since |
3.0 |
Description |
Returns the names of all readers currently registered in the execution environment. |
Returns |
A |
Throws |
None. |
Get Readers
Signature |
|
|---|---|
Since |
3.0 |
Description |
Returns all readers currently registered in the execution environment. |
Returns |
A |
Throws |
None. |
5.2.6. Card Selection Manager
Name |
|
|---|---|
Kind |
Interface |
Namespace |
|
Since |
1.0 |
Purpose |
Service responsible for preparing and executing card selection scenarios. An instance is obtained via |
A card selection scenario is composed of one or more selection cases, each backed by a
CardSelectionExtension. A selection case targets a specific card and MAY define
additional commands to be executed after the successful selection. When a selection case fails, the manager tries
the next selection case defined in the scenario, until no further selection case is available. The behaviour of
the scenario is governed by the SelectionExecutionPolicy passed at execution
time:
-
with
STOP_ON_FIRST_MATCH, the manager stops at the first successful selection case; -
with
PROCESS_ALL, the manager processes every selection case regardless of intermediate successes.
For ISO/IEC 7816-4 multi-channel cards, a dedicated execution method is provided
(processMultichannelCardSelectionScenario), parameterised by a
ChannelSelectionPolicy.
The manager provides three flavours of execution: explicit (synchronous) single-channel selection, explicit multi-channel selection, and scheduled (event-driven) selection. It additionally supports export/import of the scenario or its result for distributed architectures. See Card selection modes for an end-to-end view of the synchronous and asynchronous flows.
A scenario is considered prepared once at least one selection case has been appended via prepareSelection. A
prepared scenario MAY be executed multiple times; each execution operates on the scenario as it stood at the time
of the call.
Export Card Selection Scenario
Signature |
|
|---|---|
Since |
1.1 |
Description |
Exports the content of the current prepared selection scenario as a |
Returns |
A non-empty |
Throws |
None. |
See also |
Export Processed Card Selection Scenario
Signature |
|
|---|---|
Since |
1.3 |
Description |
Exports the content of the previously processed selection scenario as a Prerequisite: the selection scenario MUST have been processed previously via Caution: if the local environment does not have all the card extensions involved in the scenario, the
|
Returns |
A non-empty |
Throws |
|
See also |
Import Card Selection Scenario
Signature |
|
|---|---|
Since |
1.1 |
Description |
Imports a previously exported scenario. The input MUST have been produced by |
Parameters |
|
Returns |
The index of the last imported selection in the scenario. |
Throws |
|
See also |
Import Processed Card Selection Scenario
Signature |
|
|---|---|
Since |
1.3 |
Description |
Imports a previously exported processed selection scenario and returns the corresponding result. Prerequisites: the input MUST have been produced by |
Parameters |
|
Returns |
|
Throws |
|
See also |
Parse Scheduled Card Selections Response
Signature |
|
|---|---|
Since |
1.0 |
Description |
Analyses the responses provided by a |
Parameters |
|
Returns |
|
Throws |
|
Prepare Selection
Signature |
|
|---|---|
Since |
2.0 |
Description |
Appends a selection case to the scenario. The returned index gives the position of the selection in the
scenario ( |
Parameters |
|
Returns |
A non-negative |
Throws |
None. |
Process Card Selection Scenario
Signature |
|
|---|---|
Since |
3.0 |
Description |
Explicitly executes the previously prepared selection scenario against the provided reader, with the requested execution policy, and returns the result. |
Parameters |
|
Returns |
|
Throws |
|
Process Multichannel Card Selection Scenario
Signature |
|
|---|---|
Since |
3.0 |
Description |
Explicitly executes the previously prepared selection scenario in multi-channel mode against the provided reader, with the requested channel policy, and returns the result. Prerequisite: the presented card MUST be a multi-channel ISO/IEC 7816-4 card. If it is not, an
|
Parameters |
|
Returns |
|
Throws |
|
Schedule Card Selection Scenario
Signature |
|
|---|---|
Since |
3.0 |
Description |
Schedules the execution of the prepared selection scenario as soon as a card is presented to the supplied
observable reader. Events are pushed to the registered event handler according to the requested notification
policy. The result of the execution MUST be parsed via
|
Parameters |
|
Throws |
None. |
5.2.7. Card Selection Result
Name |
|
|---|---|
Kind |
Interface |
Namespace |
|
Since |
1.0 |
Purpose |
Result of a selection process. |
Each selection case prepared with the manager is associated with the index returned by prepareSelection. The same
index is used to retrieve the corresponding result here. In single-channel mode, at most one case will correspond
to the active selected card. In multi-channel mode, several active selections may coexist; see
getActiveSelectionIndexes.
Get Active Selection Index
Signature |
|
|---|---|
Since |
1.0 |
Description |
Returns the index of the active selection, if any. Identical to the first element of |
Returns |
A non-negative |
Throws |
None. |
Get Active Selection Indexes
Signature |
|
|---|---|
Since |
3.0 |
Description |
Returns the indexes of all active selections, one per channel in multi-channel mode. |
Returns |
A possibly empty list of non-negative |
Throws |
None. |
Get Active Smart Card
Signature |
|
|---|---|
Since |
1.0 |
Description |
Returns the active matching card, i.e. the card that has been selected. In case of multiple active smart cards (multi-channel mode), the active smart card placed on channel |
Returns |
The active |
Throws |
None. |
Get Card Type
Signature |
|
|---|---|
Since |
3.0 |
Description |
Returns the type of the detected card, as defined by the |
Returns |
A |
Throws |
None. |
Get Smart Cards
Signature |
|
|---|---|
Since |
1.0 |
Description |
Returns all |
Returns |
A possibly empty map. |
Throws |
None. |
5.2.8. Card Selector
Name |
|
|---|---|
Kind |
Interface |
Namespace |
|
Generics |
|
Since |
2.0 |
Purpose |
Base contract for all card selectors. Defines filters used to restrict the selection process to a subset of cards. |
All filters defined by this interface are optional and MAY be combined. If no filter is specified, any card that responds when inserted in the reader is considered selected. Conversely, if one or more filters are defined, a card is not selected if at least one of them rejects it.
Filter By Card Type
Signature |
|
|---|---|
Since |
3.0 |
Description |
Restricts the selection process to cards whose detected type matches the provided value.
The The value |
Parameters |
|
Returns |
The current instance ( |
Throws |
None. |
Filter By Power On Data
Signature |
|
|---|---|
Since |
2.0 |
Description |
Restricts the selection process to cards whose power-on data, as provided by the reader, matches a specific regular expression. |
Parameters |
|
Returns |
The current instance ( |
Throws |
|
5.2.9. ISO Card Selector
Name |
|
|---|---|
Kind |
Interface |
Namespace |
|
Extends |
|
Since |
2.0 |
Purpose |
ISO/IEC 7816-4 card selector. An instance is obtained via |
IsoCardSelector adds the ISO/IEC 7816-4-specific filters used to restrict the selection process to certain
cards. Like every selector filter, they are all optional and MAY be combined. If no filter is specified, any
card that responds when presented to the reader is considered selected. Conversely, when one or more filters are
defined, the card is not selected as soon as one of them rejects it.
Filter By DF Name (Byte Array)
Signature |
|
|---|---|
Since |
2.0 |
Description |
Selects a card application DF by its name. The DF is selected only if its name starts with the provided AID, as defined by ISO/IEC 7816-4 § 4.2. The provided AID is used as a parameter of the Select Application ISO card command. |
Parameters |
|
Returns |
The current instance ( |
Throws |
|
Filter By DF Name (String)
Signature |
|
|---|---|
Since |
2.0 |
Description |
Selects a card application DF by its name. The AID is provided as a hexadecimal string. Semantics are otherwise identical to the byte-array overload. |
Parameters |
|
Returns |
The current instance ( |
Throws |
|
Set File Control Information
Signature |
|
|---|---|
Since |
2.0 |
Description |
Sets the file control mode (see ISO/IEC 7816-4). The default value is |
Parameters |
|
Returns |
The current instance ( |
Throws |
None. |
Set File Occurrence
Signature |
|
|---|---|
Since |
2.0 |
Description |
Sets the file occurrence mode (see ISO/IEC 7816-4). The default value is |
Parameters |
|
Returns |
The current instance ( |
Throws |
None. |
5.2.10. Observable Card Reader
Name |
|
|---|---|
Kind |
Interface |
Namespace |
|
Extends |
|
Since |
1.0 |
Purpose |
A |
The observation contract is co-located with the start of detection: a single call to startCardDetection provides
both the CardDetectionSettings that govern the polling behaviour and the
CardReaderEventHandler that receives the resulting events.
The reader’s complete insertion/processing/removal lifecycle — including when each observation event is produced — is described in Reader observation lifecycle.
End Card Processing
Signature |
|
|---|---|
Since |
3.0 |
Description |
Notifies the reader that the business processing of the current card has been completed. Upon receiving this notification, the reader:
In addition, the reader releases the references to the This operation is idempotent: calling it twice on the same card processing cycle has no effect after the
first call. It is RECOMMENDED to call |
Throws |
None. |
Start Card Detection
Signature |
|
|---|---|
Since |
3.0 |
Description |
Activates card detection. Once activated, the application is notified of card events through the registered
Parameters carried by |
Parameters |
|
Throws |
None. |
Stop Card Detection
Signature |
|
|---|---|
Since |
1.0 |
Description |
Stops card detection. After this operation has returned, the registered event handler does not receive card events until detection is restarted. |
Throws |
None. |
5.2.11. Reader API Factory
Name |
|
|---|---|
Kind |
Interface |
Namespace |
|
Since |
2.0 |
Purpose |
Factory used by the application to obtain instances of the public types provided by the API. |
The ReaderApiFactory is the single entry point through which the application instantiates the public types of
the API. It is provided as a single instance whose accessors each return a fresh, fully initialised object.
Create Basic Card Selector
Signature |
|
|---|---|
Since |
2.0 |
Description |
Creates a |
Returns |
|
Throws |
None. |
Create Card Detection Settings
Signature |
|
|---|---|
Since |
3.0 |
Description |
Creates a |
Returns |
|
Throws |
None. |
Create Card Selection Manager
Signature |
|
|---|---|
Since |
2.0 |
Description |
Creates a |
Returns |
|
Throws |
None. |
Create ISO Card Selector
Signature |
|
|---|---|
Since |
2.0 |
Description |
Creates an |
Returns |
An |
Throws |
None. |
Get Card Reader Provider
Signature |
|
|---|---|
Since |
3.0 |
Description |
Returns the |
Returns |
|
Throws |
None. |
5.2.12. Scheduled Card Selections Response
Name |
|
|---|---|
Kind |
Interface (marker) |
Namespace |
|
Since |
1.0 |
Purpose |
Carrier for the response of the execution of a scheduled selection scenario, provided by a |
This interface declares no operation. It conveys the card responses to one or more of the scenario’s selection
cases (selection step itself plus any subsequent commands). Its content MUST be interpreted through
CardSelectionManager.parseScheduledCardSelectionsResponse.
5.3. SPI Interfaces
5.3.1. Card Reader Event Handler
Name |
|
|---|---|
Kind |
Interface (SPI) |
Namespace |
|
Since |
3.0 |
Purpose |
Interface that the application MUST implement to receive reader events and observation errors from an |
This SPI unifies the reception of nominal events (onReaderEvent) and of fatal observation errors
(onReaderError) into a single contract, which the application implements once and registers at the call to
startCardDetection.
On Reader Error
Signature |
|
|---|---|
Since |
3.0 |
Description |
Called when a fatal error occurs on the observed reader. After the operation returns, the observation process is considered stopped. |
Parameters |
|
Throws |
None. |
On Reader Event
Signature |
|
|---|---|
Since |
3.0 |
Description |
Called when a reader event occurs. Dispatch is sequential and synchronous unless a different policy is explicitly documented. |
Parameters |
|
Throws |
None. Any exception thrown by the handler is routed to |
5.3.2. Card Selection Extension
Name |
|
|---|---|
Kind |
Interface (SPI, marker) |
Namespace |
|
Since |
2.0 |
Purpose |
Provided by card extensions to enrich a selection case with additional commands and to interpret the response in order to build the corresponding |
This interface declares no operation at the API level; the contract between the selection manager and the extension is defined by the card extension specification consuming this SPI.
5.3.3. Card Transaction Manager
Name |
|
|---|---|
Kind |
Interface (SPI) |
Namespace |
|
Since |
2.1 |
Purpose |
Root contract common to every card transaction manager exposed by a card extension. Defines the single operation |
To exchange data with a card, the application first prepares the commands to transmit (via the operations of
the consuming card extension) and then processes them. The preparation step allows commands to be grouped to
minimise network exchanges, which is especially valuable in distributed architectures. The
SmartCard registered with the manager is updated after each data exchange with the card.
Process Commands
Signature |
|
|---|---|
Since |
3.0 |
Description |
Processes all previously prepared commands. All APDUs corresponding to the prepared commands are sent to the card, their responses retrieved and used
to update the |
Throws |
|
5.3.4. ISO Card Transaction Manager
Name |
|
|---|---|
Kind |
Interface (SPI) |
Namespace |
|
Extends |
|
Since |
3.0 |
Purpose |
Intermediate contract for ISO/IEC 7816-4 cards. Exposes the on-demand cast to multi-channel. |
As Multichannel Card Transaction Manager
Signature |
|
|---|---|
Since |
3.0 |
Description |
Returns a view of this manager as a Prerequisite: the underlying ISO/IEC 7816-4 card MUST support multi-channel operation; otherwise an |
Returns |
|
Throws |
|
5.3.5. ISO Smart Card
Name |
|
|---|---|
Kind |
Interface (SPI) |
Namespace |
|
Extends |
|
Since |
2.0 |
Purpose |
ISO/IEC 7816-4 smart card whose communication has been established after a successful selection. |
In addition to the inherited power-on data, an IsoSmartCard exposes the response to the Select Application
command. Both the power-on data and the Select Application response are optional, but at least one of them is
always present.
Get Select Application Response
Signature |
|
|---|---|
Since |
1.0 |
Description |
Returns the data received from the card in response to the Select Application command, including the status word. |
Returns |
The non-empty response bytes, or |
Throws |
None. |
Is Basic Channel
Signature |
|
|---|---|
Since |
3.0 |
Description |
Indicates whether this smart card is attached to the basic channel (channel |
Returns |
|
Throws |
None. |
5.3.6. Multichannel Card Transaction Manager
Name |
|
|---|---|
Kind |
Interface (SPI) |
Namespace |
|
Extends |
|
Since |
3.0 |
Purpose |
Multi-channel contract. Exposes the operations to close a logical channel explicitly. |
This contract MAY be obtained either:
-
through
IsoCardTransactionManager.asMultichannelCardTransactionManager, for ISO/IEC 7816-4 cards on which multi-channel is an optional capability; -
directly as the declared stereotype of a card extension targeting intrinsically multi-channel cards.
Close Channel
Signature |
|
|---|---|
Since |
3.0 |
Description |
Closes the underlying logical channel without processing any pending command. This operation is idempotent: calling it on an already-closed channel has no effect. |
Throws |
|
Process Commands And Close Channel
Signature |
|
|---|---|
Since |
3.0 |
Description |
Processes all previously prepared commands and, upon success, closes the underlying logical channel. If any command fails, the channel is left open, as with |
Throws |
|
5.3.7. Smart Card
Name |
|
|---|---|
Kind |
Interface (SPI) |
Namespace |
|
Since |
1.0 |
Purpose |
Basic smart card whose communication has been established after a successful selection. The instance is ready to receive APDUs. |
Card extensions implement (and may extend) this interface to expose the data they collected during the selection.
Get Power On Data
Signature |
|
|---|---|
Since |
1.0 |
Description |
Returns the card’s power-on data, as collected by the reader at the moment the card was inserted.
Because this data varies from one reader to another, it is exposed here as a |
Returns |
The non-empty power-on data, or |
Throws |
None. |
Is Active
Signature |
|
|---|---|
Since |
3.0 |
Description |
Returns whether this smart card is currently active on its logical channel. A smart card is considered active between its creation (as the result of a successful selection case) and the
occurrence of any of the following events, at which point the reader deactivates it (
Until then, the reader holds the references to the |
Returns |
|
Throws |
None. |
5.4. Enumerations
5.4.1. Card Presence Notification Policy
Name |
|
|---|---|
Kind |
Enumeration |
Namespace |
|
Since |
3.0 |
Purpose |
Options applied when a card is detected, used to decide which cards trigger event-handler notifications. |
In the reader observation lifecycle, this policy determines whether a detected card is treated as processable — see Reader observation lifecycle.
| Value | Since | Description |
|---|---|---|
|
3.0 |
All cards presented to the reader are notified, regardless of the result of the selection. |
|
3.0 |
Only cards that have been successfully selected are notified. The others are ignored. |
5.4.2. Card Reader Event Type
Name |
|
|---|---|
Kind |
Enumeration |
Namespace |
|
Since |
1.0 |
Purpose |
Possible card reader events. |
| Value | Since | Description |
|---|---|---|
|
1.0 |
A card has been inserted, with or without a specific selection. |
|
1.0 |
A card has been inserted that matches the selection criteria. |
|
1.0 |
The card has been removed from the reader. |
|
3.0 |
The reader has been unregistered and is no longer usable. |
5.4.3. Channel Selection Policy
Name |
|
|---|---|
Kind |
Enumeration |
Namespace |
|
Since |
3.0 |
Purpose |
Policy governing the use of the basic channel in a multi-channel selection scenario. |
| Value | Since | Description |
|---|---|---|
|
3.0 |
The basic channel (channel |
|
3.0 |
Selection cases are placed only on additional logical channels; the basic channel is not used. |
5.4.4. Detection Mode
Name |
|
|---|---|
Kind |
Enumeration |
Namespace |
|
Since |
3.0 |
Purpose |
Defines the behaviour to apply after a card processing cycle has terminated. |
In the reader observation lifecycle, this setting is the guard that decides whether detection resumes after a card-processing cycle — see Reader observation lifecycle.
| Value | Since | Description |
|---|---|---|
|
3.0 |
The reader continues waiting for the next card insertion. |
|
3.0 |
The reader stops detection after the current card-processing cycle; a new call to |
5.4.5. File Control Information
Name |
|
|---|---|
Kind |
Enumeration |
Namespace |
|
Since |
2.0 |
Purpose |
Types of templates returned in response to the Select Application command, according to ISO/IEC 7816-4. |
| Value | Since | Description |
|---|---|---|
|
2.0 |
File Control Information. |
|
2.0 |
File Control Parameters. |
|
2.0 |
File Management Data. |
|
2.0 |
No response expected. |
5.4.6. File Occurrence
Name |
|
|---|---|
Kind |
Enumeration |
Namespace |
|
Since |
2.0 |
Purpose |
Navigation options through the applications contained on the card according to ISO/IEC 7816-4. |
| Value | Since | Description |
|---|---|---|
|
2.0 |
First occurrence. |
|
2.0 |
Last occurrence. |
|
2.0 |
Next occurrence. |
|
2.0 |
Previous occurrence. |
5.4.7. Selection Execution Policy
Name |
|
|---|---|
Kind |
Enumeration |
Namespace |
|
Since |
3.0 |
Purpose |
Policy governing the iteration over the selection cases of a scenario. |
| Value | Since | Description |
|---|---|---|
|
3.0 |
The manager stops at the first successful selection case. |
|
3.0 |
The manager processes every selection case regardless of intermediate successes. |
5.5. Exceptions
5.5.1. Card Communication Exception
Name |
|
|---|---|
Kind |
Runtime exception |
Namespace |
|
Since |
1.0 |
Purpose |
Indicates that the communication with the card has failed, typically because the card was removed from the reader before the exchange could complete. |
5.5.2. Invalid Card Response Exception
Name |
|
|---|---|
Kind |
Runtime exception |
Namespace |
|
Since |
2.1 |
Purpose |
Indicates that a response received from the card was invalid — typically when the returned status word does not match any of those expected — either during a selection process or during the processing of a transaction. This exception is also raised when an ISO/IEC 7816-4 card does not support a requested multi-channel operation. |
5.5.3. Reader Communication Exception
Name |
|
|---|---|
Kind |
Runtime exception |
Namespace |
|
Since |
1.0 |
Purpose |
Indicates that the communication with the reader has failed. The most likely cause is a physical disconnection of the reader, but other technical problems MAY also be at the origin of the failure. |