2013-11-05 14:18:56 -08:00
|
|
|
/* 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;
|
|
|
|
|
2014-10-21 20:48:40 -07:00
|
|
|
[scriptable, uuid(9b43bdda-52f4-4712-b28c-ad7cba736e14)]
|
2014-10-20 02:53:39 -07:00
|
|
|
interface nsINfcTagEvent : nsISupports
|
|
|
|
{
|
|
|
|
readonly attribute nsIVariant techList;
|
2014-10-21 20:48:40 -07:00
|
|
|
|
|
|
|
// one of NFCTagType defined in MozNFCTag.webidl.
|
|
|
|
readonly attribute DOMString tagType;
|
|
|
|
|
|
|
|
readonly attribute long maxNDEFSize;
|
|
|
|
|
|
|
|
readonly attribute boolean isReadOnly;
|
|
|
|
|
|
|
|
readonly attribute boolean isFormatable;
|
2014-10-20 02:53:39 -07:00
|
|
|
};
|
|
|
|
|
2014-11-11 18:26:09 -08:00
|
|
|
[scriptable, uuid(42c7a85f-59ae-4bde-b961-e1f1436476c3)]
|
2014-11-11 19:22:36 -08:00
|
|
|
interface nsINfcEventListener : nsISupports
|
2013-12-03 13:22:21 -08:00
|
|
|
{
|
2014-10-20 02:53:39 -07:00
|
|
|
/**
|
|
|
|
* 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);
|
|
|
|
|
2013-12-03 13:22:21 -08:00
|
|
|
/**
|
2014-10-29 23:08:00 -07:00
|
|
|
* Callback function used to notify peerfound/peerready.
|
2014-07-23 21:16:02 -07:00
|
|
|
* @param sessionToken
|
2014-10-20 02:53:39 -07:00
|
|
|
* SessionToken received from parent process
|
2014-10-29 23:08:00 -07:00
|
|
|
* @param isPeerReady
|
|
|
|
* Set to true to dispatch peerready instead of peerfound
|
2014-07-23 21:16:02 -07:00
|
|
|
*/
|
2014-10-29 23:08:00 -07:00
|
|
|
void notifyPeerFound(in DOMString sessionToken, [optional] in boolean isPeerReady);
|
2014-07-23 21:16:02 -07:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Callback function used to notify peerlost.
|
2013-12-03 13:22:21 -08:00
|
|
|
*
|
|
|
|
* @param sessionToken
|
2014-10-20 02:53:39 -07:00
|
|
|
* SessionToken received from parent process
|
2013-12-03 13:22:21 -08:00
|
|
|
*/
|
2014-10-20 02:53:39 -07:00
|
|
|
void notifyPeerLost(in DOMString sessionToken);
|
2013-12-03 13:22:21 -08:00
|
|
|
};
|
|
|
|
|
2014-11-11 18:13:33 -08:00
|
|
|
[scriptable, uuid(486dff99-6755-428b-834d-3647ce276b54)]
|
2013-11-05 14:18:56 -08:00
|
|
|
interface nsINfcContentHelper : nsISupports
|
|
|
|
{
|
2014-10-14 01:37:50 -07:00
|
|
|
void init(in nsIDOMWindow window);
|
|
|
|
|
2014-11-04 01:29:26 -08:00
|
|
|
boolean checkSessionToken(in DOMString sessionToken, in boolean isP2P);
|
2013-11-05 14:18:56 -08:00
|
|
|
|
2014-10-30 03:46:41 -07:00
|
|
|
nsIDOMDOMRequest readNDEF(in DOMString sessionToken);
|
|
|
|
nsIDOMDOMRequest writeNDEF(in nsIVariant records, in DOMString sessionToken);
|
2014-10-30 23:51:41 -07:00
|
|
|
nsIDOMDOMRequest makeReadOnly(in DOMString sessionToken);
|
2013-11-05 14:18:56 -08:00
|
|
|
|
2014-10-30 03:46:41 -07:00
|
|
|
nsIDOMDOMRequest connect(in unsigned long techType, in DOMString sessionToken);
|
|
|
|
nsIDOMDOMRequest close(in DOMString sessionToken);
|
2013-12-03 13:22:21 -08:00
|
|
|
|
2014-10-20 02:53:39 -07:00
|
|
|
/**
|
|
|
|
* 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'
|
|
|
|
*/
|
2014-10-30 03:46:41 -07:00
|
|
|
nsIDOMDOMRequest sendFile(in jsval blob,
|
2013-12-14 00:57:11 -08:00
|
|
|
in DOMString sessionToken);
|
|
|
|
|
2014-07-23 21:16:02 -07:00
|
|
|
/**
|
2014-11-11 18:26:09 -08:00
|
|
|
* Add the event listener.
|
2014-07-23 21:16:02 -07:00
|
|
|
*
|
2014-11-11 18:26:09 -08:00
|
|
|
* @param listener
|
2014-11-11 19:22:36 -08:00
|
|
|
* An instance of the nsINfcEventListener.
|
2014-07-23 21:16:02 -07:00
|
|
|
*/
|
2014-11-11 19:22:36 -08:00
|
|
|
void addEventListener(in nsINfcEventListener listener);
|
2014-07-23 21:16:02 -07:00
|
|
|
|
2014-10-20 02:53:39 -07:00
|
|
|
/**
|
|
|
|
* Register the given application id with parent process
|
|
|
|
*
|
|
|
|
* @param appId
|
|
|
|
* Application ID to be registered
|
|
|
|
*/
|
2014-10-30 03:46:41 -07:00
|
|
|
void registerTargetForPeerReady(in unsigned long appId);
|
2014-07-24 03:11:42 -07:00
|
|
|
|
2014-10-20 02:53:39 -07:00
|
|
|
/**
|
|
|
|
* Unregister the given application id with parent process
|
|
|
|
*
|
|
|
|
* @param appId
|
|
|
|
* Application ID to be registered
|
|
|
|
*/
|
2014-10-30 03:46:41 -07:00
|
|
|
void unregisterTargetForPeerReady(in unsigned long appId);
|
2014-07-24 03:11:42 -07:00
|
|
|
|
2014-10-20 02:53:39 -07:00
|
|
|
/**
|
|
|
|
* 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'
|
|
|
|
*/
|
2014-10-30 03:46:41 -07:00
|
|
|
nsIDOMDOMRequest checkP2PRegistration(in unsigned long appId);
|
2013-12-03 13:22:21 -08:00
|
|
|
|
2014-10-20 02:53:39 -07:00
|
|
|
/**
|
|
|
|
* 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
|
|
|
|
*/
|
2014-10-30 03:46:41 -07:00
|
|
|
void notifyUserAcceptedP2P(in unsigned long appId);
|
2014-01-15 15:42:49 -08:00
|
|
|
|
2014-10-20 02:53:39 -07:00
|
|
|
/**
|
|
|
|
* Notify the status of sendFile operation to parent process
|
|
|
|
*
|
|
|
|
* @param status
|
|
|
|
* Status of sendFile operation
|
|
|
|
*
|
|
|
|
* @param requestId
|
|
|
|
* Request ID of SendFile DOM Request
|
|
|
|
*/
|
2014-10-30 03:46:41 -07:00
|
|
|
void notifySendFileStatus(in octet status,
|
2014-01-15 15:42:49 -08:00
|
|
|
in DOMString requestId);
|
2014-04-14 23:47:42 -07:00
|
|
|
|
|
|
|
/**
|
2014-11-11 18:13:33 -08:00
|
|
|
* Change RF state.
|
|
|
|
*
|
|
|
|
* @param rfState. Possible values are 'idle', 'listen' and 'discovery'.
|
2014-04-14 23:47:42 -07:00
|
|
|
*/
|
2014-11-11 18:13:33 -08:00
|
|
|
nsIDOMDOMRequest changeRFState(in DOMString rfState);
|
2013-11-05 14:18:56 -08:00
|
|
|
};
|