2 * Copyright (c) 2012 Samsung Electronics Co., Ltd All Rights Reserved
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
29 * @brief This file contains the NFC API.
32 #define NFC_ERROR_CLASS TIZEN_ERROR_NETWORK_CLASS | 0x200
36 * @brief Error codes reported by the NFC API.
37 * @ingroup CAPI_NETWORK_NFC_MANAGER_MODULE
40 NFC_ERROR_NONE = TIZEN_ERROR_NONE, /**< Successful */
41 NFC_ERROR_OUT_OF_MEMORY = TIZEN_ERROR_OUT_OF_MEMORY, /**< Out of memory */
42 NFC_ERROR_OPERATION_FAILED = NFC_ERROR_CLASS | 0x01, /**< Operation failed*/
43 NFC_ERROR_INVALID_PARAMETER = TIZEN_ERROR_INVALID_PARAMETER, /**< Invalid parameter */
44 NFC_ERROR_INVALID_NDEF_MESSAGE = NFC_ERROR_CLASS | 0x02, /**< Invalid NDEF message */
45 NFC_ERROR_INVALID_RECORD_TYPE = NFC_ERROR_CLASS | 0x03, /**< Invalid record type*/
46 NFC_ERROR_TIMED_OUT = TIZEN_ERROR_TIMED_OUT, /**< Timeout error, no answer */
47 NFC_ERROR_DEVICE_BUSY = TIZEN_ERROR_RESOURCE_BUSY, /**< Previous opertion is not finished still busy */
48 NFC_ERROR_NO_DEVICE = NFC_ERROR_CLASS | 0x04, /**< no device */
49 NFC_ERROR_NOT_ACTIVATED = NFC_ERROR_CLASS | 0x05, /**< NFC is not activated */
50 NFC_ERROR_NOT_SUPPORTED = NFC_ERROR_CLASS | 0x06, /**< Not supported */
51 NFC_ERROR_ALREADY_ACTIVATED = NFC_ERROR_CLASS | 0x07, /**< Already activated */
52 NFC_ERROR_ALREADY_DEACTIVATED = NFC_ERROR_CLASS | 0x08, /**< Already deactivated */
53 NFC_ERROR_READ_ONLY_NDEF = NFC_ERROR_CLASS | 0x09, /**< Read only tag */
54 NFC_ERROR_NO_SPACE_ON_NDEF = NFC_ERROR_CLASS | 0x0a, /**< No enough space on tag */
55 NFC_ERROR_NO_NDEF_MESSAGE = NFC_ERROR_CLASS | 0x0b, /**< No NDEF Message on Tag */
56 NFC_ERROR_NOT_NDEF_FORMAT = NFC_ERROR_CLASS | 0x0c /**< Not NDEF format Tag */
60 * @brief Enumerations for record TNF (Type Name Format)
61 * @details It is indicate format of type field
62 * @ingroup CAPI_NETWORK_NFC_NDEF_RECORD_MODULE
65 NFC_RECORD_TNF_EMPTY = 0x00, /**< Empty */
66 NFC_RECORD_TNF_WELL_KNOWN = 0x01, /**< RTD(Record Type Definition) type format [NFC RTD] */
67 NFC_RECORD_TNF_MIME_MEDIA= 0x02, /**< MIME Media types in RFC 2046 [RFC 2046] */
68 NFC_RECORD_TNF_URI = 0x03, /**< Absolute URI as defined in RFC 3986 [RFC 3986] */
69 NFC_RECORD_TNF_EXTERNAL_RTD = 0x04, /**< NFC Forum external type [NFC RTD] */
70 NFC_RECORD_TNF_UNKNOWN = 0x05, /**< Unknown\n The payload type is unknown */
71 NFC_RECORD_TNF_UNCHAGNED = 0x06, /**< It means the payload is an intermediate or final chunk of a chunked NDEF Record */
76 * @brief Enumerations for NFC encode types
77 * @ingroup CAPI_NETWORK_NFC_NDEF_RECORD_MODULE
80 NFC_ENCODE_UTF_8 = 0x00, /**< UTF-8 */
81 NFC_ENCODE_UTF_16, /**< UTF-16 */
85 * @brief Enumerations for NFC tag types
86 * @ingroup CAPI_NETWORK_NFC_TAG_MODULE
89 NFC_UNKNOWN_TARGET = 0x00U, /**< Unknown target */
90 NFC_GENERIC_PICC, /**< GENERIC PICC*/
91 NFC_ISO14443_A_PICC, /**< ISO14443_A PICC */
92 NFC_ISO14443_4A_PICC, /**< ISO14443_4A PICC */
93 NFC_ISO14443_3A_PICC, /**< ISO14443_3A PICC */
94 NFC_MIFARE_MINI_PICC, /**< MIFARE_MINI_PICC */
95 NFC_MIFARE_1K_PICC, /**< MIFARE_1K_PICC */
96 NFC_MIFARE_4K_PICC, /**< MIFARE_4K_PICC */
97 NFC_MIFARE_ULTRA_PICC, /**< MIFARE_ULTRA_PICC */
98 NFC_MIFARE_DESFIRE_PICC, /**< MIFARE_DESFIRE_PICC */
99 NFC_ISO14443_B_PICC, /**< ISO14443_B PICC */
100 NFC_ISO14443_4B_PICC, /**< ISO14443_4B PICC */
101 NFC_ISO14443_BPRIME_PICC, /**< ISO14443_BPRIME PICC */
102 NFC_FELICA_PICC, /**< FELICA PICC */
103 NFC_JEWEL_PICC, /**< JEWEL PICC */
104 NFC_ISO15693_PICC, /**< ISO15693 PICC */
105 NFC_NFCIP1_TARGET, /**< NFCIP1_TARGET */
106 NFC_NFCIP1_INITIATOR, /**< NFCIP1_INITIATOR */
112 * @brief Enumerations for NFC Tag filter
113 * @ingroup CAPI_NETWORK_NFC_MANAGER_MODULE
116 NFC_TAG_FILTER_ALL_DISABLE = 0x0000, /**< All disable */
117 NFC_TAG_FILTER_ISO14443A_ENABLE = 0x0001, /**< ISO14443A enable */
118 NFC_TAG_FILTER_ISO14443B_ENABLE = 0x0002, /**< ISO14443B enable */
119 NFC_TAG_FILTER_ISO15693_ENABLE = 0x0004, /**< ISO15693 enable */
120 NFC_TAG_FILTER_FELICA_ENABLE = 0x0008, /**< FELICA enable */
121 NFC_TAG_FILTER_JEWEL_ENABLE = 0x0010, /**< JEWEL enable */
122 NFC_TAG_FILTER_IP_ENABLE = 0x0020, /**< IP enable */
123 NFC_TAG_FILTER_ALL_ENABLE= ~0, /**< All enable */
127 * @brief Enumerations of polling request code for FeliCa tag
128 * @ingroup CAPI_NETWORK_NFC_TAG_FELICA
131 NFC_TAG_FELICA_POLL_NO_REQUEST = 0x00, /**< NO REQUEST */
132 NFC_TAG_FELICA_POLL_SYSTEM_CODE_REQUEST= 0x01, /**< SYSTEM CODE REQUEST */
133 NFC_TAG_FELICA_POLL_COMM_SPEED_REQUEST= 0x02, /**< COMM SPEED REQUEST */
134 } nfc_tag_felica_poll_request_code_e;
138 * @brief Enumerations for NFC discovered type
139 * @ingroup CAPI_NETWORK_NFC_MANAGER_MODULE
142 NFC_DISCOVERED_TYPE_ATTACHED, /**< Attached, discovered, activated event*/
143 NFC_DISCOVERED_TYPE_DETACHED, /**< detached, disappeared, deactivated event*/
144 } nfc_discovered_type_e;
147 * @brief Enumerations for NFC Secure Element (SIM/UICC(Universal Integrated Circuit Card)) event
148 * @ingroup CAPI_NETWORK_NFC_MANAGER_MODULE
151 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. */
152 NFC_SE_EVENT_END_TRANSACTION, /**< This event notifies the terminal host that current transaction in process was ended. */
153 NFC_SE_EVENT_CONNECTIVITY, /**< It's ready signal to communicate UICC(Universal Integrated Circuit Card) with terminal host. \nUICC(Universal Integrated Circuit Card) create pipe and open the pipe chanel.\nThen it sends the signal to terminal host or host controller. */
154 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.\nWhen 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]*/
155 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.\nWhen there are multiple open card RF gates the CLF shall send the #NFC_SE_EVENT_FIELD_OFF to one gate only.*/
156 NFC_SE_EVENT_TRANSACTION /**< This event notifies , external reader trys to access secure element */
161 * @brief Enumerations for NFC AC(Alternative Carrior)
162 * @ingroup CAPI_NETWORK_NFC_P2P_MODULE
165 NFC_AC_TYPE_BT = 0x00, /**< Bluetooth AC*/
166 NFC_AC_TYPE_WIFI, /**<Wifi AC*/
167 NFC_AC_TYPE_WIFI_DIRECT,/**<Wifi-direct AC*/
168 NFC_AC_TYPE_UNKNOWN, /* No selected preferd AC */
175 * @brief The handle to the NDEF record
176 * @ingroup CAPI_NETWORK_NFC_NDEF_RECORD_MODULE
178 typedef struct ndef_record_s *nfc_ndef_record_h;
181 * @brief The handle to the NDEF message
182 * @ingroup CAPI_NETWORK_NFC_NDEF_MESSAGE_MODULE
184 typedef struct ndef_message_s *nfc_ndef_message_h;
187 * @brief The handle to the NFC tag
188 * @ingroup CAPI_NETWORK_NFC_TAG_MODULE
190 typedef struct net_nfc_target_info_s *nfc_tag_h;
194 * @brief The handle to NFC p2p target
195 * @ingroup CAPI_NETWORK_NFC_TAG_MODULE
197 typedef void* nfc_p2p_target_h;
200 * @brief The default factory key.
201 * @details The key is 0xff, 0xff, 0xff, 0xff, 0xff, 0xff
202 * @ingroup CAPI_NETWORK_NFC_TAG_MIFARE_MODULE
204 extern const unsigned char NFC_TAG_MIFARE_KEY_DEFAULT[6];
207 * @brief The well-known key for tags formatted according to the MIFARE Application Directory (MAD) specification.
208 * @details The key is 0xA0, 0xA1, 0xA2, 0xA3, 0xA4, 0xA5
209 * @ingroup CAPI_NETWORK_NFC_TAG_MIFARE_MODULE
211 extern const unsigned char NFC_TAG_MIFARE_KEY_APPLICATION_DIRECTORY[6];
214 * @brief The well-known key for tags formatted according to the NDEF on Mifare Classic specification.
215 * @details The key is 0xD3, 0xF7, 0xD3, 0xF7, 0xD3, 0xF7
216 * @ingroup CAPI_NETWORK_NFC_TAG_MIFARE_MODULE
218 extern const unsigned char NFC_TAG_MIFARE_KEY_NFC_FORUM[6];
222 * @brief RTD(Record type definition) Type - Smart Poster type.
223 * @ingroup CAPI_NETWORK_NFC_NDEF_RECORD_MODULE
225 extern const unsigned char NFC_RECORD_SMART_POSTER_TYPE[2];
228 * @brief RTD(Record type definition) Type - Text type.
229 * @ingroup CAPI_NETWORK_NFC_NDEF_RECORD_MODULE
231 extern const unsigned char NFC_RECORD_TEXT_TYPE[1];
233 * @brief RTD(Record type definition) Type - URI type.
234 * @ingroup CAPI_NETWORK_NFC_NDEF_RECORD_MODULE
236 extern const unsigned char NFC_RECORD_URI_TYPE[1];
238 * @brief RTD(Record type definition) Type - Alternative Carrier type.
239 * @ingroup CAPI_NETWORK_NFC_NDEF_RECORD_MODULE
241 extern const unsigned char NFC_RECORD_ALTERNATIVE_CARRIER_TYPE[2];
243 * @brief RTD(Record type definition) Type - Handover Carrier type.
244 * @ingroup CAPI_NETWORK_NFC_NDEF_RECORD_MODULE
246 extern const unsigned char NFC_RECORD_HANDOVER_CARRIER_TYPE[2];
248 * @brief RTD(Record type definition) Type - Handover Request type.
249 * @ingroup CAPI_NETWORK_NFC_NDEF_RECORD_MODULE
251 extern const unsigned char NFC_RECORD_HANDOVER_REQUEST_TYPE[2];
253 * @brief RTD(Record type definition) Type - Handover Select type.
254 * @ingroup CAPI_NETWORK_NFC_NDEF_RECORD_MODULE
256 extern const unsigned char NFC_RECORD_HANDOVER_SELECT_TYPE[2];
259 * @brief Called after nfc_manager_set_activation() has completed.
260 * @ingroup CAPI_NETWORK_NFC_MANAGER_MODULE
262 * @param [in] error The result
263 * @param [in] user_data The user data passed from the callback registration function
265 * @see nfc_manager_set_activation()
267 typedef void (* nfc_activation_completed_cb)(nfc_error_e error, void *user_data);
270 * @brief Called when nfc activation state is changed.
271 * @ingroup CAPI_NETWORK_NFC_MANAGER_MODULE
273 * @param [in] activated The activation state
274 * @param [in] user_data The user data passed from the callback registeration function
276 * @see nfc_manager_set_activation_changed_cb()
278 typedef void (*nfc_activation_changed_cb)(bool activated , void *user_data);
281 * @brief Called after nfc_manager_initialize() has completed.
282 * @ingroup CAPI_NETWORK_NFC_MANAGER_MODULE
284 * @param [in] error The result
285 * @param [in] user_data The user data passed from the callback registration function
287 * @see nfc_manager_initialize()
289 typedef void (* nfc_initialize_completed_cb)(nfc_error_e error, void *user_data);
293 * @brief Called when an NFC tag appears or disappears
294 * @ingroup CAPI_NETWORK_NFC_MANAGER_MODULE
296 * @remarks The tag handle does not have detail target info when an NFC tag disappeared.\n
297 * So then do not use nfc_tag_get_keys().
299 * @param [in] type The discovered type attached or detached
300 * @param [in] tag The handle to NFC tag
301 * @param [in] user_data The user data passed from the callback registration function
303 * @see nfc_manager_set_tag_discovered_cb()
304 * @see nfc_manager_unset_tag_discovered_cb()
305 * @see nfc_manager_set_tag_filter()
307 typedef void (* nfc_tag_discovered_cb)(nfc_discovered_type_e type, nfc_tag_h tag, void *user_data);
310 * @brief Called when an NDEF Message is discovered
311 * @ingroup CAPI_NETWORK_NFC_MANAGER_MODULE
313 * @remarks @a message will be automatically destroyed when the callback function returns. (Do not release @a message.)
315 * @param [in] message The handle to NDEF message
316 * @param [in] user_data The user data passed from the callback registration function
318 * @see nfc_manager_set_ndef_discovered_cb()
319 * @see nfc_manager_unset_ndef_discovered_cb()
321 typedef void (* nfc_ndef_discovered_cb)(nfc_ndef_message_h message, void *user_data);
325 * @brief Called once for each tag information.
326 * @ingroup CAPI_NETWORK_NFC_TAG_MODULE
328 * @remarks @a key and value will be automatically destroyed when the callback function returns. (Do not release @a key and value.)
330 * @param[in] key The key of information
331 * @param[in] value The value of information
332 * @param[in] value_size The data size in bytes
333 * @param[in] user_data The user data passed from the foreach function
335 * @return @c true to continue with the next iteration of the loop, \n @c false to break outsp of the loop.
336 * @pre nfc_tag_foreach_informations() invokes this callback.
338 * @see nfc_tag_foreach_informations()
341 typedef bool (*nfc_tag_information_cb)(const char *key, const unsigned char *value, int value_size, void *user_data);
345 * @brief Called after nfc_tag_transceive() has completed.
346 * @ingroup CAPI_NETWORK_NFC_TAG_MODULE
348 * @remarks @a buffer will be automatically destroyed when the callback function returns. (Do not release @a buffer.)
350 * @param [in] result The result of function call
351 * @param [in] buffer The result data
352 * @param [in] buffer_size The size of buffer in bytes
353 * @param [in] user_data The user data passed from nfc_tag_transceive()
355 * @see nfc_tag_transceive()
357 typedef void (* nfc_tag_transceive_completed_cb)(nfc_error_e result, unsigned char *buffer, int buffer_size, void *user_data);
360 * @brief Called after the nfc_tag_write_ndef() has completed.
361 * @ingroup CAPI_NETWORK_NFC_TAG_MODULE
363 * @param [in] result The result of function call
364 * @param [in] user_data The user data passed from nfc_manager_initialize()
366 * @see nfc_tag_write_ndef()
368 typedef void (* nfc_tag_write_completed_cb)(nfc_error_e result, void *user_data);
371 * @brief Called after the nfc_tag_read_ndef() has completed.
372 * @ingroup CAPI_NETWORK_NFC_TAG_MODULE
374 * @remarks @a message will be automatically destroyed when the callback function returns. (Do not release @a message.)
376 * @param [in] result The result of function call
377 * @param [in] message The NDEF message
378 * @param [in] user_data The user data passed from nfc_tag_read_ndef()
380 * @see nfc_tag_read_ndef()
382 typedef void (* nfc_tag_read_completed_cb)(nfc_error_e result, nfc_ndef_message_h message, void *user_data);
385 * @brief Called after the nfc_tag_format_ndef() has completed.
386 * @ingroup CAPI_NETWORK_NFC_TAG_MODULE
388 * @param [in] result The result of function call
389 * @param [in] user_data The user data passed from nfc_tag_format_ndef()
391 * @see nfc_tag_format_ndef()
393 typedef void (* nfc_tag_format_completed_cb)(nfc_error_e result, void *user_data);
397 * @brief Called after nfc_mifare_authenticate_with_keyA() has completed
398 * @ingroup CAPI_NETWORK_NFC_TAG_MIFARE_MODULE
399 * @param [in] result The result of nfc_mifare_authenticate_with_keyA()
400 * @param [in] user_data The user data passed from nfc_mifare_authenticate_with_keyA()
401 * @see nfc_mifare_authenticate_with_keyA()
403 typedef void (* nfc_mifare_authenticate_with_keyA_completed_cb)(nfc_error_e result, void *user_data);
406 * @brief Called after nfc_mifare_authenticate_with_keyB() has completed
407 * @ingroup CAPI_NETWORK_NFC_TAG_MIFARE_MODULE
408 * @param [in] result The result of function call
409 * @param [in] user_data The user data passed from nfc_mifare_authenticate_with_keyB()
410 * @see nfc_mifare_authenticate_with_keyB()
412 typedef void (* nfc_mifare_authenticate_with_keyB_completed_cb)(nfc_error_e result, void *user_data);
415 * @brief Called after nfc_mifare_write_block() has completed
416 * @ingroup CAPI_NETWORK_NFC_TAG_MIFARE_MODULE
417 * @param [in] result The result of nfc_mifare_write_block()
418 * @param [in] user_data The user data passed from nfc_mifare_write_block()
419 * @see nfc_mifare_write_block()
421 typedef void (* nfc_mifare_write_block_completed_cb)(nfc_error_e result, void *user_data);
424 * @brief Called after nfc_mifare_write_page() has completed
425 * @ingroup CAPI_NETWORK_NFC_TAG_MIFARE_MODULE
426 * @param [in] result The result of function call
427 * @param [in] user_data The user data passed from nfc_mifare_write_page()
428 * @see nfc_mifare_write_page()
430 typedef void (* nfc_mifare_write_page_completed_cb)(nfc_error_e result, void *user_data);
433 * @brief Called after nfc_mifare_read_block() has completed
434 * @ingroup CAPI_NETWORK_NFC_TAG_MIFARE_MODULE
436 * @remarks @a buffer will be automatically destroyed when the callback function returns. (Do not release @a buffer.)
438 * @param [in] result The result of function call
439 * @param [in] buffer Thre read buffer
440 * @param [in] size The size of buffer in bytes
441 * @param [in] user_data The user data passed from nfc_mifare_read_block()
442 * @see nfc_mifare_read_block()
444 typedef void (* nfc_mifare_read_block_completed_cb)(nfc_error_e result, unsigned char *buffer, int bufer_size, void *user_data);
447 * @brief Called after nfc_mifare_read_page() has completed
448 * @ingroup CAPI_NETWORK_NFC_TAG_MIFARE_MODULE
450 * @remarks @a buffer will be automatically destroyed when the callback function returns. (Do not release @a buffer.)
452 * @param [in] result The result of nfc_mifare_read_page()
453 * @param [in] buffer The read buffer
454 * @param [in] size The size of read buffer in bytes
455 * @param [in] user_data The user data passed from nfc_mifare_read_page()
456 * @see nfc_mifare_read_page()
458 typedef void (* nfc_mifare_read_page_completed_cb)(nfc_error_e result, unsigned char *buffer, int bufer_size, void *user_data);
461 * @brief Called after nfc_mifare_increment() has completed
462 * @ingroup CAPI_NETWORK_NFC_TAG_MIFARE_MODULE
463 * @param [in] result The result of nfc_mifare_increment()
464 * @param [in] user_data The user data passed from nfc_mifare_increment()
465 * @see nfc_mifare_increment()
467 typedef void (* nfc_mifare_increment_completed_cb)(nfc_error_e result, void *user_data);
470 * @brief Called after nfc_mifare_decrement() has completed
471 * @ingroup CAPI_NETWORK_NFC_TAG_MIFARE_MODULE
472 * @param [in] result The result of nfc_mifare_decrement()
473 * @param [in] user_data The user data passed from nfc_mifare_decrement()
474 * @see nfc_mifare_decrement()
476 typedef void (* nfc_mifare_decrement_completed_cb)(nfc_error_e result, void *user_data);
479 * @brief Called after nfc_mifare_transfer() has completed
480 * @ingroup CAPI_NETWORK_NFC_TAG_MIFARE_MODULE
481 * @param [in] result The result of nfc_mifare_transfer()
482 * @param [in] user_data The user data passed from nfc_mifare_transfer()
483 * @see nfc_mifare_transfer()
485 typedef void (* nfc_mifare_transfer_completed_cb)(nfc_error_e result, void *user_data);
488 * @brief Called after nfc_mifare_restore() has completed
489 * @ingroup CAPI_NETWORK_NFC_TAG_MIFARE_MODULE
490 * @param [in] result The result of nfc_mifare_restore()
491 * @param [in] user_data The user data passed from nfc_mifare_restore()
492 * @see nfc_mifare_restore()
494 typedef void (* nfc_mifare_restore_completed_cb)(nfc_error_e result, void *user_data);
499 * @brief Called when NFC peer-to-peer target appeared or disappeared
500 * @ingroup CAPI_NETWORK_NFC_MANAGER_MODULE
501 * @param [in] type The discovered type attached or detached
502 * @param [in] target The handle to p2p target
503 * @param [in] user_data The user data passed from nfc_manager_set_p2p_target_discovered_cb()
505 * @see nfc_manager_set_p2p_target_discovered_cb()
506 * @see nfc_manager_unset_p2p_target_discovered_cb()
508 typedef void (*nfc_p2p_target_discovered_cb)(nfc_discovered_type_e type, nfc_p2p_target_h target, void *user_data);
511 * @brief Called when receiving Secure Element (SIM/UICC(Universal Integrated Circuit Card)) event.
512 * @ingroup CAPI_NETWORK_NFC_MANAGER_MODULE
513 * @param [in] event The Secure Element event
514 * @param [in] user_data The user data passed from nfc_manager_set_se_event_cb()
516 * @see nfc_manager_set_se_event_cb()
517 * @see nfc_manager_unset_se_event_cb()
519 typedef void (*nfc_se_event_cb)(nfc_se_event_e event , void *user_data);
523 * @brief Called when receiving Secure Element(SIM/UICC(Universal Integrated Circuit Card)) transaction event data
524 * @remarks This event notifies , external reader trys to access secure element.
525 * @ingroup CAPI_NETWORK_NFC_MANAGER_MODULE
526 * @param [in] aid Application Id, specified in ISO/IEC 7816-4
527 * @param [in] aid_size The size of aid (5~16)
528 * @param [in] param The parameter list, specified in ISO/IEC 8825-1
529 * @param [in] param The size of param (0~65535)
530 * @param [in] user_data The user data passed from nfc_manager_set_se_transaction_event_cb()
532 * @see nfc_manager_set_se_transaction_event_cb()
533 * @see nfc_manager_unset_se_transaction_event_cb()
535 typedef void (*nfc_se_transaction_event_cb)(unsigned char* aid, int aid_size , unsigned char* param, int param_size, void *user_data);
540 * @brief Called after nfc_p2p_send() has completed.
541 * @ingroup CAPI_NETWORK_NFC_P2P_MODULE
542 * @param [in] result The result of function call
543 * @param [in] user_data The user data passed from nfc_p2p_send()
545 * @see nfc_p2p_send()
547 typedef void (*nfc_p2p_send_completed_cb)(nfc_error_e result, void *user_data);
551 * @brief Called after nfc_p2p_send() has completed.
552 * @ingroup CAPI_NETWORK_NFC_P2P_MODULE
554 * @remarks @a message will be automatically destroyed when the callback function returns. (Do not release @a message.)
556 * @param [in] target The handle to p2p target
557 * @param [in] message The recevied message
558 * @param [in] user_data The user data passed from nfc_p2p_set_recv_cb()
560 * @see nfc_p2p_set_data_received_cb()
561 * @see nfc_p2p_unset_data_received_cb()
563 typedef void (*nfc_p2p_data_recived_cb)(nfc_p2p_target_h target, nfc_ndef_message_h message, void *user_data);
567 * @brief Called after nfc_p2p_connection_handover() has completed.
568 * @ingroup CAPI_NETWORK_NFC_P2P_MODULE
570 * @remark To use the @a ac_data outside this function, copy the @a ac_data.
571 * @remark @a ac_data could be NULL, if nfc_p2p_connection_handover failed.
572 * @remark If @a carrior is #NFC_AC_TYPE_BT, @ac_data should be converted to 'char *' type. This is bluetooth address information.
574 * @param [in] result The result of function call
575 * @param [in] carrior The type of Alternative Carrior
576 * @param [in] ac_data The connected remote device AC(Alternative Carrior) information data
577 * @param [in] ac_data_size The connected remote device AC(Alternative Carrior) information data size
578 * @param [in] user_data The user data passed from nfc_p2p_connection_handover()
580 * @see nfc_p2p_connection_handover()
582 typedef void (*nfc_p2p_connection_handover_completed_cb)(nfc_error_e result, nfc_ac_type_e carrior, void * ac_data, int ac_data_size , void *user_data);
585 * @brief Gets the value that indicates whether NFC is supported.
586 * @ingroup CAPI_NETWORK_NFC_MANAGER_MODULE
588 * @remarks This function can executed Regardless of nfc_manager_initialize state.
590 * @return true on NFC supported, otherwise false
591 * @see nfc_manager_set_activation()
593 bool nfc_manager_is_supported(void);
596 * @brief Sets NFC Activation
597 * @ingroup CAPI_NETWORK_NFC_MANAGER_MODULE
599 * @param [in] activation The NFC state for setting
600 * @param [in] callback The callback function to invoke after this function has completed\n It can be null if notification is not required
601 * @param [in] user_data The user data to be passed to the callback function
603 * @return 0 on success, otherwise a negative error value.
604 * @retval #NFC_ERROR_NONE Successful
605 * @retval #NFC_ERROR_OPERATION_FAILED Operation fail
606 * @retval #NFC_ERROR_NOT_SUPPORTED Not supported NFC
607 * @retval #NFC_ERROR_ALREADY_ACTIVATED Already activated
608 * @retval #NFC_ERROR_ALREADY_DEACTIVATED Already deactivated
609 * @see nfc_manager_is_activated()
610 * @see nfc_activation_completed_cb()
612 int nfc_manager_set_activation(bool activation, nfc_activation_completed_cb callback, void *user_data);
615 * @brief Set NFC Activation state changed callback
616 * @ingroup CAPI_NETWORK_NFC_MANAGER_MODULE
618 * @param [in] callback The callback function to invoke when activation state is changed.
619 * @param [in] user_data The user data to be passed to the callback function
621 * @return 0 on success, otherwise a negative error value.
622 * @retval #NFC_ERROR_NONE Successful
623 * @retval #NFC_ERROR_INVALID_PARAMETER Invalid parameter
625 * @see nfc_activation_changed_cb()
626 * @see nfc_manager_unset_activation_changed_cb()
628 int nfc_manager_set_activation_changed_cb(nfc_activation_changed_cb callback , void *user_data);
631 * @brief Unregisters the callback function.
632 * @ingroup CAPI_NETWORK_NFC_MANAGER_MODULE
634 * @see nfc_manager_set_activation_changed_cb()
635 * @see nfc_activation_changed_cb()
637 void nfc_manager_unset_activation_changed_cb(void);
641 * @brief Gets NFC Activation state
642 * @ingroup CAPI_NETWORK_NFC_MANAGER_MODULE
644 * @remarks This function can executed Regardless of nfc_manager_initialize state.
646 * @return true on NFC activated, otherwise false
647 * @see nfc_manager_set_activation()
650 bool nfc_manager_is_activated(void);
653 * @brief Initializes NFC Manager.
654 * @ingroup CAPI_NETWORK_NFC_MANAGER_MODULE
655 * @remarks This function must be called before proceeding any other nfc functions\n
656 * Internally it makes socket connection to NFC manager.\n
657 * When an application crashes or exits without the deinitialization. NFC manager automatically deinitializes the process itself.\n
659 * @param [in] callback The callback function to invoke after this function has completed\n It can be null if notification is not required
660 * @param [in] user_data The user data to be passed to the callback function
662 * @return 0 on success, otherwise a negative error value.
663 * @retval #NFC_ERROR_NONE Successful
664 * @retval #NFC_ERROR_OPERATION_FAILED Operation fail
665 * @see nfc_manager_deinitialize()
667 int nfc_manager_initialize(nfc_initialize_completed_cb callback, void *user_data);
671 * @brief Releases all the resource of the NFC Manager and disconnecst the session between an application and NFC Manager.
672 * @ingroup CAPI_NETWORK_NFC_MANAGER_MODULE
674 * @return 0 on success, otherwise a negative error value.
675 * @retval #NFC_ERROR_NONE Successful
676 * @retval #NFC_ERROR_OPERATION_FAILED Operation fail
677 * @see nfc_manager_initialize()
679 int nfc_manager_deinitialize(void);
682 * @brief Registers a callback function for receiving tag discovered notification.
683 * @ingroup CAPI_NETWORK_NFC_MANAGER_MODULE
685 * @param [in] callback The callback function called when a tag is appeared or disappeared
686 * @param [in] user_data The user data to be passed to the callback function
688 * @return 0 on success, otherwise a negative error value.
689 * @retval #NFC_ERROR_NONE Successful
690 * @retval #NFC_ERROR_INVALID_PARAMETER Invalid parameter
691 * @see nfc_manager_unset_tag_discovered_cb()
692 * @see nfc_tag_discovered_cb()
694 int nfc_manager_set_tag_discovered_cb(nfc_tag_discovered_cb callback, void *user_data);
697 * @brief Unregisters the callback function.
698 * @ingroup CAPI_NETWORK_NFC_MANAGER_MODULE
700 * @see nfc_manager_set_tag_discovered_cb()
701 * @see nfc_tag_discovered_cb()
703 void nfc_manager_unset_tag_discovered_cb(void);
706 * @brief Registers a callback function for receiving NDEF Message discovered notification
707 * @ingroup CAPI_NETWORK_NFC_MANAGER_MODULE
709 * @param [in] callback The callback function called when NDEF Message is discovered
710 * @param [in] user_data The user data to be passed to the callback function
712 * @return 0 on success, otherwise a negative error value.
713 * @retval #NFC_ERROR_NONE Successful
714 * @retval #NFC_ERROR_INVALID_PARAMETER Invalid parameter
715 * @see nfc_manager_unset_ndef_discovered_cb()
716 * @see nfc_ndef_discovered_cb()
718 int nfc_manager_set_ndef_discovered_cb(nfc_ndef_discovered_cb callback, void *user_data);
721 * @brief Unregisters the callback function.
722 * @ingroup CAPI_NETWORK_NFC_MANAGER_MODULE
724 * @see nfc_manager_set_ndef_discovered_cb()
725 * @see nfc_ndef_discovered_cb()
727 void nfc_manager_unset_ndef_discovered_cb(void);
730 * @brief Registers a callback function for receiving NFC peer-to-peer target discovered notification.
731 * @ingroup CAPI_NETWORK_NFC_MANAGER_MODULE
733 * @param [in] callback The callback function called when NFC peer-to-peer target is discovered
734 * @param [in] user_data The user data to be passed to the callback function
736 * @return 0 on success, otherwise a negative error value.
737 * @retval #NFC_ERROR_NONE Successful
738 * @retval #NFC_ERROR_INVALID_PARAMETER Invalid parameter
740 * @see nfc_manager_unset_ndef_discovered_cb()
741 * @see nfc_p2p_target_discovered_cb()
743 int nfc_manager_set_p2p_target_discovered_cb(nfc_p2p_target_discovered_cb callback, void *user_data);
746 * @brief Unregisters the callback function.
747 * @ingroup CAPI_NETWORK_NFC_MANAGER_MODULE
749 * @see nfc_manager_set_p2p_target_discovered_cb()
750 * @see nfc_p2p_target_discovered_cb()
752 void nfc_manager_unset_p2p_target_discovered_cb(void);
756 * @brief Registers a callback function for receiving Secure Element (SIM/UICC(Universal Integrated Circuit Card)) event.
757 * @ingroup CAPI_NETWORK_NFC_MANAGER_MODULE
759 * @param [in] callback The callback function called when occurred Secure Element (SIM/UICC(Universal Integrated Circuit Card)) event.
760 * @param [in] user_data The user data to be passed to the callback function
762 * @return 0 on success, otherwise a negative error value.
763 * @retval #NFC_ERROR_NONE Successful
764 * @retval #NFC_ERROR_INVALID_PARAMETER Invalid parameter
766 * @see nfc_se_event_cb()
767 * @see nfc_manager_unset_se_event_cb()
770 int nfc_manager_set_se_event_cb(nfc_se_event_cb callback, void *user_data);
773 * @brief Unregisters the callback function.
774 * @ingroup CAPI_NETWORK_NFC_MANAGER_MODULE
776 * @see nfc_se_event_cb()
777 * @see nfc_manager_set_se_event_cb()
779 void nfc_manager_unset_se_event_cb(void);
782 * @brief Registers a callback function for receiving Secure Element (SIM/UICC(Universal Integrated Circuit Card)) transaction event(#NFC_SE_EVENT_TRANSACTION) data.
783 * @ingroup CAPI_NETWORK_NFC_MANAGER_MODULE
785 * @param [in] callback The callback function called when occurred SE transaction event.
786 * @param [in] user_data The user data to be passed to the callback function
788 * @return 0 on success, otherwise a negative error value.
789 * @retval #NFC_ERROR_NONE Successful
790 * @retval #NFC_ERROR_INVALID_PARAMETER Invalid parameter
792 * @see nfc_se_transaction_event_cb()
793 * @see nfc_manager_unset_se_transaction_event_cb()
795 int nfc_manager_set_se_transaction_event_cb(nfc_se_transaction_event_cb callback, void *user_data);
798 * @brief Unregisters the callback function.
799 * @ingroup CAPI_NETWORK_NFC_MANAGER_MODULE
801 * @see nfc_se_transaction_event_cb()
802 * @see nfc_manager_set_se_transaction_event_cb()
804 void nfc_manager_unset_se_transaction_event_cb(void);
807 * @brief Gets NDEF message cached when the tag is detected or when data received from NFC peer-to-peer target.
808 * @ingroup CAPI_NETWORK_NFC_MANAGER_MODULE
810 * @remarks This function is used to get the ndef message that was read before launched your application.
811 * @param [out] ndef_message The cached NDEF message
813 * @return 0 on success, otherwise a negative error value.
814 * @retval #NFC_ERROR_NONE Successful
815 * @retval #NFC_ERROR_INVALID_PARAMETER Invalid parameter
816 * @retval #NFC_ERROR_INVALID_NDEF_MESSAGE The cached message does not exist
819 int nfc_manager_get_cached_message(nfc_ndef_message_h *ndef_message);
823 * @brief Sets filter of target types.
824 * @ingroup CAPI_NETWORK_NFC_MANAGER_MODULE
825 * @remarks Bit operator OR(|) can be used in the config parameter (like NFC_TAG_FILTER_ISO14443A_ENABLE | NFC_TAG_FILTER_ISO14443B_ENABLE)
826 * or you may choose "NFC_TAG_ALL_ENABLE" enum value to get all result.
827 * It prevent getting tag types from RF level.
828 * If the client api does call this function, default is always NFC_TAG_ALL_ENABLE.
830 * @param [in] filter The filter value with bits operation #nfc_tag_filter_e
832 * @see nfc_manager_get_tag_filter()
833 * @see nfc_tag_discovered_cb()
835 void nfc_manager_set_tag_filter(int filter);
838 * @brief Gets the current filter status.
839 * @ingroup CAPI_NETWORK_NFC_MANAGER_MODULE
841 * @remarks Bit operation OR(|) is used in return data\n
842 * The default value is NFC_TAG_FILTER_ALL_ENABLE
843 * @return The filter which is set #nfc_tag_filter_e
844 * @see nfc_manager_set_tag_filter()
846 int nfc_manager_get_tag_filter(void);
849 * @brief Gets current connected tag.
850 * @ingroup CAPI_NETWORK_NFC_MANAGER_MODULE
852 * @param [out] tag The connected tag
854 * @return 0 on success, otherwise a negative error value.
855 * @retval #NFC_ERROR_NONE Successful
856 * @retval #NFC_ERROR_INVALID_PARAMETER Invalid parameter
857 * @retval #NFC_ERROR_NO_DEVICE There is no connected tag
860 int nfc_manager_get_connected_tag(nfc_tag_h *tag);
863 * @brief Gets current connected p2p target
864 * @ingroup CAPI_NETWORK_NFC_MANAGER_MODULE
866 * @param [out] target The connected target
868 * @return 0 on success, otherwise a negative error value.
869 * @retval #NFC_ERROR_NONE Successful
870 * @retval #NFC_ERROR_INVALID_PARAMETER Invalid parameter
871 * @retval #NFC_ERROR_NO_DEVICE There is no connected target
874 int nfc_manager_get_connected_target(nfc_p2p_target_h *target);
878 * @brief Enable or disable the system handling for tag and target discovered event
879 * @ingroup CAPI_NETWORK_NFC_MANAGER_MODULE
880 * @remarks In default, The system handling is enabled.
882 * @param [in] enable The state of enable
884 * @return 0 on success, otherwise a negative error value.
885 * @retval #NFC_ERROR_NONE Successful
886 * @retval #NFC_ERROR_INVALID_PARAMETER Invalid parameter
888 * @see nfc_manager_is_system_handler_enabled()
890 int nfc_manager_set_system_handler_enable(bool enable);
893 * @brief Gets the state of the system handler
894 * @ingroup CAPI_NETWORK_NFC_MANAGER_MODULE
895 * @remarks In default, The system handling is enabled.
897 * @return true on enabled, otherwise false.
899 * @see nfc_manager_set_system_handler_enable()
901 bool nfc_manager_is_system_handler_enabled(void);
905 * @brief Creates a record with given parameter value.
906 * @ingroup CAPI_NETWORK_NFC_NDEF_RECORD_MODULE
908 * @remarks Every data buffer is deeply copied.\n
909 * Every data is a byte array(binary data).
911 * @param [out] record A handle to record
912 * @param [in] tnf The type name format
913 * @param [in] type The specified type name
914 * @param [in] type_size The byte size of type
915 * @param [in] id The record ID
916 * @param [in] id_size The byte size of ID
917 * @param [in] payload The payload of this record
918 * @param [in] payload_size The byte size of payload
920 * @return 0 on success, otherwise a negative error value.
921 * @retval #NFC_ERROR_NONE Successful
922 * @retval #NFC_ERROR_INVALID_PARAMETER Invalid parameter
923 * @retval #NFC_ERROR_OUT_OF_MEMORY Out of memory
924 * @see nfc_ndef_record_create_text()
925 * @see nfc_ndef_record_create_uri()
926 * @see nfc_ndef_record_create_mime()
927 * @see nfc_ndef_record_destroy()
929 int nfc_ndef_record_create(nfc_ndef_record_h *record, nfc_record_tnf_e tnf, const unsigned char *type, int type_size, const unsigned char *id, int id_size, const unsigned char *payload, int payload_size);
933 * @brief Creates a record with text type payload
934 * @ingroup CAPI_NETWORK_NFC_NDEF_RECORD_MODULE
936 * @remarks This function does not encode the text. @a text will be assumed as that it is already encoded with encode type.\n
937 * The text buffer will be deeply copied.\n
938 * The record is created in this format\n
939 * - TNF : NFC_RECORD_TNF_WELL_KNOWN\n
941 * - payload : encode and header information + language code + text \n
942 * Defined in Record Type Definition Technical Specifications.
944 * @param [out] record A handle to record
945 * @param [in] text The encoded text
946 * @param [in] lang_code The language code string value followed by IANA[RFC 3066] (ex: en-US, ko-KR)
947 * @param [in] encode The encoding type
949 * @return 0 on success, otherwise a negative error value.
950 * @retval #NFC_ERROR_NONE Successful
951 * @retval #NFC_ERROR_INVALID_PARAMETER Invalid parameter
952 * @retval #NFC_ERROR_OUT_OF_MEMORY Out of memory
953 * @see nfc_ndef_record_create()
954 * @see nfc_ndef_record_create_uri()
955 * @see nfc_ndef_record_create_mime()
956 * @see nfc_ndef_record_destroy()
957 * @see nfc_ndef_record_get_text()
958 * @see nfc_ndef_record_get_langcode()
959 * @see nfc_ndef_record_get_encode_type()
961 int nfc_ndef_record_create_text(nfc_ndef_record_h *record, const char *text, const char *lang_code, nfc_encode_type_e encode);
964 * @brief Creates a record with URI type payload
965 * @ingroup CAPI_NETWORK_NFC_NDEF_RECORD_MODULE
967 * @remarks The uri string will be deep copied.\n
968 * The record is created in this format\n
969 * - TNF : NFC_RECORD_TNF_WELL_KNOWN\n
971 * - payload : procotol scheme + uri\n
972 * Defined in Record Type Definition Technical Specifications.
974 * @param [out] record A handle to record
975 * @param [in] protocol_scheme The protocol scheme
976 * @param [in] uri The URI string that will be stored in the payload
978 * @return 0 on success, otherwise a negative error value.
979 * @retval #NFC_ERROR_NONE Successful
980 * @retval #NFC_ERROR_INVALID_PARAMETER Invalid parameter
981 * @retval #NFC_ERROR_OUT_OF_MEMORY Out of memory
982 * @see nfc_ndef_record_create()
983 * @see nfc_ndef_record_create_text()
984 * @see nfc_ndef_record_create_mime()
985 * @see nfc_ndef_record_destroy()
986 * @see nfc_ndef_record_get_uri()
988 int nfc_ndef_record_create_uri(nfc_ndef_record_h* record, const char *uri);
992 * @brief Creates a record with MIME type payload
993 * @ingroup CAPI_NETWORK_NFC_NDEF_RECORD_MODULE
995 * @remarks The data buffer will be deep copied.\n
996 * The data are bytes array(binary data).\n
997 * The mime_type string will deep copied.\n
998 * The record is created in this format\n
999 * - TNF : NFC_RECORD_TNF_MIME_MEDIA\n
1000 * - type : mime type\n
1001 * - payload : data\n
1002 * Defined in Record Type Definition Technical Specifications.
1004 * @param [out] record A handle to record
1005 * @param [in] mime_type The mime type [RFC 2046] (ex. text/plain, image/jpeg )\nThis value is stored in type field
1006 * @param [in] data The pointer of data
1007 * @param [in] data_size The size of data
1009 * @return 0 on success, otherwise a negative error value.
1010 * @retval #NFC_ERROR_NONE Successful
1011 * @retval #NFC_ERROR_INVALID_PARAMETER Invalid parameter
1012 * @retval #NFC_ERROR_OUT_OF_MEMORY Out of memory
1013 * @see nfc_ndef_record_create()
1014 * @see nfc_ndef_record_create_uri()
1015 * @see nfc_ndef_record_create_text()
1016 * @see nfc_ndef_record_destroy()
1017 * @see nfc_ndef_record_get_mime_type()
1019 int nfc_ndef_record_create_mime(nfc_ndef_record_h* record, const char *mime_type, const unsigned char *data, int data_size);
1023 * @brief Destroys the record handle
1024 * @ingroup CAPI_NETWORK_NFC_NDEF_RECORD_MODULE
1026 * @param [in] record The handle to record
1028 * @return 0 on success, otherwise a negative error value.
1029 * @retval #NFC_ERROR_NONE Successful
1030 * @retval #NFC_ERROR_INVALID_PARAMETER Invalid parameter
1031 * @see nfc_ndef_record_create()
1032 * @see nfc_ndef_record_create_text()
1033 * @see nfc_ndef_record_create_uri()
1034 * @see nfc_ndef_record_create_mime()
1036 int nfc_ndef_record_destroy(nfc_ndef_record_h record);
1039 * @brief Sets record ID
1040 * @ingroup CAPI_NETWORK_NFC_NDEF_RECORD_MODULE
1042 * @remarks The ID buffer are deep copied.
1044 * @param [in] record The handle to record
1045 * @param [in] id The record ID
1046 * @param [in] id_size The size of ID in bytes
1047 * @return 0 on success, otherwise a negative error value.
1048 * @retval #NFC_ERROR_NONE Successful
1049 * @retval #NFC_ERROR_INVALID_PARAMETER Invalid parameter
1050 * @see nfc_ndef_record_get_id()
1052 int nfc_ndef_record_set_id(nfc_ndef_record_h record, unsigned char *id, int id_size);
1055 * @brief Gets record ID
1056 * @ingroup CAPI_NETWORK_NFC_NDEF_RECORD_MODULE
1058 * @remarks It may return NULL pointer if the ID is not exist\n
1059 * This function gives you the pointer of ID that is contained by record\n
1060 * Do not free the ID. It will be released when @a record is destroyed by nfc_ndef_record_destroy().
1062 * @param [in] record The handle to record
1063 * @param [out] id The record ID ( do not free )
1064 * @param [out] id_size The size of ID in bytes
1066 * @return 0 on success, otherwise a negative error value.
1067 * @retval #NFC_ERROR_NONE Successful
1068 * @retval #NFC_ERROR_INVALID_PARAMETER Invalid parameter
1069 * @see nfc_ndef_record_set_id()
1071 int nfc_ndef_record_get_id(nfc_ndef_record_h record, unsigned char **id, int *size);
1074 * @brief Gets record payload.
1075 * @ingroup CAPI_NETWORK_NFC_NDEF_RECORD_MODULE
1077 * @remarks This function gives you the pointer of pyaload that is contained by record\n
1078 * Do not free the payload. it will be freed when @a record is destroyed by nfc_ndef_record_destroy().
1080 * @param [in] record The handle to record
1081 * @param [out] payload The payload ( do not free this pointer )
1082 * @param [out] size the size of payload in byte
1084 * @return 0 on success, otherwise a negative error value.
1085 * @retval #NFC_ERROR_NONE Successful
1086 * @retval #NFC_ERROR_INVALID_PARAMETER Invalid parameter
1088 int nfc_ndef_record_get_payload(nfc_ndef_record_h record, unsigned char ** payload, int *size);
1091 * @brief Gets record type.
1092 * @ingroup CAPI_NETWORK_NFC_NDEF_RECORD_MODULE
1094 * @remarks This function gives you the pointer of type that is contained by record.\n
1095 * Do not free the type. it will be freed when the record is freed.
1097 * @param [in] record The handle to record
1098 * @param [out] type The record type ( do not free this pointer )
1099 * @param [out] size The size of type in byte
1101 * @return 0 on success, otherwise a negative error value.
1102 * @retval #NFC_ERROR_NONE Successful
1103 * @retval #NFC_ERROR_INVALID_PARAMETER Invalid parameter
1105 int nfc_ndef_record_get_type(nfc_ndef_record_h record, unsigned char **type, int *size);
1108 * @brief Gets record TNF(Type Name Format) value.
1109 * @ingroup CAPI_NETWORK_NFC_NDEF_RECORD_MODULE
1111 * @param [in] record The handle to record
1112 * @param [out] tnf The TNF(Type Name Format) value
1114 * @return 0 on success, otherwise a negative error value.
1115 * @retval #NFC_ERROR_NONE Successful
1116 * @retval #NFC_ERROR_INVALID_PARAMETER Invalid parameter
1118 int nfc_ndef_record_get_tnf(nfc_ndef_record_h record, nfc_record_tnf_e *tnf);
1121 * @brief Gets text from text record
1122 * @ingroup CAPI_NETWORK_NFC_NDEF_RECORD_MODULE
1124 * @remarks This function returns newly allocated string, this value must be deallocated by caller.\n
1125 * This function is valid only for text type record.\n
1126 * The text type record 's tnf is NFC_RECORD_TNF_WELL_KNOWN and it's type is "T"
1128 * @param [in] record The handle to record
1129 * @param [out] text The text in record payload ( should be freed by caller )
1131 * @return 0 on success, otherwise a negative error value.
1132 * @retval #NFC_ERROR_NONE Successful
1133 * @retval #NFC_ERROR_INVALID_PARAMETER Invalid parameter
1134 * @retval #NFC_ERROR_INVALID_RECORD_TYPE Invalid record type
1135 * @see nfc_ndef_record_create_text()
1137 int nfc_ndef_record_get_text(nfc_ndef_record_h record, char **text);
1140 * @brief Gets language code from text record
1141 * @ingroup CAPI_NETWORK_NFC_NDEF_RECORD_MODULE
1142 * @remarks This function returns newly allocated string, this value must be deallocated by caller.\n
1143 * This function is valid only for text type record.\n
1144 * The text type record 's tnf is NFC_RECORD_TNF_WELL_KNOWN and it's type is "T"
1146 * @param [in] record The handle to record
1147 * @param [out] lang_code lang code ( should be freed by caller )
1149 * @return 0 on success, otherwise a negative error value.
1150 * @retval #NFC_ERROR_NONE Successful
1151 * @retval #NFC_ERROR_INVALID_PARAMETER Invalid parameter
1152 * @retval #NFC_ERROR_INVALID_RECORD_TYPE Invalid record type
1153 * @see nfc_ndef_record_create_text()
1155 int nfc_ndef_record_get_langcode(nfc_ndef_record_h record, char **lang_code);
1158 * @brief Gets encoding type from text record
1159 * @ingroup CAPI_NETWORK_NFC_NDEF_RECORD_MODULE
1161 * @remarks This function is valid only for text type record.\n
1162 * The text type record 's tnf is NFC_RECORD_TNF_WELL_KNOWN and it's type is "T"
1164 * @param [in] record The handle to record
1165 * @param [out] encode encode type #nfc_encode_type_e
1167 * @return 0 on success, otherwise a negative error value.
1168 * @retval #NFC_ERROR_NONE Successful
1169 * @retval #NFC_ERROR_INVALID_PARAMETER Invalid parameter
1170 * @retval #NFC_ERROR_INVALID_RECORD_TYPE Invalid record type
1171 * @see nfc_ndef_record_create_text()
1173 int nfc_ndef_record_get_encode_type(nfc_ndef_record_h record, nfc_encode_type_e *encode);
1176 * @brief Gets URI from uri record
1177 * @ingroup CAPI_NETWORK_NFC_NDEF_RECORD_MODULE
1179 * @remarks The function returns newly allocated string, this value must be deallocated by caller.\n
1180 * This function is valid only for uri type record.
1181 * The uri type record 's tnf is NFC_RECORD_TNF_WELL_KNOWN and it's type is "U"
1183 * @param [in] record The handle to record
1184 * @param [out] uri The uri in record payload ( should be freed by caller )
1186 * @return 0 on success, otherwise a negative error value.
1187 * @retval #NFC_ERROR_NONE Successful
1188 * @retval #NFC_ERROR_INVALID_PARAMETER Invalid parameter
1189 * @retval #NFC_ERROR_INVALID_RECORD_TYPE Invalid record type
1190 * @see nfc_ndef_record_create_uri()
1192 int nfc_ndef_record_get_uri(nfc_ndef_record_h record, char **uri);
1196 * @brief Gets mime type from mime type record
1197 * @ingroup CAPI_NETWORK_NFC_NDEF_RECORD_MODULE
1199 * @remarks The function returns newly allocated string, this value must be deallocated by caller.\n
1200 * This function is valid only for mime type record.\n
1201 * The uri type record 's tnf is NFC_RECORD_TNF_MIME_MEDIA.
1203 * @param [in] record The handle to record
1204 * @param [out] mime_type The mime type in record payload ( should be freed by caller )
1206 * @return 0 on success, otherwise a negative error value.
1207 * @retval #NFC_ERROR_NONE Successful
1208 * @retval #NFC_ERROR_INVALID_PARAMETER Invalid parameter
1209 * @retval #NFC_ERROR_INVALID_RECORD_TYPE Invalid record type
1210 * @see nfc_ndef_record_create_mime()
1212 int nfc_ndef_record_get_mime_type(nfc_ndef_record_h record, char **mime_type);
1216 * @brief Creates NDEF message handle
1217 * @ingroup CAPI_NETWORK_NFC_NDEF_MESSAGE_MODULE
1219 * @param [out] ndef_message A handle to NDEF message
1221 * @return 0 on success, otherwise a negative error value.
1222 * @retval #NFC_ERROR_NONE Successful
1223 * @retval #NFC_ERROR_INVALID_PARAMETER Invalid parameter
1224 * @retval #NFC_ERROR_OUT_OF_MEMORY Out of memory
1225 * @see nfc_ndef_message_create_from_rawdata()
1226 * @see nfc_ndef_message_destroy()
1229 int nfc_ndef_message_create(nfc_ndef_message_h *ndef_message);
1232 * @brief Creates NDEF message handle from raw serial bytes.
1233 * @ingroup CAPI_NETWORK_NFC_NDEF_MESSAGE_MODULE
1235 * @remarks It consumes the bytes array until get the ME(Message End) flag*. It returns error if the bytes array does not have ME flag.\n
1236 * *The ME flag is a 1-bit field that when set indicates the end of an NDEF message.
1238 * @param [out] ndef_message The handle to NDEF message
1239 * @param [in] rawdata The NDEF message in form of bytes array
1240 * @param [in] rawdata_size The size of bytes array
1242 * @return 0 on success, otherwise a negative error value.
1243 * @retval #NFC_ERROR_NONE Successful
1244 * @retval #NFC_ERROR_INVALID_PARAMETER Invalid parameter
1245 * @retval #NFC_ERROR_OUT_OF_MEMORY Out of memory
1246 * @see nfc_ndef_message_create()
1247 * @see nfc_ndef_message_destroy()
1248 * @see nfc_ndef_message_get_rawdata()
1251 int nfc_ndef_message_create_from_rawdata(nfc_ndef_message_h *ndef_message, const unsigned char *rawdata, int rawdata_size);
1254 * @brief Destroys NDEF message handle
1255 * @ingroup CAPI_NETWORK_NFC_NDEF_MESSAGE_MODULE
1257 * @remarks This function will free all these memory including record handles.
1259 * @param [in] ndef_message The handle to NDEF message to destroy
1261 * @return 0 on success, otherwise a negative error value.
1262 * @retval #NFC_ERROR_NONE Successful
1263 * @retval #NFC_ERROR_INVALID_PARAMETER Invalid parameter
1264 * @see nfc_ndef_message_create()
1265 * @see nfc_ndef_message_create_from_rawdata()
1267 int nfc_ndef_message_destroy(nfc_ndef_message_h ndef_message);
1270 * @brief Gets the number of record in NDEF message
1271 * @ingroup CAPI_NETWORK_NFC_NDEF_MESSAGE_MODULE
1273 * @param [in] ndef_message The handle to NDEF message
1274 * @param [out] count The number of record
1276 * @return 0 on success, otherwise a negative error value.
1277 * @retval #NFC_ERROR_NONE Successful
1278 * @retval #NFC_ERROR_INVALID_PARAMETER Invalid parameter
1281 int nfc_ndef_message_get_record_count(nfc_ndef_message_h ndef_message, int *count);
1284 * @brief Gets serial bytes array of NDEF message.
1285 * @ingroup CAPI_NETWORK_NFC_NDEF_MESSAGE_MODULE
1287 * @remarks It gets copy of the rawdata bytes from NDEF message. @a rawdata must be released with free() by you.
1289 * @param [in] ndef_message The handle to NDEF message
1290 * @param [out] rawdata The bytes array of rawdata
1291 * @param [out] rawdata_size The size of rawdata in byte
1293 * @return 0 on success, otherwise a negative error value.
1294 * @retval #NFC_ERROR_NONE Successful
1295 * @retval #NFC_ERROR_INVALID_PARAMETER Invalid parameter
1296 * @retval #NFC_ERROR_OUT_OF_MEMORY Out of memory
1297 * @retval #NFC_ERROR_INVALID_NDEF_MESSAGE Invalid NDEF message
1299 * @see nfc_ndef_message_create_from_rawdata()
1301 int nfc_ndef_message_get_rawdata(nfc_ndef_message_h ndef_message, unsigned char **rawdata, int *rawdata_size);
1304 * @brief Appends a record into NDEF message
1305 * @ingroup CAPI_NETWORK_NFC_NDEF_MESSAGE_MODULE
1307 * @remarks Appended record is handled by frameworks. The record is released by frameworks when message is released.
1309 * @param [in] ndef_message The handle to NDEF message
1310 * @param [in] record The record that will be appended into NDEF message
1312 * @return 0 on success, otherwise a negative error value.
1313 * @retval #NFC_ERROR_NONE Successful
1314 * @retval #NFC_ERROR_INVALID_PARAMETER Invalid parameter
1315 * @see nfc_ndef_message_insert_record()
1316 * @see nfc_ndef_message_remove_record()
1318 int nfc_ndef_message_append_record(nfc_ndef_message_h ndef_message, nfc_ndef_record_h record);
1321 * @brief Inserts a record at index into NDEF message
1322 * @ingroup CAPI_NETWORK_NFC_NDEF_MESSAGE_MODULE
1324 * @remarks Appended record is handled by frameworks. The record is released by frameworks when message is released.\n
1325 * The index value should not bigger than nfc_ndef_message_get_record_count()
1327 * @param [in] ndef_message The handle to NDEF message
1328 * @param [in] index The index of record ( starts from 0 )
1329 * @param [in] record The record that will be appended into NDEF message
1331 * @return 0 on success, otherwise a negative error value.
1332 * @retval #NFC_ERROR_NONE Successful
1333 * @retval #NFC_ERROR_INVALID_PARAMETER Invalid parameter
1334 * @retval #NFC_ERROR_INVALID_NDEF_MESSAGE Invalid NDEF message
1335 * @see nfc_ndef_message_append_record()
1336 * @see nfc_ndef_message_remove_record()
1338 int nfc_ndef_message_insert_record(nfc_ndef_message_h ndef_message, int index, nfc_ndef_record_h record);
1341 * @brief Removes the record that indicated by index number and this deleted record will be freed.
1342 * @ingroup CAPI_NETWORK_NFC_NDEF_MESSAGE_MODULE
1344 * @param [in] ndef_message The handle to NDEF message
1345 * @param [in] index The index of record ( starts from 0 )
1347 * @return 0 on success, otherwise a negative error value.
1348 * @retval #NFC_ERROR_NONE Successful
1349 * @retval #NFC_ERROR_INVALID_PARAMETER Invalid parameter
1350 * @retval #NFC_ERROR_INVALID_NDEF_MESSAGE Invalid NDEF message
1351 * @see nfc_ndef_message_append_record()
1352 * @see nfc_ndef_message_insert_record()
1354 int nfc_ndef_message_remove_record(nfc_ndef_message_h ndef_message, int index);
1357 * @brief Gets record by index.
1358 * @ingroup CAPI_NETWORK_NFC_NDEF_MESSAGE_MODULE
1360 * @remarks This function just return the pointer of record. if you change the record value it directly affects the NDEF message
1362 * @param [in] ndef_message The handle to NDEF message
1363 * @param [in] index The index of record ( starts from 0 )
1364 * @param [out] record The handle to record
1366 * @return 0 on success, otherwise a negative error value.
1367 * @retval #NFC_ERROR_NONE Successful
1368 * @retval #NFC_ERROR_INVALID_PARAMETER Invalid parameter
1371 int nfc_ndef_message_get_record(nfc_ndef_message_h ndef_message, int index, nfc_ndef_record_h *record);
1374 * @brief Gets the type of NFC tag
1375 * @ingroup CAPI_NETWORK_NFC_TAG_MODULE
1377 * @param [in] tag The handle to NFC tag
1378 * @param [out] type The type of NFC tag
1380 * @return 0 on success, otherwise a negative error value.
1381 * @retval #NFC_ERROR_NONE Successful
1382 * @retval #NFC_ERROR_INVALID_PARAMETER Invalid parameter
1385 int nfc_tag_get_type(nfc_tag_h tag, nfc_tag_type_e *type);
1388 * @brief Checks whether the given NFC tag supports NDEF messages.
1389 * @ingroup CAPI_NETWORK_NFC_TAG_MODULE
1391 * @param [in] tag The handle to NFC tag
1392 * @param [out] is_supported @c true when NFC tag supports NDEF messages, otherwise @c false
1394 * @return 0 on success, otherwise a negative error value.
1395 * @retval #NFC_ERROR_NONE Successful
1396 * @retval #NFC_ERROR_INVALID_PARAMETER Invalid parameter
1398 * @see nfc_tag_read_ndef()
1400 int nfc_tag_is_support_ndef(nfc_tag_h tag, bool *is_supported);
1403 * @brief Gets the maximum NDEF message size that can be stored in NFC tag.
1404 * @ingroup CAPI_NETWORK_NFC_TAG_MODULE
1406 * @remarks This max size indicates the maximum size of NDEF message that can be stored in this detected tag.
1408 * @param [in] tag The handle to NFC tag
1409 * @param [out] maximum_ndef_bytes_size The maximum bytes size of NDEF message that can be stored in this detected tag.
1411 * @return 0 on success, otherwise a negative error value.
1412 * @retval #NFC_ERROR_NONE Successful
1413 * @retval #NFC_ERROR_INVALID_PARAMETER Invalid parameter
1416 int nfc_tag_get_maximum_ndef_size(nfc_tag_h tag, unsigned int *maximum_ndef_bytes_size);
1419 * @brief Gets size of NDEF message that stored in the tag
1420 * @ingroup CAPI_NETWORK_NFC_TAG_MODULE
1422 * @param [in] tag The handle to NFC tag
1423 * @param [out] ndef_bytes_size The NDEF message bytes size that stored in the tag
1425 * @return 0 on success, otherwise a negative error value.
1426 * @retval #NFC_ERROR_NONE Successful
1427 * @retval #NFC_ERROR_INVALID_PARAMETER Invalid parameter
1430 int nfc_tag_get_ndef_size(nfc_tag_h tag, unsigned int *ndef_bytes_size);
1434 * @brief Retrieves all tag information
1435 * @ingroup CAPI_NETWORK_NFC_TAG_MODULE
1437 * @param[in] tag The handle to NFC tag
1438 * @param[in] callback The callback function to invoke
1439 * @param[in] user_data The user data to be passed to the callback function
1441 * @return 0 on success, otherwise a negative error value.
1442 * @retval #NFC_ERROR_NONE Successful
1443 * @retval #NFC_ERROR_INVALID_PARAMETER Invalid parameter
1446 int nfc_tag_foreach_information(nfc_tag_h tag, nfc_tag_information_cb callback, void *user_data);
1450 * @brief Transceives the data of the raw format card.
1451 * @details This function is the only way to access the raw format card (not formated),
1452 each tag type requires own command to access tags. \n
1453 This function provides the low level access of tag operation and you require the knowlege of each tag technology.
1454 * @ingroup CAPI_NETWORK_NFC_TAG_MODULE
1456 * @param [in] tag The handle to NFC tag
1457 * @param [in] buffer The binary data for parameter or additional commands
1458 * @param [in] buffer_size The size of buffer in bytes
1459 * @param [in] callback The callback function to invoke after this function has completed\n It can be null if a notification is not required
1460 * @param [in] user_data The user data to be passed to the callback funcation
1462 * @return 0 on success, otherwise a negative error value.
1463 * @retval #NFC_ERROR_NONE Successful
1464 * @retval #NFC_ERROR_OUT_OF_MEMORY Out of memory
1465 * @retval #NFC_ERROR_INVALID_PARAMETER Invalid parameter
1466 * @retval #NFC_ERROR_DEVICE_BUSY Device is too busy to handle your request
1467 * @retval #NFC_ERROR_OPERATION_FAILED Operation failed
1468 * @retval #NFC_ERROR_TIMED_OUT Timeout is reached while communicating with tag
1469 * @retval #NFC_ERROR_NOT_ACTIVATED NFC is not activated
1471 * @post It invokes nfc_tag_transceive_completed_cb() when it has completed to t
1472 * @see nfc_tag_read_ndef()
1473 * @see nfc_tag_is_support_ndef()
1475 int nfc_tag_transceive(nfc_tag_h tag, unsigned char *buffer, int buffer_size, nfc_tag_transceive_completed_cb callback, void *user_data);
1478 * @brief Reads NDEF formatted data from NFC tag.
1479 * @ingroup CAPI_NETWORK_NFC_TAG_MODULE
1481 * @param [in] tag The handle to NFC tag
1482 * @param [in] callback The callback function to invoke after this function has completed\n It can be null if notification is not required
1483 * @param [in] user_data The user data to be passed to the callback funcation
1485 * @return 0 on success, otherwise a negative error value.
1486 * @retval #NFC_ERROR_NONE Successful
1487 * @retval #NFC_ERROR_OUT_OF_MEMORY Out of memory
1488 * @retval #NFC_ERROR_INVALID_PARAMETER Invalid parameter
1489 * @retval #NFC_ERROR_DEVICE_BUSY Device is too busy to handle your request
1490 * @retval #NFC_ERROR_OPERATION_FAILED Operation failed
1491 * @retval #NFC_ERROR_TIMED_OUT Timeout is reached while communicating with tag
1492 * @retval #NFC_ERROR_NOT_ACTIVATED NFC is not activated
1493 * @retval #NFC_ERROR_NOT_NDEF_FORMAT Not ndef format tag
1495 * @post It invokes nfc_tag_read_completed_cb() when it has completed to read NDEF formatted data.
1497 * @see nfc_tag_transceive()
1498 * @see nfc_tag_is_support_ndef()
1499 * @see nfc_tag_write_ndef()
1501 int nfc_tag_read_ndef(nfc_tag_h tag, nfc_tag_read_completed_cb callback, void *user_data);
1504 * @brief Writes NDEF formatted data.
1505 * @ingroup CAPI_NETWORK_NFC_TAG_MODULE
1507 * @param [in] tag The handle to NFC tag
1508 * @param [in] msg The message will be write to the tag
1509 * @param [in] callback The callback function to invoke after this function has completed\n It can be null if notification is not required
1510 * @param [in] user_dataa The user data to be passed to the callback funcation
1512 * @return 0 on success, otherwise a negative error value.
1513 * @retval #NFC_ERROR_NONE Successful
1514 * @retval #NFC_ERROR_OUT_OF_MEMORY Out of memory
1515 * @retval #NFC_ERROR_INVALID_PARAMETER Invalid parameter
1517 * @retval #NFC_ERROR_DEVICE_BUSY Device is too busy to handle your request
1518 * @retval #NFC_ERROR_OPERATION_FAILED Operation failed
1519 * @retval #NFC_ERROR_TIMED_OUT Timeout is reached while communicating with tag
1520 * @retval #NFC_ERROR_NOT_ACTIVATED NFC is not activated
1521 * @retval #NFC_ERROR_NOT_NDEF_FORMAT Not ndef format tag
1523 * @post It invokes nfc_tag_write_completed_cb() when it has completed to write NDEF data.
1524 * @see nfc_tag_is_support_ndef()
1525 * @see nfc_tag_read_ndef()
1527 int nfc_tag_write_ndef(nfc_tag_h tag, nfc_ndef_message_h msg, nfc_tag_write_completed_cb callback, void *user_data);
1530 * @brief Formats the detected tag that can store NDEF message.
1531 * @details Some tags are required authentication. If the detected target doesn't need authentication, @a key can be NULL.
1532 * @ingroup CAPI_NETWORK_NFC_TAG_MODULE
1534 * @param [in] tag The handle to NFC tag
1535 * @param [in] key The key value that may need to format the tag
1536 * @param [in] key_size The size of key in byte
1537 * @param [in] callback The callback function to invoke after this function has completed\n It can be null if notification is not required
1538 * @param [in] user_data The user data to be passed to the callback funcation
1540 * @return 0 on success, otherwise a negative error value.
1541 * @retval #NFC_ERROR_NONE Successful
1542 * @retval #NFC_ERROR_OUT_OF_MEMORY Out of memory
1543 * @retval #NFC_ERROR_INVALID_PARAMETER Invalid parameter
1544 * @retval #NFC_ERROR_DEVICE_BUSY Device is too busy to handle your request
1545 * @retval #NFC_ERROR_OPERATION_FAILED Operation failed
1546 * @retval #NFC_ERROR_TIMED_OUT Timeout is reached while communicating with tag
1547 * @retval #NFC_ERROR_NOT_ACTIVATED NFC is not activated
1548 * @retval #NFC_ERROR_NOT_NDEF_FORMAT Not ndef format tag
1550 * @post It invokes nfc_tag_format_completed_cb() when it has completed to format the NFC tag.
1552 * @see nfc_tag_is_support_ndef()
1554 int nfc_tag_format_ndef(nfc_tag_h tag, unsigned char *key, int key_size, nfc_tag_format_completed_cb callback, void *user_data);
1557 * @ingroup CAPI_NETWORK_NFC_TAG_MIFARE_MODULE
1558 * @brief Authenticates a sector with key A.
1559 * @remarks I/O operations(read / write / increment / decrement / transfer / restore) will be available after successful authentication.\n
1560 * This function is only available for MIFARE classic.\n
1562 * MIFARE CLASSIC MINI \n
1563 * => 0 ~ 4 : 5 sectors having 4 block each with block size of 16 bytes \n
1565 * MIFARE CLASSIC 1K \n
1566 * => 0 ~ 15 : 16 sectors having 4 block each with block size of 16 bytes \n
1568 * MIFARE CLASSIC 4K \n
1569 * => 0 ~ 31 : 32 sectors having 4 block each with block size of 16 bytes \n
1570 * => 32 ~ 39 : 8 sectors having 16 block each with block size of 16 bytes
1572 * @param[in] tag The handle to NFC tag
1573 * @param[in] sector_index The index of sector to authenticate with key A, starting from 0
1574 * @param[in] auth_key 6-byte authentication key
1575 * @param[in] callback The callback function to invoke after this function has completed\n It can be null if notification is not required
1576 * @param[in] user_data The user data to be passed to the callback funcation
1578 * @return 0 on success, otherwise a negative error value.
1579 * @retval #NFC_ERROR_NONE Successful
1580 * @retval #NFC_ERROR_OUT_OF_MEMORY Out of memory
1581 * @retval #NFC_ERROR_INVALID_PARAMETER Invalid parameter
1582 * @retval #NFC_ERROR_DEVICE_BUSY Device is too busy to handle your request
1583 * @retval #NFC_ERROR_OPERATION_FAILED Operation failed
1584 * @retval #NFC_ERROR_TIMED_OUT Timeout is reached while communicating with tag
1585 * @retval #NFC_ERROR_NOT_ACTIVATED NFC is not activated
1587 * @post It invokes nfc_mifare_authenticate_with_keyA_completed_cb() when it has completed to authenticate the given sector with key A.
1588 * @see nfc_mifare_authenticate_with_keyB()
1589 * @see nfc_mifare_read_block()
1590 * @see nfc_mifare_read_page()
1591 * @see nfc_mifare_write_block()
1592 * @see nfc_mifare_write_page()
1593 * @see nfc_mifare_increment()
1594 * @see nfc_mifare_decrement()
1596 int nfc_mifare_authenticate_with_keyA(nfc_tag_h tag, int sector_index, unsigned char *auth_key, nfc_mifare_authenticate_with_keyA_completed_cb callback, void *user_data);
1600 * @ingroup CAPI_NETWORK_NFC_TAG_MIFARE_MODULE
1601 * @brief Authenticates a sector with key B.
1602 * @remarks I/O operations(read / write / increment / decrement / transfer / restore) will be available after successful authentication.\n
1603 * This function is only available for MIFARE classic.\n
1605 * MIFARE CLASSIC MINI\n
1606 * => 0 ~ 4 : 5 sector and 4 block with 16 bytes\n
1608 * MIFARE CLASSIC 1K \n
1609 * => 0 ~ 15 : 16 sector and 4 block with 16 bytes\n
1611 * MIFARE CLASSIC 4K\n
1612 * => 0 ~ 31 : 32 sector and 4 block with 16 bytes \n
1613 * => 32 ~ 39 : 8 sector and 16 block with 16 bytes
1615 * @param [in] tag The handle to NFC tag
1616 * @param [in] sector_index The index of sector to authenticate with key B, starting from 0
1617 * @param [in] auth_key 6-byte authentication key
1618 * @param [in] callback The callback function to invoke after this function has completed\n It can be null if notification is not required
1619 * @param [in] user_data The user data to be passed to the callback funcation
1621 * @return 0 on success, otherwise a negative error value.
1622 * @retval #NFC_ERROR_NONE Successful
1623 * @retval #NFC_ERROR_OUT_OF_MEMORY Out of memory
1624 * @retval #NFC_ERROR_INVALID_PARAMETER Invalid parameter
1625 * @retval #NFC_ERROR_DEVICE_BUSY Device is too busy to handle your request
1626 * @retval #NFC_ERROR_OPERATION_FAILED Operation failed
1627 * @retval #NFC_ERROR_TIMED_OUT Timeout is reached while communicating with tag
1628 * @retval #NFC_ERROR_NOT_ACTIVATED NFC is not activated
1630 * @post It invokes nfc_mifare_authenticate_with_keyB_completed_cb() when it has completed to authenticate the given sector with key B.
1631 * @see nfc_mifare_authenticate_with_keyA()
1632 * @see nfc_mifare_read_block()
1633 * @see nfc_mifare_read_page()
1634 * @see nfc_mifare_write_block()
1635 * @see nfc_mifare_write_page()
1636 * @see nfc_mifare_increment()
1637 * @see nfc_mifare_decrement()
1639 int nfc_mifare_authenticate_with_keyB(nfc_tag_h tag, int sector_index, unsigned char *auth_key, nfc_mifare_authenticate_with_keyB_completed_cb callback, void *user_data);
1643 * @ingroup CAPI_NETWORK_NFC_TAG_MIFARE_MODULE
1644 * @brief Reads a 16-byte block.
1645 * @remarks This function is only available for MIFARE classic.
1647 * @param [in] tag The handle to NFC tag
1648 * @param [in] block_index The block or starting page number
1649 * @param [in] callback The callback function to invoke after this function has completed\n It can be null if notification is not required
1650 * @param [in] user_data The user data to be passed to the callback funcation
1652 * @return 0 on success, otherwise a negative error value.
1653 * @retval #NFC_ERROR_NONE Successful
1654 * @retval #NFC_ERROR_OUT_OF_MEMORY Out of memory
1655 * @retval #NFC_ERROR_INVALID_PARAMETER Invalid parameter
1656 * @retval #NFC_ERROR_DEVICE_BUSY Device is too busy to handle your request
1657 * @retval #NFC_ERROR_OPERATION_FAILED Operation failed
1658 * @retval #NFC_ERROR_TIMED_OUT Timeout is reached while communicating with tag
1659 * @retval #NFC_ERROR_NOT_ACTIVATED NFC is not activated
1661 * @post It invokes nfc_mifare_read_block_completed_cb() when it has completed to read a block.
1662 * @see nfc_mifare_read_page()
1663 * @see nfc_mifare_write_block()
1665 int nfc_mifare_read_block(nfc_tag_h tag, int block_index, nfc_mifare_read_block_completed_cb callback, void *user_data);
1668 * @ingroup CAPI_NETWORK_NFC_TAG_MIFARE_MODULE
1669 * @brief Reads 4 pages(16 bytes).
1670 * @remarks This function is only available for MIFARE Ultra light.\n
1671 * The MIFARE Ultralight protocol always reads 4 pages at a time, to reduce the number of commands required to read an entire tag.
1673 * @param [in] tag The handle to NFC tag
1674 * @param [in] page_index The index of page to read, starting from 0
1675 * @param [in] callback The callback function to invoke after this function has completed\n It can be null if notification is not required
1676 * @param [in] user_data The user data to be passed to the callback funcation
1679 * @return 0 on success, otherwise a negative error value.
1680 * @retval #NFC_ERROR_NONE Successful
1681 * @retval #NFC_ERROR_OUT_OF_MEMORY Out of memory
1682 * @retval #NFC_ERROR_INVALID_PARAMETER Invalid parameter
1683 * @retval #NFC_ERROR_DEVICE_BUSY Device is too busy to handle your request
1684 * @retval #NFC_ERROR_OPERATION_FAILED Operation failed
1685 * @retval #NFC_ERROR_TIMED_OUT Timeout is reached while communicating with tag
1686 * @retval #NFC_ERROR_NOT_ACTIVATED NFC is not activated
1688 * @post It invokes nfc_mifare_read_page_completed_cb() when it has completed to read a page.
1689 * @see nfc_mifare_read_block()
1690 * @see nfc_mifare_write_page()
1692 int nfc_mifare_read_page(nfc_tag_h tag, int page_index, nfc_mifare_read_page_completed_cb callback, void *user_data);
1695 * @ingroup CAPI_NETWORK_NFC_TAG_MIFARE_MODULE
1696 * @brief Writes block (16 byte) of data to the tag at a given block index.
1697 * @remarks This function is only available for MIFARE classic.
1699 * @param [in] tag The handle to NFC tag
1700 * @param [in] block_index The index of block to read, starting from 0
1701 * @param [in] buffer 16 bytes of data to write
1702 * @param [in] buffer_size The size of buffer in bytes
1703 * @param [in] callback The callback function to invoke after this function has completed\n It can be null if notification is not required
1704 * @param [in] user_data The user data to be passed to the callback funcation
1706 * @return 0 on success, otherwise a negative error value.
1707 * @retval #NFC_ERROR_NONE Successful
1708 * @retval #NFC_ERROR_OUT_OF_MEMORY Out of memory
1709 * @retval #NFC_ERROR_INVALID_PARAMETER Invalid parameter
1710 * @retval #NFC_ERROR_NOT_INITIALIZED Not initialized
1711 * @retval #NFC_ERROR_DEVICE_BUSY Device is too busy to handle your request
1712 * @retval #NFC_ERROR_OPERATION_FAILED Operation failed
1713 * @retval #NFC_ERROR_TIMED_OUT Timeout is reached while communicating with tag
1714 * @retval #NFC_ERROR_NOT_ACTIVATED NFC is not activated
1716 * @post It invokes nfc_mifare_write_block_completed_cb() when it hase completed to write a block.
1718 * @see nfc_mifare_write_page()
1719 * @see nfc_mifare_read_block()
1721 int nfc_mifare_write_block(nfc_tag_h tag, int block_index, unsigned char *buffer, int buffer_size, nfc_mifare_write_block_completed_cb callback, void *user_data);
1724 * @ingroup CAPI_NETWORK_NFC_TAG_MIFARE_MODULE
1725 * @brief Writes a page (4 bytes) of data to the tag at a given page index
1726 * @remarks This function is only available for MIFARE Ultra light
1728 * @param [in] tag The handle to NFC tag
1729 * @param [in] page_index The index of page to write, starting from 0
1730 * @param [in] buffer 4 bytes of data to write
1731 * @param [in] buffer_size The size of buffer in bytes
1732 * @param [in] callback The callback function to invoke after this function has completed\n It can be null if notification is not required
1733 * @param [in] user_data The user data to be passed to the callback funcation
1735 * @return 0 on success, otherwise a negative error value.
1736 * @retval #NFC_ERROR_NONE Successful
1737 * @retval #NFC_ERROR_OUT_OF_MEMORY Out of memory
1738 * @retval #NFC_ERROR_INVALID_PARAMETER Invalid parameter
1739 * @retval #NFC_ERROR_DEVICE_BUSY Device is too busy to handle your request
1740 * @retval #NFC_ERROR_OPERATION_FAILED Operation failed
1741 * @retval #NFC_ERROR_TIMED_OUT Timeout is reached while communicating with tag
1742 * @retval #NFC_ERROR_NOT_ACTIVATED NFC is not activated
1744 * @post It invokes nfc_mifare_write_page_completed_cb() when it has completed to write a page.
1746 * @see nfc_mifare_write_block()
1747 * @see nfc_mifare_read_page()
1749 int nfc_mifare_write_page(nfc_tag_h tag, int page_index, unsigned char *buffer, int buffer_size, nfc_mifare_write_page_completed_cb callback, void *user_data);
1752 * @ingroup CAPI_NETWORK_NFC_TAG_MIFARE_MODULE
1753 * @brief Increases a value block, storing the result in the temporary block on the tag.
1754 * @remarks This function is only available for MIFARE classic
1756 * @param [in] tag The handle to NFC tag
1757 * @param [in] block_index The index of block to increase, starting from 0
1758 * @param [in] value Non-negative to increment by
1759 * @param [in] callback The callback function to invoke after this function has completed\n It can be null if notification is not required
1760 * @param [in] user_data The user data to be passed to the callback function
1762 * @return 0 on success, otherwise a negative error value.
1763 * @retval #NFC_ERROR_NONE Successful
1764 * @retval #NFC_ERROR_OUT_OF_MEMORY Out of memory
1765 * @retval #NFC_ERROR_INVALID_PARAMETER Invalid parameter
1766 * @retval #NFC_ERROR_NOT_INITIALIZED Not initialized
1767 * @retval #NFC_ERROR_DEVICE_BUSY Device is too busy to handle your request
1768 * @retval #NFC_ERROR_OPERATION_FAILED Operation failed
1769 * @retval #NFC_ERROR_TIMED_OUT Timeout is reached while communicating with tag
1770 * @retval #NFC_ERROR_NOT_ACTIVATED NFC is not activated
1772 * @see nfc_mifare_decrement()
1773 * @see nfc_mifare_write_block()
1775 int nfc_mifare_increment(nfc_tag_h tag, int block_index, int value, nfc_mifare_increment_completed_cb callback, void *user_data);
1778 * @ingroup CAPI_NETWORK_NFC_TAG_MIFARE_MODULE
1779 * @brief Decreases a value block, storing the result in the temporary block on the tag.
1780 * @remarks This function is only available for MIFARE classic
1782 * @param [in] tag The handle to NFC tag
1783 * @param [in] block_index The index of block to decrease, starting from 0
1784 * @param [in] value non-negative to decrement by
1785 * @param [in] callback The callback function to invoke after this function has completed\n It can be null if notification is not required
1786 * @param [in] user_data The user data to be passed to the callback funcation
1788 * @return 0 on success, otherwise a negative error value.
1789 * @retval #NFC_ERROR_NONE Successful
1790 * @retval #NFC_ERROR_OUT_OF_MEMORY Out of memory
1791 * @retval #NFC_ERROR_INVALID_PARAMETER Invalid parameter
1792 * @retval #NFC_ERROR_DEVICE_BUSY Device is too busy to handle your request
1793 * @retval #NFC_ERROR_OPERATION_FAILED Operation failed
1794 * @retval #NFC_ERROR_TIMED_OUT Timeout is reached while communicating with tag
1795 * @retval #NFC_ERROR_NOT_ACTIVATED NFC is not activated
1797 * @see nfc_mifare_increment()
1798 * @see nfc_mifare_write_block()
1800 int nfc_mifare_decrement(nfc_tag_h tag, int block_index, int value, nfc_mifare_decrement_completed_cb callback, void *user_data);
1803 * @ingroup CAPI_NETWORK_NFC_TAG_MIFARE_MODULE
1804 * @brief Copys from the temporary block to the specified block.
1805 * @remarks This function is only available for MIFARE classic
1807 * @param [in] tag The handle to NFC tag
1808 * @param [in] block_index The index of block to copy to, starting from 0
1809 * @param [in] callback The callback function to invoke after this function has completed\n It can be null if notification is not required
1810 * @param [in] user_data The user data to be passed to the callback funcation
1812 * @return 0 on success, otherwise a negative error value.
1813 * @retval #NFC_ERROR_NONE Successful
1814 * @retval #NFC_ERROR_OUT_OF_MEMORY Out of memory
1815 * @retval #NFC_ERROR_INVALID_PARAMETER Invalid parameter
1816 * @retval #NFC_ERROR_DEVICE_BUSY Device is too busy to handle your request
1817 * @retval #NFC_ERROR_OPERATION_FAILED Operation failed
1818 * @retval #NFC_ERROR_TIMED_OUT Timeout is reached while communicating with tag
1819 * @retval #NFC_ERROR_NOT_ACTIVATED NFC is not activated
1821 * @see nfc_mifare_restore()
1823 int nfc_mifare_transfer(nfc_tag_h tag, int block_index, nfc_mifare_transfer_completed_cb callback, void *user_data);
1826 * @ingroup CAPI_NETWORK_NFC_TAG_MIFARE_MODULE
1827 * @brief Copys from a value block to the temporary block.
1828 * @remarks This function is only available for MIFARE classic
1830 * @param [in] tag The handle to NFC tag
1831 * @param [in] block_index The index of block to copy from, starting from 0
1832 * @param [in] callback The callback function to invoke after this function has completed\n It can be null if notification is not required
1833 * @param [in] user_data The user data to be passed to the callback funcation
1835 * @return 0 on success, otherwise a negative error value.
1836 * @retval #NFC_ERROR_NONE Successful
1837 * @retval #NFC_ERROR_OUT_OF_MEMORY Out of memory
1838 * @retval #NFC_ERROR_INVALID_PARAMETER Invalid parameter
1839 * @retval #NFC_ERROR_DEVICE_BUSY Device is too busy to handle your request
1840 * @retval #NFC_ERROR_OPERATION_FAILED Operation failed
1841 * @retval #NFC_ERROR_TIMED_OUT Timeout is reached while communicating with tag
1842 * @retval #NFC_ERROR_NOT_ACTIVATED NFC is not activated
1844 * @see nfc_mifare_transfer()
1846 int nfc_mifare_restore(nfc_tag_h tag, int block_index, nfc_mifare_restore_completed_cb callback, void *user_data);
1850 * @brief Registers a callback function for receiving data from NFC peer-to-peer target.
1851 * @ingroup CAPI_NETWORK_NFC_P2P_MODULE
1853 * @param [in] target The handle to peer target
1854 * @param [in] callback The callback function to invoke when an NDEF Message is discovered
1855 * @param [in] user_data The user data to be passed to the callback function
1857 * @return 0 on success, otherwise a negative error value.
1858 * @retval #NFC_ERROR_NONE Successful
1859 * @retval #NFC_ERROR_INVALID_PARAMETER Invalid parameter
1861 * @see nfc_p2p_unset_data_received_cb()
1862 * @see nfc_p2p_data_recived_cb()
1863 * @see nfc_p2p_target_discovered_cb()
1865 int nfc_p2p_set_data_received_cb(nfc_p2p_target_h target, nfc_p2p_data_recived_cb callback, void *user_data);
1868 * @brief Unregisters the callback function.
1869 * @ingroup CAPI_NETWORK_NFC_P2P_MODULE
1871 * @param [in] target The handle to peer target
1873 * @return 0 on success, otherwise a negative error value.
1874 * @retval #NFC_ERROR_NONE Successful
1875 * @retval #NFC_ERROR_INVALID_PARAMETER Invalid parameter
1877 * @see nfc_p2p_set_data_received_cb()
1878 * @see nfc_p2p_data_recived_cb()
1879 * @see nfc_p2p_target_discovered_cb()
1881 int nfc_p2p_unset_data_received_cb(nfc_p2p_target_h target);
1884 * @brief Sends data to NFC peer-to-peer target
1885 * @ingroup CAPI_NETWORK_NFC_P2P_MODULE
1887 * @param [in] tag The handle to NFC tag
1888 * @param [in] message The message to send
1889 * @param [in] callback The callback function to invoke after this function has completed\n It can be null if notification is not required
1890 * @param [in] user_data The user data to be passed to the callback funcation
1892 * @return 0 on success, otherwise a negative error value.
1893 * @retval #NFC_ERROR_NONE Successful
1894 * @retval #NFC_ERROR_OUT_OF_MEMORY Out of memory
1895 * @retval #NFC_ERROR_OPERATION_FAILED Operation failed
1896 * @retval #NFC_ERROR_INVALID_PARAMETER Invalid parameter
1897 * @retval #NFC_ERROR_DEVICE_BUSY Device is too busy to handle your request
1898 * @retval #NFC_ERROR_NOT_ACTIVATED NFC is not activated
1900 * @see nfc_p2p_send_completed_cb()
1901 * @see @see nfc_p2p_target_discovered_cb()
1903 int nfc_p2p_send(nfc_p2p_target_h target, nfc_ndef_message_h message, nfc_p2p_send_completed_cb callback, void *user_data);
1909 * @brief NFC Connetionhandover between NFC peer-to-peer target
1910 * @ingroup CAPI_NETWORK_NFC_P2P_MODULE
1912 * @param [in] target The handle to NFC device
1913 * @param [in] type Prepered Alternative Carrior
1914 * @param [in] callback The callback function to invoke after this function has completed\n It can be null if notification is not required
1915 * @param [in] user_data The user data to be passed to the callback function
1917 * @return 0 on success, otherwise a negative error value.
1918 * @retval #NFC_ERROR_NONE Successful
1919 * @retval #NFC_ERROR_OUT_OF_MEMORY Out of memory
1920 * @retval #NFC_ERROR_OPERATION_FAILED Operation failed
1921 * @retval #NFC_ERROR_INVALID_PARAMETER Invalid parameter
1922 * @retval #NFC_ERROR_DEVICE_BUSY Device is too busy to handle your request
1923 * @retval #NFC_ERROR_NOT_ACTIVATED NFC is not activated
1925 * @see nfc_p2p_connection_handover_completed_cb()
1926 * @see @see nfc_p2p_connection_handover_completed_cb()
1929 int nfc_p2p_connection_handover(nfc_p2p_target_h target , nfc_ac_type_e type, nfc_p2p_connection_handover_completed_cb callback, void *user_data);
1934 * @brief Check available Alternative Carrior(AC) for NFC handover between NFC peer-to-peer target
1935 * @ingroup CAPI_NETWORK_NFC_P2P_MODULE
1937 * @param [in] carrior Alternative Carrior whan to be checked whether supported or not
1939 * @retval #true Supported
1940 * @retval #false Not Supported
1942 * @see nfc_p2p_is_supported_ac_type()
1945 bool nfc_p2p_is_supported_ac_type( nfc_ac_type_e carrior);
1953 #endif /* __NFC_H__ */