OLD | NEW |
(Empty) | |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. |
| 4 |
| 5 module device; |
| 6 |
| 7 enum NFCErrorType { |
| 8 SECURITY, |
| 9 NOT_SUPPORTED, |
| 10 DEVICE_DISABLED, |
| 11 NOT_FOUND, |
| 12 INVALID_MESSAGE, |
| 13 OPERATION_CANCELLED, |
| 14 TIMER_EXPIRED, |
| 15 CANNOT_CANCEL, |
| 16 IO_ERROR |
| 17 }; |
| 18 |
| 19 enum NFCRecordType { |
| 20 EMPTY, |
| 21 TEXT, |
| 22 URL, |
| 23 JSON, |
| 24 OPAQUE |
| 25 }; |
| 26 |
| 27 enum NFCPushTarget { |
| 28 TAG, |
| 29 PEER, |
| 30 ANY |
| 31 }; |
| 32 |
| 33 enum NFCWatchMode { |
| 34 WEBNFC_ONLY, |
| 35 ANY |
| 36 }; |
| 37 |
| 38 struct NFCError { |
| 39 NFCErrorType error_type; |
| 40 }; |
| 41 |
| 42 struct NFCRecord { |
| 43 NFCRecordType recordType; |
| 44 string? mediaType; |
| 45 array<uint8> data; |
| 46 }; |
| 47 |
| 48 struct NFCMessage { |
| 49 array<NFCRecord> data; |
| 50 string? url; |
| 51 }; |
| 52 |
| 53 struct NFCPushOptions { |
| 54 NFCPushTarget target; |
| 55 double timeout; |
| 56 bool ignoreRead; |
| 57 }; |
| 58 |
| 59 struct NFCRecordTypeFilter { |
| 60 NFCRecordType recordType; |
| 61 }; |
| 62 |
| 63 struct NFCWatchOptions { |
| 64 string? url; |
| 65 NFCRecordTypeFilter? recordFilter; |
| 66 string? mediaType; |
| 67 NFCWatchMode mode; |
| 68 }; |
| 69 |
| 70 interface NFC { |
| 71 SetClient(NFCClient client); |
| 72 Push(NFCMessage message, NFCPushOptions? options) => (NFCError? error); |
| 73 CancelPush(NFCPushTarget target) => (NFCError? error); |
| 74 Watch(NFCWatchOptions options) => (uint32 id, NFCError? error); |
| 75 CancelWatch (uint32 id) => (NFCError? error); |
| 76 CancelAllWatches () => (NFCError? error); |
| 77 SuspendNFCOperations(); |
| 78 ResumeNFCOperations(); |
| 79 }; |
| 80 |
| 81 interface NFCClient { |
| 82 OnWatch(uint32 id, NFCMessage message); |
| 83 }; |
OLD | NEW |