| // 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. |
| |
| [DartPackage="mojo_services"] |
| module nfc; |
| |
| struct NfcData { |
| array<uint8>? data; |
| }; |
| |
| // Represents an in-progress nfc transmission. |
| interface NfcTransmission { |
| // Cancels the nfc transmission. |
| Cancel(); |
| }; |
| |
| // NfcReceivers can be registered with Nfc to receive nfc messages. |
| interface NfcReceiver { |
| OnReceivedNfcData(NfcData nfc_data); |
| }; |
| |
| // Nfc allows data to be sent to and received from other MojoShells on Android. |
| // Received data is passed to all registered NfcReceivers. |
| interface Nfc { |
| // Puts the MojoShell in a state where it will transmit |nfc_data| to the next |
| // Android device to connect to this one via NFC. This transmission state |
| // will remain active until cancelled via |transmission| or a |success| |
| // response is received indicating whether the transmission was successful |
| // (true) or not (false). If the Android device transmitted to does not have |
| // MojoShell installed it will be directed to the Play Store to download |
| // MojoShell. |
| TransmitOnNextConnection(NfcData nfc_data, NfcTransmission&? transmission) |
| => (bool success); |
| |
| // Registers an app to receive nfc messages. Upon receiving an nfc message |
| // the app will be connected to. If the app exposes a NfcReceiver interface |
| // it will be called with the message received. |
| Register(); |
| |
| // Unregisters an app previously registered via |Register()|. |
| Unregister(); |
| }; |