Casimir aims to provide virtual tag discovery and emulation for NFC applications, in order to unlock NFC capability in various testing contexes.
Casimir includes a virtual NFCC implementation, and internally emulates
RF communications between multiple connected hosts. Cf the RF packets
specification in src/rf_packets.pdl.
Casimir may be built and run as a standalone server.
Cuttlefish runs casimir as a host service for emulating the NFC chipset inside the Android phone. The port numbers for a local instance can be obtained from the instance number:
nci_portis7100 + instance_num - 1rf_portis8100 + instance_num - 1
The script scripts/t4at.py may be used to emulate a Type 4-A Tag device on
the RF port, in either listen or poll mode.
To run a basic tag detection test on Cuttlefish:
# Start the cuttlefish instance (numbered 1)
# Wait for NFC start up.
launch_cvd
# Create a tag device connected to the casimir instance.
cd $ANDROID_TOP/packages/modules/Nfc/libnfc-nci/tools/casimir
./scripts/t4at.py --rf-port 8100 --mode listenCasimir currently supports a subset of the NFC features described in the following technical specification documents:
[NCI]NFC Controller Interface Technical Specification Version 2.2[DIGITAL]Digital Protocol Technical Specification Version 2.3[ACTIVITY]Activity Technical Specification Version 2.2
Supported technologies: NFC_A
Supported protocols: ISO_DEP, NFC_DEP
Supported RF interfaces: ISO_DEP, NFC_DEP
| CORE_RESET_CMD CORE_RESET_RSP CORE_RESET_NTF | Completed | |
| CORE_INIT_CMD CORE_INIT_RSP | Completed | To be defined: number and type of RF interfaces. It seems that the mandated default is 1 : frame RF interface. To be defined: default configuration for the NFCC, best is to get one from a real phone NCI trace. |
| CORE_SET_CONFIG_CMD CORE_SET_CONFIG_RSP | Completed | The configuration is saved but currently unused. Basic validation is implemented. |
| CORE_GET_CONFIG_CMD CORE_GET_CONFIG_RSP | Completed | |
| CORE_CONN_CREATE_CMD CORE_CONN_CREATE_RSP | Completed | |
| CORE_CONN_CLOSE_CMD CORE_CONN_CLOSE_RSP | Completed | |
| CORE_CONN_CREDITS_NTF | Completed | |
| CORE_GENERIC_ERROR_NTF CORE_INTERFACE_ERROR_NTF | Not started | Unused in the implementation so far |
| CORE_SET_POWER_SUB_STATE_CMD CORE_SET_POWER_SUB_STATE_RSP | In progress | Implemented as stub |
| RF_DISCOVER_MAP_CMD RF_DISCOVER_MAP_RSP | Completed | |
| RF_SET_LISTEN_MODE_ROUTING_CMD RF_SET_LISTEN_MODE_ROUTING_RSP | In progress | Implemented as stub |
| RF_GET_LISTEN_MODE_ROUTING_CMD RF_GET_LISTEN_MODE_ROUTING_RSP RF_GET_LISTEN_MODE_ROUTING_NTF | In progress | Implemented as stub |
| RF_DISCOVER_CMD RF_DISCOVER_RSP RF_DISCOVER_NTF | Completed | |
| RF_DISCOVER_SELECT_CMD RF_DISCOVER_SELECT_RSP | In progress | Missing protocol and interface combinations |
| RF_INTF_ACTIVATED_NTF | Completed | |
| RF_DEACTIVATE_CMD RF_DEACTIVATE_RSP RF_DEACTIVATE_NTF | In progress | |
| RF_FIELD_INFO_NTF | Completed | |
| RF_T3T_POLLING_CMD RF_T3T_POLLING_RSP RF_T3T_POLLING_NTF | Not started | |
| RF_NFCEE_ACTION_NTF | Not started | |
| RF_NFCEE_DISCOVERY_REQ_NTF | Completed | |
| RF_PARAMETER_UPDATE_CMD RF_PARAMETER_UPDATE_RSP | Not started | |
| RF_INTF_EXT_START_CMD RF_INTF_EXT_START_RSP | Not started | |
| RF_INTF_EXT_STOP_CMD RF_INTF_EXT_STOP_RSP | Not started | |
| RF_EXT_AGG_ABORT_CMD RF_EXT_AGG_ABORT_RSP | Not started | |
| RF_NDEF_ABORT_CMD RF_NDEF_ABORT_RSP | Not started | |
| RF_ISO_DEP_NAK_PRESENCE_CMD RF_ISO_DEP_NAK_PRESENCE_RSP RF_ISO_DEP_NAK_PRESENCE_NTF | Not started | |
| RF_SET_FORCED_NFCEE_ROUTING_CMD RF_SET_FORCED_NFCEE_ROUTING_RSP | Not started |
| NFCEE_DISCOVER_CMD NFCEE_DISCOVER_RSP NFCEE_DISCOVER_NTF | In progress | Implemented discovery for one NFCEE (eSE (ST)) reproducing the configuration found on Pixel7 devices. |
| NFCEE_MODE_SET_CMD NFCEE_MODE_SET_RSP NFCEE_MODE_SET_NTF | Completed | |
| NFCEE_STATUS_NTF | Not started | |
| NFCEE_POWER_AND_LINK_CNTRL_CMD NFCEE_POWER_AND_LINK_CNTRL_RSP | Not started |