cryptnox-sdk-arduino 1.0.0
Arduino library for Cryptnox Hardware Wallet
Loading...
Searching...
No Matches
CW_NfcTransport.h
Go to the documentation of this file.
1/*
2 * SPDX-License-Identifier: LGPL-3.0-or-later
3 * Copyright (c) 2026 Cryptnox SA
4 */
5
16
17#ifndef CW_NFCTRANSPORT_H
18#define CW_NFCTRANSPORT_H
19
20/******************************************************************
21 * 1. Included files
22 ******************************************************************/
23
24#include "platform_compat.h"
25#include <stdint.h>
26
27/******************************************************************
28 * 2. Class declaration
29 ******************************************************************/
30
41public:
46 virtual bool begin() = 0;
47
52 virtual bool inListPassiveTarget() = 0;
53
63 virtual bool sendAPDU(const uint8_t* apdu, uint8_t apduLen,
64 uint8_t* response, uint8_t& responseLen) = 0;
65
81 virtual bool sendAPDULarge(const uint8_t* apdu, uint8_t apduLen,
82 uint8_t* response, uint16_t& responseLen) {
83 uint8_t smallLen = static_cast<uint8_t>(
84 (responseLen > static_cast<uint16_t>(UINT8_MAX))
85 ? static_cast<uint16_t>(UINT8_MAX)
86 : responseLen);
87 bool result = sendAPDU(apdu, apduLen, response, smallLen);
88 responseLen = static_cast<uint16_t>(smallLen);
89 return result;
90 }
91
95 virtual void resetReader() = 0;
96
101 virtual bool printFirmwareVersion() = 0;
102
103 virtual ~CW_NfcTransport() {}
104};
105
106#endif // CW_NFCTRANSPORT_H
Abstract interface for NFC transport operations.
virtual ~CW_NfcTransport()
virtual bool inListPassiveTarget()=0
Detect the presence of a passive ISO-DEP NFC target.
virtual bool sendAPDULarge(const uint8_t *apdu, uint8_t apduLen, uint8_t *response, uint16_t &responseLen)
Send an APDU and receive a response that may exceed 255 bytes.
virtual void resetReader()=0
Reset the NFC reader/field for the next card detection cycle.
virtual bool printFirmwareVersion()=0
Print NFC module firmware version information to the logger.
virtual bool sendAPDU(const uint8_t *apdu, uint8_t apduLen, uint8_t *response, uint8_t &responseLen)=0
Send an APDU command to the card and receive the response.
virtual bool begin()=0
Initialize the NFC transport hardware.
Arduino compatibility shims for non-Arduino (plain C++) builds.