gecko/dom/nfc/nsINfcContentHelper.idl
Yoshi Huang 03fb2771fd Bug 1096897 - Part 2: change power to changeRFState. r=dimi
From 4ca465353c1c5bd5bc08f40195ad66cc1c407549 Mon Sep 17 00:00:00 2001
---
 dom/nfc/NfcContentHelper.js        | 30 ++++++------------------------
 dom/nfc/gonk/Nfc.js                | 26 ++++++--------------------
 dom/nfc/gonk/NfcGonkMessage.h      |  4 ++--
 dom/nfc/gonk/NfcMessageHandler.cpp | 20 ++++++++++----------
 dom/nfc/gonk/NfcMessageHandler.h   |  4 ++--
 dom/nfc/nsINfcContentHelper.idl    | 21 +++++----------------
 dom/nfc/nsNfc.js                   | 13 ++++++++++---
 7 files changed, 41 insertions(+), 77 deletions(-)
2014-11-12 10:13:33 +08:00

160 lines
4.6 KiB
Plaintext

/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#include "nsISupports.idl"
#include "nsIDOMDOMRequest.idl"
interface nsIVariant;
[scriptable, uuid(9b43bdda-52f4-4712-b28c-ad7cba736e14)]
interface nsINfcTagEvent : nsISupports
{
readonly attribute nsIVariant techList;
// one of NFCTagType defined in MozNFCTag.webidl.
readonly attribute DOMString tagType;
readonly attribute long maxNDEFSize;
readonly attribute boolean isReadOnly;
readonly attribute boolean isFormatable;
};
[scriptable, uuid(42c7a85f-59ae-4bde-b961-e1f1436476c3)]
interface nsINfcEventListener : nsISupports
{
/**
* Callback function used to notify tagfound.
*
* @param sessionToken
* SessionToken received from parent process
* @param event
* nsINfcTagFoundEvent received from parent process.
* @param ndefRecords
* NDEF records pre-read during tag-discovered.
*/
void notifyTagFound(in DOMString sessionToken,
in nsINfcTagEvent event,
in nsIVariant ndefRecords);
/**
* Callback function used to notify taglost.
*
* @param sessionToken
* SessionToken received from parent process
*/
void notifyTagLost(in DOMString sessionToken);
/**
* Callback function used to notify peerfound/peerready.
* @param sessionToken
* SessionToken received from parent process
* @param isPeerReady
* Set to true to dispatch peerready instead of peerfound
*/
void notifyPeerFound(in DOMString sessionToken, [optional] in boolean isPeerReady);
/**
* Callback function used to notify peerlost.
*
* @param sessionToken
* SessionToken received from parent process
*/
void notifyPeerLost(in DOMString sessionToken);
};
[scriptable, uuid(486dff99-6755-428b-834d-3647ce276b54)]
interface nsINfcContentHelper : nsISupports
{
void init(in nsIDOMWindow window);
boolean checkSessionToken(in DOMString sessionToken, in boolean isP2P);
nsIDOMDOMRequest readNDEF(in DOMString sessionToken);
nsIDOMDOMRequest writeNDEF(in nsIVariant records, in DOMString sessionToken);
nsIDOMDOMRequest makeReadOnly(in DOMString sessionToken);
nsIDOMDOMRequest connect(in unsigned long techType, in DOMString sessionToken);
nsIDOMDOMRequest close(in DOMString sessionToken);
/**
* Initiate send file operation.
*
* @param blob
* Raw data of the file to be sent. This object represents a file-like
* (nsIDOMFile) object of immutable, raw data. The blob data needs
* to be 'object wrapped' before calling this interface.
*
* @param sessionToken
* Current token
*
* Returns DOMRequest, if initiation of send file operation is successful
* then 'onsuccess' is called else 'onerror'
*/
nsIDOMDOMRequest sendFile(in jsval blob,
in DOMString sessionToken);
/**
* Add the event listener.
*
* @param listener
* An instance of the nsINfcEventListener.
*/
void addEventListener(in nsINfcEventListener listener);
/**
* Register the given application id with parent process
*
* @param appId
* Application ID to be registered
*/
void registerTargetForPeerReady(in unsigned long appId);
/**
* Unregister the given application id with parent process
*
* @param appId
* Application ID to be registered
*/
void unregisterTargetForPeerReady(in unsigned long appId);
/**
* Checks if the given application's id is a registered peer target (with the parent process)
*
* @param appId
* Application ID to be updated with parent process
*
* Returns DOMRequest, if appId is registered then 'onsuccess' is called else 'onerror'
*/
nsIDOMDOMRequest checkP2PRegistration(in unsigned long appId);
/**
* Notify the parent process that user has accepted to share nfc message on P2P UI
*
* @param appId
* Application ID that is capable of handling NFC_EVENT_PEER_READY event
*/
void notifyUserAcceptedP2P(in unsigned long appId);
/**
* Notify the status of sendFile operation to parent process
*
* @param status
* Status of sendFile operation
*
* @param requestId
* Request ID of SendFile DOM Request
*/
void notifySendFileStatus(in octet status,
in DOMString requestId);
/**
* Change RF state.
*
* @param rfState. Possible values are 'idle', 'listen' and 'discovery'.
*/
nsIDOMDOMRequest changeRFState(in DOMString rfState);
};