Open markus-becker-tridonic-com opened 4 years ago
Is this a replacement for SNEP which is being deprecated in Android?
The SNEP is a simple protocol for doing peer-to-peer (P2P) NDEF transfers. It is not supported by CoreNFC (iOS) and it is being deprecated on Android (where is branded Android Beam) due to security issues).
I do not know much more than what is written in https://futureiot.tech/nfc-forum-releases-new-specifications-to-improve-connectivity-of-iot-devices/.
Stack explained here: https://nfc-forum.org/our-work/specification-releases/specifications/#specs
I guess we need some native (Android etc) support before we can consider supporting this?
We have not exposed SNEP directly, so I wonder do we have to expose TNEP directly, or can it be encapsulated? What TNEP specific interactions or options need to be exposed to web pages?
And yes, a prerequisite is Android support for this.
I guess we need some native (Android etc) support before we can consider supporting this?
Isn't it layered on top of NDEF without the need of P2P? According to the stack it seems below NDEF.
The Nordic library https://github.com/NordicPlayground/fw-nrfconnect-nrf/blob/master/subsys/nfc/tnep/tag.c seems to be layered on top of NDEF.
From my quick look at this, this looks like an official HCE (host card emulation) API, so it will probably need something like that. I think it is great with an official HCE API but it requires Android moving to this new API or us to emulate it ontop of what is already there.
This probably requires a lot of research
Update: One part of it TNEP Tag Device
act similar to a NDEF version of HCE, where as TNEP Polling Device
is more similar to how an active device (say Android phone) works today.
There are a few extra records that we will need to support.
What is the platform support of those records?
I don't think you need any platform support for those as long as you can write well-known records, like smart poster without native support - can we do that?
This here basically shows what they contain in the payload:
You can create these record on Android:
Just choose Well known and manually construct the payload
As far as I understand - only Tag Type 2, 3, 4, 5 have been updated to support TNEP:
I assume this means that any TNEP Polling Device can only read these tag types (not non-standard like Mifare, or NFC Forum Type 1) and Android HCE (which emulates Type 4)
From reading source code:
#define NFC_TNEP_VERSION 0x10
enum nfc_tnep_comm_mode {
/** Single response communication mode */
NFC_TNEP_COMM_MODE_SINGLE_RESPONSE,
/** Service specific communication mode */
NFC_TNEP_COMM_MODE_SERVICE_SPECYFIC = 0xFE
};
/** Maximum Service Waiting Time. */
#define NFC_TNEP_TAG_MAX_WAIT_TIME 63
/** Maximum Waiting Time extension. */
#define NFC_TNEP_TAG_MAX_N_WAIT_TIME 15
enum nfc_tnep_status_value {
/** Success */
NFC_TNEP_STATUS_SUCCESS,
/** TNEP protocol error */
NFC_TNEP_STATUS_PROTOCOL_ERROR,
/** First service error code. */
NFC_TNEP_STATUS_SERVICE_ERROR_BEGIN = 0x80,
/** Last service error code. */
NFC_TNEP_STATUS_SERVICE_ERROR_END = 0xFE,
};
byte: version (0x10) byte: uri length in bytes uri length bytes: uri byte: communication_mode (0x01 single response, 0xFE service specific) byte: min_time (0...63 - converted to time units using protocol specified formula) byte: max_time_ext (0...15 repetitions) 2 bytes (Big Endian): max_size in bytes
byte: status (0x01 success, 0x02 protocol error, 0x80...0xFE service specific errors)
byte: uri length in bytes uri length bytes: uri
It also seems like we could implement the TNEP Tag Device API on top of Android HCE (Host Card Emulation, Type 4 Tag emulation + ISO-DEP / APDU). We considered this already as a replacement for SNEP (NDEF push).
It is exactly how it is accomplished on the Nordic devices, if you check the Tag Device demo:
Split the Tag Device part out into https://github.com/w3c/web-nfc/issues/563
Would it be possible to test TNEP with WebNFC right now using external type records or would one have to wait until Tp, Te and Ts have been added to the specification and implementation?
@markus-becker-tridonic-com you would have to wait until that is added yes.
Did some exploration here: https://github.com/w3c/web-nfc/issues/567
From https://nfc-forum.org/product/nfc-forum-tag-ndef-exchange-protocol-tnep-candidate-specification-1-0/:
Would be nice to support this with web-nfc and/or a library on top of web-nfc.
Devices based on Nordic chips implement TNEP tag-wise: https://developer.nordicsemi.com/nRF_Connect_SDK/doc/latest/nrf/include/nfc/tnep/tnep.html