1 /* This Source Code Form is subject to the terms of the Mozilla Public
2 * License, v. 2.0. If a copy of the MPL was not distributed with this
3 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
5 #include
"nsISupports.idl"
6 #include
"nsIDOMDOMRequest.idl"
10 [scriptable
, uuid(57fc2998
-1058-4fd5
-8dd9
-0e303218d5fd
)]
11 interface nsINfcPeerEventListener
: nsISupports
14 * Callback function used to notify peerready.
17 * SessionToken received from Chrome process
19 void notifyPeerReady
(in DOMString sessionToken
);
22 * Callback function used to notify peerlost.
25 * SessionToken received from Chrome process
27 void notifyPeerLost
(in DOMString sessionToken
);
30 [scriptable
, uuid(9a41d969
-3375-4933-814e-2da781c8f691
)]
31 interface nsINfcContentHelper
: nsISupports
33 const long NFC_EVENT_PEER_READY
= 0x01;
34 const long NFC_EVENT_PEER_LOST
= 0x02;
36 boolean checkSessionToken
(in DOMString sessionToken
);
38 nsIDOMDOMRequest getDetailsNDEF
(in nsIDOMWindow window
, in DOMString sessionToken
);
39 nsIDOMDOMRequest readNDEF
(in nsIDOMWindow window
, in DOMString sessionToken
);
40 nsIDOMDOMRequest writeNDEF
(in nsIDOMWindow window
, in nsIVariant records
, in DOMString sessionToken
);
41 nsIDOMDOMRequest makeReadOnlyNDEF
(in nsIDOMWindow window
, in DOMString sessionToken
);
43 nsIDOMDOMRequest connect
(in nsIDOMWindow window
, in unsigned long techType
, in DOMString sessionToken
);
44 nsIDOMDOMRequest close
(in nsIDOMWindow window
, in DOMString sessionToken
);
47 * Initiate Send file operation
53 * Raw data of the file to be sent. This object represents a file-like
54 * (nsIDOMFile) object of immutable, raw data. The blob data needs
55 * to be 'object wrapped' before calling this interface.
60 * Returns DOMRequest, if initiation of send file operation is successful
61 * then 'onsuccess' is called else 'onerror'
63 nsIDOMDOMRequest sendFile
(in nsIDOMWindow window
,
65 in DOMString sessionToken
);
68 * Register the peer event listener.
70 * @param listener An instance of the nsINfcPeerEventListener.
72 void registerPeerEventListener
(in nsINfcPeerEventListener listener
);
75 * Register the given application id with Chrome process
81 * Application ID to be registered
83 void registerTargetForPeerReady
(in nsIDOMWindow window
,
84 in unsigned long appId
);
87 * Unregister the given application id with Chrome process
93 * Application ID to be registered
95 void unregisterTargetForPeerReady
(in nsIDOMWindow window
,
96 in unsigned long appId
);
99 * Checks if the given application's id is a registered peer target (with the Chrome process)
105 * Application ID to be updated with Chrome process
107 * Returns DOMRequest, if appId is registered then 'onsuccess' is called else 'onerror'
109 nsIDOMDOMRequest checkP2PRegistration
(in nsIDOMWindow window
, in unsigned long appId
);
112 * Notify the Chrome process that user has accepted to share nfc message on P2P UI
118 * Application ID that is capable of handling NFC_EVENT_PEER_READY event
120 void notifyUserAcceptedP2P
(in nsIDOMWindow window
, in unsigned long appId
);
123 * Notify the status of sendFile operation to Chrome process
129 * Status of sendFile operation
132 * Request ID of SendFile DOM Request
134 void notifySendFileStatus
(in nsIDOMWindow window
,
136 in DOMString requestId
);
139 * Power on the NFC hardware and start polling for NFC tags or devices.
141 nsIDOMDOMRequest startPoll
(in nsIDOMWindow window
);
144 * Stop polling for NFC tags or devices. i.e. enter low power mode.
146 nsIDOMDOMRequest stopPoll
(in nsIDOMWindow window
);
149 * Power off the NFC hardware.
151 nsIDOMDOMRequest powerOff
(in nsIDOMWindow window
);