From 387e1d5b155ee6653e7b899407db250ee04e247e Mon Sep 17 00:00:00 2001 From: Szymon Jastrzebski Date: Mon, 17 Jul 2017 10:30:12 +0200 Subject: [PATCH] [NFC] Updating API reference and guide PS2: Guide reviewed Change-Id: Id28cd082d1782e51b2d7ef7fa50f4a60ee0cb577 Signed-off-by: Szymon Jastrzebski --- org.tizen.guides/html/web/connectivity/nfc_w.htm | 3 + .../html/device_api/mobile/tizen/nfc.html | 151 +++++++++++++++++++++ .../html/device_api/wearable/tizen/nfc.html | 151 +++++++++++++++++++++ 3 files changed, 305 insertions(+) diff --git a/org.tizen.guides/html/web/connectivity/nfc_w.htm b/org.tizen.guides/html/web/connectivity/nfc_w.htm index e0b9b2e..1e477b2 100644 --- a/org.tizen.guides/html/web/connectivity/nfc_w.htm +++ b/org.tizen.guides/html/web/connectivity/nfc_w.htm @@ -477,6 +477,9 @@ adapter.removeHCEEventListener(hceListenerId); adapter.cardEmulationMode = 'OFF'; +

Since Tizen 4.0, you can change the routing priority of NFC card emulation events. The card emulation events can be sent to the application currently on the foreground (instead of the application chosen in NFC settings), as long as the application stays on the foreground.

+

To set your application as preferred for HCE events, call the setPreferredApp() method of the NFCAdapter interface. When the application leaves the foreground, it loses the preferred application status, and when it enters the foreground again, it regains the status. For more information on this behavior, see the setPreferredApp() method in the NFCAdapter interface.

+

When an application no longer needs to receive card emulation events, change the routing priority back to the default setting by calling the unsetPreferredApp() method.

NFC Application Control Operations

You can launch NFC applications based on the NDEF message content using the application control functionalities:

diff --git a/org.tizen.web.apireference/html/device_api/mobile/tizen/nfc.html b/org.tizen.web.apireference/html/device_api/mobile/tizen/nfc.html index 98d6c0a..efa6299 100755 --- a/org.tizen.web.apireference/html/device_api/mobile/tizen/nfc.html +++ b/org.tizen.web.apireference/html/device_api/mobile/tizen/nfc.html @@ -155,6 +155,8 @@ For more information on the NFC features, see registerAID (SecureElementType type, AID aid, CardEmulationCategoryType category)
void unregisterAID (SecureElementType type, AID aid, CardEmulationCategoryType category)
void getAIDsForCategory (SecureElementType type, CardEmulationCategoryType category, AIDArraySuccessCallback successCallback, optional ErrorCallback? errorCallback)
+
void setPreferredApp ()
+
void unsetPreferredApp ()
@@ -716,6 +718,10 @@ catch (err) void getAIDsForCategory(SecureElementType type, CardEmulationCategoryType category, AIDArraySuccessCallback successCallback, optional ErrorCallback? errorCallback) raises(WebAPIException); + void setPreferredApp() raises(WebAPIException); + + void unsetPreferredApp() raises(WebAPIException); + };

Since: @@ -2399,6 +2405,147 @@ catch (err) +

+setPreferredApp +
+
+
+ Sets current application as preferred application for NFC card emulation events as long as it is in foreground. +
+
void setPreferredApp();
+             
+

+ Since: + 4.0 +

+
+

+Calling the method allows to change routing priority of NFC card emulation without affecting NFC Settings (the Tap and pay option). +As long as the application is in foreground, it will be set as the receiver of card emulation events instead of the application chosen in NFC Settings. +

+

+When the application leaves the foreground, receiving NFC card events is stopped for this application. The default application from settings would be used instead. +

+

+When the application comes back from background, receiving events is turned back on. +

+
+

+ Privilege level: + public +

+

+ Privilege: + http://tizen.org/privilege/nfc.cardemulation +

+

Remark : + This method may not be supported on every mobile device. +

+

Remark : + To check if NFC card emulation is supported on this device, use tizen.systeminfo.getCapability("http://tizen.org/feature/network.nfc.card_emulation.hce"). +

+
+

Exceptions:

+
  • WebAPIException
      +
    • + with error type AbortError, if any system error occured. +

    • +
    • + with error type InvalidStateError, if the application was already set as preferred. +

    • +
    • + with error type NotSupportedError, if this feature is not supported. +

    • +
    • + with error type SecurityError, if the application does not have the privilege to call this method. +

    • +
    • + with error type ServiceNotAvailableError, if the NFC service is not available. +

    • +
    +
+
+
+

Code example:

 try
+ {
+   var adapter = tizen.nfc.getDefaultAdapter();
+   adapter.setPreferredApp();
+ }
+ catch (err)
+ {
+   console.log(err.name + ": " + err.message);
+ }
+ 
+
+
+
+unsetPreferredApp +
+
+
+ Unsets currently running application as preferred application for NFC card emulation events. +
+
void unsetPreferredApp();
+             
+

+ Since: + 4.0 +

+
+

+This method restores application chosen in NFC Settings (the Tap and pay option) as preferred for NFC card emulation events. +

+

+To set application as preferred again, use setPreferredApp(). +

+
+

+ Privilege level: + public +

+

+ Privilege: + http://tizen.org/privilege/nfc.cardemulation +

+

Remark : + This method may not be supported on every mobile device. +

+

Remark : + To check if NFC card emulation is supported on this device, use tizen.systeminfo.getCapability("http://tizen.org/feature/network.nfc.card_emulation"). +

+
+

Exceptions:

+
  • WebAPIException
      +
    • + with error type AbortError, if any system error occured. +

    • +
    • + with error type NotSupportedError, if this feature is not supported. +

    • +
    • + with error type SecurityError, if the application does not have the privilege to call this method. +

    • +
    • + with error type ServiceNotAvailableError, if the NFC service is not available. +

    • +
    +
+
+
+

Code example:

 try
+ {
+   var adapter = tizen.nfc.getDefaultAdapter();
+   adapter.setPreferredApp();
+   /* Perform some actions */
+   adapter.unsetPreferredApp();
+ }
+ catch (err)
+ {
+   console.log(err.name + ": " + err.message);
+ }
+ 
+
+
@@ -4414,6 +4561,10 @@ To guarantee that the NFC host-based card emulation application runs on a device void getAIDsForCategory(SecureElementType type, CardEmulationCategoryType category, AIDArraySuccessCallback successCallback, optional ErrorCallback? errorCallback) raises(WebAPIException); + void setPreferredApp() raises(WebAPIException); + + void unsetPreferredApp() raises(WebAPIException); + }; diff --git a/org.tizen.web.apireference/html/device_api/wearable/tizen/nfc.html b/org.tizen.web.apireference/html/device_api/wearable/tizen/nfc.html index 0bb86e9..514ef82 100755 --- a/org.tizen.web.apireference/html/device_api/wearable/tizen/nfc.html +++ b/org.tizen.web.apireference/html/device_api/wearable/tizen/nfc.html @@ -155,6 +155,8 @@ For more information on the NFC features, see registerAID (SecureElementType type, AID aid, CardEmulationCategoryType category)
void unregisterAID (SecureElementType type, AID aid, CardEmulationCategoryType category)
void getAIDsForCategory (SecureElementType type, CardEmulationCategoryType category, AIDArraySuccessCallback successCallback, optional ErrorCallback? errorCallback)
+
void setPreferredApp ()
+
void unsetPreferredApp ()
@@ -716,6 +718,10 @@ catch (err) void getAIDsForCategory(SecureElementType type, CardEmulationCategoryType category, AIDArraySuccessCallback successCallback, optional ErrorCallback? errorCallback) raises(WebAPIException); + void setPreferredApp() raises(WebAPIException); + + void unsetPreferredApp() raises(WebAPIException); + };

Since: @@ -2400,6 +2406,147 @@ catch (err) +

+setPreferredApp +
+
+
+ Sets current application as preferred application for NFC card emulation events as long as it is in foreground. +
+
void setPreferredApp();
+             
+

+ Since: + 4.0 +

+
+

+Calling the method allows to change routing priority of NFC card emulation without affecting NFC Settings (the Tap and pay option). +As long as the application is in foreground, it will be set as the receiver of card emulation events instead of the application chosen in NFC Settings. +

+

+When the application leaves the foreground, receiving NFC card events is stopped for this application. The default application from settings would be used instead. +

+

+When the application comes back from background, receiving events is turned back on. +

+
+

+ Privilege level: + public +

+

+ Privilege: + http://tizen.org/privilege/nfc.cardemulation +

+

Remark : + This method may not be supported on every mobile device. +

+

Remark : + To check if NFC card emulation is supported on this device, use tizen.systeminfo.getCapability("http://tizen.org/feature/network.nfc.card_emulation.hce"). +

+
+

Exceptions:

+
  • WebAPIException
      +
    • + with error type AbortError, if any system error occured. +

    • +
    • + with error type InvalidStateError, if the application was already set as preferred. +

    • +
    • + with error type NotSupportedError, if this feature is not supported. +

    • +
    • + with error type SecurityError, if the application does not have the privilege to call this method. +

    • +
    • + with error type ServiceNotAvailableError, if the NFC service is not available. +

    • +
    +
+
+
+

Code example:

 try
+ {
+   var adapter = tizen.nfc.getDefaultAdapter();
+   adapter.setPreferredApp();
+ }
+ catch (err)
+ {
+   console.log(err.name + ": " + err.message);
+ }
+ 
+
+
+
+unsetPreferredApp +
+
+
+ Unsets currently running application as preferred application for NFC card emulation events. +
+
void unsetPreferredApp();
+             
+

+ Since: + 4.0 +

+
+

+This method restores application chosen in NFC Settings (the Tap and pay option) as preferred for NFC card emulation events. +

+

+To set application as preferred again, use setPreferredApp(). +

+
+

+ Privilege level: + public +

+

+ Privilege: + http://tizen.org/privilege/nfc.cardemulation +

+

Remark : + This method may not be supported on every mobile device. +

+

Remark : + To check if NFC card emulation is supported on this device, use tizen.systeminfo.getCapability("http://tizen.org/feature/network.nfc.card_emulation"). +

+
+

Exceptions:

+
  • WebAPIException
      +
    • + with error type AbortError, if any system error occured. +

    • +
    • + with error type NotSupportedError, if this feature is not supported. +

    • +
    • + with error type SecurityError, if the application does not have the privilege to call this method. +

    • +
    • + with error type ServiceNotAvailableError, if the NFC service is not available. +

    • +
    +
+
+
+

Code example:

 try
+ {
+   var adapter = tizen.nfc.getDefaultAdapter();
+   adapter.setPreferredApp();
+   /* Perform some actions */
+   adapter.unsetPreferredApp();
+ }
+ catch (err)
+ {
+   console.log(err.name + ": " + err.message);
+ }
+ 
+
+
@@ -4415,6 +4562,10 @@ To guarantee that the NFC host-based card emulation application runs on a device void getAIDsForCategory(SecureElementType type, CardEmulationCategoryType category, AIDArraySuccessCallback successCallback, optional ErrorCallback? errorCallback) raises(WebAPIException); + void setPreferredApp() raises(WebAPIException); + + void unsetPreferredApp() raises(WebAPIException); + }; -- 2.7.4