- From: Alexander Shalamov via GitHub <sysbot+gh@w3.org>
- Date: Wed, 28 Oct 2015 13:38:30 +0000
- To: public-web-nfc@w3.org
For multiple adapters (should be applicable for N adapters):
**One pending push operation: push(tag)**
**Case 1:** One physical NFC tag **OR** one NFC tag + one peer
* One of adapters pushes => resolve / reject
**Case 2:** Two physical NFC tags are activated simultaneously **OR**
one tag is being written while another enters RF field generated by
second adapter
* When push completes by both adapters => resolve
* Any of push operations fails => reject
**Two pending push operations: push(tag) + push(peer)**
**Case 3:** One physical NFC tag
* When push suceeds resolve promise for push(tag)
* Keep push(peer) unresolved
**Case 4:** Two tags (similar to **Case 2**)
* When push completes by both adapters => resolve push(tag)
* Any of pushes fails => reject push(tag)
* Keep push(peer) unresolved
**Case 5:** One peer
* Resolve / reject push(peer)
* Keep push(tag) unresolved
**Case 6:** Two peers (similar to **Case 2**, but with NFC peers)
* When push completes on both adapters => resolve push(peer)
* Otherwise reject push(peer)
* Keep push(tag) unresolved
At the moment I'm rewriting POC with following interface:
```javascript
partial interface Navigator {
readonly attribute NFC nfc;
};
interface NFC {
Promise<void> push (sequence<NFCRecord> records, optional
NFCPushOptions options);
Promise<void> cancelPush (NFCPushTarget target);
Promise<long> watch (MessageCallback callback, optional
NFCWatchOptions options);
Promise<void> unwatch (long id);
}
```
Note that cancelPush returns promise, since operation is asynchronous
and I need to check from platform whether it is possible to cancel
push.
Also watch(...) has reversed parameters, IMO it is easier to write:
```javascript
// Watch options are defaulted
navigator.nfc.watch(callback);
```
--
GitHub Notif of comment by alexshalamov
See https://github.com/w3c/web-nfc/issues/67#issuecomment-151847008
Received on Wednesday, 28 October 2015 13:38:32 UTC