summaryrefslogtreecommitdiffstats
path: root/device
diff options
context:
space:
mode:
authoralexander.shalamov <alexander.shalamov@intel.com>2015-12-07 04:04:37 -0800
committerCommit bot <commit-bot@chromium.org>2015-12-07 12:05:17 +0000
commit3e3f71c7c789109fa49aa9818620551025ddfed1 (patch)
tree24c975207debb0ffdc3546531c513a10ad3025e9 /device
parentac80984e24fa520ca86ad9fd0954bd00fbcf075a (diff)
downloadchromium_src-3e3f71c7c789109fa49aa9818620551025ddfed1.zip
chromium_src-3e3f71c7c789109fa49aa9818620551025ddfed1.tar.gz
chromium_src-3e3f71c7c789109fa49aa9818620551025ddfed1.tar.bz2
[webnfc] Introduce NFC mojo service.
This patch adds NFC mojo service interface definition that will be used to implement functionality required by the W3C WebNFC module. BUG=520391 Review URL: https://codereview.chromium.org/1486033002 Cr-Commit-Position: refs/heads/master@{#363455}
Diffstat (limited to 'device')
-rw-r--r--device/nfc/BUILD.gn9
-rw-r--r--device/nfc/nfc.gyp10
-rw-r--r--device/nfc/nfc.mojom83
3 files changed, 102 insertions, 0 deletions
diff --git a/device/nfc/BUILD.gn b/device/nfc/BUILD.gn
index 340c924..5932bf6 100644
--- a/device/nfc/BUILD.gn
+++ b/device/nfc/BUILD.gn
@@ -2,6 +2,9 @@
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
+import("//build/config/features.gni")
+import("//mojo/public/tools/bindings/mojom.gni")
+
static_library("nfc") {
sources = [
"nfc_adapter.cc",
@@ -40,3 +43,9 @@ static_library("nfc") {
]
}
}
+
+mojom("mojo_bindings") {
+ sources = [
+ "nfc.mojom",
+ ]
+}
diff --git a/device/nfc/nfc.gyp b/device/nfc/nfc.gyp
index ccd62b5..710bd22 100644
--- a/device/nfc/nfc.gyp
+++ b/device/nfc/nfc.gyp
@@ -50,5 +50,15 @@
}],
],
},
+ {
+ 'target_name': 'device_nfc_mojo_bindings',
+ 'type': 'static_library',
+ 'includes': [
+ '../../third_party/mojo/mojom_bindings_generator.gypi',
+ ],
+ 'sources': [
+ 'nfc.mojom',
+ ],
+ },
],
}
diff --git a/device/nfc/nfc.mojom b/device/nfc/nfc.mojom
new file mode 100644
index 0000000..72b3e9e
--- /dev/null
+++ b/device/nfc/nfc.mojom
@@ -0,0 +1,83 @@
+// Copyright 2015 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+module device;
+
+enum NFCErrorType {
+ SECURITY,
+ NOT_SUPPORTED,
+ DEVICE_DISABLED,
+ NOT_FOUND,
+ INVALID_MESSAGE,
+ OPERATION_CANCELLED,
+ TIMER_EXPIRED,
+ CANNOT_CANCEL,
+ IO_ERROR
+};
+
+enum NFCRecordType {
+ EMPTY,
+ TEXT,
+ URL,
+ JSON,
+ OPAQUE
+};
+
+enum NFCPushTarget {
+ TAG,
+ PEER,
+ ANY
+};
+
+enum NFCWatchMode {
+ WEBNFC_ONLY,
+ ANY
+};
+
+struct NFCError {
+ NFCErrorType error_type;
+};
+
+struct NFCRecord {
+ NFCRecordType recordType;
+ string? mediaType;
+ array<uint8> data;
+};
+
+struct NFCMessage {
+ array<NFCRecord> data;
+ string? url;
+};
+
+struct NFCPushOptions {
+ NFCPushTarget target;
+ double timeout;
+ bool ignoreRead;
+};
+
+struct NFCRecordTypeFilter {
+ NFCRecordType recordType;
+};
+
+struct NFCWatchOptions {
+ string? url;
+ NFCRecordTypeFilter? recordFilter;
+ string? mediaType;
+ NFCWatchMode mode;
+};
+
+interface NFC {
+ SetClient(NFCClient client);
+ Push(NFCMessage message, NFCPushOptions? options) => (NFCError? error);
+ CancelPush(NFCPushTarget target) => (NFCError? error);
+ Watch(NFCWatchOptions options) => (uint32 id, NFCError? error);
+ CancelWatch (uint32 id) => (NFCError? error);
+ CancelAllWatches () => (NFCError? error);
+ SuspendNFCOperations();
+ ResumeNFCOperations();
+};
+
+interface NFCClient {
+ OnWatch(uint32 id, NFCMessage message);
+};