Host Protocols Direct Protocol HCE class
September 3, 2025 at 8:27 AMSpringCore Direct HCE class
The HCE class uses the Interrupt endpoint to convey Host-based Card Emulation events to the host. It also allows the host to control the NFC interface.
CLA value
The HCE class uses CLA=57
.
Message format - Interrupts
The SpringCore device sends message using this class over the Interrupt endpoint to inform the host of any change in the NFC HCE state machine.
The commands and the responses use the same format.
Field | Length | Description / remark |
---|---|---|
Header | 4 bytes | CLA = 57 , LEN = 0 |
Status | 1 byte | See below |
Status bits
The Status byte is a combination of the following bits:
Bit | Mask | Nickname | Description |
---|---|---|---|
0 | 00 |
FIELD_DOWN | The (external) RF field has been lost |
1 | 01 |
FIELD_UP | An external RF field has been detected |
2 | 02 |
SELECTED | The (virtual) PICC has been selected by the (external) PCD |
3 | 04 |
CAPDU_READY | An APDU has been received by the (virtual) PICC and is ready for processing The host shall invoke PULL_CAPDU to retrieve the command issued by the (external) PCD, then provide its response through PUSH_RAPDU This bit is cleared when the host has read the CAPDU |
4 | 08 |
DESELECTED | The (virtual) PICC has been put in HALTed/DESelected state by the (external) PCD This bit is systematically cleared once read by the host |
Remark: events can be combined. The host application shall update its state machine accordingly.
Message format - Commands and Responses
The commands and the responses use the same format.
Field | Length | Description / remark |
---|---|---|
Header | 4 or 6 bytes | CLA = 57 , LEN = length of Data |
INS / STA | 1 byte | Command: opcode of the INStruction Response: STAtus |
Data | 0 or more bytes | Command data Response data |
List of INStructions
The INS
opcodes are defined below:
INS | Name | Description |
---|---|---|
00 |
STOP | Leave the HCE mode (same as NFC_HCE_STOP in the CONTROL class) |
01 |
START | Enter the HCE mode (same as NFC_HCE_START in the CONTROL class) |
02 |
GET_STATUS | Retrieve the Status bits (DO NOT DO THAT! wait for the Interrupt instead!) |
03 |
PULL_CAPDU | Retrieve the command APDU received by the (virtual) PICC from the (external) PCD |
04 |
PUSH_RAPDU | Provide the (virtual) PICC with the response APDU to be sent to the (external) PCD |
List of STAtus
The class-specific STA
values are listed below; other more generic error codes can also be returned:
STA | Name | Description |
---|---|---|
00 |
MI_OK/SUCCESS | Success |
03 |
MI_EMPTY | No C-APDU available |
26 |
MI_TARGET_NOT_ACTIVE | The (virtual) PICC is deselected |
27 |
MI_FIELD_DOWN | The external RF field has been lost |
3B |
MI_WRONG_MODE | The device is not in NFC HCE mode |
70 |
MI_BUFFER_OVERFLOW | The provided R-APDU does not fit in the device’s memory |
F1 |
NOT_AVAILABLE | NFC HCE is not supported by this device or has been disabled by configuration |
F4 |
WRONG_LENGTH | Invalid length for parameters and data |
F5 |
INS_NOT_SUPPORTED | INStruction not supported |