| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 [DartPackage="mojo_services"] | 5 [DartPackage="mojo_services"] |
| 6 module nfc; | 6 module nfc; |
| 7 | 7 |
| 8 struct NfcData { | 8 struct NfcData { |
| 9 array<uint8>? data; | 9 array<uint8>? data; |
| 10 }; | 10 }; |
| 11 | 11 |
| 12 // Represents an in-progress nfc transmission. | 12 // Represents an in-progress nfc transmission. |
| 13 interface NfcTransmission { | 13 interface NfcTransmission { |
| 14 // Cancels the nfc transmission. | 14 // Cancels the nfc transmission. |
| 15 Cancel(); | 15 Cancel(); |
| 16 }; | 16 }; |
| 17 | 17 |
| 18 // NfcReceivers can be registered with Nfc to receive nfc messages. | 18 // NfcReceivers can be registered with Nfc to receive nfc messages. |
| 19 [ServiceName="nfc::NfcReceiver"] |
| 19 interface NfcReceiver { | 20 interface NfcReceiver { |
| 20 OnReceivedNfcData(NfcData nfc_data); | 21 OnReceivedNfcData(NfcData nfc_data); |
| 21 }; | 22 }; |
| 22 | 23 |
| 23 // Nfc allows data to be sent to and received from other MojoShells on Android. | 24 // Nfc allows data to be sent to and received from other MojoShells on Android. |
| 24 // Received data is passed to all registered NfcReceivers. | 25 // Received data is passed to all registered NfcReceivers. |
| 26 [ServiceName="nfc::Nfc"] |
| 25 interface Nfc { | 27 interface Nfc { |
| 26 // Puts the MojoShell in a state where it will transmit |nfc_data| to the next | 28 // Puts the MojoShell in a state where it will transmit |nfc_data| to the next |
| 27 // Android device to connect to this one via NFC. This transmission state | 29 // Android device to connect to this one via NFC. This transmission state |
| 28 // will remain active until cancelled via |transmission| or a |success| | 30 // will remain active until cancelled via |transmission| or a |success| |
| 29 // response is received indicating whether the transmission was successful | 31 // response is received indicating whether the transmission was successful |
| 30 // (true) or not (false). If the Android device transmitted to does not have | 32 // (true) or not (false). If the Android device transmitted to does not have |
| 31 // MojoShell installed it will be directed to the Play Store to download | 33 // MojoShell installed it will be directed to the Play Store to download |
| 32 // MojoShell. | 34 // MojoShell. |
| 33 TransmitOnNextConnection(NfcData nfc_data, NfcTransmission&? transmission) | 35 TransmitOnNextConnection(NfcData nfc_data, NfcTransmission&? transmission) |
| 34 => (bool success); | 36 => (bool success); |
| 35 | 37 |
| 36 // Registers an app to receive nfc messages. Upon receiving an nfc message | 38 // Registers an app to receive nfc messages. Upon receiving an nfc message |
| 37 // the app will be connected to. If the app exposes a NfcReceiver interface | 39 // the app will be connected to. If the app exposes a NfcReceiver interface |
| 38 // it will be called with the message received. | 40 // it will be called with the message received. |
| 39 Register(); | 41 Register(); |
| 40 | 42 |
| 41 // Unregisters an app previously registered via |Register()|. | 43 // Unregisters an app previously registered via |Register()|. |
| 42 Unregister(); | 44 Unregister(); |
| 43 }; | 45 }; |
| OLD | NEW |