2 * Copyright (c) 2012, 2013 Samsung Electronics Co., Ltd.
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.
17 #include "nfc_common.h"
19 bool nfc_manager_is_supported(void)
21 bool nfc_supported = false;
25 nfc_supported = nfc_common_is_supported(NFC_FEATURE);
27 if (nfc_supported == true)
28 set_last_result(NFC_ERROR_NONE);
30 set_last_result(NFC_ERROR_NOT_SUPPORTED); // LCOV_EXCL_LINE
36 static void _activation_changed_cb(net_nfc_error_e result, void *user_data)
38 nfc_activation_data_s *data = user_data;
42 if (user_data == NULL) {
43 LOG_ERR("user_data is NULL");
47 if (data->callback != NULL)
48 data->callback(nfc_common_convert_error_code(__func__, result), data->user_data);
54 int nfc_manager_set_activation(bool activation,
55 nfc_activation_completed_cb callback,
62 CHECK_SUPPORTED(NFC_FEATURE);
67 if (nfc_manager_is_activated() == activation) {
69 ret = NFC_ERROR_ALREADY_ACTIVATED;
71 ret = NFC_ERROR_ALREADY_DEACTIVATED;
73 nfc_activation_data_s *data = NULL;
75 data = (nfc_activation_data_s *)malloc(sizeof(nfc_activation_data_s));
78 data->callback = callback;
79 data->user_data = user_data;
80 ret = net_nfc_client_manager_set_active(activation,
81 _activation_changed_cb,
83 if (ret != NET_NFC_OK) {
84 LOG_ERR("net_nfc_client_manager_set_active fail");
89 ret = NET_NFC_ALLOC_FAIL;
92 ret = nfc_common_convert_error_code(__func__, ret);
99 int nfc_manager_configure_discovery(int mode)
105 CHECK_SUPPORTED(NFC_FEATURE);
107 /* LCOV_EXCL_START */
111 ret = net_nfc_client_manager_configure_discovery_sync(mode);
113 return nfc_common_convert_error_code(__func__, ret);
117 bool nfc_manager_is_activated(void)
124 if (nfc_common_is_supported(NFC_FEATURE) == false) {
125 set_last_result(NFC_ERROR_NOT_SUPPORTED);
129 /* LCOV_EXCL_START */
130 ret = net_nfc_client_get_nfc_state(&activated);
132 set_last_result(nfc_common_convert_error_code(__func__, ret));
134 return (!!activated);
138 int nfc_manager_set_activation_changed_cb(nfc_activation_changed_cb callback,
143 CHECK_SUPPORTED(NFC_FEATURE);
145 /* LCOV_EXCL_START */
147 CHECK_INVALID(callback == NULL);
149 net_nfc_client_manager_set_activated(callback, user_data);
151 return NFC_ERROR_NONE;
155 void nfc_manager_unset_activation_changed_cb(void)
159 if (nfc_common_is_supported(NFC_FEATURE) == false) {
160 /* LCOV_EXCL_START */
161 LOG_ERR("NFC not supported");
162 set_last_result(NFC_ERROR_NOT_SUPPORTED);
167 /* LCOV_EXCL_START */
168 if (nfc_common_is_initialized() == false) {
169 LOG_ERR("NFC not initialized");
170 set_last_result(NFC_ERROR_NOT_INITIALIZED);
174 net_nfc_client_manager_unset_activated();
176 set_last_result(NFC_ERROR_NONE);
180 int nfc_manager_initialize(void)
182 int ret = NET_NFC_OK;
186 CHECK_SUPPORTED(NFC_FEATURE);
188 /* LCOV_EXCL_START */
189 if (!nfc_common_is_initialized()) {
190 ret = net_nfc_client_initialize();
191 if (ret != NET_NFC_OK)
192 return nfc_common_convert_error_code(__func__, ret);
194 memset(&gdbus_nfc_context, 0, sizeof(gdbus_nfc_context));
196 gdbus_nfc_context.initialized = true;
199 return nfc_common_convert_error_code(__func__, ret);
203 int nfc_manager_deinitialize(void)
205 int ret = NET_NFC_OK;
209 CHECK_SUPPORTED(NFC_FEATURE);
211 /* LCOV_EXCL_START */
212 if (nfc_common_is_initialized()) {
213 net_nfc_client_se_unset_event_cb();
215 net_nfc_client_p2p_unset_device_discovered();
216 net_nfc_client_p2p_unset_device_detached();
218 net_nfc_client_tag_unset_tag_discovered();
219 net_nfc_client_tag_unset_tag_detached();
221 ret = net_nfc_client_deinitialize();
223 gdbus_nfc_context.initialized = false;
226 return nfc_common_convert_error_code(__func__, ret);
230 /* LCOV_EXCL_START */
231 static void _tag_discovered_cb(net_nfc_target_info_h info, void *user_data)
235 gdbus_nfc_context.current_tag = info;
237 if (gdbus_nfc_context.on_tag_discovered_cb != NULL) {
238 gdbus_nfc_context.on_tag_discovered_cb(
239 NFC_DISCOVERED_TYPE_ATTACHED,
240 (nfc_tag_h)gdbus_nfc_context.current_tag,
241 gdbus_nfc_context.on_tag_discovered_user_data);
244 /* ndef discovered cb */
245 if (gdbus_nfc_context.on_ndef_discovered_cb) {
246 ndef_message_h ndef_message = NULL;
248 if (net_nfc_get_tag_ndef_message((net_nfc_target_info_h)info,
249 &ndef_message) == NET_NFC_OK) {
250 gdbus_nfc_context.on_ndef_discovered_cb(ndef_message,
251 gdbus_nfc_context.on_ndef_discovered_user_data);
253 net_nfc_free_ndef_message(ndef_message);
258 static void _tag_detached_cb(void *user_data)
262 if (gdbus_nfc_context.on_tag_discovered_cb != NULL) {
263 gdbus_nfc_context.on_tag_discovered_cb(
264 NFC_DISCOVERED_TYPE_DETACHED,
265 (nfc_tag_h)gdbus_nfc_context.current_tag,
266 gdbus_nfc_context.on_tag_discovered_user_data);
269 gdbus_nfc_context.current_tag = NULL;
273 int nfc_manager_set_ndef_discovered_cb(
274 nfc_ndef_discovered_cb callback,
279 CHECK_SUPPORTED(NFC_FEATURE);
281 /* LCOV_EXCL_START */
283 CHECK_INVALID(callback == NULL);
285 net_nfc_client_tag_set_tag_discovered(_tag_discovered_cb, NULL);
286 net_nfc_client_tag_set_tag_detached(_tag_detached_cb, NULL);
288 gdbus_nfc_context.on_ndef_discovered_cb = callback;
289 gdbus_nfc_context.on_ndef_discovered_user_data = user_data;
291 return NFC_ERROR_NONE;
295 void nfc_manager_unset_ndef_discovered_cb(void)
299 if (nfc_common_is_supported(NFC_FEATURE) == false) {
300 /* LCOV_EXCL_START */
301 LOG_ERR("NFC not supported");
302 set_last_result(NFC_ERROR_NOT_SUPPORTED);
307 /* LCOV_EXCL_START */
308 if (nfc_common_is_initialized() == false) {
309 LOG_ERR("NFC not initialized");
310 set_last_result(NFC_ERROR_NOT_INITIALIZED);
314 gdbus_nfc_context.on_ndef_discovered_cb = NULL;
315 gdbus_nfc_context.on_ndef_discovered_user_data = NULL;
317 set_last_result(NFC_ERROR_NONE);
321 void nfc_manager_set_tag_filter(int filter)
325 if (nfc_common_is_supported(NFC_TAG_FEATURE) == false) {
326 LOG_ERR("NFC not supported");
327 set_last_result(NFC_ERROR_NOT_SUPPORTED);
331 /* LCOV_EXCL_START */
332 if (nfc_common_is_initialized() == false) {
333 LOG_ERR("NFC not initialized");
334 set_last_result(NFC_ERROR_NOT_INITIALIZED);
338 if (filter < NET_NFC_ALL_ENABLE) {
339 LOG_ERR("Invalid parameter");
340 set_last_result(NFC_ERROR_INVALID_PARAMETER);
344 net_nfc_client_tag_set_filter(filter);
346 set_last_result(NFC_ERROR_NONE);
350 int nfc_manager_get_tag_filter(void)
354 if (nfc_common_is_supported(NFC_TAG_FEATURE) == false) {
355 LOG_ERR("NFC not supported");
356 set_last_result(NFC_ERROR_NOT_SUPPORTED);
360 /* LCOV_EXCL_START */
361 if (nfc_common_is_initialized() == false) {
362 LOG_ERR("NFC not initialized");
363 set_last_result(NFC_ERROR_NOT_INITIALIZED);
367 set_last_result(NFC_ERROR_NONE);
369 return net_nfc_client_tag_get_filter();
373 int nfc_manager_get_connected_tag(nfc_tag_h *tag)
376 net_nfc_target_info_h result = NULL;
380 CHECK_SUPPORTED(NFC_TAG_FEATURE);
382 /* LCOV_EXCL_START */
384 CHECK_INVALID(tag == NULL);
388 net_nfc_client_tag_set_tag_discovered(_tag_discovered_cb, NULL);
389 net_nfc_client_tag_set_tag_detached(_tag_detached_cb, NULL);
392 if (gdbus_nfc_context.current_tag == NULL) {
393 ret = net_nfc_client_tag_get_current_tag_info_sync(&result);
394 if (ret == NET_NFC_OK)
395 *tag = (nfc_tag_h)result;
398 *tag = gdbus_nfc_context.current_tag;
403 return nfc_common_convert_error_code(__func__, ret);
407 int nfc_manager_get_connected_target(nfc_p2p_target_h *target)
410 net_nfc_target_handle_h result = NULL;
414 CHECK_SUPPORTED(NFC_P2P_FEATURE);
416 /* LCOV_EXCL_START */
418 CHECK_INVALID(target == NULL);
422 net_nfc_client_tag_set_tag_discovered(_tag_discovered_cb, NULL);
423 net_nfc_client_tag_set_tag_detached(_tag_detached_cb, NULL);
425 if (gdbus_nfc_context.current_target == NULL) {
426 ret = net_nfc_client_tag_get_current_target_handle_sync(&result);
427 if (ret == NET_NFC_OK) {
428 gdbus_nfc_context.current_target = result;
430 *target = gdbus_nfc_context.current_target;
434 *target = gdbus_nfc_context.current_target;
439 return nfc_common_convert_error_code(__func__, ret);
443 int nfc_manager_set_tag_discovered_cb(nfc_tag_discovered_cb callback,
448 CHECK_SUPPORTED(NFC_TAG_FEATURE);
450 /* LCOV_EXCL_START */
452 CHECK_INVALID(callback == NULL);
454 net_nfc_client_tag_set_tag_discovered(_tag_discovered_cb, NULL);
455 net_nfc_client_tag_set_tag_detached(_tag_detached_cb, NULL);
457 gdbus_nfc_context.on_tag_discovered_cb = callback;
458 gdbus_nfc_context.on_tag_discovered_user_data = user_data;
460 return NFC_ERROR_NONE;
464 void nfc_manager_unset_tag_discovered_cb(void)
468 if (nfc_common_is_supported(NFC_TAG_FEATURE) == false) {
469 LOG_ERR("NFC not supported");
470 set_last_result(NFC_ERROR_NOT_SUPPORTED);
474 /* LCOV_EXCL_START */
475 if (nfc_common_is_initialized() == false) {
476 LOG_ERR("NFC not initialized");
477 set_last_result(NFC_ERROR_NOT_INITIALIZED);
481 gdbus_nfc_context.on_tag_discovered_cb = NULL;
482 gdbus_nfc_context.on_tag_discovered_user_data = NULL;
484 set_last_result(NFC_ERROR_NONE);
488 /* LCOV_EXCL_START */
489 static void _p2p_discovered_cb(
490 net_nfc_target_handle_h handle_info,
495 gdbus_nfc_context.current_target = handle_info;
497 if (gdbus_nfc_context.on_p2p_target_discovered_cb != NULL) {
498 gdbus_nfc_context.on_p2p_target_discovered_cb(
499 NFC_DISCOVERED_TYPE_ATTACHED,
500 (nfc_p2p_target_h)gdbus_nfc_context.current_target,
501 gdbus_nfc_context.on_p2p_target_discovered_user_data);
505 static void _p2p_detached_cb(void *user_data)
507 nfc_p2p_target_h handle =
508 (nfc_p2p_target_h)gdbus_nfc_context.current_target;
512 if (gdbus_nfc_context.on_p2p_target_discovered_cb != NULL) {
513 gdbus_nfc_context.on_p2p_target_discovered_cb(
514 NFC_DISCOVERED_TYPE_DETACHED,
516 gdbus_nfc_context.on_p2p_target_discovered_user_data);
519 /* unset data_received callback */
520 nfc_p2p_unset_data_received_cb(handle);
522 gdbus_nfc_context.current_target = NULL;
526 int nfc_manager_set_p2p_target_discovered_cb(
527 nfc_p2p_target_discovered_cb callback,
532 CHECK_SUPPORTED(NFC_P2P_FEATURE);
534 /* LCOV_EXCL_START */
536 CHECK_INVALID(callback == NULL);
538 net_nfc_client_p2p_set_device_discovered(_p2p_discovered_cb, NULL);
539 net_nfc_client_p2p_set_device_detached(_p2p_detached_cb, NULL);
541 gdbus_nfc_context.on_p2p_target_discovered_cb = callback;
542 gdbus_nfc_context.on_p2p_target_discovered_user_data = user_data;
544 return NFC_ERROR_NONE;
548 void nfc_manager_unset_p2p_target_discovered_cb(void)
552 if (nfc_common_is_supported(NFC_P2P_FEATURE) == false) {
553 LOG_ERR("NFC not supported");
554 set_last_result(NFC_ERROR_NOT_SUPPORTED);
558 /* LCOV_EXCL_START */
559 if (nfc_common_is_initialized() == false) {
560 LOG_ERR("NFC not initialized");
561 set_last_result(NFC_ERROR_NOT_INITIALIZED);
565 gdbus_nfc_context.on_p2p_target_discovered_cb = NULL;
566 gdbus_nfc_context.on_p2p_target_discovered_user_data = NULL;
568 set_last_result(NFC_ERROR_NONE);
572 int nfc_manager_set_system_handler_enable(bool enable)
579 CHECK_SUPPORTED(NFC_FEATURE);
581 /* LCOV_EXCL_START */
589 ret = net_nfc_client_sys_handler_set_launch_popup_state(state);
591 return nfc_common_convert_error_code(__func__, ret);
595 int nfc_manager_set_system_handler_enable_force(bool enable)
602 CHECK_SUPPORTED(NFC_FEATURE);
604 /* LCOV_EXCL_START */
612 ret = net_nfc_client_sys_handler_set_launch_popup_state_force(state);
614 return nfc_common_convert_error_code(__func__, ret);
618 bool nfc_manager_is_system_handler_enabled(void)
625 if (nfc_common_is_supported(NFC_FEATURE) == false) {
626 /* LCOV_EXCL_START */
627 LOG_ERR("NFC not supported");
628 set_last_result(NFC_ERROR_NOT_SUPPORTED);
633 /* LCOV_EXCL_START */
634 if (nfc_common_is_initialized() == false) {
635 LOG_ERR("NFC not initialized");
636 set_last_result(NFC_ERROR_NOT_INITIALIZED);
640 ret = net_nfc_client_sys_handler_get_launch_popup_state(&state);
642 set_last_result(nfc_common_convert_error_code(__func__, ret));
648 int nfc_manager_get_cached_message(nfc_ndef_message_h *ndef_message)
654 CHECK_SUPPORTED(NFC_FEATURE);
656 /* LCOV_EXCL_START */
658 CHECK_INVALID(ndef_message == NULL);
660 ret = net_nfc_retrieve_current_ndef_message(ndef_message);
662 return nfc_common_convert_error_code(__func__, ret);
666 /* LCOV_EXCL_START */
667 static void _se_event_cb(net_nfc_message_e message, void *user_data)
671 if (gdbus_nfc_context.on_se_event_cb != NULL) {
672 if (message == NET_NFC_MESSAGE_SE_CARD_EMULATION_CHANGED)
673 gdbus_nfc_context.on_se_event_cb(
674 NFC_SE_EVENT_CARD_EMULATION_CHANGED,
675 gdbus_nfc_context.on_se_event_user_data);
677 else if (message == NET_NFC_MESSAGE_SE_TYPE_CHANGED)
678 gdbus_nfc_context.on_se_event_cb(
679 NFC_SE_EVENT_SE_TYPE_CHANGED,
680 gdbus_nfc_context.on_se_event_user_data);
681 else if (message == NET_NFC_MESSAGE_SE_FIELD_ON)
682 gdbus_nfc_context.on_se_event_cb(
683 NFC_SE_EVENT_FIELD_ON,
684 gdbus_nfc_context.on_se_event_user_data);
689 int nfc_manager_set_se_event_cb(nfc_se_event_cb callback, void *user_data)
693 CHECK_SUPPORTED(NFC_CE_FEATURE);
695 /* LCOV_EXCL_START */
697 CHECK_INVALID(callback == NULL);
699 net_nfc_client_se_set_event_cb(_se_event_cb, NULL);
701 gdbus_nfc_context.on_se_event_cb = callback;
702 gdbus_nfc_context.on_se_event_user_data = user_data;
704 return NFC_ERROR_NONE;
708 void nfc_manager_unset_se_event_cb(void)
712 if (nfc_common_is_supported(NFC_CE_FEATURE) == false) {
713 /* LCOV_EXCL_START */
714 LOG_ERR("NFC not supported");
715 set_last_result(NFC_ERROR_NOT_SUPPORTED);
720 /* LCOV_EXCL_START */
721 if (nfc_common_is_initialized() == false) {
722 LOG_ERR("NFC not initialized");
723 set_last_result(NFC_ERROR_NOT_INITIALIZED);
727 gdbus_nfc_context.on_se_event_cb = NULL;
728 gdbus_nfc_context.on_se_event_user_data = NULL;
730 set_last_result(NFC_ERROR_NONE);
734 /* LCOV_EXCL_START */
735 static void _se_transaction_event_cb(net_nfc_se_type_e se_type, data_h aid,
736 data_h param, void *user_data)
740 if (gdbus_nfc_context.on_se_transaction_event_cb != NULL) {
741 gdbus_nfc_context.on_se_transaction_event_cb(
743 net_nfc_get_data_buffer(aid),
744 net_nfc_get_data_length(aid),
745 net_nfc_get_data_buffer(param),
746 net_nfc_get_data_length(param),
747 gdbus_nfc_context.on_se_transaction_event_user_data);
752 int nfc_manager_set_se_transaction_event_cb(
753 nfc_se_type_e se_type,
754 nfc_se_transaction_event_cb callback,
757 net_nfc_se_type_e type = NET_NFC_SE_TYPE_NONE;
761 CHECK_SUPPORTED(NFC_CE_FEATURE);
763 /* LCOV_EXCL_START */
765 CHECK_INVALID(callback == NULL);
767 gdbus_nfc_context.on_se_transaction_event_cb = callback;
768 gdbus_nfc_context.on_se_transaction_event_user_data = user_data;
771 case NFC_SE_TYPE_ESE:
772 type = NET_NFC_SE_TYPE_ESE;
775 case NFC_SE_TYPE_UICC:
776 type = NET_NFC_SE_TYPE_UICC;
778 case NET_NFC_SE_TYPE_HCE:
779 type = NET_NFC_SE_TYPE_HCE;
782 return NFC_ERROR_INVALID_PARAMETER;
786 net_nfc_client_se_set_transaction_event_cb(type, _se_transaction_event_cb, user_data);
788 return NFC_ERROR_NONE;
792 void nfc_manager_unset_se_transaction_event_cb(nfc_se_type_e se_type)
794 net_nfc_se_type_e type = NET_NFC_SE_TYPE_NONE;
798 if (nfc_common_is_supported(NFC_CE_FEATURE) == false) {
799 /* LCOV_EXCL_START */
800 LOG_ERR("NFC not supported");
801 set_last_result(NFC_ERROR_NOT_SUPPORTED);
806 /* LCOV_EXCL_START */
807 if (nfc_common_is_initialized() == false) {
808 LOG_ERR("NFC not initialized");
809 set_last_result(NFC_ERROR_NOT_INITIALIZED);
814 case NFC_SE_TYPE_ESE:
815 type = NET_NFC_SE_TYPE_ESE;
818 case NFC_SE_TYPE_UICC:
819 type = NET_NFC_SE_TYPE_UICC;
822 type = NET_NFC_SE_TYPE_NONE;
826 net_nfc_client_se_unset_transaction_event_cb(type);
828 set_last_result(NFC_ERROR_NONE);
832 int nfc_manager_enable_transaction_fg_dispatch()
834 net_nfc_error_e result;
838 CHECK_SUPPORTED(NFC_CE_FEATURE);
840 /* LCOV_EXCL_START */
843 result = net_nfc_client_se_set_transaction_fg_dispatch(true);
845 return nfc_common_convert_error_code(__func__, result);
849 int nfc_manager_disable_transaction_fg_dispatch()
851 net_nfc_error_e result;
853 CHECK_SUPPORTED(NFC_CE_FEATURE);
855 /* LCOV_EXCL_START */
858 result = net_nfc_client_se_set_transaction_fg_dispatch(false);
860 return nfc_common_convert_error_code(__func__, result);
864 int nfc_manager_set_se_type(nfc_se_type_e type)
867 net_nfc_se_type_e se_type = NET_NFC_SE_TYPE_NONE;
871 CHECK_SUPPORTED(NFC_CE_FEATURE);
873 /* LCOV_EXCL_START */
875 CHECK_INVALID(type < NFC_SE_TYPE_DISABLE);
876 CHECK_INVALID(type > NFC_SE_TYPE_HCE);
879 case NFC_SE_TYPE_ESE:
880 se_type = NET_NFC_SE_TYPE_ESE;
882 case NFC_SE_TYPE_UICC:
883 se_type = NET_NFC_SE_TYPE_UICC;
885 case NFC_SE_TYPE_SDCARD:
886 se_type = NET_NFC_SE_TYPE_SDCARD;
888 case NFC_SE_TYPE_HCE:
889 se_type = NET_NFC_SE_TYPE_HCE;
892 se_type = NET_NFC_SE_TYPE_NONE;
896 ret = net_nfc_client_se_set_secure_element_type_sync(se_type);
898 return nfc_common_convert_error_code(__func__, ret);
902 int nfc_manager_get_se_type(nfc_se_type_e *type)
905 net_nfc_se_type_e se_type = NET_NFC_SE_TYPE_NONE;
909 CHECK_SUPPORTED(NFC_CE_FEATURE);
911 /* LCOV_EXCL_START */
913 CHECK_INVALID(type == NULL);
915 ret = net_nfc_client_se_get_secure_element_type_sync(&se_type);
918 case NET_NFC_SE_TYPE_ESE:
919 *type = NFC_SE_TYPE_ESE;
921 case NET_NFC_SE_TYPE_UICC:
922 *type = NFC_SE_TYPE_UICC;
924 case NET_NFC_SE_TYPE_SDCARD:
925 *type = NFC_SE_TYPE_SDCARD;
927 case NET_NFC_SE_TYPE_HCE:
928 *type = NFC_SE_TYPE_HCE;
931 *type = NFC_SE_TYPE_DISABLE;
935 return nfc_common_convert_error_code(__func__, ret);
939 /* LCOV_EXCL_START */
940 static void _hce_event_cb(net_nfc_target_handle_h handle,
941 net_nfc_hce_event_t event, data_h apdu, void *user_data)
945 if (gdbus_nfc_context.on_hce_event_cb != NULL) {
946 gdbus_nfc_context.on_hce_event_cb(
948 (nfc_hce_event_type_e)event,
949 net_nfc_get_data_buffer(apdu),
950 net_nfc_get_data_length(apdu),
951 gdbus_nfc_context.on_hce_event_user_data);
956 int nfc_manager_set_hce_event_cb(nfc_hce_event_cb callback, void *user_data)
958 net_nfc_error_e result;
961 CHECK_SUPPORTED(NFC_CE_HCE_FEATURE);
963 /* LCOV_EXCL_START */
965 CHECK_INVALID(callback == NULL);
967 gdbus_nfc_context.on_hce_event_cb = callback;
968 gdbus_nfc_context.on_hce_event_user_data = user_data;
970 result = net_nfc_client_hce_set_event_received_cb(_hce_event_cb, user_data);
972 return nfc_common_convert_error_code(__func__, result);
976 void nfc_manager_unset_hce_event_cb(void)
980 if (nfc_common_is_supported(NFC_CE_HCE_FEATURE) == false) {
981 /* LCOV_EXCL_START */
982 LOG_ERR("NFC not supported");
983 set_last_result(NFC_ERROR_NOT_SUPPORTED);
988 /* LCOV_EXCL_START */
989 if (nfc_common_is_initialized() == false) {
990 LOG_ERR("NFC not initialized");
991 set_last_result(NFC_ERROR_NOT_INITIALIZED);
995 net_nfc_client_hce_unset_event_received_cb();
997 set_last_result(NFC_ERROR_NONE);