diff options
author | Jihoon Jung <jh8801.jung@samsung.com> | 2021-02-15 16:27:49 +0900 |
---|---|---|
committer | Jihoon Jung <jh8801.jung@samsung.com> | 2021-02-15 16:27:49 +0900 |
commit | a74401d641995ff7ca825d693d19562b9be58eb4 (patch) | |
tree | 15e509b05eb7d3cb6416c946f7cf8b0d0b30c20b | |
parent | f6ac343927ac5437ae67393573ef1e96b849f26b (diff) | |
download | nfc-a74401d641995ff7ca825d693d19562b9be58eb4.tar.gz nfc-a74401d641995ff7ca825d693d19562b9be58eb4.tar.bz2 nfc-a74401d641995ff7ca825d693d19562b9be58eb4.zip |
Add error handling for unsupported functionssubmit/tizen/20210217.020358submit/tizen/20210216.234305submit/tizen/20210216.231750submit/tizen/20210215.234449accepted/tizen/unified/20210217.030941accepted/tizen/unified/20210217.030927accepted/tizen/unified/20210216.015108
Change-Id: Ia83650f6ef83b0c86e7d2c2d114d40aca3dbce52
Signed-off-by: Jihoon Jung <jh8801.jung@samsung.com>
-rwxr-xr-x | include/hal-nfc.h | 2 | ||||
-rwxr-xr-x | src/hal-api-nfc.c | 191 |
2 files changed, 191 insertions, 2 deletions
diff --git a/include/hal-nfc.h b/include/hal-nfc.h index 1e8b7bc..ca907ca 100755 --- a/include/hal-nfc.h +++ b/include/hal-nfc.h @@ -26,7 +26,7 @@ extern "C" { int hal_nfc_get_backend(void); int hal_nfc_put_backend(void); -bool hal_nfc_start(int *result); +bool hal_nfc_start(net_nfc_error_e *result); bool hal_nfc_stop(void); bool hal_nfc_register_listener(target_detection_listener_cb target_detection_listener, se_transaction_listener_cb se_transaction_listener, llcp_event_listener_cb llcp_event_listener, hce_apdu_listener_cb hce_apdu_listener, net_nfc_error_e * result); diff --git a/src/hal-api-nfc.c b/src/hal-api-nfc.c index 026a06b..ad25aef 100755 --- a/src/hal-api-nfc.c +++ b/src/hal-api-nfc.c @@ -71,10 +71,13 @@ int hal_nfc_put_backend(void) } EXPORT -bool hal_nfc_start(int *result) +bool hal_nfc_start(net_nfc_error_e *result) { if (!g_nfc_funcs) return -ENOTSUP; + if (!g_nfc_funcs->start) + return -ENOTSUP; + return g_nfc_funcs->start(result); } @@ -83,6 +86,9 @@ bool hal_nfc_stop(void) { if (!g_nfc_funcs) return -ENOTSUP; + if (!g_nfc_funcs->stop) + return -ENOTSUP; + return g_nfc_funcs->stop(); } @@ -91,6 +97,9 @@ bool hal_nfc_register_listener(target_detection_listener_cb target_detection_lis { if (!g_nfc_funcs) return -ENOTSUP; + if (!g_nfc_funcs->register_listener) + return -ENOTSUP; + return g_nfc_funcs->register_listener(target_detection_listener, se_transaction_listener, llcp_event_listener, hce_apdu_listener, result); } @@ -99,6 +108,9 @@ bool hal_nfc_unregister_listener(void) { if (!g_nfc_funcs) return -ENOTSUP; + if (!g_nfc_funcs->unregister_listener) + return -ENOTSUP; + return g_nfc_funcs->unregister_listener(); } @@ -107,6 +119,9 @@ bool hal_nfc_get_firmware_version(data_s ** data, net_nfc_error_e * result) { if (!g_nfc_funcs) return -ENOTSUP; + if (!g_nfc_funcs->get_firmware_version) + return -ENOTSUP; + return g_nfc_funcs->get_firmware_version(data, result); } @@ -115,6 +130,9 @@ bool hal_nfc_support_nfc(net_nfc_error_e * result) { if (!g_nfc_funcs) return -ENOTSUP; + if (!g_nfc_funcs->support_nfc) + return -ENOTSUP; + return g_nfc_funcs->support_nfc(result); } @@ -123,6 +141,9 @@ bool hal_nfc_check_firmware_version(net_nfc_error_e * result) { if (!g_nfc_funcs) return -ENOTSUP; + if (!g_nfc_funcs->check_firmware_version) + return -ENOTSUP; + return g_nfc_funcs->check_firmware_version(result); } @@ -131,6 +152,9 @@ bool hal_nfc_update_firmware(net_nfc_error_e * result) { if (!g_nfc_funcs) return -ENOTSUP; + if (!g_nfc_funcs->update_firmware) + return -ENOTSUP; + return g_nfc_funcs->update_firmware(result); } @@ -139,6 +163,9 @@ bool hal_nfc_get_stack_information(net_nfc_stack_information_s * stack_info, net { if (!g_nfc_funcs) return -ENOTSUP; + if (!g_nfc_funcs->get_stack_information) + return -ENOTSUP; + return g_nfc_funcs->get_stack_information(stack_info, result); } @@ -147,6 +174,9 @@ bool hal_nfc_configure_discovery(net_nfc_discovery_mode_e mode, net_nfc_event_fi { if (!g_nfc_funcs) return -ENOTSUP; + if (!g_nfc_funcs->configure_discovery) + return -ENOTSUP; + return g_nfc_funcs->configure_discovery(mode, config, result); } @@ -155,6 +185,9 @@ bool hal_nfc_check_target_presence(net_nfc_target_handle_s * handle, net_nfc_err { if (!g_nfc_funcs) return -ENOTSUP; + if (!g_nfc_funcs->check_target_presence) + return -ENOTSUP; + return g_nfc_funcs->check_target_presence(handle, result); } @@ -163,6 +196,9 @@ bool hal_nfc_connect(net_nfc_target_handle_s * handle, net_nfc_error_e * result) { if (!g_nfc_funcs) return -ENOTSUP; + if (!g_nfc_funcs->connect) + return -ENOTSUP; + return g_nfc_funcs->connect(handle, result); } @@ -171,6 +207,9 @@ bool hal_nfc_disconnect(net_nfc_target_handle_s * handle, net_nfc_error_e * resu { if (!g_nfc_funcs) return -ENOTSUP; + if (!g_nfc_funcs->disconnect) + return -ENOTSUP; + return g_nfc_funcs->disconnect(handle, result); } @@ -179,6 +218,9 @@ bool hal_nfc_check_ndef(net_nfc_target_handle_s * handle, uint8_t * ndef_card_st { if (!g_nfc_funcs) return -ENOTSUP; + if (!g_nfc_funcs->check_ndef) + return -ENOTSUP; + return g_nfc_funcs->check_ndef(handle, ndef_card_state, max_data_size, real_data_size, result); } @@ -187,6 +229,9 @@ bool hal_nfc_read_ndef(net_nfc_target_handle_s * handle, data_s ** data, net_nfc { if (!g_nfc_funcs) return -ENOTSUP; + if (!g_nfc_funcs->read_ndef) + return -ENOTSUP; + return g_nfc_funcs->read_ndef(handle, data, result); } @@ -195,6 +240,9 @@ bool hal_nfc_write_ndef(net_nfc_target_handle_s * handle, data_s * data, net_nfc { if (!g_nfc_funcs) return -ENOTSUP; + if (!g_nfc_funcs->write_ndef) + return -ENOTSUP; + return g_nfc_funcs->write_ndef(handle, data, result); } @@ -203,6 +251,9 @@ bool hal_nfc_make_read_only_ndef(net_nfc_target_handle_s * handle, net_nfc_error { if (!g_nfc_funcs) return -ENOTSUP; + if (!g_nfc_funcs->make_read_only_ndef) + return -ENOTSUP; + return g_nfc_funcs->make_read_only_ndef(handle, result); } @@ -211,6 +262,9 @@ bool hal_nfc_format_ndef(net_nfc_target_handle_s * handle, data_s * secure_key, { if (!g_nfc_funcs) return -ENOTSUP; + if (!g_nfc_funcs->format_ndef) + return -ENOTSUP; + return g_nfc_funcs->format_ndef(handle, secure_key, result); } @@ -219,6 +273,9 @@ bool hal_nfc_transceive(net_nfc_target_handle_s * handle, net_nfc_transceive_inf { if (!g_nfc_funcs) return -ENOTSUP; + if (!g_nfc_funcs->transceive) + return -ENOTSUP; + return g_nfc_funcs->transceive(handle, info, data, result); } @@ -227,6 +284,9 @@ bool hal_nfc_exception_handler(void) { if (!g_nfc_funcs) return -ENOTSUP; + if (!g_nfc_funcs->exception_handler) + return -ENOTSUP; + return g_nfc_funcs->exception_handler(); } @@ -235,6 +295,9 @@ bool hal_nfc_is_ready(net_nfc_error_e * result) { if (!g_nfc_funcs) return -ENOTSUP; + if (!g_nfc_funcs->is_ready) + return -ENOTSUP; + return g_nfc_funcs->is_ready(result); } @@ -245,6 +308,9 @@ bool hal_nfc_llcp_config(net_nfc_llcp_config_info_s * config, net_nfc_error_e * { if (!g_nfc_funcs) return -ENOTSUP; + if (!g_nfc_funcs->llcp_config) + return -ENOTSUP; + return g_nfc_funcs->llcp_config(config, result); } @@ -253,6 +319,9 @@ bool hal_nfc_llcp_check_llcp(net_nfc_target_handle_s * handle, net_nfc_error_e * { if (!g_nfc_funcs) return -ENOTSUP; + if (!g_nfc_funcs->llcp_check_llcp) + return -ENOTSUP; + return g_nfc_funcs->llcp_check_llcp(handle, result); } @@ -261,6 +330,9 @@ bool hal_nfc_llcp_activate_llcp(net_nfc_target_handle_s * handle, net_nfc_error_ { if (!g_nfc_funcs) return -ENOTSUP; + if (!g_nfc_funcs->llcp_activate_llcp) + return -ENOTSUP; + return g_nfc_funcs->llcp_activate_llcp(handle, result); } @@ -269,6 +341,9 @@ bool hal_nfc_llcp_create_socket(net_nfc_llcp_socket_t * socket, net_nfc_socket_t { if (!g_nfc_funcs) return -ENOTSUP; + if (!g_nfc_funcs->llcp_create_socket) + return -ENOTSUP; + return g_nfc_funcs->llcp_create_socket(socket, socketType, miu, rw, result, user_param); } @@ -277,6 +352,9 @@ bool hal_nfc_llcp_bind(net_nfc_llcp_socket_t socket, uint8_t service_access_poin { if (!g_nfc_funcs) return -ENOTSUP; + if (!g_nfc_funcs->llcp_bind) + return -ENOTSUP; + return g_nfc_funcs->llcp_bind(socket, service_access_point, result); } @@ -285,6 +363,9 @@ bool hal_nfc_llcp_listen(net_nfc_target_handle_s * handle, uint8_t * service_acc { if (!g_nfc_funcs) return -ENOTSUP; + if (!g_nfc_funcs->llcp_listen) + return -ENOTSUP; + return g_nfc_funcs->llcp_listen(handle, service_access_name, socket, result, user_param); } @@ -293,6 +374,9 @@ bool hal_nfc_llcp_accept(net_nfc_llcp_socket_t socket, net_nfc_error_e * result, { if (!g_nfc_funcs) return -ENOTSUP; + if (!g_nfc_funcs->llcp_accept) + return -ENOTSUP; + return g_nfc_funcs->llcp_accept(socket, result, user_param); } @@ -301,6 +385,9 @@ bool hal_nfc_llcp_connect_by_url(net_nfc_target_handle_s * handle, net_nfc_llcp_ { if (!g_nfc_funcs) return -ENOTSUP; + if (!g_nfc_funcs->llcp_connect_by_url) + return -ENOTSUP; + return g_nfc_funcs->llcp_connect_by_url(handle, socket, service_access_name, result, user_param); } @@ -309,6 +396,9 @@ bool hal_nfc_llcp_connect(net_nfc_target_handle_s * handle, net_nfc_llcp_socket_ { if (!g_nfc_funcs) return -ENOTSUP; + if (!g_nfc_funcs->llcp_connect) + return -ENOTSUP; + return g_nfc_funcs->llcp_connect(handle, socket, service_access_point, result, user_param); } @@ -317,6 +407,9 @@ bool hal_nfc_llcp_disconnect(net_nfc_target_handle_s * handle, net_nfc_llcp_sock { if (!g_nfc_funcs) return -ENOTSUP; + if (!g_nfc_funcs->llcp_disconnect) + return -ENOTSUP; + return g_nfc_funcs->llcp_disconnect(handle, socket, result, user_param); } @@ -325,6 +418,9 @@ bool hal_nfc_llcp_socket_close(net_nfc_llcp_socket_t socket, net_nfc_error_e * r { if (!g_nfc_funcs) return -ENOTSUP; + if (!g_nfc_funcs->llcp_socket_close) + return -ENOTSUP; + return g_nfc_funcs->llcp_socket_close(socket, result); } @@ -333,6 +429,9 @@ bool hal_nfc_llcp_recv(net_nfc_target_handle_s * handle, net_nfc_llcp_socket_t s { if (!g_nfc_funcs) return -ENOTSUP; + if (!g_nfc_funcs->llcp_recv) + return -ENOTSUP; + return g_nfc_funcs->llcp_recv(handle, socket, data, result, user_param); } @@ -341,6 +440,9 @@ bool hal_nfc_llcp_send(net_nfc_target_handle_s * handle, net_nfc_llcp_socket_t s { if (!g_nfc_funcs) return -ENOTSUP; + if (!g_nfc_funcs->llcp_send) + return -ENOTSUP; + return g_nfc_funcs->llcp_send(handle, socket, data, result, user_param); } @@ -349,6 +451,9 @@ bool hal_nfc_llcp_recv_from(net_nfc_target_handle_s * handle, net_nfc_llcp_socke { if (!g_nfc_funcs) return -ENOTSUP; + if (!g_nfc_funcs->llcp_recv_from) + return -ENOTSUP; + return g_nfc_funcs->llcp_recv_from(handle, socket, data, result, user_param); } @@ -357,6 +462,9 @@ bool hal_nfc_llcp_send_to(net_nfc_target_handle_s * handle, net_nfc_llcp_socket_ { if (!g_nfc_funcs) return -ENOTSUP; + if (!g_nfc_funcs->llcp_send_to) + return -ENOTSUP; + return g_nfc_funcs->llcp_send_to(handle, socket, data, service_access_point, result, user_param); } @@ -365,6 +473,9 @@ bool hal_nfc_llcp_reject(net_nfc_target_handle_s * handle, net_nfc_llcp_socket_t { if (!g_nfc_funcs) return -ENOTSUP; + if (!g_nfc_funcs->llcp_reject) + return -ENOTSUP; + return g_nfc_funcs->llcp_reject(handle, socket, result); } @@ -373,6 +484,9 @@ bool hal_nfc_llcp_get_remote_config(net_nfc_target_handle_s * handle, net_nfc_ll { if (!g_nfc_funcs) return -ENOTSUP; + if (!g_nfc_funcs->llcp_get_remote_config) + return -ENOTSUP; + return g_nfc_funcs->llcp_get_remote_config(handle, config, result); } @@ -381,6 +495,9 @@ bool hal_nfc_llcp_get_remote_socket_info(net_nfc_target_handle_s * handle, net_n { if (!g_nfc_funcs) return -ENOTSUP; + if (!g_nfc_funcs->llcp_get_remote_socket_info) + return -ENOTSUP; + return g_nfc_funcs->llcp_get_remote_socket_info(handle, socket, option, result); } @@ -391,6 +508,9 @@ bool hal_nfc_secure_element_open(net_nfc_secure_element_type_e element_type, net { if (!g_nfc_funcs) return -ENOTSUP; + if (!g_nfc_funcs->secure_element_open) + return -ENOTSUP; + return g_nfc_funcs->secure_element_open(element_type, handle, result); } @@ -399,6 +519,9 @@ bool hal_nfc_secure_element_get_atr(net_nfc_target_handle_s * handle, data_s ** { if (!g_nfc_funcs) return -ENOTSUP; + if (!g_nfc_funcs->secure_element_get_atr) + return -ENOTSUP; + return g_nfc_funcs->secure_element_get_atr(handle, atr, result); } @@ -407,6 +530,9 @@ bool hal_nfc_secure_element_send_apdu(net_nfc_target_handle_s * handle, data_s * { if (!g_nfc_funcs) return -ENOTSUP; + if (!g_nfc_funcs->secure_element_send_apdu) + return -ENOTSUP; + return g_nfc_funcs->secure_element_send_apdu(handle, command, response, result); } @@ -415,6 +541,9 @@ bool hal_nfc_secure_element_close(net_nfc_target_handle_s * handle, net_nfc_erro { if (!g_nfc_funcs) return -ENOTSUP; + if (!g_nfc_funcs->secure_element_close) + return -ENOTSUP; + return g_nfc_funcs->secure_element_close(handle, result); } @@ -423,6 +552,9 @@ bool hal_nfc_get_secure_element_list(net_nfc_secure_element_info_s * list, int * { if (!g_nfc_funcs) return -ENOTSUP; + if (!g_nfc_funcs->get_secure_element_list) + return -ENOTSUP; + return g_nfc_funcs->get_secure_element_list(list, count, result); } @@ -431,6 +563,9 @@ bool hal_nfc_set_secure_element_mode(net_nfc_secure_element_type_e element_type, { if (!g_nfc_funcs) return -ENOTSUP; + if (!g_nfc_funcs->set_secure_element_mode) + return -ENOTSUP; + return g_nfc_funcs->set_secure_element_mode(element_type, mode, result); } @@ -441,6 +576,9 @@ bool hal_nfc_sim_test(net_nfc_error_e * result) { if (!g_nfc_funcs) return -ENOTSUP; + if (!g_nfc_funcs->sim_test) + return -ENOTSUP; + return g_nfc_funcs->sim_test(result); } @@ -449,6 +587,9 @@ bool hal_nfc_prbs_test(net_nfc_error_e * result, uint32_t tech, uint32_t rate) { if (!g_nfc_funcs) return -ENOTSUP; + if (!g_nfc_funcs->prbs_test) + return -ENOTSUP; + return g_nfc_funcs->prbs_test(result, tech, rate); } @@ -457,6 +598,9 @@ bool hal_nfc_test_mode_on(net_nfc_error_e * result) { if (!g_nfc_funcs) return -ENOTSUP; + if (!g_nfc_funcs->test_mode_on) + return -ENOTSUP; + return g_nfc_funcs->test_mode_on(result); } @@ -465,6 +609,9 @@ bool hal_nfc_test_mode_off(net_nfc_error_e * result) { if (!g_nfc_funcs) return -ENOTSUP; + if (!g_nfc_funcs->test_mode_off) + return -ENOTSUP; + return g_nfc_funcs->test_mode_off(result); } @@ -473,6 +620,9 @@ bool hal_nfc_eedata_register_set(net_nfc_error_e * result, uint32_t mode, uint32 { if (!g_nfc_funcs) return -ENOTSUP; + if (!g_nfc_funcs->eedata_register_set) + return -ENOTSUP; + return g_nfc_funcs->eedata_register_set(result, mode, reg_id, data); } @@ -481,6 +631,9 @@ bool hal_nfc_ese_test(net_nfc_error_e * result) { if (!g_nfc_funcs) return -ENOTSUP; + if (!g_nfc_funcs->ese_test) + return -ENOTSUP; + return g_nfc_funcs->ese_test(result); } @@ -489,6 +642,9 @@ bool hal_nfc_test_set_se_tech_type(net_nfc_error_e * result, net_nfc_se_type_e t { if (!g_nfc_funcs) return -ENOTSUP; + if (!g_nfc_funcs->test_set_se_tech_type) + return -ENOTSUP; + return g_nfc_funcs->test_set_se_tech_type(result, type, tech); } @@ -499,6 +655,9 @@ bool hal_nfc_hce_response_apdu(net_nfc_target_handle_s * handle, data_s * respon { if (!g_nfc_funcs) return -ENOTSUP; + if (!g_nfc_funcs->hce_response_apdu) + return -ENOTSUP; + return g_nfc_funcs->hce_response_apdu(handle, response, result); } @@ -507,6 +666,9 @@ bool hal_nfc_secure_element_route_aid(data_s * aid, net_nfc_se_type_e se_type, i { if (!g_nfc_funcs) return -ENOTSUP; + if (!g_nfc_funcs->secure_element_route_aid) + return -ENOTSUP; + return g_nfc_funcs->secure_element_route_aid(aid, se_type, power, result); } @@ -515,6 +677,9 @@ bool hal_nfc_secure_element_unroute_aid(data_s * aid, net_nfc_error_e * result) { if (!g_nfc_funcs) return -ENOTSUP; + if (!g_nfc_funcs->secure_element_unroute_aid) + return -ENOTSUP; + return g_nfc_funcs->secure_element_unroute_aid(aid, result); } @@ -523,6 +688,9 @@ bool hal_nfc_secure_element_commit_routing(net_nfc_error_e * result) { if (!g_nfc_funcs) return -ENOTSUP; + if (!g_nfc_funcs->secure_element_commit_routing) + return -ENOTSUP; + return g_nfc_funcs->secure_element_commit_routing(result); } @@ -531,6 +699,9 @@ bool hal_nfc_secure_element_set_default_route(net_nfc_se_type_e switch_on, net_n { if (!g_nfc_funcs) return -ENOTSUP; + if (!g_nfc_funcs->secure_element_set_default_route) + return -ENOTSUP; + return g_nfc_funcs->secure_element_set_default_route(switch_on, switch_off, battery_off, result); } @@ -539,6 +710,9 @@ bool hal_nfc_secure_element_clear_aid_table(net_nfc_error_e * result) { if (!g_nfc_funcs) return -ENOTSUP; + if (!g_nfc_funcs->secure_element_clear_aid_table) + return -ENOTSUP; + return g_nfc_funcs->secure_element_clear_aid_table(result); } @@ -547,6 +721,9 @@ bool hal_nfc_secure_element_get_aid_table_size(int *AIDTableSize, net_nfc_error_ { if (!g_nfc_funcs) return -ENOTSUP; + if (!g_nfc_funcs->secure_element_get_aid_table_size) + return -ENOTSUP; + return g_nfc_funcs->secure_element_get_aid_table_size(AIDTableSize, result); } @@ -555,6 +732,9 @@ bool hal_nfc_secure_element_set_route_entry(net_nfc_se_entry_type_e type, net_nf { if (!g_nfc_funcs) return -ENOTSUP; + if (!g_nfc_funcs->secure_element_set_route_entry) + return -ENOTSUP; + return g_nfc_funcs->secure_element_set_route_entry(type, value, route, power, result); } @@ -563,6 +743,9 @@ bool hal_nfc_secure_element_clear_routing_entry(net_nfc_se_entry_type_e type, ne { if (!g_nfc_funcs) return -ENOTSUP; + if (!g_nfc_funcs->secure_element_clear_routing_entry) + return -ENOTSUP; + return g_nfc_funcs->secure_element_clear_routing_entry(type, result); } @@ -571,6 +754,9 @@ bool hal_nfc_secure_element_set_listen_tech_mask(net_nfc_se_tech_protocol_type_e { if (!g_nfc_funcs) return -ENOTSUP; + if (!g_nfc_funcs->secure_element_set_listen_tech_mask) + return -ENOTSUP; + return g_nfc_funcs->secure_element_set_listen_tech_mask(screen_state, result); } @@ -579,5 +765,8 @@ bool hal_nfc_set_screen_state(net_nfc_screen_state_type_e screen_state, net_nfc_ { if (!g_nfc_funcs) return -ENOTSUP; + if (!g_nfc_funcs->set_screen_state) + return -ENOTSUP; + return g_nfc_funcs->set_screen_state(screen_state, result); } |