2013-11-06 09:36:19 -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/. */
|
|
|
|
|
|
|
|
/* Copyright © 2013 Deutsche Telekom, Inc. */
|
|
|
|
|
2014-08-29 18:41:20 -07:00
|
|
|
[NoInterfaceObject]
|
2014-04-28 20:50:25 -07:00
|
|
|
interface MozNFCManager {
|
2013-11-24 20:40:39 -08:00
|
|
|
/**
|
|
|
|
* API to check if the given application's manifest
|
|
|
|
* URL is registered with the Chrome Process or not.
|
|
|
|
*
|
|
|
|
* Returns success if given manifestUrl is registered for 'onpeerready',
|
|
|
|
* otherwise error
|
|
|
|
*/
|
|
|
|
DOMRequest checkP2PRegistration(DOMString manifestUrl);
|
2014-01-17 18:38:26 -08:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Notify that user has accepted to share nfc message on P2P UI
|
|
|
|
*/
|
|
|
|
void notifyUserAcceptedP2P(DOMString manifestUrl);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Notify the status of sendFile operation
|
|
|
|
*/
|
|
|
|
void notifySendFileStatus(octet status, DOMString requestId);
|
2014-04-14 20:52:27 -07:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Power on the NFC hardware and start polling for NFC tags or devices.
|
|
|
|
*/
|
|
|
|
DOMRequest startPoll();
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Stop polling for NFC tags or devices. i.e. enter low power mode.
|
|
|
|
*/
|
|
|
|
DOMRequest stopPoll();
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Power off the NFC hardware.
|
|
|
|
*/
|
|
|
|
DOMRequest powerOff();
|
2014-01-15 17:47:43 -08:00
|
|
|
};
|
|
|
|
|
|
|
|
[JSImplementation="@mozilla.org/navigatorNfc;1",
|
|
|
|
NavigatorProperty="mozNfc",
|
2014-08-19 03:43:57 -07:00
|
|
|
Func="Navigator::HasNFCSupport",
|
2014-08-19 04:09:45 -07:00
|
|
|
CheckPermissions="nfc-read nfc-write",
|
|
|
|
AvailableIn="CertifiedApps"]
|
2014-04-28 20:50:25 -07:00
|
|
|
interface MozNFC : EventTarget {
|
2014-08-05 02:06:00 -07:00
|
|
|
/**
|
|
|
|
* Returns MozNFCTag object or null in case of invalid sessionToken
|
|
|
|
*/
|
|
|
|
MozNFCTag? getNFCTag(DOMString sessionToken);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Returns MozNFCPeer object or null in case of invalid sessionToken
|
|
|
|
*/
|
|
|
|
MozNFCPeer? getNFCPeer(DOMString sessionToken);
|
2013-11-24 20:40:39 -08:00
|
|
|
|
2014-07-31 02:11:04 -07:00
|
|
|
/**
|
|
|
|
* This event will be fired when another NFCPeer is detected, and user confirms
|
|
|
|
* to share data to the NFCPeer object by calling mozNFC.notifyUserAcceptedP2P.
|
|
|
|
* The event will be type of NFCPeerEvent.
|
|
|
|
*/
|
2014-05-25 11:31:11 -07:00
|
|
|
[CheckPermissions="nfc-write"]
|
2013-11-24 20:40:39 -08:00
|
|
|
attribute EventHandler onpeerready;
|
2014-05-25 11:31:11 -07:00
|
|
|
[CheckPermissions="nfc-write"]
|
2013-11-06 09:36:19 -08:00
|
|
|
attribute EventHandler onpeerlost;
|
2014-01-15 17:47:43 -08:00
|
|
|
};
|
|
|
|
|
|
|
|
// Mozilla Only
|
2014-04-28 20:50:25 -07:00
|
|
|
partial interface MozNFC {
|
2013-11-24 20:40:39 -08:00
|
|
|
[ChromeOnly]
|
|
|
|
void eventListenerWasAdded(DOMString aType);
|
|
|
|
[ChromeOnly]
|
|
|
|
void eventListenerWasRemoved(DOMString aType);
|
2013-11-06 09:36:19 -08:00
|
|
|
};
|
2014-01-15 17:47:43 -08:00
|
|
|
|
2014-04-28 20:50:25 -07:00
|
|
|
MozNFC implements MozNFCManager;
|