Bumping manifests a=b2g-bump
[gecko.git] / dom / nfc / nsINfcContentHelper.idl
blob5f26947305944fe254b006b8efe2e75254123e56
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"
8 interface nsIVariant;
10 [scriptable, uuid(57fc2998-1058-4fd5-8dd9-0e303218d5fd)]
11 interface nsINfcPeerEventListener : nsISupports
13 /**
14 * Callback function used to notify peerready.
16 * @param sessionToken
17 * SessionToken received from Chrome process
19 void notifyPeerReady(in DOMString sessionToken);
21 /**
22 * Callback function used to notify peerlost.
24 * @param sessionToken
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);
46 /**
47 * Initiate Send file operation
49 * @param window
50 * Current window
52 * @param blob
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.
57 * @param sessionToken
58 * Current token
60 * Returns DOMRequest, if initiation of send file operation is successful
61 * then 'onsuccess' is called else 'onerror'
63 nsIDOMDOMRequest sendFile(in nsIDOMWindow window,
64 in jsval blob,
65 in DOMString sessionToken);
67 /**
68 * Register the peer event listener.
70 * @param listener An instance of the nsINfcPeerEventListener.
72 void registerPeerEventListener(in nsINfcPeerEventListener listener);
74 /**
75 * Register the given application id with Chrome process
77 * @param window
78 * Current window
80 * @param appId
81 * Application ID to be registered
83 void registerTargetForPeerReady(in nsIDOMWindow window,
84 in unsigned long appId);
86 /**
87 * Unregister the given application id with Chrome process
89 * @param window
90 * Current window
92 * @param appId
93 * Application ID to be registered
95 void unregisterTargetForPeerReady(in nsIDOMWindow window,
96 in unsigned long appId);
98 /**
99 * Checks if the given application's id is a registered peer target (with the Chrome process)
101 * @param window
102 * Current window
104 * @param appId
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
114 * @param window
115 * Current window
117 * @param appId
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
125 * @param window
126 * Current window
128 * @param status
129 * Status of sendFile operation
131 * @param requestId
132 * Request ID of SendFile DOM Request
134 void notifySendFileStatus(in nsIDOMWindow window,
135 in octet status,
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);