Tizen Native API  9.0

NFC Manager API provides access to NFC Events.

Required Header

#include <nfc.h>

Overview

The nfc manager api provides functions to connect nfc-server and register event listener

  • control connection with nfc-server.
  • register / deregister event listeners for detecting tag, ndef, llcp, secure element
  • set / unset tag filter to be listened only in case of specific tag.

Related Features

This API is related with the following features:

It is recommended to design feature related codes in your application for reliability.

You can check if a device supports the related features for this API by using System Information, thereby controlling the procedure of your application.

To ensure your application is only running on the device with specific features, please define the features in your manifest file using the manifest editor in the SDK.

More details on featuring your application can be found from Feature Element.

Functions

bool nfc_manager_is_supported (void)
 Gets the value that indicates whether NFC is supported.
int nfc_manager_set_activation_changed_cb (nfc_activation_changed_cb callback, void *user_data)
 Sets NFC Activation state changed callback.
void nfc_manager_unset_activation_changed_cb (void)
 Unsets the callback function.
int nfc_manager_set_activation (bool activation, nfc_activation_completed_cb callback, void *user_data)
 Sets NFC Activation.
bool nfc_manager_is_activated (void)
 Gets NFC Activation state.
int nfc_manager_initialize (void)
 Initializes NFC Manager.
int nfc_manager_deinitialize (void)
 Releases all the resource of the NFC Manager and disconnect the session between an application and NFC Manager.
int nfc_manager_set_tag_discovered_cb (nfc_tag_discovered_cb callback, void *user_data)
 Sets a callback function for receiving tag discovered notification.
void nfc_manager_unset_tag_discovered_cb (void)
 Unsets the callback function.
int nfc_manager_set_ndef_discovered_cb (nfc_ndef_discovered_cb callback, void *user_data)
 Sets a callback function for receiving NDEF Message discovered notification.
void nfc_manager_unset_ndef_discovered_cb (void)
 Unsets the callback function.
int nfc_manager_set_p2p_target_discovered_cb (nfc_p2p_target_discovered_cb callback, void *user_data)
 Sets a callback function for receiving NFC peer-to-peer target discovered notification.
void nfc_manager_unset_p2p_target_discovered_cb (void)
 Unsets the callback function.
int nfc_manager_set_se_event_cb (nfc_se_event_cb callback, void *user_data)
 Sets a callback function for receiving Secure Element (SIM/UICC (Universal Integrated Circuit Card)) event.
void nfc_manager_unset_se_event_cb (void)
 Unsets the callback function.
int nfc_manager_set_se_transaction_event_cb (nfc_se_type_e se_type, nfc_se_transaction_event_cb callback, void *user_data)
 Sets a callback function for receiving Secure Element (SIM/UICC (Universal Integrated Circuit Card)) transaction event(NFC_SE_EVENT_TRANSACTION) data.
void nfc_manager_unset_se_transaction_event_cb (nfc_se_type_e se_type)
 Unsets the callback function.
int nfc_manager_set_hce_event_cb (nfc_hce_event_cb callback, void *user_data)
 Sets a callback function for receiving HCE (Host Card Emulation) event.
void nfc_manager_unset_hce_event_cb (void)
 Unsets the callback function.
int nfc_manager_enable_transaction_fg_dispatch (void)
 Gives the priority to the foreground application when dispatching transaction event.
int nfc_manager_disable_transaction_fg_dispatch (void)
 Disables foreground dispatch for "EVT_TRANSACTION" to the given application.
int nfc_manager_get_cached_message (nfc_ndef_message_h *ndef_message)
 Gets NDEF message cached when the tag is detected or when data received from NFC peer-to-peer target.
void nfc_manager_set_tag_filter (int filter)
 Sets filter of target types.
int nfc_manager_get_tag_filter (void)
 Gets the current filter status.
int nfc_manager_get_connected_tag (nfc_tag_h *tag)
 Gets current connected tag.
int nfc_manager_get_connected_target (nfc_p2p_target_h *target)
 Gets current connected p2p target.
int nfc_manager_set_system_handler_enable (bool enable)
 Enables or disable the system handling for tag and target discovered event.
bool nfc_manager_is_system_handler_enabled (void)
 Gets the state of the system handler.
int nfc_manager_set_se_type (nfc_se_type_e type)
 Sets the card emulation Secure Element type.
int nfc_manager_get_se_type (nfc_se_type_e *type)
 Gets the card emulation Secure Element type.

Typedefs

typedef void(* nfc_activation_completed_cb )(nfc_error_e error, void *user_data)
 Called after nfc_manager_set_activation() has completed.
typedef void(* nfc_activation_changed_cb )(bool activated, void *user_data)
 Called when NFC activation state is changed.
typedef void(* nfc_tag_discovered_cb )(nfc_discovered_type_e type, nfc_tag_h tag, void *user_data)
 Called when an NFC tag appears or disappears.
typedef void(* nfc_ndef_discovered_cb )(nfc_ndef_message_h message, void *user_data)
 Called when an NDEF Message is discovered.
typedef void(* nfc_p2p_target_discovered_cb )(nfc_discovered_type_e type, nfc_p2p_target_h target, void *user_data)
 Called when NFC peer-to-peer target appeared or disappeared.
typedef void(* nfc_se_event_cb )(nfc_se_event_e event, void *user_data)
 Called when receiving Secure Element (SIM/UICC (Universal Integrated Circuit Card)) event.
typedef void(* nfc_se_transaction_event_cb )(nfc_se_type_e se_type, unsigned char *aid, int aid_size, unsigned char *param, int param_size, void *user_data)
 Called when receiving Secure Element(SIM/UICC (Universal Integrated Circuit Card)) transaction event data.

Typedef Documentation

typedef void(* nfc_activation_changed_cb)(bool activated, void *user_data)

Called when NFC activation state is changed.

Since :
2.3
Parameters:
[in]activatedThe activation state
[in]user_dataThe user data passed from the callback registration function
Returns:
0 on success, otherwise a negative error value.
Return values:
NFC_ERROR_NONESuccessful
NFC_ERROR_ALREADY_ACTIVATEDAlready activated
NFC_ERROR_ALREADY_DEACTIVATEDAlready deactivated
See also:
nfc_manager_set_activation_changed_cb()
typedef void(* nfc_activation_completed_cb)(nfc_error_e error, void *user_data)

Called after nfc_manager_set_activation() has completed.

Warning:
This is not for use by third-party applications.
Since :
2.3
Parameters:
[in]errorThe result
[in]user_dataThe user data passed from the callback registration function
Returns:
0 on success, otherwise a negative error value.
Return values:
NFC_ERROR_NONESuccessful
See also:
nfc_manager_set_activation()
nfc_tag_transceive
typedef void(* nfc_ndef_discovered_cb)(nfc_ndef_message_h message, void *user_data)

Called when an NDEF Message is discovered.

Since :
2.3
Remarks:
The message should not be released.
The message can be used only in the callback. To use outside, make a copy.
message will be automatically destroyed when the callback function returns. (Do not release message.)
Parameters:
[in]messageThe handle to NDEF message
[in]user_dataThe user data passed from the callback registration function
See also:
nfc_manager_set_ndef_discovered_cb()
nfc_manager_unset_ndef_discovered_cb()
typedef void(* nfc_p2p_target_discovered_cb)(nfc_discovered_type_e type, nfc_p2p_target_h target, void *user_data)

Called when NFC peer-to-peer target appeared or disappeared.

Since :
2.3
Remarks:
The target should not be released.
The target can be used only in the callback. To use outside, make a copy.
Parameters:
[in]typeThe discovered type attached or detached
[in]targetThe handle to p2p target
[in]user_dataThe user data passed from nfc_manager_set_p2p_target_discovered_cb()
See also:
nfc_manager_set_p2p_target_discovered_cb()
nfc_manager_unset_p2p_target_discovered_cb()
typedef void(* nfc_se_event_cb)(nfc_se_event_e event, void *user_data)

Called when receiving Secure Element (SIM/UICC (Universal Integrated Circuit Card)) event.

Since :
2.3
Parameters:
[in]eventThe Secure Element event
See also:
nfc_se_event_e
Parameters:
[in]user_dataThe user data passed from nfc_manager_set_se_event_cb()
See also:
nfc_manager_set_se_event_cb()
nfc_manager_unset_se_event_cb()
typedef void(* nfc_se_transaction_event_cb)(nfc_se_type_e se_type, unsigned char *aid, int aid_size, unsigned char *param, int param_size, void *user_data)

Called when receiving Secure Element(SIM/UICC (Universal Integrated Circuit Card)) transaction event data.

Since :
2.3
Remarks:
This event notifies , external reader tries to access secure element.
The aid should not be released.
The aid can be used only in the callback. To use outside, make a copy.
The param should not be released.
The param can be used only in the callback. To use outside, make a copy.
Parameters:
[in]se_typeSecure Element type
[in]aidApplication Id, specified in ISO/IEC 7816-4
[in]aid_sizeThe size of aid (5~16)
[in]paramThe parameter list, specified in ISO/IEC 8825-1
[in]param_sizeThe size of param (0~65535)
[in]user_dataThe user data passed from nfc_manager_set_se_transaction_event_cb()
See also:
nfc_manager_set_se_transaction_event_cb()
nfc_manager_unset_se_transaction_event_cb()
typedef void(* nfc_tag_discovered_cb)(nfc_discovered_type_e type, nfc_tag_h tag, void *user_data)

Called when an NFC tag appears or disappears.

Since :
2.3
Remarks:
The tag should not be released.
The tag is managed by the platform and will be released when NFC service stops.
The tag handle does not have detail target info when an NFC tag disappeared.
So then do not use tag functions which use tag handle.
Parameters:
[in]typeThe discovered type attached or detached
[in]tagThe handle to NFC tag
[in]user_dataThe user data passed from the callback registration function
See also:
nfc_manager_set_tag_discovered_cb()
nfc_manager_unset_tag_discovered_cb()
nfc_manager_set_tag_filter()

Enumeration Type Documentation

Enumerations for NFC discovered type.

Since :
2.3
Enumerator:
NFC_DISCOVERED_TYPE_ATTACHED 

Attached, discovered, activated event

NFC_DISCOVERED_TYPE_DETACHED 

detached, disappeared, deactivated event

Error codes reported by the NFC API.

Since :
2.3
Enumerator:
NFC_ERROR_NONE 

Successful

NFC_ERROR_OUT_OF_MEMORY 

Out of memory

NFC_ERROR_OPERATION_FAILED 

Tizen NFC base error code Operation failed

NFC_ERROR_INVALID_PARAMETER 

Invalid parameter

NFC_ERROR_INVALID_NDEF_MESSAGE 

Tizen NFC base error code Invalid NDEF message

NFC_ERROR_INVALID_RECORD_TYPE 

Tizen NFC base error code Invalid record type

NFC_ERROR_TIMED_OUT 

Timeout error, no answer

NFC_ERROR_DEVICE_BUSY 

Previous operation is not finished still busy

NFC_ERROR_NO_DEVICE 

Tizen NFC base error code no device

NFC_ERROR_NOT_ACTIVATED 

Tizen NFC base error code NFC is not activated

NFC_ERROR_NOT_SUPPORTED 

Not supported

NFC_ERROR_ALREADY_ACTIVATED 

Tizen NFC base error code Already activated

NFC_ERROR_ALREADY_DEACTIVATED 

Tizen NFC base error code Already deactivated

NFC_ERROR_READ_ONLY_NDEF 

Tizen NFC base error code Read only tag

NFC_ERROR_NO_SPACE_ON_NDEF 

Tizen NFC base error code No enough space on tag

NFC_ERROR_NO_NDEF_MESSAGE 

Tizen NFC base error code No NDEF Message on Tag

NFC_ERROR_NOT_NDEF_FORMAT 

Tizen NFC base error code Not NDEF format Tag

NFC_ERROR_SECURITY_RESTRICTED 

Tizen NFC base error code Restricted by access control

NFC_ERROR_PERMISSION_DENIED 

Restricted by Smack

NFC_ERROR_ILLEGAL_STATE 

Tizen NFC base error code The state is wrong

NFC_ERROR_NOT_INITIALIZED 

Tizen NFC base error code NFC is not initialized

NFC_ERROR_TAG_NOT_SUPPORTED 

Tizen NFC base error code Tag is not supported

NFC_ERROR_AID_ALREADY_REGISTERED 

Tizen NFC base error code AID already registered (Since: 2.3.1)

Enumerations for NFC Card Emulation Mode type.

Since :
2.3
Enumerator:
NFC_SE_CARD_EMULATION_MODE_OFF 

Card Emulation mode OFF

NFC_SE_CARD_EMULATION_MODE_ON 

Card Emulation mode ON

Enumerations for NFC Secure Element (SIM/UICC (Universal Integrated Circuit Card)) event.

Since :
2.3
Enumerator:
NFC_SE_EVENT_START_TRANSACTION 

This event notifies the terminal host that it shall launch an application associated to an NFC application in a UICC(Universal Integrated Circuit Card) host.

NFC_SE_EVENT_END_TRANSACTION 

This event notifies the terminal host that current transaction in process was ended.

NFC_SE_EVENT_CONNECTIVITY 

It's ready signal to communicate UICC(Universal Integrated Circuit Card) with terminal host. UICC(Universal Integrated Circuit Card) create pipe and open the pipe channel. Then it sends the signal to terminal host or host controller.

NFC_SE_EVENT_FIELD_ON 

When the CLF(Contactless Front-end) detects a RF field, the card RF gate sends the event NFC_SE_EVENT_FIELD_ON to the card application gate. When there are multiple open card RF gates the CLF shall send the NFC_SE_EVENT_FIELD_ON on all open pipes to these gates.Next the CLF starts the initialization and anti-collision process as defined in ISO/IEC 14443-3 [6]

NFC_SE_EVENT_FIELD_OFF 

When the CLF(Contactless Front-end) detects that the RF field is off, the card RF gate shall send NFC_SE_EVENT_FIELD_OFF to the card application gate. When there are multiple open card RF gates the CLF shall send the NFC_SE_EVENT_FIELD_OFF to one gate only.

NFC_SE_EVENT_TRANSACTION 

This event notifies , external reader tries to access secure element

NFC_SE_EVENT_SE_TYPE_CHANGED 

This event notifies, changing the emulated secure element type

NFC_SE_EVENT_CARD_EMULATION_CHANGED 

This event notifies, changing the card emulation mode

Enumerations for NFC Secure Element (SIM/UICC (Universal Integrated Circuit Card)) type.

Since :
2.3
Enumerator:
NFC_SE_TYPE_DISABLE 

Disable card emulation

NFC_SE_TYPE_ESE 

SmartMX type card emulation

NFC_SE_TYPE_UICC 

UICC type card emulation

NFC_SE_TYPE_SDCARD 

SDCARD card emulation (Not yet supported on Tizen) (Since: 2.3.1)

NFC_SE_TYPE_HCE 

Host based card emulation (Since: 2.3.1)

Enumerations for NFC Tag filter.

Since :
2.3
Enumerator:
NFC_TAG_FILTER_ALL_DISABLE 

All disable

NFC_TAG_FILTER_ISO14443A_ENABLE 

ISO14443A enable

NFC_TAG_FILTER_ISO14443B_ENABLE 

ISO14443B enable

NFC_TAG_FILTER_ISO15693_ENABLE 

ISO15693 enable

NFC_TAG_FILTER_FELICA_ENABLE 

FELICA enable

NFC_TAG_FILTER_JEWEL_ENABLE 

JEWEL enable

NFC_TAG_FILTER_IP_ENABLE 

IP enable

NFC_TAG_FILTER_ALL_ENABLE 

All enable


Function Documentation

int nfc_manager_deinitialize ( void  )

Releases all the resource of the NFC Manager and disconnect the session between an application and NFC Manager.

Since :
2.3
Returns:
0 on success, otherwise a negative error value.
Return values:
NFC_ERROR_NONESuccessful
NFC_ERROR_NOT_SUPPORTEDNot supported NFC
NFC_ERROR_OPERATION_FAILEDOperation fail
See also:
nfc_manager_initialize()

Disables foreground dispatch for "EVT_TRANSACTION" to the given application.

Since :
2.3
Privilege Level:
public
Privilege:
http://tizen.org/privilege/nfc.cardemulation
Remarks:
After calling "nfc_manager_enable_transaction_fg_dispatch", an application must call this function when it goes out from foreground.

Security level can be determined by the manufacturer usage.
If a security issue is occurred, contact with the manufacturer of the product.
If you want to know about security level in detail, See the GSMA specification.
(https://www.gsma.com/newsroom/wp-content/uploads/TS.26-v15.0.pdf)
Returns:
0 on success, otherwise a negative error value.
Return values:
NFC_ERROR_NONESuccessful
NFC_ERROR_NOT_SUPPORTEDNot supported NFC
NFC_ERROR_NOT_INITIALIZEDNot initialized NFC
NFC_ERROR_PERMISSION_DENIEDSecurity restricted by SMACK
NFC_ERROR_OUT_OF_MEMORYOut of memory
NFC_ERROR_DEVICE_BUSYDevice is too busy to handle your request
NFC_ERROR_SECURITY_RESTRICTEDSecurity restricted by Access Control
NFC_ERROR_ILLEGAL_STATEIllegal state
NFC_ERROR_OPERATION_FAILEDIPC fail
See also:
nfc_manager_enable_transaction_fg_dispatch()
nfc_manager_initialize()

Gives the priority to the foreground application when dispatching transaction event.

Since :
2.3
Privilege Level:
public
Privilege:
http://tizen.org/privilege/nfc.cardemulation
Remarks:
This function must be called only when the application is in the foreground.
If the application go out from foreground, application must call "nfc_manager_disable_transaction_fg_dispatch" to disable foreground dispatch

Security level can be determined by the manufacturer usage.
If a security issue is occurred, contact with the manufacturer of the product.
If you want to know about security level in detail, See the GSMA specification.
(https://www.gsma.com/newsroom/wp-content/uploads/TS.26-v15.0.pdf)
Returns:
0 on success, otherwise a negative error value.
Return values:
NFC_ERROR_NONESuccessful
NFC_ERROR_NOT_SUPPORTEDNot supported NFC
NFC_ERROR_NOT_INITIALIZEDNot initialized NFC
NFC_ERROR_PERMISSION_DENIEDSecurity restricted by SMACK
NFC_ERROR_OUT_OF_MEMORYOut of memory
NFC_ERROR_DEVICE_BUSYDevice is too busy to handle your request
NFC_ERROR_SECURITY_RESTRICTEDSecurity restricted by Access Control
NFC_ERROR_ILLEGAL_STATEIllegal state
NFC_ERROR_OPERATION_FAILEDIPC fail
See also:
nfc_manager_disable_transaction_fg_dispatch()
nfc_manager_initialize()

Gets NDEF message cached when the tag is detected or when data received from NFC peer-to-peer target.

Since :
2.3
Remarks:
The ndef_message should be released using nfc_ndef_message_destroy().
This function is used to get the NDEF message that was read before launched your application.
Parameters:
[out]ndef_messageThe cached NDEF message
Returns:
0 on success, otherwise a negative error value.
Return values:
NFC_ERROR_NONESuccessful
NFC_ERROR_NOT_SUPPORTEDNot supported NFC
NFC_ERROR_NOT_INITIALIZEDNot initialized NFC
NFC_ERROR_OUT_OF_MEMORYOut of memory
NFC_ERROR_INVALID_PARAMETERInvalid parameter
NFC_ERROR_NO_NDEF_MESSAGEThe cached message does not exist
NFC_ERROR_OPERATION_FAILEDOperation failed
See also:
nfc_manager_initialize()

Gets current connected tag.

Since :
2.3
Privilege Level:
public
Privilege:
http://tizen.org/privilege/nfc
Remarks:
The tag should not be released.
The tag is managed by the platform and will be released when NFC service stops.
Parameters:
[out]tagThe connected tag
Returns:
0 on success, otherwise a negative error value.
Return values:
NFC_ERROR_NONESuccessful
NFC_ERROR_NOT_SUPPORTEDNot supported NFC
NFC_ERROR_NOT_INITIALIZEDNot initialized NFC
NFC_ERROR_INVALID_PARAMETERInvalid parameter
NFC_ERROR_NOT_ACTIVATEDNFC is not activated
NFC_ERROR_NO_DEVICEThere is no connected target
NFC_ERROR_PERMISSION_DENIEDSecurity restricted by SMACK
NFC_ERROR_OUT_OF_MEMORYOut of memory
NFC_ERROR_DEVICE_BUSYDevice is too busy to handle your request
NFC_ERROR_NO_DEVICEThere is no connected tag
NFC_ERROR_OPERATION_FAILEDOperation failed
See also:
nfc_manager_initialize()

Gets current connected p2p target.

Since :
2.3
Privilege Level:
public
Privilege:
http://tizen.org/privilege/nfc
Remarks:
The target should not be released.
The target is managed by the platform and will be released when NFC service stops.
Parameters:
[out]targetThe connected target
Returns:
0 on success, otherwise a negative error value.
Return values:
NFC_ERROR_NONESuccessful
NFC_ERROR_NOT_SUPPORTEDNot supported NFC
NFC_ERROR_NOT_INITIALIZEDNot initialized NFC
NFC_ERROR_INVALID_PARAMETERInvalid parameter
NFC_ERROR_NOT_ACTIVATEDNFC is not activated
NFC_ERROR_NO_DEVICEThere is no connected target
NFC_ERROR_PERMISSION_DENIEDSecurity restricted by SMACK
NFC_ERROR_OUT_OF_MEMORYOut of memory
NFC_ERROR_DEVICE_BUSYDevice is too busy to handle your request
NFC_ERROR_NO_DEVICEThere is no connected tag
NFC_ERROR_OPERATION_FAILEDOperation failed
See also:
nfc_manager_initialize()

Gets the card emulation Secure Element type.

Since :
2.3
Privilege Level:
public
Privilege:
http://tizen.org/privilege/nfc.cardemulation
Parameters:
[out]typeThe type of Secure Element
Returns:
0 on success, otherwise a negative error value.
Return values:
NFC_ERROR_NONESuccessful
NFC_ERROR_NOT_SUPPORTEDNot supported NFC
NFC_ERROR_NOT_INITIALIZEDNot initialized NFC
NFC_ERROR_INVALID_PARAMETERInvalid parameter
NFC_ERROR_NOT_ACTIVATEDNFC is not activated
NFC_ERROR_PERMISSION_DENIEDSecurity restricted by SMACK
NFC_ERROR_OUT_OF_MEMORYOut of memory
NFC_ERROR_DEVICE_BUSYDevice is too busy to handle your request
NFC_ERROR_OPERATION_FAILEDOperation failed
See also:
nfc_manager_initialize()

Gets the current filter status.

Since :
2.3
Remarks:
Bit operation OR(|) is used in return data
The default value is NFC_TAG_FILTER_ALL_ENABLE
The specific error code can be obtained using the get_last_result() method. Error codes are described in Exception section.
Returns:
The filter which is set nfc_tag_filter_e
0 on success, otherwise a negative error value.
Return values:
NFC_ERROR_NONESuccess
NFC_ERROR_NOT_SUPPORTEDNot supported NFC
NFC_ERROR_NOT_INITIALIZEDNot initialized NFC
See also:
nfc_manager_set_tag_filter()
nfc_manager_initialize()
int nfc_manager_initialize ( void  )

Initializes NFC Manager.

Since :
2.3
Remarks:
This function must be called before proceeding any other NFC functions
When an application crashes or exits without the deinitialization. NFC manager automatically deinitializes the process itself.
Returns:
0 on success, otherwise a negative error value.
Return values:
NFC_ERROR_NONESuccessful
NFC_ERROR_NOT_SUPPORTEDNot supported NFC
NFC_ERROR_OPERATION_FAILEDOperation fail
See also:
nfc_manager_deinitialize()
bool nfc_manager_is_activated ( void  )

Gets NFC Activation state.

This function checks the current state of NFC activation. It returns true if NFC is currently activated, and false if it is not.

Since :
2.3
Remarks:
The specific error code can be obtained using the get_last_result() method. Error codes are described in Exception section.
This function can executed Regardless of (nfc_manager_initialize) state.
Returns:
true on NFC activated, otherwise false
Exceptions:
NFC_ERROR_NONESuccess
NFC_ERROR_NOT_SUPPORTEDNot supported NFC
NFC_ERROR_ILLEGAL_STATEIllegal state
NFC_ERROR_OPERATION_FAILEDOperation fail
bool nfc_manager_is_supported ( void  )

Gets the value that indicates whether NFC is supported.

This function returns true if the NFC feature is supported on the device, otherwise it returns false.

Since :
2.3
Remarks:
The specific error code can be obtained using the get_last_result() method. Error codes are described in Exception section.
This function can executed Regardless of (nfc_manager_initialize) state.
Returns:
true on NFC supported, otherwise false
Exceptions:
NFC_ERROR_NONESuccess
NFC_ERROR_NOT_SUPPORTEDNot supported NFC
NFC_ERROR_ILLEGAL_STATEIllegal state
NFC_ERROR_OPERATION_FAILEDOperation fail

Gets the state of the system handler.

Since :
2.3
Privilege Level:
public
Privilege:
http://tizen.org/privilege/nfc
Remarks:
In default, The system handling is enabled.
The specific error code can be obtained using the get_last_result() method. Error codes are described in Exception section.
Returns:
true on enabled, otherwise false.
0 on success, otherwise a negative error value.
Exceptions:
NFC_ERROR_NONESuccess
NFC_ERROR_NOT_SUPPORTEDNot supported NFC
NFC_ERROR_NOT_INITIALIZEDNot initialized NFC
NFC_ERROR_NOT_ACTIVATEDNFC is not activated
NFC_ERROR_PERMISSION_DENIEDSecurity restricted by SMACK
NFC_ERROR_OPERATION_FAILEDOperation failed
See also:
nfc_manager_set_system_handler_enable()
nfc_manager_initialize()
int nfc_manager_set_activation ( bool  activation,
nfc_activation_completed_cb  callback,
void *  user_data 
)

Sets NFC Activation.

Warning:
This is not for use by third-party applications.

This function sets the NFC activation state. If the NFC state is set to true, NFC will be activated. If it is set to false, NFC will be deactivated. The provided callback function will be invoked after the activation or deactivation process is complete, and it can receive an error code indicating the result of the operation.

Since :
2.3
Privilege Level:
platform
Privilege:
http://tizen.org/privilege/nfc.admin
Parameters:
[in]activationThe NFC state for setting
[in]callbackThe callback function to invoke after this function has completed
It can be null if notification is not required
[in]user_dataThe user data to be passed to the callback function
Returns:
0 on success, otherwise a negative error value.
Return values:
NFC_ERROR_NONESuccessful
NFC_ERROR_NOT_SUPPORTEDNot supported NFC
NFC_ERROR_NOT_INITIALIZEDNot initialized NFC
NFC_ERROR_ALREADY_ACTIVATEDAlready activated
NFC_ERROR_ALREADY_DEACTIVATEDAlready deactivated
NFC_ERROR_OUT_OF_MEMORYOut of memory
NFC_ERROR_OPERATION_FAILEDOperation fail
NFC_ERROR_PERMISSION_DENIEDPermission denied
Postcondition:
It invokes nfc_activation_completed_cb() when it has completed to set activation.
The Callback can receive error code when process is done.
See also:
nfc_manager_is_activated()
nfc_activation_completed_cb()
nfc_manager_initialize()
int nfc_manager_set_activation_changed_cb ( nfc_activation_changed_cb  callback,
void *  user_data 
)

Sets NFC Activation state changed callback.

This function sets a callback function to be invoked when the NFC activation state changes. The callback function will be called with the new activation state and the user data provided during registration.

Since :
2.3
Parameters:
[in]callbackThe callback function to invoke when activation state is changed.
[in]user_dataThe user data to be passed to the callback function
Returns:
0 on success, otherwise a negative error value.
Return values:
NFC_ERROR_NONESuccessful
NFC_ERROR_NOT_SUPPORTEDNot supported NFC
NFC_ERROR_NOT_INITIALIZEDNot initialized NFC
NFC_ERROR_INVALID_PARAMETERInvalid parameter
See also:
nfc_activation_changed_cb()
nfc_manager_unset_activation_changed_cb()
nfc_manager_initialize()
int nfc_manager_set_hce_event_cb ( nfc_hce_event_cb  callback,
void *  user_data 
)

Sets a callback function for receiving HCE (Host Card Emulation) event.

This function sets a callback function that will be called when a Host Card Emulation (HCE) event occurs. The callback function will be called with the user data provided as a parameter. This function must be called after the NFC manager has been initialized.

Since :
2.3.1
Privilege Level:
public
Privilege:
http://tizen.org/privilege/nfc.cardemulation
Parameters:
[in]callbackThe callback function called when HCE (Host Card Emulation) event occurred.
[in]user_dataThe user data to be passed to the callback function
Returns:
0 on success, otherwise a negative error value.
Return values:
NFC_ERROR_NONESuccessful
NFC_ERROR_NOT_SUPPORTEDNot supported NFC
NFC_ERROR_NOT_INITIALIZEDNot initialized NFC
NFC_ERROR_INVALID_PARAMETERInvalid parameter
NFC_ERROR_PERMISSION_DENIEDPermission denied
See also:
nfc_hce_event_cb()
nfc_manager_unset_hce_event_cb()
nfc_manager_initialize()
int nfc_manager_set_ndef_discovered_cb ( nfc_ndef_discovered_cb  callback,
void *  user_data 
)

Sets a callback function for receiving NDEF Message discovered notification.

This function sets a callback function that will be called when an NDEF message is discovered. The callback function will be called with the user data provided as a parameter. This function must be called after the NFC manager has been initialized.

Since :
2.3
Parameters:
[in]callbackThe callback function called when NDEF Message is discovered
[in]user_dataThe user data to be passed to the callback function
Returns:
0 on success, otherwise a negative error value.
Return values:
NFC_ERROR_NONESuccessful
NFC_ERROR_NOT_SUPPORTEDNot supported NFC
NFC_ERROR_NOT_INITIALIZEDNot initialized NFC
NFC_ERROR_INVALID_PARAMETERInvalid parameter
See also:
nfc_manager_unset_ndef_discovered_cb()
nfc_ndef_discovered_cb()
nfc_manager_initialize()

Sets a callback function for receiving NFC peer-to-peer target discovered notification.

This function sets a callback function that will be called when an NFC peer-to-peer target is discovered. The callback function will be called with the user data provided as a parameter. This function must be called after the NFC manager has been initialized.

Since :
2.3
Parameters:
[in]callbackThe callback function called when NFC peer-to-peer target is discovered
[in]user_dataThe user data to be passed to the callback function
Returns:
0 on success, otherwise a negative error value.
Return values:
NFC_ERROR_NONESuccessful
NFC_ERROR_NOT_SUPPORTEDNot supported NFC
NFC_ERROR_NOT_INITIALIZEDNot initialized NFC
NFC_ERROR_INVALID_PARAMETERInvalid parameter
See also:
nfc_manager_unset_ndef_discovered_cb()
nfc_p2p_target_discovered_cb()
nfc_manager_initialize()
int nfc_manager_set_se_event_cb ( nfc_se_event_cb  callback,
void *  user_data 
)

Sets a callback function for receiving Secure Element (SIM/UICC (Universal Integrated Circuit Card)) event.

This function sets a callback function that will be called when a Secure Element event occurs. The callback function will be called with the user data provided as a parameter. This function must be called after the NFC manager has been initialized.

Since :
2.3
Parameters:
[in]callbackThe callback function called when occurred Secure Element (SIM/UICC (Universal Integrated Circuit Card)) event.
[in]user_dataThe user data to be passed to the callback function
Returns:
0 on success, otherwise a negative error value.
Return values:
NFC_ERROR_NONESuccessful
NFC_ERROR_NOT_SUPPORTEDNot supported NFC
NFC_ERROR_NOT_INITIALIZEDNot initialized NFC
NFC_ERROR_INVALID_PARAMETERInvalid parameter
See also:
nfc_se_event_cb()
nfc_manager_unset_se_event_cb()
nfc_manager_initialize()
int nfc_manager_set_se_transaction_event_cb ( nfc_se_type_e  se_type,
nfc_se_transaction_event_cb  callback,
void *  user_data 
)

Sets a callback function for receiving Secure Element (SIM/UICC (Universal Integrated Circuit Card)) transaction event(NFC_SE_EVENT_TRANSACTION) data.

This function sets a callback function that will be called when a Secure Element (SIM/UICC) transaction event (NFC_SE_EVENT_TRANSACTION) occurs. The callback function will be called with the user data provided as a parameter. This function must be called after the NFC manager has been initialized.

Since :
2.3
Parameters:
[in]se_typeThe type of secure element.
[in]callbackThe callback function called when occurred SE transaction event.
[in]user_dataThe user data to be passed to the callback function
Returns:
0 on success, otherwise a negative error value.
Return values:
NFC_ERROR_NONESuccessful
NFC_ERROR_NOT_SUPPORTEDNot supported NFC
NFC_ERROR_NOT_INITIALIZEDNot initialized NFC
NFC_ERROR_INVALID_PARAMETERInvalid parameter
See also:
nfc_se_transaction_event_cb()
nfc_manager_unset_se_transaction_event_cb()
nfc_manager_initialize()

Sets the card emulation Secure Element type.

Since :
2.3
Privilege Level:
public
Privilege:
http://tizen.org/privilege/nfc.cardemulation
Remarks:
Security level can be determined by the manufacturer usage.
If a security issue is occurred, contact with the manufacturer of the product.
If you want to know about security level in detail, See the GSMA specification.
(https://www.gsma.com/newsroom/wp-content/uploads/TS.26-v15.0.pdf)
Parameters:
[in]typeThe type of Secure Element
Returns:
0 on success, otherwise a negative error value.
Return values:
NFC_ERROR_NONESuccessful
NFC_ERROR_NOT_SUPPORTEDNot supported NFC
NFC_ERROR_NOT_INITIALIZEDNot initialized NFC
NFC_ERROR_INVALID_PARAMETERInvalid parameter
NFC_ERROR_NOT_ACTIVATEDNFC is not activated
NFC_ERROR_PERMISSION_DENIEDSecurity restricted by SMACK
NFC_ERROR_OUT_OF_MEMORYOut of memory
NFC_ERROR_DEVICE_BUSYDevice is too busy to handle your request
NFC_ERROR_SECURITY_RESTRICTEDSecurity restricted by Access Control
NFC_ERROR_ILLEGAL_STATEIllegal state
NFC_ERROR_OPERATION_FAILEDOperation failed
See also:
nfc_manager_initialize()

Enables or disable the system handling for tag and target discovered event.

Since :
2.3
Privilege Level:
public
Privilege:
http://tizen.org/privilege/nfc
Remarks:
In default, The system handling is enabled.
Parameters:
[in]enableThe state of enable
Returns:
0 on success, otherwise a negative error value.
Return values:
NFC_ERROR_NONESuccessful
NFC_ERROR_NOT_SUPPORTEDNot supported NFC
NFC_ERROR_NOT_INITIALIZEDNot initialized NFC
NFC_ERROR_NOT_ACTIVATEDNFC is not activated
NFC_ERROR_PERMISSION_DENIEDSecurity restricted by SMACK
NFC_ERROR_OPERATION_FAILEDOperation failed
See also:
nfc_manager_is_system_handler_enabled()
nfc_manager_initialize()
int nfc_manager_set_tag_discovered_cb ( nfc_tag_discovered_cb  callback,
void *  user_data 
)

Sets a callback function for receiving tag discovered notification.

This function sets a callback function that will be called when a tag is discovered or disappears. The callback function will be called with the user data provided as a parameter. This function must be called after the NFC manager has been initialized.

Since :
2.3
Parameters:
[in]callbackThe callback function called when a tag is appeared or disappeared
[in]user_dataThe user data to be passed to the callback function
Returns:
0 on success, otherwise a negative error value.
Return values:
NFC_ERROR_NONESuccessful
NFC_ERROR_NOT_SUPPORTEDNot supported NFC
NFC_ERROR_NOT_INITIALIZEDNot initialized NFC
NFC_ERROR_INVALID_PARAMETERInvalid parameter
See also:
nfc_manager_unset_tag_discovered_cb()
nfc_tag_discovered_cb()
nfc_manager_initialize()
void nfc_manager_set_tag_filter ( int  filter)

Sets filter of target types.

Since :
2.3
Remarks:
Bit operator OR(|) can be used in the configure parameter (like NFC_TAG_FILTER_ISO14443A_ENABLE | NFC_TAG_FILTER_ISO14443B_ENABLE) or you may choose "NFC_TAG_ALL_ENABLE" enum value to get all result. It prevent getting tag types from RF level. If the client function does call this function, default is always NFC_TAG_ALL_ENABLE.
The specific error code can be obtained using the get_last_result() method. Error codes are described in Exception section.
Parameters:
[in]filterThe filter value with bits operation nfc_tag_filter_e
Returns:
0 on success, otherwise a negative error value.
Exceptions:
NFC_ERROR_NONESuccess
NFC_ERROR_NOT_SUPPORTEDNot supported NFC
NFC_ERROR_NOT_INITIALIZEDNot initialized NFC
NFC_ERROR_INVALID_PARAMETERInvalid parameter
See also:
nfc_manager_get_tag_filter()
nfc_tag_discovered_cb()
nfc_manager_initialize()

Unsets the callback function.

This function unregisters the callback function previously set by nfc_manager_set_activation_changed_cb(). After calling this function, the callback function will no longer be called when the NFC activation state changes.

Since :
2.3
Remarks:
The specific error code can be obtained using the get_last_result() method. Error codes are described in Exception section.
Exceptions:
NFC_ERROR_NONESuccess
NFC_ERROR_NOT_SUPPORTEDNot supported NFC
NFC_ERROR_NOT_INITIALIZEDNot initialized NFC
See also:
nfc_manager_set_activation_changed_cb()
nfc_activation_changed_cb()
nfc_manager_initialize()

Unsets the callback function.

This function unsets the previously set callback function for receiving Host Card Emulation (HCE) event notifications. After calling this function, the callback function will no longer be called when a Host Card Emulation (HCE) event occurs. This function must be called after the NFC manager has been initialized.

Since :
2.3.1
Privilege Level:
public
Privilege:
http://tizen.org/privilege/nfc.cardemulation
Remarks:
The specific error code can be obtained using the get_last_result() method. Error codes are described in Exception section.
Returns:
0 on success, otherwise a negative error value.
Exceptions:
NFC_ERROR_NONESuccess
NFC_ERROR_NOT_SUPPORTEDNot supported NFC
NFC_ERROR_NOT_INITIALIZEDNot initialized NFC
NFC_ERROR_PERMISSION_DENIEDPermission denied
See also:
nfc_hce_event_cb()
nfc_manager_set_hce_event_cb()
nfc_manager_initialize()

Unsets the callback function.

This function unsets the previously set callback function for receiving NDEF message discovered notifications. After calling this function, the callback function will no longer be called when an NDEF message is discovered. This function must be called after the NFC manager has been initialized.

Since :
2.3
Remarks:
The specific error code can be obtained using the get_last_result() method. Error codes are described in Exception section.
Returns:
0 on success, otherwise a negative error value.
Exceptions:
NFC_ERROR_NONESuccess
NFC_ERROR_NOT_SUPPORTEDNot supported NFC
NFC_ERROR_NOT_INITIALIZEDNot initialized NFC
See also:
nfc_manager_set_ndef_discovered_cb()
nfc_ndef_discovered_cb()
nfc_manager_initialize()

Unsets the callback function.

This function unsets the previously set callback function for receiving NFC peer-to-peer target discovered notifications. After calling this function, the callback function will no longer be called when an NFC peer-to-peer target is discovered. This function must be called after the NFC manager has been initialized.

Since :
2.3
Remarks:
The specific error code can be obtained using the get_last_result() method. Error codes are described in Exception section.
Returns:
0 on success, otherwise a negative error value.
Exceptions:
NFC_ERROR_NONESuccess
NFC_ERROR_NOT_SUPPORTEDNot supported NFC
NFC_ERROR_NOT_INITIALIZEDNot initialized NFC
See also:
nfc_manager_set_p2p_target_discovered_cb()
nfc_p2p_target_discovered_cb()
nfc_manager_initialize()

Unsets the callback function.

This function unsets the previously set callback function for receiving Secure Element (SIM/UICC) event notifications. After calling this function, the callback function will no longer be called when a Secure Element (SIM/UICC) event occurs. This function must be called after the NFC manager has been initialized.

Since :
2.3
Remarks:
The specific error code can be obtained using the get_last_result() method. Error codes are described in Exception section.
Returns:
0 on success, otherwise a negative error value.
Exceptions:
NFC_ERROR_NONESuccess
NFC_ERROR_NOT_SUPPORTEDNot supported NFC
NFC_ERROR_NOT_INITIALIZEDNot initialized NFC
See also:
nfc_se_event_cb()
nfc_manager_set_se_event_cb()
nfc_manager_initialize()

Unsets the callback function.

This function unsets the previously set callback function for receiving Secure Element (SIM/UICC) transaction event (NFC_SE_EVENT_TRANSACTION) notifications. After calling this function, the callback function will no longer be called when a Secure Element (SIM/UICC) transaction event (NFC_SE_EVENT_TRANSACTION) occurs. This function must be called after the NFC manager has been initialized.

Since :
2.3
Remarks:
The specific error code can be obtained using the get_last_result() method. Error codes are described in Exception section.
Parameters:
[in]se_typeThe type of secure element.
Returns:
0 on success, otherwise a negative error value.
Exceptions:
NFC_ERROR_NONESuccess
NFC_ERROR_NOT_SUPPORTEDNot supported NFC
NFC_ERROR_NOT_INITIALIZEDNot initialized NFC
NFC_ERROR_INVALID_PARAMETERInvalid parameter
See also:
nfc_se_transaction_event_cb()
nfc_manager_set_se_transaction_event_cb()
nfc_manager_initialize()

Unsets the callback function.

This function unsets the previously set callback function for receiving tag discovered notifications. After calling this function, the callback function will no longer be called when a tag is discovered or disappears. This function must be called after the NFC manager has been initialized.

Since :
2.3
Remarks:
The specific error code can be obtained using the get_last_result() method. Error codes are described in Exception section.
Exceptions:
NFC_ERROR_NONESuccess
NFC_ERROR_NOT_SUPPORTEDNot supported NFC
NFC_ERROR_NOT_INITIALIZEDNot initialized NFC
See also:
nfc_manager_set_tag_discovered_cb()
nfc_tag_discovered_cb()
nfc_manager_initialize()