Re: [web-nfc] Do we want to add support for writing sub records? (#357)

Given the recent shift towards low-level API, the current type mapping is more and more dissonant.
I noticed that it's really confusing to people and it's frustrating for me, too.

Therefore I would like to shift to a simple and direct type-mapping, almost the same as now, but more direct mapping with the NFC specs.
```
TNF=0 --> "empty"
TNF=1 --> TYPE="T" --> recordType="text", mediaType="text/plain"
            --> TYPE="U" --> recordType="url", mediaType="text/plain"
            --> TYPE="Sp" --> recordType="smart-poster" (with local types), mediaType=
[
           --> TYPE="Sig" --> recordType="signature", mediaType=TBD
            --> TYPE="Hc"  -->recordType="handover-carrier", mediaType=TBD
            --> TYPE="Hr"  -->recordType="handover-request", mediaType=TBD
            --> TYPE="Hs"  -->recordType="handover-select"
]
TNF=2, TYPE=<mime-type> --> recordType="media" or "mime", mediaType=<mime-type>
TNF=3, TYPE=<url> --> recordType="absolute-url", mediaType=<url>
TNF=4, TYPE=<external-type> --> recordType="external", mediaType=<external-type>
TNF=5, no TYPE --> recordType="unknown", mediaType="application/octet-stream"
TNF=6, CF=1, ID, TYPE=<mime-type>  --> recordType="unchanged", mediaType=<mime-type> (starting chunk)
TNF=6, CF=1, no ID, no TYPE --> recordType="unchanged", mediaType=null (mid chunk)
TNF=6, CF=0, no ID, no TYPE --> recordType="unchanged", mediaType=null (last chunk)
```

We probably won't see TNF=6, but the spec needs to map it.

This is almost the same as we have now, but no `"opaque"` and no `"json"`, though I think it might be useful to allow recordType="json" as a sub-case of "media" (or "mime") for reverse mapping (that would map to TNF=2, TYPE=<json-type> with default value "application/json".



-- 
GitHub Notification of comment by zolkis
Please view or discuss this issue at https://github.com/w3c/web-nfc/issues/357#issuecomment-541565806 using your GitHub account

Received on Monday, 14 October 2019 09:04:51 UTC