Apply coding rule 47/149447/2 accepted/tizen/unified/20170914.065525 submit/tizen/20170914.012554
authorjh8801.jung <jh8801.jung@samsung.com>
Tue, 12 Sep 2017 08:34:20 +0000 (17:34 +0900)
committerjh8801.jung <jh8801.jung@samsung.com>
Thu, 14 Sep 2017 00:19:18 +0000 (09:19 +0900)
Signed-off-by: jh8801.jung <jh8801.jung@samsung.com>
Change-Id: Ia442951e3df2d7a610f0be007e81a682e8bdb04b

89 files changed:
packaging/nfc-manager.spec
src/commonlib/include/net_nfc_debug_internal.h
src/commonlib/include/net_nfc_oem_controller.h
src/commonlib/include/net_nfc_typedef.h
src/commonlib/include/net_nfc_typedef_internal.h
src/commonlib/include/net_nfc_util_defines.h
src/commonlib/include/net_nfc_util_gdbus_internal.h
src/commonlib/include/net_nfc_util_handover.h
src/commonlib/include/net_nfc_util_handover_internal.h
src/commonlib/include/net_nfc_util_hce.h
src/commonlib/include/net_nfc_util_internal.h
src/commonlib/include/net_nfc_util_ndef_message.h
src/commonlib/include/net_nfc_util_ndef_record.h
src/commonlib/include/net_nfc_util_openssl_internal.h
src/commonlib/include/net_nfc_util_sign_record.h
src/commonlib/net_nfc_util.c
src/commonlib/net_nfc_util_gdbus.c
src/commonlib/net_nfc_util_handover.c
src/commonlib/net_nfc_util_handover_bt.c
src/commonlib/net_nfc_util_handover_wfd.c
src/commonlib/net_nfc_util_handover_wps.c
src/commonlib/net_nfc_util_hce.c
src/commonlib/net_nfc_util_ndef_message.c
src/commonlib/net_nfc_util_ndef_record.c
src/commonlib/net_nfc_util_openssl.c
src/commonlib/net_nfc_util_sign_record.c
src/manager/addons/include/net_nfc_addon_hce.h
src/manager/addons/include/net_nfc_addon_hce_ndef.h
src/manager/addons/include/net_nfc_addons.h
src/manager/addons/net_nfc_addon_hce.c
src/manager/addons/net_nfc_addon_hce_ndef.c
src/manager/addons/net_nfc_addon_hce_ppse.c
src/manager/addons/net_nfc_addon_hce_tmoney.c
src/manager/addons/net_nfc_addons.c
src/manager/include/net_nfc_app_util_internal.h
src/manager/include/net_nfc_controller_internal.h
src/manager/include/net_nfc_manager.h
src/manager/include/net_nfc_manager_util_internal.h
src/manager/include/net_nfc_server.h
src/manager/include/net_nfc_server_addon.h
src/manager/include/net_nfc_server_common.h
src/manager/include/net_nfc_server_context_internal.h
src/manager/include/net_nfc_server_handover.h
src/manager/include/net_nfc_server_handover_internal.h
src/manager/include/net_nfc_server_hce.h
src/manager/include/net_nfc_server_hce_ipc.h
src/manager/include/net_nfc_server_llcp.h
src/manager/include/net_nfc_server_manager.h
src/manager/include/net_nfc_server_ndef.h
src/manager/include/net_nfc_server_p2p.h
src/manager/include/net_nfc_server_process_handover.h
src/manager/include/net_nfc_server_process_npp.h
src/manager/include/net_nfc_server_process_snep.h
src/manager/include/net_nfc_server_route_table.h
src/manager/include/net_nfc_server_se.h
src/manager/include/net_nfc_server_snep.h
src/manager/include/net_nfc_server_system_handler.h
src/manager/include/net_nfc_server_tag.h
src/manager/include/net_nfc_server_test.h
src/manager/include/net_nfc_server_transceive.h
src/manager/include/net_nfc_server_vconf.h
src/manager/net_nfc_app_util.c
src/manager/net_nfc_controller.c
src/manager/net_nfc_manager.c
src/manager/net_nfc_manager_util.c
src/manager/net_nfc_server.c
src/manager/net_nfc_server_common.c
src/manager/net_nfc_server_context.c
src/manager/net_nfc_server_handover.c
src/manager/net_nfc_server_handover_bt.c
src/manager/net_nfc_server_handover_wfd.c
src/manager/net_nfc_server_handover_wps.c
src/manager/net_nfc_server_hce.c
src/manager/net_nfc_server_hce_ipc.c
src/manager/net_nfc_server_llcp.c
src/manager/net_nfc_server_manager.c
src/manager/net_nfc_server_ndef.c
src/manager/net_nfc_server_p2p.c
src/manager/net_nfc_server_process_handover.c
src/manager/net_nfc_server_process_npp.c
src/manager/net_nfc_server_process_snep.c
src/manager/net_nfc_server_route_table.c
src/manager/net_nfc_server_se.c
src/manager/net_nfc_server_snep.c
src/manager/net_nfc_server_system_handler.c
src/manager/net_nfc_server_tag.c
src/manager/net_nfc_server_test.c
src/manager/net_nfc_server_transceive.c
src/manager/net_nfc_server_vconf.c

index 8dcbfad..1885e16 100755 (executable)
@@ -1,6 +1,6 @@
 Name:       nfc-manager
 Summary:    NFC framework manager
-Version:    0.1.168
+Version:    0.1.169
 Release:    0
 Group:      Network & Connectivity/NFC
 License:    Flora-1.1
index e3aca0f..804eb2a 100755 (executable)
@@ -54,167 +54,155 @@ const char *net_nfc_get_log_tag();
                int i = 0, offset = 0; \
                char temp_buffer[4096] = { 0, }; \
                NFC_LOGD(LOG_COLOR_BLUE "BUFFER [%d] = {" LOG_COLOR_END, length); \
-               for(; i < length && offset < sizeof(temp_buffer); i++) \
-               { \
+               for (; i < length && offset < sizeof(temp_buffer); i++) { \
                        offset += snprintf(temp_buffer + offset, sizeof(temp_buffer) - offset, " %02x", buffer[i]); \
-                       if (i % 16 == 15) \
-                       { \
+                       if (i % 16 == 15) { \
                                NFC_LOGD(LOG_COLOR_BLUE "\t%s" LOG_COLOR_END, temp_buffer); \
                                offset = 0; \
                        } \
                } \
                NFC_LOGD(LOG_COLOR_BLUE "\t%s" LOG_COLOR_END, temp_buffer); \
                NFC_LOGD(LOG_COLOR_BLUE "}" LOG_COLOR_END); \
-       } while(0)
+       } while (0)
 
 #define DEBUG_MSG_PRINT_BUFFER_CHAR(buffer, length) \
        do { \
                int i = 0, offset = 0; \
                char temp_buffer[4096] = { 0, }; \
                NFC_LOGD(LOG_COLOR_BLUE "BUFFER [%d] = {" LOG_COLOR_END, length); \
-               for(; i < length && offset < sizeof(temp_buffer); i++) \
-               { \
+               for (; i < length && offset < sizeof(temp_buffer); i++) { \
                        offset += snprintf(temp_buffer + offset, sizeof(temp_buffer) - offset, " %c", buffer[i]); \
-                       if (i % 16 == 15) \
-                       { \
+                       if (i % 16 == 15) { \
                                NFC_LOGD(LOG_COLOR_BLUE "\t%s" LOG_COLOR_END, temp_buffer); \
                                offset = 0; \
                        } \
                } \
                NFC_LOGD(LOG_COLOR_BLUE "\t%s" LOG_COLOR_END, temp_buffer); \
                NFC_LOGD(LOG_COLOR_BLUE "}" LOG_COLOR_END); \
-       } while(0)
+       } while (0)
 
 #define DEBUG_MSG(format, args...) \
        do { \
                NFC_LOGD(format, ##args); \
-               if (nfc_log_file) \
-               { \
+               if (nfc_log_file) { \
                        struct tm local_tm; \
                        char timeBuf[50]; \
-                       time_t rawtime;   time (&rawtime); \
+                       time_t rawtime;   time(&rawtime); \
                        localtime_r(&rawtime, &local_tm); \
                        strftime(timeBuf, sizeof(timeBuf), "%m-%d %H:%M:%S", &local_tm); \
-                       fprintf(nfc_log_file, "\n%s",timeBuf); \
-                       fprintf(nfc_log_file, "[D][%s:%d] "format"",__func__, __LINE__,  ##args); \
+                       fprintf(nfc_log_file, "\n%s", timeBuf); \
+                       fprintf(nfc_log_file, "[D][%s:%d] "format"", __func__, __LINE__,  ##args); \
                        fflush(nfc_log_file);\
-               }\
-       } while(0)
+               } \
+       } while (0)
 
 #define DEBUG_ADDON_MSG(format, args...) \
        do { \
                NFC_LOGD(LOG_COLOR_BLUE format LOG_COLOR_END, ##args); \
-               if (nfc_log_file) \
-               { \
+               if (nfc_log_file) { \
                        struct tm local_tm; \
                        char timeBuf[50]; \
-                       time_t rawtime;   time (&rawtime); \
+                       time_t rawtime;   time(&rawtime); \
                        localtime_r(&rawtime, &local_tm); \
                        strftime(timeBuf, sizeof(timeBuf), "%m-%d %H:%M:%S", &local_tm); \
-                       fprintf(nfc_log_file, "\n%s",timeBuf); \
-                       fprintf(nfc_log_file, "[D][%s:%d] "format"",__func__, __LINE__,  ##args); \
+                       fprintf(nfc_log_file, "\n%s", timeBuf); \
+                       fprintf(nfc_log_file, "[D][%s:%d] "format"", __func__, __LINE__,  ##args); \
                        fflush(nfc_log_file);\
-               }\
-       } while(0)
+               } \
+       } while (0)
 
 #define DEBUG_SERVER_MSG(format, args...) \
-       do {\
+       do { \
                NFC_LOGD(LOG_COLOR_PURPLE format LOG_COLOR_END, ##args);\
-               if (nfc_log_file) \
-               { \
+               if (nfc_log_file) { \
                        struct tm local_tm; \
                        char timeBuf[50]; \
-                       time_t rawtime;   time (&rawtime); \
+                       time_t rawtime;   time(&rawtime); \
                        localtime_r(&rawtime, &local_tm); \
                        strftime(timeBuf, sizeof(timeBuf), "%m-%d %H:%M:%S", &local_tm); \
-                       fprintf(nfc_log_file, "\n%s",timeBuf); \
-                       fprintf(nfc_log_file, "[S][%s:%d] "format"",__func__, __LINE__,  ##args); \
+                       fprintf(nfc_log_file, "\n%s", timeBuf); \
+                       fprintf(nfc_log_file, "[S][%s:%d] "format"", __func__, __LINE__,  ##args); \
                        fflush(nfc_log_file);\
-               }\
-       } while(0)
+               } \
+       } while (0)
 
 #define DEBUG_CLIENT_MSG(format, args...) \
-       do {\
+       do { \
                NFC_LOGD(LOG_COLOR_CYAN format LOG_COLOR_END, ##args); \
-               if (nfc_log_file) \
-               { \
+               if (nfc_log_file) { \
                        struct tm local_tm; \
                        char timeBuf[50]; \
-                       time_t rawtime;   time (&rawtime); \
+                       time_t rawtime;   time(&rawtime); \
                        localtime_r(&rawtime, &local_tm); \
                        strftime(timeBuf, sizeof(timeBuf), "%m-%d %H:%M:%S", &local_tm); \
-                       fprintf(nfc_log_file, "\n%s",timeBuf); \
-                       fprintf(nfc_log_file, "[C][%s:%d] "format"",__func__, __LINE__,  ##args); \
+                       fprintf(nfc_log_file, "\n%s", timeBuf); \
+                       fprintf(nfc_log_file, "[C][%s:%d] "format"", __func__, __LINE__,  ##args); \
                        fflush(nfc_log_file);\
-               }\
-       } while(0)
+               } \
+       } while (0)
 
 #define DEBUG_ERR_MSG(format, args...) \
-       do {\
+       do { \
                NFC_LOGE(LOG_COLOR_RED format LOG_COLOR_END, ##args);\
-               if (nfc_log_file) \
-               { \
+               if (nfc_log_file) { \
                        struct tm local_tm; \
                        char timeBuf[50]; \
-                       time_t rawtime;   time (&rawtime); \
+                       time_t rawtime;   time(&rawtime); \
                        localtime_r(&rawtime, &local_tm); \
                        strftime(timeBuf, sizeof(timeBuf), "%m-%d %H:%M:%S", &local_tm); \
-                       fprintf(nfc_log_file, "\n%s",timeBuf); \
-                       fprintf(nfc_log_file, "[E][%s:%d] "format"",__func__, __LINE__,  ##args); \
+                       fprintf(nfc_log_file, "\n%s", timeBuf); \
+                       fprintf(nfc_log_file, "[E][%s:%d] "format"", __func__, __LINE__,  ##args); \
                        fflush(nfc_log_file);\
-               }\
-       } while(0)
+               } \
+       } while (0)
 
 #define INFO_MSG(format, args...) \
-       do {\
+       do { \
                NFC_LOGI(LOG_COLOR_GREEN format LOG_COLOR_END, ##args);\
-               if (nfc_log_file) \
-               { \
+               if (nfc_log_file) { \
                        struct tm local_tm; \
                        char timeBuf[50]; \
-                       time_t rawtime;   time (&rawtime); \
+                       time_t rawtime;   time(&rawtime); \
                        localtime_r(&rawtime, &local_tm); \
                        strftime(timeBuf, sizeof(timeBuf), "%m-%d %H:%M:%S", &local_tm); \
-                       fprintf(nfc_log_file, "\n%s",timeBuf); \
-                       fprintf(nfc_log_file, "[I][%s:%d] "format"",__func__, __LINE__,  ##args); \
+                       fprintf(nfc_log_file, "\n%s", timeBuf); \
+                       fprintf(nfc_log_file, "[I][%s:%d] "format"", __func__, __LINE__,  ##args); \
                        fflush(nfc_log_file);\
-               }\
-       } while(0)
+               } \
+       } while (0)
 
 #define WARN_MSG(format, args...) \
-       do {\
+       do { \
                NFC_LOGW(LOG_COLOR_BROWN format LOG_COLOR_END, ##args);\
-               if (nfc_log_file) \
-               { \
+               if (nfc_log_file) { \
                        struct tm local_tm; \
                        char timeBuf[50]; \
-                       time_t rawtime;   time (&rawtime); \
+                       time_t rawtime;   time(&rawtime); \
                        localtime_r(&rawtime, &local_tm); \
                        strftime(timeBuf, sizeof(timeBuf), "%m-%d %H:%M:%S", &local_tm); \
-                       fprintf(nfc_log_file, "\n%s",timeBuf); \
-                       fprintf(nfc_log_file, "[W][%s:%d] "format"",__func__, __LINE__,  ##args); \
+                       fprintf(nfc_log_file, "\n%s", timeBuf); \
+                       fprintf(nfc_log_file, "[W][%s:%d] "format"", __func__, __LINE__,  ##args); \
                        fflush(nfc_log_file);\
-               }\
-       } while(0)
+               } \
+       } while (0)
 
 #define SECURE_MSG(format, args...) \
-       do {\
+       do { \
                NFC_LOGD(format, ##args);\
-               if (nfc_log_file) \
-               { \
+               if (nfc_log_file) { \
                        struct tm local_tm; \
                        char timeBuf[50]; \
-                       time_t rawtime;   time (&rawtime); \
+                       time_t rawtime;   time(&rawtime); \
                        localtime_r(&rawtime, &local_tm); \
                        strftime(timeBuf, sizeof(timeBuf), "%m-%d %H:%M:%S", &local_tm); \
-                       fprintf(nfc_log_file, "\n%s",timeBuf); \
-                       fprintf(nfc_log_file, "[W][%s:%d] "format"",__func__, __LINE__,  ##args); \
+                       fprintf(nfc_log_file, "\n%s", timeBuf); \
+                       fprintf(nfc_log_file, "[W][%s:%d] "format"", __func__, __LINE__,  ##args); \
                        fflush(nfc_log_file);\
-               }\
-       } while(0)
+               } \
+       } while (0)
 
 #define PROFILING(str) \
-       do{ \
+       do { \
                struct timeval mytime;\
                char buf[128]; = {0};\
                memset(buf, 0x00, 128);\
@@ -223,6 +211,6 @@ const char *net_nfc_get_log_tag();
                sprintf(time_string, "%d.%4d", mytime.tv_sec, mytime.tv_usec);\
                NFC_LOGD(str); \
                NFC_LOGD("\t time = [%s]", time_string);\
-       } while(0)
+       } while (0)
 
-#endif //__NET_NFC_DEBUG_INTERNAL_H__
+#endif                                                 //__NET_NFC_DEBUG_INTERNAL_H__
index fda0b8c..b91abda 100755 (executable)
 
 #include "net_nfc_typedef_internal.h"
 
-typedef bool (*net_nfc_oem_controller_init)(net_nfc_error_e *result);
-typedef bool (*net_nfc_oem_controller_deinit)(void);
-typedef bool (*net_nfc_oem_controller_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);
-typedef bool (*net_nfc_oem_controller_unregister_listener)(void);
-typedef bool (*net_nfc_oem_controller_support_nfc)(net_nfc_error_e *result);
-typedef bool (*net_nfc_oem_controller_get_firmware_version)(data_s **data, net_nfc_error_e *result);
-typedef bool (*net_nfc_oem_controller_check_firmware_version)(net_nfc_error_e *result);
-typedef bool (*net_nfc_oem_controller_update_firmware)(net_nfc_error_e *result);
-typedef bool (*net_nfc_oem_controller_get_stack_information)(net_nfc_stack_information_s *stack_info, net_nfc_error_e *result);
-typedef bool (*net_nfc_oem_controller_configure_discovery)(net_nfc_discovery_mode_e mode, net_nfc_event_filter_e config, net_nfc_error_e *result);
-typedef bool (*net_nfc_oem_controller_exception_handler)(void);
+typedef bool(*net_nfc_oem_controller_init) (net_nfc_error_e * result);
+typedef bool(*net_nfc_oem_controller_deinit) (void);
+typedef bool(*net_nfc_oem_controller_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);
+typedef bool(*net_nfc_oem_controller_unregister_listener) (void);
+typedef bool(*net_nfc_oem_controller_support_nfc) (net_nfc_error_e * result);
+typedef bool(*net_nfc_oem_controller_get_firmware_version) (data_s ** data, net_nfc_error_e * result);
+typedef bool(*net_nfc_oem_controller_check_firmware_version) (net_nfc_error_e * result);
+typedef bool(*net_nfc_oem_controller_update_firmware) (net_nfc_error_e * result);
+typedef bool(*net_nfc_oem_controller_get_stack_information) (net_nfc_stack_information_s * stack_info, net_nfc_error_e * result);
+typedef bool(*net_nfc_oem_controller_configure_discovery) (net_nfc_discovery_mode_e mode, net_nfc_event_filter_e config, net_nfc_error_e * result);
+typedef bool(*net_nfc_oem_controller_exception_handler) (void);
 
 /* tag api */
-typedef bool (*net_nfc_oem_controller_connect)(net_nfc_target_handle_s *handle, net_nfc_error_e *result);
-typedef bool (*net_nfc_oem_controller_disconnect)(net_nfc_target_handle_s *handle, net_nfc_error_e *result);
-typedef bool (*net_nfc_oem_controller_check_target_presence)(net_nfc_target_handle_s *handle, net_nfc_error_e *result);
-typedef bool (*net_nfc_oem_controller_check_ndef)(net_nfc_target_handle_s *handle, uint8_t *ndef_card_state, int *max_data_size, int *real_data_size, net_nfc_error_e *result);
-typedef bool (*net_nfc_oem_controller_read_ndef)(net_nfc_target_handle_s *handle, data_s **data, net_nfc_error_e *result);
-typedef bool (*net_nfc_oem_controller_write_ndef)(net_nfc_target_handle_s *handle, data_s *data, net_nfc_error_e *result);
-typedef bool (*net_nfc_oem_controller_make_read_only_ndef)(net_nfc_target_handle_s *handle, net_nfc_error_e *result);
-typedef bool (*net_nfc_oem_controller_format_ndef)(net_nfc_target_handle_s *handle, data_s *secure_key, net_nfc_error_e *result);
-typedef bool (*net_nfc_oem_controller_transceive)(net_nfc_target_handle_s *handle, net_nfc_transceive_info_s *info, data_s **data, net_nfc_error_e *result);
-typedef bool (*net_nfc_oem_controller_is_ready)(net_nfc_error_e *result);
+typedef bool(*net_nfc_oem_controller_connect) (net_nfc_target_handle_s * handle, net_nfc_error_e * result);
+typedef bool(*net_nfc_oem_controller_disconnect) (net_nfc_target_handle_s * handle, net_nfc_error_e * result);
+typedef bool(*net_nfc_oem_controller_check_target_presence) (net_nfc_target_handle_s * handle, net_nfc_error_e * result);
+typedef bool(*net_nfc_oem_controller_check_ndef) (net_nfc_target_handle_s * handle, uint8_t * ndef_card_state, int *max_data_size, int *real_data_size, net_nfc_error_e * result);
+typedef bool(*net_nfc_oem_controller_read_ndef) (net_nfc_target_handle_s * handle, data_s ** data, net_nfc_error_e * result);
+typedef bool(*net_nfc_oem_controller_write_ndef) (net_nfc_target_handle_s * handle, data_s * data, net_nfc_error_e * result);
+typedef bool(*net_nfc_oem_controller_make_read_only_ndef) (net_nfc_target_handle_s * handle, net_nfc_error_e * result);
+typedef bool(*net_nfc_oem_controller_format_ndef) (net_nfc_target_handle_s * handle, data_s * secure_key, net_nfc_error_e * result);
+typedef bool(*net_nfc_oem_controller_transceive) (net_nfc_target_handle_s * handle, net_nfc_transceive_info_s * info, data_s ** data, net_nfc_error_e * result);
+typedef bool(*net_nfc_oem_controller_is_ready) (net_nfc_error_e * result);
 
 /* llcp api */
-typedef bool (*net_nfc_oem_controller_llcp_config)(net_nfc_llcp_config_info_s *config, net_nfc_error_e *result);
-typedef bool (*net_nfc_oem_controller_llcp_check_llcp)(net_nfc_target_handle_s *handle, net_nfc_error_e *result);
-typedef bool (*net_nfc_oem_controller_llcp_activate_llcp)(net_nfc_target_handle_s *handle, net_nfc_error_e *result);
-typedef bool (*net_nfc_oem_controller_llcp_create_socket)(net_nfc_llcp_socket_t *socket, net_nfc_socket_type_e socketType, uint16_t miu, uint8_t rw, net_nfc_error_e *result, void *user_param);
-typedef bool (*net_nfc_oem_controller_llcp_bind)(net_nfc_llcp_socket_t socket, uint8_t service_access_point, net_nfc_error_e *result);
-typedef bool (*net_nfc_oem_controller_llcp_listen)(net_nfc_target_handle_s *handle, uint8_t *service_access_name, net_nfc_llcp_socket_t socket, net_nfc_error_e *result, void *user_param);
-typedef bool (*net_nfc_oem_controller_llcp_accept)(net_nfc_llcp_socket_t socket, net_nfc_error_e *result, void *user_param);
-typedef bool (*net_nfc_oem_controller_llcp_connect_by_url)(net_nfc_target_handle_s *handle, net_nfc_llcp_socket_t socket, uint8_t *service_access_name, net_nfc_error_e *result, void *user_param);
-typedef bool (*net_nfc_oem_controller_llcp_connect)(net_nfc_target_handle_s *handle, net_nfc_llcp_socket_t socket, uint8_t service_access_point, net_nfc_error_e *result, void *user_param);
-typedef bool (*net_nfc_oem_controller_llcp_disconnect)(net_nfc_target_handle_s *handle, net_nfc_llcp_socket_t socket, net_nfc_error_e *result, void *user_param);
-typedef bool (*net_nfc_oem_controller_llcp_socket_close)(net_nfc_llcp_socket_t socket, net_nfc_error_e *result);
-typedef bool (*net_nfc_oem_controller_llcp_recv)(net_nfc_target_handle_s *handle, net_nfc_llcp_socket_t socket, data_s *data, net_nfc_error_e *result, void *user_param);
-typedef bool (*net_nfc_oem_controller_llcp_send)(net_nfc_target_handle_s *handle, net_nfc_llcp_socket_t socket, data_s *data, net_nfc_error_e *result, void *user_param);
-typedef bool (*net_nfc_oem_controller_llcp_recv_from)(net_nfc_target_handle_s *handle, net_nfc_llcp_socket_t socket, data_s *data, net_nfc_error_e *result, void *user_param);
-typedef bool (*net_nfc_oem_controller_llcp_send_to)(net_nfc_target_handle_s *handle, net_nfc_llcp_socket_t socket, data_s *data, uint8_t service_access_point, net_nfc_error_e *result, void *user_param);
-typedef bool (*net_nfc_oem_controller_llcp_reject)(net_nfc_target_handle_s *handle, net_nfc_llcp_socket_t socket, net_nfc_error_e *result);
-typedef bool (*net_nfc_oem_controller_llcp_get_remote_config)(net_nfc_target_handle_s *handle, net_nfc_llcp_config_info_s *config, net_nfc_error_e *result);
-typedef bool (*net_nfc_oem_controller_llcp_get_remote_socket_info)(net_nfc_target_handle_s *handle, net_nfc_llcp_socket_t socket, net_nfc_llcp_socket_option_s *option, net_nfc_error_e *result);
+typedef bool(*net_nfc_oem_controller_llcp_config) (net_nfc_llcp_config_info_s * config, net_nfc_error_e * result);
+typedef bool(*net_nfc_oem_controller_llcp_check_llcp) (net_nfc_target_handle_s * handle, net_nfc_error_e * result);
+typedef bool(*net_nfc_oem_controller_llcp_activate_llcp) (net_nfc_target_handle_s * handle, net_nfc_error_e * result);
+typedef bool(*net_nfc_oem_controller_llcp_create_socket) (net_nfc_llcp_socket_t * socket, net_nfc_socket_type_e socketType, uint16_t miu, uint8_t rw, net_nfc_error_e * result, void *user_param);
+typedef bool(*net_nfc_oem_controller_llcp_bind) (net_nfc_llcp_socket_t socket, uint8_t service_access_point, net_nfc_error_e * result);
+typedef bool(*net_nfc_oem_controller_llcp_listen) (net_nfc_target_handle_s * handle, uint8_t * service_access_name, net_nfc_llcp_socket_t socket, net_nfc_error_e * result, void *user_param);
+typedef bool(*net_nfc_oem_controller_llcp_accept) (net_nfc_llcp_socket_t socket, net_nfc_error_e * result, void *user_param);
+typedef bool(*net_nfc_oem_controller_llcp_connect_by_url) (net_nfc_target_handle_s * handle, net_nfc_llcp_socket_t socket, uint8_t * service_access_name, net_nfc_error_e * result, void *user_param);
+typedef bool(*net_nfc_oem_controller_llcp_connect) (net_nfc_target_handle_s * handle, net_nfc_llcp_socket_t socket, uint8_t service_access_point, net_nfc_error_e * result, void *user_param);
+typedef bool(*net_nfc_oem_controller_llcp_disconnect) (net_nfc_target_handle_s * handle, net_nfc_llcp_socket_t socket, net_nfc_error_e * result, void *user_param);
+typedef bool(*net_nfc_oem_controller_llcp_socket_close) (net_nfc_llcp_socket_t socket, net_nfc_error_e * result);
+typedef bool(*net_nfc_oem_controller_llcp_recv) (net_nfc_target_handle_s * handle, net_nfc_llcp_socket_t socket, data_s * data, net_nfc_error_e * result, void *user_param);
+typedef bool(*net_nfc_oem_controller_llcp_send) (net_nfc_target_handle_s * handle, net_nfc_llcp_socket_t socket, data_s * data, net_nfc_error_e * result, void *user_param);
+typedef bool(*net_nfc_oem_controller_llcp_recv_from) (net_nfc_target_handle_s * handle, net_nfc_llcp_socket_t socket, data_s * data, net_nfc_error_e * result, void *user_param);
+typedef bool(*net_nfc_oem_controller_llcp_send_to) (net_nfc_target_handle_s * handle, net_nfc_llcp_socket_t socket, data_s * data, uint8_t service_access_point, net_nfc_error_e * result, void *user_param);
+typedef bool(*net_nfc_oem_controller_llcp_reject) (net_nfc_target_handle_s * handle, net_nfc_llcp_socket_t socket, net_nfc_error_e * result);
+typedef bool(*net_nfc_oem_controller_llcp_get_remote_config) (net_nfc_target_handle_s * handle, net_nfc_llcp_config_info_s * config, net_nfc_error_e * result);
+typedef bool(*net_nfc_oem_controller_llcp_get_remote_socket_info) (net_nfc_target_handle_s * handle, net_nfc_llcp_socket_t socket, net_nfc_llcp_socket_option_s * option, net_nfc_error_e * result);
 
 /* secure element api */
-typedef bool (*net_nfc_oem_controller_get_secure_element_list)(net_nfc_secure_element_info_s *list, int* count, net_nfc_error_e *result);
-typedef bool (*net_nfc_oem_controller_set_secure_element_mode)(net_nfc_secure_element_type_e element_type, net_nfc_secure_element_mode_e mode, net_nfc_error_e *result);
-typedef bool (*net_nfc_oem_controller_secure_element_open)(net_nfc_secure_element_type_e element_type, net_nfc_target_handle_s **handle, net_nfc_error_e *result);
-typedef bool (*net_nfc_oem_controller_secure_element_get_atr)(net_nfc_target_handle_s *handle, data_s **atr, net_nfc_error_e *result);
-typedef bool (*net_nfc_oem_controller_secure_element_send_apdu)(net_nfc_target_handle_s *handle, data_s *command, data_s **response, net_nfc_error_e *result);
-typedef bool (*net_nfc_oem_controller_secure_element_close)(net_nfc_target_handle_s *handle, net_nfc_error_e *result);
+typedef bool(*net_nfc_oem_controller_get_secure_element_list) (net_nfc_secure_element_info_s * list, int *count, net_nfc_error_e * result);
+typedef bool(*net_nfc_oem_controller_set_secure_element_mode) (net_nfc_secure_element_type_e element_type, net_nfc_secure_element_mode_e mode, net_nfc_error_e * result);
+typedef bool(*net_nfc_oem_controller_secure_element_open) (net_nfc_secure_element_type_e element_type, net_nfc_target_handle_s ** handle, net_nfc_error_e * result);
+typedef bool(*net_nfc_oem_controller_secure_element_get_atr) (net_nfc_target_handle_s * handle, data_s ** atr, net_nfc_error_e * result);
+typedef bool(*net_nfc_oem_controller_secure_element_send_apdu) (net_nfc_target_handle_s * handle, data_s * command, data_s ** response, net_nfc_error_e * result);
+typedef bool(*net_nfc_oem_controller_secure_element_close) (net_nfc_target_handle_s * handle, net_nfc_error_e * result);
 
 /* test api */
-typedef bool (*net_nfc_oem_controller_sim_test)(net_nfc_error_e *result);
-typedef bool (*net_nfc_oem_controller_prbs_test)(net_nfc_error_e *result , int tech , int rate);
-typedef bool (*net_nfc_oem_controller_test_mode_on)(net_nfc_error_e *result);
-typedef bool (*net_nfc_oem_controller_test_mode_off)(net_nfc_error_e *result);
-typedef bool (*net_nfc_oem_controller_eedata_register_set)(net_nfc_error_e *result , uint32_t mode , uint32_t reg_id , data_s *data);
-typedef bool (*net_nfc_oem_controller_ese_test)(net_nfc_error_e *result);
-typedef bool (*net_nfc_oem_controller_test_set_se_tech_type)(net_nfc_error_e *result, net_nfc_se_type_e type, uint32_t tech);
+typedef bool(*net_nfc_oem_controller_sim_test) (net_nfc_error_e * result);
+typedef bool(*net_nfc_oem_controller_prbs_test) (net_nfc_error_e * result, int tech, int rate);
+typedef bool(*net_nfc_oem_controller_test_mode_on) (net_nfc_error_e * result);
+typedef bool(*net_nfc_oem_controller_test_mode_off) (net_nfc_error_e * result);
+typedef bool(*net_nfc_oem_controller_eedata_register_set) (net_nfc_error_e * result, uint32_t mode, uint32_t reg_id, data_s * data);
+typedef bool(*net_nfc_oem_controller_ese_test) (net_nfc_error_e * result);
+typedef bool(*net_nfc_oem_controller_test_set_se_tech_type) (net_nfc_error_e * result, net_nfc_se_type_e type, uint32_t tech);
 
 /* hce api*/
-typedef bool (*net_nfc_oem_controller_hce_response_apdu)(net_nfc_target_handle_s *handle, data_s *command, net_nfc_error_e *result);
+typedef bool(*net_nfc_oem_controller_hce_response_apdu) (net_nfc_target_handle_s * handle, data_s * command, net_nfc_error_e * result);
 
-typedef bool (*net_nfc_oem_controller_secure_element_route_aid)(data_s *aid, net_nfc_se_type_e se_type,
-       int power, net_nfc_error_e *result);
-typedef bool (*net_nfc_oem_controller_secure_element_unroute_aid)(data_s *aid, net_nfc_error_e *result);
-typedef bool (*net_nfc_oem_controller_secure_element_commit_routing)(net_nfc_error_e *result);
+typedef bool(*net_nfc_oem_controller_secure_element_route_aid) (data_s * aid, net_nfc_se_type_e se_type, int power, net_nfc_error_e * result);
+typedef bool(*net_nfc_oem_controller_secure_element_unroute_aid) (data_s * aid, net_nfc_error_e * result);
+typedef bool(*net_nfc_oem_controller_secure_element_commit_routing) (net_nfc_error_e * result);
 
-typedef bool (*net_nfc_oem_controller_secure_element_set_default_route)(
-       net_nfc_se_type_e switch_on,
-       net_nfc_se_type_e switch_off,
-       net_nfc_se_type_e battery_off, net_nfc_error_e *result);
+typedef bool(*net_nfc_oem_controller_secure_element_set_default_route) (net_nfc_se_type_e switch_on, net_nfc_se_type_e switch_off, net_nfc_se_type_e battery_off, net_nfc_error_e * result);
 
-typedef bool (*net_nfc_oem_controller_secure_element_clear_aid_table)(net_nfc_error_e *result);
-typedef bool (*net_nfc_oem_controller_secure_element_get_aid_tablesize)(int *AIDTableSize,
-       net_nfc_error_e *result);
+typedef bool(*net_nfc_oem_controller_secure_element_clear_aid_table) (net_nfc_error_e * result);
+typedef bool(*net_nfc_oem_controller_secure_element_get_aid_tablesize) (int *AIDTableSize, net_nfc_error_e * result);
 
-typedef bool (*net_nfc_oem_controller_secure_element_set_route_entry)
-       (net_nfc_se_entry_type_e type, net_nfc_se_tech_protocol_type_e value,
-       net_nfc_se_type_e route, int power, net_nfc_error_e *result);
+typedef bool(*net_nfc_oem_controller_secure_element_set_route_entry)
+(net_nfc_se_entry_type_e type, net_nfc_se_tech_protocol_type_e value, net_nfc_se_type_e route, int power, net_nfc_error_e * result);
 
-typedef bool (*net_nfc_oem_controller_secure_element_clear_routing_entry)
-       (net_nfc_se_entry_type_e type, net_nfc_error_e *result);
+typedef bool(*net_nfc_oem_controller_secure_element_clear_routing_entry)
+(net_nfc_se_entry_type_e type, net_nfc_error_e * result);
 
-typedef bool (*net_nfc_oem_controller_secure_element_set_listen_tech_mask)
-       (net_nfc_se_tech_protocol_type_e screen_state, net_nfc_error_e *result);
+typedef bool(*net_nfc_oem_controller_secure_element_set_listen_tech_mask)
+(net_nfc_se_tech_protocol_type_e screen_state, net_nfc_error_e * result);
 
+typedef bool(*net_nfc_oem_controller_set_screen_state)
+(net_nfc_screen_state_type_e screen_state, net_nfc_error_e * result);
 
-typedef bool (*net_nfc_oem_controller_set_screen_state)
-       (net_nfc_screen_state_type_e screen_state, net_nfc_error_e *result);
-
-
-
-typedef struct _net_nfc_oem_interface_s
-{
+typedef struct _net_nfc_oem_interface_s {
        net_nfc_oem_controller_init init;
        net_nfc_oem_controller_deinit deinit;
        net_nfc_oem_controller_register_listener register_listener;
@@ -181,7 +171,6 @@ typedef struct _net_nfc_oem_interface_s
        net_nfc_oem_controller_secure_element_clear_aid_table clear_aid_table;
        net_nfc_oem_controller_secure_element_get_aid_tablesize get_aid_tablesize;
 
-
        net_nfc_oem_controller_secure_element_set_route_entry set_routing_entry;
        net_nfc_oem_controller_secure_element_clear_routing_entry clear_routing_entry;
        net_nfc_oem_controller_secure_element_set_listen_tech_mask set_listen_tech_mask;
@@ -189,4 +178,4 @@ typedef struct _net_nfc_oem_interface_s
        net_nfc_oem_controller_set_screen_state set_screen_state;
 } net_nfc_oem_interface_s;
 
-#endif //__NET_NFC_OEM_CONTROLLER_H__
+#endif                                                 //__NET_NFC_OEM_CONTROLLER_H__
index 661ec4d..0ad8874 100755 (executable)
@@ -38,7 +38,6 @@
  @defgroup NET_NFC_MANAGER_APDU Internal APDU APIs
  @defgroup NET_NFC_MANAGER_EXCHANGE App Exchanger APIs
 
-
  @addtogroup NET_NFC_MANAGER
  @{
  <P> "NFC Manager" is the framework that provide NFC APIs,
 #include <stdbool.h>
 
 #ifdef __cplusplus
-extern "C"
-{
+extern "C" {
 #endif
 
 /**
  net_nfc_error_e is enum type that returned from each functions
  it mostly contains the error codes and it may contains status codes.
  */
-typedef enum
-{
-/*000*/NET_NFC_OK = 0, /**< Status is OK       */
-/*999*/NET_NFC_UNKNOWN_ERROR = -999, /**< Unknown error */
-/*998*/NET_NFC_ALLOC_FAIL, /**< Memory allocation is failed */
-/*997*/NET_NFC_THREAD_CREATE_FAIL, /**< Thread creation is failed */
-/*996*/NET_NFC_INVALID_STATE, /**< State of NFC-Manager or nfc-stack is not normal */
-/*995*/NET_NFC_IPC_FAIL, /**< Communication with ipc is failed. (from client to server)*/
-/*994*/NET_NFC_OUT_OF_BOUND, /**< Index is out of bound */
-/*993*/NET_NFC_NULL_PARAMETER, /**< Unexpected NULL parameter is received */
-/*992*/NET_NFC_BUFFER_TOO_SMALL, /**< Requested buffer is too small to store data, this error should be received */
-/*991*/NET_NFC_ALREADY_INITIALIZED, /**< You tried to initialized again without de-init */
-/*990*/NET_NFC_COMMUNICATE_WITH_CONTROLLER_FAILED, /**< Communication with Controller Chipset is failed this is Fatal Error */
-/*989*/NET_NFC_RF_TIMEOUT, /**< Timeout is raised while communicate with a tag */
-/*988*/NET_NFC_RF_ERROR, /**< Unexpected package is received from target, you may receive this error comes by the low level RF communication fault*/
-/*987*/NET_NFC_NOT_INITIALIZED, /**< Application tries to request without initialization */
-/*986*/NET_NFC_NOT_SUPPORTED, /**< Request information or command is not supported in current connected target */
-/*985*/NET_NFC_ALREADY_REGISTERED, /**< Requested SAP number is already used by other socket or data is already appended or registered */
-/*984*/NET_NFC_NOT_ALLOWED_OPERATION, /**< Requested Operation is not allowed in the situation in critical time (such as write data on target)*/
-/*983*/NET_NFC_BUSY, /**< Previous operation is not finished. don't worry to get this message, most of request will be executed in the serial queue */
-/*982*/NET_NFC_INVALID_HANDLE, /**< Requested Device in not valid device */
-/*981*/NET_NFC_TAG_READ_FAILED, /**< Tag reading is failed because of unexpected chunk data is received or error ack is received */
-/*980*/NET_NFC_TAG_WRITE_FAILED, /**< When you try to write on read only tag or error ack is received */
-/*979*/NET_NFC_NO_NDEF_SUPPORT, /**< Tag is not supported NDEF format for tag is not formatted for NDEF */
-/*978*/NET_NFC_NO_NDEF_MESSAGE, /**< No data is received after NDEF reading */
-/*977*/NET_NFC_INVALID_FORMAT, /**< Received data is not readable or it has illegal values or format */
-/*976*/NET_NFC_INSUFFICIENT_STORAGE, /**< The connected tag does not have enough information */
-/*975*/NET_NFC_OPERATION_FAIL, /**< The remote target returned error while doing a operation*/
-/*974*/NET_NFC_NOT_CONNECTED, /**< remote is not connected correctly. This can be happened when the RF does not have enough strength */
-/*973*/NET_NFC_NO_DATA_FOUND, /**< Requested data is not found in the list or properties */
-/*972*/NET_NFC_SECURITY_FAIL, /**< Authentication is failed while communication with nfc-manager server */
-/*971*/NET_NFC_TARGET_IS_MOVED_AWAY, /**< Target is lost while doing a operation */
-/*970*/NET_NFC_TAG_IS_ALREADY_FORMATTED, /** Target is already formatted */
-/*969*/NET_NFC_NOT_REGISTERED, /**< removal is requested but requested data is not registered */
-/*968*/NET_NFC_INVALID_PARAM, /**< removal is requested but requested data is not registered */
-/*967*/NET_NFC_PERMISSION_DENIED, /**< privilege check is failed */
-/*966*/NET_NFC_NOT_ACTIVATED, /**< Application tries to request without activation */
-/*965*/NET_NFC_DATA_CONFLICTED, /**< Data is conflicted with another one */
-
-/*499*/NET_NFC_NDEF_TYPE_LENGTH_IS_NOT_OK = -499, /**< Illegal ndef record type length */
-/*498*/NET_NFC_NDEF_PAYLOAD_LENGTH_IS_NOT_OK, /**< Illegal ndef record payload length */
-/*497*/NET_NFC_NDEF_ID_LENGTH_IS_NOT_OK, /**< Illegal ndef record id length */
-/*496*/NET_NFC_NDEF_RECORD_IS_NOT_EXPECTED_TYPE, /**< Parameter record is not expected record. for example, try to URI from text record */
-/*495*/NET_NFC_NDEF_BUF_END_WITHOUT_ME, /**< NDEF messages is terminated without ME flag */
-/*494*/NET_NFC_DEVICE_DOES_NOT_SUPPORT_NFC, /**< Current device does not support NFC feature or this manager does not found plugin library */
-
-/*399*/NET_NFC_LLCP_INVALID_SOCKET = -399, /**< socket is not valid socket */
-/*398*/NET_NFC_LLCP_SOCKET_DISCONNECTED, /**< socket is disconnected */
-/*397*/NET_NFC_LLCP_SOCKET_FRAME_REJECTED, /**< send data is rejected from remote side */
-
-/*299*/NET_NFC_P2P_SEND_FAIL = -299, /**< P2P data send fail */
-} net_nfc_error_e;
+       typedef enum {
+               /*000 */ NET_NFC_OK = 0,
+                                          /**< Status is OK    */
+               /*999 */ NET_NFC_UNKNOWN_ERROR = -999,
+                                                                        /**< Unknown error */
+               /*998 */ NET_NFC_ALLOC_FAIL,
+                                                  /**< Memory allocation is failed */
+               /*997 */ NET_NFC_THREAD_CREATE_FAIL,
+                                                                  /**< Thread creation is failed */
+               /*996 */ NET_NFC_INVALID_STATE,
+                                                         /**< State of NFC-Manager or nfc-stack is not normal */
+               /*995 */ NET_NFC_IPC_FAIL,
+                                                /**< Communication with ipc is failed. (from client to server)*/
+               /*994 */ NET_NFC_OUT_OF_BOUND,
+                                                        /**< Index is out of bound */
+               /*993 */ NET_NFC_NULL_PARAMETER,
+                                                          /**< Unexpected NULL parameter is received */
+               /*992 */ NET_NFC_BUFFER_TOO_SMALL,
+                                                                /**< Requested buffer is too small to store data, this error should be received */
+               /*991 */ NET_NFC_ALREADY_INITIALIZED,
+                                                                       /**< You tried to initialized again without de-init */
+               /*990 */ NET_NFC_COMMUNICATE_WITH_CONTROLLER_FAILED,
+                                                                                                  /**< Communication with Controller Chipset is failed this is Fatal Error */
+               /*989 */ NET_NFC_RF_TIMEOUT,
+                                                  /**< Timeout is raised while communicate with a tag */
+               /*988 */ NET_NFC_RF_ERROR,
+                                                /**< Unexpected package is received from target, you may receive this error comes by the low level RF communication fault*/
+               /*987 */ NET_NFC_NOT_INITIALIZED,
+                                                               /**< Application tries to request without initialization */
+               /*986 */ NET_NFC_NOT_SUPPORTED,
+                                                         /**< Request information or command is not supported in current connected target */
+               /*985 */ NET_NFC_ALREADY_REGISTERED,
+                                                                  /**< Requested SAP number is already used by other socket or data is already appended or registered */
+               /*984 */ NET_NFC_NOT_ALLOWED_OPERATION,
+                                                                         /**< Requested Operation is not allowed in the situation in critical time (such as write data on target)*/
+               /*983 */ NET_NFC_BUSY,
+                                        /**< Previous operation is not finished. don't worry to get this message, most of request will be executed in the serial queue */
+               /*982 */ NET_NFC_INVALID_HANDLE,
+                                                          /**< Requested Device in not valid device */
+               /*981 */ NET_NFC_TAG_READ_FAILED,
+                                                               /**< Tag reading is failed because of unexpected chunk data is received or error ack is received */
+               /*980 */ NET_NFC_TAG_WRITE_FAILED,
+                                                                /**< When you try to write on read only tag or error ack is received */
+               /*979 */ NET_NFC_NO_NDEF_SUPPORT,
+                                                               /**< Tag is not supported NDEF format for tag is not formatted for NDEF */
+               /*978 */ NET_NFC_NO_NDEF_MESSAGE,
+                                                               /**< No data is received after NDEF reading */
+               /*977 */ NET_NFC_INVALID_FORMAT,
+                                                          /**< Received data is not readable or it has illegal values or format */
+               /*976 */ NET_NFC_INSUFFICIENT_STORAGE,
+                                                                        /**< The connected tag does not have enough information */
+               /*975 */ NET_NFC_OPERATION_FAIL,
+                                                          /**< The remote target returned error while doing a operation*/
+               /*974 */ NET_NFC_NOT_CONNECTED,
+                                                         /**< remote is not connected correctly. This can be happened when the RF does not have enough strength */
+               /*973 */ NET_NFC_NO_DATA_FOUND,
+                                                         /**< Requested data is not found in the list or properties */
+               /*972 */ NET_NFC_SECURITY_FAIL,
+                                                         /**< Authentication is failed while communication with nfc-manager server */
+               /*971 */ NET_NFC_TARGET_IS_MOVED_AWAY,
+                                                                        /**< Target is lost while doing a operation */
+               /*970 */ NET_NFC_TAG_IS_ALREADY_FORMATTED,
+                                                                                /** Target is already formatted */
+               /*969 */ NET_NFC_NOT_REGISTERED,
+                                                          /**< removal is requested but requested data is not registered */
+               /*968 */ NET_NFC_INVALID_PARAM,
+                                                         /**< removal is requested but requested data is not registered */
+               /*967 */ NET_NFC_PERMISSION_DENIED,
+                                                                 /**< privilege check is failed */
+               /*966 */ NET_NFC_NOT_ACTIVATED,
+                                                         /**< Application tries to request without activation */
+               /*965 */ NET_NFC_DATA_CONFLICTED,
+                                                               /**< Data is conflicted with another one */
+
+               /*499 */ NET_NFC_NDEF_TYPE_LENGTH_IS_NOT_OK = -499,
+                                                                                                 /**< Illegal ndef record type length */
+               /*498 */ NET_NFC_NDEF_PAYLOAD_LENGTH_IS_NOT_OK,
+                                                                                         /**< Illegal ndef record payload length */
+               /*497 */ NET_NFC_NDEF_ID_LENGTH_IS_NOT_OK,
+                                                                                /**< Illegal ndef record id length */
+               /*496 */ NET_NFC_NDEF_RECORD_IS_NOT_EXPECTED_TYPE,
+                                                                                                /**< Parameter record is not expected record. for example, try to URI from text record */
+               /*495 */ NET_NFC_NDEF_BUF_END_WITHOUT_ME,
+                                                                               /**< NDEF messages is terminated without ME flag */
+               /*494 */ NET_NFC_DEVICE_DOES_NOT_SUPPORT_NFC,
+                                                                                       /**< Current device does not support NFC feature or this manager does not found plugin library */
+
+               /*399 */ NET_NFC_LLCP_INVALID_SOCKET = -399,
+                                                                                  /**< socket is not valid socket */
+               /*398 */ NET_NFC_LLCP_SOCKET_DISCONNECTED,
+                                                                                /**< socket is disconnected */
+               /*397 */ NET_NFC_LLCP_SOCKET_FRAME_REJECTED,
+                                                                                  /**< send data is rejected from remote side */
+
+               /*299 */ NET_NFC_P2P_SEND_FAIL = -299,
+                                                                        /**< P2P data send fail */
+       } net_nfc_error_e;
 
 /**
  Enum value of the record type  ( TNF value )
  */
-typedef enum
-{
-       NET_NFC_RECORD_EMPTY = 0x0,
-       NET_NFC_RECORD_WELL_KNOWN_TYPE,
-       NET_NFC_RECORD_MIME_TYPE, // Media type
-       NET_NFC_RECORD_URI,
-       NET_NFC_RECORD_EXTERNAL_RTD,
-       NET_NFC_RECORD_UNKNOWN,
-       NET_NFC_RECORD_UNCHAGNED,
-} net_nfc_record_tnf_e;
+       typedef enum {
+               NET_NFC_RECORD_EMPTY = 0x0,
+               NET_NFC_RECORD_WELL_KNOWN_TYPE,
+               NET_NFC_RECORD_MIME_TYPE,       // Media type
+               NET_NFC_RECORD_URI,
+               NET_NFC_RECORD_EXTERNAL_RTD,
+               NET_NFC_RECORD_UNKNOWN,
+               NET_NFC_RECORD_UNCHAGNED,
+       } net_nfc_record_tnf_e;
 
 /**
  net_nfc_message_e is identify the events comes from nfc-manager.
@@ -161,191 +203,199 @@ typedef enum
  All of the events are delivered by the the callback function that registered with "net_nfc_set_response_callback"
  */
 
-typedef enum
-{
-       NET_NFC_MESSAGE_TRANSCEIVE = 0, /**< Type: Response Event, <br> This events is received after calling the "net_nfc_tranceive"
-                                                                        <br> if the operation is success, the data parameter should cast into data_h or it return NULL*/
-       NET_NFC_MESSAGE_READ_NDEF, /**< Type: Response Event, <br> This events is received after calling the "net_nfc_read_tag"
-                                                                <br> if the operation is success, the data parameter should cast into ndef_message_h or it return NULL */
-       NET_NFC_MESSAGE_WRITE_NDEF, /**< Type: Response Event, <br> This events is received after calling the "net_nfc_write_ndef"
-                                                                <br> data pointer always returns NULL */
-       NET_NFC_MESSAGE_MAKE_READ_ONLY_NDEF, /**< Type: Response Event, <br> This events is received after calling the "net_nfc_make_read_only_ndef"
-                                                                                <br> data pointer always returns NULL */
-       NET_NFC_MESSAGE_IS_TAG_CONNECTED, /**< Type: Response Event, <br> This events is received after calling the "net_nfc_is_tag_conneced"
-                                                                                <br> data pointer always returns NULL */
-       NET_NFC_MESSAGE_GET_CURRENT_TAG_INFO, /**< Type: Response Event, <br> This events is received after calling the "net_nfc_get_current_tag_infof"
-                                                                <br> if the operation is success, the data parameter should cast into net_nfc_target_info_h or it return NULL */
-       NET_NFC_MESSAGE_GET_CURRENT_TARGET_HANDLE,  /**< Type: Response Event, <br> This events is received after calling the "net_nfc_get_current_target_handle"
-                                                                <br> if the operation is success, the data parameter should cast into net_nfc_target_handle_h or it return NULL */
-       NET_NFC_MESSAGE_TAG_DISCOVERED, /**< Type: Notify Event, <br> When a tag or SE is detected, you got this event.
-                                                                        <br> The data contains the target info , need to cast to net_nfc_target_info_h*/
-       NET_NFC_MESSAGE_NOTIFY, /**< This Notify Event <br> when the unexpected error has occurred, this event is delivered. data pointer always returns NULL  */
-       NET_NFC_MESSAGE_TAG_DETACHED, /**< Type: Notify Event, <br> When a tag or SE is disappeared, you got this event.
-                                                                        <br> The data contains the target info , need to cast to net_nfc_target_info_h but it does not have detail target info
-                                                                        <br> please, do not use "net_nfc_get_tag_info_keys" when you got this event*/
-/*10*/ NET_NFC_MESSAGE_FORMAT_NDEF, /**< Type: Response Event <br> After complete "net_nfc_format_ndef", this event is delivered */
-       NET_NFC_MESSAGE_LLCP_DISCOVERED,/**< Type: Notify Event <br> When LLCP is discovered and remote device is support llcp, you receive this event
-                                                                        <br> data pointer contains the remote llcp configuration info. Cast to net_nfc_llcp_config_info_h*/
-       NET_NFC_MESSAGE_P2P_DETACHED, /**< Type: Notify Event <br> When LLCP is de-activated by removing the device, you receive this event*/
-       NET_NFC_MESSAGE_LLCP_CONFIG, /**< Type: Response Event. <br> The operation of "net_nfc_set_llcp_local_configure" is completed */
-
-       NET_NFC_MESSAGE_P2P_DISCOVERED, /**< Type: Notify Event <br> The remove device is detected and ready for transferring data to remote side */
-       NET_NFC_MESSAGE_P2P_SEND, /**< Type: Response Event, <br> This events is received after calling the "net_nfc_send_exchanger_data" */
-       NET_NFC_MESSAGE_P2P_RECEIVE, /**< Type: Notify Event, <br> When llcp server socket receive some data, this event is delivered. */
-
-       NET_NFC_MESSAGE_SE_START_TRANSACTION, /**< Type: Notify Event, indicates external reader start transaction*/
-       NET_NFC_MESSAGE_SE_END_TRANSACTION, /**< Type: Notify Event, indicates external reader end transaction*/
-       NET_NFC_MESSAGE_SE_TYPE_TRANSACTION, /**< Type: Notify Event, Indicates external reader trying to access secure element */
-/*20*/ NET_NFC_MESSAGE_SE_CONNECTIVITY, /**< Type: Notify Event, This event notifies the terminal host that it shall send a connectivity event from UICC */
-       NET_NFC_MESSAGE_SE_FIELD_ON, /**< Type: Notify Event, indicates external reader field is on*/
-       NET_NFC_MESSAGE_SE_FIELD_OFF, /**< Type: Notify Event, indicates external reader field is off*/
-       NET_NFC_MESSAGE_SE_TYPE_CHANGED, /**< Type: Notify Event, indicates secure element type is changed*/
-       NET_NFC_MESSAGE_SE_CARD_EMULATION_CHANGED, /**< Type: Notify Event, indicates card emulation mode is changed*/
-       NET_NFC_MESSAGE_CONNECTION_HANDOVER, /**< Type: Response Event. <br> The result of connection handover. If it has been completed successfully, this event will include the information of alternative carrier. */
-
-       NET_NFC_MESSAGE_SET_SE,
-       NET_NFC_MESSAGE_GET_SE,
-       NET_NFC_MESSAGE_OPEN_INTERNAL_SE,
-       NET_NFC_MESSAGE_CLOSE_INTERNAL_SE,
-/*30*/ NET_NFC_MESSAGE_SEND_APDU_SE,
-       NET_NFC_MESSAGE_GET_ATR_SE,
-       NET_NFC_GET_SERVER_STATE,
-
-       NET_NFC_MESSAGE_SIM_TEST,
-
-       NET_NFC_MESSAGE_INIT,
-       NET_NFC_MESSAGE_DEINIT,
-
-       NET_NFC_MESSAGE_PRBS_TEST,
-
-       NET_NFC_MESSAGE_GET_FIRMWARE_VERSION,
-
-       NET_NFC_MESSAGE_SET_EEDATA,
-
-       NET_NFC_MESSAGE_SNEP_START_SERVER,
-       NET_NFC_MESSAGE_SNEP_START_CLIENT,
-/*40*/ NET_NFC_MESSAGE_SNEP_REQUEST,
-       NET_NFC_MESSAGE_SNEP_STOP_SERVICE,
-       NET_NFC_MESSAGE_SNEP_REGISTER_SERVER,
-       NET_NFC_MESSAGE_SNEP_UNREGISTER_SERVER,
-
-       NET_NFC_MESSAGE_CONNECT,
-       NET_NFC_MESSAGE_DISCONNECT,
-       NET_NFC_MESSAGE_SET_CARD_EMULATION,
-
-/*47*/ NET_NFC_MESSAGE_ROUTING_HOST_EMU_ACTIVATED,
-       NET_NFC_MESSAGE_ROUTING_HOST_EMU_DEACTIVATED,
-       NET_NFC_MESSAGE_ROUTING_HOST_EMU_DATA,
-} net_nfc_message_e;
-
-typedef enum
-{
-       NET_NFC_UNKNOWN_TARGET = 0x00U,
-
-       /* Specific PICC Devices */
-
-       NET_NFC_GENERIC_PICC,
-       NET_NFC_ISO14443_A_PICC,
-       NET_NFC_ISO14443_4A_PICC,
-       NET_NFC_ISO14443_3A_PICC,
-       NET_NFC_MIFARE_MINI_PICC,
-       NET_NFC_MIFARE_1K_PICC,
-       NET_NFC_MIFARE_4K_PICC,
-       NET_NFC_MIFARE_ULTRA_PICC,
-       NET_NFC_MIFARE_DESFIRE_PICC,
-       NET_NFC_ISO14443_B_PICC,
-       NET_NFC_ISO14443_4B_PICC,
-       NET_NFC_ISO14443_BPRIME_PICC,
-       NET_NFC_FELICA_PICC,
-       NET_NFC_JEWEL_PICC,
-       NET_NFC_ISO15693_PICC,
-       NET_NFC_BARCODE_128_PICC,
-       NET_NFC_BARCODE_256_PICC,
-
-       /* NFC-IP1 Device Types */
-       NET_NFC_NFCIP1_TARGET,
-       NET_NFC_NFCIP1_INITIATOR,
-
-} net_nfc_target_type_e;
+       typedef enum {
+               NET_NFC_MESSAGE_TRANSCEIVE = 0, /**< Type: Response Event, <br> This events is received after calling the "net_nfc_tranceive"
+                                                       <br> if the operation is success, the data parameter should cast into data_h or it return NULL*/
+               NET_NFC_MESSAGE_READ_NDEF, /**< Type: Response Event, <br> This events is received after calling the "net_nfc_read_tag"
+                                                       <br> if the operation is success, the data parameter should cast into ndef_message_h or it return NULL */
+               NET_NFC_MESSAGE_WRITE_NDEF,     /**< Type: Response Event, <br> This events is received after calling the "net_nfc_write_ndef"
+                                                       <br> data pointer always returns NULL */
+               NET_NFC_MESSAGE_MAKE_READ_ONLY_NDEF, /**< Type: Response Event, <br> This events is received after calling the "net_nfc_make_read_only_ndef"
+                                                       <br> data pointer always returns NULL */
+               NET_NFC_MESSAGE_IS_TAG_CONNECTED, /**< Type: Response Event, <br> This events is received after calling the "net_nfc_is_tag_conneced"
+                                                       <br> data pointer always returns NULL */
+               NET_NFC_MESSAGE_GET_CURRENT_TAG_INFO, /**< Type: Response Event, <br> This events is received after calling the "net_nfc_get_current_tag_infof"
+                                                       <br> if the operation is success, the data parameter should cast into net_nfc_target_info_h or it return NULL */
+               NET_NFC_MESSAGE_GET_CURRENT_TARGET_HANDLE, /**< Type: Response Event, <br> This events is received after calling the "net_nfc_get_current_target_handle"
+                                                       <br> if the operation is success, the data parameter should cast into net_nfc_target_handle_h or it return NULL */
+               NET_NFC_MESSAGE_TAG_DISCOVERED, /**< Type: Notify Event, <br> When a tag or SE is detected, you got this event.
+                                                       <br> The data contains the target info , need to cast to net_nfc_target_info_h*/
+               NET_NFC_MESSAGE_NOTIFY, /**< This Notify Event <br> when the unexpected error has occurred, this event is delivered. data pointer always returns NULL  */
+               NET_NFC_MESSAGE_TAG_DETACHED, /**< Type: Notify Event, <br> When a tag or SE is disappeared, you got this event.
+                                                       <br> The data contains the target info , need to cast to net_nfc_target_info_h but it does not have detail target info
+                                                       <br> please, do not use "net_nfc_get_tag_info_keys" when you got this event*/
+                                                                                        /*10 */ NET_NFC_MESSAGE_FORMAT_NDEF,
+                                                                                        /**< Type: Response Event <br> After complete "net_nfc_format_ndef", this event is delivered */
+               NET_NFC_MESSAGE_LLCP_DISCOVERED, /**< Type: Notify Event <br> When LLCP is discovered and remote device is support llcp, you receive this event
+                                                       <br> data pointer contains the remote llcp configuration info. Cast to net_nfc_llcp_config_info_h*/
+               NET_NFC_MESSAGE_P2P_DETACHED, /**< Type: Notify Event <br> When LLCP is de-activated by removing the device, you receive this event*/
+               NET_NFC_MESSAGE_LLCP_CONFIG, /**< Type: Response Event. <br> The operation of "net_nfc_set_llcp_local_configure" is completed */
+
+               NET_NFC_MESSAGE_P2P_DISCOVERED, /**< Type: Notify Event <br> The remove device is detected and ready for transferring data to remote side */
+               NET_NFC_MESSAGE_P2P_SEND, /**< Type: Response Event, <br> This events is received after calling the "net_nfc_send_exchanger_data" */
+               NET_NFC_MESSAGE_P2P_RECEIVE, /**< Type: Notify Event, <br> When llcp server socket receive some data, this event is delivered. */
+
+               NET_NFC_MESSAGE_SE_START_TRANSACTION,
+                                                                                 /**< Type: Notify Event, indicates external reader start transaction*/
+               NET_NFC_MESSAGE_SE_END_TRANSACTION,
+                                                                               /**< Type: Notify Event, indicates external reader end transaction*/
+               NET_NFC_MESSAGE_SE_TYPE_TRANSACTION,
+                                                                                /**< Type: Notify Event, Indicates external reader trying to access secure element */
+               /*20 */ NET_NFC_MESSAGE_SE_CONNECTIVITY,
+                                                                                /**< Type: Notify Event, This event notifies the terminal host that it shall send a connectivity event from UICC */
+               NET_NFC_MESSAGE_SE_FIELD_ON,
+                                                                /**< Type: Notify Event, indicates external reader field is on*/
+               NET_NFC_MESSAGE_SE_FIELD_OFF,
+                                                                 /**< Type: Notify Event, indicates external reader field is off*/
+               NET_NFC_MESSAGE_SE_TYPE_CHANGED,
+                                                                        /**< Type: Notify Event, indicates secure element type is changed*/
+               NET_NFC_MESSAGE_SE_CARD_EMULATION_CHANGED,
+                                                                                          /**< Type: Notify Event, indicates card emulation mode is changed*/
+               NET_NFC_MESSAGE_CONNECTION_HANDOVER,
+                                                                                /**< Type: Response Event. <br> The result of connection handover. If it has been completed successfully, this event will include the information of alternative carrier. */
+
+               NET_NFC_MESSAGE_SET_SE,
+               NET_NFC_MESSAGE_GET_SE,
+               NET_NFC_MESSAGE_OPEN_INTERNAL_SE,
+               NET_NFC_MESSAGE_CLOSE_INTERNAL_SE,
+/*30*/ NET_NFC_MESSAGE_SEND_APDU_SE,
+               NET_NFC_MESSAGE_GET_ATR_SE,
+               NET_NFC_GET_SERVER_STATE,
+
+               NET_NFC_MESSAGE_SIM_TEST,
+
+               NET_NFC_MESSAGE_INIT,
+               NET_NFC_MESSAGE_DEINIT,
+
+               NET_NFC_MESSAGE_PRBS_TEST,
+
+               NET_NFC_MESSAGE_GET_FIRMWARE_VERSION,
+
+               NET_NFC_MESSAGE_SET_EEDATA,
+
+               NET_NFC_MESSAGE_SNEP_START_SERVER,
+               NET_NFC_MESSAGE_SNEP_START_CLIENT,
+/*40*/ NET_NFC_MESSAGE_SNEP_REQUEST,
+               NET_NFC_MESSAGE_SNEP_STOP_SERVICE,
+               NET_NFC_MESSAGE_SNEP_REGISTER_SERVER,
+               NET_NFC_MESSAGE_SNEP_UNREGISTER_SERVER,
+
+               NET_NFC_MESSAGE_CONNECT,
+               NET_NFC_MESSAGE_DISCONNECT,
+               NET_NFC_MESSAGE_SET_CARD_EMULATION,
+
+/*47*/ NET_NFC_MESSAGE_ROUTING_HOST_EMU_ACTIVATED,
+               NET_NFC_MESSAGE_ROUTING_HOST_EMU_DEACTIVATED,
+               NET_NFC_MESSAGE_ROUTING_HOST_EMU_DATA,
+       } net_nfc_message_e;
+
+       typedef enum {
+               NET_NFC_UNKNOWN_TARGET = 0x00U,
+
+               /* Specific PICC Devices */
+
+               NET_NFC_GENERIC_PICC,
+               NET_NFC_ISO14443_A_PICC,
+               NET_NFC_ISO14443_4A_PICC,
+               NET_NFC_ISO14443_3A_PICC,
+               NET_NFC_MIFARE_MINI_PICC,
+               NET_NFC_MIFARE_1K_PICC,
+               NET_NFC_MIFARE_4K_PICC,
+               NET_NFC_MIFARE_ULTRA_PICC,
+               NET_NFC_MIFARE_DESFIRE_PICC,
+               NET_NFC_ISO14443_B_PICC,
+               NET_NFC_ISO14443_4B_PICC,
+               NET_NFC_ISO14443_BPRIME_PICC,
+               NET_NFC_FELICA_PICC,
+               NET_NFC_JEWEL_PICC,
+               NET_NFC_ISO15693_PICC,
+               NET_NFC_BARCODE_128_PICC,
+               NET_NFC_BARCODE_256_PICC,
+
+               /* NFC-IP1 Device Types */
+               NET_NFC_NFCIP1_TARGET,
+               NET_NFC_NFCIP1_INITIATOR,
+
+       } net_nfc_target_type_e;
 
 /**
  Card states for nfc tag
  */
-typedef enum
-{
-       NET_NFC_NDEF_CARD_INVALID = 0x00, /**<  The card is not NFC forum specified tag. The ndef format will be needed. */
-       NET_NFC_NDEF_CARD_INITIALISED, /**< The card is NFC forum specified tag, but It has no actual data. So, the ndef write will be needed. */
-       NET_NFC_NDEF_CARD_READ_WRITE, /**<  The card is NFC forum specified tag. The ndef read and write will be allowed. */
-       NET_NFC_NDEF_CARD_READ_ONLY /**< The card is NFC forum specified tag, but only the ndef read will be allowed. */
-} net_nfc_ndef_card_state_e;
+       typedef enum {
+               NET_NFC_NDEF_CARD_INVALID = 0x00,
+                                                                         /**<  The card is not NFC forum specified tag. The ndef format will be needed. */
+               NET_NFC_NDEF_CARD_INITIALISED,
+                                                                  /**< The card is NFC forum specified tag, but It has no actual data. So, the ndef write will be needed. */
+               NET_NFC_NDEF_CARD_READ_WRITE,
+                                                                 /**<  The card is NFC forum specified tag. The ndef read and write will be allowed. */
+               NET_NFC_NDEF_CARD_READ_ONLY
+                                                               /**< The card is NFC forum specified tag, but only the ndef read will be allowed. */
+       } net_nfc_ndef_card_state_e;
 
 /**
  Encoding type for string message
  */
-typedef enum
-{
-       NET_NFC_ENCODE_UTF_8 = 0x00,
-       NET_NFC_ENCODE_UTF_16,
-} net_nfc_encode_type_e;
+       typedef enum {
+               NET_NFC_ENCODE_UTF_8 = 0x00,
+               NET_NFC_ENCODE_UTF_16,
+       } net_nfc_encode_type_e;
 
 /**
  URI scheme type defined in the NFC forum  "URI Record Type Definition"
  */
-typedef enum
-{
-       NET_NFC_SCHEMA_FULL_URI = 0x00, /**< protocol is specify by payload     */
-       NET_NFC_SCHEMA_HTTP_WWW, /**< http://www.                               */
-       NET_NFC_SCHEMA_HTTPS_WWW, /**< https://www.                             */
-       NET_NFC_SCHEMA_HTTP, /**< http://                                               */
-       NET_NFC_SCHEMA_HTTPS, /**< https://                                     */
-       NET_NFC_SCHEMA_TEL, /**< tel:                                           */
-       NET_NFC_SCHEMA_MAILTO, /**< mailto:                                             */
-       NET_NFC_SCHEMA_FTP_ANONYMOUS, /**< ftp://anonymouse:anonymouse@         */
-       NET_NFC_SCHEMA_FTP_FTP, /**< ftp://ftp.                                 */
-       NET_NFC_SCHEMA_FTPS, /**< ftps://                                               */
-       NET_NFC_SCHEMA_SFTP, /**< sftp://                                               */
-       NET_NFC_SCHEMA_SMB, /**< smb://                                         */
-       NET_NFC_SCHEMA_NFS, /**< nfs://                                         */
-       NET_NFC_SCHEMA_FTP, /**< ftp://                                         */
-       NET_NFC_SCHEMA_DAV, /**< dav://                                         */
-       NET_NFC_SCHEMA_NEWS, /**< news://                                       */
-       NET_NFC_SCHEMA_TELNET, /**< telnet://                                   */
-       NET_NFC_SCHEMA_IMAP, /**< imap:                                                 */
-       NET_NFC_SCHEMA_RTSP, /**< rtsp://                                               */
-       NET_NFC_SCHEMA_URN, /**< urn:                                           */
-       NET_NFC_SCHEMA_POP, /**< pop:                                           */
-       NET_NFC_SCHEMA_SIP, /**< sip:                                           */
-       NET_NFC_SCHEMA_SIPS, /**< sips:                                                 */
-       NET_NFC_SCHEMA_TFTP, /**< tftp:                                                 */
-       NET_NFC_SCHEMA_BTSPP, /**< btspp://                                     */
-       NET_NFC_SCHEMA_BTL2CAP, /**< btl2cap://                                 */
-       NET_NFC_SCHEMA_BTGOEP, /**< btgoep://                                   */
-       NET_NFC_SCHEMA_TCPOBEX, /**< tcpobex://                                 */
-       NET_NFC_SCHEMA_IRDAOBEX, /**< irdaobex://                                       */
-       NET_NFC_SCHEMA_FILE, /**< file://                                               */
-       NET_NFC_SCHEMA_URN_EPC_ID, /**< urn:epc:id:                                     */
-       NET_NFC_SCHEMA_URN_EPC_TAG, /**< urn:epc:tag:                                   */
-       NET_NFC_SCHEMA_URN_EPC_PAT, /**< urn:epc:pat:                                   */
-       NET_NFC_SCHEMA_URN_EPC_RAW, /**< urn:epc:raw:                                   */
-       NET_NFC_SCHEMA_URN_EPC, /**< urn:epc:                                   */
-       NET_NFC_SCHEMA_URN_NFC, /**< urn:epc:nfc:                                       */
-       NET_NFC_SCHEMA_MAX /**< --  indicating max--                    */
-} net_nfc_schema_type_e;
+       typedef enum {
+               NET_NFC_SCHEMA_FULL_URI = 0x00, /**< protocol is specify by payload     */
+               NET_NFC_SCHEMA_HTTP_WWW, /**< http://www.                               */
+               NET_NFC_SCHEMA_HTTPS_WWW, /**< https://www.                             */
+               NET_NFC_SCHEMA_HTTP, /**< http://                                       */
+               NET_NFC_SCHEMA_HTTPS, /**< https://                                     */
+               NET_NFC_SCHEMA_TEL,     /**< tel:                                               */
+               NET_NFC_SCHEMA_MAILTO, /**< mailto:                                     */
+               NET_NFC_SCHEMA_FTP_ANONYMOUS, /**< ftp://anonymouse:anonymouse@         */
+               NET_NFC_SCHEMA_FTP_FTP, /**< ftp://ftp.                                 */
+               NET_NFC_SCHEMA_FTPS, /**< ftps://                                       */
+               NET_NFC_SCHEMA_SFTP, /**< sftp://                                       */
+               NET_NFC_SCHEMA_SMB,     /**< smb://                                             */
+               NET_NFC_SCHEMA_NFS,     /**< nfs://                                             */
+               NET_NFC_SCHEMA_FTP,     /**< ftp://                                             */
+               NET_NFC_SCHEMA_DAV,     /**< dav://                                             */
+               NET_NFC_SCHEMA_NEWS, /**< news://                                       */
+               NET_NFC_SCHEMA_TELNET, /**< telnet://                                   */
+               NET_NFC_SCHEMA_IMAP, /**< imap:                                         */
+               NET_NFC_SCHEMA_RTSP, /**< rtsp://                                       */
+               NET_NFC_SCHEMA_URN,     /**< urn:                                               */
+               NET_NFC_SCHEMA_POP,     /**< pop:                                               */
+               NET_NFC_SCHEMA_SIP,     /**< sip:                                               */
+               NET_NFC_SCHEMA_SIPS, /**< sips:                                         */
+               NET_NFC_SCHEMA_TFTP, /**< tftp:                                         */
+               NET_NFC_SCHEMA_BTSPP, /**< btspp://                                     */
+               NET_NFC_SCHEMA_BTL2CAP, /**< btl2cap://                                 */
+               NET_NFC_SCHEMA_BTGOEP, /**< btgoep://                                   */
+               NET_NFC_SCHEMA_TCPOBEX, /**< tcpobex://                                 */
+               NET_NFC_SCHEMA_IRDAOBEX, /**< irdaobex://                               */
+               NET_NFC_SCHEMA_FILE, /**< file://                                       */
+               NET_NFC_SCHEMA_URN_EPC_ID, /**< urn:epc:id:                             */
+               NET_NFC_SCHEMA_URN_EPC_TAG,     /**< urn:epc:tag:                               */
+               NET_NFC_SCHEMA_URN_EPC_PAT,     /**< urn:epc:pat:                               */
+               NET_NFC_SCHEMA_URN_EPC_RAW,     /**< urn:epc:raw:                               */
+               NET_NFC_SCHEMA_URN_EPC, /**< urn:epc:                                   */
+               NET_NFC_SCHEMA_URN_NFC, /**< urn:epc:nfc:                               */
+               NET_NFC_SCHEMA_MAX /**< --  indicating max--                            */
+       } net_nfc_schema_type_e;
 
 // this is for target detect event filter
 
-typedef enum
-{
-       NET_NFC_ALL_DISABLE = 0x0000,
-       NET_NFC_ISO14443A_ENABLE = 0x0001,
-       NET_NFC_ISO14443B_ENABLE = 0x0002,
-       NET_NFC_ISO15693_ENABLE = 0x0004,
-       NET_NFC_FELICA_ENABLE = 0x0008,
-       NET_NFC_JEWEL_ENABLE = 0x0010,
-       NET_NFC_IP_ENABLE = 0x0020,
-       NET_NFC_ALL_ENABLE = ~0,
+       typedef enum {
+               NET_NFC_ALL_DISABLE = 0x0000,
+               NET_NFC_ISO14443A_ENABLE = 0x0001,
+               NET_NFC_ISO14443B_ENABLE = 0x0002,
+               NET_NFC_ISO15693_ENABLE = 0x0004,
+               NET_NFC_FELICA_ENABLE = 0x0008,
+               NET_NFC_JEWEL_ENABLE = 0x0010,
+               NET_NFC_IP_ENABLE = 0x0020,
+               NET_NFC_ALL_ENABLE = ~0,
 
-} net_nfc_event_filter_e;
+       } net_nfc_event_filter_e;
 
 /*
  **************************************
@@ -355,277 +405,271 @@ typedef enum
 /**
  These events are delivered to the each socket callback. These events are separated events that comes from "net_nfc_set_response_callback" callback
  */
-typedef enum
-{
-       /* start number should be larger than "net_nfc_message_e"
-        because  to make seperate with net_nfc_message_e event it may conflict in
-        the dispatcher and ipc part */
-       NET_NFC_MESSAGE_LLCP_LISTEN = 1000, /**< Type: Response Event <br> this event indicates "net_nfc_listen_llcp" requested is completed*/
-       NET_NFC_MESSAGE_LLCP_ACCEPTED, /**< Type: Notify Event. <br>  Remote socket is accepted to listening socket
-                                                                        <br> data pointer contains the remote socket info (Cast to net_nfc_llcp_socket_option_h)*/
-       NET_NFC_MESSAGE_LLCP_CONNECT, /**< Type: Response Event. <br> "net_nfc_connect_llcp_with" request is completed and your socket is connected to remote site with url*/
-       NET_NFC_MESSAGE_LLCP_CONNECT_SAP, /**< Type: Response Event.<br>  "net_nfc_connect_llcp_with_sap" request is completed and your socket is connected to remote site with sap number*/
-       NET_NFC_MESSAGE_LLCP_SEND, /**< Type: Response Event,<br>  "net_nfc_send_llcp" operation is completed (connection mode)*/
-       NET_NFC_MESSAGE_LLCP_SEND_TO, /**< Type: Response Event,<br>  "net_nfc_send_llcp_to"operation is completed (connectionless mode)*/
-       NET_NFC_MESSAGE_LLCP_RECEIVE, /**< Type: Response Event,<br>  "net_nfc_receive_llcp" operation is completed (connection mode)
-                                                                        <br> data pointer contains received data (Cast to data_h)*/
-       NET_NFC_MESSAGE_LLCP_RECEIVE_FROM, /**< Type: Response Event,<br>  "net_nfc_receive_llcp_from" operation is completed (connectionless mode)*/
-       NET_NFC_MESSAGE_LLCP_DISCONNECT, /**< Type: Response Event,<br>  "net_nfc_disconnect_llcp" request is completed */
-       NET_NFC_MESSAGE_LLCP_ERROR, /**< Type: Notify Event,<br>  when the socket is disconnected, you may receive this event */
-       NET_NFC_MESSAGE_LLCP_CONNECT_REQ, /**< Type: Notify Event,<br> when the peer requests connect, you may receive this event */
-       NET_NFC_MESSAGE_LLCP_ACCEPT, /**< Type: Response Event <br> this event indicates "net_nfc_accept_llcp" requested is completed*/
-       NET_NFC_MESSAGE_LLCP_REJECT, /**< Type: Response Event <br> this event indicates "net_nfc_reject_llcp" requested is completed*/
-       NET_NFC_MESSAGE_LLCP_REJECTED, /**< Type: Notify Event,<br> when the socket is rejected, you may receive this event */
-       NET_NFC_MESSAGE_LLCP_CLOSE, /**< Type: Response Event,<br>  "net_nfc_close_llcp_socket" request is completed */
-
-} net_nfc_llcp_message_e;
-
-typedef enum
-{
-       NET_NFC_LLCP_SOCKET_TYPE_CONNECTIONORIENTED,
-       NET_NFC_LLCP_SOCKET_TYPE_CONNECTIONLESS,
-} net_nfc_socket_type_e;
-
-typedef enum
-{
-       NET_NFC_SNEP = 0x00,
-       NET_NFC_NPP,
-} llcp_app_protocol_e;
-
-typedef struct _data_s *data_h;
-
-typedef struct _ndef_record_s *ndef_record_h;
-
-typedef struct _ndef_message_s *ndef_message_h;
-
-typedef struct _net_nfc_target_info_s *net_nfc_target_info_h;
-
-typedef uint32_t net_nfc_traceive_cmd;
-
-typedef struct _net_nfc_llcp_config_info_s *net_nfc_llcp_config_info_h;
-
-typedef struct _net_nfc_llcp_socket_option_s *net_nfc_llcp_socket_option_h;
-
-typedef struct _net_nfc_target_handle_s *net_nfc_target_handle_h;
-
-typedef struct _net_nfc_connection_handover_info_s *net_nfc_connection_handover_info_h;
-
-typedef uint8_t sap_t;
-
-typedef uint32_t net_nfc_llcp_socket_t;
-
-typedef void *net_nfc_snep_handle_h;
+       typedef enum {
+               /* start number should be larger than "net_nfc_message_e"
+                  because  to make seperate with net_nfc_message_e event it may conflict in
+                  the dispatcher and ipc part */
+               NET_NFC_MESSAGE_LLCP_LISTEN = 1000,
+                                                                               /**< Type: Response Event <br> this event indicates "net_nfc_listen_llcp" requested is completed*/
+               NET_NFC_MESSAGE_LLCP_ACCEPTED,
+                                                                  /**< Type: Notify Event. <br>  Remote socket is accepted to listening socket
+                                                                       <br> data pointer contains the remote socket info (Cast to net_nfc_llcp_socket_option_h)*/
+               NET_NFC_MESSAGE_LLCP_CONNECT,
+                                                                 /**< Type: Response Event. <br> "net_nfc_connect_llcp_with" request is completed and your socket is connected to remote site with url*/
+               NET_NFC_MESSAGE_LLCP_CONNECT_SAP,
+                                                                         /**< Type: Response Event.<br>  "net_nfc_connect_llcp_with_sap" request is completed and your socket is connected to remote site with sap number*/
+               NET_NFC_MESSAGE_LLCP_SEND,
+                                                          /**< Type: Response Event,<br>  "net_nfc_send_llcp" operation is completed (connection mode)*/
+               NET_NFC_MESSAGE_LLCP_SEND_TO,
+                                                                 /**< Type: Response Event,<br>  "net_nfc_send_llcp_to"operation is completed (connectionless mode)*/
+               NET_NFC_MESSAGE_LLCP_RECEIVE,
+                                                                 /**< Type: Response Event,<br>  "net_nfc_receive_llcp" operation is completed (connection mode)
+                                                                       <br> data pointer contains received data (Cast to data_h)*/
+               NET_NFC_MESSAGE_LLCP_RECEIVE_FROM,
+                                                                          /**< Type: Response Event,<br>  "net_nfc_receive_llcp_from" operation is completed (connectionless mode)*/
+               NET_NFC_MESSAGE_LLCP_DISCONNECT,
+                                                                        /**< Type: Response Event,<br>  "net_nfc_disconnect_llcp" request is completed */
+               NET_NFC_MESSAGE_LLCP_ERROR,
+                                                               /**< Type: Notify Event,<br>  when the socket is disconnected, you may receive this event */
+               NET_NFC_MESSAGE_LLCP_CONNECT_REQ,
+                                                                         /**< Type: Notify Event,<br> when the peer requests connect, you may receive this event */
+               NET_NFC_MESSAGE_LLCP_ACCEPT,
+                                                                /**< Type: Response Event <br> this event indicates "net_nfc_accept_llcp" requested is completed*/
+               NET_NFC_MESSAGE_LLCP_REJECT,
+                                                                /**< Type: Response Event <br> this event indicates "net_nfc_reject_llcp" requested is completed*/
+               NET_NFC_MESSAGE_LLCP_REJECTED,
+                                                                  /**< Type: Notify Event,<br> when the socket is rejected, you may receive this event */
+               NET_NFC_MESSAGE_LLCP_CLOSE,
+                                                               /**< Type: Response Event,<br>  "net_nfc_close_llcp_socket" request is completed */
+
+       } net_nfc_llcp_message_e;
+
+       typedef enum {
+               NET_NFC_LLCP_SOCKET_TYPE_CONNECTIONORIENTED,
+               NET_NFC_LLCP_SOCKET_TYPE_CONNECTIONLESS,
+       } net_nfc_socket_type_e;
+
+       typedef enum {
+               NET_NFC_SNEP = 0x00,
+               NET_NFC_NPP,
+       } llcp_app_protocol_e;
+
+       typedef struct _data_s *data_h;
+
+       typedef struct _ndef_record_s *ndef_record_h;
+
+       typedef struct _ndef_message_s *ndef_message_h;
+
+       typedef struct _net_nfc_target_info_s *net_nfc_target_info_h;
+
+       typedef uint32_t net_nfc_traceive_cmd;
+
+       typedef struct _net_nfc_llcp_config_info_s *net_nfc_llcp_config_info_h;
+
+       typedef struct _net_nfc_llcp_socket_option_s *net_nfc_llcp_socket_option_h;
+
+       typedef struct _net_nfc_target_handle_s *net_nfc_target_handle_h;
+
+       typedef struct _net_nfc_connection_handover_info_s *net_nfc_connection_handover_info_h;
+
+       typedef uint8_t sap_t;
+
+       typedef uint32_t net_nfc_llcp_socket_t;
+
+       typedef void *net_nfc_snep_handle_h;
 
 // LLCP Callback
-typedef void (*net_nfc_llcp_socket_cb)(net_nfc_llcp_message_e message, net_nfc_error_e result, void *data, void *user_data, void *trans_data);
+       typedef void (*net_nfc_llcp_socket_cb) (net_nfc_llcp_message_e message, net_nfc_error_e result, void *data, void *user_data, void *trans_data);
 
 // Main Callback
-typedef void (*net_nfc_response_cb)(net_nfc_message_e message, net_nfc_error_e result, void *data, void *user_param, void *trans_data);
+       typedef void (*net_nfc_response_cb) (net_nfc_message_e message, net_nfc_error_e result, void *data, void *user_param, void *trans_data);
 
-typedef void (*net_nfc_internal_se_response_cb)(net_nfc_message_e message, net_nfc_error_e result, void *data, void *user_param, void *trans_data);
+       typedef void (*net_nfc_internal_se_response_cb) (net_nfc_message_e message, net_nfc_error_e result, void *data, void *user_param, void *trans_data);
 
-typedef void (* net_nfc_set_activation_completed_cb)(net_nfc_error_e error, void *user_data);
+       typedef void (*net_nfc_set_activation_completed_cb) (net_nfc_error_e error, void *user_data);
 
 // handover
 
-typedef enum
-{
-       NET_NFC_CONN_HANDOVER_CARRIER_BT = 0x00,
-       NET_NFC_CONN_HANDOVER_CARRIER_WIFI_WPS, /* Wifi Protected Setup */
+       typedef enum {
+               NET_NFC_CONN_HANDOVER_CARRIER_BT = 0x00,
+               NET_NFC_CONN_HANDOVER_CARRIER_WIFI_WPS, /* Wifi Protected Setup */
 #define NET_NFC_CONN_HANDOVER_CARRIER_WIFI_BSS NET_NFC_CONN_HANDOVER_CARRIER_WIFI_WPS
-       NET_NFC_CONN_HANDOVER_CARRIER_WIFI_P2P, /* Wifi Peer-to-Peer */
+               NET_NFC_CONN_HANDOVER_CARRIER_WIFI_P2P, /* Wifi Peer-to-Peer */
 #define NET_NFC_CONN_HANDOVER_CARRIER_WIFI_IBSS NET_NFC_CONN_HANDOVER_CARRIER_WIFI_P2P
 #define NET_NFC_CONN_HANDOVER_CARRIER_WIFI_DIRECT NET_NFC_CONN_HANDOVER_CARRIER_WIFI_P2P
-       NET_NFC_CONN_HANDOVER_CARRIER_BT_LE,
-       NET_NFC_CONN_HANDOVER_CARRIER_UNKNOWN,
-} net_nfc_conn_handover_carrier_type_e;
-
-typedef enum
-{
-       NET_NFC_CONN_HANDOVER_CARRIER_INACTIVATE = 0x00,
-       NET_NFC_CONN_HANDOVER_CARRIER_ACTIVATE,
-       NET_NFC_CONN_HANDOVER_CARRIER_ACTIVATING,
-       NET_NFC_CONN_HANDOVER_CARRIER_UNKNOWN_STATUS,
-} net_nfc_conn_handover_carrier_state_e;
-
-typedef struct _net_nfc_conn_handover_carrier_info_s *net_nfc_conn_handover_carrier_info_h;
-typedef struct _net_nfc_conn_handover_info_s *net_nfc_conn_handover_info_h;
-
-#define MIFARE_KEY_DEFAULT {(uint8_t)0xFF,(uint8_t)0xFF,(uint8_t)0xFF,(uint8_t)0xFF,(uint8_t)0xFF,(uint8_t)0xFF}
-#define MIFARE_KEY_APPLICATION_DIRECTORY {(uint8_t)0xA0,(uint8_t)0xA1,(uint8_t)0xA2,(uint8_t)0xA3,(uint8_t)0xA4,(uint8_t)0xA5}
-#define MIFARE_KEY_NET_NFC_FORUM {(uint8_t)0xD3,(uint8_t)0xF7,(uint8_t)0xD3,(uint8_t)0xF7,(uint8_t)0xD3,(uint8_t)0xF7}
+               NET_NFC_CONN_HANDOVER_CARRIER_BT_LE,
+               NET_NFC_CONN_HANDOVER_CARRIER_UNKNOWN,
+       } net_nfc_conn_handover_carrier_type_e;
+
+       typedef enum {
+               NET_NFC_CONN_HANDOVER_CARRIER_INACTIVATE = 0x00,
+               NET_NFC_CONN_HANDOVER_CARRIER_ACTIVATE,
+               NET_NFC_CONN_HANDOVER_CARRIER_ACTIVATING,
+               NET_NFC_CONN_HANDOVER_CARRIER_UNKNOWN_STATUS,
+       } net_nfc_conn_handover_carrier_state_e;
+
+       typedef struct _net_nfc_conn_handover_carrier_info_s *net_nfc_conn_handover_carrier_info_h;
+       typedef struct _net_nfc_conn_handover_info_s *net_nfc_conn_handover_info_h;
+
+#define MIFARE_KEY_DEFAULT {(uint8_t)0xFF, (uint8_t)0xFF, (uint8_t)0xFF, (uint8_t)0xFF, (uint8_t)0xFF, (uint8_t)0xFF}
+#define MIFARE_KEY_APPLICATION_DIRECTORY {(uint8_t)0xA0, (uint8_t)0xA1, (uint8_t)0xA2, (uint8_t)0xA3, (uint8_t)0xA4, (uint8_t)0xA5}
+#define MIFARE_KEY_NET_NFC_FORUM {(uint8_t)0xD3, (uint8_t)0xF7, (uint8_t)0xD3, (uint8_t)0xF7, (uint8_t)0xD3, (uint8_t)0xF7}
 #define MIFARE_KEY_LENGTH 6
 
-typedef enum
-{
-       NET_NFC_FELICA_POLL_NO_REQUEST = 0x00,
-       NET_NFC_FELICA_POLL_SYSTEM_CODE_REQUEST,
-       NET_NFC_FELICA_POLL_COMM_SPEED_REQUEST,
-       NET_NFC_FELICA_POLL_MAX = 0xFF,
-} net_nfc_felica_poll_request_code_e;
+       typedef enum {
+               NET_NFC_FELICA_POLL_NO_REQUEST = 0x00,
+               NET_NFC_FELICA_POLL_SYSTEM_CODE_REQUEST,
+               NET_NFC_FELICA_POLL_COMM_SPEED_REQUEST,
+               NET_NFC_FELICA_POLL_MAX = 0xFF,
+       } net_nfc_felica_poll_request_code_e;
 
 /**
  WIFI configuration key enums for connection handover.
  */
 
-typedef enum
-{
-       NET_NFC_WIFI_ATTRIBUTE_VERSION = 0x104A,
-       NET_NFC_WIFI_ATTRIBUTE_CREDENTIAL = 0x100E,
-       NET_NFC_WIFI_ATTRIBUTE_NET_INDEX = 0x1026,
-       NET_NFC_WIFI_ATTRIBUTE_SSID = 0x1045,
-       NET_NFC_WIFI_ATTRIBUTE_AUTH_TYPE = 0x1003, /*< WPA2PSK  0x0020 */
-       NET_NFC_WIFI_ATTRIBUTE_ENC_TYPE = 0x100F, /*< AES                       0x0008 */
-       NET_NFC_WIFI_ATTRIBUTE_NET_KEY = 0x1027,
-       NET_NFC_WIFI_ATTRIBUTE_MAC_ADDR = 0x1020,
-       NET_NFC_WIFI_ATTRIBUTE_CHANNEL = 0x1001, /* Channel number - based on IEEE */
-       NET_NFC_WIFI_ATTRIBUTE_VEN_EXT = 0x1049,
-       NET_NFC_WIFI_ATTRIBUTE_VERSION2 = 0x00,
-} net_nfc_carrier_wifi_attribute_e;
-
-typedef enum
-{
-       NET_NFC_WIFI_P2P_ATTRIBUTE_MANUFACTURER = 0x1021,
-       NET_NFC_WIFI_P2P_ATTRIBUTE_MODEL_NAME = 0x1023,
-       NET_NFC_WIFI_P2P_ATTRIBUTE_MODEL_NUMBER = 0x1024,
-       NET_NFC_WIFI_P2P_ATTRIBUTE_OOB_DEVICE_PASSWORD = 0x102C,
-       NET_NFC_WIFI_P2P_ATTRIBUTE_RF_BANDS = 0x103C,
-       NET_NFC_WIFI_P2P_ATTRIBUTE_SERIAL_NUMBER = 0x1042,
-       NET_NFC_WIFI_P2P_ATTRIBUTE_UUID_E = 0x1047,
-       NET_NFC_WIFI_P2P_ATTRIBUTE_VEN_EXT = 0x1049,
-
-       NET_NFC_WIFI_P2P_ATTRIBUTE_CAPABILITY = 0x02,
-       NET_NFC_WIFI_P2P_ATTRIBUTE_DEVICE_INFO = 0x0D,
-       NET_NFC_WIFI_P2P_ATTRIBUTE_OOB_GROUP_OWNER_NEGO_CHANNEL = 0x13,
-       NET_NFC_WIFI_P2P_ATTRIBUTE_CHANNEL_LIST = 0x0B,
-       NET_NFC_WIFI_P2P_ATTRIBUTE_GROUP_INFO = 0x0E,
-       NET_NFC_WIFI_P2P_ATTRIBUTE_GROUP_ID = 0x0F,
-}
-net_nfc_carrier_wifi_p2p_attribute_e;
-
-typedef enum
-{
-       NET_NFC_BT_ATTRIBUTE_UUID16_PART = 0x02, /* More 16-bit UUIDs available */
-       NET_NFC_BT_ATTRIBUTE_UUID16 = 0x03, /* Complete list of 16-bit UUIDs */
-       NET_NFC_BT_ATTRIBUTE_UUID32_PART = 0x04, /* More 32-bit UUIDs available */
-       NET_NFC_BT_ATTRIBUTE_UUID32 = 0x05, /* Complete list of 32-bit UUIDs */
-       NET_NFC_BT_ATTRIBUTE_UUID128_PART = 0x06, /* More 128-bit UUIDs available */
-       NET_NFC_BT_ATTRIBUTE_UUID128 = 0x07, /* Complete list of 128-bit UUIDs */
-       NET_NFC_BT_ATTRIBUTE_NAME_PART = 0x08, /* Shortened local name */
-       NET_NFC_BT_ATTRIBUTE_NAME = 0x09, /* Complete local name */
-       NET_NFC_BT_ATTRIBUTE_TXPOWER = 0x0a, /* TX Power level */
-       NET_NFC_BT_ATTRIBUTE_OOB_COD = 0x0d, /* SSP OOB Class of Device */
-       NET_NFC_BT_ATTRIBUTE_OOB_HASH_C = 0x0e, /* SSP OOB Hash C */
-       NET_NFC_BT_ATTRIBUTE_OOB_HASH_R = 0x0f, /* SSP OOB Randomizer R */
-       NET_NFC_BT_ATTRIBUTE_ID = 0x10, /* Device ID */
-       NET_NFC_BT_ATTRIBUTE_MANUFACTURER = 0xFF, /* Manufacturer Specific Data */
-       NET_NFC_BT_ATTRIBUTE_ADDRESS = 0xF0, /* Bluetooth device Address */
-} net_nfc_handover_bt_attribute_e;
-
-typedef struct _net_nfc_carrier_config_s *net_nfc_carrier_config_h;
-typedef struct _net_nfc_carrier_property_s *net_nfc_property_group_h;
-
-typedef struct _net_nfc_ch_message_s *net_nfc_ch_message_h;
-typedef struct _net_nfc_ch_carrier_s *net_nfc_ch_carrier_h;
-
-typedef enum
-{
-       NET_NFC_SE_TYPE_NONE = 0x00,/**< Invalid */
-       NET_NFC_SE_TYPE_ESE = 0x01,/**< SmartMX */
-       NET_NFC_SE_TYPE_UICC = 0x02,/**< UICC */
-       NET_NFC_SE_TYPE_SDCARD = 0x03, /* SDCard type is not currently supported */
-       NET_NFC_SE_TYPE_HCE = 0x04, /* SDCard type is not currently supported */
-} net_nfc_se_type_e;
-
- typedef enum
- {
-       NET_NFC_SE_INVALID_ENTRY = 0x00, /**< Indicates SE type is Invalid */
-       NET_NFC_SE_TECH_ENTRY = 0x01, /*Technology*/
-       NET_NFC_SE_PROTOCOL_ENTRY = 0x02, /*Protocol*/
-       NET_NFC_SE_AID_ENTRY = 0x04, /*Using it clear aid table*/
-} net_nfc_se_entry_type_e;
-
-typedef enum
-{
-       NET_NFC_SE_INVALID_TECH_PROTO = 0x00, /**< Indicates SE type is Invalid */
-       NET_NFC_SE_TECH_A_ISODEP = 0x01,/*Type A /ISO DEP*/
-       NET_NFC_SE_TECH_B_NFCDEP = 0x02,/*Type B / NFC DEP*/
-       NET_NFC_SE_TECH_A_B_ISO_NFC_DEP = 0x03,/*Type B / NFC DEP*/
-       NET_NFC_SE_TECH_F = 0x04,/*Type F*/
-} net_nfc_se_tech_protocol_type_e;
-
-typedef enum
-{
-       NET_NFC_SE_INVALID = 0x00, /**< Indicates SE type is Invalid */
-       NET_NFC_SE_SWITCH_ON = 0x01,/* Target On*/
-       NET_NFC_SE_SWITCH_OFF = 0x02,/*Target Off*/
-       NET_NFC_SE_SCREEN_OFF = 0x08,
-       NET_NFC_SE_SCREEN_ON_LOCK = 0x10,
-       NET_NFC_SE_SCREEN_ON_UNLOCK = 0x20,
-} net_nfc_se_power_state_type_e;
-
-typedef enum
-{
-       NET_NFC_SIGN_TYPE_NO_SIGN = 0,
-       NET_NFC_SIGN_TYPE_PKCS_1,
-       NET_NFC_SIGN_TYPE_PKCS_1_V_1_5,
-       NET_NFC_SIGN_TYPE_DSA,
-       NET_NFC_SIGN_TYPE_ECDSA,
-       NET_NFC_MAX_SIGN_TYPE,
-} net_nfc_sign_type_t;
-
-typedef enum
-{
-       NET_NFC_CERT_FORMAT_X_509 = 0,
-       NET_NFC_CERT_FORMAT_X9_86,
-       NET_NFC_MAX_CERT_FORMAT,
-} net_nfc_cert_format_t;
-
-typedef enum
-{
-       NET_NFC_SNEP_GET = 1,
-       NET_NFC_SNEP_PUT = 2,
-} net_nfc_snep_type_t;
-
-typedef enum
-{
-       NET_NFC_LLCP_REGISTERED = -1,
-       NET_NFC_LLCP_UNREGISTERED = -2,
-       NET_NFC_LLCP_START  = -3,
-       NET_NFC_LLCP_STOP  = -4,
-}
-net_nfc_llcp_state_t;
-
-typedef enum
-{
-       NET_NFC_CARD_EMULATION_DISABLE = 0,
-       NET_NFC_CARD_EMELATION_ENABLE
-}
-net_nfc_card_emulation_mode_t;
-
-typedef enum
-{
-       NET_NFC_HCE_EVENT_DEACTIVATED = 0,
-       NET_NFC_HCE_EVENT_ACTIVATED = 1,
-       NET_NFC_HCE_EVENT_APDU_RECEIVED = 2,
-}
-net_nfc_hce_event_t;
-
-typedef enum
-{
-       NET_NFC_CARD_EMULATION_CATEGORY_UNKNOWN = 0,
-       NET_NFC_CARD_EMULATION_CATEGORY_PAYMENT = 1,
-       NET_NFC_CARD_EMULATION_CATEGORY_OTHER = 2,
-       NET_NFC_CARD_EMULATION_CATEGORY_MAX = 3,
-}
-net_nfc_card_emulation_category_t;
+       typedef enum {
+               NET_NFC_WIFI_ATTRIBUTE_VERSION = 0x104A,
+               NET_NFC_WIFI_ATTRIBUTE_CREDENTIAL = 0x100E,
+               NET_NFC_WIFI_ATTRIBUTE_NET_INDEX = 0x1026,
+               NET_NFC_WIFI_ATTRIBUTE_SSID = 0x1045,
+               NET_NFC_WIFI_ATTRIBUTE_AUTH_TYPE = 0x1003,      /*< WPA2PSK  0x0020 */
+               NET_NFC_WIFI_ATTRIBUTE_ENC_TYPE = 0x100F,       /*< AES           0x0008 */
+               NET_NFC_WIFI_ATTRIBUTE_NET_KEY = 0x1027,
+               NET_NFC_WIFI_ATTRIBUTE_MAC_ADDR = 0x1020,
+               NET_NFC_WIFI_ATTRIBUTE_CHANNEL = 0x1001,        /* Channel number - based on IEEE */
+               NET_NFC_WIFI_ATTRIBUTE_VEN_EXT = 0x1049,
+               NET_NFC_WIFI_ATTRIBUTE_VERSION2 = 0x00,
+       } net_nfc_carrier_wifi_attribute_e;
+
+       typedef enum {
+               NET_NFC_WIFI_P2P_ATTRIBUTE_MANUFACTURER = 0x1021,
+               NET_NFC_WIFI_P2P_ATTRIBUTE_MODEL_NAME = 0x1023,
+               NET_NFC_WIFI_P2P_ATTRIBUTE_MODEL_NUMBER = 0x1024,
+               NET_NFC_WIFI_P2P_ATTRIBUTE_OOB_DEVICE_PASSWORD = 0x102C,
+               NET_NFC_WIFI_P2P_ATTRIBUTE_RF_BANDS = 0x103C,
+               NET_NFC_WIFI_P2P_ATTRIBUTE_SERIAL_NUMBER = 0x1042,
+               NET_NFC_WIFI_P2P_ATTRIBUTE_UUID_E = 0x1047,
+               NET_NFC_WIFI_P2P_ATTRIBUTE_VEN_EXT = 0x1049,
+
+               NET_NFC_WIFI_P2P_ATTRIBUTE_CAPABILITY = 0x02,
+               NET_NFC_WIFI_P2P_ATTRIBUTE_DEVICE_INFO = 0x0D,
+               NET_NFC_WIFI_P2P_ATTRIBUTE_OOB_GROUP_OWNER_NEGO_CHANNEL = 0x13,
+               NET_NFC_WIFI_P2P_ATTRIBUTE_CHANNEL_LIST = 0x0B,
+               NET_NFC_WIFI_P2P_ATTRIBUTE_GROUP_INFO = 0x0E,
+               NET_NFC_WIFI_P2P_ATTRIBUTE_GROUP_ID = 0x0F,
+       } net_nfc_carrier_wifi_p2p_attribute_e;
+
+       typedef enum {
+               NET_NFC_BT_ATTRIBUTE_UUID16_PART = 0x02,        /* More 16-bit UUIDs available */
+               NET_NFC_BT_ATTRIBUTE_UUID16 = 0x03,     /* Complete list of 16-bit UUIDs */
+               NET_NFC_BT_ATTRIBUTE_UUID32_PART = 0x04,        /* More 32-bit UUIDs available */
+               NET_NFC_BT_ATTRIBUTE_UUID32 = 0x05,     /* Complete list of 32-bit UUIDs */
+               NET_NFC_BT_ATTRIBUTE_UUID128_PART = 0x06,       /* More 128-bit UUIDs available */
+               NET_NFC_BT_ATTRIBUTE_UUID128 = 0x07,    /* Complete list of 128-bit UUIDs */
+               NET_NFC_BT_ATTRIBUTE_NAME_PART = 0x08,  /* Shortened local name */
+               NET_NFC_BT_ATTRIBUTE_NAME = 0x09,       /* Complete local name */
+               NET_NFC_BT_ATTRIBUTE_TXPOWER = 0x0a,    /* TX Power level */
+               NET_NFC_BT_ATTRIBUTE_OOB_COD = 0x0d,    /* SSP OOB Class of Device */
+               NET_NFC_BT_ATTRIBUTE_OOB_HASH_C = 0x0e, /* SSP OOB Hash C */
+               NET_NFC_BT_ATTRIBUTE_OOB_HASH_R = 0x0f, /* SSP OOB Randomizer R */
+               NET_NFC_BT_ATTRIBUTE_ID = 0x10, /* Device ID */
+               NET_NFC_BT_ATTRIBUTE_MANUFACTURER = 0xFF,       /* Manufacturer Specific Data */
+               NET_NFC_BT_ATTRIBUTE_ADDRESS = 0xF0,    /* Bluetooth device Address */
+       } net_nfc_handover_bt_attribute_e;
+
+       typedef struct _net_nfc_carrier_config_s *net_nfc_carrier_config_h;
+       typedef struct _net_nfc_carrier_property_s *net_nfc_property_group_h;
+
+       typedef struct _net_nfc_ch_message_s *net_nfc_ch_message_h;
+       typedef struct _net_nfc_ch_carrier_s *net_nfc_ch_carrier_h;
+
+       typedef enum {
+               NET_NFC_SE_TYPE_NONE = 0x00,
+                                                               /**< Invalid */
+               NET_NFC_SE_TYPE_ESE = 0x01,
+                                                          /**< SmartMX */
+               NET_NFC_SE_TYPE_UICC = 0x02,
+                                                               /**< UICC */
+               NET_NFC_SE_TYPE_SDCARD = 0x03,  /* SDCard type is not currently supported */
+               NET_NFC_SE_TYPE_HCE = 0x04,     /* SDCard type is not currently supported */
+       } net_nfc_se_type_e;
+
+       typedef enum {
+               NET_NFC_SE_INVALID_ENTRY = 0x00,
+                                                                        /**< Indicates SE type is Invalid */
+               NET_NFC_SE_TECH_ENTRY = 0x01,   /*Technology */
+               NET_NFC_SE_PROTOCOL_ENTRY = 0x02,       /*Protocol */
+               NET_NFC_SE_AID_ENTRY = 0x04,    /*Using it clear aid table */
+       } net_nfc_se_entry_type_e;
+
+       typedef enum {
+               NET_NFC_SE_INVALID_TECH_PROTO = 0x00,
+                                                                                 /**< Indicates SE type is Invalid */
+               NET_NFC_SE_TECH_A_ISODEP = 0x01,        /*Type A /ISO DEP */
+               NET_NFC_SE_TECH_B_NFCDEP = 0x02,        /*Type B / NFC DEP */
+               NET_NFC_SE_TECH_A_B_ISO_NFC_DEP = 0x03, /*Type B / NFC DEP */
+               NET_NFC_SE_TECH_F = 0x04,       /*Type F */
+       } net_nfc_se_tech_protocol_type_e;
+
+       typedef enum {
+               NET_NFC_SE_INVALID = 0x00,
+                                                          /**< Indicates SE type is Invalid */
+               NET_NFC_SE_SWITCH_ON = 0x01,    /* Target On */
+               NET_NFC_SE_SWITCH_OFF = 0x02,   /*Target Off */
+               NET_NFC_SE_SCREEN_OFF = 0x08,
+               NET_NFC_SE_SCREEN_ON_LOCK = 0x10,
+               NET_NFC_SE_SCREEN_ON_UNLOCK = 0x20,
+       } net_nfc_se_power_state_type_e;
+
+       typedef enum {
+               NET_NFC_SIGN_TYPE_NO_SIGN = 0,
+               NET_NFC_SIGN_TYPE_PKCS_1,
+               NET_NFC_SIGN_TYPE_PKCS_1_V_1_5,
+               NET_NFC_SIGN_TYPE_DSA,
+               NET_NFC_SIGN_TYPE_ECDSA,
+               NET_NFC_MAX_SIGN_TYPE,
+       } net_nfc_sign_type_t;
+
+       typedef enum {
+               NET_NFC_CERT_FORMAT_X_509 = 0,
+               NET_NFC_CERT_FORMAT_X9_86,
+               NET_NFC_MAX_CERT_FORMAT,
+       } net_nfc_cert_format_t;
+
+       typedef enum {
+               NET_NFC_SNEP_GET = 1,
+               NET_NFC_SNEP_PUT = 2,
+       } net_nfc_snep_type_t;
+
+       typedef enum {
+               NET_NFC_LLCP_REGISTERED = -1,
+               NET_NFC_LLCP_UNREGISTERED = -2,
+               NET_NFC_LLCP_START = -3,
+               NET_NFC_LLCP_STOP = -4,
+       } net_nfc_llcp_state_t;
+
+       typedef enum {
+               NET_NFC_CARD_EMULATION_DISABLE = 0,
+               NET_NFC_CARD_EMELATION_ENABLE
+       } net_nfc_card_emulation_mode_t;
+
+       typedef enum {
+               NET_NFC_HCE_EVENT_DEACTIVATED = 0,
+               NET_NFC_HCE_EVENT_ACTIVATED = 1,
+               NET_NFC_HCE_EVENT_APDU_RECEIVED = 2,
+       } net_nfc_hce_event_t;
+
+       typedef enum {
+               NET_NFC_CARD_EMULATION_CATEGORY_UNKNOWN = 0,
+               NET_NFC_CARD_EMULATION_CATEGORY_PAYMENT = 1,
+               NET_NFC_CARD_EMULATION_CATEGORY_OTHER = 2,
+               NET_NFC_CARD_EMULATION_CATEGORY_MAX = 3,
+       } net_nfc_card_emulation_category_t;
 
 #ifdef __cplusplus
 }
 #endif
-
 /**
  @}
  */
-
-#endif //__NET_NFC_TYPEDEF_H__
+#endif                                                 //__NET_NFC_TYPEDEF_H__
index b35f9af..7070b36 100755 (executable)
@@ -1,25 +1,24 @@
  /*
- * Copyright   2012, 2013 Samsung Electronics Co., Ltd.
- *
- * Licensed under the Flora License, Version 1.1 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
-
- *     http://floralicense.org/license/
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
 * Copyright   2012, 2013 Samsung Electronics Co., Ltd.
 *
 * Licensed under the Flora License, Version 1.1 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
+
 *     http://floralicense.org/license/
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
 #ifndef __NET_NFC_TYPEDEF_INTERNAL_H__
 #define __NET_NFC_TYPEDEF_INTERNAL_H__
 
 #include "net_nfc_typedef.h"
 
-typedef enum
-{
+typedef enum {
        NET_NFC_POLL_START = 0x01,
        NET_NFC_POLL_STOP,
 } net_nfc_detect_mode_e;
@@ -27,63 +26,55 @@ typedef enum
 /**
  This structure is just data, to express bytes array
  */
-typedef struct _data_s
-{
+typedef struct _data_s {
        uint8_t *buffer;
        uint32_t length;
 } data_s;
 
-typedef struct _net_nfc_data_t
-{
+typedef struct _net_nfc_data_t {
        uint32_t length;
        uint8_t buffer[0];
 } net_nfc_data_s;
 
-typedef enum _net_nfc_connection_type_e
-{
+typedef enum _net_nfc_connection_type_e {
        NET_NFC_TAG_CONNECTION = 0x00,
        NET_NFC_P2P_CONNECTION_TARGET,
        NET_NFC_P2P_CONNECTION_INITIATOR,
        NET_NFC_SE_CONNECTION
 } net_nfc_connection_type_e;
 
-typedef struct _net_nfc_target_handle_s
-{
+typedef struct _net_nfc_target_handle_s {
        uint32_t connection_id;
        net_nfc_connection_type_e connection_type;
        net_nfc_target_type_e target_type;
-       /*++npp++*/
+       /*++npp++ */
        llcp_app_protocol_e app_type;
        /*--npp--*/
 } net_nfc_target_handle_s;
 
-typedef struct _net_nfc_current_target_info_s
-{
+typedef struct _net_nfc_current_target_info_s {
        net_nfc_target_handle_s *handle;
        uint32_t devType;
        int number_of_keys;
        net_nfc_data_s target_info_values;
-}net_nfc_current_target_info_s;
+} net_nfc_current_target_info_s;
 
-typedef struct _net_nfc_llcp_config_info_s
-{
+typedef struct _net_nfc_llcp_config_info_s {
        uint16_t miu; /** The remote Maximum Information Unit (NOTE: this is MIU, not MIUX !)*/
        uint16_t wks; /** The remote Well-Known Services*/
        uint8_t lto; /** The remote Link TimeOut (in 1/100s)*/
-       uint8_t option; /** The remote options*/
+       uint8_t option; /** The remote options*/
 } net_nfc_llcp_config_info_s;
 
-typedef struct _net_nfc_llcp_socket_option_s
-{
+typedef struct _net_nfc_llcp_socket_option_s {
        uint16_t miu; /** The remote Maximum Information Unit */
-       uint8_t rw; /** The Receive Window size (4 bits)*/
+       uint8_t rw;     /** The Receive Window size (4 bits)*/
        net_nfc_socket_type_e type;
 } net_nfc_llcp_socket_option_s;
 
-typedef struct _net_nfc_llcp_internal_socket_s
-{
+typedef struct _net_nfc_llcp_internal_socket_s {
        uint16_t miu; /** The remote Maximum Information Unit */
-       uint8_t rw; /** The Receive Window size (4 bits)*/
+       uint8_t rw;     /** The Receive Window size (4 bits)*/
        net_nfc_socket_type_e type;
        net_nfc_llcp_socket_t oal_socket;
        net_nfc_llcp_socket_t client_socket;
@@ -92,20 +83,19 @@ typedef struct _net_nfc_llcp_internal_socket_s
        net_nfc_target_handle_s *device_id;
        net_nfc_llcp_socket_cb cb;
        bool close_requested;
-       void *register_param; /* void param that has been registered in callback register time */
+       void *register_param;           /* void param that has been registered in callback register time */
 } net_nfc_llcp_internal_socket_s;
 
 /**
  ndef_record_s structure has the NDEF record data. it is only a record not a message
  */
-typedef struct _record_s
-{
-       uint8_t MB :1;
-       uint8_t ME :1;
-       uint8_t CF :1;
-       uint8_t SR :1;
-       uint8_t IL :1;
-       uint8_t TNF :3;
+typedef struct _record_s {
+       uint8_t MB:1;
+       uint8_t ME:1;
+       uint8_t CF:1;
+       uint8_t SR:1;
+       uint8_t IL:1;
+       uint8_t TNF:3;
        data_s type_s;
        data_s id_s;
        data_s payload_s;
@@ -115,41 +105,38 @@ typedef struct _record_s
 /**
  NDEF message it has record counts and records (linked listed form)
  */
-typedef struct _ndef_message_s
-{
+typedef struct _ndef_message_s {
        uint32_t recordCount;
-       ndef_record_s *records; // linked list
+       ndef_record_s *records;         // linked list
 } ndef_message_s;
 
 /**
  Enum value to stop or start the discovery mode
  */
 
-#define NET_NFC_MAX_UID_LENGTH            0x0AU       /**< Maximum UID length expected */
-#define NET_NFC_MAX_ATR_LENGTH            0x30U       /**< Maximum ATR_RES (General Bytes) */
-#define NET_NFC_ATQA_LENGTH               0x02U       /**< ATQA length */
-#define NET_NFC_ATQB_LENGTH               0x0BU       /**< ATQB length */
+#define NET_NFC_MAX_UID_LENGTH            0x0AU                  /**< Maximum UID length expected */
+#define NET_NFC_MAX_ATR_LENGTH            0x30U                  /**< Maximum ATR_RES (General Bytes) */
+#define NET_NFC_ATQA_LENGTH               0x02U                  /**< ATQA length */
+#define NET_NFC_ATQB_LENGTH               0x0BU                  /**< ATQB length */
 
-#define NET_NFC_PUPI_LENGTH               0x04U       /**< PUPI length */
-#define NET_NFC_APP_DATA_B_LENGTH         0x04U       /**< Application Data length for Type B */
-#define NET_NFC_PROT_INFO_B_LENGTH        0x03U       /**< Protocol info length for Type B  */
+#define NET_NFC_PUPI_LENGTH               0x04U                  /**< PUPI length */
+#define NET_NFC_APP_DATA_B_LENGTH         0x04U                  /**< Application Data length for Type B */
+#define NET_NFC_PROT_INFO_B_LENGTH        0x03U                  /**< Protocol info length for Type B  */
 
-#define NET_NFC_MAX_ATR_LENGTH            0x30U       /**< Maximum ATR_RES (General Bytes)  */
-#define NET_NFC_MAX_UID_LENGTH            0x0AU       /**< Maximum UID length expected */
-#define NET_NFC_FEL_ID_LEN                0x08U       /**< Felica current ID Length */
-#define NET_NFC_FEL_PM_LEN                0x08U       /**< Felica current PM Length */
-#define NET_NFC_FEL_SYS_CODE_LEN          0x02U       /**< Felica System Code Length */
+#define NET_NFC_MAX_ATR_LENGTH            0x30U                  /**< Maximum ATR_RES (General Bytes)  */
+#define NET_NFC_MAX_UID_LENGTH            0x0AU                  /**< Maximum UID length expected */
+#define NET_NFC_FEL_ID_LEN                0x08U                  /**< Felica current ID Length */
+#define NET_NFC_FEL_PM_LEN                0x08U                  /**< Felica current PM Length */
+#define NET_NFC_FEL_SYS_CODE_LEN          0x02U                  /**< Felica System Code Length */
 
-#define NET_NFC_15693_UID_LENGTH          0x08U       /**< Length of the Inventory bytes for  */
+#define NET_NFC_15693_UID_LENGTH          0x08U                  /**< Length of the Inventory bytes for  */
 
-typedef struct _net_nfc_tag_info_s
-{
+typedef struct _net_nfc_tag_info_s {
        char *key;
        data_h value;
 } net_nfc_tag_info_s;
 
-typedef struct _net_nfc_target_info_s
-{
+typedef struct _net_nfc_target_info_s {
        net_nfc_target_handle_s *handle;
        net_nfc_target_type_e devType;
        uint8_t is_ndef_supported;
@@ -162,45 +149,37 @@ typedef struct _net_nfc_target_info_s
        data_s raw_data;
 } net_nfc_target_info_s;
 
-typedef struct _net_nfc_se_event_info_s
-{
+typedef struct _net_nfc_se_event_info_s {
        data_s aid;
        data_s param;
 } net_nfc_se_event_info_s;
 
-typedef struct _net_nfc_transceive_info_s
-{
+typedef struct _net_nfc_transceive_info_s {
        uint32_t dev_type;
        data_s trans_data;
 } net_nfc_transceive_info_s;
 
-typedef struct _net_nfc_connection_handover_info_s
-{
+typedef struct _net_nfc_connection_handover_info_s {
        net_nfc_conn_handover_carrier_type_e type;
        data_s data;
-}
-net_nfc_connection_handover_info_s;
+} net_nfc_connection_handover_info_s;
 
-typedef enum _client_state_e
-{
+typedef enum _client_state_e {
        NET_NFC_CLIENT_INACTIVE_STATE = 0x00,
        NET_NFC_CLIENT_ACTIVE_STATE,
 } client_state_e;
 
-typedef enum _net_nfc_launch_popup_check_e
-{
+typedef enum _net_nfc_launch_popup_check_e {
        CHECK_FOREGROUND = 0x00,
        NO_CHECK_FOREGROUND,
 } net_nfc_launch_popup_check_e;
 
-typedef enum _net_nfc_launch_popup_state_e
-{
+typedef enum _net_nfc_launch_popup_state_e {
        NET_NFC_LAUNCH_APP_SELECT = 0x00,
        NET_NFC_NO_LAUNCH_APP_SELECT,
 } net_nfc_launch_popup_state_e;
 
-typedef enum _net_nfc_privilege_e
-{
+typedef enum _net_nfc_privilege_e {
        NET_NFC_PRIVILEGE_NFC = 0x00,
        NET_NFC_PRIVILEGE_NFC_ADMIN,
        NET_NFC_PRIVILEGE_NFC_TAG,
@@ -228,53 +207,36 @@ typedef enum _net_nfc_privilege_e
        void *user_param; \
        /* DON'T MODIFY THIS CODE - END */
 
-typedef struct _net_nfc_request_msg_t
-{
-       NET_NFC_REQUEST_MSG_HEADER
-} net_nfc_request_msg_t;
-
-typedef struct _net_nfc_request_target_detected_t
-{
-       NET_NFC_REQUEST_MSG_HEADER
+typedef struct _net_nfc_request_msg_t {
+NET_NFC_REQUEST_MSG_HEADER} net_nfc_request_msg_t;
 
-       net_nfc_target_handle_s *handle;
+typedef struct _net_nfc_request_target_detected_t {
+       NET_NFC_REQUEST_MSG_HEADER net_nfc_target_handle_s *handle;
        uint32_t devType;
        int number_of_keys;
        net_nfc_data_s target_info_values;
 } net_nfc_request_target_detected_t;
 
-typedef struct _net_nfc_request_se_event_t
-{
-       NET_NFC_REQUEST_MSG_HEADER
-
-       data_s aid;
+typedef struct _net_nfc_request_se_event_t {
+       NET_NFC_REQUEST_MSG_HEADER data_s aid;
        data_s param;
 } net_nfc_request_se_event_t;
 
-typedef struct _net_nfc_request_llcp_msg_t
-{
-       NET_NFC_REQUEST_MSG_HEADER
-
-       uint32_t result;
+typedef struct _net_nfc_request_llcp_msg_t {
+       NET_NFC_REQUEST_MSG_HEADER uint32_t result;
        net_nfc_llcp_socket_t llcp_socket;
 } net_nfc_request_llcp_msg_t;
 
-typedef struct _net_nfc_request_hce_apdu_t
-{
-       NET_NFC_REQUEST_MSG_HEADER
-
-       data_s apdu;
+typedef struct _net_nfc_request_hce_apdu_t {
+       NET_NFC_REQUEST_MSG_HEADER data_s apdu;
 } net_nfc_request_hce_apdu_t;
 
-typedef struct _net_nfc_request_listen_socket_t
-{
-       NET_NFC_REQUEST_MSG_HEADER
-
-       uint32_t result;
+typedef struct _net_nfc_request_listen_socket_t {
+       NET_NFC_REQUEST_MSG_HEADER uint32_t result;
        net_nfc_target_handle_s *handle;
        net_nfc_llcp_socket_t client_socket;
        uint16_t miu; /** The remote Maximum Information Unit */
-       uint8_t rw; /** The Receive Window size (4 bits)*/
+       uint8_t rw;     /** The Receive Window size (4 bits)*/
        net_nfc_socket_type_e type;
        net_nfc_llcp_socket_t oal_socket;
        sap_t sap;
@@ -282,11 +244,8 @@ typedef struct _net_nfc_request_listen_socket_t
        net_nfc_data_s service_name;
 } net_nfc_request_listen_socket_t;
 
-typedef struct _net_nfc_request_receive_socket_t
-{
-       NET_NFC_REQUEST_MSG_HEADER
-
-       uint32_t result;
+typedef struct _net_nfc_request_receive_socket_t {
+       NET_NFC_REQUEST_MSG_HEADER uint32_t result;
        net_nfc_target_handle_s *handle;
        net_nfc_llcp_socket_t client_socket;
        net_nfc_llcp_socket_t oal_socket;
@@ -295,11 +254,8 @@ typedef struct _net_nfc_request_receive_socket_t
        net_nfc_data_s data;
 } net_nfc_request_receive_socket_t;
 
-typedef struct _net_nfc_request_receive_from_socket_t
-{
-       NET_NFC_REQUEST_MSG_HEADER
-
-       uint32_t result;
+typedef struct _net_nfc_request_receive_from_socket_t {
+       NET_NFC_REQUEST_MSG_HEADER uint32_t result;
        net_nfc_target_handle_s *handle;
        net_nfc_llcp_socket_t client_socket;
        net_nfc_llcp_socket_t oal_socket;
@@ -311,53 +267,43 @@ typedef struct _net_nfc_request_receive_from_socket_t
 
 // these are messages for response
 
-typedef void (*target_detection_listener_cb)(void *data, void *user_param);
-typedef void (*se_transaction_listener_cb)(void *data, void *user_param);
-typedef void (*llcp_event_listener_cb)(void *data, void *user_param);
-
+typedef void (*target_detection_listener_cb) (void *data, void *user_param);
+typedef void (*se_transaction_listener_cb) (void *data, void *user_param);
+typedef void (*llcp_event_listener_cb) (void *data, void *user_param);
 
 /*HCE CB*/
-typedef void (*hce_active_listener_cb)(void *user_param);
-typedef void (*hce_deactive_listener_cb)(void *user_param);
-typedef void (*hce_apdu_listener_cb)(void *data, void *user_param);
-
+typedef void (*hce_active_listener_cb) (void *user_param);
+typedef void (*hce_deactive_listener_cb) (void *user_param);
+typedef void (*hce_apdu_listener_cb) (void *data, void *user_param);
 
-typedef enum _llcp_event_e
-{
+typedef enum _llcp_event_e {
        LLCP_EVENT_SOCKET_ACCEPTED = 0x1,
        LLCP_EVENT_SOCKET_ERROR,
        LLCP_EVENT_DEACTIVATED,
 } llcp_event_e;
 
-typedef struct _net_nfc_stack_information_s
-{
+typedef struct _net_nfc_stack_information_s {
        uint32_t net_nfc_supported_tagetType;
        uint32_t net_nfc_fw_version;
 } net_nfc_stack_information_s;
 
-typedef enum _net_nfc_discovery_mode_e
-{
+typedef enum _net_nfc_discovery_mode_e {
        NET_NFC_DISCOVERY_MODE_STOP = 0x00,
        NET_NFC_DISCOVERY_MODE_CONFIG_POLLING = 0x01,
        NET_NFC_DISCOVERY_MODE_CONFIG_LISTENING = 0x02,
        NET_NFC_DISCOVERY_MODE_CONFIG_P2P = 0x04,
-       NET_NFC_DISCOVERY_MODE_CONFIG_ALL = NET_NFC_DISCOVERY_MODE_CONFIG_POLLING |
-                                       NET_NFC_DISCOVERY_MODE_CONFIG_LISTENING |
-                                       NET_NFC_DISCOVERY_MODE_CONFIG_P2P,
-       NET_NFC_DISCOVERY_MODE_CONFIG_DEFAULT = NET_NFC_DISCOVERY_MODE_CONFIG_POLLING |
-                                       NET_NFC_DISCOVERY_MODE_CONFIG_LISTENING,
+       NET_NFC_DISCOVERY_MODE_CONFIG_ALL = NET_NFC_DISCOVERY_MODE_CONFIG_POLLING | NET_NFC_DISCOVERY_MODE_CONFIG_LISTENING | NET_NFC_DISCOVERY_MODE_CONFIG_P2P,
+       NET_NFC_DISCOVERY_MODE_CONFIG_DEFAULT = NET_NFC_DISCOVERY_MODE_CONFIG_POLLING | NET_NFC_DISCOVERY_MODE_CONFIG_LISTENING,
        NET_NFC_DISCOVERY_MODE_CONFIG = NET_NFC_DISCOVERY_MODE_CONFIG_DEFAULT,
-        NET_NFC_DISCOVERY_MODE_START_LISTENING = NET_NFC_DISCOVERY_MODE_CONFIG_LISTENING,
+       NET_NFC_DISCOVERY_MODE_START_LISTENING = NET_NFC_DISCOVERY_MODE_CONFIG_LISTENING,
        NET_NFC_DISCOVERY_MODE_START_POLLING = NET_NFC_DISCOVERY_MODE_CONFIG_POLLING,
        NET_NFC_DISCOVERY_MODE_START_ALL = NET_NFC_DISCOVERY_MODE_CONFIG_ALL,
        NET_NFC_DISCOVERY_MODE_START_DEFAULT = NET_NFC_DISCOVERY_MODE_CONFIG_DEFAULT,
        NET_NFC_DISCOVERY_MODE_START = NET_NFC_DISCOVERY_MODE_START_DEFAULT,
        NET_NFC_DISCOVERY_MODE_RESUME = NET_NFC_DISCOVERY_MODE_START
- } net_nfc_discovery_mode_e;
-
+} net_nfc_discovery_mode_e;
 
-typedef enum _net_nfc_secure_element_policy_e
-{
+typedef enum _net_nfc_secure_element_policy_e {
        SECURE_ELEMENT_POLICY_INVALID = 0x00,
        SECURE_ELEMENT_POLICY_UICC_ON = 0x01,
        SECURE_ELEMENT_POLICY_UICC_OFF = 0x02,
@@ -367,23 +313,20 @@ typedef enum _net_nfc_secure_element_policy_e
        SECURE_ELEMENT_POLICY_HCE_OFF = 0x06
 } net_nfc_secure_element_policy_e;
 
- typedef enum _net_nfc_secure_element_type_e
- {
-       SECURE_ELEMENT_TYPE_INVALID = 0x00, /**< Indicates SE type is Invalid */
-       SECURE_ELEMENT_TYPE_ESE = 0x01, /**< Indicates SE type is SmartMX */
+typedef enum _net_nfc_secure_element_type_e {
+       SECURE_ELEMENT_TYPE_INVALID = 0x00,     /**< Indicates SE type is Invalid */
+       SECURE_ELEMENT_TYPE_ESE = 0x01, /**< Indicates SE type is SmartMX */
        SECURE_ELEMENT_TYPE_UICC = 0x02, /**<Indicates SE type is   UICC */
-       SECURE_ELEMENT_TYPE_HCE = 0x03, /**<Indicates SE type is   HCE */
+       SECURE_ELEMENT_TYPE_HCE = 0x03, /**<Indicates SE type is   HCE */
        SECURE_ELEMENT_TYPE_UNKNOWN = 0x04 /**< Indicates SE type is Unknown */
 } net_nfc_secure_element_type_e;
 
-typedef enum _net_nfc_secure_element_state_e
-{
+typedef enum _net_nfc_secure_element_state_e {
        SECURE_ELEMENT_INACTIVE_STATE = 0x00, /**< state of the SE is In active*/
-       SECURE_ELEMENT_ACTIVE_STATE = 0x01, /**< state of the SE is active  */
+       SECURE_ELEMENT_ACTIVE_STATE = 0x01,     /**< state of the SE is active  */
 } net_nfc_secure_element_state_e;
 
-typedef enum _net_nfc_wallet_mode_e
-{
+typedef enum _net_nfc_wallet_mode_e {
        NET_NFC_WALLET_MODE_MANUAL = 0x00,
        NET_NFC_WALLET_MODE_AUTOMATIC = 0x01,
        NET_NFC_WALLET_MODE_UICC = 0x02,
@@ -391,23 +334,20 @@ typedef enum _net_nfc_wallet_mode_e
        NET_NFC_WALLET_MODE_HCE = 0x04,
 } net_nfc_wallet_mode_e;
 
-typedef struct _secure_element_info_s
-{
+typedef struct _secure_element_info_s {
        net_nfc_target_handle_s *handle;
        net_nfc_secure_element_type_e secure_element_type;
        net_nfc_secure_element_state_e secure_element_state;
 
 } net_nfc_secure_element_info_s;
 
-typedef enum _net_nfc_secure_element_mode_e
-{
+typedef enum _net_nfc_secure_element_mode_e {
        SECURE_ELEMENT_WIRED_MODE = 0x00, /**< Enables Wired Mode communication.This mode shall be applied to */
        SECURE_ELEMENT_VIRTUAL_MODE, /**< Enables Virtual Mode communication.This can be applied to UICC as well as SmartMX*/
-       SECURE_ELEMENT_OFF_MODE /**< Inactivate SE.This means,put SE in in-active state */
+       SECURE_ELEMENT_OFF_MODE /**< Inactivate SE.This means,put SE in in-active state */
 } net_nfc_secure_element_mode_e;
 
-typedef enum _net_nfc_message_service_e
-{
+typedef enum _net_nfc_message_service_e {
        NET_NFC_MESSAGE_SERVICE_RESET = 2000,
        NET_NFC_MESSAGE_SERVICE_INIT,
        NET_NFC_MESSAGE_SERVICE_ACTIVATE,
@@ -439,8 +379,7 @@ typedef enum _net_nfc_message_service_e
        NET_NFC_MESSAGE_SERVICE_SET_LAUNCH_STATE,
 } net_nfc_message_service_e;
 
-typedef enum _net_nfc_se_command_e
-{
+typedef enum _net_nfc_se_command_e {
        NET_NFC_SE_CMD_UICC_ON = 0,
        NET_NFC_SE_CMD_ESE_ON,
        NET_NFC_SE_CMD_ALL_OFF,
@@ -449,8 +388,7 @@ typedef enum _net_nfc_se_command_e
 
 /* connection handover info */
 
-typedef enum
-{
+typedef enum {
        NET_NFC_CONN_HANDOVER_ERR_REASON_RESERVED = 0x00,
        NET_NFC_CONN_HANDOVER_ERR_REASON_TEMP_MEM_CONSTRAINT,
        NET_NFC_CONN_HANDOVER_ERR_REASON_PERM_MEM_CONSTRAINT,
@@ -464,24 +402,20 @@ typedef enum
 
 #define URI_SCHEM_FILE "file://"
 
-typedef void (*net_nfc_service_llcp_cb)(net_nfc_llcp_socket_t socket,
-       net_nfc_error_e result, data_s *data, void *extra, void *user_param);
+typedef void (*net_nfc_service_llcp_cb) (net_nfc_llcp_socket_t socket, net_nfc_error_e result, data_s * data, void *extra, void *user_param);
 
-typedef struct _net_nfc_llcp_param_t
-{
+typedef struct _net_nfc_llcp_param_t {
        net_nfc_llcp_socket_t socket;
        net_nfc_service_llcp_cb cb;
        data_s data;
        void *user_param;
-}
-net_nfc_llcp_param_t;
+} net_nfc_llcp_param_t;
 
-typedef enum
-{
+typedef enum {
        NET_NFC_SCREEN_INVALID = 0x00,
        NET_NFC_SCREEN_OFF = 0x01,
        NET_NFC_SCREEN_ON_LOCK = 0x02,
        NET_NFC_SCREEN_ON_UNLOCK = 0x03,
 } net_nfc_screen_state_type_e;
 
-#endif //__NET_NFC_TYPEDEF_INTERNAL_H__
+#endif                                                 //__NET_NFC_TYPEDEF_INTERNAL_H__
index 500a03c..7478730 100755 (executable)
@@ -20,4 +20,4 @@
 #define NET_NFC_UTIL_MSG_TYPE_REQUEST  0
 #define NET_NFC_UTIL_MSG_TYPE_RESPONSE 1
 
-#endif //__NET_NFC_UTIL_DEFINES_H__
+#endif                                                 //__NET_NFC_UTIL_DEFINES_H__
index 0d7d682..3a5ae73 100644 (file)
 
 #include "net_nfc_typedef_internal.h"
 
-void net_nfc_util_gdbus_variant_to_buffer(GVariant *variant, uint8_t **buffer,
-               size_t *length);
+void net_nfc_util_gdbus_variant_to_buffer(GVariant * variant, uint8_t ** buffer, size_t * length);
 
-data_s *net_nfc_util_gdbus_variant_to_data(GVariant *variant);
+data_s *net_nfc_util_gdbus_variant_to_data(GVariant * variant);
 
-void net_nfc_util_gdbus_variant_to_data_s(GVariant *variant, data_s *data);
+void net_nfc_util_gdbus_variant_to_data_s(GVariant * variant, data_s * data);
 
-GVariant *net_nfc_util_gdbus_buffer_to_variant(const uint8_t *buffer,
-       size_t length);
+GVariant *net_nfc_util_gdbus_buffer_to_variant(const uint8_t * buffer, size_t length);
 
-GVariant *net_nfc_util_gdbus_data_to_variant(const data_s *data);
+GVariant *net_nfc_util_gdbus_data_to_variant(const data_s * data);
 
-ndef_message_s *net_nfc_util_gdbus_variant_to_ndef_message(GVariant *variant);
+ndef_message_s *net_nfc_util_gdbus_variant_to_ndef_message(GVariant * variant);
 
-GVariant *net_nfc_util_gdbus_ndef_message_to_variant(
-       const ndef_message_s *message);
+GVariant *net_nfc_util_gdbus_ndef_message_to_variant(const ndef_message_s * message);
 
-#endif //__NET_NFC_UTIL_GDBUS_INTERNAL_H__
+#endif                                                 //__NET_NFC_UTIL_GDBUS_INTERNAL_H__
index a901d98..c76ce91 100755 (executable)
@@ -19,8 +19,7 @@
 #include "net_nfc_typedef_internal.h"
 
 #ifdef __cplusplus
-extern "C"
-{
+extern "C" {
 #endif
 
 #define CH_MAJOR_VER           1
@@ -55,205 +54,131 @@ extern "C"
 #define CH_WIFI_IBSS_MIME      CH_WIFI_P2P_MIME
 #define CH_WIFI_DIRECT_MIME    CH_WIFI_P2P_MIME
 
-typedef struct _net_nfc_carrier_property_s
-{
-       bool is_group;
-       uint16_t attribute;
-       uint16_t length;
-       void *data;
-} net_nfc_carrier_property_s;
-
-typedef struct _net_nfc_carrier_config_s
-{
-       net_nfc_conn_handover_carrier_type_e type;
-       uint32_t length;
-       struct _GNode *data;
-} net_nfc_carrier_config_s;
-
-
-typedef enum
-{
-       NET_NFC_CH_TYPE_UNKNOWN,
-       NET_NFC_CH_TYPE_REQUEST,
-       NET_NFC_CH_TYPE_SELECT,
-       NET_NFC_CH_TYPE_MEDIATION,
-       NET_NFC_CH_TYPE_INITIAITE,
-       NET_NFC_CH_TYPE_MAX,
-}
-net_nfc_ch_type_e;
-
-typedef struct _net_nfc_ch_carrier_s
-{
-       net_nfc_conn_handover_carrier_type_e type;
-       net_nfc_conn_handover_carrier_state_e cps;
-       ndef_record_s *carrier_record;
-       struct _GList *aux_records;
-}
-net_nfc_ch_carrier_s;
-
-typedef struct _net_nfc_ch_message_s
-{
-       net_nfc_ch_type_e type;
-       uint8_t version;
-       uint16_t cr;
-       struct _GList *carriers;
-}
-net_nfc_ch_message_s;
+       typedef struct _net_nfc_carrier_property_s {
+               bool is_group;
+               uint16_t attribute;
+               uint16_t length;
+               void *data;
+       } net_nfc_carrier_property_s;
 
-net_nfc_error_e net_nfc_util_create_carrier_config(
-       net_nfc_carrier_config_s **config,
-       net_nfc_conn_handover_carrier_type_e type);
+       typedef struct _net_nfc_carrier_config_s {
+               net_nfc_conn_handover_carrier_type_e type;
+               uint32_t length;
+               struct _GNode *data;
+       } net_nfc_carrier_config_s;
 
-net_nfc_error_e net_nfc_util_add_carrier_config_property(
-       net_nfc_carrier_config_s *config,
-       uint16_t attribute, uint16_t size, uint8_t *data);
+       typedef enum {
+               NET_NFC_CH_TYPE_UNKNOWN,
+               NET_NFC_CH_TYPE_REQUEST,
+               NET_NFC_CH_TYPE_SELECT,
+               NET_NFC_CH_TYPE_MEDIATION,
+               NET_NFC_CH_TYPE_INITIAITE,
+               NET_NFC_CH_TYPE_MAX,
+       } net_nfc_ch_type_e;
 
-net_nfc_error_e net_nfc_util_remove_carrier_config_property(
-       net_nfc_carrier_config_s *config, uint16_t attribute);
+       typedef struct _net_nfc_ch_carrier_s {
+               net_nfc_conn_handover_carrier_type_e type;
+               net_nfc_conn_handover_carrier_state_e cps;
+               ndef_record_s *carrier_record;
+               struct _GList *aux_records;
+       } net_nfc_ch_carrier_s;
 
-net_nfc_error_e net_nfc_util_get_carrier_config_property(
-       net_nfc_carrier_config_s *config,
-       uint16_t attribute, uint16_t *size, uint8_t **data);
+       typedef struct _net_nfc_ch_message_s {
+               net_nfc_ch_type_e type;
+               uint8_t version;
+               uint16_t cr;
+               struct _GList *carriers;
+       } net_nfc_ch_message_s;
 
-net_nfc_error_e net_nfc_util_append_carrier_config_group(
-       net_nfc_carrier_config_s *config, net_nfc_carrier_property_s *group);
+       net_nfc_error_e net_nfc_util_create_carrier_config(net_nfc_carrier_config_s ** config, net_nfc_conn_handover_carrier_type_e type);
 
-net_nfc_error_e net_nfc_util_remove_carrier_config_group(
-       net_nfc_carrier_config_s *config, net_nfc_carrier_property_s *group);
+       net_nfc_error_e net_nfc_util_add_carrier_config_property(net_nfc_carrier_config_s * config, uint16_t attribute, uint16_t size, uint8_t * data);
 
-net_nfc_error_e net_nfc_util_get_carrier_config_group(
-       net_nfc_carrier_config_s *config, uint16_t attribute,
-       net_nfc_carrier_property_s **group);
+       net_nfc_error_e net_nfc_util_remove_carrier_config_property(net_nfc_carrier_config_s * config, uint16_t attribute);
 
-net_nfc_error_e net_nfc_util_free_carrier_config(
-       net_nfc_carrier_config_s *config);
+       net_nfc_error_e net_nfc_util_get_carrier_config_property(net_nfc_carrier_config_s * config, uint16_t attribute, uint16_t * size, uint8_t ** data);
 
+       net_nfc_error_e net_nfc_util_append_carrier_config_group(net_nfc_carrier_config_s * config, net_nfc_carrier_property_s * group);
 
-net_nfc_error_e net_nfc_util_create_carrier_config_group(
-       net_nfc_carrier_property_s **group, uint16_t attribute);
+       net_nfc_error_e net_nfc_util_remove_carrier_config_group(net_nfc_carrier_config_s * config, net_nfc_carrier_property_s * group);
 
-net_nfc_error_e net_nfc_util_add_carrier_config_group_property(
-       net_nfc_carrier_property_s *group,
-       uint16_t attribute, uint16_t size, uint8_t *data);
+       net_nfc_error_e net_nfc_util_get_carrier_config_group(net_nfc_carrier_config_s * config, uint16_t attribute, net_nfc_carrier_property_s ** group);
 
-net_nfc_error_e net_nfc_util_get_carrier_config_group_property(
-       net_nfc_carrier_property_s *group,
-       uint16_t attribute, uint16_t *size, uint8_t **data);
+       net_nfc_error_e net_nfc_util_free_carrier_config(net_nfc_carrier_config_s * config);
 
-net_nfc_error_e net_nfc_util_remove_carrier_config_group_property(
-       net_nfc_carrier_property_s *group, uint16_t attribute);
+       net_nfc_error_e net_nfc_util_create_carrier_config_group(net_nfc_carrier_property_s ** group, uint16_t attribute);
 
-net_nfc_error_e net_nfc_util_free_carrier_group(
-       net_nfc_carrier_property_s *group);
+       net_nfc_error_e net_nfc_util_add_carrier_config_group_property(net_nfc_carrier_property_s * group, uint16_t attribute, uint16_t size, uint8_t * data);
 
-net_nfc_error_e net_nfc_util_create_ndef_record_with_carrier_config(
-       ndef_record_s **record, net_nfc_carrier_config_s *config);
+       net_nfc_error_e net_nfc_util_get_carrier_config_group_property(net_nfc_carrier_property_s * group, uint16_t attribute, uint16_t * size, uint8_t ** data);
 
-net_nfc_error_e net_nfc_util_create_carrier_config_from_config_record(
-       net_nfc_carrier_config_s **config, ndef_record_s *record);
+       net_nfc_error_e net_nfc_util_remove_carrier_config_group_property(net_nfc_carrier_property_s * group, uint16_t attribute);
 
-net_nfc_error_e net_nfc_util_create_carrier_config_from_carrier(
-       net_nfc_carrier_config_s **config, net_nfc_ch_carrier_s *carrier);
+       net_nfc_error_e net_nfc_util_free_carrier_group(net_nfc_carrier_property_s * group);
 
-net_nfc_error_e net_nfc_util_create_handover_error_record(
-       ndef_record_s **record, uint8_t reason, uint32_t data);
+       net_nfc_error_e net_nfc_util_create_ndef_record_with_carrier_config(ndef_record_s ** record, net_nfc_carrier_config_s * config);
 
+       net_nfc_error_e net_nfc_util_create_carrier_config_from_config_record(net_nfc_carrier_config_s ** config, ndef_record_s * record);
 
-net_nfc_error_e net_nfc_util_create_handover_carrier(
-       net_nfc_ch_carrier_s **carrier,
-       net_nfc_conn_handover_carrier_state_e cps);
+       net_nfc_error_e net_nfc_util_create_carrier_config_from_carrier(net_nfc_carrier_config_s ** config, net_nfc_ch_carrier_s * carrier);
 
-net_nfc_error_e net_nfc_util_duplicate_handover_carrier(
-       net_nfc_ch_carrier_s **dest,
-       net_nfc_ch_carrier_s *src);
+       net_nfc_error_e net_nfc_util_create_handover_error_record(ndef_record_s ** record, uint8_t reason, uint32_t data);
 
-net_nfc_error_e net_nfc_util_free_handover_carrier(
-       net_nfc_ch_carrier_s *carrier);
+       net_nfc_error_e net_nfc_util_create_handover_carrier(net_nfc_ch_carrier_s ** carrier, net_nfc_conn_handover_carrier_state_e cps);
 
-net_nfc_error_e net_nfc_util_set_handover_carrier_cps(
-       net_nfc_ch_carrier_s *carrier,
-       net_nfc_conn_handover_carrier_state_e cps);
+       net_nfc_error_e net_nfc_util_duplicate_handover_carrier(net_nfc_ch_carrier_s ** dest, net_nfc_ch_carrier_s * src);
 
-net_nfc_error_e net_nfc_util_get_handover_carrier_cps(
-       net_nfc_ch_carrier_s *carrier,
-       net_nfc_conn_handover_carrier_state_e *cps);
+       net_nfc_error_e net_nfc_util_free_handover_carrier(net_nfc_ch_carrier_s * carrier);
 
-net_nfc_error_e net_nfc_util_set_handover_carrier_type(
-       net_nfc_ch_carrier_s *carrier,
-       net_nfc_conn_handover_carrier_type_e type);
+       net_nfc_error_e net_nfc_util_set_handover_carrier_cps(net_nfc_ch_carrier_s * carrier, net_nfc_conn_handover_carrier_state_e cps);
 
-net_nfc_error_e net_nfc_util_get_handover_carrier_type(
-       net_nfc_ch_carrier_s *carrier,
-       net_nfc_conn_handover_carrier_type_e *type);
+       net_nfc_error_e net_nfc_util_get_handover_carrier_cps(net_nfc_ch_carrier_s * carrier, net_nfc_conn_handover_carrier_state_e * cps);
 
-net_nfc_error_e net_nfc_util_append_handover_carrier_record(
-       net_nfc_ch_carrier_s *carrier, ndef_record_s *record);
+       net_nfc_error_e net_nfc_util_set_handover_carrier_type(net_nfc_ch_carrier_s * carrier, net_nfc_conn_handover_carrier_type_e type);
 
-net_nfc_error_e net_nfc_util_get_handover_carrier_record(
-       net_nfc_ch_carrier_s *carrier, ndef_record_s **record);
+       net_nfc_error_e net_nfc_util_get_handover_carrier_type(net_nfc_ch_carrier_s * carrier, net_nfc_conn_handover_carrier_type_e * type);
 
-net_nfc_error_e net_nfc_util_remove_handover_carrier_record(
-       net_nfc_ch_carrier_s *carrier);
+       net_nfc_error_e net_nfc_util_append_handover_carrier_record(net_nfc_ch_carrier_s * carrier, ndef_record_s * record);
 
-net_nfc_error_e net_nfc_util_append_handover_auxiliary_record(
-       net_nfc_ch_carrier_s *carrier, ndef_record_s *record);
+       net_nfc_error_e net_nfc_util_get_handover_carrier_record(net_nfc_ch_carrier_s * carrier, ndef_record_s ** record);
 
-net_nfc_error_e net_nfc_util_get_handover_auxiliary_record_count(
-       net_nfc_ch_carrier_s *carrier, uint32_t *count);
+       net_nfc_error_e net_nfc_util_remove_handover_carrier_record(net_nfc_ch_carrier_s * carrier);
 
-net_nfc_error_e net_nfc_util_get_handover_auxiliary_record(
-       net_nfc_ch_carrier_s *carrier, int index, ndef_record_s **record);
+       net_nfc_error_e net_nfc_util_append_handover_auxiliary_record(net_nfc_ch_carrier_s * carrier, ndef_record_s * record);
 
-net_nfc_error_e net_nfc_util_remove_handover_auxiliary_record(
-       net_nfc_ch_carrier_s *carrier, ndef_record_s *record);
+       net_nfc_error_e net_nfc_util_get_handover_auxiliary_record_count(net_nfc_ch_carrier_s * carrier, uint32_t * count);
 
+       net_nfc_error_e net_nfc_util_get_handover_auxiliary_record(net_nfc_ch_carrier_s * carrier, int index, ndef_record_s ** record);
 
-net_nfc_error_e net_nfc_util_create_handover_message(
-       net_nfc_ch_message_s **message);
+       net_nfc_error_e net_nfc_util_remove_handover_auxiliary_record(net_nfc_ch_carrier_s * carrier, ndef_record_s * record);
 
-net_nfc_error_e net_nfc_util_free_handover_message(
-       net_nfc_ch_message_s *message);
+       net_nfc_error_e net_nfc_util_create_handover_message(net_nfc_ch_message_s ** message);
 
-net_nfc_error_e net_nfc_util_set_handover_message_type(
-       net_nfc_ch_message_s *message, net_nfc_ch_type_e type);
+       net_nfc_error_e net_nfc_util_free_handover_message(net_nfc_ch_message_s * message);
 
-net_nfc_error_e net_nfc_util_get_handover_message_type(
-       net_nfc_ch_message_s *message, net_nfc_ch_type_e *type);
+       net_nfc_error_e net_nfc_util_set_handover_message_type(net_nfc_ch_message_s * message, net_nfc_ch_type_e type);
 
-net_nfc_error_e net_nfc_util_get_handover_random_number(
-       net_nfc_ch_message_s *message, uint16_t *random_number);
+       net_nfc_error_e net_nfc_util_get_handover_message_type(net_nfc_ch_message_s * message, net_nfc_ch_type_e * type);
 
-net_nfc_error_e net_nfc_util_append_handover_carrier(
-       net_nfc_ch_message_s *message, net_nfc_ch_carrier_s *carrier);
+       net_nfc_error_e net_nfc_util_get_handover_random_number(net_nfc_ch_message_s * message, uint16_t * random_number);
 
-net_nfc_error_e net_nfc_util_get_handover_carrier_count(
-       net_nfc_ch_message_s *message, uint32_t *count);
+       net_nfc_error_e net_nfc_util_append_handover_carrier(net_nfc_ch_message_s * message, net_nfc_ch_carrier_s * carrier);
 
-net_nfc_error_e net_nfc_util_get_handover_carrier(
-       net_nfc_ch_message_s *message, int index,
-       net_nfc_ch_carrier_s **carrier);
+       net_nfc_error_e net_nfc_util_get_handover_carrier_count(net_nfc_ch_message_s * message, uint32_t * count);
 
-net_nfc_error_e net_nfc_util_get_handover_carrier_by_type(
-       net_nfc_ch_message_s *message,
-       net_nfc_conn_handover_carrier_type_e type,
-       net_nfc_ch_carrier_s **carrier);
+       net_nfc_error_e net_nfc_util_get_handover_carrier(net_nfc_ch_message_s * message, int index, net_nfc_ch_carrier_s ** carrier);
 
+       net_nfc_error_e net_nfc_util_get_handover_carrier_by_type(net_nfc_ch_message_s * message, net_nfc_conn_handover_carrier_type_e type, net_nfc_ch_carrier_s ** carrier);
 
-net_nfc_error_e net_nfc_util_export_handover_to_ndef_message(
-       net_nfc_ch_message_s *message, ndef_message_s **result);
+       net_nfc_error_e net_nfc_util_export_handover_to_ndef_message(net_nfc_ch_message_s * message, ndef_message_s ** result);
 
-net_nfc_error_e net_nfc_util_import_handover_from_ndef_message(
-       ndef_message_s *msg, net_nfc_ch_message_s **result);
+       net_nfc_error_e net_nfc_util_import_handover_from_ndef_message(ndef_message_s * msg, net_nfc_ch_message_s ** result);
 
-net_nfc_error_e net_nfc_util_get_handover_random_number(
-       net_nfc_ch_message_s *message, uint16_t *random_number);
+       net_nfc_error_e net_nfc_util_get_handover_random_number(net_nfc_ch_message_s * message, uint16_t * random_number);
 
-net_nfc_error_e net_nfc_util_get_selector_power_status(
-       net_nfc_ch_message_s *message,
-       net_nfc_conn_handover_carrier_state_e *cps);
+       net_nfc_error_e net_nfc_util_get_selector_power_status(net_nfc_ch_message_s * message, net_nfc_conn_handover_carrier_state_e * cps);
 
 #ifdef __cplusplus
 }
 #endif
-
-#endif //__NET_NFC_UTIL_HANDOVER_H__
+#endif                                                 //__NET_NFC_UTIL_HANDOVER_H__
index 9eea854..b0c5c03 100755 (executable)
 #include "net_nfc_typedef_internal.h"
 
 #ifdef __cplusplus
-extern "C"
-{
+extern "C" {
 #endif
 
 /* Bluetooth */
-bool net_nfc_util_handover_bt_check_carrier_record(ndef_record_s *record);
+       bool net_nfc_util_handover_bt_check_carrier_record(ndef_record_s * record);
 
-net_nfc_error_e net_nfc_util_handover_bt_create_record_from_config(
-       ndef_record_s **record, net_nfc_carrier_config_s *config);
-
-net_nfc_error_e net_nfc_util_handover_bt_create_config_from_record(
-       net_nfc_carrier_config_s **config, ndef_record_s *record);
+       net_nfc_error_e net_nfc_util_handover_bt_create_record_from_config(ndef_record_s ** record, net_nfc_carrier_config_s * config);
 
+       net_nfc_error_e net_nfc_util_handover_bt_create_config_from_record(net_nfc_carrier_config_s ** config, ndef_record_s * record);
 
 /* Wifi protected setup */
-bool net_nfc_util_handover_wps_check_carrier_record(ndef_record_s *record);
+       bool net_nfc_util_handover_wps_check_carrier_record(ndef_record_s * record);
 
-net_nfc_error_e net_nfc_util_handover_wps_create_record_from_config(
-       ndef_record_s **record, net_nfc_carrier_config_s *config);
+       net_nfc_error_e net_nfc_util_handover_wps_create_record_from_config(ndef_record_s ** record, net_nfc_carrier_config_s * config);
 
-net_nfc_error_e net_nfc_util_handover_wps_create_config_from_record(
-       net_nfc_carrier_config_s **config, ndef_record_s *record);
+       net_nfc_error_e net_nfc_util_handover_wps_create_config_from_record(net_nfc_carrier_config_s ** config, ndef_record_s * record);
 
 /* Wifi direct setup */
-bool net_nfc_util_handover_wfd_check_carrier_record(ndef_record_s *record);
+       bool net_nfc_util_handover_wfd_check_carrier_record(ndef_record_s * record);
 
-net_nfc_error_e net_nfc_util_handover_wfd_create_record_from_config(
-       ndef_record_s **record, net_nfc_carrier_config_s *config);
+       net_nfc_error_e net_nfc_util_handover_wfd_create_record_from_config(ndef_record_s ** record, net_nfc_carrier_config_s * config);
 
-net_nfc_error_e net_nfc_util_handover_wfd_create_config_from_record(
-       net_nfc_carrier_config_s **config, ndef_record_s *record);
+       net_nfc_error_e net_nfc_util_handover_wfd_create_config_from_record(net_nfc_carrier_config_s ** config, ndef_record_s * record);
 
 #ifdef __cplusplus
 }
 #endif
-
-#endif //__NET_NFC_UTIL_HANDOVER_INTERNAL_H__
+#endif                                                 //__NET_NFC_UTIL_HANDOVER_INTERNAL_H__
index 507b232..6f9ef84 100644 (file)
@@ -30,7 +30,6 @@
 
 #define NET_NFC_HCE_P2_SELECT_FIRST_OCC                (uint8_t)0x0C
 
-
 #define NET_NFC_HCE_SW_SUCCESS                 (uint16_t)0x9000
 #define NET_NFC_HCE_SW_SUCCESS                 (uint16_t)0x9000
 
@@ -48,8 +47,7 @@
 
 #define NET_NFC_HCE_INVALID_VALUE              (uint16_t)0xFFFF
 
-typedef struct _net_nfc_apdu_data_t
-{
+typedef struct _net_nfc_apdu_data_t {
        uint16_t cla;
        uint16_t ins;
        uint16_t p1;
@@ -57,27 +55,20 @@ typedef struct _net_nfc_apdu_data_t
        uint16_t lc;
        uint8_t *data;
        uint16_t le;
-}
-net_nfc_apdu_data_t;
-
+} net_nfc_apdu_data_t;
 
 net_nfc_apdu_data_t *net_nfc_util_hce_create_apdu_data();
 
-void net_nfc_util_hce_free_apdu_data(net_nfc_apdu_data_t *apdu_data);
+void net_nfc_util_hce_free_apdu_data(net_nfc_apdu_data_t * apdu_data);
 
-net_nfc_error_e net_nfc_util_hce_extract_parameter(data_s *apdu,
-       net_nfc_apdu_data_t *apdu_data);
+net_nfc_error_e net_nfc_util_hce_extract_parameter(data_s * apdu, net_nfc_apdu_data_t * apdu_data);
 
-net_nfc_error_e net_nfc_util_hce_generate_apdu(net_nfc_apdu_data_t *apdu_data,
-       data_s **apdu);
+net_nfc_error_e net_nfc_util_hce_generate_apdu(net_nfc_apdu_data_t * apdu_data, data_s ** apdu);
 
-typedef struct _net_nfc_hce_data_t
-{
+typedef struct _net_nfc_hce_data_t {
        uint32_t type;
        uint32_t handle;
        uint8_t data[0];
-}
-net_nfc_hce_data_t;
-
+} net_nfc_hce_data_t;
 
-#endif //__NET_NFC_UTIL_HCE_H__
+#endif                                                 //__NET_NFC_UTIL_HCE_H__
index 8188b0a..72f3b67 100755 (executable)
 #include "net_nfc_typedef_internal.h"
 
 #define NET_NFC_REVERSE_ORDER_6_BYTES(__array) \
-       do \
-       { \
+       do { \
                uint16_t __x = htons(*(uint16_t *)(__array + 4)); \
                *(uint32_t *)(__array + 2) = htonl(*(uint32_t *)(__array)); \
                *(uint16_t *)(__array) = __x; \
        } while (0)
 
 #define NET_NFC_REVERSE_ORDER_16_BYTES(array) \
-       do \
-       { \
+       do { \
                uint32_t __x1 = htonl(*(uint32_t *)(array + 12)); \
                uint32_t __x2 = htonl(*(uint32_t *)(array + 8)); \
                *(uint32_t *)(array + 8) = htonl(*(uint32_t *)(array + 4)); \
@@ -42,8 +40,7 @@
                *(uint32_t *)(array + 4) = __x2; \
        } while (0)
 
-typedef enum
-{
+typedef enum {
        CRC_A = 0x00,
        CRC_B,
 } CRC_type_e;
@@ -54,7 +51,7 @@ void net_nfc_manager_fini_log();
 /* Memory utils */
 /* allocation memory */
 void __net_nfc_util_alloc_mem(void **mem, int size, char *filename, unsigned int line);
-#define         _net_nfc_util_alloc_mem(mem,size) __net_nfc_util_alloc_mem((void **)&mem,size, basename(__FILE__), __LINE__)
+#define         _net_nfc_util_alloc_mem(mem, size) __net_nfc_util_alloc_mem((void **)&mem, size, basename(__FILE__), __LINE__)
 
 /* allocation memory */
 void __net_nfc_util_strdup(char **output, const char *origin, char *filename, unsigned int line);
@@ -65,15 +62,15 @@ void __net_nfc_util_free_mem(void **mem, char *filename, unsigned int line);
 #define         _net_nfc_util_free_mem(mem) __net_nfc_util_free_mem((void **)&mem, basename(__FILE__), __LINE__)
 
 data_s *net_nfc_util_create_data(uint32_t length);
-bool net_nfc_util_init_data(data_s *data, uint32_t length);
-data_s *net_nfc_util_duplicate_data(data_s *src);
-bool net_nfc_util_append_data(data_s *dest, data_s *src);
-void net_nfc_util_clear_data(data_s *data);
-void net_nfc_util_free_data(data_s *data);
+bool net_nfc_util_init_data(data_s * data, uint32_t length);
+data_s *net_nfc_util_duplicate_data(data_s * src);
+bool net_nfc_util_append_data(data_s * dest, data_s * src);
+void net_nfc_util_clear_data(data_s * data);
+void net_nfc_util_free_data(data_s * data);
 
 bool net_nfc_util_strip_string(char *buffer, int buffer_length);
 
-void net_nfc_util_compute_CRC(CRC_type_e CRC_type, uint8_t *buffer, uint32_t length);
+void net_nfc_util_compute_CRC(CRC_type_e CRC_type, uint8_t * buffer, uint32_t length);
 
 const char *net_nfc_util_get_schema_string(int index);
 
@@ -81,17 +78,15 @@ uint32_t net_nfc_util_create_memory_handle(void *address);
 void *net_nfc_util_get_memory_address(uint32_t handle);
 void net_nfc_util_destroy_memory_handle(uint32_t handle);
 
-
 bool net_nfc_util_aid_check_validity(const char *aid);
 bool net_nfc_util_aid_is_prefix(const char *aid);
-bool net_nfc_util_aid_is_matched(const char *aid_criteria,
-       const char *aid_target);
+bool net_nfc_util_aid_is_matched(const char *aid_criteria, const char *aid_target);
 
-bool net_nfc_util_get_login_user(uid_t *uid);
+bool net_nfc_util_get_login_user(uid_t * uid);
 bool net_nfc_util_get_pkgid_by_pid(pid_t pid, char *pkgid, size_t len);
 
-bool net_nfc_util_hex_string_to_binary(const char *str, data_s *result);
-bool net_nfc_util_binary_to_hex_string(data_s *data, char *out_buf, uint32_t max_len);
+bool net_nfc_util_hex_string_to_binary(const char *str, data_s * result);
+bool net_nfc_util_binary_to_hex_string(data_s * data, char *out_buf, uint32_t max_len);
 int net_nfc_util_get_fd_from_systemd(void);
 
-#endif //__NET_NFC_UTIL_INTERNAL_H__
+#endif                                                 //__NET_NFC_UTIL_INTERNAL_H__
index 6bd2ee5..2f4b950 100755 (executable)
 #define NET_NFC_NDEF_TNF_UNCHANGED             0x06    /**< Unchanged: Used for Chunked Records. */
 #define NET_NFC_NDEF_TNF_RESERVED              0x07    /**< RFU, must not be used. */
 
-typedef void (*net_nfc_foreach_ndef_records_cb)(ndef_record_s *record,
-       void *user_data);
+typedef void (*net_nfc_foreach_ndef_records_cb) (ndef_record_s * record, void *user_data);
 /*
  convert rawdata into ndef message structure
  */
-net_nfc_error_e net_nfc_util_convert_rawdata_to_ndef_message(data_s *rawdata, ndef_message_s *ndef);
+net_nfc_error_e net_nfc_util_convert_rawdata_to_ndef_message(data_s * rawdata, ndef_message_s * ndef);
 
 /*
  this util function converts into rawdata from ndef message structure
  */
-net_nfc_error_e net_nfc_util_convert_ndef_message_to_rawdata(ndef_message_s *ndef, data_s *rawdata);
+net_nfc_error_e net_nfc_util_convert_ndef_message_to_rawdata(ndef_message_s * ndef, data_s * rawdata);
 
 /*
  get total bytes of ndef message in serial form
  */
-uint32_t net_nfc_util_get_ndef_message_length(ndef_message_s *message);
+uint32_t net_nfc_util_get_ndef_message_length(ndef_message_s * message);
 
 /*
  free ndef message. this function also free any defined buffer insdie structures
  */
-net_nfc_error_e net_nfc_util_free_ndef_message(ndef_message_s *msg);
+net_nfc_error_e net_nfc_util_free_ndef_message(ndef_message_s * msg);
 
 /*
  append record into ndef message
  */
-net_nfc_error_e net_nfc_util_append_record(ndef_message_s *msg, ndef_record_s *record);
+net_nfc_error_e net_nfc_util_append_record(ndef_message_s * msg, ndef_record_s * record);
 
 /*
  print out ndef structure value with printf function. this is for just debug purpose
  */
-void net_nfc_util_print_ndef_message(ndef_message_s *msg);
+void net_nfc_util_print_ndef_message(ndef_message_s * msg);
 
-net_nfc_error_e net_nfc_util_create_ndef_message(ndef_message_s **ndef_message);
+net_nfc_error_e net_nfc_util_create_ndef_message(ndef_message_s ** ndef_message);
 
-net_nfc_error_e net_nfc_util_search_record_by_type(ndef_message_s *ndef_message, net_nfc_record_tnf_e tnf, data_s *type, ndef_record_s **record);
+net_nfc_error_e net_nfc_util_search_record_by_type(ndef_message_s * ndef_message, net_nfc_record_tnf_e tnf, data_s * type, ndef_record_s ** record);
 
-net_nfc_error_e net_nfc_util_append_record_by_index(ndef_message_s *ndef_message, int index, ndef_record_s *record);
+net_nfc_error_e net_nfc_util_append_record_by_index(ndef_message_s * ndef_message, int index, ndef_record_s * record);
 
-net_nfc_error_e net_nfc_util_get_record_by_index(ndef_message_s *ndef_message, int index, ndef_record_s **record);
+net_nfc_error_e net_nfc_util_get_record_by_index(ndef_message_s * ndef_message, int index, ndef_record_s ** record);
 
-net_nfc_error_e net_nfc_util_remove_record_by_index(ndef_message_s *ndef_message, int index);
+net_nfc_error_e net_nfc_util_remove_record_by_index(ndef_message_s * ndef_message, int index);
 
-net_nfc_error_e net_nfc_util_search_record_by_id(ndef_message_s *ndef_message, data_s *id, ndef_record_s **record);
+net_nfc_error_e net_nfc_util_search_record_by_id(ndef_message_s * ndef_message, data_s * id, ndef_record_s ** record);
 
-void net_nfc_util_foreach_ndef_records(ndef_message_s *msg,
-       net_nfc_foreach_ndef_records_cb func, void *user_data);
+void net_nfc_util_foreach_ndef_records(ndef_message_s * msg, net_nfc_foreach_ndef_records_cb func, void *user_data);
 
-net_nfc_error_e net_nfc_util_check_ndef_message_rawdata(data_s *rawdata);
+net_nfc_error_e net_nfc_util_check_ndef_message_rawdata(data_s * rawdata);
 
-#endif //__NET_NFC_UTIL_NDEF_MESSAGE_H__
+#endif                                                 //__NET_NFC_UTIL_NDEF_MESSAGE_H__
index a16a938..9020061 100755 (executable)
 /*
  create record structure with basic info
  */
-net_nfc_error_e net_nfc_util_create_record(net_nfc_record_tnf_e recordType, data_s *typeName, data_s *id, data_s *payload, ndef_record_s **record);
+net_nfc_error_e net_nfc_util_create_record(net_nfc_record_tnf_e recordType, data_s * typeName, data_s * id, data_s * payload, ndef_record_s ** record);
 
 /*
  create text type record
  */
-net_nfc_error_e net_nfc_util_create_text_type_record(const char *text, const char *lang_code_str, net_nfc_encode_type_e encode, ndef_record_s **record);
+net_nfc_error_e net_nfc_util_create_text_type_record(const char *text, const char *lang_code_str, net_nfc_encode_type_e encode, ndef_record_s ** record);
 
 /*
  this utility function help to create uri type record
  */
-net_nfc_error_e net_nfc_util_create_uri_type_record(const char *uri, net_nfc_schema_type_e protocol_schema, ndef_record_s **record);
+net_nfc_error_e net_nfc_util_create_uri_type_record(const char *uri, net_nfc_schema_type_e protocol_schema, ndef_record_s ** record);
 
 /*
  free ndef record. it free all the buffered data
  */
-net_nfc_error_e net_nfc_util_free_record(ndef_record_s *record);
+net_nfc_error_e net_nfc_util_free_record(ndef_record_s * record);
 
 /*
  convert schema enum value to character string.
  */
-net_nfc_error_e net_nfc_util_set_record_id(ndef_record_s *record, uint8_t *data, int length);
+net_nfc_error_e net_nfc_util_set_record_id(ndef_record_s * record, uint8_t * data, int length);
 
 /*
  get total bytes of ndef record in serial form
  */
-uint32_t net_nfc_util_get_record_length(ndef_record_s *record);
+uint32_t net_nfc_util_get_record_length(ndef_record_s * record);
 
 /*
  create uri string from record
  */
-net_nfc_error_e net_nfc_util_create_uri_string_from_uri_record(ndef_record_s *record, char **uri);
+net_nfc_error_e net_nfc_util_create_uri_string_from_uri_record(ndef_record_s * record, char **uri);
 
-#endif //__NET_NFC_UTIL_NDEF_RECORD_H__
+#endif                                                 //__NET_NFC_UTIL_NDEF_RECORD_H__
index 28aa669..55fb269 100755 (executable)
@@ -18,8 +18,7 @@
 
 #include <openssl/x509.h>
 
-enum
-{
+enum {
        OPENSSL_FORMAT_UNDEF,
        OPENSSL_FORMAT_ASN1,
        OPENSSL_FORMAT_TEXT,
@@ -35,29 +34,26 @@ enum
        OPENSSL_FORMAT_PVK,
 };
 
-typedef struct _net_nfc_openssl_verify_context_s
-{
+typedef struct _net_nfc_openssl_verify_context_s {
        X509 *signer_cert;
        X509_STORE *store;
        X509_STORE_CTX *store_ctx;
-}
-net_nfc_openssl_verify_context_s;
+} net_nfc_openssl_verify_context_s;
 
 typedef net_nfc_openssl_verify_context_s *net_nfc_openssl_verify_context_h;
 
 net_nfc_openssl_verify_context_h net_nfc_util_openssl_init_verify_certificate(void);
-bool net_nfc_util_openssl_add_certificate_of_signer(net_nfc_openssl_verify_context_h context, uint8_t *buffer, uint32_t length);
-bool net_nfc_util_openssl_add_certificate_of_ca(net_nfc_openssl_verify_context_h context, uint8_t *buffer, uint32_t length);
+bool net_nfc_util_openssl_add_certificate_of_signer(net_nfc_openssl_verify_context_h context, uint8_t * buffer, uint32_t length);
+bool net_nfc_util_openssl_add_certificate_of_ca(net_nfc_openssl_verify_context_h context, uint8_t * buffer, uint32_t length);
 int net_nfc_util_openssl_verify_certificate(net_nfc_openssl_verify_context_h context);
 void net_nfc_util_openssl_release_verify_certificate(net_nfc_openssl_verify_context_h context);
 
-int net_nfc_util_openssl_sign_buffer(uint32_t type, uint8_t *buffer, uint32_t length, char *key_file, char *password, uint8_t *sign, uint32_t *sign_len);
-int net_nfc_util_openssl_verify_signature(uint32_t type, uint8_t *buffer, uint32_t length, uint8_t *cert, uint32_t cert_len, uint8_t *sign, uint32_t sign_len);
-int net_nfc_util_get_cert_list_from_file(char *file_name, char *password, uint8_t **buffer, uint32_t *length, uint32_t *cert_count);
+int net_nfc_util_openssl_sign_buffer(uint32_t type, uint8_t * buffer, uint32_t length, char *key_file, char *password, uint8_t * sign, uint32_t * sign_len);
+int net_nfc_util_openssl_verify_signature(uint32_t type, uint8_t * buffer, uint32_t length, uint8_t * cert, uint32_t cert_len, uint8_t * sign, uint32_t sign_len);
+int net_nfc_util_get_cert_list_from_file(char *file_name, char *password, uint8_t ** buffer, uint32_t * length, uint32_t * cert_count);
 
+bool net_nfc_util_openssl_encode_base64(const uint8_t * buffer, const uint32_t buf_len, char *result, uint32_t max_len, bool new_line_char);
+bool net_nfc_util_openssl_decode_base64(const char *buffer, uint8_t * result, uint32_t * out_len, bool new_line_char);
+bool net_nfc_util_openssl_digest(const char *algorithm, const uint8_t * buffer, const uint32_t buf_len, uint8_t * result, uint32_t * out_len);
 
-bool net_nfc_util_openssl_encode_base64(const uint8_t *buffer, const uint32_t buf_len, char *result, uint32_t max_len, bool new_line_char);
-bool net_nfc_util_openssl_decode_base64(const char *buffer, uint8_t *result, uint32_t *out_len, bool new_line_char);
-bool net_nfc_util_openssl_digest(const char *algorithm, const uint8_t *buffer, const uint32_t buf_len, uint8_t *result, uint32_t *out_len);
-
-#endif //__NET_NFC_UTIL_OPENSSL_INTERNAL_H__
+#endif                                                 //__NET_NFC_UTIL_OPENSSL_INTERNAL_H__
index f0bd3a8..1de1493 100755 (executable)
 /*
  * sign ndef record and ndef message
  */
-net_nfc_error_e net_nfc_util_sign_records(ndef_message_s *msg, int begin_index, int end_index, char *cert_file, char *password);
-net_nfc_error_e net_nfc_util_sign_ndef_message(ndef_message_s *msg, char *cert_file, char *password);
+net_nfc_error_e net_nfc_util_sign_records(ndef_message_s * msg, int begin_index, int end_index, char *cert_file, char *password);
+net_nfc_error_e net_nfc_util_sign_ndef_message(ndef_message_s * msg, char *cert_file, char *password);
 
 /*
  * check validity of ndef record and ndef message
  */
-net_nfc_error_e net_nfc_util_verify_signature_ndef_message(ndef_message_s *msg);
-net_nfc_error_e net_nfc_util_verify_signature_records(ndef_record_s *begin_record, ndef_record_s *sign_record);
-
-
-#endif //__NET_NFC_UTIL_SIGN_RECORD_H__
+net_nfc_error_e net_nfc_util_verify_signature_ndef_message(ndef_message_s * msg);
+net_nfc_error_e net_nfc_util_verify_signature_records(ndef_record_s * begin_record, ndef_record_s * sign_record);
 
+#endif                                                 //__NET_NFC_UTIL_SIGN_RECORD_H__
index 4010e7f..3604593 100755 (executable)
@@ -38,8 +38,7 @@
 #define NET_NFC_EXPORT_API __attribute__((visibility("default")))
 #endif
 
-static const char *schema[] =
-{
+static const char *schema[] = {
        "",
        "http://www.",
        "https://www.",
@@ -95,9 +94,7 @@ const char *net_nfc_get_log_tag()
 void __attribute__ ((constructor)) lib_init()
 {
        if (__progname != NULL && strncmp(__progname, NET_NFC_MANAGER_NAME, strlen(NET_NFC_MANAGER_NAME)) == 0)
-       {
                log_tag = LOG_SERVER_TAG;
-       }
 }
 
 void __attribute__ ((destructor)) lib_fini()
@@ -108,21 +105,18 @@ void net_nfc_manager_init_log()
 {
        struct tm local_tm;
        nfc_log_file = fopen(NFC_DLOG_FILE, "a+");
-       if (nfc_log_file != NULL)
-       {
+       if (nfc_log_file != NULL) {
                char timeBuf[50];
                time_t rawtime;
 
-               time (&rawtime);
+               time(&rawtime);
                localtime_r(&rawtime, &local_tm);
 
                strftime(timeBuf, sizeof(timeBuf), "%m-%d %H:%M:%S", &local_tm);
-               fprintf(nfc_log_file, "\n%s",timeBuf);
+               fprintf(nfc_log_file, "\n%s", timeBuf);
                fprintf(nfc_log_file, "========== log begin, pid [%d] =========", getpid());
                fflush(nfc_log_file);
-       }
-       else
-       {
+       } else {
                fprintf(stderr, "\n\nfopen error\n\n");
        }
 }
@@ -130,16 +124,15 @@ void net_nfc_manager_init_log()
 void net_nfc_manager_fini_log()
 {
        struct tm local_tm;
-       if (nfc_log_file != NULL)
-       {
+       if (nfc_log_file != NULL) {
                char timeBuf[50];
                time_t rawtime;
 
-               time (&rawtime);
+               time(&rawtime);
                localtime_r(&rawtime, &local_tm);
 
                strftime(timeBuf, sizeof(timeBuf), "%m-%d %H:%M:%S", &local_tm);
-               fprintf(nfc_log_file, "\n%s",timeBuf);
+               fprintf(nfc_log_file, "\n%s", timeBuf);
                fprintf(nfc_log_file, "=========== log end, pid [%d] ==========", getpid());
                fflush(nfc_log_file);
                fclose(nfc_log_file);
@@ -149,14 +142,12 @@ void net_nfc_manager_fini_log()
 
 NET_NFC_EXPORT_API void __net_nfc_util_free_mem(void **mem, char *filename, unsigned int line)
 {
-       if (mem == NULL)
-       {
+       if (mem == NULL) {
                SECURE_LOGD("FILE: %s, LINE:%d, Invalid parameter in mem free util, mem is NULL", filename, line);
                return;
        }
 
-       if (*mem == NULL)
-       {
+       if (*mem == NULL) {
                SECURE_LOGD("FILE: %s, LINE:%d, Invalid Parameter in mem free util, *mem is NULL", filename, line);
                return;
        }
@@ -167,44 +158,34 @@ NET_NFC_EXPORT_API void __net_nfc_util_free_mem(void **mem, char *filename, unsi
 
 NET_NFC_EXPORT_API void __net_nfc_util_alloc_mem(void **mem, int size, char *filename, unsigned int line)
 {
-       if (mem == NULL || size <= 0)
-       {
+       if (mem == NULL || size <= 0) {
                SECURE_LOGD("FILE: %s, LINE:%d, Invalid parameter in mem alloc util, mem [%p], size [%d]", filename, line, mem, size);
                return;
        }
 
        if (*mem != NULL)
-       {
                SECURE_LOGD("FILE: %s, LINE:%d, WARNING: Pointer is not NULL, mem [%p]", filename, line, *mem);
-       }
 
        *mem = g_malloc0(size);
 
        if (*mem == NULL)
-       {
                SECURE_LOGD("FILE: %s, LINE:%d, Allocation is failed, size [%d]", filename, line, size);
-       }
 }
 
 NET_NFC_EXPORT_API void __net_nfc_util_strdup(char **output, const char *origin, char *filename, unsigned int line)
 {
-       if (output == NULL || origin == NULL)
-       {
+       if (output == NULL || origin == NULL) {
                SECURE_LOGD("FILE: %s, LINE:%d, Invalid parameter in strdup, output [%p], origin [%p]", filename, line, output, origin);
                return;
        }
 
        if (*output != NULL)
-       {
                SECURE_LOGD("FILE: %s, LINE:%d, WARNING: Pointer is not NULL, mem [%p]", filename, line, *output);
-       }
 
        *output = g_strdup(origin);
 
        if (*output == NULL)
-       {
                SECURE_LOGD("FILE: %s, LINE:%d, strdup failed", filename, line);
-       }
 }
 
 NET_NFC_EXPORT_API data_s *net_nfc_util_create_data(uint32_t length)
@@ -212,14 +193,13 @@ NET_NFC_EXPORT_API data_s *net_nfc_util_create_data(uint32_t length)
        data_s *data;
 
        _net_nfc_util_alloc_mem(data, sizeof(*data));
-       if (length > 0) {
+       if (length > 0)
                net_nfc_util_init_data(data, length);
-       }
 
        return data;
 }
 
-NET_NFC_EXPORT_API bool net_nfc_util_init_data(data_s *data, uint32_t length)
+NET_NFC_EXPORT_API bool net_nfc_util_init_data(data_s * data, uint32_t length)
 {
        if (data == NULL || length == 0)
                return false;
@@ -233,7 +213,7 @@ NET_NFC_EXPORT_API bool net_nfc_util_init_data(data_s *data, uint32_t length)
        return true;
 }
 
-NET_NFC_EXPORT_API data_s *net_nfc_util_duplicate_data(data_s *src)
+NET_NFC_EXPORT_API data_s *net_nfc_util_duplicate_data(data_s * src)
 {
        data_s *data;
 
@@ -241,14 +221,13 @@ NET_NFC_EXPORT_API data_s *net_nfc_util_duplicate_data(data_s *src)
                return false;
 
        data = net_nfc_util_create_data(src->length);
-       if (data != NULL) {
+       if (data != NULL)
                memcpy(data->buffer, src->buffer, data->length);
-       }
 
        return data;
 }
 
-NET_NFC_EXPORT_API bool net_nfc_util_append_data(data_s *dest, data_s *src)
+NET_NFC_EXPORT_API bool net_nfc_util_append_data(data_s * dest, data_s * src)
 {
        data_s *data;
 
@@ -257,9 +236,8 @@ NET_NFC_EXPORT_API bool net_nfc_util_append_data(data_s *dest, data_s *src)
 
        data = net_nfc_util_create_data(dest->length + src->length);
        if (data != NULL) {
-               if (dest->length > 0) {
+               if (dest->length > 0)
                        memcpy(data->buffer, dest->buffer, dest->length);
-               }
                memcpy(data->buffer + dest->length, src->buffer, src->length);
 
                net_nfc_util_clear_data(dest);
@@ -272,7 +250,7 @@ NET_NFC_EXPORT_API bool net_nfc_util_append_data(data_s *dest, data_s *src)
        return true;
 }
 
-NET_NFC_EXPORT_API void net_nfc_util_clear_data(data_s *data)
+NET_NFC_EXPORT_API void net_nfc_util_clear_data(data_s * data)
 {
        if (data == NULL)
                return;
@@ -285,7 +263,7 @@ NET_NFC_EXPORT_API void net_nfc_util_clear_data(data_s *data)
        data->length = 0;
 }
 
-NET_NFC_EXPORT_API void net_nfc_util_free_data(data_s *data)
+NET_NFC_EXPORT_API void net_nfc_util_free_data(data_s * data)
 {
        if (data == NULL)
                return;
@@ -303,27 +281,21 @@ bool net_nfc_util_strip_string(char *buffer, int buffer_length)
 
        _net_nfc_util_alloc_mem(temp, buffer_length);
        if (temp == NULL)
-       {
                return result;
-       }
 
-       for (; i < buffer_length; i++)
-       {
+       for (; i < buffer_length; i++) {
                if (buffer[i] != ' ' && buffer[i] != '\t')
                        break;
        }
 
-       if (i < buffer_length)
-       {
+       if (i < buffer_length) {
                memcpy(temp, &buffer[i], buffer_length - i);
                memset(buffer, 0x00, buffer_length);
 
                memcpy(buffer, temp, buffer_length - i);
 
                result = true;
-       }
-       else
-       {
+       } else {
                result = false;
        }
 
@@ -332,48 +304,43 @@ bool net_nfc_util_strip_string(char *buffer, int buffer_length)
        return true;
 }
 
-static uint16_t _net_nfc_util_update_CRC(uint8_t ch, uint16_t *lpwCrc)
+static uint16_t _net_nfc_util_update_CRC(uint8_t ch, uint16_t * lpwCrc)
 {
-       ch = (ch ^ (uint8_t)((*lpwCrc) & 0x00FF));
+       ch = (ch ^ (uint8_t) ((*lpwCrc) & 0x00FF));
        ch = (ch ^ (ch << 4));
-       *lpwCrc = (*lpwCrc >> 8) ^ ((uint16_t)ch << 8) ^ ((uint16_t)ch << 3) ^ ((uint16_t)ch >> 4);
+       *lpwCrc = (*lpwCrc >> 8) ^ ((uint16_t) ch << 8) ^ ((uint16_t) ch << 3) ^ ((uint16_t) ch >> 4);
        return (*lpwCrc);
 }
 
-void net_nfc_util_compute_CRC(CRC_type_e CRC_type, uint8_t *buffer, uint32_t length)
+void net_nfc_util_compute_CRC(CRC_type_e CRC_type, uint8_t * buffer, uint32_t length)
 {
        uint8_t chBlock = 0;
        int msg_length = length - 2;
        uint8_t *temp = buffer;
 
        // default is CRC_B
-       uint16_t wCrc = 0xFFFF; /* ISO/IEC 13239 (formerly ISO/IEC 3309) */
+       uint16_t wCrc = 0xFFFF;         /* ISO/IEC 13239 (formerly ISO/IEC 3309) */
 
-       switch (CRC_type)
-       {
-       case CRC_A :
+       switch (CRC_type) {
+       case CRC_A:
                wCrc = 0x6363;
                break;
 
-       case CRC_B :
+       case CRC_B:
                wCrc = 0xFFFF;
                break;
        }
 
-       do
-       {
+       do {
                chBlock = *buffer++;
                _net_nfc_util_update_CRC(chBlock, &wCrc);
-       }
-       while (--msg_length > 0);
+       } while (--msg_length > 0);
 
        if (CRC_type == CRC_B)
-       {
-               wCrc = ~wCrc; /* ISO/IEC 13239 (formerly ISO/IEC 3309) */
-       }
+               wCrc = ~wCrc;                   /* ISO/IEC 13239 (formerly ISO/IEC 3309) */
 
-       temp[length - 2] = (uint8_t)(wCrc & 0xFF);
-       temp[length - 1] = (uint8_t)((wCrc >> 8) & 0xFF);
+       temp[length - 2] = (uint8_t) (wCrc & 0xFF);
+       temp[length - 1] = (uint8_t) ((wCrc >> 8) & 0xFF);
 }
 
 const char *net_nfc_util_get_schema_string(int index)
@@ -392,22 +359,19 @@ static GHashTable *handle_table;
 
 static void *_get_memory_address(uint32_t handle)
 {
-       return g_hash_table_lookup(handle_table,
-               (gconstpointer)handle);
+       return g_hash_table_lookup(handle_table, (gconstpointer) handle);
 }
 
 uint32_t net_nfc_util_create_memory_handle(void *address)
 {
        uint32_t handle;
 
-       if (handle_table == NULL) {
+       if (handle_table == NULL)
                handle_table = g_hash_table_new(g_int_hash, g_int_equal);
-       }
 
        g_assert(g_hash_table_size(handle_table) < MAX_HANDLE);
 
-       g_hash_table_insert(handle_table, (gpointer)next_handle,
-               (gpointer)address);
+       g_hash_table_insert(handle_table, (gpointer) next_handle, (gpointer) address);
 
        handle = next_handle;
 
@@ -436,7 +400,7 @@ void net_nfc_util_destroy_memory_handle(uint32_t handle)
        if (handle_table == NULL || handle == 0 || handle > MAX_HANDLE)
                return;
 
-       g_hash_table_remove(handle_table, (gconstpointer)handle);
+       g_hash_table_remove(handle_table, (gconstpointer) handle);
 }
 
 #define IS_HEX(c) (((c) >= '0' && (c) <= '9') || ((c) >= 'A' && (c) <= 'F') || \
@@ -447,9 +411,8 @@ bool net_nfc_util_aid_check_validity(const char *aid)
        const char *temp = aid;
        bool asterisk = false;
 
-       if (aid == NULL || strlen(aid) == 0) {
+       if (aid == NULL || strlen(aid) == 0)
                return false;
-       }
 
        while (*temp != '\0') {
                if (asterisk == true) {
@@ -476,30 +439,26 @@ bool net_nfc_util_aid_is_prefix(const char *aid)
 {
        size_t len;
 
-       if (net_nfc_util_aid_check_validity(aid) == false) {
+       if (net_nfc_util_aid_check_validity(aid) == false)
                return false;
-       }
 
        len = strlen(aid);
 
        return (aid[len - 1] == '*');
 }
 
-bool net_nfc_util_aid_is_matched(const char *aid_criteria,
-       const char *aid_target)
+bool net_nfc_util_aid_is_matched(const char *aid_criteria, const char *aid_target)
 {
        const char *criteria = aid_criteria;
        const char *target = aid_target;
        bool is_prefix;
        bool result;
 
-       if (net_nfc_util_aid_check_validity(criteria) == false) {
+       if (net_nfc_util_aid_check_validity(criteria) == false)
                return false;
-       }
 
-       if (net_nfc_util_aid_check_validity(target) == false) {
+       if (net_nfc_util_aid_check_validity(target) == false)
                return false;
-       }
 
        is_prefix = net_nfc_util_aid_is_prefix(target);
 
@@ -531,7 +490,7 @@ bool net_nfc_util_aid_is_matched(const char *aid_criteria,
        return result;
 }
 
-bool net_nfc_util_get_login_user(uid_t *uid)
+bool net_nfc_util_get_login_user(uid_t * uid)
 {
        int i, ret;
        uid_t *uids;
@@ -543,7 +502,7 @@ bool net_nfc_util_get_login_user(uid_t *uid)
                return false;
        }
 
-       for (i = 0; i < uid_count ; i++) {
+       for (i = 0; i < uid_count; i++) {
                char *state = NULL;
 
                ret = sd_uid_get_state(uids[i], &state);
@@ -612,40 +571,35 @@ bool net_nfc_util_get_pkgid_by_pid(pid_t pid, char *pkgid, size_t len)
 
        result = (snprintf(pkgid, len, "%s", temp) > 0);
 
-END :
-       if (appinfo != NULL) {
+ END:
+       if (appinfo != NULL)
                pkgmgrinfo_appinfo_destroy_appinfo(appinfo);
-       }
 
        return result;
 }
 
 #define TO_BINARY(x) (((x) >= '0' && (x) <= '9') ? ((x) - '0') : (((x) >= 'A' && (x) <= 'F') ? ((x) - 'A' + 10) : (((x) >= 'a' && (x) <= 'f') ? ((x) - 'a' + 10) : 0)))
 
-bool net_nfc_util_hex_string_to_binary(const char *str, data_s *result)
+bool net_nfc_util_hex_string_to_binary(const char *str, data_s * result)
 {
        size_t len, i;
 
-       if (str == NULL || result == NULL) {
+       if (str == NULL || result == NULL)
                return false;
-       }
 
        len = strlen(str);
-       if (len < 2) {
+       if (len < 2)
                return false;
-       }
 
        for (i = 0; i < len; i++) {
-               if (IS_HEX(str[i]) == false) {
+               if (IS_HEX(str[i]) == false)
                        return false;
-               }
        }
 
        len /= 2;
 
-       if (net_nfc_util_init_data(result, len) == false) {
+       if (net_nfc_util_init_data(result, len) == false)
                return false;
-       }
 
        for (i = 0; i < len; i++) {
                result->buffer[i] = TO_BINARY(str[i << 1]) << 4;
@@ -655,22 +609,20 @@ bool net_nfc_util_hex_string_to_binary(const char *str, data_s *result)
        return true;
 }
 
-bool net_nfc_util_binary_to_hex_string(data_s *data, char *out_buf, uint32_t max_len)
+bool net_nfc_util_binary_to_hex_string(data_s * data, char *out_buf, uint32_t max_len)
 {
        int current = 0;
        uint8_t *buffer;
        size_t len;
 
-       if (data == NULL || data->buffer == NULL || data->length == 0 ||
-               out_buf == NULL || max_len == 0)
+       if (data == NULL || data->buffer == NULL || data->length == 0 || out_buf == NULL || max_len == 0)
                return false;
 
        buffer = data->buffer;
        len = data->length;
 
        while (len > 0 && current < max_len) {
-               current += snprintf(out_buf + current, max_len - current,
-                       "%02X", *(buffer++));
+               current += snprintf(out_buf + current, max_len - current, "%02X", *(buffer++));
                len--;
        }
 
@@ -682,10 +634,9 @@ int net_nfc_util_get_fd_from_systemd()
        int n = sd_listen_fds(0);
        int fd;
 
-       for(fd = SD_LISTEN_FDS_START; fd < SD_LISTEN_FDS_START+n; ++fd) {
-               if (0 < sd_is_socket_unix(fd, SOCK_STREAM, 1, "/tmp/.nfc-hce.sock", 0)) {
+       for (fd = SD_LISTEN_FDS_START; fd < SD_LISTEN_FDS_START + n; ++fd) {
+               if (0 < sd_is_socket_unix(fd, SOCK_STREAM, 1, "/tmp/.nfc-hce.sock", 0))
                        return fd;
-               }
        }
        return -1;
 }
index 2e4d5d5..8f88d9d 100755 (executable)
@@ -24,8 +24,7 @@
 #include "net_nfc_util_gdbus_internal.h"
 #include "net_nfc_util_ndef_message.h"
 
-void net_nfc_util_gdbus_variant_to_buffer(GVariant *variant, uint8_t **buffer,
-       size_t *length)
+void net_nfc_util_gdbus_variant_to_buffer(GVariant * variant, uint8_t ** buffer, size_t * length)
 {
        GVariantIter *iter;
        guint8 *buf = NULL;
@@ -37,15 +36,13 @@ void net_nfc_util_gdbus_variant_to_buffer(GVariant *variant, uint8_t **buffer,
        g_variant_get(variant, "a(y)", &iter);
 
        size = g_variant_iter_n_children(iter);
-       buf  = g_new0(guint8, size);
-       if (buf != NULL)
-       {
+       buf = g_new0(guint8, size);
+       if (buf != NULL) {
                guint8 element;
                guint i;
 
                i = 0;
-               while (g_variant_iter_loop(iter, "(y)", &element))
-               {
+               while (g_variant_iter_loop(iter, "(y)", &element)) {
                        *(buf + i) = element;
                        i++;
                }
@@ -62,7 +59,7 @@ void net_nfc_util_gdbus_variant_to_buffer(GVariant *variant, uint8_t **buffer,
        }
 }
 
-data_s *net_nfc_util_gdbus_variant_to_data(GVariant *variant)
+data_s *net_nfc_util_gdbus_variant_to_data(GVariant * variant)
 {
        GVariantIter *iter;
        guint size;
@@ -76,13 +73,11 @@ data_s *net_nfc_util_gdbus_variant_to_data(GVariant *variant)
        size = g_variant_iter_n_children(iter);
        if (size > 0) {
                result = net_nfc_util_create_data(size);
-               if (result != NULL && result->buffer != NULL)
-               {
+               if (result != NULL && result->buffer != NULL) {
                        guint i = 0;
                        guint8 element;
 
-                       while (g_variant_iter_loop(iter, "(y)", &element))
-                       {
+                       while (g_variant_iter_loop(iter, "(y)", &element)) {
                                *(result->buffer + i) = element;
                                i++;
                        }
@@ -94,7 +89,7 @@ data_s *net_nfc_util_gdbus_variant_to_data(GVariant *variant)
        return result;
 }
 
-void net_nfc_util_gdbus_variant_to_data_s(GVariant *variant, data_s *data)
+void net_nfc_util_gdbus_variant_to_data_s(GVariant * variant, data_s * data)
 {
        GVariantIter *iter;
        guint size;
@@ -106,9 +101,7 @@ void net_nfc_util_gdbus_variant_to_data_s(GVariant *variant, data_s *data)
        data->length = 0;
 
        if (variant == NULL)
-       {
                return;
-       }
 
        g_variant_get(variant, "a(y)", &iter);
 
@@ -118,8 +111,7 @@ void net_nfc_util_gdbus_variant_to_data_s(GVariant *variant, data_s *data)
                        guint i = 0;
                        guint8 element;
 
-                       while (g_variant_iter_loop(iter, "(y)", &element))
-                       {
+                       while (g_variant_iter_loop(iter, "(y)", &element)) {
                                *(data->buffer + i) = element;
                                i++;
                        }
@@ -129,38 +121,31 @@ void net_nfc_util_gdbus_variant_to_data_s(GVariant *variant, data_s *data)
        }
 }
 
-GVariant *net_nfc_util_gdbus_buffer_to_variant(const uint8_t *buffer,
-       size_t length)
+GVariant *net_nfc_util_gdbus_buffer_to_variant(const uint8_t * buffer, size_t length)
 {
        GVariantBuilder builder;
 
        g_variant_builder_init(&builder, G_VARIANT_TYPE("a(y)"));
 
-       if (buffer && length > 0)
-       {
+       if (buffer && length > 0) {
                int i;
 
-               for(i = 0; i < length; i++)
+               for (i = 0; i < length; i++)
                        g_variant_builder_add(&builder, "(y)", *(buffer + i));
        }
 
        return g_variant_builder_end(&builder);
 }
 
-GVariant *net_nfc_util_gdbus_data_to_variant(const data_s *data)
+GVariant *net_nfc_util_gdbus_data_to_variant(const data_s * data)
 {
        if (data != NULL)
-       {
-               return net_nfc_util_gdbus_buffer_to_variant(data->buffer,
-                       data->length);
-       }
+               return net_nfc_util_gdbus_buffer_to_variant(data->buffer, data->length);
        else
-       {
                return net_nfc_util_gdbus_buffer_to_variant(NULL, 0);
-       }
 }
 
-ndef_message_s *net_nfc_util_gdbus_variant_to_ndef_message(GVariant *variant)
+ndef_message_s *net_nfc_util_gdbus_variant_to_ndef_message(GVariant * variant)
 {
        ndef_message_s *message = NULL;
        data_s data = { NULL, 0 };
@@ -170,13 +155,11 @@ ndef_message_s *net_nfc_util_gdbus_variant_to_ndef_message(GVariant *variant)
 
        net_nfc_util_gdbus_variant_to_data_s(variant, &data);
 
-       if (data.buffer && data.length > 0)
-       {
+       if (data.buffer && data.length > 0) {
                ndef_message_s *temp = NULL;
 
                if (net_nfc_util_create_ndef_message(&temp) == NET_NFC_OK) {
-                       if (net_nfc_util_convert_rawdata_to_ndef_message(
-                               &data, temp) == NET_NFC_OK) {
+                       if (net_nfc_util_convert_rawdata_to_ndef_message(&data, temp) == NET_NFC_OK) {
                                message = temp;
                        } else {
                                DEBUG_ERR_MSG("net_nfc_create_ndef_message_from_rawdata failed");
@@ -193,25 +176,20 @@ ndef_message_s *net_nfc_util_gdbus_variant_to_ndef_message(GVariant *variant)
        return message;
 }
 
-GVariant *net_nfc_util_gdbus_ndef_message_to_variant(
-       const ndef_message_s *message)
+GVariant *net_nfc_util_gdbus_ndef_message_to_variant(const ndef_message_s * message)
 {
        GVariant *variant = NULL;
        data_s temp = { NULL, 0 };
        data_s *data = NULL;
        size_t length;
 
-       length = net_nfc_util_get_ndef_message_length(
-               (ndef_message_s *)message);
+       length = net_nfc_util_get_ndef_message_length((ndef_message_s *) message);
        if (length > 0) {
                if (net_nfc_util_init_data(&temp, length) == true) {
-                       if (net_nfc_util_convert_ndef_message_to_rawdata(
-                               (ndef_message_s *)message,
-                               &temp) == NET_NFC_OK) {
+                       if (net_nfc_util_convert_ndef_message_to_rawdata((ndef_message_s *) message, &temp) == NET_NFC_OK)
                                data = &temp;
-                       } else {
+                       else
                                DEBUG_ERR_MSG("can not convert ndef_message to rawdata");
-                       }
                } else {
                        DEBUG_ERR_MSG("net_nfc_util_alloc_data failed");
                }
index 84e239c..3d023b8 100755 (executable)
 #include "net_nfc_util_handover.h"
 #include "net_nfc_util_handover_internal.h"
 
-
 #define CHECK_TYPE(__x, __y) (\
        (__x.length == __y##_LEN) && \
        (memcmp(__x.buffer, __y, __y##_LEN) == 0))
 
-static gboolean _find_by_attribute_cb(GNode *node, gpointer data)
+static gboolean _find_by_attribute_cb(GNode * node, gpointer data)
 {
        net_nfc_carrier_property_s *prop = node->data;
        gpointer *temp = data;
        gboolean result;
 
-       if (prop != NULL && prop->attribute == (uint16_t)(uint32_t)temp[0]) {
+       if (prop != NULL && prop->attribute == (uint16_t) (uint32_t) temp[0]) {
                temp[1] = node;
 
                result = true;
@@ -47,28 +46,25 @@ static gboolean _find_by_attribute_cb(GNode *node, gpointer data)
        return result;
 }
 
-static GNode *__find_property_by_attribute(GNode *list,
-       uint16_t attribute)
+static GNode *__find_property_by_attribute(GNode * list, uint16_t attribute)
 {
        gpointer context[2];
 
-       context[0] = (gpointer)(uint32_t)attribute;
+       context[0] = (gpointer) (uint32_t) attribute;
        context[1] = NULL;
 
-       g_node_traverse(list, G_IN_ORDER, G_TRAVERSE_ALL,
-               -1, _find_by_attribute_cb, context);
+       g_node_traverse(list, G_IN_ORDER, G_TRAVERSE_ALL, -1, _find_by_attribute_cb, context);
 
-       return (GNode *)context[1];
+       return (GNode *) context[1];
 }
 
-static gboolean _destroy_cb(GNode *node, gpointer data)
+static gboolean _destroy_cb(GNode * node, gpointer data)
 {
        net_nfc_carrier_property_s *prop = node->data;
 
        if (prop != NULL) {
-               if (prop->is_group) {
+               if (prop->is_group)
                        prop->data = NULL;
-               }
 
                _net_nfc_util_free_mem(prop->data);
                _net_nfc_util_free_mem(prop);
@@ -77,25 +73,17 @@ static gboolean _destroy_cb(GNode *node, gpointer data)
        return false;
 }
 
-net_nfc_error_e net_nfc_util_create_carrier_config(
-       net_nfc_carrier_config_s **config,
-       net_nfc_conn_handover_carrier_type_e type)
+net_nfc_error_e net_nfc_util_create_carrier_config(net_nfc_carrier_config_s ** config, net_nfc_conn_handover_carrier_type_e type)
 {
        if (config == NULL)
-       {
                return NET_NFC_NULL_PARAMETER;
-       }
 
        if (type < 0 || type >= NET_NFC_CONN_HANDOVER_CARRIER_UNKNOWN)
-       {
                return NET_NFC_OUT_OF_BOUND;
-       }
 
        _net_nfc_util_alloc_mem(*config, sizeof(net_nfc_carrier_config_s));
        if (*config == NULL)
-       {
                return NET_NFC_ALLOC_FAIL;
-       }
 
        (*config)->type = type;
        (*config)->data = g_node_new(NULL);
@@ -103,13 +91,12 @@ net_nfc_error_e net_nfc_util_create_carrier_config(
        return NET_NFC_OK;
 }
 
-static net_nfc_error_e _append_tree_node(GNode *root, uint16_t attribute,
-       uint16_t size, uint8_t *data)
+static net_nfc_error_e _append_tree_node(GNode * root, uint16_t attribute, uint16_t size, uint8_t * data)
 {
        net_nfc_error_e result;
        net_nfc_carrier_property_s *elem = NULL;
 
-       _net_nfc_util_alloc_mem(elem, sizeof (net_nfc_carrier_property_s));
+       _net_nfc_util_alloc_mem(elem, sizeof(net_nfc_carrier_property_s));
        if (elem != NULL) {
                _net_nfc_util_alloc_mem(elem->data, size);
                if (elem->data != NULL) {
@@ -133,42 +120,32 @@ static net_nfc_error_e _append_tree_node(GNode *root, uint16_t attribute,
        return result;
 }
 
-net_nfc_error_e net_nfc_util_add_carrier_config_property(
-       net_nfc_carrier_config_s *config,
-       uint16_t attribute, uint16_t size, uint8_t *data)
+net_nfc_error_e net_nfc_util_add_carrier_config_property(net_nfc_carrier_config_s * config, uint16_t attribute, uint16_t size, uint8_t * data)
 {
        DEBUG_MSG("ADD property: [ATTRIB:0x%02X, SIZE:%d]", attribute, size);
 
        if (config == NULL || data == NULL)
-       {
                return NET_NFC_NULL_PARAMETER;
-       }
 
        if (__find_property_by_attribute(config->data, attribute) != NULL)
-       {
                return NET_NFC_ALREADY_REGISTERED;
-       }
 
        return _append_tree_node(config->data, attribute, size, data);
 }
 
-static void _release_tree(GNode *root)
+static void _release_tree(GNode * root)
 {
-       g_node_traverse(root, G_IN_ORDER, G_TRAVERSE_ALL,
-               -1, _destroy_cb, NULL);
+       g_node_traverse(root, G_IN_ORDER, G_TRAVERSE_ALL, -1, _destroy_cb, NULL);
        g_node_destroy(root);
 }
 
-net_nfc_error_e net_nfc_util_remove_carrier_config_property(
-       net_nfc_carrier_config_s *config, uint16_t attribute)
+net_nfc_error_e net_nfc_util_remove_carrier_config_property(net_nfc_carrier_config_s * config, uint16_t attribute)
 {
        net_nfc_error_e result;
        GNode *node;
 
        if (config == NULL)
-       {
                return NET_NFC_NULL_PARAMETER;
-       }
 
        node = __find_property_by_attribute(config->data, attribute);
        if (node != NULL) {
@@ -182,18 +159,13 @@ net_nfc_error_e net_nfc_util_remove_carrier_config_property(
        return result;
 }
 
-net_nfc_error_e net_nfc_util_get_carrier_config_property(
-       net_nfc_carrier_config_s *config,
-       uint16_t attribute,
-       uint16_t *size, uint8_t **data)
+net_nfc_error_e net_nfc_util_get_carrier_config_property(net_nfc_carrier_config_s * config, uint16_t attribute, uint16_t * size, uint8_t ** data)
 {
        GNode *node;
        net_nfc_error_e result;
 
        if (config == NULL || size == NULL || data == NULL)
-       {
                return NET_NFC_NULL_PARAMETER;
-       }
 
        node = __find_property_by_attribute(config->data, attribute);
        if (node != NULL) {
@@ -220,54 +192,39 @@ net_nfc_error_e net_nfc_util_get_carrier_config_property(
        return result;
 }
 
-net_nfc_error_e net_nfc_util_append_carrier_config_group(
-       net_nfc_carrier_config_s *config, net_nfc_carrier_property_s *group)
+net_nfc_error_e net_nfc_util_append_carrier_config_group(net_nfc_carrier_config_s * config, net_nfc_carrier_property_s * group)
 {
        if (config == NULL || group == NULL)
-       {
                return NET_NFC_NULL_PARAMETER;
-       }
 
-       if (__find_property_by_attribute(config->data,
-               group->attribute) != NULL) {
+       if (__find_property_by_attribute(config->data, group->attribute) != NULL)
                return NET_NFC_ALREADY_REGISTERED;
-       }
 
        g_node_append_data(config->data, group);
 
        return NET_NFC_OK;
 }
 
-net_nfc_error_e net_nfc_util_remove_carrier_config_group(
-       net_nfc_carrier_config_s *config, net_nfc_carrier_property_s *group)
+net_nfc_error_e net_nfc_util_remove_carrier_config_group(net_nfc_carrier_config_s * config, net_nfc_carrier_property_s * group)
 {
        if (config == NULL || group == NULL)
-       {
                return NET_NFC_NULL_PARAMETER;
-       }
 
-       if (__find_property_by_attribute(config->data,
-               group->attribute) != NULL)
-       {
+       if (__find_property_by_attribute(config->data, group->attribute) != NULL)
                return NET_NFC_NO_DATA_FOUND;
-       }
 
        net_nfc_util_free_carrier_group(group);
 
        return NET_NFC_OK;
 }
 
-net_nfc_error_e net_nfc_util_get_carrier_config_group(
-       net_nfc_carrier_config_s *config,
-       uint16_t attribute, net_nfc_carrier_property_s **group)
+net_nfc_error_e net_nfc_util_get_carrier_config_group(net_nfc_carrier_config_s * config, uint16_t attribute, net_nfc_carrier_property_s ** group)
 {
        GNode *node;
        net_nfc_error_e result;
 
        if (config == NULL || group == NULL)
-       {
                return NET_NFC_NULL_PARAMETER;
-       }
 
        node = __find_property_by_attribute(config->data, attribute);
        if (node != NULL) {
@@ -287,13 +244,10 @@ net_nfc_error_e net_nfc_util_get_carrier_config_group(
        return result;
 }
 
-net_nfc_error_e net_nfc_util_free_carrier_config(
-       net_nfc_carrier_config_s *config)
+net_nfc_error_e net_nfc_util_free_carrier_config(net_nfc_carrier_config_s * config)
 {
        if (config == NULL)
-       {
                return NET_NFC_NULL_PARAMETER;
-       }
 
        _release_tree(config->data);
 
@@ -302,16 +256,13 @@ net_nfc_error_e net_nfc_util_free_carrier_config(
        return NET_NFC_OK;
 }
 
-net_nfc_error_e net_nfc_util_create_carrier_config_group(
-       net_nfc_carrier_property_s **group, uint16_t attribute)
+net_nfc_error_e net_nfc_util_create_carrier_config_group(net_nfc_carrier_property_s ** group, uint16_t attribute)
 {
        net_nfc_carrier_property_s *temp;
        net_nfc_error_e result;
 
        if (group == NULL)
-       {
                return NET_NFC_NULL_PARAMETER;
-       }
 
        _net_nfc_util_alloc_mem(temp, sizeof(net_nfc_carrier_property_s));
        if (temp != NULL) {
@@ -328,41 +279,30 @@ net_nfc_error_e net_nfc_util_create_carrier_config_group(
        return result;
 }
 
-net_nfc_error_e net_nfc_util_add_carrier_config_group_property(
-       net_nfc_carrier_property_s *group,
-       uint16_t attribute, uint16_t size, uint8_t *data)
+net_nfc_error_e net_nfc_util_add_carrier_config_group_property(net_nfc_carrier_property_s * group, uint16_t attribute, uint16_t size, uint8_t * data)
 {
        DEBUG_MSG("ADD group property: [ATTRIB:0x%X, SIZE:%d]", attribute, size);
 
        if (group == NULL || data == NULL)
-       {
                return NET_NFC_NULL_PARAMETER;
-       }
 
        if (__find_property_by_attribute(group->data, attribute) != NULL)
-       {
                return NET_NFC_ALREADY_REGISTERED;
-       }
-
-//     group->length += size + 2 * __net_nfc_get_size_of_attribute(attribute);
-//     DEBUG_MSG("ADD group completed total length %d", group->length);
+//  group->length += size + 2 * __net_nfc_get_size_of_attribute(attribute);
+//  DEBUG_MSG("ADD group completed total length %d", group->length);
 
-       return _append_tree_node((GNode *)group->data, attribute, size, data);
+       return _append_tree_node((GNode *) group->data, attribute, size, data);
 }
 
-net_nfc_error_e net_nfc_util_get_carrier_config_group_property(
-       net_nfc_carrier_property_s *group,
-       uint16_t attribute, uint16_t *size, uint8_t **data)
+net_nfc_error_e net_nfc_util_get_carrier_config_group_property(net_nfc_carrier_property_s * group, uint16_t attribute, uint16_t * size, uint8_t ** data)
 {
        GNode *node;
        net_nfc_error_e result;
 
        if (group == NULL || size == NULL || data == NULL)
-       {
                return NET_NFC_NULL_PARAMETER;
-       }
 
-       node = __find_property_by_attribute((GNode *)(group->data), attribute);
+       node = __find_property_by_attribute((GNode *) (group->data), attribute);
        if (node != NULL) {
                net_nfc_carrier_property_s *elem = node->data;
 
@@ -380,18 +320,15 @@ net_nfc_error_e net_nfc_util_get_carrier_config_group_property(
        return result;
 }
 
-net_nfc_error_e net_nfc_util_remove_carrier_config_group_property(
-       net_nfc_carrier_property_s *group, uint16_t attribute)
+net_nfc_error_e net_nfc_util_remove_carrier_config_group_property(net_nfc_carrier_property_s * group, uint16_t attribute)
 {
        GNode *node;
        net_nfc_error_e result;
 
        if (group == NULL)
-       {
                return NET_NFC_NULL_PARAMETER;
-       }
 
-       node = __find_property_by_attribute((GNode *)(group->data), attribute);
+       node = __find_property_by_attribute((GNode *) (group->data), attribute);
        if (node != NULL) {
                _release_tree(node);
 
@@ -403,43 +340,37 @@ net_nfc_error_e net_nfc_util_remove_carrier_config_group_property(
        return result;
 }
 
-net_nfc_error_e net_nfc_util_free_carrier_group(
-       net_nfc_carrier_property_s *group)
+net_nfc_error_e net_nfc_util_free_carrier_group(net_nfc_carrier_property_s * group)
 {
        if (group == NULL)
-       {
                return NET_NFC_NULL_PARAMETER;
-       }
 
        _release_tree(group->data);
 
        return NET_NFC_OK;
 }
 
-net_nfc_error_e net_nfc_util_create_ndef_record_with_carrier_config(
-       ndef_record_s **record, net_nfc_carrier_config_s *config)
+net_nfc_error_e net_nfc_util_create_ndef_record_with_carrier_config(ndef_record_s ** record, net_nfc_carrier_config_s * config)
 {
        net_nfc_error_e result;
 
        if (record == NULL || config == NULL)
-       {
                return NET_NFC_NULL_PARAMETER;
-       }
 
        switch (config->type) {
-       case NET_NFC_CONN_HANDOVER_CARRIER_BT :
+       case NET_NFC_CONN_HANDOVER_CARRIER_BT:
                result = net_nfc_util_handover_bt_create_record_from_config(record, config);
                break;
 
-       case NET_NFC_CONN_HANDOVER_CARRIER_WIFI_WPS :
+       case NET_NFC_CONN_HANDOVER_CARRIER_WIFI_WPS:
                result = net_nfc_util_handover_wps_create_record_from_config(record, config);
                break;
 
-       case NET_NFC_CONN_HANDOVER_CARRIER_WIFI_P2P :
+       case NET_NFC_CONN_HANDOVER_CARRIER_WIFI_P2P:
                result = net_nfc_util_handover_wfd_create_record_from_config(record, config);
                break;
 
-       default :
+       default:
                result = NET_NFC_NOT_SUPPORTED;
                break;
        }
@@ -447,114 +378,96 @@ net_nfc_error_e net_nfc_util_create_ndef_record_with_carrier_config(
        return result;
 }
 
-net_nfc_error_e net_nfc_util_create_carrier_config_from_config_record(
-       net_nfc_carrier_config_s **config, ndef_record_s *record)
+net_nfc_error_e net_nfc_util_create_carrier_config_from_config_record(net_nfc_carrier_config_s ** config, ndef_record_s * record)
 {
        net_nfc_error_e result;
 
        if (record == NULL || config == NULL)
-       {
                return NET_NFC_NULL_PARAMETER;
-       }
 
-       if (net_nfc_util_handover_bt_check_carrier_record(record)) {
+       if (net_nfc_util_handover_bt_check_carrier_record(record))
                result = net_nfc_util_handover_bt_create_config_from_record(config, record);
-       } else if (net_nfc_util_handover_wps_check_carrier_record(record)) {
+       else if (net_nfc_util_handover_wps_check_carrier_record(record))
                result = net_nfc_util_handover_wps_create_config_from_record(config, record);
-       } else if (net_nfc_util_handover_wfd_check_carrier_record(record)) {
+       else if (net_nfc_util_handover_wfd_check_carrier_record(record))
                result = net_nfc_util_handover_wfd_create_config_from_record(config, record);
-       } else {
+       else
                result = NET_NFC_NOT_SUPPORTED;
-       }
 
        return result;
 }
 
-net_nfc_error_e net_nfc_util_create_carrier_config_from_carrier(
-       net_nfc_carrier_config_s **config, net_nfc_ch_carrier_s *carrier)
+net_nfc_error_e net_nfc_util_create_carrier_config_from_carrier(net_nfc_carrier_config_s ** config, net_nfc_ch_carrier_s * carrier)
 {
        net_nfc_error_e result;
        ndef_record_s *record;
 
        if (carrier == NULL || carrier->carrier_record == NULL || config == NULL)
-       {
                return NET_NFC_NULL_PARAMETER;
-       }
 
        result = net_nfc_util_get_handover_carrier_record(carrier, &record);
-       if (result == NET_NFC_OK) {
+       if (result == NET_NFC_OK)
                result = net_nfc_util_create_carrier_config_from_config_record(config, record);
-       }
 
        return result;
 }
 
-static net_nfc_error_e _create_collision_resolution_record(
-       ndef_record_s **record)
+static net_nfc_error_e _create_collision_resolution_record(ndef_record_s ** record)
 {
        uint32_t state;
        uint16_t random_num;
-       data_s typeName = { (uint8_t *)CH_CR_RECORD_TYPE,
-               CH_CR_RECORD_TYPE_LEN };
-       data_s payload = { (uint8_t *)&random_num, sizeof(random_num) };
+       data_s typeName = { (uint8_t *) CH_CR_RECORD_TYPE,
+               CH_CR_RECORD_TYPE_LEN
+       };
+       data_s payload = { (uint8_t *) & random_num, sizeof(random_num) };
 
        if (record == NULL)
                return NET_NFC_NULL_PARAMETER;
 
-       state = (uint32_t)time(NULL);
+       state = (uint32_t) time(NULL);
        random_num = htons((unsigned short)rand_r(&state));
 
-       return net_nfc_util_create_record(NET_NFC_RECORD_WELL_KNOWN_TYPE,
-               &typeName, NULL, &payload, record);
+       return net_nfc_util_create_record(NET_NFC_RECORD_WELL_KNOWN_TYPE, &typeName, NULL, &payload, record);
 }
 
-net_nfc_error_e net_nfc_util_create_handover_error_record(
-       ndef_record_s **record, uint8_t reason, uint32_t data)
+net_nfc_error_e net_nfc_util_create_handover_error_record(ndef_record_s ** record, uint8_t reason, uint32_t data)
 {
-       data_s type = { (uint8_t *)CH_ERR_RECORD_TYPE, CH_ERR_RECORD_TYPE_LEN };
+       data_s type = { (uint8_t *) CH_ERR_RECORD_TYPE, CH_ERR_RECORD_TYPE_LEN };
        data_s payload;
        int size = 1;
 
-       switch (reason)
-       {
-       case 0x01 :
+       switch (reason) {
+       case 0x01:
                size = 1;
                break;
-       case 0x02 :
+       case 0x02:
                size = 4;
                break;
-       case 0x03 :
+       case 0x03:
                size = 1;
                break;
        }
 
        _net_nfc_util_alloc_mem(payload.buffer, size);
        if (payload.buffer == NULL)
-       {
                return NET_NFC_ALLOC_FAIL;
-       }
        payload.length = size;
 
        memcpy(payload.buffer, &data, size);
 
-       net_nfc_util_create_record(NET_NFC_RECORD_WELL_KNOWN_TYPE, &type, NULL,
-               &payload, record);
+       net_nfc_util_create_record(NET_NFC_RECORD_WELL_KNOWN_TYPE, &type, NULL, &payload, record);
 
        _net_nfc_util_free_mem(payload.buffer);
 
        return NET_NFC_OK;
 }
 
-
-net_nfc_error_e net_nfc_util_create_handover_carrier(
-       net_nfc_ch_carrier_s **carrier,
-       net_nfc_conn_handover_carrier_state_e cps)
+net_nfc_error_e net_nfc_util_create_handover_carrier(net_nfc_ch_carrier_s ** carrier, net_nfc_conn_handover_carrier_state_e cps)
 {
        net_nfc_ch_carrier_s *temp;
 
-       if (carrier == NULL) {
+       if (carrier == NULL)
                return NET_NFC_NULL_PARAMETER;
-       }
 
        temp = g_new0(net_nfc_ch_carrier_s, 1);
 
@@ -567,45 +480,32 @@ net_nfc_error_e net_nfc_util_create_handover_carrier(
 
 static void _duplicate_carrier_cb(gpointer data, gpointer user_data)
 {
-       ndef_record_s *record = (ndef_record_s *)data;
-       net_nfc_ch_carrier_s *temp = (net_nfc_ch_carrier_s *)user_data;
+       ndef_record_s *record = (ndef_record_s *) data;
+       net_nfc_ch_carrier_s *temp = (net_nfc_ch_carrier_s *) user_data;
 
        if (record != NULL) {
                ndef_record_s *temp_record;
 
-               net_nfc_util_create_record(record->TNF,
-                       &record->type_s,
-                       &record->id_s,
-                       &record->payload_s,
-                       &temp_record);
+               net_nfc_util_create_record(record->TNF, &record->type_s, &record->id_s, &record->payload_s, &temp_record);
 
-               temp->aux_records = g_list_append(temp->aux_records,
-                       temp_record);
+               temp->aux_records = g_list_append(temp->aux_records, temp_record);
        }
 }
 
-net_nfc_error_e net_nfc_util_duplicate_handover_carrier(
-       net_nfc_ch_carrier_s **dest,
-       net_nfc_ch_carrier_s *src)
+net_nfc_error_e net_nfc_util_duplicate_handover_carrier(net_nfc_ch_carrier_s ** dest, net_nfc_ch_carrier_s * src)
 {
        net_nfc_ch_carrier_s *temp;
 
-       if (dest == NULL || src == NULL) {
+       if (dest == NULL || src == NULL)
                return NET_NFC_NULL_PARAMETER;
-       }
 
        temp = g_new0(net_nfc_ch_carrier_s, 1);
 
        temp->type = src->type;
        temp->cps = src->cps;
 
-       if (src->carrier_record != NULL) {
-               net_nfc_util_create_record(src->carrier_record->TNF,
-                       &src->carrier_record->type_s,
-                       &src->carrier_record->id_s,
-                       &src->carrier_record->payload_s,
-                       &temp->carrier_record);
-       }
+       if (src->carrier_record != NULL)
+               net_nfc_util_create_record(src->carrier_record->TNF, &src->carrier_record->type_s, &src->carrier_record->id_s, &src->carrier_record->payload_s, &temp->carrier_record);
 
        g_list_foreach(src->aux_records, _duplicate_carrier_cb, temp);
 
@@ -614,20 +514,17 @@ net_nfc_error_e net_nfc_util_duplicate_handover_carrier(
        return NET_NFC_OK;
 }
 
-
 static void _ch_carrier_free_cb(gpointer data)
 {
-       ndef_record_s *record = (ndef_record_s *)data;
+       ndef_record_s *record = (ndef_record_s *) data;
 
        net_nfc_util_free_record(record);
 }
 
-net_nfc_error_e net_nfc_util_free_handover_carrier(
-       net_nfc_ch_carrier_s *carrier)
+net_nfc_error_e net_nfc_util_free_handover_carrier(net_nfc_ch_carrier_s * carrier)
 {
-       if (carrier == NULL) {
+       if (carrier == NULL)
                return NET_NFC_NULL_PARAMETER;
-       }
 
        g_list_free_full(carrier->aux_records, _ch_carrier_free_cb);
 
@@ -638,9 +535,7 @@ net_nfc_error_e net_nfc_util_free_handover_carrier(
        return NET_NFC_OK;
 }
 
-net_nfc_error_e net_nfc_util_set_handover_carrier_cps(
-       net_nfc_ch_carrier_s *carrier,
-       net_nfc_conn_handover_carrier_state_e cps)
+net_nfc_error_e net_nfc_util_set_handover_carrier_cps(net_nfc_ch_carrier_s * carrier, net_nfc_conn_handover_carrier_state_e cps)
 {
        if (carrier == NULL)
                return NET_NFC_NULL_PARAMETER;
@@ -650,9 +545,7 @@ net_nfc_error_e net_nfc_util_set_handover_carrier_cps(
        return NET_NFC_OK;
 }
 
-net_nfc_error_e net_nfc_util_get_handover_carrier_cps(
-       net_nfc_ch_carrier_s *carrier,
-       net_nfc_conn_handover_carrier_state_e *cps)
+net_nfc_error_e net_nfc_util_get_handover_carrier_cps(net_nfc_ch_carrier_s * carrier, net_nfc_conn_handover_carrier_state_e * cps)
 {
        if (carrier == NULL || cps == NULL)
                return NET_NFC_NULL_PARAMETER;
@@ -662,9 +555,7 @@ net_nfc_error_e net_nfc_util_get_handover_carrier_cps(
        return NET_NFC_OK;
 }
 
-net_nfc_error_e net_nfc_util_set_handover_carrier_type(
-       net_nfc_ch_carrier_s *carrier,
-       net_nfc_conn_handover_carrier_type_e type)
+net_nfc_error_e net_nfc_util_set_handover_carrier_type(net_nfc_ch_carrier_s * carrier, net_nfc_conn_handover_carrier_type_e type)
 {
        if (carrier == NULL)
                return NET_NFC_NULL_PARAMETER;
@@ -674,9 +565,7 @@ net_nfc_error_e net_nfc_util_set_handover_carrier_type(
        return NET_NFC_OK;
 }
 
-net_nfc_error_e net_nfc_util_get_handover_carrier_type(
-       net_nfc_ch_carrier_s *carrier,
-       net_nfc_conn_handover_carrier_type_e *type)
+net_nfc_error_e net_nfc_util_get_handover_carrier_type(net_nfc_ch_carrier_s * carrier, net_nfc_conn_handover_carrier_type_e * type)
 {
        if (carrier == NULL || type == NULL)
                return NET_NFC_NULL_PARAMETER;
@@ -686,33 +575,28 @@ net_nfc_error_e net_nfc_util_get_handover_carrier_type(
        return NET_NFC_OK;
 }
 
-net_nfc_error_e net_nfc_util_append_handover_carrier_record(
-       net_nfc_ch_carrier_s *carrier, ndef_record_s *record)
+net_nfc_error_e net_nfc_util_append_handover_carrier_record(net_nfc_ch_carrier_s * carrier, ndef_record_s * record)
 {
        if (carrier == NULL || record == NULL)
                return NET_NFC_NULL_PARAMETER;
 
        net_nfc_util_remove_handover_carrier_record(carrier);
 
-       return net_nfc_util_create_record(record->TNF, &record->type_s, NULL,
-               &record->payload_s, &carrier->carrier_record);
+       return net_nfc_util_create_record(record->TNF, &record->type_s, NULL, &record->payload_s, &carrier->carrier_record);
 }
 
-net_nfc_error_e net_nfc_util_get_handover_carrier_record(
-       net_nfc_ch_carrier_s *carrier, ndef_record_s **record)
+net_nfc_error_e net_nfc_util_get_handover_carrier_record(net_nfc_ch_carrier_s * carrier, ndef_record_s ** record)
 {
        if (carrier == NULL || record == NULL)
                return NET_NFC_NULL_PARAMETER;
 
-       if (carrier->carrier_record != NULL) {
+       if (carrier->carrier_record != NULL)
                *record = carrier->carrier_record;
-       }
 
        return NET_NFC_OK;
 }
 
-net_nfc_error_e net_nfc_util_remove_handover_carrier_record(
-       net_nfc_ch_carrier_s *carrier)
+net_nfc_error_e net_nfc_util_remove_handover_carrier_record(net_nfc_ch_carrier_s * carrier)
 {
        if (carrier == NULL)
                return NET_NFC_NULL_PARAMETER;
@@ -725,8 +609,7 @@ net_nfc_error_e net_nfc_util_remove_handover_carrier_record(
        return NET_NFC_OK;
 }
 
-net_nfc_error_e net_nfc_util_append_handover_auxiliary_record(
-       net_nfc_ch_carrier_s *carrier, ndef_record_s *record)
+net_nfc_error_e net_nfc_util_append_handover_auxiliary_record(net_nfc_ch_carrier_s * carrier, ndef_record_s * record)
 {
        net_nfc_error_e result;
        ndef_record_s *temp = NULL;
@@ -734,18 +617,14 @@ net_nfc_error_e net_nfc_util_append_handover_auxiliary_record(
        if (carrier == NULL || record == NULL)
                return NET_NFC_NULL_PARAMETER;
 
-       result = net_nfc_util_create_record(record->TNF, &record->type_s, NULL,
-                       &record->payload_s, &temp);
-       if (result == NET_NFC_OK) {
-               carrier->aux_records = g_list_append(carrier->aux_records,
-                       temp);
-       }
+       result = net_nfc_util_create_record(record->TNF, &record->type_s, NULL, &record->payload_s, &temp);
+       if (result == NET_NFC_OK)
+               carrier->aux_records = g_list_append(carrier->aux_records, temp);
 
        return result;
 }
 
-net_nfc_error_e net_nfc_util_get_handover_auxiliary_record_count(
-       net_nfc_ch_carrier_s *carrier, uint32_t *count)
+net_nfc_error_e net_nfc_util_get_handover_auxiliary_record_count(net_nfc_ch_carrier_s * carrier, uint32_t * count)
 {
        if (carrier == NULL || count == NULL)
                return NET_NFC_NULL_PARAMETER;
@@ -755,8 +634,7 @@ net_nfc_error_e net_nfc_util_get_handover_auxiliary_record_count(
        return NET_NFC_OK;
 }
 
-net_nfc_error_e net_nfc_util_get_handover_auxiliary_record(
-       net_nfc_ch_carrier_s *carrier, int index, ndef_record_s **record)
+net_nfc_error_e net_nfc_util_get_handover_auxiliary_record(net_nfc_ch_carrier_s * carrier, int index, ndef_record_s ** record)
 {
        net_nfc_error_e result;
        GList *item;
@@ -769,7 +647,7 @@ net_nfc_error_e net_nfc_util_get_handover_auxiliary_record(
 
        item = g_list_nth(carrier->aux_records, index);
        if (item != NULL) {
-               *record = (ndef_record_s *)item->data;
+               *record = (ndef_record_s *) item->data;
                result = NET_NFC_OK;
        } else {
                result = NET_NFC_OUT_OF_BOUND;
@@ -778,8 +656,7 @@ net_nfc_error_e net_nfc_util_get_handover_auxiliary_record(
        return result;
 }
 
-net_nfc_error_e net_nfc_util_remove_handover_auxiliary_record(
-       net_nfc_ch_carrier_s *carrier, ndef_record_s *record)
+net_nfc_error_e net_nfc_util_remove_handover_auxiliary_record(net_nfc_ch_carrier_s * carrier, ndef_record_s * record)
 {
        net_nfc_error_e result;
        GList *list;
@@ -789,9 +666,8 @@ net_nfc_error_e net_nfc_util_remove_handover_auxiliary_record(
 
        list = g_list_find(carrier->aux_records, record);
        if (list != NULL) {
-               net_nfc_util_free_record((ndef_record_s *)list->data);
-               carrier->aux_records = g_list_delete_link(carrier->aux_records,
-                       list);
+               net_nfc_util_free_record((ndef_record_s *) list->data);
+               carrier->aux_records = g_list_delete_link(carrier->aux_records, list);
 
                result = NET_NFC_OK;
        } else {
@@ -801,14 +677,12 @@ net_nfc_error_e net_nfc_util_remove_handover_auxiliary_record(
        return result;
 }
 
-net_nfc_error_e net_nfc_util_create_handover_message(
-       net_nfc_ch_message_s **message)
+net_nfc_error_e net_nfc_util_create_handover_message(net_nfc_ch_message_s ** message)
 {
        net_nfc_ch_message_s *temp;
 
-       if (message == NULL) {
+       if (message == NULL)
                return NET_NFC_NULL_PARAMETER;
-       }
 
        temp = g_new0(net_nfc_ch_message_s, 1);
 
@@ -821,17 +695,15 @@ net_nfc_error_e net_nfc_util_create_handover_message(
 
 static void _ch_message_free_cb(gpointer data)
 {
-       net_nfc_ch_carrier_s *carrier = (net_nfc_ch_carrier_s *)data;
+       net_nfc_ch_carrier_s *carrier = (net_nfc_ch_carrier_s *) data;
 
        net_nfc_util_free_handover_carrier(carrier);
 }
 
-net_nfc_error_e net_nfc_util_free_handover_message(
-       net_nfc_ch_message_s *message)
+net_nfc_error_e net_nfc_util_free_handover_message(net_nfc_ch_message_s * message)
 {
-       if (message == NULL) {
+       if (message == NULL)
                return NET_NFC_NULL_PARAMETER;
-       }
 
        DEBUG_MSG("free [%p]", message);
 
@@ -843,36 +715,30 @@ net_nfc_error_e net_nfc_util_free_handover_message(
        return NET_NFC_OK;
 }
 
-net_nfc_error_e net_nfc_util_set_handover_message_type(
-       net_nfc_ch_message_s *message, net_nfc_ch_type_e type)
+net_nfc_error_e net_nfc_util_set_handover_message_type(net_nfc_ch_message_s * message, net_nfc_ch_type_e type)
 {
-       if (message == NULL) {
+       if (message == NULL)
                return NET_NFC_NULL_PARAMETER;
-       }
 
-       if (type >= NET_NFC_CH_TYPE_MAX) {
+       if (type >= NET_NFC_CH_TYPE_MAX)
                return NET_NFC_OUT_OF_BOUND;
-       }
 
        message->type = type;
 
        return NET_NFC_OK;
 }
 
-net_nfc_error_e net_nfc_util_get_handover_message_type(
-       net_nfc_ch_message_s *message, net_nfc_ch_type_e *type)
+net_nfc_error_e net_nfc_util_get_handover_message_type(net_nfc_ch_message_s * message, net_nfc_ch_type_e * type)
 {
-       if (message == NULL || type == NULL) {
+       if (message == NULL || type == NULL)
                return NET_NFC_NULL_PARAMETER;
-       }
 
        *type = message->type;
 
        return NET_NFC_OK;
 }
 
-net_nfc_error_e net_nfc_util_append_handover_carrier(
-       net_nfc_ch_message_s *message, net_nfc_ch_carrier_s *carrier)
+net_nfc_error_e net_nfc_util_append_handover_carrier(net_nfc_ch_message_s * message, net_nfc_ch_carrier_s * carrier)
 {
        if (message == NULL || carrier == NULL)
                return NET_NFC_NULL_PARAMETER;
@@ -882,8 +748,7 @@ net_nfc_error_e net_nfc_util_append_handover_carrier(
        return NET_NFC_OK;
 }
 
-net_nfc_error_e net_nfc_util_get_handover_carrier_count(
-       net_nfc_ch_message_s *message, uint32_t *count)
+net_nfc_error_e net_nfc_util_get_handover_carrier_count(net_nfc_ch_message_s * message, uint32_t * count)
 {
        if (message == NULL || count == NULL)
                return NET_NFC_NULL_PARAMETER;
@@ -893,9 +758,7 @@ net_nfc_error_e net_nfc_util_get_handover_carrier_count(
        return NET_NFC_OK;
 }
 
-net_nfc_error_e net_nfc_util_get_handover_carrier(
-       net_nfc_ch_message_s *message, int index,
-       net_nfc_ch_carrier_s **carrier)
+net_nfc_error_e net_nfc_util_get_handover_carrier(net_nfc_ch_message_s * message, int index, net_nfc_ch_carrier_s ** carrier)
 {
        net_nfc_error_e result;
        GList *list;
@@ -919,9 +782,8 @@ net_nfc_error_e net_nfc_util_get_handover_carrier(
 
 static gint _compare_cb(gconstpointer a, gconstpointer b)
 {
-       net_nfc_ch_carrier_s *carrier = (net_nfc_ch_carrier_s *)a;
-       net_nfc_conn_handover_carrier_type_e type =
-               (net_nfc_conn_handover_carrier_type_e)b;
+       net_nfc_ch_carrier_s *carrier = (net_nfc_ch_carrier_s *) a;
+       net_nfc_conn_handover_carrier_type_e type = (net_nfc_conn_handover_carrier_type_e) b;
 
        if (carrier->type == type)
                return 0;
@@ -929,10 +791,7 @@ static gint _compare_cb(gconstpointer a, gconstpointer b)
                return 1;
 }
 
-net_nfc_error_e net_nfc_util_get_handover_carrier_by_type(
-       net_nfc_ch_message_s *message,
-       net_nfc_conn_handover_carrier_type_e type,
-       net_nfc_ch_carrier_s **carrier)
+net_nfc_error_e net_nfc_util_get_handover_carrier_by_type(net_nfc_ch_message_s * message, net_nfc_conn_handover_carrier_type_e type, net_nfc_ch_carrier_s ** carrier)
 {
        net_nfc_error_e result;
        GList *list;
@@ -940,8 +799,7 @@ net_nfc_error_e net_nfc_util_get_handover_carrier_by_type(
        if (message == NULL || carrier == NULL)
                return NET_NFC_NULL_PARAMETER;
 
-       list = g_list_find_custom(message->carriers, (gconstpointer)type,
-               _compare_cb);
+       list = g_list_find_custom(message->carriers, (gconstpointer) type, _compare_cb);
        if (list != NULL) {
                *carrier = list->data;
 
@@ -953,56 +811,45 @@ net_nfc_error_e net_nfc_util_get_handover_carrier_by_type(
        return result;
 }
 
-typedef struct _ch_payload_t
-{
+typedef struct _ch_payload_t {
        uint8_t version;
        uint8_t message[0];
-}
-__attribute__((packed)) ch_payload_t;
+} __attribute__ ((packed)) ch_payload_t;
 
-typedef struct _ch_ac_ref_t
-{
+typedef struct _ch_ac_ref_t {
        uint8_t ref_len;
        uint8_t ref[0];
-}
-__attribute__((packed)) ch_ac_ref_t;
+} __attribute__ ((packed)) ch_ac_ref_t;
 
-typedef struct _ch_ac_header_t
-{
-       uint8_t cps : 3;
-       uint8_t rfu : 5;
+typedef struct _ch_ac_header_t {
+       uint8_t cps:3;
+       uint8_t rfu:5;
        uint8_t data[0];
-}
-__attribute__((packed)) ch_ac_header_t;
+} __attribute__ ((packed)) ch_ac_header_t;
 
-typedef struct _ch_ac_aux_header_t
-{
+typedef struct _ch_ac_aux_header_t {
        uint8_t count;
        uint8_t data[0];
-}
-__attribute__((packed)) ch_ac_aux_header_t;
+} __attribute__ ((packed)) ch_ac_aux_header_t;
 
-static void _change_id_field_and_add_record(uint8_t *buffer, uint32_t length,
-       ndef_record_s *record, ndef_message_s *message)
+static void _change_id_field_and_add_record(uint8_t * buffer, uint32_t length, ndef_record_s * record, ndef_message_s * message)
 {
        data_s id = { buffer, length };
        ndef_record_s *temp = NULL;
 
-       net_nfc_util_create_record(record->TNF,
-               &record->type_s,
-               &id, &record->payload_s, &temp);
+       net_nfc_util_create_record(record->TNF, &record->type_s, &id, &record->payload_s, &temp);
 
        net_nfc_util_append_record(message, temp);
 }
 
 static void _ch_message_export_cb(gpointer data, gpointer user_data)
 {
-       gpointer *params = (gpointer *)user_data;
-       net_nfc_ch_carrier_s *carrier = (net_nfc_ch_carrier_s *)data;
+       gpointer *params = (gpointer *) user_data;
+       net_nfc_ch_carrier_s *carrier = (net_nfc_ch_carrier_s *) data;
        ndef_message_s *inner_msg;
        ndef_message_s *main_msg;
        int count;
-       data_s type = { (uint8_t *)CH_AC_RECORD_TYPE, CH_AC_RECORD_TYPE_LEN };
+       data_s type = { (uint8_t *) CH_AC_RECORD_TYPE, CH_AC_RECORD_TYPE_LEN };
        data_s payload;
        ndef_record_s *record = NULL;
        char *id;
@@ -1011,97 +858,90 @@ static void _ch_message_export_cb(gpointer data, gpointer user_data)
                return;
 
        id = (char *)params[0];
-       inner_msg = (ndef_message_s *)params[1];
-       main_msg = (ndef_message_s *)params[2];
+       inner_msg = (ndef_message_s *) params[1];
+       main_msg = (ndef_message_s *) params[2];
 
        /* count total record */
-       count = 1/* carrier record */ + g_list_length(carrier->aux_records);
+       count = 1 /* carrier record */  + g_list_length(carrier->aux_records);
 
        /* create ac record */
-       net_nfc_util_init_data(&payload,
-               sizeof(ch_ac_header_t) + sizeof(ch_ac_aux_header_t) +
-               count * (sizeof(ch_ac_ref_t) + 4/* max length is 4 */));
+       net_nfc_util_init_data(&payload, sizeof(ch_ac_header_t) + sizeof(ch_ac_aux_header_t) + count * (sizeof(ch_ac_ref_t) + 4));
 
-       ch_ac_header_t *header = (ch_ac_header_t *)payload.buffer;
+       ch_ac_header_t *header = (ch_ac_header_t *) payload.buffer;
 
        header->cps = carrier->cps;
 
        payload.length = sizeof(ch_ac_header_t);
 
        /* carrier record */
-       ch_ac_ref_t *ref = (ch_ac_ref_t *)header->data;
+       ch_ac_ref_t *ref = (ch_ac_ref_t *) header->data;
 
        ref->ref[0] = *id++;
        ref->ref_len = 1;
 
-       _change_id_field_and_add_record(ref->ref, ref->ref_len,
-               carrier->carrier_record, main_msg);
+       _change_id_field_and_add_record(ref->ref, ref->ref_len, carrier->carrier_record, main_msg);
 
        payload.length += sizeof(ch_ac_ref_t) + ref->ref_len;
 
        /* aux record */
-       ch_ac_aux_header_t *aux = (ch_ac_aux_header_t *)(ref->ref +
-               ref->ref_len);
+       ch_ac_aux_header_t *aux = (ch_ac_aux_header_t *) (ref->ref + ref->ref_len);
 
        aux->count = g_list_length(carrier->aux_records);
 
        payload.length += sizeof(ch_ac_aux_header_t);
 
        GList *list = g_list_first(carrier->aux_records);
-       ref = (ch_ac_ref_t *)aux->data;
+       ref = (ch_ac_ref_t *) aux->data;
 
        while (list != NULL) {
                ref->ref[0] = *id++;
                ref->ref_len = 1;
 
-               _change_id_field_and_add_record(ref->ref, ref->ref_len,
-                       (ndef_record_s *)list->data, main_msg);
+               _change_id_field_and_add_record(ref->ref, ref->ref_len, (ndef_record_s *) list->data, main_msg);
 
                payload.length += sizeof(ch_ac_ref_t) + ref->ref_len;
-               ref = (ch_ac_ref_t *)(ref->ref + ref->ref_len);
+               ref = (ch_ac_ref_t *) (ref->ref + ref->ref_len);
 
                list = g_list_next(list);
        }
 
        /* append ac record */
-       net_nfc_util_create_record(NET_NFC_RECORD_WELL_KNOWN_TYPE,
-               &type, NULL, &payload, &record);
+       net_nfc_util_create_record(NET_NFC_RECORD_WELL_KNOWN_TYPE, &type, NULL, &payload, &record);
 
        net_nfc_util_append_record(inner_msg, record);
 
        net_nfc_util_clear_data(&payload);
 }
 
-static void _get_handover_type_field(net_nfc_ch_type_e type, data_s *result)
+static void _get_handover_type_field(net_nfc_ch_type_e type, data_s * result)
 {
        switch (type) {
-       case NET_NFC_CH_TYPE_REQUEST :
-               result->buffer = (uint8_t *)CH_REQ_RECORD_TYPE;
+       case NET_NFC_CH_TYPE_REQUEST:
+               result->buffer = (uint8_t *) CH_REQ_RECORD_TYPE;
                result->length = CH_REQ_RECORD_TYPE_LEN;
                break;
 
-       case NET_NFC_CH_TYPE_SELECT :
-               result->buffer = (uint8_t *)CH_SEL_RECORD_TYPE;
+       case NET_NFC_CH_TYPE_SELECT:
+               result->buffer = (uint8_t *) CH_SEL_RECORD_TYPE;
                result->length = CH_SEL_RECORD_TYPE_LEN;
                break;
 
-       case NET_NFC_CH_TYPE_MEDIATION :
-               result->buffer = (uint8_t *)CH_MED_RECORD_TYPE;
+       case NET_NFC_CH_TYPE_MEDIATION:
+               result->buffer = (uint8_t *) CH_MED_RECORD_TYPE;
                result->length = CH_MED_RECORD_TYPE_LEN;
                break;
 
-       case NET_NFC_CH_TYPE_INITIAITE :
-               result->buffer = (uint8_t *)CH_INI_RECORD_TYPE;
+       case NET_NFC_CH_TYPE_INITIAITE:
+               result->buffer = (uint8_t *) CH_INI_RECORD_TYPE;
                result->length = CH_INI_RECORD_TYPE_LEN;
                break;
 
-       default :
+       default:
                break;
        }
 }
 
-net_nfc_error_e net_nfc_util_export_handover_to_ndef_message(
-       net_nfc_ch_message_s *message, ndef_message_s **result)
+net_nfc_error_e net_nfc_util_export_handover_to_ndef_message(net_nfc_ch_message_s * message, ndef_message_s ** result)
 {
        net_nfc_error_e error;
        gpointer params[3];
@@ -1111,19 +951,15 @@ net_nfc_error_e net_nfc_util_export_handover_to_ndef_message(
        uint32_t len;
        char id = 'A';
 
-       if (message == NULL || result == NULL) {
+       if (message == NULL || result == NULL)
                return NET_NFC_NULL_PARAMETER;
-       }
 
        error = net_nfc_util_create_ndef_message(&inner_msg);
        if (error != NET_NFC_OK)
-       {
                return error;
-       }
 
        error = net_nfc_util_create_ndef_message(&main_msg);
-       if (error != NET_NFC_OK)
-       {
+       if (error != NET_NFC_OK) {
                net_nfc_util_free_ndef_message(inner_msg);
 
                return error;
@@ -1147,18 +983,16 @@ net_nfc_error_e net_nfc_util_export_handover_to_ndef_message(
        /* convert message to raw data */
        len = net_nfc_util_get_ndef_message_length(inner_msg);
 
-       if (net_nfc_util_init_data(&payload, sizeof(ch_payload_t) + len) ==
-               true) {
+       if (net_nfc_util_init_data(&payload, sizeof(ch_payload_t) + len) == true) {
                data_s data;
                ch_payload_t *header;
 
-               header = (ch_payload_t *)payload.buffer;
+               header = (ch_payload_t *) payload.buffer;
 
                data.buffer = header->message;
                data.length = len;
 
-               error = net_nfc_util_convert_ndef_message_to_rawdata(inner_msg,
-                       &data);
+               error = net_nfc_util_convert_ndef_message_to_rawdata(inner_msg, &data);
                if (error == NET_NFC_OK) {
                        ndef_record_s *hr = NULL;
                        data_s type;
@@ -1169,13 +1003,10 @@ net_nfc_error_e net_nfc_util_export_handover_to_ndef_message(
                        _get_handover_type_field(message->type, &type);
 
                        /* create Hr record */
-                       error = net_nfc_util_create_record(
-                               NET_NFC_RECORD_WELL_KNOWN_TYPE,
-                               &type, NULL, &payload, &hr);
+                       error = net_nfc_util_create_record(NET_NFC_RECORD_WELL_KNOWN_TYPE, &type, NULL, &payload, &hr);
                        if (error == NET_NFC_OK) {
                                /* append first record */
-                               net_nfc_util_append_record_by_index(main_msg, 0,
-                                       hr);
+                               net_nfc_util_append_record_by_index(main_msg, 0, hr);
 
                                *result = main_msg;
                        } else {
@@ -1195,15 +1026,14 @@ net_nfc_error_e net_nfc_util_export_handover_to_ndef_message(
        return error;
 }
 
-static ndef_message_s *_raw_data_to_ndef_message(data_s *data)
+static ndef_message_s *_raw_data_to_ndef_message(data_s * data)
 {
        net_nfc_error_e result;
        ndef_message_s *msg = NULL;
 
        result = net_nfc_util_create_ndef_message(&msg);
        if (result == NET_NFC_OK) {
-               result = net_nfc_util_convert_rawdata_to_ndef_message(data,
-                       msg);
+               result = net_nfc_util_convert_rawdata_to_ndef_message(data, msg);
                if (result != NET_NFC_OK) {
                        net_nfc_util_free_ndef_message(msg);
                        msg = NULL;
@@ -1213,14 +1043,12 @@ static ndef_message_s *_raw_data_to_ndef_message(data_s *data)
        return msg;
 }
 
-static ndef_record_s *_find_record_by_id(uint8_t *id, uint8_t id_len,
-       ndef_record_s *records)
+static ndef_record_s *_find_record_by_id(uint8_t * id, uint8_t id_len, ndef_record_s * records)
 {
        ndef_record_s *record = NULL;
 
        while (records != NULL) {
-               if (records->id_s.length == id_len &&
-                       memcmp(id, records->id_s.buffer, id_len) == 0) {
+               if (records->id_s.length == id_len && memcmp(id, records->id_s.buffer, id_len) == 0) {
                        record = records;
 
                        break;
@@ -1231,8 +1059,7 @@ static ndef_record_s *_find_record_by_id(uint8_t *id, uint8_t id_len,
        return record;
 }
 
-static void _fill_aux_rec(net_nfc_ch_carrier_s *carrier,
-       ch_ac_aux_header_t *header, ndef_record_s *content)
+static void _fill_aux_rec(net_nfc_ch_carrier_s * carrier, ch_ac_aux_header_t * header, ndef_record_s * content)
 {
        if (header == NULL)
                return;
@@ -1244,54 +1071,38 @@ static void _fill_aux_rec(net_nfc_ch_carrier_s *carrier,
                ndef_record_s *temp;
                ch_ac_ref_t *ref;
 
-               ref = (ch_ac_ref_t *)header->data;
+               ref = (ch_ac_ref_t *) header->data;
 
                for (i = 0; i < header->count; i++) {
-                       record = _find_record_by_id(ref->ref, ref->ref_len,
-                               content);
+                       record = _find_record_by_id(ref->ref, ref->ref_len, content);
                        if (record != NULL) {
-                               net_nfc_util_create_record(record->TNF,
-                                       &record->type_s,
-                                       NULL, &record->payload_s,
-                                       &temp);
+                               net_nfc_util_create_record(record->TNF, &record->type_s, NULL, &record->payload_s, &temp);
 
-                               carrier->aux_records = g_list_append(
-                                       carrier->aux_records, temp);
+                               carrier->aux_records = g_list_append(carrier->aux_records, temp);
                        }
 
-                       ref = (ch_ac_ref_t *)(ref->ref + ref->ref_len);
+                       ref = (ch_ac_ref_t *) (ref->ref + ref->ref_len);
                }
        }
 }
 
-static net_nfc_conn_handover_carrier_type_e _get_carrier_type_from_record(
-       ndef_record_s *record)
+static net_nfc_conn_handover_carrier_type_e _get_carrier_type_from_record(ndef_record_s * record)
 {
        net_nfc_conn_handover_carrier_type_e result;
 
        if (net_nfc_util_handover_bt_check_carrier_record(record))
-       {
                result = NET_NFC_CONN_HANDOVER_CARRIER_BT;
-       }
        else if (net_nfc_util_handover_wps_check_carrier_record(record))
-       {
                result = NET_NFC_CONN_HANDOVER_CARRIER_WIFI_WPS;
-       }
        else if (net_nfc_util_handover_wfd_check_carrier_record(record))
-       {
                result = NET_NFC_CONN_HANDOVER_CARRIER_WIFI_P2P;
-       }
        else
-       {
                result = NET_NFC_CONN_HANDOVER_CARRIER_UNKNOWN;
-       }
 
        return result;
 }
 
-static net_nfc_error_e _fill_handover_carrier_record(
-       net_nfc_ch_carrier_s *carrier,
-       ch_ac_ref_t *ref, ndef_record_s *content)
+static net_nfc_error_e _fill_handover_carrier_record(net_nfc_ch_carrier_s * carrier, ch_ac_ref_t * ref, ndef_record_s * content)
 {
        net_nfc_error_e result;
        ndef_record_s *record;
@@ -1306,14 +1117,9 @@ static net_nfc_error_e _fill_handover_carrier_record(
 
                carrier->type = _get_carrier_type_from_record(record);
 
-               result = net_nfc_util_create_record(record->TNF,
-                       &record->type_s, NULL,
-                       &record->payload_s,
-                       &carrier->carrier_record);
+               result = net_nfc_util_create_record(record->TNF, &record->type_s, NULL, &record->payload_s, &carrier->carrier_record);
 
-               _fill_aux_rec(carrier,
-                       (ch_ac_aux_header_t *)(ref->ref + ref->ref_len),
-                       content);
+               _fill_aux_rec(carrier, (ch_ac_aux_header_t *) (ref->ref + ref->ref_len), content);
 
                result = NET_NFC_OK;
        } else {
@@ -1325,21 +1131,19 @@ static net_nfc_error_e _fill_handover_carrier_record(
        return result;
 }
 
-static net_nfc_error_e _fill_handover_message(net_nfc_ch_message_s *msg,
-       ndef_record_s *header, ndef_record_s *content)
+static net_nfc_error_e _fill_handover_message(net_nfc_ch_message_s * msg, ndef_record_s * header, ndef_record_s * content)
 {
        net_nfc_error_e result = NET_NFC_OK;
        ndef_record_s *current = header;
 
        DEBUG_MSG("header [%p], content [%p]", header, content);
 
-       while (current != NULL &&
-               CHECK_TYPE(current->type_s, CH_AC_RECORD_TYPE) == true) {
+       while (current != NULL && CHECK_TYPE(current->type_s, CH_AC_RECORD_TYPE) == true) {
                net_nfc_ch_carrier_s *carrier;
                ch_ac_header_t *ac_header;
                net_nfc_conn_handover_carrier_state_e cps;
 
-               ac_header = (ch_ac_header_t *)current->payload_s.buffer;
+               ac_header = (ch_ac_header_t *) current->payload_s.buffer;
 
                cps = ac_header->cps;
 
@@ -1348,13 +1152,11 @@ static net_nfc_error_e _fill_handover_message(net_nfc_ch_message_s *msg,
                        ch_ac_ref_t *ref;
 
                        /* copy carrier record */
-                       ref = (ch_ac_ref_t *)ac_header->data;
+                       ref = (ch_ac_ref_t *) ac_header->data;
 
-                       result = _fill_handover_carrier_record(carrier, ref,
-                               content);
+                       result = _fill_handover_carrier_record(carrier, ref, content);
                        if (result == NET_NFC_OK) {
-                               net_nfc_util_append_handover_carrier(msg,
-                                       carrier);
+                               net_nfc_util_append_handover_carrier(msg, carrier);
                        } else {
                                DEBUG_ERR_MSG("_fill_handover_carrier_record failed, [%d]", result);
 
@@ -1370,35 +1172,32 @@ static net_nfc_error_e _fill_handover_message(net_nfc_ch_message_s *msg,
        return result;
 }
 
-static net_nfc_ch_type_e _get_handover_type_from_type_data(data_s *result)
+static net_nfc_ch_type_e _get_handover_type_from_type_data(data_s * result)
 {
        net_nfc_ch_type_e type;
 
-       if (CHECK_TYPE((*result), CH_REQ_RECORD_TYPE) == true) {
+       if (CHECK_TYPE((*result), CH_REQ_RECORD_TYPE) == true)
                type = NET_NFC_CH_TYPE_REQUEST;
-       } else if (CHECK_TYPE((*result), CH_SEL_RECORD_TYPE) == true) {
+       else if (CHECK_TYPE((*result), CH_SEL_RECORD_TYPE) == true)
                type = NET_NFC_CH_TYPE_SELECT;
-       } else if (CHECK_TYPE((*result), CH_MED_RECORD_TYPE) == true) {
+       else if (CHECK_TYPE((*result), CH_MED_RECORD_TYPE) == true)
                type = NET_NFC_CH_TYPE_MEDIATION;
-       } else if (CHECK_TYPE((*result), CH_INI_RECORD_TYPE) == true) {
+       else if (CHECK_TYPE((*result), CH_INI_RECORD_TYPE) == true)
                type = NET_NFC_CH_TYPE_INITIAITE;
-       } else {
+       else
                type = NET_NFC_CH_TYPE_UNKNOWN;
-       }
 
        return type;
 }
 
-net_nfc_error_e net_nfc_util_import_handover_from_ndef_message(
-       ndef_message_s *msg, net_nfc_ch_message_s **result)
+net_nfc_error_e net_nfc_util_import_handover_from_ndef_message(ndef_message_s * msg, net_nfc_ch_message_s ** result)
 {
        net_nfc_error_e error;
        ndef_record_s *hr = NULL;
        net_nfc_ch_type_e type;
 
-       if (msg == NULL || result == NULL) {
+       if (msg == NULL || result == NULL)
                return NET_NFC_NULL_PARAMETER;
-       }
 
        /* first record */
        error = net_nfc_util_get_record_by_index(msg, 0, &hr);
@@ -1408,21 +1207,19 @@ net_nfc_error_e net_nfc_util_import_handover_from_ndef_message(
                return error;
        }
 
-       if (hr->TNF != NET_NFC_RECORD_WELL_KNOWN_TYPE) {
+       if (hr->TNF != NET_NFC_RECORD_WELL_KNOWN_TYPE)
                return NET_NFC_INVALID_FORMAT;
-       }
 
        type = _get_handover_type_from_type_data(&hr->type_s);
-       if (type == NET_NFC_CH_TYPE_UNKNOWN) {
+       if (type == NET_NFC_CH_TYPE_UNKNOWN)
                return NET_NFC_INVALID_FORMAT;
-       }
 
        ndef_message_s *inner;
        data_s data;
        ch_payload_t *header;
 
        /* check type */
-       header = (ch_payload_t *)hr->payload_s.buffer;
+       header = (ch_payload_t *) hr->payload_s.buffer;
 
        /* check version */
 
@@ -1441,15 +1238,14 @@ net_nfc_error_e net_nfc_util_import_handover_from_ndef_message(
                        ndef_record_s *record = NULL;
 
                        temp->version = header->version;
-                       temp->type = _get_handover_type_from_type_data(
-                               &hr->type_s);
+                       temp->type = _get_handover_type_from_type_data(&hr->type_s);
 
                        record = inner->records;
 
                        if (temp->type == NET_NFC_CH_TYPE_REQUEST) {
                                /* get cr */
                                if (CHECK_TYPE(record->type_s, CH_CR_RECORD_TYPE) == true) {
-                                       temp->cr = htons(*(uint16_t *)record->payload_s.buffer);
+                                       temp->cr = htons(*(uint16_t *) record->payload_s.buffer);
 
                                        record = record->next;
                                }
@@ -1472,34 +1268,26 @@ net_nfc_error_e net_nfc_util_import_handover_from_ndef_message(
        return error;
 }
 
-net_nfc_error_e net_nfc_util_get_handover_random_number(
-       net_nfc_ch_message_s *message, uint16_t *random_number)
+net_nfc_error_e net_nfc_util_get_handover_random_number(net_nfc_ch_message_s * message, uint16_t * random_number)
 {
        if (message == NULL || random_number == NULL)
-       {
                return NET_NFC_NULL_PARAMETER;
-       }
 
-       if (message->type != NET_NFC_CH_TYPE_REQUEST) {
+       if (message->type != NET_NFC_CH_TYPE_REQUEST)
                return NET_NFC_INVALID_PARAM;
-       }
 
        *random_number = message->cr;
 
        return NET_NFC_OK;
 }
 
-net_nfc_error_e net_nfc_util_get_selector_power_status(
-       net_nfc_ch_message_s *message,
-       net_nfc_conn_handover_carrier_state_e *cps)
+net_nfc_error_e net_nfc_util_get_selector_power_status(net_nfc_ch_message_s * message, net_nfc_conn_handover_carrier_state_e * cps)
 {
        net_nfc_error_e error;
        int count;
 
        if (message == NULL || cps == NULL)
-       {
                return NET_NFC_NULL_PARAMETER;
-       }
 
        count = g_list_length(message->carriers);
 
@@ -1519,8 +1307,7 @@ net_nfc_error_e net_nfc_util_get_selector_power_status(
                        if (carrier == NULL)
                                continue;
 
-                       if (carrier->cps == NET_NFC_CONN_HANDOVER_CARRIER_ACTIVATE ||
-                               carrier->cps == NET_NFC_CONN_HANDOVER_CARRIER_ACTIVATING) {
+                       if (carrier->cps == NET_NFC_CONN_HANDOVER_CARRIER_ACTIVATE || carrier->cps == NET_NFC_CONN_HANDOVER_CARRIER_ACTIVATING) {
 
                                *cps = NET_NFC_CONN_HANDOVER_CARRIER_ACTIVATE;
                                break;
index b64cd5b..ec4caf4 100644 (file)
 #define CH_BT_MIME             "application/vnd.bluetooth.ep.oob"
 #define CH_BT_MIME_LEN         32
 
-bool net_nfc_util_handover_bt_check_carrier_record(ndef_record_s *record)
+bool net_nfc_util_handover_bt_check_carrier_record(ndef_record_s * record)
 {
        bool result;
 
        g_assert(record != NULL);
 
-       if ((record->type_s.length == CH_CAR_RECORD_TYPE_LEN) &&
-               (memcmp(CH_CAR_RECORD_TYPE, record->type_s.buffer,
-                       CH_CAR_RECORD_TYPE_LEN) == 0)) {
+       if ((record->type_s.length == CH_CAR_RECORD_TYPE_LEN) && (memcmp(CH_CAR_RECORD_TYPE, record->type_s.buffer, CH_CAR_RECORD_TYPE_LEN) == 0)) {
 
                /* FIXME */
-               if ((record->type_s.length == CH_BT_MIME_LEN) &&
-                       (memcmp(CH_BT_MIME, record->type_s.buffer,
-                               CH_BT_MIME_LEN) == 0)) {
+               if ((record->type_s.length == CH_BT_MIME_LEN) && (memcmp(CH_BT_MIME, record->type_s.buffer, CH_BT_MIME_LEN) == 0))
                        result = true;
-               } else {
+               else
                        result = false;
-               }
-       } else if ((record->type_s.length == CH_BT_MIME_LEN) &&
-               (memcmp(CH_BT_MIME, record->type_s.buffer,
-                       CH_BT_MIME_LEN) == 0)) {
+       } else if ((record->type_s.length == CH_BT_MIME_LEN) && (memcmp(CH_BT_MIME, record->type_s.buffer, CH_BT_MIME_LEN) == 0)) {
                result = true;
        } else {
                result = false;
@@ -56,26 +49,22 @@ bool net_nfc_util_handover_bt_check_carrier_record(ndef_record_s *record)
        return result;
 }
 
-typedef struct _oob_header_t
-{
+typedef struct _oob_header_t {
        uint16_t length;
        uint8_t address[6];
        uint8_t data[0];
-}
-oob_header_t;
+} oob_header_t;
 
-typedef struct _eir_header_t
-{
+typedef struct _eir_header_t {
        uint8_t l;
        uint8_t t;
        uint8_t v[0];
-}
-__attribute__((packed)) eir_header_t;
+} __attribute__ ((packed)) eir_header_t;
 
-static void __calc_total_length_cb(GNode *node, gpointer data)
+static void __calc_total_length_cb(GNode * node, gpointer data)
 {
        net_nfc_carrier_property_s *info = node->data;
-       uint32_t *length = (uint32_t *)data;
+       uint32_t *length = (uint32_t *) data;
 
        if (info == NULL)
                return;
@@ -88,44 +77,40 @@ static void __calc_total_length_cb(GNode *node, gpointer data)
        if (info->is_group) {
                uint32_t temp_len = 0;
 
-               g_node_children_foreach(node, G_TRAVERSE_ALL,
-                       __calc_total_length_cb, &temp_len);
+               g_node_children_foreach(node, G_TRAVERSE_ALL, __calc_total_length_cb, &temp_len);
 
                info->length = temp_len;
 
                *length += info->length;
-       }
-       else
-       {
+       } else {
                *length += info->length;
        }
 }
 
-static uint32_t _calc_total_length(net_nfc_carrier_config_s *config)
+static uint32_t _calc_total_length(net_nfc_carrier_config_s * config)
 {
        uint32_t result = sizeof(oob_header_t);
 
-       g_node_children_foreach(config->data, G_TRAVERSE_ALL,
-               __calc_total_length_cb, &result);
+       g_node_children_foreach(config->data, G_TRAVERSE_ALL, __calc_total_length_cb, &result);
 
        config->length = result;
 
        return result;
 }
 
-static void _serialize_cb(GNode *node, gpointer data)
+static void _serialize_cb(GNode * node, gpointer data)
 {
        net_nfc_carrier_property_s *prop = node->data;
-       data_s *payload = (data_s *)data;
+       data_s *payload = (data_s *) data;
        eir_header_t *header;
 
        if (prop == NULL)
                return;
 
-       if (prop->attribute == NET_NFC_BT_ATTRIBUTE_ADDRESS) /* skip property */
+       if (prop->attribute == NET_NFC_BT_ATTRIBUTE_ADDRESS)    /* skip property */
                return;
 
-       header = (eir_header_t *)(payload->buffer + payload->length);
+       header = (eir_header_t *) (payload->buffer + payload->length);
 
        header->t = prop->attribute;
        header->l = prop->length + sizeof(header->t);
@@ -137,18 +122,15 @@ static void _serialize_cb(GNode *node, gpointer data)
        payload->length += (prop->length);
 }
 
-net_nfc_error_e net_nfc_util_handover_bt_create_record_from_config(
-       ndef_record_s **record, net_nfc_carrier_config_s *config)
+net_nfc_error_e net_nfc_util_handover_bt_create_record_from_config(ndef_record_s ** record, net_nfc_carrier_config_s * config)
 {
        net_nfc_error_e result;
        uint32_t len;
        uint8_t *buffer = NULL;
-       data_s type = { (uint8_t *)CH_BT_MIME, CH_BT_MIME_LEN };
+       data_s type = { (uint8_t *) CH_BT_MIME, CH_BT_MIME_LEN };
 
        if (record == NULL || config == NULL)
-       {
                return NET_NFC_NULL_PARAMETER;
-       }
 
        len = _calc_total_length(config);
 
@@ -156,7 +138,7 @@ net_nfc_error_e net_nfc_util_handover_bt_create_record_from_config(
 
        _net_nfc_util_alloc_mem(buffer, len);
        if (buffer != NULL) {
-               oob_header_t *header = (oob_header_t *)buffer;
+               oob_header_t *header = (oob_header_t *) buffer;
                uint16_t addr_len = 0;
                uint8_t *addr = NULL;
                data_s payload;
@@ -165,25 +147,20 @@ net_nfc_error_e net_nfc_util_handover_bt_create_record_from_config(
                header->length = len;
 
                /* address */
-               net_nfc_util_get_carrier_config_property(config,
-                       NET_NFC_BT_ATTRIBUTE_ADDRESS,
-                       &addr_len, &addr);
+               net_nfc_util_get_carrier_config_property(config, NET_NFC_BT_ATTRIBUTE_ADDRESS, &addr_len, &addr);
 
-               if (addr_len == sizeof(header->address)) {
+               if (addr_len == sizeof(header->address))
                        memcpy(header->address, addr, addr_len);
-               }
 
                payload.buffer = buffer;
-               payload.length = sizeof(oob_header_t); /* offset */
+               payload.length = sizeof(oob_header_t);  /* offset */
 
                /* eirs */
-               g_node_children_foreach(config->data, G_TRAVERSE_ALL,
-                       _serialize_cb, &payload);
+               g_node_children_foreach(config->data, G_TRAVERSE_ALL, _serialize_cb, &payload);
 
                g_assert(len == payload.length);
 
-               result = net_nfc_util_create_record(NET_NFC_RECORD_MIME_TYPE,
-                       &type, NULL, &payload, record);
+               result = net_nfc_util_create_record(NET_NFC_RECORD_MIME_TYPE, &type, NULL, &payload, record);
 
                _net_nfc_util_free_mem(buffer);
        } else {
@@ -193,11 +170,9 @@ net_nfc_error_e net_nfc_util_handover_bt_create_record_from_config(
        return result;
 }
 
-typedef void (*_parse_eir_cb)(uint8_t t, uint8_t l,
-       uint8_t *v, void *user_data);
+typedef void (*_parse_eir_cb) (uint8_t t, uint8_t l, uint8_t * v, void *user_data);
 
-static void _parse_eir(uint8_t *buffer, uint32_t len,
-       _parse_eir_cb cb, void *user_data)
+static void _parse_eir(uint8_t * buffer, uint32_t len, _parse_eir_cb cb, void *user_data)
 {
        eir_header_t *tlv;
        uint32_t offset = 0;
@@ -206,20 +181,17 @@ static void _parse_eir(uint8_t *buffer, uint32_t len,
        if (buffer == NULL || len == 0 || cb == NULL)
                return;
 
-       do
-       {
-               tlv = (eir_header_t *)(buffer + offset);
-               l = tlv->l - sizeof(tlv->t); /* length includes tag's size */
+       do {
+               tlv = (eir_header_t *) (buffer + offset);
+               l = tlv->l - sizeof(tlv->t);    /* length includes tag's size */
                cb(tlv->t, l, tlv->v, user_data);
                offset += sizeof(eir_header_t) + l;
-       }
-       while (offset < len);
+       } while (offset < len);
 }
 
-static void _bt_eir_cb(uint8_t t, uint8_t l,
-       uint8_t *v, void *user_data)
+static void _bt_eir_cb(uint8_t t, uint8_t l, uint8_t * v, void *user_data)
 {
-       GNode *node = (GNode *)user_data;
+       GNode *node = (GNode *) user_data;
        net_nfc_carrier_property_s *elem;
 
        elem = g_new0(net_nfc_carrier_property_s, 1);
@@ -228,38 +200,30 @@ static void _bt_eir_cb(uint8_t t, uint8_t l,
        elem->length = l;
        elem->data = g_malloc0(l);
 
-       if(elem->data != NULL)
-       {
+       if (elem->data != NULL) {
                memcpy(elem->data, v, l);
 
                g_node_append_data(node, elem);
        }
 }
 
-net_nfc_error_e net_nfc_util_handover_bt_create_config_from_record(
-       net_nfc_carrier_config_s **config, ndef_record_s *record)
+net_nfc_error_e net_nfc_util_handover_bt_create_config_from_record(net_nfc_carrier_config_s ** config, ndef_record_s * record)
 {
        net_nfc_error_e result = NET_NFC_OK;
        net_nfc_carrier_config_s *temp = NULL;
 
        if (record == NULL || config == NULL)
-       {
                return NET_NFC_NULL_PARAMETER;
-       }
 
-       result = net_nfc_util_create_carrier_config(&temp,
-               NET_NFC_CONN_HANDOVER_CARRIER_WIFI_WPS);
+       result = net_nfc_util_create_carrier_config(&temp, NET_NFC_CONN_HANDOVER_CARRIER_WIFI_WPS);
        if (temp != NULL) {
-               oob_header_t *header = (oob_header_t *)record->payload_s.buffer;
+               oob_header_t *header = (oob_header_t *) record->payload_s.buffer;
 
                temp->length = header->length;
 
-               net_nfc_util_add_carrier_config_property(temp,
-                       NET_NFC_BT_ATTRIBUTE_ADDRESS, sizeof(header->address),
-                       header->address);
+               net_nfc_util_add_carrier_config_property(temp, NET_NFC_BT_ATTRIBUTE_ADDRESS, sizeof(header->address), header->address);
 
-               _parse_eir(header->data, temp->length - sizeof(oob_header_t),
-                       _bt_eir_cb, temp->data);
+               _parse_eir(header->data, temp->length - sizeof(oob_header_t), _bt_eir_cb, temp->data);
 
                *config = temp;
        } else {
index bb5e275..8678c94 100644 (file)
 #include "net_nfc_util_ndef_message.h"
 #include "net_nfc_util_handover.h"
 
-bool net_nfc_util_handover_wfd_check_carrier_record(ndef_record_s *record)
+bool net_nfc_util_handover_wfd_check_carrier_record(ndef_record_s * record)
 {
        bool result;
 
        g_assert(record != NULL);
 
-       if ((record->type_s.length == CH_CAR_RECORD_TYPE_LEN) &&
-               (memcmp(CH_CAR_RECORD_TYPE, record->type_s.buffer,
-                       CH_CAR_RECORD_TYPE_LEN) == 0)) {
+       if ((record->type_s.length == CH_CAR_RECORD_TYPE_LEN) && (memcmp(CH_CAR_RECORD_TYPE, record->type_s.buffer, CH_CAR_RECORD_TYPE_LEN) == 0)) {
 
                /* FIXME */
-               if ((record->type_s.length == CH_WIFI_P2P_MIME_LEN) &&
-                       (memcmp(CH_WIFI_P2P_MIME, record->type_s.buffer,
-                               CH_WIFI_P2P_MIME_LEN) == 0)) {
+               if ((record->type_s.length == CH_WIFI_P2P_MIME_LEN) && (memcmp(CH_WIFI_P2P_MIME, record->type_s.buffer, CH_WIFI_P2P_MIME_LEN) == 0))
                        result = true;
-               } else {
+               else
                        result = false;
-               }
-       } else if ((record->type_s.length == CH_WIFI_P2P_MIME_LEN) &&
-               (memcmp(CH_WIFI_P2P_MIME, record->type_s.buffer,
-                       CH_WIFI_P2P_MIME_LEN) == 0)) {
+       } else if ((record->type_s.length == CH_WIFI_P2P_MIME_LEN) && (memcmp(CH_WIFI_P2P_MIME, record->type_s.buffer, CH_WIFI_P2P_MIME_LEN) == 0)) {
                result = true;
        } else {
                result = false;
@@ -53,26 +46,20 @@ bool net_nfc_util_handover_wfd_check_carrier_record(ndef_record_s *record)
        return result;
 }
 
-typedef struct _ac_header_t
-{
+typedef struct _ac_header_t {
        uint16_t length;
        uint8_t buffer[0];
-}
-__attribute__((packed)) ac_header_t;
+} __attribute__ ((packed)) ac_header_t;
 
-typedef struct _tlv_header_t
-{
+typedef struct _tlv_header_t {
        uint16_t t;
        uint16_t l;
        uint8_t v[0];
-}
-__attribute__((packed)) tlv_header_t;
+} __attribute__ ((packed)) tlv_header_t;
 
-typedef void (*_parse_tlv_cb)(uint16_t t, uint16_t l,
-       uint8_t *v, void *user_data);
+typedef void (*_parse_tlv_cb) (uint16_t t, uint16_t l, uint8_t * v, void *user_data);
 
-static void _parse_tlv(uint8_t *buffer, uint32_t len,
-       _parse_tlv_cb cb, void *user_data)
+static void _parse_tlv(uint8_t * buffer, uint32_t len, _parse_tlv_cb cb, void *user_data)
 {
        tlv_header_t *tlv;
        uint32_t offset = 0;
@@ -81,26 +68,21 @@ static void _parse_tlv(uint8_t *buffer, uint32_t len,
        if (buffer == NULL || len == 0 || cb == NULL)
                return;
 
-       do
-       {
-               tlv = (tlv_header_t *)(buffer + offset);
+       do {
+               tlv = (tlv_header_t *) (buffer + offset);
                l = htons(tlv->l);
                cb(htons(tlv->t), l, tlv->v, user_data);
                offset += sizeof(tlv_header_t) + l;
-       }
-       while (offset < len);
+       } while (offset < len);
 }
 
-typedef struct _small_tlv_header_t
-{
+typedef struct _small_tlv_header_t {
        uint8_t t;
        uint16_t l;
        uint8_t v[0];
-}
-__attribute__((packed)) small_tlv_header_t;
+} __attribute__ ((packed)) small_tlv_header_t;
 
-static void _parse_small_tlv(uint8_t *buffer, uint32_t len,
-       _parse_tlv_cb cb, void *user_data)
+static void _parse_small_tlv(uint8_t * buffer, uint32_t len, _parse_tlv_cb cb, void *user_data)
 {
        small_tlv_header_t *tlv;
        uint32_t offset = 0;
@@ -109,20 +91,17 @@ static void _parse_small_tlv(uint8_t *buffer, uint32_t len,
        if (buffer == NULL || len == 0 || cb == NULL)
                return;
 
-       do
-       {
-               tlv = (small_tlv_header_t *)(buffer + offset);
+       do {
+               tlv = (small_tlv_header_t *) (buffer + offset);
                l = htons(tlv->l);
                cb(tlv->t, l, tlv->v, user_data);
                offset += sizeof(small_tlv_header_t) + l;
-       }
-       while (offset < len);
+       } while (offset < len);
 }
 
-static void _wifi_tlv_cb(uint16_t t, uint16_t l,
-       uint8_t *v, void *user_data)
+static void _wifi_tlv_cb(uint16_t t, uint16_t l, uint8_t * v, void *user_data)
 {
-       GNode *node = (GNode *)user_data;
+       GNode *node = (GNode *) user_data;
        net_nfc_carrier_property_s *elem;
 
        elem = g_new0(net_nfc_carrier_property_s, 1);
@@ -141,30 +120,22 @@ static void _wifi_tlv_cb(uint16_t t, uint16_t l,
                DEBUG_MSG("t [0x%04X] l [%d] v [%p]", t, l, v);
 
                elem->data = g_malloc0(l);
-               if(elem->data != NULL)
-               {
+               if (elem->data != NULL)
                        memcpy(elem->data, v, l);
-               }
                else
-               {
                        DEBUG_MSG("elem->data is NULL");
-               }
        }
 }
 
-net_nfc_error_e net_nfc_util_handover_wfd_create_config_from_record(
-       net_nfc_carrier_config_s **config, ndef_record_s *record)
+net_nfc_error_e net_nfc_util_handover_wfd_create_config_from_record(net_nfc_carrier_config_s ** config, ndef_record_s * record)
 {
        net_nfc_error_e result = NET_NFC_OK;
        net_nfc_carrier_config_s *temp = NULL;
 
        if (record == NULL || config == NULL)
-       {
                return NET_NFC_NULL_PARAMETER;
-       }
 
-       result = net_nfc_util_create_carrier_config(&temp,
-               NET_NFC_CONN_HANDOVER_CARRIER_WIFI_P2P);
+       result = net_nfc_util_create_carrier_config(&temp, NET_NFC_CONN_HANDOVER_CARRIER_WIFI_P2P);
        if (result == NET_NFC_OK && temp != NULL) {
                ac_header_t *header;
                uint16_t length;
@@ -173,18 +144,16 @@ net_nfc_error_e net_nfc_util_handover_wfd_create_config_from_record(
                temp->length = record->payload_s.length;
 
                /* WSC properties */
-               header = (ac_header_t *)record->payload_s.buffer;
+               header = (ac_header_t *) record->payload_s.buffer;
                length = htons(header->length);
 
-               _parse_tlv(header->buffer, length,
-                       _wifi_tlv_cb, temp->data);
+               _parse_tlv(header->buffer, length, _wifi_tlv_cb, temp->data);
 
                /* P2P properties */
-               header = (ac_header_t *)(header->buffer + length);
+               header = (ac_header_t *) (header->buffer + length);
                length = htons(header->length);
 
-               _parse_small_tlv(header->buffer, length,
-                       _wifi_tlv_cb, temp->data);
+               _parse_small_tlv(header->buffer, length, _wifi_tlv_cb, temp->data);
 
                *config = temp;
        } else {
@@ -194,89 +163,82 @@ net_nfc_error_e net_nfc_util_handover_wfd_create_config_from_record(
        return result;
 }
 
-static void __calc_total_wsc_prop_length_cb(GNode *node, gpointer data)
+static void __calc_total_wsc_prop_length_cb(GNode * node, gpointer data)
 {
        net_nfc_carrier_property_s *info = node->data;
-       uint32_t *length = (uint32_t *)data;
+       uint32_t *length = (uint32_t *) data;
 
        if (info == NULL)
                return;
 
-       if (info->attribute < 0x0100) {
+       if (info->attribute < 0x0100)
                return;
-       }
 
        *length += sizeof(tlv_header_t);
 
        if (info->is_group) {
                uint32_t temp_len = 0;
 
-               g_node_children_foreach(node, G_TRAVERSE_ALL,
-                       __calc_total_wsc_prop_length_cb, &temp_len);
+               g_node_children_foreach(node, G_TRAVERSE_ALL, __calc_total_wsc_prop_length_cb, &temp_len);
 
                info->length = temp_len;
 
                *length += info->length;
-       }
-       else
-       {
+       } else {
                *length += info->length;
        }
 }
 
-static void __calc_total_p2p_prop_length_cb(GNode *node, gpointer data)
+static void __calc_total_p2p_prop_length_cb(GNode * node, gpointer data)
 {
        net_nfc_carrier_property_s *info = node->data;
-       uint32_t *length = (uint32_t *)data;
+       uint32_t *length = (uint32_t *) data;
 
        if (info == NULL)
                return;
 
-       if (info->attribute > 0x00FF) {
+       if (info->attribute > 0x00FF)
                return;
-       }
 
        *length += sizeof(small_tlv_header_t);
        *length += info->length;
 }
 
-static uint32_t _calc_total_wsc_prop_length(net_nfc_carrier_config_s *config)
+static uint32_t _calc_total_wsc_prop_length(net_nfc_carrier_config_s * config)
 {
        uint32_t result = 0;
 
        /* WSC properties */
        result += sizeof(ac_header_t);
 
-       g_node_children_foreach(config->data, G_TRAVERSE_ALL,
-               __calc_total_wsc_prop_length_cb, &result);
+       g_node_children_foreach(config->data, G_TRAVERSE_ALL, __calc_total_wsc_prop_length_cb, &result);
 
        config->length = result;
 
        return result;
 }
 
-static uint32_t _calc_total_p2p_prop_length(net_nfc_carrier_config_s *config)
+static uint32_t _calc_total_p2p_prop_length(net_nfc_carrier_config_s * config)
 {
        uint32_t result = 0;
 
        /* P2P properties */
        result += sizeof(ac_header_t);
 
-       g_node_children_foreach(config->data, G_TRAVERSE_ALL,
-               __calc_total_p2p_prop_length_cb, &result);
+       g_node_children_foreach(config->data, G_TRAVERSE_ALL, __calc_total_p2p_prop_length_cb, &result);
 
        config->length = result;
 
        return result;
 }
 
-static void _serialize_wsc_prop_cb(GNode *node, gpointer data)
+static void _serialize_wsc_prop_cb(GNode * node, gpointer data)
 {
        net_nfc_carrier_property_s *prop = node->data;
-       data_s *payload = (data_s *)data;
+       data_s *payload = (data_s *) data;
        tlv_header_t *header;
 
-       header = (tlv_header_t *)(payload->buffer + payload->length);
+       header = (tlv_header_t *) (payload->buffer + payload->length);
 
        header->t = htons(prop->attribute);
        header->l = htons(prop->length);
@@ -284,8 +246,7 @@ static void _serialize_wsc_prop_cb(GNode *node, gpointer data)
        payload->length += sizeof(tlv_header_t);
 
        if (prop->is_group == true) {
-               g_node_children_foreach(node, G_TRAVERSE_ALL,
-                       _serialize_wsc_prop_cb, payload);
+               g_node_children_foreach(node, G_TRAVERSE_ALL, _serialize_wsc_prop_cb, payload);
        } else {
                memcpy(header->v, prop->data, prop->length);
 
@@ -293,15 +254,15 @@ static void _serialize_wsc_prop_cb(GNode *node, gpointer data)
        }
 }
 
-static void _serialize_p2p_prop_cb(GNode *node, gpointer data)
+static void _serialize_p2p_prop_cb(GNode * node, gpointer data)
 {
        net_nfc_carrier_property_s *prop = node->data;
-       data_s *payload = (data_s *)data;
+       data_s *payload = (data_s *) data;
        small_tlv_header_t *header;
 
-       header = (small_tlv_header_t *)(payload->buffer + payload->length);
+       header = (small_tlv_header_t *) (payload->buffer + payload->length);
 
-       header->t = (uint8_t)prop->attribute;
+       header->t = (uint8_t) prop->attribute;
        header->l = htons(prop->length);
 
        payload->length += sizeof(small_tlv_header_t);
@@ -311,18 +272,15 @@ static void _serialize_p2p_prop_cb(GNode *node, gpointer data)
        payload->length += (prop->length);
 }
 
-net_nfc_error_e net_nfc_util_handover_wfd_create_record_from_config(
-       ndef_record_s **record, net_nfc_carrier_config_s *config)
+net_nfc_error_e net_nfc_util_handover_wfd_create_record_from_config(ndef_record_s ** record, net_nfc_carrier_config_s * config)
 {
        net_nfc_error_e result;
        uint32_t wsc_len, p2p_len;
        data_s payload = { 0, };
-       data_s type = { (uint8_t *)CH_WIFI_P2P_MIME, CH_WIFI_P2P_MIME_LEN };
+       data_s type = { (uint8_t *) CH_WIFI_P2P_MIME, CH_WIFI_P2P_MIME_LEN };
 
        if (record == NULL || config == NULL)
-       {
                return NET_NFC_NULL_PARAMETER;
-       }
 
        wsc_len = _calc_total_wsc_prop_length(config);
        p2p_len = _calc_total_p2p_prop_length(config);
@@ -334,34 +292,31 @@ net_nfc_error_e net_nfc_util_handover_wfd_create_record_from_config(
                data_s temp;
 
                /* serialize WSC properties */
-               header = (ac_header_t *)payload.buffer;
+               header = (ac_header_t *) payload.buffer;
 
                header->length = htons(wsc_len);
 
                temp.buffer = header->buffer;
                temp.length = wsc_len;
 
-               g_node_children_foreach(config->data, G_TRAVERSE_ALL,
-                       _serialize_wsc_prop_cb, &temp);
+               g_node_children_foreach(config->data, G_TRAVERSE_ALL, _serialize_wsc_prop_cb, &temp);
 
                g_assert(wsc_len == temp.length);
 
                /* serialize P2P properties */
-               header = (ac_header_t *)(header->buffer + wsc_len);
+               header = (ac_header_t *) (header->buffer + wsc_len);
 
                header->length = htons(p2p_len);
 
                temp.buffer = header->buffer;
                temp.length = p2p_len;
 
-               g_node_children_foreach(config->data, G_TRAVERSE_ALL,
-                       _serialize_p2p_prop_cb, &temp);
+               g_node_children_foreach(config->data, G_TRAVERSE_ALL, _serialize_p2p_prop_cb, &temp);
 
                g_assert(p2p_len == temp.length);
 
                /* create record */
-               result = net_nfc_util_create_record(NET_NFC_RECORD_MIME_TYPE,
-                       &type, NULL, &payload, record);
+               result = net_nfc_util_create_record(NET_NFC_RECORD_MIME_TYPE, &type, NULL, &payload, record);
 
                net_nfc_util_clear_data(&payload);
        } else {
index eb76cf1..d67e034 100644 (file)
 #include "net_nfc_util_ndef_message.h"
 #include "net_nfc_util_handover.h"
 
-bool net_nfc_util_handover_wps_check_carrier_record(ndef_record_s *record)
+bool net_nfc_util_handover_wps_check_carrier_record(ndef_record_s * record)
 {
        bool result;
 
        g_assert(record != NULL);
 
-       if ((record->type_s.length == CH_CAR_RECORD_TYPE_LEN) &&
-               (memcmp(CH_CAR_RECORD_TYPE, record->type_s.buffer,
-                       CH_CAR_RECORD_TYPE_LEN) == 0)) {
+       if ((record->type_s.length == CH_CAR_RECORD_TYPE_LEN) && (memcmp(CH_CAR_RECORD_TYPE, record->type_s.buffer, CH_CAR_RECORD_TYPE_LEN) == 0)) {
 
                /* FIXME */
-               if ((record->type_s.length == CH_WIFI_WPS_MIME_LEN) &&
-                       (memcmp(CH_WIFI_WPS_MIME, record->type_s.buffer,
-                               CH_WIFI_WPS_MIME_LEN) == 0)) {
+               if ((record->type_s.length == CH_WIFI_WPS_MIME_LEN) && (memcmp(CH_WIFI_WPS_MIME, record->type_s.buffer, CH_WIFI_WPS_MIME_LEN) == 0))
                        result = true;
-               } else {
+               else
                        result = false;
-               }
-       } else if ((record->type_s.length == CH_WIFI_WPS_MIME_LEN) &&
-               (memcmp(CH_WIFI_WPS_MIME, record->type_s.buffer,
-                       CH_WIFI_WPS_MIME_LEN) == 0)) {
+       } else if ((record->type_s.length == CH_WIFI_WPS_MIME_LEN) && (memcmp(CH_WIFI_WPS_MIME, record->type_s.buffer, CH_WIFI_WPS_MIME_LEN) == 0)) {
                result = true;
        } else {
                result = false;
@@ -53,19 +46,15 @@ bool net_nfc_util_handover_wps_check_carrier_record(ndef_record_s *record)
        return result;
 }
 
-typedef struct _tlv_header_t
-{
+typedef struct _tlv_header_t {
        uint16_t t;
        uint16_t l;
        uint8_t v[0];
-}
-__attribute__((packed)) tlv_header_t;
+} __attribute__ ((packed)) tlv_header_t;
 
-typedef void (*_parse_tlv_cb)(uint16_t t, uint16_t l,
-       uint8_t *v, void *user_data);
+typedef void (*_parse_tlv_cb) (uint16_t t, uint16_t l, uint8_t * v, void *user_data);
 
-static void _parse_tlv(uint8_t *buffer, uint32_t len,
-       _parse_tlv_cb cb, void *user_data)
+static void _parse_tlv(uint8_t * buffer, uint32_t len, _parse_tlv_cb cb, void *user_data)
 {
        tlv_header_t *tlv;
        uint32_t offset = 0;
@@ -74,20 +63,17 @@ static void _parse_tlv(uint8_t *buffer, uint32_t len,
        if (buffer == NULL || len == 0 || cb == NULL)
                return;
 
-       do
-       {
-               tlv = (tlv_header_t *)(buffer + offset);
+       do {
+               tlv = (tlv_header_t *) (buffer + offset);
                l = htons(tlv->l);
                cb(htons(tlv->t), l, tlv->v, user_data);
                offset += sizeof(tlv_header_t) + l;
-       }
-       while (offset < len);
+       } while (offset < len);
 }
 
-static void _wifi_tlv_cb(uint16_t t, uint16_t l,
-       uint8_t *v, void *user_data)
+static void _wifi_tlv_cb(uint16_t t, uint16_t l, uint8_t * v, void *user_data)
 {
-       GNode *node = (GNode *)user_data;
+       GNode *node = (GNode *) user_data;
        net_nfc_carrier_property_s *elem;
 
        elem = g_new0(net_nfc_carrier_property_s, 1);
@@ -104,28 +90,23 @@ static void _wifi_tlv_cb(uint16_t t, uint16_t l,
                _parse_tlv(v, l, _wifi_tlv_cb, node);
        } else {
                elem->data = g_malloc0(l);
-               if(elem->data != NULL)
+               if (elem->data != NULL)
                        memcpy(elem->data, v, l);
        }
 }
 
-net_nfc_error_e net_nfc_util_handover_wps_create_config_from_record(
-       net_nfc_carrier_config_s **config, ndef_record_s *record)
+net_nfc_error_e net_nfc_util_handover_wps_create_config_from_record(net_nfc_carrier_config_s ** config, ndef_record_s * record)
 {
        net_nfc_error_e result = NET_NFC_OK;
        net_nfc_carrier_config_s *temp = NULL;
 
        if (record == NULL || config == NULL)
-       {
                return NET_NFC_NULL_PARAMETER;
-       }
 
-       result = net_nfc_util_create_carrier_config(&temp,
-               NET_NFC_CONN_HANDOVER_CARRIER_WIFI_P2P);
+       result = net_nfc_util_create_carrier_config(&temp, NET_NFC_CONN_HANDOVER_CARRIER_WIFI_P2P);
        if (temp != NULL) {
                temp->length = record->payload_s.length;
-               _parse_tlv(record->payload_s.buffer, record->payload_s.length,
-                       _wifi_tlv_cb, temp->data);
+               _parse_tlv(record->payload_s.buffer, record->payload_s.length, _wifi_tlv_cb, temp->data);
                *config = temp;
        } else {
                result = NET_NFC_ALLOC_FAIL;
@@ -134,10 +115,10 @@ net_nfc_error_e net_nfc_util_handover_wps_create_config_from_record(
        return result;
 }
 
-static void __calc_total_length_cb(GNode *node, gpointer data)
+static void __calc_total_length_cb(GNode * node, gpointer data)
 {
        net_nfc_carrier_property_s *info = node->data;
-       uint32_t *length = (uint32_t *)data;
+       uint32_t *length = (uint32_t *) data;
 
        if (info == NULL)
                return;
@@ -147,38 +128,34 @@ static void __calc_total_length_cb(GNode *node, gpointer data)
        if (info->is_group) {
                uint32_t temp_len = 0;
 
-               g_node_children_foreach(node, G_TRAVERSE_ALL,
-                       __calc_total_length_cb, &temp_len);
+               g_node_children_foreach(node, G_TRAVERSE_ALL, __calc_total_length_cb, &temp_len);
 
                info->length = temp_len;
 
                *length += info->length;
-       }
-       else
-       {
+       } else {
                *length += info->length;
        }
 }
 
-static uint32_t _calc_total_length(net_nfc_carrier_config_s *config)
+static uint32_t _calc_total_length(net_nfc_carrier_config_s * config)
 {
        uint32_t result = 0;
 
-       g_node_children_foreach(config->data, G_TRAVERSE_ALL,
-               __calc_total_length_cb, &result);
+       g_node_children_foreach(config->data, G_TRAVERSE_ALL, __calc_total_length_cb, &result);
 
        config->length = result;
 
        return result;
 }
 
-static void _serialize_cb(GNode *node, gpointer data)
+static void _serialize_cb(GNode * node, gpointer data)
 {
        net_nfc_carrier_property_s *prop = node->data;
-       data_s *payload = (data_s *)data;
+       data_s *payload = (data_s *) data;
        tlv_header_t *header;
 
-       header = (tlv_header_t *)(payload->buffer + payload->length);
+       header = (tlv_header_t *) (payload->buffer + payload->length);
 
        header->t = htons(prop->attribute);
        header->l = htons(prop->length);
@@ -186,8 +163,7 @@ static void _serialize_cb(GNode *node, gpointer data)
        payload->length += sizeof(tlv_header_t);
 
        if (prop->is_group == true) {
-               g_node_children_foreach(node, G_TRAVERSE_ALL,
-                       _serialize_cb, payload);
+               g_node_children_foreach(node, G_TRAVERSE_ALL, _serialize_cb, payload);
        } else {
                memcpy(header->v, prop->data, prop->length);
 
@@ -195,31 +171,26 @@ static void _serialize_cb(GNode *node, gpointer data)
        }
 }
 
-net_nfc_error_e net_nfc_util_handover_wps_create_record_from_config(
-       ndef_record_s **record, net_nfc_carrier_config_s *config)
+net_nfc_error_e net_nfc_util_handover_wps_create_record_from_config(ndef_record_s ** record, net_nfc_carrier_config_s * config)
 {
        net_nfc_error_e result;
        uint32_t len;
        data_s payload = { 0, };
-       data_s type = { (uint8_t *)CH_WIFI_P2P_MIME, CH_WIFI_P2P_MIME_LEN };
+       data_s type = { (uint8_t *) CH_WIFI_P2P_MIME, CH_WIFI_P2P_MIME_LEN };
 
        if (record == NULL || config == NULL)
-       {
                return NET_NFC_NULL_PARAMETER;
-       }
 
        len = _calc_total_length(config);
 
        DEBUG_MSG("payload length = %d", len);
 
        if (net_nfc_util_init_data(&payload, len) == true) {
-               g_node_children_foreach(config->data, G_TRAVERSE_ALL,
-                       _serialize_cb, &payload);
+               g_node_children_foreach(config->data, G_TRAVERSE_ALL, _serialize_cb, &payload);
 
                g_assert(len == payload.length);
 
-               result = net_nfc_util_create_record(NET_NFC_RECORD_MIME_TYPE,
-                       &type, NULL, &payload, record);
+               result = net_nfc_util_create_record(NET_NFC_RECORD_MIME_TYPE, &type, NULL, &payload, record);
 
                net_nfc_util_clear_data(&payload);
        } else {
index 64a01db..527b4dd 100755 (executable)
 #include "net_nfc_util_internal.h"
 #include "net_nfc_util_hce.h"
 
-typedef struct _apdu_header_t
-{
+typedef struct _apdu_header_t {
        uint8_t cla;
        uint8_t ins;
        uint8_t p1;
        uint8_t p2;
        uint8_t data[0];
-}
-__attribute__((packed)) apdu_header_t;
+} __attribute__ ((packed)) apdu_header_t;
 
 net_nfc_apdu_data_t *net_nfc_util_hce_create_apdu_data()
 {
@@ -52,27 +50,24 @@ net_nfc_apdu_data_t *net_nfc_util_hce_create_apdu_data()
        return apdu_data;
 }
 
-void net_nfc_util_hce_free_apdu_data(net_nfc_apdu_data_t *apdu_data)
+void net_nfc_util_hce_free_apdu_data(net_nfc_apdu_data_t * apdu_data)
 {
        if (apdu_data != NULL) {
-               if (apdu_data->data != NULL) {
+               if (apdu_data->data != NULL)
                        g_free(apdu_data->data);
-               }
 
                g_free(apdu_data);
        }
 }
 
-net_nfc_error_e net_nfc_util_hce_extract_parameter(data_s *apdu,
-       net_nfc_apdu_data_t *apdu_data)
+net_nfc_error_e net_nfc_util_hce_extract_parameter(data_s * apdu, net_nfc_apdu_data_t * apdu_data)
 {
        net_nfc_error_e result;
        apdu_header_t *header;
        size_t l = sizeof(*header);
 
-       if (apdu == NULL || apdu->buffer == NULL || apdu_data == NULL) {
+       if (apdu == NULL || apdu->buffer == NULL || apdu_data == NULL)
                return NET_NFC_NULL_PARAMETER;
-       }
 
        if (apdu->length < l) {
                DEBUG_ERR_MSG("wrong length");
@@ -80,7 +75,7 @@ net_nfc_error_e net_nfc_util_hce_extract_parameter(data_s *apdu,
                return NET_NFC_INVALID_PARAM;
        }
 
-       header = (apdu_header_t *)apdu->buffer;
+       header = (apdu_header_t *) apdu->buffer;
 
        apdu_data->cla = header->cla;
        apdu_data->ins = header->ins;
@@ -105,16 +100,13 @@ net_nfc_error_e net_nfc_util_hce_extract_parameter(data_s *apdu,
                                apdu_data->lc = header->data[0];
 
                                apdu_data->data = g_malloc0(apdu_data->lc);
-                               if(apdu_data->data == NULL)
-                               {
+                               if (apdu_data->data == NULL) {
                                        DEBUG_ERR_MSG("malloc failed");
                                        result = NET_NFC_ALLOC_FAIL;
-                               }
-                               else
-                               {
+                               } else {
                                        memcpy(apdu_data->data, header->data + 1, apdu_data->lc);
 
-                                       if (l + 1 == apdu->length) 
+                                       if (l + 1 == apdu->length)
                                                apdu_data->le = header->data[apdu_data->lc + 1];
 
                                        result = NET_NFC_OK;
@@ -140,8 +132,7 @@ net_nfc_error_e net_nfc_util_hce_extract_parameter(data_s *apdu,
        return result;
 }
 
-net_nfc_error_e net_nfc_util_hce_generate_apdu(net_nfc_apdu_data_t *apdu_data,
-       data_s **apdu)
+net_nfc_error_e net_nfc_util_hce_generate_apdu(net_nfc_apdu_data_t * apdu_data, data_s ** apdu)
 {
        return NET_NFC_NOT_SUPPORTED;
 }
index fca35fd..3cc90aa 100755 (executable)
   * limitations under the License.
   */
 
-
 #include "net_nfc_debug_internal.h"
 #include "net_nfc_util_defines.h"
 #include "net_nfc_util_internal.h"
 #include "net_nfc_util_ndef_message.h"
 #include "net_nfc_util_ndef_record.h"
 
-typedef struct _ndef_header_t
-{
-       uint8_t tnf : 3;
-       uint8_t il : 1;
-       uint8_t sr : 1;
-       uint8_t cf : 1;
-       uint8_t me : 1;
-       uint8_t mb : 1;
+typedef struct _ndef_header_t {
+       uint8_t tnf:3;
+       uint8_t il:1;
+       uint8_t sr:1;
+       uint8_t cf:1;
+       uint8_t me:1;
+       uint8_t mb:1;
        uint8_t type_len;
        uint8_t payload_len[0];
-}
-__attribute__((packed)) ndef_header_t;
+} __attribute__ ((packed)) ndef_header_t;
 
 #define GET_PAYLOAD_LEN(__x)   ((__x->sr) ? (__x->payload_len[0]) : \
        ((__x->payload_len[0] << 24) | (__x->payload_len[1] << 16) | \
        (__x->payload_len[2] << 8) | (__x->payload_len[3])))
 
-static net_nfc_error_e __net_nfc_repair_record_flags(ndef_message_s *ndef_message);
+static net_nfc_error_e __net_nfc_repair_record_flags(ndef_message_s * ndef_message);
 
-net_nfc_error_e net_nfc_util_check_ndef_message_rawdata(data_s *rawdata)
+net_nfc_error_e net_nfc_util_check_ndef_message_rawdata(data_s * rawdata)
 {
        uint32_t offset = 0, records = 0;
        uint8_t *buffer;
@@ -55,7 +52,7 @@ net_nfc_error_e net_nfc_util_check_ndef_message_rawdata(data_s *rawdata)
 
        while (offset < length) {
                /* header */
-               header = (ndef_header_t *)(buffer + offset);
+               header = (ndef_header_t *) (buffer + offset);
 
                offset += sizeof(*header);
 
@@ -70,11 +67,10 @@ net_nfc_error_e net_nfc_util_check_ndef_message_rawdata(data_s *rawdata)
                        return NET_NFC_INVALID_FORMAT;
                }
 
-               if (header->sr == 1) {
+               if (header->sr == 1)
                        offset++;
-               } else {
+               else
                        offset += 4;
-               }
 
                if (offset > length) {
                        DEBUG_ERR_MSG("payload length field failed, records [%d], offset [%d], length [%d]", records, offset, length);
@@ -103,9 +99,8 @@ net_nfc_error_e net_nfc_util_check_ndef_message_rawdata(data_s *rawdata)
 
                records++;
 
-               if (header->me == 1) {
+               if (header->me == 1)
                        break;
-               }
        }
 
        if (header != NULL && header->me == 0) {
@@ -121,14 +116,14 @@ net_nfc_error_e net_nfc_util_check_ndef_message_rawdata(data_s *rawdata)
        return NET_NFC_OK;
 }
 
-net_nfc_error_e net_nfc_util_convert_rawdata_to_ndef_message(data_s *rawdata, ndef_message_s *ndef)
+net_nfc_error_e net_nfc_util_convert_rawdata_to_ndef_message(data_s * rawdata, ndef_message_s * ndef)
 {
        ndef_record_s *newRec = NULL;
        ndef_record_s *prevRec = NULL;
        uint8_t *current = NULL;
        uint8_t *last = NULL;
        uint8_t ndef_header = 0;
-       net_nfc_error_e result = NET_NFC_OK;
+       net_nfc_error_e result = NET_NFC_OK;
 
        if (rawdata == NULL || ndef == NULL)
                return NET_NFC_NULL_PARAMETER;
@@ -136,160 +131,123 @@ net_nfc_error_e net_nfc_util_convert_rawdata_to_ndef_message(data_s *rawdata, nd
        current = rawdata->buffer;
        last = current + rawdata->length;
 
-       if(rawdata->length < 3)
+       if (rawdata->length < 3)
                return NET_NFC_INVALID_FORMAT;
 
-       for(ndef->recordCount = 0; current < last; ndef->recordCount++)
-       {
+       for (ndef->recordCount = 0; current < last; ndef->recordCount++) {
                ndef_header = *current++;
 
-               if(ndef->recordCount == 0)
-               {
+               if (ndef->recordCount == 0) {
                        /* first record has MB field */
-                       if((ndef_header & NET_NFC_NDEF_RECORD_MASK_MB) == 0)
+                       if ((ndef_header & NET_NFC_NDEF_RECORD_MASK_MB) == 0)
                                return NET_NFC_INVALID_FORMAT;
 
                        /* first record should not be a chunked record */
-                       if((ndef_header & NET_NFC_NDEF_RECORD_MASK_TNF) == NET_NFC_NDEF_TNF_UNCHANGED)
+                       if ((ndef_header & NET_NFC_NDEF_RECORD_MASK_TNF) == NET_NFC_NDEF_TNF_UNCHANGED)
                                return NET_NFC_INVALID_FORMAT;
                }
 
                _net_nfc_util_alloc_mem(newRec, sizeof(ndef_record_s));
-               if (newRec == NULL)
-               {
+               if (newRec == NULL) {
                        result = NET_NFC_ALLOC_FAIL;
                        goto error;
                }
 
                /* ndef header set */
                if (ndef_header & NET_NFC_NDEF_RECORD_MASK_MB)
-               {
                        newRec->MB = 1;
-               }
                if (ndef_header & NET_NFC_NDEF_RECORD_MASK_ME)
-               {
                        newRec->ME = 1;
-               }
                if (ndef_header & NET_NFC_NDEF_RECORD_MASK_CF)
-               {
                        newRec->CF = 1;
-               }
                if (ndef_header & NET_NFC_NDEF_RECORD_MASK_SR)
-               {
                        newRec->SR = 1;
-               }
                if (ndef_header & NET_NFC_NDEF_RECORD_MASK_IL)
-               {
                        newRec->IL = 1;
-               }
 
                newRec->TNF = ndef_header & NET_NFC_NDEF_RECORD_MASK_TNF;
 
                newRec->type_s.length = *current++;
 
                /* SR = 1 -> payload is 1 byte, SR = 0 -> payload is 4 bytes */
-               if(ndef_header & NET_NFC_NDEF_RECORD_MASK_SR)
-               {
+               if (ndef_header & NET_NFC_NDEF_RECORD_MASK_SR) {
                        newRec->payload_s.length = *current++;
-               }
-               else
-               {
-                       newRec->payload_s.length = (uint32_t)((*current) << 24);
+               } else {
+                       newRec->payload_s.length = (uint32_t) ((*current) << 24);
                        current++;
 
-                       newRec->payload_s.length += (uint32_t)((*current) << 16);
+                       newRec->payload_s.length += (uint32_t) ((*current) << 16);
                        current++;
 
-                       newRec->payload_s.length += (uint32_t)((*current) << 8);
+                       newRec->payload_s.length += (uint32_t) ((*current) << 8);
                        current++;
 
-                       newRec->payload_s.length += (uint32_t)((*current));
+                       newRec->payload_s.length += (uint32_t) ((*current));
                        current++;
                }
 
                /* ID length check */
-               if(ndef_header & NET_NFC_NDEF_RECORD_MASK_IL)
-               {
+               if (ndef_header & NET_NFC_NDEF_RECORD_MASK_IL)
                        newRec->id_s.length = *current++;
-               }
                else
-               {
                        newRec->id_s.length = 0;
-               }
 
                /* to do : chunked record */
 
-
                /* empty record check */
-               if((ndef_header & NET_NFC_NDEF_RECORD_MASK_TNF) == NET_NFC_NDEF_TNF_EMPTY)
-               {
-                       if(newRec->type_s.length != 0 || newRec->id_s.length != 0 || newRec->payload_s.length != 0)
-                       {
+               if ((ndef_header & NET_NFC_NDEF_RECORD_MASK_TNF) == NET_NFC_NDEF_TNF_EMPTY) {
+                       if (newRec->type_s.length != 0 || newRec->id_s.length != 0 || newRec->payload_s.length != 0) {
                                result = NET_NFC_INVALID_FORMAT;
                                goto error;
                        }
                }
 
-               if((ndef_header & NET_NFC_NDEF_RECORD_MASK_TNF) == NET_NFC_NDEF_TNF_UNKNOWN)
-               {
-                       if(newRec->type_s.length != 0)
-                       {
+               if ((ndef_header & NET_NFC_NDEF_RECORD_MASK_TNF) == NET_NFC_NDEF_TNF_UNKNOWN) {
+                       if (newRec->type_s.length != 0) {
                                result = NET_NFC_INVALID_FORMAT;
                                goto error;
                        }
                }
 
                /* put Type buffer */
-               if(newRec->type_s.length > 0)
-               {
+               if (newRec->type_s.length > 0) {
                        _net_nfc_util_alloc_mem(newRec->type_s.buffer, newRec->type_s.length);
-                       if (newRec->type_s.buffer == NULL)
-                       {
+                       if (newRec->type_s.buffer == NULL) {
                                result = NET_NFC_ALLOC_FAIL;
                                goto error;
                        }
 
                        memcpy(newRec->type_s.buffer, current, newRec->type_s.length);
                        current += newRec->type_s.length;
-               }
-               else
-               {
+               } else {
                        newRec->type_s.buffer = NULL;
                }
 
                /* put ID buffer */
-               if(newRec->id_s.length > 0)
-               {
+               if (newRec->id_s.length > 0) {
                        _net_nfc_util_alloc_mem(newRec->id_s.buffer, newRec->id_s.length);
-                       if (newRec->id_s.buffer == NULL)
-                       {
+                       if (newRec->id_s.buffer == NULL) {
                                result = NET_NFC_ALLOC_FAIL;
                                goto error;
                        }
 
                        memcpy(newRec->id_s.buffer, current, newRec->id_s.length);
                        current += newRec->id_s.length;
-               }
-               else
-               {
+               } else {
                        newRec->id_s.buffer = NULL;
                }
 
                /* put Payload buffer */
-               if(newRec->payload_s.length > 0)
-               {
+               if (newRec->payload_s.length > 0) {
                        _net_nfc_util_alloc_mem(newRec->payload_s.buffer, newRec->payload_s.length);
-                       if (newRec->payload_s.buffer == NULL)
-                       {
+                       if (newRec->payload_s.buffer == NULL) {
                                result = NET_NFC_ALLOC_FAIL;
                                goto error;
                        }
 
                        memcpy(newRec->payload_s.buffer, current, newRec->payload_s.length);
                        current += newRec->payload_s.length;
-               }
-               else
-               {
+               } else {
                        newRec->payload_s.buffer = NULL;
                }
 
@@ -301,28 +259,24 @@ net_nfc_error_e net_nfc_util_convert_rawdata_to_ndef_message(data_s *rawdata, nd
                prevRec = newRec;
                newRec = NULL;
 
-               if(ndef_header & NET_NFC_NDEF_RECORD_MASK_ME)
-               {
+               if (ndef_header & NET_NFC_NDEF_RECORD_MASK_ME)
                        break;
-               }
        }
 
        ndef->recordCount++;
 
-       if((current != last) || ((ndef_header & NET_NFC_NDEF_RECORD_MASK_ME) == 0))
-       {
+       if ((current != last) || ((ndef_header & NET_NFC_NDEF_RECORD_MASK_ME) == 0)) {
                result = NET_NFC_INVALID_FORMAT;
                goto error;
        }
 
        return NET_NFC_OK;
 
-error:
+ error:
 
        DEBUG_ERR_MSG("parser error");
 
-       if (newRec)
-       {
+       if (newRec) {
                _net_nfc_util_free_mem(newRec->type_s.buffer);
                _net_nfc_util_free_mem(newRec->id_s.buffer);
                _net_nfc_util_free_mem(newRec->payload_s.buffer);
@@ -331,8 +285,7 @@ error:
 
        prevRec = ndef->records;
 
-       while(prevRec)
-       {
+       while (prevRec) {
                ndef_record_s *tmpRec = NULL;
 
                _net_nfc_util_free_mem(prevRec->type_s.buffer);
@@ -349,7 +302,7 @@ error:
        return result;
 }
 
-net_nfc_error_e net_nfc_util_convert_ndef_message_to_rawdata(ndef_message_s *ndef, data_s *rawdata)
+net_nfc_error_e net_nfc_util_convert_ndef_message_to_rawdata(ndef_message_s * ndef, data_s * rawdata)
 {
        ndef_record_s *record = NULL;
        uint8_t *current = NULL;
@@ -361,19 +314,18 @@ net_nfc_error_e net_nfc_util_convert_ndef_message_to_rawdata(ndef_message_s *nde
        record = ndef->records;
        current = rawdata->buffer;
 
-       while(record)
-       {
+       while (record) {
                ndef_header = 0x00;
 
-               if(record->MB)
+               if (record->MB)
                        ndef_header |= NET_NFC_NDEF_RECORD_MASK_MB;
-               if(record->ME)
+               if (record->ME)
                        ndef_header |= NET_NFC_NDEF_RECORD_MASK_ME;
-               if(record->CF)
+               if (record->CF)
                        ndef_header |= NET_NFC_NDEF_RECORD_MASK_CF;
-               if(record->SR)
+               if (record->SR)
                        ndef_header |= NET_NFC_NDEF_RECORD_MASK_SR;
-               if(record->IL)
+               if (record->IL)
                        ndef_header |= NET_NFC_NDEF_RECORD_MASK_IL;
 
                ndef_header |= record->TNF;
@@ -381,8 +333,7 @@ net_nfc_error_e net_nfc_util_convert_ndef_message_to_rawdata(ndef_message_s *nde
                *current++ = ndef_header;
 
                /* check empty record */
-               if(record->TNF == NET_NFC_NDEF_TNF_EMPTY)
-               {
+               if (record->TNF == NET_NFC_NDEF_TNF_EMPTY) {
                        /* set type length to zero */
                        *current++ = 0x00;
 
@@ -390,10 +341,8 @@ net_nfc_error_e net_nfc_util_convert_ndef_message_to_rawdata(ndef_message_s *nde
                        *current++ = 0x00;
 
                        /* set ID length to zero */
-                       if(record->IL)
-                       {
+                       if (record->IL)
                                *current++ = 0x00;
-                       }
 
                        record = record->next;
 
@@ -401,37 +350,27 @@ net_nfc_error_e net_nfc_util_convert_ndef_message_to_rawdata(ndef_message_s *nde
                }
 
                /* set type length */
-               if(record->TNF == NET_NFC_NDEF_TNF_UNKNOWN || record->TNF == NET_NFC_NDEF_TNF_UNCHANGED)
-               {
+               if (record->TNF == NET_NFC_NDEF_TNF_UNKNOWN || record->TNF == NET_NFC_NDEF_TNF_UNCHANGED)
                        *current++ = 0x00;
-               }
                else
-               {
                        *current++ = record->type_s.length;
-               }
 
                /* set payload length */
-               if(record->SR)
-               {
-                       *current++ = (uint8_t)(record->payload_s.length & 0x000000FF);
-               }
-               else
-               {
-                       *current++ = (uint8_t)((record->payload_s.length & 0xFF000000) >> 24);
-                       *current++ = (uint8_t)((record->payload_s.length & 0x00FF0000) >> 16);
-                       *current++ = (uint8_t)((record->payload_s.length & 0x0000FF00) >> 8);
-                       *current++ = (uint8_t)(record->payload_s.length & 0x000000FF) ;
+               if (record->SR) {
+                       *current++ = (uint8_t) (record->payload_s.length & 0x000000FF);
+               } else {
+                       *current++ = (uint8_t) ((record->payload_s.length & 0xFF000000) >> 24);
+                       *current++ = (uint8_t) ((record->payload_s.length & 0x00FF0000) >> 16);
+                       *current++ = (uint8_t) ((record->payload_s.length & 0x0000FF00) >> 8);
+                       *current++ = (uint8_t) (record->payload_s.length & 0x000000FF);
                }
 
                /* set ID length */
-               if(record->IL)
-               {
+               if (record->IL)
                        *current++ = record->id_s.length;
-               }
 
                /* set type buffer */
-               if((record->TNF != NET_NFC_NDEF_TNF_UNKNOWN) && (record->TNF != NET_NFC_NDEF_TNF_UNCHANGED))
-               {
+               if ((record->TNF != NET_NFC_NDEF_TNF_UNKNOWN) && (record->TNF != NET_NFC_NDEF_TNF_UNCHANGED)) {
                        memcpy(current, record->type_s.buffer, record->type_s.length);
                        current += record->type_s.length;
                }
@@ -450,15 +389,12 @@ net_nfc_error_e net_nfc_util_convert_ndef_message_to_rawdata(ndef_message_s *nde
        return NET_NFC_OK;
 }
 
-net_nfc_error_e net_nfc_util_append_record(ndef_message_s *msg, ndef_record_s *record)
+net_nfc_error_e net_nfc_util_append_record(ndef_message_s * msg, ndef_record_s * record)
 {
        if (msg == NULL || record == NULL)
-       {
                return NET_NFC_NULL_PARAMETER;
-       }
 
-       if (msg->recordCount == 0)
-       {
+       if (msg->recordCount == 0) {
                // set short message and append
                record->MB = 1;
                record->ME = 1;
@@ -469,17 +405,14 @@ net_nfc_error_e net_nfc_util_append_record(ndef_message_s *msg, ndef_record_s *r
                msg->recordCount++;
 
                DEBUG_MSG("record is added to NDEF message :: count [%d]", msg->recordCount);
-       }
-       else
-       {
+       } else {
                ndef_record_s *current = NULL;
                ndef_record_s *prev = NULL;
 
                // set flag :: this record is FIRST
                current = msg->records;
 
-               if (current != NULL)
-               {
+               if (current != NULL) {
                        // first node
                        current->MB = 1;
                        current->ME = 0;
@@ -489,8 +422,7 @@ net_nfc_error_e net_nfc_util_append_record(ndef_message_s *msg, ndef_record_s *r
                        // second node
                        current = current->next;
 
-                       while (current != NULL)
-                       {
+                       while (current != NULL) {
                                current->MB = 0;
                                current->ME = 0;
                                prev = current;
@@ -510,7 +442,7 @@ net_nfc_error_e net_nfc_util_append_record(ndef_message_s *msg, ndef_record_s *r
        return NET_NFC_OK;
 }
 
-uint32_t net_nfc_util_get_ndef_message_length(ndef_message_s *message)
+uint32_t net_nfc_util_get_ndef_message_length(ndef_message_s * message)
 {
        ndef_record_s *current;
        int total = 0;
@@ -520,8 +452,7 @@ uint32_t net_nfc_util_get_ndef_message_length(ndef_message_s *message)
 
        current = message->records;
 
-       while (current != NULL)
-       {
+       while (current != NULL) {
                total += net_nfc_util_get_record_length(current);
                current = current->next;
        }
@@ -529,51 +460,40 @@ uint32_t net_nfc_util_get_ndef_message_length(ndef_message_s *message)
        return total;
 }
 
-void net_nfc_util_print_ndef_message(ndef_message_s *msg)
+void net_nfc_util_print_ndef_message(ndef_message_s * msg)
 {
        int idx = 0, idx2 = 0;
        ndef_record_s *current = NULL;
        char buffer[1024];
 
        if (msg == NULL)
-       {
                return;
-       }
-
        //                123456789012345678901234567890123456789012345678901234567890
        DEBUG_MSG("========== NDEF Message ====================================");
        DEBUG_MSG("Total NDEF Records count: %d", msg->recordCount);
        current = msg->records;
-       for (idx = 0; idx < msg->recordCount; idx++)
-       {
-               if (current == NULL)
-               {
+       for (idx = 0; idx < msg->recordCount; idx++) {
+               if (current == NULL) {
                        DEBUG_ERR_MSG("Message Record is NULL!! unexpected error");
                        DEBUG_MSG("============================================================");
                        return;
                }
                DEBUG_MSG("---------- Record -----------------------------------------");
-               DEBUG_MSG("MB:%d ME:%d CF:%d SR:%d IL:%d TNF:0x%02X",
-                       current->MB, current->ME, current->CF, current->SR, current->IL, current->TNF);
-               DEBUG_MSG("TypeLength:%d  PayloadLength:%d  IDLength:%d",
-                       current->type_s.length, current->payload_s.length, current->id_s.length);
-               if (current->type_s.buffer != NULL)
-               {
+               DEBUG_MSG("MB:%d ME:%d CF:%d SR:%d IL:%d TNF:0x%02X", current->MB, current->ME, current->CF, current->SR, current->IL, current->TNF);
+               DEBUG_MSG("TypeLength:%d  PayloadLength:%d  IDLength:%d", current->type_s.length, current->payload_s.length, current->id_s.length);
+               if (current->type_s.buffer != NULL) {
                        memcpy(buffer, current->type_s.buffer, current->type_s.length);
                        buffer[current->type_s.length] = '\0';
                        DEBUG_MSG("Type: %s", buffer);
                }
-               if (current->id_s.buffer != NULL)
-               {
+               if (current->id_s.buffer != NULL) {
                        memcpy(buffer, current->id_s.buffer, current->id_s.length);
                        buffer[current->id_s.length] = '\0';
                        SECURE_LOGD("ID: %s", buffer);
                }
-               if (current->payload_s.buffer != NULL)
-               {
+               if (current->payload_s.buffer != NULL) {
                        DEBUG_MSG("Payload: ");
-                       for (idx2 = 0; idx2 < current->payload_s.length; idx2++)
-                       {
+                       for (idx2 = 0; idx2 < current->payload_s.length; idx2++) {
                                if (idx2 % 16 == 0)
                                        DEBUG_MSG("\t");
                                DEBUG_MSG("%02X ", current->payload_s.buffer[idx2]);
@@ -587,7 +507,7 @@ void net_nfc_util_print_ndef_message(ndef_message_s *msg)
 
 }
 
-net_nfc_error_e net_nfc_util_free_ndef_message(ndef_message_s *msg)
+net_nfc_error_e net_nfc_util_free_ndef_message(ndef_message_s * msg)
 {
        int idx = 0;
        ndef_record_s *prev, *current;
@@ -597,8 +517,7 @@ net_nfc_error_e net_nfc_util_free_ndef_message(ndef_message_s *msg)
 
        current = msg->records;
 
-       for (idx = 0; idx < msg->recordCount; idx++)
-       {
+       for (idx = 0; idx < msg->recordCount; idx++) {
                if (current == NULL)
                        break;
 
@@ -613,21 +532,19 @@ net_nfc_error_e net_nfc_util_free_ndef_message(ndef_message_s *msg)
        return NET_NFC_OK;
 }
 
-net_nfc_error_e net_nfc_util_create_ndef_message(ndef_message_s **ndef_message)
+net_nfc_error_e net_nfc_util_create_ndef_message(ndef_message_s ** ndef_message)
 {
-       if (ndef_message == NULL) {
+       if (ndef_message == NULL)
                return NET_NFC_NULL_PARAMETER;
-       }
 
        _net_nfc_util_alloc_mem(*ndef_message, sizeof(ndef_message_s));
-       if (*ndef_message == NULL) {
+       if (*ndef_message == NULL)
                return NET_NFC_ALLOC_FAIL;
-       }
 
        return NET_NFC_OK;
 }
 
-net_nfc_error_e net_nfc_util_remove_record_by_index(ndef_message_s *ndef_message, int index)
+net_nfc_error_e net_nfc_util_remove_record_by_index(ndef_message_s * ndef_message, int index)
 {
        int current_idx = 0;
        ndef_record_s *prev;
@@ -635,37 +552,25 @@ net_nfc_error_e net_nfc_util_remove_record_by_index(ndef_message_s *ndef_message
        ndef_record_s *current;
 
        if (ndef_message == NULL)
-       {
                return NET_NFC_NULL_PARAMETER;
-       }
 
        if (index < 0 || index >= ndef_message->recordCount)
-       {
                return NET_NFC_OUT_OF_BOUND;
-       }
 
-       if (index == 0)
-       {
+       if (index == 0) {
                current = ndef_message->records;
                next = ndef_message->records->next;
                ndef_message->records = next;
-       }
-       else
-       {
+       } else {
                prev = ndef_message->records;
-               for (; current_idx < index - 1; current_idx++)
-               {
+               for (; current_idx < index - 1; current_idx++) {
                        prev = prev->next;
                        if (prev == NULL)
-                       {
                                return NET_NFC_INVALID_FORMAT;
-                       }
                }
                current = prev->next;
                if (current == NULL)
-               {
                        return NET_NFC_INVALID_FORMAT;
-               }
                next = current->next;
                prev->next = next;
        }
@@ -676,65 +581,49 @@ net_nfc_error_e net_nfc_util_remove_record_by_index(ndef_message_s *ndef_message
        return __net_nfc_repair_record_flags(ndef_message);
 }
 
-net_nfc_error_e net_nfc_util_get_record_by_index(ndef_message_s *ndef_message, int index, ndef_record_s **record)
+net_nfc_error_e net_nfc_util_get_record_by_index(ndef_message_s * ndef_message, int index, ndef_record_s ** record)
 {
        ndef_record_s *current;
        int idx = 0;
 
        if (ndef_message == NULL || record == NULL)
-       {
                return NET_NFC_NULL_PARAMETER;
-       }
 
        if (index < 0 || index >= ndef_message->recordCount)
-       {
                return NET_NFC_OUT_OF_BOUND;
-       }
 
        current = ndef_message->records;
 
        for (; current != NULL && idx < index; idx++)
-       {
                current = current->next;
-       }
 
        *record = current;
 
        return NET_NFC_OK;
 }
 
-net_nfc_error_e net_nfc_util_append_record_by_index(ndef_message_s *ndef_message, int index, ndef_record_s *record)
+net_nfc_error_e net_nfc_util_append_record_by_index(ndef_message_s * ndef_message, int index, ndef_record_s * record)
 {
        int idx = 0;
        ndef_record_s *prev;
        ndef_record_s *next;
 
        if (ndef_message == NULL || record == NULL)
-       {
                return NET_NFC_NULL_PARAMETER;
-       }
 
        if (index < 0 || index > ndef_message->recordCount)
-       {
                return NET_NFC_OUT_OF_BOUND;
-       }
 
        prev = ndef_message->records;
 
-       if (index == 0)
-       {
+       if (index == 0) {
                ndef_message->records = record;
                record->next = prev;
-       }
-       else
-       {
-               for (; idx < index - 1; idx++)
-               {
+       } else {
+               for (; idx < index - 1; idx++) {
                        prev = prev->next;
                        if (prev == NULL)
-                       {
                                return NET_NFC_INVALID_FORMAT;
-                       }
                }
                next = prev->next;
                prev->next = record;
@@ -745,7 +634,7 @@ net_nfc_error_e net_nfc_util_append_record_by_index(ndef_message_s *ndef_message
        return __net_nfc_repair_record_flags(ndef_message);
 }
 
-net_nfc_error_e net_nfc_util_search_record_by_type(ndef_message_s *ndef_message, net_nfc_record_tnf_e tnf, data_s *type, ndef_record_s **record)
+net_nfc_error_e net_nfc_util_search_record_by_type(ndef_message_s * ndef_message, net_nfc_record_tnf_e tnf, data_s * type, ndef_record_s ** record)
 {
        int idx = 0;
        ndef_record_s *tmp_record;
@@ -753,19 +642,14 @@ net_nfc_error_e net_nfc_util_search_record_by_type(ndef_message_s *ndef_message,
        uint8_t *buf;
 
        if (ndef_message == NULL || type == NULL || record == NULL)
-       {
                return NET_NFC_NULL_PARAMETER;
-       }
 
        type_length = type->length;
        buf = type->buffer;
 
        /* remove prefix of nfc specific urn */
-       if (type_length > 12)
-       {
-               if (memcmp(buf, "urn:nfc:ext:", 12) == 0 ||
-                       memcmp(buf, "urn:nfc:wkt:", 12) == 0)
-               {
+       if (type_length > 12) {
+               if (memcmp(buf, "urn:nfc:ext:", 12) == 0 || memcmp(buf, "urn:nfc:wkt:", 12) == 0) {
                        buf += 12;
                        type_length -= 12;
                }
@@ -773,19 +657,14 @@ net_nfc_error_e net_nfc_util_search_record_by_type(ndef_message_s *ndef_message,
 
        tmp_record = ndef_message->records;
 
-       for (; idx < ndef_message->recordCount; idx++)
-       {
-               if (tmp_record == NULL)
-               {
+       for (; idx < ndef_message->recordCount; idx++) {
+               if (tmp_record == NULL) {
                        *record = NULL;
 
                        return NET_NFC_INVALID_FORMAT;
                }
 
-               if (tmp_record->TNF == tnf &&
-                       type_length == tmp_record->type_s.length &&
-                       memcmp(buf, tmp_record->type_s.buffer, type_length) == 0)
-               {
+               if (tmp_record->TNF == tnf && type_length == tmp_record->type_s.length && memcmp(buf, tmp_record->type_s.buffer, type_length) == 0) {
                        *record = tmp_record;
 
                        return NET_NFC_OK;
@@ -797,7 +676,7 @@ net_nfc_error_e net_nfc_util_search_record_by_type(ndef_message_s *ndef_message,
        return NET_NFC_NO_DATA_FOUND;
 }
 
-net_nfc_error_e net_nfc_util_search_record_by_id(ndef_message_s *ndef_message, data_s *id, ndef_record_s **record)
+net_nfc_error_e net_nfc_util_search_record_by_id(ndef_message_s * ndef_message, data_s * id, ndef_record_s ** record)
 {
        int idx = 0;
        ndef_record_s *record_in_msg;
@@ -805,26 +684,20 @@ net_nfc_error_e net_nfc_util_search_record_by_id(ndef_message_s *ndef_message, d
        uint8_t *buf;
 
        if (ndef_message == NULL || id == NULL || record == NULL)
-       {
                return NET_NFC_NULL_PARAMETER;
-       }
 
        id_length = id->length;
        buf = id->buffer;
 
        record_in_msg = ndef_message->records;
 
-       for (; idx < ndef_message->recordCount; idx++)
-       {
-               if (record_in_msg == NULL)
-               {
+       for (; idx < ndef_message->recordCount; idx++) {
+               if (record_in_msg == NULL) {
                        *record = NULL;
 
                        return NET_NFC_INVALID_FORMAT;
                }
-               if (id_length == record_in_msg->id_s.length &&
-                       memcmp(buf, record_in_msg->id_s.buffer, id_length) == 0)
-               {
+               if (id_length == record_in_msg->id_s.length && memcmp(buf, record_in_msg->id_s.buffer, id_length) == 0) {
                        *record = record_in_msg;
 
                        return NET_NFC_OK;
@@ -836,24 +709,19 @@ net_nfc_error_e net_nfc_util_search_record_by_id(ndef_message_s *ndef_message, d
        return NET_NFC_NO_DATA_FOUND;
 }
 
-static net_nfc_error_e __net_nfc_repair_record_flags(ndef_message_s *ndef_message)
+static net_nfc_error_e __net_nfc_repair_record_flags(ndef_message_s * ndef_message)
 {
        int idx = 0;
        ndef_record_s *record;
 
        if (ndef_message == NULL)
-       {
                return NET_NFC_NULL_PARAMETER;
-       }
 
        record = ndef_message->records;
 
-       if (ndef_message->recordCount == 1)
-       {
+       if (ndef_message->recordCount == 1) {
                if (record == NULL)
-               {
                        return NET_NFC_INVALID_FORMAT;
-               }
 
                record->MB = 1;
                record->ME = 1;
@@ -861,25 +729,17 @@ static net_nfc_error_e __net_nfc_repair_record_flags(ndef_message_s *ndef_messag
                return NET_NFC_OK;
        }
 
-       for (idx = 0; idx < ndef_message->recordCount; idx++)
-       {
+       for (idx = 0; idx < ndef_message->recordCount; idx++) {
                if (record == NULL)
-               {
                        return NET_NFC_INVALID_FORMAT;
-               }
 
-               if (idx == 0)
-               {
+               if (idx == 0) {
                        record->MB = 1;
                        record->ME = 0;
-               }
-               else if (idx == ndef_message->recordCount - 1)
-               {
+               } else if (idx == ndef_message->recordCount - 1) {
                        record->MB = 0;
                        record->ME = 1;
-               }
-               else
-               {
+               } else {
                        record->MB = 0;
                        record->ME = 0;
                }
@@ -889,8 +749,7 @@ static net_nfc_error_e __net_nfc_repair_record_flags(ndef_message_s *ndef_messag
        return NET_NFC_OK;
 }
 
-void net_nfc_util_foreach_ndef_records(ndef_message_s *msg,
-       net_nfc_foreach_ndef_records_cb func, void *user_data)
+void net_nfc_util_foreach_ndef_records(ndef_message_s * msg, net_nfc_foreach_ndef_records_cb func, void *user_data)
 {
        ndef_record_s *record;
 
index 137c426..4d4691c 100755 (executable)
@@ -20,7 +20,7 @@
 #include "net_nfc_util_ndef_message.h"
 #include "net_nfc_util_ndef_record.h"
 
-net_nfc_error_e net_nfc_util_free_record(ndef_record_s *record)
+net_nfc_error_e net_nfc_util_free_record(ndef_record_s * record)
 {
        if (record == NULL)
                return NET_NFC_NULL_PARAMETER;
@@ -34,59 +34,40 @@ net_nfc_error_e net_nfc_util_free_record(ndef_record_s *record)
        return NET_NFC_OK;
 }
 
-net_nfc_error_e net_nfc_util_create_record(net_nfc_record_tnf_e recordType, data_s *typeName, data_s *id, data_s *payload, ndef_record_s **record)
+net_nfc_error_e net_nfc_util_create_record(net_nfc_record_tnf_e recordType, data_s * typeName, data_s * id, data_s * payload, ndef_record_s ** record)
 {
        ndef_record_s *record_temp = NULL;
 
        if (record == NULL)
-       {
                return NET_NFC_NULL_PARAMETER;
-       }
 
        if (recordType < NET_NFC_RECORD_EMPTY || recordType > NET_NFC_RECORD_UNCHAGNED)
-       {
                return NET_NFC_OUT_OF_BOUND;
-       }
 
        /* empty_tag */
-       if (recordType == NET_NFC_RECORD_EMPTY)
-       {
-               if ((typeName != NULL && typeName->length > 0) ||
-                       (payload != NULL && payload->length > 0) ||
-                       (id != NULL && id->length > 0)) {
+       if (recordType == NET_NFC_RECORD_EMPTY) {
+               if ((typeName != NULL && typeName->length > 0) || (payload != NULL && payload->length > 0) || (id != NULL && id->length > 0))
                        return NET_NFC_INVALID_PARAM;
-               }
-       }
-       else
-       {
-               if (typeName == NULL || typeName->buffer == NULL ||
-                       typeName->length == 0) {
+       } else {
+               if (typeName == NULL || typeName->buffer == NULL || typeName->length == 0)
                        return NET_NFC_INVALID_PARAM;
-               }
        }
 
        _net_nfc_util_alloc_mem(record_temp, sizeof(ndef_record_s));
        if (record_temp == NULL)
-       {
                return NET_NFC_ALLOC_FAIL;
-       }
-
        // set type name and length and  TNF field
        record_temp->TNF = recordType;
 
-       if (typeName != NULL && typeName->length > 0)
-       {
-               if (net_nfc_util_init_data(&record_temp->type_s, typeName->length) == false)
-               {
+       if (typeName != NULL && typeName->length > 0) {
+               if (net_nfc_util_init_data(&record_temp->type_s, typeName->length) == false) {
                        _net_nfc_util_free_mem(record_temp);
 
                        return NET_NFC_ALLOC_FAIL;
                }
 
                memcpy(record_temp->type_s.buffer, typeName->buffer, record_temp->type_s.length);
-       }
-       else
-       {
+       } else {
                record_temp->type_s.buffer = NULL;
                record_temp->type_s.length = 0;
        }
@@ -94,10 +75,8 @@ net_nfc_error_e net_nfc_util_create_record(net_nfc_record_tnf_e recordType, data
        record_temp->SR = 1;
 
        // set payload
-       if (payload != NULL && payload->length > 0)
-       {
-               if (net_nfc_util_init_data(&record_temp->payload_s, payload->length) == false)
-               {
+       if (payload != NULL && payload->length > 0) {
+               if (net_nfc_util_init_data(&record_temp->payload_s, payload->length) == false) {
                        net_nfc_util_clear_data(&record_temp->type_s);
                        _net_nfc_util_free_mem(record_temp);
 
@@ -107,21 +86,15 @@ net_nfc_error_e net_nfc_util_create_record(net_nfc_record_tnf_e recordType, data
                memcpy(record_temp->payload_s.buffer, payload->buffer, record_temp->payload_s.length);
 
                if (payload->length > 255)
-               {
                        record_temp->SR = 0;
-               }
-       }
-       else
-       {
+       } else {
                record_temp->payload_s.buffer = NULL;
                record_temp->payload_s.length = 0;
        }
 
        // set id and id length and IL field
-       if (id != NULL && id->buffer != NULL && id->length > 0)
-       {
-               if (net_nfc_util_init_data(&record_temp->id_s, id->length) == false)
-               {
+       if (id != NULL && id->buffer != NULL && id->length > 0) {
+               if (net_nfc_util_init_data(&record_temp->id_s, id->length) == false) {
                        net_nfc_util_clear_data(&record_temp->payload_s);
                        net_nfc_util_clear_data(&record_temp->type_s);
                        _net_nfc_util_free_mem(record_temp);
@@ -131,9 +104,7 @@ net_nfc_error_e net_nfc_util_create_record(net_nfc_record_tnf_e recordType, data
 
                memcpy(record_temp->id_s.buffer, id->buffer, record_temp->id_s.length);
                record_temp->IL = 1;
-       }
-       else
-       {
+       } else {
                record_temp->IL = 0;
                record_temp->id_s.buffer = NULL;
                record_temp->id_s.length = 0;
@@ -150,33 +121,27 @@ net_nfc_error_e net_nfc_util_create_record(net_nfc_record_tnf_e recordType, data
        return NET_NFC_OK;
 }
 
-net_nfc_error_e net_nfc_util_create_uri_type_record(const char *uri, net_nfc_schema_type_e protocol_schema, ndef_record_s **record)
+net_nfc_error_e net_nfc_util_create_uri_type_record(const char *uri, net_nfc_schema_type_e protocol_schema, ndef_record_s ** record)
 {
        net_nfc_error_e error;
        data_s type_data;
        data_s payload_data = { NULL, 0 };
 
        if (uri == NULL)
-       {
                return NET_NFC_NULL_PARAMETER;
-       }
 
        payload_data.length = strlen((char *)uri) + 1;
        if (payload_data.length == 1)
-       {
                return NET_NFC_INVALID_PARAM;
-       }
 
        if (net_nfc_util_init_data(&payload_data, payload_data.length) == false)
-       {
                return NET_NFC_ALLOC_FAIL;
-       }
 
        payload_data.buffer[0] = protocol_schema;       /* first byte of payload is protocol scheme */
        memcpy(payload_data.buffer + 1, uri, payload_data.length - 1);
 
        type_data.length = 1;
-       type_data.buffer = (uint8_t *)URI_RECORD_TYPE;
+       type_data.buffer = (uint8_t *) URI_RECORD_TYPE;
 
        error = net_nfc_util_create_record(NET_NFC_RECORD_WELL_KNOWN_TYPE, &type_data, NULL, &payload_data, record);
 
@@ -185,7 +150,7 @@ net_nfc_error_e net_nfc_util_create_uri_type_record(const char *uri, net_nfc_sch
        return error;
 }
 
-net_nfc_error_e net_nfc_util_create_text_type_record(const char *text, const char *lang_code_str, net_nfc_encode_type_e encode, ndef_record_s **record)
+net_nfc_error_e net_nfc_util_create_text_type_record(const char *text, const char *lang_code_str, net_nfc_encode_type_e encode, ndef_record_s ** record)
 {
        data_s type_data;
        data_s payload_data;
@@ -193,27 +158,19 @@ net_nfc_error_e net_nfc_util_create_text_type_record(const char *text, const cha
        int offset = 0;
 
        if (text == NULL || lang_code_str == NULL)
-       {
                return NET_NFC_NULL_PARAMETER;
-       }
 
        if ((encode < NET_NFC_ENCODE_UTF_8 || encode > NET_NFC_ENCODE_UTF_16))
-       {
                return NET_NFC_OUT_OF_BOUND;
-       }
 
        payload_data.length = strlen((char *)text) + strlen(lang_code_str) + 1;
 
        if (net_nfc_util_init_data(&payload_data, payload_data.length) == false)
-       {
                return NET_NFC_ALLOC_FAIL;
-       }
 
        controll_byte = strlen(lang_code_str) & 0x3F;
        if (encode == NET_NFC_ENCODE_UTF_16)
-       {
                controll_byte = controll_byte | 0x80;
-       }
 
        payload_data.buffer[0] = controll_byte;
 
@@ -224,7 +181,7 @@ net_nfc_error_e net_nfc_util_create_text_type_record(const char *text, const cha
        memcpy(payload_data.buffer + offset, (char *)text, strlen((char *)text));
 
        type_data.length = 1;
-       type_data.buffer = (uint8_t *)TEXT_RECORD_TYPE;
+       type_data.buffer = (uint8_t *) TEXT_RECORD_TYPE;
 
        net_nfc_util_create_record(NET_NFC_RECORD_WELL_KNOWN_TYPE, &type_data, NULL, &payload_data, record);
 
@@ -233,27 +190,19 @@ net_nfc_error_e net_nfc_util_create_text_type_record(const char *text, const cha
        return NET_NFC_OK;
 }
 
-net_nfc_error_e net_nfc_util_set_record_id(ndef_record_s *record, uint8_t *data, int length)
+net_nfc_error_e net_nfc_util_set_record_id(ndef_record_s * record, uint8_t * data, int length)
 {
        if (record == NULL || data == NULL)
-       {
                return NET_NFC_NULL_PARAMETER;
-       }
 
        if (length < 1)
-       {
                return NET_NFC_OUT_OF_BOUND;
-       }
 
        if (record->id_s.buffer != NULL && record->id_s.length > 0)
-       {
                net_nfc_util_clear_data(&record->id_s);
-       }
 
        if (net_nfc_util_init_data(&record->id_s, length) == false)
-       {
                return NET_NFC_ALLOC_FAIL;
-       }
        memcpy(record->id_s.buffer, data, length);
        record->id_s.length = length;
        record->IL = 1;
@@ -261,7 +210,7 @@ net_nfc_error_e net_nfc_util_set_record_id(ndef_record_s *record, uint8_t *data,
        return NET_NFC_OK;
 }
 
-uint32_t net_nfc_util_get_record_length(ndef_record_s *Record)
+uint32_t net_nfc_util_get_record_length(ndef_record_s * Record)
 {
        uint32_t RecordLength = 1;
 
@@ -269,42 +218,32 @@ uint32_t net_nfc_util_get_record_length(ndef_record_s *Record)
                return 0;
 
        /* Type length is present only for following TNF
-        NET_NFC_TNF_NFCWELLKNOWN
-        NET_NFC_TNF_MEDIATYPE
-        SLP_FRINET_NFC_NDEFRECORD_TNF_ABSURI
-        SLP_FRINET_NFC_NDEFRECORD_TNF_NFCEXT
+          NET_NFC_TNF_NFCWELLKNOWN
+          NET_NFC_TNF_MEDIATYPE
+          SLP_FRINET_NFC_NDEFRECORD_TNF_ABSURI
+          SLP_FRINET_NFC_NDEFRECORD_TNF_NFCEXT
         */
 
        /* ++ is for the Type Length Byte */
        RecordLength++;
-       if (Record->TNF != NET_NFC_NDEF_TNF_EMPTY &&
-               Record->TNF != NET_NFC_NDEF_TNF_UNKNOWN &&
-               Record->TNF != NET_NFC_NDEF_TNF_UNCHANGED)
-       {
+       if (Record->TNF != NET_NFC_NDEF_TNF_EMPTY && Record->TNF != NET_NFC_NDEF_TNF_UNKNOWN && Record->TNF != NET_NFC_NDEF_TNF_UNCHANGED)
                RecordLength += Record->type_s.length;
-       }
 
-       /* to check if payloadlength is 8bit or 32bit*/
-       if (Record->SR != 0)
-       {
+       /* to check if payloadlength is 8bit or 32bit */
+       if (Record->SR != 0) {
                /* ++ is for the Payload Length Byte */
-               RecordLength++;/* for short record*/
-       }
-       else
-       {
+               RecordLength++;                 /* for short record */
+       } else {
                /* + NET_NFC_NDEF_NORMAL_RECORD_BYTE is for the Payload Length Byte */
                RecordLength += 4;
        }
 
        /* for non empty record */
        if (Record->TNF != NET_NFC_NDEF_TNF_EMPTY)
-       {
                RecordLength += Record->payload_s.length;
-       }
 
-       /* ID and IDlength are present only if IL flag is set*/
-       if (Record->IL != 0)
-       {
+       /* ID and IDlength are present only if IL flag is set */
+       if (Record->IL != 0) {
                RecordLength += Record->id_s.length;
                /* ++ is for the ID Length Byte */
                RecordLength++;
@@ -313,71 +252,50 @@ uint32_t net_nfc_util_get_record_length(ndef_record_s *Record)
        return RecordLength;
 }
 
-net_nfc_error_e net_nfc_util_create_uri_string_from_uri_record(ndef_record_s *record, char **uri)
+net_nfc_error_e net_nfc_util_create_uri_string_from_uri_record(ndef_record_s * record, char **uri)
 {
        net_nfc_error_e result = NET_NFC_OK;
 
        if (record == NULL || uri == NULL)
-       {
                return NET_NFC_INVALID_PARAM;
-       }
 
        *uri = NULL;
 
-       if (record->TNF == NET_NFC_RECORD_WELL_KNOWN_TYPE &&
-               (record->type_s.length == 1 && record->type_s.buffer[0] == 'U'))
-       {
+       if (record->TNF == NET_NFC_RECORD_WELL_KNOWN_TYPE && (record->type_s.length == 1 && record->type_s.buffer[0] == 'U')) {
                data_s *payload = &record->payload_s;
 
-               if (payload->length > 0)
-               {
+               if (payload->length > 0) {
                        int length = 0;
                        const char *scheme = NULL;
 
                        /* buffer length include a schema byte.
                         * so it does not need to allocate one more byte for string. */
                        if ((scheme = net_nfc_util_get_schema_string(payload->buffer[0])) != NULL)
-                       {
                                length = strlen(scheme);
-                       }
 
                        *uri = (char *)calloc(1, length + payload->length);
-                       if (*uri != NULL)
-                       {
+                       if (*uri != NULL) {
                                if (length > 0)
                                        memcpy(*uri, scheme, length);
                                memcpy(*uri + length, payload->buffer + 1, payload->length - 1);
-                       }
-                       else
-                       {
+                       } else {
                                result = NET_NFC_ALLOC_FAIL;
                        }
-               }
-               else
-               {
+               } else {
                        DEBUG_ERR_MSG("invalid payload in record");
                }
-       }
-       else if (record->TNF == NET_NFC_RECORD_URI)
-       {
+       } else if (record->TNF == NET_NFC_RECORD_URI) {
                data_s *type = &record->type_s;
 
-               if (type->length > 0)
-               {
+               if (type->length > 0) {
                        *uri = (char *)calloc(1, type->length + 1);
 
                        if (*uri != NULL)
-                       {
                                memcpy(*uri, type->buffer, type->length);
-                       }
                        else
-                       {
                                result = NET_NFC_ALLOC_FAIL;
-                       }
                }
-       }
-       else
-       {
+       } else {
                DEBUG_ERR_MSG("no uri record");
                result = NET_NFC_NDEF_RECORD_IS_NOT_EXPECTED_TYPE;
        }
index 1dbbaa4..283b8b1 100755 (executable)
@@ -14,7 +14,6 @@
   * limitations under the License.
   */
 
-
 #include <openssl/evp.h>
 #include <openssl/engine.h>
 #include <openssl/pkcs12.h>
 
 //static X509 *_load_certificate_from_file(const char *file)
 //{
-//     X509 *x509 = NULL;
-//     BIO *cert = NULL;
+//  X509 *x509 = NULL;
+//  BIO *cert = NULL;
 //
-//     cert = BIO_new(BIO_s_file());
-//     if (cert != NULL)
-//     {
-//             if (BIO_read_filename(cert, file) > 0)
-//             {
-//                     x509 = PEM_read_bio_X509_AUX(cert, NULL, NULL, NULL);
-//             }
+//  cert = BIO_new(BIO_s_file());
+//  if (cert != NULL)
+//  {
+//      if (BIO_read_filename(cert, file) > 0)
+//      {
+//          x509 = PEM_read_bio_X509_AUX(cert, NULL, NULL, NULL);
+//      }
 //
-//             BIO_free(cert);
-//     }
+//      BIO_free(cert);
+//  }
 //
-//     return x509;
+//  return x509;
 //}
 
-static X509 *_load_certificate_from_mem(int format, uint8_t *buffer, uint32_t length, char *password)
+static X509 *_load_certificate_from_mem(int format, uint8_t * buffer, uint32_t length, char *password)
 {
        X509 *x509 = NULL;
        BIO *mem = NULL;
 
        mem = BIO_new_mem_buf(buffer, length);
-       if (mem != NULL)
-       {
-               switch (format)
-               {
-               case 0 :
+       if (mem != NULL) {
+               switch (format) {
+               case 0:
                        x509 = d2i_X509_bio(mem, NULL);
                        break;
 
-               case 1 :
+               case 1:
                        x509 = PEM_read_bio_X509(mem, NULL, NULL, NULL);
                        break;
 
-               case 2 :
+               case 2:
                        {
                                PKCS12 *p12 = d2i_PKCS12_bio(mem, NULL);
                                PKCS12_parse(p12, password, NULL, &x509, NULL);
@@ -72,9 +69,7 @@ static X509 *_load_certificate_from_mem(int format, uint8_t *buffer, uint32_t le
                }
 
                BIO_free(mem);
-       }
-       else
-       {
+       } else {
                DEBUG_ERR_MSG("X509_LOOKUP_load_file failed");
        }
 
@@ -83,50 +78,50 @@ static X509 *_load_certificate_from_mem(int format, uint8_t *buffer, uint32_t le
 
 //int net_nfc_util_openssl_verify_certificate(const char* certfile, const char* CAfile)
 //{
-//     int ret = 0;
-//     X509_STORE *cert_ctx = NULL;
-//     X509_LOOKUP *lookup = NULL;
+//  int ret = 0;
+//  X509_STORE *cert_ctx = NULL;
+//  X509_LOOKUP *lookup = NULL;
 //
-//     cert_ctx = X509_STORE_new();
-//     if (cert_ctx != NULL)
-//     {
-//             OpenSSL_add_all_algorithms();
+//  cert_ctx = X509_STORE_new();
+//  if (cert_ctx != NULL)
+//  {
+//      OpenSSL_add_all_algorithms();
 //
-//             lookup = X509_STORE_add_lookup(cert_ctx, X509_LOOKUP_file());
-//             if (lookup != NULL)
-//             {
-//                     if (X509_LOOKUP_load_file(lookup, CAfile, X509_FILETYPE_PEM) == true)
-//                     {
-//                             lookup = X509_STORE_add_lookup(cert_ctx, X509_LOOKUP_hash_dir());
-//                             if (lookup != NULL)
-//                             {
-//                                     X509_LOOKUP_add_dir(lookup, NULL, X509_FILETYPE_DEFAULT);
+//      lookup = X509_STORE_add_lookup(cert_ctx, X509_LOOKUP_file());
+//      if (lookup != NULL)
+//      {
+//          if (X509_LOOKUP_load_file(lookup, CAfile, X509_FILETYPE_PEM) == true)
+//          {
+//              lookup = X509_STORE_add_lookup(cert_ctx, X509_LOOKUP_hash_dir());
+//              if (lookup != NULL)
+//              {
+//                  X509_LOOKUP_add_dir(lookup, NULL, X509_FILETYPE_DEFAULT);
 //
-//                                     ret = _verify_certificate_file(cert_ctx, certfile);
-//                             }
-//                             else
-//                             {
-//                                     DEBUG_ERR_MSG("X509_STORE_add_lookup failed");
-//                             }
-//                     }
-//                     else
-//                     {
-//                             DEBUG_ERR_MSG("X509_LOOKUP_load_file failed");
-//                     }
-//             }
-//             else
-//             {
-//                     DEBUG_ERR_MSG("X509_STORE_add_lookup failed");
-//             }
+//                  ret = _verify_certificate_file(cert_ctx, certfile);
+//              }
+//              else
+//              {
+//                  DEBUG_ERR_MSG("X509_STORE_add_lookup failed");
+//              }
+//          }
+//          else
+//          {
+//              DEBUG_ERR_MSG("X509_LOOKUP_load_file failed");
+//          }
+//      }
+//      else
+//      {
+//          DEBUG_ERR_MSG("X509_STORE_add_lookup failed");
+//      }
 //
-//             X509_STORE_free(cert_ctx);
-//     }
-//     else
-//     {
-//             DEBUG_ERR_MSG("X509_STORE_new failed");
-//     }
+//      X509_STORE_free(cert_ctx);
+//  }
+//  else
+//  {
+//      DEBUG_ERR_MSG("X509_STORE_new failed");
+//  }
 //
-//     return ret;
+//  return ret;
 //}
 
 net_nfc_openssl_verify_context_s *net_nfc_util_openssl_init_verify_certificate(void)
@@ -134,30 +129,22 @@ net_nfc_openssl_verify_context_s *net_nfc_util_openssl_init_verify_certificate(v
        net_nfc_openssl_verify_context_s *result = NULL;
 
        _net_nfc_util_alloc_mem(result, sizeof(net_nfc_openssl_verify_context_s));
-       if (result != NULL)
-       {
+       if (result != NULL) {
                result->store = X509_STORE_new();
                if (result->store != NULL)
-               {
                        OpenSSL_add_all_algorithms();
-               }
                else
-               {
                        DEBUG_ERR_MSG("X509_STORE_new failed");
-               }
-       }
-       else
-       {
+       } else {
                DEBUG_ERR_MSG("alloc failed [%d]", sizeof(net_nfc_openssl_verify_context_s));
        }
 
        return result;
 }
 
-void net_nfc_util_openssl_release_verify_certificate(net_nfc_openssl_verify_context_s *context)
+void net_nfc_util_openssl_release_verify_certificate(net_nfc_openssl_verify_context_s * context)
 {
-       if (context != NULL)
-       {
+       if (context != NULL) {
                if (context->signer_cert != NULL)
                        X509_free(context->signer_cert);
 
@@ -168,12 +155,11 @@ void net_nfc_util_openssl_release_verify_certificate(net_nfc_openssl_verify_cont
        }
 }
 
-bool net_nfc_util_openssl_add_certificate_of_signer(net_nfc_openssl_verify_context_s *context, uint8_t *buffer, uint32_t length)
+bool net_nfc_util_openssl_add_certificate_of_signer(net_nfc_openssl_verify_context_s * context, uint8_t * buffer, uint32_t length)
 {
        bool result = false;
 
-       if (context->signer_cert != NULL)
-       {
+       if (context->signer_cert != NULL) {
                X509_free(context->signer_cert);
                context->signer_cert = NULL;
        }
@@ -185,45 +171,35 @@ bool net_nfc_util_openssl_add_certificate_of_signer(net_nfc_openssl_verify_conte
        return result;
 }
 
-bool net_nfc_util_openssl_add_certificate_of_ca(net_nfc_openssl_verify_context_s *context, uint8_t *buffer, uint32_t length)
+bool net_nfc_util_openssl_add_certificate_of_ca(net_nfc_openssl_verify_context_s * context, uint8_t * buffer, uint32_t length)
 {
        bool result = false;
        X509 *x509 = NULL;
 
        x509 = _load_certificate_from_mem(1, buffer, length, NULL);
-       if (x509 != NULL)
-       {
+       if (x509 != NULL) {
                if (X509_STORE_add_cert(context->store, x509))
-               {
                        result = true;
-               }
        }
 
        return result;
 }
 
-int net_nfc_util_openssl_verify_certificate(net_nfc_openssl_verify_context_s *context)
+int net_nfc_util_openssl_verify_certificate(net_nfc_openssl_verify_context_s * context)
 {
        int result = 0;
        X509_STORE_CTX *store_ctx = NULL;
 
        store_ctx = X509_STORE_CTX_new();
-       if (store_ctx != NULL)
-       {
+       if (store_ctx != NULL) {
                X509_STORE_set_flags(context->store, 0);
                if (X509_STORE_CTX_init(store_ctx, context->store, context->signer_cert, 0) == true)
-               {
                        result = X509_verify_cert(store_ctx);
-               }
                else
-               {
                        DEBUG_ERR_MSG("X509_STORE_CTX_init failed");
-               }
 
                X509_STORE_CTX_free(store_ctx);
-       }
-       else
-       {
+       } else {
                DEBUG_ERR_MSG("X509_STORE_CTX_new failed");
        }
 
@@ -235,8 +211,7 @@ int _password_callback(char *buf, int bufsiz, int verify, void *data)
        int res = 0;
        const char *password = (char *)data;
 
-       if (password)
-       {
+       if (password) {
                res = strlen(password);
                if (res > bufsiz)
                        res = bufsiz;
@@ -252,98 +227,73 @@ static int _load_pkcs12(BIO *in, const char *password, EVP_PKEY **pkey, X509 **c
        int ret = 0;
        PKCS12 *p12 = NULL;
 
-       if ((p12 = d2i_PKCS12_bio(in, NULL)) != NULL)
-       {
+       if ((p12 = d2i_PKCS12_bio(in, NULL)) != NULL) {
                if (PKCS12_verify_mac(p12, password, strlen(password)) == true)
-               {
                        ret = PKCS12_parse(p12, password, pkey, cert, ca);
-               }
                else
-               {
                        DEBUG_ERR_MSG("Mac verify error (wrong password?) in PKCS12 file");
-               }
 
                PKCS12_free(p12);
-       }
-       else
-       {
+       } else {
                DEBUG_ERR_MSG("Error loading PKCS12 file");
        }
 
        return ret;
 }
 
-EVP_PKEY *_load_key(const char *file, int format, const char *pass, ENGINE *e)
+EVP_PKEY *_load_key(const char *file, int format, const char *pass, ENGINE * e)
 {
        BIO *key = NULL;
        EVP_PKEY *pkey = NULL;
 
-       if (file == NULL)
-       {
+       if (file == NULL) {
                DEBUG_ERR_MSG("no keyfile specified");
                return pkey;
        }
 
-       if (format == OPENSSL_FORMAT_ENGINE)
-       {
-               if (e != NULL)
-               {
-                       pkey = ENGINE_load_private_key(e, file, NULL/*ui_method*/, (void *)pass);
+       if (format == OPENSSL_FORMAT_ENGINE) {
+               if (e != NULL) {
+                       pkey = ENGINE_load_private_key(e, file, NULL /*ui_method */ , (void *)pass);
                        if (!pkey)
-                       {
                                DEBUG_ERR_MSG("cannot load key from engine");
-                       }
-               }
-               else
-               {
+               } else {
                        DEBUG_ERR_MSG("no engine specified");
                }
-       }
-       else
-       {
-               if ((key = BIO_new(BIO_s_file())) != NULL)
-               {
-                       if (BIO_read_filename(key,file) > 0)
-                       {
-                               switch (format)
-                               {
-                               case OPENSSL_FORMAT_ASN1 :
+       } else {
+               if ((key = BIO_new(BIO_s_file())) != NULL) {
+                       if (BIO_read_filename(key, file) > 0) {
+                               switch (format) {
+                               case OPENSSL_FORMAT_ASN1:
                                        pkey = d2i_PrivateKey_bio(key, NULL);
                                        break;
 
-                               case OPENSSL_FORMAT_PEM :
-                                       pkey = PEM_read_bio_PrivateKey(key, NULL, (pem_password_cb *)_password_callback, (void *)pass);
+                               case OPENSSL_FORMAT_PEM:
+                                       pkey = PEM_read_bio_PrivateKey(key, NULL, (pem_password_cb *) _password_callback, (void *)pass);
                                        break;
 
-                               case OPENSSL_FORMAT_PKCS12 :
+                               case OPENSSL_FORMAT_PKCS12:
                                        if (_load_pkcs12(key, pass, &pkey, NULL, NULL) == false)
-                                       {
                                                DEBUG_ERR_MSG("_load_pkcs12 failed");
-                                       }
                                        break;
 
-                               case OPENSSL_FORMAT_MSBLOB :
+                               case OPENSSL_FORMAT_MSBLOB:
                                        pkey = b2i_PrivateKey_bio(key);
                                        break;
 
-                               case OPENSSL_FORMAT_PVK :
-                                       pkey = b2i_PVK_bio(key, (pem_password_cb *)_password_callback, (void *)pass);
+                               case OPENSSL_FORMAT_PVK:
+                                       pkey = b2i_PVK_bio(key, (pem_password_cb *) _password_callback, (void *)pass);
                                        break;
 
-                               default :
+                               default:
                                        DEBUG_ERR_MSG("bad input format specified for key file");
                                        break;
                                }
-                       }
-                       else
-                       {
+                       } else {
                                DEBUG_ERR_MSG("Error opening %s", file);
                        }
 
                        BIO_free(key);
-               }
-               else
-               {
+               } else {
                        DEBUG_ERR_MSG("BIO_new failed");
                }
        }
@@ -351,94 +301,75 @@ EVP_PKEY *_load_key(const char *file, int format, const char *pass, ENGINE *e)
        return pkey;
 }
 
-EVP_PKEY *_load_pubkey(const char *file, int format, const char *pass, ENGINE *e, const char *key_descrip)
+EVP_PKEY *_load_pubkey(const char *file, int format, const char *pass, ENGINE * e, const char *key_descrip)
 {
        BIO *key = NULL;
        EVP_PKEY *pkey = NULL;
 
-       if (file == NULL)
-       {
+       if (file == NULL) {
                DEBUG_ERR_MSG("no keyfile specified");
                return pkey;
        }
 
-       if (format == OPENSSL_FORMAT_ENGINE)
-       {
+       if (format == OPENSSL_FORMAT_ENGINE) {
                if (e != NULL)
-               {
-                       pkey = ENGINE_load_public_key(e, file, NULL/*ui_method*/, (void *)pass);
-               }
+                       pkey = ENGINE_load_public_key(e, file, NULL /*ui_method */ , (void *)pass);
                else
-               {
                        DEBUG_ERR_MSG("no engine specified");
-               }
-       }
-       else
-       {
-               if ((key = BIO_new(BIO_s_file())) != NULL)
-               {
-                       if (BIO_read_filename(key,file) <= 0)
-                       {
-                               switch (format)
-                               {
-                               case OPENSSL_FORMAT_ASN1 :
+       } else {
+               if ((key = BIO_new(BIO_s_file())) != NULL) {
+                       if (BIO_read_filename(key, file) <= 0) {
+                               switch (format) {
+                               case OPENSSL_FORMAT_ASN1:
                                        pkey = d2i_PUBKEY_bio(key, NULL);
                                        break;
 
-                               case OPENSSL_FORMAT_ASN1RSA :
+                               case OPENSSL_FORMAT_ASN1RSA:
                                        {
                                                RSA *rsa;
                                                rsa = d2i_RSAPublicKey_bio(key, NULL);
-                                               if (rsa)
-                                               {
+                                               if (rsa) {
                                                        pkey = EVP_PKEY_new();
                                                        if (pkey)
                                                                EVP_PKEY_set1_RSA(pkey, rsa);
                                                        RSA_free(rsa);
-                                               }
-                                               else
+                                               } else
                                                        pkey = NULL;
                                        }
                                        break;
 
-                               case OPENSSL_FORMAT_PEMRSA :
+                               case OPENSSL_FORMAT_PEMRSA:
                                        {
                                                RSA *rsa;
-                                               rsa = PEM_read_bio_RSAPublicKey(key, NULL, (pem_password_cb *)_password_callback, (void *)pass);
-                                               if (rsa)
-                                               {
+                                               rsa = PEM_read_bio_RSAPublicKey(key, NULL, (pem_password_cb *) _password_callback, (void *)pass);
+                                               if (rsa) {
                                                        pkey = EVP_PKEY_new();
                                                        if (pkey)
                                                                EVP_PKEY_set1_RSA(pkey, rsa);
                                                        RSA_free(rsa);
-                                               }
-                                               else
+                                               } else
                                                        pkey = NULL;
                                        }
                                        break;
 
-                               case OPENSSL_FORMAT_PEM :
-                                       pkey = PEM_read_bio_PUBKEY(key, NULL, (pem_password_cb *)_password_callback, (void *)pass);
+                               case OPENSSL_FORMAT_PEM:
+                                       pkey = PEM_read_bio_PUBKEY(key, NULL, (pem_password_cb *) _password_callback, (void *)pass);
                                        break;
 
-                               case OPENSSL_FORMAT_MSBLOB :
+                               case OPENSSL_FORMAT_MSBLOB:
                                        pkey = b2i_PublicKey_bio(key);
                                        break;
 
-                               default :
+                               default:
                                        DEBUG_ERR_MSG("bad input format specified for key file");
                                        break;
                                }
-                       }
-                       else
-                       {
+                       } else {
                                DEBUG_ERR_MSG("Error opening %s %s", key_descrip, file);
                        }
 
                        BIO_free(key);
-               }
-               else
-               {
+               } else {
                        DEBUG_ERR_MSG("BIO_new failed");
                }
        }
@@ -446,7 +377,7 @@ EVP_PKEY *_load_pubkey(const char *file, int format, const char *pass, ENGINE *e
        return pkey;
 }
 
-int net_nfc_util_openssl_sign_buffer(uint32_t type, uint8_t *buffer, uint32_t length, char *key_file, char *password, uint8_t *sign, uint32_t *sign_len)
+int net_nfc_util_openssl_sign_buffer(uint32_t type, uint8_t * buffer, uint32_t length, char *key_file, char *password, uint8_t * sign, uint32_t * sign_len)
 {
        int result = 0;
        const EVP_MD *md = NULL;
@@ -459,15 +390,14 @@ int net_nfc_util_openssl_sign_buffer(uint32_t type, uint8_t *buffer, uint32_t le
        EVP_MD_CTX ctx = { 0, };
        EVP_PKEY_CTX *pctx = NULL;
 
-       switch (type)
-       {
-       case 0 :
+       switch (type) {
+       case 0:
                result = 0;
                return result;
 
                /* RSASSA-PSS, RSASSA-PKCS1-v1_5 */
-       case 1 :
-               case 2 :
+       case 1:
+       case 2:
                /* md */
                md = EVP_get_digestbyname("sha1");
 
@@ -476,7 +406,7 @@ int net_nfc_util_openssl_sign_buffer(uint32_t type, uint8_t *buffer, uint32_t le
                break;
 
                /* DSA */
-       case 3 :
+       case 3:
                /* md */
                //md = EVP_get_digestbyname("sha1");
                /* engine */
@@ -484,7 +414,7 @@ int net_nfc_util_openssl_sign_buffer(uint32_t type, uint8_t *buffer, uint32_t le
                break;
 
                /* ECDSA */
-       case 4 :
+       case 4:
                /* md */
                md = EVP_get_digestbyname("sha1");
 
@@ -492,7 +422,7 @@ int net_nfc_util_openssl_sign_buffer(uint32_t type, uint8_t *buffer, uint32_t le
                engine = ENGINE_get_default_ECDSA();
                break;
 
-       default :
+       default:
                result = -1;
                return result;
        }
@@ -507,7 +437,7 @@ int net_nfc_util_openssl_sign_buffer(uint32_t type, uint8_t *buffer, uint32_t le
        return result;
 }
 
-int net_nfc_util_openssl_verify_signature(uint32_t type, uint8_t *buffer, uint32_t length, uint8_t *cert, uint32_t cert_len, uint8_t *sign, uint32_t sign_len)
+int net_nfc_util_openssl_verify_signature(uint32_t type, uint8_t * buffer, uint32_t length, uint8_t * cert, uint32_t cert_len, uint8_t * sign, uint32_t sign_len)
 {
        int result = 0;
        const EVP_MD *md = NULL;
@@ -520,15 +450,14 @@ int net_nfc_util_openssl_verify_signature(uint32_t type, uint8_t *buffer, uint32
        EVP_MD_CTX ctx = { 0, };
        EVP_PKEY_CTX *pctx = NULL;
 
-       switch (type)
-       {
-       case 0 :
+       switch (type) {
+       case 0:
                result = 0;
                return result;
 
                /* RSASSA-PSS, RSASSA-PKCS1-v1_5 */
-       case 1 :
-       case 2 :
+       case 1:
+       case 2:
                /* md */
                md = EVP_get_digestbyname("sha1");
 
@@ -537,7 +466,7 @@ int net_nfc_util_openssl_verify_signature(uint32_t type, uint8_t *buffer, uint32
                break;
 
                /* DSA */
-       case 3 :
+       case 3:
                /* md */
                //md = EVP_get_digestbyname("sha1");
                /* engine */
@@ -545,7 +474,7 @@ int net_nfc_util_openssl_verify_signature(uint32_t type, uint8_t *buffer, uint32
                break;
 
                /* ECDSA */
-       case 4 :
+       case 4:
                /* md */
                md = EVP_get_digestbyname("sha1");
 
@@ -553,14 +482,14 @@ int net_nfc_util_openssl_verify_signature(uint32_t type, uint8_t *buffer, uint32
                engine = ENGINE_get_default_ECDSA();
                break;
 
-       default :
+       default:
                result = -1;
                return result;
        }
 
        /* pkey */
        X509 *x509 = _load_certificate_from_mem(0, cert, cert_len, NULL);
-       if(x509 == NULL)
+       if (x509 == NULL)
                return 0;
 
        pkey = X509_PUBKEY_get(X509_get_X509_PUBKEY(x509));
@@ -576,20 +505,17 @@ int net_nfc_util_openssl_verify_signature(uint32_t type, uint8_t *buffer, uint32
 }
 
 #if 0
-int net_nfc_util_get_cert_list_from_file(char *file_name, char *password, uint8_t **buffer, uint32_t *length, uint32_t *cert_count)
+int net_nfc_util_get_cert_list_from_file(char *file_name, char *password, uint8_t ** buffer, uint32_t * length, uint32_t * cert_count)
 {
        int result = 0;
        BIO *bio = NULL;
 
        bio = BIO_new(BIO_s_file());
-       if (bio != NULL)
-       {
-               if (BIO_read_filename(bio, file_name) > 0)
-               {
-                       STACK_OF(X509_INFO) *xis = NULL;
+       if (bio != NULL) {
+               if (BIO_read_filename(bio, file_name) > 0) {
+                       STACK_OF(X509_INFO) * xis = NULL;
 
-                       if ((xis = PEM_X509_INFO_read_bio(bio, NULL, (pem_password_cb *)_password_callback, password)) != NULL)
-                       {
+                       if ((xis = PEM_X509_INFO_read_bio(bio, NULL, (pem_password_cb *) _password_callback, password)) != NULL) {
                                X509_INFO *xi;
                                int i;
                                uint32_t temp_len = 0;
@@ -597,17 +523,13 @@ int net_nfc_util_get_cert_list_from_file(char *file_name, char *password, uint8_
                                uint32_t offset = 0;
                                uint32_t count = 0;
 
-                               for (i = 0; i < sk_X509_INFO_num(xis); i++)
-                               {
+                               for (i = 0; i < sk_X509_INFO_num(xis); i++) {
                                        xi = sk_X509_INFO_value(xis, i);
-                                       if (xi->x509)
-                                       {
+                                       if (xi->x509) {
                                                int32_t ret = 0;
 
                                                if ((ret = i2d_X509(xi->x509, NULL)) > 0)
-                                               {
                                                        temp_len += (ret + 2);
-                                               }
                                        }
                                }
 
@@ -615,16 +537,13 @@ int net_nfc_util_get_cert_list_from_file(char *file_name, char *password, uint8_
                                *length = temp_len;
                                _net_nfc_util_alloc_mem(*buffer, temp_len);
 
-                               for (i = 0; i < sk_X509_INFO_num(xis); i++)
-                               {
+                               for (i = 0; i < sk_X509_INFO_num(xis); i++) {
                                        xi = sk_X509_INFO_value(xis, i);
-                                       if (xi->x509)
-                                       {
+                                       if (xi->x509) {
                                                temp_buf = NULL;
 
-                                               if ((temp_len = i2d_X509(xi->x509, &temp_buf)) > 0)
-                                               {
-                                                       *(uint16_t *)(*buffer + offset) = temp_len;
+                                               if ((temp_len = i2d_X509(xi->x509, &temp_buf)) > 0) {
+                                                       *(uint16_t *) (*buffer + offset) = temp_len;
                                                        offset += sizeof(uint16_t);
 
                                                        memcpy(*buffer + offset, temp_buf, temp_len);
@@ -638,9 +557,7 @@ int net_nfc_util_get_cert_list_from_file(char *file_name, char *password, uint8_
                                *cert_count = count;
 
                                sk_X509_INFO_pop_free(xis, X509_INFO_free);
-                       }
-                       else
-                       {
+                       } else {
                                DEBUG_ERR_MSG("PEM_X509_INFO_read_bio failed");
                        }
                }
@@ -653,22 +570,19 @@ int net_nfc_util_get_cert_list_from_file(char *file_name, char *password, uint8_
 #endif
 
 /* TODO : DER?? PEM?? */
-int net_nfc_util_get_cert_list_from_file(char *file_name, char *password, uint8_t **buffer, uint32_t *length, uint32_t *cert_count)
+int net_nfc_util_get_cert_list_from_file(char *file_name, char *password, uint8_t ** buffer, uint32_t * length, uint32_t * cert_count)
 {
        int result = 0;
        BIO *bio = NULL;
 
        bio = BIO_new(BIO_s_file());
-       if (bio != NULL)
-       {
-               if (BIO_read_filename(bio, file_name) > 0)
-               {
+       if (bio != NULL) {
+               if (BIO_read_filename(bio, file_name) > 0) {
                        EVP_PKEY *pkey = NULL;
                        X509 *x509 = NULL;
-                       STACK_OF(X509) *ca = NULL;
+                       STACK_OF(X509) * ca = NULL;
 
-                       if (_load_pkcs12(bio, password, &pkey, &x509, &ca) != 0)
-                       {
+                       if (_load_pkcs12(bio, password, &pkey, &x509, &ca) != 0) {
                                X509 *temp_x509;
                                int i;
                                uint32_t temp_len = 0;
@@ -678,19 +592,13 @@ int net_nfc_util_get_cert_list_from_file(char *file_name, char *password, uint8_
                                int32_t ret = 0;
 
                                if ((ret = i2d_X509(x509, NULL)) > 0)
-                               {
                                        temp_len += (ret + 2);
-                               }
 
-                               for (i = 0; i < sk_X509_num(ca); i++)
-                               {
+                               for (i = 0; i < sk_X509_num(ca); i++) {
                                        temp_x509 = sk_X509_value(ca, i);
-                                       if (temp_x509)
-                                       {
+                                       if (temp_x509) {
                                                if ((ret = i2d_X509(temp_x509, NULL)) > 0)
-                                               {
                                                        temp_len += (ret + 2);
-                                               }
                                        }
                                }
 
@@ -698,9 +606,8 @@ int net_nfc_util_get_cert_list_from_file(char *file_name, char *password, uint8_
                                *length = temp_len;
                                _net_nfc_util_alloc_mem(*buffer, temp_len);
 
-                               if ((temp_len = i2d_X509(x509, &temp_buf)) > 0)
-                               {
-                                       *(uint16_t *)(*buffer + offset) = temp_len;
+                               if ((temp_len = i2d_X509(x509, &temp_buf)) > 0) {
+                                       *(uint16_t *) (*buffer + offset) = temp_len;
                                        offset += sizeof(uint16_t);
 
                                        memcpy(*buffer + offset, temp_buf, temp_len);
@@ -709,16 +616,13 @@ int net_nfc_util_get_cert_list_from_file(char *file_name, char *password, uint8_
                                        count++;
                                }
 
-                               for (i = 0; i < sk_X509_num(ca); i++)
-                               {
+                               for (i = 0; i < sk_X509_num(ca); i++) {
                                        temp_x509 = sk_X509_value(ca, i);
-                                       if (temp_x509)
-                                       {
+                                       if (temp_x509) {
                                                temp_buf = NULL;
 
-                                               if ((temp_len = i2d_X509(temp_x509, &temp_buf)) > 0)
-                                               {
-                                                       *(uint16_t *)(*buffer + offset) = temp_len;
+                                               if ((temp_len = i2d_X509(temp_x509, &temp_buf)) > 0) {
+                                                       *(uint16_t *) (*buffer + offset) = temp_len;
                                                        offset += sizeof(uint16_t);
 
                                                        memcpy(*buffer + offset, temp_buf, temp_len);
@@ -732,9 +636,7 @@ int net_nfc_util_get_cert_list_from_file(char *file_name, char *password, uint8_
                                *cert_count = count;
 
                                sk_X509_pop_free(ca, X509_free);
-                       }
-                       else
-                       {
+                       } else {
                                DEBUG_ERR_MSG("PEM_X509_INFO_read_bio failed");
                        }
                }
@@ -745,19 +647,17 @@ int net_nfc_util_get_cert_list_from_file(char *file_name, char *password, uint8_
        return result;
 }
 
-bool net_nfc_util_openssl_encode_base64(const uint8_t *buffer, const uint32_t buf_len, char *result, uint32_t max_len, bool new_line_char)
+bool net_nfc_util_openssl_encode_base64(const uint8_t * buffer, const uint32_t buf_len, char *result, uint32_t max_len, bool new_line_char)
 {
        bool ret = false;
        BUF_MEM *bptr;
        BIO *b64, *bmem;
 
        if (buffer == NULL || buf_len == 0)
-       {
                return ret;
-       }
 
        b64 = BIO_new(BIO_f_base64());
-       if(b64 == NULL)
+       if (b64 == NULL)
                return false;
 
        bmem = BIO_new(BIO_s_mem());
@@ -771,14 +671,11 @@ bool net_nfc_util_openssl_encode_base64(const uint8_t *buffer, const uint32_t bu
        BIO_flush(b64);
        BIO_get_mem_ptr(b64, &bptr);
 
-       if (max_len >= bptr->length)
-       {
+       if (max_len >= bptr->length) {
                memcpy(result, bptr->data, bptr->length);
                result[bptr->length] = 0;
                ret = true;
-       }
-       else
-       {
+       } else {
                DEBUG_ERR_MSG("not enough result buffer");
        }
 
@@ -787,20 +684,17 @@ bool net_nfc_util_openssl_encode_base64(const uint8_t *buffer, const uint32_t bu
        return ret;
 }
 
-bool net_nfc_util_openssl_decode_base64(const char *buffer, uint8_t *result, uint32_t *out_len, bool new_line_char)
+bool net_nfc_util_openssl_decode_base64(const char *buffer, uint8_t * result, uint32_t * out_len, bool new_line_char)
 {
        bool ret = false;
        unsigned int length = 0;
        char *temp;
 
        if (buffer == NULL || (length = strlen(buffer)) == 0)
-       {
                return ret;
-       }
 
        _net_nfc_util_alloc_mem(temp, length);
-       if (temp != NULL)
-       {
+       if (temp != NULL) {
                BIO *b64, *bmem;
 
                b64 = BIO_new(BIO_f_base64());
@@ -818,45 +712,36 @@ bool net_nfc_util_openssl_decode_base64(const char *buffer, uint8_t *result, uin
 
                BIO_free_all(bmem);
 
-               if (*out_len > length && length > 0)
-               {
+               if (*out_len > length && length > 0) {
                        *out_len = length;
                        memcpy(result, temp, *out_len);
                        ret = true;
-               }
-               else
-               {
+               } else {
                        DEBUG_ERR_MSG("not enough result buffer");
                }
 
                _net_nfc_util_free_mem(temp);
-       }
-       else
-       {
+       } else {
                DEBUG_ERR_MSG("alloc failed");
        }
 
        return ret;
 }
 
-bool net_nfc_util_openssl_digest(const char *algorithm, const uint8_t *buffer, const uint32_t buf_len, uint8_t *result, uint32_t *out_len)
+bool net_nfc_util_openssl_digest(const char *algorithm, const uint8_t * buffer, const uint32_t buf_len, uint8_t * result, uint32_t * out_len)
 {
        const EVP_MD *md;
        unsigned char *temp;
        bool ret = false;
 
        if (algorithm == NULL || buffer == NULL || buf_len == 0)
-       {
                return ret;
-       }
 
        OpenSSL_add_all_digests();
 
-       if ((md = EVP_get_digestbyname(algorithm)) != NULL)
-       {
+       if ((md = EVP_get_digestbyname(algorithm)) != NULL) {
                _net_nfc_util_alloc_mem(temp, EVP_MAX_MD_SIZE);
-               if (temp != NULL)
-               {
+               if (temp != NULL) {
                        EVP_MD_CTX mdCtx;
                        unsigned int resultLen = 0;
 
@@ -864,31 +749,22 @@ bool net_nfc_util_openssl_digest(const char *algorithm, const uint8_t *buffer, c
 
                        EVP_DigestInit(&mdCtx, md);
                        if (EVP_DigestUpdate(&mdCtx, buffer, buf_len) != 0)
-                       {
                                DEBUG_ERR_MSG("EVP_DigestUpdate failed");
-                       }
                        EVP_DigestFinal(&mdCtx, temp, &resultLen);
 
-                       if (*out_len >= resultLen)
-                       {
+                       if (*out_len >= resultLen) {
                                *out_len = resultLen;
                                memcpy(result, temp, *out_len);
                                ret = true;
-                       }
-                       else
-                       {
+                       } else {
                                DEBUG_ERR_MSG("not enough result buffer");
                        }
 
                        _net_nfc_util_free_mem(temp);
-               }
-               else
-               {
+               } else {
                        DEBUG_ERR_MSG("alloc failed");
                }
-       }
-       else
-       {
+       } else {
                DEBUG_ERR_MSG("EVP_get_digestbyname(\"%s\") returns NULL", algorithm);
        }
 
index 67e7703..8929dd1 100644 (file)
@@ -14,7 +14,6 @@
  * limitations under the License.
  */
 
-
 #include <sys/param.h>
 
 #include "net_nfc_debug_internal.h"
 #include "net_nfc_util_openssl_internal.h"
 #include "net_nfc_util_sign_record.h"
 
-typedef struct _net_nfc_sub_field_s
-{
+typedef struct _net_nfc_sub_field_s {
        uint16_t length;
        uint8_t value[0];
-}
-__attribute__((packed)) net_nfc_sub_field_s;
+} __attribute__ ((packed)) net_nfc_sub_field_s;
 
-typedef struct _net_nfc_signature_record_s
-{
+typedef struct _net_nfc_signature_record_s {
        uint8_t version;
-       uint8_t sign_type : 7;
-       uint8_t uri_present : 1;
+       uint8_t sign_type:7;
+       uint8_t uri_present:1;
        net_nfc_sub_field_s signature;
-}
-__attribute__((packed)) net_nfc_signature_record_s;
+} __attribute__ ((packed)) net_nfc_signature_record_s;
 
-typedef struct _net_nfc_certificate_chain_s
-{
-       uint8_t num_of_certs : 4;
-       uint8_t cert_format : 3;
-       uint8_t uri_present : 1;
+typedef struct _net_nfc_certificate_chain_s {
+       uint8_t num_of_certs:4;
+       uint8_t cert_format:3;
+       uint8_t uri_present:1;
        uint8_t cert_store[0];
-}
-__attribute__((packed)) net_nfc_certificate_chain_s;
+} __attribute__ ((packed)) net_nfc_certificate_chain_s;
 
 #define SIGNATURE_RECORD_TYPE  "Sig"
 
@@ -66,7 +59,7 @@ __attribute__((packed)) net_nfc_certificate_chain_s;
 
 #define __NEXT_SUB_FIELD(__dst) ((__dst)->value + (__dst)->length)
 
-bool _get_records_data_buffer(ndef_record_s *begin_record, ndef_record_s *end_record, uint8_t **buffer, uint32_t *length)
+bool _get_records_data_buffer(ndef_record_s * begin_record, ndef_record_s * end_record, uint8_t ** buffer, uint32_t * length)
 {
        bool result = false;
        uint32_t len = 0;
@@ -79,8 +72,7 @@ bool _get_records_data_buffer(ndef_record_s *begin_record, ndef_record_s *end_re
        current_record = begin_record;
        len = 0;
 
-       while (current_record != NULL && current_record != end_record)
-       {
+       while (current_record != NULL && current_record != end_record) {
                /* type length */
                if (current_record->type_s.buffer != NULL && current_record->type_s.length > 0)
                        len += current_record->type_s.length;
@@ -96,36 +88,30 @@ bool _get_records_data_buffer(ndef_record_s *begin_record, ndef_record_s *end_re
                current_record = current_record->next;
        }
 
-       if (len > 0)
-       {
+       if (len > 0) {
                uint8_t *buf = NULL;
 
                _net_nfc_util_alloc_mem(buf, len);
-               if (buf != NULL)
-               {
+               if (buf != NULL) {
                        uint32_t offset = 0;
 
                        current_record = begin_record;
 
-                       while (offset < len && current_record != NULL && current_record != end_record)
-                       {
+                       while (offset < len && current_record != NULL && current_record != end_record) {
                                /* type length */
-                               if (current_record->type_s.buffer != NULL && current_record->type_s.length > 0)
-                               {
+                               if (current_record->type_s.buffer != NULL && current_record->type_s.length > 0) {
                                        memcpy(buf + offset, current_record->type_s.buffer, MIN(current_record->type_s.length, len - offset));
                                        offset += MIN(current_record->type_s.length, len - offset);
                                }
 
                                /* ID length */
-                               if (current_record->id_s.buffer != NULL && current_record->id_s.length > 0)
-                               {
+                               if (current_record->id_s.buffer != NULL && current_record->id_s.length > 0) {
                                        memcpy(buf + offset, current_record->id_s.buffer, MIN(current_record->id_s.length, len - offset));
                                        offset += MIN(current_record->id_s.length, len - offset);
                                }
 
                                /* payload length */
-                               if (current_record->payload_s.buffer != NULL && current_record->payload_s.length > 0)
-                               {
+                               if (current_record->payload_s.buffer != NULL && current_record->payload_s.length > 0) {
                                        memcpy(buf + offset, current_record->payload_s.buffer, MIN(current_record->payload_s.length, len - offset));
                                        offset += MIN(current_record->payload_s.length, len - offset);
                                }
@@ -143,7 +129,7 @@ bool _get_records_data_buffer(ndef_record_s *begin_record, ndef_record_s *end_re
        return result;
 }
 
-net_nfc_error_e net_nfc_util_verify_signature_records(ndef_record_s *begin_record, ndef_record_s *sign_record)
+net_nfc_error_e net_nfc_util_verify_signature_records(ndef_record_s * begin_record, ndef_record_s * sign_record)
 {
        net_nfc_error_e result = NET_NFC_UNKNOWN_ERROR;
        uint8_t *buffer = NULL;
@@ -153,64 +139,56 @@ net_nfc_error_e net_nfc_util_verify_signature_records(ndef_record_s *begin_recor
                return NET_NFC_INVALID_PARAM;
 
        /* get signed data */
-       if (_get_records_data_buffer(begin_record, sign_record, &buffer, &length) == true)
-       {
+       if (_get_records_data_buffer(begin_record, sign_record, &buffer, &length) == true) {
                uint8_t *signature = NULL;
                uint32_t sign_len = 0;
                net_nfc_signature_record_s *sign_info = NULL;
                net_nfc_certificate_chain_s *chain_info = NULL;
 
                /* parse signature info */
-               sign_info = (net_nfc_signature_record_s *)sign_record->payload_s.buffer;
+               sign_info = (net_nfc_signature_record_s *) sign_record->payload_s.buffer;
 
                DEBUG_MSG("record version : %d", sign_info->version);
                DEBUG_MSG("signature URI present? : %s", sign_info->uri_present ? "true" : "false");
                DEBUG_MSG("signature type : %d", sign_info->sign_type);
                DEBUG_MSG("signature length : %d", sign_info->signature.length);
 
-               if (sign_info->uri_present == true)
-               {
+               if (sign_info->uri_present == true) {
                        /* TODO */
                        /* receive the signature data directed by uri */
                        DEBUG_ERR_MSG("NOT IMPLEMENTED (sign_info->uri_present == true)");
                        _net_nfc_util_free_mem(buffer);
                        return result;
-               }
-               else
-               {
+               } else {
                        signature = sign_info->signature.value;
                        sign_len = sign_info->signature.length;
                }
 
                /* parse certificate chain info */
-               chain_info = (net_nfc_certificate_chain_s *)__NEXT_SUB_FIELD(&(sign_info->signature));
+               chain_info = (net_nfc_certificate_chain_s *) __NEXT_SUB_FIELD(&(sign_info->signature));
 
                SECURE_LOGD("certificate URI present? : %s", chain_info->uri_present ? "true" : "false");
                DEBUG_MSG("certificate format : %d", chain_info->cert_format);
                DEBUG_MSG("number of certificates : %d", chain_info->num_of_certs);
 
-               if (chain_info->num_of_certs > 0)
-               {
+               if (chain_info->num_of_certs > 0) {
                        net_nfc_sub_field_s *data_info = NULL;
 
-                       data_info = (net_nfc_sub_field_s *)chain_info->cert_store;
+                       data_info = (net_nfc_sub_field_s *) chain_info->cert_store;
                        DEBUG_MSG("certificate length : %d", data_info->length);
 
-       //              DEBUG_MSG_PRINT_BUFFER(data_info->value, data_info->length);
+                       //      DEBUG_MSG_PRINT_BUFFER(data_info->value, data_info->length);
 
                        /* the first certificate is signer's one
                         * verify signature of content */
-                       if (net_nfc_util_openssl_verify_signature(sign_info->sign_type, buffer, length, data_info->value, data_info->length, signature, sign_len) == true)
-                       {
-                               if (chain_info->num_of_certs > 1)
-                               {
+                       if (net_nfc_util_openssl_verify_signature(sign_info->sign_type, buffer, length, data_info->value, data_info->length, signature, sign_len) == true) {
+                               if (chain_info->num_of_certs > 1) {
                                        int32_t i = 0;
                                        net_nfc_openssl_verify_context_h context = NULL;
 
                                        /* initialize context of verifying certificate */
                                        context = net_nfc_util_openssl_init_verify_certificate();
-                                       if(context == NULL)
-                                       {
+                                       if (context == NULL) {
                                                _net_nfc_util_free_mem(buffer);
                                                return NET_NFC_ALLOC_FAIL;
                                        }
@@ -219,27 +197,23 @@ net_nfc_error_e net_nfc_util_verify_signature_records(ndef_record_s *begin_recor
                                        net_nfc_util_openssl_add_certificate_of_signer(context, data_info->value, data_info->length);
 
                                        /* verify certificate using certificate chain */
-                                       for (i = 1, data_info = (net_nfc_sub_field_s *)__NEXT_SUB_FIELD(data_info);
-                                               i < chain_info->num_of_certs;
-                                               i++, data_info = (net_nfc_sub_field_s *)__NEXT_SUB_FIELD(data_info))
-                                       {
+                                       for (i = 1, data_info = (net_nfc_sub_field_s *) __NEXT_SUB_FIELD(data_info); i < chain_info->num_of_certs; i++, data_info = (net_nfc_sub_field_s *) __NEXT_SUB_FIELD(data_info)) {
                                                DEBUG_MSG("certficate length : %d", data_info->length);
-//                                             DEBUG_MSG_PRINT_BUFFER(data_info->value, data_info->length);
+//                      DEBUG_MSG_PRINT_BUFFER(data_info->value, data_info->length);
 
                                                net_nfc_util_openssl_add_certificate_of_ca(context, data_info->value, data_info->length);
                                        }
 
                                        /* if the CA_Uri is present, continue adding certificate from uri */
-                                       if (chain_info->uri_present == true)
-                                       {
+                                       if (chain_info->uri_present == true) {
                                                /* TODO : Need to implement */
                                                DEBUG_ERR_MSG("NOT IMPLEMENTED (found_root == false && chain_info->uri_present == true)");
                                                net_nfc_util_openssl_release_verify_certificate(context);
                                                _net_nfc_util_free_mem(buffer);
                                                return result;
 
-//                                             DEBUG_MSG("certficate length : %d", data_info->length);
-//                                             DEBUG_MSG_PRINT_BUFFER(data_info->value, data_info->length);
+//                      DEBUG_MSG("certficate length : %d", data_info->length);
+//                      DEBUG_MSG_PRINT_BUFFER(data_info->value, data_info->length);
                                        }
 
                                        /* verify buffer with cert chain and signature bytes */
@@ -247,40 +221,30 @@ net_nfc_error_e net_nfc_util_verify_signature_records(ndef_record_s *begin_recor
                                                result = NET_NFC_OK;
 
                                        net_nfc_util_openssl_release_verify_certificate(context);
-                               }
-                               else
-                               {
+                               } else {
                                        /* TODO : test certificate??? */
                                        result = NET_NFC_OK;
                                }
 
                                DEBUG_MSG("verifying signature %d", result);
-                       }
-                       else
-                       {
+                       } else {
                                DEBUG_ERR_MSG("verifying signature failed");
                        }
-               }
-               else
-               {
+               } else {
                        DEBUG_ERR_MSG("certificate not found");
                }
 
                _net_nfc_util_free_mem(buffer);
-       }
-       else
-       {
-               if(buffer != NULL)
-               {
+       } else {
+               if (buffer != NULL)
                        _net_nfc_util_free_mem(buffer);
-               }
                DEBUG_ERR_MSG("_get_records_data_buffer failed");
        }
 
        return result;
 }
 
-net_nfc_error_e net_nfc_util_verify_signature_ndef_message(ndef_message_s *msg)
+net_nfc_error_e net_nfc_util_verify_signature_ndef_message(ndef_message_s * msg)
 {
        net_nfc_error_e result = NET_NFC_UNKNOWN_ERROR;
        ndef_record_s *begin_record = NULL;
@@ -289,19 +253,13 @@ net_nfc_error_e net_nfc_util_verify_signature_ndef_message(ndef_message_s *msg)
        begin_record = msg->records;
        current_record = msg->records;
 
-       while (current_record != NULL)
-       {
+       while (current_record != NULL) {
                if (begin_record == NULL)
-               {
                        begin_record = current_record;
-               }
 
-               if (IS_EMPTY_RECORD(current_record))
-               {
+               if (IS_EMPTY_RECORD(current_record)) {
                        begin_record = NULL;
-               }
-               else if (IS_SIGN_RECORD(current_record))
-               {
+               } else if (IS_SIGN_RECORD(current_record)) {
                        result = net_nfc_util_verify_signature_records(begin_record, current_record);
 
                        begin_record = NULL;
@@ -316,7 +274,7 @@ net_nfc_error_e net_nfc_util_verify_signature_ndef_message(ndef_message_s *msg)
 /*
  * sign method
  */
-net_nfc_error_e net_nfc_util_sign_records(ndef_message_s *msg, int begin_index, int end_index, char *cert_file, char *password)
+net_nfc_error_e net_nfc_util_sign_records(ndef_message_s * msg, int begin_index, int end_index, char *cert_file, char *password)
 {
        net_nfc_error_e result = NET_NFC_UNKNOWN_ERROR;
        ndef_record_s *begin_record = NULL, *end_record = NULL, *record = NULL;
@@ -337,7 +295,7 @@ net_nfc_error_e net_nfc_util_sign_records(ndef_message_s *msg, int begin_index,
        /* get target data */
        _get_records_data_buffer(begin_record, end_record->next, &data_buffer, &data_len);
 
-//     DEBUG_MSG_PRINT_BUFFER(data_buffer, data_len);
+//  DEBUG_MSG_PRINT_BUFFER(data_buffer, data_len);
 
        net_nfc_util_openssl_sign_buffer(NET_NFC_SIGN_TYPE_PKCS_1, data_buffer, data_len, cert_file, password, signature, &sign_len);
 
@@ -356,42 +314,33 @@ net_nfc_error_e net_nfc_util_sign_records(ndef_message_s *msg, int begin_index,
                return result;
        }
 
-       net_nfc_signature_record_s *sign_record = (net_nfc_signature_record_s *)payload.buffer;
+       net_nfc_signature_record_s *sign_record = (net_nfc_signature_record_s *) payload.buffer;
        sign_record->version = 1;
        sign_record->uri_present = 0;
        sign_record->sign_type = NET_NFC_SIGN_TYPE_PKCS_1;
 
        if (sign_record->uri_present)
-       {
-               /* TODO */
-       }
+               DEBUG_ERR_MSG("sign_record->uri_present is true");
        else
-       {
                __FILL_SUB_FIELD(&(sign_record->signature), signature, sign_len);
-       }
 
-       net_nfc_certificate_chain_s *chain = (net_nfc_certificate_chain_s *)__NEXT_SUB_FIELD(&(sign_record->signature));
+       net_nfc_certificate_chain_s *chain = (net_nfc_certificate_chain_s *) __NEXT_SUB_FIELD(&(sign_record->signature));
        if (cert_count < 16)
-       {
                chain->uri_present = 0;
-       }
        else
-       {
                chain->uri_present = 1;
-       }
 
        chain->cert_format = NET_NFC_CERT_FORMAT_X_509;
        chain->num_of_certs = cert_count;
        memcpy(chain->cert_store, cert_buffer, cert_len);
 
-       if (chain->uri_present)
-       {
+       if (chain->uri_present) {
                /* TODO */
                DEBUG_ERR_MSG("num_of_certs is greater than 15 [%d]", cert_count);
        }
 
        /* create record */
-       data_s type = { (uint8_t *)SIGNATURE_RECORD_TYPE, 3 };
+       data_s type = { (uint8_t *) SIGNATURE_RECORD_TYPE, 3 };
 
        net_nfc_util_create_record(NET_NFC_RECORD_WELL_KNOWN_TYPE, &type, NULL, &payload, &record);
 
@@ -406,12 +355,11 @@ net_nfc_error_e net_nfc_util_sign_records(ndef_message_s *msg, int begin_index,
        return result;
 }
 
-net_nfc_error_e net_nfc_util_sign_ndef_message(ndef_message_s *msg, char *cert_file, char *password)
+net_nfc_error_e net_nfc_util_sign_ndef_message(ndef_message_s * msg, char *cert_file, char *password)
 {
        net_nfc_error_e result = NET_NFC_UNKNOWN_ERROR;
 
-       if (msg->recordCount > 0)
-       {
+       if (msg->recordCount > 0) {
                net_nfc_util_sign_records(msg, 0, msg->recordCount - 1, cert_file, password);
 
                result = NET_NFC_OK;
index 4a0845d..0ee9433 100755 (executable)
@@ -23,8 +23,7 @@
 #include "net_nfc_server_hce.h"
 #include "net_nfc_server_addon.h"
 
-typedef struct _net_nfc_addon_hce_ops_t
-{
+typedef struct _net_nfc_addon_hce_ops_t {
        const char *name;
 
        net_nfc_addon_init init;
@@ -34,7 +33,6 @@ typedef struct _net_nfc_addon_hce_ops_t
 
        const char *aid;
        net_nfc_server_hce_listener_cb listener;
-}
-net_nfc_addon_hce_ops_t;
+} net_nfc_addon_hce_ops_t;
 
-#endif // __NET_NFC_ADDON_HCE_H__
+#endif                                                 // __NET_NFC_ADDON_HCE_H__
index 65a2a31..bd25059 100644 (file)
@@ -20,7 +20,7 @@
 #include "net_nfc_typedef_internal.h"
 
 void net_nfc_addon_hce_ndef_enable(void);
-net_nfc_error_e net_nfc_addon_hce_ndef_set_data(data_s *data);
+net_nfc_error_e net_nfc_addon_hce_ndef_set_data(data_s * data);
 void net_nfc_addon_hce_ndef_disable(void);
 
-#endif // __NET_NFC_ADDON_HCE_NDEF_H__
+#endif                                                 // __NET_NFC_ADDON_HCE_NDEF_H__
index 073ad5e..7b5a1c3 100755 (executable)
@@ -24,4 +24,4 @@ net_nfc_error_e net_nfc_addons_pause(void);
 net_nfc_error_e net_nfc_addons_resume(void);
 net_nfc_error_e net_nfc_addons_deinit(void);
 
-#endif // __NET_NFC_ADDON_H__
+#endif                                                 // __NET_NFC_ADDON_H__
index a5a9deb..15776d0 100755 (executable)
@@ -51,8 +51,7 @@ size_t hce_addons_count = (sizeof(hce_addons) / sizeof(net_nfc_addon_hce_ops_t *
 
 static net_nfc_addon_hce_ops_t *selected_ops;
 
-
-static void __process_command(net_nfc_target_handle_s *handle, data_s *data)
+static void __process_command(net_nfc_target_handle_s * handle, data_s * data)
 {
        net_nfc_apdu_data_t *apdu_data;
 
@@ -83,36 +82,32 @@ static void __process_command(net_nfc_target_handle_s *handle, data_s *data)
                        }
                }
 
-               if (selected_ops == NULL) {
+               if (selected_ops == NULL)
                        DEBUG_ERR_MSG("NOT SELECTED");
-               } else {
-                       selected_ops->listener(handle,
-                               NET_NFC_MESSAGE_ROUTING_HOST_EMU_DATA,
-                               data, NULL);
-               }
+               else
+                       selected_ops->listener(handle, NET_NFC_MESSAGE_ROUTING_HOST_EMU_DATA, data, NULL);
        }
 
        net_nfc_util_hce_free_apdu_data(apdu_data);
 }
 
-static void __hce_listener(net_nfc_target_handle_s *handle, int event,
-       data_s *data, void *user_data)
+static void __hce_listener(net_nfc_target_handle_s * handle, int event, data_s * data, void *user_data)
 {
        switch (event) {
-       case NET_NFC_MESSAGE_ROUTING_HOST_EMU_ACTIVATED :
+       case NET_NFC_MESSAGE_ROUTING_HOST_EMU_ACTIVATED:
                DEBUG_ADDON_MSG("NET_NFC_MESSAGE_ROUTING_HOST_EMU_ACTIVATED");
                break;
 
-       case NET_NFC_MESSAGE_ROUTING_HOST_EMU_DATA :
+       case NET_NFC_MESSAGE_ROUTING_HOST_EMU_DATA:
                DEBUG_ADDON_MSG("NET_NFC_MESSAGE_ROUTING_HOST_EMU_DATA");
                __process_command(handle, data);
                break;
 
-       case NET_NFC_MESSAGE_ROUTING_HOST_EMU_DEACTIVATED :
+       case NET_NFC_MESSAGE_ROUTING_HOST_EMU_DEACTIVATED:
                DEBUG_ADDON_MSG("NET_NFC_MESSAGE_ROUTING_HOST_EMU_DEACTIVATED");
                break;
 
-       default :
+       default:
                break;
        }
 }
@@ -125,12 +120,10 @@ static void _nfc_addon_hce_init(void)
 
        net_nfc_server_route_table_init();
 
-       net_nfc_server_hce_start_hce_handler("nfc-manager", NULL,
-               __hce_listener, NULL, NULL);
+       net_nfc_server_hce_start_hce_handler("nfc-manager", NULL, __hce_listener, NULL, NULL);
 
-       for (i = 0; i < hce_addons_count; i++) {
+       for (i = 0; i < hce_addons_count; i++)
                hce_addons[i]->init();
-       }
 }
 
 static void _nfc_addon_hce_pause(void)
@@ -139,9 +132,8 @@ static void _nfc_addon_hce_pause(void)
 
        DEBUG_ADDON_MSG(">>>>");
 
-       for (i = 0; i < hce_addons_count; i++) {
+       for (i = 0; i < hce_addons_count; i++)
                hce_addons[i]->pause();
-       }
 }
 
 static void _nfc_addon_hce_resume(void)
@@ -150,9 +142,8 @@ static void _nfc_addon_hce_resume(void)
 
        DEBUG_ADDON_MSG(">>>>");
 
-       for (i = 0; i < hce_addons_count; i++) {
+       for (i = 0; i < hce_addons_count; i++)
                hce_addons[i]->resume();
-       }
 }
 
 static void _nfc_addon_hce_deinit(void)
@@ -161,9 +152,8 @@ static void _nfc_addon_hce_deinit(void)
 
        DEBUG_ADDON_MSG(">>>>");
 
-       for (i = 0; i < hce_addons_count; i++) {
+       for (i = 0; i < hce_addons_count; i++)
                hce_addons[i]->deinit();
-       }
 
        net_nfc_server_hce_stop_hce_handler("nfc-manager");
 }
index 60a00ea..9196e63 100755 (executable)
@@ -28,7 +28,6 @@
 #include "net_nfc_addon_hce.h"
 #include "net_nfc_addon_hce_ndef.h"
 
-
 #define MAPPING_VERSION                        0x20
 
 #define NDEF_FILE_CONTROL_TAG          0x04
 
 #define ENDIAN_16(x)                   ((((x) >> 8) & 0x00FF) | (((x) << 8) & 0xFF00))
 
-#define NDEF_AID                       "D2760000850101" /* 00A4040007D2760000850101 */
+#define NDEF_AID                       "D2760000850101"        /* 00A4040007D2760000850101 */
 
-typedef struct _cc_data_t
-{
+typedef struct _cc_data_t {
        uint16_t cclen;
        uint8_t version;
        uint16_t mle;
        uint16_t mlc;
-       struct
-       {
+       struct {
                uint8_t tag;
                uint8_t len;
                uint16_t fid;
                uint16_t mndef;
                uint8_t rcond;
                uint8_t wcond;
-       }
-       cc;
+       } cc;
        uint8_t tlv[0];
-}
-__attribute__((packed)) cc_data_t;
+} __attribute__ ((packed)) cc_data_t;
 
-typedef struct _ndef_data_t
-{
+typedef struct _ndef_data_t {
        uint16_t len;
        uint8_t data[0];
-}
-__attribute__((packed)) ndef_data_t;
+} __attribute__ ((packed)) ndef_data_t;
 
 static uint8_t ndef_aid[] = { 0xD2, 0x76, 0x00, 0x00, 0x85, 0x01, 0x01 };
 static uint8_t cc_fid[] = { CC_FID };
 static uint8_t ndef_fid[] = { NDEF_FID };
 
 static uint8_t cc_data[] = {
-       0x00, 0x0F, /* cclen */
-       MAPPING_VERSION, /* version */
-       0x00, 0x3B, /* max lc */
-       0x00, 0x34, /* max le */
-       NDEF_FILE_CONTROL_TAG, /* tag */
-       0x06, /* len */
-       NDEF_FID, /* ndef fid */
-       MAX_NDEF_DEF, /* max ndef len */
-       COND_ALL_ACCESS, /* read right */
-       COND_NO_ACCESS, /* write right */
+       0x00, 0x0F,                                     /* cclen */
+       MAPPING_VERSION,                        /* version */
+       0x00, 0x3B,                                     /* max lc */
+       0x00, 0x34,                                     /* max le */
+       NDEF_FILE_CONTROL_TAG,          /* tag */
+       0x06,                                           /* len */
+       NDEF_FID,                                       /* ndef fid */
+       MAX_NDEF_DEF,                           /* max ndef len */
+       COND_ALL_ACCESS,                        /* read right */
+       COND_NO_ACCESS,                         /* write right */
 };
 
 static uint16_t ndef_len;
@@ -99,7 +92,7 @@ static uint8_t *selected_fid;
 
 static bool enabled;
 
-static void __send_response(net_nfc_target_handle_s *handle, uint16_t sw, uint8_t *resp, size_t len)
+static void __send_response(net_nfc_target_handle_s * handle, uint16_t sw, uint8_t * resp, size_t len)
 {
        size_t total_len = sizeof(sw);
        size_t offset = 0;
@@ -107,9 +100,8 @@ static void __send_response(net_nfc_target_handle_s *handle, uint16_t sw, uint8_
 
        sw = ENDIAN_16(sw);
 
-       if (resp != NULL && len > 0) {
+       if (resp != NULL && len > 0)
                total_len += len;
-       }
 
        buffer = g_malloc0(total_len);
 
@@ -128,7 +120,7 @@ static void __send_response(net_nfc_target_handle_s *handle, uint16_t sw, uint8_
        g_free(buffer);
 }
 
-static void __process_command(net_nfc_target_handle_s *handle, data_s *cmd)
+static void __process_command(net_nfc_target_handle_s * handle, data_s * cmd)
 {
        net_nfc_apdu_data_t *apdu;
 
@@ -148,8 +140,7 @@ static void __process_command(net_nfc_target_handle_s *handle, data_s *cmd)
                }
 
                if (apdu->p1 == NET_NFC_HCE_P1_SELECT_BY_NAME) {
-                       if (memcmp(apdu->data, ndef_aid,
-                               MIN(sizeof(ndef_aid), apdu->lc)) == 0) {
+                       if (memcmp(apdu->data, ndef_aid, MIN(sizeof(ndef_aid), apdu->lc)) == 0) {
                                DEBUG_ADDON_MSG("select ndef applet");
 
                                /* bt on */
@@ -175,15 +166,13 @@ static void __process_command(net_nfc_target_handle_s *handle, data_s *cmd)
                                goto END;
                        }
 
-                       if (memcmp(apdu->data, cc_fid,
-                               MIN(sizeof(cc_fid), apdu->lc)) == 0) {
+                       if (memcmp(apdu->data, cc_fid, MIN(sizeof(cc_fid), apdu->lc)) == 0) {
                                DEBUG_ADDON_MSG("select capability container");
 
                                selected_fid = cc_fid;
 
                                __send_response(handle, NET_NFC_HCE_SW_SUCCESS, NULL, 0);
-                       } else if (memcmp(apdu->data, ndef_fid,
-                               MIN(sizeof(ndef_fid), apdu->lc)) == 0) {
+                       } else if (memcmp(apdu->data, ndef_fid, MIN(sizeof(ndef_fid), apdu->lc)) == 0) {
                                DEBUG_ADDON_MSG("select ndef");
 
                                selected_fid = ndef_fid;
@@ -197,8 +186,7 @@ static void __process_command(net_nfc_target_handle_s *handle, data_s *cmd)
 
                }
        } else if (apdu->ins == NET_NFC_HCE_INS_READ_BINARY) {
-               if (apdu->lc != NET_NFC_HCE_INVALID_VALUE ||
-                       apdu->data != NULL || apdu->le == NET_NFC_HCE_INVALID_VALUE) {
+               if (apdu->lc != NET_NFC_HCE_INVALID_VALUE || apdu->data != NULL || apdu->le == NET_NFC_HCE_INVALID_VALUE) {
                        DEBUG_ERR_MSG("wrong parameter, lc [%d], data [%p], le [%d]", apdu->lc, apdu->data, apdu->le);
                        __send_response(handle, NET_NFC_HCE_SW_LC_INCONSIST_P1_TO_P2, NULL, 0);
                        goto END;
@@ -211,9 +199,7 @@ static void __process_command(net_nfc_target_handle_s *handle, data_s *cmd)
                        if (offset < sizeof(cc_data)) {
                                /* send response */
 
-                               __send_response(handle, NET_NFC_HCE_SW_SUCCESS,
-                                       cc_data + offset,
-                                       MIN(sizeof(cc_data) - offset, apdu->le));
+                               __send_response(handle, NET_NFC_HCE_SW_SUCCESS, cc_data + offset, MIN(sizeof(cc_data) - offset, apdu->le));
                        } else {
                                DEBUG_ERR_MSG("abnormal offset, [%d]", offset);
                                __send_response(handle, NET_NFC_HCE_SW_INCORRECT_P1_TO_P2, NULL, 0);
@@ -225,9 +211,7 @@ static void __process_command(net_nfc_target_handle_s *handle, data_s *cmd)
                        if (offset < ndef_data->len + sizeof(*ndef_data)) {
                                /* send response */
 
-                               __send_response(handle, NET_NFC_HCE_SW_SUCCESS,
-                                       (uint8_t *)ndef_data + offset,
-                                       MIN(ndef_data->len + sizeof(*ndef_data) - offset, apdu->le));
+                               __send_response(handle, NET_NFC_HCE_SW_SUCCESS, (uint8_t *) ndef_data + offset, MIN(ndef_data->len + sizeof(*ndef_data) - offset, apdu->le));
                        } else {
                                DEBUG_ERR_MSG("abnormal offset, [%d]", offset);
                                __send_response(handle, NET_NFC_HCE_SW_INCORRECT_P1_TO_P2, NULL, 0);
@@ -244,34 +228,32 @@ static void __process_command(net_nfc_target_handle_s *handle, data_s *cmd)
                __send_response(handle, NET_NFC_HCE_SW_INS_NOT_SUPPORTED, NULL, 0);
        }
 
-END :
-       if (apdu != NULL) {
+ END:
+       if (apdu != NULL)
                net_nfc_util_hce_free_apdu_data(apdu);
-       }
 }
 
-static void __nfc_addon_hce_ndef_listener(net_nfc_target_handle_s *handle,
-       int event, data_s *data, void *user_data)
+static void __nfc_addon_hce_ndef_listener(net_nfc_target_handle_s * handle, int event, data_s * data, void *user_data)
 {
        switch (event) {
-       case NET_NFC_MESSAGE_ROUTING_HOST_EMU_ACTIVATED :
+       case NET_NFC_MESSAGE_ROUTING_HOST_EMU_ACTIVATED:
                DEBUG_ADDON_MSG("NET_NFC_MESSAGE_ROUTING_HOST_EMU_ACTIVATED");
                selected_fid = NULL;
                selected_aid = NULL;
                break;
 
-       case NET_NFC_MESSAGE_ROUTING_HOST_EMU_DATA :
+       case NET_NFC_MESSAGE_ROUTING_HOST_EMU_DATA:
                DEBUG_ADDON_MSG("NET_NFC_MESSAGE_ROUTING_HOST_EMU_DATA");
                __process_command(handle, data);
                break;
 
-       case NET_NFC_MESSAGE_ROUTING_HOST_EMU_DEACTIVATED :
+       case NET_NFC_MESSAGE_ROUTING_HOST_EMU_DEACTIVATED:
                DEBUG_ADDON_MSG("NET_NFC_MESSAGE_ROUTING_HOST_EMU_DEACTIVATED");
                selected_fid = NULL;
                selected_aid = NULL;
                break;
 
-       default :
+       default:
                break;
        }
 }
@@ -320,33 +302,25 @@ void net_nfc_addon_hce_ndef_enable(void)
        net_nfc_error_e result = NET_NFC_OK;
 
        if (enabled == false) {
-               if (net_nfc_server_route_table_find_aid("nfc-manager",
-                       NDEF_AID) == NULL) {
-                       result = net_nfc_server_route_table_add_aid(NULL, "nfc-manager",
-                               NET_NFC_SE_TYPE_HCE,
-                               NET_NFC_CARD_EMULATION_CATEGORY_OTHER,
-                               NDEF_AID);
-               }
+               if (net_nfc_server_route_table_find_aid("nfc-manager", NDEF_AID) == NULL)
+                       result = net_nfc_server_route_table_add_aid(NULL, "nfc-manager", NET_NFC_SE_TYPE_HCE, NET_NFC_CARD_EMULATION_CATEGORY_OTHER, NDEF_AID);
 
-               if (result == NET_NFC_OK) {
+               if (result == NET_NFC_OK)
                        enabled = true;
-               } else {
+               else
                        DEBUG_ERR_MSG("net_nfc_server_route_table_add_aid failed, [%d]", result);
-               }
        }
 }
 
-net_nfc_error_e net_nfc_addon_hce_ndef_set_data(data_s *data)
+net_nfc_error_e net_nfc_addon_hce_ndef_set_data(data_s * data)
 {
-       if (data == NULL || data->buffer == NULL) {
+       if (data == NULL || data->buffer == NULL)
                return NET_NFC_NULL_PARAMETER;
-       }
 
-       if (data->length > (ndef_len - sizeof(*ndef_data))) {
+       if (data->length > (ndef_len - sizeof(*ndef_data)))
                return NET_NFC_INSUFFICIENT_STORAGE;
-       }
 
-       ndef_data->len = ENDIAN_16((uint16_t)data->length);
+       ndef_data->len = ENDIAN_16((uint16_t) data->length);
        memcpy(ndef_data->data, data->buffer, data->length);
 
        return NET_NFC_OK;
@@ -355,11 +329,8 @@ net_nfc_error_e net_nfc_addon_hce_ndef_set_data(data_s *data)
 void net_nfc_addon_hce_ndef_disable(void)
 {
        if (enabled == true) {
-               if (net_nfc_server_route_table_find_aid("nfc-manager",
-                       NDEF_AID) != NULL) {
-                       net_nfc_server_route_table_del_aid(NULL, "nfc-manager",
-                               NDEF_AID, false);
-               }
+               if (net_nfc_server_route_table_find_aid("nfc-manager", NDEF_AID) != NULL)
+                       net_nfc_server_route_table_del_aid(NULL, "nfc-manager", NDEF_AID, false);
 
                enabled = false;
        }
index 7a7b22f..b057b28 100755 (executable)
 #include "net_nfc_server_route_table.h"
 #include "net_nfc_addon_hce.h"
 
-
 #define PPSE_INS_LOOPBACK              0xEE
 
 #define ENDIAN_16(x)                   ((((x) >> 8) & 0x00FF) | (((x) << 8) & 0xFF00))
 
-#define PPSE_AID                       "325041592E5359532E4444463031" /* 00A404000E325041592E5359532E4444463031 */
+#define PPSE_AID                       "325041592E5359532E4444463031"  /* 00A404000E325041592E5359532E4444463031 */
 
 /* "2PAY.SYS.DDF01" */
 static uint8_t ppse_aid[] = { '2', 'P', 'A', 'Y', '.', 'S', 'Y', 'S', '.', 'D', 'D', 'F', '0', '1' };
 
 static bool selected;
 
-static size_t __put_tlv(uint8_t *out, size_t len,
-       uint16_t t, uint16_t l, uint8_t *v)
+static size_t __put_tlv(uint8_t * out, size_t len, uint16_t t, uint16_t l, uint8_t * v)
 {
        size_t offset = 0;
 
@@ -64,8 +62,7 @@ static size_t __put_tlv(uint8_t *out, size_t len,
        return offset;
 }
 
-static size_t __fill_fci(uint8_t *tlv, size_t len, data_s *aid, data_s *label,
-       uint8_t priority)
+static size_t __fill_fci(uint8_t * tlv, size_t len, data_s * aid, data_s * label, uint8_t priority)
 {
        uint8_t result[1024] = { 0, };
        uint8_t temp[1024] = { 0, };
@@ -75,13 +72,10 @@ static size_t __fill_fci(uint8_t *tlv, size_t len, data_s *aid, data_s *label,
        offset = __put_tlv(temp, sizeof(temp), 0x4F, aid->length, aid->buffer);
 
        /* label */
-       offset += __put_tlv(temp + offset, sizeof(temp) - offset, 0x50,
-               label->length, label->buffer);
+       offset += __put_tlv(temp + offset, sizeof(temp) - offset, 0x50, label->length, label->buffer);
 
        /* priority */
-       offset += __put_tlv(temp + offset, sizeof(temp) - offset, 0x82,
-               sizeof(priority), &priority);
-
+       offset += __put_tlv(temp + offset, sizeof(temp) - offset, 0x82, sizeof(priority), &priority);
 
        /* FCI issuer descretionary data */
        temp_len = __put_tlv(result, sizeof(result), 0xBF0C, offset, temp);
@@ -90,9 +84,7 @@ static size_t __fill_fci(uint8_t *tlv, size_t len, data_s *aid, data_s *label,
        offset = __put_tlv(temp, sizeof(temp), 0x84, sizeof(ppse_aid), ppse_aid);
 
        /* FCI proprietary template */
-       offset += __put_tlv(temp + offset, sizeof(result) - offset, 0xA5,
-               temp_len, result);
-
+       offset += __put_tlv(temp + offset, sizeof(result) - offset, 0xA5, temp_len, result);
 
        offset = __put_tlv(result, sizeof(result), 0x6F, offset, temp);
 
@@ -101,7 +93,7 @@ static size_t __fill_fci(uint8_t *tlv, size_t len, data_s *aid, data_s *label,
        return offset;
 }
 
-static void __send_response(net_nfc_target_handle_s *handle, uint16_t sw, uint8_t *resp, size_t len)
+static void __send_response(net_nfc_target_handle_s * handle, uint16_t sw, uint8_t * resp, size_t len)
 {
        size_t total_len = sizeof(sw);
        size_t offset = 0;
@@ -109,9 +101,8 @@ static void __send_response(net_nfc_target_handle_s *handle, uint16_t sw, uint8_
 
        sw = ENDIAN_16(sw);
 
-       if (resp != NULL && len > 0) {
+       if (resp != NULL && len > 0)
                total_len += len;
-       }
 
        buffer = g_malloc0(total_len);
 
@@ -130,7 +121,7 @@ static void __send_response(net_nfc_target_handle_s *handle, uint16_t sw, uint8_
        g_free(buffer);
 }
 
-static void __process_command(net_nfc_target_handle_s *handle, data_s *cmd)
+static void __process_command(net_nfc_target_handle_s * handle, data_s * cmd)
 {
        net_nfc_apdu_data_t *apdu;
 
@@ -149,8 +140,7 @@ static void __process_command(net_nfc_target_handle_s *handle, data_s *cmd)
                        goto END;
                }
 
-               if (apdu->p1 != NET_NFC_HCE_P1_SELECT_BY_NAME ||
-                       apdu->p2 != 0) {
+               if (apdu->p1 != NET_NFC_HCE_P1_SELECT_BY_NAME || apdu->p2 != 0) {
                        DEBUG_ERR_MSG("incorrect parameter");
                        __send_response(handle, NET_NFC_HCE_SW_INCORRECT_P1_TO_P2, NULL, 0);
                        goto END;
@@ -194,9 +184,7 @@ static void __process_command(net_nfc_target_handle_s *handle, data_s *cmd)
                        goto END;
                }
 
-               if (apdu->lc == NET_NFC_HCE_INVALID_VALUE ||
-                       apdu->lc == 0 || apdu->data == NULL ||
-                       apdu->le == NET_NFC_HCE_INVALID_VALUE) {
+               if (apdu->lc == NET_NFC_HCE_INVALID_VALUE || apdu->lc == 0 || apdu->data == NULL || apdu->le == NET_NFC_HCE_INVALID_VALUE) {
                        DEBUG_ERR_MSG("wrong parameter, lc [%d], data [%p], le [%d]", apdu->lc, apdu->data, apdu->le);
                        __send_response(handle, NET_NFC_HCE_SW_LC_INCONSIST_P1_TO_P2, NULL, 0);
                        goto END;
@@ -204,44 +192,39 @@ static void __process_command(net_nfc_target_handle_s *handle, data_s *cmd)
 
                DEBUG_ADDON_MSG("ppse loopback");
 
-               if (apdu->le == 0) {
+               if (apdu->le == 0)
                        apdu->le = 255;
-               }
 
-               __send_response(handle, NET_NFC_HCE_SW_SUCCESS,
-                       apdu->data,
-                       MIN(apdu->lc, apdu->le));
+               __send_response(handle, NET_NFC_HCE_SW_SUCCESS, apdu->data, MIN(apdu->lc, apdu->le));
        } else {
                DEBUG_ERR_MSG("not supported");
                __send_response(handle, NET_NFC_HCE_SW_INS_NOT_SUPPORTED, NULL, 0);
        }
 
-END :
-       if (apdu != NULL) {
+ END:
+       if (apdu != NULL)
                net_nfc_util_hce_free_apdu_data(apdu);
-       }
 }
 
-static void __nfc_addon_hce_ppse_listener(net_nfc_target_handle_s *handle,
-       int event, data_s *data, void *user_data)
+static void __nfc_addon_hce_ppse_listener(net_nfc_target_handle_s * handle, int event, data_s * data, void *user_data)
 {
        switch (event) {
-       case NET_NFC_MESSAGE_ROUTING_HOST_EMU_ACTIVATED :
+       case NET_NFC_MESSAGE_ROUTING_HOST_EMU_ACTIVATED:
                DEBUG_ADDON_MSG("NET_NFC_MESSAGE_ROUTING_HOST_EMU_ACTIVATED");
                selected = false;
                break;
 
-       case NET_NFC_MESSAGE_ROUTING_HOST_EMU_DATA :
+       case NET_NFC_MESSAGE_ROUTING_HOST_EMU_DATA:
                DEBUG_ADDON_MSG("NET_NFC_MESSAGE_ROUTING_HOST_EMU_DATA");
                __process_command(handle, data);
                break;
 
-       case NET_NFC_MESSAGE_ROUTING_HOST_EMU_DEACTIVATED :
+       case NET_NFC_MESSAGE_ROUTING_HOST_EMU_DEACTIVATED:
                DEBUG_ADDON_MSG("NET_NFC_MESSAGE_ROUTING_HOST_EMU_DEACTIVATED");
                selected = false;
                break;
 
-       default :
+       default:
                break;
        }
 }
@@ -250,17 +233,12 @@ static void _nfc_plugin_hce_ppse_init(void)
 {
        DEBUG_ADDON_MSG(">>>>");
 
-       if (net_nfc_server_route_table_find_aid("nfc-manager",
-               PPSE_AID) == NULL) {
+       if (net_nfc_server_route_table_find_aid("nfc-manager", PPSE_AID) == NULL) {
                net_nfc_error_e result;
 
-               result = net_nfc_server_route_table_add_aid(NULL, "nfc-manager",
-                       NET_NFC_SE_TYPE_HCE,
-                       NET_NFC_CARD_EMULATION_CATEGORY_OTHER,
-                       PPSE_AID);
-               if (result != NET_NFC_OK) {
+               result = net_nfc_server_route_table_add_aid(NULL, "nfc-manager", NET_NFC_SE_TYPE_HCE, NET_NFC_CARD_EMULATION_CATEGORY_OTHER, PPSE_AID);
+               if (result != NET_NFC_OK)
                        DEBUG_ERR_MSG("net_nfc_server_route_table_add_aid failed, [%d]", result);
-               }
        }
 }
 
@@ -278,14 +256,12 @@ static void _nfc_plugin_hce_ppse_deinit(void)
 {
        DEBUG_ADDON_MSG(">>>>");
 
-       if (net_nfc_server_route_table_find_aid("nfc-manager",
-               PPSE_AID) == NULL) {
+       if (net_nfc_server_route_table_find_aid("nfc-manager", PPSE_AID) == NULL) {
                net_nfc_error_e result;
 
                result = net_nfc_server_route_table_del_aid(NULL, "nfc-manager", PPSE_AID, false);
-               if (result != NET_NFC_OK) {
+               if (result != NET_NFC_OK)
                        DEBUG_ERR_MSG("net_nfc_server_route_table_del_aid failed, [%d]", result);
-               }
        }
 }
 
index 2b01cc3..7b5c92c 100644 (file)
 #include "net_nfc_server_route_table.h"
 #include "net_nfc_addon_hce.h"
 
-
 #define ENDIAN_16(x)                   ((((x) >> 8) & 0x00FF) | (((x) << 8) & 0xFF00))
 
-#define T_MONEY_AID                    "D4100000030001" /*  00A4040007D410000003000100 */
+#define T_MONEY_AID                    "D4100000030001"        /*  00A4040007D410000003000100 */
 #define T_MONEY_INS_READ               (uint8_t)0xCA
 
 static const uint8_t tmoney_aid[] = { 0xD4, 0x10, 0x00, 0x00, 0x03, 0x00, 0x01 };
+
 static uint8_t tmoney_response[] = {
        0x6F, 0x00,
-//     0x6F, 0x31,
-//     0xB0, 0x2F,
-//     0x00, 0x10, 0x01, 0x08, 0x10, 0x10, 0x00, 0x09, 0x84, 0x60, 0x82, 0x99, 0x01, 0x06, 0x70, 0x79,
-//     0x48, 0x20, 0x13, 0x03, 0x30, 0x20, 0x18, 0x03, 0x29, 0x01, 0x00, 0x00, 0x07, 0xA1, 0x20, 0x40,
-//     0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+//  0x6F, 0x31,
+//  0xB0, 0x2F,
+//  0x00, 0x10, 0x01, 0x08, 0x10, 0x10, 0x00, 0x09, 0x84, 0x60, 0x82, 0x99, 0x01, 0x06, 0x70, 0x79,
+//  0x48, 0x20, 0x13, 0x03, 0x30, 0x20, 0x18, 0x03, 0x29, 0x01, 0x00, 0x00, 0x07, 0xA1, 0x20, 0x40,
+//  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
 };
 static uint8_t tmoney_uid[] = { 'T', 'i', 'z', 'e', 'n', '1', '2', '3' };
 
 static bool selected;
 static bool enabled;
 
-static void __send_response(net_nfc_target_handle_s *handle, uint16_t sw, uint8_t *resp, size_t len)
+static void __send_response(net_nfc_target_handle_s * handle, uint16_t sw, uint8_t * resp, size_t len)
 {
        size_t total_len = sizeof(sw);
        size_t offset = 0;
@@ -52,9 +52,8 @@ static void __send_response(net_nfc_target_handle_s *handle, uint16_t sw, uint8_
 
        sw = ENDIAN_16(sw);
 
-       if (resp != NULL && len > 0) {
+       if (resp != NULL && len > 0)
                total_len += len;
-       }
 
        buffer = g_malloc0(total_len);
 
@@ -73,7 +72,7 @@ static void __send_response(net_nfc_target_handle_s *handle, uint16_t sw, uint8_
        g_free(buffer);
 }
 
-static void __process_command(net_nfc_target_handle_s *handle, data_s *cmd)
+static void __process_command(net_nfc_target_handle_s * handle, data_s * cmd)
 {
        net_nfc_apdu_data_t *apdu;
 
@@ -92,8 +91,7 @@ static void __process_command(net_nfc_target_handle_s *handle, data_s *cmd)
                        goto END;
                }
 
-               if (apdu->p1 != NET_NFC_HCE_P1_SELECT_BY_NAME ||
-                       apdu->p2 != 0) {
+               if (apdu->p1 != NET_NFC_HCE_P1_SELECT_BY_NAME || apdu->p2 != 0) {
                        DEBUG_ERR_MSG("incorrect parameter");
                        __send_response(handle, NET_NFC_HCE_SW_INCORRECT_P1_TO_P2, NULL, 0);
                        goto END;
@@ -130,40 +128,36 @@ static void __process_command(net_nfc_target_handle_s *handle, data_s *cmd)
 
                DEBUG_ADDON_MSG("tmoney read");
 
-               __send_response(handle, NET_NFC_HCE_SW_SUCCESS,
-                       tmoney_uid,
-                       sizeof(tmoney_uid));
+               __send_response(handle, NET_NFC_HCE_SW_SUCCESS, tmoney_uid, sizeof(tmoney_uid));
        } else {
                DEBUG_ERR_MSG("not supported");
                __send_response(handle, NET_NFC_HCE_SW_INS_NOT_SUPPORTED, NULL, 0);
        }
 
-END :
-       if (apdu != NULL) {
+ END:
+       if (apdu != NULL)
                net_nfc_util_hce_free_apdu_data(apdu);
-       }
 }
 
-static void __nfc_addon_hce_tmoney_listener(net_nfc_target_handle_s *handle,
-       int event, data_s *data, void *user_data)
+static void __nfc_addon_hce_tmoney_listener(net_nfc_target_handle_s * handle, int event, data_s * data, void *user_data)
 {
        switch (event) {
-       case NET_NFC_MESSAGE_ROUTING_HOST_EMU_ACTIVATED :
+       case NET_NFC_MESSAGE_ROUTING_HOST_EMU_ACTIVATED:
                DEBUG_ADDON_MSG("NET_NFC_MESSAGE_ROUTING_HOST_EMU_ACTIVATED");
                selected = false;
                break;
 
-       case NET_NFC_MESSAGE_ROUTING_HOST_EMU_DATA :
+       case NET_NFC_MESSAGE_ROUTING_HOST_EMU_DATA:
                DEBUG_ADDON_MSG("NET_NFC_MESSAGE_ROUTING_HOST_EMU_DATA");
                __process_command(handle, data);
                break;
 
-       case NET_NFC_MESSAGE_ROUTING_HOST_EMU_DEACTIVATED :
+       case NET_NFC_MESSAGE_ROUTING_HOST_EMU_DEACTIVATED:
                DEBUG_ADDON_MSG("NET_NFC_MESSAGE_ROUTING_HOST_EMU_DEACTIVATED");
                selected = false;
                break;
 
-       default :
+       default:
                break;
        }
 }
@@ -173,34 +167,26 @@ static void _plugin_hce_tmoney_enable(void)
        net_nfc_error_e result = NET_NFC_OK;
 
        if (enabled == false) {
-               if (net_nfc_server_route_table_find_aid("nfc-manager",
-                       T_MONEY_AID) == NULL) {
-                       result = net_nfc_server_route_table_add_aid(NULL, "nfc-manager",
-                               NET_NFC_SE_TYPE_HCE,
-                               NET_NFC_CARD_EMULATION_CATEGORY_OTHER,
-                               T_MONEY_AID);
-               }
+               if (net_nfc_server_route_table_find_aid("nfc-manager", T_MONEY_AID) == NULL)
+                       result = net_nfc_server_route_table_add_aid(NULL, "nfc-manager", NET_NFC_SE_TYPE_HCE, NET_NFC_CARD_EMULATION_CATEGORY_OTHER, T_MONEY_AID);
 
-               if (result == NET_NFC_OK) {
+               if (result == NET_NFC_OK)
                        enabled = true;
-               } else {
+               else
                        DEBUG_ERR_MSG("net_nfc_server_route_table_add_aid failed, [%d]", result);
-               }
        }
 }
 
 static void _plugin_hce_tmoney_disable(void)
 {
        if (enabled == true) {
-               if (net_nfc_server_route_table_find_aid("nfc-manager",
-                       T_MONEY_AID) != NULL) {
-                       net_nfc_server_route_table_del_aid(NULL, "nfc-manager",
-                               T_MONEY_AID, false);
-               }
+               if (net_nfc_server_route_table_find_aid("nfc-manager", T_MONEY_AID) != NULL)
+                       net_nfc_server_route_table_del_aid(NULL, "nfc-manager", T_MONEY_AID, false);
 
                enabled = false;
        }
 }
+
 static void _nfc_plugin_hce_tmoney_init(void)
 {
        DEBUG_ADDON_MSG(">>>>");
index 3e0ae24..2b424e2 100755 (executable)
@@ -28,6 +28,7 @@ extern net_nfc_addon_ops_t net_nfc_addon_hce_ops;
 net_nfc_addon_ops_t *addons[] = {
        &net_nfc_addon_hce_ops,
 };
+
 size_t addons_count = sizeof(addons) / sizeof(net_nfc_addon_ops_t *);
 
 net_nfc_error_e net_nfc_addons_init(void)
@@ -36,9 +37,8 @@ net_nfc_error_e net_nfc_addons_init(void)
 
        DEBUG_ADDON_MSG(">>>");
 
-       for (i = 0; i < addons_count; i++) {
+       for (i = 0; i < addons_count; i++)
                addons[i]->init();
-       }
 
        return NET_NFC_OK;
 }
@@ -47,9 +47,8 @@ net_nfc_error_e net_nfc_addons_pause(void)
 {
        int i;
 
-       for (i = 0; i < addons_count; i++) {
+       for (i = 0; i < addons_count; i++)
                addons[i]->pause();
-       }
 
        return NET_NFC_OK;
 }
@@ -58,9 +57,8 @@ net_nfc_error_e net_nfc_addons_resume(void)
 {
        int i;
 
-       for (i = 0; i < addons_count; i++) {
+       for (i = 0; i < addons_count; i++)
                addons[i]->resume();
-       }
 
        return NET_NFC_OK;
 }
index abe8562..353714d 100755 (executable)
 #define IDS_FAILED_TO_CONNECT_TO_PS    \
        gettext("IDS_NFC_TPOP_FAILED_TO_CONNECT_TO_PS")
 
-net_nfc_error_e net_nfc_app_util_store_ndef_message(data_s *data);
-net_nfc_error_e net_nfc_app_util_process_ndef(data_s *data);
-void net_nfc_app_util_aul_launch_app(char* package_name, bundle* kb);
-void net_nfc_app_util_clean_storage(charsrc_path);
-bool net_nfc_app_util_is_dir(const charpath_name);
+net_nfc_error_e net_nfc_app_util_store_ndef_message(data_s * data);
+net_nfc_error_e net_nfc_app_util_process_ndef(data_s * data);
+void net_nfc_app_util_aul_launch_app(char *package_name, bundle * kb);
+void net_nfc_app_util_clean_storage(char *src_path);
+bool net_nfc_app_util_is_dir(const char *path_name);
 int net_nfc_app_util_appsvc_launch(const char *operation, const char *uri, const char *mime, const char *data);
-int net_nfc_app_util_launch_se_transaction_app(net_nfc_se_type_e se_type, uint8_t *aid, uint32_t aid_len, uint8_t *param, uint32_t param_len);
-int net_nfc_app_util_launch_se_off_host_apdu_service_app(net_nfc_se_type_e se_type, uint8_t *aid, uint32_t aid_len, uint8_t *param, uint32_t param_len);
-int net_nfc_app_util_encode_base64(uint8_t *buffer, uint32_t buf_len, char *result, uint32_t max_result);
-int net_nfc_app_util_decode_base64(const char *buffer, uint32_t buf_len, uint8_t *result, uint32_t *res_len);
+int net_nfc_app_util_launch_se_transaction_app(net_nfc_se_type_e se_type, uint8_t * aid, uint32_t aid_len, uint8_t * param, uint32_t param_len);
+int net_nfc_app_util_launch_se_off_host_apdu_service_app(net_nfc_se_type_e se_type, uint8_t * aid, uint32_t aid_len, uint8_t * param, uint32_t param_len);
+int net_nfc_app_util_encode_base64(uint8_t * buffer, uint32_t buf_len, char *result, uint32_t max_result);
+int net_nfc_app_util_decode_base64(const char *buffer, uint32_t buf_len, uint8_t * result, uint32_t * res_len);
 bool net_nfc_app_util_check_launch_state();
 pid_t net_nfc_app_util_get_focus_app_pid();
 void net_nfc_app_util_show_notification(const char *signal, const char *param);
 
-
-#endif //__NET_NFC_APP_UTIL_INTERNAL_H__
+#endif                                                 //__NET_NFC_APP_UTIL_INTERNAL_H__
index 5cf46c2..c91c813 100755 (executable)
 
 #include "net_nfc_typedef_internal.h"
 
-typedef struct _socket_info_t
-{
+typedef struct _socket_info_t {
        net_nfc_llcp_socket_t socket;
        net_nfc_service_llcp_cb err_cb;
        net_nfc_service_llcp_cb work_cb;
        void *err_param;
        void *work_param;
-}
-socket_info_t;
+} socket_info_t;
 
 /* common api */
 void *net_nfc_controller_onload(void);
 bool net_nfc_controller_unload(void *handle);
-bool net_nfc_controller_init(net_nfc_error_e *result);
+bool net_nfc_controller_init(net_nfc_error_e * result);
 bool net_nfc_controller_deinit(void);
-bool net_nfc_controller_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);
+bool net_nfc_controller_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);
 bool net_nfc_controller_unregister_listener(void);
-bool net_nfc_controller_support_nfc(net_nfc_error_e *result);
-bool net_nfc_controller_get_firmware_version(data_s **data, net_nfc_error_e *result);
-bool net_nfc_controller_check_firmware_version(net_nfc_error_e *result);
-bool net_nfc_controller_update_firmware(net_nfc_error_e *result);
-bool net_nfc_controller_get_stack_information(net_nfc_stack_information_s *stack_info, net_nfc_error_e *result);
-bool net_nfc_controller_configure_discovery (net_nfc_discovery_mode_e mode, net_nfc_event_filter_e config, net_nfc_error_e *result);
-bool net_nfc_controller_check_target_presence(net_nfc_target_handle_s *handle, net_nfc_error_e *result);
-bool net_nfc_controller_connect(net_nfc_target_handle_s *handle, net_nfc_error_e *result);
-bool net_nfc_controller_disconnect(net_nfc_target_handle_s *handle, net_nfc_error_e *result);
-bool net_nfc_controller_check_ndef(net_nfc_target_handle_s *handle, uint8_t *ndef_card_state, int *max_data_size, int *real_data_size, net_nfc_error_e *result);
-bool net_nfc_controller_read_ndef(net_nfc_target_handle_s *handle, data_s **data, net_nfc_error_e *result);
-bool net_nfc_controller_write_ndef(net_nfc_target_handle_s *handle, data_s *data, net_nfc_error_e *result);
-bool net_nfc_controller_make_read_only_ndef(net_nfc_target_handle_s *handle,  net_nfc_error_e *result);
-bool net_nfc_controller_format_ndef(net_nfc_target_handle_s *handle, data_s *secure_key, net_nfc_error_e *result);
-bool net_nfc_controller_transceive (net_nfc_target_handle_s *handle, net_nfc_transceive_info_s *info, data_s **data, net_nfc_error_e *result);
+bool net_nfc_controller_support_nfc(net_nfc_error_e * result);
+bool net_nfc_controller_get_firmware_version(data_s ** data, net_nfc_error_e * result);
+bool net_nfc_controller_check_firmware_version(net_nfc_error_e * result);
+bool net_nfc_controller_update_firmware(net_nfc_error_e * result);
+bool net_nfc_controller_get_stack_information(net_nfc_stack_information_s * stack_info, net_nfc_error_e * result);
+bool net_nfc_controller_configure_discovery(net_nfc_discovery_mode_e mode, net_nfc_event_filter_e config, net_nfc_error_e * result);
+bool net_nfc_controller_check_target_presence(net_nfc_target_handle_s * handle, net_nfc_error_e * result);
+bool net_nfc_controller_connect(net_nfc_target_handle_s * handle, net_nfc_error_e * result);
+bool net_nfc_controller_disconnect(net_nfc_target_handle_s * handle, net_nfc_error_e * result);
+bool net_nfc_controller_check_ndef(net_nfc_target_handle_s * handle, uint8_t * ndef_card_state, int *max_data_size, int *real_data_size, net_nfc_error_e * result);
+bool net_nfc_controller_read_ndef(net_nfc_target_handle_s * handle, data_s ** data, net_nfc_error_e * result);
+bool net_nfc_controller_write_ndef(net_nfc_target_handle_s * handle, data_s * data, net_nfc_error_e * result);
+bool net_nfc_controller_make_read_only_ndef(net_nfc_target_handle_s * handle, net_nfc_error_e * result);
+bool net_nfc_controller_format_ndef(net_nfc_target_handle_s * handle, data_s * secure_key, net_nfc_error_e * result);
+bool net_nfc_controller_transceive(net_nfc_target_handle_s * handle, net_nfc_transceive_info_s * info, data_s ** data, net_nfc_error_e * result);
 bool net_nfc_controller_exception_handler(void);
-bool net_nfc_controller_is_ready(net_nfc_error_e *result);
+bool net_nfc_controller_is_ready(net_nfc_error_e * result);
 
 /* llcp api */
-bool net_nfc_controller_llcp_config(net_nfc_llcp_config_info_s *config, net_nfc_error_e *result);
-bool net_nfc_controller_llcp_check_llcp(net_nfc_target_handle_s *handle, net_nfc_error_e *result);
-bool net_nfc_controller_llcp_activate_llcp(net_nfc_target_handle_s *handle, net_nfc_error_e *result);
-bool net_nfc_controller_llcp_create_socket(net_nfc_llcp_socket_t *socket, net_nfc_socket_type_e socketType, uint16_t miu, uint8_t rw, net_nfc_error_e *result, net_nfc_service_llcp_cb cb, void *user_param);
-bool net_nfc_controller_llcp_bind(net_nfc_llcp_socket_t socket, uint8_t service_access_point, net_nfc_error_e *result);
-bool net_nfc_controller_llcp_listen(net_nfc_target_handle_s* handle, uint8_t *service_access_name, net_nfc_llcp_socket_t socket, net_nfc_error_e *result, net_nfc_service_llcp_cb cb, void *user_param);
-bool net_nfc_controller_llcp_accept(net_nfc_llcp_socket_t socket, net_nfc_error_e *result, net_nfc_service_llcp_cb cb, void *user_param);
-bool net_nfc_controller_llcp_connect_by_url(net_nfc_target_handle_s *handle, net_nfc_llcp_socket_t socket, uint8_t *service_access_name, net_nfc_error_e *result, net_nfc_service_llcp_cb cb, void *user_param);
-bool net_nfc_controller_llcp_connect(net_nfc_target_handle_s *handle, net_nfc_llcp_socket_t socket, uint8_t service_access_point, net_nfc_error_e *result, net_nfc_service_llcp_cb cb, void *user_param);
-bool net_nfc_controller_llcp_disconnect(net_nfc_target_handle_s *handle, net_nfc_llcp_socket_t socket, net_nfc_error_e *result, net_nfc_service_llcp_cb cb, void *user_param);
-bool net_nfc_controller_llcp_socket_close(net_nfc_llcp_socket_t socket, net_nfc_error_e *result);
-bool net_nfc_controller_llcp_recv(net_nfc_target_handle_s *handle, net_nfc_llcp_socket_t socket, uint32_t max_len, net_nfc_error_e *result, net_nfc_service_llcp_cb cb, void *user_param);
-bool net_nfc_controller_llcp_send(net_nfc_target_handle_s *handle, net_nfc_llcp_socket_t socket, data_s *data, net_nfc_error_e *result, net_nfc_service_llcp_cb cb, void *user_param);
-bool net_nfc_controller_llcp_recv_from(net_nfc_target_handle_s *handle, net_nfc_llcp_socket_t socket, uint32_t max_len, net_nfc_error_e *result, net_nfc_service_llcp_cb cb, void *user_param);
-bool net_nfc_controller_llcp_send_to(net_nfc_target_handle_s *handle, net_nfc_llcp_socket_t socket, data_s *data, uint8_t service_access_point, net_nfc_error_e *result, net_nfc_service_llcp_cb cb, void *user_param);
-bool net_nfc_controller_llcp_reject(net_nfc_target_handle_s *handle, net_nfc_llcp_socket_t socket, net_nfc_error_e *result);
-bool net_nfc_controller_llcp_get_remote_config (net_nfc_target_handle_s *handle, net_nfc_llcp_config_info_s *config, net_nfc_error_e *result);
-bool net_nfc_controller_llcp_get_remote_socket_info (net_nfc_target_handle_s *handle, net_nfc_llcp_socket_t socket, net_nfc_llcp_socket_option_s *option, net_nfc_error_e *result);
+bool net_nfc_controller_llcp_config(net_nfc_llcp_config_info_s * config, net_nfc_error_e * result);
+bool net_nfc_controller_llcp_check_llcp(net_nfc_target_handle_s * handle, net_nfc_error_e * result);
+bool net_nfc_controller_llcp_activate_llcp(net_nfc_target_handle_s * handle, net_nfc_error_e * result);
+bool net_nfc_controller_llcp_create_socket(net_nfc_llcp_socket_t * socket, net_nfc_socket_type_e socketType, uint16_t miu, uint8_t rw, net_nfc_error_e * result, net_nfc_service_llcp_cb cb, void *user_param);
+bool net_nfc_controller_llcp_bind(net_nfc_llcp_socket_t socket, uint8_t service_access_point, net_nfc_error_e * result);
+bool net_nfc_controller_llcp_listen(net_nfc_target_handle_s * handle, uint8_t * service_access_name, net_nfc_llcp_socket_t socket, net_nfc_error_e * result, net_nfc_service_llcp_cb cb, void *user_param);
+bool net_nfc_controller_llcp_accept(net_nfc_llcp_socket_t socket, net_nfc_error_e * result, net_nfc_service_llcp_cb cb, void *user_param);
+bool net_nfc_controller_llcp_connect_by_url(net_nfc_target_handle_s * handle, net_nfc_llcp_socket_t socket, uint8_t * service_access_name, net_nfc_error_e * result, net_nfc_service_llcp_cb cb, void *user_param);
+bool net_nfc_controller_llcp_connect(net_nfc_target_handle_s * handle, net_nfc_llcp_socket_t socket, uint8_t service_access_point, net_nfc_error_e * result, net_nfc_service_llcp_cb cb, void *user_param);
+bool net_nfc_controller_llcp_disconnect(net_nfc_target_handle_s * handle, net_nfc_llcp_socket_t socket, net_nfc_error_e * result, net_nfc_service_llcp_cb cb, void *user_param);
+bool net_nfc_controller_llcp_socket_close(net_nfc_llcp_socket_t socket, net_nfc_error_e * result);
+bool net_nfc_controller_llcp_recv(net_nfc_target_handle_s * handle, net_nfc_llcp_socket_t socket, uint32_t max_len, net_nfc_error_e * result, net_nfc_service_llcp_cb cb, void *user_param);
+bool net_nfc_controller_llcp_send(net_nfc_target_handle_s * handle, net_nfc_llcp_socket_t socket, data_s * data, net_nfc_error_e * result, net_nfc_service_llcp_cb cb, void *user_param);
+bool net_nfc_controller_llcp_recv_from(net_nfc_target_handle_s * handle, net_nfc_llcp_socket_t socket, uint32_t max_len, net_nfc_error_e * result, net_nfc_service_llcp_cb cb, void *user_param);
+bool net_nfc_controller_llcp_send_to(net_nfc_target_handle_s * handle, net_nfc_llcp_socket_t socket, data_s * data, uint8_t service_access_point, net_nfc_error_e * result, net_nfc_service_llcp_cb cb, void *user_param);
+bool net_nfc_controller_llcp_reject(net_nfc_target_handle_s * handle, net_nfc_llcp_socket_t socket, net_nfc_error_e * result);
+bool net_nfc_controller_llcp_get_remote_config(net_nfc_target_handle_s * handle, net_nfc_llcp_config_info_s * config, net_nfc_error_e * result);
+bool net_nfc_controller_llcp_get_remote_socket_info(net_nfc_target_handle_s * handle, net_nfc_llcp_socket_t socket, net_nfc_llcp_socket_option_s * option, net_nfc_error_e * result);
 
-void net_nfc_controller_llcp_socket_error_cb(net_nfc_llcp_socket_t socket,
-       net_nfc_error_e result, void *data, void *user_param);
-void net_nfc_controller_llcp_incoming_cb(net_nfc_llcp_socket_t socket,
-       net_nfc_error_e result, void *data, void *user_param);
-void net_nfc_controller_llcp_connected_cb(net_nfc_llcp_socket_t socket,
-       net_nfc_error_e result, void *data, void *user_param);
-void net_nfc_controller_llcp_disconnected_cb(net_nfc_llcp_socket_t socket,
-       net_nfc_error_e result, void *data, void *user_param);
-void net_nfc_controller_llcp_received_cb(net_nfc_llcp_socket_t socket,
-       net_nfc_error_e result, void *data, void *user_param);
-void net_nfc_controller_llcp_sent_cb(net_nfc_llcp_socket_t socket,
-       net_nfc_error_e result, void *data, void *user_param);
+void net_nfc_controller_llcp_socket_error_cb(net_nfc_llcp_socket_t socket, net_nfc_error_e result, void *data, void *user_param);
+void net_nfc_controller_llcp_incoming_cb(net_nfc_llcp_socket_t socket, net_nfc_error_e result, void *data, void *user_param);
+void net_nfc_controller_llcp_connected_cb(net_nfc_llcp_socket_t socket, net_nfc_error_e result, void *data, void *user_param);
+void net_nfc_controller_llcp_disconnected_cb(net_nfc_llcp_socket_t socket, net_nfc_error_e result, void *data, void *user_param);
+void net_nfc_controller_llcp_received_cb(net_nfc_llcp_socket_t socket, net_nfc_error_e result, void *data, void *user_param);
+void net_nfc_controller_llcp_sent_cb(net_nfc_llcp_socket_t socket, net_nfc_error_e result, void *data, void *user_param);
 
 /* secure element api */
-bool net_nfc_controller_secure_element_open(net_nfc_secure_element_type_e element_type, net_nfc_target_handle_s **handle, net_nfc_error_e *result);
-bool net_nfc_controller_secure_element_get_atr(net_nfc_target_handle_s *handle, data_s **atr, net_nfc_error_e *result);
-bool net_nfc_controller_secure_element_send_apdu(net_nfc_target_handle_s *handle, data_s *command, data_s **response, net_nfc_error_e *result);
-bool net_nfc_controller_secure_element_close(net_nfc_target_handle_s *handle, net_nfc_error_e *result);
-bool net_nfc_controller_get_secure_element_list(net_nfc_secure_element_info_s* list, int* count, net_nfc_error_e* result);
-bool net_nfc_controller_set_secure_element_mode(net_nfc_secure_element_type_e element_type, net_nfc_secure_element_mode_e mode, net_nfc_error_e* result);
+bool net_nfc_controller_secure_element_open(net_nfc_secure_element_type_e element_type, net_nfc_target_handle_s ** handle, net_nfc_error_e * result);
+bool net_nfc_controller_secure_element_get_atr(net_nfc_target_handle_s * handle, data_s ** atr, net_nfc_error_e * result);
+bool net_nfc_controller_secure_element_send_apdu(net_nfc_target_handle_s * handle, data_s * command, data_s ** response, net_nfc_error_e * result);
+bool net_nfc_controller_secure_element_close(net_nfc_target_handle_s * handle, net_nfc_error_e * result);
+bool net_nfc_controller_get_secure_element_list(net_nfc_secure_element_info_s * list, int *count, net_nfc_error_e * result);
+bool net_nfc_controller_set_secure_element_mode(net_nfc_secure_element_type_e element_type, net_nfc_secure_element_mode_e mode, net_nfc_error_e * result);
 
 /* test api */
-bool net_nfc_controller_sim_test(net_nfc_error_e *result);
-bool net_nfc_controller_prbs_test(net_nfc_error_e *result , uint32_t tech , uint32_t rate);
-bool net_nfc_controller_test_mode_on(net_nfc_error_e *result);
-bool net_nfc_controller_test_mode_off(net_nfc_error_e *result);
+bool net_nfc_controller_sim_test(net_nfc_error_e * result);
+bool net_nfc_controller_prbs_test(net_nfc_error_e * result, uint32_t tech, uint32_t rate);
+bool net_nfc_controller_test_mode_on(net_nfc_error_e * result);
+bool net_nfc_controller_test_mode_off(net_nfc_error_e * result);
 bool net_nfc_test_sim(void);
-bool net_nfc_controller_eedata_register_set(net_nfc_error_e *result , uint32_t mode , uint32_t reg_id , data_s *data);
-bool net_nfc_controller_ese_test(net_nfc_error_e *result);
-bool net_nfc_controller_test_set_se_tech_type(net_nfc_error_e *result, net_nfc_se_type_e type, uint32_t tech);
+bool net_nfc_controller_eedata_register_set(net_nfc_error_e * result, uint32_t mode, uint32_t reg_id, data_s * data);
+bool net_nfc_controller_ese_test(net_nfc_error_e * result);
+bool net_nfc_controller_test_set_se_tech_type(net_nfc_error_e * result, net_nfc_se_type_e type, uint32_t tech);
 
 /* hce api */
-bool net_nfc_controller_hce_response_apdu(net_nfc_target_handle_s *handle, data_s *response, net_nfc_error_e *result);
+bool net_nfc_controller_hce_response_apdu(net_nfc_target_handle_s * handle, data_s * response, net_nfc_error_e * result);
 
-bool net_nfc_controller_secure_element_route_aid(data_s *aid, net_nfc_se_type_e se_type, int power, net_nfc_error_e *result);
-bool net_nfc_controller_secure_element_unroute_aid(data_s *aid, net_nfc_error_e *result);
-bool net_nfc_controller_secure_element_commit_routing(net_nfc_error_e *result);
-bool net_nfc_controller_secure_element_set_default_route(
-       net_nfc_se_type_e switch_on,
-       net_nfc_se_type_e switch_off,
-       net_nfc_se_type_e battery_off, net_nfc_error_e *result);
-bool net_nfc_controller_secure_element_clear_aid_table(net_nfc_error_e *result);
-bool net_nfc_controller_secure_element_get_aid_table_size(int *AIDTableSize, net_nfc_error_e *result);
+bool net_nfc_controller_secure_element_route_aid(data_s * aid, net_nfc_se_type_e se_type, int power, net_nfc_error_e * result);
+bool net_nfc_controller_secure_element_unroute_aid(data_s * aid, net_nfc_error_e * result);
+bool net_nfc_controller_secure_element_commit_routing(net_nfc_error_e * result);
+bool net_nfc_controller_secure_element_set_default_route(net_nfc_se_type_e switch_on, net_nfc_se_type_e switch_off, net_nfc_se_type_e battery_off, net_nfc_error_e * result);
+bool net_nfc_controller_secure_element_clear_aid_table(net_nfc_error_e * result);
+bool net_nfc_controller_secure_element_get_aid_table_size(int *AIDTableSize, net_nfc_error_e * result);
 
-bool net_nfc_controller_secure_element_set_route_entry
-       (net_nfc_se_entry_type_e type, net_nfc_se_tech_protocol_type_e value, net_nfc_se_type_e route, int power, net_nfc_error_e *result);
+bool net_nfc_controller_secure_element_set_route_entry(net_nfc_se_entry_type_e type, net_nfc_se_tech_protocol_type_e value, net_nfc_se_type_e route, int power, net_nfc_error_e * result);
 
-bool net_nfc_controller_secure_element_clear_routing_entry
-       (net_nfc_se_entry_type_e type, net_nfc_error_e *result);
+bool net_nfc_controller_secure_element_clear_routing_entry(net_nfc_se_entry_type_e type, net_nfc_error_e * result);
 
-bool net_nfc_controller_secure_element_set_listen_tech_mask
-       (net_nfc_se_tech_protocol_type_e screen_state, net_nfc_error_e *result);
+bool net_nfc_controller_secure_element_set_listen_tech_mask(net_nfc_se_tech_protocol_type_e screen_state, net_nfc_error_e * result);
 
-bool net_nfc_controller_set_screen_state
-       (net_nfc_screen_state_type_e screen_state, net_nfc_error_e *result);
+bool net_nfc_controller_set_screen_state(net_nfc_screen_state_type_e screen_state, net_nfc_error_e * result);
 
-
-#endif //__NET_NFC_CONTROLLER_INTERNAL_H__
+#endif                                                 //__NET_NFC_CONTROLLER_INTERNAL_H__
index f57cb71..47ab236 100755 (executable)
@@ -18,4 +18,4 @@
 
 void net_nfc_manager_quit();
 
-#endif //__NET_NFC_MANAGER_H__
+#endif                                                 //__NET_NFC_MANAGER_H__
index c2f9f90..1303175 100755 (executable)
@@ -32,8 +32,7 @@
 #define WRITE_BUFFER_LENGTH_MAX                        BUFFER_LENGTH_MAX
 #define NET_NFC_MAX_LLCP_SOCKET_BUFFER         BUFFER_LENGTH_MAX
 
-typedef enum
-{
+typedef enum {
        NET_NFC_TASK_START = 0x00,
        NET_NFC_TASK_END,
        NET_NFC_TASK_ERROR
@@ -41,4 +40,4 @@ typedef enum
 
 void net_nfc_manager_util_play_sound(net_nfc_sound_type_e sound_type);
 
-#endif //__NET_NFC_MANAGER_UTIL_INTERNAL_H__
+#endif                                                 //__NET_NFC_MANAGER_UTIL_INTERNAL_H__
index 7f00ea8..fe1f279 100755 (executable)
@@ -24,4 +24,4 @@ void net_nfc_server_gdbus_deinit(void);
 
 pid_t net_nfc_server_gdbus_get_pid(const char *name);
 
-#endif //__NET_NFC_SERVER_H__
+#endif                                                 //__NET_NFC_SERVER_H__
index c0497ef..73b79f4 100755 (executable)
 
 #include "net_nfc_typedef_internal.h"
 
-typedef void (*net_nfc_addon_init)(void);
-typedef void (*net_nfc_addon_pause)(void);
-typedef void (*net_nfc_addon_resume)(void);
-typedef void (*net_nfc_addon_deinit)(void);
+typedef void (*net_nfc_addon_init) (void);
+typedef void (*net_nfc_addon_pause) (void);
+typedef void (*net_nfc_addon_resume) (void);
+typedef void (*net_nfc_addon_deinit) (void);
 
-typedef struct _net_nfc_addon_ops_t
-{
+typedef struct _net_nfc_addon_ops_t {
        const char *name;
 
        net_nfc_addon_init init;
        net_nfc_addon_pause pause;
        net_nfc_addon_resume resume;
        net_nfc_addon_deinit deinit;
-}
-net_nfc_addon_ops_t;
+} net_nfc_addon_ops_t;
 
-#endif //__NET_NFC_SERVER_ADDON_H__
+#endif                                                 //__NET_NFC_SERVER_ADDON_H__
index 0a66c71..2aa45b7 100755 (executable)
@@ -21,7 +21,7 @@
 
 #include "net_nfc_typedef.h"
 
-typedef void (*net_nfc_server_controller_func)(gpointer user_data);
+typedef void (*net_nfc_server_controller_func) (gpointer user_data);
 
 gboolean net_nfc_server_controller_thread_init(void);
 
@@ -34,17 +34,13 @@ void net_nfc_server_controller_deinit(void);
 
 gboolean net_nfc_server_controller_is_blocked();
 
-gboolean net_nfc_server_controller_async_queue_push_force(
-       net_nfc_server_controller_func func, gpointer user_data);
+gboolean net_nfc_server_controller_async_queue_push_force(net_nfc_server_controller_func func, gpointer user_data);
 
-gboolean net_nfc_server_controller_async_queue_push(
-       net_nfc_server_controller_func func, gpointer user_data);
+gboolean net_nfc_server_controller_async_queue_push(net_nfc_server_controller_func func, gpointer user_data);
 
-gboolean net_nfc_server_controller_async_queue_push_and_block(
-       net_nfc_server_controller_func func, gpointer user_data);
+gboolean net_nfc_server_controller_async_queue_push_and_block(net_nfc_server_controller_func func, gpointer user_data);
 
-gboolean net_nfc_server_controller_async_queue_delayed_push_force(
-       guint msec, net_nfc_server_controller_func func, gpointer user_data);
+gboolean net_nfc_server_controller_async_queue_delayed_push_force(guint msec, net_nfc_server_controller_func func, gpointer user_data);
 
 void net_nfc_server_restart_polling_loop(void);
 
@@ -52,7 +48,6 @@ void net_nfc_server_force_polling_loop(void);
 
 void net_nfc_server_quit_nfc_manager_loop(void);
 
-
 void net_nfc_server_set_state(guint32 state);
 
 void net_nfc_server_unset_state(guint32 state);
@@ -64,5 +59,4 @@ void net_nfc_server_controller_quit_dispatch_loop();
 
 void net_nfc_server_controller_init_sync();
 
-
-#endif //__NET_NFC_SERVER_COMMON_H__
+#endif                                                 //__NET_NFC_SERVER_COMMON_H__
index a11ffde..c15748b 100755 (executable)
@@ -22,8 +22,7 @@
 
 #include "net_nfc_typedef_internal.h"
 
-typedef struct _net_nfc_client_context_info_t
-{
+typedef struct _net_nfc_client_context_info_t {
        /* Permanent property */
        char *id;
        pid_t pid;
@@ -37,59 +36,43 @@ typedef struct _net_nfc_client_context_info_t
        bool isTransactionFgDispatch;
 } net_nfc_client_context_info_t;
 
-typedef void (*net_nfc_server_gdbus_on_client_detached_cb)(
-       net_nfc_client_context_info_t *client);
+typedef void (*net_nfc_server_gdbus_on_client_detached_cb) (net_nfc_client_context_info_t * client);
 
-typedef void (*net_nfc_server_gdbus_for_each_client_cb)(
-       net_nfc_client_context_info_t *client, void *user_param);
+typedef void (*net_nfc_server_gdbus_for_each_client_cb) (net_nfc_client_context_info_t * client, void *user_param);
 
 void net_nfc_server_gdbus_init_client_context();
 
 void net_nfc_server_gdbus_deinit_client_context();
 
-void net_nfc_server_gdbus_register_on_client_detached_cb(
-       net_nfc_server_gdbus_on_client_detached_cb cb);
+void net_nfc_server_gdbus_register_on_client_detached_cb(net_nfc_server_gdbus_on_client_detached_cb cb);
 
-void net_nfc_server_gdbus_unregister_on_client_detached_cb(
-       net_nfc_server_gdbus_on_client_detached_cb cb);
+void net_nfc_server_gdbus_unregister_on_client_detached_cb(net_nfc_server_gdbus_on_client_detached_cb cb);
 
-bool net_nfc_server_gdbus_check_privilege(GDBusMethodInvocation *invocation,
-       net_nfc_privilege_e privilege);
+bool net_nfc_server_gdbus_check_privilege(GDBusMethodInvocation * invocation, net_nfc_privilege_e privilege);
 
-void net_nfc_server_gdbus_add_client_context(const char *id,
-       client_state_e state);
+void net_nfc_server_gdbus_add_client_context(const char *id, client_state_e state);
 
 void net_nfc_server_gdbus_cleanup_client_context(const char *id);
 
-net_nfc_client_context_info_t *net_nfc_server_gdbus_get_client_context(
-       const char *id);
+net_nfc_client_context_info_t *net_nfc_server_gdbus_get_client_context(const char *id);
 
-net_nfc_client_context_info_t *net_nfc_server_gdbus_get_client_context_by_pid(
-       pid_t pid);
+net_nfc_client_context_info_t *net_nfc_server_gdbus_get_client_context_by_pid(pid_t pid);
 
 size_t net_nfc_server_gdbus_get_client_count();
 
-void net_nfc_server_gdbus_for_each_client_context(
-       net_nfc_server_gdbus_for_each_client_cb cb,
-       void *user_param);
+void net_nfc_server_gdbus_for_each_client_context(net_nfc_server_gdbus_for_each_client_cb cb, void *user_param);
 
 bool net_nfc_server_gdbus_check_client_is_running(const char *id);
 
-client_state_e net_nfc_server_gdbus_get_client_state(
-       const char *id);
+client_state_e net_nfc_server_gdbus_get_client_state(const char *id);
 
-void net_nfc_server_gdbus_set_client_state(const char *id,
-       client_state_e state);
+void net_nfc_server_gdbus_set_client_state(const char *id, client_state_e state);
 
-void net_nfc_server_gdbus_set_launch_state(const char *id,
-       net_nfc_launch_popup_state_e popup_state,
-       net_nfc_launch_popup_check_e check_foreground);
+void net_nfc_server_gdbus_set_launch_state(const char *id, net_nfc_launch_popup_state_e popup_state, net_nfc_launch_popup_check_e check_foreground);
 
-net_nfc_launch_popup_state_e net_nfc_server_gdbus_get_launch_state(
-       const char *id);
+net_nfc_launch_popup_state_e net_nfc_server_gdbus_get_launch_state(const char *id);
 
-net_nfc_launch_popup_state_e net_nfc_server_gdbus_get_client_popup_state(
-       pid_t pid);
+net_nfc_launch_popup_state_e net_nfc_server_gdbus_get_client_popup_state(pid_t pid);
 bool net_nfc_server_gdbus_get_client_transaction_fg_dispatch_state(pid_t pid);
 bool net_nfc_app_util_check_transaction_fg_dispatch();
 
@@ -99,8 +82,6 @@ void net_nfc_server_gdbus_decrease_se_count(const char *id);
 bool net_nfc_server_gdbus_is_server_busy_no_lock();
 bool net_nfc_server_gdbus_is_server_busy();
 
-net_nfc_error_e net_nfc_server_gdbus_set_transaction_fg_dispatch(
-       const char *id,
-       int fgDispatch);
+net_nfc_error_e net_nfc_server_gdbus_set_transaction_fg_dispatch(const char *id, int fgDispatch);
 
-#endif //__NET_NFC_SERVER_CONTEXT_INTERNAL_H__
+#endif                                                 //__NET_NFC_SERVER_CONTEXT_INTERNAL_H__
index 2966ce2..c8054f2 100755 (executable)
 #include "net_nfc_gdbus.h"
 #include "net_nfc_typedef_internal.h"
 
-
 typedef struct _HandoverRequestData HandoverRequestData;
 
-struct _HandoverRequestData
-{
+struct _HandoverRequestData {
        NetNfcGDbusHandover *handoverobj;
        GDBusMethodInvocation *invocation;
        guint32 handle;
@@ -36,9 +34,8 @@ net_nfc_error_e net_nfc_server_handover_emit_started_signal();
 
 net_nfc_error_e net_nfc_server_handover_emit_finished_signal();
 
-gboolean net_nfc_server_handover_init(GDBusConnection *connection);
+gboolean net_nfc_server_handover_init(GDBusConnection * connection);
 
 void net_nfc_server_handover_deinit(void);
 
-
-#endif //__NET_NFC_SERVER_HANDOVER_H__
+#endif                                                 //__NET_NFC_SERVER_HANDOVER_H__
index 96998b4..7ecbbb4 100755 (executable)
 
 #include "net_nfc_typedef_internal.h"
 
-typedef void (*net_nfc_server_handover_get_carrier_cb)(
-       net_nfc_error_e result,
-       net_nfc_ch_carrier_s *carrier,
-       void *user_param);
+typedef void (*net_nfc_server_handover_get_carrier_cb) (net_nfc_error_e result, net_nfc_ch_carrier_s * carrier, void *user_param);
 
-typedef void (*net_nfc_server_handover_process_carrier_cb)(
-       net_nfc_error_e result,
-       net_nfc_conn_handover_carrier_type_e type,
-       data_s *data,
-       void *user_param);
+typedef void (*net_nfc_server_handover_process_carrier_cb) (net_nfc_error_e result, net_nfc_conn_handover_carrier_type_e type, data_s * data, void *user_param);
 
-typedef struct _ch_hc_record_t
-{
-       uint8_t rfu : 5;
-       uint8_t ctf : 3;
+typedef struct _ch_hc_record_t {
+       uint8_t rfu:5;
+       uint8_t ctf:3;
        uint8_t type_len;
        uint8_t type[0];
-}
-__attribute__((packed)) ch_hc_record_t;
-
+} __attribute__ ((packed)) ch_hc_record_t;
 
 /* alternative carrier functions */
 /* bluetooth */
-net_nfc_error_e net_nfc_server_handover_bt_get_carrier(
-       net_nfc_server_handover_get_carrier_cb cb, void *user_param);
+net_nfc_error_e net_nfc_server_handover_bt_get_carrier(net_nfc_server_handover_get_carrier_cb cb, void *user_param);
 
-net_nfc_error_e net_nfc_server_handover_bt_prepare_pairing(
-       net_nfc_ch_carrier_s *carrier,
-       net_nfc_server_handover_process_carrier_cb cb,
-       void *user_param);
+net_nfc_error_e net_nfc_server_handover_bt_prepare_pairing(net_nfc_ch_carrier_s * carrier, net_nfc_server_handover_process_carrier_cb cb, void *user_param);
 
-net_nfc_error_e net_nfc_server_handover_bt_do_pairing(
-       net_nfc_ch_carrier_s *carrier,
-       net_nfc_server_handover_process_carrier_cb cb,
-       void *user_param);
+net_nfc_error_e net_nfc_server_handover_bt_do_pairing(net_nfc_ch_carrier_s * carrier, net_nfc_server_handover_process_carrier_cb cb, void *user_param);
 
 /* Wifi protected setup */
-net_nfc_error_e net_nfc_server_handover_wps_get_selector_carrier(
-       net_nfc_server_handover_get_carrier_cb cb,
-       void *user_param);
+net_nfc_error_e net_nfc_server_handover_wps_get_selector_carrier(net_nfc_server_handover_get_carrier_cb cb, void *user_param);
 
-net_nfc_error_e net_nfc_server_handover_wps_get_requester_carrier(
-       net_nfc_server_handover_get_carrier_cb cb,
-       void *user_param);
+net_nfc_error_e net_nfc_server_handover_wps_get_requester_carrier(net_nfc_server_handover_get_carrier_cb cb, void *user_param);
 
-net_nfc_error_e net_nfc_server_handover_wps_do_connect(
-       net_nfc_ch_carrier_s *carrier,
-       net_nfc_server_handover_process_carrier_cb cb,
-       void *user_param);
+net_nfc_error_e net_nfc_server_handover_wps_do_connect(net_nfc_ch_carrier_s * carrier, net_nfc_server_handover_process_carrier_cb cb, void *user_param);
 
 /* wifi-direct */
-net_nfc_error_e net_nfc_server_handover_wfd_do_pairing(
-       net_nfc_ch_carrier_s *carrier,
-       net_nfc_server_handover_process_carrier_cb cb,
-       void *user_param);
-
+net_nfc_error_e net_nfc_server_handover_wfd_do_pairing(net_nfc_ch_carrier_s * carrier, net_nfc_server_handover_process_carrier_cb cb, void *user_param);
 
-#endif //__NET_NFC_SERVER_HANDOVER_INTERNAL_H__
+#endif                                                 //__NET_NFC_SERVER_HANDOVER_INTERNAL_H__
index 765e801..482dc5f 100755 (executable)
 
 #include "net_nfc_typedef_internal.h"
 
-
 /******************************************************************************/
-typedef void (*net_nfc_server_hce_listener_cb)(net_nfc_target_handle_s *handle,
-       int event, data_s *data, void *user_data);
-
-typedef void (*net_nfc_server_hce_user_data_destroy_cb)(void *user_data);
+typedef void (*net_nfc_server_hce_listener_cb) (net_nfc_target_handle_s * handle, int event, data_s * data, void *user_data);
 
+typedef void (*net_nfc_server_hce_user_data_destroy_cb) (void *user_data);
 
 /******************************************************************************/
-net_nfc_error_e net_nfc_server_hce_start_hce_handler(const char *package,
-       const char *id, net_nfc_server_hce_listener_cb listener,
-       net_nfc_server_hce_user_data_destroy_cb destroy_cb, void *user_data);
+net_nfc_error_e net_nfc_server_hce_start_hce_handler(const char *package, const char *id, net_nfc_server_hce_listener_cb listener, net_nfc_server_hce_user_data_destroy_cb destroy_cb, void *user_data);
 
 net_nfc_error_e net_nfc_server_hce_stop_hce_handler(const char *package);
 
-net_nfc_error_e net_nfc_server_hce_send_apdu_response(
-       net_nfc_target_handle_s *handle, data_s *response);
+net_nfc_error_e net_nfc_server_hce_send_apdu_response(net_nfc_target_handle_s * handle, data_s * response);
 
 /******************************************************************************/
 /* internal */
-gboolean net_nfc_server_hce_init(GDBusConnection *connection);
+gboolean net_nfc_server_hce_init(GDBusConnection * connection);
 void net_nfc_server_hce_deinit(void);
 
 void net_nfc_server_hce_apdu_received(void *info);
 
-void net_nfc_server_hce_handle_send_apdu_response(
-       net_nfc_target_handle_s *handle, data_s *response);
+void net_nfc_server_hce_handle_send_apdu_response(net_nfc_target_handle_s * handle, data_s * response);
 
-#endif //__NET_NFC_SERVER_SE_H__
+#endif                                                 //__NET_NFC_SERVER_SE_H__
index 596f721..3e71f73 100755 (executable)
 
 #include "net_nfc_typedef_internal.h"
 
-
 /******************************************************************************/
 /* internal */
 bool net_nfc_server_hce_ipc_init();
 
 void net_nfc_server_hce_ipc_deinit();
 
+bool net_nfc_server_hce_send_to_client(const char *id, int type, net_nfc_target_handle_s * handle, data_s * data);
 
-bool net_nfc_server_hce_send_to_client(const char *id, int type,
-       net_nfc_target_handle_s *handle, data_s *data);
-
-bool net_nfc_server_hce_send_to_all_client(int type,
-       net_nfc_target_handle_s *handle, data_s *data);
+bool net_nfc_server_hce_send_to_all_client(int type, net_nfc_target_handle_s * handle, data_s * data);
 
-#endif //__NET_NFC_SERVER_HCE_IPC_H__
+#endif                                                 //__NET_NFC_SERVER_HCE_IPC_H__
index 7a40434..36e8966 100644 (file)
 // service access name
 #define SDP_SAN                        "urn:nfc:sn:sdp"
 #define IP_SAN                 "urn:nfc:sn:ip"
-#define OBEX_SAN               "urn:nfc:sn:obex"
+#define OBEX_SAN               "urn:nfc:sn:obex"
 
-#define SDP_SAP                        1  /* service discovery protocol service access point */
-#define IP_SAP                 2  /* Internet protocol service access point */
-#define OBEX_SAP               3  /* object exchange service access point */
+#define SDP_SAP                        1               /* service discovery protocol service access point */
+#define IP_SAP                 2               /* Internet protocol service access point */
+#define OBEX_SAP               3               /* object exchange service access point */
 
 #define GET_MAJOR_VER(__x)     (((__x) >> 4) & 0x0F)
 #define GET_MINOR_VER(__x)     ((__x) & 0x0F)
@@ -40,8 +40,7 @@
 #define NET_NFC_LLCP_LTO       10
 #define NET_NFC_LLCP_OPT       0
 
-typedef enum
-{
+typedef enum {
        NET_NFC_LLCP_IDLE = 0,
        NET_NFC_LLCP_STEP_01 = 0xFFFF,
        NET_NFC_LLCP_STEP_02,
@@ -68,28 +67,18 @@ typedef enum
        NET_NFC_STATE_ERROR,
 } net_nfc_state_e;
 
-typedef void (*net_nfc_server_llcp_callback) (net_nfc_error_e result,
-                                       net_nfc_target_handle_s *handle,
-                                       net_nfc_llcp_socket_t socket,
-                                       data_s *data,
-                                       gpointer user_data);
+typedef void (*net_nfc_server_llcp_callback) (net_nfc_error_e result, net_nfc_target_handle_s * handle, net_nfc_llcp_socket_t socket, data_s * data, gpointer user_data);
 
-typedef void (*net_nfc_server_llcp_activate_cb)(
-       int event,
-       net_nfc_target_handle_s *handle,
-       uint32_t sap,
-       const char *san,
-       void *user_param);
+typedef void (*net_nfc_server_llcp_activate_cb) (int event, net_nfc_target_handle_s * handle, uint32_t sap, const char *san, void *user_param);
 
-gboolean net_nfc_server_llcp_init(GDBusConnection *connection);
+gboolean net_nfc_server_llcp_init(GDBusConnection * connection);
 
 void net_nfc_server_llcp_deinit(void);
 
 /* server side */
 void net_nfc_server_llcp_deactivated(gpointer user_data);
 
-net_nfc_error_e net_nfc_server_llcp_set_config(
-                                       net_nfc_llcp_config_info_s *config);
+net_nfc_error_e net_nfc_server_llcp_set_config(net_nfc_llcp_config_info_s * config);
 
 guint16 net_nfc_server_llcp_get_miu(void);
 
@@ -101,53 +90,24 @@ guint8 net_nfc_server_llcp_get_option(void);
 
 bool net_nfc_server_llcp_target_detected(void *info);
 
-net_nfc_error_e net_nfc_server_llcp_simple_server(
-                               net_nfc_target_handle_s *handle,
-                               const char *san,
-                               sap_t sap,
-                               net_nfc_server_llcp_callback callback,
-                               net_nfc_server_llcp_callback error_callback,
-                               gpointer user_data);
-
-net_nfc_error_e net_nfc_server_llcp_simple_client(
-                               net_nfc_target_handle_s *handle,
-                               const char *san,
-                               sap_t sap,
-                               net_nfc_server_llcp_callback callback,
-                               net_nfc_server_llcp_callback error_callback,
-                               gpointer user_data);
-
-net_nfc_error_e net_nfc_server_llcp_simple_accept(
-                               net_nfc_target_handle_s *handle,
-                               net_nfc_llcp_socket_t socket,
-                               net_nfc_server_llcp_callback error_callback,
-                               gpointer user_data);
-
-net_nfc_error_e net_nfc_server_llcp_simple_send(
-                                       net_nfc_target_handle_s *handle,
-                                       net_nfc_llcp_socket_t socket,
-                                       data_s *data,
-                                       net_nfc_server_llcp_callback callback,
-                                       gpointer user_data);
-
-net_nfc_error_e net_nfc_server_llcp_simple_receive(
-                                       net_nfc_target_handle_s *handle,
-                                       net_nfc_llcp_socket_t socket,
-                                       net_nfc_server_llcp_callback callback,
-                                       gpointer user_data);
-
-net_nfc_error_e net_nfc_server_llcp_register_service(const char *id,
-       sap_t sap, const char *san, net_nfc_server_llcp_activate_cb cb,
-       void *user_param);
-
-net_nfc_error_e net_nfc_server_llcp_unregister_service(const char *id,
-       sap_t sap, const char *san);
+net_nfc_error_e net_nfc_server_llcp_simple_server(net_nfc_target_handle_s * handle, const char *san, sap_t sap, net_nfc_server_llcp_callback callback, net_nfc_server_llcp_callback error_callback, gpointer user_data);
+
+net_nfc_error_e net_nfc_server_llcp_simple_client(net_nfc_target_handle_s * handle, const char *san, sap_t sap, net_nfc_server_llcp_callback callback, net_nfc_server_llcp_callback error_callback, gpointer user_data);
+
+net_nfc_error_e net_nfc_server_llcp_simple_accept(net_nfc_target_handle_s * handle, net_nfc_llcp_socket_t socket, net_nfc_server_llcp_callback error_callback, gpointer user_data);
+
+net_nfc_error_e net_nfc_server_llcp_simple_send(net_nfc_target_handle_s * handle, net_nfc_llcp_socket_t socket, data_s * data, net_nfc_server_llcp_callback callback, gpointer user_data);
+
+net_nfc_error_e net_nfc_server_llcp_simple_receive(net_nfc_target_handle_s * handle, net_nfc_llcp_socket_t socket, net_nfc_server_llcp_callback callback, gpointer user_data);
+
+net_nfc_error_e net_nfc_server_llcp_register_service(const char *id, sap_t sap, const char *san, net_nfc_server_llcp_activate_cb cb, void *user_param);
+
+net_nfc_error_e net_nfc_server_llcp_unregister_service(const char *id, sap_t sap, const char *san);
 
 net_nfc_error_e net_nfc_server_llcp_unregister_services(const char *id);
 
 net_nfc_error_e net_nfc_server_llcp_unregister_all();
 
-net_nfc_error_e net_nfc_server_llcp_start_registered_services(
-       net_nfc_target_handle_s *handle);
+net_nfc_error_e net_nfc_server_llcp_start_registered_services(net_nfc_target_handle_s * handle);
 
-#endif //__NET_NFC_SERVER_LLCP_H__
+#endif                                                 //__NET_NFC_SERVER_LLCP_H__
index 1f6fa22..087aed7 100755 (executable)
@@ -20,7 +20,7 @@
 #include <gio/gio.h>
 #include "net_nfc_server_vconf.h"
 
-gboolean net_nfc_server_manager_init(GDBusConnection *connection);
+gboolean net_nfc_server_manager_init(GDBusConnection * connection);
 
 void net_nfc_server_manager_deinit(void);
 
@@ -28,4 +28,4 @@ void net_nfc_server_manager_set_active(gboolean is_active);
 
 bool net_nfc_server_manager_get_active();
 
-#endif //__NET_NFC_SERVER_MANAGER_H__
+#endif                                                 //__NET_NFC_SERVER_MANAGER_H__
index 7b241b1..f859fa1 100644 (file)
@@ -18,8 +18,8 @@
 
 #include <gio/gio.h>
 
-gboolean net_nfc_server_ndef_init(GDBusConnection *connection);
+gboolean net_nfc_server_ndef_init(GDBusConnection * connection);
 
 void net_nfc_server_ndef_deinit(void);
 
-#endif //__NET_NFC_SERVER_NDEF_H__
+#endif                                                 //__NET_NFC_SERVER_NDEF_H__
index bed96f6..2af0e98 100644 (file)
@@ -20,7 +20,7 @@
 
 #include "net_nfc_typedef_internal.h"
 
-gboolean net_nfc_server_p2p_init(GDBusConnection *connection);
+gboolean net_nfc_server_p2p_init(GDBusConnection * connection);
 
 void net_nfc_server_p2p_deinit(void);
 
@@ -33,4 +33,4 @@ void net_nfc_server_p2p_received(data_h user_data);
 
 void net_nfc_server_p2p_data_sent(net_nfc_error_e result, gpointer user_data);
 
-#endif //__NET_NFC_SERVER_P2P_H__
+#endif                                                 //__NET_NFC_SERVER_P2P_H__
index 2d83605..37e99a5 100755 (executable)
 
 #include "net_nfc_typedef_internal.h"
 
-net_nfc_error_e net_nfc_server_handover_default_server_start(
-                                       net_nfc_target_handle_s *handle);
+net_nfc_error_e net_nfc_server_handover_default_server_start(net_nfc_target_handle_s * handle);
 
-net_nfc_error_e net_nfc_server_handover_default_client_start(
-                                       net_nfc_target_handle_s *handle,
-                                       void *user_data);
+net_nfc_error_e net_nfc_server_handover_default_client_start(net_nfc_target_handle_s * handle, void *user_data);
 
 net_nfc_error_e net_nfc_server_handover_default_server_register();
 
 net_nfc_error_e net_nfc_server_handover_default_server_unregister();
 
-#endif //__NET_NFC_SERVER_PROCESS_HANDOVER_H__
+#endif                                                 //__NET_NFC_SERVER_PROCESS_HANDOVER_H__
index f68b53a..eeacf2e 100644 (file)
 #include "net_nfc_typedef.h"
 #include "net_nfc_typedef_internal.h"
 
-typedef void (*net_nfc_server_npp_callback) (net_nfc_error_e result,
-                                       data_s *data,
-                                       gpointer user_data);
-
-net_nfc_error_e net_nfc_server_npp_server(net_nfc_target_handle_s *handle,
-                                       char *san,
-                                       sap_t sap,
-                                       net_nfc_server_npp_callback callback,
-                                       gpointer user_data);
-
-net_nfc_error_e net_nfc_server_npp_client(net_nfc_target_handle_s *handle,
-                                       char *san,
-                                       sap_t sap,
-                                       data_s *data,
-                                       net_nfc_server_npp_callback callback,
-                                       gpointer user_data);
-
-net_nfc_error_e net_nfc_server_npp_default_server_start(
-                                       net_nfc_target_handle_s *handle);
-
-net_nfc_error_e net_nfc_server_npp_default_client_start(
-                                       net_nfc_target_handle_s *handle,
-                                       data_s *data,
-                                       int client,
-                                       gpointer user_data);
+typedef void (*net_nfc_server_npp_callback) (net_nfc_error_e result, data_s * data, gpointer user_data);
+
+net_nfc_error_e net_nfc_server_npp_server(net_nfc_target_handle_s * handle, char *san, sap_t sap, net_nfc_server_npp_callback callback, gpointer user_data);
+
+net_nfc_error_e net_nfc_server_npp_client(net_nfc_target_handle_s * handle, char *san, sap_t sap, data_s * data, net_nfc_server_npp_callback callback, gpointer user_data);
+
+net_nfc_error_e net_nfc_server_npp_default_server_start(net_nfc_target_handle_s * handle);
+
+net_nfc_error_e net_nfc_server_npp_default_client_start(net_nfc_target_handle_s * handle, data_s * data, int client, gpointer user_data);
 
 net_nfc_error_e net_nfc_server_npp_default_server_register();
 
 net_nfc_error_e net_nfc_server_npp_default_server_unregister();
 
-#endif //__NET_NFC_SERVER_PROCESS_NPP_H__
+#endif                                                 //__NET_NFC_SERVER_PROCESS_NPP_H__
index d9bd52c..116b350 100755 (executable)
 #include "net_nfc_gdbus.h"
 #include "net_nfc_typedef_internal.h"
 
-#define SNEP_SAN                       "urn:nfc:sn:snep"
+#define SNEP_SAN                       "urn:nfc:sn:snep"
 #define SNEP_SAP                       4
 
-typedef enum
-{
-       SNEP_REQ_CONTINUE               = 0x00,
-       SNEP_REQ_GET                    = 0x01,
-       SNEP_REQ_PUT                    = 0x02,
-       SNEP_REQ_REJECT                 = 0x7F,
-       SNEP_RESP_CONT                  = 0x80,
-       SNEP_RESP_SUCCESS               = 0x81,
-       SNEP_RESP_NOT_FOUND             = 0xC0,
-       SNEP_RESP_EXCESS_DATA           = 0xC1,
-       SNEP_RESP_BAD_REQ               = 0xC2,
-       SNEP_RESP_NOT_IMPLEMENT         = 0xE0,
-       SNEP_RESP_UNSUPPORTED_VER       = 0xE1,
-       SNEP_RESP_REJECT                = 0xFF,
+typedef enum {
+       SNEP_REQ_CONTINUE = 0x00,
+       SNEP_REQ_GET = 0x01,
+       SNEP_REQ_PUT = 0x02,
+       SNEP_REQ_REJECT = 0x7F,
+       SNEP_RESP_CONT = 0x80,
+       SNEP_RESP_SUCCESS = 0x81,
+       SNEP_RESP_NOT_FOUND = 0xC0,
+       SNEP_RESP_EXCESS_DATA = 0xC1,
+       SNEP_RESP_BAD_REQ = 0xC2,
+       SNEP_RESP_NOT_IMPLEMENT = 0xE0,
+       SNEP_RESP_UNSUPPORTED_VER = 0xE1,
+       SNEP_RESP_REJECT = 0xFF,
 } snep_command_field_e;
 
-typedef bool (*net_nfc_server_snep_listen_cb)(net_nfc_snep_handle_h handle,
-                       uint32_t type,
-                       uint32_t max_len,
-                       data_s *data,
-                       void *user_param);
-
-typedef net_nfc_error_e (*net_nfc_server_snep_cb)(net_nfc_snep_handle_h handle,
-                       net_nfc_error_e result,
-                       uint32_t type,
-                       data_s *data,
-                       void *user_param);
-
-net_nfc_error_e net_nfc_server_snep_server(
-                       net_nfc_target_handle_s *handle,
-                       const char *san,
-                       sap_t sap,
-                       net_nfc_server_snep_cb cb,
-                       void *user_param);
-
-net_nfc_error_e net_nfc_server_snep_client(
-                       net_nfc_target_handle_s *handle,
-                       const char *san,
-                       sap_t sap,
-                       net_nfc_server_snep_cb cb,
-                       void *user_param);
-
-net_nfc_error_e net_nfc_server_snep_server_send_get_response(
-                       net_nfc_snep_handle_h snep_handle,
-                       data_s *data);
-
-net_nfc_error_e net_nfc_server_snep_client_request(
-                       net_nfc_snep_handle_h snep,
-                       uint8_t type,
-                       data_s *data,
-                       net_nfc_server_snep_cb cb,
-                       void *user_param);
-
-net_nfc_error_e net_nfc_server_snep_default_server_start(
-                       net_nfc_target_handle_s *handle);
-
-net_nfc_error_e net_nfc_server_snep_default_client_start(
-                       net_nfc_target_handle_s *handle,
-                       int type,
-                       data_s *data,
-                       int client,
-                       void *user_param);
-
-net_nfc_error_e
-net_nfc_server_snep_default_server_register_get_response_cb(
-                       net_nfc_server_snep_listen_cb cb,
-                       void *user_param);
-
-net_nfc_error_e
-net_nfc_server_snep_default_server_unregister_get_response_cb(
-                       net_nfc_server_snep_listen_cb cb);
-
-net_nfc_error_e
-net_nfc_server_snep_default_server_send_get_response(
-                       net_nfc_snep_handle_h snep_handle,
-                       data_s *data);
+typedef bool(*net_nfc_server_snep_listen_cb) (net_nfc_snep_handle_h handle, uint32_t type, uint32_t max_len, data_s * data, void *user_param);
+
+typedef net_nfc_error_e(*net_nfc_server_snep_cb) (net_nfc_snep_handle_h handle, net_nfc_error_e result, uint32_t type, data_s * data, void *user_param);
+
+net_nfc_error_e net_nfc_server_snep_server(net_nfc_target_handle_s * handle, const char *san, sap_t sap, net_nfc_server_snep_cb cb, void *user_param);
+
+net_nfc_error_e net_nfc_server_snep_client(net_nfc_target_handle_s * handle, const char *san, sap_t sap, net_nfc_server_snep_cb cb, void *user_param);
+
+net_nfc_error_e net_nfc_server_snep_server_send_get_response(net_nfc_snep_handle_h snep_handle, data_s * data);
+
+net_nfc_error_e net_nfc_server_snep_client_request(net_nfc_snep_handle_h snep, uint8_t type, data_s * data, net_nfc_server_snep_cb cb, void *user_param);
+
+net_nfc_error_e net_nfc_server_snep_default_server_start(net_nfc_target_handle_s * handle);
+
+net_nfc_error_e net_nfc_server_snep_default_client_start(net_nfc_target_handle_s * handle, int type, data_s * data, int client, void *user_param);
+
+net_nfc_error_e net_nfc_server_snep_default_server_register_get_response_cb(net_nfc_server_snep_listen_cb cb, void *user_param);
+
+net_nfc_error_e net_nfc_server_snep_default_server_unregister_get_response_cb(net_nfc_server_snep_listen_cb cb);
+
+net_nfc_error_e net_nfc_server_snep_default_server_send_get_response(net_nfc_snep_handle_h snep_handle, data_s * data);
 
 net_nfc_error_e net_nfc_server_snep_default_server_register();
 
 net_nfc_error_e net_nfc_server_snep_default_server_unregister();
 
-net_nfc_error_e net_nfc_server_snep_parse_get_request(data_s *request,
-       size_t *max_len, data_s *message);
+net_nfc_error_e net_nfc_server_snep_parse_get_request(data_s * request, size_t * max_len, data_s * message);
 
-#endif //__NET_NFC_SERVER_PROCESS_SNEP_H__
\ No newline at end of file
+#endif                                                 //__NET_NFC_SERVER_PROCESS_SNEP_H__
index 7ddc95e..9f6f9d7 100755 (executable)
@@ -21,8 +21,7 @@
 
 #include "net_nfc_typedef_internal.h"
 
-typedef struct _aid_info_t
-{
+typedef struct _aid_info_t {
        net_nfc_se_type_e se_type;
        net_nfc_card_emulation_category_t category;
        bool is_routed;
@@ -30,53 +29,38 @@ typedef struct _aid_info_t
        bool unlock;
        int power;
        bool manifest;
-}
-aid_info_t;
+} aid_info_t;
 
-typedef struct _route_table_handler_t
-{
+typedef struct _route_table_handler_t {
        char *package;
        char *id;
        bool activated[NET_NFC_CARD_EMULATION_CATEGORY_MAX];
        GPtrArray *aids[NET_NFC_CARD_EMULATION_CATEGORY_MAX];
-}
-route_table_handler_t;
+} route_table_handler_t;
 
-typedef bool (*net_nfc_server_route_table_handler_iter_cb)(
-       const char *package, route_table_handler_t *handler, void *user_data);
+typedef bool(*net_nfc_server_route_table_handler_iter_cb) (const char *package, route_table_handler_t * handler, void *user_data);
 
-typedef bool (*net_nfc_server_route_table_aid_iter_cb)(
-       const char *package, route_table_handler_t *handler,
-       aid_info_t *aid, void *user_data);
+typedef bool(*net_nfc_server_route_table_aid_iter_cb) (const char *package, route_table_handler_t * handler, aid_info_t * aid, void *user_data);
 
 void net_nfc_server_route_table_init();
 void net_nfc_server_route_table_load_db();
 void net_nfc_server_route_table_deinit();
 
-void net_nfc_server_route_table_iterate_handler(
-       net_nfc_server_route_table_handler_iter_cb cb, void *user_data);
+void net_nfc_server_route_table_iterate_handler(net_nfc_server_route_table_handler_iter_cb cb, void *user_data);
 
-void net_nfc_server_route_table_iterate_handler_activated_last(
-       net_nfc_server_route_table_handler_iter_cb cb, void *user_data);
+void net_nfc_server_route_table_iterate_handler_activated_last(net_nfc_server_route_table_handler_iter_cb cb, void *user_data);
 
-route_table_handler_t *net_nfc_server_route_table_find_handler(
-       const char *package);
+route_table_handler_t *net_nfc_server_route_table_find_handler(const char *package);
 
-net_nfc_error_e net_nfc_server_route_table_add_handler(const char *id,
-       const char *package);
+net_nfc_error_e net_nfc_server_route_table_add_handler(const char *id, const char *package);
 
-net_nfc_error_e net_nfc_server_route_table_del_handler(const char *id,
-       const char *package, bool force);
+net_nfc_error_e net_nfc_server_route_table_del_handler(const char *id, const char *package, bool force);
 
-net_nfc_error_e net_nfc_server_route_table_update_handler_id(
-       const char *package, const char *id);
+net_nfc_error_e net_nfc_server_route_table_update_handler_id(const char *package, const char *id);
 
-net_nfc_error_e net_nfc_server_route_table_set_handler_activation(
-       const char *package, net_nfc_card_emulation_category_t category);
+net_nfc_error_e net_nfc_server_route_table_set_handler_activation(const char *package, net_nfc_card_emulation_category_t category);
 
-
-route_table_handler_t *net_nfc_server_route_table_find_handler_by_id(
-       const char *id);
+route_table_handler_t *net_nfc_server_route_table_find_handler_by_id(const char *id);
 
 net_nfc_error_e net_nfc_server_route_table_add_handler_by_id(const char *id);
 
@@ -84,79 +68,52 @@ net_nfc_error_e net_nfc_server_route_table_del_handler_by_id(const char *id);
 
 net_nfc_error_e net_nfc_server_route_table_set_handler_by_id(const char *id);
 
-net_nfc_error_e net_nfc_server_route_table_set_handler_activation_by_id(
-       const char *id, net_nfc_card_emulation_category_t category);
-
-
+net_nfc_error_e net_nfc_server_route_table_set_handler_activation_by_id(const char *id, net_nfc_card_emulation_category_t category);
 
-route_table_handler_t *net_nfc_server_route_table_find_handler_by_aid(
-       const char *aid);
+route_table_handler_t *net_nfc_server_route_table_find_handler_by_aid(const char *aid);
 
-aid_info_t *net_nfc_server_route_table_find_aid(const char *package,
-       const char *aid);
+aid_info_t *net_nfc_server_route_table_find_aid(const char *package, const char *aid);
 
-net_nfc_error_e net_nfc_server_route_table_add_aid(const char *id,
-       const char *package, net_nfc_se_type_e se_type,
-       net_nfc_card_emulation_category_t category,
-       const char *aid);
+net_nfc_error_e net_nfc_server_route_table_add_aid(const char *id, const char *package, net_nfc_se_type_e se_type, net_nfc_card_emulation_category_t category, const char *aid);
 
-net_nfc_error_e net_nfc_server_route_table_del_aid(const char *id, const char *package,
-       const char *aid, bool force);
+net_nfc_error_e net_nfc_server_route_table_del_aid(const char *id, const char *package, const char *aid, bool force);
 
-net_nfc_error_e net_nfc_server_route_table_del_aids(const char *id, const char *package,
-       bool force);
+net_nfc_error_e net_nfc_server_route_table_del_aids(const char *id, const char *package, bool force);
 
-void net_nfc_server_route_table_iterate_aids(
-       net_nfc_server_route_table_aid_iter_cb cb, void *user_data);
+void net_nfc_server_route_table_iterate_aids(net_nfc_server_route_table_aid_iter_cb cb, void *user_data);
 
-void net_nfc_server_route_table_iterate_handler_aids(const char *package,
-       net_nfc_server_route_table_aid_iter_cb cb, void *user_data);
+void net_nfc_server_route_table_iterate_handler_aids(const char *package, net_nfc_server_route_table_aid_iter_cb cb, void *user_data);
 
-aid_info_t *net_nfc_server_route_table_find_aid_by_id(const char *package,
-       const char *aid);
+aid_info_t *net_nfc_server_route_table_find_aid_by_id(const char *package, const char *aid);
 
-net_nfc_error_e net_nfc_server_route_table_add_aid_by_id(const char *id,
-       net_nfc_se_type_e se_type,
-       net_nfc_card_emulation_category_t category,
-       const char *aid);
+net_nfc_error_e net_nfc_server_route_table_add_aid_by_id(const char *id, net_nfc_se_type_e se_type, net_nfc_card_emulation_category_t category, const char *aid);
 
-net_nfc_error_e net_nfc_server_route_table_del_aid_by_id(const char *id,
-       const char *aid, bool force);
+net_nfc_error_e net_nfc_server_route_table_del_aid_by_id(const char *id, const char *aid, bool force);
 
-void net_nfc_server_route_table_iterate_aids_by_id(const char *id,
-       net_nfc_server_route_table_aid_iter_cb cb, void *user_data);
+void net_nfc_server_route_table_iterate_aids_by_id(const char *id, net_nfc_server_route_table_aid_iter_cb cb, void *user_data);
 
+net_nfc_error_e net_nfc_server_route_table_insert_aid_into_db(const char *package, net_nfc_se_type_e se_type, net_nfc_card_emulation_category_t category, const char *aid, bool unlock, int power);
 
-net_nfc_error_e net_nfc_server_route_table_insert_aid_into_db(
-       const char *package, net_nfc_se_type_e se_type,
-       net_nfc_card_emulation_category_t category,
-       const char *aid, bool unlock, int power);
+net_nfc_error_e net_nfc_server_route_table_delete_aid_from_db(const char *package, const char *aid);
 
-net_nfc_error_e net_nfc_server_route_table_delete_aid_from_db(
-       const char *package, const char *aid);
+net_nfc_error_e net_nfc_server_route_table_delete_aids_from_db(const char *package);
 
-net_nfc_error_e net_nfc_server_route_table_delete_aids_from_db(
-       const char *package);
-
-void net_nfc_server_route_table_update_category_handler(const char *package,
-       net_nfc_card_emulation_category_t category);
+void net_nfc_server_route_table_update_category_handler(const char *package, net_nfc_card_emulation_category_t category);
 
 net_nfc_error_e net_nfc_server_route_table_do_update(bool routing);
 
-
-net_nfc_error_e net_nfc_server_route_table_get_storage_info(
-       net_nfc_card_emulation_category_t category, int *used, int *max);
+net_nfc_error_e net_nfc_server_route_table_get_storage_info(net_nfc_card_emulation_category_t category, int *used, int *max);
 
 route_table_handler_t *net_nfc_server_route_table_get_preferred_handler();
 
-void net_nfc_server_route_table_set_preferred_handler(route_table_handler_t *handler);
+void net_nfc_server_route_table_set_preferred_handler(route_table_handler_t * handler);
 
 net_nfc_error_e net_nfc_server_route_table_update_preferred_handler();
 
-bool net_nfc_server_route_table_is_allowed_preferred_handler(route_table_handler_t *data);
+bool net_nfc_server_route_table_is_allowed_preferred_handler(route_table_handler_t * data);
 
-void net_nfc_server_route_table_unset_preferred_handler_by_id(const charid);
+void net_nfc_server_route_table_unset_preferred_handler_by_id(const char *id);
 
 void net_nfc_server_route_table_preferred_handler_dump();
 
-#endif //__NET_NFC_SERVER_ROUTE_TABLE_H__
+#endif                                                 //__NET_NFC_SERVER_ROUTE_TABLE_H__
index ca4faae..15f6e57 100644 (file)
@@ -21,7 +21,6 @@
 
 #include "net_nfc_typedef_internal.h"
 
-
 /***************************************************************/
 
 net_nfc_se_type_e net_nfc_server_se_get_se_type();
@@ -30,26 +29,19 @@ net_nfc_error_e net_nfc_server_se_set_se_type(net_nfc_se_type_e type);
 
 net_nfc_card_emulation_mode_t net_nfc_server_se_get_se_state();
 
-net_nfc_error_e net_nfc_server_se_set_se_state(
-       net_nfc_card_emulation_mode_t state);
+net_nfc_error_e net_nfc_server_se_set_se_state(net_nfc_card_emulation_mode_t state);
 #if 0
-net_nfc_error_e net_nfc_server_se_set_se_policy(
-       net_nfc_secure_element_policy_e policy);
+net_nfc_error_e net_nfc_server_se_set_se_policy(net_nfc_secure_element_policy_e policy);
 #endif
 net_nfc_error_e net_nfc_server_se_apply_se_current_policy();
 
-net_nfc_error_e net_nfc_server_se_apply_se_policy(
-       net_nfc_secure_element_policy_e policy);
-
-net_nfc_error_e net_nfc_server_se_change_wallet_mode(
-       net_nfc_wallet_mode_e wallet_mode);
-
-
+net_nfc_error_e net_nfc_server_se_apply_se_policy(net_nfc_secure_element_policy_e policy);
 
+net_nfc_error_e net_nfc_server_se_change_wallet_mode(net_nfc_wallet_mode_e wallet_mode);
 
 /***************************************************************/
 
-gboolean net_nfc_server_se_init(GDBusConnection *connection);
+gboolean net_nfc_server_se_init(GDBusConnection * connection);
 
 void net_nfc_server_se_deinit(void);
 
@@ -65,12 +57,10 @@ void net_nfc_server_se_connected(void *info);
 
 bool net_nfc_server_se_notify_lcd_state_changed(net_nfc_screen_state_type_e state);
 
-void net_nfc_server_se_convert_to_binary(uint8_t *orig, size_t len,
-       uint8_t **dest, size_t *destLen);
+void net_nfc_server_se_convert_to_binary(uint8_t * orig, size_t len, uint8_t ** dest, size_t * destLen);
 
-void net_nfc_server_se_create_deactivate_apdu_command(uint8_t *orig, uint8_t **dest, size_t *destLen);
+void net_nfc_server_se_create_deactivate_apdu_command(uint8_t * orig, uint8_t ** dest, size_t * destLen);
 
 void net_nfc_server_se_deactivate_card(void);
 
-
-#endif //__NET_NFC_SERVER_SE_H__
+#endif                                                 //__NET_NFC_SERVER_SE_H__
index c868fb7..6704f58 100644 (file)
@@ -19,8 +19,8 @@
 #include "net_nfc_gdbus.h"
 #include "net_nfc_typedef_internal.h"
 
-gboolean net_nfc_server_snep_init(GDBusConnection *connection);
+gboolean net_nfc_server_snep_init(GDBusConnection * connection);
 
 void net_nfc_server_snep_deinit(void);
 
-#endif //__NET_NFC_SERVER_SNEP_H__
+#endif                                                 //__NET_NFC_SERVER_SNEP_H__
index a0c3963..2bb2e32 100644 (file)
@@ -19,8 +19,8 @@
 
 #include <gio/gio.h>
 
-gboolean net_nfc_server_system_handler_init(GDBusConnection *connection);
+gboolean net_nfc_server_system_handler_init(GDBusConnection * connection);
 
 void net_nfc_server_system_handler_deinit(void);
 
-#endif //__NET_NFC_SERVER_SYSTEM_HANDLER_H__
+#endif                                                 //__NET_NFC_SERVER_SYSTEM_HANDLER_H__
index a81d294..ce115d7 100755 (executable)
 
 #include "net_nfc_typedef_internal.h"
 
-gboolean net_nfc_server_tag_init(GDBusConnection *connection);
+gboolean net_nfc_server_tag_init(GDBusConnection * connection);
 
 void net_nfc_server_tag_deinit(void);
 
-void net_nfc_server_set_target_info(net_nfc_current_target_info_s *info);
+void net_nfc_server_set_target_info(net_nfc_current_target_info_s * info);
 
 net_nfc_current_target_info_s *net_nfc_server_get_target_info(void);
 
@@ -36,4 +36,4 @@ void net_nfc_server_free_target_info(void);
 
 bool net_nfc_server_tag_target_detected(void *info);
 
-#endif //__NET_NFC_SERVER_TAG_H__
+#endif                                                 //__NET_NFC_SERVER_TAG_H__
index bbffc8d..ec5d577 100644 (file)
@@ -18,8 +18,8 @@
 
 #include <gio/gio.h>
 
-gboolean net_nfc_server_test_init(GDBusConnection *connection);
+gboolean net_nfc_server_test_init(GDBusConnection * connection);
 
 void net_nfc_server_test_deinit(void);
 
-#endif //__NET_NFC_SERVER_TEST_H__
\ No newline at end of file
+#endif                                                 //__NET_NFC_SERVER_TEST_H__
index 0c0d6b0..e8d9b4c 100644 (file)
@@ -19,8 +19,8 @@
 
 #include <gio/gio.h>
 
-gboolean net_nfc_server_transceive_init(GDBusConnection *connection);
+gboolean net_nfc_server_transceive_init(GDBusConnection * connection);
 
 void net_nfc_server_transceive_deinit(void);
 
-#endif //__NET_NFC_SERVER_TRANSCEIVE_H__
+#endif                                                 //__NET_NFC_SERVER_TRANSCEIVE_H__
index a9a96d0..bcc36a2 100755 (executable)
@@ -24,4 +24,4 @@ bool net_nfc_check_start_polling_vconf(void);
 
 void net_nfc_server_vconf_set_screen_on_flag(bool flag);
 
-#endif //__NET_NFC_SERVER_VCONF_H__
+#endif                                                 //__NET_NFC_SERVER_VCONF_H__
index 37b6823..acccf62 100755 (executable)
@@ -14,7 +14,6 @@
   * limitations under the License.
   */
 
-
 #include <dirent.h>
 #include <pwd.h>
 #include <grp.h>
 #define OSP_K_COND_TYPE                "nfc"
 #define OSP_K_LAUNCH_TYPE      "__OSP_LAUNCH_TYPE__"
 
-static bool _net_nfc_app_util_get_operation_from_record(ndef_record_s *record, char *operation, size_t length);
-static bool _net_nfc_app_util_get_mime_from_record(ndef_record_s *record, char *mime, size_t length);
+static bool _net_nfc_app_util_get_operation_from_record(ndef_record_s * record, char *operation, size_t length);
+static bool _net_nfc_app_util_get_mime_from_record(ndef_record_s * record, char *mime, size_t length);
 #ifdef USE_FULL_URI
-static bool _net_nfc_app_util_get_uri_from_record(ndef_record_s *record, char *uri, size_t length);
+static bool _net_nfc_app_util_get_uri_from_record(ndef_record_s * record, char *uri, size_t length);
 #endif
-static bool _net_nfc_app_util_get_data_from_record(ndef_record_s *record, char *data, size_t length);
+static bool _net_nfc_app_util_get_data_from_record(ndef_record_s * record, char *data, size_t length);
 
 static const char osp_launch_type_condition[] = "condition";
 
-typedef net_nfc_error_e (*process_message_cb)(ndef_message_s *msg);
+typedef net_nfc_error_e(*process_message_cb) (ndef_message_s * msg);
 
 /* TEMP : process handover message */
-static void _process_carrier_record_cb(net_nfc_error_e result,
-       net_nfc_conn_handover_carrier_type_e type,
-       data_s *data, void *user_param)
+static void _process_carrier_record_cb(net_nfc_error_e result, net_nfc_conn_handover_carrier_type_e type, data_s * data, void *user_param)
 {
-       data_s *message = (data_s *)user_param;
+       data_s *message = (data_s *) user_param;
 
        if (result == NET_NFC_OK)
-       {
                DEBUG_SERVER_MSG("process carrier record success");
-       }
        else
-       {
                DEBUG_ERR_MSG("net_nfc_service_handover_bt_process_carrier_record failed, [%d]", result);
-       }
 
        net_nfc_server_handover_emit_finished_signal(result, type, data, message);
 
        net_nfc_util_free_data(message);
 }
 
-static net_nfc_error_e __process_ch_message(net_nfc_ch_message_s *message,
-       data_s *data)
+static net_nfc_error_e __process_ch_message(net_nfc_ch_message_s * message, data_s * data)
 {
        net_nfc_error_e result;
        uint32_t count;
        int i;
 
        result = net_nfc_util_get_handover_carrier_count(message, &count);
-       if (result == NET_NFC_OK)
-       {
+       if (result == NET_NFC_OK) {
                net_nfc_ch_carrier_s *carrier = NULL;
                net_nfc_conn_handover_carrier_type_e type;
 
-               for (i = 0; i < count; i++)
-               {
+               for (i = 0; i < count; i++) {
                        /* TODO : apply select order */
-                       result = net_nfc_util_get_handover_carrier(message, i,
-                               &carrier);
+                       result = net_nfc_util_get_handover_carrier(message, i, &carrier);
 
-                       result = net_nfc_util_get_handover_carrier_type(carrier,
-                               &type);
-                       if (result == NET_NFC_OK)
-                       {
+                       result = net_nfc_util_get_handover_carrier_type(carrier, &type);
+                       if (result == NET_NFC_OK) {
                                DEBUG_SERVER_MSG("selected carrier type = [%d]", type);
                                break;
-                       }
-                       else
-                       {
+                       } else {
                                carrier = NULL;
                        }
                }
 
-               if (carrier != NULL)
-               {
+               if (carrier != NULL) {
                        data_s *temp;
 
-                       if (type == NET_NFC_CONN_HANDOVER_CARRIER_BT)
-                       {
+                       if (type == NET_NFC_CONN_HANDOVER_CARRIER_BT) {
                                temp = net_nfc_util_duplicate_data(data);
 
                                net_nfc_server_handover_emit_started_signal(NULL, temp);
 
-                               net_nfc_server_handover_bt_do_pairing(
-                                       carrier,
-                                       _process_carrier_record_cb,
-                                       temp);
-                       }
-                       else if (type == NET_NFC_CONN_HANDOVER_CARRIER_WIFI_WPS)
-                       {
+                               net_nfc_server_handover_bt_do_pairing(carrier, _process_carrier_record_cb, temp);
+                       } else if (type == NET_NFC_CONN_HANDOVER_CARRIER_WIFI_WPS) {
                                temp = net_nfc_util_duplicate_data(data);
 
                                net_nfc_server_handover_emit_started_signal(NULL, temp);
 
-                               net_nfc_server_handover_wps_do_connect(
-                                       carrier,
-                                       _process_carrier_record_cb,
-                                       temp);
-                       }
-                       else if (type == NET_NFC_CONN_HANDOVER_CARRIER_WIFI_P2P)/*WIFI-DIRECT*/
-                       {
+                               net_nfc_server_handover_wps_do_connect(carrier, _process_carrier_record_cb, temp);
+                       } else if (type == NET_NFC_CONN_HANDOVER_CARRIER_WIFI_P2P) {    /*WIFI-DIRECT */
                                temp = net_nfc_util_duplicate_data(data);
 
                                net_nfc_server_handover_emit_started_signal(NULL, temp);
 
-                               /*Implement to connct with wifi direct*/
-                               net_nfc_server_handover_wfd_do_pairing(
-                                       carrier,
-                                       _process_carrier_record_cb,
-                                       temp);
+                               /*Implement to connct with wifi direct */
+                               net_nfc_server_handover_wfd_do_pairing(carrier, _process_carrier_record_cb, temp);
                        }
                }
-       }
-       else
-       {
+       } else {
                DEBUG_ERR_MSG("net_nfc_util_get_handover_carrier_count failed [%d]", result);
        }
 
        return result;
 }
 
-static net_nfc_error_e __process_handover_message(ndef_message_s *message)
+static net_nfc_error_e __process_handover_message(ndef_message_s * message)
 {
        net_nfc_ch_message_s *msg = NULL;
        net_nfc_error_e result;
@@ -205,23 +173,21 @@ static net_nfc_error_e __process_handover_message(ndef_message_s *message)
        data_s data = { NULL, 0 };
        size_t length = net_nfc_util_get_ndef_message_length(message);
 
-       if (net_nfc_util_init_data(&data, length) == true) {
+       if (net_nfc_util_init_data(&data, length) == true)
                net_nfc_util_convert_ndef_message_to_rawdata(message, &data);
-       }
 
        result = __process_ch_message(msg, &data);
 
        net_nfc_util_clear_data(&data);
 
-END :
-       if (msg != NULL) {
+ END:
+       if (msg != NULL)
                net_nfc_util_free_handover_message(msg);
-       }
 
        return result;
 }
 
-static net_nfc_error_e __process_normal_message(ndef_message_s *msg)
+static net_nfc_error_e __process_normal_message(ndef_message_s * msg)
 {
        net_nfc_error_e result;
        char operation[2048] = { 0, };
@@ -233,37 +199,32 @@ static net_nfc_error_e __process_normal_message(ndef_message_s *msg)
        int ret;
 
        /* check state of launch popup */
-       if (net_nfc_app_util_check_launch_state() == TRUE)
-       {
+       if (net_nfc_app_util_check_launch_state() == TRUE) {
                DEBUG_SERVER_MSG("skip launch popup!!!");
                result = NET_NFC_OK;
                goto END;
        }
 
-       if (_net_nfc_app_util_get_operation_from_record(msg->records, operation, sizeof(operation)) == FALSE)
-       {
+       if (_net_nfc_app_util_get_operation_from_record(msg->records, operation, sizeof(operation)) == FALSE) {
                DEBUG_ERR_MSG("_net_nfc_app_util_get_operation_from_record failed");
                result = NET_NFC_UNKNOWN_ERROR;
                goto END;
        }
 
-       if (_net_nfc_app_util_get_mime_from_record(msg->records, mime, sizeof(mime)) == FALSE)
-       {
+       if (_net_nfc_app_util_get_mime_from_record(msg->records, mime, sizeof(mime)) == FALSE) {
                DEBUG_ERR_MSG("_net_nfc_app_util_get_mime_from_record failed");
                result = NET_NFC_UNKNOWN_ERROR;
                goto END;
        }
 #ifdef USE_FULL_URI
-       if (_net_nfc_app_util_get_uri_from_record(msg->records, uri, sizeof(uri)) == FALSE)
-       {
+       if (_net_nfc_app_util_get_uri_from_record(msg->records, uri, sizeof(uri)) == FALSE) {
                DEBUG_ERR_MSG("_net_nfc_app_util_get_uri_from_record failed");
                result = NET_NFC_UNKNOWN_ERROR;
                goto END;
        }
 #endif
        /* launch appsvc */
-       if (_net_nfc_app_util_get_data_from_record(msg->records, text, sizeof(text)) == FALSE)
-       {
+       if (_net_nfc_app_util_get_data_from_record(msg->records, text, sizeof(text)) == FALSE) {
                DEBUG_ERR_MSG("_net_nfc_app_util_get_data_from_record failed");
                result = NET_NFC_UNKNOWN_ERROR;
                goto END;
@@ -273,14 +234,12 @@ static net_nfc_error_e __process_normal_message(ndef_message_s *msg)
        DEBUG_SERVER_MSG("net_nfc_app_util_appsvc_launch return %d", ret);
 #if 1
        if ((ret == APPSVC_RET_ENOMATCH) || (ret == APPSVC_RET_EINVAL))
-       {
                net_nfc_app_util_show_notification(IDS_SIGNAL_2, NULL);
-       }
 #endif
 
        result = NET_NFC_OK;
 
-END :
+ END:
        return result;
 }
 
@@ -290,36 +249,32 @@ static process_message_cb message_handlers[] = {
        NULL
 };
 
-net_nfc_error_e net_nfc_app_util_process_ndef(data_s *data)
+net_nfc_error_e net_nfc_app_util_process_ndef(data_s * data)
 {
        net_nfc_error_e result = NET_NFC_UNKNOWN_ERROR;
        ndef_message_s *msg = NULL;
        int i = 0;
 
-       if (data == NULL || data->buffer == NULL || data->length == 0)
-       {
+       if (data == NULL || data->buffer == NULL || data->length == 0) {
                DEBUG_ERR_MSG("net_nfc_app_util_process_ndef NET_NFC_NULL_PARAMETER");
                return NET_NFC_NULL_PARAMETER;
        }
 
        /* create file */
        result = net_nfc_app_util_store_ndef_message(data);
-       if (result != NET_NFC_OK)
-       {
+       if (result != NET_NFC_OK) {
                DEBUG_ERR_MSG("net_nfc_app_util_store_ndef_message failed [%d]", result);
                return result;
        }
 
-       if (net_nfc_util_create_ndef_message(&msg) != NET_NFC_OK)
-       {
+       if (net_nfc_util_create_ndef_message(&msg) != NET_NFC_OK) {
                DEBUG_ERR_MSG("memory alloc fail..");
                return NET_NFC_ALLOC_FAIL;
        }
 
        /* parse ndef message and fill appsvc data */
        result = net_nfc_util_convert_rawdata_to_ndef_message(data, msg);
-       if (result != NET_NFC_OK)
-       {
+       if (result != NET_NFC_OK) {
                DEBUG_ERR_MSG("net_nfc_util_convert_rawdata_to_ndef_message failed [%d]", result);
                goto ERROR;
        }
@@ -327,19 +282,18 @@ net_nfc_error_e net_nfc_app_util_process_ndef(data_s *data)
        result = NET_NFC_INVALID_FORMAT;
 
        for (i = 0; message_handlers[i] != NULL; i++) {
-               result = message_handlers[i](msg);
-               if (result != NET_NFC_INVALID_FORMAT) {
+               result = message_handlers[i] (msg);
+               if (result != NET_NFC_INVALID_FORMAT)
                        break;
-               }
        }
 
-ERROR :
+ ERROR:
        net_nfc_util_free_ndef_message(msg);
 
        return result;
 }
 
-bool _net_nfc_app_util_change_file_owner_permission(FILE *file)
+bool _net_nfc_app_util_change_file_owner_permission(FILE * file)
 {
        char *buffer = NULL;
        size_t buffer_len = 0;
@@ -358,9 +312,7 @@ bool _net_nfc_app_util_change_file_owner_permission(FILE *file)
        /* get passwd id */
        buffer_len = sysconf(_SC_GETPW_R_SIZE_MAX);
        if (buffer_len == -1)
-       {
                buffer_len = 16384;
-       }
 
        _net_nfc_util_alloc_mem(buffer, buffer_len);
        if (buffer == NULL)
@@ -372,9 +324,7 @@ bool _net_nfc_app_util_change_file_owner_permission(FILE *file)
        /* get group id */
        buffer_len = sysconf(_SC_GETGR_R_SIZE_MAX);
        if (buffer_len == -1)
-       {
                buffer_len = 16384;
-       }
 
        _net_nfc_util_alloc_mem(buffer, buffer_len);
        if (buffer == NULL)
@@ -383,41 +333,33 @@ bool _net_nfc_app_util_change_file_owner_permission(FILE *file)
        getgrnam_r("inhouse", &grp, buffer, buffer_len, &gr_inhouse);
        _net_nfc_util_free_mem(buffer);
 
-       if ((pw_inhouse != NULL) && (gr_inhouse != NULL))
-       {
+       if ((pw_inhouse != NULL) && (gr_inhouse != NULL)) {
                if (fchown(fileno(file), pw_inhouse->pw_uid, gr_inhouse->gr_gid) < 0)
-               {
                        DEBUG_ERR_MSG("failed to change owner");
-               }
        }
 
        return true;
 }
 
-net_nfc_error_e net_nfc_app_util_store_ndef_message(data_s *data)
+net_nfc_error_e net_nfc_app_util_store_ndef_message(data_s * data)
 {
        net_nfc_error_e result = NET_NFC_UNKNOWN_ERROR;
        char file_name[1024] = { 0, };
        FILE *fp = NULL;
 
        if (data == NULL)
-       {
                return NET_NFC_NULL_PARAMETER;
-       }
 
        /* create file */
-       snprintf(file_name, sizeof(file_name), "%s/%s/%s", NET_NFC_MANAGER_DATA_PATH,
-               NET_NFC_MANAGER_DATA_PATH_MESSAGE, NET_NFC_MANAGER_NDEF_FILE_NAME);
+       snprintf(file_name, sizeof(file_name), "%s/%s/%s", NET_NFC_MANAGER_DATA_PATH, NET_NFC_MANAGER_DATA_PATH_MESSAGE, NET_NFC_MANAGER_NDEF_FILE_NAME);
        SECURE_LOGD("file path : %s", file_name);
 
        unlink(file_name);
 
-       if ((fp = fopen(file_name, "w")) != NULL)
-       {
+       if ((fp = fopen(file_name, "w")) != NULL) {
                int length = 0;
 
-               if ((length = fwrite(data->buffer, 1, data->length, fp)) > 0)
-               {
+               if ((length = fwrite(data->buffer, 1, data->length, fp)) > 0) {
                        DEBUG_SERVER_MSG("[%d] bytes is written", length);
 
                        _net_nfc_app_util_change_file_owner_permission(fp);
@@ -426,9 +368,7 @@ net_nfc_error_e net_nfc_app_util_store_ndef_message(data_s *data)
                        fsync(fileno(fp));
 
                        result = NET_NFC_OK;
-               }
-               else
-               {
+               } else {
                        DEBUG_ERR_MSG("write is failed = [%d]", data->length);
                        result = NET_NFC_UNKNOWN_ERROR;
                }
@@ -439,54 +379,39 @@ net_nfc_error_e net_nfc_app_util_store_ndef_message(data_s *data)
        return result;
 }
 
-bool net_nfc_app_util_is_dir(const charpath_name)
+bool net_nfc_app_util_is_dir(const char *path_name)
 {
        struct stat statbuf = { 0 };
 
        if (stat(path_name, &statbuf) == -1)
-       {
                return false;
-       }
 
        if (S_ISDIR(statbuf.st_mode) != 0)
-       {
                return true;
-       }
        else
-       {
                return false;
-       }
 }
 
-void net_nfc_app_util_clean_storage(charsrc_path)
+void net_nfc_app_util_clean_storage(char *src_path)
 {
-       struct direntent = NULL;
-       DIRdir = NULL;
+       struct dirent *ent = NULL;
+       DIR *dir = NULL;
 
        char path[1024] = { 0 };
 
        if ((dir = opendir(src_path)) == NULL)
-       {
                return;
-       }
 
-       while ((ent = readdir(dir)) != NULL)
-       {
-               if (strncmp(ent->d_name, ".", 1) == 0 || strncmp(ent->d_name, "..", 2) == 0)
-               {
+       while ((ent = readdir(dir)) != NULL) {
+               if (strncmp(ent->d_name, ".", 1) == 0 || strncmp(ent->d_name, "..", 2) == 0) {
                        continue;
-               }
-               else
-               {
+               } else {
                        snprintf(path, 1024, "%s/%s", src_path, ent->d_name);
 
-                       if (net_nfc_app_util_is_dir(path) != false)
-                       {
+                       if (net_nfc_app_util_is_dir(path) != false) {
                                net_nfc_app_util_clean_storage(path);
                                rmdir(path);
-                       }
-                       else
-                       {
+                       } else {
                                unlink(path);
                        }
                }
@@ -499,8 +424,7 @@ void net_nfc_app_util_clean_storage(char* src_path)
 
 static void _to_lower_utf_8(char *str)
 {
-       while (*str != 0)
-       {
+       while (*str != 0) {
                if (*str >= 'A' && *str <= 'Z')
                        *str += ('a' - 'A');
 
@@ -513,46 +437,42 @@ static void _to_lower(int type, char *str)
        _to_lower_utf_8(str);
 }
 
-static bool _net_nfc_app_util_get_operation_from_record(ndef_record_s *record, char *operation, size_t length)
+static bool _net_nfc_app_util_get_operation_from_record(ndef_record_s * record, char *operation, size_t length)
 {
        bool result = false;
        char *op_text = NULL;
 
        if (record == NULL || operation == NULL || length == 0)
-       {
                return result;
-       }
 
-       switch (record->TNF)
-       {
-       case NET_NFC_RECORD_WELL_KNOWN_TYPE :
+       switch (record->TNF) {
+       case NET_NFC_RECORD_WELL_KNOWN_TYPE:
                op_text = "http://tizen.org/appcontrol/operation/nfc/wellknown";
                break;
 
-       case NET_NFC_RECORD_MIME_TYPE :
+       case NET_NFC_RECORD_MIME_TYPE:
                op_text = "http://tizen.org/appcontrol/operation/nfc/mime";
                break;
 
-       case NET_NFC_RECORD_URI : /* Absolute URI */
+       case NET_NFC_RECORD_URI:        /* Absolute URI */
                op_text = "http://tizen.org/appcontrol/operation/nfc/uri";
                break;
 
-       case NET_NFC_RECORD_EXTERNAL_RTD : /* external type */
+       case NET_NFC_RECORD_EXTERNAL_RTD:       /* external type */
                op_text = "http://tizen.org/appcontrol/operation/nfc/external";
                break;
 
-       case NET_NFC_RECORD_EMPTY : /* empty_tag */
+       case NET_NFC_RECORD_EMPTY:      /* empty_tag */
                op_text = "http://tizen.org/appcontrol/operation/nfc/empty";
                break;
 
-       case NET_NFC_RECORD_UNKNOWN : /* unknown msg. discard it */
-       case NET_NFC_RECORD_UNCHAGNED : /* RFU msg. discard it */
-       default :
+       case NET_NFC_RECORD_UNKNOWN:    /* unknown msg. discard it */
+       case NET_NFC_RECORD_UNCHAGNED /* RFU msg. discard it */
+       default:
                break;
        }
 
-       if (op_text != NULL)
-       {
+       if (op_text != NULL) {
                snprintf(operation, length, "%s", op_text);
                result = TRUE;
        }
@@ -560,32 +480,24 @@ static bool _net_nfc_app_util_get_operation_from_record(ndef_record_s *record, c
        return result;
 }
 
-static bool _net_nfc_app_util_get_mime_from_record(ndef_record_s *record, char *mime, size_t length)
+static bool _net_nfc_app_util_get_mime_from_record(ndef_record_s * record, char *mime, size_t length)
 {
        bool result = false;
 
        if (record == NULL || mime == NULL || length == 0)
-       {
                return result;
-       }
 
-       switch (record->TNF)
-       {
-       case NET_NFC_RECORD_WELL_KNOWN_TYPE :
+       switch (record->TNF) {
+       case NET_NFC_RECORD_WELL_KNOWN_TYPE:
                {
-                       if (record->type_s.buffer == NULL || record->type_s.length == 0 ||
-                               record->payload_s.buffer == NULL || record->payload_s.length == 0)
-                       {
+                       if (record->type_s.buffer == NULL || record->type_s.length == 0 || record->payload_s.buffer == NULL || record->payload_s.length == 0) {
                                DEBUG_ERR_MSG("Broken NDEF Message [NET_NFC_RECORD_WELL_KNOWN_TYPE]");
                                break;
                        }
 
-                       if (record->type_s.length == 1 && record->type_s.buffer[0] == 'U')
-                       {
+                       if (record->type_s.length == 1 && record->type_s.buffer[0] == 'U') {
                                snprintf(mime, length, "U/0x%02x", record->payload_s.buffer[0]);
-                       }
-                       else
-                       {
+                       } else {
                                if (length < record->type_s.length + 4) {
                                        DEBUG_ERR_MSG("mime Data Error: mime[%d], record[%d]+4", length, record->type_s.length);
                                        break;
@@ -603,22 +515,20 @@ static bool _net_nfc_app_util_get_mime_from_record(ndef_record_s *record, char *
                }
                break;
 
-       case NET_NFC_RECORD_MIME_TYPE :
+       case NET_NFC_RECORD_MIME_TYPE:
                {
                        char *token = NULL;
                        char *buffer = NULL;
                        int len = 0;
 
-                       if (record->type_s.buffer == NULL || record->type_s.length == 0)
-                       {
+                       if (record->type_s.buffer == NULL || record->type_s.length == 0) {
                                DEBUG_ERR_MSG("Broken NDEF Message [NET_NFC_RECORD_MIME_TYPE]");
                                break;
                        }
 
                        /* get mime type */
                        _net_nfc_util_alloc_mem(buffer, record->type_s.length + 1);
-                       if (buffer == NULL)
-                       {
+                       if (buffer == NULL) {
                                DEBUG_ERR_MSG("_net_nfc_manager_util_alloc_mem return NULL");
                                break;
                        }
@@ -627,13 +537,10 @@ static bool _net_nfc_app_util_get_mime_from_record(ndef_record_s *record, char *
                        //DEBUG_SERVER_MSG("NET_NFC_RECORD_MIME_TYPE type [%s]", buffer);
 
                        token = strchr(buffer, ';');
-                       if (token != NULL)
-                       {
+                       if (token != NULL) {
                                //DEBUG_SERVER_MSG("token = strchr(buffer, ';') != NULL, len [%d]", token - buffer);
                                len = MIN(token - buffer, length - 1);
-                       }
-                       else
-                       {
+                       } else {
                                len = MIN(strlen(buffer), length - 1);
                        }
 
@@ -652,15 +559,15 @@ static bool _net_nfc_app_util_get_mime_from_record(ndef_record_s *record, char *
                }
                break;
 
-       case NET_NFC_RECORD_URI : /* Absolute URI */
-       case NET_NFC_RECORD_EXTERNAL_RTD : /* external type */
-       case NET_NFC_RECORD_EMPTY :  /* empty_tag */
+       case NET_NFC_RECORD_URI:        /* Absolute URI */
+       case NET_NFC_RECORD_EXTERNAL_RTD:       /* external type */
+       case NET_NFC_RECORD_EMPTY:      /* empty_tag */
                result = true;
                break;
 
-       case NET_NFC_RECORD_UNKNOWN : /* unknown msg. discard it */
-       case NET_NFC_RECORD_UNCHAGNED : /* RFU msg. discard it */
-       default :
+       case NET_NFC_RECORD_UNKNOWN:    /* unknown msg. discard it */
+       case NET_NFC_RECORD_UNCHAGNED /* RFU msg. discard it */
+       default:
                break;
        }
 
@@ -668,25 +575,20 @@ static bool _net_nfc_app_util_get_mime_from_record(ndef_record_s *record, char *
 }
 
 #ifdef USE_FULL_URI
-static bool _net_nfc_app_util_get_uri_from_record(ndef_record_s *record, char *data, size_t length)
+static bool _net_nfc_app_util_get_uri_from_record(ndef_record_s * record, char *data, size_t length)
 {
        bool result = false;
 
        if (record == NULL || data == NULL || length == 0)
-       {
                return result;
-       }
 
-       switch (record->TNF)
-       {
-       case NET_NFC_RECORD_WELL_KNOWN_TYPE :
-       case NET_NFC_RECORD_URI : /* Absolute URI */
+       switch (record->TNF) {
+       case NET_NFC_RECORD_WELL_KNOWN_TYPE:
+       case NET_NFC_RECORD_URI:        /* Absolute URI */
                {
                        char *uri = NULL;
 
-                       if (net_nfc_util_create_uri_string_from_uri_record(record, &uri) == NET_NFC_OK &&
-                               uri != NULL)
-                       {
+                       if (net_nfc_util_create_uri_string_from_uri_record(record, &uri) == NET_NFC_OK && uri != NULL) {
                                //DEBUG_SERVER_MSG("uri record : %s", uri);
                                snprintf(data, length, "%s", uri);
 
@@ -696,19 +598,17 @@ static bool _net_nfc_app_util_get_uri_from_record(ndef_record_s *record, char *d
                }
                break;
 
-       case NET_NFC_RECORD_EXTERNAL_RTD : /* external type */
+       case NET_NFC_RECORD_EXTERNAL_RTD:       /* external type */
                {
                        data_s *type = &record->type_s;
 
-                       if (type->length > 0)
-                       {
+                       if (type->length > 0) {
 #if 0
                                char *buffer = NULL;
                                int len = strlen(NET_NFC_UTIL_EXTERNAL_TYPE_SCHEME);
 
                                _net_nfc_util_alloc_mem(buffer, type->length + len + 1);
-                               if (buffer != NULL)
-                               {
+                               if (buffer != NULL) {
                                        memcpy(buffer, NET_NFC_UTIL_EXTERNAL_TYPE_SCHEME, len);
                                        memcpy(buffer + len, type->buffer, type->length);
 
@@ -735,14 +635,14 @@ static bool _net_nfc_app_util_get_uri_from_record(ndef_record_s *record, char *d
                }
                break;
 
-       case NET_NFC_RECORD_MIME_TYPE :
-       case NET_NFC_RECORD_EMPTY : /* empy msg. discard it */
+       case NET_NFC_RECORD_MIME_TYPE:
+       case NET_NFC_RECORD_EMPTY:      /* empy msg. discard it */
                result = true;
                break;
 
-       case NET_NFC_RECORD_UNKNOWN : /* unknown msg. discard it */
-       case NET_NFC_RECORD_UNCHAGNED : /* RFU msg. discard it */
-       default :
+       case NET_NFC_RECORD_UNKNOWN:    /* unknown msg. discard it */
+       case NET_NFC_RECORD_UNCHAGNED /* RFU msg. discard it */
+       default:
                break;
        }
 
@@ -750,28 +650,22 @@ static bool _net_nfc_app_util_get_uri_from_record(ndef_record_s *record, char *d
 }
 #endif
 
-static bool _net_nfc_app_util_get_data_from_record(ndef_record_s *record, char *data, size_t length)
+static bool _net_nfc_app_util_get_data_from_record(ndef_record_s * record, char *data, size_t length)
 {
        bool result = false;
 
        if (record == NULL || data == NULL || length == 0)
-       {
                return result;
-       }
 
-       switch (record->TNF)
-       {
-       case NET_NFC_RECORD_WELL_KNOWN_TYPE :
+       switch (record->TNF) {
+       case NET_NFC_RECORD_WELL_KNOWN_TYPE:
                {
-                       if (record->type_s.buffer == NULL || record->type_s.length == 0
-                               || record->payload_s.buffer == NULL || record->payload_s.length == 0)
-                       {
+                       if (record->type_s.buffer == NULL || record->type_s.length == 0 || record->payload_s.buffer == NULL || record->payload_s.length == 0) {
                                DEBUG_ERR_MSG("Broken NDEF Message [NET_NFC_RECORD_WELL_KNOWN_TYPE]");
                                break;
                        }
 
-                       if (record->type_s.length == 1 && record->type_s.buffer[0] == 'T')
-                       {
+                       if (record->type_s.length == 1 && record->type_s.buffer[0] == 'T') {
                                uint8_t *buffer_temp = record->payload_s.buffer;
                                uint32_t buffer_length = record->payload_s.length;
 
@@ -780,30 +674,29 @@ static bool _net_nfc_app_util_get_data_from_record(ndef_record_s *record, char *
 
                                memcpy(data, &(buffer_temp[index]), MIN(text_length, length));
                        }
-
                        //DEBUG_SERVER_MSG("data [%s]", data);
 
                        result = true;
                }
                break;
 
-       case NET_NFC_RECORD_MIME_TYPE :
-       case NET_NFC_RECORD_URI : /* Absolute URI */
-       case NET_NFC_RECORD_EXTERNAL_RTD : /* external type */
-       case NET_NFC_RECORD_EMPTY : /* empy msg. discard it */
+       case NET_NFC_RECORD_MIME_TYPE:
+       case NET_NFC_RECORD_URI:        /* Absolute URI */
+       case NET_NFC_RECORD_EXTERNAL_RTD:       /* external type */
+       case NET_NFC_RECORD_EMPTY:      /* empy msg. discard it */
                result = true;
                break;
 
-       case NET_NFC_RECORD_UNKNOWN : /* unknown msg. discard it */
-       case NET_NFC_RECORD_UNCHAGNED : /* RFU msg. discard it */
-       default :
+       case NET_NFC_RECORD_UNKNOWN:    /* unknown msg. discard it */
+       case NET_NFC_RECORD_UNCHAGNED /* RFU msg. discard it */
+       default:
                break;
        }
 
        return result;
 }
 
-void net_nfc_app_util_aul_launch_app(char* package_name, bundle* kb)
+void net_nfc_app_util_aul_launch_app(char *package_name, bundle * kb)
 {
        int result = 0;
        uid_t uid = 0;
@@ -813,10 +706,8 @@ void net_nfc_app_util_aul_launch_app(char* package_name, bundle* kb)
                return;
        }
 
-       if((result = aul_launch_app_for_uid(package_name, kb, uid)) < 0)
-       {
-               switch(result)
-               {
+       if ((result = aul_launch_app_for_uid(package_name, kb, uid)) < 0) {
+               switch (result) {
                case AUL_R_EINVAL:
                        DEBUG_SERVER_MSG("aul launch error : AUL_R_EINVAL");
                        break;
@@ -830,9 +721,7 @@ void net_nfc_app_util_aul_launch_app(char* package_name, bundle* kb)
                        DEBUG_SERVER_MSG("aul launch error : unknown ERROR");
                        break;
                }
-       }
-       else
-       {
+       } else {
                SECURE_MSG("success to launch [%s]", package_name);
        }
 }
@@ -847,26 +736,22 @@ int net_nfc_app_util_appsvc_launch(const char *operation, const char *uri, const
        if (bd == NULL)
                return result;
 
-       if (operation != NULL && strlen(operation) > 0)
-       {
+       if (operation != NULL && strlen(operation) > 0) {
                SECURE_MSG("operation : %s", operation);
                appsvc_set_operation(bd, operation);
        }
 
-       if (uri != NULL && strlen(uri) > 0)
-       {
+       if (uri != NULL && strlen(uri) > 0) {
                SECURE_MSG("uri : %s", uri);
                appsvc_set_uri(bd, uri);
        }
 
-       if (mime != NULL && strlen(mime) > 0)
-       {
+       if (mime != NULL && strlen(mime) > 0) {
                SECURE_MSG("mime : %s", mime);
                appsvc_set_mime(bd, mime);
        }
 
-       if (data != NULL && strlen(data) > 0)
-       {
+       if (data != NULL && strlen(data) > 0) {
                SECURE_MSG("data : %s", data);
                appsvc_add_data(bd, "data", data);
        }
@@ -881,7 +766,7 @@ int net_nfc_app_util_appsvc_launch(const char *operation, const char *uri, const
        return result;
 }
 
-void _string_to_binary(const char *input, uint8_t *output, uint32_t *length)
+void _string_to_binary(const char *input, uint8_t * output, uint32_t * length)
 {
        int current = 0;
        int temp;
@@ -895,28 +780,23 @@ void _string_to_binary(const char *input, uint8_t *output, uint32_t *length)
        /* string pass "nfc://secure/" */
        input += 13;
 
-       if(strncmp(input, "SIM1", 4) == 0)
+       if (strncmp(input, "SIM1", 4) == 0)
                input += 4;
-       else if(strncmp(input, "eSE", 3) == 0)
+       else if (strncmp(input, "eSE", 3) == 0)
                input += 3;
 
        input += 5;
 
-       while (*input && (current < *length))
-       {
+       while (*input && (current < *length)) {
                temp = (*input++) - '0';
 
-               if(temp > 9)
+               if (temp > 9)
                        temp -= 7;
 
-               if(current % 2)
-               {
+               if (current % 2)
                        output[current / 2] += temp;
-               }
                else
-               {
                        output[current / 2] = temp << 4;
-               }
 
                current++;
        }
@@ -924,7 +804,7 @@ void _string_to_binary(const char *input, uint8_t *output, uint32_t *length)
        *length = current / 2;
 }
 
-int net_nfc_app_util_launch_se_transaction_app(net_nfc_se_type_e se_type, uint8_t *aid, uint32_t aid_len, uint8_t *param, uint32_t param_len)
+int net_nfc_app_util_launch_se_transaction_app(net_nfc_se_type_e se_type, uint8_t * aid, uint32_t aid_len, uint8_t * param, uint32_t param_len)
 {
        uid_t uid = 0;
        bundle *bd = NULL;
@@ -935,34 +815,31 @@ int net_nfc_app_util_launch_se_transaction_app(net_nfc_se_type_e se_type, uint8_
        appsvc_set_operation(bd, "http://tizen.org/appcontrol/operation/nfc/transaction");
 
        /* convert aid to aid string */
-       if (aid != NULL && aid_len > 0)
-       {
+       if (aid != NULL && aid_len > 0) {
                char temp_string[1024] = { 0, };
                char aid_string[1024] = { 0, };
                data_s temp = { aid, aid_len };
 
                net_nfc_util_binary_to_hex_string(&temp, temp_string, sizeof(temp_string));
 
-               switch(se_type)
-               {
-                       case NET_NFC_SE_TYPE_UICC:
-                               snprintf(aid_string, sizeof(aid_string), "nfc://secure/SIM1/aid/%s", temp_string);
-                               break;
+               switch (se_type) {
+               case NET_NFC_SE_TYPE_UICC:
+                       snprintf(aid_string, sizeof(aid_string), "nfc://secure/SIM1/aid/%s", temp_string);
+                       break;
 
-                       case NET_NFC_SE_TYPE_ESE:
-                               snprintf(aid_string, sizeof(aid_string), "nfc://secure/eSE/aid/%s", temp_string);
-                               break;
-                       default:
-                               snprintf(aid_string, sizeof(aid_string), "nfc://secure/aid/%s", temp_string);
-                               break;
+               case NET_NFC_SE_TYPE_ESE:
+                       snprintf(aid_string, sizeof(aid_string), "nfc://secure/eSE/aid/%s", temp_string);
+                       break;
+               default:
+                       snprintf(aid_string, sizeof(aid_string), "nfc://secure/aid/%s", temp_string);
+                       break;
                }
 
                SECURE_MSG("aid_string : %s", aid_string);
                appsvc_set_uri(bd, aid_string);
        }
 
-       if (param != NULL && param_len > 0)
-       {
+       if (param != NULL && param_len > 0) {
                char param_string[1024] = { 0, };
                data_s temp = { param, param_len };
 
@@ -982,7 +859,7 @@ int net_nfc_app_util_launch_se_transaction_app(net_nfc_se_type_e se_type, uint8_
        return 0;
 }
 
-int net_nfc_app_util_launch_se_off_host_apdu_service_app(net_nfc_se_type_e se_type, uint8_t *aid, uint32_t aid_len, uint8_t *param, uint32_t param_len)
+int net_nfc_app_util_launch_se_off_host_apdu_service_app(net_nfc_se_type_e se_type, uint8_t * aid, uint32_t aid_len, uint8_t * param, uint32_t param_len)
 {
        uid_t uid = 0;
        bundle *bd = NULL;
@@ -993,34 +870,31 @@ int net_nfc_app_util_launch_se_off_host_apdu_service_app(net_nfc_se_type_e se_ty
        appsvc_set_operation(bd, "http://tizen.org/appcontrol/operation/nfc/card_emulation/off_host_apdu_service");
 
        /* convert aid to aid string */
-       if (aid != NULL && aid_len > 0)
-       {
+       if (aid != NULL && aid_len > 0) {
                char temp_string[1024] = { 0, };
                char aid_string[1024] = { 0, };
                data_s temp = { aid, aid_len };
 
                net_nfc_util_binary_to_hex_string(&temp, temp_string, sizeof(temp_string));
 
-               switch(se_type)
-               {
-                       case NET_NFC_SE_TYPE_UICC:
-                               snprintf(aid_string, sizeof(aid_string), "nfc://secure/SIM1/aid/%s", temp_string);
-                               break;
+               switch (se_type) {
+               case NET_NFC_SE_TYPE_UICC:
+                       snprintf(aid_string, sizeof(aid_string), "nfc://secure/SIM1/aid/%s", temp_string);
+                       break;
 
-                       case NET_NFC_SE_TYPE_ESE:
-                               snprintf(aid_string, sizeof(aid_string), "nfc://secure/eSE/aid/%s", temp_string);
-                               break;
-                       default:
-                               snprintf(aid_string, sizeof(aid_string), "nfc://secure/aid/%s", temp_string);
-                               break;
+               case NET_NFC_SE_TYPE_ESE:
+                       snprintf(aid_string, sizeof(aid_string), "nfc://secure/eSE/aid/%s", temp_string);
+                       break;
+               default:
+                       snprintf(aid_string, sizeof(aid_string), "nfc://secure/aid/%s", temp_string);
+                       break;
                }
 
                SECURE_MSG("aid_string : %s", aid_string);
                appsvc_set_uri(bd, aid_string);
        }
 
-       if (param != NULL && param_len > 0)
-       {
+       if (param != NULL && param_len > 0) {
                char param_string[1024] = { 0, };
                data_s temp = { param, param_len };
 
@@ -1040,7 +914,7 @@ int net_nfc_app_util_launch_se_off_host_apdu_service_app(net_nfc_se_type_e se_ty
        return 0;
 }
 
-int net_nfc_app_util_encode_base64(uint8_t *buffer, uint32_t buf_len, char *result, uint32_t max_result)
+int net_nfc_app_util_encode_base64(uint8_t * buffer, uint32_t buf_len, char *result, uint32_t max_result)
 {
        int ret = -1;
        BUF_MEM *bptr;
@@ -1051,7 +925,7 @@ int net_nfc_app_util_encode_base64(uint8_t *buffer, uint32_t buf_len, char *resu
 
        /* base 64 */
        b64 = BIO_new(BIO_f_base64());
-       if(b64 == NULL)
+       if (b64 == NULL)
                return NET_NFC_ALLOC_FAIL;
 
        BIO_set_flags(b64, BIO_FLAGS_BASE64_NO_NL);
@@ -1072,7 +946,7 @@ int net_nfc_app_util_encode_base64(uint8_t *buffer, uint32_t buf_len, char *resu
        return ret;
 }
 
-int net_nfc_app_util_decode_base64(const char *buffer, uint32_t buf_len, uint8_t *result, uint32_t *res_len)
+int net_nfc_app_util_decode_base64(const char *buffer, uint32_t buf_len, uint8_t * result, uint32_t * res_len)
 {
        int ret = -1;
        char *temp = NULL;
@@ -1081,8 +955,7 @@ int net_nfc_app_util_decode_base64(const char *buffer, uint32_t buf_len, uint8_t
                return ret;
 
        _net_nfc_util_alloc_mem(temp, buf_len);
-       if (temp != NULL)
-       {
+       if (temp != NULL) {
                BIO *b64, *bmem;
                uint32_t temp_len;
 
@@ -1108,16 +981,14 @@ int net_nfc_app_util_decode_base64(const char *buffer, uint32_t buf_len, uint8_t
                _net_nfc_util_free_mem(temp);
 
                ret = 0;
-       }
-       else
-       {
+       } else {
                DEBUG_ERR_MSG("alloc failed");
        }
 
        return ret;
 }
 
-int _iter_func(const aul_app_info *info, void *data)
+int _iter_func(const aul_app_info * info, void *data)
 {
        uid_t uid = 0;
        int *pid = (int *)data;
@@ -1132,7 +1003,7 @@ int _iter_func(const aul_app_info *info, void *data)
 
        DEBUG_SERVER_MSG("login user is %d, pid is %d, status is %d", (int)uid, info->pid, status);
 
-       if(status == STATUS_VISIBLE || status == STATUS_FOCUS) {
+       if (status == STATUS_VISIBLE || status == STATUS_FOCUS) {
                *pid = info->pid;
                return -1;
        }
@@ -1170,7 +1041,7 @@ bool net_nfc_app_util_check_launch_state()
 
        popup_state = net_nfc_server_gdbus_get_client_popup_state(focus_app_pid);
 
-       if(popup_state == NET_NFC_NO_LAUNCH_APP_SELECT)
+       if (popup_state == NET_NFC_NO_LAUNCH_APP_SELECT)
                result = true;
 
        return result;
index 703863b..8bf4dde 100755 (executable)
@@ -23,7 +23,7 @@
 #include <string.h>
 #include <errno.h>
 
-#include <dd-display.h>/*for pm lock*/
+#include <dd-display.h>                        /*for pm lock */
 #include <device/power.h>
 
 #include "net_nfc_oem_controller.h"
 #define NET_NFC_OEM_LIBRARY_PATH "/usr/lib/libnfc-plugin.so"
 #define NET_NFC_DEFAULT_PLUGIN "libnfc-plugin.so"
 
-
 static net_nfc_oem_interface_s g_interface;
 
-static void *net_nfc_controller_load_file(const char *dir_path,
-                                       const char *filename)
+static void *net_nfc_controller_load_file(const char *dir_path, const char *filename)
 {
        void *handle = NULL;
        char path[PATH_MAX] = { '\0' };
@@ -47,7 +45,7 @@ static void *net_nfc_controller_load_file(const char *dir_path,
 
        net_nfc_error_e result;
 
-       bool (*onload)(net_nfc_oem_interface_s *interfaces);
+       bool(*onload) (net_nfc_oem_interface_s * interfaces);
 
        snprintf(path, PATH_MAX, "%s/%s", dir_path, filename);
        SECURE_MSG("path : %s", path);
@@ -64,15 +62,13 @@ static void *net_nfc_controller_load_file(const char *dir_path,
 
        handle = dlopen(path, RTLD_LAZY);
        if (handle == NULL) {
-               DEBUG_ERR_MSG("dlopen failed, [%d] : %s",
-                       errno, dlerror());
+               DEBUG_ERR_MSG("dlopen failed, [%d] : %s", errno, dlerror());
                goto ERROR;
        }
 
        onload = dlsym(handle, "onload");
        if (onload == NULL) {
-               DEBUG_ERR_MSG("dlsym failed, [%d] : %s",
-                       errno, dlerror());
+               DEBUG_ERR_MSG("dlsym failed, [%d] : %s", errno, dlerror());
                goto ERROR;
        }
 
@@ -83,17 +79,15 @@ static void *net_nfc_controller_load_file(const char *dir_path,
        }
 
        if (net_nfc_controller_support_nfc(&result) == false) {
-               DEBUG_ERR_MSG("net_nfc_controller_support_nfc failed, [%d]",
-                       result);
+               DEBUG_ERR_MSG("net_nfc_controller_support_nfc failed, [%d]", result);
                goto ERROR;
        }
 
        return handle;
 
-ERROR :
-       if (handle != NULL) {
+ ERROR:
+       if (handle != NULL)
                dlclose(handle);
-       }
 
        return NULL;
 }
@@ -106,36 +100,26 @@ void *net_nfc_controller_onload()
        void *handle = NULL;
 
        dirp = opendir(NFC_MANAGER_MODULEDIR);
-       if (dirp == NULL)
-       {
-               SECURE_MSG("Can not open directory %s",
-                               NFC_MANAGER_MODULEDIR);
+       if (dirp == NULL) {
+               SECURE_MSG("Can not open directory %s", NFC_MANAGER_MODULEDIR);
                return NULL;
        }
 
-       while ((dir = readdir(dirp)))
-       {
-               if ((strcmp(dir->d_name, ".") == 0) ||
-                               (strcmp(dir->d_name, "..") == 0))
-               {
+       while ((dir = readdir(dirp))) {
+               if ((strcmp(dir->d_name, ".") == 0) || (strcmp(dir->d_name, "..") == 0))
                        continue;
-               }
 
                /* check ".so" suffix */
-               if (strcmp(dir->d_name + (strlen(dir->d_name) - strlen(".so")),
-                                       ".so") != 0)
+               if (strcmp(dir->d_name + (strlen(dir->d_name) - strlen(".so")), ".so") != 0)
                        continue;
 
                /* check default plugin later */
                if (strcmp(dir->d_name, NET_NFC_DEFAULT_PLUGIN) == 0)
                        continue;
 
-               handle = net_nfc_controller_load_file(NFC_MANAGER_MODULEDIR,
-                                               dir->d_name);
-               if (handle)
-               {
-                       SECURE_LOGD("Successfully loaded : %s",
-                                       dir->d_name);
+               handle = net_nfc_controller_load_file(NFC_MANAGER_MODULEDIR, dir->d_name);
+               if (handle) {
+                       SECURE_LOGD("Successfully loaded : %s", dir->d_name);
                        closedir(dirp);
                        return handle;
                }
@@ -144,19 +128,13 @@ void *net_nfc_controller_onload()
        closedir(dirp);
 
        /* load default plugin */
-       handle = net_nfc_controller_load_file(NFC_MANAGER_MODULEDIR,
-                                       NET_NFC_DEFAULT_PLUGIN);
+       handle = net_nfc_controller_load_file(NFC_MANAGER_MODULEDIR, NET_NFC_DEFAULT_PLUGIN);
 
-       if (handle)
-       {
-               SECURE_MSG("loaded default plugin : %s",
-                               NET_NFC_DEFAULT_PLUGIN);
+       if (handle) {
+               SECURE_MSG("loaded default plugin : %s", NET_NFC_DEFAULT_PLUGIN);
                return handle;
-       }
-       else
-       {
-               SECURE_MSG("can not load default plugin : %s",
-                               NET_NFC_DEFAULT_PLUGIN);
+       } else {
+               SECURE_MSG("can not load default plugin : %s", NET_NFC_DEFAULT_PLUGIN);
                return NULL;
        }
 }
@@ -165,22 +143,18 @@ bool net_nfc_controller_unload(void *handle)
 {
        memset(&g_interface, 0x00, sizeof(net_nfc_oem_interface_s));
 
-       if (handle != NULL)
-       {
+       if (handle != NULL) {
                dlclose(handle);
                handle = NULL;
        }
        return true;
 }
 
-bool net_nfc_controller_init(net_nfc_error_e *result)
+bool net_nfc_controller_init(net_nfc_error_e * result)
 {
-       if (g_interface.init != NULL)
-       {
+       if (g_interface.init != NULL) {
                return g_interface.init(result);
-       }
-       else
-       {
+       } else {
                *result = NET_NFC_DEVICE_DOES_NOT_SUPPORT_NFC;
                DEBUG_SERVER_MSG("interface is null");
                return false;
@@ -189,28 +163,19 @@ bool net_nfc_controller_init(net_nfc_error_e *result)
 
 bool net_nfc_controller_deinit(void)
 {
-       if (g_interface.deinit != NULL)
-       {
+       if (g_interface.deinit != NULL) {
                return g_interface.deinit();
-       }
-       else
-       {
+       } else {
                DEBUG_SERVER_MSG("interface is null");
                return false;
        }
 }
 
-bool net_nfc_controller_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)
+bool net_nfc_controller_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)
 {
-       if (g_interface.register_listener != NULL)
-       {
-               return g_interface.register_listener(target_detection_listener, se_transaction_listener,
-                       llcp_event_listener, hce_apdu_listener, result);
-       }
-       else
-       {
+       if (g_interface.register_listener != NULL) {
+               return g_interface.register_listener(target_detection_listener, se_transaction_listener, llcp_event_listener, hce_apdu_listener, result);
+       } else {
                *result = NET_NFC_DEVICE_DOES_NOT_SUPPORT_NFC;
                DEBUG_SERVER_MSG("interface is null");
                return false;
@@ -219,119 +184,94 @@ bool net_nfc_controller_register_listener(target_detection_listener_cb target_de
 
 bool net_nfc_controller_unregister_listener()
 {
-       if (g_interface.unregister_listener != NULL)
-       {
+       if (g_interface.unregister_listener != NULL) {
                return g_interface.unregister_listener();
-       }
-       else
-       {
+       } else {
                DEBUG_SERVER_MSG("interface is null");
                return false;
        }
 }
 
-bool net_nfc_controller_get_firmware_version(data_s **data, net_nfc_error_e *result)
+bool net_nfc_controller_get_firmware_version(data_s ** data, net_nfc_error_e * result)
 {
-       if (g_interface.get_firmware_version != NULL)
-       {
+       if (g_interface.get_firmware_version != NULL) {
                return g_interface.get_firmware_version(data, result);
-       }
-       else
-       {
+       } else {
                *result = NET_NFC_DEVICE_DOES_NOT_SUPPORT_NFC;
                DEBUG_SERVER_MSG("interface is null");
                return false;
        }
 }
 
-bool net_nfc_controller_check_firmware_version(net_nfc_error_e *result)
+bool net_nfc_controller_check_firmware_version(net_nfc_error_e * result)
 {
-       if (g_interface.check_firmware_version != NULL)
-       {
+       if (g_interface.check_firmware_version != NULL) {
                return g_interface.check_firmware_version(result);
-       }
-       else
-       {
+       } else {
                *result = NET_NFC_DEVICE_DOES_NOT_SUPPORT_NFC;
                DEBUG_SERVER_MSG("interface is null");
                return false;
        }
 }
 
-bool net_nfc_controller_update_firmware(net_nfc_error_e *result)
+bool net_nfc_controller_update_firmware(net_nfc_error_e * result)
 {
-       if (g_interface.update_firmeware != NULL)
-       {
+       if (g_interface.update_firmeware != NULL) {
                return g_interface.update_firmeware(result);
-       }
-       else
-       {
+       } else {
                *result = NET_NFC_DEVICE_DOES_NOT_SUPPORT_NFC;
                DEBUG_SERVER_MSG("interface is null");
                return false;
        }
 }
 
-bool net_nfc_controller_get_stack_information(net_nfc_stack_information_s *stack_info, net_nfc_error_e *result)
+bool net_nfc_controller_get_stack_information(net_nfc_stack_information_s * stack_info, net_nfc_error_e * result)
 {
-       if (g_interface.get_stack_information != NULL)
-       {
+       if (g_interface.get_stack_information != NULL) {
                return g_interface.get_stack_information(stack_info, result);
-       }
-       else
-       {
+       } else {
                *result = NET_NFC_DEVICE_DOES_NOT_SUPPORT_NFC;
                DEBUG_SERVER_MSG("interface is null");
                return false;
        }
 }
 
-bool net_nfc_controller_configure_discovery(net_nfc_discovery_mode_e mode, net_nfc_event_filter_e config, net_nfc_error_e *result)
+bool net_nfc_controller_configure_discovery(net_nfc_discovery_mode_e mode, net_nfc_event_filter_e config, net_nfc_error_e * result)
 {
-       if (g_interface.configure_discovery != NULL)
-       {
+       if (g_interface.configure_discovery != NULL) {
                return g_interface.configure_discovery(mode, config, result);
-       }
-       else
-       {
+       } else {
                *result = NET_NFC_DEVICE_DOES_NOT_SUPPORT_NFC;
                DEBUG_SERVER_MSG("interface is null");
                return false;
        }
 }
 
-bool net_nfc_controller_get_secure_element_list(net_nfc_secure_element_info_s *list, int *count, net_nfc_error_e *result)
+bool net_nfc_controller_get_secure_element_list(net_nfc_secure_element_info_s * list, int *count, net_nfc_error_e * result)
 {
-       if (g_interface.get_secure_element_list != NULL)
-       {
+       if (g_interface.get_secure_element_list != NULL) {
                return g_interface.get_secure_element_list(list, count, result);
-       }
-       else
-       {
+       } else {
                *result = NET_NFC_DEVICE_DOES_NOT_SUPPORT_NFC;
                DEBUG_SERVER_MSG("interface is null");
                return false;
        }
 }
 
-bool net_nfc_controller_set_secure_element_mode(net_nfc_secure_element_type_e element_type, net_nfc_secure_element_mode_e mode, net_nfc_error_e *result)
+bool net_nfc_controller_set_secure_element_mode(net_nfc_secure_element_type_e element_type, net_nfc_secure_element_mode_e mode, net_nfc_error_e * result)
 {
-       if (g_interface.set_secure_element_mode != NULL)
-       {
+       if (g_interface.set_secure_element_mode != NULL) {
                return g_interface.set_secure_element_mode(element_type, mode, result);
-       }
-       else
-       {
+       } else {
                *result = NET_NFC_DEVICE_DOES_NOT_SUPPORT_NFC;
                DEBUG_SERVER_MSG("interface is null");
                return false;
        }
 }
 
-bool net_nfc_controller_secure_element_open(net_nfc_secure_element_type_e element_type, net_nfc_target_handle_s **handle, net_nfc_error_e *result)
+bool net_nfc_controller_secure_element_open(net_nfc_secure_element_type_e element_type, net_nfc_target_handle_s ** handle, net_nfc_error_e * result)
 {
-       if (g_interface.secure_element_open != NULL)
-       {
+       if (g_interface.secure_element_open != NULL) {
                bool ret;
 
                ret = g_interface.secure_element_open(element_type, handle, result);
@@ -339,88 +279,71 @@ bool net_nfc_controller_secure_element_open(net_nfc_secure_element_type_e elemen
                        int ret_val;
 
                        ret_val = device_power_request_lock(POWER_LOCK_CPU, 300000);
-                       if (ret_val < 0) {
+                       if (ret_val < 0)
                                DEBUG_ERR_MSG("device_power_request_lock failed, [%d]", ret_val);
-                       }
                }
 
                return ret;
-       }
-       else
-       {
+       } else {
                *result = NET_NFC_DEVICE_DOES_NOT_SUPPORT_NFC;
                DEBUG_SERVER_MSG("interface is null");
                return false;
        }
 }
 
-bool net_nfc_controller_secure_element_get_atr(net_nfc_target_handle_s *handle, data_s **atr, net_nfc_error_e *result)
+bool net_nfc_controller_secure_element_get_atr(net_nfc_target_handle_s * handle, data_s ** atr, net_nfc_error_e * result)
 {
-       if (g_interface.secure_element_get_atr != NULL)
-       {
+       if (g_interface.secure_element_get_atr != NULL) {
                return g_interface.secure_element_get_atr(handle, atr, result);
-       }
-       else
-       {
+       } else {
                *result = NET_NFC_DEVICE_DOES_NOT_SUPPORT_NFC;
                DEBUG_SERVER_MSG("interface is null");
                return false;
        }
 }
 
-bool net_nfc_controller_secure_element_send_apdu(net_nfc_target_handle_s *handle, data_s *command, data_s **response, net_nfc_error_e *result)
+bool net_nfc_controller_secure_element_send_apdu(net_nfc_target_handle_s * handle, data_s * command, data_s ** response, net_nfc_error_e * result)
 {
-       if (g_interface.secure_element_send_apdu != NULL)
-       {
+       if (g_interface.secure_element_send_apdu != NULL) {
                return g_interface.secure_element_send_apdu(handle, command, response, result);
-       }
-       else
-       {
+       } else {
                *result = NET_NFC_DEVICE_DOES_NOT_SUPPORT_NFC;
                DEBUG_SERVER_MSG("interface is null");
                return false;
        }
 }
 
-bool net_nfc_controller_secure_element_close(net_nfc_target_handle_s *handle, net_nfc_error_e *result)
+bool net_nfc_controller_secure_element_close(net_nfc_target_handle_s * handle, net_nfc_error_e * result)
 {
        int ret_val;
 
        ret_val = device_power_release_lock(POWER_LOCK_CPU);
-       if (ret_val < 0) {
+       if (ret_val < 0)
                DEBUG_ERR_MSG("device_power_release_lock failed, [%d]", ret_val);
-       }
 
-       if (g_interface.secure_element_close != NULL)
-       {
+       if (g_interface.secure_element_close != NULL) {
                return g_interface.secure_element_close(handle, result);
-       }
-       else
-       {
+       } else {
                *result = NET_NFC_DEVICE_DOES_NOT_SUPPORT_NFC;
                DEBUG_SERVER_MSG("interface is null");
                return false;
        }
 }
 
-bool net_nfc_controller_check_target_presence(net_nfc_target_handle_s *handle, net_nfc_error_e *result)
+bool net_nfc_controller_check_target_presence(net_nfc_target_handle_s * handle, net_nfc_error_e * result)
 {
-       if (g_interface.check_presence != NULL)
-       {
+       if (g_interface.check_presence != NULL) {
                return g_interface.check_presence(handle, result);
-       }
-       else
-       {
+       } else {
                *result = NET_NFC_DEVICE_DOES_NOT_SUPPORT_NFC;
                DEBUG_SERVER_MSG("interface is null");
                return false;
        }
 }
 
-bool net_nfc_controller_connect(net_nfc_target_handle_s *handle, net_nfc_error_e *result)
+bool net_nfc_controller_connect(net_nfc_target_handle_s * handle, net_nfc_error_e * result)
 {
-       if (g_interface.connect != NULL)
-       {
+       if (g_interface.connect != NULL) {
                bool ret;
 
                ret = g_interface.connect(handle, result);
@@ -428,122 +351,97 @@ bool net_nfc_controller_connect(net_nfc_target_handle_s *handle, net_nfc_error_e
                        int ret_val = 0;
 
                        ret_val = device_power_request_lock(POWER_LOCK_CPU, 20000);
-                       if (ret_val < 0) {
+                       if (ret_val < 0)
                                DEBUG_ERR_MSG("device_power_request_lock failed, [%d]", ret_val);
-                       }
                }
 
                return ret;
-       }
-       else
-       {
+       } else {
                *result = NET_NFC_DEVICE_DOES_NOT_SUPPORT_NFC;
                DEBUG_SERVER_MSG("interface is null");
                return false;
        }
 }
 
-bool net_nfc_controller_disconnect(net_nfc_target_handle_s *handle, net_nfc_error_e *result)
+bool net_nfc_controller_disconnect(net_nfc_target_handle_s * handle, net_nfc_error_e * result)
 {
        int ret_val;
 
        ret_val = device_power_release_lock(POWER_LOCK_CPU);
-       if (ret_val < 0) {
+       if (ret_val < 0)
                DEBUG_ERR_MSG("device_power_release_lock failed, [%d]", ret_val);
-       }
 
-       if (g_interface.disconnect != NULL)
-       {
+       if (g_interface.disconnect != NULL) {
                net_nfc_server_free_target_info();
 
                return g_interface.disconnect(handle, result);
-       }
-       else
-       {
+       } else {
                *result = NET_NFC_DEVICE_DOES_NOT_SUPPORT_NFC;
                DEBUG_SERVER_MSG("interface is null");
                return false;
        }
 }
 
-bool net_nfc_controller_check_ndef(net_nfc_target_handle_s *handle, uint8_t *ndef_card_state, int *max_data_size, int *real_data_size, net_nfc_error_e *result)
+bool net_nfc_controller_check_ndef(net_nfc_target_handle_s * handle, uint8_t * ndef_card_state, int *max_data_size, int *real_data_size, net_nfc_error_e * result)
 {
-       if (g_interface.check_ndef != NULL)
-       {
+       if (g_interface.check_ndef != NULL) {
                return g_interface.check_ndef(handle, ndef_card_state, max_data_size, real_data_size, result);
-       }
-       else
-       {
+       } else {
                *result = NET_NFC_DEVICE_DOES_NOT_SUPPORT_NFC;
                DEBUG_SERVER_MSG("interface is null");
                return false;
        }
 }
 
-bool net_nfc_controller_read_ndef(net_nfc_target_handle_s *handle, data_s **data, net_nfc_error_e *result)
+bool net_nfc_controller_read_ndef(net_nfc_target_handle_s * handle, data_s ** data, net_nfc_error_e * result)
 {
-       if (g_interface.read_ndef != NULL)
-       {
+       if (g_interface.read_ndef != NULL) {
                return g_interface.read_ndef(handle, data, result);
-       }
-       else
-       {
+       } else {
                *result = NET_NFC_DEVICE_DOES_NOT_SUPPORT_NFC;
                DEBUG_SERVER_MSG("interface is null");
                return false;
        }
 }
 
-bool net_nfc_controller_write_ndef(net_nfc_target_handle_s *handle, data_s *data, net_nfc_error_e *result)
+bool net_nfc_controller_write_ndef(net_nfc_target_handle_s * handle, data_s * data, net_nfc_error_e * result)
 {
-       if (g_interface.write_ndef != NULL)
-       {
+       if (g_interface.write_ndef != NULL) {
                return g_interface.write_ndef(handle, data, result);
-       }
-       else
-       {
+       } else {
                *result = NET_NFC_DEVICE_DOES_NOT_SUPPORT_NFC;
                DEBUG_SERVER_MSG("interface is null");
                return false;
        }
 }
 
-bool net_nfc_controller_make_read_only_ndef(net_nfc_target_handle_s *handle, net_nfc_error_e *result)
+bool net_nfc_controller_make_read_only_ndef(net_nfc_target_handle_s * handle, net_nfc_error_e * result)
 {
-       if (g_interface.make_read_only_ndef != NULL)
-       {
+       if (g_interface.make_read_only_ndef != NULL) {
                return g_interface.make_read_only_ndef(handle, result);
-       }
-       else
-       {
+       } else {
                *result = NET_NFC_DEVICE_DOES_NOT_SUPPORT_NFC;
                DEBUG_SERVER_MSG("interface is null");
                return false;
        }
 }
 
-bool net_nfc_controller_format_ndef(net_nfc_target_handle_s *handle, data_s *secure_key, net_nfc_error_e *result)
+bool net_nfc_controller_format_ndef(net_nfc_target_handle_s * handle, data_s * secure_key, net_nfc_error_e * result)
 {
-       if (g_interface.format_ndef != NULL)
-       {
+       if (g_interface.format_ndef != NULL) {
                return g_interface.format_ndef(handle, secure_key, result);
-       }
-       else
-       {
+       } else {
                *result = NET_NFC_DEVICE_DOES_NOT_SUPPORT_NFC;
                DEBUG_SERVER_MSG("interface is null");
                return false;
        }
 }
 
-bool net_nfc_controller_transceive(net_nfc_target_handle_s *handle, net_nfc_transceive_info_s *info, data_s **data, net_nfc_error_e *result)
+bool net_nfc_controller_transceive(net_nfc_target_handle_s * handle, net_nfc_transceive_info_s * info, data_s ** data, net_nfc_error_e * result)
 {
-       if (g_interface.transceive != NULL)
-       {
+       if (g_interface.transceive != NULL) {
                return g_interface.transceive(handle, info, data, result);
-       }
-       else
-       {
+       } else {
                *result = NET_NFC_DEVICE_DOES_NOT_SUPPORT_NFC;
                DEBUG_SERVER_MSG("interface is null");
                return false;
@@ -552,65 +450,52 @@ bool net_nfc_controller_transceive(net_nfc_target_handle_s *handle, net_nfc_tran
 
 bool net_nfc_controller_exception_handler()
 {
-       if (g_interface.exception_handler != NULL)
-       {
+       if (g_interface.exception_handler != NULL) {
                return g_interface.exception_handler();
-       }
-       else
-       {
+       } else {
                DEBUG_SERVER_MSG("interface is null");
                return false;
        }
 }
 
-bool net_nfc_controller_is_ready(net_nfc_error_e *result)
+bool net_nfc_controller_is_ready(net_nfc_error_e * result)
 {
-       if (g_interface.is_ready != NULL)
-       {
+       if (g_interface.is_ready != NULL) {
                return g_interface.is_ready(result);
-       }
-       else
-       {
+       } else {
                *result = NET_NFC_DEVICE_DOES_NOT_SUPPORT_NFC;
                DEBUG_SERVER_MSG("interface is null");
                return false;
        }
 }
 
-bool net_nfc_controller_llcp_config(net_nfc_llcp_config_info_s *config, net_nfc_error_e *result)
+bool net_nfc_controller_llcp_config(net_nfc_llcp_config_info_s * config, net_nfc_error_e * result)
 {
-       if (g_interface.config_llcp != NULL)
-       {
+       if (g_interface.config_llcp != NULL) {
                return g_interface.config_llcp(config, result);
-       }
-       else
-       {
+       } else {
                *result = NET_NFC_DEVICE_DOES_NOT_SUPPORT_NFC;
                DEBUG_SERVER_MSG("interface is null");
                return false;
        }
 }
-bool net_nfc_controller_llcp_check_llcp(net_nfc_target_handle_s *handle, net_nfc_error_e *result)
+
+bool net_nfc_controller_llcp_check_llcp(net_nfc_target_handle_s * handle, net_nfc_error_e * result)
 {
-       if (g_interface.check_llcp_status != NULL)
-       {
+       if (g_interface.check_llcp_status != NULL) {
                return g_interface.check_llcp_status(handle, result);
-       }
-       else
-       {
+       } else {
                *result = NET_NFC_DEVICE_DOES_NOT_SUPPORT_NFC;
                DEBUG_SERVER_MSG("interface is null");
                return false;
        }
 }
-bool net_nfc_controller_llcp_activate_llcp(net_nfc_target_handle_s *handle, net_nfc_error_e *result)
+
+bool net_nfc_controller_llcp_activate_llcp(net_nfc_target_handle_s * handle, net_nfc_error_e * result)
 {
-       if (g_interface.activate_llcp != NULL)
-       {
+       if (g_interface.activate_llcp != NULL) {
                return g_interface.activate_llcp(handle, result);
-       }
-       else
-       {
+       } else {
                *result = NET_NFC_DEVICE_DOES_NOT_SUPPORT_NFC;
                DEBUG_SERVER_MSG("interface is null");
                return false;
@@ -622,9 +507,9 @@ static GSList *llcp_sockets;
 static gint _compare_socket_info(gconstpointer a, gconstpointer b)
 {
        int result;
-       socket_info_t *info = (socket_info_t *)a;
+       socket_info_t *info = (socket_info_t *) a;
 
-       if (info->socket == (net_nfc_llcp_socket_t)b)
+       if (info->socket == (net_nfc_llcp_socket_t) b)
                result = 0;
        else
                result = -1;
@@ -637,13 +522,11 @@ static socket_info_t *_get_socket_info(net_nfc_llcp_socket_t socket)
        socket_info_t *result;
        GSList *item;
 
-       item = g_slist_find_custom(llcp_sockets, GUINT_TO_POINTER(socket),
-               _compare_socket_info);
-       if (item != NULL) {
-               result = (socket_info_t *)item->data;
-       } else {
+       item = g_slist_find_custom(llcp_sockets, GUINT_TO_POINTER(socket), _compare_socket_info);
+       if (item != NULL)
+               result = (socket_info_t *) item->data;
+       else
                result = NULL;
-       }
 
        return result;
 }
@@ -666,33 +549,29 @@ static void _remove_socket_info(net_nfc_llcp_socket_t socket)
 {
        GSList *item;
 
-       item = g_slist_find_custom(llcp_sockets, GUINT_TO_POINTER(socket),
-               _compare_socket_info);
+       item = g_slist_find_custom(llcp_sockets, GUINT_TO_POINTER(socket), _compare_socket_info);
        if (item != NULL) {
                llcp_sockets = g_slist_remove_link(llcp_sockets, item);
                free(item->data);
        }
 }
 
-void net_nfc_controller_llcp_socket_error_cb(net_nfc_llcp_socket_t socket,
-       net_nfc_error_e result, void *data, void *user_param)
+void net_nfc_controller_llcp_socket_error_cb(net_nfc_llcp_socket_t socket, net_nfc_error_e result, void *data, void *user_param)
 {
        socket_info_t *info;
 
        info = _get_socket_info(socket);
        if (info != NULL) {
-               if (info->err_cb != NULL) {
+               if (info->err_cb != NULL)
                        info->err_cb(socket, result, NULL, NULL, info->err_param);
-               }
 
                _remove_socket_info(socket);
        }
 }
 
-bool net_nfc_controller_llcp_create_socket(net_nfc_llcp_socket_t *socket, net_nfc_socket_type_e socketType, uint16_t miu, uint8_t rw, net_nfc_error_e *result, net_nfc_service_llcp_cb cb, void *user_param)
+bool net_nfc_controller_llcp_create_socket(net_nfc_llcp_socket_t * socket, net_nfc_socket_type_e socketType, uint16_t miu, uint8_t rw, net_nfc_error_e * result, net_nfc_service_llcp_cb cb, void *user_param)
 {
-       if (g_interface.create_llcp_socket != NULL)
-       {
+       if (g_interface.create_llcp_socket != NULL) {
                bool ret;
                socket_info_t *info;
 
@@ -713,51 +592,42 @@ bool net_nfc_controller_llcp_create_socket(net_nfc_llcp_socket_t *socket, net_nf
                }
 
                return ret;
-       }
-       else
-       {
+       } else {
                *result = NET_NFC_DEVICE_DOES_NOT_SUPPORT_NFC;
                DEBUG_SERVER_MSG("interface is null");
                return false;
        }
 }
 
-bool net_nfc_controller_llcp_bind(net_nfc_llcp_socket_t socket, uint8_t service_access_point, net_nfc_error_e *result)
+bool net_nfc_controller_llcp_bind(net_nfc_llcp_socket_t socket, uint8_t service_access_point, net_nfc_error_e * result)
 {
-       if (g_interface.bind_llcp_socket != NULL)
-       {
+       if (g_interface.bind_llcp_socket != NULL) {
                return g_interface.bind_llcp_socket(socket, service_access_point, result);
-       }
-       else
-       {
+       } else {
                *result = NET_NFC_DEVICE_DOES_NOT_SUPPORT_NFC;
                DEBUG_SERVER_MSG("interface is null");
                return false;
        }
 }
 
-void net_nfc_controller_llcp_incoming_cb(net_nfc_llcp_socket_t socket,
-       net_nfc_error_e result, void *data, void *user_param)
+void net_nfc_controller_llcp_incoming_cb(net_nfc_llcp_socket_t socket, net_nfc_error_e result, void *data, void *user_param)
 {
-       socket_info_t *info = (socket_info_t *)user_param;
+       socket_info_t *info = (socket_info_t *) user_param;
 
        info = _get_socket_info(info->socket);
        if (info != NULL) {
                if (_add_socket_info(socket) != NULL) {
-                       if (info->work_cb != NULL) {
-                               info->work_cb(socket, result, NULL, NULL,
-                                       info->work_param);
-                       }
+                       if (info->work_cb != NULL)
+                               info->work_cb(socket, result, NULL, NULL, info->work_param);
                } else {
                        DEBUG_ERR_MSG("_net_nfc_util_alloc_mem failed");
                }
        }
 }
 
-bool net_nfc_controller_llcp_listen(net_nfc_target_handle_s* handle, uint8_t *service_access_name, net_nfc_llcp_socket_t socket, net_nfc_error_e *result, net_nfc_service_llcp_cb cb, void *user_param)
+bool net_nfc_controller_llcp_listen(net_nfc_target_handle_s * handle, uint8_t * service_access_name, net_nfc_llcp_socket_t socket, net_nfc_error_e * result, net_nfc_service_llcp_cb cb, void *user_param)
 {
-       if (g_interface.listen_llcp_socket != NULL)
-       {
+       if (g_interface.listen_llcp_socket != NULL) {
                socket_info_t *info;
 
                info = _get_socket_info(socket);
@@ -771,19 +641,16 @@ bool net_nfc_controller_llcp_listen(net_nfc_target_handle_s* handle, uint8_t *se
                info->work_param = user_param;
 
                return g_interface.listen_llcp_socket(handle, service_access_name, socket, result, info);
-       }
-       else
-       {
+       } else {
                *result = NET_NFC_DEVICE_DOES_NOT_SUPPORT_NFC;
                DEBUG_SERVER_MSG("interface is null");
                return false;
        }
 }
 
-bool net_nfc_controller_llcp_accept(net_nfc_llcp_socket_t socket, net_nfc_error_e *result, net_nfc_service_llcp_cb cb, void *user_param)
+bool net_nfc_controller_llcp_accept(net_nfc_llcp_socket_t socket, net_nfc_error_e * result, net_nfc_service_llcp_cb cb, void *user_param)
 {
-       if (g_interface.accept_llcp_socket != NULL)
-       {
+       if (g_interface.accept_llcp_socket != NULL) {
                socket_info_t *info;
 
                info = _get_socket_info(socket);
@@ -797,57 +664,48 @@ bool net_nfc_controller_llcp_accept(net_nfc_llcp_socket_t socket, net_nfc_error_
                info->err_param = user_param;
 
                return g_interface.accept_llcp_socket(socket, result, NULL);
-       }
-       else
-       {
+       } else {
                *result = NET_NFC_DEVICE_DOES_NOT_SUPPORT_NFC;
                DEBUG_SERVER_MSG("interface is null");
                return false;
        }
 }
 
-bool net_nfc_controller_llcp_reject(net_nfc_target_handle_s *handle, net_nfc_llcp_socket_t socket, net_nfc_error_e *result)
+bool net_nfc_controller_llcp_reject(net_nfc_target_handle_s * handle, net_nfc_llcp_socket_t socket, net_nfc_error_e * result)
 {
-       if (g_interface.reject_llcp != NULL)
-       {
+       if (g_interface.reject_llcp != NULL) {
                bool ret;
 
                ret = g_interface.reject_llcp(handle, socket, result);
-               if (ret == true) {
+               if (ret == true)
                        _remove_socket_info(socket);
-               }
 
                return ret;
-       }
-       else
-       {
+       } else {
                *result = NET_NFC_DEVICE_DOES_NOT_SUPPORT_NFC;
                DEBUG_SERVER_MSG("interface is null");
                return false;
        }
 }
 
-void net_nfc_controller_llcp_connected_cb(net_nfc_llcp_socket_t socket,
-       net_nfc_error_e result, void *data, void *user_param)
+void net_nfc_controller_llcp_connected_cb(net_nfc_llcp_socket_t socket, net_nfc_error_e result, void *data, void *user_param)
 {
-       net_nfc_llcp_param_t *param = (net_nfc_llcp_param_t *)user_param;
+       net_nfc_llcp_param_t *param = (net_nfc_llcp_param_t *) user_param;
 
        if (param == NULL)
                return;
 
-       if (param->cb != NULL) {
+       if (param->cb != NULL)
                param->cb(param->socket, result, NULL, NULL, param->user_param);
-       }
 
        _net_nfc_util_free_mem(param);
 }
 
-bool net_nfc_controller_llcp_connect_by_url(net_nfc_target_handle_s *handle, net_nfc_llcp_socket_t socket, uint8_t *service_access_name, net_nfc_error_e *result, net_nfc_service_llcp_cb cb, void *user_param)
+bool net_nfc_controller_llcp_connect_by_url(net_nfc_target_handle_s * handle, net_nfc_llcp_socket_t socket, uint8_t * service_access_name, net_nfc_error_e * result, net_nfc_service_llcp_cb cb, void *user_param)
 {
        bool ret;
 
-       if (g_interface.connect_llcp_by_url != NULL)
-       {
+       if (g_interface.connect_llcp_by_url != NULL) {
                net_nfc_llcp_param_t *param = NULL;
 
                _net_nfc_util_alloc_mem(param, sizeof(*param));
@@ -866,27 +724,23 @@ bool net_nfc_controller_llcp_connect_by_url(net_nfc_target_handle_s *handle, net
                        int ret_val;
 
                        ret_val = device_power_request_lock(POWER_LOCK_CPU, 20000);
-                       if (ret_val < 0) {
+                       if (ret_val < 0)
                                DEBUG_ERR_MSG("device_power_request_lock failed, [%d]", ret_val);
-                       }
                } else {
                        _remove_socket_info(socket);
                }
 
                return ret;
-       }
-       else
-       {
+       } else {
                *result = NET_NFC_DEVICE_DOES_NOT_SUPPORT_NFC;
                DEBUG_SERVER_MSG("interface is null");
                return false;
        }
 }
 
-bool net_nfc_controller_llcp_connect(net_nfc_target_handle_s *handle, net_nfc_llcp_socket_t socket, uint8_t service_access_point, net_nfc_error_e *result, net_nfc_service_llcp_cb cb, void *user_param)
+bool net_nfc_controller_llcp_connect(net_nfc_target_handle_s * handle, net_nfc_llcp_socket_t socket, uint8_t service_access_point, net_nfc_error_e * result, net_nfc_service_llcp_cb cb, void *user_param)
 {
-       if (g_interface.connect_llcp != NULL)
-       {
+       if (g_interface.connect_llcp != NULL) {
                bool ret;
                net_nfc_llcp_param_t *param = NULL;
 
@@ -906,47 +760,40 @@ bool net_nfc_controller_llcp_connect(net_nfc_target_handle_s *handle, net_nfc_ll
                        int ret_val;
 
                        ret_val = device_power_request_lock(POWER_LOCK_CPU, 20000);
-                       if (ret_val < 0) {
+                       if (ret_val < 0)
                                DEBUG_ERR_MSG("device_power_request_lock failed, [%d]", ret_val);
-                       }
                }
 
                return ret;
-       }
-       else
-       {
+       } else {
                *result = NET_NFC_DEVICE_DOES_NOT_SUPPORT_NFC;
                DEBUG_SERVER_MSG("interface is null");
                return false;
        }
 }
 
-void net_nfc_controller_llcp_disconnected_cb(net_nfc_llcp_socket_t socket,
-       net_nfc_error_e result, void *data, void *user_param)
+void net_nfc_controller_llcp_disconnected_cb(net_nfc_llcp_socket_t socket, net_nfc_error_e result, void *data, void *user_param)
 {
-       net_nfc_llcp_param_t *param = (net_nfc_llcp_param_t *)user_param;
+       net_nfc_llcp_param_t *param = (net_nfc_llcp_param_t *) user_param;
 
        if (param == NULL)
                return;
 
-       if (param->cb != NULL) {
+       if (param->cb != NULL)
                param->cb(param->socket, result, NULL, NULL, param->user_param);
-       }
 
        _net_nfc_util_free_mem(param);
 }
 
-bool net_nfc_controller_llcp_disconnect(net_nfc_target_handle_s *handle, net_nfc_llcp_socket_t socket, net_nfc_error_e *result, net_nfc_service_llcp_cb cb, void *user_param)
+bool net_nfc_controller_llcp_disconnect(net_nfc_target_handle_s * handle, net_nfc_llcp_socket_t socket, net_nfc_error_e * result, net_nfc_service_llcp_cb cb, void *user_param)
 {
        int ret_val;
 
        ret_val = device_power_release_lock(POWER_LOCK_CPU);
-       if (ret_val < 0) {
+       if (ret_val < 0)
                DEBUG_ERR_MSG("device_power_release_lock failed, [%d]", ret_val);
-       }
 
-       if (g_interface.disconnect_llcp != NULL)
-       {
+       if (g_interface.disconnect_llcp != NULL) {
                net_nfc_llcp_param_t *param = NULL;
 
                _net_nfc_util_alloc_mem(param, sizeof(*param));
@@ -961,48 +808,40 @@ bool net_nfc_controller_llcp_disconnect(net_nfc_target_handle_s *handle, net_nfc
                param->user_param = user_param;
 
                return g_interface.disconnect_llcp(handle, socket, result, param);
-       }
-       else
-       {
+       } else {
                *result = NET_NFC_DEVICE_DOES_NOT_SUPPORT_NFC;
                DEBUG_SERVER_MSG("interface is null");
                return false;
        }
 }
 
-bool net_nfc_controller_llcp_socket_close(net_nfc_llcp_socket_t socket, net_nfc_error_e *result)
+bool net_nfc_controller_llcp_socket_close(net_nfc_llcp_socket_t socket, net_nfc_error_e * result)
 {
-       if (g_interface.close_llcp_socket != NULL)
-       {
+       if (g_interface.close_llcp_socket != NULL) {
                return g_interface.close_llcp_socket(socket, result);
-       }
-       else
-       {
+       } else {
                *result = NET_NFC_DEVICE_DOES_NOT_SUPPORT_NFC;
                DEBUG_SERVER_MSG("interface is null");
                return false;
        }
 }
 
-void net_nfc_controller_llcp_received_cb(net_nfc_llcp_socket_t socket,
-       net_nfc_error_e result, void *data, void *user_param)
+void net_nfc_controller_llcp_received_cb(net_nfc_llcp_socket_t socket, net_nfc_error_e result, void *data, void *user_param)
 {
-       net_nfc_llcp_param_t *param = (net_nfc_llcp_param_t *)user_param;
+       net_nfc_llcp_param_t *param = (net_nfc_llcp_param_t *) user_param;
 
        if (param == NULL)
                return;
 
-       if (param->cb != NULL) {
+       if (param->cb != NULL)
                param->cb(param->socket, result, &param->data, data, param->user_param);
-       }
 
        _net_nfc_util_free_mem(param);
 }
 
-bool net_nfc_controller_llcp_recv(net_nfc_target_handle_s *handle, net_nfc_llcp_socket_t socket, uint32_t max_len, net_nfc_error_e *result, net_nfc_service_llcp_cb cb, void *user_param)
+bool net_nfc_controller_llcp_recv(net_nfc_target_handle_s * handle, net_nfc_llcp_socket_t socket, uint32_t max_len, net_nfc_error_e * result, net_nfc_service_llcp_cb cb, void *user_param)
 {
-       if (g_interface.recv_llcp != NULL)
-       {
+       if (g_interface.recv_llcp != NULL) {
                net_nfc_llcp_param_t *param = NULL;
 
                _net_nfc_util_alloc_mem(param, sizeof(*param));
@@ -1026,34 +865,29 @@ bool net_nfc_controller_llcp_recv(net_nfc_target_handle_s *handle, net_nfc_llcp_
                param->user_param = user_param;
 
                return g_interface.recv_llcp(handle, socket, &param->data, result, param);
-       }
-       else
-       {
+       } else {
                *result = NET_NFC_DEVICE_DOES_NOT_SUPPORT_NFC;
                DEBUG_SERVER_MSG("interface is null");
                return false;
        }
 }
 
-void net_nfc_controller_llcp_sent_cb(net_nfc_llcp_socket_t socket,
-       net_nfc_error_e result, void *data, void *user_param)
+void net_nfc_controller_llcp_sent_cb(net_nfc_llcp_socket_t socket, net_nfc_error_e result, void *data, void *user_param)
 {
-       net_nfc_llcp_param_t *param = (net_nfc_llcp_param_t *)user_param;
+       net_nfc_llcp_param_t *param = (net_nfc_llcp_param_t *) user_param;
 
        if (param == NULL)
                return;
 
-       if (param->cb != NULL) {
+       if (param->cb != NULL)
                param->cb(param->socket, result, NULL, NULL, param->user_param);
-       }
 
        _net_nfc_util_free_mem(param);
 }
 
-bool net_nfc_controller_llcp_send(net_nfc_target_handle_s *handle, net_nfc_llcp_socket_t socket, data_s *data, net_nfc_error_e *result, net_nfc_service_llcp_cb cb, void *user_param)
+bool net_nfc_controller_llcp_send(net_nfc_target_handle_s * handle, net_nfc_llcp_socket_t socket, data_s * data, net_nfc_error_e * result, net_nfc_service_llcp_cb cb, void *user_param)
 {
-       if (g_interface.send_llcp != NULL)
-       {
+       if (g_interface.send_llcp != NULL) {
                net_nfc_llcp_param_t *param = NULL;
 
                _net_nfc_util_alloc_mem(param, sizeof(*param));
@@ -1068,18 +902,16 @@ bool net_nfc_controller_llcp_send(net_nfc_target_handle_s *handle, net_nfc_llcp_
                param->user_param = user_param;
 
                return g_interface.send_llcp(handle, socket, data, result, param);
-       }
-       else
-       {
+       } else {
                *result = NET_NFC_DEVICE_DOES_NOT_SUPPORT_NFC;
                DEBUG_SERVER_MSG("interface is null");
                return false;
        }
 }
-bool net_nfc_controller_llcp_recv_from(net_nfc_target_handle_s *handle, net_nfc_llcp_socket_t socket, uint32_t max_len, net_nfc_error_e *result, net_nfc_service_llcp_cb cb, void *user_param)
+
+bool net_nfc_controller_llcp_recv_from(net_nfc_target_handle_s * handle, net_nfc_llcp_socket_t socket, uint32_t max_len, net_nfc_error_e * result, net_nfc_service_llcp_cb cb, void *user_param)
 {
-       if (g_interface.recv_from_llcp != NULL)
-       {
+       if (g_interface.recv_from_llcp != NULL) {
                net_nfc_llcp_param_t *param = NULL;
 
                _net_nfc_util_alloc_mem(param, sizeof(*param));
@@ -1103,18 +935,16 @@ bool net_nfc_controller_llcp_recv_from(net_nfc_target_handle_s *handle, net_nfc_
                param->user_param = user_param;
 
                return g_interface.recv_from_llcp(handle, socket, &param->data, result, param);
-       }
-       else
-       {
+       } else {
                *result = NET_NFC_DEVICE_DOES_NOT_SUPPORT_NFC;
                DEBUG_SERVER_MSG("interface is null");
                return false;
        }
 }
-bool net_nfc_controller_llcp_send_to(net_nfc_target_handle_s *handle, net_nfc_llcp_socket_t socket, data_s *data, uint8_t service_access_point, net_nfc_error_e *result, net_nfc_service_llcp_cb cb, void *user_param)
+
+bool net_nfc_controller_llcp_send_to(net_nfc_target_handle_s * handle, net_nfc_llcp_socket_t socket, data_s * data, uint8_t service_access_point, net_nfc_error_e * result, net_nfc_service_llcp_cb cb, void *user_param)
 {
-       if (g_interface.send_to_llcp != NULL)
-       {
+       if (g_interface.send_to_llcp != NULL) {
                net_nfc_llcp_param_t *param = NULL;
 
                _net_nfc_util_alloc_mem(param, sizeof(*param));
@@ -1129,36 +959,29 @@ bool net_nfc_controller_llcp_send_to(net_nfc_target_handle_s *handle, net_nfc_ll
                param->user_param = user_param;
 
                return g_interface.send_to_llcp(handle, socket, data, service_access_point, result, param);
-       }
-       else
-       {
+       } else {
                *result = NET_NFC_DEVICE_DOES_NOT_SUPPORT_NFC;
                DEBUG_SERVER_MSG("interface is null");
                return false;
        }
 }
 
-bool net_nfc_controller_llcp_get_remote_config(net_nfc_target_handle_s *handle, net_nfc_llcp_config_info_s *config, net_nfc_error_e *result)
+bool net_nfc_controller_llcp_get_remote_config(net_nfc_target_handle_s * handle, net_nfc_llcp_config_info_s * config, net_nfc_error_e * result)
 {
-       if (g_interface.get_remote_config != NULL)
-       {
+       if (g_interface.get_remote_config != NULL) {
                return g_interface.get_remote_config(handle, config, result);
-       }
-       else
-       {
+       } else {
                *result = NET_NFC_DEVICE_DOES_NOT_SUPPORT_NFC;
                DEBUG_SERVER_MSG("interface is null");
                return false;
        }
 }
-bool net_nfc_controller_llcp_get_remote_socket_info(net_nfc_target_handle_s *handle, net_nfc_llcp_socket_t socket, net_nfc_llcp_socket_option_s *option, net_nfc_error_e *result)
+
+bool net_nfc_controller_llcp_get_remote_socket_info(net_nfc_target_handle_s * handle, net_nfc_llcp_socket_t socket, net_nfc_llcp_socket_option_s * option, net_nfc_error_e * result)
 {
-       if (g_interface.get_remote_socket_info != NULL)
-       {
+       if (g_interface.get_remote_socket_info != NULL) {
                return g_interface.get_remote_socket_info(handle, socket, option, result);
-       }
-       else
-       {
+       } else {
                *result = NET_NFC_DEVICE_DOES_NOT_SUPPORT_NFC;
                DEBUG_SERVER_MSG("interface is null");
                return false;
@@ -1166,279 +989,214 @@ bool net_nfc_controller_llcp_get_remote_socket_info(net_nfc_target_handle_s *han
 
 }
 
-bool net_nfc_controller_sim_test(net_nfc_error_e *result)
+bool net_nfc_controller_sim_test(net_nfc_error_e * result)
 {
-       if (g_interface.sim_test != NULL)
-       {
+       if (g_interface.sim_test != NULL) {
                return g_interface.sim_test(result);
-       }
-       else
-       {
+       } else {
                *result = NET_NFC_DEVICE_DOES_NOT_SUPPORT_NFC;
                DEBUG_SERVER_MSG("interface is null");
                return false;
        }
 }
 
-bool net_nfc_controller_prbs_test(net_nfc_error_e *result, uint32_t tech, uint32_t rate)
+bool net_nfc_controller_prbs_test(net_nfc_error_e * result, uint32_t tech, uint32_t rate)
 {
-       if (g_interface.prbs_test != NULL)
-       {
+       if (g_interface.prbs_test != NULL) {
                return g_interface.prbs_test(result, tech, rate);
-       }
-       else
-       {
+       } else {
                *result = NET_NFC_DEVICE_DOES_NOT_SUPPORT_NFC;
                DEBUG_SERVER_MSG("interface is null");
                return false;
        }
 }
 
-bool net_nfc_controller_test_mode_on(net_nfc_error_e *result)
+bool net_nfc_controller_test_mode_on(net_nfc_error_e * result)
 {
-       if (g_interface.test_mode_on != NULL)
-       {
+       if (g_interface.test_mode_on != NULL) {
                return g_interface.test_mode_on(result);
-       }
-       else
-       {
+       } else {
                *result = NET_NFC_DEVICE_DOES_NOT_SUPPORT_NFC;
                DEBUG_SERVER_MSG("interface is null");
                return false;
        }
 }
 
-bool net_nfc_controller_test_mode_off(net_nfc_error_e *result)
+bool net_nfc_controller_test_mode_off(net_nfc_error_e * result)
 {
-       if (g_interface.test_mode_off != NULL)
-       {
+       if (g_interface.test_mode_off != NULL) {
                return g_interface.test_mode_off(result);
-       }
-       else
-       {
+       } else {
                *result = NET_NFC_DEVICE_DOES_NOT_SUPPORT_NFC;
                DEBUG_SERVER_MSG("interface is null");
                return false;
        }
 }
 
-bool net_nfc_controller_support_nfc(net_nfc_error_e *result)
+bool net_nfc_controller_support_nfc(net_nfc_error_e * result)
 {
-       if (g_interface.support_nfc != NULL)
-       {
+       if (g_interface.support_nfc != NULL) {
                return g_interface.support_nfc(result);
-       }
-       else
-       {
+       } else {
                *result = NET_NFC_DEVICE_DOES_NOT_SUPPORT_NFC;
                DEBUG_SERVER_MSG("interface is null");
                return false;
        }
 }
 
-bool net_nfc_controller_eedata_register_set(net_nfc_error_e *result, uint32_t mode, uint32_t reg_id, data_s *data)
+bool net_nfc_controller_eedata_register_set(net_nfc_error_e * result, uint32_t mode, uint32_t reg_id, data_s * data)
 {
-       if (g_interface.eedata_register_set != NULL)
-       {
+       if (g_interface.eedata_register_set != NULL) {
                return g_interface.eedata_register_set(result, mode, reg_id, data);
-       }
-       else
-       {
+       } else {
                *result = NET_NFC_DEVICE_DOES_NOT_SUPPORT_NFC;
                DEBUG_SERVER_MSG("interface is null");
                return false;
        }
 }
 
-bool net_nfc_controller_ese_test(net_nfc_error_e *result)
+bool net_nfc_controller_ese_test(net_nfc_error_e * result)
 {
-       if (g_interface.ese_test != NULL)
-       {
+       if (g_interface.ese_test != NULL) {
                return g_interface.ese_test(result);
-       }
-       else
-       {
+       } else {
                *result = NET_NFC_DEVICE_DOES_NOT_SUPPORT_NFC;
                DEBUG_SERVER_MSG("NFC ESE TEST interface is null");
                return false;
        }
 }
 
-bool net_nfc_controller_test_set_se_tech_type(net_nfc_error_e *result, net_nfc_se_type_e type, uint32_t tech)
+bool net_nfc_controller_test_set_se_tech_type(net_nfc_error_e * result, net_nfc_se_type_e type, uint32_t tech)
 {
-       if (g_interface.test_set_se_tech_type != NULL)
-       {
+       if (g_interface.test_set_se_tech_type != NULL) {
                return g_interface.test_set_se_tech_type(result, type, tech);
-       }
-       else
-       {
+       } else {
                *result = NET_NFC_DEVICE_DOES_NOT_SUPPORT_NFC;
                DEBUG_ERR_MSG("interface is null");
 
                return false;
        }
 }
+
 #if 0
-bool net_nfc_controller_hce_listener(hce_active_listener_cb hce_active_listener, hce_deactive_listener_cb hce_deactive_listener, hce_apdu_listener_cb hce_apdu_listener, net_nfc_error_e *result)
+bool net_nfc_controller_hce_listener(hce_active_listener_cb hce_active_listener, hce_deactive_listener_cb hce_deactive_listener, hce_apdu_listener_cb hce_apdu_listener, net_nfc_error_e * result)
 {
-       if (g_interface.register_hce_listener != NULL)
-       {
+       if (g_interface.register_hce_listener != NULL) {
                return g_interface.register_hce_listener(hce_active_listener, hce_deactive_listener, hce_apdu_listener, result);
-       }
-       else
-       {
+       } else {
                *result = NET_NFC_DEVICE_DOES_NOT_SUPPORT_NFC;
                DEBUG_SERVER_MSG("interface is null");
                return false;
        }
 }
 #endif
-bool net_nfc_controller_hce_response_apdu(net_nfc_target_handle_s *handle, data_s *response, net_nfc_error_e *result)
+bool net_nfc_controller_hce_response_apdu(net_nfc_target_handle_s * handle, data_s * response, net_nfc_error_e * result)
 {
-       if (g_interface.hce_response_apdu != NULL)
-       {
+       if (g_interface.hce_response_apdu != NULL) {
                return g_interface.hce_response_apdu(handle, response, result);
-       }
-       else
-       {
+       } else {
                *result = NET_NFC_DEVICE_DOES_NOT_SUPPORT_NFC;
                DEBUG_SERVER_MSG("interface is null");
                return false;
        }
 }
 
-bool net_nfc_controller_secure_element_route_aid(data_s *aid, net_nfc_se_type_e se_type, int power, net_nfc_error_e *result)
+bool net_nfc_controller_secure_element_route_aid(data_s * aid, net_nfc_se_type_e se_type, int power, net_nfc_error_e * result)
 {
-       if (g_interface.route_aid != NULL)
-       {
+       if (g_interface.route_aid != NULL) {
                return g_interface.route_aid(aid, se_type, power, result);
-       }
-       else
-       {
+       } else {
                DEBUG_SERVER_MSG("interface is null");
                return false;
        }
 }
 
-bool net_nfc_controller_secure_element_unroute_aid(data_s *aid, net_nfc_error_e *result)
+bool net_nfc_controller_secure_element_unroute_aid(data_s * aid, net_nfc_error_e * result)
 {
-       if (g_interface.unroute_aid != NULL)
-       {
+       if (g_interface.unroute_aid != NULL) {
                return g_interface.unroute_aid(aid, result);
-       }
-       else
-       {
+       } else {
                DEBUG_SERVER_MSG("interface is null");
                return false;
        }
 }
 
-bool net_nfc_controller_secure_element_commit_routing(net_nfc_error_e *result)
+bool net_nfc_controller_secure_element_commit_routing(net_nfc_error_e * result)
 {
-       if (g_interface.commit_routing != NULL)
-       {
+       if (g_interface.commit_routing != NULL) {
                return g_interface.commit_routing(result);
-       }
-       else
-       {
+       } else {
                DEBUG_SERVER_MSG("interface is null");
                return false;
        }
 }
 
-bool net_nfc_controller_secure_element_set_default_route(
-       net_nfc_se_type_e switch_on,
-       net_nfc_se_type_e switch_off,
-       net_nfc_se_type_e battery_off, net_nfc_error_e *result)
+bool net_nfc_controller_secure_element_set_default_route(net_nfc_se_type_e switch_on, net_nfc_se_type_e switch_off, net_nfc_se_type_e battery_off, net_nfc_error_e * result)
 {
-       if (g_interface.set_default_route != NULL)
-       {
+       if (g_interface.set_default_route != NULL) {
                return g_interface.set_default_route(switch_on, switch_off, battery_off, result);
-       }
-       else
-       {
+       } else {
                DEBUG_SERVER_MSG("interface is null");
                return false;
        }
 }
 
-bool net_nfc_controller_secure_element_clear_aid_table(net_nfc_error_e *result)
+bool net_nfc_controller_secure_element_clear_aid_table(net_nfc_error_e * result)
 {
-       if (g_interface.clear_aid_table != NULL)
-       {
+       if (g_interface.clear_aid_table != NULL) {
                return g_interface.clear_aid_table(result);
-       }
-       else
-       {
+       } else {
                DEBUG_SERVER_MSG("interface is null");
                return false;
        }
 }
 
-bool net_nfc_controller_secure_element_get_aid_table_size(int *AIDTableSize, net_nfc_error_e *result)
+bool net_nfc_controller_secure_element_get_aid_table_size(int *AIDTableSize, net_nfc_error_e * result)
 {
-       if (g_interface.get_aid_tablesize != NULL)
-       {
+       if (g_interface.get_aid_tablesize != NULL) {
                return g_interface.get_aid_tablesize(AIDTableSize, result);
-       }
-       else
-       {
+       } else {
                DEBUG_SERVER_MSG("interface is null");
                return false;
        }
 }
 
-bool net_nfc_controller_secure_element_set_route_entry
-       (net_nfc_se_entry_type_e type, net_nfc_se_tech_protocol_type_e value, net_nfc_se_type_e route, int power, net_nfc_error_e *result)
+bool net_nfc_controller_secure_element_set_route_entry(net_nfc_se_entry_type_e type, net_nfc_se_tech_protocol_type_e value, net_nfc_se_type_e route, int power, net_nfc_error_e * result)
 {
-       if (g_interface.set_routing_entry != NULL)
-       {
+       if (g_interface.set_routing_entry != NULL) {
                return g_interface.set_routing_entry(type, value, route, power, result);
-       }
-       else
-       {
+       } else {
                DEBUG_SERVER_MSG("interface is null");
                return false;
        }
 }
 
-bool net_nfc_controller_secure_element_clear_routing_entry
-       (net_nfc_se_entry_type_e type, net_nfc_error_e *result)
+bool net_nfc_controller_secure_element_clear_routing_entry(net_nfc_se_entry_type_e type, net_nfc_error_e * result)
 {
-       if (g_interface.clear_routing_entry != NULL)
-       {
+       if (g_interface.clear_routing_entry != NULL) {
                return g_interface.clear_routing_entry(type, result);
-       }
-       else
-       {
+       } else {
                DEBUG_SERVER_MSG("interface is null");
                return false;
        }
 }
 
-bool net_nfc_controller_secure_element_set_listen_tech_mask(net_nfc_se_tech_protocol_type_e value, net_nfc_error_e *result)
+bool net_nfc_controller_secure_element_set_listen_tech_mask(net_nfc_se_tech_protocol_type_e value, net_nfc_error_e * result)
 {
-       if (g_interface.set_listen_tech_mask!= NULL)
-       {
-               return g_interface.set_listen_tech_mask(value , result);
-       }
-       else
-       {
+       if (g_interface.set_listen_tech_mask != NULL) {
+               return g_interface.set_listen_tech_mask(value, result);
+       } else {
                *result = NET_NFC_UNKNOWN_ERROR;
                DEBUG_SERVER_MSG("interface is null");
                return false;
        }
 }
 
-
-bool net_nfc_controller_set_screen_state(net_nfc_screen_state_type_e screen_state, net_nfc_error_e *result)
+bool net_nfc_controller_set_screen_state(net_nfc_screen_state_type_e screen_state, net_nfc_error_e * result)
 {
-       if (g_interface.set_screen_state!= NULL)
-       {
-               return g_interface.set_screen_state(screen_state , result);
-       }
-       else
-       {
+       if (g_interface.set_screen_state != NULL) {
+               return g_interface.set_screen_state(screen_state, result);
+       } else {
                *result = NET_NFC_UNKNOWN_ERROR;
                DEBUG_SERVER_MSG("interface is null");
                return false;
index 542bd2b..4d5e5c6 100755 (executable)
@@ -40,9 +40,9 @@
 static gboolean use_daemon = FALSE;
 
 GOptionEntry option_entries[] = {
-       { "daemon", 'd', 0, G_OPTION_ARG_NONE, &use_daemon,
-               "Use Daemon mode", NULL },
-       { NULL }
+       {"daemon", 'd', 0, G_OPTION_ARG_NONE, &use_daemon,
+        "Use Daemon mode", NULL},
+       {NULL}
 };
 
 static GMainLoop *loop = NULL;
@@ -58,8 +58,7 @@ static void _net_nfc_disable_ese()
        if (vconf_get_bool(VCONFKEY_NFC_ESE_DISABLE, &value) < 0)
                return;
 
-       if (value == true)
-       {
+       if (value == true) {
                DEBUG_SERVER_MSG("Set the se_type , wallet mode HCE");
 
                vconf_set_int(VCONFKEY_NFC_SE_TYPE, VCONFKEY_NFC_SE_POLICY_HCE_ON);
@@ -68,19 +67,15 @@ static void _net_nfc_disable_ese()
        }
 }
 
-
 void net_nfc_manager_quit()
 {
        DEBUG_SERVER_MSG("net_nfc_manager_quit kill the nfc-manager daemon!!");
 
-       if (loop != NULL) {
+       if (loop != NULL)
                g_main_loop_quit(loop);
-       }
 }
 
-static void on_bus_acquired(GDBusConnection *connection,
-                       const gchar *path,
-                       gpointer user_data)
+static void on_bus_acquired(GDBusConnection * connection, const gchar * path, gpointer user_data)
 {
        gint state;
 
@@ -88,14 +83,13 @@ static void on_bus_acquired(GDBusConnection *connection,
 
        net_nfc_server_gdbus_init();
 
-       #if 0
+#if 0
        net_nfc_server_controller_init();
-       #else
+#else
        net_nfc_server_controller_init_sync();
-       #endif
+#endif
 
-       if (vconf_get_bool(VCONFKEY_NFC_STATE, &state) != 0)
-       {
+       if (vconf_get_bool(VCONFKEY_NFC_STATE, &state) != 0) {
                DEBUG_SERVER_MSG("VCONFKEY_NFC_STATE is not exist");
                net_nfc_server_controller_deinit();
 
@@ -113,31 +107,25 @@ static void on_bus_acquired(GDBusConnection *connection,
        else if (net_nfc_check_mode_conditions())
                net_nfc_server_manager_set_active(FALSE);
 #ifndef ESE_ALWAYS_ON
-       else if (use_daemon == TRUE)
-       {
+       else if (use_daemon == TRUE) {
                DEBUG_SERVER_MSG("exit process...");
                net_nfc_server_controller_deinit();
        }
 #endif
 }
 
-static void on_name_acquired(GDBusConnection *connection,
-                       const gchar *name,
-                       gpointer user_data)
+static void on_name_acquired(GDBusConnection * connection, const gchar * name, gpointer user_data)
 {
        SECURE_MSG("name : %s", name);
 }
 
-static void on_name_lost(GDBusConnection *connnection,
-                       const gchar *name,
-                       gpointer user_data)
+static void on_name_lost(GDBusConnection * connnection, const gchar * name, gpointer user_data)
 {
        SECURE_MSG("name : %s", name);
 
        net_nfc_manager_quit();
 }
 
-
 int main(int argc, char *argv[])
 {
        void *handle = NULL;
@@ -147,17 +135,10 @@ int main(int argc, char *argv[])
        GError *error = NULL;
 
        option_context = g_option_context_new("Nfc manager");
-       g_option_context_add_main_entries(option_context,
-                                       option_entries,
-                                       NULL);
-
-       if (g_option_context_parse(option_context,
-                               &argc,
-                               &argv,
-                               &error) == FALSE)
-       {
-               DEBUG_ERR_MSG("can not parse option: %s",
-                               error->message);
+       g_option_context_add_main_entries(option_context, option_entries, NULL);
+
+       if (g_option_context_parse(option_context, &argc, &argv, &error) == FALSE) {
+               DEBUG_ERR_MSG("can not parse option: %s", error->message);
                g_error_free(error);
 
                g_option_context_free(option_context);
@@ -172,57 +153,37 @@ int main(int argc, char *argv[])
        net_nfc_app_util_clean_storage(MESSAGE_STORAGE);
 
        handle = net_nfc_controller_onload();
-       if (handle == NULL)
-       {
+       if (handle == NULL) {
                DEBUG_ERR_MSG("load plugin library is failed");
 
-               if (vconf_set_bool(VCONFKEY_NFC_FEATURE,
-                               VCONFKEY_NFC_FEATURE_OFF) != 0)
-               {
-                       DEBUG_ERR_MSG("VCONFKEY_NFC_FEATURE set to %d failed",
-                                       VCONFKEY_NFC_FEATURE_OFF);
-               }
+               if (vconf_set_bool(VCONFKEY_NFC_FEATURE, VCONFKEY_NFC_FEATURE_OFF) != 0)
+                       DEBUG_ERR_MSG("VCONFKEY_NFC_FEATURE set to %d failed", VCONFKEY_NFC_FEATURE_OFF);
 
                if (vconf_set_bool(VCONFKEY_NFC_STATE, 0) != 0)
-               {
-                       DEBUG_ERR_MSG("VCONFKEY_NFC_STATE set to %d failed",
-                                       0);
-               }
+                       DEBUG_ERR_MSG("VCONFKEY_NFC_STATE set to %d failed", 0);
 
                goto EXIT;
        }
 
        if (vconf_set_bool(VCONFKEY_NFC_FEATURE, VCONFKEY_NFC_FEATURE_ON) != 0)
-       {
-               DEBUG_ERR_MSG("VCONFKEY_NFC_FEATURE set to %d failed",
-                               VCONFKEY_NFC_FEATURE_ON);
-       }
+               DEBUG_ERR_MSG("VCONFKEY_NFC_FEATURE set to %d failed", VCONFKEY_NFC_FEATURE_ON);
 
-       id = g_bus_own_name(G_BUS_TYPE_SYSTEM,
-               "org.tizen.NetNfcService",
-               G_BUS_NAME_OWNER_FLAGS_NONE,
-               on_bus_acquired,
-               on_name_acquired,
-               on_name_lost,
-               NULL,
-               NULL);
+       id = g_bus_own_name(G_BUS_TYPE_SYSTEM, "org.tizen.NetNfcService", G_BUS_NAME_OWNER_FLAGS_NONE, on_bus_acquired, on_name_acquired, on_name_lost, NULL, NULL);
 
        loop = g_main_loop_new(NULL, FALSE);
 
        g_main_loop_run(loop);
 
-EXIT :
+ EXIT:
        g_main_loop_unref(loop);
 
        net_nfc_server_vconf_deinit();
        net_nfc_server_gdbus_deinit();
 
        if (id)
-       {
                g_bus_unown_name(id);
-       }
 
-       usleep(1000 * 10); // 10ms
+       usleep(1000 * 10);                      // 10ms
 
        net_nfc_controller_unload(handle);
        DEBUG_SERVER_MSG("END net_nfc_controller_unload");
@@ -241,26 +202,20 @@ static bool net_nfc_check_mode_conditions()
        gint result = 0;
 
        result = vconf_get_bool(VCONFKEY_TELEPHONY_FLIGHT_MODE, &flight_mode);
-       if (result != 0)
-       {
-               DEBUG_ERR_MSG("Can not get %s",
-                               "VCONFKEY_TELEPHONY_FLIGHT_MODE");
+       if (result != 0) {
+               DEBUG_ERR_MSG("Can not get %s", "VCONFKEY_TELEPHONY_FLIGHT_MODE");
                return FALSE;
        }
 
-       if (flight_mode == TRUE)
-       {
+       if (flight_mode == TRUE) {
                DEBUG_SERVER_MSG("Flight mode!! Do Not Kill Daemon!!");
                return TRUE;
-       }
-       else
-       {
+       } else {
                DEBUG_SERVER_MSG("Not any mode!!");
                return FALSE;
        }
 #else
-return FALSE;
+       return FALSE;
 #endif
 
-
 }
index 4fc3a40..b674f80 100755 (executable)
@@ -26,8 +26,7 @@
 #include "net_nfc_util_internal.h"
 #include "net_nfc_manager_util_internal.h"
 
-static void __focus_changed_cb(sound_stream_info_h stream_info, sound_stream_focus_mask_e focus_mask, sound_stream_focus_state_e focus_state,
-       sound_stream_focus_change_reason_e reason_for_change, int sound_behavior, const char *additional_info, void *user_data)
+static void __focus_changed_cb(sound_stream_info_h stream_info, sound_stream_focus_mask_e focus_mask, sound_stream_focus_state_e focus_state, sound_stream_focus_change_reason_e reason_for_change, int sound_behavior, const char *additional_info, void *user_data)
 {
 
 }
@@ -40,66 +39,55 @@ static void __wav_start_completed_cb(int id, void *user_data)
        sound_manager_destroy_stream_information(stream_info);
 }
 
-
 void net_nfc_manager_util_play_sound(net_nfc_sound_type_e sound_type)
 {
        int bSoundOn = 0;
        int bVibrationOn = 0;
 
-       if (vconf_get_bool(VCONFKEY_SETAPPL_SOUND_STATUS_BOOL, &bSoundOn) != 0)
-       {
+       if (vconf_get_bool(VCONFKEY_SETAPPL_SOUND_STATUS_BOOL, &bSoundOn) != 0) {
                DEBUG_SERVER_MSG("vconf_get_bool failed for Sound");
                return;
        }
 
-       if (vconf_get_bool(VCONFKEY_SETAPPL_VIBRATION_STATUS_BOOL, &bVibrationOn) != 0)
-       {
+       if (vconf_get_bool(VCONFKEY_SETAPPL_VIBRATION_STATUS_BOOL, &bVibrationOn) != 0) {
                DEBUG_SERVER_MSG("vconf_get_bool failed for Vibration");
                return;
        }
 
-       if ((sound_type > NET_NFC_TASK_ERROR) || (sound_type < NET_NFC_TASK_START))
-       {
+       if ((sound_type > NET_NFC_TASK_ERROR) || (sound_type < NET_NFC_TASK_START)) {
                DEBUG_SERVER_MSG("Invalid Sound Type");
                return;
        }
 
-       if (bVibrationOn)
-       {
+       if (bVibrationOn) {
                DEBUG_SERVER_MSG("Play Vibration");
 
-               if (FEEDBACK_ERROR_NONE == feedback_initialize())
-               {
-                       if (FEEDBACK_ERROR_NONE ==  feedback_play_type(FEEDBACK_TYPE_VIBRATION, FEEDBACK_PATTERN_SIP))
-                       {
+               if (FEEDBACK_ERROR_NONE == feedback_initialize()) {
+                       if (FEEDBACK_ERROR_NONE == feedback_play_type(FEEDBACK_TYPE_VIBRATION, FEEDBACK_PATTERN_SIP))
                                DEBUG_SERVER_MSG("feedback_play_type success");
-                       }
 
                        feedback_deinitialize();
                }
        }
 
-       if (bSoundOn)
-       {
+       if (bSoundOn) {
                char *sound_path = NULL;
 
                DEBUG_SERVER_MSG("Play Sound");
 
-               switch (sound_type)
-               {
-               case NET_NFC_TASK_START :
+               switch (sound_type) {
+               case NET_NFC_TASK_START:
                        sound_path = strdup(NET_NFC_MANAGER_SOUND_PATH_TASK_START);
                        break;
-               case NET_NFC_TASK_END :
+               case NET_NFC_TASK_END:
                        sound_path = strdup(NET_NFC_MANAGER_SOUND_PATH_TASK_END);
                        break;
-               case NET_NFC_TASK_ERROR :
+               case NET_NFC_TASK_ERROR:
                        sound_path = strdup(NET_NFC_MANAGER_SOUND_PATH_TASK_ERROR);
                        break;
                }
 
-               if (sound_path != NULL)
-               {
+               if (sound_path != NULL) {
                        int id;
                        int ret;
                        sound_stream_info_h stream_info;
@@ -109,13 +97,11 @@ void net_nfc_manager_util_play_sound(net_nfc_sound_type_e sound_type)
                        if (ret == SOUND_MANAGER_ERROR_NONE) {
                                ret = sound_manager_acquire_focus(stream_info, SOUND_STREAM_FOCUS_FOR_PLAYBACK, SOUND_BEHAVIOR_NONE, NULL);
                                if (ret == SOUND_MANAGER_ERROR_NONE) {
-                                       ret = wav_player_start_new(sound_path,
-                                               stream_info, __wav_start_completed_cb, stream_info, &id);
-                                       if (ret == WAV_PLAYER_ERROR_NONE) {
+                                       ret = wav_player_start_new(sound_path, stream_info, __wav_start_completed_cb, stream_info, &id);
+                                       if (ret == WAV_PLAYER_ERROR_NONE)
                                                DEBUG_SERVER_MSG("wav_player_start_with_stream_info success");
-                                       } else {
+                                       else
                                                DEBUG_SERVER_MSG("wav_player_start_with_stream_info failed");
-                                       }
                                } else {
                                        DEBUG_SERVER_MSG("sound_manager_acquire_focus failed");
                                }
@@ -124,9 +110,7 @@ void net_nfc_manager_util_play_sound(net_nfc_sound_type_e sound_type)
                        }
 
                        _net_nfc_util_free_mem(sound_path);
-               }
-               else
-               {
+               } else {
                        DEBUG_ERR_MSG("Invalid Sound Path");
                }
        }
index 5930f32..bb3d1dd 100755 (executable)
@@ -34,7 +34,6 @@
 #include "net_nfc_server_context_internal.h"
 #include "net_nfc_server_hce.h"
 
-
 static GDBusConnection *connection = NULL;
 static guint subscribe_id;
 
@@ -44,17 +43,7 @@ pid_t net_nfc_server_gdbus_get_pid(const char *name)
        GError *error = NULL;
        GVariant *_ret;
 
-       _ret = g_dbus_connection_call_sync(connection,
-               "org.freedesktop.DBus",
-               "/org/freedesktop/DBus",
-               "org.freedesktop.DBus",
-               "GetConnectionUnixProcessID",
-               g_variant_new("(s)", name),
-               NULL,
-               G_DBUS_CALL_FLAGS_NONE,
-               -1,
-               NULL,
-               &error);
+       _ret = g_dbus_connection_call_sync(connection, "org.freedesktop.DBus", "/org/freedesktop/DBus", "org.freedesktop.DBus", "GetConnectionUnixProcessID", g_variant_new("(s)", name), NULL, G_DBUS_CALL_FLAGS_NONE, -1, NULL, &error);
        if (_ret != NULL) {
                g_variant_get(_ret, "(u)", &pid);
                g_variant_unref(_ret);
@@ -64,9 +53,7 @@ pid_t net_nfc_server_gdbus_get_pid(const char *name)
        return pid;
 }
 
-static void _name_owner_changed(GDBusProxy *proxy,
-       const gchar *name, const gchar *old_owner,
-       const gchar *new_owner, void *user_data)
+static void _name_owner_changed(GDBusProxy * proxy, const gchar * name, const gchar * old_owner, const gchar * new_owner, void *user_data)
 {
        if (name == NULL || old_owner == NULL || new_owner == NULL) {
                DEBUG_ERR_MSG("invalid parameter");
@@ -82,23 +69,15 @@ static void _name_owner_changed(GDBusProxy *proxy,
        }
 }
 
-static void _on_name_owner_changed(GDBusConnection *connection,
-       const gchar *sender_name, const gchar *object_path,
-       const gchar *interface_name, const gchar *signal_name,
-       GVariant *parameters, gpointer user_data)
+static void _on_name_owner_changed(GDBusConnection * connection, const gchar * sender_name, const gchar * object_path, const gchar * interface_name, const gchar * signal_name, GVariant * parameters, gpointer user_data)
 {
        gchar *name;
        gchar *old_owner;
        gchar *new_owner;
 
-       g_variant_get(parameters,
-               "(sss)",
-               &name,
-               &old_owner,
-               &new_owner);
+       g_variant_get(parameters, "(sss)", &name, &old_owner, &new_owner);
 
-       _name_owner_changed((GDBusProxy *)connection,
-               name, old_owner, new_owner, user_data);
+       _name_owner_changed((GDBusProxy *) connection, name, old_owner, new_owner, user_data);
 
        g_free(name);
        g_free(old_owner);
@@ -111,15 +90,12 @@ static void _subscribe_name_owner_changed_event()
                return;
 
        /* subscribe signal */
-       subscribe_id = g_dbus_connection_signal_subscribe(connection,
-               "org.freedesktop.DBus", /* bus name */
-               "org.freedesktop.DBus", /* interface */
-               "NameOwnerChanged", /* member */
-               "/org/freedesktop/DBus", /* path */
-               NULL, /* arg0 */
-               G_DBUS_SIGNAL_FLAGS_NONE,
-               _on_name_owner_changed,
-               NULL, NULL);
+       subscribe_id = g_dbus_connection_signal_subscribe(connection, "org.freedesktop.DBus",   /* bus name */
+                                                                                                         "org.freedesktop.DBus",       /* interface */
+                                                                                                         "NameOwnerChanged",   /* member */
+                                                                                                         "/org/freedesktop/DBus",      /* path */
+                                                                                                         NULL, /* arg0 */
+                                                                                                         G_DBUS_SIGNAL_FLAGS_NONE, _on_name_owner_changed, NULL, NULL);
 }
 
 static void _unsubscribe_name_owner_changed_event()
@@ -128,9 +104,8 @@ static void _unsubscribe_name_owner_changed_event()
                return;
 
        /* subscribe signal */
-       if (subscribe_id > 0) {
+       if (subscribe_id > 0)
                g_dbus_connection_signal_unsubscribe(connection, subscribe_id);
-       }
 }
 
 void net_nfc_server_gdbus_init(void)
@@ -141,91 +116,77 @@ void net_nfc_server_gdbus_init(void)
                g_object_unref(connection);
 
        connection = g_bus_get_sync(G_BUS_TYPE_SYSTEM, NULL, &error);
-       if (connection == NULL)
-       {
+       if (connection == NULL) {
                DEBUG_ERR_MSG("Can not get connection %s", error->message);
-               g_error_free (error);
+               g_error_free(error);
                return;
        }
 
        net_nfc_server_gdbus_init_client_context();
 
-       if (net_nfc_server_controller_thread_init() == FALSE)
-       {
+       if (net_nfc_server_controller_thread_init() == FALSE) {
                DEBUG_ERR_MSG("Can not init controller thread");
                return;
        }
 
        _subscribe_name_owner_changed_event();
 
-       if (net_nfc_server_manager_init(connection) == FALSE)
-       {
+       if (net_nfc_server_manager_init(connection) == FALSE) {
                DEBUG_ERR_MSG("Can not init manager");
                return;
        }
 
-       if (net_nfc_server_tag_init(connection) == FALSE)
-       {
+       if (net_nfc_server_tag_init(connection) == FALSE) {
                DEBUG_ERR_MSG("Can not init tag");
                return;
        }
 
-       if (net_nfc_server_ndef_init(connection) == FALSE)
-       {
+       if (net_nfc_server_ndef_init(connection) == FALSE) {
                DEBUG_ERR_MSG("Can not init ndef");
                return;
        }
 
-       if (net_nfc_server_llcp_init(connection) == FALSE)
-       {
+       if (net_nfc_server_llcp_init(connection) == FALSE) {
                DEBUG_ERR_MSG("Can not init llcp");
                return;
        }
 
-       if (net_nfc_server_p2p_init(connection) == FALSE)
-       {
+       if (net_nfc_server_p2p_init(connection) == FALSE) {
                DEBUG_ERR_MSG("Can not init tag");
                return;
        }
 
-       if (net_nfc_server_transceive_init(connection) == FALSE)
-       {
+       if (net_nfc_server_transceive_init(connection) == FALSE) {
                DEBUG_ERR_MSG("Can not initialize transceive");
                return;
        }
 
-       if (net_nfc_server_test_init(connection) == FALSE)
-       {
+       if (net_nfc_server_test_init(connection) == FALSE) {
                DEBUG_ERR_MSG("Can not init Test");
                return;
        }
 
-       if (net_nfc_server_handover_init(connection) == FALSE)
-       {
+       if (net_nfc_server_handover_init(connection) == FALSE) {
                DEBUG_ERR_MSG("Can not initialize transceive");
                return;
        }
 
-       if (net_nfc_server_se_init(connection) == FALSE)
-       {
+       if (net_nfc_server_se_init(connection) == FALSE) {
                DEBUG_ERR_MSG("Can not init Test");
                return;
        }
 
-       if (net_nfc_server_snep_init(connection) == FALSE)
-       {
+       if (net_nfc_server_snep_init(connection) == FALSE) {
                DEBUG_ERR_MSG("Can not init controller thread");
                return;
        }
 
-       if (net_nfc_server_system_handler_init(connection) == FALSE)
-       {
+       if (net_nfc_server_system_handler_init(connection) == FALSE) {
                DEBUG_ERR_MSG("Can not init controller thread");
                return;
        }
 
-       if (net_nfc_server_hce_init(connection) == FALSE)
-       {
+       if (net_nfc_server_hce_init(connection) == FALSE) {
                DEBUG_ERR_MSG("Can not init Test");
                return;
        }
@@ -251,8 +212,7 @@ void net_nfc_server_gdbus_deinit(void)
 
        net_nfc_server_gdbus_deinit_client_context();
 
-       if (connection)
-       {
+       if (connection) {
                g_object_unref(connection);
                connection = NULL;
        }
index 9f8b261..36c3243 100755 (executable)
 #include "net_nfc_server_se.h"
 #include "net_nfc_server_hce.h"
 
-
 typedef struct _ControllerFuncData ControllerFuncData;
 
-struct _ControllerFuncData
-{
+struct _ControllerFuncData {
        net_nfc_server_controller_func func;
        gpointer data;
        gboolean blocking;
@@ -43,17 +41,13 @@ static void controller_async_queue_free_func(gpointer user_data);
 
 static void controller_thread_deinit_thread_func(gpointer user_data);
 
-static void controller_target_detected_cb(void *info,
-                               void *user_context);
+static void controller_target_detected_cb(void *info, void *user_context);
 
-static void controller_se_transaction_cb(void *info,
-                               void *user_context);
+static void controller_se_transaction_cb(void *info, void *user_context);
 
-static void controller_llcp_event_cb(void *info,
-                               void *user_context);
+static void controller_llcp_event_cb(void *info, void *user_context);
 
-static void controller_hce_apdu_cb(void *info,
-                               void *user_context);
+static void controller_hce_apdu_cb(void *info, void *user_context);
 
 static void controller_init_thread_func(gpointer user_data);
 
@@ -77,16 +71,13 @@ static gint controller_block;
 
 static gboolean check_nfc_disable = FALSE;
 
-
-
 static void controller_async_queue_free_func(gpointer user_data)
 {
-       ControllerFuncData *func_data = (ControllerFuncData *)user_data;
+       ControllerFuncData *func_data = (ControllerFuncData *) user_data;
 
        if (func_data != NULL) {
-               if (func_data->blocking == true) {
+               if (func_data->blocking == true)
                        controller_block--;
-               }
 
                g_free(user_data);
        }
@@ -94,16 +85,14 @@ static void controller_async_queue_free_func(gpointer user_data)
 
 static gpointer controller_thread_func(gpointer user_data)
 {
-       if (controller_async_queue == NULL)
-       {
+       if (controller_async_queue == NULL) {
                g_thread_exit(NULL);
 
                return NULL;
        }
 
        controller_is_running = TRUE;
-       while (controller_is_running)
-       {
+       while (controller_is_running) {
                ControllerFuncData *func_data;
 
                func_data = g_async_queue_pop(controller_async_queue);
@@ -123,53 +112,40 @@ static void controller_thread_deinit_thread_func(gpointer user_data)
        controller_is_running = FALSE;
 }
 
-static net_nfc_current_target_info_s *_create_target_info(
-       net_nfc_request_target_detected_t *msg)
+static net_nfc_current_target_info_s *_create_target_info(net_nfc_request_target_detected_t * msg)
 {
        net_nfc_current_target_info_s *info;
 
-       info = g_malloc0(sizeof(net_nfc_current_target_info_s) +
-               msg->target_info_values.length);
+       info = g_malloc0(sizeof(net_nfc_current_target_info_s) + msg->target_info_values.length);
 
-       if(info == NULL)
+       if (info == NULL)
                return NULL;
 
        info->handle = msg->handle;
        info->devType = msg->devType;
 
-       if (info->devType != NET_NFC_NFCIP1_INITIATOR &&
-               info->devType != NET_NFC_NFCIP1_TARGET)
-       {
+       if (info->devType != NET_NFC_NFCIP1_INITIATOR && info->devType != NET_NFC_NFCIP1_TARGET) {
                info->number_of_keys = msg->number_of_keys;
-               info->target_info_values.length =
-                       msg->target_info_values.length;
+               info->target_info_values.length = msg->target_info_values.length;
 
-               memcpy(&info->target_info_values,
-                       &msg->target_info_values,
-                       info->target_info_values.length + sizeof(int));
+               memcpy(&info->target_info_values, &msg->target_info_values, info->target_info_values.length + sizeof(int));
        }
 
        return info;
 }
 
-
 /* FIXME: it works as broadcast only now */
-static void controller_target_detected_cb(void *info,
-                               void *user_context)
+static void controller_target_detected_cb(void *info, void *user_context)
 {
-       net_nfc_request_target_detected_t *req =
-               (net_nfc_request_target_detected_t *)info;
+       net_nfc_request_target_detected_t *req = (net_nfc_request_target_detected_t *) info;
 
        g_assert(info != NULL);
 
-       DEBUG_SERVER_MSG("check devType = [%d]", req->devType );
+       DEBUG_SERVER_MSG("check devType = [%d]", req->devType);
 
-       if (req->request_type == NET_NFC_MESSAGE_SERVICE_RESTART_POLLING_LOOP)
-       {
+       if (req->request_type == NET_NFC_MESSAGE_SERVICE_RESTART_POLLING_LOOP) {
                net_nfc_server_restart_polling_loop();
-       }
-       else
-       {
+       } else {
                bool ret = true;
                net_nfc_current_target_info_s *target_info;
 
@@ -177,8 +153,7 @@ static void controller_target_detected_cb(void *info,
                target_info = _create_target_info(req);
                if (target_info != NULL) {
                        if (req->devType != NET_NFC_UNKNOWN_TARGET) {
-                               if (req->devType == NET_NFC_NFCIP1_TARGET ||
-                                       req->devType == NET_NFC_NFCIP1_INITIATOR) {
+                               if (req->devType == NET_NFC_NFCIP1_TARGET || req->devType == NET_NFC_NFCIP1_INITIATOR) {
                                        /* llcp target detected */
                                        ret = net_nfc_server_llcp_target_detected(target_info);
                                } else {
@@ -193,51 +168,48 @@ static void controller_target_detected_cb(void *info,
                        DEBUG_ERR_MSG("_create_target_info failed");
                }
 
-               if(ret == false)
+               if (ret == false)
                        _net_nfc_util_free_mem(target_info);
        }
 
-       /* FIXME : should be removed when plugins would be fixed*/
+       /* FIXME : should be removed when plugins would be fixed */
        _net_nfc_util_free_mem(info);
 }
 
 /* FIXME : net_nfc_dispatcher_queue_push() need to be removed */
-static void controller_se_transaction_cb(void *info,
-                               void *user_context)
+static void controller_se_transaction_cb(void *info, void *user_context)
 {
-       net_nfc_request_se_event_t *req = (net_nfc_request_se_event_t *)info;
+       net_nfc_request_se_event_t *req = (net_nfc_request_se_event_t *) info;
 
        g_assert(info != NULL);
 
        req->user_param = user_context;
 
+       DEBUG_SERVER_MSG("SE Transaction = [%d]", req->request_type);
 
-       DEBUG_SERVER_MSG("SE Transaction = [%d]", req->request_type );
-
-       switch(req->request_type)
-       {
-       case NET_NFC_MESSAGE_SERVICE_SLAVE_ESE_DETECTED :
+       switch (req->request_type) {
+       case NET_NFC_MESSAGE_SERVICE_SLAVE_ESE_DETECTED:
                net_nfc_server_se_detected(req);
                break;
 
-       case NET_NFC_MESSAGE_SE_START_TRANSACTION :
+       case NET_NFC_MESSAGE_SE_START_TRANSACTION:
                net_nfc_server_se_transaction_received(req);
                break;
 
-       case NET_NFC_MESSAGE_SE_FIELD_ON :
+       case NET_NFC_MESSAGE_SE_FIELD_ON:
                net_nfc_server_se_rf_field_on(req);
                break;
 
-       case NET_NFC_MESSAGE_SE_CONNECTIVITY :
+       case NET_NFC_MESSAGE_SE_CONNECTIVITY:
                net_nfc_server_se_connected(req);
                break;
 
-       case NET_NFC_MESSAGE_SE_FIELD_OFF :
+       case NET_NFC_MESSAGE_SE_FIELD_OFF:
                net_nfc_server_se_rf_field_off(req);
                break;
 
-       default :
-               /* FIXME : should be removed when plugins would be fixed*/
+       default:
+               /* FIXME : should be removed when plugins would be fixed */
                _net_nfc_util_free_mem(info);
                break;
        }
@@ -246,99 +218,70 @@ static void controller_se_transaction_cb(void *info,
 /* FIXME : net_nfc_dispatcher_queue_push() need to be removed */
 static void _controller_llcp_event_cb(gpointer user_data)
 {
-       net_nfc_request_llcp_msg_t *req_msg =
-               (net_nfc_request_llcp_msg_t *)user_data;
+       net_nfc_request_llcp_msg_t *req_msg = (net_nfc_request_llcp_msg_t *) user_data;
 
-       if (req_msg == NULL)
-       {
+       if (req_msg == NULL) {
                DEBUG_ERR_MSG("can not get llcp_event info");
 
                return;
        }
 
-       switch (req_msg->request_type)
-       {
-       case NET_NFC_MESSAGE_SERVICE_LLCP_DEACTIVATED :
+       switch (req_msg->request_type) {
+       case NET_NFC_MESSAGE_SERVICE_LLCP_DEACTIVATED:
                net_nfc_server_llcp_deactivated(NULL);
                break;
 
-       case NET_NFC_MESSAGE_SERVICE_LLCP_LISTEN :
+       case NET_NFC_MESSAGE_SERVICE_LLCP_LISTEN:
                {
-                       net_nfc_request_listen_socket_t *msg =
-                               (net_nfc_request_listen_socket_t *)user_data;
+                       net_nfc_request_listen_socket_t *msg = (net_nfc_request_listen_socket_t *) user_data;
 
-                       net_nfc_controller_llcp_incoming_cb(msg->client_socket,
-                               msg->result, NULL, (void *)req_msg->user_param);
+                       net_nfc_controller_llcp_incoming_cb(msg->client_socket, msg->result, NULL, (void *)req_msg->user_param);
                }
                break;
 
-       case NET_NFC_MESSAGE_SERVICE_LLCP_SOCKET_ERROR :
-       case NET_NFC_MESSAGE_SERVICE_LLCP_SOCKET_ACCEPTED_ERROR :
-               net_nfc_controller_llcp_socket_error_cb(
-                       req_msg->llcp_socket,
-                       req_msg->result,
-                       NULL,
-                       (void *)req_msg->user_param);
+       case NET_NFC_MESSAGE_SERVICE_LLCP_SOCKET_ERROR:
+       case NET_NFC_MESSAGE_SERVICE_LLCP_SOCKET_ACCEPTED_ERROR:
+               net_nfc_controller_llcp_socket_error_cb(req_msg->llcp_socket, req_msg->result, NULL, (void *)req_msg->user_param);
                break;
 
-       case NET_NFC_MESSAGE_SERVICE_LLCP_SEND :
-       case NET_NFC_MESSAGE_SERVICE_LLCP_SEND_TO :
-               net_nfc_controller_llcp_sent_cb(
-                       req_msg->llcp_socket,
-                       req_msg->result,
-                       NULL,
-                       (void *)req_msg->user_param);
+       case NET_NFC_MESSAGE_SERVICE_LLCP_SEND:
+       case NET_NFC_MESSAGE_SERVICE_LLCP_SEND_TO:
+               net_nfc_controller_llcp_sent_cb(req_msg->llcp_socket, req_msg->result, NULL, (void *)req_msg->user_param);
                break;
 
-       case NET_NFC_MESSAGE_SERVICE_LLCP_RECEIVE :
+       case NET_NFC_MESSAGE_SERVICE_LLCP_RECEIVE:
                {
-                       net_nfc_request_receive_socket_t *msg =
-                               (net_nfc_request_receive_socket_t *)user_data;
+                       net_nfc_request_receive_socket_t *msg = (net_nfc_request_receive_socket_t *) user_data;
                        data_s data = { msg->data.buffer, msg->data.length };
 
-                       net_nfc_controller_llcp_received_cb(msg->client_socket,
-                               msg->result,
-                               &data,
-                               (void *)req_msg->user_param);
+                       net_nfc_controller_llcp_received_cb(msg->client_socket, msg->result, &data, (void *)req_msg->user_param);
                }
                break;
 
-       case NET_NFC_MESSAGE_SERVICE_LLCP_RECEIVE_FROM :
+       case NET_NFC_MESSAGE_SERVICE_LLCP_RECEIVE_FROM:
                {
-                       net_nfc_request_receive_from_socket_t *msg =
-                               (net_nfc_request_receive_from_socket_t *)user_data;
+                       net_nfc_request_receive_from_socket_t *msg = (net_nfc_request_receive_from_socket_t *) user_data;
                        data_s data = { msg->data.buffer, msg->data.length };
 
                        /* FIXME : pass sap */
-                       net_nfc_controller_llcp_received_cb(msg->client_socket,
-                               msg->result,
-                               &data,
-                               (void *)req_msg->user_param);
+                       net_nfc_controller_llcp_received_cb(msg->client_socket, msg->result, &data, (void *)req_msg->user_param);
                }
                break;
 
-       case NET_NFC_MESSAGE_SERVICE_LLCP_CONNECT :
-       case NET_NFC_MESSAGE_SERVICE_LLCP_CONNECT_SAP :
-               net_nfc_controller_llcp_connected_cb(
-                       req_msg->llcp_socket,
-                       req_msg->result,
-                       NULL,
-                       (void *)req_msg->user_param);
+       case NET_NFC_MESSAGE_SERVICE_LLCP_CONNECT:
+       case NET_NFC_MESSAGE_SERVICE_LLCP_CONNECT_SAP:
+               net_nfc_controller_llcp_connected_cb(req_msg->llcp_socket, req_msg->result, NULL, (void *)req_msg->user_param);
                break;
 
-       case NET_NFC_MESSAGE_SERVICE_LLCP_DISCONNECT :
-               net_nfc_controller_llcp_disconnected_cb(
-                       req_msg->llcp_socket,
-                       req_msg->result,
-                       NULL,
-                       (void *)req_msg->user_param);
+       case NET_NFC_MESSAGE_SERVICE_LLCP_DISCONNECT:
+               net_nfc_controller_llcp_disconnected_cb(req_msg->llcp_socket, req_msg->result, NULL, (void *)req_msg->user_param);
                break;
 
        default:
                break;
        }
 
-       /* FIXME : should be removed when plugins would be fixed*/
+       /* FIXME : should be removed when plugins would be fixed */
        _net_nfc_util_free_mem(req_msg);
 }
 
@@ -347,59 +290,46 @@ static void controller_llcp_event_cb(void *info, void *user_context)
 {
        net_nfc_request_llcp_msg_t *req_msg = info;
 
-       if(user_context != NULL)
+       if (user_context != NULL)
                req_msg->user_param = user_context;
 
-       if (net_nfc_server_controller_async_queue_push_force(
-               _controller_llcp_event_cb, req_msg) == FALSE)
-       {
+       if (net_nfc_server_controller_async_queue_push_force(_controller_llcp_event_cb, req_msg) == FALSE)
                DEBUG_ERR_MSG("Failed to push onto the queue");
-       }
 }
 
-
-static void controller_hce_apdu_cb(void *info,
-                               void *user_context)
+static void controller_hce_apdu_cb(void *info, void *user_context)
 {
-       net_nfc_request_hce_apdu_t *req = (net_nfc_request_hce_apdu_t *)info;
+       net_nfc_request_hce_apdu_t *req = (net_nfc_request_hce_apdu_t *) info;
 
        g_assert(info != NULL);
 
        net_nfc_server_hce_apdu_received(req);
 }
 
-
 static void controller_init_thread_func(gpointer user_data)
 {
        net_nfc_error_e result;
 
        net_nfc_controller_is_ready(&result);
 
-       if(result != NET_NFC_OK) {
+       if (result != NET_NFC_OK) {
 
                DEBUG_ERR_MSG("net_nfc_controller_is_ready[%d]", result);
 
-               if (net_nfc_controller_init(&result) == false)
-               {
+               if (net_nfc_controller_init(&result) == false) {
                        DEBUG_ERR_MSG("net_nfc_controller_init failed, [%d]", result);
 
                        /* ADD TEMPORARY ABORT FOR DEBUG */
                        abort();
-       //              net_nfc_manager_quit();
+                       //      net_nfc_manager_quit();
                        return;
                }
        }
 
        DEBUG_SERVER_MSG("net_nfc_controller_init success, [%d]", result);
 
-       if (net_nfc_controller_register_listener(controller_target_detected_cb,
-                                               controller_se_transaction_cb,
-                                               controller_llcp_event_cb,
-                                               controller_hce_apdu_cb,
-                                               &result) == false)
-       {
-               DEBUG_ERR_MSG("net_nfc_contorller_register_listener failed [%d]",
-                               result);
+       if (net_nfc_controller_register_listener(controller_target_detected_cb, controller_se_transaction_cb, controller_llcp_event_cb, controller_hce_apdu_cb, &result) == false) {
+               DEBUG_ERR_MSG("net_nfc_contorller_register_listener failed [%d]", result);
 
                /* ADD TEMPORARY ABORT FOR DEBUG */
                abort();
@@ -408,10 +338,8 @@ static void controller_init_thread_func(gpointer user_data)
        DEBUG_SERVER_MSG("net_nfc_contorller_register_listener success");
 
        result = net_nfc_server_llcp_set_config(NULL);
-       if (result != NET_NFC_OK)
-       {
-               DEBUG_ERR_MSG("net_nfc_server_llcp_set config failed, [%d]",
-                       result);
+       if (result != NET_NFC_OK) {
+               DEBUG_ERR_MSG("net_nfc_server_llcp_set config failed, [%d]", result);
 
                /* ADD TEMPORARY ABORT FOR DEBUG */
                abort();
@@ -425,8 +353,7 @@ static void controller_deinit_thread_func(gpointer user_data)
 {
        net_nfc_server_free_target_info();
 
-       if (net_nfc_controller_deinit() == false)
-       {
+       if (net_nfc_controller_deinit() == false) {
                DEBUG_ERR_MSG("net_nfc_controller_deinit failed");
 
                /* ADD TEMPORARY ABORT FOR DEBUG */
@@ -463,38 +390,26 @@ static void restart_polling_loop_thread_func(gpointer user_data)
        if (vconf_get_int(VCONFKEY_PM_STATE, &pm_state) != 0)
                DEBUG_ERR_MSG("%s does not exist", "VCONFKEY_PM_STATE");
 
-       DEBUG_SERVER_MSG("lock_screen_set:%d ,pm_state:%d,lock_state:%d",
-               lock_screen_set , pm_state , lock_state);
-
-               if (pm_state == VCONFKEY_PM_STATE_NORMAL)
-               {
-                       if (net_nfc_controller_configure_discovery(
-                                                       NET_NFC_DISCOVERY_MODE_CONFIG,
-                                                       NET_NFC_ALL_ENABLE,
-                                                       &result) == true)
-                       {
-                               check_nfc_disable = FALSE;
-                               DEBUG_SERVER_MSG("polling enable");
-                       }
+       DEBUG_SERVER_MSG("lock_screen_set:%d ,pm_state:%d,lock_state:%d", lock_screen_set, pm_state, lock_state);
 
-                       return;
+       if (pm_state == VCONFKEY_PM_STATE_NORMAL) {
+               if (net_nfc_controller_configure_discovery(NET_NFC_DISCOVERY_MODE_CONFIG, NET_NFC_ALL_ENABLE, &result) == true) {
+                       check_nfc_disable = FALSE;
+                       DEBUG_SERVER_MSG("polling enable");
                }
 
-               if (pm_state == VCONFKEY_PM_STATE_LCDOFF)
-               {
-                       if (check_nfc_disable == FALSE)
-                       {
-                               if (net_nfc_controller_configure_discovery(
-                                                               NET_NFC_DISCOVERY_MODE_CONFIG,
-                                                               NET_NFC_ALL_DISABLE,
-                                                               &result) == true)
-                               {
-                                       check_nfc_disable = TRUE;
-                                       DEBUG_SERVER_MSG("polling disabled");
-                               }
+               return;
+       }
+
+       if (pm_state == VCONFKEY_PM_STATE_LCDOFF) {
+               if (check_nfc_disable == FALSE) {
+                       if (net_nfc_controller_configure_discovery(NET_NFC_DISCOVERY_MODE_CONFIG, NET_NFC_ALL_DISABLE, &result) == true) {
+                               check_nfc_disable = TRUE;
+                               DEBUG_SERVER_MSG("polling disabled");
                        }
-                       return;
                }
+               return;
+       }
 }
 
 static void force_polling_loop_thread_func(gpointer user_data)
@@ -504,14 +419,9 @@ static void force_polling_loop_thread_func(gpointer user_data)
        /* keep_SE_select_value */
        result = net_nfc_server_se_apply_se_current_policy();
 
-       if (net_nfc_controller_configure_discovery(
-                               NET_NFC_DISCOVERY_MODE_START,
-                               NET_NFC_ALL_ENABLE,
-                               &result) == true)
-       {
+       if (net_nfc_controller_configure_discovery(NET_NFC_DISCOVERY_MODE_START, NET_NFC_ALL_ENABLE, &result) == true) {
                /* vconf on */
-               if (vconf_set_bool(VCONFKEY_NFC_STATE, TRUE) != 0)
-               {
+               if (vconf_set_bool(VCONFKEY_NFC_STATE, TRUE) != 0) {
                        DEBUG_ERR_MSG("vconf_set_bool is failed");
 
                        result = NET_NFC_OPERATION_FAIL;
@@ -526,13 +436,10 @@ static void quit_nfc_manager_loop_thread_func(gpointer user_data)
 {
        gint state;
 
-       if (vconf_get_bool(VCONFKEY_NFC_STATE, &state) != 0)
-       {
+       if (vconf_get_bool(VCONFKEY_NFC_STATE, &state) != 0) {
                DEBUG_SERVER_MSG("VCONFKEY_NFC_STATE is not exist");
 
-       }
-       else
-       {
+       } else {
                if (state != VCONFKEY_NFC_STATE_ON)
                        net_nfc_server_controller_deinit();
                else
@@ -544,16 +451,11 @@ gboolean net_nfc_server_controller_thread_init(void)
 {
        GError *error = NULL;
 
-       controller_async_queue = g_async_queue_new_full(
-                                       controller_async_queue_free_func);
+       controller_async_queue = g_async_queue_new_full(controller_async_queue_free_func);
 
-       controller_thread = g_thread_try_new("controller_thread",
-                                       controller_thread_func,
-                                       NULL,
-                                       &error);
+       controller_thread = g_thread_try_new("controller_thread", controller_thread_func, NULL, &error);
 
-       if (controller_thread == NULL)
-       {
+       if (controller_thread == NULL) {
                DEBUG_ERR_MSG("can not create controller thread");
                if (error != NULL) {
                        DEBUG_ERR_MSG("error msg : %s", error->message);
@@ -567,12 +469,8 @@ gboolean net_nfc_server_controller_thread_init(void)
 
 void net_nfc_server_controller_thread_deinit(void)
 {
-       if (net_nfc_server_controller_async_queue_push_force(
-                                       controller_thread_deinit_thread_func,
-                                       NULL)==FALSE)
-       {
+       if (net_nfc_server_controller_async_queue_push_force(controller_thread_deinit_thread_func, NULL) == FALSE)
                DEBUG_ERR_MSG("Failed to push onto the queue");
-       }
 
        g_thread_join(controller_thread);
        controller_thread = NULL;
@@ -583,14 +481,11 @@ void net_nfc_server_controller_thread_deinit(void)
 
 void net_nfc_server_controller_init(void)
 {
-       if (net_nfc_server_controller_async_queue_push_force(
-               controller_init_thread_func, NULL) == FALSE)
-       {
+       if (net_nfc_server_controller_async_queue_push_force(controller_init_thread_func, NULL) == FALSE)
                DEBUG_ERR_MSG("Failed to push onto the queue");
-       }
 }
 
-inline static gboolean _timeout_cb(gpointer data)
+static inline gboolean _timeout_cb(gpointer data)
 {
        g_assert(data != NULL);
 
@@ -599,9 +494,7 @@ inline static gboolean _timeout_cb(gpointer data)
        return false;
 }
 
-inline static void _push_to_queue(guint msec, bool blocking,
-       net_nfc_server_controller_func func,
-       gpointer user_data)
+static inline void _push_to_queue(guint msec, bool blocking, net_nfc_server_controller_func func, gpointer user_data)
 {
        ControllerFuncData *func_data;
 
@@ -610,18 +503,16 @@ inline static void _push_to_queue(guint msec, bool blocking,
        func_data->data = user_data;
        func_data->blocking = blocking;
 
-       if (__builtin_expect(msec == 0, true)) {
+       if (__builtin_expect(msec == 0, true))
                g_async_queue_push(controller_async_queue, func_data);
-       } else {
+       else
                g_timeout_add(msec, _timeout_cb, func_data);
-       }
 }
 
 #ifndef ESE_ALWAYS_ON
 void net_nfc_server_controller_deinit(void)
 {
-       if (controller_async_queue == NULL)
-       {
+       if (controller_async_queue == NULL) {
                DEBUG_ERR_MSG("controller_async_queue is not initialized");
 
                return;
@@ -639,11 +530,9 @@ gboolean net_nfc_server_controller_is_blocked()
        return (controller_block > 0);
 }
 
-gboolean net_nfc_server_controller_async_queue_delayed_push_force(
-       guint msec, net_nfc_server_controller_func func, gpointer user_data)
+gboolean net_nfc_server_controller_async_queue_delayed_push_force(guint msec, net_nfc_server_controller_func func, gpointer user_data)
 {
-       if (controller_async_queue == NULL)
-       {
+       if (controller_async_queue == NULL) {
                DEBUG_ERR_MSG("controller_async_queue is not initialized");
 
                return FALSE;
@@ -654,38 +543,29 @@ gboolean net_nfc_server_controller_async_queue_delayed_push_force(
        return TRUE;
 }
 
-gboolean net_nfc_server_controller_async_queue_push_force(
-       net_nfc_server_controller_func func, gpointer user_data)
+gboolean net_nfc_server_controller_async_queue_push_force(net_nfc_server_controller_func func, gpointer user_data)
 {
-       return net_nfc_server_controller_async_queue_delayed_push_force(0,
-               func, user_data);
+       return net_nfc_server_controller_async_queue_delayed_push_force(0, func, user_data);
 }
 
-gboolean net_nfc_server_controller_async_queue_push(
-                                       net_nfc_server_controller_func func,
-                                       gpointer user_data)
+gboolean net_nfc_server_controller_async_queue_push(net_nfc_server_controller_func func, gpointer user_data)
 {
-       if (net_nfc_server_controller_is_blocked() == true) {
+       if (net_nfc_server_controller_is_blocked() == true)
                return FALSE;
-       }
 
-       return net_nfc_server_controller_async_queue_push_force(func,
-               user_data);
+       return net_nfc_server_controller_async_queue_push_force(func, user_data);
 }
 
-gboolean net_nfc_server_controller_async_queue_push_and_block(
-       net_nfc_server_controller_func func, gpointer user_data)
+gboolean net_nfc_server_controller_async_queue_push_and_block(net_nfc_server_controller_func func, gpointer user_data)
 {
-       if (controller_async_queue == NULL)
-       {
+       if (controller_async_queue == NULL) {
                DEBUG_ERR_MSG("controller_async_queue is not initialized");
 
                return FALSE;
        }
 
-       if (net_nfc_server_controller_is_blocked() == true) {
+       if (net_nfc_server_controller_is_blocked() == true)
                return FALSE;
-       }
 
        /* block pushing message until complete previous blocking message */
        controller_block++;
@@ -698,15 +578,12 @@ gboolean net_nfc_server_controller_async_queue_push_and_block(
 void net_nfc_server_controller_run_dispatch_loop()
 {
        if (controller_async_queue == NULL)
-       {
                return;
-       }
 
        DEBUG_SERVER_MSG("START DISPATCH LOOP");
 
        controller_dispath_running = TRUE;
-       while (controller_is_running && controller_dispath_running)
-       {
+       while (controller_is_running && controller_dispath_running) {
                ControllerFuncData *func_data;
 
                func_data = g_async_queue_try_pop(controller_async_queue);
@@ -731,32 +608,20 @@ void net_nfc_server_controller_quit_dispatch_loop()
 
 void net_nfc_server_restart_polling_loop(void)
 {
-       if (net_nfc_server_controller_async_queue_push_force(
-                                       restart_polling_loop_thread_func,
-                                       NULL) == FALSE)
-       {
+       if (net_nfc_server_controller_async_queue_push_force(restart_polling_loop_thread_func, NULL) == FALSE)
                DEBUG_ERR_MSG("Failed to push onto the queue");
-       }
 }
 
 void net_nfc_server_force_polling_loop(void)
 {
-       if (net_nfc_server_controller_async_queue_push_force(
-                                       force_polling_loop_thread_func,
-                                       NULL) == FALSE)
-       {
+       if (net_nfc_server_controller_async_queue_push_force(force_polling_loop_thread_func, NULL) == FALSE)
                DEBUG_ERR_MSG("Failed to push onto the queue");
-       }
 }
 
 void net_nfc_server_quit_nfc_manager_loop(void)
 {
-       if (net_nfc_server_controller_async_queue_push_force(
-                                       quit_nfc_manager_loop_thread_func,
-                                       NULL) == FALSE)
-       {
+       if (net_nfc_server_controller_async_queue_push_force(quit_nfc_manager_loop_thread_func, NULL) == FALSE)
                DEBUG_ERR_MSG("Failed to push onto the queue");
-       }
 }
 
 void net_nfc_server_set_state(guint32 state)
@@ -781,26 +646,19 @@ void net_nfc_server_controller_init_sync(void)
 {
        net_nfc_error_e result;
 
-       if (net_nfc_controller_init(&result) == false)
-       {
+       if (net_nfc_controller_init(&result) == false) {
                DEBUG_ERR_MSG("net_nfc_controller_init failed, [%d]", result);
 
                /* ADD TEMPORARY ABORT FOR DEBUG */
                abort();
-//             net_nfc_manager_quit();
+//      net_nfc_manager_quit();
                return;
        }
 
        DEBUG_SERVER_MSG("net_nfc_controller_init success, [%d]", result);
 
-       if (net_nfc_controller_register_listener(controller_target_detected_cb,
-                                               controller_se_transaction_cb,
-                                               controller_llcp_event_cb,
-                                               controller_hce_apdu_cb,
-                                               &result) == false)
-       {
-               DEBUG_ERR_MSG("net_nfc_contorller_register_listener failed [%d]",
-                               result);
+       if (net_nfc_controller_register_listener(controller_target_detected_cb, controller_se_transaction_cb, controller_llcp_event_cb, controller_hce_apdu_cb, &result) == false) {
+               DEBUG_ERR_MSG("net_nfc_contorller_register_listener failed [%d]", result);
 
                /* ADD TEMPORARY ABORT FOR DEBUG */
                abort();
@@ -809,10 +667,8 @@ void net_nfc_server_controller_init_sync(void)
        DEBUG_SERVER_MSG("net_nfc_contorller_register_listener success");
 
        result = net_nfc_server_llcp_set_config(NULL);
-       if (result != NET_NFC_OK)
-       {
-               DEBUG_ERR_MSG("net_nfc_server_llcp_set config failed, [%d]",
-                       result);
+       if (result != NET_NFC_OK) {
+               DEBUG_ERR_MSG("net_nfc_server_llcp_set config failed, [%d]", result);
 
                /* ADD TEMPORARY ABORT FOR DEBUG */
                abort();
@@ -820,4 +676,3 @@ void net_nfc_server_controller_init_sync(void)
 
        DEBUG_SERVER_MSG("net_nfc_server_llcp_set_config success");
 }
-
index eb57993..ca8bb35 100755 (executable)
@@ -44,9 +44,7 @@ static pthread_mutex_t context_lock = PTHREAD_MUTEX_INITIALIZER;
 static void _cleanup_client_key(gpointer data)
 {
        if (data != NULL)
-       {
                g_free(data);
-       }
 }
 
 static void _on_client_detached(gpointer data, gpointer user_data)
@@ -55,9 +53,8 @@ static void _on_client_detached(gpointer data, gpointer user_data)
 
        DEBUG_SERVER_MSG("invoke releasing callbacks");
 
-       if (cb != NULL) {
-               cb((net_nfc_client_context_info_t *)user_data);
-       }
+       if (cb != NULL)
+               cb((net_nfc_client_context_info_t *) user_data);
 }
 
 static void _cleanup_client_context(gpointer data)
@@ -76,10 +73,8 @@ void net_nfc_server_gdbus_init_client_context()
 {
        pthread_mutex_lock(&context_lock);
 
-       if (client_contexts == NULL) {
-               client_contexts = g_hash_table_new_full(g_str_hash, g_str_equal,
-                       _cleanup_client_key, _cleanup_client_context);
-       }
+       if (client_contexts == NULL)
+               client_contexts = g_hash_table_new_full(g_str_hash, g_str_equal, _cleanup_client_key, _cleanup_client_context);
 
        pthread_mutex_unlock(&context_lock);
 }
@@ -96,20 +91,18 @@ void net_nfc_server_gdbus_deinit_client_context()
        pthread_mutex_unlock(&context_lock);
 }
 
-void net_nfc_server_gdbus_register_on_client_detached_cb(
-       net_nfc_server_gdbus_on_client_detached_cb cb)
+void net_nfc_server_gdbus_register_on_client_detached_cb(net_nfc_server_gdbus_on_client_detached_cb cb)
 {
        client_detached_cbs = g_list_append(client_detached_cbs, cb);
 }
 
-void net_nfc_server_gdbus_unregister_on_client_detached_cb(
-       net_nfc_server_gdbus_on_client_detached_cb cb)
+void net_nfc_server_gdbus_unregister_on_client_detached_cb(net_nfc_server_gdbus_on_client_detached_cb cb)
 {
        client_detached_cbs = g_list_remove(client_detached_cbs, cb);
 }
 
 #ifdef USE_CYNARA
-static bool _get_credentials(GDBusMethodInvocation *invocation, net_nfc_privilege_e _privilege)
+static bool _get_credentials(GDBusMethodInvocation * invocation, net_nfc_privilege_e _privilege)
 {
        int ret = 0;
        int pid = 0;
@@ -130,7 +123,7 @@ static bool _get_credentials(GDBusMethodInvocation *invocation, net_nfc_privileg
                return false;
        }
 
-       ret =   cynara_creds_gdbus_get_pid(connection, sender_unique_name, &pid);
+       ret = cynara_creds_gdbus_get_pid(connection, sender_unique_name, &pid);
        if (ret != CYNARA_API_SUCCESS) {
                DEBUG_SERVER_MSG("cynara_creds_gdbus_get_pid() failed");
                return false;
@@ -149,31 +142,30 @@ static bool _get_credentials(GDBusMethodInvocation *invocation, net_nfc_privileg
                return false;
        }
 
-       switch (_privilege)
-       {
+       switch (_privilege) {
        case NET_NFC_PRIVILEGE_NFC:
                privilege = "http://tizen.org/privilege/nfc";
-       break;
+               break;
 
-       case NET_NFC_PRIVILEGE_NFC_ADMIN :
+       case NET_NFC_PRIVILEGE_NFC_ADMIN:
                privilege = "http://tizen.org/privilege/nfc.admin";
-       break;
+               break;
 
-       case NET_NFC_PRIVILEGE_NFC_TAG :
+       case NET_NFC_PRIVILEGE_NFC_TAG:
                privilege = "http://tizen.org/privilege/nfc";
-       break;
+               break;
 
-       case NET_NFC_PRIVILEGE_NFC_P2P :
+       case NET_NFC_PRIVILEGE_NFC_P2P:
                privilege = "http://tizen.org/privilege/nfc";
-       break;
+               break;
 
-       case NET_NFC_PRIVILEGE_NFC_CARD_EMUL :
+       case NET_NFC_PRIVILEGE_NFC_CARD_EMUL:
                privilege = "http://tizen.org/privilege/nfc.cardemulation";
-       break;
-       default :
+               break;
+       default:
                DEBUG_SERVER_MSG("Undifined privilege");
                return false;
-       break;
+               break;
        }
 
        client_session = cynara_session_from_pid(pid);
@@ -202,16 +194,15 @@ static bool _get_credentials(GDBusMethodInvocation *invocation, net_nfc_privileg
 }
 #endif
 
-bool net_nfc_server_gdbus_check_privilege(GDBusMethodInvocation *invocation, net_nfc_privilege_e privilege)
+bool net_nfc_server_gdbus_check_privilege(GDBusMethodInvocation * invocation, net_nfc_privilege_e privilege)
 {
        bool ret = true;
 
        const char *id = g_dbus_method_invocation_get_sender(invocation);
 
-       DEBUG_SERVER_MSG("check the id of the gdbus sender = [%s]",id);
+       DEBUG_SERVER_MSG("check the id of the gdbus sender = [%s]", id);
 
-       net_nfc_server_gdbus_add_client_context(id,
-                       NET_NFC_CLIENT_ACTIVE_STATE);
+       net_nfc_server_gdbus_add_client_context(id, NET_NFC_CLIENT_ACTIVE_STATE);
 
 #ifdef USE_CYNARA
        ret = _get_credentials(invocation, privilege);
@@ -238,8 +229,7 @@ size_t net_nfc_server_gdbus_get_client_count()
        return result;
 }
 
-net_nfc_client_context_info_t *net_nfc_server_gdbus_get_client_context_no_lock(
-       const char *id)
+net_nfc_client_context_info_t *net_nfc_server_gdbus_get_client_context_no_lock(const char *id)
 {
        net_nfc_client_context_info_t *result;
 
@@ -248,8 +238,7 @@ net_nfc_client_context_info_t *net_nfc_server_gdbus_get_client_context_no_lock(
        return result;
 }
 
-net_nfc_client_context_info_t *net_nfc_server_gdbus_get_client_context(
-       const char *id)
+net_nfc_client_context_info_t *net_nfc_server_gdbus_get_client_context(const char *id)
 {
        net_nfc_client_context_info_t *result;
 
@@ -262,8 +251,7 @@ net_nfc_client_context_info_t *net_nfc_server_gdbus_get_client_context(
        return result;
 }
 
-net_nfc_client_context_info_t *net_nfc_server_gdbus_get_client_context_by_pid(
-       pid_t pid)
+net_nfc_client_context_info_t *net_nfc_server_gdbus_get_client_context_by_pid(pid_t pid)
 {
        net_nfc_client_context_info_t *result = NULL;
        char *key;
@@ -274,8 +262,7 @@ net_nfc_client_context_info_t *net_nfc_server_gdbus_get_client_context_by_pid(
 
        g_hash_table_iter_init(&iter, client_contexts);
 
-       while (g_hash_table_iter_next(&iter, (gpointer *)&key,
-               (gpointer *)&value) == true) {
+       while (g_hash_table_iter_next(&iter, (gpointer *) & key, (gpointer *) & value) == true) {
                if (value->pid == pid) {
                        result = value;
                        break;
@@ -287,18 +274,15 @@ net_nfc_client_context_info_t *net_nfc_server_gdbus_get_client_context_by_pid(
        return result;
 }
 
-void net_nfc_server_gdbus_add_client_context(const char *id,
-       client_state_e state)
+void net_nfc_server_gdbus_add_client_context(const char *id, client_state_e state)
 {
        pthread_mutex_lock(&context_lock);
 
-       if (net_nfc_server_gdbus_get_client_context_no_lock(id) == NULL)
-       {
+       if (net_nfc_server_gdbus_get_client_context_no_lock(id) == NULL) {
                net_nfc_client_context_info_t *info = NULL;
 
                info = g_new0(net_nfc_client_context_info_t, 1);
-               if (info != NULL)
-               {
+               if (info != NULL) {
                        pid_t pid;
 
                        pid = net_nfc_server_gdbus_get_pid(id);
@@ -312,20 +296,13 @@ void net_nfc_server_gdbus_add_client_context(const char *id,
                        info->launch_popup_state_no_check = NET_NFC_LAUNCH_APP_SELECT;
                        info->isTransactionFgDispatch = false;
 
-                       g_hash_table_insert(client_contexts,
-                               (gpointer)g_strdup(id),
-                               (gpointer)info);
+                       g_hash_table_insert(client_contexts, (gpointer) g_strdup(id), (gpointer) info);
 
-                       DEBUG_SERVER_MSG("current client count = [%d]",
-                               net_nfc_server_gdbus_get_client_count_no_lock());
-               }
-               else
-               {
+                       DEBUG_SERVER_MSG("current client count = [%d]", net_nfc_server_gdbus_get_client_count_no_lock());
+               } else {
                        DEBUG_ERR_MSG("alloc failed");
                }
-       }
-       else
-       {
+       } else {
                DEBUG_SERVER_MSG("we already have this client in our context!!");
        }
 
@@ -339,21 +316,17 @@ void net_nfc_server_gdbus_cleanup_client_context(const char *id)
        pthread_mutex_lock(&context_lock);
 
        info = net_nfc_server_gdbus_get_client_context_no_lock(id);
-       if (info != NULL)
-       {
-               DEBUG_SERVER_MSG("clean up client context, [%s, %d]", id,
-                       info->pid);
+       if (info != NULL) {
+               DEBUG_SERVER_MSG("clean up client context, [%s, %d]", id, info->pid);
 
                g_hash_table_remove(client_contexts, id);
 
-               DEBUG_SERVER_MSG("current client count = [%d]",
-                       net_nfc_server_gdbus_get_client_count_no_lock());
+               DEBUG_SERVER_MSG("current client count = [%d]", net_nfc_server_gdbus_get_client_count_no_lock());
 
                net_nfc_server_route_table_unset_preferred_handler_by_id(id);
 
                /* TODO : exit when no client */
-               if (net_nfc_server_gdbus_get_client_count_no_lock() == 0)
-               {
+               if (net_nfc_server_gdbus_get_client_count_no_lock() == 0) {
                        DEBUG_SERVER_MSG("put the nfc-manager into queue");
                        net_nfc_server_quit_nfc_manager_loop();
                }
@@ -362,9 +335,7 @@ void net_nfc_server_gdbus_cleanup_client_context(const char *id)
        pthread_mutex_unlock(&context_lock);
 }
 
-void net_nfc_server_gdbus_for_each_client_context(
-       net_nfc_server_gdbus_for_each_client_cb cb,
-       void *user_param)
+void net_nfc_server_gdbus_for_each_client_context(net_nfc_server_gdbus_for_each_client_cb cb, void *user_param)
 {
        GHashTableIter iter;
        char *id;
@@ -376,10 +347,8 @@ void net_nfc_server_gdbus_for_each_client_context(
        pthread_mutex_lock(&context_lock);
 
        g_hash_table_iter_init(&iter, client_contexts);
-       while (g_hash_table_iter_next(&iter, (gpointer *)&id,
-               (gpointer *)&info) == true) {
+       while (g_hash_table_iter_next(&iter, (gpointer *) & id, (gpointer *) & info) == true)
                cb(info, user_param);
-       }
 
        pthread_mutex_unlock(&context_lock);
 }
@@ -397,9 +366,8 @@ client_state_e net_nfc_server_gdbus_get_client_state(const char *id)
        pthread_mutex_lock(&context_lock);
 
        info = net_nfc_server_gdbus_get_client_context_no_lock(id);
-       if (info != NULL) {
+       if (info != NULL)
                state = info->state;
-       }
 
        pthread_mutex_unlock(&context_lock);
 
@@ -413,16 +381,13 @@ void net_nfc_server_gdbus_set_client_state(const char *id, client_state_e state)
        pthread_mutex_lock(&context_lock);
 
        info = net_nfc_server_gdbus_get_client_context_no_lock(id);
-       if (info != NULL) {
+       if (info != NULL)
                info->state = state;
-       }
 
        pthread_mutex_unlock(&context_lock);
 }
 
-void net_nfc_server_gdbus_set_launch_state(const char *id,
-       net_nfc_launch_popup_state_e popup_state,
-       net_nfc_launch_popup_check_e check_foreground)
+void net_nfc_server_gdbus_set_launch_state(const char *id, net_nfc_launch_popup_state_e popup_state, net_nfc_launch_popup_check_e check_foreground)
 {
        net_nfc_client_context_info_t *info;
 
@@ -430,18 +395,16 @@ void net_nfc_server_gdbus_set_launch_state(const char *id,
 
        info = net_nfc_server_gdbus_get_client_context_no_lock(id);
        if (info != NULL) {
-               if (check_foreground == CHECK_FOREGROUND) {
+               if (check_foreground == CHECK_FOREGROUND)
                        info->launch_popup_state = popup_state;
-               } else {
+               else
                        info->launch_popup_state_no_check = popup_state;
-               }
        }
 
        pthread_mutex_unlock(&context_lock);
 }
 
-net_nfc_launch_popup_state_e net_nfc_server_gdbus_get_launch_state(
-       const char *id)
+net_nfc_launch_popup_state_e net_nfc_server_gdbus_get_launch_state(const char *id)
 {
        net_nfc_client_context_info_t *info;
        net_nfc_launch_popup_state_e result = NET_NFC_LAUNCH_APP_SELECT;
@@ -450,12 +413,10 @@ net_nfc_launch_popup_state_e net_nfc_server_gdbus_get_launch_state(
 
        info = net_nfc_server_gdbus_get_client_context_no_lock(id);
        if (info != NULL) {
-               if (info->launch_popup_state_no_check  ==
-                       NET_NFC_NO_LAUNCH_APP_SELECT) {
+               if (info->launch_popup_state_no_check == NET_NFC_NO_LAUNCH_APP_SELECT)
                        result = NET_NFC_NO_LAUNCH_APP_SELECT;
-               } else {
+               else
                        result = info->launch_popup_state;
-               }
        }
 
        pthread_mutex_unlock(&context_lock);
@@ -463,9 +424,7 @@ net_nfc_launch_popup_state_e net_nfc_server_gdbus_get_launch_state(
        return result;
 }
 
-net_nfc_error_e net_nfc_server_gdbus_set_transaction_fg_dispatch(
-       const char *id,
-       int fgDispatch)
+net_nfc_error_e net_nfc_server_gdbus_set_transaction_fg_dispatch(const char *id, int fgDispatch)
 {
        net_nfc_client_context_info_t *info;
        pid_t focus_app_pid;
@@ -477,26 +436,16 @@ net_nfc_error_e net_nfc_server_gdbus_set_transaction_fg_dispatch(
 
        info = net_nfc_server_gdbus_get_client_context_no_lock(id);
 
-       if(info != NULL)
-       {
-               if(fgDispatch == true)
-               {
-                       if(info->pgid == focus_app_pid)
-                       {
+       if (info != NULL) {
+               if (fgDispatch == true) {
+                       if (info->pgid == focus_app_pid)
                                info->isTransactionFgDispatch = fgDispatch;
-                       }
                        else
-                       {
                                result = NET_NFC_INVALID_STATE;
-                       }
-               }
-               else
-               {
+               } else {
                        info->isTransactionFgDispatch = fgDispatch;
                }
-       }
-       else
-       {
+       } else {
                result = NET_NFC_INVALID_STATE;
        }
 
@@ -505,8 +454,7 @@ net_nfc_error_e net_nfc_server_gdbus_set_transaction_fg_dispatch(
        return result;
 }
 
-net_nfc_launch_popup_state_e net_nfc_server_gdbus_get_client_popup_state(
-       pid_t pid)
+net_nfc_launch_popup_state_e net_nfc_server_gdbus_get_client_popup_state(pid_t pid)
 {
        GHashTableIter iter;
        char *id;
@@ -516,10 +464,8 @@ net_nfc_launch_popup_state_e net_nfc_server_gdbus_get_client_popup_state(
        pthread_mutex_lock(&context_lock);
 
        g_hash_table_iter_init(&iter, client_contexts);
-       while (g_hash_table_iter_next(&iter, (gpointer *)&id,
-               (gpointer *)&temp) == true) {
-               if (temp->launch_popup_state_no_check ==
-                       NET_NFC_NO_LAUNCH_APP_SELECT) {
+       while (g_hash_table_iter_next(&iter, (gpointer *) & id, (gpointer *) & temp) == true) {
+               if (temp->launch_popup_state_no_check == NET_NFC_NO_LAUNCH_APP_SELECT) {
                        state = NET_NFC_NO_LAUNCH_APP_SELECT;
                        break;
                }
@@ -530,17 +476,15 @@ net_nfc_launch_popup_state_e net_nfc_server_gdbus_get_client_popup_state(
                }
        }
 
-       if (info != NULL) {
+       if (info != NULL)
                state = info->launch_popup_state;
-       }
 
        pthread_mutex_unlock(&context_lock);
 
        return state;
 }
 
-bool net_nfc_server_gdbus_get_client_transaction_fg_dispatch_state(
-       pid_t pid)
+bool net_nfc_server_gdbus_get_client_transaction_fg_dispatch_state(pid_t pid)
 {
        GHashTableIter iter;
        char *id;
@@ -550,8 +494,7 @@ bool net_nfc_server_gdbus_get_client_transaction_fg_dispatch_state(
        pthread_mutex_lock(&context_lock);
 
        g_hash_table_iter_init(&iter, client_contexts);
-       while (g_hash_table_iter_next(&iter, (gpointer *)&id,
-               (gpointer *)&temp) == true) {
+       while (g_hash_table_iter_next(&iter, (gpointer *) & id, (gpointer *) & temp) == true) {
 
                if (temp->pgid == pid) {
                        info = temp;
@@ -559,9 +502,8 @@ bool net_nfc_server_gdbus_get_client_transaction_fg_dispatch_state(
                }
        }
 
-       if (info != NULL) {
+       if (info != NULL)
                state = info->isTransactionFgDispatch;
-       }
 
        pthread_mutex_unlock(&context_lock);
 
@@ -575,9 +517,8 @@ void net_nfc_server_gdbus_increase_se_count(const char *id)
        pthread_mutex_lock(&context_lock);
 
        info = net_nfc_server_gdbus_get_client_context_no_lock(id);
-       if (info != NULL) {
+       if (info != NULL)
                info->ref_se++;
-       }
 
        pthread_mutex_unlock(&context_lock);
 }
@@ -589,9 +530,8 @@ void net_nfc_server_gdbus_decrease_se_count(const char *id)
        pthread_mutex_lock(&context_lock);
 
        info = net_nfc_server_gdbus_get_client_context_no_lock(id);
-       if (info != NULL) {
+       if (info != NULL)
                info->ref_se--;
-       }
 
        pthread_mutex_unlock(&context_lock);
 }
@@ -606,8 +546,7 @@ bool net_nfc_server_gdbus_is_server_busy_no_lock()
                net_nfc_client_context_info_t *info;
 
                g_hash_table_iter_init(&iter, client_contexts);
-               while (g_hash_table_iter_next(&iter, (gpointer *)&id,
-                       (gpointer *)&info) == true) {
+               while (g_hash_table_iter_next(&iter, (gpointer *) & id, (gpointer *) & info) == true) {
                        if (info->ref_se > 0) {
                                result = true;
                                break;
index 11b0dbc..58bd3b1 100755 (executable)
@@ -14,7 +14,6 @@
  * limitations under the License.
  */
 
-
 #include "net_nfc_debug_internal.h"
 #include "net_nfc_util_gdbus_internal.h"
 #include "net_nfc_controller_internal.h"
@@ -27,33 +26,20 @@ static NetNfcGDbusHandover *handover_skeleton = NULL;
 
 static void handover_request_thread_func(gpointer user_data);
 
-static gboolean handover_handle_request(NetNfcGDbusHandover *hdover,
-                               GDBusMethodInvocation *invocation,
-                               guint32 arg_handle,
-                               gint32 arg_type,
-                               GVariant *smack_privilege,
-                               gpointer user_data);
+static gboolean handover_handle_request(NetNfcGDbusHandover * hdover, GDBusMethodInvocation * invocation, guint32 arg_handle, gint32 arg_type, GVariant * smack_privilege, gpointer user_data);
 
 static void handover_request_thread_func(gpointer user_data)
 {
-       HandoverRequestData *handover_data = (HandoverRequestData *)user_data;
+       HandoverRequestData *handover_data = (HandoverRequestData *) user_data;
        net_nfc_error_e result;
 
        g_assert(handover_data != NULL);
        g_assert(handover_data->handoverobj != NULL);
        g_assert(handover_data->invocation != NULL);
 
-       result = net_nfc_server_handover_default_client_start(
-               GUINT_TO_POINTER(handover_data->handle),
-               (void *)handover_data);
-       if (result != NET_NFC_OK)
-       {
-               net_nfc_gdbus_handover_complete_request(
-                       handover_data->handoverobj,
-                       handover_data->invocation,
-                       result,
-                       NET_NFC_CONN_HANDOVER_CARRIER_UNKNOWN,
-                       net_nfc_util_gdbus_buffer_to_variant(NULL, 0));
+       result = net_nfc_server_handover_default_client_start(GUINT_TO_POINTER(handover_data->handle), (void *)handover_data);
+       if (result != NET_NFC_OK) {
+               net_nfc_gdbus_handover_complete_request(handover_data->handoverobj, handover_data->invocation, result, NET_NFC_CONN_HANDOVER_CARRIER_UNKNOWN, net_nfc_util_gdbus_buffer_to_variant(NULL, 0));
 
                g_object_unref(handover_data->invocation);
                g_object_unref(handover_data->handoverobj);
@@ -62,18 +48,12 @@ static void handover_request_thread_func(gpointer user_data)
        }
 }
 
-static gboolean handover_handle_request(NetNfcGDbusHandover *hdover,
-                               GDBusMethodInvocation *invocation,
-                               guint32 arg_handle,
-                               gint32 arg_type,
-                               GVariant *smack_privilege,
-                               gpointer user_data)
+static gboolean handover_handle_request(NetNfcGDbusHandover * hdover, GDBusMethodInvocation * invocation, guint32 arg_handle, gint32 arg_type, GVariant * smack_privilege, gpointer user_data)
 {
        HandoverRequestData *data = NULL;
        gint result;
 
-       INFO_MSG(">>> REQUEST from [%s]",
-               g_dbus_method_invocation_get_sender(invocation));
+       INFO_MSG(">>> REQUEST from [%s]", g_dbus_method_invocation_get_sender(invocation));
 
        /* check privilege and update client context */
        if (net_nfc_server_gdbus_check_privilege(invocation, NET_NFC_PRIVILEGE_NFC_P2P) == false) {
@@ -83,9 +63,8 @@ static gboolean handover_handle_request(NetNfcGDbusHandover *hdover,
                goto ERROR;
        }
 
-       data = g_try_new0(HandoverRequestData,1);
-       if(data == NULL)
-       {
+       data = g_try_new0(HandoverRequestData, 1);
+       if (data == NULL) {
                DEBUG_ERR_MSG("Memory allocation failed");
                result = NET_NFC_ALLOC_FAIL;
 
@@ -97,9 +76,7 @@ static gboolean handover_handle_request(NetNfcGDbusHandover *hdover,
        data->handle = arg_handle;
        data->type = arg_type;
 
-       if (net_nfc_server_controller_async_queue_push(
-               handover_request_thread_func, data) == FALSE)
-       {
+       if (net_nfc_server_controller_async_queue_push(handover_request_thread_func, data) == FALSE) {
                /* return error if queue was blocked */
                DEBUG_SERVER_MSG("controller is processing important message..");
                result = NET_NFC_BUSY;
@@ -109,7 +86,7 @@ static gboolean handover_handle_request(NetNfcGDbusHandover *hdover,
 
        return TRUE;
 
-ERROR :
+ ERROR:
        if (data != NULL) {
                g_object_unref(data->invocation);
                g_object_unref(data->handoverobj);
@@ -117,48 +94,32 @@ ERROR :
                g_free(data);
        }
 
-       net_nfc_gdbus_handover_complete_request(
-               hdover,
-               invocation,
-               result,
-               NET_NFC_CONN_HANDOVER_CARRIER_UNKNOWN,
-               net_nfc_util_gdbus_buffer_to_variant(NULL, 0));
+       net_nfc_gdbus_handover_complete_request(hdover, invocation, result, NET_NFC_CONN_HANDOVER_CARRIER_UNKNOWN, net_nfc_util_gdbus_buffer_to_variant(NULL, 0));
 
        return TRUE;
 }
 
-net_nfc_error_e net_nfc_server_handover_emit_started_signal(
-       net_nfc_target_handle_s *handle, data_s *message)
+net_nfc_error_e net_nfc_server_handover_emit_started_signal(net_nfc_target_handle_s * handle, data_s * message)
 {
-       if (handover_skeleton == NULL) {
+       if (handover_skeleton == NULL)
                return NET_NFC_INVALID_STATE;
-       }
 
-       net_nfc_gdbus_handover_emit_started(handover_skeleton,
-               net_nfc_util_gdbus_data_to_variant(message));
+       net_nfc_gdbus_handover_emit_started(handover_skeleton, net_nfc_util_gdbus_data_to_variant(message));
 
        return NET_NFC_OK;
 }
 
-net_nfc_error_e net_nfc_server_handover_emit_finished_signal(
-       net_nfc_error_e result,
-       net_nfc_conn_handover_carrier_type_e type,
-       data_s *address, data_s *message)
+net_nfc_error_e net_nfc_server_handover_emit_finished_signal(net_nfc_error_e result, net_nfc_conn_handover_carrier_type_e type, data_s * address, data_s * message)
 {
-       if (handover_skeleton == NULL) {
+       if (handover_skeleton == NULL)
                return NET_NFC_INVALID_STATE;
-       }
 
-       net_nfc_gdbus_handover_emit_finished(handover_skeleton,
-               result,
-               type,
-               net_nfc_util_gdbus_data_to_variant(address),
-               net_nfc_util_gdbus_data_to_variant(message));
+       net_nfc_gdbus_handover_emit_finished(handover_skeleton, result, type, net_nfc_util_gdbus_data_to_variant(address), net_nfc_util_gdbus_data_to_variant(message));
 
        return NET_NFC_OK;
 }
 
-gboolean net_nfc_server_handover_init(GDBusConnection *connection)
+gboolean net_nfc_server_handover_init(GDBusConnection * connection)
 {
        GError *error = NULL;
 
@@ -167,17 +128,9 @@ gboolean net_nfc_server_handover_init(GDBusConnection *connection)
 
        handover_skeleton = net_nfc_gdbus_handover_skeleton_new();
 
-       g_signal_connect(handover_skeleton,
-                       "handle-request",
-                       G_CALLBACK(handover_handle_request),
-                       NULL);
-
-       if (g_dbus_interface_skeleton_export(
-                               G_DBUS_INTERFACE_SKELETON(handover_skeleton),
-                               connection,
-                               "/org/tizen/NetNfcService/Handover",
-                               &error) == FALSE)
-       {
+       g_signal_connect(handover_skeleton, "handle-request", G_CALLBACK(handover_handle_request), NULL);
+
+       if (g_dbus_interface_skeleton_export(G_DBUS_INTERFACE_SKELETON(handover_skeleton), connection, "/org/tizen/NetNfcService/Handover", &error) == FALSE) {
                g_error_free(error);
 
                g_object_unref(handover_skeleton);
@@ -191,8 +144,7 @@ gboolean net_nfc_server_handover_init(GDBusConnection *connection)
 
 void net_nfc_server_handover_deinit(void)
 {
-       if (handover_skeleton)
-       {
+       if (handover_skeleton) {
                g_object_unref(handover_skeleton);
                handover_skeleton = NULL;
        }
index 148472b..cd9fbb7 100755 (executable)
 #include "net_nfc_server_llcp.h"
 #include "net_nfc_app_util_internal.h"
 
-
-typedef struct _net_nfc_handover_bt_get_context_t
-{
+typedef struct _net_nfc_handover_bt_get_context_t {
        bool already_on;
        int step;
        net_nfc_error_e result;
        net_nfc_ch_carrier_s *carrier;
        net_nfc_server_handover_get_carrier_cb cb;
        void *user_param;
-}
-net_nfc_handover_bt_get_context_t;
+} net_nfc_handover_bt_get_context_t;
 
-typedef struct _net_nfc_handover_bt_process_context_t
-{
+typedef struct _net_nfc_handover_bt_process_context_t {
        bool already_on;
        int step;
        net_nfc_error_e result;
@@ -56,8 +52,7 @@ typedef struct _net_nfc_handover_bt_process_context_t
        char remote_address[20];
        bt_service_class_t service_mask;
        void *user_param;
-}
-net_nfc_handover_bt_process_context_t;
+} net_nfc_handover_bt_process_context_t;
 
 typedef struct {
        unsigned char hash[16];
@@ -66,15 +61,15 @@ typedef struct {
        unsigned int randomizer_len;
 } net_nfc_handover_bt_oob_data_t;
 
-static uint8_t __bt_cod[] = { 0x0c, 0x02, 0x5a }; /* 0x5a020c */
+static uint8_t __bt_cod[] = { 0x0c, 0x02, 0x5a };      /* 0x5a020c */
+
 #ifndef USE_SYSTEM_INFO
 static const char *manufacturer = "Samsung Tizen";
 #endif
 
-static int _bt_get_carrier_record(net_nfc_handover_bt_get_context_t *context);
-static int _bt_prepare_pairing(net_nfc_handover_bt_process_context_t *context);
-static int _bt_do_pairing(net_nfc_handover_bt_process_context_t *context);
-
+static int _bt_get_carrier_record(net_nfc_handover_bt_get_context_t * context);
+static int _bt_prepare_pairing(net_nfc_handover_bt_process_context_t * context);
+static int _bt_do_pairing(net_nfc_handover_bt_process_context_t * context);
 
 net_nfc_conn_handover_carrier_state_e net_nfc_server_handover_bt_get_cps()
 {
@@ -82,20 +77,19 @@ net_nfc_conn_handover_carrier_state_e net_nfc_server_handover_bt_get_cps()
 
        int ret = bluetooth_check_adapter();
 
-       switch (ret)
-       {
-       case BLUETOOTH_ADAPTER_ENABLED :
+       switch (ret) {
+       case BLUETOOTH_ADAPTER_ENABLED:
                cps = NET_NFC_CONN_HANDOVER_CARRIER_ACTIVATE;
                break;
 
-       case BLUETOOTH_ADAPTER_CHANGING_ENABLE :
+       case BLUETOOTH_ADAPTER_CHANGING_ENABLE:
                cps = NET_NFC_CONN_HANDOVER_CARRIER_ACTIVATING;
                break;
 
-       case BLUETOOTH_ADAPTER_DISABLED :
-       case BLUETOOTH_ADAPTER_CHANGING_DISABLE :
-       case BLUETOOTH_ERROR_NO_RESOURCES :
-       default :
+       case BLUETOOTH_ADAPTER_DISABLED:
+       case BLUETOOTH_ADAPTER_CHANGING_DISABLE:
+       case BLUETOOTH_ERROR_NO_RESOURCES:
+       default:
                cps = NET_NFC_CONN_HANDOVER_CARRIER_INACTIVATE;
                break;
        }
@@ -111,52 +105,36 @@ uint8_t *net_nfc_server_handover_bt_get_local_address()
        static uint8_t *bt_addr = NULL;
 
        if (bt_addr != NULL)
-       {
                return bt_addr;
-       }
 
        _net_nfc_util_alloc_mem(bt_addr, BLUETOOTH_ADDRESS_LENGTH);
-       if (bt_addr != NULL)
-       {
-               if (net_nfc_server_handover_bt_get_cps() != NET_NFC_CONN_HANDOVER_CARRIER_ACTIVATE)
-               {
+       if (bt_addr != NULL) {
+               if (net_nfc_server_handover_bt_get_cps() != NET_NFC_CONN_HANDOVER_CARRIER_ACTIVATE) {
                        // bt power is off. so get bt address from configuration file.
                        FILE *fp = NULL;
 
-                       if ((fp = fopen(HIDDEN_BT_ADDR_FILE, "r")) != NULL)
-                       {
+                       if ((fp = fopen(HIDDEN_BT_ADDR_FILE, "r")) != NULL) {
                                unsigned char temp[BLUETOOTH_ADDRESS_LENGTH * 2] = { 0, };
 
                                int ch;
                                int count = 0;
                                int i = 0;
 
-                               while ((ch = fgetc(fp)) != EOF && count < BLUETOOTH_ADDRESS_LENGTH * 2)
-                               {
+                               while ((ch = fgetc(fp)) != EOF && count < BLUETOOTH_ADDRESS_LENGTH * 2) {
                                        if (((ch >= '0') && (ch <= '9')))
-                                       {
                                                temp[count++] = ch - '0';
-                                       }
                                        else if (((ch >= 'a') && (ch <= 'z')))
-                                       {
                                                temp[count++] = ch - 'a' + 10;
-                                       }
                                        else if (((ch >= 'A') && (ch <= 'Z')))
-                                       {
                                                temp[count++] = ch - 'A' + 10;
-                                       }
                                }
 
                                for (; i < BLUETOOTH_ADDRESS_LENGTH; i++)
-                               {
                                        bt_addr[i] = temp[i * 2] << 4 | temp[i * 2 + 1];
-                               }
 
                                fclose(fp);
                        }
-               }
-               else
-               {
+               } else {
                        bluetooth_device_address_t local_address;
 
                        memset(&local_address, 0x00, sizeof(bluetooth_device_address_t));
@@ -175,9 +153,7 @@ void net_nfc_util_enable_bluetooth(void)
        bluetooth_enable_adapter();
 }
 
-static net_nfc_error_e _bt_get_oob_data_from_config(
-       net_nfc_carrier_config_s *config,
-       net_nfc_handover_bt_oob_data_t *oob)
+static net_nfc_error_e _bt_get_oob_data_from_config(net_nfc_carrier_config_s * config, net_nfc_handover_bt_oob_data_t * oob)
 {
        net_nfc_error_e result = NET_NFC_UNKNOWN_ERROR;
        data_s hash = { NULL, 0 };
@@ -186,50 +162,34 @@ static net_nfc_error_e _bt_get_oob_data_from_config(
        LOGD("[%s:%d] START", __func__, __LINE__);
 
        if (config == NULL || oob == NULL)
-       {
                return NET_NFC_NULL_PARAMETER;
-       }
 
        memset(oob, 0, sizeof(net_nfc_handover_bt_oob_data_t));
 
-       result = net_nfc_util_get_carrier_config_property(config,
-               NET_NFC_BT_ATTRIBUTE_OOB_HASH_C,
-               (uint16_t *)&hash.length, &hash.buffer);
-       if (result == NET_NFC_OK)
-       {
-               if (hash.length == 16)
-               {
+       result = net_nfc_util_get_carrier_config_property(config, NET_NFC_BT_ATTRIBUTE_OOB_HASH_C, (uint16_t *) & hash.length, &hash.buffer);
+       if (result == NET_NFC_OK) {
+               if (hash.length == 16) {
                        INFO_MSG("hash found");
 
                        NET_NFC_REVERSE_ORDER_16_BYTES(hash.buffer);
 
                        oob->hash_len = MIN(sizeof(oob->hash), hash.length);
                        memcpy(oob->hash, hash.buffer, oob->hash_len);
-               }
-               else
-               {
+               } else {
                        DEBUG_ERR_MSG("hash.length error : [%d] bytes", hash.length);
                }
        }
 
-       result = net_nfc_util_get_carrier_config_property(config,
-               NET_NFC_BT_ATTRIBUTE_OOB_HASH_R,
-               (uint16_t *)&randomizer.length, &randomizer.buffer);
-       if (result == NET_NFC_OK)
-       {
-               if (randomizer.length == 16)
-               {
+       result = net_nfc_util_get_carrier_config_property(config, NET_NFC_BT_ATTRIBUTE_OOB_HASH_R, (uint16_t *) & randomizer.length, &randomizer.buffer);
+       if (result == NET_NFC_OK) {
+               if (randomizer.length == 16) {
                        INFO_MSG("randomizer found");
 
                        NET_NFC_REVERSE_ORDER_16_BYTES(randomizer.buffer);
 
-                       oob->randomizer_len = MIN(sizeof(oob->randomizer),
-                               randomizer.length);
-                       memcpy(oob->randomizer, randomizer.buffer,
-                               oob->randomizer_len);
-               }
-               else
-               {
+                       oob->randomizer_len = MIN(sizeof(oob->randomizer), randomizer.length);
+                       memcpy(oob->randomizer, randomizer.buffer, oob->randomizer_len);
+               } else {
                        DEBUG_ERR_MSG("randomizer.length error : [%d] bytes", randomizer.length);
                }
        }
@@ -239,40 +199,32 @@ static net_nfc_error_e _bt_get_oob_data_from_config(
        return result;
 }
 
-static void _bt_carrier_record_cb(int result, bt_adapter_state_e adapter_state,
-       void *user_data)
+static void _bt_carrier_record_cb(int result, bt_adapter_state_e adapter_state, void *user_data)
 {
-       net_nfc_handover_bt_get_context_t *context =
-               (net_nfc_handover_bt_get_context_t *)user_data;
+       net_nfc_handover_bt_get_context_t *context = (net_nfc_handover_bt_get_context_t *) user_data;
 
        LOGD("[%s] START", __func__);
 
-       if (context == NULL)
-       {
+       if (context == NULL) {
                DEBUG_SERVER_MSG("user_data is null");
                LOGD("[%s] END", __func__);
                return;
        }
 
-       switch (adapter_state)
-       {
-       case BT_ADAPTER_ENABLED :
+       switch (adapter_state) {
+       case BT_ADAPTER_ENABLED:
                INFO_MSG("BT_ADAPTER_ENABLED");
                if (context->step == NET_NFC_LLCP_STEP_02)
-               {
                        _bt_get_carrier_record(context);
-               }
                else
-               {
                        DEBUG_ERR_MSG("step is incorrect");
-               }
                break;
 
-       case BT_ADAPTER_DISABLED :
+       case BT_ADAPTER_DISABLED:
                INFO_MSG("BT_ADAPTER_DISABLED");
                break;
 
-       default :
+       default:
                DEBUG_MSG("unhandled bt event [%d], [%d]", adapter_state, result);
                break;
        }
@@ -280,7 +232,7 @@ static void _bt_carrier_record_cb(int result, bt_adapter_state_e adapter_state,
        LOGD("[%s] END", __func__);
 }
 
-static void _append_oob_data(net_nfc_carrier_config_s *config)
+static void _append_oob_data(net_nfc_carrier_config_s * config)
 {
        int result;
        unsigned char *hash;
@@ -290,61 +242,43 @@ static void _append_oob_data(net_nfc_carrier_config_s *config)
 
        /* get oob data, optional!!! */
        result = bt_adapter_get_local_oob_data(&hash, &randomizer, &hash_len, &randomizer_len);
-       if (result == BT_ERROR_NONE)
-       {
-               if (hash_len == 16 && randomizer_len == 16)
-               {
+       if (result == BT_ERROR_NONE) {
+               if (hash_len == 16 && randomizer_len == 16) {
                        INFO_MSG("oob.hash_len [%d], oob.randomizer_len [%d]", hash_len, randomizer_len);
 
                        NET_NFC_REVERSE_ORDER_16_BYTES(hash);
 
-                       result = net_nfc_util_add_carrier_config_property(
-                               config, NET_NFC_BT_ATTRIBUTE_OOB_HASH_C,
-                               hash_len, hash);
+                       result = net_nfc_util_add_carrier_config_property(config, NET_NFC_BT_ATTRIBUTE_OOB_HASH_C, hash_len, hash);
                        if (result != NET_NFC_OK)
-                       {
                                DEBUG_ERR_MSG("net_nfc_util_add_carrier_config_property failed [%d]", result);
-                       }
 
                        NET_NFC_REVERSE_ORDER_16_BYTES(randomizer);
 
-                       result = net_nfc_util_add_carrier_config_property(
-                               config, NET_NFC_BT_ATTRIBUTE_OOB_HASH_R,
-                               randomizer_len, randomizer);
+                       result = net_nfc_util_add_carrier_config_property(config, NET_NFC_BT_ATTRIBUTE_OOB_HASH_R, randomizer_len, randomizer);
                        if (result != NET_NFC_OK)
-                       {
                                DEBUG_ERR_MSG("net_nfc_util_add_carrier_config_property failed [%d]", result);
-                       }
-               }
-               else
-               {
+               } else {
                        DEBUG_ERR_MSG("abnormal oob data, skip....");
                }
-       }
-       else
-       {
+       } else {
                DEBUG_ERR_MSG("bt oob_read_local_data failed, skip.... [%d]", result);
        }
 }
 
-static net_nfc_error_e _bt_create_config_record(ndef_record_s **record)
+static net_nfc_error_e _bt_create_config_record(ndef_record_s ** record)
 {
-       charbt_addr = NULL;
+       char *bt_addr = NULL;
        char *bt_name = NULL;
        net_nfc_carrier_config_s *config = NULL;
        int result;
 
        if (record == NULL)
-       {
                return NET_NFC_NULL_PARAMETER;
-       }
 
        *record = NULL;
 
-       result = net_nfc_util_create_carrier_config(&config,
-               NET_NFC_CONN_HANDOVER_CARRIER_BT);
-       if (result != NET_NFC_OK)
-       {
+       result = net_nfc_util_create_carrier_config(&config, NET_NFC_CONN_HANDOVER_CARRIER_BT);
+       if (result != NET_NFC_OK) {
                DEBUG_ERR_MSG("net_nfc_util_create_carrier_config failed [%d]", result);
                goto END;
        }
@@ -352,8 +286,7 @@ static net_nfc_error_e _bt_create_config_record(ndef_record_s **record)
        /* add blutooth address, mandatory */
 
        result = bt_adapter_get_address(&bt_addr);
-       if (result != BT_ERROR_NONE)
-       {
+       if (result != BT_ERROR_NONE) {
                DEBUG_ERR_MSG("bt_adapter_get_address failed [%d]", result);
                result = NET_NFC_OPERATION_FAIL;
                goto END;
@@ -361,21 +294,15 @@ static net_nfc_error_e _bt_create_config_record(ndef_record_s **record)
 
        NET_NFC_REVERSE_ORDER_6_BYTES(bt_addr);
 
-       result = net_nfc_util_add_carrier_config_property(
-               config, NET_NFC_BT_ATTRIBUTE_ADDRESS,
-               strlen(bt_addr), (uint8_t *)bt_addr);
-       if (result != NET_NFC_OK)
-       {
+       result = net_nfc_util_add_carrier_config_property(config, NET_NFC_BT_ATTRIBUTE_ADDRESS, strlen(bt_addr), (uint8_t *) bt_addr);
+       if (result != NET_NFC_OK) {
                DEBUG_ERR_MSG("net_nfc_util_add_carrier_config_property failed [%d]", result);
                goto END;
        }
 
        /* append cod */
-       result = net_nfc_util_add_carrier_config_property(
-               config, NET_NFC_BT_ATTRIBUTE_OOB_COD,
-               sizeof(__bt_cod), __bt_cod);
-       if (result != NET_NFC_OK)
-       {
+       result = net_nfc_util_add_carrier_config_property(config, NET_NFC_BT_ATTRIBUTE_OOB_COD, sizeof(__bt_cod), __bt_cod);
+       if (result != NET_NFC_OK) {
                DEBUG_ERR_MSG("net_nfc_util_add_carrier_config_property failed [%d]", result);
                goto END;
        }
@@ -385,25 +312,20 @@ static net_nfc_error_e _bt_create_config_record(ndef_record_s **record)
 
        /* append device name */
        result = bt_adapter_get_name(&bt_name);
-       if (result != BT_ERROR_NONE)
-       {
+       if (result != BT_ERROR_NONE) {
                DEBUG_ERR_MSG("bt_adapter_get_name failed [%d]", result);
                result = NET_NFC_OPERATION_FAIL;
                goto END;
        }
 
-       if(bt_name == NULL)
-       {
+       if (bt_name == NULL) {
                result = NET_NFC_OPERATION_FAIL;
                goto END;
        }
 
        if (strlen(bt_name) > 0) {
-               result = net_nfc_util_add_carrier_config_property(
-                       config, NET_NFC_BT_ATTRIBUTE_NAME,
-                       strlen(bt_name), (uint8_t *)bt_name);
-               if (result != NET_NFC_OK)
-               {
+               result = net_nfc_util_add_carrier_config_property(config, NET_NFC_BT_ATTRIBUTE_NAME, strlen(bt_name), (uint8_t *) bt_name);
+               if (result != NET_NFC_OK) {
                        DEBUG_ERR_MSG("net_nfc_util_add_carrier_config_property failed [%d]", result);
                        goto END;
                }
@@ -423,14 +345,11 @@ static net_nfc_error_e _bt_create_config_record(ndef_record_s **record)
        }
 #endif
        if (manufacturer != NULL && strlen(manufacturer) > 0) {
-               result = net_nfc_util_add_carrier_config_property(
-                       config, NET_NFC_BT_ATTRIBUTE_MANUFACTURER,
-                       strlen(manufacturer), (uint8_t *)manufacturer);
+               result = net_nfc_util_add_carrier_config_property(config, NET_NFC_BT_ATTRIBUTE_MANUFACTURER, strlen(manufacturer), (uint8_t *) manufacturer);
 #ifdef USE_SYSTEM_INFO
                g_free(manufacturer);
 #endif
-               if (result != NET_NFC_OK)
-               {
+               if (result != NET_NFC_OK) {
                        DEBUG_ERR_MSG("net_nfc_util_add_carrier_config_property failed [%d]", result);
                        goto END;
                }
@@ -438,77 +357,66 @@ static net_nfc_error_e _bt_create_config_record(ndef_record_s **record)
 
        result = net_nfc_util_handover_bt_create_record_from_config(record, config);
        if (result != NET_NFC_OK)
-       {
                DEBUG_ERR_MSG("net_nfc_util_create_ndef_record_with_carrier_config failed [%d]", result);
-       }
 
-END :
+ END:
        if (bt_name != NULL)
                free(bt_name);
 
        if (bt_addr != NULL)
                free(bt_addr);
 
-       if (config != NULL) {
+       if (config != NULL)
                net_nfc_util_free_carrier_config(config);
-       }
 
        return result;
 }
 
-static int _bt_get_carrier_record(net_nfc_handover_bt_get_context_t *context)
+static int _bt_get_carrier_record(net_nfc_handover_bt_get_context_t * context)
 {
        int ret;
        LOGD("[%s:%d] START", __func__, __LINE__);
 
-       if (context->result != NET_NFC_OK && context->result != NET_NFC_BUSY)
-       {
+       if (context->result != NET_NFC_OK && context->result != NET_NFC_BUSY) {
                DEBUG_ERR_MSG("context->result is error [%d]", context->result);
 
                context->step = NET_NFC_LLCP_STEP_RETURN;
        }
 
-       switch (context->step)
-       {
-       case NET_NFC_LLCP_STEP_01 :
+       switch (context->step) {
+       case NET_NFC_LLCP_STEP_01:
                DEBUG_MSG("STEP [1]");
 
                ret = bt_initialize();
                ret = bt_adapter_set_state_changed_cb(_bt_carrier_record_cb, context);
 
-               if (ret >= BT_ERROR_NONE)
-               {
+               if (ret >= BT_ERROR_NONE) {
                        bt_adapter_state_e adapter_state;
                        context->step = NET_NFC_LLCP_STEP_02;
                        context->result = NET_NFC_OK;
 
                        ret = bt_adapter_get_state(&adapter_state);
 
-                       if (ret == BT_ADAPTER_DISABLED)
-                       {
+                       if (ret == BT_ADAPTER_DISABLED) {
                                bt_adapter_enable();
-                       }
-                       else
-                       {
+                       } else {
                                DEBUG_MSG("BT is enabled already");
                                context->already_on = true;
 
                                /* do next step */
-                               g_idle_add((GSourceFunc)_bt_get_carrier_record, (gpointer)context);
+                               g_idle_add((GSourceFunc) _bt_get_carrier_record, (gpointer) context);
                        }
-               }
-               else
-               {
+               } else {
                        DEBUG_ERR_MSG("bt register_callback failed");
 
                        context->step = NET_NFC_LLCP_STEP_RETURN;
                        context->result = NET_NFC_OPERATION_FAIL;
 
-                       g_idle_add((GSourceFunc)_bt_get_carrier_record, (gpointer)context);
+                       g_idle_add((GSourceFunc) _bt_get_carrier_record, (gpointer) context);
                }
                break;
 
-       case NET_NFC_LLCP_STEP_02 :
+       case NET_NFC_LLCP_STEP_02:
                {
                        ndef_record_s *record;
 
@@ -517,22 +425,18 @@ static int _bt_get_carrier_record(net_nfc_handover_bt_get_context_t *context)
                        context->step = NET_NFC_LLCP_STEP_RETURN;
 
                        /* append config to ndef message */
-                       context->result = _bt_create_config_record(
-                               &record);
-                       if (context->result == NET_NFC_OK) {
-                               net_nfc_util_append_handover_carrier_record(
-                                       context->carrier, record);
-                       } else {
+                       context->result = _bt_create_config_record(&record);
+                       if (context->result == NET_NFC_OK)
+                               net_nfc_util_append_handover_carrier_record(context->carrier, record);
+                       else
                                DEBUG_ERR_MSG("_bt_create_config_record failed, [%d]", context->result);
-                       }
 
                        /* complete and return to upper step */
-                       g_idle_add((GSourceFunc)_bt_get_carrier_record,
-                               (gpointer)context);
+                       g_idle_add((GSourceFunc) _bt_get_carrier_record, (gpointer) context);
                }
                break;
 
-       case NET_NFC_LLCP_STEP_RETURN :
+       case NET_NFC_LLCP_STEP_RETURN:
                {
                        net_nfc_ch_carrier_s *carrier = NULL;
 
@@ -540,23 +444,20 @@ static int _bt_get_carrier_record(net_nfc_handover_bt_get_context_t *context)
 
                        bt_deinitialize();
 
-                       if (context->result == NET_NFC_OK) {
+                       if (context->result == NET_NFC_OK)
                                carrier = context->carrier;
-                       }
 
                        /* complete and return to upper step */
-                       context->cb(context->result, carrier,
-                               context->user_param);
+                       context->cb(context->result, carrier, context->user_param);
 
-                       if (carrier != NULL) {
+                       if (carrier != NULL)
                                net_nfc_util_free_handover_carrier(carrier);
-                       }
 
                        _net_nfc_util_free_mem(context);
                }
                break;
 
-       default :
+       default:
                break;
        }
 
@@ -565,9 +466,7 @@ static int _bt_get_carrier_record(net_nfc_handover_bt_get_context_t *context)
        return 0;
 }
 
-net_nfc_error_e net_nfc_server_handover_bt_get_carrier(
-       net_nfc_server_handover_get_carrier_cb cb,
-       void *user_param)
+net_nfc_error_e net_nfc_server_handover_bt_get_carrier(net_nfc_server_handover_get_carrier_cb cb, void *user_param)
 {
        net_nfc_error_e result = NET_NFC_OK;
        net_nfc_handover_bt_get_context_t *context = NULL;
@@ -579,12 +478,9 @@ net_nfc_error_e net_nfc_server_handover_bt_get_carrier(
                context->step = NET_NFC_LLCP_STEP_01;
 
                /* TODO : check cps of bt */
-               result = net_nfc_util_create_handover_carrier(&context->carrier,
-                       NET_NFC_CONN_HANDOVER_CARRIER_ACTIVATE);
-               if (result == NET_NFC_OK) {
-                       g_idle_add((GSourceFunc)_bt_get_carrier_record,
-                               (gpointer)context);
-               }
+               result = net_nfc_util_create_handover_carrier(&context->carrier, NET_NFC_CONN_HANDOVER_CARRIER_ACTIVATE);
+               if (result == NET_NFC_OK)
+                       g_idle_add((GSourceFunc) _bt_get_carrier_record, (gpointer) context);
        } else {
                result = NET_NFC_ALLOC_FAIL;
        }
@@ -592,163 +488,126 @@ net_nfc_error_e net_nfc_server_handover_bt_get_carrier(
        return result;
 }
 
-static void _bt_prepare_pairing_cb(int result, bt_adapter_state_e adapter_state,
-       void *user_data)
+static void _bt_prepare_pairing_cb(int result, bt_adapter_state_e adapter_state, void *user_data)
 {
-       net_nfc_handover_bt_process_context_t *context =
-               (net_nfc_handover_bt_process_context_t *)user_data;
+       net_nfc_handover_bt_process_context_t *context = (net_nfc_handover_bt_process_context_t *) user_data;
 
        LOGD("[%s] START", __func__);
 
-       if (context == NULL)
-       {
+       if (context == NULL) {
                DEBUG_SERVER_MSG("user_data is null");
                LOGD("[%s] END", __func__);
                return;
        }
 
-       switch (adapter_state)
-       {
-       case BT_ADAPTER_ENABLED :
+       switch (adapter_state) {
+       case BT_ADAPTER_ENABLED:
                INFO_MSG("BT_ADAPTER_ENABLED");
                if (context->step == NET_NFC_LLCP_STEP_02)
-               {
                        _bt_prepare_pairing(context);
-               }
                else
-               {
                        DEBUG_ERR_MSG("step is incorrect");
-               }
                break;
 
        case BT_ADAPTER_DISABLED:
                INFO_MSG("BT_ADAPTER_DISABLED");
                if (context->step == NET_NFC_LLCP_STEP_RETURN)
-               {
                        _bt_prepare_pairing(context);
-               }
                else
-               {
                        DEBUG_ERR_MSG("step is incorrect");
-               }
                break;
 
-       default :
-               DEBUG_SERVER_MSG("unhandled bt event [%d],"
-                               "[0x%04x]", adapter_state, result);
+       default:
+               DEBUG_SERVER_MSG("unhandled bt event [%d]," "[0x%04x]", adapter_state, result);
                break;
        }
 
        LOGD("[%s] END", __func__);
 }
 
-static int _bt_prepare_pairing(net_nfc_handover_bt_process_context_t *context)
+static int _bt_prepare_pairing(net_nfc_handover_bt_process_context_t * context)
 {
        int ret;
 
        LOGD("[%s:%d] START", __func__, __LINE__);
 
-       if (context->result != NET_NFC_OK && context->result != NET_NFC_BUSY)
-       {
+       if (context->result != NET_NFC_OK && context->result != NET_NFC_BUSY) {
                DEBUG_ERR_MSG("context->result is error [%d]", context->result);
                context->step = NET_NFC_LLCP_STEP_RETURN;
        }
 
-       switch (context->step)
-       {
-       case NET_NFC_LLCP_STEP_01 :
+       switch (context->step) {
+       case NET_NFC_LLCP_STEP_01:
                INFO_MSG("STEP [1]");
 
                ret = bt_initialize();
                ret = bt_adapter_set_state_changed_cb(_bt_prepare_pairing_cb, context);
 
-               if (ret >= BT_ERROR_NONE)
-               {
+               if (ret >= BT_ERROR_NONE) {
                        bt_adapter_state_e adapter_state;
                        /* next step */
                        context->step = NET_NFC_LLCP_STEP_02;
 
                        ret = bt_adapter_get_state(&adapter_state);
 
-                       if (ret != BT_ADAPTER_DISABLED)
-                       {
+                       if (ret != BT_ADAPTER_DISABLED) {
                                context->result = NET_NFC_OK;
 
                                ret = bt_adapter_enable();
-                               if (ret != BT_ERROR_NONE)
-                               {
+                               if (ret != BT_ERROR_NONE) {
                                        DEBUG_ERR_MSG("bt_adapter_enable failed, [%d]", ret);
 
                                        context->step = NET_NFC_STATE_ERROR;
                                        context->result = NET_NFC_OPERATION_FAIL;
                                }
-                       }
-                       else
-                       {
+                       } else {
                                /* do next step */
                                INFO_MSG("BT is enabled already, go next step");
 
                                context->already_on = true;
                                context->result = NET_NFC_OK;
 
-                               g_idle_add((GSourceFunc)_bt_prepare_pairing,
-                                       (gpointer)context);
+                               g_idle_add((GSourceFunc) _bt_prepare_pairing, (gpointer) context);
                        }
-               }
-               else
-               {
+               } else {
                        DEBUG_ERR_MSG("bt_adapter_set_state_changed_cb failed, [%d]", ret);
                        context->step = NET_NFC_STATE_ERROR;
                        context->result = NET_NFC_OPERATION_FAIL;
 
-                       g_idle_add((GSourceFunc)_bt_prepare_pairing,
-                               (gpointer)context);
+                       g_idle_add((GSourceFunc) _bt_prepare_pairing, (gpointer) context);
                }
                break;
 
-       case NET_NFC_LLCP_STEP_02 :
+       case NET_NFC_LLCP_STEP_02:
                {
                        net_nfc_carrier_config_s *config;
                        data_s temp = { NULL, 0 };
 
                        INFO_MSG("STEP [2]");
 
-                       net_nfc_util_create_carrier_config_from_config_record(
-                               &config, context->carrier->carrier_record);
+                       net_nfc_util_create_carrier_config_from_config_record(&config, context->carrier->carrier_record);
 
-                       net_nfc_util_get_carrier_config_property(config,
-                               NET_NFC_BT_ATTRIBUTE_ADDRESS,
-                               (uint16_t *)&temp.length, &temp.buffer);
-                       if (temp.length == 6)
-                       {
+                       net_nfc_util_get_carrier_config_property(config, NET_NFC_BT_ATTRIBUTE_ADDRESS, (uint16_t *) & temp.length, &temp.buffer);
+                       if (temp.length == 6) {
                                bt_device_info_s *device_info;
 
                                NET_NFC_REVERSE_ORDER_6_BYTES(temp.buffer);
-                               snprintf(context->remote_address, 18, "%02X:%02X:%02X:%02X:%02X:%02X",
-                                                               temp.buffer[0],
-                                                               temp.buffer[1],
-                                                               temp.buffer[2],
-                                                               temp.buffer[3],
-                                                               temp.buffer[4],
-                                                               temp.buffer[5]);
-
-                               if (bt_adapter_get_bonded_device_info(context->remote_address, &device_info) == BT_ERROR_NONE)
-                               {
+                               snprintf(context->remote_address, 18, "%02X:%02X:%02X:%02X:%02X:%02X", temp.buffer[0], temp.buffer[1], temp.buffer[2], temp.buffer[3], temp.buffer[4], temp.buffer[5]);
+
+                               if (bt_adapter_get_bonded_device_info(context->remote_address, &device_info) == BT_ERROR_NONE) {
                                        INFO_MSG("already paired with [%s]", context->remote_address);
 
                                        /* return */
                                        context->step = NET_NFC_LLCP_STEP_RETURN;
                                        context->result = NET_NFC_OK;
-                               }
-                               else
-                               {
-                                       net_nfc_handover_bt_oob_data_t oob = { { 0 } , };
+                               } else {
+                                       net_nfc_handover_bt_oob_data_t oob = { {0}
+                                       ,
+                                       };
 
-                                       if (_bt_get_oob_data_from_config(config, &oob) == NET_NFC_OK)
-                                       {
+                                       if (_bt_get_oob_data_from_config(config, &oob) == NET_NFC_OK) {
                                                /* set oob data */
-                                               bt_adapter_set_remote_oob_data(context->remote_address,
-                                                       oob.hash, oob.randomizer, oob.hash_len, oob.randomizer_len);
+                                               bt_adapter_set_remote_oob_data(context->remote_address, oob.hash, oob.randomizer, oob.hash_len, oob.randomizer_len);
                                        }
 
                                        /* pair and send response */
@@ -757,9 +616,7 @@ static int _bt_prepare_pairing(net_nfc_handover_bt_process_context_t *context)
                                }
 
                                bt_adapter_free_device_info(device_info);
-                       }
-                       else
-                       {
+                       } else {
                                DEBUG_ERR_MSG("bluetooth address is invalid. [%d] bytes", temp.length);
 
                                context->step = NET_NFC_STATE_ERROR;
@@ -768,29 +625,23 @@ static int _bt_prepare_pairing(net_nfc_handover_bt_process_context_t *context)
 
                        net_nfc_util_free_carrier_config(config);
 
-                       g_idle_add((GSourceFunc)_bt_prepare_pairing,
-                               (gpointer)context);
+                       g_idle_add((GSourceFunc) _bt_prepare_pairing, (gpointer) context);
                }
                break;
 
-       case NET_NFC_STATE_ERROR :
+       case NET_NFC_STATE_ERROR:
                INFO_MSG("STEP ERROR");
 
                context->step = NET_NFC_LLCP_STEP_RETURN;
                if (context->already_on == false)
-               {
                        bt_adapter_disable();
-               }
                else
-               {
-                       g_idle_add((GSourceFunc)_bt_prepare_pairing,
-                               (gpointer)context);
-               }
+                       g_idle_add((GSourceFunc) _bt_prepare_pairing, (gpointer) context);
                break;
 
-       case NET_NFC_LLCP_STEP_RETURN :
+       case NET_NFC_LLCP_STEP_RETURN:
                {
-                       data_s temp = { (uint8_t *)context->remote_address, (uint32_t)sizeof(context->remote_address) };
+                       data_s temp = { (uint8_t *) context->remote_address, (uint32_t) sizeof(context->remote_address) };
                        data_s *data = NULL;
 
                        INFO_MSG("STEP return");
@@ -798,27 +649,20 @@ static int _bt_prepare_pairing(net_nfc_handover_bt_process_context_t *context)
                        bt_deinitialize();
 
                        if (context->result == NET_NFC_OK)
-                       {
                                data = &temp;
-                       }
 
-                       context->cb(context->result,
-                               NET_NFC_CONN_HANDOVER_CARRIER_BT,
-                               data, context->user_param);
+                       context->cb(context->result, NET_NFC_CONN_HANDOVER_CARRIER_BT, data, context->user_param);
 
                        /* release context */
                        if (context->carrier != NULL)
-                       {
-                               net_nfc_util_free_handover_carrier(
-                                       context->carrier);
-                       }
+                               net_nfc_util_free_handover_carrier(context->carrier);
 
                        net_nfc_util_clear_data(&context->data);
                        _net_nfc_util_free_mem(context);
                }
                break;
 
-       default :
+       default:
                break;
        }
 
@@ -827,10 +671,7 @@ static int _bt_prepare_pairing(net_nfc_handover_bt_process_context_t *context)
        return 0;
 }
 
-net_nfc_error_e net_nfc_server_handover_bt_prepare_pairing(
-       net_nfc_ch_carrier_s *carrier,
-       net_nfc_server_handover_process_carrier_cb cb,
-       void *user_param)
+net_nfc_error_e net_nfc_server_handover_bt_prepare_pairing(net_nfc_ch_carrier_s * carrier, net_nfc_server_handover_process_carrier_cb cb, void *user_param)
 {
        net_nfc_error_e result = NET_NFC_OK;
        net_nfc_handover_bt_process_context_t *context = NULL;
@@ -841,11 +682,9 @@ net_nfc_error_e net_nfc_server_handover_bt_prepare_pairing(
                context->user_param = user_param;
                context->step = NET_NFC_LLCP_STEP_01;
 
-               net_nfc_util_duplicate_handover_carrier(&context->carrier,
-                       carrier);
+               net_nfc_util_duplicate_handover_carrier(&context->carrier, carrier);
 
-               g_idle_add((GSourceFunc)_bt_prepare_pairing,
-                       (gpointer)context);
+               g_idle_add((GSourceFunc) _bt_prepare_pairing, (gpointer) context);
        } else {
                result = NET_NFC_ALLOC_FAIL;
        }
@@ -853,47 +692,36 @@ net_nfc_error_e net_nfc_server_handover_bt_prepare_pairing(
        return result;
 }
 
-static void __bt_get_name(ndef_record_s *record, char *name, uint32_t length)
+static void __bt_get_name(ndef_record_s * record, char *name, uint32_t length)
 {
        net_nfc_carrier_config_s *config;
        uint16_t len = 0;
        uint8_t *buf = NULL;
 
-       net_nfc_util_handover_bt_create_config_from_record(
-               &config, record);
+       net_nfc_util_handover_bt_create_config_from_record(&config, record);
 
-       if (net_nfc_util_get_carrier_config_property(config,
-               NET_NFC_BT_ATTRIBUTE_NAME,
-               &len, &buf) == NET_NFC_OK) {
+       if (net_nfc_util_get_carrier_config_property(config, NET_NFC_BT_ATTRIBUTE_NAME, &len, &buf) == NET_NFC_OK) {
                len = MIN(len, length - 1);
                memcpy(name, buf, len);
                name[len] = 0;
        } else {
-               net_nfc_util_get_carrier_config_property(config,
-                       NET_NFC_BT_ATTRIBUTE_ADDRESS,
-                       &len, &buf);
-
-               snprintf(name, length,
-                       "%02X:%02X:%02X:%02X:%02X:%02X",
-                       buf[0], buf[1], buf[2],
-                       buf[3], buf[4], buf[5]);
+               net_nfc_util_get_carrier_config_property(config, NET_NFC_BT_ATTRIBUTE_ADDRESS, &len, &buf);
+
+               snprintf(name, length, "%02X:%02X:%02X:%02X:%02X:%02X", buf[0], buf[1], buf[2], buf[3], buf[4], buf[5]);
        }
 
        _net_nfc_util_free_mem(config);
 }
 
-static void _bt_audio_connection_state_changed_cb(int result, bool connected,
-       const char *remote_address, bt_audio_profile_type_e type, void *user_data)
+static void _bt_audio_connection_state_changed_cb(int result, bool connected, const char *remote_address, bt_audio_profile_type_e type, void *user_data)
 {
-       net_nfc_handover_bt_process_context_t *context =
-                       (net_nfc_handover_bt_process_context_t *)user_data;
-
-       switch(type) {
-       case BT_AUDIO_PROFILE_TYPE_AG :
-       case BT_AUDIO_PROFILE_TYPE_HSP_HFP :
-       case BT_AUDIO_PROFILE_TYPE_A2DP :
-               if(connected == true)
-               {
+       net_nfc_handover_bt_process_context_t *context = (net_nfc_handover_bt_process_context_t *) user_data;
+
+       switch (type) {
+       case BT_AUDIO_PROFILE_TYPE_AG:
+       case BT_AUDIO_PROFILE_TYPE_HSP_HFP:
+       case BT_AUDIO_PROFILE_TYPE_A2DP:
+               if (connected == true) {
                        if (result == BT_ERROR_NONE) {
                                INFO_MSG("connected device [%s]", context->remote_address);
                                context->result = NET_NFC_OK;
@@ -909,9 +737,7 @@ static void _bt_audio_connection_state_changed_cb(int result, bool connected,
                                context->result = NET_NFC_OPERATION_FAIL;
                                context->step = NET_NFC_STATE_ERROR;
                        }
-               }
-               else
-               {
+               } else {
                        if (result == BT_ERROR_NONE) {
                                INFO_MSG("disconnected device [%s]", context->remote_address);
                                context->result = NET_NFC_OK;
@@ -925,20 +751,17 @@ static void _bt_audio_connection_state_changed_cb(int result, bool connected,
                bt_audio_deinitialize();
                _bt_do_pairing(context);
                break;
-       default :
+       default:
                DEBUG_ERR_MSG("bt op failed, [%d][%d]", type, result);
                break;
        }
 }
 
-void _bt_hid_host_connection_state_changed_cb(int result, bool connected,
-       const char *remote_address, void *user_data)
+void _bt_hid_host_connection_state_changed_cb(int result, bool connected, const char *remote_address, void *user_data)
 {
-       net_nfc_handover_bt_process_context_t *context =
-               (net_nfc_handover_bt_process_context_t *)user_data;
+       net_nfc_handover_bt_process_context_t *context = (net_nfc_handover_bt_process_context_t *) user_data;
 
-       if(connected == true)
-       {
+       if (connected == true) {
                if (result == BT_ERROR_NONE) {
                        INFO_MSG("connected device [%s]", context->remote_address);
 
@@ -955,9 +778,7 @@ void _bt_hid_host_connection_state_changed_cb(int result, bool connected,
                        context->result = NET_NFC_OPERATION_FAIL;
                        context->step = NET_NFC_STATE_ERROR;
                }
-       }
-       else
-       {
+       } else {
                if (result == BT_ERROR_NONE) {
                        INFO_MSG("disconnected device [%s]", context->remote_address);
 
@@ -975,77 +796,61 @@ void _bt_hid_host_connection_state_changed_cb(int result, bool connected,
        _bt_do_pairing(context);
 }
 
-void _bt_state_changed_cb(int result, bt_adapter_state_e adapter_state,
-                       void *user_data)
+void _bt_state_changed_cb(int result, bt_adapter_state_e adapter_state, void *user_data)
 {
-       net_nfc_handover_bt_process_context_t *context =
-                       (net_nfc_handover_bt_process_context_t *)user_data;
+       net_nfc_handover_bt_process_context_t *context = (net_nfc_handover_bt_process_context_t *) user_data;
 
        LOGD("[%s] START", __func__);
 
-       if (context == NULL)
-       {
+       if (context == NULL) {
                DEBUG_SERVER_MSG("user_data is null");
                LOGD("[%s] END", __func__);
                return;
        }
 
-       switch (adapter_state)
-       {
-       case BT_ADAPTER_ENABLED :
+       switch (adapter_state) {
+       case BT_ADAPTER_ENABLED:
                INFO_MSG("BT_ADAPTER_ENABLED");
                if (context->step == NET_NFC_LLCP_STEP_02)
-               {
                        _bt_do_pairing(context);
-               }
                else
-               {
                        DEBUG_ERR_MSG("step is incorrect");
-               }
                break;
 
-       case BT_ADAPTER_DISABLED :
+       case BT_ADAPTER_DISABLED:
                INFO_MSG("BT_ADAPTER_DISABLED");
                if (context->step == NET_NFC_LLCP_STEP_RETURN)
-               {
                        _bt_do_pairing(context);
-               }
                else
-               {
                        DEBUG_ERR_MSG("step is incorrect");
-               }
                break;
-       default :
+       default:
                DEBUG_MSG("unhandled bt event [%d], [%d]", adapter_state, result);
                break;
        }
 }
 
-void _bt_bond_created_cb(int result, bt_device_info_s *device_info,
-       void *user_data)
+void _bt_bond_created_cb(int result, bt_device_info_s * device_info, void *user_data)
 {
-       net_nfc_handover_bt_process_context_t *context =
-               (net_nfc_handover_bt_process_context_t *)user_data;
+       net_nfc_handover_bt_process_context_t *context = (net_nfc_handover_bt_process_context_t *) user_data;
 
        LOGD("[%s] START", __func__);
 
-       if (context == NULL)
-       {
+       if (context == NULL) {
                DEBUG_SERVER_MSG("user_data is null");
                LOGD("[%s] END", __func__);
                return;
        }
 
        if (result >= BT_ERROR_NONE) {
-               bt_device_get_service_mask_from_uuid_list(device_info->service_uuid,
-                       device_info->service_count, &(context->service_mask));
+               bt_device_get_service_mask_from_uuid_list(device_info->service_uuid, device_info->service_count, &(context->service_mask));
                context->result = NET_NFC_OK;
        } else {
                char name[512];
 
                DEBUG_ERR_MSG("bond failed, [%d]", result);
 
-               if(result != BT_ERROR_RESOURCE_BUSY){
+               if (result != BT_ERROR_RESOURCE_BUSY) {
                        __bt_get_name(context->carrier->carrier_record, name, sizeof(name));
 
                        net_nfc_app_util_show_notification(IDS_SIGNAL_3, name);
@@ -1060,105 +865,82 @@ void _bt_bond_created_cb(int result, bt_device_info_s *device_info,
        LOGD("[%s] END", __func__);
 }
 
-static int _bt_do_pairing(net_nfc_handover_bt_process_context_t *context)
+static int _bt_do_pairing(net_nfc_handover_bt_process_context_t * context)
 {
        int ret;
        bt_adapter_state_e adapter_state;
 
        if (context->result != NET_NFC_OK && context->result != NET_NFC_BUSY)
-       {
                DEBUG_ERR_MSG("context->result is error [%d]", context->result);
-       }
 
-       switch (context->step)
-       {
-       case NET_NFC_LLCP_STEP_01 :
+       switch (context->step) {
+       case NET_NFC_LLCP_STEP_01:
                INFO_MSG("STEP [1]");
 
                ret = bt_initialize();
                ret = bt_adapter_set_state_changed_cb(_bt_state_changed_cb, context);
                ret = bt_device_set_bond_created_cb(_bt_bond_created_cb, context);
 
-               if (ret >= BT_ERROR_NONE)
-               {
+               if (ret >= BT_ERROR_NONE) {
                        /* next step */
                        context->step = NET_NFC_LLCP_STEP_02;
 
                        ret = bt_adapter_get_state(&adapter_state);
 
-                       if (adapter_state != BT_ADAPTER_ENABLED)
-                       {
+                       if (adapter_state != BT_ADAPTER_ENABLED) {
                                context->result = NET_NFC_OK;
 
                                ret = bt_adapter_enable();
-                               if (ret != BT_ERROR_NONE)
-                               {
+                               if (ret != BT_ERROR_NONE) {
                                        DEBUG_ERR_MSG("bt adapter enable failed, [%d]", ret);
 
                                        context->step = NET_NFC_STATE_ERROR;
                                        context->result = NET_NFC_OPERATION_FAIL;
                                }
-                       }
-                       else
-                       {
+                       } else {
                                /* do next step */
                                INFO_MSG("BT is enabled already, go next step");
 
                                context->already_on = true;
                                context->result = NET_NFC_OK;
 
-                               g_idle_add((GSourceFunc)_bt_do_pairing, (gpointer)context);
+                               g_idle_add((GSourceFunc) _bt_do_pairing, (gpointer) context);
                        }
-               }
-               else
-               {
+               } else {
                        DEBUG_ERR_MSG("bt set register_callback failed, [%d]", ret);
 
                        /* bluetooth handover is working already. skip new request */
                        context->step = NET_NFC_LLCP_STEP_05;
                        context->result = NET_NFC_OPERATION_FAIL;
 
-                       g_idle_add((GSourceFunc)_bt_do_pairing,
-                               (gpointer)context);
+                       g_idle_add((GSourceFunc) _bt_do_pairing, (gpointer) context);
                }
                break;
 
-       case NET_NFC_LLCP_STEP_02 :
+       case NET_NFC_LLCP_STEP_02:
                {
                        net_nfc_carrier_config_s *config;
                        data_s temp = { NULL, 0 };
 
                        INFO_MSG("STEP [2]");
 
-                       net_nfc_util_handover_bt_create_config_from_record(
-                               &config, context->carrier->carrier_record);
+                       net_nfc_util_handover_bt_create_config_from_record(&config, context->carrier->carrier_record);
 
-                       net_nfc_util_get_carrier_config_property(config,
-                               NET_NFC_BT_ATTRIBUTE_ADDRESS,
-                               (uint16_t *)&temp.length, &temp.buffer);
-                       if (temp.length == 6)
-                       {
+                       net_nfc_util_get_carrier_config_property(config, NET_NFC_BT_ATTRIBUTE_ADDRESS, (uint16_t *) & temp.length, &temp.buffer);
+                       if (temp.length == 6) {
                                bt_device_info_s *device_info;
 
                                NET_NFC_REVERSE_ORDER_6_BYTES(temp.buffer);
-                               snprintf(context->remote_address, 18, "%02X:%02X:%02X:%02X:%02X:%02X",
-                                                               temp.buffer[0],
-                                                               temp.buffer[1],
-                                                               temp.buffer[2],
-                                                               temp.buffer[3],
-                                                               temp.buffer[4],
-                                                               temp.buffer[5]);
+                               snprintf(context->remote_address, 18, "%02X:%02X:%02X:%02X:%02X:%02X", temp.buffer[0], temp.buffer[1], temp.buffer[2], temp.buffer[3], temp.buffer[4], temp.buffer[5]);
 
                                context->result = NET_NFC_OK;
 
-                               if (bt_adapter_get_bonded_device_info(context->remote_address, &device_info) == BT_ERROR_NONE)
-                               {
+                               if (bt_adapter_get_bonded_device_info(context->remote_address, &device_info) == BT_ERROR_NONE) {
                                        INFO_MSG("already paired with [%s]", context->remote_address);
 
                                        context->step = NET_NFC_LLCP_STEP_04;
 
-                                       ret = bt_device_get_service_mask_from_uuid_list(device_info->service_uuid,
-                                               device_info->service_count, &(context->service_mask));
+                                       ret = bt_device_get_service_mask_from_uuid_list(device_info->service_uuid, device_info->service_count, &(context->service_mask));
 #ifdef DISCONNECT_DEVICE
                                        gboolean connected = FALSE;
                                        bt_device_is_profile_connected(context->remote_address, BT_PROFILE_HSP, &connected);
@@ -1173,18 +955,16 @@ static int _bt_do_pairing(net_nfc_handover_bt_process_context_t *context)
                                        if (connected)
                                                context->step = NET_NFC_LLCP_STEP_06;
 
-                                       INFO_MSG("Check connected=[%d] " , connected );
+                                       INFO_MSG("Check connected=[%d] ", connected);
 #endif
-                               }
-                               else
-                               {
-                                       net_nfc_handover_bt_oob_data_t oob = { { 0 } , };
+                               } else {
+                                       net_nfc_handover_bt_oob_data_t oob = { {0}
+                                       ,
+                                       };
 
-                                       if (_bt_get_oob_data_from_config(config, &oob) == NET_NFC_OK)
-                                       {
+                                       if (_bt_get_oob_data_from_config(config, &oob) == NET_NFC_OK) {
                                                /* set oob data */
-                                               bt_adapter_set_remote_oob_data(context->remote_address,
-                                                       oob.hash, oob.randomizer, oob.hash_len, oob.randomizer_len);
+                                               bt_adapter_set_remote_oob_data(context->remote_address, oob.hash, oob.randomizer, oob.hash_len, oob.randomizer_len);
                                        }
 
                                        /* pair and send response */
@@ -1192,9 +972,7 @@ static int _bt_do_pairing(net_nfc_handover_bt_process_context_t *context)
                                }
 
                                bt_adapter_free_device_info(device_info);
-                       }
-                       else
-                       {
+                       } else {
                                DEBUG_ERR_MSG("bluetooth address is invalid. [%d] bytes", temp.length);
 
                                context->step = NET_NFC_STATE_ERROR;
@@ -1203,37 +981,33 @@ static int _bt_do_pairing(net_nfc_handover_bt_process_context_t *context)
 
                        net_nfc_util_free_carrier_config(config);
 
-                       g_idle_add((GSourceFunc)_bt_do_pairing, (gpointer)context);
+                       g_idle_add((GSourceFunc) _bt_do_pairing, (gpointer) context);
                }
                break;
 
-       case NET_NFC_LLCP_STEP_03 :
+       case NET_NFC_LLCP_STEP_03:
                INFO_MSG("STEP [3]");
                context->step = NET_NFC_LLCP_STEP_04;
 
                DEBUG_ERR_MSG("bt_device_create_bond : [%s]", context->remote_address);
 
                ret = bt_device_create_bond(context->remote_address);
-               if (ret != BT_ERROR_NONE && ret != BT_ERROR_RESOURCE_BUSY)
-               {
+               if (ret != BT_ERROR_NONE && ret != BT_ERROR_RESOURCE_BUSY) {
                        DEBUG_ERR_MSG("bt_device_create_bond failed, [%d]", ret);
 
                        context->step = NET_NFC_STATE_ERROR;
                        context->result = NET_NFC_OPERATION_FAIL;
 
-                       g_idle_add((GSourceFunc)_bt_do_pairing,
-                               (gpointer)context);
+                       g_idle_add((GSourceFunc) _bt_do_pairing, (gpointer) context);
                }
                break;
 
-       case NET_NFC_LLCP_STEP_04 :
+       case NET_NFC_LLCP_STEP_04:
                INFO_MSG("STEP [4]");
 
                context->step = NET_NFC_LLCP_STEP_RETURN;
 
-               if ((context->service_mask & BT_SC_HSP_SERVICE_MASK) &&
-                       (context->service_mask & BT_SC_A2DP_SERVICE_MASK))
-               {
+               if ((context->service_mask & BT_SC_HSP_SERVICE_MASK) && (context->service_mask & BT_SC_A2DP_SERVICE_MASK)) {
 
                        bt_audio_initialize();
                        bt_audio_set_connection_state_changed_cb(_bt_audio_connection_state_changed_cb, context);
@@ -1256,37 +1030,30 @@ static int _bt_do_pairing(net_nfc_handover_bt_process_context_t *context)
                        bt_hid_host_connect(context->remote_address);
 
                } else {
-                       g_idle_add((GSourceFunc)_bt_do_pairing, (gpointer)context);
+                       g_idle_add((GSourceFunc) _bt_do_pairing, (gpointer) context);
                }
                break;
 
-       case NET_NFC_LLCP_STEP_05 :
+       case NET_NFC_LLCP_STEP_05:
                INFO_MSG("STEP [5]");
 
                /* bluetooth handover is working already. skip new request */
-               context->cb(context->result,
-                       NET_NFC_CONN_HANDOVER_CARRIER_BT,
-                       NULL, context->user_param);
+               context->cb(context->result, NET_NFC_CONN_HANDOVER_CARRIER_BT, NULL, context->user_param);
 
                /* release context */
                if (context->carrier != NULL)
-               {
                        net_nfc_util_free_handover_carrier(context->carrier);
-               }
 
                net_nfc_util_clear_data(&context->data);
                _net_nfc_util_free_mem(context);
                break;
 #ifdef DISCONNECT_DEVICE
-       case NET_NFC_LLCP_STEP_06 :
+       case NET_NFC_LLCP_STEP_06:
                INFO_MSG("STEP [6]");
 
                context->step = NET_NFC_LLCP_STEP_RETURN;
 
-
-               if ((context->service_mask & BT_SC_HSP_SERVICE_MASK) &&
-                       (context->service_mask & BT_SC_A2DP_SERVICE_MASK))
-               {
+               if ((context->service_mask & BT_SC_HSP_SERVICE_MASK) && (context->service_mask & BT_SC_A2DP_SERVICE_MASK)) {
 
                        bt_audio_initialize();
                        bt_audio_set_connection_state_changed_cb(_bt_audio_connection_state_changed_cb, context);
@@ -1309,25 +1076,21 @@ static int _bt_do_pairing(net_nfc_handover_bt_process_context_t *context)
                        bt_hid_host_disconnect(context->remote_address);
 
                } else {
-                       g_idle_add((GSourceFunc)_bt_do_pairing, (gpointer)context);
+                       g_idle_add((GSourceFunc) _bt_do_pairing, (gpointer) context);
                }
                break;
 #endif
-       case NET_NFC_STATE_ERROR :
+       case NET_NFC_STATE_ERROR:
                context->step = NET_NFC_LLCP_STEP_RETURN;
                if (context->already_on == false)
-               {
                        bt_adapter_disable();
-               }
                else
-               {
-                       g_idle_add((GSourceFunc)_bt_do_pairing, (gpointer)context);
-               }
+                       g_idle_add((GSourceFunc) _bt_do_pairing, (gpointer) context);
                break;
 
-       case NET_NFC_LLCP_STEP_RETURN :
+       case NET_NFC_LLCP_STEP_RETURN:
                {
-                       data_s temp = { (uint8_t *)context->remote_address, (uint32_t)sizeof(context->remote_address) };
+                       data_s temp = { (uint8_t *) context->remote_address, (uint32_t) sizeof(context->remote_address) };
                        data_s *data = NULL;
 
                        INFO_MSG("STEP return");
@@ -1335,37 +1098,27 @@ static int _bt_do_pairing(net_nfc_handover_bt_process_context_t *context)
                        bt_deinitialize();
 
                        if (context->result == NET_NFC_OK)
-                       {
                                data = &temp;
-                       }
 
-                       context->cb(context->result,
-                               NET_NFC_CONN_HANDOVER_CARRIER_BT,
-                               data, context->user_param);
+                       context->cb(context->result, NET_NFC_CONN_HANDOVER_CARRIER_BT, data, context->user_param);
 
                        /* release context */
                        if (context->carrier != NULL)
-                       {
-                               net_nfc_util_free_handover_carrier(
-                                       context->carrier);
-                       }
+                               net_nfc_util_free_handover_carrier(context->carrier);
 
                        net_nfc_util_clear_data(&context->data);
                        _net_nfc_util_free_mem(context);
                }
                break;
 
-       default :
+       default:
                break;
        }
 
        return 0;
 }
 
-net_nfc_error_e net_nfc_server_handover_bt_do_pairing(
-       net_nfc_ch_carrier_s *carrier,
-       net_nfc_server_handover_process_carrier_cb cb,
-       void *user_param)
+net_nfc_error_e net_nfc_server_handover_bt_do_pairing(net_nfc_ch_carrier_s * carrier, net_nfc_server_handover_process_carrier_cb cb, void *user_param)
 {
        net_nfc_error_e result = NET_NFC_OK;
        net_nfc_handover_bt_process_context_t *context = NULL;
@@ -1379,7 +1132,7 @@ net_nfc_error_e net_nfc_server_handover_bt_do_pairing(
                context->step = NET_NFC_LLCP_STEP_01;
 
                net_nfc_util_duplicate_handover_carrier(&context->carrier, carrier);
-               g_idle_add((GSourceFunc)_bt_do_pairing, (gpointer)context);
+               g_idle_add((GSourceFunc) _bt_do_pairing, (gpointer) context);
 
        } else {
                result = NET_NFC_ALLOC_FAIL;
index 08adc0b..4c3552a 100755 (executable)
 /*For Wifi-direct*/
 #define Size_of_MAC_Address 18
 
-typedef struct _net_nfc_handover_wfd_process_context_t
-{
+typedef struct _net_nfc_handover_wfd_process_context_t {
        bool already_on;
        net_nfc_error_e result;
        net_nfc_server_handover_process_carrier_cb cb;
        net_nfc_carrier_config_s *config;
        void *user_param;
        char *mac_address;
-}
-net_nfc_handover_wfd_process_context_t;
+} net_nfc_handover_wfd_process_context_t;
 
-typedef struct _device_type_t
-{
+typedef struct _device_type_t {
        uint16_t cat_id;
        uint32_t oui;
        uint16_t sub_cat_id;
-}
-__attribute__((packed)) device_type_t;
+} __attribute__ ((packed)) device_type_t;
 
-typedef struct _device_info_attr_t
-{
+typedef struct _device_info_attr_t {
        uint8_t address[6];
        uint16_t config_methods;
        device_type_t primary_device;
        uint16_t secondary_devices_num;
        device_type_t secondary_devices[0];
-}
-__attribute__((packed)) device_info_attr_t;
+} __attribute__ ((packed)) device_info_attr_t;
 
-static void set_mac_address(char *data, uint8_t *origin_data)
+static void set_mac_address(char *data, uint8_t * origin_data)
 {
        int i, len = 0;
 
-       for (i = 0; i < 6; i++)
-       {
+       for (i = 0; i < 6; i++) {
                len += snprintf(data + len, 3, "%02x", origin_data[i]);
 
                //DEBUG_SERVER_MSG("check temp [%s]", data);
@@ -74,42 +67,31 @@ static void set_mac_address(char *data, uint8_t *origin_data)
        SECURE_MSG("check mac_address [%s]", data);
 }
 
-static bool _cb_discovered_peers(wifi_direct_discovered_peer_info_s *peer,
-       void *user_data)
+static bool _cb_discovered_peers(wifi_direct_discovered_peer_info_s * peer, void *user_data)
 {
-       net_nfc_handover_wfd_process_context_t *context =
-               (net_nfc_handover_wfd_process_context_t *)user_data;
+       net_nfc_handover_wfd_process_context_t *context = (net_nfc_handover_wfd_process_context_t *) user_data;
        bool result = true;
 
-       if (peer->mac_address != NULL && context->mac_address != NULL)
-       {
+       if (peer->mac_address != NULL && context->mac_address != NULL) {
                SECURE_MSG("mac_address [%s]", context->mac_address);
                SECURE_MSG("peer->mac_address [%s]", peer->mac_address);
 
                /* Check mac address */
-               if (strncasecmp(peer->mac_address, context->mac_address,
-                       strlen(context->mac_address)) == 0)
-               {
+               if (strncasecmp(peer->mac_address, context->mac_address, strlen(context->mac_address)) == 0) {
                        DEBUG_SERVER_MSG("wifi_direct_connect");
                        wifi_direct_connect(context->mac_address);
 
-                       context->cb(context->result,
-                               NET_NFC_CONN_HANDOVER_CARRIER_WIFI_P2P,
-                               NULL, context->user_param);
+                       context->cb(context->result, NET_NFC_CONN_HANDOVER_CARRIER_WIFI_P2P, NULL, context->user_param);
 
                        g_free(context->mac_address);
 
                        if (context->config != NULL)
-                       {
                                net_nfc_util_free_carrier_config(context->config);
-                       }
 
                        _net_nfc_util_free_mem(context);
 
-                       result = false; /* break iterate */
-               }
-               else
-               {
+                       result = false;         /* break iterate */
+               } else {
                        DEBUG_SERVER_MSG("I have to find other wifi direct");
                }
        }
@@ -117,32 +99,27 @@ static bool _cb_discovered_peers(wifi_direct_discovered_peer_info_s *peer,
        return result;
 }
 
-static void _cb_activation(int error_code,
-       wifi_direct_device_state_e device_state, void *user_data)
+static void _cb_activation(int error_code, wifi_direct_device_state_e device_state, void *user_data)
 {
        int result;
 
        DEBUG_SERVER_MSG("Call _cb_activation [%p]", user_data);
 
-       switch (device_state)
-       {
-       case WIFI_DIRECT_DEVICE_STATE_ACTIVATED :
+       switch (device_state) {
+       case WIFI_DIRECT_DEVICE_STATE_ACTIVATED:
                {
                        DEBUG_SERVER_MSG("event -WIFI_DIRECT_DEVICE_STATE_ACTIVATED");
 
-                       result = wifi_direct_start_discovery_specific_channel(
-                               FALSE, 0, WIFI_DIRECT_DISCOVERY_FULL_SCAN);
-                       if (WIFI_DIRECT_ERROR_NOT_PERMITTED == result)
-                       {
+                       result = wifi_direct_start_discovery_specific_channel(FALSE, 0, WIFI_DIRECT_DISCOVERY_FULL_SCAN);
+                       if (WIFI_DIRECT_ERROR_NOT_PERMITTED == result) {
                                DEBUG_SERVER_MSG("WIFI_DIRECT_ERROR_NOT_PERMITTED");
 
-                               result = wifi_direct_foreach_discovered_peers(
-                                       _cb_discovered_peers, (void*)user_data);
+                               result = wifi_direct_foreach_discovered_peers(_cb_discovered_peers, (void *)user_data);
                        }
                }
                break;
 
-       case WIFI_DIRECT_DEVICE_STATE_DEACTIVATED :
+       case WIFI_DIRECT_DEVICE_STATE_DEACTIVATED:
                {
                        DEBUG_SERVER_MSG("event - WIFI_DIRECT_DEVICE_STATE_DEACTIVATED");
                }
@@ -153,25 +130,22 @@ static void _cb_activation(int error_code,
        }
 }
 
-static void _cb_discovery(int error_code,
-       wifi_direct_discovery_state_e discovery_state, void *user_data)
+static void _cb_discovery(int error_code, wifi_direct_discovery_state_e discovery_state, void *user_data)
 {
        int result;
 
        DEBUG_SERVER_MSG("Call _cb_discovery");
 
-       switch (discovery_state)
-       {
-       case WIFI_DIRECT_DISCOVERY_STARTED :
+       switch (discovery_state) {
+       case WIFI_DIRECT_DISCOVERY_STARTED:
                DEBUG_SERVER_MSG("event - WIFI_DIRECT_DISCOVERY_STARTED");
                break;
 
-       case WIFI_DIRECT_DISCOVERY_FOUND :
+       case WIFI_DIRECT_DISCOVERY_FOUND:
                {
                        DEBUG_SERVER_MSG("event - WIFI_DIRECT_DISCOVERY_FOUND");
 
-                       result = wifi_direct_foreach_discovered_peers(
-                               _cb_discovered_peers, (void*)user_data);
+                       result = wifi_direct_foreach_discovered_peers(_cb_discovered_peers, (void *)user_data);
 
                        DEBUG_SERVER_MSG("wifi_direct_foreach_discovered_peers() result=[0x%x]", result);
                }
@@ -182,26 +156,24 @@ static void _cb_discovery(int error_code,
        }
 }
 
-static int handover_wfd_init(net_nfc_handover_wfd_process_context_t *user_data)
+static int handover_wfd_init(net_nfc_handover_wfd_process_context_t * user_data)
 {
        int result;
 
        DEBUG_SERVER_MSG("handover_wfd_init");
 
        result = wifi_direct_initialize();
-       if (WIFI_DIRECT_ERROR_ALREADY_INITIALIZED == result)
-       {
+       if (WIFI_DIRECT_ERROR_ALREADY_INITIALIZED == result) {
                DEBUG_SERVER_MSG("WIFI_DIRECT_ERROR_ALREADY_INITIALIZED!!");
                return NET_NFC_OK;
        }
 
-       if (WIFI_DIRECT_ERROR_NONE != result)
-       {
+       if (WIFI_DIRECT_ERROR_NONE != result) {
                DEBUG_SERVER_MSG("wifi_direct_initialize failed [0x%x]!!", result);
                return NET_NFC_UNKNOWN_ERROR;
        }
 
-       /* set callback for active*/
+       /* set callback for active */
        wifi_direct_set_device_state_changed_cb(_cb_activation, user_data);
 
        wifi_direct_set_discovery_state_changed_cb(_cb_discovery, user_data);
@@ -211,22 +183,20 @@ static int handover_wfd_init(net_nfc_handover_wfd_process_context_t *user_data)
 
        DEBUG_SERVER_MSG("wifi_direct_activate");
 
-       /*we need to check wifi state??*/
+       /*we need to check wifi state?? */
        //wifi_direct_set_connection_state_changed_cb(_cb_connection, ad);
        return NET_NFC_OK;
 }
 
-net_nfc_error_e _net_nfc_server_handover_wifi_direct_pairing(
-       net_nfc_handover_wfd_process_context_t *context)
+net_nfc_error_e _net_nfc_server_handover_wifi_direct_pairing(net_nfc_handover_wfd_process_context_t * context)
 {
        net_nfc_error_e result = NET_NFC_OK;
        uint16_t len = 0;
        uint8_t *data = NULL;
 
-       result = net_nfc_util_get_carrier_config_property(context->config,
-               NET_NFC_WIFI_P2P_ATTRIBUTE_DEVICE_INFO, &len, &data);
+       result = net_nfc_util_get_carrier_config_property(context->config, NET_NFC_WIFI_P2P_ATTRIBUTE_DEVICE_INFO, &len, &data);
        if (result == NET_NFC_OK) {
-               device_info_attr_t *info = (device_info_attr_t *)data;
+               device_info_attr_t *info = (device_info_attr_t *) data;
 
                context->mac_address = (char *)malloc(Size_of_MAC_Address * sizeof(char));
                set_mac_address(context->mac_address, info->address);
@@ -241,10 +211,7 @@ net_nfc_error_e _net_nfc_server_handover_wifi_direct_pairing(
        return result;
 }
 
-net_nfc_error_e net_nfc_server_handover_wfd_do_pairing(
-       net_nfc_ch_carrier_s *carrier,
-       net_nfc_server_handover_process_carrier_cb cb,
-       void *user_param)
+net_nfc_error_e net_nfc_server_handover_wfd_do_pairing(net_nfc_ch_carrier_s * carrier, net_nfc_server_handover_process_carrier_cb cb, void *user_param)
 {
        net_nfc_error_e result = NET_NFC_OK;
        net_nfc_handover_wfd_process_context_t *context = NULL;
@@ -252,24 +219,19 @@ net_nfc_error_e net_nfc_server_handover_wfd_do_pairing(
        DEBUG_SERVER_MSG("Call this function for connecting wifi-direct");
 
        _net_nfc_util_alloc_mem(context, sizeof(*context));
-       if (context != NULL)
-       {
+       if (context != NULL) {
                context->cb = cb;
                context->user_param = user_param;
 
-               result = net_nfc_util_create_carrier_config_from_config_record(
-                       &context->config, carrier->carrier_record);
+               result = net_nfc_util_create_carrier_config_from_config_record(&context->config, carrier->carrier_record);
                if (result == NET_NFC_OK) {
-                       g_idle_add((GSourceFunc)_net_nfc_server_handover_wifi_direct_pairing,
-                               (gpointer)context);
+                       g_idle_add((GSourceFunc) _net_nfc_server_handover_wifi_direct_pairing, (gpointer) context);
                } else {
                        DEBUG_ERR_MSG("net_nfc_util_create_carrier_config_from_config_record failed, [%d]", result);
 
                        _net_nfc_util_free_mem(context);
                }
-       }
-       else
-       {
+       } else {
                result = NET_NFC_ALLOC_FAIL;
        }
 
index 1ed5b28..b71f5fa 100755 (executable)
 
 #include <vconf.h>
 
-typedef struct _wps_process_context_t
-{
+typedef struct _wps_process_context_t {
        net_nfc_error_e result;
        net_nfc_carrier_config_s *config;
        net_nfc_server_handover_process_carrier_cb cb;
        void *user_param;
-}
-wps_process_context_t;
+} wps_process_context_t;
 
 net_nfc_conn_handover_carrier_state_e net_nfc_server_handover_wps_get_cps()
 {
@@ -43,16 +41,15 @@ net_nfc_conn_handover_carrier_state_e net_nfc_server_handover_wps_get_cps()
 
        (void)vconf_get_int(VCONFKEY_WIFI_STATE, &wifi_state);
 
-       switch (wifi_state)
-       {
-       case VCONFKEY_WIFI_UNCONNECTED :
-       case VCONFKEY_WIFI_CONNECTED :
-       case VCONFKEY_WIFI_TRANSFER :
+       switch (wifi_state) {
+       case VCONFKEY_WIFI_UNCONNECTED:
+       case VCONFKEY_WIFI_CONNECTED:
+       case VCONFKEY_WIFI_TRANSFER:
                cps = NET_NFC_CONN_HANDOVER_CARRIER_ACTIVATE;
                break;
 
-       case VCONFKEY_WIFI_OFF :
-       default :
+       case VCONFKEY_WIFI_OFF:
+       default:
                cps = NET_NFC_CONN_HANDOVER_CARRIER_INACTIVATE;
                break;
        }
@@ -60,55 +57,46 @@ net_nfc_conn_handover_carrier_state_e net_nfc_server_handover_wps_get_cps()
        return cps;
 }
 
-static char *_wps_get_string_property(net_nfc_carrier_config_s *config,
-       uint16_t attr)
+static char *_wps_get_string_property(net_nfc_carrier_config_s * config, uint16_t attr)
 {
        char *result = NULL;
        uint16_t len = 0;
        uint8_t *buffer = NULL;
        net_nfc_error_e ret;
 
-       ret = net_nfc_util_get_carrier_config_property(config,
-               attr, &len, &buffer);
-       if (ret == NET_NFC_OK) {
+       ret = net_nfc_util_get_carrier_config_property(config, attr, &len, &buffer);
+       if (ret == NET_NFC_OK)
                result = g_strndup((char *)buffer, len);
-       }
 
        return result;
 }
 
-static uint16_t _wps_get_short_property(net_nfc_carrier_config_s *config,
-       uint16_t attr)
+static uint16_t _wps_get_short_property(net_nfc_carrier_config_s * config, uint16_t attr)
 {
        uint16_t result = 0;
        uint16_t len = 0;
        uint8_t *buffer = NULL;
        net_nfc_error_e ret;
 
-       ret = net_nfc_util_get_carrier_config_property(config,
-               attr, &len, &buffer);
-       if (ret == NET_NFC_OK) {
-               result = htons(*(uint16_t *)buffer);
-       }
+       ret = net_nfc_util_get_carrier_config_property(config, attr, &len, &buffer);
+       if (ret == NET_NFC_OK)
+               result = htons(*(uint16_t *) buffer);
 
        return result;
 }
 
-static char *_wps_get_mac_address(net_nfc_carrier_config_s *config)
+static char *_wps_get_mac_address(net_nfc_carrier_config_s * config)
 {
        char *result = NULL;
        uint16_t len = 0;
        uint8_t *buffer = NULL;
        net_nfc_error_e ret;
 
-       ret = net_nfc_util_get_carrier_config_property(config,
-               NET_NFC_WIFI_ATTRIBUTE_MAC_ADDR, &len, &buffer);
+       ret = net_nfc_util_get_carrier_config_property(config, NET_NFC_WIFI_ATTRIBUTE_MAC_ADDR, &len, &buffer);
        if (ret == NET_NFC_OK) {
                char temp[50];
 
-               snprintf(temp, sizeof(temp), "%02X:%02X:%02X:%02X:%02X:%02X",
-                       buffer[0], buffer[1], buffer[2],
-                       buffer[3], buffer[4], buffer[5]);
+               snprintf(temp, sizeof(temp), "%02X:%02X:%02X:%02X:%02X:%02X", buffer[0], buffer[1], buffer[2], buffer[3], buffer[4], buffer[5]);
 
                result = g_strdup(temp);
        }
@@ -116,41 +104,39 @@ static char *_wps_get_mac_address(net_nfc_carrier_config_s *config)
        return result;
 }
 
-static wifi_security_type_e _wps_get_security_type(
-       net_nfc_carrier_config_s *config)
+static wifi_security_type_e _wps_get_security_type(net_nfc_carrier_config_s * config)
 {
        wifi_security_type_e result;
        uint16_t ret;
 
-       ret = _wps_get_short_property(config,
-               NET_NFC_WIFI_ATTRIBUTE_AUTH_TYPE);
+       ret = _wps_get_short_property(config, NET_NFC_WIFI_ATTRIBUTE_AUTH_TYPE);
 
        switch (ret) {
-       case 1 : /* open */
+       case 1:                                 /* open */
                result = WIFI_SECURITY_TYPE_NONE;
                break;
 
-       case 2 : /* WPA-Personal */
+       case 2:                                 /* WPA-Personal */
                result = WIFI_SECURITY_TYPE_WPA_PSK;
                break;
 
-       case 4 : /* Shared */
+       case 4:                                 /* Shared */
                result = WIFI_SECURITY_TYPE_WEP;
                break;
 
-       case 8 : /* WPA-Enterprise */
+       case 8:                                 /* WPA-Enterprise */
                result = WIFI_SECURITY_TYPE_EAP;
                break;
 
-       case 16 : /* WPA2-Enterprise */
+       case 16:                                        /* WPA2-Enterprise */
                result = WIFI_SECURITY_TYPE_EAP;
                break;
 
-       case 32 : /* WPA2-Personal */
+       case 32:                                        /* WPA2-Personal */
                result = WIFI_SECURITY_TYPE_WPA2_PSK;
                break;
 
-       default :
+       default:
                result = WIFI_SECURITY_TYPE_NONE;
                break;
        }
@@ -158,37 +144,35 @@ static wifi_security_type_e _wps_get_security_type(
        return result;
 }
 
-static wifi_encryption_type_e _wps_get_encryption_type(
-       net_nfc_carrier_config_s *config)
+static wifi_encryption_type_e _wps_get_encryption_type(net_nfc_carrier_config_s * config)
 {
        wifi_encryption_type_e result;
        uint16_t ret;
 
-       ret = _wps_get_short_property(config,
-               NET_NFC_WIFI_ATTRIBUTE_ENC_TYPE);
+       ret = _wps_get_short_property(config, NET_NFC_WIFI_ATTRIBUTE_ENC_TYPE);
 
        switch (ret) {
-       case 1 : /* None */
+       case 1:                                 /* None */
                result = WIFI_ENCRYPTION_TYPE_NONE;
                break;
 
-       case 2 : /* WEP */
+       case 2:                                 /* WEP */
                result = WIFI_ENCRYPTION_TYPE_WEP;
                break;
 
-       case 4 : /* TKIP */
+       case 4:                                 /* TKIP */
                result = WIFI_ENCRYPTION_TYPE_TKIP;
                break;
 
-       case 8 : /* AES */
+       case 8:                                 /* AES */
                result = WIFI_ENCRYPTION_TYPE_AES;
                break;
 
-       case 12 : /* AES/TKIP */
+       case 12:                                        /* AES/TKIP */
                result = WIFI_ENCRYPTION_TYPE_TKIP_AES_MIXED;
                break;
 
-       default :
+       default:
                result = WIFI_SECURITY_TYPE_NONE;
                break;
        }
@@ -196,48 +180,40 @@ static wifi_encryption_type_e _wps_get_encryption_type(
        return result;
 }
 
-net_nfc_error_e net_nfc_server_handover_wps_get_selector_carrier(
-       net_nfc_server_handover_get_carrier_cb cb,
-       void *user_param)
+net_nfc_error_e net_nfc_server_handover_wps_get_selector_carrier(net_nfc_server_handover_get_carrier_cb cb, void *user_param)
 {
        net_nfc_error_e result = NET_NFC_NOT_SUPPORTED;
 
        /* generating selector record is not supported */
 
-       if (cb != NULL) {
+       if (cb != NULL)
                cb(NET_NFC_NOT_SUPPORTED, NULL, user_param);
-       }
 
        return result;
 }
 
-net_nfc_error_e net_nfc_server_handover_wps_get_requester_carrier(
-       net_nfc_server_handover_get_carrier_cb cb,
-       void *user_param)
+net_nfc_error_e net_nfc_server_handover_wps_get_requester_carrier(net_nfc_server_handover_get_carrier_cb cb, void *user_param)
 {
        net_nfc_error_e result;
        net_nfc_ch_carrier_s *carrier = NULL;
        ndef_record_s *record = NULL;
-       data_s type = { (uint8_t *)CH_CAR_RECORD_TYPE, CH_CAR_RECORD_TYPE_LEN };
+       data_s type = { (uint8_t *) CH_CAR_RECORD_TYPE, CH_CAR_RECORD_TYPE_LEN };
        uint8_t buffer[sizeof(ch_hc_record_t) + CH_WIFI_WPS_MIME_LEN];
        data_s payload = { buffer, sizeof(buffer) };
-       ch_hc_record_t *hc_buffer = (ch_hc_record_t *)buffer;
+       ch_hc_record_t *hc_buffer = (ch_hc_record_t *) buffer;
 
        hc_buffer->ctf = NET_NFC_RECORD_MIME_TYPE;
        hc_buffer->type_len = CH_WIFI_WPS_MIME_LEN;
        memcpy(hc_buffer->type, CH_WIFI_WPS_MIME, CH_WIFI_WPS_MIME_LEN);
 
-       result = net_nfc_util_create_record(NET_NFC_RECORD_WELL_KNOWN_TYPE,
-               &type, NULL, &payload, &record);
+       result = net_nfc_util_create_record(NET_NFC_RECORD_WELL_KNOWN_TYPE, &type, NULL, &payload, &record);
 
-       result = net_nfc_util_create_handover_carrier(&carrier,
-               NET_NFC_CONN_HANDOVER_CARRIER_ACTIVATE);
+       result = net_nfc_util_create_handover_carrier(&carrier, NET_NFC_CONN_HANDOVER_CARRIER_ACTIVATE);
 
        result = net_nfc_util_append_handover_carrier_record(carrier, record);
 
-       if (cb != NULL) {
+       if (cb != NULL)
                cb(result, carrier, user_param);
-       }
 
        net_nfc_util_free_handover_carrier(carrier);
 
@@ -248,7 +224,7 @@ net_nfc_error_e net_nfc_server_handover_wps_get_requester_carrier(
 
 static bool _wifi_found_ap_cb(wifi_ap_h ap, void *user_data)
 {
-       gpointer *context = (gpointer *)user_data;
+       gpointer *context = (gpointer *) user_data;
        bool result;
        char *ssid = NULL;
        int ret;
@@ -286,12 +262,12 @@ static wifi_ap_h _wifi_search_ap(const char *ssid)
 {
        gpointer context[2];
 
-       context[0] = (gpointer)ssid;
+       context[0] = (gpointer) ssid;
        context[1] = NULL;
 
        (void)wifi_foreach_found_aps(_wifi_found_ap_cb, &context);
 
-       return (wifi_ap_h)context[1];
+       return (wifi_ap_h) context[1];
 }
 
 static bool _wifi_is_connected(wifi_ap_h ap)
@@ -313,7 +289,7 @@ static bool _wifi_is_connected(wifi_ap_h ap)
        return result;
 }
 
-static void _wps_finish_do_connect(int result, wps_process_context_t *context)
+static void _wps_finish_do_connect(int result, wps_process_context_t * context)
 {
        if (context != NULL) {
                if (context->cb != NULL) {
@@ -325,26 +301,21 @@ static void _wps_finish_do_connect(int result, wps_process_context_t *context)
 
                                mac = _wps_get_mac_address(context->config);
                                if (mac != NULL) {
-                                       temp.buffer = (uint8_t *)mac;
+                                       temp.buffer = (uint8_t *) mac;
                                        temp.length = strlen(mac);
 
                                        data = &temp;
                                }
                        }
 
-                       context->cb(result,
-                               NET_NFC_CONN_HANDOVER_CARRIER_WIFI_WPS,
-                               data,
-                               context->user_param);
+                       context->cb(result, NET_NFC_CONN_HANDOVER_CARRIER_WIFI_WPS, data, context->user_param);
 
-                       if (data != NULL) {
+                       if (data != NULL)
                                net_nfc_util_clear_data(data);
-                       }
                }
 
-               if (context->config != NULL) {
+               if (context->config != NULL)
                        net_nfc_util_free_carrier_config(context->config);
-               }
 
                _net_nfc_util_free_mem(context);
        }
@@ -357,7 +328,7 @@ static void _wifi_connected_cb(wifi_error_e result, void *user_data)
        _wps_finish_do_connect(result, user_data);
 }
 
-static int __connect(wifi_ap_h ap, wps_process_context_t *context)
+static int __connect(wifi_ap_h ap, wps_process_context_t * context)
 {
        int result;
        char *net_key;
@@ -365,8 +336,7 @@ static int __connect(wifi_ap_h ap, wps_process_context_t *context)
        (void)wifi_ap_set_security_type(ap, _wps_get_security_type(context->config));
        (void)wifi_ap_set_encryption_type(ap, _wps_get_encryption_type(context->config));
 
-       net_key = _wps_get_string_property(context->config,
-               NET_NFC_WIFI_ATTRIBUTE_NET_KEY);
+       net_key = _wps_get_string_property(context->config, NET_NFC_WIFI_ATTRIBUTE_NET_KEY);
        (void)wifi_ap_set_passphrase(ap, net_key);
        g_free(net_key);
 
@@ -375,14 +345,13 @@ static int __connect(wifi_ap_h ap, wps_process_context_t *context)
        return result;
 }
 
-static void _connect(wps_process_context_t *context)
+static void _connect(wps_process_context_t * context)
 {
        wifi_ap_h ap = NULL;
        int result;
        char *ssid;
 
-       ssid = _wps_get_string_property(context->config,
-               NET_NFC_WIFI_ATTRIBUTE_SSID);
+       ssid = _wps_get_string_property(context->config, NET_NFC_WIFI_ATTRIBUTE_SSID);
        if (ssid != NULL) {
                ap = _wifi_search_ap(ssid);
                if (ap == NULL) {
@@ -448,9 +417,8 @@ static void _wifi_activated_cb(wifi_error_e result, void *user_data)
                int ret;
 
                ret = wifi_scan(_wifi_scan_finished_cb, user_data);
-               if (ret != WIFI_ERROR_NONE) {
+               if (ret != WIFI_ERROR_NONE)
                        DEBUG_ERR_MSG("wifi_scan failed, [%d]", ret);
-               }
        } else {
                DEBUG_ERR_MSG("wifi_activate failed, [%d]", result);
 
@@ -458,7 +426,7 @@ static void _wifi_activated_cb(wifi_error_e result, void *user_data)
        }
 }
 
-static int _wifi_activate(wps_process_context_t *context)
+static int _wifi_activate(wps_process_context_t * context)
 {
        int result;
 
@@ -472,9 +440,8 @@ static int _wifi_activate(wps_process_context_t *context)
                                DEBUG_SERVER_MSG("wifi is off, try to activate");
                                /* activate */
                                result = wifi_activate(_wifi_activated_cb, context);
-                               if (result != WIFI_ERROR_NONE) {
+                               if (result != WIFI_ERROR_NONE)
                                        DEBUG_ERR_MSG("wifi_activate failed, [%d]", result);
-                               }
                        } else {
                                _connect(context);
 
@@ -490,10 +457,7 @@ static int _wifi_activate(wps_process_context_t *context)
        return result;
 }
 
-net_nfc_error_e net_nfc_server_handover_wps_do_connect(
-       net_nfc_ch_carrier_s *carrier,
-       net_nfc_server_handover_process_carrier_cb cb,
-       void *user_param)
+net_nfc_error_e net_nfc_server_handover_wps_do_connect(net_nfc_ch_carrier_s * carrier, net_nfc_server_handover_process_carrier_cb cb, void *user_param)
 {
        net_nfc_error_e result;
        wps_process_context_t *context = NULL;
@@ -503,8 +467,7 @@ net_nfc_error_e net_nfc_server_handover_wps_do_connect(
                context->cb = cb;
                context->user_param = user_param;
 
-               result = net_nfc_util_create_carrier_config_from_config_record(
-                       &context->config, carrier->carrier_record);
+               result = net_nfc_util_create_carrier_config_from_config_record(&context->config, carrier->carrier_record);
                if (result == NET_NFC_OK) {
                        result = _wifi_activate(context);
                        if (result != NET_NFC_OK) {
index 5db441e..a13bdec 100755 (executable)
@@ -45,30 +45,26 @@ static char *selected_aid;
 //static uint8_t android_hce_aid_buffer[] = { 0xA0, 0x00, 0x00, 0x04, 0x76, 0x41, 0x6E, 0x64, 0x72, 0x6F, 0x69, 0x64, 0x48, 0x43, 0x45 };
 //static data_s android_hce_aid = { android_hce_aid_buffer, sizeof(android_hce_aid_buffer) };
 
-typedef struct _hce_listener_t
-{
+typedef struct _hce_listener_t {
        char *id;
        char *package;
        net_nfc_server_hce_listener_cb listener;
        net_nfc_server_hce_user_data_destroy_cb destroy_cb;
        void *user_data;
-}
-hce_listener_t;
+} hce_listener_t;
 
 /* server_side */
 typedef struct _SeDataHandle SeDataHandle;
 
-struct _SeDataHandle
-{
+struct _SeDataHandle {
        NetNfcGDbusHce *object;
        GDBusMethodInvocation *invocation;
-       net_nfc_target_handle_shandle;
+       net_nfc_target_handle_s *handle;
 };
 
 typedef struct _ServerHceData ServerHceData;
 
-struct _ServerHceData
-{
+struct _ServerHceData {
        net_nfc_target_handle_s *handle;
        guint event;
        data_s apdu;
@@ -76,42 +72,35 @@ struct _ServerHceData
 
 typedef struct _HceDataApdu HceDataApdu;
 
-struct _HceDataApdu
-{
+struct _HceDataApdu {
        NetNfcGDbusHce *object;
        GDBusMethodInvocation *invocation;
        net_nfc_target_handle_s *handle;
        GVariant *data;
 };
 
-typedef struct _hce_client_context_s
-{
+typedef struct _hce_client_context_s {
        GDBusConnection *connection;
        char *id;
-}
-hce_client_context_s;
-
-typedef bool (*route_table_iter_cb)(hce_listener_t *data, void *user_data);
+} hce_client_context_s;
 
+typedef bool(*route_table_iter_cb) (hce_listener_t * data, void *user_data);
 
 static void __on_key_destroy(gpointer data)
 {
-       if (data != NULL) {
+       if (data != NULL)
                g_free(data);
-       }
 }
 
 static void __on_value_destroy(gpointer data)
 {
-       hce_listener_t *listener = (hce_listener_t *)data;
+       hce_listener_t *listener = (hce_listener_t *) data;
 
        if (data != NULL) {
-               if (listener->id != NULL) {
+               if (listener->id != NULL)
                        g_free(listener->id);
-               }
-               if (listener->package != NULL) {
+               if (listener->package != NULL)
                        g_free(listener->package);
-               }
 
                g_free(data);
        }
@@ -120,19 +109,15 @@ static void __on_value_destroy(gpointer data)
 static void _routing_table_init()
 {
        if (routing_table_aid == NULL)
-               routing_table_aid = g_hash_table_new_full(g_str_hash,
-                       g_str_equal, __on_key_destroy, __on_value_destroy);
+               routing_table_aid = g_hash_table_new_full(g_str_hash, g_str_equal, __on_key_destroy, __on_value_destroy);
 }
 
-inline static hce_listener_t *_routing_table_find_aid(const char *package)
+static inline hce_listener_t *_routing_table_find_aid(const char *package)
 {
-       return (hce_listener_t *)g_hash_table_lookup(routing_table_aid,
-               (gconstpointer)package);
+       return (hce_listener_t *) g_hash_table_lookup(routing_table_aid, (gconstpointer) package);
 }
 
-static net_nfc_error_e _routing_table_add(const char *package, const char *id,
-       net_nfc_server_hce_listener_cb listener,
-       net_nfc_server_hce_user_data_destroy_cb destroy_cb, void *user_data)
+static net_nfc_error_e _routing_table_add(const char *package, const char *id, net_nfc_server_hce_listener_cb listener, net_nfc_server_hce_user_data_destroy_cb destroy_cb, void *user_data)
 {
        net_nfc_error_e result;
 
@@ -143,15 +128,13 @@ static net_nfc_error_e _routing_table_add(const char *package, const char *id,
                data = g_new0(hce_listener_t, 1);
 
                data->package = g_strdup(package);
-               if (id != NULL) {
+               if (id != NULL)
                        data->id = g_strdup(id);
-               }
                data->listener = listener;
                data->destroy_cb = destroy_cb;
                data->user_data = user_data;
 
-               g_hash_table_insert(routing_table_aid,
-                       (gpointer)g_strdup(package), (gpointer)data);
+               g_hash_table_insert(routing_table_aid, (gpointer) g_strdup(package), (gpointer) data);
 
                result = NET_NFC_OK;
        } else {
@@ -171,9 +154,8 @@ static void _routing_table_del(const char *package)
        if (data != NULL) {
                SECURE_MSG("remove hce package, [%s]", package);
 
-               if (data->destroy_cb != NULL) {
+               if (data->destroy_cb != NULL)
                        data->destroy_cb(data->user_data);
-               }
 
                g_hash_table_remove(routing_table_aid, package);
        }
@@ -188,16 +170,15 @@ static void _routing_table_iterate(route_table_iter_cb cb, void *user_data)
        if (routing_table_aid == NULL)
                return;
 
-       g_hash_table_iter_init (&iter, routing_table_aid);
+       g_hash_table_iter_init(&iter, routing_table_aid);
 
-       while (g_hash_table_iter_next (&iter, &key, (gpointer)&data)) {
-               if (cb(data, user_data) == false) {
+       while (g_hash_table_iter_next(&iter, &key, (gpointer) & data)) {
+               if (cb(data, user_data) == false)
                        break;
-               }
        }
 }
 
-static bool _del_by_id_cb(hce_listener_t *data, void *user_data)
+static bool _del_by_id_cb(hce_listener_t * data, void *user_data)
 {
        const char *id = user_data;
        bool result;
@@ -231,30 +212,24 @@ static void _routing_table_del_by_id(const char *id)
 }
 
 ////////////////////////////////////////////////////////////////////////////////
-net_nfc_error_e net_nfc_server_hce_start_hce_handler(const char *package,
-       const char *id, net_nfc_server_hce_listener_cb listener,
-       net_nfc_server_hce_user_data_destroy_cb destroy_cb, void *user_data)
+net_nfc_error_e net_nfc_server_hce_start_hce_handler(const char *package, const char *id, net_nfc_server_hce_listener_cb listener, net_nfc_server_hce_user_data_destroy_cb destroy_cb, void *user_data)
 {
        net_nfc_error_e result;
 
-       if (package == NULL || listener == NULL) {
+       if (package == NULL || listener == NULL)
                return NET_NFC_NULL_PARAMETER;
-       }
 
-       result = _routing_table_add(package, id, listener,
-               destroy_cb, user_data);
-       if (result == NET_NFC_OK) {
+       result = _routing_table_add(package, id, listener, destroy_cb, user_data);
+       if (result == NET_NFC_OK)
                result = net_nfc_server_route_table_update_handler_id(package, id);
-       }
 
        return result;
 }
 
 net_nfc_error_e net_nfc_server_hce_stop_hce_handler(const char *package)
 {
-       if (package == NULL || strlen(package) == 0) {
+       if (package == NULL || strlen(package) == 0)
                return NET_NFC_NULL_PARAMETER;
-       }
 
        _routing_table_del(package);
 
@@ -265,9 +240,8 @@ net_nfc_error_e net_nfc_server_hce_stop_hce_handler(const char *package)
 
 net_nfc_error_e net_nfc_server_hce_stop_hce_handler_by_id(const char *id)
 {
-       if (id == NULL || strlen(id) == 0) {
+       if (id == NULL || strlen(id) == 0)
                return NET_NFC_NULL_PARAMETER;
-       }
 
        _routing_table_del_by_id(id);
 
@@ -276,71 +250,50 @@ net_nfc_error_e net_nfc_server_hce_stop_hce_handler_by_id(const char *id)
        return NET_NFC_OK;
 }
 
-net_nfc_error_e net_nfc_server_hce_send_apdu_response(
-       net_nfc_target_handle_s *handle, data_s *response)
+net_nfc_error_e net_nfc_server_hce_send_apdu_response(net_nfc_target_handle_s * handle, data_s * response)
 {
        net_nfc_error_e result = NET_NFC_OK;
 
-       if (response == NULL || response->buffer == NULL ||
-               response->length == 0) {
+       if (response == NULL || response->buffer == NULL || response->length == 0)
                return NET_NFC_NULL_PARAMETER;
-       }
 
-       if (net_nfc_controller_hce_response_apdu(
-               handle, response, &result) == true) {
-       } else {
+       if (net_nfc_controller_hce_response_apdu(handle, response, &result) == true)
+               DEBUG_ERR_MSG("net_nfc_controller_hce_response_apdu success, [%d]", result);
+       else
                DEBUG_ERR_MSG("net_nfc_controller_hce_response_apdu failed, [%d]", result);
-       }
 
        return result;
 }
 
 ////////////////////////////////////////////////////////////////////////////////
 #if 0
-static void _emit_event_received_signal(GDBusConnection *connection,
-       const char *id, int event,
-       net_nfc_target_handle_h handle,
-       data_s *data)
+static void _emit_event_received_signal(GDBusConnection * connection, const char *id, int event, net_nfc_target_handle_h handle, data_s * data)
 {
        GVariant *arg_data;
        GError *error = NULL;
 
        arg_data = net_nfc_util_gdbus_data_to_variant(data);
 
-       if (g_dbus_connection_emit_signal(
-               connection,
-               id,
-               "/org/tizen/NetNfcService/Hce",
-               "org.tizen.NetNfcService.Hce",
-               "EventReceived",
-               g_variant_new("(uu@a(y))",
-                       GPOINTER_TO_UINT(handle),
-                       event,
-                       arg_data),
-               &error) == false) {
-               if (error != NULL && error->message != NULL) {
+       if (g_dbus_connection_emit_signal(connection, id, "/org/tizen/NetNfcService/Hce", "org.tizen.NetNfcService.Hce", "EventReceived", g_variant_new("(uu@a(y))", GPOINTER_TO_UINT(handle), event, arg_data), &error) == false) {
+               if (error != NULL && error->message != NULL)
                        DEBUG_ERR_MSG("g_dbus_connection_emit_signal failed : %s", error->message);
-               } else {
+               else
                        DEBUG_ERR_MSG("g_dbus_connection_emit_signal failed");
-               }
        }
 }
 
-static void _hce_default_listener_cb(net_nfc_target_handle_s *handle,
-       int event, data_s *data, void *user_data)
+static void _hce_default_listener_cb(net_nfc_target_handle_s * handle, int event, data_s * data, void *user_data)
 {
-       hce_client_context_s *context = (hce_client_context_s *)user_data;
+       hce_client_context_s *context = (hce_client_context_s *) user_data;
 
-       if (context == NULL) {
+       if (context == NULL)
                return;
-       }
 
        switch (event) {
-       case NET_NFC_MESSAGE_ROUTING_HOST_EMU_DATA :
+       case NET_NFC_MESSAGE_ROUTING_HOST_EMU_DATA:
                if (context->id != NULL) {
                        /* app is running */
-                       _emit_event_received_signal(context->connection,
-                               context->id, (int)NET_NFC_HCE_EVENT_APDU_RECEIVED, handle, data);
+                       _emit_event_received_signal(context->connection, context->id, (int)NET_NFC_HCE_EVENT_APDU_RECEIVED, handle, data);
 
                } else {
                        /* launch app */
@@ -348,45 +301,40 @@ static void _hce_default_listener_cb(net_nfc_target_handle_s *handle,
                }
                break;
 
-       case NET_NFC_MESSAGE_ROUTING_HOST_EMU_ACTIVATED :
+       case NET_NFC_MESSAGE_ROUTING_HOST_EMU_ACTIVATED:
                DEBUG_SERVER_MSG("HCE ACTIVATE");
 
                if (context->id != NULL) {
                        /* app is running */
-                       _emit_event_received_signal(context->connection,
-                               context->id, (int)NET_NFC_HCE_EVENT_ACTIVATED, handle, data);
+                       _emit_event_received_signal(context->connection, context->id, (int)NET_NFC_HCE_EVENT_ACTIVATED, handle, data);
                }
                break;
-       case NET_NFC_MESSAGE_ROUTING_HOST_EMU_DEACTIVATED :
+       case NET_NFC_MESSAGE_ROUTING_HOST_EMU_DEACTIVATED:
                DEBUG_SERVER_MSG("HCE DEACTIVATE");
 
                if (context->id != NULL) {
                        /* app is running */
-                       _emit_event_received_signal(context->connection,
-                               context->id, (int)NET_NFC_HCE_EVENT_DEACTIVATED, handle, data);
+                       _emit_event_received_signal(context->connection, context->id, (int)NET_NFC_HCE_EVENT_DEACTIVATED, handle, data);
                }
                break;
 
-       default :
+       default:
                break;
        }
 }
 #else
-static void _hce_default_listener_cb(net_nfc_target_handle_s *handle,
-       int event, data_s *data, void *user_data)
+static void _hce_default_listener_cb(net_nfc_target_handle_s * handle, int event, data_s * data, void *user_data)
 {
-       hce_client_context_s *context = (hce_client_context_s *)user_data;
+       hce_client_context_s *context = (hce_client_context_s *) user_data;
 
-       if (context == NULL) {
+       if (context == NULL)
                return;
-       }
 
        switch (event) {
-       case NET_NFC_MESSAGE_ROUTING_HOST_EMU_DATA :
+       case NET_NFC_MESSAGE_ROUTING_HOST_EMU_DATA:
                if (context->id != NULL) {
                        /* app is running */
-                       net_nfc_server_hce_send_to_client(context->id,
-                               NET_NFC_HCE_EVENT_APDU_RECEIVED, handle, data);
+                       net_nfc_server_hce_send_to_client(context->id, NET_NFC_HCE_EVENT_APDU_RECEIVED, handle, data);
 
                } else {
                        /* launch app */
@@ -394,7 +342,7 @@ static void _hce_default_listener_cb(net_nfc_target_handle_s *handle,
                }
                break;
 
-       case NET_NFC_MESSAGE_ROUTING_HOST_EMU_ACTIVATED :
+       case NET_NFC_MESSAGE_ROUTING_HOST_EMU_ACTIVATED:
                DEBUG_SERVER_MSG("HCE ACTIVATE");
 
                if (context->id != NULL) {
@@ -402,7 +350,7 @@ static void _hce_default_listener_cb(net_nfc_target_handle_s *handle,
                        net_nfc_server_hce_send_to_all_client(NET_NFC_HCE_EVENT_ACTIVATED, handle, data);
                }
                break;
-       case NET_NFC_MESSAGE_ROUTING_HOST_EMU_DEACTIVATED :
+       case NET_NFC_MESSAGE_ROUTING_HOST_EMU_DEACTIVATED:
                DEBUG_SERVER_MSG("HCE DEACTIVATE");
 
                if (context->id != NULL) {
@@ -411,7 +359,7 @@ static void _hce_default_listener_cb(net_nfc_target_handle_s *handle,
                }
                break;
 
-       default :
+       default:
                break;
        }
 }
@@ -423,9 +371,8 @@ static void _hce_user_data_destroy_cb(void *user_data)
 
        if (context != NULL) {
                g_object_unref(context->connection);
-               if (context->id != NULL) {
+               if (context->id != NULL)
                        g_free(context->id);
-               }
 
                g_free(context);
        }
@@ -433,7 +380,7 @@ static void _hce_user_data_destroy_cb(void *user_data)
 
 static void hce_start_hce_handler_thread_func(gpointer user_data)
 {
-       HceDataApdu *data = (HceDataApdu *)user_data;
+       HceDataApdu *data = (HceDataApdu *) user_data;
        net_nfc_error_e result;
        const char *id;
        char package[1024];
@@ -459,17 +406,14 @@ static void hce_start_hce_handler_thread_func(gpointer user_data)
                context->connection = g_object_ref(connection);
                context->id = g_strdup(id);
 
-               result = net_nfc_server_hce_start_hce_handler(package, id,
-                       _hce_default_listener_cb, _hce_user_data_destroy_cb,
-                       context);
+               result = net_nfc_server_hce_start_hce_handler(package, id, _hce_default_listener_cb, _hce_user_data_destroy_cb, context);
        } else {
                DEBUG_ERR_MSG("net_nfc_util_get_pkgid_by_pid failed, pid [%d]", pid);
 
                result = NET_NFC_OPERATION_FAIL;
        }
 
-       net_nfc_gdbus_hce_complete_start_hce_handler(data->object,
-               data->invocation, result);
+       net_nfc_gdbus_hce_complete_start_hce_handler(data->object, data->invocation, result);
 
        g_object_unref(data->invocation);
        g_object_unref(data->object);
@@ -477,17 +421,12 @@ static void hce_start_hce_handler_thread_func(gpointer user_data)
        g_free(data);
 }
 
-
-static gboolean hce_handle_start_hce_handler(
-       NetNfcGDbusHce *object,
-       GDBusMethodInvocation *invocation,
-       GVariant *smack_privilege)
+static gboolean hce_handle_start_hce_handler(NetNfcGDbusHce * object, GDBusMethodInvocation * invocation, GVariant * smack_privilege)
 {
        HceDataApdu *data = NULL;
        gint result;
 
-       INFO_MSG(">>> REQUEST from [%s]",
-               g_dbus_method_invocation_get_sender(invocation));
+       INFO_MSG(">>> REQUEST from [%s]", g_dbus_method_invocation_get_sender(invocation));
 
        if (net_nfc_server_gdbus_check_privilege(invocation, NET_NFC_PRIVILEGE_NFC_CARD_EMUL) == false) {
                DEBUG_ERR_MSG("permission denied, and finished request");
@@ -497,8 +436,7 @@ static gboolean hce_handle_start_hce_handler(
        }
 
        data = g_try_new0(HceDataApdu, 1);
-       if (data == NULL)
-       {
+       if (data == NULL) {
                DEBUG_ERR_MSG("Memory allocation failed");
                result = NET_NFC_ALLOC_FAIL;
 
@@ -508,9 +446,7 @@ static gboolean hce_handle_start_hce_handler(
        data->object = g_object_ref(object);
        data->invocation = g_object_ref(invocation);
 
-       if (net_nfc_server_controller_async_queue_push_force(
-               hce_start_hce_handler_thread_func, data) == FALSE)
-       {
+       if (net_nfc_server_controller_async_queue_push_force(hce_start_hce_handler_thread_func, data) == FALSE) {
                /* return error if queue was blocked */
                DEBUG_SERVER_MSG("controller is processing important message..");
                result = NET_NFC_BUSY;
@@ -520,7 +456,7 @@ static gboolean hce_handle_start_hce_handler(
 
        return TRUE;
 
-ERROR :
+ ERROR:
        if (data != NULL) {
                g_object_unref(data->invocation);
                g_object_unref(data->object);
@@ -528,15 +464,14 @@ ERROR :
                g_free(data);
        }
 
-       net_nfc_gdbus_hce_complete_start_hce_handler(object, invocation,
-               result);
+       net_nfc_gdbus_hce_complete_start_hce_handler(object, invocation, result);
 
        return TRUE;
 }
 
 static void hce_stop_hce_handler_thread_func(gpointer user_data)
 {
-       HceDataApdu *data = (HceDataApdu *)user_data;
+       HceDataApdu *data = (HceDataApdu *) user_data;
        net_nfc_error_e result;
        const char *id;
        char package[1024];
@@ -560,8 +495,7 @@ static void hce_stop_hce_handler_thread_func(gpointer user_data)
                result = NET_NFC_OPERATION_FAIL;
        }
 
-       net_nfc_gdbus_hce_complete_stop_hce_handler(data->object,
-               data->invocation, result);
+       net_nfc_gdbus_hce_complete_stop_hce_handler(data->object, data->invocation, result);
 
        g_object_unref(data->invocation);
        g_object_unref(data->object);
@@ -569,17 +503,12 @@ static void hce_stop_hce_handler_thread_func(gpointer user_data)
        g_free(data);
 }
 
-
-static gboolean hce_handle_stop_hce_handler(
-       NetNfcGDbusHce *object,
-       GDBusMethodInvocation *invocation,
-       GVariant *smack_privilege)
+static gboolean hce_handle_stop_hce_handler(NetNfcGDbusHce * object, GDBusMethodInvocation * invocation, GVariant * smack_privilege)
 {
        HceDataApdu *data = NULL;
        gint result;
 
-       INFO_MSG(">>> REQUEST from [%s]",
-               g_dbus_method_invocation_get_sender(invocation));
+       INFO_MSG(">>> REQUEST from [%s]", g_dbus_method_invocation_get_sender(invocation));
 
        if (net_nfc_server_gdbus_check_privilege(invocation, NET_NFC_PRIVILEGE_NFC_CARD_EMUL) == false) {
                DEBUG_ERR_MSG("permission denied, and finished request");
@@ -589,8 +518,7 @@ static gboolean hce_handle_stop_hce_handler(
        }
 
        data = g_try_new0(HceDataApdu, 1);
-       if (data == NULL)
-       {
+       if (data == NULL) {
                DEBUG_ERR_MSG("Memory allocation failed");
                result = NET_NFC_ALLOC_FAIL;
 
@@ -600,9 +528,7 @@ static gboolean hce_handle_stop_hce_handler(
        data->object = g_object_ref(object);
        data->invocation = g_object_ref(invocation);
 
-       if (net_nfc_server_controller_async_queue_push_force(
-               hce_stop_hce_handler_thread_func, data) == FALSE)
-       {
+       if (net_nfc_server_controller_async_queue_push_force(hce_stop_hce_handler_thread_func, data) == FALSE) {
                /* return error if queue was blocked */
                DEBUG_SERVER_MSG("controller is processing important message..");
                result = NET_NFC_BUSY;
@@ -612,7 +538,7 @@ static gboolean hce_handle_stop_hce_handler(
 
        return TRUE;
 
-ERROR :
+ ERROR:
        if (data != NULL) {
                g_object_unref(data->invocation);
                g_object_unref(data->object);
@@ -620,16 +546,14 @@ ERROR :
                g_free(data);
        }
 
-       net_nfc_gdbus_hce_complete_stop_hce_handler(object, invocation,
-               result);
+       net_nfc_gdbus_hce_complete_stop_hce_handler(object, invocation, result);
 
        return TRUE;
 }
 
-
 static void hce_response_apdu_thread_func(gpointer user_data)
 {
-       HceDataApdu *detail = (HceDataApdu *)user_data;
+       HceDataApdu *detail = (HceDataApdu *) user_data;
        data_s apdu_data = { NULL, 0 };
        net_nfc_error_e result = NET_NFC_OK;
 
@@ -641,13 +565,9 @@ static void hce_response_apdu_thread_func(gpointer user_data)
 
        net_nfc_util_gdbus_variant_to_data_s(detail->data, &apdu_data);
 
-       result = net_nfc_server_hce_send_apdu_response(detail->handle,
-               &apdu_data);
+       result = net_nfc_server_hce_send_apdu_response(detail->handle, &apdu_data);
 
-       net_nfc_gdbus_hce_complete_response_apdu(
-               detail->object,
-               detail->invocation,
-               result);
+       net_nfc_gdbus_hce_complete_response_apdu(detail->object, detail->invocation, result);
 
        net_nfc_util_clear_data(&apdu_data);
 
@@ -659,19 +579,12 @@ static void hce_response_apdu_thread_func(gpointer user_data)
        g_free(detail);
 }
 
-
-static gboolean hce_handle_response_apdu(
-       NetNfcGDbusHce *object,
-       GDBusMethodInvocation *invocation,
-       guint arg_handle,
-       GVariant *apdudata,
-       GVariant *smack_privilege)
+static gboolean hce_handle_response_apdu(NetNfcGDbusHce * object, GDBusMethodInvocation * invocation, guint arg_handle, GVariant * apdudata, GVariant * smack_privilege)
 {
        HceDataApdu *data = NULL;
        gint result;
 
-       INFO_MSG(">>> REQUEST from [%s]",
-               g_dbus_method_invocation_get_sender(invocation));
+       INFO_MSG(">>> REQUEST from [%s]", g_dbus_method_invocation_get_sender(invocation));
 
        if (net_nfc_server_gdbus_check_privilege(invocation, NET_NFC_PRIVILEGE_NFC_CARD_EMUL) == false) {
                DEBUG_ERR_MSG("permission denied, and finished request");
@@ -681,8 +594,7 @@ static gboolean hce_handle_response_apdu(
        }
 
        data = g_try_new0(HceDataApdu, 1);
-       if (data == NULL)
-       {
+       if (data == NULL) {
                DEBUG_ERR_MSG("Memory allocation failed");
                result = NET_NFC_ALLOC_FAIL;
 
@@ -691,12 +603,10 @@ static gboolean hce_handle_response_apdu(
 
        data->object = g_object_ref(object);
        data->invocation = g_object_ref(invocation);
-       data->handle = (net_nfc_target_handle_s *)arg_handle;
+       data->handle = (net_nfc_target_handle_s *) arg_handle;
        data->data = g_variant_ref(apdudata);
 
-       if (net_nfc_server_controller_async_queue_push_force(
-               hce_response_apdu_thread_func, data) == FALSE)
-       {
+       if (net_nfc_server_controller_async_queue_push_force(hce_response_apdu_thread_func, data) == FALSE) {
                /* return error if queue was blocked */
                DEBUG_SERVER_MSG("controller is processing important message..");
                result = NET_NFC_BUSY;
@@ -706,7 +616,7 @@ static gboolean hce_handle_response_apdu(
 
        return TRUE;
 
-ERROR :
+ ERROR:
        if (data != NULL) {
                g_variant_unref(data->data);
 
@@ -716,16 +626,14 @@ ERROR :
                g_free(data);
        }
 
-       net_nfc_gdbus_hce_complete_response_apdu(object, invocation,
-               result);
+       net_nfc_gdbus_hce_complete_response_apdu(object, invocation, result);
 
        return TRUE;
 }
 
-
 static void __hce_handle_send_apdu_response_thread_func(gpointer user_data)
 {
-       HceDataApdu *detail = (HceDataApdu *)user_data;
+       HceDataApdu *detail = (HceDataApdu *) user_data;
        data_s *response;
 
        g_assert(detail != NULL);
@@ -733,19 +641,16 @@ static void __hce_handle_send_apdu_response_thread_func(gpointer user_data)
 
        DEBUG_SERVER_MSG(">>> __hce_handle_send_apdu_response_thread_func!!");
 
-       response = (data_s *)detail->data;
+       response = (data_s *) detail->data;
 
-       net_nfc_server_hce_send_apdu_response(detail->handle,
-               response);
+       net_nfc_server_hce_send_apdu_response(detail->handle, response);
 
        net_nfc_util_free_data(response);
 
        g_free(detail);
 }
 
-
-void net_nfc_server_hce_handle_send_apdu_response(
-       net_nfc_target_handle_s *handle, data_s *response)
+void net_nfc_server_hce_handle_send_apdu_response(net_nfc_target_handle_s * handle, data_s * response)
 {
        HceDataApdu *data;
 
@@ -756,11 +661,10 @@ void net_nfc_server_hce_handle_send_apdu_response(
                goto ERROR;
        }
 
-       data->handle = (net_nfc_target_handle_s *)handle;
-       data->data = (GVariant *)net_nfc_util_duplicate_data(response); /* caution : invalid type casting */
+       data->handle = (net_nfc_target_handle_s *) handle;
+       data->data = (GVariant *) net_nfc_util_duplicate_data(response);        /* caution : invalid type casting */
 
-       if (net_nfc_server_controller_async_queue_push_force(
-               __hce_handle_send_apdu_response_thread_func, data) == FALSE) {
+       if (net_nfc_server_controller_async_queue_push_force(__hce_handle_send_apdu_response_thread_func, data) == FALSE) {
                /* return error if queue was blocked */
                DEBUG_SERVER_MSG("controller is processing important message..");
 
@@ -769,9 +673,9 @@ void net_nfc_server_hce_handle_send_apdu_response(
 
        return;
 
-ERROR :
+ ERROR:
        if (data != NULL) {
-               net_nfc_util_free_data((data_s *)data->data); /* caution : invalid type casting */
+               net_nfc_util_free_data((data_s *) data->data);  /* caution : invalid type casting */
 
                g_free(data);
        }
@@ -779,18 +683,15 @@ ERROR :
 
 /******************************************************************************/
 
-typedef struct _apdu_header_t
-{
+typedef struct _apdu_header_t {
        uint8_t cla;
        uint8_t ins;
        uint8_t p1;
        uint8_t p2;
        uint8_t data[0];
-}
-__attribute__((packed)) apdu_header_t;
+} __attribute__ ((packed)) apdu_header_t;
 
-static bool __extract_parameter(apdu_header_t *apdu, size_t len, uint16_t *lc,
-       uint16_t *le, uint8_t **data)
+static bool __extract_parameter(apdu_header_t * apdu, size_t len, uint16_t * lc, uint16_t * le, uint8_t ** data)
 {
        size_t l = sizeof(*apdu);
        bool result;
@@ -813,9 +714,8 @@ static bool __extract_parameter(apdu_header_t *apdu, size_t len, uint16_t *lc,
                                *lc = apdu->data[0];
                                *data = apdu->data + 1;
 
-                               if (l + 1 == len) {
+                               if (l + 1 == len)
                                        *le = apdu->data[*lc + 1];
-                               }
 
                                result = true;
                        } else {
@@ -839,28 +739,26 @@ static bool __extract_parameter(apdu_header_t *apdu, size_t len, uint16_t *lc,
        return result;
 }
 
-static bool _route_table_iter_cb(hce_listener_t *data, void *user_data)
+static bool _route_table_iter_cb(hce_listener_t * data, void *user_data)
 {
-       ServerHceData *detail = (ServerHceData *)user_data;
+       ServerHceData *detail = (ServerHceData *) user_data;
 
-       if (data != NULL && data->listener != NULL) {
-               data->listener(detail->handle, detail->event, NULL,
-                       data->user_data);
-       }
+       if (data != NULL && data->listener != NULL)
+               data->listener(detail->handle, detail->event, NULL, data->user_data);
 
        return true;
 }
 
-static bool __pre_process_apdu(net_nfc_target_handle_s *handle, data_s *cmd)
+static bool __pre_process_apdu(net_nfc_target_handle_s * handle, data_s * cmd)
 {
-       apdu_header_t *apdu = (apdu_header_t *)cmd->buffer;
+       apdu_header_t *apdu = (apdu_header_t *) cmd->buffer;
        uint16_t lc, le;
        uint8_t *data;
        bool result;
 
        if (__extract_parameter(apdu, cmd->length, &lc, &le, &data) == true) {
                switch (apdu->ins) {
-               case 0x70 :
+               case 0x70:
                        DEBUG_ERR_MSG("not supported, [%d]", cmd->length);
 
                        /* send response */
@@ -869,10 +767,10 @@ static bool __pre_process_apdu(net_nfc_target_handle_s *handle, data_s *cmd)
 
                        net_nfc_server_hce_send_apdu_response(handle, &resp);
 
-                       result = true; /* completed... skip passing to clients */
+                       result = true;          /* completed... skip passing to clients */
                        break;
 
-               case NET_NFC_HCE_INS_SELECT :
+               case NET_NFC_HCE_INS_SELECT:
                        if (apdu->p1 == NET_NFC_HCE_P1_SELECT_BY_NAME) {
                                if (lc > 2) {
                                        char aid[1024];
@@ -894,7 +792,7 @@ static bool __pre_process_apdu(net_nfc_target_handle_s *handle, data_s *cmd)
 
                                                net_nfc_server_hce_send_apdu_response(handle, &resp);
 
-                                               result = true; /* completed... skip passing to clients */
+                                               result = true;  /* completed... skip passing to clients */
                                                break;
                                        }
                                } else {
@@ -906,13 +804,13 @@ static bool __pre_process_apdu(net_nfc_target_handle_s *handle, data_s *cmd)
 
                                        net_nfc_server_hce_send_apdu_response(handle, &resp);
 
-                                       result = true; /* completed... skip passing to clients */
+                                       result = true;  /* completed... skip passing to clients */
                                        break;
                                }
                        }
                        /* no break */
-               default :
-                       result = false; /* need to pass to client */
+               default:
+                       result = false;         /* need to pass to client */
                        break;
                }
        } else {
@@ -924,7 +822,7 @@ static bool __pre_process_apdu(net_nfc_target_handle_s *handle, data_s *cmd)
 
                net_nfc_server_hce_send_apdu_response(handle, &resp);
 
-               result = true; /* completed... skip passing to clients */
+               result = true;                  /* completed... skip passing to clients */
        }
 
        return result;
@@ -932,7 +830,7 @@ static bool __pre_process_apdu(net_nfc_target_handle_s *handle, data_s *cmd)
 
 static void hce_apdu_thread_func(gpointer user_data)
 {
-       ServerHceData *data = (ServerHceData *)user_data;
+       ServerHceData *data = (ServerHceData *) user_data;
 
        g_assert(data != NULL);
 
@@ -942,8 +840,7 @@ static void hce_apdu_thread_func(gpointer user_data)
        if (data->event == NET_NFC_MESSAGE_ROUTING_HOST_EMU_DATA) {
                DEBUG_SERVER_MSG("[HCE] Command arrived, handle [0x%x], len [%d]", (int)data->handle, data->apdu.length);
 
-               if (__pre_process_apdu(data->handle,
-                       &data->apdu) == false) {
+               if (__pre_process_apdu(data->handle, &data->apdu) == false) {
                        /* finished */
                        if (selected_aid != NULL) {
                                route_table_handler_t *handler;
@@ -955,7 +852,7 @@ static void hce_apdu_thread_func(gpointer user_data)
                                        listener = _routing_table_find_aid(handler->package);
 
                                        if (!listener) {
-                                               apdu_header_t *apdu = (apdu_header_t *)data->apdu.buffer;
+                                               apdu_header_t *apdu = (apdu_header_t *) data->apdu.buffer;
                                                uint16_t lc, le;
                                                uint8_t *aid_data;
 
@@ -984,9 +881,7 @@ static void hce_apdu_thread_func(gpointer user_data)
                                                        }
                                                }
                                        } else {
-                                               listener->listener(data->handle,
-                                                       data->event, &data->apdu,
-                                                       listener->user_data);
+                                               listener->listener(data->handle, data->event, &data->apdu, listener->user_data);
                                        }
                                } else {
                                        uint8_t temp[] = { 0x69, 0x00 };
@@ -1023,12 +918,11 @@ static void hce_apdu_thread_func(gpointer user_data)
 
 void net_nfc_server_hce_apdu_received(void *hce_event)
 {
-       net_nfc_request_hce_apdu_t *hce_apdu =
-               (net_nfc_request_hce_apdu_t *)hce_event;
+       net_nfc_request_hce_apdu_t *hce_apdu = (net_nfc_request_hce_apdu_t *) hce_event;
        net_nfc_target_handle_s *handle;
        ServerHceData *data;
 
-       handle = (net_nfc_target_handle_s *)hce_apdu->user_param;
+       handle = (net_nfc_target_handle_s *) hce_apdu->user_param;
 
        data = g_try_new0(ServerHceData, 1);
        if (data != NULL) {
@@ -1036,28 +930,20 @@ void net_nfc_server_hce_apdu_received(void *hce_event)
                data->event = hce_apdu->request_type;
                data->handle = handle;
 
-               if (data->event == NET_NFC_MESSAGE_ROUTING_HOST_EMU_DATA &&
-                       hce_apdu->apdu.buffer != NULL &&
-                       hce_apdu->apdu.length > 0)
-               {
-                       /* APDU from CLF*/
-                       if (net_nfc_util_init_data(&data->apdu,
-                               hce_apdu->apdu.length) == true) {
-                               memcpy(data->apdu.buffer, hce_apdu->apdu.buffer,
-                                       hce_apdu->apdu.length);
-                       }
+               if (data->event == NET_NFC_MESSAGE_ROUTING_HOST_EMU_DATA && hce_apdu->apdu.buffer != NULL && hce_apdu->apdu.length > 0) {
+                       /* APDU from CLF */
+                       if (net_nfc_util_init_data(&data->apdu, hce_apdu->apdu.length) == true)
+                               memcpy(data->apdu.buffer, hce_apdu->apdu.buffer, hce_apdu->apdu.length);
                }
 
-               if (net_nfc_server_controller_async_queue_push_force(
-                       hce_apdu_thread_func, data) == FALSE) {
+               if (net_nfc_server_controller_async_queue_push_force(hce_apdu_thread_func, data) == FALSE) {
                        DEBUG_ERR_MSG("can not push to controller thread");
 
                        net_nfc_util_clear_data(&data->apdu);
 
                        g_free(data);
 
-                       if (hce_apdu->request_type ==
-                               NET_NFC_MESSAGE_ROUTING_HOST_EMU_DATA) {
+                       if (hce_apdu->request_type == NET_NFC_MESSAGE_ROUTING_HOST_EMU_DATA) {
                                uint8_t temp[] = { 0x69, 0x00 };
                                data_s resp = { temp, sizeof(temp) };
 
@@ -1067,8 +953,7 @@ void net_nfc_server_hce_apdu_received(void *hce_event)
        } else {
                DEBUG_ERR_MSG("g_new0 failed");
 
-               if (hce_apdu->request_type ==
-                       NET_NFC_MESSAGE_ROUTING_HOST_EMU_DATA) {
+               if (hce_apdu->request_type == NET_NFC_MESSAGE_ROUTING_HOST_EMU_DATA) {
                        uint8_t temp[] = { 0x69, 0x00 };
                        data_s resp = { temp, sizeof(temp) };
 
@@ -1081,12 +966,12 @@ void net_nfc_server_hce_apdu_received(void *hce_event)
        _net_nfc_util_free_mem(hce_event);
 }
 
-static void _hce_on_client_detached_cb(net_nfc_client_context_info_t *info)
+static void _hce_on_client_detached_cb(net_nfc_client_context_info_t * info)
 {
        _routing_table_del_by_id(info->id);
 }
 
-gboolean net_nfc_server_hce_init(GDBusConnection *connection)
+gboolean net_nfc_server_hce_init(GDBusConnection * connection)
 {
        GError *error = NULL;
        gboolean result;
@@ -1096,35 +981,21 @@ gboolean net_nfc_server_hce_init(GDBusConnection *connection)
 
        hce_skeleton = net_nfc_gdbus_hce_skeleton_new();
 
-       g_signal_connect(hce_skeleton,
-               "handle-start-hce-handler",
-               G_CALLBACK(hce_handle_start_hce_handler),
-               NULL);
-
-       g_signal_connect(hce_skeleton,
-               "handle-stop-hce-handler",
-               G_CALLBACK(hce_handle_stop_hce_handler),
-               NULL);
-
-       g_signal_connect(hce_skeleton,
-               "handle-response-apdu",
-               G_CALLBACK(hce_handle_response_apdu),
-               NULL);
-
-       result = g_dbus_interface_skeleton_export(
-               G_DBUS_INTERFACE_SKELETON(hce_skeleton),
-               connection,
-               "/org/tizen/NetNfcService/Hce",
-               &error);
+       g_signal_connect(hce_skeleton, "handle-start-hce-handler", G_CALLBACK(hce_handle_start_hce_handler), NULL);
+
+       g_signal_connect(hce_skeleton, "handle-stop-hce-handler", G_CALLBACK(hce_handle_stop_hce_handler), NULL);
+
+       g_signal_connect(hce_skeleton, "handle-response-apdu", G_CALLBACK(hce_handle_response_apdu), NULL);
+
+       result = g_dbus_interface_skeleton_export(G_DBUS_INTERFACE_SKELETON(hce_skeleton), connection, "/org/tizen/NetNfcService/Hce", &error);
        if (result == TRUE) {
-               /*TODO : Make the Routing Table for AID!*/
-               /*TODO : Do i have to make other file for routing table?????*/
+               /*TODO : Make the Routing Table for AID! */
+               /*TODO : Do i have to make other file for routing table????? */
                _routing_table_init();
 
                net_nfc_server_hce_ipc_init();
 
-               net_nfc_server_gdbus_register_on_client_detached_cb(
-                       _hce_on_client_detached_cb);
+               net_nfc_server_gdbus_register_on_client_detached_cb(_hce_on_client_detached_cb);
        } else {
                DEBUG_ERR_MSG("can not skeleton_export %s", error->message);
 
@@ -1138,12 +1009,10 @@ gboolean net_nfc_server_hce_init(GDBusConnection *connection)
 
 void net_nfc_server_hce_deinit(void)
 {
-       if (hce_skeleton)
-       {
+       if (hce_skeleton) {
                net_nfc_server_hce_ipc_deinit();
 
-               net_nfc_server_gdbus_unregister_on_client_detached_cb(
-                       _hce_on_client_detached_cb);
+               net_nfc_server_gdbus_unregister_on_client_detached_cb(_hce_on_client_detached_cb);
 
                g_object_unref(hce_skeleton);
                hce_skeleton = NULL;
index 3d2b05b..f05c931 100755 (executable)
@@ -14,7 +14,6 @@
   * limitations under the License.
   */
 
-
 #include <stdio.h>
 #include <stdlib.h>
 #include <sys/socket.h>
 #include "net_nfc_server_hce_ipc.h"
 
 /* define */
-typedef struct _net_nfc_hce_client_t
-{
+typedef struct _net_nfc_hce_client_t {
        int socket;
        GIOChannel *channel;
        guint source_id;
        pid_t pid;
 
        char *id;
-}
-net_nfc_hce_client_t;
+} net_nfc_hce_client_t;
 
 #define NET_NFC_MANAGER_OBJECT "nfc-manager"
 #define NET_NFC_CARD_EMUL_LABEL        "nfc-manager::card_emul"
@@ -77,9 +74,8 @@ static void __set_non_block_socket(int socket)
        flags = fcntl(socket, F_GETFL);
        flags |= O_NONBLOCK;
 
-       if (fcntl(socket, F_SETFL, flags) < 0) {
+       if (fcntl(socket, F_SETFL, flags) < 0)
                DEBUG_ERR_MSG("fcntl, executing nonblock error");
-       }
 }
 
 static pid_t __get_pid_by_socket(int socket)
@@ -88,31 +84,27 @@ static pid_t __get_pid_by_socket(int socket)
        socklen_t uc_len = sizeof(uc);
        pid_t pid;
 
-       if (getsockopt(socket, SOL_SOCKET, SO_PEERCRED, &uc, &uc_len) == 0) {
+       if (getsockopt(socket, SOL_SOCKET, SO_PEERCRED, &uc, &uc_len) == 0)
                pid = uc.pid;
-       } else {
+       else
                pid = -1;
-       }
 
        return pid;
 }
 
 static void __on_client_value_destroy(gpointer data)
 {
-       net_nfc_hce_client_t *client = (net_nfc_hce_client_t *)data;
+       net_nfc_hce_client_t *client = (net_nfc_hce_client_t *) data;
 
        if (data != NULL) {
-               if (client->id != NULL) {
+               if (client->id != NULL)
                        g_free(client->id);
-               }
 
-               if (client->source_id > 0) {
+               if (client->source_id > 0)
                        g_source_remove(client->source_id);
-               }
 
-               if (client->channel != NULL) {
+               if (client->channel != NULL)
                        g_io_channel_unref(client->channel);
-               }
 
                if (client->socket != -1) {
                        shutdown(client->socket, SHUT_RDWR);
@@ -127,14 +119,11 @@ static void __on_client_value_destroy(gpointer data)
 
 static void __hce_client_init()
 {
-       if (hce_clients == NULL) {
-               hce_clients = g_hash_table_new_full(g_direct_hash,
-                       g_direct_equal, NULL, __on_client_value_destroy);
-       }
+       if (hce_clients == NULL)
+               hce_clients = g_hash_table_new_full(g_direct_hash, g_direct_equal, NULL, __on_client_value_destroy);
 }
 
-static void __hce_client_add(int socket, GIOChannel *channel,
-       guint source_id)
+static void __hce_client_add(int socket, GIOChannel * channel, guint source_id)
 {
        net_nfc_hce_client_t *client;
 
@@ -145,13 +134,11 @@ static void __hce_client_add(int socket, GIOChannel *channel,
                if (client->pid != -1) {
                        net_nfc_client_context_info_t *context;
 
-                       context = net_nfc_server_gdbus_get_client_context_by_pid(
-                               client->pid);
-                       if (context != NULL) {
+                       context = net_nfc_server_gdbus_get_client_context_by_pid(client->pid);
+                       if (context != NULL)
                                client->id = g_strdup(context->id);
-                       } else {
+                       else
                                DEBUG_ERR_MSG("net_nfc_server_gdbus_get_client_context_by_pid failed");
-                       }
                } else {
                        DEBUG_ERR_MSG("__get_pid_by_socket failed");
                }
@@ -160,7 +147,7 @@ static void __hce_client_add(int socket, GIOChannel *channel,
                client->channel = channel;
                client->source_id = source_id;
 
-               g_hash_table_insert(hce_clients, (gpointer)channel, client);
+               g_hash_table_insert(hce_clients, (gpointer) channel, client);
 
                DEBUG_SERVER_MSG("client added, [%d]", g_hash_table_size(hce_clients));
        } else {
@@ -168,9 +155,9 @@ static void __hce_client_add(int socket, GIOChannel *channel,
        }
 }
 
-static void __hce_client_del(GIOChannel *channel)
+static void __hce_client_del(GIOChannel * channel)
 {
-       g_hash_table_remove(hce_clients, (gconstpointer)channel);
+       g_hash_table_remove(hce_clients, (gconstpointer) channel);
 }
 
 static void __hce_client_clear()
@@ -178,10 +165,9 @@ static void __hce_client_clear()
        g_hash_table_unref(hce_clients);
 }
 
-static net_nfc_hce_client_t *__hce_client_find(GIOChannel *channel)
+static net_nfc_hce_client_t *__hce_client_find(GIOChannel * channel)
 {
-       return (net_nfc_hce_client_t *)g_hash_table_lookup(hce_clients,
-               (gconstpointer)channel);
+       return (net_nfc_hce_client_t *) g_hash_table_lookup(hce_clients, (gconstpointer) channel);
 }
 
 static net_nfc_hce_client_t *__hce_client_find_by_id(const char *id)
@@ -193,8 +179,7 @@ static net_nfc_hce_client_t *__hce_client_find_by_id(const char *id)
 
        g_hash_table_iter_init(&iter, hce_clients);
 
-       while (g_hash_table_iter_next(&iter, (gpointer *)&key,
-               (gpointer *)&value) == true) {
+       while (g_hash_table_iter_next(&iter, (gpointer *) & key, (gpointer *) & value) == true) {
                if (value->id != NULL && g_strcmp0(value->id, id) == 0) {
                        result = value;
                        break;
@@ -206,7 +191,7 @@ static net_nfc_hce_client_t *__hce_client_find_by_id(const char *id)
 
 /******************************************************************************/
 
-static bool __receive_data_from_client(int socket, data_s *data)
+static bool __receive_data_from_client(int socket, data_s * data)
 {
        bool result;
        ssize_t ret;
@@ -233,9 +218,8 @@ static bool __receive_data_from_client(int socket, data_s *data)
                /* second, receive buffer */
                do {
                        ret = recv(socket, data->buffer + offset, data->length - offset, 0);
-                       if (ret == -1) {
+                       if (ret == -1)
                                break;
-                       }
 
                        offset += ret;
                } while (offset < len);
@@ -256,7 +240,7 @@ static bool __receive_data_from_client(int socket, data_s *data)
        return result;
 }
 
-static bool __process_client_message(GIOChannel *channel)
+static bool __process_client_message(GIOChannel * channel)
 {
        bool result;
        data_s data;
@@ -268,13 +252,12 @@ static bool __process_client_message(GIOChannel *channel)
                        net_nfc_hce_data_t *header;
                        data_s temp;
 
-                       header = (net_nfc_hce_data_t *)data.buffer;
+                       header = (net_nfc_hce_data_t *) data.buffer;
 
                        temp.buffer = header->data;
                        temp.length = data.length - sizeof(net_nfc_hce_data_t);
 
-                       net_nfc_server_hce_handle_send_apdu_response(
-                               (net_nfc_target_handle_s *)header->handle, &temp);
+                       net_nfc_server_hce_handle_send_apdu_response((net_nfc_target_handle_s *) header->handle, &temp);
 
                        result = true;
                } else {
@@ -291,8 +274,7 @@ static bool __process_client_message(GIOChannel *channel)
        return result;
 }
 
-static gboolean __on_client_io_event_cb(GIOChannel *channel,
-       GIOCondition condition, gpointer data)
+static gboolean __on_client_io_event_cb(GIOChannel * channel, GIOCondition condition, gpointer data)
 {
        if ((G_IO_ERR & condition) || (G_IO_HUP & condition)) {
                DEBUG_SERVER_MSG("client socket is closed");
@@ -323,7 +305,7 @@ static bool __do_client_connect_request()
        int socket = -1;
        GIOChannel *channel = NULL;
        guint source_id = 0;
-       GIOCondition condition = (GIOCondition)(G_IO_ERR | G_IO_HUP | G_IO_IN);
+       GIOCondition condition = (GIOCondition) (G_IO_ERR | G_IO_HUP | G_IO_IN);
 
        socket = accept(hce_server_socket, NULL, &addrlen);
        if (socket < 0) {
@@ -339,8 +321,7 @@ static bool __do_client_connect_request()
                goto ERROR;
        }
 
-       source_id = g_io_add_watch(channel, condition,
-               __on_client_io_event_cb, NULL);
+       source_id = g_io_add_watch(channel, condition, __on_client_io_event_cb, NULL);
        if (source_id == 0) {
                DEBUG_ERR_MSG("add io callback is failed");
 
@@ -353,10 +334,9 @@ static bool __do_client_connect_request()
 
        return true;
 
-ERROR :
-       if (channel != NULL) {
+ ERROR:
+       if (channel != NULL)
                g_io_channel_unref(channel);
-       }
 
        if (socket != -1) {
                shutdown(socket, SHUT_RDWR);
@@ -366,8 +346,7 @@ ERROR :
        return false;
 }
 
-static gboolean __on_io_event_cb(GIOChannel *channel, GIOCondition condition,
-       gpointer data)
+static gboolean __on_io_event_cb(GIOChannel * channel, GIOCondition condition, gpointer data)
 {
        if ((G_IO_ERR & condition) || (G_IO_HUP & condition)) {
                DEBUG_SERVER_MSG("server socket is closed");
@@ -394,7 +373,7 @@ bool net_nfc_server_hce_ipc_init()
        __hce_client_init();
 
        hce_server_socket = -1;
-       hce_server_channel = (GIOChannel *)NULL;
+       hce_server_channel = (GIOChannel *) NULL;
        hce_server_src_id = 0;
 
        ///////////////////////////////
@@ -416,7 +395,7 @@ bool net_nfc_server_hce_ipc_init()
                goto ERROR;
        }
 
-       GIOCondition condition = (GIOCondition)(G_IO_ERR | G_IO_HUP | G_IO_IN);
+       GIOCondition condition = (GIOCondition) (G_IO_ERR | G_IO_HUP | G_IO_IN);
 
        hce_server_channel = g_io_channel_unix_new(hce_server_socket);
        if (hce_server_channel == NULL) {
@@ -425,8 +404,7 @@ bool net_nfc_server_hce_ipc_init()
                goto ERROR;
        }
 
-       hce_server_src_id = g_io_add_watch(hce_server_channel,
-               condition, __on_io_event_cb, NULL);
+       hce_server_src_id = g_io_add_watch(hce_server_channel, condition, __on_io_event_cb, NULL);
        if (hce_server_src_id < 1) {
                DEBUG_ERR_MSG("g_io_add_watch is failed");
 
@@ -437,7 +415,7 @@ bool net_nfc_server_hce_ipc_init()
 
        return true;
 
-ERROR :
+ ERROR:
        if (hce_server_src_id > 0) {
                g_source_remove(hce_server_src_id);
                hce_server_src_id = 0;
@@ -479,7 +457,7 @@ void net_nfc_server_hce_ipc_deinit()
        }
 }
 
-static bool __send_data_to_client(int socket, data_s *data)
+static bool __send_data_to_client(int socket, data_s * data)
 {
        ssize_t ret;
 
@@ -493,8 +471,7 @@ static bool __send_data_to_client(int socket, data_s *data)
        return true;
 }
 
-bool net_nfc_server_hce_send_to_client(const char *id, int type,
-       net_nfc_target_handle_s *handle, data_s *data)
+bool net_nfc_server_hce_send_to_client(const char *id, int type, net_nfc_target_handle_s * handle, data_s * data)
 {
        bool ret;
        net_nfc_hce_client_t *client;
@@ -508,23 +485,21 @@ bool net_nfc_server_hce_send_to_client(const char *id, int type,
                return false;
        }
 
-       if (data != NULL && data->length > 0) {
+       if (data != NULL && data->length > 0)
                len += data->length;
-       }
 
-       ret = net_nfc_util_init_data(&temp, len + sizeof(len)); /* length + data */
+       ret = net_nfc_util_init_data(&temp, len + sizeof(len)); /* length + data */
        if (ret == true) {
                net_nfc_hce_data_t *header;
 
-               *(uint32_t *)(temp.buffer) = len;
-               header = (net_nfc_hce_data_t *)(temp.buffer + sizeof(len));
+               *(uint32_t *) (temp.buffer) = len;
+               header = (net_nfc_hce_data_t *) (temp.buffer + sizeof(len));
 
                header->type = type;
                header->handle = (int)handle;
 
-               if (data != NULL && data->length > 0) {
+               if (data != NULL && data->length > 0)
                        memcpy(header->data, data->buffer, data->length);
-               }
 
                ret = __send_data_to_client(client->socket, &temp);
 
@@ -536,40 +511,35 @@ bool net_nfc_server_hce_send_to_client(const char *id, int type,
        return ret;
 }
 
-bool net_nfc_server_hce_send_to_all_client(int type,
-       net_nfc_target_handle_s *handle, data_s *data)
+bool net_nfc_server_hce_send_to_all_client(int type, net_nfc_target_handle_s * handle, data_s * data)
 {
        bool ret;
        data_s temp;
        uint32_t len = sizeof(net_nfc_hce_data_t);
 
-       if (data != NULL && data->length > 0) {
+       if (data != NULL && data->length > 0)
                len += data->length;
-       }
 
-       ret = net_nfc_util_init_data(&temp, len + sizeof(len)); /* length + data */
+       ret = net_nfc_util_init_data(&temp, len + sizeof(len)); /* length + data */
        if (ret == true) {
                GHashTableIter iter;
                gpointer key;
                net_nfc_hce_client_t *client;
                net_nfc_hce_data_t *header;
 
-               *(uint32_t *)(temp.buffer) = len;
-               header = (net_nfc_hce_data_t *)(temp.buffer + sizeof(len));
+               *(uint32_t *) (temp.buffer) = len;
+               header = (net_nfc_hce_data_t *) (temp.buffer + sizeof(len));
 
                header->type = type;
                header->handle = (int)handle;
 
-               if (data != NULL && data->length > 0) {
+               if (data != NULL && data->length > 0)
                        memcpy(header->data, data->buffer, data->length);
-               }
 
                g_hash_table_iter_init(&iter, hce_clients);
 
-               while (g_hash_table_iter_next(&iter, (gpointer *)&key,
-                       (gpointer *)&client) == true) {
+               while (g_hash_table_iter_next(&iter, (gpointer *) & key, (gpointer *) & client) == true)
                        ret = __send_data_to_client(client->socket, &temp);
-               }
 
                net_nfc_util_clear_data(&temp);
        } else {
index 8b1ce5a..c2bdb86 100755 (executable)
@@ -14,7 +14,7 @@
  * limitations under the License.
  */
 
-#include <dd-display.h>/*for pm lock*/
+#include <dd-display.h>                        /*for pm lock */
 //#include <logd/logd.h>   /* battery_adv */
 
 #include "net_nfc_debug_internal.h"
 
 static NetNfcGDbusLlcp *llcp_skeleton = NULL;
 
-static net_nfc_llcp_config_info_s llcp_config =
-{
+static net_nfc_llcp_config_info_s llcp_config = {
        NET_NFC_LLCP_MIU,
        NET_NFC_LLCP_WKS,
        NET_NFC_LLCP_LTO,
        NET_NFC_LLCP_OPT,
 };
 
-
-typedef struct _llcp_client_data
-{
+typedef struct _llcp_client_data {
        GDBusConnection *connection;
        GDBusMethodInvocation *invocation;
        net_nfc_target_handle_h handle;
        net_nfc_llcp_socket_t socket;
        void *user_data;
-}
-llcp_client_data;
-
+} llcp_client_data;
 
 typedef struct _LlcpData LlcpData;
 
-struct _LlcpData
-{
+struct _LlcpData {
        NetNfcGDbusLlcp *llcp;
        GDBusMethodInvocation *invocation;
 };
 
 typedef struct _LlcpConfigData LlcpConfigData;
 
-struct _LlcpConfigData
-{
+struct _LlcpConfigData {
        NetNfcGDbusLlcp *llcp;
        GDBusMethodInvocation *invocation;
 
@@ -83,8 +76,7 @@ struct _LlcpConfigData
 
 typedef struct _LlcpListenData LlcpListenData;
 
-struct _LlcpListenData
-{
+struct _LlcpListenData {
        NetNfcGDbusLlcp *llcp;
        GDBusMethodInvocation *invocation;
 
@@ -99,8 +91,7 @@ struct _LlcpListenData
 
 typedef struct _LlcpAcceptData LlcpAcceptData;
 
-struct _LlcpAcceptData
-{
+struct _LlcpAcceptData {
        NetNfcGDbusLlcp *llcp;
        GDBusMethodInvocation *invocation;
 
@@ -110,8 +101,7 @@ struct _LlcpAcceptData
 
 typedef struct _LlcpConnectData LlcpConnectData;
 
-struct _LlcpConnectData
-{
+struct _LlcpConnectData {
        NetNfcGDbusLlcp *llcp;
        GDBusMethodInvocation *invocation;
 
@@ -125,8 +115,7 @@ struct _LlcpConnectData
 
 typedef struct _LlcpConnectSapData LlcpConnectSapData;
 
-struct _LlcpConnectSapData
-{
+struct _LlcpConnectSapData {
        NetNfcGDbusLlcp *llcp;
        GDBusMethodInvocation *invocation;
 
@@ -140,8 +129,7 @@ struct _LlcpConnectSapData
 
 typedef struct _LlcpSendData LlcpSendData;
 
-struct _LlcpSendData
-{
+struct _LlcpSendData {
        NetNfcGDbusLlcp *llcp;
        GDBusMethodInvocation *invocation;
 
@@ -153,8 +141,7 @@ struct _LlcpSendData
 
 typedef struct _LlcpSendToData LlcpSendToData;
 
-struct _LlcpSendToData
-{
+struct _LlcpSendToData {
        NetNfcGDbusLlcp *llcp;
        GDBusMethodInvocation *invocation;
 
@@ -167,8 +154,7 @@ struct _LlcpSendToData
 
 typedef struct _LlcpReceiveData LlcpReceiveData;
 
-struct _LlcpReceiveData
-{
+struct _LlcpReceiveData {
        NetNfcGDbusLlcp *llcp;
        GDBusMethodInvocation *invocation;
 
@@ -179,8 +165,7 @@ struct _LlcpReceiveData
 
 typedef struct _LlcpCloseData LlcpCloseData;
 
-struct _LlcpCloseData
-{
+struct _LlcpCloseData {
        NetNfcGDbusLlcp *llcp;
        GDBusMethodInvocation *invocation;
 
@@ -190,8 +175,7 @@ struct _LlcpCloseData
 
 typedef struct _LlcpDisconnectData LlcpDisconnectData;
 
-struct _LlcpDisconnectData
-{
+struct _LlcpDisconnectData {
        NetNfcGDbusLlcp *llcp;
        GDBusMethodInvocation *invocation;
 
@@ -201,8 +185,7 @@ struct _LlcpDisconnectData
 
 typedef struct _LlcpSimpleData LlcpSimpleData;
 
-struct _LlcpSimpleData
-{
+struct _LlcpSimpleData {
        net_nfc_target_handle_s *handle;
        net_nfc_llcp_socket_t socket;
        guint32 miu;
@@ -211,59 +194,23 @@ struct _LlcpSimpleData
        gpointer user_data;
 };
 
-static void llcp_socket_error_cb(net_nfc_llcp_socket_t socket,
-       net_nfc_error_e result,
-       data_s *data,
-       void *extra,
-       void *user_param);
-
-static void llcp_incoming_cb(net_nfc_llcp_socket_t socket,
-                       net_nfc_error_e result,
-                       data_s *data,
-                       void *extra,
-                       void *user_param);
-
-static void llcp_connect_by_url_cb(net_nfc_llcp_socket_t socket,
-       net_nfc_error_e result,
-       data_s *data,
-       void *extra,
-       void *user_param);
-
-static void llcp_connect_cb(net_nfc_llcp_socket_t socket,
-       net_nfc_error_e result,
-       data_s *data,
-       void *extra,
-       void *user_param);
-
-static void llcp_send_cb(net_nfc_llcp_socket_t socket,
-       net_nfc_error_e result,
-       data_s *data,
-       void *extra,
-       void *user_param);
-
-static void llcp_send_to_cb(net_nfc_llcp_socket_t socket,
-       net_nfc_error_e result,
-       data_s *data,
-       void *extra,
-       void *user_param);
-
-static void llcp_receive_cb(net_nfc_llcp_socket_t socket,
-       net_nfc_error_e result,
-       data_s *data,
-       void *extra,
-       void *user_param);
-
-static void llcp_receive_from_cb(net_nfc_llcp_socket_t socket,
-       net_nfc_error_e result,
-       data_s *data,
-       void *extra,
-       void *user_param);
-
-static void llcp_disconnect_cb(net_nfc_llcp_socket_t socket,
-       net_nfc_error_e result,
-       data_s *data,
-       void *extra,
-       void *user_param);
+static void llcp_socket_error_cb(net_nfc_llcp_socket_t socket, net_nfc_error_e result, data_s * data, void *extra, void *user_param);
+
+static void llcp_incoming_cb(net_nfc_llcp_socket_t socket, net_nfc_error_e result, data_s * data, void *extra, void *user_param);
+
+static void llcp_connect_by_url_cb(net_nfc_llcp_socket_t socket, net_nfc_error_e result, data_s * data, void *extra, void *user_param);
+
+static void llcp_connect_cb(net_nfc_llcp_socket_t socket, net_nfc_error_e result, data_s * data, void *extra, void *user_param);
+
+static void llcp_send_cb(net_nfc_llcp_socket_t socket, net_nfc_error_e result, data_s * data, void *extra, void *user_param);
+
+static void llcp_send_to_cb(net_nfc_llcp_socket_t socket, net_nfc_error_e result, data_s * data, void *extra, void *user_param);
+
+static void llcp_receive_cb(net_nfc_llcp_socket_t socket, net_nfc_error_e result, data_s * data, void *extra, void *user_param);
+
+static void llcp_receive_from_cb(net_nfc_llcp_socket_t socket, net_nfc_error_e result, data_s * data, void *extra, void *user_param);
+
+static void llcp_disconnect_cb(net_nfc_llcp_socket_t socket, net_nfc_error_e result, data_s * data, void *extra, void *user_param);
 
 /* client method */
 static void llcp_handle_config_thread_func(gpointer user_data);
@@ -291,198 +238,72 @@ static void llcp_handle_close_thread_func(gpointer user_data);
 static void llcp_handle_disconnect_thread_func(gpointer user_data);
 
 /* methods */
-static gboolean llcp_handle_config(NetNfcGDbusLlcp *llcp,
-                               GDBusMethodInvocation *invocation,
-                               GVariant *arg_config,
-                               GVariant *smack_privilege,
-                               gpointer user_data);
-
-static gboolean llcp_handle_listen(NetNfcGDbusLlcp *llcp,
-                               GDBusMethodInvocation *invocation,
-                               guint32 arg_handle,
-                               guint32 arg_client_socket,
-                               guint16 arg_miu,
-                               guint8 arg_rw,
-                               gint32 arg_type,
-                               guint8 arg_sap,
-                               const gchar *arg_service_name,
-                               GVariant *smack_privilege,
-                               gpointer user_data);
-
-static gboolean llcp_handle_connect(NetNfcGDbusLlcp *llcp,
-                               GDBusMethodInvocation *invocation,
-                               guint32 arg_handle,
-                               guint32 arg_client_socket,
-                               guint16 arg_miu,
-                               guint8 arg_rw,
-                               gint32 arg_type,
-                               const gchar *arg_service_name,
-                               GVariant *smack_privilege,
-                               gpointer user_data);
-
-static gboolean llcp_handle_connect_sap(NetNfcGDbusLlcp *llcp,
-                               GDBusMethodInvocation *invocation,
-                               guint32 arg_handle,
-                               guint32 arg_client_socket,
-                               guint16 arg_miu,
-                               guint8 arg_rw,
-                               gint32 arg_type,
-                               guint8 arg_sap,
-                               GVariant *smack_privilege,
-                               gpointer user_data);
-
-static gboolean llcp_handle_send(NetNfcGDbusLlcp *llcp,
-                               GDBusMethodInvocation *invocation,
-                               guint32 arg_handle,
-                               guint32 arg_client_socket,
-                               GVariant *arg_data,
-                               GVariant *smack_privilege,
-                               gpointer user_data);
-
-static gboolean llcp_handle_send_to(NetNfcGDbusLlcp *llcp,
-                               GDBusMethodInvocation *invocation,
-                               guint32 arg_handle,
-                               guint32 arg_client_socket,
-                               guint8 arg_sap,
-                               GVariant *arg_data,
-                               GVariant *smack_privilege,
-                               gpointer user_data);
-
-static gboolean llcp_handle_receive(NetNfcGDbusLlcp *llcp,
-                               GDBusMethodInvocation *invocation,
-                               guint32 arg_handle,
-                               guint32 arg_client_socket,
-                               guint32 arg_req_length,
-                               GVariant *smack_privilege,
-                               gpointer user_data);
-
-static gboolean llcp_handle_receive_from(NetNfcGDbusLlcp *llcp,
-                               GDBusMethodInvocation *invocation,
-                               guint32 arg_handle,
-                               guint32 arg_client_socket,
-                               guint32 arg_req_length,
-                               GVariant *smack_privilege,
-                               gpointer user_data);
-
-static gboolean llcp_handle_close(NetNfcGDbusLlcp *llcp,
-                               GDBusMethodInvocation *invocation,
-                               guint32 arg_handle,
-                               guint32 arg_client_socket,
-                               GVariant *smack_privilege,
-                               gpointer user_data);
-
-static gboolean llcp_handle_disconnect(NetNfcGDbusLlcp *llcp,
-                               GDBusMethodInvocation *invocation,
-                               guint32 arg_handle,
-                               guint32 arg_client_socket,
-                               GVariant *smack_privilege,
-                               gpointer user_data);
+static gboolean llcp_handle_config(NetNfcGDbusLlcp * llcp, GDBusMethodInvocation * invocation, GVariant * arg_config, GVariant * smack_privilege, gpointer user_data);
+
+static gboolean llcp_handle_listen(NetNfcGDbusLlcp * llcp, GDBusMethodInvocation * invocation, guint32 arg_handle, guint32 arg_client_socket, guint16 arg_miu, guint8 arg_rw, gint32 arg_type, guint8 arg_sap, const gchar * arg_service_name, GVariant * smack_privilege, gpointer user_data);
+
+static gboolean llcp_handle_connect(NetNfcGDbusLlcp * llcp, GDBusMethodInvocation * invocation, guint32 arg_handle, guint32 arg_client_socket, guint16 arg_miu, guint8 arg_rw, gint32 arg_type, const gchar * arg_service_name, GVariant * smack_privilege, gpointer user_data);
+
+static gboolean llcp_handle_connect_sap(NetNfcGDbusLlcp * llcp, GDBusMethodInvocation * invocation, guint32 arg_handle, guint32 arg_client_socket, guint16 arg_miu, guint8 arg_rw, gint32 arg_type, guint8 arg_sap, GVariant * smack_privilege, gpointer user_data);
+
+static gboolean llcp_handle_send(NetNfcGDbusLlcp * llcp, GDBusMethodInvocation * invocation, guint32 arg_handle, guint32 arg_client_socket, GVariant * arg_data, GVariant * smack_privilege, gpointer user_data);
+
+static gboolean llcp_handle_send_to(NetNfcGDbusLlcp * llcp, GDBusMethodInvocation * invocation, guint32 arg_handle, guint32 arg_client_socket, guint8 arg_sap, GVariant * arg_data, GVariant * smack_privilege, gpointer user_data);
+
+static gboolean llcp_handle_receive(NetNfcGDbusLlcp * llcp, GDBusMethodInvocation * invocation, guint32 arg_handle, guint32 arg_client_socket, guint32 arg_req_length, GVariant * smack_privilege, gpointer user_data);
+
+static gboolean llcp_handle_receive_from(NetNfcGDbusLlcp * llcp, GDBusMethodInvocation * invocation, guint32 arg_handle, guint32 arg_client_socket, guint32 arg_req_length, GVariant * smack_privilege, gpointer user_data);
+
+static gboolean llcp_handle_close(NetNfcGDbusLlcp * llcp, GDBusMethodInvocation * invocation, guint32 arg_handle, guint32 arg_client_socket, GVariant * smack_privilege, gpointer user_data);
 
+static gboolean llcp_handle_disconnect(NetNfcGDbusLlcp * llcp, GDBusMethodInvocation * invocation, guint32 arg_handle, guint32 arg_client_socket, GVariant * smack_privilege, gpointer user_data);
 
 /* simple */
-static void llcp_simple_socket_error_cb(net_nfc_llcp_socket_t socket,
-                               net_nfc_error_e result,
-                               data_s *data,
-                               void *extra,
-                               void *user_param);
-
-static void llcp_simple_listen_cb(net_nfc_llcp_socket_t socket,
-                               net_nfc_error_e result,
-                               data_s *data,
-                               void *extra,
-                               void *user_param);
-
-static void llcp_simple_connect_cb(net_nfc_llcp_socket_t socket,
-                               net_nfc_error_e result,
-                               data_s *data,
-                               void *extra,
-                               void *user_param);
-
-static void llcp_simple_send_cb(net_nfc_llcp_socket_t socket,
-                               net_nfc_error_e result,
-                               data_s *data,
-                               void *extra,
-                               void *user_param);
-
-static void llcp_simple_receive_cb(net_nfc_llcp_socket_t socket,
-                               net_nfc_error_e result,
-                               data_s *data,
-                               void *extra,
-                               void *user_param);
-
-
-static void llcp_socket_error_cb(net_nfc_llcp_socket_t socket,
-                               net_nfc_error_e result,
-                               data_s *data,
-                               void *extra,
-                               void *user_param)
-{
-       llcp_client_data *client_data = (llcp_client_data *)user_param;
+static void llcp_simple_socket_error_cb(net_nfc_llcp_socket_t socket, net_nfc_error_e result, data_s * data, void *extra, void *user_param);
+
+static void llcp_simple_listen_cb(net_nfc_llcp_socket_t socket, net_nfc_error_e result, data_s * data, void *extra, void *user_param);
+
+static void llcp_simple_connect_cb(net_nfc_llcp_socket_t socket, net_nfc_error_e result, data_s * data, void *extra, void *user_param);
+
+static void llcp_simple_send_cb(net_nfc_llcp_socket_t socket, net_nfc_error_e result, data_s * data, void *extra, void *user_param);
+
+static void llcp_simple_receive_cb(net_nfc_llcp_socket_t socket, net_nfc_error_e result, data_s * data, void *extra, void *user_param);
+
+static void llcp_socket_error_cb(net_nfc_llcp_socket_t socket, net_nfc_error_e result, data_s * data, void *extra, void *user_param)
+{
+       llcp_client_data *client_data = (llcp_client_data *) user_param;
        GError *error = NULL;
 
-       if (g_dbus_connection_emit_signal(
-               client_data->connection,
-               g_dbus_method_invocation_get_sender(client_data->invocation),
-               "/org/tizen/NetNfcService/Llcp",
-               "org.tizen.NetNfcService.Llcp",
-               "Error",
-               g_variant_new("(uui)",
-                       GPOINTER_TO_UINT(client_data->handle),
-                       socket,
-                       result),
-               &error) == false) {
-               if (error != NULL && error->message != NULL) {
+       if (g_dbus_connection_emit_signal(client_data->connection, g_dbus_method_invocation_get_sender(client_data->invocation), "/org/tizen/NetNfcService/Llcp", "org.tizen.NetNfcService.Llcp", "Error", g_variant_new("(uui)", GPOINTER_TO_UINT(client_data->handle), socket, result), &error) == false) {
+               if (error != NULL && error->message != NULL)
                        DEBUG_ERR_MSG("g_dbus_connection_emit_signal failed : %s", error->message);
-               } else {
+               else
                        DEBUG_ERR_MSG("g_dbus_connection_emit_signal failed");
-               }
        }
 }
 
-static void llcp_incoming_cb(net_nfc_llcp_socket_t socket,
-                       net_nfc_error_e result,
-                       data_s *data,
-                       void *extra,
-                       void *user_param)
+static void llcp_incoming_cb(net_nfc_llcp_socket_t socket, net_nfc_error_e result, data_s * data, void *extra, void *user_param)
 {
-       llcp_client_data *client_data = (llcp_client_data *)user_param;
+       llcp_client_data *client_data = (llcp_client_data *) user_param;
        GError *error = NULL;
 
-       if (g_dbus_connection_emit_signal(
-               client_data->connection,
-               g_dbus_method_invocation_get_sender(client_data->invocation),
-               "/org/tizen/NetNfcService/Llcp",
-               "org.tizen.NetNfcService.Llcp",
-               "Incoming",
-               g_variant_new("(uuu)",
-                       GPOINTER_TO_UINT(client_data->handle),
-                       client_data->socket,
-                       socket),
-               &error) == false) {
-               if (error != NULL && error->message != NULL) {
+       if (g_dbus_connection_emit_signal(client_data->connection, g_dbus_method_invocation_get_sender(client_data->invocation), "/org/tizen/NetNfcService/Llcp", "org.tizen.NetNfcService.Llcp", "Incoming", g_variant_new("(uuu)", GPOINTER_TO_UINT(client_data->handle), client_data->socket, socket), &error) == false) {
+               if (error != NULL && error->message != NULL)
                        DEBUG_ERR_MSG("g_dbus_connection_emit_signal failed : %s", error->message);
-               } else {
+               else
                        DEBUG_ERR_MSG("g_dbus_connection_emit_signal failed");
-               }
        }
 }
 
-static void llcp_connect_by_url_cb(net_nfc_llcp_socket_t socket,
-                               net_nfc_error_e result,
-                               data_s *data,
-                               void *extra,
-                               void *user_param)
+static void llcp_connect_by_url_cb(net_nfc_llcp_socket_t socket, net_nfc_error_e result, data_s * data, void *extra, void *user_param)
 {
-       LlcpConnectData *llcp_data = (LlcpConnectData *)user_param;
+       LlcpConnectData *llcp_data = (LlcpConnectData *) user_param;
 
        g_assert(llcp_data != NULL);
        g_assert(llcp_data->llcp != NULL);
        g_assert(llcp_data->invocation != NULL);
 
-       net_nfc_gdbus_llcp_complete_connect(llcp_data->llcp,
-               llcp_data->invocation,
-               result,
-               socket);
+       net_nfc_gdbus_llcp_complete_connect(llcp_data->llcp, llcp_data->invocation, result, socket);
 
        g_free(llcp_data->service_name);
 
@@ -492,23 +313,15 @@ static void llcp_connect_by_url_cb(net_nfc_llcp_socket_t socket,
        g_free(llcp_data);
 }
 
-static void llcp_connect_cb(net_nfc_llcp_socket_t socket,
-                       net_nfc_error_e result,
-                       data_s *data,
-                       void *extra,
-                       void *user_param)
+static void llcp_connect_cb(net_nfc_llcp_socket_t socket, net_nfc_error_e result, data_s * data, void *extra, void *user_param)
 {
-       LlcpConnectSapData *llcp_data = (LlcpConnectSapData *)user_param;
+       LlcpConnectSapData *llcp_data = (LlcpConnectSapData *) user_param;
 
        g_assert(llcp_data != NULL);
        g_assert(llcp_data->llcp != NULL);
        g_assert(llcp_data->invocation != NULL);
 
-       net_nfc_gdbus_llcp_complete_connect_sap(
-               llcp_data->llcp,
-               llcp_data->invocation,
-               result,
-               socket);
+       net_nfc_gdbus_llcp_complete_connect_sap(llcp_data->llcp, llcp_data->invocation, result, socket);
 
        g_object_unref(llcp_data->invocation);
        g_object_unref(llcp_data->llcp);
@@ -516,23 +329,15 @@ static void llcp_connect_cb(net_nfc_llcp_socket_t socket,
        g_free(llcp_data);
 }
 
-static void llcp_send_cb(net_nfc_llcp_socket_t socket,
-       net_nfc_error_e result,
-       data_s *data,
-       void *extra,
-       void *user_param)
+static void llcp_send_cb(net_nfc_llcp_socket_t socket, net_nfc_error_e result, data_s * data, void *extra, void *user_param)
 {
-       LlcpSendData *llcp_data = (LlcpSendData *)user_param;
+       LlcpSendData *llcp_data = (LlcpSendData *) user_param;
 
        g_assert(llcp_data != NULL);
        g_assert(llcp_data->llcp != NULL);
        g_assert(llcp_data->invocation != NULL);
 
-       net_nfc_gdbus_llcp_complete_send(
-               llcp_data->llcp,
-               llcp_data->invocation,
-               result,
-               socket);
+       net_nfc_gdbus_llcp_complete_send(llcp_data->llcp, llcp_data->invocation, result, socket);
 
        net_nfc_util_clear_data(&llcp_data->data);
 
@@ -542,23 +347,15 @@ static void llcp_send_cb(net_nfc_llcp_socket_t socket,
        g_free(llcp_data);
 }
 
-static void llcp_send_to_cb(net_nfc_llcp_socket_t socket,
-       net_nfc_error_e result,
-       data_s *data,
-       void *extra,
-       void *user_param)
+static void llcp_send_to_cb(net_nfc_llcp_socket_t socket, net_nfc_error_e result, data_s * data, void *extra, void *user_param)
 {
-       LlcpSendToData *llcp_data = (LlcpSendToData *)user_param;
+       LlcpSendToData *llcp_data = (LlcpSendToData *) user_param;
 
        g_assert(llcp_data != NULL);
        g_assert(llcp_data->llcp != NULL);
        g_assert(llcp_data->invocation != NULL);
 
-       net_nfc_gdbus_llcp_complete_send_to(
-               llcp_data->llcp,
-               llcp_data->invocation,
-               result,
-               socket);
+       net_nfc_gdbus_llcp_complete_send_to(llcp_data->llcp, llcp_data->invocation, result, socket);
 
        net_nfc_util_clear_data(&llcp_data->data);
 
@@ -568,13 +365,9 @@ static void llcp_send_to_cb(net_nfc_llcp_socket_t socket,
        g_free(llcp_data);
 }
 
-static void llcp_receive_cb(net_nfc_llcp_socket_t socket,
-                       net_nfc_error_e result,
-                       data_s *data,
-                       void *extra,
-                       void *user_param)
+static void llcp_receive_cb(net_nfc_llcp_socket_t socket, net_nfc_error_e result, data_s * data, void *extra, void *user_param)
 {
-       LlcpReceiveData *llcp_data = (LlcpReceiveData *)user_param;
+       LlcpReceiveData *llcp_data = (LlcpReceiveData *) user_param;
        GVariant *variant;
 
        g_assert(llcp_data != NULL);
@@ -582,11 +375,7 @@ static void llcp_receive_cb(net_nfc_llcp_socket_t socket,
        g_assert(llcp_data->invocation != NULL);
 
        variant = net_nfc_util_gdbus_data_to_variant(data);
-       net_nfc_gdbus_llcp_complete_receive(
-               llcp_data->llcp,
-               llcp_data->invocation,
-               result,
-               variant);
+       net_nfc_gdbus_llcp_complete_receive(llcp_data->llcp, llcp_data->invocation, result, variant);
 
        g_object_unref(llcp_data->invocation);
        g_object_unref(llcp_data->llcp);
@@ -594,13 +383,9 @@ static void llcp_receive_cb(net_nfc_llcp_socket_t socket,
        g_free(llcp_data);
 }
 
-static void llcp_receive_from_cb(net_nfc_llcp_socket_t socket,
-                       net_nfc_error_e result,
-                       data_s *data,
-                       void *extra,
-                       void *user_param)
+static void llcp_receive_from_cb(net_nfc_llcp_socket_t socket, net_nfc_error_e result, data_s * data, void *extra, void *user_param)
 {
-       LlcpReceiveData *llcp_data = (LlcpReceiveData *)user_param;
+       LlcpReceiveData *llcp_data = (LlcpReceiveData *) user_param;
        GVariant *variant;
 
        g_assert(llcp_data != NULL);
@@ -608,12 +393,7 @@ static void llcp_receive_from_cb(net_nfc_llcp_socket_t socket,
        g_assert(llcp_data->invocation != NULL);
 
        variant = net_nfc_util_gdbus_data_to_variant(data);
-       net_nfc_gdbus_llcp_complete_receive_from(
-               llcp_data->llcp,
-               llcp_data->invocation,
-               result,
-               (guint8)(int)extra,
-               variant);
+       net_nfc_gdbus_llcp_complete_receive_from(llcp_data->llcp, llcp_data->invocation, result, (guint8) (int)extra, variant);
 
        g_object_unref(llcp_data->invocation);
        g_object_unref(llcp_data->llcp);
@@ -621,24 +401,15 @@ static void llcp_receive_from_cb(net_nfc_llcp_socket_t socket,
        g_free(llcp_data);
 }
 
-
-static void llcp_disconnect_cb(net_nfc_llcp_socket_t socket,
-                       net_nfc_error_e result,
-                       data_s *data,
-                       void *extra,
-                       void *user_param)
+static void llcp_disconnect_cb(net_nfc_llcp_socket_t socket, net_nfc_error_e result, data_s * data, void *extra, void *user_param)
 {
-       LlcpDisconnectData *llcp_data = (LlcpDisconnectData *)user_param;
+       LlcpDisconnectData *llcp_data = (LlcpDisconnectData *) user_param;
 
        g_assert(llcp_data != NULL);
        g_assert(llcp_data->llcp != NULL);
        g_assert(llcp_data->invocation != NULL);
 
-       net_nfc_gdbus_llcp_complete_disconnect(
-               llcp_data->llcp,
-               llcp_data->invocation,
-               result,
-               socket);
+       net_nfc_gdbus_llcp_complete_disconnect(llcp_data->llcp, llcp_data->invocation, result, socket);
 
        g_object_unref(llcp_data->invocation);
        g_object_unref(llcp_data->llcp);
@@ -646,10 +417,9 @@ static void llcp_disconnect_cb(net_nfc_llcp_socket_t socket,
        g_free(llcp_data);
 }
 
-
 static void llcp_handle_config_thread_func(gpointer user_data)
 {
-       LlcpConfigData *data = (LlcpConfigData *)user_data;
+       LlcpConfigData *data = (LlcpConfigData *) user_data;
        net_nfc_error_e result;
        net_nfc_llcp_config_info_s config;
 
@@ -664,9 +434,7 @@ static void llcp_handle_config_thread_func(gpointer user_data)
 
        result = net_nfc_server_llcp_set_config(&config);
 
-       net_nfc_gdbus_llcp_complete_config(data->llcp,
-                                       data->invocation,
-                                       result);
+       net_nfc_gdbus_llcp_complete_config(data->llcp, data->invocation, result);
 
        g_object_unref(data->invocation);
        g_object_unref(data->llcp);
@@ -676,7 +444,7 @@ static void llcp_handle_config_thread_func(gpointer user_data)
 
 static void llcp_handle_listen_thread_func(gpointer user_data)
 {
-       LlcpListenData *data = (LlcpListenData *)user_data;
+       LlcpListenData *data = (LlcpListenData *) user_data;
        llcp_client_data *client_data;
 
        net_nfc_llcp_socket_t socket = -1;
@@ -693,19 +461,11 @@ static void llcp_handle_listen_thread_func(gpointer user_data)
                goto ERROR;
        }
 
-       client_data->connection = g_dbus_method_invocation_get_connection(
-               data->invocation);
+       client_data->connection = g_dbus_method_invocation_get_connection(data->invocation);
        client_data->invocation = data->invocation;
-       client_data->handle = (net_nfc_target_handle_h)data->handle;
-
-       if (net_nfc_controller_llcp_create_socket(&socket,
-               data->type,
-               data->miu,
-               data->rw,
-               &result,
-               llcp_socket_error_cb,
-               client_data) == false)
-       {
+       client_data->handle = (net_nfc_target_handle_h) data->handle;
+
+       if (net_nfc_controller_llcp_create_socket(&socket, data->type, data->miu, data->rw, &result, llcp_socket_error_cb, client_data) == false) {
                DEBUG_ERR_MSG("net_nfc_controller_llcp_create_socket failed [%d]", result);
 
                goto ERROR;
@@ -713,30 +473,19 @@ static void llcp_handle_listen_thread_func(gpointer user_data)
 
        client_data->socket = socket;
 
-       if (net_nfc_controller_llcp_bind(socket,
-               data->sap,
-               &result) == false)
-       {
+       if (net_nfc_controller_llcp_bind(socket, data->sap, &result) == false) {
                DEBUG_ERR_MSG("net_nfc_controller_llcp_bind failed [%d]", result);
 
                goto ERROR;
        }
 
-       if (net_nfc_controller_llcp_listen(GUINT_TO_POINTER(data->handle),
-               (uint8_t *)data->service_name,
-               socket,
-               &result,
-               llcp_incoming_cb,
-               client_data) == false)
-       {
+       if (net_nfc_controller_llcp_listen(GUINT_TO_POINTER(data->handle), (uint8_t *) data->service_name, socket, &result, llcp_incoming_cb, client_data) == false) {
                DEBUG_ERR_MSG("net_nfc_controller_llcp_listen failed [%d]", result);
 
                goto ERROR;
        }
 
-       net_nfc_gdbus_llcp_complete_listen(data->llcp, data->invocation,
-               result,
-               GPOINTER_TO_UINT(socket));
+       net_nfc_gdbus_llcp_complete_listen(data->llcp, data->invocation, result, GPOINTER_TO_UINT(socket));
 
        g_object_unref(data->invocation);
        g_object_unref(data->llcp);
@@ -745,10 +494,8 @@ static void llcp_handle_listen_thread_func(gpointer user_data)
 
        return;
 
-ERROR :
-       net_nfc_gdbus_llcp_complete_listen(data->llcp, data->invocation,
-               result,
-               -1);
+ ERROR:
+       net_nfc_gdbus_llcp_complete_listen(data->llcp, data->invocation, result, -1);
 
        if (socket != -1)
                net_nfc_controller_llcp_socket_close(socket, &result);
@@ -765,7 +512,7 @@ ERROR :
 
 static void llcp_handle_accept_thread_func(gpointer user_data)
 {
-       LlcpAcceptData *data = (LlcpAcceptData *)user_data;
+       LlcpAcceptData *data = (LlcpAcceptData *) user_data;
        llcp_client_data *client_data;
        net_nfc_error_e result;
 
@@ -780,22 +527,18 @@ static void llcp_handle_accept_thread_func(gpointer user_data)
                goto ERROR;
        }
 
-       client_data->connection = g_dbus_method_invocation_get_connection(
-               data->invocation);
+       client_data->connection = g_dbus_method_invocation_get_connection(data->invocation);
        client_data->invocation = data->invocation;
-       client_data->handle = (net_nfc_target_handle_h)data->handle;
+       client_data->handle = (net_nfc_target_handle_h) data->handle;
        client_data->socket = data->client_socket;
 
-       if (net_nfc_controller_llcp_accept(data->client_socket, &result,
-               llcp_socket_error_cb,
-               client_data) == false) {
+       if (net_nfc_controller_llcp_accept(data->client_socket, &result, llcp_socket_error_cb, client_data) == false) {
                DEBUG_ERR_MSG("net_nfc_controller_llcp_accept failed [%d]", result);
 
                goto ERROR;
        }
 
-       net_nfc_gdbus_llcp_complete_accept(data->llcp, data->invocation,
-               result);
+       net_nfc_gdbus_llcp_complete_accept(data->llcp, data->invocation, result);
 
        g_object_unref(data->invocation);
        g_object_unref(data->llcp);
@@ -804,9 +547,8 @@ static void llcp_handle_accept_thread_func(gpointer user_data)
 
        return;
 
-ERROR :
-       net_nfc_gdbus_llcp_complete_accept(data->llcp, data->invocation,
-               result);
+ ERROR:
+       net_nfc_gdbus_llcp_complete_accept(data->llcp, data->invocation, result);
 
        g_free(client_data);
 
@@ -818,21 +560,17 @@ ERROR :
 
 static void llcp_handle_reject_thread_func(gpointer user_data)
 {
-       LlcpAcceptData *data = (LlcpAcceptData *)user_data;
+       LlcpAcceptData *data = (LlcpAcceptData *) user_data;
        net_nfc_error_e result;
 
        g_assert(data != NULL);
        g_assert(data->llcp != NULL);
        g_assert(data->invocation != NULL);
 
-       if (net_nfc_controller_llcp_reject(GUINT_TO_POINTER(data->handle),
-               data->client_socket,
-               &result) == false) {
+       if (net_nfc_controller_llcp_reject(GUINT_TO_POINTER(data->handle), data->client_socket, &result) == false)
                DEBUG_ERR_MSG("net_nfc_controller_llcp_reject failed [%d]", result);
-       }
 
-       net_nfc_gdbus_llcp_complete_reject(data->llcp, data->invocation,
-               result);
+       net_nfc_gdbus_llcp_complete_reject(data->llcp, data->invocation, result);
 
        g_object_unref(data->invocation);
        g_object_unref(data->llcp);
@@ -840,10 +578,9 @@ static void llcp_handle_reject_thread_func(gpointer user_data)
        g_free(data);
 }
 
-
 static void llcp_handle_connect_thread_func(gpointer user_data)
 {
-       LlcpConnectData *data = (LlcpConnectData *)user_data;
+       LlcpConnectData *data = (LlcpConnectData *) user_data;
        llcp_client_data *client_data;
        net_nfc_llcp_socket_t socket = -1;
        net_nfc_error_e result;
@@ -859,19 +596,11 @@ static void llcp_handle_connect_thread_func(gpointer user_data)
                goto ERROR;
        }
 
-       client_data->connection = g_dbus_method_invocation_get_connection(
-               data->invocation);
+       client_data->connection = g_dbus_method_invocation_get_connection(data->invocation);
        client_data->invocation = data->invocation;
-       client_data->handle = (net_nfc_target_handle_h)data->handle;
-
-       if (net_nfc_controller_llcp_create_socket(&socket,
-               data->type,
-               data->miu,
-               data->rw,
-               &result,
-               llcp_socket_error_cb,
-               client_data) == false)
-       {
+       client_data->handle = (net_nfc_target_handle_h) data->handle;
+
+       if (net_nfc_controller_llcp_create_socket(&socket, data->type, data->miu, data->rw, &result, llcp_socket_error_cb, client_data) == false) {
                DEBUG_ERR_MSG("net_nfc_controller_llcp_create_socket failed [%d]", result);
 
                goto ERROR;
@@ -879,14 +608,7 @@ static void llcp_handle_connect_thread_func(gpointer user_data)
 
        client_data->socket = socket;
 
-       if (net_nfc_controller_llcp_connect_by_url(
-               GUINT_TO_POINTER(data->handle),
-               socket,
-               (uint8_t *)data->service_name,
-               &result,
-               llcp_connect_by_url_cb,
-               data) == false)
-       {
+       if (net_nfc_controller_llcp_connect_by_url(GUINT_TO_POINTER(data->handle), socket, (uint8_t *) data->service_name, &result, llcp_connect_by_url_cb, data) == false) {
                DEBUG_ERR_MSG("net_nfc_controller_llcp_listen failed [%d]", result);
 
                goto ERROR;
@@ -899,10 +621,8 @@ static void llcp_handle_connect_thread_func(gpointer user_data)
 
        return;
 
-ERROR :
-       net_nfc_gdbus_llcp_complete_connect(data->llcp, data->invocation,
-               result,
-               -1);
+ ERROR:
+       net_nfc_gdbus_llcp_complete_connect(data->llcp, data->invocation, result, -1);
 
        if (socket != -1)
                net_nfc_controller_llcp_socket_close(socket, &result);
@@ -919,7 +639,7 @@ ERROR :
 
 static void llcp_handle_connect_sap_thread_func(gpointer user_data)
 {
-       LlcpConnectSapData *data = (LlcpConnectSapData *)user_data;
+       LlcpConnectSapData *data = (LlcpConnectSapData *) user_data;
        llcp_client_data *client_data;
 
        net_nfc_llcp_socket_t socket = -1;
@@ -936,19 +656,11 @@ static void llcp_handle_connect_sap_thread_func(gpointer user_data)
                goto ERROR;
        }
 
-       client_data->connection = g_dbus_method_invocation_get_connection(
-               data->invocation);
+       client_data->connection = g_dbus_method_invocation_get_connection(data->invocation);
        client_data->invocation = data->invocation;
-       client_data->handle = (net_nfc_target_handle_h)data->handle;
-
-       if (net_nfc_controller_llcp_create_socket(&socket,
-               data->type,
-               data->miu,
-               data->rw,
-               &result,
-               llcp_socket_error_cb,
-               client_data) == false)
-       {
+       client_data->handle = (net_nfc_target_handle_h) data->handle;
+
+       if (net_nfc_controller_llcp_create_socket(&socket, data->type, data->miu, data->rw, &result, llcp_socket_error_cb, client_data) == false) {
                DEBUG_ERR_MSG("net_nfc_controller_llcp_create_socket failed [%d]", result);
 
                goto ERROR;
@@ -956,13 +668,7 @@ static void llcp_handle_connect_sap_thread_func(gpointer user_data)
 
        client_data->socket = socket;
 
-       if (net_nfc_controller_llcp_connect(GUINT_TO_POINTER(data->handle),
-               socket,
-               data->sap,
-               &result,
-               llcp_connect_cb,
-               data) == false)
-       {
+       if (net_nfc_controller_llcp_connect(GUINT_TO_POINTER(data->handle), socket, data->sap, &result, llcp_connect_cb, data) == false) {
                DEBUG_ERR_MSG("net_nfc_controller_llcp_listen failed [%d]", result);
 
                goto ERROR;
@@ -975,10 +681,8 @@ static void llcp_handle_connect_sap_thread_func(gpointer user_data)
 
        return;
 
-ERROR :
-       net_nfc_gdbus_llcp_complete_connect_sap(data->llcp, data->invocation,
-               result,
-               -1);
+ ERROR:
+       net_nfc_gdbus_llcp_complete_connect_sap(data->llcp, data->invocation, result, -1);
 
        if (socket != -1)
                net_nfc_controller_llcp_socket_close(socket, &result);
@@ -993,26 +697,17 @@ ERROR :
 
 static void llcp_handle_send_thread_func(gpointer user_data)
 {
-       LlcpSendData *data = (LlcpSendData *)user_data;
+       LlcpSendData *data = (LlcpSendData *) user_data;
        net_nfc_error_e result;
 
        g_assert(data != NULL);
        g_assert(data->llcp != NULL);
        g_assert(data->invocation != NULL);
 
-       if (net_nfc_controller_llcp_send(GUINT_TO_POINTER(data->handle),
-               data->client_socket,
-               &data->data,
-               &result,
-               llcp_send_cb,
-               data) == false)
-       {
+       if (net_nfc_controller_llcp_send(GUINT_TO_POINTER(data->handle), data->client_socket, &data->data, &result, llcp_send_cb, data) == false) {
                DEBUG_ERR_MSG("net_nfc_controller_llcp_send failed [%d]", result);
 
-               net_nfc_gdbus_llcp_complete_send(data->llcp,
-                       data->invocation,
-                       result,
-                       data->client_socket);
+               net_nfc_gdbus_llcp_complete_send(data->llcp, data->invocation, result, data->client_socket);
 
                net_nfc_util_clear_data(&data->data);
 
@@ -1025,27 +720,17 @@ static void llcp_handle_send_thread_func(gpointer user_data)
 
 static void llcp_handle_send_to_thread_func(gpointer user_data)
 {
-       LlcpSendToData *data = (LlcpSendToData *)user_data;
+       LlcpSendToData *data = (LlcpSendToData *) user_data;
        net_nfc_error_e result;
 
        g_assert(data != NULL);
        g_assert(data->llcp != NULL);
        g_assert(data->invocation != NULL);
 
-       if (net_nfc_controller_llcp_send_to(GUINT_TO_POINTER(data->handle),
-               data->client_socket,
-               &data->data,
-               data->sap,
-               &result,
-               llcp_send_to_cb,
-               data) == false)
-       {
+       if (net_nfc_controller_llcp_send_to(GUINT_TO_POINTER(data->handle), data->client_socket, &data->data, data->sap, &result, llcp_send_to_cb, data) == false) {
                DEBUG_ERR_MSG("net_nfc_controller_llcp_send_to failed [%d]", result);
 
-               net_nfc_gdbus_llcp_complete_send_to(data->llcp,
-                       data->invocation,
-                       result,
-                       data->client_socket);
+               net_nfc_gdbus_llcp_complete_send_to(data->llcp, data->invocation, result, data->client_socket);
 
                net_nfc_util_clear_data(&data->data);
 
@@ -1058,26 +743,17 @@ static void llcp_handle_send_to_thread_func(gpointer user_data)
 
 static void llcp_handle_receive_thread_func(gpointer user_data)
 {
-       LlcpReceiveData *data = (LlcpReceiveData *)user_data;
+       LlcpReceiveData *data = (LlcpReceiveData *) user_data;
        net_nfc_error_e result;
 
        g_assert(data != NULL);
        g_assert(data->llcp != NULL);
        g_assert(data->invocation != NULL);
 
-       if (net_nfc_controller_llcp_recv(GUINT_TO_POINTER(data->handle),
-               data->client_socket,
-               data->req_length,
-               &result,
-               llcp_receive_cb,
-               data) == false)
-       {
+       if (net_nfc_controller_llcp_recv(GUINT_TO_POINTER(data->handle), data->client_socket, data->req_length, &result, llcp_receive_cb, data) == false) {
                DEBUG_ERR_MSG("net_nfc_controller_llcp_recv failed [%d]", result);
 
-               net_nfc_gdbus_llcp_complete_receive(data->llcp,
-                       data->invocation,
-                       result,
-                       net_nfc_util_gdbus_buffer_to_variant(NULL, 0));
+               net_nfc_gdbus_llcp_complete_receive(data->llcp, data->invocation, result, net_nfc_util_gdbus_buffer_to_variant(NULL, 0));
 
                g_object_unref(data->invocation);
                g_object_unref(data->llcp);
@@ -1088,27 +764,17 @@ static void llcp_handle_receive_thread_func(gpointer user_data)
 
 static void llcp_handle_receive_from_thread_func(gpointer user_data)
 {
-       LlcpReceiveData *data = (LlcpReceiveData *)user_data;
+       LlcpReceiveData *data = (LlcpReceiveData *) user_data;
        net_nfc_error_e result;
 
        g_assert(data != NULL);
        g_assert(data->llcp != NULL);
        g_assert(data->invocation != NULL);
 
-       if (net_nfc_controller_llcp_recv_from(GUINT_TO_POINTER(data->handle),
-               data->client_socket,
-               data->req_length,
-               &result,
-               llcp_receive_from_cb,
-               data) == false)
-       {
+       if (net_nfc_controller_llcp_recv_from(GUINT_TO_POINTER(data->handle), data->client_socket, data->req_length, &result, llcp_receive_from_cb, data) == false) {
                DEBUG_ERR_MSG("net_nfc_controller_llcp_recv_from failed [%d]", result);
 
-               net_nfc_gdbus_llcp_complete_receive_from(data->llcp,
-                       data->invocation,
-                       result,
-                       -1,
-                       net_nfc_util_gdbus_buffer_to_variant(NULL, 0));
+               net_nfc_gdbus_llcp_complete_receive_from(data->llcp, data->invocation, result, -1, net_nfc_util_gdbus_buffer_to_variant(NULL, 0));
 
                g_object_unref(data->invocation);
                g_object_unref(data->llcp);
@@ -1119,7 +785,7 @@ static void llcp_handle_receive_from_thread_func(gpointer user_data)
 
 static void llcp_handle_close_thread_func(gpointer user_data)
 {
-       LlcpCloseData *data = (LlcpCloseData *)user_data;
+       LlcpCloseData *data = (LlcpCloseData *) user_data;
        net_nfc_error_e result;
 
        g_assert(data != NULL);
@@ -1128,10 +794,7 @@ static void llcp_handle_close_thread_func(gpointer user_data)
 
        net_nfc_controller_llcp_socket_close(data->client_socket, &result);
 
-       net_nfc_gdbus_llcp_complete_close(data->llcp,
-               data->invocation,
-               result,
-               data->client_socket);
+       net_nfc_gdbus_llcp_complete_close(data->llcp, data->invocation, result, data->client_socket);
 
        g_object_unref(data->invocation);
        g_object_unref(data->llcp);
@@ -1141,35 +804,25 @@ static void llcp_handle_close_thread_func(gpointer user_data)
 
 static void llcp_handle_disconnect_thread_func(gpointer user_data)
 {
-       LlcpDisconnectData *data = (LlcpDisconnectData *)user_data;
+       LlcpDisconnectData *data = (LlcpDisconnectData *) user_data;
        net_nfc_error_e result;
 
        g_assert(data != NULL);
        g_assert(data->llcp != NULL);
        g_assert(data->invocation != NULL);
 
-       if (GUINT_TO_POINTER(data->handle) == 0)
-       {
+       if (GUINT_TO_POINTER(data->handle) == 0) {
                int ret_val;
 
                net_nfc_server_free_target_info();
                ret_val = display_unlock_state(LCD_NORMAL, PM_RESET_TIMER);
-               DEBUG_SERVER_MSG("net_nfc_controller_disconnect display_unlock_state"
-                                               "[%d]!!", ret_val);
+               DEBUG_SERVER_MSG("net_nfc_controller_disconnect display_unlock_state" "[%d]!!", ret_val);
        }
 
-       if (net_nfc_controller_llcp_disconnect(GUINT_TO_POINTER(data->handle),
-               data->client_socket,
-               &result,
-               llcp_disconnect_cb,
-               data) == false)
-       {
+       if (net_nfc_controller_llcp_disconnect(GUINT_TO_POINTER(data->handle), data->client_socket, &result, llcp_disconnect_cb, data) == false) {
                DEBUG_ERR_MSG("net_nfc_controller_llcp_disconnect failed [%d]", result);
 
-               net_nfc_gdbus_llcp_complete_disconnect(data->llcp,
-                       data->invocation,
-                       result,
-                       data->client_socket);
+               net_nfc_gdbus_llcp_complete_disconnect(data->llcp, data->invocation, result, data->client_socket);
 
                g_object_unref(data->invocation);
                g_object_unref(data->llcp);
@@ -1178,18 +831,12 @@ static void llcp_handle_disconnect_thread_func(gpointer user_data)
        }
 }
 
-
-static gboolean llcp_handle_config(NetNfcGDbusLlcp *llcp,
-                               GDBusMethodInvocation *invocation,
-                               GVariant *arg_config,
-                               GVariant *smack_privilege,
-                               gpointer user_data)
+static gboolean llcp_handle_config(NetNfcGDbusLlcp * llcp, GDBusMethodInvocation * invocation, GVariant * arg_config, GVariant * smack_privilege, gpointer user_data)
 {
        gint result;
        LlcpConfigData *data = NULL;
 
-       INFO_MSG(">>> REQUEST from [%s]",
-               g_dbus_method_invocation_get_sender(invocation));
+       INFO_MSG(">>> REQUEST from [%s]", g_dbus_method_invocation_get_sender(invocation));
 
        /* check privilege and update client context */
        if (net_nfc_server_gdbus_check_privilege(invocation, NET_NFC_PRIVILEGE_NFC_P2P) == false) {
@@ -1210,16 +857,9 @@ static gboolean llcp_handle_config(NetNfcGDbusLlcp *llcp,
        data->llcp = g_object_ref(llcp);
        data->invocation = g_object_ref(invocation);
 
-       g_variant_get(arg_config,
-               "(qqyy)",
-               &data->miu,
-               &data->wks,
-               &data->lto,
-               &data->option);
+       g_variant_get(arg_config, "(qqyy)", &data->miu, &data->wks, &data->lto, &data->option);
 
-       if (net_nfc_server_controller_async_queue_push(
-               llcp_handle_config_thread_func, data) == FALSE)
-       {
+       if (net_nfc_server_controller_async_queue_push(llcp_handle_config_thread_func, data) == FALSE) {
                /* return error if queue was blocked */
                DEBUG_SERVER_MSG("controller is processing important message..");
                result = NET_NFC_BUSY;
@@ -1229,7 +869,7 @@ static gboolean llcp_handle_config(NetNfcGDbusLlcp *llcp,
 
        return TRUE;
 
-ERROR :
+ ERROR:
        if (data != NULL) {
                g_object_unref(data->invocation);
                g_object_unref(data->llcp);
@@ -1237,30 +877,17 @@ ERROR :
                g_free(data);
        }
 
-       net_nfc_gdbus_llcp_complete_config(llcp,
-                                       invocation,
-                                       result);
+       net_nfc_gdbus_llcp_complete_config(llcp, invocation, result);
 
        return TRUE;
 }
 
-static gboolean llcp_handle_listen(NetNfcGDbusLlcp *llcp,
-                               GDBusMethodInvocation *invocation,
-                               guint32 arg_handle,
-                               guint32 arg_client_socket,
-                               guint16 arg_miu,
-                               guint8 arg_rw,
-                               gint32 arg_type,
-                               guint8 arg_sap,
-                               const gchar *arg_service_name,
-                               GVariant *smack_privilege,
-                               gpointer user_data)
+static gboolean llcp_handle_listen(NetNfcGDbusLlcp * llcp, GDBusMethodInvocation * invocation, guint32 arg_handle, guint32 arg_client_socket, guint16 arg_miu, guint8 arg_rw, gint32 arg_type, guint8 arg_sap, const gchar * arg_service_name, GVariant * smack_privilege, gpointer user_data)
 {
        gint result;
        LlcpListenData *data = NULL;
 
-       INFO_MSG(">>> REQUEST from [%s]",
-               g_dbus_method_invocation_get_sender(invocation));
+       INFO_MSG(">>> REQUEST from [%s]", g_dbus_method_invocation_get_sender(invocation));
 
        /* check privilege and update client context */
        if (net_nfc_server_gdbus_check_privilege(invocation, NET_NFC_PRIVILEGE_NFC_P2P) == false) {
@@ -1288,9 +915,7 @@ static gboolean llcp_handle_listen(NetNfcGDbusLlcp *llcp,
        data->sap = arg_sap;
        data->service_name = g_strdup(arg_service_name);
 
-       if (net_nfc_server_controller_async_queue_push(
-               llcp_handle_listen_thread_func, data) == FALSE)
-       {
+       if (net_nfc_server_controller_async_queue_push(llcp_handle_listen_thread_func, data) == FALSE) {
                /* return error if queue was blocked */
                DEBUG_SERVER_MSG("controller is processing important message..");
                result = NET_NFC_BUSY;
@@ -1300,7 +925,7 @@ static gboolean llcp_handle_listen(NetNfcGDbusLlcp *llcp,
 
        return TRUE;
 
-ERROR :
+ ERROR:
        if (data != NULL) {
                g_free(data->service_name);
 
@@ -1315,18 +940,12 @@ ERROR :
        return TRUE;
 }
 
-static gboolean llcp_handle_accept(NetNfcGDbusLlcp *llcp,
-                               GDBusMethodInvocation *invocation,
-                               guint32 arg_handle,
-                               guint32 arg_client_socket,
-                               GVariant *smack_privilege,
-                               gpointer user_data)
+static gboolean llcp_handle_accept(NetNfcGDbusLlcp * llcp, GDBusMethodInvocation * invocation, guint32 arg_handle, guint32 arg_client_socket, GVariant * smack_privilege, gpointer user_data)
 {
        gint result;
        LlcpAcceptData *data = NULL;
 
-       INFO_MSG(">>> REQUEST from [%s]",
-               g_dbus_method_invocation_get_sender(invocation));
+       INFO_MSG(">>> REQUEST from [%s]", g_dbus_method_invocation_get_sender(invocation));
 
        /* check privilege and update client context */
        if (net_nfc_server_gdbus_check_privilege(invocation, NET_NFC_PRIVILEGE_NFC_P2P) == false) {
@@ -1349,9 +968,7 @@ static gboolean llcp_handle_accept(NetNfcGDbusLlcp *llcp,
        data->handle = arg_handle;
        data->client_socket = arg_client_socket;
 
-       if (net_nfc_server_controller_async_queue_push(
-               llcp_handle_accept_thread_func, data) == FALSE)
-       {
+       if (net_nfc_server_controller_async_queue_push(llcp_handle_accept_thread_func, data) == FALSE) {
                /* return error if queue was blocked */
                DEBUG_SERVER_MSG("controller is processing important message..");
                result = NET_NFC_BUSY;
@@ -1361,7 +978,7 @@ static gboolean llcp_handle_accept(NetNfcGDbusLlcp *llcp,
 
        return TRUE;
 
-ERROR :
+ ERROR:
        if (data != NULL) {
                g_object_unref(data->invocation);
                g_object_unref(data->llcp);
@@ -1374,18 +991,12 @@ ERROR :
        return TRUE;
 }
 
-static gboolean llcp_handle_reject(NetNfcGDbusLlcp *llcp,
-                               GDBusMethodInvocation *invocation,
-                               guint32 arg_handle,
-                               guint32 arg_client_socket,
-                               GVariant *smack_privilege,
-                               gpointer user_data)
+static gboolean llcp_handle_reject(NetNfcGDbusLlcp * llcp, GDBusMethodInvocation * invocation, guint32 arg_handle, guint32 arg_client_socket, GVariant * smack_privilege, gpointer user_data)
 {
        gint result;
        LlcpAcceptData *data = NULL;
 
-       INFO_MSG(">>> REQUEST from [%s]",
-               g_dbus_method_invocation_get_sender(invocation));
+       INFO_MSG(">>> REQUEST from [%s]", g_dbus_method_invocation_get_sender(invocation));
 
        /* check privilege and update client context */
        if (net_nfc_server_gdbus_check_privilege(invocation, NET_NFC_PRIVILEGE_NFC_P2P) == false) {
@@ -1408,9 +1019,7 @@ static gboolean llcp_handle_reject(NetNfcGDbusLlcp *llcp,
        data->handle = arg_handle;
        data->client_socket = arg_client_socket;
 
-       if (net_nfc_server_controller_async_queue_push(
-               llcp_handle_reject_thread_func, data) == FALSE)
-       {
+       if (net_nfc_server_controller_async_queue_push(llcp_handle_reject_thread_func, data) == FALSE) {
                /* return error if queue was blocked */
                DEBUG_SERVER_MSG("controller is processing important message..");
                result = NET_NFC_BUSY;
@@ -1420,7 +1029,7 @@ static gboolean llcp_handle_reject(NetNfcGDbusLlcp *llcp,
 
        return TRUE;
 
-ERROR :
+ ERROR:
        if (data != NULL) {
                g_object_unref(data->invocation);
                g_object_unref(data->llcp);
@@ -1433,22 +1042,12 @@ ERROR :
        return TRUE;
 }
 
-static gboolean llcp_handle_connect(NetNfcGDbusLlcp *llcp,
-                               GDBusMethodInvocation *invocation,
-                               guint32 arg_handle,
-                               guint32 arg_client_socket,
-                               guint16 arg_miu,
-                               guint8 arg_rw,
-                               gint32 arg_type,
-                               const gchar *arg_service_name,
-                               GVariant *smack_privilege,
-                               gpointer user_data)
+static gboolean llcp_handle_connect(NetNfcGDbusLlcp * llcp, GDBusMethodInvocation * invocation, guint32 arg_handle, guint32 arg_client_socket, guint16 arg_miu, guint8 arg_rw, gint32 arg_type, const gchar * arg_service_name, GVariant * smack_privilege, gpointer user_data)
 {
        gint result;
        LlcpConnectData *data = NULL;
 
-       INFO_MSG(">>> REQUEST from [%s]",
-               g_dbus_method_invocation_get_sender(invocation));
+       INFO_MSG(">>> REQUEST from [%s]", g_dbus_method_invocation_get_sender(invocation));
 
        /* check privilege and update client context */
        if (net_nfc_server_gdbus_check_privilege(invocation, NET_NFC_PRIVILEGE_NFC_P2P) == false) {
@@ -1475,9 +1074,7 @@ static gboolean llcp_handle_connect(NetNfcGDbusLlcp *llcp,
        data->type = arg_type;
        data->service_name = g_strdup(arg_service_name);
 
-       if (net_nfc_server_controller_async_queue_push(
-               llcp_handle_connect_thread_func, data) == FALSE)
-       {
+       if (net_nfc_server_controller_async_queue_push(llcp_handle_connect_thread_func, data) == FALSE) {
                /* return error if queue was blocked */
                DEBUG_SERVER_MSG("controller is processing important message..");
                result = NET_NFC_BUSY;
@@ -1487,7 +1084,7 @@ static gboolean llcp_handle_connect(NetNfcGDbusLlcp *llcp,
 
        return TRUE;
 
-ERROR :
+ ERROR:
        if (data != NULL) {
                g_free(data->service_name);
 
@@ -1502,22 +1099,12 @@ ERROR :
        return TRUE;
 }
 
-static gboolean llcp_handle_connect_sap(NetNfcGDbusLlcp *llcp,
-                                       GDBusMethodInvocation *invocation,
-                                       guint32 arg_handle,
-                                       guint32 arg_client_socket,
-                                       guint16 arg_miu,
-                                       guint8 arg_rw,
-                                       gint32 arg_type,
-                                       guint8 arg_sap,
-                                       GVariant *smack_privilege,
-                                       gpointer user_data)
+static gboolean llcp_handle_connect_sap(NetNfcGDbusLlcp * llcp, GDBusMethodInvocation * invocation, guint32 arg_handle, guint32 arg_client_socket, guint16 arg_miu, guint8 arg_rw, gint32 arg_type, guint8 arg_sap, GVariant * smack_privilege, gpointer user_data)
 {
        gint result;
        LlcpConnectSapData *data = NULL;
 
-       INFO_MSG(">>> REQUEST from [%s]",
-               g_dbus_method_invocation_get_sender(invocation));
+       INFO_MSG(">>> REQUEST from [%s]", g_dbus_method_invocation_get_sender(invocation));
 
        /* check privilege and update client context */
        if (net_nfc_server_gdbus_check_privilege(invocation, NET_NFC_PRIVILEGE_NFC_P2P) == false) {
@@ -1544,9 +1131,7 @@ static gboolean llcp_handle_connect_sap(NetNfcGDbusLlcp *llcp,
        data->type = arg_type;
        data->sap = arg_sap;
 
-       if (net_nfc_server_controller_async_queue_push(
-               llcp_handle_connect_sap_thread_func, data) == FALSE)
-       {
+       if (net_nfc_server_controller_async_queue_push(llcp_handle_connect_sap_thread_func, data) == FALSE) {
                /* return error if queue was blocked */
                DEBUG_SERVER_MSG("controller is processing important message..");
                result = NET_NFC_BUSY;
@@ -1556,7 +1141,7 @@ static gboolean llcp_handle_connect_sap(NetNfcGDbusLlcp *llcp,
 
        return TRUE;
 
-ERROR :
+ ERROR:
        if (data != NULL) {
                g_object_unref(data->invocation);
                g_object_unref(data->llcp);
@@ -1564,24 +1149,17 @@ ERROR :
                g_free(data);
        }
 
-       net_nfc_gdbus_llcp_complete_connect_sap(llcp,invocation, result, -1);
+       net_nfc_gdbus_llcp_complete_connect_sap(llcp, invocation, result, -1);
 
        return TRUE;
 }
 
-static gboolean llcp_handle_send(NetNfcGDbusLlcp *llcp,
-                               GDBusMethodInvocation *invocation,
-                               guint32 arg_handle,
-                               guint32 arg_client_socket,
-                               GVariant *arg_data,
-                               GVariant *smack_privilege,
-                               gpointer user_data)
+static gboolean llcp_handle_send(NetNfcGDbusLlcp * llcp, GDBusMethodInvocation * invocation, guint32 arg_handle, guint32 arg_client_socket, GVariant * arg_data, GVariant * smack_privilege, gpointer user_data)
 {
        gint result;
        LlcpSendData *data = NULL;
 
-       INFO_MSG(">>> REQUEST from [%s]",
-               g_dbus_method_invocation_get_sender(invocation));
+       INFO_MSG(">>> REQUEST from [%s]", g_dbus_method_invocation_get_sender(invocation));
 
        /* check privilege and update client context */
        if (net_nfc_server_gdbus_check_privilege(invocation, NET_NFC_PRIVILEGE_NFC_P2P) == false) {
@@ -1606,9 +1184,7 @@ static gboolean llcp_handle_send(NetNfcGDbusLlcp *llcp,
 
        net_nfc_util_gdbus_variant_to_data_s(arg_data, &data->data);
 
-       if (net_nfc_server_controller_async_queue_push(
-               llcp_handle_send_thread_func, data) == FALSE)
-       {
+       if (net_nfc_server_controller_async_queue_push(llcp_handle_send_thread_func, data) == FALSE) {
                /* return error if queue was blocked */
                DEBUG_SERVER_MSG("controller is processing important message..");
                result = NET_NFC_BUSY;
@@ -1618,7 +1194,7 @@ static gboolean llcp_handle_send(NetNfcGDbusLlcp *llcp,
 
        return TRUE;
 
-ERROR :
+ ERROR:
        if (data != NULL) {
                net_nfc_util_clear_data(&data->data);
 
@@ -1628,26 +1204,17 @@ ERROR :
                g_free(data);
        }
 
-       net_nfc_gdbus_llcp_complete_send(llcp, invocation,
-               result, arg_client_socket);
+       net_nfc_gdbus_llcp_complete_send(llcp, invocation, result, arg_client_socket);
 
        return TRUE;
 }
 
-static gboolean llcp_handle_send_to(NetNfcGDbusLlcp *llcp,
-                               GDBusMethodInvocation *invocation,
-                               guint32 arg_handle,
-                               guint32 arg_client_socket,
-                               guint8 arg_sap,
-                               GVariant *arg_data,
-                               GVariant *smack_privilege,
-                               gpointer user_data)
+static gboolean llcp_handle_send_to(NetNfcGDbusLlcp * llcp, GDBusMethodInvocation * invocation, guint32 arg_handle, guint32 arg_client_socket, guint8 arg_sap, GVariant * arg_data, GVariant * smack_privilege, gpointer user_data)
 {
        gint result;
        LlcpSendToData *data = NULL;
 
-       INFO_MSG(">>> REQUEST from [%s]",
-               g_dbus_method_invocation_get_sender(invocation));
+       INFO_MSG(">>> REQUEST from [%s]", g_dbus_method_invocation_get_sender(invocation));
 
        /* check privilege and update client context */
        if (net_nfc_server_gdbus_check_privilege(invocation, NET_NFC_PRIVILEGE_NFC_P2P) == false) {
@@ -1673,9 +1240,7 @@ static gboolean llcp_handle_send_to(NetNfcGDbusLlcp *llcp,
 
        net_nfc_util_gdbus_variant_to_data_s(arg_data, &data->data);
 
-       if (net_nfc_server_controller_async_queue_push(
-               llcp_handle_send_to_thread_func, data) == FALSE)
-       {
+       if (net_nfc_server_controller_async_queue_push(llcp_handle_send_to_thread_func, data) == FALSE) {
                /* return error if queue was blocked */
                DEBUG_SERVER_MSG("controller is processing important message..");
                result = NET_NFC_BUSY;
@@ -1685,7 +1250,7 @@ static gboolean llcp_handle_send_to(NetNfcGDbusLlcp *llcp,
 
        return TRUE;
 
-ERROR :
+ ERROR:
        if (data != NULL) {
                net_nfc_util_clear_data(&data->data);
 
@@ -1695,25 +1260,17 @@ ERROR :
                g_free(data);
        }
 
-       net_nfc_gdbus_llcp_complete_send_to(llcp, invocation,
-               result, arg_client_socket);
+       net_nfc_gdbus_llcp_complete_send_to(llcp, invocation, result, arg_client_socket);
 
        return TRUE;
 }
 
-static gboolean llcp_handle_receive(NetNfcGDbusLlcp *llcp,
-                               GDBusMethodInvocation *invocation,
-                               guint32 arg_handle,
-                               guint32 arg_client_socket,
-                               guint32 arg_req_length,
-                               GVariant *smack_privilege,
-                               gpointer user_data)
+static gboolean llcp_handle_receive(NetNfcGDbusLlcp * llcp, GDBusMethodInvocation * invocation, guint32 arg_handle, guint32 arg_client_socket, guint32 arg_req_length, GVariant * smack_privilege, gpointer user_data)
 {
        gint result;
        LlcpReceiveData *data = NULL;
 
-       INFO_MSG(">>> REQUEST from [%s]",
-               g_dbus_method_invocation_get_sender(invocation));
+       INFO_MSG(">>> REQUEST from [%s]", g_dbus_method_invocation_get_sender(invocation));
 
        /* check privilege and update client context */
        if (net_nfc_server_gdbus_check_privilege(invocation, NET_NFC_PRIVILEGE_NFC_P2P) == false) {
@@ -1737,9 +1294,7 @@ static gboolean llcp_handle_receive(NetNfcGDbusLlcp *llcp,
        data->client_socket = arg_client_socket;
        data->req_length = arg_req_length;
 
-       if (net_nfc_server_controller_async_queue_push(
-               llcp_handle_receive_thread_func, data) == FALSE)
-       {
+       if (net_nfc_server_controller_async_queue_push(llcp_handle_receive_thread_func, data) == FALSE) {
                /* return error if queue was blocked */
                DEBUG_SERVER_MSG("controller is processing important message..");
                result = NET_NFC_BUSY;
@@ -1749,7 +1304,7 @@ static gboolean llcp_handle_receive(NetNfcGDbusLlcp *llcp,
 
        return TRUE;
 
-ERROR :
+ ERROR:
        if (data != NULL) {
                g_object_unref(data->invocation);
                g_object_unref(data->llcp);
@@ -1757,25 +1312,17 @@ ERROR :
                g_free(data);
        }
 
-       net_nfc_gdbus_llcp_complete_receive(llcp, invocation, result,
-               net_nfc_util_gdbus_buffer_to_variant(NULL, 0));
+       net_nfc_gdbus_llcp_complete_receive(llcp, invocation, result, net_nfc_util_gdbus_buffer_to_variant(NULL, 0));
 
        return TRUE;
 }
 
-static gboolean llcp_handle_receive_from(NetNfcGDbusLlcp *llcp,
-                                       GDBusMethodInvocation *invocation,
-                                       guint32 arg_handle,
-                                       guint32 arg_client_socket,
-                                       guint32 arg_req_length,
-                                       GVariant *smack_privilege,
-                                       gpointer user_data)
+static gboolean llcp_handle_receive_from(NetNfcGDbusLlcp * llcp, GDBusMethodInvocation * invocation, guint32 arg_handle, guint32 arg_client_socket, guint32 arg_req_length, GVariant * smack_privilege, gpointer user_data)
 {
        gint result;
        LlcpReceiveData *data = NULL;
 
-       INFO_MSG(">>> REQUEST from [%s]",
-               g_dbus_method_invocation_get_sender(invocation));
+       INFO_MSG(">>> REQUEST from [%s]", g_dbus_method_invocation_get_sender(invocation));
 
        /* check privilege and update client context */
        if (net_nfc_server_gdbus_check_privilege(invocation, NET_NFC_PRIVILEGE_NFC_P2P) == false) {
@@ -1799,9 +1346,7 @@ static gboolean llcp_handle_receive_from(NetNfcGDbusLlcp *llcp,
        data->client_socket = arg_client_socket;
        data->req_length = arg_req_length;
 
-       if (net_nfc_server_controller_async_queue_push(
-               llcp_handle_receive_from_thread_func, data) == FALSE)
-       {
+       if (net_nfc_server_controller_async_queue_push(llcp_handle_receive_from_thread_func, data) == FALSE) {
                /* return error if queue was blocked */
                DEBUG_SERVER_MSG("controller is processing important message..");
                result = NET_NFC_BUSY;
@@ -1811,7 +1356,7 @@ static gboolean llcp_handle_receive_from(NetNfcGDbusLlcp *llcp,
 
        return TRUE;
 
-ERROR :
+ ERROR:
        if (data != NULL) {
                g_object_unref(data->invocation);
                g_object_unref(data->llcp);
@@ -1819,24 +1364,17 @@ ERROR :
                g_free(data);
        }
 
-       net_nfc_gdbus_llcp_complete_receive_from(llcp, invocation,
-               result, -1, net_nfc_util_gdbus_buffer_to_variant(NULL, 0));
+       net_nfc_gdbus_llcp_complete_receive_from(llcp, invocation, result, -1, net_nfc_util_gdbus_buffer_to_variant(NULL, 0));
 
        return TRUE;
 }
 
-static gboolean llcp_handle_close(NetNfcGDbusLlcp *llcp,
-                               GDBusMethodInvocation *invocation,
-                               guint32 arg_handle,
-                               guint32 arg_client_socket,
-                               GVariant *smack_privilege,
-                               gpointer user_data)
+static gboolean llcp_handle_close(NetNfcGDbusLlcp * llcp, GDBusMethodInvocation * invocation, guint32 arg_handle, guint32 arg_client_socket, GVariant * smack_privilege, gpointer user_data)
 {
        gint result;
        LlcpCloseData *data = NULL;
 
-       INFO_MSG(">>> REQUEST from [%s]",
-               g_dbus_method_invocation_get_sender(invocation));
+       INFO_MSG(">>> REQUEST from [%s]", g_dbus_method_invocation_get_sender(invocation));
 
        /* check privilege and update client context */
        if (net_nfc_server_gdbus_check_privilege(invocation, NET_NFC_PRIVILEGE_NFC_P2P) == false) {
@@ -1859,9 +1397,7 @@ static gboolean llcp_handle_close(NetNfcGDbusLlcp *llcp,
        data->handle = arg_handle;
        data->client_socket = arg_client_socket;
 
-       if (net_nfc_server_controller_async_queue_push(
-               llcp_handle_close_thread_func, data) == FALSE)
-       {
+       if (net_nfc_server_controller_async_queue_push(llcp_handle_close_thread_func, data) == FALSE) {
                /* return error if queue was blocked */
                DEBUG_SERVER_MSG("controller is processing important message..");
                result = NET_NFC_BUSY;
@@ -1871,7 +1407,7 @@ static gboolean llcp_handle_close(NetNfcGDbusLlcp *llcp,
 
        return TRUE;
 
-ERROR :
+ ERROR:
        if (data != NULL) {
                g_object_unref(data->invocation);
                g_object_unref(data->llcp);
@@ -1879,24 +1415,17 @@ ERROR :
                g_free(data);
        }
 
-       net_nfc_gdbus_llcp_complete_close(llcp, invocation,
-               result, arg_client_socket);
+       net_nfc_gdbus_llcp_complete_close(llcp, invocation, result, arg_client_socket);
 
        return TRUE;
 }
 
-static gboolean llcp_handle_disconnect(NetNfcGDbusLlcp *llcp,
-                               GDBusMethodInvocation *invocation,
-                               guint32 arg_handle,
-                               guint32 arg_client_socket,
-                               GVariant *smack_privilege,
-                               gpointer user_data)
+static gboolean llcp_handle_disconnect(NetNfcGDbusLlcp * llcp, GDBusMethodInvocation * invocation, guint32 arg_handle, guint32 arg_client_socket, GVariant * smack_privilege, gpointer user_data)
 {
        gint result;
        LlcpDisconnectData *data = NULL;
 
-       INFO_MSG(">>> REQUEST from [%s]",
-               g_dbus_method_invocation_get_sender(invocation));
+       INFO_MSG(">>> REQUEST from [%s]", g_dbus_method_invocation_get_sender(invocation));
 
        /* check privilege and update client context */
        if (net_nfc_server_gdbus_check_privilege(invocation, NET_NFC_PRIVILEGE_NFC_P2P) == false) {
@@ -1919,9 +1448,7 @@ static gboolean llcp_handle_disconnect(NetNfcGDbusLlcp *llcp,
        data->handle = arg_handle;
        data->client_socket = arg_client_socket;
 
-       if (net_nfc_server_controller_async_queue_push(
-               llcp_handle_disconnect_thread_func, data) == FALSE)
-       {
+       if (net_nfc_server_controller_async_queue_push(llcp_handle_disconnect_thread_func, data) == FALSE) {
                /* return error if queue was blocked */
                DEBUG_SERVER_MSG("controller is processing important message..");
                result = NET_NFC_BUSY;
@@ -1931,7 +1458,7 @@ static gboolean llcp_handle_disconnect(NetNfcGDbusLlcp *llcp,
 
        return TRUE;
 
-ERROR :
+ ERROR:
        if (data != NULL) {
                g_object_unref(data->invocation);
                g_object_unref(data->llcp);
@@ -1939,8 +1466,7 @@ ERROR :
                g_free(data);
        }
 
-       net_nfc_gdbus_llcp_complete_disconnect(llcp, invocation,
-               result, arg_client_socket);
+       net_nfc_gdbus_llcp_complete_disconnect(llcp, invocation, result, arg_client_socket);
 
        return TRUE;
 }
@@ -1952,176 +1478,114 @@ void net_nfc_server_llcp_deactivated(gpointer user_data)
 
        target_info = net_nfc_server_get_target_info();
 
-       if(target_info != NULL && target_info->handle != NULL)
+       if (target_info != NULL && target_info->handle != NULL)
                handle = target_info->handle;
 
-       if (handle != NULL)
-       {
+       if (handle != NULL) {
                net_nfc_error_e result = NET_NFC_OK;
 
-               if (net_nfc_controller_disconnect(handle, &result) == false)
-               {
+               if (net_nfc_controller_disconnect(handle, &result) == false) {
                        DEBUG_ERR_MSG("net_nfc_controller_disconnect failed, [%d]", result);
 #if 0
                        if (result != NET_NFC_NOT_CONNECTED)
-                       {
                                net_nfc_controller_exception_handler();
-                       }
                        else
-                       {
                                DEBUG_SERVER_MSG("target was not connected.");
-                       }
 #endif
                }
 
                net_nfc_server_set_state(NET_NFC_SERVER_IDLE);
-       }
-       else
-       {
+       } else {
                int ret_val = 0;
 
                ret_val = display_unlock_state(LCD_NORMAL, PM_RESET_TIMER);
 
-               DEBUG_SERVER_MSG("the target was disconnected display_unlock_state = [%d]" , ret_val);
+               DEBUG_SERVER_MSG("the target was disconnected display_unlock_state = [%d]", ret_val);
        }
 
        /* send p2p detatch */
-       if (net_nfc_server_controller_async_queue_push(
-               net_nfc_server_p2p_detached, NULL) == FALSE)
-       {
+       if (net_nfc_server_controller_async_queue_push(net_nfc_server_p2p_detached, NULL) == FALSE) {
                /* return error if queue was blocked */
                DEBUG_SERVER_MSG("controller is processing important message..");
        }
 }
 
-static void llcp_simple_socket_error_cb(net_nfc_llcp_socket_t socket,
-                               net_nfc_error_e result,
-                               data_s *data,
-                               void *extra,
-                               void *user_param)
+static void llcp_simple_socket_error_cb(net_nfc_llcp_socket_t socket, net_nfc_error_e result, data_s * data, void *extra, void *user_param)
 {
-       LlcpSimpleData *simple_data = (LlcpSimpleData *)user_param;
+       LlcpSimpleData *simple_data = (LlcpSimpleData *) user_param;
 
-       DEBUG_SERVER_MSG("Check socket = [%x]" ,socket );
+       DEBUG_SERVER_MSG("Check socket = [%x]", socket);
 
        g_assert(simple_data != NULL);
 
        if (simple_data->error_callback)
-       {
-               simple_data->error_callback(result,
-                       simple_data->handle,
-                       socket,
-                       data,
-                       simple_data->user_data);
-       }
+               simple_data->error_callback(result, simple_data->handle, socket, data, simple_data->user_data);
 
        g_free(simple_data);
        simple_data = NULL;
 }
 
-static void llcp_simple_listen_cb(net_nfc_llcp_socket_t socket,
-                               net_nfc_error_e result,
-                               data_s *data,
-                               void *extra,
-                               void *user_param)
+static void llcp_simple_listen_cb(net_nfc_llcp_socket_t socket, net_nfc_error_e result, data_s * data, void *extra, void *user_param)
 {
-       LlcpSimpleData *simple_data = (LlcpSimpleData *)user_param;
+       LlcpSimpleData *simple_data = (LlcpSimpleData *) user_param;
 
        g_assert(simple_data != NULL);
 
-       if (result != NET_NFC_OK) {
+       if (result != NET_NFC_OK)
                DEBUG_ERR_MSG("listen socket failed, [%d]", result);
-       }
 
        if (simple_data->callback)
-       {
-               simple_data->callback(result,
-                       simple_data->handle,
-                       socket,
-                       data,
-                       simple_data->user_data);
-       }
+               simple_data->callback(result, simple_data->handle, socket, data, simple_data->user_data);
 
        /* 'simple_data' will be freed in socket error callback */
 }
 
-static void llcp_simple_connect_cb(net_nfc_llcp_socket_t socket,
-                               net_nfc_error_e result,
-                               data_s *data,
-                               void *extra,
-                               void *user_param)
+static void llcp_simple_connect_cb(net_nfc_llcp_socket_t socket, net_nfc_error_e result, data_s * data, void *extra, void *user_param)
 {
-       LlcpSimpleData *simple_data = (LlcpSimpleData *)user_param;
+       LlcpSimpleData *simple_data = (LlcpSimpleData *) user_param;
 
        g_assert(simple_data != NULL);
 
-       if (result != NET_NFC_OK) {
+       if (result != NET_NFC_OK)
                DEBUG_ERR_MSG("connect socket failed, [%d]", result);
-       }
 
        if (simple_data->callback)
-       {
-               simple_data->callback(result,
-                       simple_data->handle,
-                       socket,
-                       data,
-                       simple_data->user_data);
-       }
+               simple_data->callback(result, simple_data->handle, socket, data, simple_data->user_data);
 
        /* 'simple_data' will be freed in socket error callback */
 }
 
-static void llcp_simple_send_cb(net_nfc_llcp_socket_t socket,
-                               net_nfc_error_e result,
-                               data_s *data,
-                               void *extra,
-                               void *user_param)
+static void llcp_simple_send_cb(net_nfc_llcp_socket_t socket, net_nfc_error_e result, data_s * data, void *extra, void *user_param)
 {
-       LlcpSimpleData *simple_data = (LlcpSimpleData *)user_param;
+       LlcpSimpleData *simple_data = (LlcpSimpleData *) user_param;
 
        g_assert(simple_data != NULL);
 
        if (simple_data->callback)
-       {
-               simple_data->callback(result,
-                               simple_data->handle,
-                               socket,
-                               data,
-                               simple_data->user_data);
-       }
+               simple_data->callback(result, simple_data->handle, socket, data, simple_data->user_data);
 
        g_free(simple_data);
 }
 
-static void llcp_simple_receive_cb(net_nfc_llcp_socket_t socket,
-                               net_nfc_error_e result,
-                               data_s *data,
-                               void *extra,
-                               void *user_param)
+static void llcp_simple_receive_cb(net_nfc_llcp_socket_t socket, net_nfc_error_e result, data_s * data, void *extra, void *user_param)
 {
-       LlcpSimpleData *simple_data = (LlcpSimpleData *)user_param;
+       LlcpSimpleData *simple_data = (LlcpSimpleData *) user_param;
 
        g_assert(simple_data != NULL);
 
        if (simple_data->callback)
-       {
-               simple_data->callback(result,
-                       simple_data->handle,
-                       socket,
-                       data,
-                       simple_data->user_data);
-       }
+               simple_data->callback(result, simple_data->handle, socket, data, simple_data->user_data);
 
        g_free(simple_data);
 }
 
-static void _llcp_on_client_detached_cb(net_nfc_client_context_info_t *client)
+static void _llcp_on_client_detached_cb(net_nfc_client_context_info_t * client)
 {
        net_nfc_server_llcp_unregister_services(client->id);
 }
 
 /* Public Function */
-gboolean net_nfc_server_llcp_init(GDBusConnection *connection)
+gboolean net_nfc_server_llcp_init(GDBusConnection * connection)
 {
        gboolean result;
        GError *error = NULL;
@@ -2131,103 +1595,57 @@ gboolean net_nfc_server_llcp_init(GDBusConnection *connection)
 
        llcp_skeleton = net_nfc_gdbus_llcp_skeleton_new();
 
-       g_signal_connect(llcp_skeleton,
-                       "handle-config",
-                       G_CALLBACK(llcp_handle_config),
-                       NULL);
-
-       g_signal_connect(llcp_skeleton,
-                       "handle-listen",
-                       G_CALLBACK(llcp_handle_listen),
-                       NULL);
-
-       g_signal_connect(llcp_skeleton,
-                       "handle-accept",
-                       G_CALLBACK(llcp_handle_accept),
-                       NULL);
-
-       g_signal_connect(llcp_skeleton,
-                       "handle-reject",
-                       G_CALLBACK(llcp_handle_reject),
-                       NULL);
-
-       g_signal_connect(llcp_skeleton,
-                       "handle-connect",
-                       G_CALLBACK(llcp_handle_connect),
-                       NULL);
-
-       g_signal_connect(llcp_skeleton,
-                       "handle-connect-sap",
-                       G_CALLBACK(llcp_handle_connect_sap),
-                       NULL);
-
-       g_signal_connect(llcp_skeleton,
-                       "handle-send",
-                       G_CALLBACK(llcp_handle_send),
-                       NULL);
-
-       g_signal_connect(llcp_skeleton,
-                       "handle-send-to",
-                       G_CALLBACK(llcp_handle_send_to),
-                       NULL);
-
-       g_signal_connect(llcp_skeleton,
-                       "handle-receive",
-                       G_CALLBACK(llcp_handle_receive),
-                       NULL);
-
-       g_signal_connect(llcp_skeleton,
-                       "handle-receive-from",
-                       G_CALLBACK(llcp_handle_receive_from),
-                       NULL);
-
-       g_signal_connect(llcp_skeleton,
-                       "handle-close",
-                       G_CALLBACK(llcp_handle_close),
-                       NULL);
-
-       g_signal_connect(llcp_skeleton,
-                       "handle-disconnect",
-                       G_CALLBACK(llcp_handle_disconnect),
-                       NULL);
-
-       result = g_dbus_interface_skeleton_export(
-               G_DBUS_INTERFACE_SKELETON(llcp_skeleton),
-               connection,
-               "/org/tizen/NetNfcService/Llcp",
-               &error);
+       g_signal_connect(llcp_skeleton, "handle-config", G_CALLBACK(llcp_handle_config), NULL);
+
+       g_signal_connect(llcp_skeleton, "handle-listen", G_CALLBACK(llcp_handle_listen), NULL);
+
+       g_signal_connect(llcp_skeleton, "handle-accept", G_CALLBACK(llcp_handle_accept), NULL);
+
+       g_signal_connect(llcp_skeleton, "handle-reject", G_CALLBACK(llcp_handle_reject), NULL);
+
+       g_signal_connect(llcp_skeleton, "handle-connect", G_CALLBACK(llcp_handle_connect), NULL);
+
+       g_signal_connect(llcp_skeleton, "handle-connect-sap", G_CALLBACK(llcp_handle_connect_sap), NULL);
+
+       g_signal_connect(llcp_skeleton, "handle-send", G_CALLBACK(llcp_handle_send), NULL);
+
+       g_signal_connect(llcp_skeleton, "handle-send-to", G_CALLBACK(llcp_handle_send_to), NULL);
+
+       g_signal_connect(llcp_skeleton, "handle-receive", G_CALLBACK(llcp_handle_receive), NULL);
+
+       g_signal_connect(llcp_skeleton, "handle-receive-from", G_CALLBACK(llcp_handle_receive_from), NULL);
+
+       g_signal_connect(llcp_skeleton, "handle-close", G_CALLBACK(llcp_handle_close), NULL);
+
+       g_signal_connect(llcp_skeleton, "handle-disconnect", G_CALLBACK(llcp_handle_disconnect), NULL);
+
+       result = g_dbus_interface_skeleton_export(G_DBUS_INTERFACE_SKELETON(llcp_skeleton), connection, "/org/tizen/NetNfcService/Llcp", &error);
        if (result == TRUE) {
-               net_nfc_server_gdbus_register_on_client_detached_cb(
-                       _llcp_on_client_detached_cb);
+               net_nfc_server_gdbus_register_on_client_detached_cb(_llcp_on_client_detached_cb);
        } else {
                g_error_free(error);
 
                net_nfc_server_llcp_deinit();
        }
 
-
        return result;
 }
 
 void net_nfc_server_llcp_deinit(void)
 {
-       if (llcp_skeleton)
-       {
-               net_nfc_server_gdbus_unregister_on_client_detached_cb(
-                       _llcp_on_client_detached_cb);
+       if (llcp_skeleton) {
+               net_nfc_server_gdbus_unregister_on_client_detached_cb(_llcp_on_client_detached_cb);
 
                g_object_unref(llcp_skeleton);
                llcp_skeleton = NULL;
        }
 }
 
-net_nfc_error_e net_nfc_server_llcp_set_config(
-                                       net_nfc_llcp_config_info_s *config)
+net_nfc_error_e net_nfc_server_llcp_set_config(net_nfc_llcp_config_info_s * config)
 {
        net_nfc_error_e result;
 
-       if (config == NULL)
-       {
+       if (config == NULL) {
                net_nfc_controller_llcp_config(&llcp_config, &result);
                return result;
        }
@@ -2258,13 +1676,7 @@ guint8 net_nfc_server_llcp_get_option(void)
        return llcp_config.option;
 }
 
-net_nfc_error_e net_nfc_server_llcp_simple_server(
-                               net_nfc_target_handle_s *handle,
-                               const char *san,
-                               sap_t sap,
-                               net_nfc_server_llcp_callback callback,
-                               net_nfc_server_llcp_callback error_callback,
-                               gpointer user_data)
+net_nfc_error_e net_nfc_server_llcp_simple_server(net_nfc_target_handle_s * handle, const char *san, sap_t sap, net_nfc_server_llcp_callback callback, net_nfc_server_llcp_callback error_callback, gpointer user_data)
 {
        net_nfc_error_e result = NET_NFC_OK;
        LlcpSimpleData *simple_data = NULL;
@@ -2274,10 +1686,7 @@ net_nfc_error_e net_nfc_server_llcp_simple_server(
        if (handle == NULL)
                return NET_NFC_NULL_PARAMETER;
 
-       if (net_nfc_controller_llcp_get_remote_config(handle,
-                                               &config,
-                                               &result) == false)
-       {
+       if (net_nfc_controller_llcp_get_remote_config(handle, &config, &result) == false) {
                DEBUG_ERR_MSG("net_nfc_controller_llcp_get_remote_config failed [%d]", result);
 
                goto ERROR;
@@ -2299,14 +1708,7 @@ net_nfc_error_e net_nfc_server_llcp_simple_server(
 
        simple_data->miu = MIN(config.miu, net_nfc_server_llcp_get_miu());
 
-       if (net_nfc_controller_llcp_create_socket(&socket,
-                       NET_NFC_LLCP_SOCKET_TYPE_CONNECTIONORIENTED,
-                       simple_data->miu,
-                       1,
-                       &result,
-                       llcp_simple_socket_error_cb,
-                       simple_data) == false)
-       {
+       if (net_nfc_controller_llcp_create_socket(&socket, NET_NFC_LLCP_SOCKET_TYPE_CONNECTIONORIENTED, simple_data->miu, 1, &result, llcp_simple_socket_error_cb, simple_data) == false) {
                DEBUG_ERR_MSG("net_nfc_controller_llcp_create_socket failed [%d]", result);
 
                goto ERROR;
@@ -2314,22 +1716,13 @@ net_nfc_error_e net_nfc_server_llcp_simple_server(
 
        simple_data->socket = socket;
 
-       if (net_nfc_controller_llcp_bind(socket,
-                                       sap,
-                                       &result) == false)
-       {
+       if (net_nfc_controller_llcp_bind(socket, sap, &result) == false) {
                DEBUG_ERR_MSG("net_nfc_controller_llcp_bind failed [%d]", result);
 
                goto ERROR;
        }
 
-       if (net_nfc_controller_llcp_listen(handle,
-                                       (uint8_t *)san,
-                                       socket,
-                                       &result,
-                                       llcp_simple_listen_cb,
-                                       simple_data) == false)
-       {
+       if (net_nfc_controller_llcp_listen(handle, (uint8_t *) san, socket, &result, llcp_simple_listen_cb, simple_data) == false) {
                DEBUG_ERR_MSG("net_nfc_controller_llcp_listen failed [%d]", result);
 
                goto ERROR;
@@ -2342,7 +1735,7 @@ net_nfc_error_e net_nfc_server_llcp_simple_server(
 
        return result;
 
-ERROR :
+ ERROR:
        if (socket != -1) {
                net_nfc_error_e temp;
 
@@ -2352,13 +1745,7 @@ ERROR :
        return result;
 }
 
-net_nfc_error_e net_nfc_server_llcp_simple_client(
-                               net_nfc_target_handle_s *handle,
-                               const char *san,
-                               sap_t sap,
-                               net_nfc_server_llcp_callback callback,
-                               net_nfc_server_llcp_callback error_callback,
-                               gpointer user_data)
+net_nfc_error_e net_nfc_server_llcp_simple_client(net_nfc_target_handle_s * handle, const char *san, sap_t sap, net_nfc_server_llcp_callback callback, net_nfc_server_llcp_callback error_callback, gpointer user_data)
 {
        net_nfc_error_e result;
        LlcpSimpleData *simple_data = NULL;
@@ -2368,10 +1755,7 @@ net_nfc_error_e net_nfc_server_llcp_simple_client(
        if (handle == NULL)
                return NET_NFC_NULL_PARAMETER;
 
-       if (net_nfc_controller_llcp_get_remote_config(handle,
-                                               &config,
-                                               &result) == false)
-       {
+       if (net_nfc_controller_llcp_get_remote_config(handle, &config, &result) == false) {
                DEBUG_ERR_MSG("net_nfc_controller_llcp_get_remote_config failed [%d]", result);
 
                goto ERROR;
@@ -2393,14 +1777,7 @@ net_nfc_error_e net_nfc_server_llcp_simple_client(
 
        simple_data->miu = MIN(config.miu, net_nfc_server_llcp_get_miu());
 
-       if (net_nfc_controller_llcp_create_socket(&socket,
-                       NET_NFC_LLCP_SOCKET_TYPE_CONNECTIONORIENTED,
-                       simple_data->miu,
-                       1,
-                       &result,
-                       llcp_simple_socket_error_cb,
-                       simple_data) == false)
-       {
+       if (net_nfc_controller_llcp_create_socket(&socket, NET_NFC_LLCP_SOCKET_TYPE_CONNECTIONORIENTED, simple_data->miu, 1, &result, llcp_simple_socket_error_cb, simple_data) == false) {
                DEBUG_ERR_MSG("net_nfc_controller_llcp_create_socket failed [%d]", result);
 
                goto ERROR;
@@ -2408,29 +1785,14 @@ net_nfc_error_e net_nfc_server_llcp_simple_client(
 
        simple_data->socket = socket;
 
-       if (san == NULL)
-       {
-               if (net_nfc_controller_llcp_connect(handle,
-                                               simple_data->socket,
-                                               sap,
-                                               &result,
-                                               llcp_simple_connect_cb,
-                                               simple_data) == false)
-               {
+       if (san == NULL) {
+               if (net_nfc_controller_llcp_connect(handle, simple_data->socket, sap, &result, llcp_simple_connect_cb, simple_data) == false) {
                        DEBUG_ERR_MSG("net_nfc_controller_llcp_connect failed [%d]", result);
 
                        goto ERROR;
                }
-       }
-       else
-       {
-               if (net_nfc_controller_llcp_connect_by_url(handle,
-                                               simple_data->socket,
-                                               (uint8_t *)san,
-                                               &result,
-                                               llcp_simple_connect_cb,
-                                               simple_data) == false)
-               {
+       } else {
+               if (net_nfc_controller_llcp_connect_by_url(handle, simple_data->socket, (uint8_t *) san, &result, llcp_simple_connect_cb, simple_data) == false) {
                        DEBUG_ERR_MSG("net_nfc_controller_llcp_connect_by_url failed [%d]", result);
 
                        goto ERROR;
@@ -2444,7 +1806,7 @@ net_nfc_error_e net_nfc_server_llcp_simple_client(
 
        return result;
 
-ERROR :
+ ERROR:
        if (socket != -1) {
                net_nfc_error_e temp;
 
@@ -2459,11 +1821,7 @@ ERROR :
        return result;
 }
 
-net_nfc_error_e net_nfc_server_llcp_simple_accept(
-                               net_nfc_target_handle_s *handle,
-                               net_nfc_llcp_socket_t socket,
-                               net_nfc_server_llcp_callback error_callback,
-                               gpointer user_data)
+net_nfc_error_e net_nfc_server_llcp_simple_accept(net_nfc_target_handle_s * handle, net_nfc_llcp_socket_t socket, net_nfc_server_llcp_callback error_callback, gpointer user_data)
 {
        net_nfc_error_e result;
        LlcpSimpleData *simple_data;
@@ -2475,13 +1833,8 @@ net_nfc_error_e net_nfc_server_llcp_simple_accept(
                simple_data->error_callback = error_callback;
                simple_data->user_data = user_data;
 
-               if (net_nfc_controller_llcp_accept(socket,
-                                               &result,
-                                               llcp_simple_socket_error_cb,
-                                               simple_data) == false)
-               {
+               if (net_nfc_controller_llcp_accept(socket, &result, llcp_simple_socket_error_cb, simple_data) == false)
                        DEBUG_ERR_MSG("net_nfc_controller_llcp_accept failed [%d]", result);
-               }
        } else {
                DEBUG_ERR_MSG("g_try_new0 failed");
 
@@ -2494,12 +1847,7 @@ net_nfc_error_e net_nfc_server_llcp_simple_accept(
        return result;
 }
 
-net_nfc_error_e net_nfc_server_llcp_simple_send(
-                                       net_nfc_target_handle_s *handle,
-                                       net_nfc_llcp_socket_t socket,
-                                       data_s *data,
-                                       net_nfc_server_llcp_callback callback,
-                                       gpointer user_data)
+net_nfc_error_e net_nfc_server_llcp_simple_send(net_nfc_target_handle_s * handle, net_nfc_llcp_socket_t socket, data_s * data, net_nfc_server_llcp_callback callback, gpointer user_data)
 {
        net_nfc_error_e result;
        LlcpSimpleData *simple_data;
@@ -2511,16 +1859,8 @@ net_nfc_error_e net_nfc_server_llcp_simple_send(
                simple_data->callback = callback;
                simple_data->user_data = user_data;
 
-               if (net_nfc_controller_llcp_send(handle,
-                                               socket,
-                                               data,
-                                               &result,
-                                               llcp_simple_send_cb,
-                                               simple_data) == false)
-               {
-                       DEBUG_ERR_MSG("net_nfc_controller_llcp_send failed [%d]",
-                               result);
-               }
+               if (net_nfc_controller_llcp_send(handle, socket, data, &result, llcp_simple_send_cb, simple_data) == false)
+                       DEBUG_ERR_MSG("net_nfc_controller_llcp_send failed [%d]", result);
        } else {
                DEBUG_ERR_MSG("g_try_new0 failed");
 
@@ -2533,11 +1873,7 @@ net_nfc_error_e net_nfc_server_llcp_simple_send(
        return result;
 }
 
-net_nfc_error_e net_nfc_server_llcp_simple_receive(
-       net_nfc_target_handle_s *handle,
-       net_nfc_llcp_socket_t socket,
-       net_nfc_server_llcp_callback callback,
-       gpointer user_data)
+net_nfc_error_e net_nfc_server_llcp_simple_receive(net_nfc_target_handle_s * handle, net_nfc_llcp_socket_t socket, net_nfc_server_llcp_callback callback, gpointer user_data)
 {
        net_nfc_error_e result;
        LlcpSimpleData *simple_data;
@@ -2549,13 +1885,7 @@ net_nfc_error_e net_nfc_server_llcp_simple_receive(
                simple_data->callback = callback;
                simple_data->user_data = user_data;
 
-               if (net_nfc_controller_llcp_recv(handle,
-                       socket,
-                       net_nfc_server_llcp_get_miu(),
-                       &result,
-                       llcp_simple_receive_cb,
-                       simple_data) == false)
-               {
+               if (net_nfc_controller_llcp_recv(handle, socket, net_nfc_server_llcp_get_miu(), &result, llcp_simple_receive_cb, simple_data) == false) {
                        DEBUG_ERR_MSG("net_nfc_controller_llcp_recv failed [%d]", result);
 
                        g_free(simple_data);
@@ -2572,15 +1902,13 @@ net_nfc_error_e net_nfc_server_llcp_simple_receive(
        return result;
 }
 
-typedef struct _service_t
-{
+typedef struct _service_t {
        uint32_t sap;
        char *san;
        char *id;
        net_nfc_server_llcp_activate_cb cb;
        void *user_data;
-}
-service_t;
+} service_t;
 
 static GHashTable *service_table;
 
@@ -2590,14 +1918,12 @@ static void _llcp_init()
                service_table = g_hash_table_new(NULL, NULL);
 }
 
-inline static service_t *_llcp_find_service(uint32_t sap)
+static inline service_t *_llcp_find_service(uint32_t sap)
 {
-       return (service_t *)g_hash_table_lookup(service_table,
-               (gconstpointer)sap);
+       return (service_t *) g_hash_table_lookup(service_table, (gconstpointer) sap);
 }
 
-static net_nfc_error_e _llcp_add_service(const char *id, uint32_t sap,
-       const char *san, net_nfc_server_llcp_activate_cb cb, void *user_data)
+static net_nfc_error_e _llcp_add_service(const char *id, uint32_t sap, const char *san, net_nfc_server_llcp_activate_cb cb, void *user_data)
 {
        service_t *service = NULL;
        net_nfc_error_e result;
@@ -2616,17 +1942,14 @@ static net_nfc_error_e _llcp_add_service(const char *id, uint32_t sap,
                service = g_try_new0(service_t, 1);
                if (service != NULL) {
                        service->sap = sap;
-                       if (san != NULL && strlen(san) > 0) {
+                       if (san != NULL && strlen(san) > 0)
                                service->san = g_strdup(san);
-                       }
-                       if (id != NULL && strlen(id) > 0) {
+                       if (id != NULL && strlen(id) > 0)
                                service->id = g_strdup(id);
-                       }
                        service->cb = cb;
                        service->user_data = user_data;
 
-                       g_hash_table_insert(service_table, (gpointer)sap,
-                               (gpointer)service);
+                       g_hash_table_insert(service_table, (gpointer) sap, (gpointer) service);
 
                        result = NET_NFC_OK;
                } else {
@@ -2653,7 +1976,7 @@ static void _llcp_remove_service(uint32_t sap)
                g_free(service->id);
                g_free(service);
 
-               g_hash_table_remove(service_table, (gconstpointer)sap);
+               g_hash_table_remove(service_table, (gconstpointer) sap);
        }
 }
 
@@ -2666,9 +1989,9 @@ static void _llcp_remove_services(const char *id)
        if (service_table == NULL)
                return;
 
-       g_hash_table_iter_init (&iter, service_table);
+       g_hash_table_iter_init(&iter, service_table);
 
-       while (g_hash_table_iter_next (&iter, &key, (gpointer)&service)) {
+       while (g_hash_table_iter_next(&iter, &key, (gpointer) & service)) {
                if (id == NULL || strcmp(service->id, id) == 0) {
                        g_free(service->san);
                        g_free(service->id);
@@ -2679,34 +2002,26 @@ static void _llcp_remove_services(const char *id)
        }
 }
 
-static void _llcp_start_services_cb(gpointer key, gpointer value,
-       gpointer user_data)
+static void _llcp_start_services_cb(gpointer key, gpointer value, gpointer user_data)
 {
-       service_t *service = (service_t *)value;
+       service_t *service = (service_t *) value;
 
        /* TODO : start service */
-       if (service != NULL && service->cb != NULL) {
-               service->cb(NET_NFC_LLCP_START,
-                       (net_nfc_target_handle_s *)user_data,
-                       service->sap,
-                       service->san, service->user_data);
-       }
+       if (service != NULL && service->cb != NULL)
+               service->cb(NET_NFC_LLCP_START, (net_nfc_target_handle_s *) user_data, service->sap, service->san, service->user_data);
 }
 
-static void _llcp_start_services(net_nfc_target_handle_s *handle)
+static void _llcp_start_services(net_nfc_target_handle_s * handle)
 {
        g_hash_table_foreach(service_table, _llcp_start_services_cb, handle);
 }
 
-net_nfc_error_e net_nfc_server_llcp_register_service(const char *id,
-       sap_t sap, const char *san, net_nfc_server_llcp_activate_cb cb,
-       void *user_param)
+net_nfc_error_e net_nfc_server_llcp_register_service(const char *id, sap_t sap, const char *san, net_nfc_server_llcp_activate_cb cb, void *user_param)
 {
        return _llcp_add_service(id, sap, san, cb, user_param);
 }
 
-net_nfc_error_e net_nfc_server_llcp_unregister_service(const char *id,
-       sap_t sap, const char *san)
+net_nfc_error_e net_nfc_server_llcp_unregister_service(const char *id, sap_t sap, const char *san)
 {
        net_nfc_error_e result;
        service_t *service;
@@ -2714,8 +2029,7 @@ net_nfc_error_e net_nfc_server_llcp_unregister_service(const char *id,
        service = _llcp_find_service(sap);
        if (service != NULL) {
                /* invoke callback */
-               service->cb(NET_NFC_LLCP_UNREGISTERED, NULL, service->sap,
-                       service->san, service->user_data);
+               service->cb(NET_NFC_LLCP_UNREGISTERED, NULL, service->sap, service->san, service->user_data);
 
                _llcp_remove_service(sap);
 
@@ -2747,9 +2061,8 @@ net_nfc_error_e net_nfc_server_llcp_unregister_all()
 
        g_hash_table_iter_init(&iter, service_table);
 
-       while (g_hash_table_iter_next(&iter, &key, (gpointer)&service)) {
-               service->cb(NET_NFC_LLCP_UNREGISTERED, NULL, service->sap,
-                       service->san, service->user_data);
+       while (g_hash_table_iter_next(&iter, &key, (gpointer) & service)) {
+               service->cb(NET_NFC_LLCP_UNREGISTERED, NULL, service->sap, service->san, service->user_data);
 
                g_free(service->san);
                g_free(service->id);
@@ -2761,8 +2074,7 @@ net_nfc_error_e net_nfc_server_llcp_unregister_all()
        return NET_NFC_OK;
 }
 
-net_nfc_error_e net_nfc_server_llcp_start_registered_services(
-       net_nfc_target_handle_s *handle)
+net_nfc_error_e net_nfc_server_llcp_start_registered_services(net_nfc_target_handle_s * handle)
 {
        _llcp_start_services(handle);
 
@@ -2776,7 +2088,7 @@ static void net_nfc_server_llcp_process(gpointer user_data)
        net_nfc_target_type_e dev_type;
        net_nfc_target_handle_s *handle;
 
-       net_nfc_server_set_target_info((net_nfc_current_target_info_s *)user_data);
+       net_nfc_server_set_target_info((net_nfc_current_target_info_s *) user_data);
 
        g_free(user_data);
 
@@ -2788,24 +2100,14 @@ static void net_nfc_server_llcp_process(gpointer user_data)
        dev_type = target->devType;
 
        DEBUG_SERVER_MSG("connection type = [%d]", handle->connection_type);
-       if (dev_type == NET_NFC_NFCIP1_TARGET)
-       {
+       if (dev_type == NET_NFC_NFCIP1_TARGET) {
                DEBUG_SERVER_MSG("LLCP : target, try to connect");
 
-               if (net_nfc_controller_connect(handle, &result) == false)
-               {
-                       DEBUG_SERVER_MSG("%s is failed, [%d]",
-                                       "net_nfc_controller_connect",
-                                       result);
-
-                       if (net_nfc_controller_configure_discovery(
-                                       NET_NFC_DISCOVERY_MODE_RESUME,
-                                       NET_NFC_ALL_ENABLE,
-                                       &result) == false)
-                       {
-                               DEBUG_ERR_MSG("%s is failed [%d]",
-                               "net_nfc_controller_configure_discovery",
-                               result);
+               if (net_nfc_controller_connect(handle, &result) == false) {
+                       DEBUG_SERVER_MSG("%s is failed, [%d]", "net_nfc_controller_connect", result);
+
+                       if (net_nfc_controller_configure_discovery(NET_NFC_DISCOVERY_MODE_RESUME, NET_NFC_ALL_ENABLE, &result) == false) {
+                               DEBUG_ERR_MSG("%s is failed [%d]", "net_nfc_controller_configure_discovery", result);
 
                                net_nfc_controller_exception_handler();
                        }
@@ -2816,22 +2118,16 @@ static void net_nfc_server_llcp_process(gpointer user_data)
 
        DEBUG_SERVER_MSG("check LLCP");
 
-       if (net_nfc_controller_llcp_check_llcp(handle, &result) == false)
-       {
-               DEBUG_ERR_MSG("%s is failed [%d]",
-                       "net_nfc_controller_llcp_check_llcp",
-                       result);
+       if (net_nfc_controller_llcp_check_llcp(handle, &result) == false) {
+               DEBUG_ERR_MSG("%s is failed [%d]", "net_nfc_controller_llcp_check_llcp", result);
 
                return;
        }
 
        DEBUG_SERVER_MSG("activate LLCP");
 
-       if (net_nfc_controller_llcp_activate_llcp(handle, &result) == false)
-       {
-               DEBUG_ERR_MSG("%s is failed [%d]",
-                       "net_nfc_controller_llcp_activate_llcp",
-                       result);
+       if (net_nfc_controller_llcp_activate_llcp(handle, &result) == false) {
+               DEBUG_ERR_MSG("%s is failed [%d]", "net_nfc_controller_llcp_activate_llcp", result);
 
                return;
        }
@@ -2842,9 +2138,7 @@ static void net_nfc_server_llcp_process(gpointer user_data)
 
 bool net_nfc_server_llcp_target_detected(void *info)
 {
-       if (net_nfc_server_controller_async_queue_push_force(
-               net_nfc_server_llcp_process, info) == FALSE)
-       {
+       if (net_nfc_server_controller_async_queue_push_force(net_nfc_server_llcp_process, info) == FALSE) {
                DEBUG_ERR_MSG("can not push to controller thread");
                return false;
        }
index 7745d1d..5793153 100755 (executable)
 
 typedef struct _ManagerActivationData ManagerActivationData;
 
-struct _ManagerActivationData
-{
+struct _ManagerActivationData {
        NetNfcGDbusManager *manager;
        GDBusMethodInvocation *invocation;
        gboolean is_active;
 };
 
-
 static NetNfcGDbusManager *manager_skeleton = NULL;
 
 static net_nfc_error_e manager_active(void);
@@ -53,28 +51,18 @@ static net_nfc_error_e manager_deactive(void);
 
 static void manager_handle_active_thread_func(gpointer user_data);
 
-static gboolean manager_handle_set_active(NetNfcGDbusManager *manager,
-                                       GDBusMethodInvocation *invocation,
-                                       gboolean arg_is_active,
-                                       GVariant *smack_privilege,
-                                       gpointer user_data);
-
-static gboolean manager_handle_get_server_state(NetNfcGDbusManager *manager,
-                                       GDBusMethodInvocation *invocation,
-                                       GVariant *smack_privilege,
-                                       gpointer user_data);
+static gboolean manager_handle_set_active(NetNfcGDbusManager * manager, GDBusMethodInvocation * invocation, gboolean arg_is_active, GVariant * smack_privilege, gpointer user_data);
 
+static gboolean manager_handle_get_server_state(NetNfcGDbusManager * manager, GDBusMethodInvocation * invocation, GVariant * smack_privilege, gpointer user_data);
 
 static void manager_active_thread_func(gpointer user_data);
 
-
 /* reimplementation of net_nfc_service_init()*/
 static net_nfc_error_e manager_active(void)
 {
        net_nfc_error_e result;
 
-       if (net_nfc_controller_is_ready(&result) == false)
-       {
+       if (net_nfc_controller_is_ready(&result) == false) {
                DEBUG_ERR_MSG("net_nfc_controller_is_ready failed [%d]", result);
 
                return result;
@@ -99,23 +87,16 @@ static net_nfc_error_e manager_active(void)
        net_nfc_server_route_table_do_update(true);
 
        /* current comsume issue for card only model */
-       net_nfc_controller_set_screen_state(NET_NFC_SCREEN_OFF , &result);
+       net_nfc_controller_set_screen_state(NET_NFC_SCREEN_OFF, &result);
 
-       if (net_nfc_controller_configure_discovery(
-                               NET_NFC_DISCOVERY_MODE_START,
-                               NET_NFC_ALL_ENABLE,
-                               &result) == true)
-       {
+       if (net_nfc_controller_configure_discovery(NET_NFC_DISCOVERY_MODE_START, NET_NFC_ALL_ENABLE, &result) == true) {
                /* vconf on */
-               if (vconf_set_bool(VCONFKEY_NFC_STATE, TRUE) != 0)
-               {
+               if (vconf_set_bool(VCONFKEY_NFC_STATE, TRUE) != 0) {
                        DEBUG_ERR_MSG("vconf_set_bool is failed");
 
                        result = NET_NFC_OPERATION_FAIL;
                }
-       }
-       else
-       {
+       } else {
                DEBUG_ERR_MSG("net_nfc_controller_configure_discovery is failed, [%d]", result);
 
                net_nfc_server_controller_init();
@@ -134,8 +115,7 @@ static net_nfc_error_e manager_deactive(void)
 {
        net_nfc_error_e result;
 
-       if (net_nfc_controller_is_ready(&result) == false)
-       {
+       if (net_nfc_controller_is_ready(&result) == false) {
                DEBUG_ERR_MSG("net_nfc_controller_is_ready failed [%d]", result);
 
                return result;
@@ -144,7 +124,6 @@ static net_nfc_error_e manager_deactive(void)
        /* stop addons */
        net_nfc_addons_deinit();
 
-
        DEBUG_ERR_MSG("net_nfc_addons_deinit success!!!");
 
        /* unregister all services */
@@ -153,21 +132,14 @@ static net_nfc_error_e manager_deactive(void)
        /* keep_SE_select_value do not need to update vconf */
        result = net_nfc_server_se_apply_se_policy(SECURE_ELEMENT_POLICY_INVALID);
 
-       if (net_nfc_controller_configure_discovery(
-                               NET_NFC_DISCOVERY_MODE_STOP,
-                               NET_NFC_ALL_DISABLE,
-                               &result) == TRUE)
-       {
+       if (net_nfc_controller_configure_discovery(NET_NFC_DISCOVERY_MODE_STOP, NET_NFC_ALL_DISABLE, &result) == TRUE) {
                /* vconf off */
-               if (vconf_set_bool(VCONFKEY_NFC_STATE, FALSE) != 0)
-               {
+               if (vconf_set_bool(VCONFKEY_NFC_STATE, FALSE) != 0) {
                        DEBUG_ERR_MSG("vconf_set_bool is failed");
 
                        result = NET_NFC_OPERATION_FAIL;
                }
-       }
-       else
-       {
+       } else {
                DEBUG_ERR_MSG("net_nfc_controller_configure_discovery is failed, [%d]", result);
 
                /* ADD TEMPORARY ABORT FOR DEBUG */
@@ -179,7 +151,7 @@ static net_nfc_error_e manager_deactive(void)
 
 static void manager_handle_active_thread_func(gpointer user_data)
 {
-       ManagerActivationData *data = (ManagerActivationData *)user_data;
+       ManagerActivationData *data = (ManagerActivationData *) user_data;
        net_nfc_error_e result;
 
        g_assert(data != NULL);
@@ -192,22 +164,17 @@ static void manager_handle_active_thread_func(gpointer user_data)
                result = manager_deactive();
 
        if (result == NET_NFC_OK) {
-               INFO_MSG("nfc %s", data->is_active ?
-                       "activated" : "deactivated");
+               INFO_MSG("nfc %s", data->is_active ? "activated" : "deactivated");
 
-               net_nfc_gdbus_manager_emit_activated(data->manager,
-                       data->is_active);
+               net_nfc_gdbus_manager_emit_activated(data->manager, data->is_active);
        } else {
                DEBUG_ERR_MSG("activation change failed, [%d]", result);
        }
 
-       net_nfc_gdbus_manager_complete_set_active(data->manager,
-               data->invocation,
-               result);
+       net_nfc_gdbus_manager_complete_set_active(data->manager, data->invocation, result);
 
        /* shutdown process if it doesn't need */
-       if (result == NET_NFC_OK && data->is_active == false &&
-               net_nfc_server_gdbus_is_server_busy() == false) {
+       if (result == NET_NFC_OK && data->is_active == false && net_nfc_server_gdbus_is_server_busy() == false) {
                DEBUG_ERR_MSG("net_nfc_server_controller_deinit");
                net_nfc_server_controller_deinit();
        }
@@ -218,18 +185,12 @@ static void manager_handle_active_thread_func(gpointer user_data)
        g_free(data);
 }
 
-
-static gboolean manager_handle_set_active(NetNfcGDbusManager *manager,
-                                       GDBusMethodInvocation *invocation,
-                                       gboolean arg_is_active,
-                                       GVariant *smack_privilege,
-                                       gpointer user_data)
+static gboolean manager_handle_set_active(NetNfcGDbusManager * manager, GDBusMethodInvocation * invocation, gboolean arg_is_active, GVariant * smack_privilege, gpointer user_data)
 {
        ManagerActivationData *data = NULL;
        gint result;
 
-       INFO_MSG(">>> REQUEST from [%s]",
-               g_dbus_method_invocation_get_sender(invocation));
+       INFO_MSG(">>> REQUEST from [%s]", g_dbus_method_invocation_get_sender(invocation));
 
        /* check privilege and update client context */
        if (net_nfc_server_gdbus_check_privilege(invocation, NET_NFC_PRIVILEGE_NFC_ADMIN) == false) {
@@ -242,8 +203,7 @@ static gboolean manager_handle_set_active(NetNfcGDbusManager *manager,
        DEBUG_SERVER_MSG("is_active %d", arg_is_active);
 
        data = g_try_new0(ManagerActivationData, 1);
-       if (data == NULL)
-       {
+       if (data == NULL) {
                DEBUG_ERR_MSG("Memory allocation failed");
                result = NET_NFC_ALLOC_FAIL;
 
@@ -254,8 +214,7 @@ static gboolean manager_handle_set_active(NetNfcGDbusManager *manager,
        data->invocation = g_object_ref(invocation);
        data->is_active = arg_is_active;
 
-
-       if (data->is_active == true){
+       if (data->is_active == true) {
                net_nfc_error_e check_result;
                INFO_MSG("Daemon alive, But check the nfc device state.");
 
@@ -264,14 +223,11 @@ static gboolean manager_handle_set_active(NetNfcGDbusManager *manager,
                if (check_result != NET_NFC_OK) {
                        INFO_MSG("nfc is not active. so call net_nfc_server_controller_init");
                        net_nfc_server_controller_init();
-               }
-               else
+               } else
                        INFO_MSG("nfc is already active!!!!!!");
        }
 
-       if (net_nfc_server_controller_async_queue_push_and_block(
-               manager_handle_active_thread_func, data) == FALSE)
-       {
+       if (net_nfc_server_controller_async_queue_push_and_block(manager_handle_active_thread_func, data) == FALSE) {
                /* return error if queue was blocked */
                DEBUG_SERVER_MSG("controller is processing important message..");
                result = NET_NFC_BUSY;
@@ -281,7 +237,7 @@ static gboolean manager_handle_set_active(NetNfcGDbusManager *manager,
 
        return TRUE;
 
-ERROR :
+ ERROR:
        if (data != NULL) {
                g_object_unref(data->invocation);
                g_object_unref(data->manager);
@@ -294,16 +250,12 @@ ERROR :
        return TRUE;
 }
 
-static gboolean manager_handle_get_server_state(NetNfcGDbusManager *manager,
-                                       GDBusMethodInvocation *invocation,
-                                       GVariant *smack_privilege,
-                                       gpointer user_data)
+static gboolean manager_handle_get_server_state(NetNfcGDbusManager * manager, GDBusMethodInvocation * invocation, GVariant * smack_privilege, gpointer user_data)
 {
        gint result = NET_NFC_OK;
        guint32 state = NET_NFC_SERVER_IDLE;
 
-       INFO_MSG(">>> REQUEST from [%s]",
-               g_dbus_method_invocation_get_sender(invocation));
+       INFO_MSG(">>> REQUEST from [%s]", g_dbus_method_invocation_get_sender(invocation));
 
        /* check privilege and update client context */
        if (net_nfc_server_gdbus_check_privilege(invocation, NET_NFC_PRIVILEGE_NFC_ADMIN) == false) {
@@ -315,11 +267,8 @@ static gboolean manager_handle_get_server_state(NetNfcGDbusManager *manager,
 
        state = net_nfc_server_get_state();
 
-END :
-       net_nfc_gdbus_manager_complete_get_server_state(manager,
-                                               invocation,
-                                               result,
-                                               state);
+ END:
+       net_nfc_gdbus_manager_complete_get_server_state(manager, invocation, result, state);
 
        return TRUE;
 }
@@ -327,8 +276,7 @@ END :
 /* server side */
 static void manager_active_thread_func(gpointer user_data)
 {
-       ManagerActivationData *data =
-               (ManagerActivationData *)user_data;
+       ManagerActivationData *data = (ManagerActivationData *) user_data;
        net_nfc_error_e result;
 
        g_assert(data != NULL);
@@ -337,16 +285,11 @@ static void manager_active_thread_func(gpointer user_data)
                result = manager_active();
        else
                result = manager_deactive();
-       if (result == NET_NFC_OK)
-       {
-               INFO_MSG("nfc %s", data->is_active ?
-                       "activated" : "deactivated");
+       if (result == NET_NFC_OK) {
+               INFO_MSG("nfc %s", data->is_active ? "activated" : "deactivated");
 
-               net_nfc_gdbus_manager_emit_activated(data->manager,
-                       data->is_active);
-       }
-       else
-       {
+               net_nfc_gdbus_manager_emit_activated(data->manager, data->is_active);
+       } else {
                DEBUG_ERR_MSG("activation change failed, [%d]", result);
        }
 
@@ -354,8 +297,7 @@ static void manager_active_thread_func(gpointer user_data)
        if (result == NET_NFC_OK && data->is_active == false) {
                DEBUG_ERR_MSG("net_nfc_server_controller_deinit");
 
-               if (net_nfc_controller_deinit() == false)
-               {
+               if (net_nfc_controller_deinit() == false) {
                        DEBUG_ERR_MSG("net_nfc_controller_deinit failed");
 
                        /* ADD TEMPORARY ABORT FOR DEBUG */
@@ -368,7 +310,7 @@ static void manager_active_thread_func(gpointer user_data)
        g_free(data);
 }
 
-gboolean net_nfc_server_manager_init(GDBusConnection *connection)
+gboolean net_nfc_server_manager_init(GDBusConnection * connection)
 {
        GError *error = NULL;
 
@@ -377,22 +319,11 @@ gboolean net_nfc_server_manager_init(GDBusConnection *connection)
 
        manager_skeleton = net_nfc_gdbus_manager_skeleton_new();
 
-       g_signal_connect(manager_skeleton,
-                       "handle-set-active",
-                       G_CALLBACK(manager_handle_set_active),
-                       NULL);
-
-       g_signal_connect(manager_skeleton,
-                       "handle-get-server-state",
-                       G_CALLBACK(manager_handle_get_server_state),
-                       NULL);
-
-       if (g_dbus_interface_skeleton_export(
-                               G_DBUS_INTERFACE_SKELETON(manager_skeleton),
-                               connection,
-                               "/org/tizen/NetNfcService/Manager",
-                               &error) == FALSE)
-       {
+       g_signal_connect(manager_skeleton, "handle-set-active", G_CALLBACK(manager_handle_set_active), NULL);
+
+       g_signal_connect(manager_skeleton, "handle-get-server-state", G_CALLBACK(manager_handle_get_server_state), NULL);
+
+       if (g_dbus_interface_skeleton_export(G_DBUS_INTERFACE_SKELETON(manager_skeleton), connection, "/org/tizen/NetNfcService/Manager", &error) == FALSE) {
                DEBUG_ERR_MSG("Can not skeleton_export %s", error->message);
 
                g_error_free(error);
@@ -407,8 +338,7 @@ gboolean net_nfc_server_manager_init(GDBusConnection *connection)
 
 void net_nfc_server_manager_deinit(void)
 {
-       if (manager_skeleton)
-       {
+       if (manager_skeleton) {
                g_object_unref(manager_skeleton);
                manager_skeleton = NULL;
        }
@@ -419,8 +349,7 @@ void net_nfc_server_manager_set_active(gboolean is_active)
        ManagerActivationData *data;
        net_nfc_error_e result;
 
-       if (manager_skeleton == NULL)
-       {
+       if (manager_skeleton == NULL) {
                DEBUG_ERR_MSG("net_nfc_server_manager is not initialized");
 
                return;
@@ -429,8 +358,7 @@ void net_nfc_server_manager_set_active(gboolean is_active)
        DEBUG_SERVER_MSG("is_active %d", is_active);
 
        data = g_try_new0(ManagerActivationData, 1);
-       if (data == NULL)
-       {
+       if (data == NULL) {
                DEBUG_ERR_MSG("Memory allocation failed");
 
                return;
@@ -439,8 +367,7 @@ void net_nfc_server_manager_set_active(gboolean is_active)
        data->manager = g_object_ref(manager_skeleton);
        data->is_active = is_active;
 
-
-       if (data->is_active == true){
+       if (data->is_active == true) {
                INFO_MSG("Daemon alive, But check the nfc device state.");
 
                net_nfc_controller_is_ready(&result);
@@ -448,16 +375,11 @@ void net_nfc_server_manager_set_active(gboolean is_active)
                if (result != NET_NFC_OK) {
                        INFO_MSG("nfc is not active. so call net_nfc_server_controller_init");
                        net_nfc_server_controller_init();
-               }
-               else
+               } else
                        INFO_MSG("nfc is already active!!!!!!");
        }
 
-
-       if (net_nfc_server_controller_async_queue_push(
-                                       manager_active_thread_func,
-                                       data) == FALSE)
-       {
+       if (net_nfc_server_controller_async_queue_push(manager_active_thread_func, data) == FALSE) {
                DEBUG_ERR_MSG("can not push to controller thread");
 
                g_object_unref(data->manager);
index 97f20d0..318e2de 100755 (executable)
@@ -28,8 +28,7 @@
 
 typedef struct _ReadData ReadData;
 
-struct _ReadData
-{
+struct _ReadData {
        NetNfcGDbusNdef *ndef;
        GDBusMethodInvocation *invocation;
        guint32 handle;
@@ -37,8 +36,7 @@ struct _ReadData
 
 typedef struct _WriteData WriteData;
 
-struct _WriteData
-{
+struct _WriteData {
        NetNfcGDbusNdef *ndef;
        GDBusMethodInvocation *invocation;
        guint32 handle;
@@ -47,8 +45,7 @@ struct _WriteData
 
 typedef struct _MakeReadOnlyData MakeReadOnlyData;
 
-struct _MakeReadOnlyData
-{
+struct _MakeReadOnlyData {
        NetNfcGDbusNdef *ndef;
        GDBusMethodInvocation *invocation;
        guint32 handle;
@@ -56,15 +53,13 @@ struct _MakeReadOnlyData
 
 typedef struct _FormatData FormatData;
 
-struct _FormatData
-{
+struct _FormatData {
        NetNfcGDbusNdef *ndef;
        GDBusMethodInvocation *invocation;
        guint32 handle;
        data_s key;
 };
 
-
 static NetNfcGDbusNdef *ndef_skeleton = NULL;
 
 static void ndef_read_thread_func(gpointer user_data);
@@ -76,32 +71,13 @@ static void ndef_make_read_only_thread_func(gpointer user_data);
 static void ndef_format_thread_func(gpointer user_data);
 
 /* methods */
-static gboolean ndef_handle_read(NetNfcGDbusNdef *ndef,
-                               GDBusMethodInvocation *invocation,
-                               guint32 arg_handle,
-                               GVariant *smack_privilege,
-                               gpointer user_data);
-
-static gboolean ndef_handle_write(NetNfcGDbusNdef *ndef,
-                               GDBusMethodInvocation *invocation,
-                               guint32 arg_handle,
-                               GVariant *arg_data,
-                               GVariant *smack_privilege,
-                               gpointer user_data);
-
-static gboolean ndef_handle_make_read_only(NetNfcGDbusNdef *ndef,
-                                       GDBusMethodInvocation *invocation,
-                                       guint32 arg_handle,
-                                       GVariant *smack_privilege,
-                                       gpointer user_data);
-
-static gboolean ndef_handle_format(NetNfcGDbusNdef *ndef,
-                               GDBusMethodInvocation *invocation,
-                               guint32 arg_handle,
-                               GVariant *arg_key,
-                               GVariant *smack_privilege,
-                               gpointer user_data);
+static gboolean ndef_handle_read(NetNfcGDbusNdef * ndef, GDBusMethodInvocation * invocation, guint32 arg_handle, GVariant * smack_privilege, gpointer user_data);
+
+static gboolean ndef_handle_write(NetNfcGDbusNdef * ndef, GDBusMethodInvocation * invocation, guint32 arg_handle, GVariant * arg_data, GVariant * smack_privilege, gpointer user_data);
+
+static gboolean ndef_handle_make_read_only(NetNfcGDbusNdef * ndef, GDBusMethodInvocation * invocation, guint32 arg_handle, GVariant * smack_privilege, gpointer user_data);
 
+static gboolean ndef_handle_format(NetNfcGDbusNdef * ndef, GDBusMethodInvocation * invocation, guint32 arg_handle, GVariant * arg_key, GVariant * smack_privilege, gpointer user_data);
 
 static void ndef_read_thread_func(gpointer user_data)
 {
@@ -125,14 +101,10 @@ static void ndef_read_thread_func(gpointer user_data)
 
        data_variant = net_nfc_util_gdbus_data_to_variant(read_data);
 
-       net_nfc_gdbus_ndef_complete_read(data->ndef,
-                                       data->invocation,
-                                       (gint)result,
-                                       data_variant);
+       net_nfc_gdbus_ndef_complete_read(data->ndef, data->invocation, (gint) result, data_variant);
 
-       if (read_data) {
+       if (read_data)
                net_nfc_util_free_data(read_data);
-       }
 
        g_object_unref(data->invocation);
        g_object_unref(data->ndef);
@@ -158,9 +130,7 @@ static void ndef_write_thread_func(gpointer user_data)
                result = NET_NFC_TARGET_IS_MOVED_AWAY;
        }
 
-       net_nfc_gdbus_ndef_complete_write(data->ndef,
-               data->invocation,
-               (gint)result);
+       net_nfc_gdbus_ndef_complete_write(data->ndef, data->invocation, (gint) result);
 
        net_nfc_util_clear_data(&data->data);
 
@@ -188,9 +158,7 @@ static void ndef_make_read_only_thread_func(gpointer user_data)
                result = NET_NFC_TARGET_IS_MOVED_AWAY;
        }
 
-       net_nfc_gdbus_ndef_complete_make_read_only(data->ndef,
-               data->invocation,
-               (gint)result);
+       net_nfc_gdbus_ndef_complete_make_read_only(data->ndef, data->invocation, (gint) result);
 
        g_object_unref(data->invocation);
        g_object_unref(data->ndef);
@@ -216,9 +184,7 @@ static void ndef_format_thread_func(gpointer user_data)
                result = NET_NFC_TARGET_IS_MOVED_AWAY;
        }
 
-       net_nfc_gdbus_ndef_complete_format(data->ndef,
-               data->invocation,
-               (gint)result);
+       net_nfc_gdbus_ndef_complete_format(data->ndef, data->invocation, (gint) result);
 
        net_nfc_util_clear_data(&data->key);
 
@@ -228,17 +194,12 @@ static void ndef_format_thread_func(gpointer user_data)
        g_free(data);
 }
 
-static gboolean ndef_handle_read(NetNfcGDbusNdef *ndef,
-                               GDBusMethodInvocation *invocation,
-                               guint32 arg_handle,
-                               GVariant *smack_privilege,
-                               gpointer user_data)
+static gboolean ndef_handle_read(NetNfcGDbusNdef * ndef, GDBusMethodInvocation * invocation, guint32 arg_handle, GVariant * smack_privilege, gpointer user_data)
 {
        ReadData *data = NULL;
        gint result;
 
-       INFO_MSG(">>> REQUEST from [%s]",
-               g_dbus_method_invocation_get_sender(invocation));
+       INFO_MSG(">>> REQUEST from [%s]", g_dbus_method_invocation_get_sender(invocation));
 
        /* check privilege and update client context */
        if (net_nfc_server_gdbus_check_privilege(invocation, NET_NFC_PRIVILEGE_NFC_TAG) == false) {
@@ -249,8 +210,7 @@ static gboolean ndef_handle_read(NetNfcGDbusNdef *ndef,
        }
 
        data = g_new0(ReadData, 1);
-       if (data == NULL)
-       {
+       if (data == NULL) {
                DEBUG_ERR_MSG("Memory allocation failed");
                result = NET_NFC_ALLOC_FAIL;
 
@@ -261,9 +221,7 @@ static gboolean ndef_handle_read(NetNfcGDbusNdef *ndef,
        data->invocation = g_object_ref(invocation);
        data->handle = arg_handle;
 
-       if (net_nfc_server_controller_async_queue_push(
-               ndef_read_thread_func, data) == FALSE)
-       {
+       if (net_nfc_server_controller_async_queue_push(ndef_read_thread_func, data) == FALSE) {
                /* return error if queue was blocked */
                DEBUG_SERVER_MSG("controller is processing important message..");
                result = NET_NFC_BUSY;
@@ -273,7 +231,7 @@ static gboolean ndef_handle_read(NetNfcGDbusNdef *ndef,
 
        return TRUE;
 
-ERROR :
+ ERROR:
        if (data != NULL) {
                g_object_unref(data->invocation);
                g_object_unref(data->ndef);
@@ -281,24 +239,17 @@ ERROR :
                g_free(data);
        }
 
-       net_nfc_gdbus_ndef_complete_read(ndef, invocation, result,
-               net_nfc_util_gdbus_buffer_to_variant(NULL, 0));
+       net_nfc_gdbus_ndef_complete_read(ndef, invocation, result, net_nfc_util_gdbus_buffer_to_variant(NULL, 0));
 
        return TRUE;
 }
 
-static gboolean ndef_handle_write(NetNfcGDbusNdef *ndef,
-                               GDBusMethodInvocation *invocation,
-                               guint32 arg_handle,
-                               GVariant *arg_data,
-                               GVariant *smack_privilege,
-                               gpointer user_data)
+static gboolean ndef_handle_write(NetNfcGDbusNdef * ndef, GDBusMethodInvocation * invocation, guint32 arg_handle, GVariant * arg_data, GVariant * smack_privilege, gpointer user_data)
 {
        WriteData *data = NULL;
        gint result;
 
-       INFO_MSG(">>> REQUEST from [%s]",
-               g_dbus_method_invocation_get_sender(invocation));
+       INFO_MSG(">>> REQUEST from [%s]", g_dbus_method_invocation_get_sender(invocation));
 
        /* check privilege and update client context */
        if (net_nfc_server_gdbus_check_privilege(invocation, NET_NFC_PRIVILEGE_NFC_TAG) == false) {
@@ -309,8 +260,7 @@ static gboolean ndef_handle_write(NetNfcGDbusNdef *ndef,
        }
 
        data = g_new0(WriteData, 1);
-       if (data == NULL)
-       {
+       if (data == NULL) {
                DEBUG_ERR_MSG("Memory allocation failed");
                result = NET_NFC_ALLOC_FAIL;
 
@@ -323,9 +273,7 @@ static gboolean ndef_handle_write(NetNfcGDbusNdef *ndef,
 
        net_nfc_util_gdbus_variant_to_data_s(arg_data, &data->data);
 
-       if (net_nfc_server_controller_async_queue_push(
-               ndef_write_thread_func, data) == FALSE)
-       {
+       if (net_nfc_server_controller_async_queue_push(ndef_write_thread_func, data) == FALSE) {
                /* return error if queue was blocked */
                DEBUG_SERVER_MSG("controller is processing important message..");
                result = NET_NFC_BUSY;
@@ -335,7 +283,7 @@ static gboolean ndef_handle_write(NetNfcGDbusNdef *ndef,
 
        return TRUE;
 
-ERROR :
+ ERROR:
        if (data != NULL) {
                net_nfc_util_clear_data(&data->data);
 
@@ -350,20 +298,15 @@ ERROR :
        return TRUE;
 }
 
-static gboolean ndef_handle_make_read_only(NetNfcGDbusNdef *ndef,
-                                       GDBusMethodInvocation *invocation,
-                                       guint32 arg_handle,
-                                       GVariant *smack_privilege,
-                                       gpointer user_data)
+static gboolean ndef_handle_make_read_only(NetNfcGDbusNdef * ndef, GDBusMethodInvocation * invocation, guint32 arg_handle, GVariant * smack_privilege, gpointer user_data)
 {
        MakeReadOnlyData *data = NULL;
        gint result;
 
-       INFO_MSG(">>> REQUEST from [%s]",
-               g_dbus_method_invocation_get_sender(invocation));
+       INFO_MSG(">>> REQUEST from [%s]", g_dbus_method_invocation_get_sender(invocation));
 
        /* check privilege and update client context */
-       if (net_nfc_server_gdbus_check_privilege(invocation, NET_NFC_PRIVILEGE_NFC_TAG) == false) {
+       if (net_nfc_server_gdbus_check_privilege(invocation, NET_NFC_PRIVILEGE_NFC_TAG) == false) {
                DEBUG_ERR_MSG("permission denied, and finished request");
                result = NET_NFC_PERMISSION_DENIED;
 
@@ -371,8 +314,7 @@ static gboolean ndef_handle_make_read_only(NetNfcGDbusNdef *ndef,
        }
 
        data = g_new0(MakeReadOnlyData, 1);
-       if (data == NULL)
-       {
+       if (data == NULL) {
                DEBUG_ERR_MSG("Memory allocation failed");
                result = NET_NFC_ALLOC_FAIL;
 
@@ -383,9 +325,7 @@ static gboolean ndef_handle_make_read_only(NetNfcGDbusNdef *ndef,
        data->invocation = g_object_ref(invocation);
        data->handle = arg_handle;
 
-       if (net_nfc_server_controller_async_queue_push(
-               ndef_make_read_only_thread_func, data) == FALSE)
-       {
+       if (net_nfc_server_controller_async_queue_push(ndef_make_read_only_thread_func, data) == FALSE) {
                /* return error if queue was blocked */
                DEBUG_SERVER_MSG("controller is processing important message..");
                result = NET_NFC_BUSY;
@@ -395,7 +335,7 @@ static gboolean ndef_handle_make_read_only(NetNfcGDbusNdef *ndef,
 
        return TRUE;
 
-ERROR :
+ ERROR:
        if (data != NULL) {
                g_object_unref(data->invocation);
                g_object_unref(data->ndef);
@@ -408,18 +348,12 @@ ERROR :
        return TRUE;
 }
 
-static gboolean ndef_handle_format(NetNfcGDbusNdef *ndef,
-                               GDBusMethodInvocation *invocation,
-                               guint32 arg_handle,
-                               GVariant *arg_key,
-                               GVariant *smack_privilege,
-                               gpointer user_data)
+static gboolean ndef_handle_format(NetNfcGDbusNdef * ndef, GDBusMethodInvocation * invocation, guint32 arg_handle, GVariant * arg_key, GVariant * smack_privilege, gpointer user_data)
 {
        FormatData *data = NULL;
        gint result;
 
-       INFO_MSG(">>> REQUEST from [%s]",
-               g_dbus_method_invocation_get_sender(invocation));
+       INFO_MSG(">>> REQUEST from [%s]", g_dbus_method_invocation_get_sender(invocation));
 
        /* check privilege and update client context */
        if (net_nfc_server_gdbus_check_privilege(invocation, NET_NFC_PRIVILEGE_NFC_TAG) == false) {
@@ -430,8 +364,7 @@ static gboolean ndef_handle_format(NetNfcGDbusNdef *ndef,
        }
 
        data = g_new0(FormatData, 1);
-       if (data == NULL)
-       {
+       if (data == NULL) {
                DEBUG_ERR_MSG("Memory allocation failed");
                result = NET_NFC_ALLOC_FAIL;
 
@@ -443,9 +376,7 @@ static gboolean ndef_handle_format(NetNfcGDbusNdef *ndef,
        data->handle = arg_handle;
        net_nfc_util_gdbus_variant_to_data_s(arg_key, &data->key);
 
-       if (net_nfc_server_controller_async_queue_push(
-               ndef_format_thread_func, data) == FALSE)
-       {
+       if (net_nfc_server_controller_async_queue_push(ndef_format_thread_func, data) == FALSE) {
                /* return error if queue was blocked */
                DEBUG_SERVER_MSG("controller is processing important message..");
                result = NET_NFC_BUSY;
@@ -455,7 +386,7 @@ static gboolean ndef_handle_format(NetNfcGDbusNdef *ndef,
 
        return TRUE;
 
-ERROR :
+ ERROR:
        if (data != NULL) {
                net_nfc_util_clear_data(&data->key);
 
@@ -470,7 +401,7 @@ ERROR :
        return TRUE;
 }
 
-gboolean net_nfc_server_ndef_init(GDBusConnection *connection)
+gboolean net_nfc_server_ndef_init(GDBusConnection * connection)
 {
        gboolean result;
        GError *error = NULL;
@@ -480,33 +411,16 @@ gboolean net_nfc_server_ndef_init(GDBusConnection *connection)
 
        ndef_skeleton = net_nfc_gdbus_ndef_skeleton_new();
 
-       g_signal_connect(ndef_skeleton,
-                       "handle-read",
-                       G_CALLBACK(ndef_handle_read),
-                       NULL);
-
-       g_signal_connect(ndef_skeleton,
-                       "handle-write",
-                       G_CALLBACK(ndef_handle_write),
-                       NULL);
-
-       g_signal_connect(ndef_skeleton,
-                       "handle-make-read-only",
-                       G_CALLBACK(ndef_handle_make_read_only),
-                       NULL);
-
-       g_signal_connect(ndef_skeleton,
-                       "handle-format",
-                       G_CALLBACK(ndef_handle_format),
-                       NULL);
-
-       result = g_dbus_interface_skeleton_export(
-               G_DBUS_INTERFACE_SKELETON(ndef_skeleton),
-               connection,
-               "/org/tizen/NetNfcService/Ndef",
-               &error);
-       if (result == FALSE)
-       {
+       g_signal_connect(ndef_skeleton, "handle-read", G_CALLBACK(ndef_handle_read), NULL);
+
+       g_signal_connect(ndef_skeleton, "handle-write", G_CALLBACK(ndef_handle_write), NULL);
+
+       g_signal_connect(ndef_skeleton, "handle-make-read-only", G_CALLBACK(ndef_handle_make_read_only), NULL);
+
+       g_signal_connect(ndef_skeleton, "handle-format", G_CALLBACK(ndef_handle_format), NULL);
+
+       result = g_dbus_interface_skeleton_export(G_DBUS_INTERFACE_SKELETON(ndef_skeleton), connection, "/org/tizen/NetNfcService/Ndef", &error);
+       if (result == FALSE) {
                g_error_free(error);
 
                net_nfc_server_ndef_deinit();
@@ -517,8 +431,7 @@ gboolean net_nfc_server_ndef_init(GDBusConnection *connection)
 
 void net_nfc_server_ndef_deinit(void)
 {
-       if (ndef_skeleton)
-       {
+       if (ndef_skeleton) {
                g_object_unref(ndef_skeleton);
                ndef_skeleton = NULL;
        }
index eb7ce85..faaf0d6 100755 (executable)
 #include "net_nfc_server_process_snep.h"
 #include "net_nfc_server_p2p.h"
 
-
 typedef struct _P2pSendData P2pSendData;
 
-struct _P2pSendData
-{
+struct _P2pSendData {
        NetNfcGDbusP2p *p2p;
        GDBusMethodInvocation *invocation;
        gint32 type;
@@ -40,19 +38,13 @@ struct _P2pSendData
 
 static void p2p_send_data_thread_func(gpointer user_data);
 
-static gboolean p2p_handle_send(NetNfcGDbusP2p *p2p,
-                               GDBusMethodInvocation *invocation,
-                               gint32 arg_type,
-                               GVariant *arg_data,
-                               guint32 handle,
-                               GVariant *smack_privilege,
-                               gpointer user_data);
+static gboolean p2p_handle_send(NetNfcGDbusP2p * p2p, GDBusMethodInvocation * invocation, gint32 arg_type, GVariant * arg_data, guint32 handle, GVariant * smack_privilege, gpointer user_data);
 
 static NetNfcGDbusP2p *p2p_skeleton = NULL;
 
 static void p2p_send_data_thread_func(gpointer user_data)
 {
-       P2pSendData *p2p_data = (P2pSendData *)user_data;
+       P2pSendData *p2p_data = (P2pSendData *) user_data;
        net_nfc_error_e result;
        net_nfc_target_handle_s *handle;
 
@@ -63,9 +55,7 @@ static void p2p_send_data_thread_func(gpointer user_data)
        handle = GUINT_TO_POINTER(p2p_data->p2p_handle);
 
 #if TIZEN_EMULATOR
-       net_nfc_gdbus_p2p_complete_send(p2p_data->p2p,
-               p2p_data->invocation,
-               NET_NFC_OK);
+       net_nfc_gdbus_p2p_complete_send(p2p_data->p2p, p2p_data->invocation, NET_NFC_OK);
        net_nfc_util_clear_data(&p2p_data->data);
 
        g_object_unref(p2p_data->invocation);
@@ -73,17 +63,9 @@ static void p2p_send_data_thread_func(gpointer user_data)
 
        g_free(p2p_data);
 #else
-       result = net_nfc_server_snep_default_client_start(
-               handle,
-               SNEP_REQ_PUT,
-               &p2p_data->data,
-               -1,
-               p2p_data);
-       if (result != NET_NFC_OK)
-       {
-               net_nfc_gdbus_p2p_complete_send(p2p_data->p2p,
-                       p2p_data->invocation,
-                       (gint)result);
+       result = net_nfc_server_snep_default_client_start(handle, SNEP_REQ_PUT, &p2p_data->data, -1, p2p_data);
+       if (result != NET_NFC_OK) {
+               net_nfc_gdbus_p2p_complete_send(p2p_data->p2p, p2p_data->invocation, (gint) result);
 
                net_nfc_util_clear_data(&p2p_data->data);
 
@@ -95,19 +77,12 @@ static void p2p_send_data_thread_func(gpointer user_data)
 #endif
 }
 
-static gboolean p2p_handle_send(NetNfcGDbusP2p *p2p,
-                               GDBusMethodInvocation *invocation,
-                               gint32 arg_type,
-                               GVariant *arg_data,
-                               guint32 handle,
-                               GVariant *smack_privilege,
-                               gpointer user_data)
+static gboolean p2p_handle_send(NetNfcGDbusP2p * p2p, GDBusMethodInvocation * invocation, gint32 arg_type, GVariant * arg_data, guint32 handle, GVariant * smack_privilege, gpointer user_data)
 {
        gint result;
        P2pSendData *data = NULL;
 
-       INFO_MSG(">>> REQUEST from [%s]",
-               g_dbus_method_invocation_get_sender(invocation));
+       INFO_MSG(">>> REQUEST from [%s]", g_dbus_method_invocation_get_sender(invocation));
 
        /* check privilege and update client context */
        if (net_nfc_server_gdbus_check_privilege(invocation, NET_NFC_PRIVILEGE_NFC_P2P) == false) {
@@ -118,8 +93,7 @@ static gboolean p2p_handle_send(NetNfcGDbusP2p *p2p,
        }
 
        data = g_new0(P2pSendData, 1);
-       if(data == NULL)
-       {
+       if (data == NULL) {
                DEBUG_ERR_MSG("Memory allocation failed");
                result = NET_NFC_ALLOC_FAIL;
 
@@ -132,9 +106,7 @@ static gboolean p2p_handle_send(NetNfcGDbusP2p *p2p,
        data->p2p_handle = handle;
        net_nfc_util_gdbus_variant_to_data_s(arg_data, &data->data);
 
-       if (net_nfc_server_controller_async_queue_push(
-               p2p_send_data_thread_func, data) == FALSE)
-       {
+       if (net_nfc_server_controller_async_queue_push(p2p_send_data_thread_func, data) == FALSE) {
                /* return error if queue was blocked */
                DEBUG_SERVER_MSG("controller is processing important message..");
                result = NET_NFC_BUSY;
@@ -144,7 +116,7 @@ static gboolean p2p_handle_send(NetNfcGDbusP2p *p2p,
 
        return TRUE;
 
-ERROR :
+ ERROR:
        if (data != NULL) {
                net_nfc_util_clear_data(&data->data);
 
@@ -159,8 +131,7 @@ ERROR :
        return TRUE;
 }
 
-
-gboolean net_nfc_server_p2p_init(GDBusConnection *connection)
+gboolean net_nfc_server_p2p_init(GDBusConnection * connection)
 {
        gboolean result;
        GError *error = NULL;
@@ -170,18 +141,10 @@ gboolean net_nfc_server_p2p_init(GDBusConnection *connection)
 
        p2p_skeleton = net_nfc_gdbus_p2p_skeleton_new();
 
-       g_signal_connect(p2p_skeleton,
-                       "handle-send",
-                       G_CALLBACK(p2p_handle_send),
-                       NULL);
-
-       result = g_dbus_interface_skeleton_export(
-               G_DBUS_INTERFACE_SKELETON(p2p_skeleton),
-               connection,
-               "/org/tizen/NetNfcService/P2p",
-               &error);
-       if (result == FALSE)
-       {
+       g_signal_connect(p2p_skeleton, "handle-send", G_CALLBACK(p2p_handle_send), NULL);
+
+       result = g_dbus_interface_skeleton_export(G_DBUS_INTERFACE_SKELETON(p2p_skeleton), connection, "/org/tizen/NetNfcService/P2p", &error);
+       if (result == FALSE) {
                g_error_free(error);
 
                net_nfc_server_p2p_deinit();
@@ -192,8 +155,7 @@ gboolean net_nfc_server_p2p_init(GDBusConnection *connection)
 
 void net_nfc_server_p2p_deinit(void)
 {
-       if (p2p_skeleton)
-       {
+       if (p2p_skeleton) {
                g_object_unref(p2p_skeleton);
                p2p_skeleton = NULL;
        }
@@ -207,17 +169,14 @@ void net_nfc_server_p2p_detached(gpointer user_data)
        net_nfc_server_free_target_info();
 
        if (p2p_skeleton != NULL)
-       {
                net_nfc_gdbus_p2p_emit_detached(p2p_skeleton);
-       }
 }
 
 void net_nfc_server_p2p_discovered(net_nfc_target_handle_h handle)
 {
        INFO_MSG("====== p2p target discovered ======");
 
-       if (p2p_skeleton == NULL)
-       {
+       if (p2p_skeleton == NULL) {
                DEBUG_ERR_MSG("p2p_skeleton is not initialized");
 
                return;
@@ -232,32 +191,28 @@ void net_nfc_server_p2p_received(data_h user_data)
 {
        GVariant *arg_data;
 
-       if (p2p_skeleton == NULL)
-       {
+       if (p2p_skeleton == NULL) {
                DEBUG_ERR_MSG("p2p_skeleton is not initialized");
 
                return;
        }
 
-       arg_data = net_nfc_util_gdbus_data_to_variant((data_s *)user_data);
+       arg_data = net_nfc_util_gdbus_data_to_variant((data_s *) user_data);
 
        net_nfc_gdbus_p2p_emit_received(p2p_skeleton, arg_data);
 
        net_nfc_manager_util_play_sound(NET_NFC_TASK_END);
 }
 
-void net_nfc_server_p2p_data_sent(net_nfc_error_e result,
-                               gpointer user_data)
+void net_nfc_server_p2p_data_sent(net_nfc_error_e result, gpointer user_data)
 {
-       P2pSendData *data = (P2pSendData *)user_data;
+       P2pSendData *data = (P2pSendData *) user_data;
 
        g_assert(data != NULL);
        g_assert(data->p2p != NULL);
        g_assert(data->invocation != NULL);
 
-       net_nfc_gdbus_p2p_complete_send(data->p2p,
-               data->invocation,
-               (gint)result);
+       net_nfc_gdbus_p2p_complete_send(data->p2p, data->invocation, (gint) result);
 
        net_nfc_manager_util_play_sound(NET_NFC_TASK_END);
 
index 13fa756..bbf79f7 100755 (executable)
 #include "net_nfc_server_process_snep.h"
 #include "net_nfc_util_gdbus_internal.h"
 
+typedef void (*_create_ch_msg_cb) (net_nfc_error_e result, net_nfc_ch_message_s * msg, void *user_param);
 
-typedef void (*_create_ch_msg_cb)(net_nfc_error_e result,
-       net_nfc_ch_message_s *msg,
-       void *user_param);
-
-typedef struct _net_nfc_handover_context_t
-{
+typedef struct _net_nfc_handover_context_t {
        net_nfc_target_handle_s *handle;
        net_nfc_error_e result;
        net_nfc_llcp_socket_t socket;
@@ -42,8 +38,7 @@ typedef struct _net_nfc_handover_context_t
        data_s data;
        net_nfc_ch_carrier_s *carrier;
        void *user_param;
-}
-net_nfc_handover_context_t;
+} net_nfc_handover_context_t;
 
 #define NET_NFC_CH_CONTEXT net_nfc_target_handle_s *handle;\
                        net_nfc_llcp_socket_t socket;\
@@ -52,117 +47,73 @@ net_nfc_handover_context_t;
                        net_nfc_conn_handover_carrier_type_e type;\
                        void *user_param;
 
-typedef struct _create_config_context_t
-{
+typedef struct _create_config_context_t {
        NET_NFC_CH_CONTEXT;
 
        _create_ch_msg_cb cb;
        net_nfc_conn_handover_carrier_type_e current_type;
        net_nfc_ch_message_s *message;
-       ndef_message_s *requester; /* for low power selector */
-}
-_create_config_context_t;
+       ndef_message_s *requester;      /* for low power selector */
+} _create_config_context_t;
 
-typedef struct _net_nfc_server_handover_process_config_context_t
-{
+typedef struct _net_nfc_server_handover_process_config_context_t {
        NET_NFC_CH_CONTEXT;
 
        net_nfc_server_handover_process_carrier_cb cb;
-}
-_process_config_context_t;
-
-
+} _process_config_context_t;
 
-static void _send_response(net_nfc_error_e result,
-       net_nfc_conn_handover_carrier_type_e carrier,
-       data_h ac_data,
-       void *user_param);
+static void _send_response(net_nfc_error_e result, net_nfc_conn_handover_carrier_type_e carrier, data_h ac_data, void *user_param);
 
-static void _client_process(net_nfc_handover_context_t *context);
+static void _client_process(net_nfc_handover_context_t * context);
 
-static void _client_error_cb(net_nfc_error_e result,
-       net_nfc_target_handle_s *handle,
-       net_nfc_llcp_socket_t socket,
-       data_s *data,
-       void *user_param);
+static void _client_error_cb(net_nfc_error_e result, net_nfc_target_handle_s * handle, net_nfc_llcp_socket_t socket, data_s * data, void *user_param);
 
-static void _client_connected_cb(net_nfc_error_e result,
-       net_nfc_target_handle_s *handle,
-       net_nfc_llcp_socket_t socket,
-       data_s *data,
-       void *user_param);
+static void _client_connected_cb(net_nfc_error_e result, net_nfc_target_handle_s * handle, net_nfc_llcp_socket_t socket, data_s * data, void *user_param);
 
-static void _get_response_process(net_nfc_handover_context_t *context);
+static void _get_response_process(net_nfc_handover_context_t * context);
 
-static net_nfc_error_e _process_requester_carrier(
-       net_nfc_ch_carrier_s *carrier,
-       net_nfc_server_handover_process_carrier_cb cb,
-       void *user_param);
+static net_nfc_error_e _process_requester_carrier(net_nfc_ch_carrier_s * carrier, net_nfc_server_handover_process_carrier_cb cb, void *user_param);
 
-static net_nfc_error_e _process_selector_carrier(
-       net_nfc_ch_carrier_s *carrier,
-       net_nfc_server_handover_process_carrier_cb cb,
-       void *user_param);
+static net_nfc_error_e _process_selector_carrier(net_nfc_ch_carrier_s * carrier, net_nfc_server_handover_process_carrier_cb cb, void *user_param);
 #if 0
-static int _net_nfc_server_handover_append_wifi_carrier_config(
-               _create_config_context_t *context);
+static int _net_nfc_server_handover_append_wifi_carrier_config(_create_config_context_t * context);
 #endif
 
-static net_nfc_error_e _create_requester_from_rawdata(
-       ndef_message_s **requestor, data_s *data);
+static net_nfc_error_e _create_requester_from_rawdata(ndef_message_s ** requestor, data_s * data);
 
-static net_nfc_error_e _create_requester_handover_message(
-       net_nfc_conn_handover_carrier_type_e type,
-       _create_ch_msg_cb cb,
-       void *user_param);
+static net_nfc_error_e _create_requester_handover_message(net_nfc_conn_handover_carrier_type_e type, _create_ch_msg_cb cb, void *user_param);
 
-static bool _check_hr_record_validation(ndef_message_s *message);
+static bool _check_hr_record_validation(ndef_message_s * message);
 
-static bool _check_hs_record_validation(ndef_message_s *message);
+static bool _check_hs_record_validation(ndef_message_s * message);
 
-static net_nfc_error_e _create_selector_handover_message(
-       net_nfc_conn_handover_carrier_type_e type,
-       _create_ch_msg_cb cb,
-       void *user_param);
+static net_nfc_error_e _create_selector_handover_message(net_nfc_conn_handover_carrier_type_e type, _create_ch_msg_cb cb, void *user_param);
 
-static int _iterate_create_carrier_configs(_create_config_context_t *context);
+static int _iterate_create_carrier_configs(_create_config_context_t * context);
 
-static int _iterate_carrier_configs_to_next(_create_config_context_t *context);
+static int _iterate_carrier_configs_to_next(_create_config_context_t * context);
 
-static int _iterate_carrier_configs_step(_create_config_context_t *context);
+static int _iterate_carrier_configs_step(_create_config_context_t * context);
 
-static void _server_process(net_nfc_handover_context_t *context);
+static void _server_process(net_nfc_handover_context_t * context);
 
 #if 0
-static net_nfc_error_e
-_net_nfc_server_handover_create_low_power_selector_message(
-                                       ndef_message_s *request_msg,
-                                       ndef_message_s *select_msg);
+static net_nfc_error_e _net_nfc_server_handover_create_low_power_selector_message(ndef_message_s * request_msg, ndef_message_s * select_msg);
 #endif
 ////////////////////////////////////////////////////////////////////////////
 
-static void _send_response(net_nfc_error_e result,
-       net_nfc_conn_handover_carrier_type_e carrier,
-       data_h ac_data,
-       void *user_param)
+static void _send_response(net_nfc_error_e result, net_nfc_conn_handover_carrier_type_e carrier, data_h ac_data, void *user_param)
 {
-       HandoverRequestData *handover_data = (HandoverRequestData *)user_param;
+       HandoverRequestData *handover_data = (HandoverRequestData *) user_param;
 
        g_assert(handover_data != NULL);
        g_assert(handover_data->invocation != NULL);
        g_assert(handover_data->handoverobj != NULL);
 
-       net_nfc_gdbus_handover_complete_request(
-               handover_data->handoverobj,
-               handover_data->invocation,
-               result,
-               carrier,
-               net_nfc_util_gdbus_data_to_variant(ac_data));
+       net_nfc_gdbus_handover_complete_request(handover_data->handoverobj, handover_data->invocation, result, carrier, net_nfc_util_gdbus_data_to_variant(ac_data));
 
        if (handover_data->data)
-       {
                net_nfc_util_free_data(handover_data->data);
-       }
 
        g_object_unref(handover_data->invocation);
        g_object_unref(handover_data->handoverobj);
@@ -170,139 +121,90 @@ static void _send_response(net_nfc_error_e result,
        g_free(handover_data);
 }
 
-static net_nfc_error_e _convert_ndef_message_to_data(ndef_message_s *msg,
-       data_s *data)
+static net_nfc_error_e _convert_ndef_message_to_data(ndef_message_s * msg, data_s * data)
 {
        net_nfc_error_e result;
        uint32_t length;
 
        if (msg == NULL || data == NULL)
-       {
                return NET_NFC_INVALID_PARAM;
-       }
 
        length = net_nfc_util_get_ndef_message_length(msg);
-       if (length > 0)
-       {
+       if (length > 0) {
                net_nfc_util_init_data(data, length);
                result = net_nfc_util_convert_ndef_message_to_rawdata(msg, data);
-       }
-       else
-       {
+       } else {
                result = NET_NFC_INVALID_PARAM;
        }
 
        return result;
 }
 
-static void _bt_get_carrier_record_cb(net_nfc_error_e result,
-       net_nfc_ch_carrier_s *carrier,
-       void *user_param)
+static void _bt_get_carrier_record_cb(net_nfc_error_e result, net_nfc_ch_carrier_s * carrier, void *user_param)
 {
-       _create_config_context_t *context =
-               (_create_config_context_t *)user_param;
+       _create_config_context_t *context = (_create_config_context_t *) user_param;
 
        /* append record to ndef message */
-       if (result == NET_NFC_OK)
-       {
+       if (result == NET_NFC_OK) {
                net_nfc_ch_carrier_s *temp;
 
                net_nfc_util_duplicate_handover_carrier(&temp, carrier);
 
-               result = net_nfc_util_append_handover_carrier(context->message,
-                       temp);
+               result = net_nfc_util_append_handover_carrier(context->message, temp);
                if (result == NET_NFC_OK)
-               {
                        DEBUG_SERVER_MSG("net_nfc_util_append_carrier_config_record success");
-               }
                else
-               {
-                       DEBUG_ERR_MSG("net_nfc_util_append_carrier_config_record failed [%d]",
-                               result);
-               }
+                       DEBUG_ERR_MSG("net_nfc_util_append_carrier_config_record failed [%d]", result);
 
-               g_idle_add((GSourceFunc)_iterate_carrier_configs_to_next,
-                       (gpointer)context);
+               g_idle_add((GSourceFunc) _iterate_carrier_configs_to_next, (gpointer) context);
        }
 
        /* don't free context */
 }
 
-static void _bt_process_carrier_cb(net_nfc_error_e result,
-       net_nfc_conn_handover_carrier_type_e type,
-       data_s *data,
-       void *user_param)
+static void _bt_process_carrier_cb(net_nfc_error_e result, net_nfc_conn_handover_carrier_type_e type, data_s * data, void *user_param)
 {
-       _process_config_context_t *context =
-               (_process_config_context_t *)user_param;
+       _process_config_context_t *context = (_process_config_context_t *) user_param;
 
-       if (result == NET_NFC_OK)
-       {
+       if (result == NET_NFC_OK) {
                if (context->cb != NULL)
-               {
                        context->cb(result, type, data, context->user_param);
-               }
-       }
-       else
-       {
-               DEBUG_ERR_MSG("_bt_process_carrier_cb failed [%d]",
-                       result);
+       } else {
+               DEBUG_ERR_MSG("_bt_process_carrier_cb failed [%d]", result);
        }
 
        _net_nfc_util_free_mem(context);
 }
 
-static void _wps_process_carrier_cb(net_nfc_error_e result,
-       net_nfc_conn_handover_carrier_type_e type,
-       data_s *data,
-       void *user_param)
+static void _wps_process_carrier_cb(net_nfc_error_e result, net_nfc_conn_handover_carrier_type_e type, data_s * data, void *user_param)
 {
-       _process_config_context_t *context =
-               (_process_config_context_t *)user_param;
+       _process_config_context_t *context = (_process_config_context_t *) user_param;
 
-       if (result == NET_NFC_OK)
-       {
+       if (result == NET_NFC_OK) {
                if (context->cb != NULL)
-               {
                        context->cb(result, type, data, context->user_param);
-               }
-       }
-       else
-       {
-               DEBUG_ERR_MSG("_wps_process_carrier_cb failed [%d]",
-                       result);
+       } else {
+               DEBUG_ERR_MSG("_wps_process_carrier_cb failed [%d]", result);
        }
 
        _net_nfc_util_free_mem(context);
 }
 
-static void _wfd_process_carrier_cb(net_nfc_error_e result,
-       net_nfc_conn_handover_carrier_type_e type,
-       data_s *data,
-       void *user_param)
+static void _wfd_process_carrier_cb(net_nfc_error_e result, net_nfc_conn_handover_carrier_type_e type, data_s * data, void *user_param)
 {
-       _process_config_context_t *context =
-               (_process_config_context_t *)user_param;
+       _process_config_context_t *context = (_process_config_context_t *) user_param;
 
-       if (result == NET_NFC_OK)
-       {
+       if (result == NET_NFC_OK) {
                if (context->cb != NULL)
-               {
                        context->cb(result, type, data, context->user_param);
-               }
-       }
-       else
-       {
-               DEBUG_ERR_MSG("_wfd_process_carrier_cb failed [%d]",
-                       result);
+       } else {
+               DEBUG_ERR_MSG("_wfd_process_carrier_cb failed [%d]", result);
        }
 
        _net_nfc_util_free_mem(context);
 }
 
-static net_nfc_error_e _get_carrier_record_by_priority_order(
-       net_nfc_ch_message_s *request,
-       net_nfc_ch_carrier_s **carrier)
+static net_nfc_error_e _get_carrier_record_by_priority_order(net_nfc_ch_message_s * request, net_nfc_ch_carrier_s ** carrier)
 {
        net_nfc_error_e result;
        unsigned int carrier_count = 0;
@@ -310,38 +212,23 @@ static net_nfc_error_e _get_carrier_record_by_priority_order(
        LOGD("[%s] START", __func__);
 
        if (request == NULL || carrier == NULL)
-       {
                return NET_NFC_NULL_PARAMETER;
-       }
 
        *carrier = NULL;
 
-       result = net_nfc_util_get_handover_carrier_count(request,
-               &carrier_count);
-       if (result == NET_NFC_OK)
-       {
+       result = net_nfc_util_get_handover_carrier_count(request, &carrier_count);
+       if (result == NET_NFC_OK) {
                int idx, priority;
-               net_nfc_conn_handover_carrier_type_e carrier_type =
-                       NET_NFC_CONN_HANDOVER_CARRIER_UNKNOWN;
+               net_nfc_conn_handover_carrier_type_e carrier_type = NET_NFC_CONN_HANDOVER_CARRIER_UNKNOWN;
 
-               for (priority = NET_NFC_CONN_HANDOVER_CARRIER_BT;
-                       *carrier == NULL &&
-                               priority < NET_NFC_CONN_HANDOVER_CARRIER_UNKNOWN;
-                       priority++)
-               {
+               for (priority = NET_NFC_CONN_HANDOVER_CARRIER_BT; *carrier == NULL && priority < NET_NFC_CONN_HANDOVER_CARRIER_UNKNOWN; priority++) {
                        net_nfc_ch_carrier_s *temp;
 
                        /* check each carrier record and create matched record */
-                       for (idx = 0; idx < carrier_count; idx++)
-                       {
-                               net_nfc_util_get_handover_carrier(
-                                       request,
-                                       idx,
-                                       &temp);
-                               net_nfc_util_get_handover_carrier_type(
-                                       temp, &carrier_type);
-                               if (carrier_type == priority)
-                               {
+                       for (idx = 0; idx < carrier_count; idx++) {
+                               net_nfc_util_get_handover_carrier(request, idx, &temp);
+                               net_nfc_util_get_handover_carrier_type(temp, &carrier_type);
+                               if (carrier_type == priority) {
                                        DEBUG_SERVER_MSG("selected carrier type = [%d]", carrier_type);
 
                                        *carrier = temp;
@@ -350,9 +237,7 @@ static net_nfc_error_e _get_carrier_record_by_priority_order(
                                }
                        }
                }
-       }
-       else
-       {
+       } else {
                DEBUG_ERR_MSG("net_nfc_util_get_handover_carrier_count failed, [%d]", result);
        }
 
@@ -361,8 +246,7 @@ static net_nfc_error_e _get_carrier_record_by_priority_order(
        return result;
 }
 
-static net_nfc_error_e _create_requester_from_rawdata(
-       ndef_message_s **requestor, data_s *data)
+static net_nfc_error_e _create_requester_from_rawdata(ndef_message_s ** requestor, data_s * data)
 {
        net_nfc_error_e result;
        ndef_message_s *temp = NULL;
@@ -373,28 +257,20 @@ static net_nfc_error_e _create_requester_from_rawdata(
        *requestor = NULL;
 
        result = net_nfc_util_create_ndef_message(&temp);
-       if (result == NET_NFC_OK)
-       {
-               result = net_nfc_util_convert_rawdata_to_ndef_message(data,
-                       temp);
-               if (result == NET_NFC_OK)
-               {
-                       if (_check_hr_record_validation(temp) == true)
-                       {
+       if (result == NET_NFC_OK) {
+               result = net_nfc_util_convert_rawdata_to_ndef_message(data, temp);
+               if (result == NET_NFC_OK) {
+                       if (_check_hr_record_validation(temp) == true) {
                                *requestor = temp;
 
                                result = NET_NFC_OK;
-                       }
-                       else
-                       {
+                       } else {
                                DEBUG_ERR_MSG("record is not valid or available");
 
                                net_nfc_util_free_ndef_message(temp);
                                result = NET_NFC_INVALID_PARAM;
                        }
-               }
-               else
-               {
+               } else {
                        DEBUG_ERR_MSG("net_nfc_util_convert_rawdata_to_ndef_message failed, [%d]", result);
 
                        net_nfc_util_free_ndef_message(temp);
@@ -406,8 +282,7 @@ static net_nfc_error_e _create_requester_from_rawdata(
        return result;
 }
 
-static net_nfc_error_e _create_selector_from_rawdata(
-       ndef_message_s **selector, data_s *data)
+static net_nfc_error_e _create_selector_from_rawdata(ndef_message_s ** selector, data_s * data)
 {
        net_nfc_error_e result;
        ndef_message_s *temp = NULL;
@@ -418,42 +293,32 @@ static net_nfc_error_e _create_selector_from_rawdata(
        *selector = NULL;
 
        result = net_nfc_util_create_ndef_message(&temp);
-       if (result == NET_NFC_OK)
-       {
-               result = net_nfc_util_convert_rawdata_to_ndef_message(data,
-                       temp);
-               if (result == NET_NFC_OK)
-               {
+       if (result == NET_NFC_OK) {
+               result = net_nfc_util_convert_rawdata_to_ndef_message(data, temp);
+               if (result == NET_NFC_OK) {
                        /* if record is not Hs record, then */
-                       if (_check_hs_record_validation(temp) == true)
-                       {
+                       if (_check_hs_record_validation(temp) == true) {
                                *selector = temp;
                                result = NET_NFC_OK;
-                       }
-                       else
-                       {
+                       } else {
                                DEBUG_ERR_MSG("record is not valid or available");
 
                                net_nfc_util_free_ndef_message(temp);
                                result = NET_NFC_INVALID_PARAM;
                        }
-               }
-               else
-               {
+               } else {
                        DEBUG_ERR_MSG("net_nfc_util_convert_rawdata_to_ndef_message failed [%d]", result);
 
                        net_nfc_util_free_ndef_message(temp);
                }
-       }
-       else
-       {
+       } else {
                DEBUG_ERR_MSG("_net_nfc_util_create_ndef_message failed [%d]", result);
        }
 
        return result;
 }
 
-static bool _check_hr_record_validation(ndef_message_s *message)
+static bool _check_hr_record_validation(ndef_message_s * message)
 {
        unsigned int count;
        net_nfc_ch_message_s *msg = NULL;
@@ -465,9 +330,8 @@ static bool _check_hr_record_validation(ndef_message_s *message)
                return false;
 
        result = net_nfc_util_import_handover_from_ndef_message(message, &msg);
-       if (result != NET_NFC_OK) {
+       if (result != NET_NFC_OK)
                goto ERROR;
-       }
 
        if (msg->version != CH_VERSION) {
                DEBUG_ERR_MSG("connection handover version is not matched");
@@ -493,8 +357,7 @@ static bool _check_hr_record_validation(ndef_message_s *message)
 
        /* check alternative record count */
        result = net_nfc_util_get_handover_carrier_count(msg, &count);
-       if (result != NET_NFC_OK || count == 0)
-       {
+       if (result != NET_NFC_OK || count == 0) {
                DEBUG_ERR_MSG("there is no carrier reference");
                result = NET_NFC_INVALID_PARAM;
 
@@ -507,17 +370,16 @@ static bool _check_hr_record_validation(ndef_message_s *message)
 
        return true;
 
-ERROR :
-       if (msg != NULL) {
+ ERROR:
+       if (msg != NULL)
                net_nfc_util_free_handover_message(msg);
-       }
 
        LOGD("[%s] END", __func__);
 
        return false;
 }
 
-static bool _check_hs_record_validation(ndef_message_s *message)
+static bool _check_hs_record_validation(ndef_message_s * message)
 {
        net_nfc_ch_message_s *msg = NULL;
        net_nfc_error_e result;
@@ -528,9 +390,8 @@ static bool _check_hs_record_validation(ndef_message_s *message)
                return false;
 
        result = net_nfc_util_import_handover_from_ndef_message(message, &msg);
-       if (result != NET_NFC_OK) {
+       if (result != NET_NFC_OK)
                goto ERROR;
-       }
 
        if (msg->version != CH_VERSION) {
                DEBUG_ERR_MSG("connection handover version is not matched");
@@ -552,35 +413,27 @@ static bool _check_hs_record_validation(ndef_message_s *message)
 
        return true;
 
-ERROR :
-       if (msg != NULL) {
+ ERROR:
+       if (msg != NULL)
                net_nfc_util_free_handover_message(msg);
-       }
 
        LOGD("[%s] END", __func__);
 
        return false;
 }
 
-static int _iterate_carrier_configs_step(_create_config_context_t *context)
+static int _iterate_carrier_configs_step(_create_config_context_t * context)
 {
        LOGD("[%s:%d] START", __func__, __LINE__);
 
        if (context == NULL)
-       {
                return 0;
-       }
 
        if (context->cb != NULL)
-       {
-               context->cb(NET_NFC_OK, context->message,
-                       context->user_param);
-       }
+               context->cb(NET_NFC_OK, context->message, context->user_param);
 
        if (context->message != NULL)
-       {
                net_nfc_util_free_handover_message(context->message);
-       }
 
        _net_nfc_util_free_mem(context);
 
@@ -590,41 +443,37 @@ static int _iterate_carrier_configs_step(_create_config_context_t *context)
 }
 
 #if 0
-static int _net_nfc_server_handover_append_wifi_carrier_config(
-       _create_config_context_t *context)
+static int _net_nfc_server_handover_append_wifi_carrier_config(_create_config_context_t * context)
 {
        LOGD("[%s:%d] START", __func__, __LINE__);
 
-       switch (context->step)
-       {
-       case NET_NFC_LLCP_STEP_01 :
+       switch (context->step) {
+       case NET_NFC_LLCP_STEP_01:
                DEBUG_MSG("STEP [1]");
 
                context->step = NET_NFC_LLCP_STEP_02;
                break;
 
-       case NET_NFC_LLCP_STEP_02 :
+       case NET_NFC_LLCP_STEP_02:
                DEBUG_MSG("STEP [2]");
 
                context->step = NET_NFC_LLCP_STEP_03;
                break;
 
-       case NET_NFC_LLCP_STEP_03 :
+       case NET_NFC_LLCP_STEP_03:
                DEBUG_MSG("STEP [3]");
 
                context->step = NET_NFC_LLCP_STEP_RETURN;
                break;
 
-       case NET_NFC_LLCP_STEP_RETURN :
+       case NET_NFC_LLCP_STEP_RETURN:
                DEBUG_MSG("STEP return");
 
                /* complete and return to upper step */
-               g_idle_add(
-               (GSourceFunc)_iterate_carrier_configs_to_next,
-               (gpointer)context);
+               g_idle_add((GSourceFunc) _iterate_carrier_configs_to_next, (gpointer) context);
                break;
 
-       default :
+       default:
                break;
        }
 
@@ -634,73 +483,54 @@ static int _net_nfc_server_handover_append_wifi_carrier_config(
 }
 #endif
 
-static int _iterate_carrier_configs_to_next(_create_config_context_t *context)
+static int _iterate_carrier_configs_to_next(_create_config_context_t * context)
 {
-       if (context->result == NET_NFC_OK || context->result == NET_NFC_BUSY)
-       {
-               if (context->type == NET_NFC_CONN_HANDOVER_CARRIER_UNKNOWN)
-               {
-                       if (context->current_type <
-                                       NET_NFC_CONN_HANDOVER_CARRIER_UNKNOWN)
-                       {
+       if (context->result == NET_NFC_OK || context->result == NET_NFC_BUSY) {
+               if (context->type == NET_NFC_CONN_HANDOVER_CARRIER_UNKNOWN) {
+                       if (context->current_type < NET_NFC_CONN_HANDOVER_CARRIER_UNKNOWN)
                                context->current_type++;
-                       }
-               }
-               else
-               {
-                       context->current_type =
-                                       NET_NFC_CONN_HANDOVER_CARRIER_UNKNOWN;
+               } else {
+                       context->current_type = NET_NFC_CONN_HANDOVER_CARRIER_UNKNOWN;
                }
 
-               g_idle_add((GSourceFunc)_iterate_create_carrier_configs,
-                       (gpointer)context);
-       }
-       else
-       {
+               g_idle_add((GSourceFunc) _iterate_create_carrier_configs, (gpointer) context);
+       } else {
                DEBUG_ERR_MSG("context->result is error [%d]", context->result);
 
-               g_idle_add((GSourceFunc)_iterate_carrier_configs_step,
-                       (gpointer)context);
+               g_idle_add((GSourceFunc) _iterate_carrier_configs_step, (gpointer) context);
        }
 
        return 0;
 }
 
-static int _iterate_create_carrier_configs(_create_config_context_t *context)
+static int _iterate_create_carrier_configs(_create_config_context_t * context)
 {
        LOGD("[%s:%d] START", __func__, __LINE__);
 
-       switch (context->current_type)
-       {
-       case NET_NFC_CONN_HANDOVER_CARRIER_BT :
+       switch (context->current_type) {
+       case NET_NFC_CONN_HANDOVER_CARRIER_BT:
                DEBUG_SERVER_MSG("[NET_NFC_CONN_HANDOVER_CARRIER_BT]");
-               net_nfc_server_handover_bt_get_carrier(
-                       _bt_get_carrier_record_cb,
-                       context);
+               net_nfc_server_handover_bt_get_carrier(_bt_get_carrier_record_cb, context);
                break;
 
-       case NET_NFC_CONN_HANDOVER_CARRIER_WIFI_WPS :
+       case NET_NFC_CONN_HANDOVER_CARRIER_WIFI_WPS:
                DEBUG_SERVER_MSG("[NET_NFC_CONN_HANDOVER_CARRIER_WIFI_WPS]");
-               g_idle_add((GSourceFunc)_iterate_carrier_configs_step,
-                       (gpointer)context);
+               g_idle_add((GSourceFunc) _iterate_carrier_configs_step, (gpointer) context);
                break;
 
-       case NET_NFC_CONN_HANDOVER_CARRIER_WIFI_P2P :
+       case NET_NFC_CONN_HANDOVER_CARRIER_WIFI_P2P:
                DEBUG_SERVER_MSG("[NET_NFC_CONN_HANDOVER_CARRIER_WIFI_P2P]");
-               g_idle_add((GSourceFunc)_iterate_carrier_configs_step,
-                       (gpointer)context);
+               g_idle_add((GSourceFunc) _iterate_carrier_configs_step, (gpointer) context);
                break;
 
-       case NET_NFC_CONN_HANDOVER_CARRIER_UNKNOWN :
+       case NET_NFC_CONN_HANDOVER_CARRIER_UNKNOWN:
                DEBUG_SERVER_MSG("[NET_NFC_CONN_HANDOVER_CARRIER_UNKNOWN]");
-               g_idle_add((GSourceFunc)_iterate_carrier_configs_step,
-                       (gpointer)context);
+               g_idle_add((GSourceFunc) _iterate_carrier_configs_step, (gpointer) context);
                break;
 
-       default :
+       default:
                DEBUG_SERVER_MSG("[unknown : %d]", context->current_type);
-               g_idle_add((GSourceFunc)_iterate_carrier_configs_step,
-                       (gpointer)context);
+               g_idle_add((GSourceFunc) _iterate_carrier_configs_step, (gpointer) context);
                break;
        }
 
@@ -709,10 +539,7 @@ static int _iterate_create_carrier_configs(_create_config_context_t *context)
        return 0;
 }
 
-static net_nfc_error_e _create_requester_handover_message(
-       net_nfc_conn_handover_carrier_type_e type,
-       _create_ch_msg_cb cb,
-       void *user_param)
+static net_nfc_error_e _create_requester_handover_message(net_nfc_conn_handover_carrier_type_e type, _create_ch_msg_cb cb, void *user_param)
 {
        net_nfc_error_e result = NET_NFC_OK;
        _create_config_context_t *context = NULL;
@@ -720,33 +547,26 @@ static net_nfc_error_e _create_requester_handover_message(
        LOGD("[%s:%d] START", __func__, __LINE__);
 
        _net_nfc_util_alloc_mem(context, sizeof(*context));
-       if (context != NULL)
-       {
+       if (context != NULL) {
                context->type = type;
-               if (type == NET_NFC_CONN_HANDOVER_CARRIER_UNKNOWN) {
+               if (type == NET_NFC_CONN_HANDOVER_CARRIER_UNKNOWN)
                        context->current_type = NET_NFC_CONN_HANDOVER_CARRIER_BT;
-               } else {
+               else
                        context->current_type = context->type;
-               }
 
                context->cb = cb;
                context->user_param = user_param;
 
-               result = net_nfc_util_create_handover_message(
-                       &context->message);
+               result = net_nfc_util_create_handover_message(&context->message);
                if (result == NET_NFC_OK) {
-                       net_nfc_util_set_handover_message_type(context->message,
-                               NET_NFC_CH_TYPE_REQUEST);
+                       net_nfc_util_set_handover_message_type(context->message, NET_NFC_CH_TYPE_REQUEST);
 
                        /* append carrier record */
-                       g_idle_add((GSourceFunc)_iterate_create_carrier_configs,
-                               (gpointer)context);
+                       g_idle_add((GSourceFunc) _iterate_create_carrier_configs, (gpointer) context);
                } else {
                        DEBUG_ERR_MSG("net_nfc_util_create_handover_message failed, [%d]", result);
                }
-       }
-       else
-       {
+       } else {
                DEBUG_ERR_MSG("alloc failed");
 
                result = NET_NFC_ALLOC_FAIL;
@@ -757,10 +577,7 @@ static net_nfc_error_e _create_requester_handover_message(
        return result;
 }
 
-static net_nfc_error_e _create_selector_handover_message(
-       net_nfc_conn_handover_carrier_type_e type,
-       _create_ch_msg_cb cb,
-       void *user_param)
+static net_nfc_error_e _create_selector_handover_message(net_nfc_conn_handover_carrier_type_e type, _create_ch_msg_cb cb, void *user_param)
 {
        net_nfc_error_e result = NET_NFC_OK;
        _create_config_context_t *context = NULL;
@@ -768,35 +585,27 @@ static net_nfc_error_e _create_selector_handover_message(
        LOGD("[%s:%d] START", __func__, __LINE__);
 
        _net_nfc_util_alloc_mem(context, sizeof(*context));
-       if (context != NULL)
-       {
+       if (context != NULL) {
                context->type = type;
 
-               if (type == NET_NFC_CONN_HANDOVER_CARRIER_UNKNOWN) {
-                       context->current_type =
-                               NET_NFC_CONN_HANDOVER_CARRIER_BT;
-               } else {
+               if (type == NET_NFC_CONN_HANDOVER_CARRIER_UNKNOWN)
+                       context->current_type = NET_NFC_CONN_HANDOVER_CARRIER_BT;
+               else
                        context->current_type = context->type;
-               }
 
                context->cb = cb;
                context->user_param = user_param;
 
-               result = net_nfc_util_create_handover_message(
-                       &context->message);
+               result = net_nfc_util_create_handover_message(&context->message);
                if (result == NET_NFC_OK) {
-                       net_nfc_util_set_handover_message_type(context->message,
-                               NET_NFC_CH_TYPE_SELECT);
+                       net_nfc_util_set_handover_message_type(context->message, NET_NFC_CH_TYPE_SELECT);
 
                        /* append carrier record */
-                       g_idle_add((GSourceFunc)_iterate_create_carrier_configs,
-                               (gpointer)context);
+                       g_idle_add((GSourceFunc) _iterate_create_carrier_configs, (gpointer) context);
                } else {
                        DEBUG_ERR_MSG("net_nfc_util_create_handover_message failed, [%d]", result);
                }
-       }
-       else
-       {
+       } else {
                DEBUG_ERR_MSG("alloc failed");
 
                result = NET_NFC_ALLOC_FAIL;
@@ -808,10 +617,7 @@ static net_nfc_error_e _create_selector_handover_message(
 }
 
 #if 0
-static net_nfc_error_e
-_net_nfc_server_handover_create_low_power_selector_message(
-                                       ndef_message_s *request_msg,
-                                       ndef_message_s *select_msg)
+static net_nfc_error_e _net_nfc_server_handover_create_low_power_selector_message(ndef_message_s * request_msg, ndef_message_s * select_msg)
 {
        net_nfc_error_e result = NET_NFC_UNKNOWN_ERROR;
        unsigned int carrier_count = 0;
@@ -819,28 +625,17 @@ _net_nfc_server_handover_create_low_power_selector_message(
        LOGD("[%s] START", __func__);
 
        if (request_msg == NULL || select_msg == NULL)
-       {
                return NET_NFC_NULL_PARAMETER;
-       }
 
-       if ((result = net_nfc_util_get_alternative_carrier_record_count(
-                                       request_msg,
-                                       &carrier_count)) == NET_NFC_OK)
-       {
+       if ((result = net_nfc_util_get_alternative_carrier_record_count(request_msg, &carrier_count)) == NET_NFC_OK) {
                int idx;
                ndef_record_s *carrier_record = NULL;
-               net_nfc_conn_handover_carrier_type_e carrier_type =
-                               NET_NFC_CONN_HANDOVER_CARRIER_UNKNOWN;
+               net_nfc_conn_handover_carrier_type_e carrier_type = NET_NFC_CONN_HANDOVER_CARRIER_UNKNOWN;
 
                /* check each carrier record and create matched record */
-               for (idx = 0; idx < carrier_count; idx++)
-               {
-                       if ((net_nfc_util_get_alternative_carrier_type(
-                       request_msg,idx,&carrier_type) != NET_NFC_OK) ||
-                       (carrier_type == NET_NFC_CONN_HANDOVER_CARRIER_UNKNOWN))
-                       {
-                               DEBUG_ERR_MSG("net_nfc_util_get_alternative"
-                                               "_carrier_type failed or unknown");
+               for (idx = 0; idx < carrier_count; idx++) {
+                       if ((net_nfc_util_get_alternative_carrier_type(request_msg, idx, &carrier_type) != NET_NFC_OK) || (carrier_type == NET_NFC_CONN_HANDOVER_CARRIER_UNKNOWN)) {
+                               DEBUG_ERR_MSG("net_nfc_util_get_alternative" "_carrier_type failed or unknown");
                                continue;
                        }
 
@@ -850,54 +645,34 @@ _net_nfc_server_handover_create_low_power_selector_message(
                        {
                                net_nfc_carrier_config_s *config = NULL;
 
-                               if ((result = net_nfc_util_create_carrier_config(
-                                               &config,carrier_type)) == NET_NFC_OK)
-                               {
-                                       if ((result =
-                                               net_nfc_util_create_ndef_record_with_carrier_config(
-                                               &carrier_record,config)) == NET_NFC_OK)
-                                       {
-                                               DEBUG_SERVER_MSG("net_nfc_util_create_ndef_record_"
-                                                       "with_carrier_config success");
-                                       }
-                                       else
-                                       {
-                                               DEBUG_ERR_MSG("create_ndef_record_with_carrier_config "
-                                                                               "failed [%d]", result);
+                               if ((result = net_nfc_util_create_carrier_config(&config, carrier_type)) == NET_NFC_OK) {
+                                       if ((result = net_nfc_util_create_ndef_record_with_carrier_config(&carrier_record, config)) == NET_NFC_OK) {
+                                               DEBUG_SERVER_MSG("net_nfc_util_create_ndef_record_" "with_carrier_config success");
+                                       } else {
+                                               DEBUG_ERR_MSG("create_ndef_record_with_carrier_config " "failed [%d]", result);
                                                net_nfc_util_free_carrier_config(config);
                                                continue;
                                        }
 
                                        net_nfc_util_free_carrier_config(config);
-                               }
-                               else
-                               {
+                               } else {
                                        DEBUG_ERR_MSG("net_nfc_util_get_local_bt_address return NULL");
                                        continue;
                                }
                        }
 
                        /* append carrier configure record to selector message */
-                       if ((result = net_nfc_util_append_carrier_config_record(
-                                       select_msg,
-                                       carrier_record,
-                                       NET_NFC_CONN_HANDOVER_CARRIER_INACTIVATE)) == NET_NFC_OK)
-                       {
+                       if ((result = net_nfc_util_append_carrier_config_record(select_msg, carrier_record, NET_NFC_CONN_HANDOVER_CARRIER_INACTIVATE)) == NET_NFC_OK) {
                                DEBUG_SERVER_MSG("net_nfc_util_append_carrier_config_record success");
-                       }
-                       else
-                       {
-                               DEBUG_ERR_MSG("net_nfc_util_append_carrier_config_record"
-                                                                       " failed [%d]", result);
+                       } else {
+                               DEBUG_ERR_MSG("net_nfc_util_append_carrier_config_record" " failed [%d]", result);
 
                                net_nfc_util_free_record(carrier_record);
                        }
                }
 
                result = NET_NFC_OK;
-       }
-       else
-       {
+       } else {
                DEBUG_ERR_MSG("net_nfc_util_get_alternative_carrier_record_count failed");
        }
 
@@ -907,9 +682,7 @@ _net_nfc_server_handover_create_low_power_selector_message(
 }
 #endif
 
-static net_nfc_error_e _process_requester_carrier(net_nfc_ch_carrier_s *carrier,
-       net_nfc_server_handover_process_carrier_cb cb,
-       void *user_param)
+static net_nfc_error_e _process_requester_carrier(net_nfc_ch_carrier_s * carrier, net_nfc_server_handover_process_carrier_cb cb, void *user_param)
 {
        net_nfc_error_e result = NET_NFC_OK;
        _process_config_context_t *context = NULL;
@@ -917,8 +690,7 @@ static net_nfc_error_e _process_requester_carrier(net_nfc_ch_carrier_s *carrier,
        LOGD("[%s:%d] START", __func__, __LINE__);
 
        _net_nfc_util_alloc_mem(context, sizeof(*context));
-       if (context != NULL)
-       {
+       if (context != NULL) {
                net_nfc_conn_handover_carrier_type_e type;
 
                net_nfc_util_get_handover_carrier_type(carrier, &type);
@@ -929,38 +701,32 @@ static net_nfc_error_e _process_requester_carrier(net_nfc_ch_carrier_s *carrier,
                context->step = NET_NFC_LLCP_STEP_01;
 
                /* process carrier record */
-               switch (type)
-               {
-               case NET_NFC_CONN_HANDOVER_CARRIER_BT :
+               switch (type) {
+               case NET_NFC_CONN_HANDOVER_CARRIER_BT:
                        DEBUG_SERVER_MSG("[NET_NFC_CONN_HANDOVER_CARRIER_BT]");
-                       net_nfc_server_handover_bt_prepare_pairing(
-                               carrier,
-                               _bt_process_carrier_cb,
-                               context);
+                       net_nfc_server_handover_bt_prepare_pairing(carrier, _bt_process_carrier_cb, context);
                        break;
 
-               case NET_NFC_CONN_HANDOVER_CARRIER_WIFI_WPS :
+               case NET_NFC_CONN_HANDOVER_CARRIER_WIFI_WPS:
                        DEBUG_SERVER_MSG("[NET_NFC_CONN_HANDOVER_CARRIER_WIFI_WPS]");
                        _net_nfc_util_free_mem(context);
                        break;
 
-               case NET_NFC_CONN_HANDOVER_CARRIER_WIFI_P2P :
+               case NET_NFC_CONN_HANDOVER_CARRIER_WIFI_P2P:
                        DEBUG_SERVER_MSG("[NET_NFC_CONN_HANDOVER_CARRIER_WIFI_P2P]");
                        _net_nfc_util_free_mem(context);
                        break;
 
-               case NET_NFC_CONN_HANDOVER_CARRIER_UNKNOWN :
+               case NET_NFC_CONN_HANDOVER_CARRIER_UNKNOWN:
                        DEBUG_SERVER_MSG("[NET_NFC_CONN_HANDOVER_CARRIER_UNKNOWN]");
                        break;
 
-               default :
+               default:
                        DEBUG_SERVER_MSG("[unknown]");
                        _net_nfc_util_free_mem(context);
                        break;
                }
-       }
-       else
-       {
+       } else {
                DEBUG_ERR_MSG("alloc failed");
                result = NET_NFC_ALLOC_FAIL;
        }
@@ -970,9 +736,7 @@ static net_nfc_error_e _process_requester_carrier(net_nfc_ch_carrier_s *carrier,
        return result;
 }
 
-static net_nfc_error_e _process_selector_carrier(net_nfc_ch_carrier_s *carrier,
-       net_nfc_server_handover_process_carrier_cb cb,
-       void *user_param)
+static net_nfc_error_e _process_selector_carrier(net_nfc_ch_carrier_s * carrier, net_nfc_server_handover_process_carrier_cb cb, void *user_param)
 {
        net_nfc_error_e result = NET_NFC_OK;
        _process_config_context_t *context = NULL;
@@ -980,8 +744,7 @@ static net_nfc_error_e _process_selector_carrier(net_nfc_ch_carrier_s *carrier,
        LOGD("[%s:%d] START", __func__, __LINE__);
 
        _net_nfc_util_alloc_mem(context, sizeof(*context));
-       if (context != NULL)
-       {
+       if (context != NULL) {
                net_nfc_conn_handover_carrier_type_e type;
 
                net_nfc_util_get_handover_carrier_type(carrier, &type);
@@ -992,45 +755,33 @@ static net_nfc_error_e _process_selector_carrier(net_nfc_ch_carrier_s *carrier,
                context->step = NET_NFC_LLCP_STEP_01;
 
                /* process carrier record */
-               switch (type)
-               {
-               case NET_NFC_CONN_HANDOVER_CARRIER_BT :
+               switch (type) {
+               case NET_NFC_CONN_HANDOVER_CARRIER_BT:
                        DEBUG_SERVER_MSG("[NET_NFC_CONN_HANDOVER_CARRIER_BT]");
-                       net_nfc_server_handover_bt_do_pairing(
-                               carrier,
-                               _bt_process_carrier_cb,
-                               context);
+                       net_nfc_server_handover_bt_do_pairing(carrier, _bt_process_carrier_cb, context);
                        break;
 
-               case NET_NFC_CONN_HANDOVER_CARRIER_WIFI_WPS :
+               case NET_NFC_CONN_HANDOVER_CARRIER_WIFI_WPS:
                        DEBUG_SERVER_MSG("[NET_NFC_CONN_HANDOVER_CARRIER_WIFI_WPS]");
-                       net_nfc_server_handover_wps_do_connect(
-                               carrier,
-                               _wps_process_carrier_cb,
-                               context);
+                       net_nfc_server_handover_wps_do_connect(carrier, _wps_process_carrier_cb, context);
                        break;
 
-               case NET_NFC_CONN_HANDOVER_CARRIER_WIFI_P2P :
+               case NET_NFC_CONN_HANDOVER_CARRIER_WIFI_P2P:
                        DEBUG_SERVER_MSG("[NET_NFC_CONN_HANDOVER_CARRIER_WIFI_P2P]");
-                       net_nfc_server_handover_wfd_do_pairing(
-                               carrier,
-                               _wfd_process_carrier_cb,
-                               context);
+                       net_nfc_server_handover_wfd_do_pairing(carrier, _wfd_process_carrier_cb, context);
                        break;
 
-               case NET_NFC_CONN_HANDOVER_CARRIER_UNKNOWN :
+               case NET_NFC_CONN_HANDOVER_CARRIER_UNKNOWN:
                        DEBUG_SERVER_MSG("[NET_NFC_CONN_HANDOVER_CARRIER_UNKNOWN]");
                        _net_nfc_util_free_mem(context);
                        break;
 
-               default :
+               default:
                        DEBUG_SERVER_MSG("[unknown]");
                        _net_nfc_util_free_mem(context);
                        break;
                }
-       }
-       else
-       {
+       } else {
                DEBUG_ERR_MSG("alloc failed");
                result = NET_NFC_ALLOC_FAIL;
        }
@@ -1041,80 +792,52 @@ static net_nfc_error_e _process_selector_carrier(net_nfc_ch_carrier_s *carrier,
 }
 
 #if 0
-static net_nfc_error_e _net_nfc_server_handover_snep_client_cb(
-                                       net_nfc_snep_handle_h handle,
-                                       net_nfc_error_e result,
-                                       uint32_t type,
-                                       data_s *data,
-                                       void *user_param)
+static net_nfc_error_e _net_nfc_server_handover_snep_client_cb(net_nfc_snep_handle_h handle, net_nfc_error_e result, uint32_t type, data_s * data, void *user_param)
 {
-       _net_nfc_server_handover_client_context_t *context =
-               (_net_nfc_server_handover_client_context_t *)user_param;
+       _net_nfc_server_handover_client_context_t *context = (_net_nfc_server_handover_client_context_t *) user_param;
 
-       DEBUG_SERVER_MSG("type [%d], result [%d], data [%p], user_param [%p]",
-               type, result, data, user_param);
+       DEBUG_SERVER_MSG("type [%d], result [%d], data [%p], user_param [%p]", type, result, data, user_param);
 
        switch (type) {
-       case SNEP_RESP_SUCCESS :
+       case SNEP_RESP_SUCCESS:
                {
                        ndef_message_s *selector;
 
-                       result = _create_selector_from_rawdata(
-                                                       &selector,
-                                                       data);
+                       result = _create_selector_from_rawdata(&selector, data);
                        if (result == NET_NFC_OK) {
-                               if (false /* is low power ??? */) {
-                                       result =
-                                               _net_nfc_server_handover_process_selector_msg(
-                                               selector,
-                                               user_param);
-                               } else {
-                                       result =
-                                                _net_nfc_server_handover_process_selector_msg(
-                                               selector,
-                                               user_param);
-                               }
+                               if (false)
+                                       result = _net_nfc_server_handover_process_selector_msg(selector, user_param);
+                               else
+                                       result = _net_nfc_server_handover_process_selector_msg(selector, user_param);
 
                                if (result != NET_NFC_OK) {
-                                       DEBUG_ERR_MSG("_net_nfc_server_handover_process"
-                                               "_selector_msg failed [%d]",result);
-                                       if (context->cb != NULL) {
-                                               context->cb(result,
-                                                       context->type,
-                                                       NULL,
-                                                       context->user_param);
-                                       }
+                                       DEBUG_ERR_MSG("_net_nfc_server_handover_process" "_selector_msg failed [%d]", result);
+                                       if (context->cb != NULL)
+                                               context->cb(result, context->type, NULL, context->user_param);
                                        _net_nfc_util_free_mem(context);
                                }
 
                                net_nfc_util_free_ndef_message(selector);
                        } else {
-                               DEBUG_ERR_MSG("_net_nfc_server_handover_create"
-                                       "_selector_from_rawdata failed [%d]",result);
-                               if (context->cb != NULL) {
-                                       context->cb(result,
-                                               context->type,
-                                               NULL,
-                                               context->user_param);
-                               }
+                               DEBUG_ERR_MSG("_net_nfc_server_handover_create" "_selector_from_rawdata failed [%d]", result);
+                               if (context->cb != NULL)
+                                       context->cb(result, context->type, NULL, context->user_param);
                                _net_nfc_util_free_mem(context);
                        }
                }
                break;
 
-       case SNEP_RESP_BAD_REQ :
-       case SNEP_RESP_EXCESS_DATA :
-       case SNEP_RESP_NOT_FOUND :
-       case SNEP_RESP_NOT_IMPLEMENT :
-       case SNEP_RESP_REJECT :
-       case SNEP_RESP_UNSUPPORTED_VER :
-       default :
+       case SNEP_RESP_BAD_REQ:
+       case SNEP_RESP_EXCESS_DATA:
+       case SNEP_RESP_NOT_FOUND:
+       case SNEP_RESP_NOT_IMPLEMENT:
+       case SNEP_RESP_REJECT:
+       case SNEP_RESP_UNSUPPORTED_VER:
+       default:
                {
                        DEBUG_ERR_MSG("error response [0x%02x]", type);
-                       if (context->cb != NULL) {
-                               context->cb(result, context->type, NULL,
-                                       context->user_param);
-                       }
+                       if (context->cb != NULL)
+                               context->cb(result, context->type, NULL, context->user_param);
                        _net_nfc_util_free_mem(context);
                }
                break;
@@ -1123,124 +846,67 @@ static net_nfc_error_e _net_nfc_server_handover_snep_client_cb(
        return result;
 }
 
-
-static void _net_nfc_server_handover_create_requester_carrier_configs_cb(
-                                               net_nfc_error_e result,
-                                               ndef_message_s *msg,
-                                               void *user_param)
+static void _net_nfc_server_handover_create_requester_carrier_configs_cb(net_nfc_error_e result, ndef_message_s * msg, void *user_param)
 {
-       _net_nfc_server_handover_client_context_t *context =
-               (_net_nfc_server_handover_client_context_t *)user_param;
+       _net_nfc_server_handover_client_context_t *context = (_net_nfc_server_handover_client_context_t *) user_param;
        data_s data;
 
        if (context == NULL)
-       {
                return;
-       }
 
        if (msg != NULL) {
                /* convert ndef message */
-               if ((result = _convert_ndef_message_to_data(msg,
-                       &data)) == NET_NFC_OK) {
-                       net_nfc_service_snep_client(context->handle,
-                                               SNEP_SAN,
-                                               0,
-                                               SNEP_REQ_GET,
-                                               &data,
-                                               _net_nfc_server_handover_snep_client_cb,
-                                               context);
+               if ((result = _convert_ndef_message_to_data(msg, &data)) == NET_NFC_OK) {
+                       net_nfc_service_snep_client(context->handle, SNEP_SAN, 0, SNEP_REQ_GET, &data, _net_nfc_server_handover_snep_client_cb, context);
 
                        net_nfc_util_clear_data(&data);
-               }
-               else
-               {
-                       DEBUG_ERR_MSG("_net_nfc_server_handover_convert"
-                               "_ndef_message_to_datafailed [%d]",result);
+               } else {
+                       DEBUG_ERR_MSG("_net_nfc_server_handover_convert" "_ndef_message_to_datafailed [%d]", result);
                        if (context->cb != NULL)
-                       {
-                               context->cb(result,
-                                       context->type,
-                                       NULL,
-                                       context->user_param);
-                       }
+                               context->cb(result, context->type, NULL, context->user_param);
                        _net_nfc_util_free_mem(context);
                }
-       }
-       else
-       {
+       } else {
                DEBUG_ERR_MSG("null param, [%d]", result);
                if (context->cb != NULL)
-               {
-                       context->cb(result,
-                               context->type,
-                               NULL,
-                               context->user_param);
-               }
+                       context->cb(result, context->type, NULL, context->user_param);
                _net_nfc_util_free_mem(context);
        }
 }
 #endif
 
-
 #if 0
 
-static void _net_nfc_server_handover_server_create_carrier_configs_cb(
-                                               net_nfc_error_e result,
-                                               ndef_message_s *selector,
-                                               void *user_param)
+static void _net_nfc_server_handover_server_create_carrier_configs_cb(net_nfc_error_e result, ndef_message_s * selector, void *user_param)
 {
-       _net_nfc_server_handover_create_config_context_t *context =
-           (_net_nfc_server_handover_create_config_context_t *)user_param;
+       _net_nfc_server_handover_create_config_context_t *context = (_net_nfc_server_handover_create_config_context_t *) user_param;
        data_s data;
 
        if (context == NULL)
-       {
                return;
-       }
 
-       if (result == NET_NFC_OK)
-       {
-               result = _convert_ndef_message_to_data(
-                                                               selector,
-                                                               &data);
+       if (result == NET_NFC_OK) {
+               result = _convert_ndef_message_to_data(selector, &data);
 
-               if (result == NET_NFC_OK)
-               {
+               if (result == NET_NFC_OK) {
                        /* process message */
-                       _process_requester_carrier(
-                                                       context->record,
-                                                       NULL,
-                                                       NULL);
-
-                       result = net_nfc_service_snep_server_send_get_response(
-                                                               context->user_param,
-                                                               &data);
+                       _process_requester_carrier(context->record, NULL, NULL);
+
+                       result = net_nfc_service_snep_server_send_get_response(context->user_param, &data);
                        if (result != NET_NFC_OK)
-                       {
-                               DEBUG_ERR_MSG("net_nfc_service_snep_server"
-                                       "_send_get_response failed [%d]",result);
-                       }
+                               DEBUG_ERR_MSG("net_nfc_service_snep_server" "_send_get_response failed [%d]", result);
                        net_nfc_util_clear_data(&data);
+               } else {
+                       DEBUG_ERR_MSG("_net_nfc_server_handover_convert_ndef_message_to_data" "failed [%d]", result);
                }
-               else
-               {
-                       DEBUG_ERR_MSG("_net_nfc_server_handover_convert_ndef_message_to_data"
-                                                               "failed [%d]",result);
-               }
-       }
-       else
-       {
-               DEBUG_ERR_MSG("_net_nfc_server_handover_create_selector_msg"
-                                               "failed [%d]",result);
+       } else {
+               DEBUG_ERR_MSG("_net_nfc_server_handover_create_selector_msg" "failed [%d]", result);
        }
 
        _net_nfc_util_free_mem(context);
 }
 
-static net_nfc_error_e _net_nfc_server_handover_create_selector_msg(
-                                       net_nfc_snep_handle_h handle,
-                                       ndef_message_s *request,
-                                       void *user_param)
+static net_nfc_error_e _net_nfc_server_handover_create_selector_msg(net_nfc_snep_handle_h handle, ndef_message_s * request, void *user_param)
 {
        net_nfc_error_e result;
        uint32_t count;
@@ -1248,150 +914,88 @@ static net_nfc_error_e _net_nfc_server_handover_create_selector_msg(
        net_nfc_manager_util_play_sound(NET_NFC_TASK_END);
 
        /* get requester message */
-       if ((result = net_nfc_util_get_alternative_carrier_record_count(
-                                       request,
-                                       &count)) == NET_NFC_OK)
-       {
-               if (1/* power state */ || count == 1)
-               {
+       if ((result = net_nfc_util_get_alternative_carrier_record_count(request, &count)) == NET_NFC_OK) {
+               if (1 /* power state */  || count == 1) {
                        ndef_record_s *record = NULL;
 
                        /* fill alternative carrier information */
-                       if ((result =
-                               _get_carrier_record_by_priority_order(
-                                                                       request,
-                                                                       &record)) == NET_NFC_OK)
-                       {
-                               net_nfc_conn_handover_carrier_type_e type =
-                                                       NET_NFC_CONN_HANDOVER_CARRIER_UNKNOWN;
+                       if ((result = _get_carrier_record_by_priority_order(request, &record)) == NET_NFC_OK) {
+                               net_nfc_conn_handover_carrier_type_e type = NET_NFC_CONN_HANDOVER_CARRIER_UNKNOWN;
 
-                               if ((result = net_nfc_util_get_alternative_carrier_type_from_record(
-                                                               record,
-                                                               &type)) == NET_NFC_OK)
-                               {
+                               if ((result = net_nfc_util_get_alternative_carrier_type_from_record(record, &type)) == NET_NFC_OK) {
                                        _net_nfc_server_handover_create_config_context_t *context = NULL;
 
                                        _net_nfc_util_alloc_mem(context, sizeof(*context));
 
                                        context->user_param = handle;
 
-                                       net_nfc_util_create_record(record->TNF,
-                                               &record->type_s, &record->id_s,
-                                               &record->payload_s,
-                                               &context->record);
-
-                                       if ((result = _create_selector_handover_message(
-                                                       type,
-                                                       _net_nfc_server_handover_server_create_carrier_configs_cb,
-                                                       context)) != NET_NFC_OK)
-                                       {
-                                               DEBUG_ERR_MSG("_create_selector_carrier_configs "
-                                                                       "failed [%d]", result);
-                                       }
-                               }
-                               else
-                               {
-                                       DEBUG_ERR_MSG("get_alternative_carrier_type_from_record "
-                                               "failed [%d]", result);
+                                       net_nfc_util_create_record(record->TNF, &record->type_s, &record->id_s, &record->payload_s, &context->record);
+
+                                       if ((result = _create_selector_handover_message(type, _net_nfc_server_handover_server_create_carrier_configs_cb, context)) != NET_NFC_OK)
+                                               DEBUG_ERR_MSG("_create_selector_carrier_configs " "failed [%d]", result);
+                               } else {
+                                       DEBUG_ERR_MSG("get_alternative_carrier_type_from_record " "failed [%d]", result);
                                }
+                       } else {
+                               DEBUG_ERR_MSG("r_get_carrier_record_by_priority_order" " failed [%d]", result);
                        }
-                       else
-                       {
-                               DEBUG_ERR_MSG("r_get_carrier_record_by_priority_order"
-                                       " failed [%d]", result);
-                       }
-               }
-               else /* low power && count > 1 */
-               {
+               } else {                                /* low power && count > 1 */
+
                        ndef_message_s selector;
 
-                       if ((result = _net_nfc_server_handover_create_low_power_selector_message(
-                                                               request,
-                                                               &selector)) == NET_NFC_OK)
-                       {
-                               _net_nfc_server_handover_server_create_carrier_configs_cb(
-                                                                               NET_NFC_OK,
-                                                                               &selector,
-                                                                               user_param);
+                       if ((result = _net_nfc_server_handover_create_low_power_selector_message(request, &selector)) == NET_NFC_OK) {
+                               _net_nfc_server_handover_server_create_carrier_configs_cb(NET_NFC_OK, &selector, user_param);
 
                                net_nfc_util_free_ndef_message(&selector);
-                       }
-                       else
-                       {
-                               DEBUG_ERR_MSG("_create_low_power_selector_message"
-                                                               "failed [%d]", result);
+                       } else {
+                               DEBUG_ERR_MSG("_create_low_power_selector_message" "failed [%d]", result);
                        }
                }
-       }
-       else
-       {
-               DEBUG_ERR_MSG("net_nfc_util_get_alternative_carrier_record_count"
-                                                               "failed [%d]", result);
+       } else {
+               DEBUG_ERR_MSG("net_nfc_util_get_alternative_carrier_record_count" "failed [%d]", result);
        }
 
        return result;
 }
 
-
-static net_nfc_error_e _net_nfc_server_handover_create_server_cb(
-                                       net_nfc_snep_handle_h handle,
-                                       net_nfc_error_e result,
-                                       uint32_t type,
-                                       data_s *data,
-                                       void *user_param)
+static net_nfc_error_e _net_nfc_server_handover_create_server_cb(net_nfc_snep_handle_h handle, net_nfc_error_e result, uint32_t type, data_s * data, void *user_param)
 {
-       DEBUG_SERVER_MSG("type [0x%02x], result [%d], data [%p], user_param [%p]",
-               type, result, data, user_param);
+       DEBUG_SERVER_MSG("type [0x%02x], result [%d], data [%p], user_param [%p]", type, result, data, user_param);
 
-       if (result != NET_NFC_OK || data == NULL || data->buffer == NULL)
-       {
+       if (result != NET_NFC_OK || data == NULL || data->buffer == NULL) {
                /* restart */
                return NET_NFC_NULL_PARAMETER;
        }
 
-       switch (type)
-       {
-       case SNEP_REQ_GET :
+       switch (type) {
+       case SNEP_REQ_GET:
                {
                        ndef_message_s *request;
 
                        /* TODO : send select response to requester */
-                       result =
-                       _create_requester_from_rawdata(
-                                                                       &request,
-                                                                       data);
+                       result = _create_requester_from_rawdata(&request, data);
                        if (result == NET_NFC_OK) {
-                               if (1/* TODO : check version */)
-                               {
-                                       _net_nfc_server_handover_create_selector_msg(
-                                               handle,
-                                               request,
-                                               user_param);
-                               }
-                               else
-                               {
-                                       DEBUG_ERR_MSG("not supported version [0x%x]",
-                                               result);
+                               if (1) {
+                                       _net_nfc_server_handover_create_selector_msg(handle, request, user_param);
+                               } else {
+                                       DEBUG_ERR_MSG("not supported version [0x%x]", result);
 
                                        result = NET_NFC_NOT_SUPPORTED;
                                }
 
                                net_nfc_util_free_ndef_message(request);
-                       }
-                       else
-                       {
-                               DEBUG_ERR_MSG("_net_nfc_server_handover_create"
-                               "_requester_from_rawdata failed [%d]",result);
+                       } else {
+                               DEBUG_ERR_MSG("_net_nfc_server_handover_create" "_requester_from_rawdata failed [%d]", result);
                        }
                }
                break;
 
-       case SNEP_REQ_PUT :
+       case SNEP_REQ_PUT:
                DEBUG_ERR_MSG("PUT request doesn't supported");
                result = NET_NFC_NOT_SUPPORTED;
                break;
 
-       default :
+       default:
                DEBUG_ERR_MSG("error [%d]", result);
                break;
        }
@@ -1400,8 +1004,7 @@ static net_nfc_error_e _net_nfc_server_handover_create_server_cb(
 }
 #else
 
-static net_nfc_error_e _select_carrier_record(net_nfc_ch_message_s *request,
-       net_nfc_ch_carrier_s **carrier)
+static net_nfc_error_e _select_carrier_record(net_nfc_ch_message_s * request, net_nfc_ch_carrier_s ** carrier)
 {
        net_nfc_error_e result;
        uint32_t count;
@@ -1410,32 +1013,21 @@ static net_nfc_error_e _select_carrier_record(net_nfc_ch_message_s *request,
 
        /* get requester message */
        result = net_nfc_util_get_handover_carrier_count(request, &count);
-       if (result == NET_NFC_OK)
-       {
-               if (1/* power state */ || count == 1)
-               {
+       if (result == NET_NFC_OK) {
+               if (1 /* power state */  || count == 1) {
                        net_nfc_ch_carrier_s *temp;
 
                        /* fill alternative carrier information */
-                       result = _get_carrier_record_by_priority_order(request,
-                               &temp);
+                       result = _get_carrier_record_by_priority_order(request, &temp);
                        if (result == NET_NFC_OK)
-                       {
-                               net_nfc_util_duplicate_handover_carrier(carrier,
-                                       temp);
-                       }
+                               net_nfc_util_duplicate_handover_carrier(carrier, temp);
                        else
-                       {
                                DEBUG_ERR_MSG("_get_carrier_record_by_priority_order failed [%d]", result);
-                       }
-               }
-               else /* low power && count > 1 */
-               {
+               } else {                                /* low power && count > 1 */
+
                        result = NET_NFC_INVALID_STATE;
                }
-       }
-       else
-       {
+       } else {
                DEBUG_ERR_MSG("net_nfc_util_get_handover_carrier_count failed [%d]", result);
        }
 
@@ -1444,19 +1036,14 @@ static net_nfc_error_e _select_carrier_record(net_nfc_ch_message_s *request,
 
 #endif
 
-static void _create_carrier_configs_2_cb(net_nfc_error_e result,
-       net_nfc_ch_message_s *selector,
-       void *user_param)
+static void _create_carrier_configs_2_cb(net_nfc_error_e result, net_nfc_ch_message_s * selector, void *user_param)
 {
-       net_nfc_handover_context_t *context =
-               (net_nfc_handover_context_t *)user_param;
+       net_nfc_handover_context_t *context = (net_nfc_handover_context_t *) user_param;
 
        DEBUG_SERVER_MSG("_server_create_carrier_config_cb result [%d]", result);
 
        if (context == NULL)
-       {
                return;
-       }
 
        context->result = result;
 
@@ -1465,20 +1052,15 @@ static void _create_carrier_configs_2_cb(net_nfc_error_e result,
 
                net_nfc_util_export_handover_to_ndef_message(selector, &msg);
 
-               result = _convert_ndef_message_to_data(msg,
-                       &context->data);
+               result = _convert_ndef_message_to_data(msg, &context->data);
 
-               DEBUG_SERVER_MSG("selector message created, length [%d]",
-                       context->data.length);
+               DEBUG_SERVER_MSG("selector message created, length [%d]", context->data.length);
 
                context->state = NET_NFC_LLCP_STEP_03;
 
                net_nfc_util_free_ndef_message(msg);
-       }
-       else
-       {
-               DEBUG_ERR_MSG("_net_nfc_server_handover_create_selector_msg failed [%d]",
-                       result);
+       } else {
+               DEBUG_ERR_MSG("_net_nfc_server_handover_create_selector_msg failed [%d]", result);
 
                context->state = NET_NFC_MESSAGE_LLCP_ERROR;
        }
@@ -1486,26 +1068,17 @@ static void _create_carrier_configs_2_cb(net_nfc_error_e result,
        _get_response_process(context);
 }
 
-static void _process_carrier_record_2_cb(net_nfc_error_e result,
-       net_nfc_conn_handover_carrier_type_e type,
-       data_s *data,
-       void *user_param)
+static void _process_carrier_record_2_cb(net_nfc_error_e result, net_nfc_conn_handover_carrier_type_e type, data_s * data, void *user_param)
 {
-       net_nfc_handover_context_t *context =
-               (net_nfc_handover_context_t *)user_param;
+       net_nfc_handover_context_t *context = (net_nfc_handover_context_t *) user_param;
 
-       DEBUG_SERVER_MSG("_server_process_carrier_record_cb result [%d]",
-               result);
+       DEBUG_SERVER_MSG("_server_process_carrier_record_cb result [%d]", result);
 
        context->result = result;
        if (result == NET_NFC_OK)
-       {
                context->state = NET_NFC_LLCP_STEP_04;
-       }
        else
-       {
                context->state = NET_NFC_MESSAGE_LLCP_ERROR;
-       }
 
        net_nfc_util_init_data(&context->data, data->length);
        memcpy(context->data.buffer, data->buffer, context->data.length);
@@ -1513,183 +1086,133 @@ static void _process_carrier_record_2_cb(net_nfc_error_e result,
        _server_process(context);
 }
 
-static void _get_response_process(net_nfc_handover_context_t *context)
+static void _get_response_process(net_nfc_handover_context_t * context)
 {
        net_nfc_error_e result;
 
        if (context == NULL)
-       {
                return;
-       }
 
-       switch (context->state)
-       {
-       case NET_NFC_LLCP_STEP_02 :
+       switch (context->state) {
+       case NET_NFC_LLCP_STEP_02:
                DEBUG_SERVER_MSG("NET_NFC_LLCP_STEP_02");
 
-               result = _create_selector_handover_message(context->type,
-                       _create_carrier_configs_2_cb,
-                       context);
+               result = _create_selector_handover_message(context->type, _create_carrier_configs_2_cb, context);
                if (result != NET_NFC_OK)
-               {
                        DEBUG_ERR_MSG("_create_selector_carrier_config failed [%d]", result);
-               }
                break;
 
-       case NET_NFC_LLCP_STEP_03 :
+       case NET_NFC_LLCP_STEP_03:
                DEBUG_SERVER_MSG("NET_NFC_LLCP_STEP_03");
 
-               result = _process_requester_carrier(context->carrier,
-                       _process_carrier_record_2_cb,
-                       context);
+               result = _process_requester_carrier(context->carrier, _process_carrier_record_2_cb, context);
                if (result != NET_NFC_OK)
-               {
                        DEBUG_ERR_MSG("_process_requester_carrier_record failed [%d]", result);
-               }
                break;
 
-       case NET_NFC_LLCP_STEP_04 :
+       case NET_NFC_LLCP_STEP_04:
                DEBUG_SERVER_MSG("NET_NFC_LLCP_STEP_04");
 
                /* response select message */
-               result = net_nfc_server_snep_server_send_get_response(
-                       (net_nfc_snep_handle_h)context->handle,
-                       &context->data);
+               result = net_nfc_server_snep_server_send_get_response((net_nfc_snep_handle_h) context->handle, &context->data);
                break;
 
-       case NET_NFC_STATE_ERROR :
+       case NET_NFC_STATE_ERROR:
                DEBUG_SERVER_MSG("NET_NFC_STATE_ERROR");
                break;
 
-       default :
+       default:
                DEBUG_ERR_MSG("NET_NFC_LLCP_STEP_??");
                /* TODO */
                break;
        }
 }
 
-static bool _get_response_cb(net_nfc_snep_handle_h handle,
-       uint32_t type,
-       uint32_t max_len,
-       data_s *data,
-       void *user_param)
+static bool _get_response_cb(net_nfc_snep_handle_h handle, uint32_t type, uint32_t max_len, data_s * data, void *user_param)
 {
        net_nfc_error_e result;
        ndef_message_s *request;
 
-       DEBUG_SERVER_MSG("type [%d], data [%p], user_param [%p]",
-                               type, data, user_param);
+       DEBUG_SERVER_MSG("type [%d], data [%p], user_param [%p]", type, data, user_param);
 
-       if (data == NULL || data->buffer == NULL)
-       {
+       if (data == NULL || data->buffer == NULL) {
                /* restart */
                return false;
        }
 
        /* TODO : send select response to requester */
        result = _create_requester_from_rawdata(&request, data);
-       if (result == NET_NFC_OK)
-       {
+       if (result == NET_NFC_OK) {
                net_nfc_ch_message_s *msg;
                net_nfc_ch_carrier_s *carrier;
 
                net_nfc_util_import_handover_from_ndef_message(request, &msg);
 
                result = _select_carrier_record(msg, &carrier);
-               if (result == NET_NFC_OK)
-               {
+               if (result == NET_NFC_OK) {
                        net_nfc_handover_context_t *context = NULL;
 
                        _net_nfc_util_alloc_mem(context, sizeof(*context));
-                       if (context != NULL)
-                       {
+                       if (context != NULL) {
                                context->handle = (void *)handle;
                                context->user_param = user_param;
                                context->state = NET_NFC_LLCP_STEP_02;
-                               net_nfc_util_get_handover_carrier_type(carrier,
-                                       &context->type);
+                               net_nfc_util_get_handover_carrier_type(carrier, &context->type);
 
-                               net_nfc_util_duplicate_handover_carrier(
-                                       &context->carrier, carrier);
+                               net_nfc_util_duplicate_handover_carrier(&context->carrier, carrier);
 
                                _get_response_process(context);
-                       }
-                       else
-                       {
+                       } else {
                                DEBUG_ERR_MSG("_net_nfc_util_alloc_mem failed");
 
                                result = NET_NFC_ALLOC_FAIL;
                        }
-               }
-               else
-               {
+               } else {
                        /* low power */
                }
 
                net_nfc_util_free_handover_message(msg);
                net_nfc_util_free_ndef_message(request);
-       }
-       else
-       {
-               DEBUG_SERVER_MSG("it is not handover requester message, [%d]",
-                       result);
+       } else {
+               DEBUG_SERVER_MSG("it is not handover requester message, [%d]", result);
        }
 
        return (result == NET_NFC_OK);
 }
 
 ////////////////////////////////////////////////////////////////////////////////
-static void _server_process_carrier_record_cb(
-                               net_nfc_error_e result,
-                               net_nfc_conn_handover_carrier_type_e type,
-                               data_s *data,
-                               void *user_param)
+static void _server_process_carrier_record_cb(net_nfc_error_e result, net_nfc_conn_handover_carrier_type_e type, data_s * data, void *user_param)
 {
-       net_nfc_handover_context_t *context =
-               (net_nfc_handover_context_t *)user_param;
+       net_nfc_handover_context_t *context = (net_nfc_handover_context_t *) user_param;
 
-       DEBUG_SERVER_MSG("_server_process_carrier_record_cb result [%d]",
-               result);
+       DEBUG_SERVER_MSG("_server_process_carrier_record_cb result [%d]", result);
 
        context->result = result;
        if (result == NET_NFC_OK)
-       {
                context->state = NET_NFC_LLCP_STEP_04;
-       }
        else
-       {
                context->state = NET_NFC_MESSAGE_LLCP_ERROR;
-       }
 
        _server_process(context);
 }
 
-static void _server_create_carrier_config_cb(net_nfc_error_e result,
-       net_nfc_ch_message_s *selector,
-       void *user_param)
+static void _server_create_carrier_config_cb(net_nfc_error_e result, net_nfc_ch_message_s * selector, void *user_param)
 {
-       net_nfc_handover_context_t *context =
-               (net_nfc_handover_context_t *)user_param;
+       net_nfc_handover_context_t *context = (net_nfc_handover_context_t *) user_param;
 
        DEBUG_SERVER_MSG("_server_create_carrier_config_cb, result [%d]", result);
 
        if (context == NULL)
-       {
                return;
-       }
 
-       if (result == NET_NFC_OK)
-       {
+       if (result == NET_NFC_OK) {
                ndef_message_s *msg;
 
-               result = net_nfc_util_export_handover_to_ndef_message(selector,
-                       &msg);
+               result = net_nfc_util_export_handover_to_ndef_message(selector, &msg);
                if (result == NET_NFC_OK) {
-                       result = _convert_ndef_message_to_data(msg,
-                               &context->data);
+                       result = _convert_ndef_message_to_data(msg, &context->data);
                        if (result == NET_NFC_OK) {
-                               DEBUG_SERVER_MSG("selector message created, length [%d]",
-                                       context->data.length);
+                               DEBUG_SERVER_MSG("selector message created, length [%d]", context->data.length);
 
                                context->state = NET_NFC_LLCP_STEP_03;
                                context->result = result;
@@ -1707,9 +1230,7 @@ static void _server_create_carrier_config_cb(net_nfc_error_e result,
                        context->state = NET_NFC_MESSAGE_LLCP_ERROR;
                        context->result = result;
                }
-       }
-       else
-       {
+       } else {
                DEBUG_ERR_MSG("_create_selector_msg failed [%d]", result);
 
                context->state = NET_NFC_MESSAGE_LLCP_ERROR;
@@ -1719,58 +1240,42 @@ static void _server_create_carrier_config_cb(net_nfc_error_e result,
        _server_process(context);
 }
 
-static void _handover_server_recv_cb(net_nfc_error_e result,
-       net_nfc_target_handle_s *handle,
-       net_nfc_llcp_socket_t socket,
-       data_s *data,
-       void *user_param)
+static void _handover_server_recv_cb(net_nfc_error_e result, net_nfc_target_handle_s * handle, net_nfc_llcp_socket_t socket, data_s * data, void *user_param)
 {
-       net_nfc_handover_context_t *context =
-               (net_nfc_handover_context_t *)user_param;
+       net_nfc_handover_context_t *context = (net_nfc_handover_context_t *) user_param;
        ndef_message_s *request;
 
        DEBUG_SERVER_MSG("_server_recv_cb, socket [%x], result [%d]", socket, result);
 
        context->result = result;
 
-       if (result == NET_NFC_OK)
-       {
+       if (result == NET_NFC_OK) {
                net_nfc_util_append_data(&context->data, data);
 
                result = net_nfc_util_check_ndef_message_rawdata(&context->data);
                if (result == NET_NFC_OK) {
                        /* message complete */
                        result = _create_requester_from_rawdata(&request, &context->data);
-                       if (result == NET_NFC_OK)
-                       {
+                       if (result == NET_NFC_OK) {
                                net_nfc_ch_message_s *msg;
                                net_nfc_ch_carrier_s *carrier;
 
-                               net_nfc_util_import_handover_from_ndef_message(request,
-                                       &msg);
+                               net_nfc_util_import_handover_from_ndef_message(request, &msg);
 
-                               if (_select_carrier_record(msg, &carrier) ==
-                                       NET_NFC_OK)
-                               {
-                                       net_nfc_util_get_handover_carrier_type(carrier,
-                                               &context->type);
-                                       net_nfc_util_duplicate_handover_carrier(
-                                               &context->carrier, carrier);
+                               if (_select_carrier_record(msg, &carrier) == NET_NFC_OK) {
+                                       net_nfc_util_get_handover_carrier_type(carrier, &context->type);
+                                       net_nfc_util_duplicate_handover_carrier(&context->carrier, carrier);
 
                                        context->state = NET_NFC_LLCP_STEP_02;
-                               }
-                               else
-                               {
+                               } else {
                                        /* low power */
                                        context->state = NET_NFC_LLCP_STEP_06;
                                }
 
                                net_nfc_util_free_handover_message(msg);
                                net_nfc_util_free_ndef_message(request);
-                       }
-                       else
-                       {
-                               DEBUG_ERR_MSG("_create_requester_from_rawdata failed [%d]",result);
+                       } else {
+                               DEBUG_ERR_MSG("_create_requester_from_rawdata failed [%d]", result);
 
                                context->state = NET_NFC_MESSAGE_LLCP_ERROR;
                        }
@@ -1783,11 +1288,8 @@ static void _handover_server_recv_cb(net_nfc_error_e result,
 
                        context->state = NET_NFC_MESSAGE_LLCP_ERROR;
                }
-       }
-       else
-       {
-               DEBUG_ERR_MSG("net_nfc_server_llcp_simple_receive failed [%d]",
-                       result);
+       } else {
+               DEBUG_ERR_MSG("net_nfc_server_llcp_simple_receive failed [%d]", result);
 
                context->state = NET_NFC_MESSAGE_LLCP_ERROR;
        }
@@ -1795,129 +1297,91 @@ static void _handover_server_recv_cb(net_nfc_error_e result,
        _server_process(context);
 }
 
-static void _server_send_cb(net_nfc_error_e result,
-                                       net_nfc_target_handle_s *handle,
-                                       net_nfc_llcp_socket_t socket,
-                                       data_s *data,
-                                       void *user_param)
+static void _server_send_cb(net_nfc_error_e result, net_nfc_target_handle_s * handle, net_nfc_llcp_socket_t socket, data_s * data, void *user_param)
 {
-       net_nfc_handover_context_t *context =
-               (net_nfc_handover_context_t *)user_param;
+       net_nfc_handover_context_t *context = (net_nfc_handover_context_t *) user_param;
 
        DEBUG_SERVER_MSG("_server_send_cb socket [%x], result [%d]", socket, result);
 
        context->result = result;
 
-       if (result == NET_NFC_OK)
-       {
+       if (result == NET_NFC_OK) {
                context->state = NET_NFC_LLCP_STEP_01;
                net_nfc_util_clear_data(&context->data);
                net_nfc_util_free_handover_carrier(context->carrier);
                context->carrier = NULL;
-       }
-       else
-       {
-               DEBUG_ERR_MSG("net_nfc_server_llcp_simple_send failed [%d]",
-                       result);
+       } else {
+               DEBUG_ERR_MSG("net_nfc_server_llcp_simple_send failed [%d]", result);
                context->state = NET_NFC_MESSAGE_LLCP_ERROR;
        }
 
        _server_process(context);
 }
 
-static void _server_process(net_nfc_handover_context_t *context)
+static void _server_process(net_nfc_handover_context_t * context)
 {
        if (context == NULL)
-       {
                return;
-       }
 
-       switch (context->state)
-       {
-       case NET_NFC_LLCP_STEP_01 :
+       switch (context->state) {
+       case NET_NFC_LLCP_STEP_01:
                DEBUG_SERVER_MSG("NET_NFC_LLCP_STEP_01");
 
                /* receive request message */
-               net_nfc_server_llcp_simple_receive(context->handle,
-                       context->socket,
-                       _handover_server_recv_cb,
-                       context);
+               net_nfc_server_llcp_simple_receive(context->handle, context->socket, _handover_server_recv_cb, context);
                break;
 
-       case NET_NFC_LLCP_STEP_02 :
+       case NET_NFC_LLCP_STEP_02:
                DEBUG_SERVER_MSG("NET_NFC_LLCP_STEP_02");
 
                net_nfc_util_clear_data(&context->data);
 
-               context->result = _create_selector_handover_message(
-                       context->type,
-                       _server_create_carrier_config_cb,
-                       context);
+               context->result = _create_selector_handover_message(context->type, _server_create_carrier_config_cb, context);
                if (context->result != NET_NFC_OK)
-               {
                        DEBUG_ERR_MSG("_create_selector_carrier_configs failed [%d]", context->result);
-               }
                break;
 
-       case NET_NFC_LLCP_STEP_03 :
+       case NET_NFC_LLCP_STEP_03:
                DEBUG_SERVER_MSG("NET_NFC_LLCP_STEP_03");
 
-               context->result = _process_requester_carrier(
-                       context->carrier,
-                       _server_process_carrier_record_cb,
-                       context);
+               context->result = _process_requester_carrier(context->carrier, _server_process_carrier_record_cb, context);
                if (context->result != NET_NFC_OK)
-               {
                        DEBUG_ERR_MSG("_process_carrier_record failed [%d]", context->result);
-               }
                break;
 
-       case NET_NFC_LLCP_STEP_04 :
+       case NET_NFC_LLCP_STEP_04:
                DEBUG_SERVER_MSG("NET_NFC_LLCP_STEP_04");
 
                /* send select message */
-               net_nfc_server_llcp_simple_send(context->handle,
-                       context->socket,
-                       &context->data,
-                       _server_send_cb,
-                       context);
+               net_nfc_server_llcp_simple_send(context->handle, context->socket, &context->data, _server_send_cb, context);
                break;
 
-       case NET_NFC_STATE_ERROR :
+       case NET_NFC_STATE_ERROR:
                DEBUG_SERVER_MSG("NET_NFC_STATE_ERROR");
 
                /* error, invoke callback */
-               DEBUG_ERR_MSG("handover_server failed, [%d]",
-                       context->result);
+               DEBUG_ERR_MSG("handover_server failed, [%d]", context->result);
 
                net_nfc_util_clear_data(&context->data);
 
                /* restart?? */
                break;
 
-       default :
+       default:
                DEBUG_ERR_MSG("NET_NFC_LLCP_STEP_??");
                /* TODO */
                break;
        }
 }
 
-static void _server_error_cb(net_nfc_error_e result,
-       net_nfc_target_handle_s *handle,
-       net_nfc_llcp_socket_t socket,
-       data_s *data,
-       void *user_param)
+static void _server_error_cb(net_nfc_error_e result, net_nfc_target_handle_s * handle, net_nfc_llcp_socket_t socket, data_s * data, void *user_param)
 {
-       net_nfc_handover_context_t *context =
-               (net_nfc_handover_context_t *)user_param;
+       net_nfc_handover_context_t *context = (net_nfc_handover_context_t *) user_param;
 
-       DEBUG_ERR_MSG("result [%d], socket [%x], user_param [%p]",
-               result, socket, user_param);
+       DEBUG_ERR_MSG("result [%d], socket [%x], user_param [%p]", result, socket, user_param);
 
        if (context == NULL)
-       {
                return;
-       }
 
        net_nfc_controller_llcp_socket_close(socket, &result);
 
@@ -1926,20 +1390,14 @@ static void _server_error_cb(net_nfc_error_e result,
        _net_nfc_util_free_mem(user_param);
 }
 
-static void _server_incomming_cb(net_nfc_error_e result,
-       net_nfc_target_handle_s *handle,
-       net_nfc_llcp_socket_t socket,
-       data_s *data,
-       void *user_param)
+static void _server_incomming_cb(net_nfc_error_e result, net_nfc_target_handle_s * handle, net_nfc_llcp_socket_t socket, data_s * data, void *user_param)
 {
-       DEBUG_SERVER_MSG("result [%d], socket [%x], user_param [%p]",
-               result, socket, user_param);
+       DEBUG_SERVER_MSG("result [%d], socket [%x], user_param [%p]", result, socket, user_param);
 
        net_nfc_handover_context_t *accept_context = NULL;
 
        _net_nfc_util_alloc_mem(accept_context, sizeof(*accept_context));
-       if (accept_context == NULL)
-       {
+       if (accept_context == NULL) {
                DEBUG_ERR_MSG("_net_nfc_util_alloc_mem failed");
 
                result = NET_NFC_ALLOC_FAIL;
@@ -1950,13 +1408,9 @@ static void _server_incomming_cb(net_nfc_error_e result,
        accept_context->socket = socket;
        accept_context->state = NET_NFC_LLCP_STEP_01;
 
-       result = net_nfc_server_llcp_simple_accept(handle, socket,
-               _server_error_cb,
-               accept_context);
-       if (result != NET_NFC_OK)
-       {
-               DEBUG_ERR_MSG("net_nfc_server_llcp_simple_accept failed, [%d]",
-                       result);
+       result = net_nfc_server_llcp_simple_accept(handle, socket, _server_error_cb, accept_context);
+       if (result != NET_NFC_OK) {
+               DEBUG_ERR_MSG("net_nfc_server_llcp_simple_accept failed, [%d]", result);
 
                goto ERROR;
        }
@@ -1965,71 +1419,48 @@ static void _server_incomming_cb(net_nfc_error_e result,
 
        return;
 
-ERROR :
+ ERROR:
        if (accept_context != NULL)
-       {
                _net_nfc_util_free_mem(accept_context);
-       }
 
        net_nfc_controller_llcp_socket_close(socket, &result);
 
        /* TODO : restart ?? */
 }
 
-net_nfc_error_e net_nfc_server_handover_default_server_start(
-                               net_nfc_target_handle_s *handle)
+net_nfc_error_e net_nfc_server_handover_default_server_start(net_nfc_target_handle_s * handle)
 {
        net_nfc_error_e result;
 
        /* start default handover server using snep */
-       result = net_nfc_server_snep_default_server_register_get_response_cb(
-               _get_response_cb, NULL);
+       result = net_nfc_server_snep_default_server_register_get_response_cb(_get_response_cb, NULL);
 
        /* start default handover server */
-       result = net_nfc_server_llcp_simple_server(handle, CH_SAN, CH_SAP,
-               _server_incomming_cb,
-               _server_error_cb,
-               NULL);
+       result = net_nfc_server_llcp_simple_server(handle, CH_SAN, CH_SAP, _server_incomming_cb, _server_error_cb, NULL);
        if (result == NET_NFC_OK)
-       {
-               DEBUG_SERVER_MSG("start handover server, san [%s], sap [%d]",
-                       CH_SAN,CH_SAP);
-       }
+               DEBUG_SERVER_MSG("start handover server, san [%s], sap [%d]", CH_SAN, CH_SAP);
        else
-       {
-               DEBUG_ERR_MSG("net_nfc_server_llcp_simple_server failed, [%d]",
-                       result);
-       }
+               DEBUG_ERR_MSG("net_nfc_server_llcp_simple_server failed, [%d]", result);
 
        return result;
 }
 
-static void _handover_default_activate_cb(int event,
-       net_nfc_target_handle_s *handle,
-       uint32_t sap, const char *san, void *user_param)
+static void _handover_default_activate_cb(int event, net_nfc_target_handle_s * handle, uint32_t sap, const char *san, void *user_param)
 {
        net_nfc_error_e result;
 
-       DEBUG_SERVER_MSG("event [%d], handle [%p], sap [%d], san [%s]",
-               event, handle, sap, san);
+       DEBUG_SERVER_MSG("event [%d], handle [%p], sap [%d], san [%s]", event, handle, sap, san);
 
        if (event == NET_NFC_LLCP_START) {
                /* start default handover server using snep */
-               result = net_nfc_server_snep_default_server_register_get_response_cb(
-                       _get_response_cb, NULL);
+               result = net_nfc_server_snep_default_server_register_get_response_cb(_get_response_cb, NULL);
 
                /* start default handover server */
-               result = net_nfc_server_llcp_simple_server(handle,
-                       CH_SAN, CH_SAP,
-                       _server_incomming_cb,
-                       _server_error_cb, NULL);
-               if (result == NET_NFC_OK) {
-                       DEBUG_SERVER_MSG("start handover server, san [%s], sap [%d]",
-                               CH_SAN, CH_SAP);
-               } else {
-                       DEBUG_ERR_MSG("net_nfc_service_llcp_server failed, [%d]",
-                               result);
-               }
+               result = net_nfc_server_llcp_simple_server(handle, CH_SAN, CH_SAP, _server_incomming_cb, _server_error_cb, NULL);
+               if (result == NET_NFC_OK)
+                       DEBUG_SERVER_MSG("start handover server, san [%s], sap [%d]", CH_SAN, CH_SAP);
+               else
+                       DEBUG_ERR_MSG("net_nfc_service_llcp_server failed, [%d]", result);
        } else if (event == NET_NFC_LLCP_UNREGISTERED) {
                /* unregister server, do nothing */
        }
@@ -2043,8 +1474,7 @@ net_nfc_error_e net_nfc_server_handover_default_server_register()
        snprintf(id, sizeof(id), "%d", getpid());
 
        /* start default snep server */
-       return net_nfc_server_llcp_register_service(id, CH_SAP, CH_SAN,
-               _handover_default_activate_cb, NULL);
+       return net_nfc_server_llcp_register_service(id, CH_SAP, CH_SAN, _handover_default_activate_cb, NULL);
 }
 
 net_nfc_error_e net_nfc_server_handover_default_server_unregister()
@@ -2059,13 +1489,9 @@ net_nfc_error_e net_nfc_server_handover_default_server_unregister()
 }
 
 ////////////////////////////////////////////////////////////////////////////////
-static void _client_process_carrier_record_cb(net_nfc_error_e result,
-       net_nfc_conn_handover_carrier_type_e type,
-       data_s *data,
-       void *user_param)
+static void _client_process_carrier_record_cb(net_nfc_error_e result, net_nfc_conn_handover_carrier_type_e type, data_s * data, void *user_param)
 {
-       net_nfc_handover_context_t *context =
-               (net_nfc_handover_context_t *)user_param;
+       net_nfc_handover_context_t *context = (net_nfc_handover_context_t *) user_param;
 
        DEBUG_SERVER_MSG("_server_process_carrier_record_cb, result [%d]", result);
 
@@ -2073,67 +1499,47 @@ static void _client_process_carrier_record_cb(net_nfc_error_e result,
 
        net_nfc_util_clear_data(&context->data);
 
-       if (result == NET_NFC_OK)
-       {
+       if (result == NET_NFC_OK) {
                net_nfc_util_init_data(&context->data, data->length);
                memcpy(context->data.buffer, data->buffer, data->length);
 
                context->state = NET_NFC_LLCP_STEP_RETURN;
-       }
-       else
-       {
+       } else {
                context->state = NET_NFC_MESSAGE_LLCP_ERROR;
        }
 
        _client_process(context);
 }
 
-static void _client_recv_cb(net_nfc_error_e result,
-       net_nfc_target_handle_s *handle,
-       net_nfc_llcp_socket_t socket,
-       data_s *data,
-       void *user_param)
+static void _client_recv_cb(net_nfc_error_e result, net_nfc_target_handle_s * handle, net_nfc_llcp_socket_t socket, data_s * data, void *user_param)
 {
-       net_nfc_handover_context_t *context =
-               (net_nfc_handover_context_t *)user_param;
+       net_nfc_handover_context_t *context = (net_nfc_handover_context_t *) user_param;
 
        if (context == NULL)
-       {
                return;
-       }
 
        context->result = result;
 
-       if (result == NET_NFC_OK)
-       {
+       if (result == NET_NFC_OK) {
                net_nfc_util_append_data(&context->data, data);
 
-               result = net_nfc_util_check_ndef_message_rawdata(
-                       &context->data);
+               result = net_nfc_util_check_ndef_message_rawdata(&context->data);
                if (result == NET_NFC_OK) {
                        ndef_message_s *selector;
 
-                       result = _create_selector_from_rawdata(&selector,
-                               &context->data);
-                       if (result == NET_NFC_OK)
-                       {
+                       result = _create_selector_from_rawdata(&selector, &context->data);
+                       if (result == NET_NFC_OK) {
                                net_nfc_ch_message_s *msg;
                                net_nfc_ch_carrier_s *carrier;
 
-                               net_nfc_util_import_handover_from_ndef_message(selector,
-                                       &msg);
+                               net_nfc_util_import_handover_from_ndef_message(selector, &msg);
 
-                               result = _get_carrier_record_by_priority_order(
-                                       msg, &carrier);
-                               if (result == NET_NFC_OK)
-                               {
-                                       net_nfc_util_duplicate_handover_carrier(
-                                               &context->carrier, carrier);
+                               result = _get_carrier_record_by_priority_order(msg, &carrier);
+                               if (result == NET_NFC_OK) {
+                                       net_nfc_util_duplicate_handover_carrier(&context->carrier, carrier);
 
                                        context->state = NET_NFC_LLCP_STEP_04;
-                               }
-                               else
-                               {
+                               } else {
                                        DEBUG_ERR_MSG("_get_carrier_record_by_priority_order failed, [%d]", result);
 
                                        context->state = NET_NFC_STATE_ERROR;
@@ -2141,9 +1547,7 @@ static void _client_recv_cb(net_nfc_error_e result,
 
                                net_nfc_util_free_handover_message(msg);
                                net_nfc_util_free_ndef_message(selector);
-                       }
-                       else
-                       {
+                       } else {
                                DEBUG_ERR_MSG("_create_selector_from_rawdata failed, [%d]", result);
 
                                context->state = NET_NFC_STATE_ERROR;
@@ -2157,11 +1561,8 @@ static void _client_recv_cb(net_nfc_error_e result,
 
                        context->state = NET_NFC_MESSAGE_LLCP_ERROR;
                }
-       }
-       else
-       {
-               DEBUG_ERR_MSG("net_nfc_server_llcp_simple_receive failed, [%d]",
-                       result);
+       } else {
+               DEBUG_ERR_MSG("net_nfc_server_llcp_simple_receive failed, [%d]", result);
 
                context->state = NET_NFC_STATE_ERROR;
        }
@@ -2169,74 +1570,53 @@ static void _client_recv_cb(net_nfc_error_e result,
        _client_process(context);
 }
 
-static void _client_send_cb(net_nfc_error_e result,
-       net_nfc_target_handle_s *handle,
-       net_nfc_llcp_socket_t socket,
-       data_s *data,
-       void *user_param)
+static void _client_send_cb(net_nfc_error_e result, net_nfc_target_handle_s * handle, net_nfc_llcp_socket_t socket, data_s * data, void *user_param)
 {
-       net_nfc_handover_context_t *context =
-               (net_nfc_handover_context_t *)user_param;
+       net_nfc_handover_context_t *context = (net_nfc_handover_context_t *) user_param;
 
        if (context == NULL)
-       {
                return;
-       }
 
        context->result = result;
 
        net_nfc_util_clear_data(&context->data);
 
-       if (result == NET_NFC_OK)
-       {
+       if (result == NET_NFC_OK) {
                context->state = NET_NFC_LLCP_STEP_03;
-       }
-       else
-       {
-               DEBUG_ERR_MSG("net_nfc_server_llcp_simple_client failed, [%d]",
-                       result);
+       } else {
+               DEBUG_ERR_MSG("net_nfc_server_llcp_simple_client failed, [%d]", result);
                context->state = NET_NFC_STATE_ERROR;
        }
 
        _client_process(context);
 }
 
-static void _client_create_carrier_configs_cb(net_nfc_error_e result,
-       net_nfc_ch_message_s *msg,
-       void *user_param)
+static void _client_create_carrier_configs_cb(net_nfc_error_e result, net_nfc_ch_message_s * msg, void *user_param)
 {
-       net_nfc_handover_context_t *context =
-               (net_nfc_handover_context_t *)user_param;
+       net_nfc_handover_context_t *context = (net_nfc_handover_context_t *) user_param;
 
-       if (context == NULL) {
+       if (context == NULL)
                return;
-       }
 
        context->result = result;
 
-       if (msg != NULL)
-       {
+       if (msg != NULL) {
                ndef_message_s *message;
 
                net_nfc_util_export_handover_to_ndef_message(msg, &message);
 
                result = _convert_ndef_message_to_data(message, &context->data);
-               if (result == NET_NFC_OK)
-               {
-//                     DEBUG_MSG_PRINT_BUFFER(context->data.buffer, context->data.length);
+               if (result == NET_NFC_OK) {
+//          DEBUG_MSG_PRINT_BUFFER(context->data.buffer, context->data.length);
 
                        context->state = NET_NFC_LLCP_STEP_02;
-               }
-               else
-               {
+               } else {
                        DEBUG_ERR_MSG("_convert_ndef_message_to_data failed [%d]", result);
 
                        context->state = NET_NFC_STATE_ERROR;
                        context->result = result;
                }
-       }
-       else
-       {
+       } else {
                DEBUG_ERR_MSG("null param, [%d]", result);
 
                context->state = NET_NFC_STATE_ERROR;
@@ -2246,72 +1626,52 @@ static void _client_create_carrier_configs_cb(net_nfc_error_e result,
        _client_process(context);
 }
 
-
 ////////////////////////////////////////////////////////////////////////////////
-static void _client_process(net_nfc_handover_context_t *context)
+static void _client_process(net_nfc_handover_context_t * context)
 {
        net_nfc_error_e result;
 
        if (context == NULL)
-       {
                return;
-       }
 
-       switch (context->state)
-       {
-       case NET_NFC_LLCP_STEP_01 :
+       switch (context->state) {
+       case NET_NFC_LLCP_STEP_01:
                DEBUG_SERVER_MSG("NET_NFC_LLCP_STEP_01");
 
-               result = _create_requester_handover_message(context->type,
-                       _client_create_carrier_configs_cb,
-                       context);
+               result = _create_requester_handover_message(context->type, _client_create_carrier_configs_cb, context);
                if (result != NET_NFC_OK)
-               {
                        DEBUG_ERR_MSG("_create_requester_carriers failed [%d]", result);
-               }
                break;
 
-       case NET_NFC_LLCP_STEP_02 :
+       case NET_NFC_LLCP_STEP_02:
                DEBUG_SERVER_MSG("NET_NFC_LLCP_STEP_02");
 
                /* send request */
-               net_nfc_server_llcp_simple_send(context->handle,
-                       context->socket,
-                       &context->data,
-                       _client_send_cb,
-                       context);
+               net_nfc_server_llcp_simple_send(context->handle, context->socket, &context->data, _client_send_cb, context);
 
                net_nfc_util_clear_data(&context->data);
                break;
 
-       case NET_NFC_LLCP_STEP_03 :
+       case NET_NFC_LLCP_STEP_03:
                DEBUG_SERVER_MSG("NET_NFC_LLCP_STEP_03");
 
                /* receive response */
-               net_nfc_server_llcp_simple_receive(context->handle,
-                       context->socket,
-                       _client_recv_cb,
-                       context);
+               net_nfc_server_llcp_simple_receive(context->handle, context->socket, _client_recv_cb, context);
                break;
 
-       case NET_NFC_LLCP_STEP_04 :
+       case NET_NFC_LLCP_STEP_04:
                DEBUG_SERVER_MSG("NET_NFC_LLCP_STEP_04");
 
-               result = _process_selector_carrier(context->carrier,
-                       _client_process_carrier_record_cb,
-                       context);
+               result = _process_selector_carrier(context->carrier, _client_process_carrier_record_cb, context);
                if (result != NET_NFC_OK)
-               {
                        DEBUG_ERR_MSG("_process_requester_carrier_record failed [%d]", result);
-               }
                break;
 
-       case NET_NFC_LLCP_STEP_RETURN :
+       case NET_NFC_LLCP_STEP_RETURN:
                DEBUG_SERVER_MSG("NET_NFC_LLCP_STEP_RETURN");
 
                /* complete and invoke callback */
-               _send_response(context->result, context->type, &context->data,
-                       context->user_param);
+               _send_response(context->result, context->type, &context->data, context->user_param);
 
                net_nfc_util_clear_data(&context->data);
 
@@ -2321,87 +1681,57 @@ static void _client_process(net_nfc_handover_context_t *context)
                _net_nfc_util_free_mem(context);
                break;
 
-       case NET_NFC_STATE_ERROR :
-       default :
+       case NET_NFC_STATE_ERROR:
+       default:
                DEBUG_ERR_MSG("NET_NFC_STATE_ERROR");
 
-               _send_response(context->result, context->type, NULL,
-                       context->user_param);
+               _send_response(context->result, context->type, NULL, context->user_param);
                break;
        }
 }
 
-static void _client_connected_cb(net_nfc_error_e result,
-       net_nfc_target_handle_s *handle,
-       net_nfc_llcp_socket_t socket,
-       data_s *data,
-       void *user_param)
+static void _client_connected_cb(net_nfc_error_e result, net_nfc_target_handle_s * handle, net_nfc_llcp_socket_t socket, data_s * data, void *user_param)
 {
-       DEBUG_SERVER_MSG("result [%d], socket [%x], user_param [%p]",
-               result, socket, user_param);
+       DEBUG_SERVER_MSG("result [%d], socket [%x], user_param [%p]", result, socket, user_param);
 
-       if (result == NET_NFC_OK)
-       {
+       if (result == NET_NFC_OK) {
                net_nfc_handover_context_t *context = NULL;
 
                _net_nfc_util_alloc_mem(context, sizeof(*context));
-               if (context != NULL)
-               {
+               if (context != NULL) {
                        context->handle = handle;
                        context->socket = socket;
                        context->state = NET_NFC_LLCP_STEP_01;
                        context->user_param = user_param;
 
                        _client_process(context);
-               }
-               else
-               {
+               } else {
                        DEBUG_ERR_MSG("_net_nfc_util_alloc_mem failed");
 
                        result = NET_NFC_ALLOC_FAIL;
                }
-       }
-       else
-       {
+       } else {
                DEBUG_ERR_MSG("net_nfc_server_llcp_simple_client failed, [%d]", result);
        }
 }
 
-static void _client_error_cb(net_nfc_error_e result,
-       net_nfc_target_handle_s *handle,
-       net_nfc_llcp_socket_t socket,
-       data_s *data,
-       void *user_param)
+static void _client_error_cb(net_nfc_error_e result, net_nfc_target_handle_s * handle, net_nfc_llcp_socket_t socket, data_s * data, void *user_param)
 {
-       DEBUG_ERR_MSG("result [%d], socket [%x], user_param [%p]",
-               result, socket, user_param);
+       DEBUG_ERR_MSG("result [%d], socket [%x], user_param [%p]", result, socket, user_param);
 
        if (false)
-       {
-               _send_response(result,
-                       NET_NFC_CONN_HANDOVER_CARRIER_UNKNOWN,
-                       NULL,
-                       user_param);
-       }
+               _send_response(result, NET_NFC_CONN_HANDOVER_CARRIER_UNKNOWN, NULL, user_param);
 
        net_nfc_controller_llcp_socket_close(socket, &result);
 }
 
-
-net_nfc_error_e net_nfc_server_handover_default_client_start(
-       net_nfc_target_handle_s *handle,
-       void *user_data)
+net_nfc_error_e net_nfc_server_handover_default_client_start(net_nfc_target_handle_s * handle, void *user_data)
 {
        net_nfc_error_e result;
 
-       result = net_nfc_server_llcp_simple_client(handle, CH_SAN, CH_SAP,
-               _client_connected_cb,
-               _client_error_cb,
-               user_data);
+       result = net_nfc_server_llcp_simple_client(handle, CH_SAN, CH_SAP, _client_connected_cb, _client_error_cb, user_data);
        if (result != NET_NFC_OK)
-       {
                DEBUG_ERR_MSG("net_nfc_server_llcp_simple_client failed, [%d]", result);
-       }
 
        return result;
 }
index 296a2d6..caa4fbb 100755 (executable)
 #include "net_nfc_server_llcp.h"
 #include "net_nfc_server_process_npp.h"
 
-
-typedef struct _net_nfc_npp_entry_t
-{
+typedef struct _net_nfc_npp_entry_t {
        uint8_t op;
        uint32_t length;
        uint8_t data[0];
-}
-__attribute__ ((packed)) net_nfc_npp_entry_t;
+} __attribute__ ((packed)) net_nfc_npp_entry_t;
 
-typedef struct _net_nfc_npp_msg_t
-{
+typedef struct _net_nfc_npp_msg_t {
        uint8_t version;
        uint32_t entry_count;
        net_nfc_npp_entry_t entry[0];
-}
-__attribute__ ((packed)) net_nfc_npp_msg_t;
+} __attribute__ ((packed)) net_nfc_npp_msg_t;
 
 typedef struct _NppData NppData;
 
-struct _NppData
-{
+struct _NppData {
        net_nfc_target_handle_s *handle;
        net_nfc_llcp_socket_t socket;
        uint32_t type;
@@ -57,8 +51,7 @@ struct _NppData
 
 typedef struct _NppClientStartData NppClientStartData;
 
-struct _NppClientStartData
-{
+struct _NppClientStartData {
        net_nfc_target_handle_s *handle;
        int client;
        gpointer user_data;
@@ -77,55 +70,29 @@ struct _NppClientStartData
 #define NPP_NDEF_ENTRY                 0x00000001
 #define NPP_ACTION_CODE                        0x01
 
-static net_nfc_error_e npp_create_message(data_s *data,
-                                       data_s *message);
+static net_nfc_error_e npp_create_message(data_s * data, data_s * message);
 
 /* server */
-static void npp_server_receive_cb(net_nfc_error_e result,
-                               net_nfc_target_handle_s *handle,
-                               net_nfc_llcp_socket_t socket,
-                               data_s *data,
-                               gpointer user_data);
+static void npp_server_receive_cb(net_nfc_error_e result, net_nfc_target_handle_s * handle, net_nfc_llcp_socket_t socket, data_s * data, gpointer user_data);
 
-static void npp_server_process(NppData *npp_data);
+static void npp_server_process(NppData * npp_data);
 
-static void npp_listen_cb(net_nfc_error_e result,
-                       net_nfc_target_handle_s *handle,
-                       net_nfc_llcp_socket_t socket,
-                       data_s *data,
-                       gpointer user_data);
+static void npp_listen_cb(net_nfc_error_e result, net_nfc_target_handle_s * handle, net_nfc_llcp_socket_t socket, data_s * data, gpointer user_data);
 
 /* client */
-static void npp_client_send_cb(net_nfc_error_e result,
-                               net_nfc_target_handle_s *handle,
-                               net_nfc_llcp_socket_t socket,
-                               data_s *data,
-                               gpointer user_data);
-
-static void npp_client_process(NppData *npp_data);
-
-static void npp_connected_cb(net_nfc_error_e result,
-                               net_nfc_target_handle_s *handle,
-                               net_nfc_llcp_socket_t socket,
-                               data_s *data,
-                               gpointer user_data);
-
-static void npp_socket_error_cb(net_nfc_error_e result,
-                               net_nfc_target_handle_s *handle,
-                               net_nfc_llcp_socket_t socket,
-                               data_s *data,
-                               gpointer user_data);
-
-static void npp_default_server_cb(net_nfc_error_e result,
-                               data_s *data,
-                               gpointer user_data);
-
-static void npp_default_client_cb(net_nfc_error_e result,
-                               data_s *data,
-                               gpointer user_data);
-
-static net_nfc_error_e npp_create_message(data_s *data,
-                                       data_s *message)
+static void npp_client_send_cb(net_nfc_error_e result, net_nfc_target_handle_s * handle, net_nfc_llcp_socket_t socket, data_s * data, gpointer user_data);
+
+static void npp_client_process(NppData * npp_data);
+
+static void npp_connected_cb(net_nfc_error_e result, net_nfc_target_handle_s * handle, net_nfc_llcp_socket_t socket, data_s * data, gpointer user_data);
+
+static void npp_socket_error_cb(net_nfc_error_e result, net_nfc_target_handle_s * handle, net_nfc_llcp_socket_t socket, data_s * data, gpointer user_data);
+
+static void npp_default_server_cb(net_nfc_error_e result, data_s * data, gpointer user_data);
+
+static void npp_default_client_cb(net_nfc_error_e result, data_s * data, gpointer user_data);
+
+static net_nfc_error_e npp_create_message(data_s * data, data_s * message)
 {
        size_t length = NPP_HEADER_LEN;
        net_nfc_npp_msg_t *msg;
@@ -135,11 +102,10 @@ static net_nfc_error_e npp_create_message(data_s *data,
 
        net_nfc_util_init_data(message, length);
 
-       msg = (net_nfc_npp_msg_t *)message->buffer;
+       msg = (net_nfc_npp_msg_t *) message->buffer;
        msg->version = NPP_VERSION;
 
-       if (data != NULL)
-       {
+       if (data != NULL) {
                net_nfc_npp_entry_t *entity;
 
                DEBUG_SERVER_MSG("data->length [%d]", data->length);
@@ -152,29 +118,21 @@ static net_nfc_error_e npp_create_message(data_s *data,
                entity->length = htonl(data->length);
                /* copy ndef information to response msg */
                memcpy(entity->data, data->buffer, data->length);
-       }
-       else
-       {
+       } else {
                msg->entry_count = 0;
        }
 
        return NET_NFC_OK;
 }
 
-static void __npp_server_received_cb(net_nfc_error_e result,
-                               net_nfc_target_handle_s *handle,
-                               net_nfc_llcp_socket_t socket,
-                               data_s *data,
-                               gpointer user_data)
+static void __npp_server_received_cb(net_nfc_error_e result, net_nfc_target_handle_s * handle, net_nfc_llcp_socket_t socket, data_s * data, gpointer user_data)
 {
-       NppData *npp_data = (NppData *)user_data;
+       NppData *npp_data = (NppData *) user_data;
        size_t length;
 
-       length = MIN(data->length,
-               npp_data->data.length - npp_data->data_offset);
+       length = MIN(data->length, npp_data->data.length - npp_data->data_offset);
 
-       memcpy(npp_data->data.buffer + npp_data->data_offset,
-               data->buffer, length);
+       memcpy(npp_data->data.buffer + npp_data->data_offset, data->buffer, length);
 
        npp_data->data_offset += length;
 
@@ -182,60 +140,46 @@ static void __npp_server_received_cb(net_nfc_error_e result,
                DEBUG_SERVER_MSG("receive message complete, length [%d]", npp_data->data.length);
 
                /* launch */
-               if (npp_data->callback) {
-                       npp_data->callback(result, &npp_data->data,
-                               npp_data->user_data);
-               }
-
-//             if (length < data->length) {
-//                     /* start next entry */
-//             }
+               if (npp_data->callback)
+                       npp_data->callback(result, &npp_data->data, npp_data->user_data);
+//      if (length < data->length) {
+//          /* start next entry */
+//      }
        } else {
                DEBUG_SERVER_MSG("fragmented message, read [%d], expected [%d]", npp_data->data_offset, npp_data->data.length);
 
                /* receive next fragment */
-               result = net_nfc_server_llcp_simple_receive(npp_data->handle,
-                       npp_data->socket,
-                       __npp_server_received_cb,
-                       npp_data);
-               if (result != NET_NFC_OK)
-               {
+               result = net_nfc_server_llcp_simple_receive(npp_data->handle, npp_data->socket, __npp_server_received_cb, npp_data);
+               if (result != NET_NFC_OK) {
                        DEBUG_ERR_MSG("net_nfc_server_llcp_simple_receive failed, [%d]", result);
 
                        if (npp_data->callback)
-                               npp_data->callback(result, NULL,
-                                       npp_data->user_data);
+                               npp_data->callback(result, NULL, npp_data->user_data);
                }
        }
 }
 
-static void npp_server_receive_cb(net_nfc_error_e result,
-                               net_nfc_target_handle_s *handle,
-                               net_nfc_llcp_socket_t socket,
-                               data_s *data,
-                               gpointer user_data)
+static void npp_server_receive_cb(net_nfc_error_e result, net_nfc_target_handle_s * handle, net_nfc_llcp_socket_t socket, data_s * data, gpointer user_data)
 {
-       NppData *npp_data = (NppData *)user_data;
+       NppData *npp_data = (NppData *) user_data;
 
        net_nfc_npp_msg_t *message;
        net_nfc_npp_entry_t *entry;
 
        size_t length;
        size_t entry_count;
-//     size_t i;
+//  size_t i;
 
        if (npp_data == NULL)
                return;
 
-       if (result != NET_NFC_OK)
-       {
+       if (result != NET_NFC_OK) {
                DEBUG_ERR_MSG("receive failed [%d]", result);
 
                goto ERR;
        }
 
-       if (data == NULL || data->buffer == NULL || data->length == 0)
-       {
+       if (data == NULL || data->buffer == NULL || data->length == 0) {
                DEBUG_ERR_MSG("Wrong data");
 
                result = NET_NFC_INVALID_PARAM;
@@ -243,8 +187,7 @@ static void npp_server_receive_cb(net_nfc_error_e result,
                goto ERR;
        }
 
-       if (data->length < NPP_HEADER_LEN)
-       {
+       if (data->length < NPP_HEADER_LEN) {
                DEBUG_ERR_MSG("too short data, length [%d]", data->length);
 
                result = NET_NFC_INVALID_PARAM;
@@ -252,13 +195,10 @@ static void npp_server_receive_cb(net_nfc_error_e result,
                goto ERR;
        }
 
-       message = (net_nfc_npp_msg_t *)data->buffer;
+       message = (net_nfc_npp_msg_t *) data->buffer;
 
-       if (GET_MAJOR_VER(message->version) > NPP_MAJOR_VER ||
-                       GET_MINOR_VER(message->version > NPP_MINOR_VER))
-       {
-               DEBUG_ERR_MSG("not supported version, version [0x%02x]",
-                       message->version);
+       if (GET_MAJOR_VER(message->version) > NPP_MAJOR_VER || GET_MINOR_VER(message->version > NPP_MINOR_VER)) {
+               DEBUG_ERR_MSG("not supported version, version [0x%02x]", message->version);
 
                result = NET_NFC_NOT_SUPPORTED;
 
@@ -267,10 +207,8 @@ static void npp_server_receive_cb(net_nfc_error_e result,
 
        entry_count = htonl(message->entry_count);
 
-       if (entry_count > NPP_NDEF_ENTRY)
-       {
-               DEBUG_ERR_MSG("too many entries, support only one entry. count [%d]",
-                       message->entry_count);
+       if (entry_count > NPP_NDEF_ENTRY) {
+               DEBUG_ERR_MSG("too many entries, support only one entry. count [%d]", message->entry_count);
 
                result = NET_NFC_INVALID_PARAM;
 
@@ -278,14 +216,13 @@ static void npp_server_receive_cb(net_nfc_error_e result,
        }
 
        /* FIXME : ..... multi-entry is useless... I don't want to implement. */
-//     for (i = 0; i < entry_count; i++)
+//  for (i = 0; i < entry_count; i++)
        {
-//             entry = (message->entry + i);
+//      entry = (message->entry + i);
                entry = message->entry;
 
                if (entry->op != NPP_ACTION_CODE) {
-                       DEBUG_ERR_MSG("not supported action code, [0x%02x]",
-                               entry->op);
+                       DEBUG_ERR_MSG("not supported action code, [0x%02x]", entry->op);
 
                        result = NET_NFC_INVALID_PARAM;
 
@@ -294,11 +231,9 @@ static void npp_server_receive_cb(net_nfc_error_e result,
 
                length = htonl(entry->length);
 
-               DEBUG_SERVER_MSG("action code [0x%02x], length [%d]",
-                       entry->op, length);
+               DEBUG_SERVER_MSG("action code [0x%02x], length [%d]", entry->op, length);
 
-               if (length > 0)
-               {
+               if (length > 0) {
                        data_s temp;
 
                        /* buffer create */
@@ -306,11 +241,9 @@ static void npp_server_receive_cb(net_nfc_error_e result,
                        npp_data->data_offset = 0;
 
                        temp.buffer = entry->data;
-                       temp.length = data->length -
-                               NPP_HEADER_LEN - NPP_ENTRY_HEADER_LEN;
+                       temp.length = data->length - NPP_HEADER_LEN - NPP_ENTRY_HEADER_LEN;
 
-                       __npp_server_received_cb(result, handle,
-                               socket, &temp, user_data);
+                       __npp_server_received_cb(result, handle, socket, &temp, user_data);
                } else {
                        DEBUG_ERR_MSG("invalid ndef length");
 
@@ -322,14 +255,12 @@ static void npp_server_receive_cb(net_nfc_error_e result,
 
        return;
 
-ERR :
-       if (npp_data->callback) {
+ ERR:
+       if (npp_data->callback)
                npp_data->callback(result, NULL, npp_data->user_data);
-       }
 }
 
-
-static void npp_server_process(NppData *npp_data)
+static void npp_server_process(NppData * npp_data)
 {
        net_nfc_error_e result;
 
@@ -337,12 +268,8 @@ static void npp_server_process(NppData *npp_data)
                return;
 
        /* receive request */
-       result = net_nfc_server_llcp_simple_receive(npp_data->handle,
-                                               npp_data->socket,
-                                               npp_server_receive_cb,
-                                               npp_data);
-       if (result != NET_NFC_OK)
-       {
+       result = net_nfc_server_llcp_simple_receive(npp_data->handle, npp_data->socket, npp_server_receive_cb, npp_data);
+       if (result != NET_NFC_OK) {
                DEBUG_ERR_MSG("net_nfc_server_llcp_simple_receive failed, [%d]", result);
 
                if (npp_data->callback)
@@ -350,20 +277,15 @@ static void npp_server_process(NppData *npp_data)
        }
 }
 
-static void npp_listen_cb(net_nfc_error_e result,
-                       net_nfc_target_handle_s *handle,
-                       net_nfc_llcp_socket_t socket,
-                       data_s *data,
-                       gpointer user_data)
+static void npp_listen_cb(net_nfc_error_e result, net_nfc_target_handle_s * handle, net_nfc_llcp_socket_t socket, data_s * data, gpointer user_data)
 {
-       NppData *npp_data = (NppData *)user_data;
+       NppData *npp_data = (NppData *) user_data;
        NppData *accept_data = NULL;
 
        if (npp_data == NULL)
                return;
 
-       DEBUG_SERVER_MSG("npp_listen_cb, incoming socket [%#x], result [%d]",
-                       socket, result);
+       DEBUG_SERVER_MSG("npp_listen_cb, incoming socket [%#x], result [%d]", socket, result);
 
        if (result != NET_NFC_OK) {
                DEBUG_ERR_MSG("listen failed [%d]", result);
@@ -379,40 +301,30 @@ static void npp_listen_cb(net_nfc_error_e result,
        accept_data->callback = npp_data->callback;
        accept_data->user_data = npp_data->user_data;
 
-       result = net_nfc_server_llcp_simple_accept(handle,
-                                               socket,
-                                               npp_socket_error_cb,
-                                               accept_data);
-       if (result != NET_NFC_OK)
-       {
+       result = net_nfc_server_llcp_simple_accept(handle, socket, npp_socket_error_cb, accept_data);
+       if (result != NET_NFC_OK) {
                DEBUG_ERR_MSG("net_nfc_server_llcp_simple_accept failed, [%d]", result);
 
                goto ERR;
        }
 
-       DEBUG_SERVER_MSG("socket [%x] accepted.. waiting for request message",
-                       socket);
+       DEBUG_SERVER_MSG("socket [%x] accepted.. waiting for request message", socket);
 
        npp_server_process(accept_data);
 
        return;
 
-ERR :
+ ERR:
        if (npp_data->callback)
                npp_data->callback(result, NULL, npp_data->user_data);
 
-       if (accept_data != NULL) {
+       if (accept_data != NULL)
                g_free(accept_data);
-       }
 }
 
-static void npp_client_send_cb(net_nfc_error_e result,
-                       net_nfc_target_handle_s *handle,
-                       net_nfc_llcp_socket_t socket,
-                       data_s *data,
-                       gpointer user_data)
+static void npp_client_send_cb(net_nfc_error_e result, net_nfc_target_handle_s * handle, net_nfc_llcp_socket_t socket, data_s * data, gpointer user_data)
 {
-       NppData *npp_data = (NppData *)user_data;
+       NppData *npp_data = (NppData *) user_data;
 
        if (npp_data == NULL)
                return;
@@ -424,14 +336,13 @@ static void npp_client_send_cb(net_nfc_error_e result,
        } else {
                DEBUG_SERVER_MSG("send complete... [%d] length [%d]", result, npp_data->data.length);
 
-               if (npp_data->callback) {
+               if (npp_data->callback)
                        npp_data->callback(result, NULL, npp_data->user_data);
-               }
        }
 }
 
 /* FIXME : fragment */
-static void npp_client_process(NppData *npp_data)
+static void npp_client_process(NppData * npp_data)
 {
        net_nfc_error_e result;
        data_s data;
@@ -440,18 +351,13 @@ static void npp_client_process(NppData *npp_data)
        if (npp_data == NULL)
                return;
 
-       length = MIN(npp_data->data.length - npp_data->data_offset,
-               npp_data->miu);
+       length = MIN(npp_data->data.length - npp_data->data_offset, npp_data->miu);
        data.buffer = npp_data->data.buffer + npp_data->data_offset;
        data.length = length;
        npp_data->data_offset += length;
 
        /* send request */
-       result = net_nfc_server_llcp_simple_send(npp_data->handle,
-                                               npp_data->socket,
-                                               &data,
-                                               npp_client_send_cb,
-                                               npp_data);
+       result = net_nfc_server_llcp_simple_send(npp_data->handle, npp_data->socket, &data, npp_client_send_cb, npp_data);
        if (result != NET_NFC_OK) {
                DEBUG_ERR_MSG("net_nfc_server_llcp_simple_send failed [%d]", result);
 
@@ -460,27 +366,21 @@ static void npp_client_process(NppData *npp_data)
 
        return;
 
-ERR :
-       if (npp_data->callback) {
+ ERR:
+       if (npp_data->callback)
                npp_data->callback(result, NULL, npp_data->user_data);
-       }
 }
 
-static void npp_connected_cb(net_nfc_error_e result,
-                       net_nfc_target_handle_s *handle,
-                       net_nfc_llcp_socket_t socket,
-                       data_s *data,
-                       gpointer user_data)
+static void npp_connected_cb(net_nfc_error_e result, net_nfc_target_handle_s * handle, net_nfc_llcp_socket_t socket, data_s * data, gpointer user_data)
 {
-       NppData *npp_data = (NppData *)user_data;
+       NppData *npp_data = (NppData *) user_data;
 
        if (npp_data == NULL)
                return;
 
        if (result == NET_NFC_OK) {
                /*start npp client */
-               DEBUG_SERVER_MSG("socket [%x] connected, send request message.",
-                               socket);
+               DEBUG_SERVER_MSG("socket [%x] connected, send request message.", socket);
                npp_data->socket = socket;
 
                npp_client_process(npp_data);
@@ -495,42 +395,33 @@ static void npp_connected_cb(net_nfc_error_e result,
        }
 }
 
-static void npp_socket_error_cb(net_nfc_error_e result,
-                               net_nfc_target_handle_s *handle,
-                               net_nfc_llcp_socket_t socket,
-                               data_s *data,
-                               gpointer user_data)
+static void npp_socket_error_cb(net_nfc_error_e result, net_nfc_target_handle_s * handle, net_nfc_llcp_socket_t socket, data_s * data, gpointer user_data)
 {
        NppData *npp_data;
 
        DEBUG_SERVER_MSG("socket [%x], result [%d]", socket, result);
 
-       npp_data = (NppData *)user_data;
+       npp_data = (NppData *) user_data;
        if (npp_data == NULL)
                return;
 
-//     if (npp_data->callback)
-//             npp_data->callback(result, NULL, npp_data->user_data);
+//  if (npp_data->callback)
+//      npp_data->callback(result, NULL, npp_data->user_data);
 
        net_nfc_util_clear_data(&npp_data->data);
        g_free(npp_data);
 }
 
-static void npp_default_server_cb(net_nfc_error_e result,
-                               data_s *data,
-                               gpointer user_data)
+static void npp_default_server_cb(net_nfc_error_e result, data_s * data, gpointer user_data)
 {
-       DEBUG_SERVER_MSG("result [%d], data [%p], user_data [%p]",
-                       result, data, user_data);
+       DEBUG_SERVER_MSG("result [%d], data [%p], user_data [%p]", result, data, user_data);
 
-       if (data == NULL)
-       {
+       if (data == NULL) {
                DEBUG_ERR_MSG("npp server receive failed, [%d]", result);
                return;
        }
 
-       if (data->buffer == NULL)
-       {
+       if (data->buffer == NULL) {
                DEBUG_ERR_MSG("npp server receive failed, [%d]", result);
                return;
        }
@@ -539,19 +430,16 @@ static void npp_default_server_cb(net_nfc_error_e result,
        net_nfc_app_util_process_ndef(data);
 }
 
-static void npp_default_client_cb(net_nfc_error_e result,
-                               data_s *data,
-                               gpointer user_data)
+static void npp_default_client_cb(net_nfc_error_e result, data_s * data, gpointer user_data)
 {
        NppClientStartData *npp_client_data;
 
-       DEBUG_SERVER_MSG("result [%d], data [%p], user_data [%p]",
-                       result, data, user_data);
+       DEBUG_SERVER_MSG("result [%d], data [%p], user_data [%p]", result, data, user_data);
 
        if (user_data == NULL)
                return;
 
-       npp_client_data = (NppClientStartData *)user_data;
+       npp_client_data = (NppClientStartData *) user_data;
 
        net_nfc_server_p2p_data_sent(result, npp_client_data->user_data);
 
@@ -559,23 +447,17 @@ static void npp_default_client_cb(net_nfc_error_e result,
 }
 
 /* public apis */
-net_nfc_error_e net_nfc_server_npp_server(net_nfc_target_handle_s *handle,
-                                       char *san,
-                                       sap_t sap,
-                                       net_nfc_server_npp_callback callback,
-                                       gpointer user_data)
+net_nfc_error_e net_nfc_server_npp_server(net_nfc_target_handle_s * handle, char *san, sap_t sap, net_nfc_server_npp_callback callback, gpointer user_data)
 {
        net_nfc_error_e result = NET_NFC_OK;
        NppData *npp_data;
 
-       if (handle == NULL)
-       {
+       if (handle == NULL) {
                DEBUG_ERR_MSG("handle is NULL");
                return FALSE;
        }
 
-       if (san == NULL)
-       {
+       if (san == NULL) {
                DEBUG_ERR_MSG("san is NULL");
                return FALSE;
        }
@@ -586,14 +468,8 @@ net_nfc_error_e net_nfc_server_npp_server(net_nfc_target_handle_s *handle,
        npp_data->callback = callback;
        npp_data->user_data = user_data;
 
-       result = net_nfc_server_llcp_simple_server(handle,
-                                               san,
-                                               sap,
-                                               npp_listen_cb,
-                                               npp_socket_error_cb,
-                                               npp_data);
-       if (result != NET_NFC_OK)
-       {
+       result = net_nfc_server_llcp_simple_server(handle, san, sap, npp_listen_cb, npp_socket_error_cb, npp_data);
+       if (result != NET_NFC_OK) {
                DEBUG_ERR_MSG("net_nfc_server_llcp_simple_server failed [%d]", result);
 
                if (npp_data->callback)
@@ -609,12 +485,7 @@ net_nfc_error_e net_nfc_server_npp_server(net_nfc_target_handle_s *handle,
        return result;
 }
 
-net_nfc_error_e net_nfc_server_npp_client(net_nfc_target_handle_s *handle,
-                                       char *san,
-                                       sap_t sap,
-                                       data_s *data,
-                                       net_nfc_server_npp_callback callback,
-                                       gpointer user_data)
+net_nfc_error_e net_nfc_server_npp_client(net_nfc_target_handle_s * handle, char *san, sap_t sap, data_s * data, net_nfc_server_npp_callback callback, gpointer user_data)
 {
        net_nfc_error_e result = NET_NFC_OK;;
        NppData *npp_data;
@@ -641,30 +512,17 @@ net_nfc_error_e net_nfc_server_npp_client(net_nfc_target_handle_s *handle,
        npp_create_message(data, &npp_data->data);
        npp_data->data_offset = 0;
 
-       result = net_nfc_server_llcp_simple_client(handle,
-                                               san,
-                                               sap,
-                                               npp_connected_cb,
-                                               npp_socket_error_cb,
-                                               npp_data);
+       result = net_nfc_server_llcp_simple_client(handle, san, sap, npp_connected_cb, npp_socket_error_cb, npp_data);
        if (result == NET_NFC_OK) {
                if (san != NULL)
-               {
-                       DEBUG_SERVER_MSG("start npp client, san [%s], result [%d]",
-                               san, result);
-               }
+                       DEBUG_SERVER_MSG("start npp client, san [%s], result [%d]", san, result);
                else
-               {
-                       DEBUG_SERVER_MSG("start npp client, sap [%d], result [%d]",
-                               sap, result);
-               }
+                       DEBUG_SERVER_MSG("start npp client, sap [%d], result [%d]", sap, result);
        } else {
                DEBUG_ERR_MSG("net_nfc_server_llcp_simple_client failed, [%d]", result);
 
                if (npp_data->callback)
-               {
                        npp_data->callback(result, NULL, npp_data->user_data);
-               }
 
                net_nfc_util_clear_data(&npp_data->data);
                g_free(npp_data);
@@ -673,34 +531,23 @@ net_nfc_error_e net_nfc_server_npp_client(net_nfc_target_handle_s *handle,
        return result;
 }
 
-net_nfc_error_e net_nfc_server_npp_default_server_start(
-                                       net_nfc_target_handle_s *handle)
+net_nfc_error_e net_nfc_server_npp_default_server_start(net_nfc_target_handle_s * handle)
 {
        /* start default npp server */
-       return net_nfc_server_npp_server(handle,
-                                       NPP_SAN,
-                                       NPP_SAP,
-                                       npp_default_server_cb,
-                                       (gpointer)1234);
+       return net_nfc_server_npp_server(handle, NPP_SAN, NPP_SAP, npp_default_server_cb, (gpointer) 1234);
 }
 
-static void _npp_default_activate_cb(int event,
-       net_nfc_target_handle_s *handle,
-       uint32_t sap, const char *san, void *user_param)
+static void _npp_default_activate_cb(int event, net_nfc_target_handle_s * handle, uint32_t sap, const char *san, void *user_param)
 {
        net_nfc_error_e result;
 
-       DEBUG_SERVER_MSG("event [%d], handle [%p], sap [%d], san [%s]",
-               event, handle, sap, san);
+       DEBUG_SERVER_MSG("event [%d], handle [%p], sap [%d], san [%s]", event, handle, sap, san);
 
        if (event == NET_NFC_LLCP_START) {
                /* start default npp server */
-               result = net_nfc_server_npp_server(handle, (char *)san, sap,
-                       npp_default_server_cb, user_param);
-               if (result != NET_NFC_OK) {
-                       DEBUG_ERR_MSG("net_nfc_server_npp_server failed, [%d]",
-                               result);
-               }
+               result = net_nfc_server_npp_server(handle, (char *)san, sap, npp_default_server_cb, user_param);
+               if (result != NET_NFC_OK)
+                       DEBUG_ERR_MSG("net_nfc_server_npp_server failed, [%d]", result);
        } else if (event == NET_NFC_LLCP_UNREGISTERED) {
                /* unregister server, do nothing */
        }
@@ -714,11 +561,7 @@ net_nfc_error_e net_nfc_server_npp_default_server_register()
        snprintf(id, sizeof(id), "%d", getpid());
 
        /* start default npp server */
-       return net_nfc_server_llcp_register_service(id,
-               NPP_SAP,
-               NPP_SAN,
-               _npp_default_activate_cb,
-               NULL);
+       return net_nfc_server_llcp_register_service(id, NPP_SAP, NPP_SAN, _npp_default_activate_cb, NULL);
 }
 
 net_nfc_error_e net_nfc_server_npp_default_server_unregister()
@@ -729,34 +572,25 @@ net_nfc_error_e net_nfc_server_npp_default_server_unregister()
        snprintf(id, sizeof(id), "%d", getpid());
 
        /* start default npp server */
-       return net_nfc_server_llcp_unregister_service(id,
-               NPP_SAP,
-               NPP_SAN);
+       return net_nfc_server_llcp_unregister_service(id, NPP_SAP, NPP_SAN);
 }
 
-net_nfc_error_e net_nfc_server_npp_default_client_start(
-                               net_nfc_target_handle_s *handle,
-                               data_s *data,
-                               int client,
-                               gpointer user_data)
+net_nfc_error_e net_nfc_server_npp_default_client_start(net_nfc_target_handle_s * handle, data_s * data, int client, gpointer user_data)
 {
        NppClientStartData *npp_client_data;
        net_nfc_error_e result;
 
-       if (handle == NULL)
-       {
+       if (handle == NULL) {
                DEBUG_ERR_MSG("handle is NULL");
                return NET_NFC_NULL_PARAMETER;
        }
 
-       if (data == NULL)
-       {
+       if (data == NULL) {
                DEBUG_ERR_MSG("data is NULL");
                return NET_NFC_NULL_PARAMETER;
        }
 
-       if (data->buffer == NULL || data->length == 0)
-       {
+       if (data->buffer == NULL || data->length == 0) {
                DEBUG_ERR_MSG("data->buffer is NULL");
                return NET_NFC_NULL_PARAMETER;
        }
@@ -767,15 +601,9 @@ net_nfc_error_e net_nfc_server_npp_default_client_start(
        npp_client_data->client = client;
        npp_client_data->user_data = user_data;
 
-       result = net_nfc_server_npp_client(handle,
-                                       NPP_SAN,
-                                       NPP_SAP,
-                                       data,
-                                       npp_default_client_cb,
-                                       npp_client_data);
+       result = net_nfc_server_npp_client(handle, NPP_SAN, NPP_SAP, data, npp_default_client_cb, npp_client_data);
 
-       if (result != NET_NFC_OK)
-       {
+       if (result != NET_NFC_OK) {
                DEBUG_ERR_MSG("net_nfc_server_client failed");
                g_free(npp_client_data);
        }
index 3adc3a0..8495ae3 100755 (executable)
 #include "net_nfc_app_util_internal.h"
 #include "net_nfc_util_gdbus_internal.h"
 
-
-typedef struct _net_nfc_server_snep_msg_t
-{
+typedef struct _net_nfc_server_snep_msg_t {
        uint8_t version;
        uint8_t op;
        uint32_t length;
        uint8_t data[0];
-}
-__attribute__ ((packed)) net_nfc_server_snep_msg_t;
+} __attribute__ ((packed)) net_nfc_server_snep_msg_t;
 
-typedef struct _net_nfc_server_snep_get_msg_t
-{
+typedef struct _net_nfc_server_snep_get_msg_t {
        uint32_t length;
        uint8_t data[0];
-}
-__attribute__ ((packed)) net_nfc_server_snep_get_msg_t;
+} __attribute__ ((packed)) net_nfc_server_snep_get_msg_t;
 
-typedef struct _net_nfc_server_cb_data_t
-{
+typedef struct _net_nfc_server_cb_data_t {
        net_nfc_server_snep_listen_cb cb;
        void *user_param;
-}
-net_nfc_server_cb_data_t;
+} net_nfc_server_cb_data_t;
 
-typedef struct _net_nfc_server_snep_context_t
-{
+typedef struct _net_nfc_server_snep_context_t {
        net_nfc_target_handle_s *handle;
        net_nfc_error_e result;
        net_nfc_llcp_socket_t socket;
@@ -62,11 +54,9 @@ typedef struct _net_nfc_server_snep_context_t
        net_nfc_server_snep_cb cb;
        void *user_param;
        GQueue queue;
-}
-net_nfc_server_snep_context_t;
+} net_nfc_server_snep_context_t;
 
-typedef struct _net_nfc_server_snep_job_t
-{
+typedef struct _net_nfc_server_snep_job_t {
        net_nfc_server_snep_context_t *context;
        net_nfc_target_handle_s *handle;
        net_nfc_error_e result;
@@ -76,36 +66,25 @@ typedef struct _net_nfc_server_snep_job_t
        data_s data;
        net_nfc_server_snep_cb cb;
        void *user_param;
-}
-net_nfc_server_snep_job_t;
+} net_nfc_server_snep_job_t;
 
-
-typedef struct __net_nfc_server_snep_server_context_t
-{
+typedef struct __net_nfc_server_snep_server_context_t {
        net_nfc_target_handle_s *handle;
        int client;
        void *user_param;
-}
-_net_nfc_server_snep_server_context_t;
+} _net_nfc_server_snep_server_context_t;
 
-typedef struct __net_nfc_server_snep_service_context_t
-{
+typedef struct __net_nfc_server_snep_service_context_t {
        net_nfc_target_handle_s *handle;
        int client;
        uint32_t type;
        data_s data;
        void *user_param;
-}
-_net_nfc_server_snep_service_context_t;
+} _net_nfc_server_snep_service_context_t;
 
-typedef void (*_net_nfc_server_snep_operation_cb)(
-                               net_nfc_error_e result,
-                               uint32_t type,
-                               data_s *data,
-                               void *user_param);
+typedef void (*_net_nfc_server_snep_operation_cb) (net_nfc_error_e result, uint32_t type, data_s * data, void *user_param);
 
-typedef struct _net_nfc_server_snep_op_context_t
-{
+typedef struct _net_nfc_server_snep_op_context_t {
        net_nfc_target_handle_s *handle;
        net_nfc_error_e result;
        int socket;
@@ -117,9 +96,7 @@ typedef struct _net_nfc_server_snep_op_context_t
        uint32_t offset;
        _net_nfc_server_snep_operation_cb cb;
        void *user_param;
-}
-
-net_nfc_server_snep_op_context_t;
+} net_nfc_server_snep_op_context_t;
 
 #define SNEP_MAJOR_VER                 1
 #define SNEP_MINOR_VER                 0
@@ -139,70 +116,44 @@ net_nfc_server_snep_op_context_t;
 
 static GList *list_listen_cb = NULL;
 
-static void _net_nfc_server_snep_recv(
-                               net_nfc_server_snep_op_context_t *context);
-
-static void _net_nfc_server_snep_send(
-                               net_nfc_server_snep_op_context_t *context);
+static void _net_nfc_server_snep_recv(net_nfc_server_snep_op_context_t * context);
 
-static net_nfc_error_e net_nfc_server_snep_recv(
-                               net_nfc_target_handle_s *handle,
-                               net_nfc_llcp_socket_t socket,
-                               _net_nfc_server_snep_operation_cb cb,
-                               void *user_param);
+static void _net_nfc_server_snep_send(net_nfc_server_snep_op_context_t * context);
 
-static net_nfc_error_e net_nfc_server_snep_send(
-                               net_nfc_target_handle_s *handle,
-                               net_nfc_llcp_socket_t socket,
-                               uint32_t type,
-                               data_s *data,
-                               _net_nfc_server_snep_operation_cb cb,
-                               void *user_param);
+static net_nfc_error_e net_nfc_server_snep_recv(net_nfc_target_handle_s * handle, net_nfc_llcp_socket_t socket, _net_nfc_server_snep_operation_cb cb, void *user_param);
 
+static net_nfc_error_e net_nfc_server_snep_send(net_nfc_target_handle_s * handle, net_nfc_llcp_socket_t socket, uint32_t type, data_s * data, _net_nfc_server_snep_operation_cb cb, void *user_param);
 
-static void _net_nfc_server_snep_client_process(
-                               net_nfc_server_snep_job_t *job);
+static void _net_nfc_server_snep_client_process(net_nfc_server_snep_job_t * job);
 
-static void _net_nfc_server_snep_server_process(
-                               net_nfc_server_snep_context_t *context);
+static void _net_nfc_server_snep_server_process(net_nfc_server_snep_context_t * context);
 
 /**********************************************************************/
-static bool _net_nfc_server_snep_add_get_response_cb(
-                                       net_nfc_server_snep_listen_cb cb,
-                                       void *user_param)
+static bool _net_nfc_server_snep_add_get_response_cb(net_nfc_server_snep_listen_cb cb, void *user_param)
 {
        net_nfc_server_cb_data_t *data = NULL;
        bool result = false;
 
        _net_nfc_util_alloc_mem(data, sizeof(*data));
-       if (data != NULL)
-       {
+       if (data != NULL) {
                data->cb = cb;
                data->user_param = user_param;
 
                list_listen_cb = g_list_append(list_listen_cb, data);
                if (list_listen_cb != NULL)
-               {
                        result = true;
-               }
                else
-               {
                        DEBUG_ERR_MSG("g_list_append failed");
-               }
-       }
-       else
-       {
+       } else {
                DEBUG_ERR_MSG("_net_nfc_util_alloc_mem failed");
        }
 
        return result;
 }
 
-static gint _net_nfc_server_snep_compare_func_cb(
-                                       gconstpointer a,
-                                       gconstpointer b)
+static gint _net_nfc_server_snep_compare_func_cb(gconstpointer a, gconstpointer b)
 {
-       net_nfc_server_cb_data_t *data = (net_nfc_server_cb_data_t *)a;
+       net_nfc_server_cb_data_t *data = (net_nfc_server_cb_data_t *) a;
 
        if (data->cb == (void *)b)
                return 0;
@@ -210,56 +161,37 @@ static gint _net_nfc_server_snep_compare_func_cb(
                return 1;
 }
 
-static void _net_nfc_server_snep_del_get_response_cb(
-                                       net_nfc_server_snep_listen_cb cb)
+static void _net_nfc_server_snep_del_get_response_cb(net_nfc_server_snep_listen_cb cb)
 {
        GList *list;
 
-       list = g_list_find_custom(list_listen_cb,
-                               cb,
-                               _net_nfc_server_snep_compare_func_cb);
+       list = g_list_find_custom(list_listen_cb, cb, _net_nfc_server_snep_compare_func_cb);
 
        if (list != NULL)
                list_listen_cb = g_list_delete_link(list_listen_cb, list);
 }
 
-static bool _net_nfc_server_snep_process_get_response_cb(
-                               net_nfc_target_handle_s *handle,
-                               data_s *data,
-                               uint32_t max_len)
+static bool _net_nfc_server_snep_process_get_response_cb(net_nfc_target_handle_s * handle, data_s * data, uint32_t max_len)
 {
        GList *list = list_listen_cb;
 
-       for(list = g_list_first(list); list != NULL; list = g_list_next(list))
-       {
-               net_nfc_server_cb_data_t *cb_data =
-                       (net_nfc_server_cb_data_t *)list->data;
+       for (list = g_list_first(list); list != NULL; list = g_list_next(list)) {
+               net_nfc_server_cb_data_t *cb_data = (net_nfc_server_cb_data_t *) list->data;
 
-               if(list->data == NULL)
+               if (list->data == NULL)
                        continue;
 
-               if (cb_data->cb != NULL)
-               {
+               if (cb_data->cb != NULL) {
                        DEBUG_SERVER_MSG("invoke callback [%p]", cb_data->cb);
-                       if (cb_data->cb(handle,
-                               SNEP_REQ_GET,
-                               max_len,
-                               data,
-                               cb_data->user_param) == true)
-                       return true;
+                       if (cb_data->cb(handle, SNEP_REQ_GET, max_len, data, cb_data->user_param) == true)
+                               return true;
                }
        }
 
        return false;
 }
 
-static net_nfc_server_snep_op_context_t *
-_net_nfc_server_snep_create_send_context(uint32_t type,
-                       net_nfc_target_handle_s *handle,
-                       net_nfc_llcp_socket_t socket,
-                       data_s *data,
-                       void *cb,
-                       void *user_param)
+static net_nfc_server_snep_op_context_t *_net_nfc_server_snep_create_send_context(uint32_t type, net_nfc_target_handle_s * handle, net_nfc_llcp_socket_t socket, data_s * data, void *cb, void *user_param)
 {
        net_nfc_server_snep_op_context_t *context = NULL;
        uint32_t data_len = 0;
@@ -267,64 +199,48 @@ _net_nfc_server_snep_create_send_context(uint32_t type,
        net_nfc_llcp_config_info_s config;
        net_nfc_error_e result;
 
-       if (net_nfc_controller_llcp_get_remote_config(handle,
-                       &config, &result) == false)
-       {
-               DEBUG_ERR_MSG("net_nfc_controller_llcp_get_remote_config failed, [%d]",
-                                       result);
+       if (net_nfc_controller_llcp_get_remote_config(handle, &config, &result) == false) {
+               DEBUG_ERR_MSG("net_nfc_controller_llcp_get_remote_config failed, [%d]", result);
 
                return NULL;
        }
 
        _net_nfc_util_alloc_mem(context, sizeof(*context));
        if (context == NULL)
-       {
                return NULL;
-       }
 
        if (type == SNEP_REQ_GET)
-       {
                data_len = sizeof(net_nfc_server_snep_msg_t);
-       }
 
        if (data != NULL)
-       {
                data_len += data->length;
-       }
 
        net_nfc_util_init_data(&context->data, SNEP_HEADER_LEN + data_len);
-       if (context->data.buffer == NULL)
-       {
+       if (context->data.buffer == NULL) {
                _net_nfc_util_free_mem(context);
                return NULL;
        }
 
-       msg = (net_nfc_server_snep_msg_t *)context->data.buffer;
+       msg = (net_nfc_server_snep_msg_t *) context->data.buffer;
 
        msg->version = SNEP_VERSION;
        msg->op = type;
 
-       if (data_len > 0)
-       {
+       if (data_len > 0) {
                uint8_t *buffer;
 
                msg->length = htonl(data_len);
 
-               if (type == SNEP_REQ_GET)
-               {
-                       net_nfc_server_snep_msg_t *get_msg =
-                               (net_nfc_server_snep_msg_t *)msg->data;
+               if (type == SNEP_REQ_GET) {
+                       net_nfc_server_snep_msg_t *get_msg = (net_nfc_server_snep_msg_t *) msg->data;
 
                        get_msg->length = htonl(SNEP_MAX_LEN);
                        buffer = get_msg->data;
-               }
-               else
-               {
+               } else {
                        buffer = msg->data;
                }
 
-               if (data != NULL && data->buffer != NULL)
-               {
+               if (data != NULL && data->buffer != NULL) {
                        DEBUG_SERVER_MSG("data->length [%d]", data->length);
 
                        /* copy ndef information to response msg */
@@ -343,23 +259,14 @@ _net_nfc_server_snep_create_send_context(uint32_t type,
        return context;
 }
 
-static net_nfc_server_snep_op_context_t *
-_net_nfc_server_snep_create_recv_context(
-                       net_nfc_target_handle_s *handle,
-                       net_nfc_llcp_socket_t socket,
-                       void *cb,
-                       void *user_param)
+static net_nfc_server_snep_op_context_t *_net_nfc_server_snep_create_recv_context(net_nfc_target_handle_s * handle, net_nfc_llcp_socket_t socket, void *cb, void *user_param)
 {
        net_nfc_server_snep_op_context_t *context = NULL;
        net_nfc_llcp_config_info_s config;
        net_nfc_error_e result;
 
-       if (net_nfc_controller_llcp_get_remote_config(handle,
-                                       &config,
-                                       &result) == false)
-       {
-               DEBUG_ERR_MSG("net_nfc_controller_llcp_get_remote_config failed, [%d]",
-                                       result);
+       if (net_nfc_controller_llcp_get_remote_config(handle, &config, &result) == false) {
+               DEBUG_ERR_MSG("net_nfc_controller_llcp_get_remote_config failed, [%d]", result);
                return NULL;
        }
 
@@ -378,11 +285,9 @@ _net_nfc_server_snep_create_recv_context(
        return context;
 }
 
-static void _net_nfc_server_snep_destory_context(
-                               net_nfc_server_snep_op_context_t *context)
+static void _net_nfc_server_snep_destory_context(net_nfc_server_snep_op_context_t * context)
 {
-       if (context != NULL)
-       {
+       if (context != NULL) {
                if (context->data.buffer != NULL)
                        net_nfc_util_clear_data(&context->data);
 
@@ -390,49 +295,36 @@ static void _net_nfc_server_snep_destory_context(
        }
 }
 
-static void _net_nfc_server_recv_fragment_cb(
-                               net_nfc_llcp_socket_t socket,
-                               net_nfc_error_e result,
-                               data_s *data,
-                               void *extra,
-                               void *user_param)
+static void _net_nfc_server_recv_fragment_cb(net_nfc_llcp_socket_t socket, net_nfc_error_e result, data_s * data, void *extra, void *user_param)
 {
-       net_nfc_server_snep_op_context_t *context =
-               (net_nfc_server_snep_op_context_t *)user_param;
+       net_nfc_server_snep_op_context_t *context = (net_nfc_server_snep_op_context_t *) user_param;
        uint8_t *buffer;
        uint32_t length;
 
-       DEBUG_SERVER_MSG("_net_nfc_server_recv_fragment_cb,"
-                               " socket [%x], result [%d]",socket, result);
+       DEBUG_SERVER_MSG("_net_nfc_server_recv_fragment_cb," " socket [%x], result [%d]", socket, result);
 
        if (context == NULL)
                return;
 
        context->result = result;
 
-       if (result != NET_NFC_OK)
-       {
+       if (result != NET_NFC_OK) {
                DEBUG_ERR_MSG("error [%d]", result);
                context->state = NET_NFC_STATE_ERROR;
                goto END;
        }
 
-       if (data == NULL || data->buffer == NULL || data->length == 0)
-       {
+       if (data == NULL || data->buffer == NULL || data->length == 0) {
                DEBUG_ERR_MSG("invalid response");
                context->state = NET_NFC_STATE_ERROR;
                goto END;
        }
 
-       if (context->state == NET_NFC_LLCP_STEP_01)
-       {
-               net_nfc_server_snep_msg_t *msg =
-                       (net_nfc_server_snep_msg_t *)data->buffer;
+       if (context->state == NET_NFC_LLCP_STEP_01) {
+               net_nfc_server_snep_msg_t *msg = (net_nfc_server_snep_msg_t *) data->buffer;
 
-               if (data->length < SNEP_HEADER_LEN)
-               {
-                       DEBUG_ERR_MSG("too short data, length [%d]",
-                                               data->length);
+               if (data->length < SNEP_HEADER_LEN) {
+                       DEBUG_ERR_MSG("too short data, length [%d]", data->length);
                        /* FIXME!!! what should I do. */
                        context->type = SNEP_RESP_BAD_REQ;
                        context->state = NET_NFC_STATE_ERROR;
@@ -441,111 +333,79 @@ static void _net_nfc_server_recv_fragment_cb(
                }
 
                length = htonl(msg->length);
-#if 0 /* snep unlimited */
-               if (length > SNEP_MAX_LEN)
-               {
-                       DEBUG_ERR_MSG("too long snep message, length [%d]",
-                                               length);
+#if 0                                                  /* snep unlimited */
+               if (length > SNEP_MAX_LEN) {
+                       DEBUG_ERR_MSG("too long snep message, length [%d]", length);
                        if (IS_SNEP_REQ(msg->op))
-                       {
                                context->type = SNEP_RESP_EXCESS_DATA;
-                       }
                        else
-                       {
                                context->type = SNEP_REQ_REJECT;
-                       }
                        context->state = NET_NFC_LLCP_STEP_04;
                        context->result = NET_NFC_INSUFFICIENT_STORAGE;
                        goto END;
                }
 #endif
-               if (IS_SNEP_REQ(msg->op) &&
-                       GET_MAJOR_VER(msg->version) > SNEP_MAJOR_VER)
-               {
-                       DEBUG_ERR_MSG("not supported version, version [0x%02x]",
-                                               msg->version);
+               if (IS_SNEP_REQ(msg->op) && GET_MAJOR_VER(msg->version) > SNEP_MAJOR_VER) {
+                       DEBUG_ERR_MSG("not supported version, version [0x%02x]", msg->version);
                        context->type = SNEP_RESP_UNSUPPORTED_VER;
                        context->state = NET_NFC_LLCP_STEP_04;
                        context->result = NET_NFC_NOT_SUPPORTED;
                        goto END;
                }
 
-               if (length > 0)
-               {
+               if (length > 0) {
                        /* buffer create */
                        net_nfc_util_init_data(&context->data, length);
-                       if (context->data.buffer == NULL)
-                       {
+                       if (context->data.buffer == NULL) {
                                DEBUG_ERR_MSG("net_nfc_util_alloc_data failed");
                                if (IS_SNEP_REQ(msg->op))
-                               {
                                        context->type = SNEP_RESP_REJECT;
-                               }
                                else
-                               {
                                        context->type = SNEP_REQ_REJECT;
-                               }
                                context->state = NET_NFC_LLCP_STEP_04;
                                context->result = NET_NFC_ALLOC_FAIL;
                                goto END;
                        }
                }
 
-               DEBUG_SERVER_MSG("incoming message, type [0x%02x], length [%d]",
-                                       msg->op, length);
+               DEBUG_SERVER_MSG("incoming message, type [0x%02x], length [%d]", msg->op, length);
 
                context->type = msg->op;
                buffer = msg->data;
                length = data->length - SNEP_HEADER_LEN;
                context->state = NET_NFC_LLCP_STEP_02;
-       }
-       else
-       {
+       } else {
                buffer = data->buffer;
                length = data->length;
                context->state = NET_NFC_LLCP_STEP_03;
        }
 
-       if (context->data.length > 0)
-       {
+       if (context->data.length > 0) {
                /* copy data */
-               memcpy(context->data.buffer + context->offset,
-                                       buffer, length);
+               memcpy(context->data.buffer + context->offset, buffer, length);
                context->offset += length;
 
-               DEBUG_SERVER_MSG("receive progress... [%d|%d]",
-                                       context->offset, context->data.length);
+               DEBUG_SERVER_MSG("receive progress... [%d|%d]", context->offset, context->data.length);
 
                if (context->offset >= context->data.length)
                        context->state = NET_NFC_LLCP_STEP_RETURN;
 
-       }
-       else
-       {
+       } else {
                DEBUG_SERVER_MSG("receive complete... [no ndef message]");
                context->state = NET_NFC_LLCP_STEP_RETURN;
        }
 
-END :
+ END:
        _net_nfc_server_snep_recv(context);
 }
 
-
-static void _net_nfc_server_recv_fragment(
-                               net_nfc_server_snep_op_context_t *context)
+static void _net_nfc_server_recv_fragment(net_nfc_server_snep_op_context_t * context)
 {
        net_nfc_error_e result;
 
        DEBUG_SERVER_MSG("socket [%x] waiting data.....", context->socket);
 
-       if (net_nfc_controller_llcp_recv(
-                               context->handle,
-                               context->socket,
-                               context->miu,
-                               &result,
-                               _net_nfc_server_recv_fragment_cb,
-                               context) == false)
-       {
+       if (net_nfc_controller_llcp_recv(context->handle, context->socket, context->miu, &result, _net_nfc_server_recv_fragment_cb, context) == false) {
                DEBUG_ERR_MSG("net_nfc_controller_llcp_recv failed, [%d]", result);
                context->state = NET_NFC_STATE_ERROR;
                context->result = result;
@@ -553,27 +413,19 @@ static void _net_nfc_server_recv_fragment(
        }
 }
 
-
-void _net_nfc_server_snep_recv_send_cb(
-                               net_nfc_error_e result,
-                               uint32_t type,
-                               data_s *data,
-                               void *user_param)
+void _net_nfc_server_snep_recv_send_cb(net_nfc_error_e result, uint32_t type, data_s * data, void *user_param)
 {
-       net_nfc_server_snep_op_context_t *context =
-                       (net_nfc_server_snep_op_context_t *)user_param;
+       net_nfc_server_snep_op_context_t *context = (net_nfc_server_snep_op_context_t *) user_param;
 
        DEBUG_SERVER_MSG("_net_nfc_server_snep_recv_send_cb, result [%d]", result);
 
-       if (context == NULL)/* TODO */
+       if (context == NULL)            /* TODO */
                return;
 
        if (result == NET_NFC_OK)
                context->state = NET_NFC_LLCP_STEP_03;
-       else
-       {
-               DEBUG_ERR_MSG("net_nfc_server_snep_send failed, [0x%x][%d]",
-                                       type, result);
+       else {
+               DEBUG_ERR_MSG("net_nfc_server_snep_send failed, [0x%x][%d]", type, result);
                context->state = NET_NFC_STATE_ERROR;
                context->result = result;
        }
@@ -581,50 +433,38 @@ void _net_nfc_server_snep_recv_send_cb(
        _net_nfc_server_snep_recv(context);
 }
 
-void _net_nfc_server_snep_recv_send_reject_cb(
-                               net_nfc_error_e result,
-                               uint32_t type,
-                               data_s *data,
-                               void *user_param)
+void _net_nfc_server_snep_recv_send_reject_cb(net_nfc_error_e result, uint32_t type, data_s * data, void *user_param)
 {
-       net_nfc_server_snep_op_context_t *context =
-                       (net_nfc_server_snep_op_context_t *)user_param;
+       net_nfc_server_snep_op_context_t *context = (net_nfc_server_snep_op_context_t *) user_param;
 
-       DEBUG_SERVER_MSG("_net_nfc_server_snep_recv_send_reject_cb,"
-                       " result [%d]", result);
+       DEBUG_SERVER_MSG("_net_nfc_server_snep_recv_send_reject_cb," " result [%d]", result);
 
-       if (context == NULL)/* TODO */
+       if (context == NULL)            /* TODO */
                return;
 
        context->state = NET_NFC_LLCP_STEP_RETURN;
 
        if (result != NET_NFC_OK)
-       {
-               DEBUG_ERR_MSG("net_nfc_server_snep_send failed, [0x%x][%d]",
-                               type, result);
-       }
+               DEBUG_ERR_MSG("net_nfc_server_snep_send failed, [0x%x][%d]", type, result);
 
        _net_nfc_server_snep_recv(context);
 }
 
-static void _net_nfc_server_snep_recv(
-                       net_nfc_server_snep_op_context_t *context)
+static void _net_nfc_server_snep_recv(net_nfc_server_snep_op_context_t * context)
 {
        if (context == NULL)
                return;
 
-       switch (context->state)
-       {
-       case NET_NFC_LLCP_STEP_01 :
-       case NET_NFC_LLCP_STEP_03 :
-               DEBUG_SERVER_MSG("NET_NFC_LLCP_STEP_%02d",
-                       context->state - NET_NFC_LLCP_STEP_01 + 1);
+       switch (context->state) {
+       case NET_NFC_LLCP_STEP_01:
+       case NET_NFC_LLCP_STEP_03:
+               DEBUG_SERVER_MSG("NET_NFC_LLCP_STEP_%02d", context->state - NET_NFC_LLCP_STEP_01 + 1);
 
                /* receive fragment */
                _net_nfc_server_recv_fragment(context);
                break;
 
-       case NET_NFC_LLCP_STEP_02 :
+       case NET_NFC_LLCP_STEP_02:
                {
                        uint8_t op = context->type;
 
@@ -634,59 +474,38 @@ static void _net_nfc_server_snep_recv(
                        op = SNEP_MAKE_PAIR_OP(op, SNEP_REQ_CONTINUE);
 
                        /* send response */
-                       net_nfc_server_snep_send(
-                               context->handle,
-                               context->socket,
-                               op,
-                               NULL,
-                               _net_nfc_server_snep_recv_send_cb,
-                               context);
+                       net_nfc_server_snep_send(context->handle, context->socket, op, NULL, _net_nfc_server_snep_recv_send_cb, context);
                }
                break;
 
-       case NET_NFC_LLCP_STEP_04 :
+       case NET_NFC_LLCP_STEP_04:
                {
                        DEBUG_SERVER_MSG("NET_NFC_LLCP_STEP_04");
 
                        /* send response */
-                       net_nfc_server_snep_send(
-                               context->handle,
-                               context->socket,
-                               context->type,
-                               NULL,
-                               _net_nfc_server_snep_recv_send_reject_cb,
-                               context);
+                       net_nfc_server_snep_send(context->handle, context->socket, context->type, NULL, _net_nfc_server_snep_recv_send_reject_cb, context);
                }
                break;
 
-       case NET_NFC_LLCP_STEP_RETURN :
+       case NET_NFC_LLCP_STEP_RETURN:
                {
                        DEBUG_SERVER_MSG("NET_NFC_LLCP_STEP_RETURN");
 
                        /* complete and invoke callback */
-                       context->cb(
-                               context->result,
-                               context->type,
-                               &context->data,
-                               context->user_param);
+                       context->cb(context->result, context->type, &context->data, context->user_param);
 
                        _net_nfc_server_snep_destory_context(context);
                }
                break;
 
-       case NET_NFC_STATE_ERROR :
-       default :
+       case NET_NFC_STATE_ERROR:
+       default:
                DEBUG_ERR_MSG("NET_NFC_STATE_ERROR");
 
                /* error, invoke callback */
-               DEBUG_ERR_MSG("net_nfc_server_snep_recv failed, [%d]",
-                               context->result);
+               DEBUG_ERR_MSG("net_nfc_server_snep_recv failed, [%d]", context->result);
 
-               context->cb(
-                       context->result,
-                       context->type,
-                       NULL,
-                       context->user_param);
+               context->cb(context->result, context->type, NULL, context->user_param);
 
                _net_nfc_server_snep_destory_context(context);
 
@@ -694,22 +513,13 @@ static void _net_nfc_server_snep_recv(
        }
 }
 
-static net_nfc_error_e
-net_nfc_server_snep_recv(
-                       net_nfc_target_handle_s *handle,
-                       net_nfc_llcp_socket_t socket,
-                       _net_nfc_server_snep_operation_cb cb,
-                       void *user_param)
+static net_nfc_error_e net_nfc_server_snep_recv(net_nfc_target_handle_s * handle, net_nfc_llcp_socket_t socket, _net_nfc_server_snep_operation_cb cb, void *user_param)
 {
        net_nfc_server_snep_op_context_t *context;
        net_nfc_error_e result;
 
        /* create context */
-       context = _net_nfc_server_snep_create_recv_context(
-                                               handle,
-                                               socket,
-                                               cb,
-                                               user_param);
+       context = _net_nfc_server_snep_create_recv_context(handle, socket, cb, user_param);
        if (context != NULL) {
                /* send response */
                _net_nfc_server_snep_recv(context);
@@ -717,65 +527,45 @@ net_nfc_server_snep_recv(
        } else {
                result = NET_NFC_ALLOC_FAIL;
 
-               if (cb != NULL) {
+               if (cb != NULL)
                        cb(result, -1, NULL, user_param);
-               }
        }
 
        return result;
 }
 
-static void _net_nfc_server_send_fragment_cb(
-                               net_nfc_llcp_socket_t socket,
-                               net_nfc_error_e result,
-                               data_s *data,
-                               void *extra,
-                               void *user_param)
+static void _net_nfc_server_send_fragment_cb(net_nfc_llcp_socket_t socket, net_nfc_error_e result, data_s * data, void *extra, void *user_param)
 {
-       net_nfc_server_snep_op_context_t *context =
-               (net_nfc_server_snep_op_context_t *)user_param;
+       net_nfc_server_snep_op_context_t *context = (net_nfc_server_snep_op_context_t *) user_param;
 
-       DEBUG_SERVER_MSG("_net_nfc_server_send_fragment_cb,"
-                       " socket [%x], result [%d]",socket, result);
+       DEBUG_SERVER_MSG("_net_nfc_server_send_fragment_cb," " socket [%x], result [%d]", socket, result);
 
        if (context == NULL)
                return;
 
        context->result = result;
 
-       if (result == NET_NFC_OK)
-       {
-               DEBUG_SERVER_MSG("send progress... [%d|%d]",
-                               context->offset, context->data.length);
-               if (context->offset < context->data.length)
-               {
-                       if (context->state == NET_NFC_LLCP_STEP_01)
-                       {
+       if (result == NET_NFC_OK) {
+               DEBUG_SERVER_MSG("send progress... [%d|%d]", context->offset, context->data.length);
+               if (context->offset < context->data.length) {
+                       if (context->state == NET_NFC_LLCP_STEP_01) {
                                /* first fragment */
                                context->state = NET_NFC_LLCP_STEP_02;
-                       }
-                       else
-                       {
+                       } else {
                                context->state = NET_NFC_LLCP_STEP_03;
                        }
-               }
-               else
-               {
+               } else {
                        context->state = NET_NFC_LLCP_STEP_RETURN;
                }
-       }
-       else
-       {
-               DEBUG_ERR_MSG("net_nfc_controller_llcp_send failed, [%d]",
-                                       result);
+       } else {
+               DEBUG_ERR_MSG("net_nfc_controller_llcp_send failed, [%d]", result);
                context->state = NET_NFC_STATE_ERROR;
        }
 
        _net_nfc_server_snep_send(context);
 }
 
-static void _net_nfc_server_send_fragment(
-                               net_nfc_server_snep_op_context_t *context)
+static void _net_nfc_server_send_fragment(net_nfc_server_snep_op_context_t * context)
 {
        data_s req_msg;
        uint32_t remain_len;
@@ -790,40 +580,25 @@ static void _net_nfc_server_send_fragment(
        req_msg.length = (remain_len < context->miu) ? remain_len : context->miu;
        req_msg.buffer = context->data.buffer + context->offset;
 
-       DEBUG_SERVER_MSG("try to send data, socket [%x], offset [%d],"
-                       " current [%d], remain [%d]",context->socket, context->offset,
-                       req_msg.length, remain_len - req_msg.length);
+       DEBUG_SERVER_MSG("try to send data, socket [%x], offset [%d]," " current [%d], remain [%d]", context->socket, context->offset, req_msg.length, remain_len - req_msg.length);
 
        context->offset += req_msg.length;
 
-       if (net_nfc_controller_llcp_send(context->handle,
-                                       context->socket,
-                                       &req_msg,
-                                       &result,
-                                       _net_nfc_server_send_fragment_cb,
-                                       context) == false)
-       {
-               DEBUG_ERR_MSG("net_nfc_controller_llcp_send failed, [%d]",
-                                       result);
+       if (net_nfc_controller_llcp_send(context->handle, context->socket, &req_msg, &result, _net_nfc_server_send_fragment_cb, context) == false) {
+               DEBUG_ERR_MSG("net_nfc_controller_llcp_send failed, [%d]", result);
                context->state = NET_NFC_STATE_ERROR;
                context->result = result;
                _net_nfc_server_snep_send(context);
        }
 }
 
-void _net_nfc_server_snep_send_recv_cb(
-                               net_nfc_error_e result,
-                               uint32_t type,
-                               data_s *data,
-                               void *user_param)
+void _net_nfc_server_snep_send_recv_cb(net_nfc_error_e result, uint32_t type, data_s * data, void *user_param)
 {
-       net_nfc_server_snep_op_context_t *context =
-               (net_nfc_server_snep_op_context_t *)user_param;
+       net_nfc_server_snep_op_context_t *context = (net_nfc_server_snep_op_context_t *) user_param;
 
-       DEBUG_SERVER_MSG("_net_nfc_server_snep_send_recv_cb,"
-                               " result [%d]", result);
+       DEBUG_SERVER_MSG("_net_nfc_server_snep_send_recv_cb," " result [%d]", result);
 
-       if (context == NULL)/* TODO */
+       if (context == NULL)            /* TODO */
                return;
 
        DEBUG_SERVER_MSG("received message, type [%d]", type);
@@ -831,41 +606,40 @@ void _net_nfc_server_snep_send_recv_cb(
        context->result = result;
        context->type = type;
 
-       switch (type)
-       {
-       case SNEP_REQ_CONTINUE :
-       case SNEP_RESP_CONT :
+       switch (type) {
+       case SNEP_REQ_CONTINUE:
+       case SNEP_RESP_CONT:
                context->state = NET_NFC_LLCP_STEP_03;
                break;
 
-       case SNEP_REQ_REJECT :
-       case SNEP_RESP_REJECT :
+       case SNEP_REQ_REJECT:
+       case SNEP_RESP_REJECT:
                context->state = NET_NFC_STATE_ERROR;
                context->result = NET_NFC_LLCP_SOCKET_FRAME_REJECTED;
                break;
 
-       case SNEP_RESP_NOT_FOUND :
+       case SNEP_RESP_NOT_FOUND:
                context->state = NET_NFC_STATE_ERROR;
                context->result = NET_NFC_NO_DATA_FOUND;
                break;
 
-       case SNEP_RESP_EXCESS_DATA :
+       case SNEP_RESP_EXCESS_DATA:
                context->state = NET_NFC_STATE_ERROR;
                context->result = NET_NFC_INSUFFICIENT_STORAGE;
                break;
 
-       case SNEP_RESP_BAD_REQ :
+       case SNEP_RESP_BAD_REQ:
                context->state = NET_NFC_STATE_ERROR;
                context->result = NET_NFC_INVALID_FORMAT;
                break;
 
-       case SNEP_RESP_NOT_IMPLEMENT :
-       case SNEP_RESP_UNSUPPORTED_VER :
+       case SNEP_RESP_NOT_IMPLEMENT:
+       case SNEP_RESP_UNSUPPORTED_VER:
                context->state = NET_NFC_STATE_ERROR;
                context->result = NET_NFC_NOT_ALLOWED_OPERATION;
                break;
 
-       default :
+       default:
                context->state = NET_NFC_STATE_ERROR;
                context->result = NET_NFC_OPERATION_FAIL;
                break;
@@ -874,131 +648,87 @@ void _net_nfc_server_snep_send_recv_cb(
        _net_nfc_server_snep_send(context);
 }
 
-static void _net_nfc_server_snep_send(
-                       net_nfc_server_snep_op_context_t *context)
+static void _net_nfc_server_snep_send(net_nfc_server_snep_op_context_t * context)
 {
        if (context == NULL)
-       {
                return;
-       }
 
-       switch (context->state)
-       {
-       case NET_NFC_LLCP_STEP_01 :
-       case NET_NFC_LLCP_STEP_03 :
-               DEBUG_SERVER_MSG("NET_NFC_LLCP_STEP_%02d",
-                               context->state - NET_NFC_LLCP_STEP_01 + 1);
+       switch (context->state) {
+       case NET_NFC_LLCP_STEP_01:
+       case NET_NFC_LLCP_STEP_03:
+               DEBUG_SERVER_MSG("NET_NFC_LLCP_STEP_%02d", context->state - NET_NFC_LLCP_STEP_01 + 1);
 
                /* send fragment */
                _net_nfc_server_send_fragment(context);
                break;
 
-       case NET_NFC_LLCP_STEP_02 :
+       case NET_NFC_LLCP_STEP_02:
                DEBUG_SERVER_MSG("NET_NFC_LLCP_STEP_02");
 
                /* receive response */
-               net_nfc_server_snep_recv(
-                       context->handle,
-                       context->socket,
-                       _net_nfc_server_snep_send_recv_cb,
-                       context);
+               net_nfc_server_snep_recv(context->handle, context->socket, _net_nfc_server_snep_send_recv_cb, context);
                break;
 
-       case NET_NFC_LLCP_STEP_RETURN :
+       case NET_NFC_LLCP_STEP_RETURN:
                DEBUG_SERVER_MSG("NET_NFC_LLCP_STEP_RETURN");
 
                /* complete and invoke callback */
-               context->cb(
-                       context->result,
-                       context->type,
-                       NULL,
-                       context->user_param);
+               context->cb(context->result, context->type, NULL, context->user_param);
 
                _net_nfc_server_snep_destory_context(context);
                break;
 
-       case NET_NFC_STATE_ERROR :
+       case NET_NFC_STATE_ERROR:
                DEBUG_ERR_MSG("NET_NFC_STATE_ERROR");
 
                /* error, invoke callback */
-               DEBUG_ERR_MSG("net_nfc_server_snep_send failed, [%d]",
-                               context->result);
+               DEBUG_ERR_MSG("net_nfc_server_snep_send failed, [%d]", context->result);
 
-               context->cb(
-                       context->result,
-                       context->type,
-                       NULL,
-                       context->user_param);
+               context->cb(context->result, context->type, NULL, context->user_param);
 
                _net_nfc_server_snep_destory_context(context);
                break;
 
-       default :
+       default:
                DEBUG_ERR_MSG("NET_NFC_LLCP_STEP_??");
 
-               context->cb(NET_NFC_OPERATION_FAIL,
-                       context->type,
-                       NULL,
-                       context->user_param);
+               context->cb(NET_NFC_OPERATION_FAIL, context->type, NULL, context->user_param);
 
                _net_nfc_server_snep_destory_context(context);
                break;
        }
 }
 
-net_nfc_error_e net_nfc_server_snep_send(
-                               net_nfc_target_handle_s *handle,
-                               net_nfc_llcp_socket_t socket,
-                               uint32_t type,
-                               data_s *data,
-                               _net_nfc_server_snep_operation_cb cb,
-                               void *user_param)
+net_nfc_error_e net_nfc_server_snep_send(net_nfc_target_handle_s * handle, net_nfc_llcp_socket_t socket, uint32_t type, data_s * data, _net_nfc_server_snep_operation_cb cb, void *user_param)
 {
        net_nfc_server_snep_op_context_t *context;
        net_nfc_error_e result;
 
        /* create context */
-       context = _net_nfc_server_snep_create_send_context(
-                                                       type,
-                                                       handle,
-                                                       socket,
-                                                       data,
-                                                       cb,
-                                                       user_param);
-       if (context != NULL)
-       {
+       context = _net_nfc_server_snep_create_send_context(type, handle, socket, data, cb, user_param);
+       if (context != NULL) {
                /* send response */
                _net_nfc_server_snep_send(context);
                result = NET_NFC_OK;
-       }
-       else
-       {
+       } else {
                DEBUG_ERR_MSG("_net_nfc_server_snep_create_send_context failed");
 
                result = NET_NFC_ALLOC_FAIL;
 
-               if (cb != NULL) {
+               if (cb != NULL)
                        cb(result, type, NULL, user_param);
-               }
        }
 
        return result;
 }
 
-static void _net_nfc_server_snep_server_recv_cb(
-                               net_nfc_error_e result,
-                               uint32_t type,
-                               data_s *data,
-                               void *user_param)
+static void _net_nfc_server_snep_server_recv_cb(net_nfc_error_e result, uint32_t type, data_s * data, void *user_param)
 {
-       net_nfc_server_snep_context_t *context =
-                       (net_nfc_server_snep_context_t *)user_param;
+       net_nfc_server_snep_context_t *context = (net_nfc_server_snep_context_t *) user_param;
 
-       DEBUG_SERVER_MSG("_net_nfc_server_snep_server_recv_cb"
-                               "result [%d]", result);
+       DEBUG_SERVER_MSG("_net_nfc_server_snep_server_recv_cb" "result [%d]", result);
 
-       if (context == NULL)
-       {
+       if (context == NULL) {
                /* TODO */
                return;
        }
@@ -1006,44 +736,35 @@ static void _net_nfc_server_snep_server_recv_cb(
        context->result = result;
        context->type = type;
 
-       if (result == NET_NFC_OK && data != NULL && data->buffer != NULL)
-       {
-               DEBUG_SERVER_MSG("received message, type [%d], length [%d]",
-                               type, data->length);
+       if (result == NET_NFC_OK && data != NULL && data->buffer != NULL) {
+               DEBUG_SERVER_MSG("received message, type [%d], length [%d]", type, data->length);
 
                net_nfc_util_init_data(&context->data, data->length);
-               if (context->data.buffer != NULL)
-               {
-                       memcpy(context->data.buffer,
-                                       data->buffer, data->length);
-
-                       switch (type)
-                       {
-                       case SNEP_REQ_GET :
-                                       context->state = NET_NFC_LLCP_STEP_02;
-                                       break;
-
-                       case SNEP_REQ_PUT :
-                                       context->state = NET_NFC_LLCP_STEP_04;
-                                       break;
-
-                       default :
-                                       DEBUG_ERR_MSG("invalid request, [%d]", type);
-                                       context->state = NET_NFC_STATE_ERROR;
-                                       context->result = NET_NFC_NOT_ALLOWED_OPERATION;
-                                       break;
+               if (context->data.buffer != NULL) {
+                       memcpy(context->data.buffer, data->buffer, data->length);
+
+                       switch (type) {
+                       case SNEP_REQ_GET:
+                               context->state = NET_NFC_LLCP_STEP_02;
+                               break;
+
+                       case SNEP_REQ_PUT:
+                               context->state = NET_NFC_LLCP_STEP_04;
+                               break;
+
+                       default:
+                               DEBUG_ERR_MSG("invalid request, [%d]", type);
+                               context->state = NET_NFC_STATE_ERROR;
+                               context->result = NET_NFC_NOT_ALLOWED_OPERATION;
+                               break;
                        }
-               }
-               else
-               {
+               } else {
                        DEBUG_ERR_MSG("net_nfc_util_alloc_data failed");
                        /* TODO */
                        context->state = NET_NFC_STATE_ERROR;
                        context->result = NET_NFC_ALLOC_FAIL;
                }
-       }
-       else
-       {
+       } else {
                DEBUG_ERR_MSG("net_nfc_server_snep_recv failed, [%d]", result);
                context->type = type;
                context->state = NET_NFC_STATE_ERROR;
@@ -1052,33 +773,24 @@ static void _net_nfc_server_snep_server_recv_cb(
        _net_nfc_server_snep_server_process(context);
 }
 
-
-static void _net_nfc_server_snep_server_send_cb(net_nfc_error_e result,
-                                               uint32_t type,
-                                               data_s *data,
-                                               void *user_param)
+static void _net_nfc_server_snep_server_send_cb(net_nfc_error_e result, uint32_t type, data_s * data, void *user_param)
 {
-       net_nfc_server_snep_context_t *context =
-                       (net_nfc_server_snep_context_t *)user_param;
+       net_nfc_server_snep_context_t *context = (net_nfc_server_snep_context_t *) user_param;
 
-       DEBUG_SERVER_MSG("_net_nfc_server_snep_server_send_cb"
-               ", result [%d]", result);
+       DEBUG_SERVER_MSG("_net_nfc_server_snep_server_send_cb" ", result [%d]", result);
 
-       if (context == NULL)/* TODO */
+       if (context == NULL)            /* TODO */
                return;
 
        context->result = result;
 
-       if (result == NET_NFC_OK)
-       {
+       if (result == NET_NFC_OK) {
                DEBUG_SERVER_MSG("server process success. and restart....");
 
                /* restart */
                net_nfc_util_clear_data(&context->data);
                context->state = NET_NFC_LLCP_STEP_01;
-       }
-       else
-       {
+       } else {
                DEBUG_ERR_MSG("net_nfc_server_snep_send failed, [%d]", result);
                context->state = NET_NFC_STATE_ERROR;
        }
@@ -1086,237 +798,142 @@ static void _net_nfc_server_snep_server_send_cb(net_nfc_error_e result,
        _net_nfc_server_snep_server_process(context);
 }
 
-
-static void _net_nfc_server_snep_server_process(
-                       net_nfc_server_snep_context_t *context)
+static void _net_nfc_server_snep_server_process(net_nfc_server_snep_context_t * context)
 {
        if (context == NULL)
                return;
 
-       switch (context->state)
-       {
-       case NET_NFC_LLCP_STEP_01 :
+       switch (context->state) {
+       case NET_NFC_LLCP_STEP_01:
                DEBUG_SERVER_MSG("NET_NFC_LLCP_STEP_01");
 
                /* receive request */
-               net_nfc_server_snep_recv(
-                               context->handle,
-                               context->socket,
-                               _net_nfc_server_snep_server_recv_cb,
-                               context);
+               net_nfc_server_snep_recv(context->handle, context->socket, _net_nfc_server_snep_server_recv_cb, context);
                break;
 
-       case NET_NFC_LLCP_STEP_02 :
+       case NET_NFC_LLCP_STEP_02:
                DEBUG_SERVER_MSG("NET_NFC_LLCP_STEP_02");
 
                context->state = NET_NFC_LLCP_STEP_03;
 
-               if (context->cb == NULL ||
-                               context->cb((net_nfc_snep_handle_h)context,
-                                               context->result,
-                                               context->type,
-                                               &context->data,
-                                               context->user_param) != NET_NFC_OK)
-               {
+               if (context->cb == NULL || context->cb((net_nfc_snep_handle_h) context, context->result, context->type, &context->data, context->user_param) != NET_NFC_OK) {
                        /* there is no response for GET request */
                        DEBUG_ERR_MSG("there is no response for GET request");
 
                        /* receive request */
-                       net_nfc_server_snep_send(context->handle,
-                                               context->socket,
-                                               SNEP_RESP_NOT_FOUND,
-                                               NULL,
-                                               _net_nfc_server_snep_server_send_cb,
-                                               context);
+                       net_nfc_server_snep_send(context->handle, context->socket, SNEP_RESP_NOT_FOUND, NULL, _net_nfc_server_snep_server_send_cb, context);
                }
                break;
 
-       case NET_NFC_LLCP_STEP_03 :
+       case NET_NFC_LLCP_STEP_03:
                DEBUG_SERVER_MSG("NET_NFC_LLCP_STEP_03");
 
                /* receive request */
-               net_nfc_server_snep_send(context->handle,
-                                       context->socket,
-                                       SNEP_RESP_SUCCESS,
-                                       &context->data,
-                                       _net_nfc_server_snep_server_send_cb,
-                                       context);
+               net_nfc_server_snep_send(context->handle, context->socket, SNEP_RESP_SUCCESS, &context->data, _net_nfc_server_snep_server_send_cb, context);
                break;
 
-       case NET_NFC_LLCP_STEP_04 :
+       case NET_NFC_LLCP_STEP_04:
                DEBUG_SERVER_MSG("NET_NFC_LLCP_STEP_04");
 
-               if (context->cb != NULL)
-               {
+               if (context->cb != NULL) {
                        /* complete and invoke callback */
-                       context->cb(
-                               (net_nfc_snep_handle_h)context,
-                               NET_NFC_OK,
-                               context->type,
-                               &context->data,
-                               context->user_param);
+                       context->cb((net_nfc_snep_handle_h) context, NET_NFC_OK, context->type, &context->data, context->user_param);
                }
 
                /* receive request */
-               net_nfc_server_snep_send(context->handle,
-                                       context->socket,
-                                       SNEP_RESP_SUCCESS,
-                                       NULL,
-                                       _net_nfc_server_snep_server_send_cb,
-                                       context);
+               net_nfc_server_snep_send(context->handle, context->socket, SNEP_RESP_SUCCESS, NULL, _net_nfc_server_snep_server_send_cb, context);
                break;
 
-       case NET_NFC_LLCP_STEP_10 : /* server error, and need to send error code to client */
+       case NET_NFC_LLCP_STEP_10:      /* server error, and need to send error code to client */
                {
                        /* FIXME : */
                }
                break;
 
-       case NET_NFC_STATE_ERROR :
+       case NET_NFC_STATE_ERROR:
                DEBUG_SERVER_MSG("NET_NFC_STATE_ERROR");
 
                /* error, invoke callback */
-               DEBUG_ERR_MSG("_snep_server_recv failed, [%d]",
-                               context->result);
-#if 0 /* temp code */
+               DEBUG_ERR_MSG("_snep_server_recv failed, [%d]", context->result);
+#if 0                                                  /* temp code */
                if (context->cb != NULL)
-               {
-                       context->cb((net_nfc_snep_handle_h)context,
-                                               context->result,
-                                               context->type,
-                                               NULL,
-                                               context->user_param);
-               }
+                       context->cb((net_nfc_snep_handle_h) context, context->result, context->type, NULL, context->user_param);
 #endif
                /* restart?? */
                break;
 
-       default :
+       default:
                DEBUG_ERR_MSG("NET_NFC_LLCP_STEP_??");
                /* TODO */
                break;
        }
 }
 
-
-static void _net_nfc_server_snep_clear_queue(
-                       gpointer data,
-                       gpointer user_data)
+static void _net_nfc_server_snep_clear_queue(gpointer data, gpointer user_data)
 {
-       net_nfc_server_snep_job_t *job = (net_nfc_server_snep_job_t *)data;
+       net_nfc_server_snep_job_t *job = (net_nfc_server_snep_job_t *) data;
 
-       if (job != NULL)
-       {
+       if (job != NULL) {
                if (job->cb != NULL)
-               {
-                       job->cb((net_nfc_snep_handle_h)job->context,
-                               NET_NFC_OPERATION_FAIL, job->type,
-                               NULL, job->user_param);
-               }
+                       job->cb((net_nfc_snep_handle_h) job->context, NET_NFC_OPERATION_FAIL, job->type, NULL, job->user_param);
 
                if (job->data.buffer != NULL)
-               {
                        net_nfc_util_clear_data(&job->data);
-               }
 
                _net_nfc_util_free_mem(job);
        }
 }
 
-
-static void _net_nfc_server_snep_incomming_socket_error_cb(
-                       net_nfc_error_e result,
-                       net_nfc_target_handle_s *handle,
-                       net_nfc_llcp_socket_t socket,
-                       data_s *data,
-                       void *user_param)
+static void _net_nfc_server_snep_incomming_socket_error_cb(net_nfc_error_e result, net_nfc_target_handle_s * handle, net_nfc_llcp_socket_t socket, data_s * data, void *user_param)
 {
-       net_nfc_server_snep_context_t *context =
-               (net_nfc_server_snep_context_t *)user_param;
+       net_nfc_server_snep_context_t *context = (net_nfc_server_snep_context_t *) user_param;
 
-       DEBUG_SERVER_MSG("_net_nfc_server_snep_incomming_socket_error_cb,"
-               " socket [%x], result [%d]",socket, result);
+       DEBUG_SERVER_MSG("_net_nfc_server_snep_incomming_socket_error_cb," " socket [%x], result [%d]", socket, result);
 
        if (context == NULL)
-       {
                return;
-       }
 
        if (context->data.buffer != NULL)
-       {
                net_nfc_util_clear_data(&context->data);
-       }
 
-       g_queue_foreach(&context->queue,
-               _net_nfc_server_snep_clear_queue,
-               NULL);
+       g_queue_foreach(&context->queue, _net_nfc_server_snep_clear_queue, NULL);
 
        _net_nfc_util_free_mem(context);
 }
 
-
-static void _net_nfc_server_snep_socket_error_cb(
-                               net_nfc_error_e result,
-                               net_nfc_target_handle_s *handle,
-                               net_nfc_llcp_socket_t socket,
-                               data_s *data,
-                               void *user_param)
+static void _net_nfc_server_snep_socket_error_cb(net_nfc_error_e result, net_nfc_target_handle_s * handle, net_nfc_llcp_socket_t socket, data_s * data, void *user_param)
 {
-       net_nfc_server_snep_context_t *context =
-                       (net_nfc_server_snep_context_t *)user_param;
+       net_nfc_server_snep_context_t *context = (net_nfc_server_snep_context_t *) user_param;
 
-       DEBUG_SERVER_MSG("_net_nfc_server_snep_socket_error_cb"
-                       " socket [%x], result [%d]",socket, result);
+       DEBUG_SERVER_MSG("_net_nfc_server_snep_socket_error_cb" " socket [%x], result [%d]", socket, result);
 
        if (context == NULL)
-       {
                return;
-       }
 
        if (context->cb != NULL)
-       {
-               context->cb((net_nfc_snep_handle_h)context,
-                                       result,
-                                       NET_NFC_LLCP_STOP,
-                                       NULL,
-                                       context->user_param);
-       }
+               context->cb((net_nfc_snep_handle_h) context, result, NET_NFC_LLCP_STOP, NULL, context->user_param);
 
-       /*net_nfc_controller_llcp_socket_close(socket, &result);*/
+       /*net_nfc_controller_llcp_socket_close(socket, &result); */
 
        if (context->data.buffer != NULL)
-       {
                net_nfc_util_clear_data(&context->data);
-       }
 
-       g_queue_foreach(&context->queue,
-               _net_nfc_server_snep_clear_queue,
-               NULL);
+       g_queue_foreach(&context->queue, _net_nfc_server_snep_clear_queue, NULL);
 
        _net_nfc_util_free_mem(context);
 }
 
-
-static void _net_nfc_server_snep_incoming_cb(
-                               net_nfc_error_e result,
-                               net_nfc_target_handle_s *handle,
-                               net_nfc_llcp_socket_t socket,
-                               data_s *data,
-                               void *user_param)
+static void _net_nfc_server_snep_incoming_cb(net_nfc_error_e result, net_nfc_target_handle_s * handle, net_nfc_llcp_socket_t socket, data_s * data, void *user_param)
 {
-       net_nfc_server_snep_context_t *context =
-               (net_nfc_server_snep_context_t *)user_param;
+       net_nfc_server_snep_context_t *context = (net_nfc_server_snep_context_t *) user_param;
        net_nfc_server_snep_context_t *accept_context = NULL;
 
        if (context == NULL)
-       {
                return;
-       }
 
        DEBUG_SERVER_MSG("snep incoming socket [%x], result [%d]", socket, result);
 
-       if (result != NET_NFC_OK)
-       {
+       if (result != NET_NFC_OK) {
                DEBUG_ERR_MSG("listen socket failed, [%d]", result);
 
                goto ERROR;
@@ -1325,8 +942,7 @@ static void _net_nfc_server_snep_incoming_cb(
        /* start snep server */
        _net_nfc_util_alloc_mem(accept_context, sizeof(*accept_context));
 
-       if (accept_context == NULL)
-       {
+       if (accept_context == NULL) {
                DEBUG_ERR_MSG("_net_nfc_util_alloc_mem failed");
                result = NET_NFC_ALLOC_FAIL;
 
@@ -1339,12 +955,8 @@ static void _net_nfc_server_snep_incoming_cb(
        accept_context->user_param = context->user_param;
        accept_context->state = NET_NFC_LLCP_STEP_01;
 
-       result = net_nfc_server_llcp_simple_accept(handle,
-               socket,
-               _net_nfc_server_snep_incomming_socket_error_cb,
-               accept_context);
-       if (result != NET_NFC_OK)
-       {
+       result = net_nfc_server_llcp_simple_accept(handle, socket, _net_nfc_server_snep_incomming_socket_error_cb, accept_context);
+       if (result != NET_NFC_OK) {
                DEBUG_ERR_MSG("net_nfc_server_llcp_simple_accept failed, [%d]", result);
                goto ERROR;
        }
@@ -1355,35 +967,24 @@ static void _net_nfc_server_snep_incoming_cb(
 
        return;
 
-ERROR :
+ ERROR:
        if (accept_context != NULL)
-       {
                _net_nfc_util_free_mem(accept_context);
-       }
 }
 
-net_nfc_error_e net_nfc_server_snep_server(
-                               net_nfc_target_handle_s *handle,
-                               const char *san,
-                               sap_t sap,
-                               net_nfc_server_snep_cb cb,
-                               void *user_param)
+net_nfc_error_e net_nfc_server_snep_server(net_nfc_target_handle_s * handle, const char *san, sap_t sap, net_nfc_server_snep_cb cb, void *user_param)
 {
        net_nfc_error_e result;
        net_nfc_server_snep_context_t *context = NULL;
 
        if (handle == NULL || san == NULL)
-       {
                return NET_NFC_NULL_PARAMETER;
-       }
 
-       if (net_nfc_server_target_connected(handle->connection_id) == false) {
+       if (net_nfc_server_target_connected(handle->connection_id) == false)
                return NET_NFC_NOT_CONNECTED;
-       }
 
        _net_nfc_util_alloc_mem(context, sizeof(*context));
-       if (context == NULL)
-       {
+       if (context == NULL) {
                DEBUG_ERR_MSG("_create_snep_context failed");
                result = NET_NFC_ALLOC_FAIL;
                goto ERROR;
@@ -1394,82 +995,59 @@ net_nfc_error_e net_nfc_server_snep_server(
        context->user_param = user_param;
        context->state = NET_NFC_LLCP_STEP_01;
 
-       result = net_nfc_server_llcp_simple_server(handle,
-                               san,
-                               sap,
-                               _net_nfc_server_snep_incoming_cb,
-                               _net_nfc_server_snep_socket_error_cb,
-                               context);
+       result = net_nfc_server_llcp_simple_server(handle, san, sap, _net_nfc_server_snep_incoming_cb, _net_nfc_server_snep_socket_error_cb, context);
 
-       if (result != NET_NFC_OK)
-       {
-               DEBUG_ERR_MSG("net_nfc_server_llcp_simple_server failed, [%d]",
-                               result);
+       if (result != NET_NFC_OK) {
+               DEBUG_ERR_MSG("net_nfc_server_llcp_simple_server failed, [%d]", result);
                goto ERROR;
        }
 
-       DEBUG_SERVER_MSG("start snep server, san [%s], sap [%d]",
-                       san, sap);
+       DEBUG_SERVER_MSG("start snep server, san [%s], sap [%d]", san, sap);
        return result;
 
-ERROR :
+ ERROR:
        if (context != NULL)
                _net_nfc_util_free_mem(context);
 
        return result;
 }
 
-net_nfc_error_e net_nfc_server_snep_server_send_get_response(
-                                       net_nfc_snep_handle_h snep_handle,
-                                       data_s *data)
+net_nfc_error_e net_nfc_server_snep_server_send_get_response(net_nfc_snep_handle_h snep_handle, data_s * data)
 {
-       net_nfc_server_snep_context_t *context =
-                       (net_nfc_server_snep_context_t *)snep_handle;
+       net_nfc_server_snep_context_t *context = (net_nfc_server_snep_context_t *) snep_handle;
        net_nfc_error_e result = NET_NFC_OK;
 
-       if (context == NULL/* && check valid handle */)
-       {
+       if (context == NULL) {
                DEBUG_ERR_MSG("invalid handle");
                return NET_NFC_INVALID_PARAM;
        }
 
-       if (net_nfc_server_target_connected(context->handle->connection_id) == false) {
+       if (net_nfc_server_target_connected(context->handle->connection_id) == false)
                return NET_NFC_NOT_CONNECTED;
-       }
 
        DEBUG_SERVER_MSG("send get response, socket [%x]", context->socket);
 
        /* check correct status */
-       if (context->type == SNEP_REQ_GET)
-       {
+       if (context->type == SNEP_REQ_GET) {
                if (context->data.buffer != NULL)
                        net_nfc_util_clear_data(&context->data);
 
-               if (data != NULL)
-               {
+               if (data != NULL) {
                        context->type = SNEP_RESP_SUCCESS;
 
-                       if (net_nfc_util_init_data(&context->data, data->length) == true)
-                       {
-                               memcpy(context->data.buffer, data->buffer,
-                                               data->length);
-                       }
-                       else
-                       {
+                       if (net_nfc_util_init_data(&context->data, data->length) == true) {
+                               memcpy(context->data.buffer, data->buffer, data->length);
+                       } else {
                                DEBUG_ERR_MSG("net_nfc_util_alloc_data failed");
                                result = NET_NFC_ALLOC_FAIL;
                        }
-               }
-               else
-               {
+               } else {
                        /* not found */
                        context->type = SNEP_RESP_NOT_FOUND;
                }
 
                _net_nfc_server_snep_server_process(context);
-       }
-       else
-       {
+       } else {
                DEBUG_ERR_MSG("incorrect handle state");
                result = NET_NFC_INVALID_STATE;
        }
@@ -1477,17 +1055,11 @@ net_nfc_error_e net_nfc_server_snep_server_send_get_response(
        return result;
 }
 
-static void _net_nfc_server_snep_client_send_cb(
-                               net_nfc_error_e result,
-                               uint32_t type,
-                               data_s *data,
-                               void *user_param)
+static void _net_nfc_server_snep_client_send_cb(net_nfc_error_e result, uint32_t type, data_s * data, void *user_param)
 {
-       net_nfc_server_snep_job_t *job =
-                       (net_nfc_server_snep_job_t *)user_param;
+       net_nfc_server_snep_job_t *job = (net_nfc_server_snep_job_t *) user_param;
 
-       if (job == NULL)
-       {
+       if (job == NULL) {
                /* TODO */
                return;
        }
@@ -1495,14 +1067,11 @@ static void _net_nfc_server_snep_client_send_cb(
        job->type = type;
        job->result = result;
 
-       if (result == NET_NFC_OK)
-       {
+       if (result == NET_NFC_OK) {
                job->state = NET_NFC_LLCP_STEP_02;
 
                net_nfc_util_clear_data(&job->data);
-       }
-       else
-       {
+       } else {
                DEBUG_ERR_MSG("net_nfc_server_snep_send failed, [%d]", result);
                job->state = NET_NFC_STATE_ERROR;
        }
@@ -1510,17 +1079,11 @@ static void _net_nfc_server_snep_client_send_cb(
        _net_nfc_server_snep_client_process(job);
 }
 
-static void _net_nfc_server_snep_client_recv_cb(
-                               net_nfc_error_e result,
-                               uint32_t type,
-                               data_s *data,
-                               void *user_param)
+static void _net_nfc_server_snep_client_recv_cb(net_nfc_error_e result, uint32_t type, data_s * data, void *user_param)
 {
-       net_nfc_server_snep_job_t *job =
-                       (net_nfc_server_snep_job_t *)user_param;
+       net_nfc_server_snep_job_t *job = (net_nfc_server_snep_job_t *) user_param;
 
-       if (job == NULL)
-       {
+       if (job == NULL) {
                /* TODO */
                return;
        }
@@ -1528,37 +1091,26 @@ static void _net_nfc_server_snep_client_recv_cb(
        job->type = type;
        job->result = result;
 
-       if (result == NET_NFC_OK)
-       {
-               if (type == SNEP_RESP_SUCCESS)
-               {
+       if (result == NET_NFC_OK) {
+               if (type == SNEP_RESP_SUCCESS) {
                        job->state = NET_NFC_LLCP_STEP_RETURN;
-                       if (data != NULL && data->buffer != NULL)
-                       {
+                       if (data != NULL && data->buffer != NULL) {
                                net_nfc_util_init_data(&job->data, data->length);
-                               if (job->data.buffer != NULL)
-                               {
-                                       memcpy(job->data.buffer, data->buffer,
-                                               data->length);
-                               }
-                               else
-                               {
+                               if (job->data.buffer != NULL) {
+                                       memcpy(job->data.buffer, data->buffer, data->length);
+                               } else {
                                        DEBUG_ERR_MSG("net_nfc_util_alloc_data failed");
                                        job->state = NET_NFC_STATE_ERROR;
                                        job->result = NET_NFC_ALLOC_FAIL;
                                }
                        }
-               }
-               else
-               {
+               } else {
                        /* TODO */
                        DEBUG_ERR_MSG("invalid request, [0x%x]", type);
                        job->state = NET_NFC_STATE_ERROR;
                        job->result = NET_NFC_NOT_ALLOWED_OPERATION;
                }
-       }
-       else
-       {
+       } else {
 
                DEBUG_ERR_MSG("net_nfc_server_snep_recv failed, [%d]", result);
                job->state = NET_NFC_STATE_ERROR;
@@ -1567,11 +1119,9 @@ static void _net_nfc_server_snep_client_recv_cb(
        _net_nfc_server_snep_client_process(job);
 }
 
-
-static void _net_nfc_server_snep_client_do_job(net_nfc_server_snep_context_t *context)
+static void _net_nfc_server_snep_client_do_job(net_nfc_server_snep_context_t * context)
 {
-       if (context->state == NET_NFC_LLCP_IDLE &&
-               g_queue_is_empty(&context->queue) == false) {
+       if (context->state == NET_NFC_LLCP_IDLE && g_queue_is_empty(&context->queue) == false) {
                net_nfc_server_snep_job_t *job;
 
                job = g_queue_pop_head(&context->queue);
@@ -1583,86 +1133,58 @@ static void _net_nfc_server_snep_client_do_job(net_nfc_server_snep_context_t *co
        }
 }
 
-static void _net_nfc_server_snep_client_process(
-                       net_nfc_server_snep_job_t *job)
+static void _net_nfc_server_snep_client_process(net_nfc_server_snep_job_t * job)
 {
        bool finish = false;
 
        if (job == NULL)
-       {
                return;
-       }
 
-       switch (job->state)
-       {
-       case NET_NFC_LLCP_STEP_01 :
+       switch (job->state) {
+       case NET_NFC_LLCP_STEP_01:
                DEBUG_SERVER_MSG("NET_NFC_LLCP_STEP_01");
 
                /* send request */
-               net_nfc_server_snep_send(job->handle,
-                       job->socket,
-                       job->type,
-                       &job->data,
-                       _net_nfc_server_snep_client_send_cb,
-                       job);
+               net_nfc_server_snep_send(job->handle, job->socket, job->type, &job->data, _net_nfc_server_snep_client_send_cb, job);
                break;
 
-       case NET_NFC_LLCP_STEP_02 :
+       case NET_NFC_LLCP_STEP_02:
                DEBUG_SERVER_MSG("NET_NFC_LLCP_STEP_02");
 
                /* receive response */
-               net_nfc_server_snep_recv(job->handle,
-                       job->socket,
-                       _net_nfc_server_snep_client_recv_cb,
-                       job);
+               net_nfc_server_snep_recv(job->handle, job->socket, _net_nfc_server_snep_client_recv_cb, job);
                break;
 
-       case NET_NFC_LLCP_STEP_RETURN :
+       case NET_NFC_LLCP_STEP_RETURN:
                DEBUG_SERVER_MSG("NET_NFC_LLCP_STEP_RETURN");
 
                /* complete and invoke callback */
                if (job->cb != NULL)
-               {
-                       job->cb((net_nfc_snep_handle_h)job->context,
-                               NET_NFC_OK,
-                               job->type,
-                               &job->data,
-                               job->user_param);
-               }
+                       job->cb((net_nfc_snep_handle_h) job->context, NET_NFC_OK, job->type, &job->data, job->user_param);
 
                /* finish job */
                finish = true;
                break;
 
-       case NET_NFC_STATE_ERROR :
-       default :
+       case NET_NFC_STATE_ERROR:
+       default:
                DEBUG_ERR_MSG("NET_NFC_STATE_ERROR");
 
                /* error, invoke callback */
-               DEBUG_ERR_MSG("_snep_client_send failed, [%d]",
-                       job->result);
+               DEBUG_ERR_MSG("_snep_client_send failed, [%d]", job->result);
                if (job->cb != NULL)
-               {
-                       job->cb((net_nfc_snep_handle_h)job->context,
-                               job->result,
-                               job->type,
-                               &job->data,
-                               job->user_param);
-               }
+                       job->cb((net_nfc_snep_handle_h) job->context, job->result, job->type, &job->data, job->user_param);
 
                /* finish job */
                finish = true;
                break;
        }
 
-       if (finish == true)
-       {
+       if (finish == true) {
                net_nfc_server_snep_context_t *context = job->context;
 
                if (job->data.buffer != NULL)
-               {
                        net_nfc_util_clear_data(&job->data);
-               }
 
                _net_nfc_util_free_mem(job);
 
@@ -1672,66 +1194,39 @@ static void _net_nfc_server_snep_client_process(
        }
 }
 
-static void _net_nfc_server_snep_connected_cb(
-                               net_nfc_error_e result,
-                               net_nfc_target_handle_s *handle,
-                               net_nfc_llcp_socket_t socket,
-                               data_s *data,
-                               void *user_param)
+static void _net_nfc_server_snep_connected_cb(net_nfc_error_e result, net_nfc_target_handle_s * handle, net_nfc_llcp_socket_t socket, data_s * data, void *user_param)
 {
-       net_nfc_server_snep_context_t *context =
-                       (net_nfc_server_snep_context_t *)user_param;
+       net_nfc_server_snep_context_t *context = (net_nfc_server_snep_context_t *) user_param;
 
        if (context == NULL)
-       {
                return;
-       }
 
        context->socket = socket;
 
-       if (result == NET_NFC_OK)
-       {
+       if (result == NET_NFC_OK) {
                /* start snep client */
-               DEBUG_SERVER_MSG("socket [%x] connected. send message",
-                               socket);
-       }
-       else
-       {
+               DEBUG_SERVER_MSG("socket [%x] connected. send message", socket);
+       } else {
                DEBUG_ERR_MSG("connect socket failed, [%d]", result);
        }
 
        if (context->cb != NULL)
-       {
-               context->cb((net_nfc_snep_handle_h)context,
-                                       result,
-                                       NET_NFC_LLCP_START,
-                                       NULL,
-                                       context->user_param);
-       }
+               context->cb((net_nfc_snep_handle_h) context, result, NET_NFC_LLCP_START, NULL, context->user_param);
 }
 
-net_nfc_error_e net_nfc_server_snep_client(
-                               net_nfc_target_handle_s *handle,
-                               const char *san,
-                               sap_t sap,
-                               net_nfc_server_snep_cb cb,
-                               void *user_param)
+net_nfc_error_e net_nfc_server_snep_client(net_nfc_target_handle_s * handle, const char *san, sap_t sap, net_nfc_server_snep_cb cb, void *user_param)
 {
        net_nfc_error_e result;
        net_nfc_server_snep_context_t *context = NULL;
 
        if (handle == NULL)
-       {
                return NET_NFC_NULL_PARAMETER;
-       }
 
-       if (net_nfc_server_target_connected(handle->connection_id) == false) {
+       if (net_nfc_server_target_connected(handle->connection_id) == false)
                return NET_NFC_NOT_CONNECTED;
-       }
 
        _net_nfc_util_alloc_mem(context, sizeof(*context));
-       if (context == NULL)
-       {
+       if (context == NULL) {
                DEBUG_ERR_MSG("_net_nfc_util_alloc_mem failed");
                result = NET_NFC_ALLOC_FAIL;
 
@@ -1741,17 +1236,10 @@ net_nfc_error_e net_nfc_server_snep_client(
        context->cb = cb;
        context->user_param = user_param;
 
-       result = net_nfc_server_llcp_simple_client(handle,
-                                       san,
-                                       sap,
-                                       _net_nfc_server_snep_connected_cb,
-                                       _net_nfc_server_snep_socket_error_cb,
-                                       context);
+       result = net_nfc_server_llcp_simple_client(handle, san, sap, _net_nfc_server_snep_connected_cb, _net_nfc_server_snep_socket_error_cb, context);
 
-       if (result != NET_NFC_OK)
-       {
-               DEBUG_ERR_MSG("net_nfc_server_llcp_simple_client failed, [%d]",
-                               result);
+       if (result != NET_NFC_OK) {
+               DEBUG_ERR_MSG("net_nfc_server_llcp_simple_client failed, [%d]", result);
 
                goto ERROR;
        }
@@ -1763,49 +1251,34 @@ net_nfc_error_e net_nfc_server_snep_client(
 
        return result;
 
-ERROR :
-       if (context != NULL)
-       {
+ ERROR:
+       if (context != NULL) {
                if (context->data.buffer != NULL)
-               {
                        net_nfc_util_clear_data(&context->data);
-               }
                _net_nfc_util_free_mem(context);
        }
 
        return result;
 }
 
-
-net_nfc_error_e net_nfc_server_snep_client_request(
-                       net_nfc_snep_handle_h snep,
-                       uint8_t type,
-                       data_s *data,
-                       net_nfc_server_snep_cb cb,
-                       void *user_param)
+net_nfc_error_e net_nfc_server_snep_client_request(net_nfc_snep_handle_h snep, uint8_t type, data_s * data, net_nfc_server_snep_cb cb, void *user_param)
 {
-       net_nfc_server_snep_context_t *context = (net_nfc_server_snep_context_t *)snep;
+       net_nfc_server_snep_context_t *context = (net_nfc_server_snep_context_t *) snep;
        net_nfc_error_e result = NET_NFC_OK;
        net_nfc_server_snep_job_t *job;
 
        if (context == NULL || data == NULL || data->buffer == NULL)
-       {
                return NET_NFC_NULL_PARAMETER;
-       }
 
-       if (net_nfc_server_target_connected(context->handle->connection_id) == false) {
+       if (net_nfc_server_target_connected(context->handle->connection_id) == false)
                return NET_NFC_NOT_CONNECTED;
-       }
 
        /* check type */
        _net_nfc_util_alloc_mem(job, sizeof(*job));
-       if (job != NULL)
-       {
+       if (job != NULL) {
                net_nfc_util_init_data(&job->data, data->length);
                if (job->data.buffer != NULL)
-               {
                        memcpy(job->data.buffer, data->buffer, data->length);
-               }
                job->type = type;
                job->cb = cb;
                job->user_param = user_param;
@@ -1815,9 +1288,7 @@ net_nfc_error_e net_nfc_server_snep_client_request(
                job->socket = context->socket;
 
                g_queue_push_tail(&context->queue, job);
-       }
-       else
-       {
+       } else {
                return NET_NFC_ALLOC_FAIL;
        }
 
@@ -1825,57 +1296,40 @@ net_nfc_error_e net_nfc_server_snep_client_request(
 
        /* if client is idle, starts sending request */
        if (context->state == NET_NFC_LLCP_IDLE)
-       {
                _net_nfc_server_snep_client_do_job(context);
-       } else {
+       else
                DEBUG_SERVER_MSG("client is working. this job will be enqueued");
-       }
 
        return result;
 }
 
-static net_nfc_error_e _net_nfc_server_default_server_cb_(
-                                               net_nfc_snep_handle_h handle,
-                                               net_nfc_error_e result,
-                                               uint32_t type,
-                                               data_s *data,
-                                               void *user_param)
+static net_nfc_error_e _net_nfc_server_default_server_cb_(net_nfc_snep_handle_h handle, net_nfc_error_e result, uint32_t type, data_s * data, void *user_param)
 {
-       DEBUG_SERVER_MSG("type [%d], result [%d], data [%p], user_param [%p]",
-                       type, result, data, user_param);
+       DEBUG_SERVER_MSG("type [%d], result [%d], data [%p], user_param [%p]", type, result, data, user_param);
 
-       if (result != NET_NFC_OK || data == NULL || data->buffer == NULL)
-       {
+       if (result != NET_NFC_OK || data == NULL || data->buffer == NULL) {
                /* restart */
                return NET_NFC_NULL_PARAMETER;
        }
 
-       switch (type)
-       {
+       switch (type) {
        case SNEP_REQ_GET:
                {
-                       net_nfc_server_snep_get_msg_t *msg =
-                                       (net_nfc_server_snep_get_msg_t *)data->buffer;
-
+                       net_nfc_server_snep_get_msg_t *msg = (net_nfc_server_snep_get_msg_t *) data->buffer;
 
                        uint32_t max_len = htonl(msg->length);
-                       data_s get_msg = { msg->data,data->length - sizeof(msg->length)};
+                       data_s get_msg = { msg->data, data->length - sizeof(msg->length) };
 
-                       DEBUG_SERVER_MSG("GET : acceptable max_len [%d], message [%d]",
-                                       max_len, data->length - sizeof(msg->length));
+                       DEBUG_SERVER_MSG("GET : acceptable max_len [%d], message [%d]", max_len, data->length - sizeof(msg->length));
 
                        if (_net_nfc_server_snep_process_get_response_cb(handle, &get_msg, max_len))
-                       {
                                result = NET_NFC_OK;
-                       }
                        else
-                       {
                                result = NET_NFC_NOT_SUPPORTED;
-                       }
                }
                break;
 
-       case SNEP_REQ_PUT :
+       case SNEP_REQ_PUT:
                {
                        net_nfc_server_p2p_received(data);
                        net_nfc_app_util_process_ndef(data);
@@ -1884,7 +1338,7 @@ static net_nfc_error_e _net_nfc_server_default_server_cb_(
                }
                break;
 
-       default :
+       default:
                DEBUG_ERR_MSG("error [%d]", result);
                break;
        }
@@ -1892,38 +1346,29 @@ static net_nfc_error_e _net_nfc_server_default_server_cb_(
        return result;
 }
 
-
-static net_nfc_error_e _net_nfc_server_default_client_cb_(
-                                               net_nfc_snep_handle_h handle,
-                                               net_nfc_error_e result,
-                                               uint32_t type,
-                                               data_s *data,
-                                               void *user_param)
+static net_nfc_error_e _net_nfc_server_default_client_cb_(net_nfc_snep_handle_h handle, net_nfc_error_e result, uint32_t type, data_s * data, void *user_param)
 {
-       _net_nfc_server_snep_service_context_t *context =
-               (_net_nfc_server_snep_service_context_t*)user_param;
+       _net_nfc_server_snep_service_context_t *context = (_net_nfc_server_snep_service_context_t *) user_param;
 
-       DEBUG_SERVER_MSG("type [%d], result [%d], data [%p]",
-                       type, result, data);
+       DEBUG_SERVER_MSG("type [%d], result [%d], data [%p]", type, result, data);
 
        if (user_param == NULL)
                return NET_NFC_NULL_PARAMETER;;
 
-       switch (type)
-       {
-       case SNEP_RESP_SUCCESS :
-       case SNEP_RESP_BAD_REQ :
-       case SNEP_RESP_EXCESS_DATA :
-       case SNEP_RESP_NOT_FOUND :
-       case SNEP_RESP_NOT_IMPLEMENT :
-       case SNEP_RESP_REJECT :
-       case SNEP_RESP_UNSUPPORTED_VER :
-               context = (_net_nfc_server_snep_service_context_t *)user_param;
+       switch (type) {
+       case SNEP_RESP_SUCCESS:
+       case SNEP_RESP_BAD_REQ:
+       case SNEP_RESP_EXCESS_DATA:
+       case SNEP_RESP_NOT_FOUND:
+       case SNEP_RESP_NOT_IMPLEMENT:
+       case SNEP_RESP_REJECT:
+       case SNEP_RESP_UNSUPPORTED_VER:
+               context = (_net_nfc_server_snep_service_context_t *) user_param;
 
                net_nfc_server_p2p_data_sent(result, context->user_param);
                break;
 
-       default :
+       default:
                DEBUG_ERR_MSG("error [%d]", result);
                break;
        }
@@ -1931,155 +1376,94 @@ static net_nfc_error_e _net_nfc_server_default_client_cb_(
        return result;
 }
 
-
-static net_nfc_error_e _net_nfc_server_default_client_connected_cb_(
-       net_nfc_snep_handle_h handle,
-       net_nfc_error_e result,
-       uint32_t type,
-       data_s *data,
-       void *user_param)
+static net_nfc_error_e _net_nfc_server_default_client_connected_cb_(net_nfc_snep_handle_h handle, net_nfc_error_e result, uint32_t type, data_s * data, void *user_param)
 {
-       _net_nfc_server_snep_service_context_t *context =
-               (_net_nfc_server_snep_service_context_t *)user_param;
+       _net_nfc_server_snep_service_context_t *context = (_net_nfc_server_snep_service_context_t *) user_param;
 
-       DEBUG_SERVER_MSG("type [%d], result [%d], data [%p], user_param [%p]",
-       type, result, data, user_param);
+       DEBUG_SERVER_MSG("type [%d], result [%d], data [%p], user_param [%p]", type, result, data, user_param);
 
        if (context == NULL)
-       {
                return NET_NFC_NULL_PARAMETER;
-       }
 
-       if (result == NET_NFC_OK)
-       {
-               result = net_nfc_server_snep_client_request(handle,
-                       context->type,
-                       &context->data,
-                       _net_nfc_server_default_client_cb_,
-                       context);
-       }
-       else
-       {
+       if (result == NET_NFC_OK) {
+               result = net_nfc_server_snep_client_request(handle, context->type, &context->data, _net_nfc_server_default_client_cb_, context);
+       } else {
                if (context->data.buffer != NULL)
-               {
                        net_nfc_util_clear_data(&context->data);
-               }
                _net_nfc_util_free_mem(context);
        }
 
        return result;
 }
 
-
-net_nfc_error_e net_nfc_server_snep_default_server_start(
-                                               net_nfc_target_handle_s *handle)
+net_nfc_error_e net_nfc_server_snep_default_server_start(net_nfc_target_handle_s * handle)
 {
        /* start default snep server, register your callback */
-       return net_nfc_server_snep_server(handle,
-                               SNEP_SAN,
-                               SNEP_SAP,
-                               _net_nfc_server_default_server_cb_,
-                               (void *)1234);
+       return net_nfc_server_snep_server(handle, SNEP_SAN, SNEP_SAP, _net_nfc_server_default_server_cb_, (void *)1234);
 }
 
-
-net_nfc_error_e net_nfc_server_snep_default_client_start(
-                               net_nfc_target_handle_s *handle,
-                               int type,
-                               data_s *data,
-                               int client,
-                               void *user_param)
+net_nfc_error_e net_nfc_server_snep_default_client_start(net_nfc_target_handle_s * handle, int type, data_s * data, int client, void *user_param)
 {
        _net_nfc_server_snep_service_context_t *context = NULL;
        net_nfc_error_e result;
 
        _net_nfc_util_alloc_mem(context, sizeof(*context));
-       if (context != NULL)
-       {
+       if (context != NULL) {
                context->handle = handle;
                context->client = client;
                context->user_param = user_param;
                context->type = type;
                net_nfc_util_init_data(&context->data, data->length);
                if (context->data.buffer != NULL)
-               {
-                       memcpy(context->data.buffer, data->buffer,
-                               data->length);
-               }
+                       memcpy(context->data.buffer, data->buffer, data->length);
                /* start default snep client, register your callback */
-               result = net_nfc_server_snep_client(handle,
-                                       SNEP_SAN,
-                                       SNEP_SAP,
-                                       _net_nfc_server_default_client_connected_cb_,
-                                       context);
+               result = net_nfc_server_snep_client(handle, SNEP_SAN, SNEP_SAP, _net_nfc_server_default_client_connected_cb_, context);
 
-               if (result != NET_NFC_OK)
-               {
-                       DEBUG_ERR_MSG("net_nfc_server_snep_client failed, [%d]",
-                                       result);
+               if (result != NET_NFC_OK) {
+                       DEBUG_ERR_MSG("net_nfc_server_snep_client failed, [%d]", result);
                        if (context->data.buffer != NULL)
-                       {
                                net_nfc_util_clear_data(&context->data);
-                       }
                        _net_nfc_util_free_mem(context);
                }
                return result;
-       }
-       else
-       {
+       } else {
                return NET_NFC_ALLOC_FAIL;
        }
 }
 
-net_nfc_error_e
-net_nfc_server_snep_default_server_register_get_response_cb(
-                       net_nfc_server_snep_listen_cb cb,
-                       void *user_param)
+net_nfc_error_e net_nfc_server_snep_default_server_register_get_response_cb(net_nfc_server_snep_listen_cb cb, void *user_param)
 {
        net_nfc_error_e result;
 
        if (_net_nfc_server_snep_add_get_response_cb(cb, user_param) == true)
-       {
                result = NET_NFC_OK;
-       }
        else
-       {
                result = NET_NFC_ALREADY_REGISTERED;
-       }
 
        return result;
 }
 
-net_nfc_error_e
-net_nfc_server_snep_default_server_unregister_get_response_cb(
-                       net_nfc_server_snep_listen_cb cb)
+net_nfc_error_e net_nfc_server_snep_default_server_unregister_get_response_cb(net_nfc_server_snep_listen_cb cb)
 {
        _net_nfc_server_snep_del_get_response_cb(cb);
 
        return NET_NFC_OK;
 }
 
-net_nfc_error_e net_nfc_server_snep_default_server_send_get_response(
-                               net_nfc_snep_handle_h snep_handle, data_s *data)
+net_nfc_error_e net_nfc_server_snep_default_server_send_get_response(net_nfc_snep_handle_h snep_handle, data_s * data)
 {
-       net_nfc_server_snep_context_t *context =
-                       (net_nfc_server_snep_context_t *)snep_handle;
+       net_nfc_server_snep_context_t *context = (net_nfc_server_snep_context_t *) snep_handle;
        net_nfc_error_e result = NET_NFC_OK;
 
-       if (context == NULL/* && check valid handle */)
-       {
+       if (context == NULL) {
                DEBUG_ERR_MSG("invalid handle");
                return NET_NFC_INVALID_PARAM;
        }
 
        /* check correct status */
-       if (context->type == SNEP_REQ_GET &&
-                       context->state == NET_NFC_LLCP_STEP_03)
-       {
+       if (context->type == SNEP_REQ_GET && context->state == NET_NFC_LLCP_STEP_03) {
                net_nfc_server_snep_server_send_get_response(snep_handle, data);
-       }
-       else
-       {
+       } else {
                DEBUG_ERR_MSG("incorrect handle state");
                result = NET_NFC_INVALID_STATE;
        }
@@ -2087,23 +1471,17 @@ net_nfc_error_e net_nfc_server_snep_default_server_send_get_response(
        return result;
 }
 
-static void _snep_default_activate_cb(int event,
-       net_nfc_target_handle_s *handle,
-       uint32_t sap, const char *san, void *user_param)
+static void _snep_default_activate_cb(int event, net_nfc_target_handle_s * handle, uint32_t sap, const char *san, void *user_param)
 {
        net_nfc_error_e result;
 
-       DEBUG_SERVER_MSG("event [%d], handle [%p], sap [%d], san [%s]",
-               event, handle, sap, san);
+       DEBUG_SERVER_MSG("event [%d], handle [%p], sap [%d], san [%s]", event, handle, sap, san);
 
        if (event == NET_NFC_LLCP_START) {
                /* start snep server */
-               result = net_nfc_server_snep_server(handle, (char *)san, sap,
-                       _net_nfc_server_default_server_cb_, user_param);
-               if (result != NET_NFC_OK) {
-                       DEBUG_ERR_MSG("net_nfc_service_snep_server failed, [%d]",
-                               result);
-               }
+               result = net_nfc_server_snep_server(handle, (char *)san, sap, _net_nfc_server_default_server_cb_, user_param);
+               if (result != NET_NFC_OK)
+                       DEBUG_ERR_MSG("net_nfc_service_snep_server failed, [%d]", result);
        } else if (event == NET_NFC_LLCP_UNREGISTERED) {
                /* unregister server, do nothing */
        }
@@ -2117,11 +1495,7 @@ net_nfc_error_e net_nfc_server_snep_default_server_register()
        snprintf(id, sizeof(id), "%d", getpid());
 
        /* start default snep server */
-       return net_nfc_server_llcp_register_service(id,
-               SNEP_SAP,
-               SNEP_SAN,
-               _snep_default_activate_cb,
-               NULL);
+       return net_nfc_server_llcp_register_service(id, SNEP_SAP, SNEP_SAN, _snep_default_activate_cb, NULL);
 }
 
 net_nfc_error_e net_nfc_server_snep_default_server_unregister()
@@ -2132,30 +1506,24 @@ net_nfc_error_e net_nfc_server_snep_default_server_unregister()
        snprintf(id, sizeof(id), "%d", getpid());
 
        /* start default snep server */
-       return net_nfc_server_llcp_unregister_service(id,
-               SNEP_SAP,
-               SNEP_SAN);
+       return net_nfc_server_llcp_unregister_service(id, SNEP_SAP, SNEP_SAN);
 }
 
-net_nfc_error_e net_nfc_server_snep_parse_get_request(data_s *request,
-       size_t *max_len, data_s *message)
+net_nfc_error_e net_nfc_server_snep_parse_get_request(data_s * request, size_t * max_len, data_s * message)
 {
        net_nfc_server_snep_msg_t *msg = NULL;
 
-       if (request == NULL || request->buffer == NULL ||
-               request->length == 0 || max_len == NULL || message == NULL) {
+       if (request == NULL || request->buffer == NULL || request->length == 0 || max_len == NULL || message == NULL)
                return NET_NFC_NULL_PARAMETER;
-       }
 
-       msg = (net_nfc_server_snep_msg_t *)request->buffer;
+       msg = (net_nfc_server_snep_msg_t *) request->buffer;
 
        *max_len = htonl(msg->length);
 
        message->buffer = msg->data;
        message->length = request->length - sizeof(msg->length);
 
-       DEBUG_SERVER_MSG("GET : acceptable max_len [%d], message [%d]",
-                       *max_len, request->length - sizeof(msg->length));
+       DEBUG_SERVER_MSG("GET : acceptable max_len [%d], message [%d]", *max_len, request->length - sizeof(msg->length));
 
        return NET_NFC_OK;
 }
index 824edf9..9a83dd7 100755 (executable)
 #define NFC_ROUTE_TABLE_DB_FILE "/opt/usr/data/nfc-manager-daemon/.route_table.db"
 #define NFC_ROUTE_TABLE_DB_TABLE "route_table"
 
-typedef void (*_iterate_db_cb)(const char *package, net_nfc_se_type_e se_type,
-       net_nfc_card_emulation_category_t category, const char *aid,
-       bool unlock, int power, bool manifest, void *user_data);
+typedef void (*_iterate_db_cb) (const char *package, net_nfc_se_type_e se_type, net_nfc_card_emulation_category_t category, const char *aid, bool unlock, int power, bool manifest, void *user_data);
 
 static sqlite3 *db;
 static sqlite3_stmt *current_stmt;
 static int count = 0;
 
-static net_nfc_error_e __route_table_add_aid(const char *id,
-       const char *package, net_nfc_se_type_e se_type,
-       net_nfc_card_emulation_category_t category,
-       const char *aid, bool unlock, int power, bool manifest, bool routing);
+static net_nfc_error_e __route_table_add_aid(const char *id, const char *package, net_nfc_se_type_e se_type, net_nfc_card_emulation_category_t category, const char *aid, bool unlock, int power, bool manifest, bool routing);
 
-static net_nfc_error_e __route_table_del_aid(const char *id,
-       const char *package, const char *aid, bool force);
+static net_nfc_error_e __route_table_del_aid(const char *id, const char *package, const char *aid, bool force);
 
-static net_nfc_error_e __insert_into_db(const char *package, net_nfc_se_type_e se_type,
-       net_nfc_card_emulation_category_t category, const char *aid,
-       bool unlock, int power, bool manifest);
+static net_nfc_error_e __insert_into_db(const char *package, net_nfc_se_type_e se_type, net_nfc_card_emulation_category_t category, const char *aid, bool unlock, int power, bool manifest);
 
 static void __set_payment_handler(const char *package);
 
@@ -74,11 +66,10 @@ static bool __is_table_existing(const char *table)
                                int count;
 
                                count = sqlite3_column_int(stmt, 0);
-                               if (count > 0) {
+                               if (count > 0)
                                        result = true;
-                               } else {
+                               else
                                        result = false;
-                               }
                        } else {
                                DEBUG_ERR_MSG("sqlite3_step failed, [%d:%s]", ret, sqlite3_errmsg(db));
 
@@ -126,9 +117,8 @@ static void __create_table()
 
 static void __prepare_table()
 {
-       if (__is_table_existing(NFC_ROUTE_TABLE_DB_TABLE) == false) {
+       if (__is_table_existing(NFC_ROUTE_TABLE_DB_TABLE) == false)
                __create_table();
-       }
 }
 
 static void __initialize_db()
@@ -137,9 +127,7 @@ static void __initialize_db()
        char *error = NULL;
 
        if (db == NULL) {
-               result = sqlite3_open_v2(NFC_ROUTE_TABLE_DB_FILE, &db,
-                       SQLITE_OPEN_NOMUTEX | SQLITE_OPEN_READWRITE | SQLITE_OPEN_CREATE,
-                       NULL);
+               result = sqlite3_open_v2(NFC_ROUTE_TABLE_DB_FILE, &db, SQLITE_OPEN_NOMUTEX | SQLITE_OPEN_READWRITE | SQLITE_OPEN_CREATE, NULL);
                if (result != SQLITE_OK) {
                        DEBUG_ERR_MSG("sqlite3_open_v2 failed, [%d]", result);
 
@@ -147,8 +135,7 @@ static void __initialize_db()
                }
 
                /* Enable persist journal mode */
-               result = sqlite3_exec(db, "PRAGMA journal_mode = PERSIST",
-                       NULL, NULL, &error);
+               result = sqlite3_exec(db, "PRAGMA journal_mode = PERSIST", NULL, NULL, &error);
                if (result != SQLITE_OK) {
                        DEBUG_ERR_MSG("Fail to change journal mode: %s", error);
                        sqlite3_free(error);
@@ -161,14 +148,13 @@ static void __initialize_db()
 
        return;
 
-ERR :
+ ERR:
        if (db != NULL) {
                result = sqlite3_close(db);
-               if (result == SQLITE_OK) {
+               if (result == SQLITE_OK)
                        db = NULL;
-               } else {
+               else
                        DEBUG_ERR_MSG("sqlite3_close failed, [%d]", result);
-               }
        }
 }
 
@@ -179,17 +165,15 @@ static void __finalize_db()
        if (db != NULL) {
                if (current_stmt != NULL) {
                        result = sqlite3_finalize(current_stmt);
-                       if (result != SQLITE_OK) {
+                       if (result != SQLITE_OK)
                                DEBUG_ERR_MSG("sqlite3_finalize failed, [%d]", result);
-                       }
                }
 
                result = sqlite3_close(db);
-               if (result == SQLITE_OK) {
+               if (result == SQLITE_OK)
                        db = NULL;
-               } else {
+               else
                        DEBUG_ERR_MSG("sqlite3_close failed, [%d]", result);
-               }
        }
 }
 
@@ -197,9 +181,8 @@ static void __iterate_db(_iterate_db_cb cb, void *user_data)
 {
        char *sql;
 
-       if (cb == NULL) {
+       if (cb == NULL)
                return;
-       }
 
        sql = sqlite3_mprintf("SELECT * FROM %s;", NFC_ROUTE_TABLE_DB_TABLE);
        if (sql != NULL) {
@@ -218,12 +201,12 @@ static void __iterate_db(_iterate_db_cb cb, void *user_data)
 
                        while ((ret = sqlite3_step(stmt)) == SQLITE_ROW) {
                                package = (const char *)sqlite3_column_text(stmt, 1);
-                               se_type = (net_nfc_se_type_e)sqlite3_column_int(stmt, 2);
-                               category = (net_nfc_card_emulation_category_t)sqlite3_column_int(stmt, 3);
+                               se_type = (net_nfc_se_type_e) sqlite3_column_int(stmt, 2);
+                               category = (net_nfc_card_emulation_category_t) sqlite3_column_int(stmt, 3);
                                aid = (const char *)sqlite3_column_text(stmt, 4);
-                               unlock = (bool)sqlite3_column_int(stmt, 5);
+                               unlock = (bool) sqlite3_column_int(stmt, 5);
                                power = sqlite3_column_int(stmt, 6);
-                               manifest = (bool)sqlite3_column_int(stmt, 7);
+                               manifest = (bool) sqlite3_column_int(stmt, 7);
 
                                cb(package, se_type, category, aid, unlock, power, manifest, user_data);
                        }
@@ -239,23 +222,19 @@ static void __iterate_db(_iterate_db_cb cb, void *user_data)
        }
 }
 
-static net_nfc_error_e __insert_into_db(const char *package, net_nfc_se_type_e se_type,
-       net_nfc_card_emulation_category_t category, const char *aid,
-       bool unlock, int power, bool manifest)
+static net_nfc_error_e __insert_into_db(const char *package, net_nfc_se_type_e se_type, net_nfc_card_emulation_category_t category, const char *aid, bool unlock, int power, bool manifest)
 {
        net_nfc_error_e result;
        char *sql;
 
-       sql = sqlite3_mprintf("INSERT INTO %s (package, se_type, category, aid, unlock, power, manifest) values(?, %d, %d, ?, %d, %d, %d);",
-               NFC_ROUTE_TABLE_DB_TABLE, se_type, category, (int)unlock, power, (int)manifest);
+       sql = sqlite3_mprintf("INSERT INTO %s (package, se_type, category, aid, unlock, power, manifest) values(?, %d, %d, ?, %d, %d, %d);", NFC_ROUTE_TABLE_DB_TABLE, se_type, category, (int)unlock, power, (int)manifest);
        if (sql != NULL) {
                sqlite3_stmt *stmt = NULL;
                int ret;
 
                ret = sqlite3_prepare_v2(db, sql, strlen(sql), &stmt, NULL);
                if (ret == SQLITE_OK) {
-                       ret = sqlite3_bind_text(stmt, 1, package,
-                               strlen(package), SQLITE_STATIC);
+                       ret = sqlite3_bind_text(stmt, 1, package, strlen(package), SQLITE_STATIC);
                        if (ret != SQLITE_OK) {
                                DEBUG_ERR_MSG("sqlite3_bind_text failed, [%d]", ret);
 
@@ -263,8 +242,7 @@ static net_nfc_error_e __insert_into_db(const char *package, net_nfc_se_type_e s
                                goto END;
                        }
 
-                       ret = sqlite3_bind_text(stmt, 2, aid,
-                               strlen(aid), SQLITE_STATIC);
+                       ret = sqlite3_bind_text(stmt, 2, aid, strlen(aid), SQLITE_STATIC);
                        if (ret != SQLITE_OK) {
                                DEBUG_ERR_MSG("sqlite3_bind_text failed, [%d]", ret);
 
@@ -281,7 +259,7 @@ static net_nfc_error_e __insert_into_db(const char *package, net_nfc_se_type_e s
                        }
 
                        result = NET_NFC_OK;
-END :
+ END:
                        sqlite3_finalize(stmt);
                } else {
                        DEBUG_ERR_MSG("sqlite3_prepare_v2 failed, [%d:%s]", ret, sqlite3_errmsg(db));
@@ -305,8 +283,7 @@ static net_nfc_error_e __delete_from_db(const char *package, const char *aid)
        char *sql;
        char *error = NULL;
 
-       sql = sqlite3_mprintf("DELETE FROM %s WHERE package=%Q AND aid=%Q;",
-               NFC_ROUTE_TABLE_DB_TABLE, package, aid);
+       sql = sqlite3_mprintf("DELETE FROM %s WHERE package=%Q AND aid=%Q;", NFC_ROUTE_TABLE_DB_TABLE, package, aid);
        if (sql != NULL) {
                int ret;
 
@@ -329,6 +306,7 @@ static net_nfc_error_e __delete_from_db(const char *package, const char *aid)
 
        return result;
 }
+
 #if 0
 static net_nfc_error_e __delete_aids_from_db(const char *package)
 {
@@ -336,8 +314,7 @@ static net_nfc_error_e __delete_aids_from_db(const char *package)
        char *sql;
        char *error = NULL;
 
-       sql = sqlite3_mprintf("DELETE FROM %s WHERE package=%Q;",
-               NFC_ROUTE_TABLE_DB_TABLE, package);
+       sql = sqlite3_mprintf("DELETE FROM %s WHERE package=%Q;", NFC_ROUTE_TABLE_DB_TABLE, package);
        if (sql != NULL) {
                int ret;
 
@@ -373,36 +350,30 @@ static int used_aids_count[NET_NFC_CARD_EMULATION_CATEGORY_MAX + 1];
 
 static void __update_payment_handler(const char *package)
 {
-       if (activated_payment != NULL) {
+       if (activated_payment != NULL)
                g_free(activated_payment);
-       }
 
-       if (package != NULL) {
+       if (package != NULL)
                activated_payment = g_strdup(package);
-       }
 }
 
 static bool __is_preferred_payment_handler(const char *package)
 {
-       return (preferred_payment != NULL &&
-               g_strcmp0(package, preferred_payment) == 0);
+       return (preferred_payment != NULL && g_strcmp0(package, preferred_payment) == 0);
 }
 
 static bool __is_payment_handler(const char *package)
 {
-       return (activated_payment != NULL &&
-               g_strcmp0(package, activated_payment) == 0);
+       return (activated_payment != NULL && g_strcmp0(package, activated_payment) == 0);
 }
 
 static void __set_payment_handler(const char *package)
 {
        int result;
 
-       result = vconf_set_str(VCONFKEY_NFC_PAYMENT_HANDLERS,
-               package != NULL ? package : "");
-       if (result < 0) {
+       result = vconf_set_str(VCONFKEY_NFC_PAYMENT_HANDLERS, package != NULL ? package : "");
+       if (result < 0)
                DEBUG_ERR_MSG("vconf_set_str(VCONFKEY_NFC_PAYMENT_HANDLER) failed, [%d]", result);
-       }
 }
 
 static void __on_destroy_other_cb(gpointer data)
@@ -412,22 +383,19 @@ static void __on_destroy_other_cb(gpointer data)
 
 static void __update_other_handler(const char *packages)
 {
-       if (activated_other != NULL) {
+       if (activated_other != NULL)
                g_ptr_array_free(activated_other, true);
-       }
 
        if (packages != NULL) {
                gchar **tokens;
                gchar **ptr;
 
-               activated_other = g_ptr_array_new_full(10,
-                       __on_destroy_other_cb);
+               activated_other = g_ptr_array_new_full(10, __on_destroy_other_cb);
 
                tokens = g_strsplit(packages, "|", -1);
 
-               for (ptr = tokens; *ptr != NULL; ptr++) {
+               for (ptr = tokens; *ptr != NULL; ptr++)
                        g_ptr_array_add(activated_other, g_strdup(*ptr));
-               }
 
                g_strfreev(tokens);
        }
@@ -442,8 +410,7 @@ void net_nfc_server_route_table_update_other_handler(const char *packages)
 
 static bool __is_preferred_other_handler(const char *package)
 {
-       return (preferred_other != NULL &&
-               g_strcmp0(package, preferred_other) == 0);
+       return (preferred_other != NULL && g_strcmp0(package, preferred_other) == 0);
 }
 
 static bool __is_other_handler(const char *package)
@@ -473,24 +440,18 @@ static void __remove_other_handler(const char *package)
                if (g_strcmp0(package, (char *)activated_other->pdata[i]) == 0) {
                        found = i;
                } else {
-                       if (i != activated_other->len - 1) {
-                               offset += snprintf(built + offset,
-                                       sizeof(built) - offset, "%s|",
-                                       (char *)activated_other->pdata[i]);
-                       } else {
-                               offset += snprintf(built + offset,
-                                       sizeof(built) - offset, "%s",
-                                       (char *)activated_other->pdata[i]);
-                       }
+                       if (i != activated_other->len - 1)
+                               offset += snprintf(built + offset, sizeof(built) - offset, "%s|", (char *)activated_other->pdata[i]);
+                       else
+                               offset += snprintf(built + offset, sizeof(built) - offset, "%s", (char *)activated_other->pdata[i]);
                }
        }
 
        if (found >= 0) {
                /* vconf update */
                i = vconf_set_str(VCONFKEY_NFC_OTHER_HANDLERS, built);
-               if (i < 0) {
+               if (i < 0)
                        DEBUG_ERR_MSG("vconf_set_str(VCONFKEY_NFC_OTHERS_HANDLER) failed, [%d]", i);
-               }
        }
 }
 
@@ -500,17 +461,15 @@ static void __append_other_handler(const char *package)
        char *others;
        char built[4096] = { 0, };
 
-       if (__is_other_handler(package) == true) {
+       if (__is_other_handler(package) == true)
                return;
-       }
 
        others = vconf_get_str(VCONFKEY_NFC_OTHER_HANDLERS);
        if (others != NULL) {
-               if (strlen(others) > 0) {
+               if (strlen(others) > 0)
                        snprintf(built, sizeof(built), "%s|%s", others, package);
-               } else {
+               else
                        snprintf(built, sizeof(built), "%s", package);
-               }
 
                free(others);
        } else {
@@ -519,104 +478,92 @@ static void __append_other_handler(const char *package)
 
        /* vconf update */
        result = vconf_set_str(VCONFKEY_NFC_OTHER_HANDLERS, built);
-       if (result < 0) {
+       if (result < 0)
                DEBUG_ERR_MSG("vconf_set_str(VCONFKEY_NFC_OTHERS_HANDLER) failed, [%d]", result);
-       }
 }
 
-static bool __is_preferred_handler(net_nfc_card_emulation_category_t category,
-       const char *package)
+static bool __is_preferred_handler(net_nfc_card_emulation_category_t category, const char *package)
 {
        switch (category) {
-       case NET_NFC_CARD_EMULATION_CATEGORY_PAYMENT :
+       case NET_NFC_CARD_EMULATION_CATEGORY_PAYMENT:
                return __is_preferred_payment_handler(package);
-       case NET_NFC_CARD_EMULATION_CATEGORY_OTHER :
+       case NET_NFC_CARD_EMULATION_CATEGORY_OTHER:
                return __is_preferred_other_handler(package);
-       default :
+       default:
                return false;
        }
 }
 
-static bool __is_activated_handler(net_nfc_card_emulation_category_t category,
-       const char *package)
+static bool __is_activated_handler(net_nfc_card_emulation_category_t category, const char *package)
 {
        /* set nfc-manager to default handler */
-       if (g_strcmp0(package, "nfc-manager") == 0) {
+       if (g_strcmp0(package, "nfc-manager") == 0)
                return true;
-       }
 
        switch (category) {
-       case NET_NFC_CARD_EMULATION_CATEGORY_PAYMENT :
+       case NET_NFC_CARD_EMULATION_CATEGORY_PAYMENT:
                return __is_payment_handler(package);
-       case NET_NFC_CARD_EMULATION_CATEGORY_OTHER :
+       case NET_NFC_CARD_EMULATION_CATEGORY_OTHER:
                return __is_other_handler(package);
-       default :
+       default:
                return false;
        }
 }
 
-static void __activate_handler(const char *package,
-       net_nfc_card_emulation_category_t category)
+static void __activate_handler(const char *package, net_nfc_card_emulation_category_t category)
 {
        switch (category) {
-       case NET_NFC_CARD_EMULATION_CATEGORY_PAYMENT :
-               if (__is_payment_handler(package) == false) {
+       case NET_NFC_CARD_EMULATION_CATEGORY_PAYMENT:
+               if (__is_payment_handler(package) == false)
                        __set_payment_handler(package);
-               }
                break;
 
-       case NET_NFC_CARD_EMULATION_CATEGORY_OTHER :
-               if (__is_other_handler(package) == false) {
+       case NET_NFC_CARD_EMULATION_CATEGORY_OTHER:
+               if (__is_other_handler(package) == false)
                        __append_other_handler(package);
-               }
                break;
 
-       default :
+       default:
                break;
        }
 }
 
-static void __deactivate_handler(const char *package,
-       net_nfc_card_emulation_category_t category)
+static void __deactivate_handler(const char *package, net_nfc_card_emulation_category_t category)
 {
        switch (category) {
-       case NET_NFC_CARD_EMULATION_CATEGORY_PAYMENT :
-               if (__is_payment_handler(package) == true) {
+       case NET_NFC_CARD_EMULATION_CATEGORY_PAYMENT:
+               if (__is_payment_handler(package) == true)
                        __set_payment_handler(NULL);
-               }
                break;
 
-       case NET_NFC_CARD_EMULATION_CATEGORY_OTHER :
-               if (__is_other_handler(package) == true) {
+       case NET_NFC_CARD_EMULATION_CATEGORY_OTHER:
+               if (__is_other_handler(package) == true)
                        __remove_other_handler(package);
-               }
                break;
 
-       default :
+       default:
                break;
        }
 }
 
-void net_nfc_server_route_table_update_category_handler(const char *package,
-       net_nfc_card_emulation_category_t category)
+void net_nfc_server_route_table_update_category_handler(const char *package, net_nfc_card_emulation_category_t category)
 {
        switch (category) {
-       case NET_NFC_CARD_EMULATION_CATEGORY_PAYMENT :
+       case NET_NFC_CARD_EMULATION_CATEGORY_PAYMENT:
                __update_payment_handler(package);
                net_nfc_server_route_table_do_update(net_nfc_server_manager_get_active());
                break;
 
-       case NET_NFC_CARD_EMULATION_CATEGORY_OTHER :
+       case NET_NFC_CARD_EMULATION_CATEGORY_OTHER:
                __update_other_handler(package);
                net_nfc_server_route_table_do_update(net_nfc_server_manager_get_active());
                break;
 
-       default :
+       default:
                break;
        }
 }
 
-
 ////////////////////////////////////////////////////////////////////////////////
 
 /*Routing Table base on AID*/
@@ -630,12 +577,10 @@ static bool __get_package_name(const char *id, char *package, size_t len)
 
        pid = net_nfc_server_gdbus_get_pid(id);
        if (pid > 0) {
-               if (net_nfc_util_get_pkgid_by_pid(pid,
-                       package, len) == true) {
+               if (net_nfc_util_get_pkgid_by_pid(pid, package, len) == true)
                        result = true;
-               } else {
+               else
                        result = false;
-               }
        } else {
                result = false;
        }
@@ -645,29 +590,24 @@ static bool __get_package_name(const char *id, char *package, size_t len)
 
 static void __on_key_destroy(gpointer data)
 {
-       if (data != NULL) {
+       if (data != NULL)
                g_free(data);
-       }
 }
 
 static void __on_value_destroy(gpointer data)
 {
-       route_table_handler_t *listener = (route_table_handler_t *)data;
+       route_table_handler_t *listener = (route_table_handler_t *) data;
 
        if (data != NULL) {
                int i;
 
-               for (i = NET_NFC_CARD_EMULATION_CATEGORY_PAYMENT;
-                       i < NET_NFC_CARD_EMULATION_CATEGORY_MAX;
-                       i++) {
-                       if (listener->aids[i] != NULL) {
+               for (i = NET_NFC_CARD_EMULATION_CATEGORY_PAYMENT; i < NET_NFC_CARD_EMULATION_CATEGORY_MAX; i++) {
+                       if (listener->aids[i] != NULL)
                                g_ptr_array_free(listener->aids[i], true);
-                       }
                }
 
-               if (listener->id != NULL) {
+               if (listener->id != NULL)
                        g_free(listener->id);
-               }
 
                g_free(data);
        }
@@ -675,18 +615,15 @@ static void __on_value_destroy(gpointer data)
 
 static void __on_aid_info_destroy(gpointer data)
 {
-       aid_info_t *info = (aid_info_t *)data;
+       aid_info_t *info = (aid_info_t *) data;
 
-       if (info->aid != NULL) {
+       if (info->aid != NULL)
                g_free(info->aid);
-       }
 
        g_free(info);
 }
 
-static void __on_iterate_db_aid_cb(const char *package,
-       net_nfc_se_type_e se_type, net_nfc_card_emulation_category_t category,
-       const char *aid, bool unlock, int power, bool manifest, void *user_data)
+static void __on_iterate_db_aid_cb(const char *package, net_nfc_se_type_e se_type, net_nfc_card_emulation_category_t category, const char *aid, bool unlock, int power, bool manifest, void *user_data)
 {
        net_nfc_server_route_table_add_handler(NULL, package);
 
@@ -704,18 +641,15 @@ void net_nfc_server_route_table_init()
 
                package = vconf_get_str(VCONFKEY_NFC_PAYMENT_HANDLERS);
                __update_payment_handler(package);
-               if (package != NULL) {
+               if (package != NULL)
                        free(package);
-               }
 
                package = vconf_get_str(VCONFKEY_NFC_OTHER_HANDLERS);
                __update_other_handler(package);
-               if (package != NULL) {
+               if (package != NULL)
                        free(package);
-               }
 
-               routing_handlers = g_hash_table_new_full(g_str_hash,
-                       g_str_equal, __on_key_destroy, __on_value_destroy);
+               routing_handlers = g_hash_table_new_full(g_str_hash, g_str_equal, __on_key_destroy, __on_value_destroy);
 
                /* load aids from database */
                net_nfc_server_route_table_load_db();
@@ -727,9 +661,8 @@ void net_nfc_server_route_table_init()
 
 void net_nfc_server_route_table_load_db()
 {
-       if (routing_handlers != NULL) {
+       if (routing_handlers != NULL)
                __iterate_db(__on_iterate_db_aid_cb, NULL);
-       }
 }
 
 void net_nfc_server_route_table_deinit()
@@ -743,15 +676,12 @@ void net_nfc_server_route_table_deinit()
 
 }
 
-route_table_handler_t *net_nfc_server_route_table_find_handler(
-       const char *package)
+route_table_handler_t *net_nfc_server_route_table_find_handler(const char *package)
 {
-       return (route_table_handler_t *)g_hash_table_lookup(routing_handlers,
-               (gconstpointer)package);
+       return (route_table_handler_t *) g_hash_table_lookup(routing_handlers, (gconstpointer) package);
 }
 
-net_nfc_error_e net_nfc_server_route_table_add_handler(const char *id,
-       const char *package)
+net_nfc_error_e net_nfc_server_route_table_add_handler(const char *id, const char *package)
 {
        route_table_handler_t *data;
        net_nfc_error_e result;
@@ -765,23 +695,17 @@ net_nfc_error_e net_nfc_server_route_table_add_handler(const char *id,
                data = g_new0(route_table_handler_t, 1);
 
                data->package = g_strdup(package);
-               if (id != NULL) {
+               if (id != NULL)
                        data->id = g_strdup(id);
-               }
 
                /* full aid list in array index 0 */
-               data->aids[NET_NFC_CARD_EMULATION_CATEGORY_UNKNOWN] =
-                       g_ptr_array_new_full(0, __on_aid_info_destroy);
+               data->aids[NET_NFC_CARD_EMULATION_CATEGORY_UNKNOWN] = g_ptr_array_new_full(0, __on_aid_info_destroy);
 
                /* partial aid list for each category in array index > 1 */
-               for (i = NET_NFC_CARD_EMULATION_CATEGORY_PAYMENT;
-                       i < NET_NFC_CARD_EMULATION_CATEGORY_MAX;
-                       i++) {
+               for (i = NET_NFC_CARD_EMULATION_CATEGORY_PAYMENT; i < NET_NFC_CARD_EMULATION_CATEGORY_MAX; i++)
                        data->aids[i] = g_ptr_array_new();
-               }
 
-               g_hash_table_insert(routing_handlers, (gpointer)g_strdup(package),
-                       (gpointer)data);
+               g_hash_table_insert(routing_handlers, (gpointer) g_strdup(package), (gpointer) data);
 
                result = NET_NFC_OK;
        } else {
@@ -796,7 +720,7 @@ net_nfc_error_e net_nfc_server_route_table_add_handler(const char *id,
        return result;
 }
 
-static net_nfc_error_e __do_routing_aid(aid_info_t *info, bool commit)
+static net_nfc_error_e __do_routing_aid(aid_info_t * info, bool commit)
 {
        net_nfc_error_e result;
 
@@ -805,9 +729,8 @@ static net_nfc_error_e __do_routing_aid(aid_info_t *info, bool commit)
 
                SECURE_MSG("route aid, aid [%s]", info->aid);
 
-               if (net_nfc_util_aid_is_prefix(info->aid) == true) {
+               if (net_nfc_util_aid_is_prefix(info->aid) == true)
                        SECURE_MSG("prefix...");
-               }
 
                if (net_nfc_util_hex_string_to_binary(info->aid, &temp) == true) {
                        net_nfc_controller_secure_element_route_aid(&temp, info->se_type, info->power, &result);
@@ -818,9 +741,8 @@ static net_nfc_error_e __do_routing_aid(aid_info_t *info, bool commit)
                                        net_nfc_server_vconf_set_screen_on_flag(true);
                                }
 
-                               if (commit == true) {
+                               if (commit == true)
                                        net_nfc_controller_secure_element_commit_routing(&result);
-                               }
                        } else {
                                DEBUG_ERR_MSG("net_nfc_controller_secure_element_route_aid failed, [%d]", result);
                        }
@@ -840,7 +762,7 @@ static net_nfc_error_e __do_routing_aid(aid_info_t *info, bool commit)
        return result;
 }
 
-static net_nfc_error_e __do_unrouting_aid(aid_info_t *info, bool commit)
+static net_nfc_error_e __do_unrouting_aid(aid_info_t * info, bool commit)
 {
        net_nfc_error_e result;
 
@@ -849,9 +771,8 @@ static net_nfc_error_e __do_unrouting_aid(aid_info_t *info, bool commit)
 
                SECURE_MSG("unroute aid, aid [%s]", info->aid);
 
-               if (net_nfc_util_aid_is_prefix(info->aid) == true) {
+               if (net_nfc_util_aid_is_prefix(info->aid) == true)
                        SECURE_MSG("prefix...");
-               }
 
                if (net_nfc_util_hex_string_to_binary(info->aid, &temp) == true) {
                        net_nfc_controller_secure_element_unroute_aid(&temp, &result);
@@ -861,13 +782,12 @@ static net_nfc_error_e __do_unrouting_aid(aid_info_t *info, bool commit)
                                        count--;
                                        if (count <= 0) {
                                                net_nfc_server_vconf_set_screen_on_flag(false);
-                                               net_nfc_controller_set_screen_state(NET_NFC_SCREEN_OFF , &result);
+                                               net_nfc_controller_set_screen_state(NET_NFC_SCREEN_OFF, &result);
                                        }
                                }
 
-                               if (commit == true) {
+                               if (commit == true)
                                        net_nfc_controller_secure_element_commit_routing(&result);
-                               }
                        } else {
                                DEBUG_ERR_MSG("net_nfc_controller_secure_element_unroute_aid failed, [%d]", result);
                        }
@@ -888,8 +808,7 @@ static net_nfc_error_e __do_unrouting_aid(aid_info_t *info, bool commit)
 }
 
 #if 0
-net_nfc_error_e net_nfc_server_route_table_del_handler(const char *id,
-       const char *package, bool force)
+net_nfc_error_e net_nfc_server_route_table_del_handler(const char *id, const char *package, bool force)
 {
        route_table_handler_t *data;
        net_nfc_error_e result;
@@ -902,12 +821,10 @@ net_nfc_error_e net_nfc_server_route_table_del_handler(const char *id,
 
                DEBUG_SERVER_MSG("deleting package, [%s]", package);
 
-               for (i = NET_NFC_CARD_EMULATION_CATEGORY_PAYMENT;
-                       i < NET_NFC_CARD_EMULATION_CATEGORY_MAX;
-                       i++) {
-                       /* deactivate for each category */
+               for (i = NET_NFC_CARD_EMULATION_CATEGORY_PAYMENT; i < NET_NFC_CARD_EMULATION_CATEGORY_MAX; i++) {
                        if (data->activated[i] == true) {
                                /* TODO */
+                               /* deactivate for each category */
                        }
                }
 
@@ -915,9 +832,8 @@ net_nfc_error_e net_nfc_server_route_table_del_handler(const char *id,
                        info = data->aids[0]->pdata[i];
 
                        if (force == true || info->manifest == false) {
-                               if (__do_unrouting_aid(info, false) == NET_NFC_OK) {
+                               if (__do_unrouting_aid(info, false) == NET_NFC_OK)
                                        need_commit = true;
-                               }
 
                                g_ptr_array_remove(data->aids[info->category], info);
                                g_ptr_array_remove_index(data->aids[0], i);
@@ -926,15 +842,13 @@ net_nfc_error_e net_nfc_server_route_table_del_handler(const char *id,
                        }
                }
 
-               if (need_commit == true) {
+               if (need_commit == true)
                        net_nfc_controller_secure_element_commit_routing(&result);
-               }
 
-               if (data->aids[0]->len == 0) {
+               if (data->aids[0]->len == 0)
                        g_hash_table_remove(routing_handlers, package);
-               } else {
+               else
                        DEBUG_SERVER_MSG("remain some aids, [%d]", data->aids[0]->len);
-               }
 
                result = NET_NFC_OK;
        } else {
@@ -946,8 +860,7 @@ net_nfc_error_e net_nfc_server_route_table_del_handler(const char *id,
        return result;
 }
 #else
-net_nfc_error_e net_nfc_server_route_table_del_handler(const char *id,
-       const char *package, bool force)
+net_nfc_error_e net_nfc_server_route_table_del_handler(const char *id, const char *package, bool force)
 {
        route_table_handler_t *data;
        net_nfc_error_e result;
@@ -961,16 +874,12 @@ net_nfc_error_e net_nfc_server_route_table_del_handler(const char *id,
                        data->id = NULL;
                }
 
-               if (data->aids[0]->len > 0) {
+               if (data->aids[0]->len > 0)
                        net_nfc_server_route_table_del_aids(id, package, force);
-               }
 
-               for (category = NET_NFC_CARD_EMULATION_CATEGORY_PAYMENT;
-                       category < NET_NFC_CARD_EMULATION_CATEGORY_MAX;
-                       category++) {
-                       if (data->aids[category]->len == 0 &&
-                               data->activated[category] == true) {
-                       /* deactivate for each category */
+               for (category = NET_NFC_CARD_EMULATION_CATEGORY_PAYMENT; category < NET_NFC_CARD_EMULATION_CATEGORY_MAX; category++) {
+                       if (data->aids[category]->len == 0 && data->activated[category] == true) {
+                               /* deactivate for each category */
                                SECURE_MSG("deactivate handler, [%d][%s]", category, package);
 
                                /* TODO */
@@ -998,8 +907,7 @@ net_nfc_error_e net_nfc_server_route_table_del_handler(const char *id,
        return result;
 }
 #endif
-net_nfc_error_e net_nfc_server_route_table_update_handler_id(
-       const char *package, const char *id)
+net_nfc_error_e net_nfc_server_route_table_update_handler_id(const char *package, const char *id)
 {
        net_nfc_error_e result;
 
@@ -1029,14 +937,13 @@ route_table_handler_t *net_nfc_server_route_table_get_preferred_handler()
        return preferred_handler;
 }
 
-void net_nfc_server_route_table_unset_preferred_handler_by_id(const charid)
+void net_nfc_server_route_table_unset_preferred_handler_by_id(const char *id)
 {
        route_table_handler_t *handler;
 
        handler = net_nfc_server_route_table_find_handler_by_id(id);
        if (handler != NULL) {
-               if (__is_preferred_handler(NET_NFC_CARD_EMULATION_CATEGORY_PAYMENT, handler->package) ||
-                        __is_preferred_handler(NET_NFC_CARD_EMULATION_CATEGORY_OTHER, handler->package)) {
+               if (__is_preferred_handler(NET_NFC_CARD_EMULATION_CATEGORY_PAYMENT, handler->package) || __is_preferred_handler(NET_NFC_CARD_EMULATION_CATEGORY_OTHER, handler->package)) {
                        DEBUG_SERVER_MSG("[Preferred] Unset Preferred handler by id");
                        net_nfc_server_route_table_set_preferred_handler(NULL);
                        net_nfc_server_route_table_do_update(net_nfc_server_manager_get_active());
@@ -1044,7 +951,7 @@ void net_nfc_server_route_table_unset_preferred_handler_by_id(const char* id)
        }
 }
 
-void net_nfc_server_route_table_set_preferred_handler(route_table_handler_t *handler)
+void net_nfc_server_route_table_set_preferred_handler(route_table_handler_t * handler)
 {
        int payment_count, other_count;
 
@@ -1070,7 +977,7 @@ void net_nfc_server_route_table_set_preferred_handler(route_table_handler_t *han
 
 net_nfc_error_e net_nfc_server_route_table_update_preferred_handler()
 {
-       char foreground[1024] = {0,};
+       char foreground[1024] = { 0, };
 
        if (preferred_handler != NULL && preferred_handler->package) {
                pid_t pid;
@@ -1080,21 +987,19 @@ net_nfc_error_e net_nfc_server_route_table_update_preferred_handler()
                net_nfc_util_get_pkgid_by_pid(pid, foreground, sizeof(foreground));
 
                if (strcmp(foreground, preferred_handler->package) != 0) {
-                       DEBUG_SERVER_MSG("[Preferred] Not match!!! foreground : %s, preferred : %s",
-                               foreground, preferred_handler->package);
+                       DEBUG_SERVER_MSG("[Preferred] Not match!!! foreground : %s, preferred : %s", foreground, preferred_handler->package);
 
                        net_nfc_server_route_table_set_preferred_handler(NULL);
                        net_nfc_server_route_table_do_update(net_nfc_server_manager_get_active());
                }
        }
-
 #ifdef PRINT_TABLE
        net_nfc_server_route_table_preferred_handler_dump();
 #endif
        return NET_NFC_OK;
 }
 
-bool net_nfc_server_route_table_is_allowed_preferred_handler(route_table_handler_t *handler)
+bool net_nfc_server_route_table_is_allowed_preferred_handler(route_table_handler_t * handler)
 {
        int payment_count;
 
@@ -1114,7 +1019,7 @@ bool net_nfc_server_route_table_is_allowed_preferred_handler(route_table_handler
 #ifdef PRINT_TABLE
 void net_nfc_server_route_table_preferred_handler_dump()
 {
-       char foreground[1024] = {0,};
+       char foreground[1024] = { 0, };
        pid_t pid;
 
        //check match prefered and foreground app
@@ -1138,8 +1043,7 @@ void net_nfc_server_route_table_preferred_handler_dump()
 }
 #endif
 
-void net_nfc_server_route_table_iterate_handler(
-       net_nfc_server_route_table_handler_iter_cb cb, void *user_data)
+void net_nfc_server_route_table_iterate_handler(net_nfc_server_route_table_handler_iter_cb cb, void *user_data)
 {
        GHashTableIter iter;
        gpointer key;
@@ -1150,15 +1054,13 @@ void net_nfc_server_route_table_iterate_handler(
 
        g_hash_table_iter_init(&iter, routing_handlers);
 
-       while (g_hash_table_iter_next(&iter, &key, (gpointer)&data)) {
-               if (cb((const char *)key, data, user_data) == false) {
+       while (g_hash_table_iter_next(&iter, &key, (gpointer) & data)) {
+               if (cb((const char *)key, data, user_data) == false)
                        break;
-               }
        }
 }
 
-void net_nfc_server_route_table_iterate_handler_activated_last(
-       net_nfc_server_route_table_handler_iter_cb cb, void *user_data)
+void net_nfc_server_route_table_iterate_handler_activated_last(net_nfc_server_route_table_handler_iter_cb cb, void *user_data)
 {
        GHashTableIter iter;
        gpointer key;
@@ -1169,70 +1071,58 @@ void net_nfc_server_route_table_iterate_handler_activated_last(
 
        g_hash_table_iter_init(&iter, routing_handlers);
 
-       while (g_hash_table_iter_next(&iter, &key, (gpointer)&data)) {
+       while (g_hash_table_iter_next(&iter, &key, (gpointer) & data)) {
                if (!__is_preferred_payment_handler((const char *)key)
                        && !__is_preferred_other_handler((const char *)key)
                        && !__is_payment_handler((const char *)key)
                        && !__is_other_handler((const char *)key)) {
-                       if (cb((const char *)key, data, user_data) == false) {
+                       if (cb((const char *)key, data, user_data) == false)
                                break;
-                       }
                }
        }
 
        g_hash_table_iter_init(&iter, routing_handlers);
 
-       while (g_hash_table_iter_next(&iter, &key, (gpointer)&data)) {
-               if (__is_preferred_payment_handler((const char *)key) == false
-                       && __is_preferred_other_handler((const char *)key) == false
-                       && (__is_payment_handler((const char *)key) || __is_other_handler((const char *)key))) {
-                       if (cb((const char *)key, data, user_data) == false) {
+       while (g_hash_table_iter_next(&iter, &key, (gpointer) & data)) {
+               if (__is_preferred_payment_handler((const char *)key) == false && __is_preferred_other_handler((const char *)key) == false && (__is_payment_handler((const char *)key) || __is_other_handler((const char *)key))) {
+                       if (cb((const char *)key, data, user_data) == false)
                                break;
-                       }
                }
        }
 
-       if (preferred_handler != NULL) {
+       if (preferred_handler != NULL)
                cb((const char *)preferred_handler->package, preferred_handler, user_data);
-       }
 }
+
 #ifdef PRINT_TABLE
 static const char *__get_se_name(net_nfc_se_type_e se_type)
 {
        switch (se_type) {
-       case NET_NFC_SE_TYPE_ESE :
+       case NET_NFC_SE_TYPE_ESE:
                return "eSE";
-       case NET_NFC_SE_TYPE_UICC :
+       case NET_NFC_SE_TYPE_UICC:
                return "UICC";
-       case NET_NFC_SE_TYPE_SDCARD :
+       case NET_NFC_SE_TYPE_SDCARD:
                return "SD";
-       case NET_NFC_SE_TYPE_HCE :
+       case NET_NFC_SE_TYPE_HCE:
                return "HCE";
-       default :
+       default:
                return "Unknown";
        }
 }
 
-static bool _display_route_table_cb(const char *package,
-       route_table_handler_t *handler, void *user_data)
+static bool _display_route_table_cb(const char *package, route_table_handler_t * handler, void *user_data)
 {
        int i;
-       if (preferred_handler == handler) {
+       if (preferred_handler == handler)
                DEBUG_SERVER_MSG(" + Preferred PACKAGE [%s|%s]", handler->package, handler->id);
-       } else {
+       else
                DEBUG_SERVER_MSG(" + PACKAGE [%s|%s]", handler->package, handler->id);
-       }
 
        for (i = 0; i < handler->aids[0]->len; i++) {
-               aid_info_t *info = (aid_info_t *)handler->aids[0]->pdata[i];
-
-               DEBUG_SERVER_MSG(" +-- AID [%s], SE [%s], CATEGORY [%s%s], MANIFEST [%s]%s",
-                       info->aid,
-                       __get_se_name(info->se_type),
-                       info->category == NET_NFC_CARD_EMULATION_CATEGORY_PAYMENT ? "payment" : "other",
-                       handler->activated[info->category] ? " (A)" : "",
-                       info->manifest ? "manifest" : "dynamic",
-                       info->is_routed ? ", (ROUTED)" : "");
+               aid_info_t *info = (aid_info_t *) handler->aids[0]->pdata[i];
+
+               DEBUG_SERVER_MSG(" +-- AID [%s], SE [%s], CATEGORY [%s%s], MANIFEST [%s]%s", info->aid, __get_se_name(info->se_type), info->category == NET_NFC_CARD_EMULATION_CATEGORY_PAYMENT ? "payment" : "other", handler->activated[info->category] ? " (A)" : "", info->manifest ? "manifest" : "dynamic", info->is_routed ? ", (ROUTED)" : "");
        }
 
        return true;
@@ -1245,38 +1135,34 @@ static void __display_route_table()
        DEBUG_SERVER_MSG(" +------------------------------------------------+");
 }
 #endif
-static bool __activation_iter_cb(const char *package,
-       route_table_handler_t *handler, void *user_data)
+static bool __activation_iter_cb(const char *package, route_table_handler_t * handler, void *user_data)
 {
        int i;
        bool ret = true;
        aid_info_t *info;
-       gpointer *params = (gpointer *)user_data;
+       gpointer *params = (gpointer *) user_data;
        net_nfc_se_type_e se_type;
        net_nfc_card_emulation_category_t category;
 
-       category = (net_nfc_card_emulation_category_t)params[1];
-       se_type = (net_nfc_se_type_e)params[2];
+       category = (net_nfc_card_emulation_category_t) params[1];
+       se_type = (net_nfc_se_type_e) params[2];
 
-       if (params[0] != NULL &&
-               g_ascii_strcasecmp(package, (const char *)params[0]) == 0) {
+       if (params[0] != NULL && g_ascii_strcasecmp(package, (const char *)params[0]) == 0) {
                handler->activated[category] = true;
 
                (*(int *)params[3])++;
 
                for (i = 0; i < handler->aids[category]->len; i++) {
-                       info = (aid_info_t *)handler->aids[category]->pdata[i];
+                       info = (aid_info_t *) handler->aids[category]->pdata[i];
 
                        if (info->se_type == se_type) {
-                               if (info->is_routed == true) {
+                               if (info->is_routed == true)
                                        __do_unrouting_aid(info, false);
-                               }
                                continue;
                        }
 
-                       if (info->is_routed == false) {
+                       if (info->is_routed == false)
                                __do_routing_aid(info, false);
-                       }
 
                        /* FIXME : need commit?? check and return */
                }
@@ -1284,22 +1170,19 @@ static bool __activation_iter_cb(const char *package,
                /* in others category, it is changed just exact handler state */
                /* FIXME : when 'others setting' is applied, conflict case should be handled */
                /* stop iterating */
-               if (category == NET_NFC_CARD_EMULATION_CATEGORY_OTHER) {
+               if (category == NET_NFC_CARD_EMULATION_CATEGORY_OTHER)
                        ret = false;
-               }
        } else {
-               if (category == NET_NFC_CARD_EMULATION_CATEGORY_PAYMENT &&
-                       handler->activated[category] == true) {
+               if (category == NET_NFC_CARD_EMULATION_CATEGORY_PAYMENT && handler->activated[category] == true) {
                        /* deactivate another handlers in payment category */
 
                        handler->activated[category] = false;
 
                        for (i = 0; i < handler->aids[category]->len; i++) {
-                               info = (aid_info_t *)handler->aids[category]->pdata[i];
+                               info = (aid_info_t *) handler->aids[category]->pdata[i];
 
-                               if (info->is_routed == true) {
+                               if (info->is_routed == true)
                                        __do_unrouting_aid(info, false);
-                               }
 
                                /* FIXME : need commit?? check and return */
                        }
@@ -1309,20 +1192,18 @@ static bool __activation_iter_cb(const char *package,
        return ret;
 }
 
-net_nfc_error_e net_nfc_server_route_table_set_handler_activation(
-       const char *package, net_nfc_card_emulation_category_t category)
+net_nfc_error_e net_nfc_server_route_table_set_handler_activation(const char *package, net_nfc_card_emulation_category_t category)
 {
        net_nfc_error_e result;
        gpointer params[4];
        int ret = 0;
 
-       params[0] = (gpointer)package;
-       params[1] = (gpointer)category;
-       params[2] = (gpointer)net_nfc_server_se_get_se_type();
-       params[3] = (gpointer)&ret;
+       params[0] = (gpointer) package;
+       params[1] = (gpointer) category;
+       params[2] = (gpointer) net_nfc_server_se_get_se_type();
+       params[3] = (gpointer) & ret;
 
-       net_nfc_server_route_table_iterate_handler(__activation_iter_cb,
-               (void *)params);
+       net_nfc_server_route_table_iterate_handler(__activation_iter_cb, (void *)params);
 
 #ifdef PRINT_TABLE
        __display_route_table();
@@ -1347,9 +1228,7 @@ net_nfc_error_e net_nfc_server_route_table_set_handler_activation(
        return result;
 }
 
-
-route_table_handler_t *net_nfc_server_route_table_find_handler_by_id(
-       const char *id)
+route_table_handler_t *net_nfc_server_route_table_find_handler_by_id(const char *id)
 {
        route_table_handler_t *result;
        char package[1024];
@@ -1369,12 +1248,10 @@ net_nfc_error_e net_nfc_server_route_table_add_handler_by_id(const char *id)
        net_nfc_error_e result;
        char package[1024];
 
-       if (__get_package_name(id, package, sizeof(package)) == true) {
-               result = net_nfc_server_route_table_add_handler(id,
-                       package);
-       } else {
+       if (__get_package_name(id, package, sizeof(package)) == true)
+               result = net_nfc_server_route_table_add_handler(id, package);
+       else
                result = NET_NFC_INVALID_PARAM;
-       }
 
        return result;
 }
@@ -1384,36 +1261,28 @@ net_nfc_error_e net_nfc_server_route_table_del_handler_by_id(const char *id)
        net_nfc_error_e result;
        char package[1024];
 
-       if (__get_package_name(id, package, sizeof(package)) == true) {
+       if (__get_package_name(id, package, sizeof(package)) == true)
                result = net_nfc_server_route_table_del_handler(id, package, false);
-       } else {
+       else
                result = NET_NFC_INVALID_PARAM;
-       }
 
        return result;
 }
 
-
-net_nfc_error_e net_nfc_server_route_table_set_handler_activation_by_id(
-       const char *id, net_nfc_card_emulation_category_t category)
+net_nfc_error_e net_nfc_server_route_table_set_handler_activation_by_id(const char *id, net_nfc_card_emulation_category_t category)
 {
        net_nfc_error_e result;
        char package[1024];
 
-       if (__get_package_name(id, package, sizeof(package)) == true) {
-               result = net_nfc_server_route_table_set_handler_activation(
-                       package, category);
-       } else {
+       if (__get_package_name(id, package, sizeof(package)) == true)
+               result = net_nfc_server_route_table_set_handler_activation(package, category);
+       else
                result = NET_NFC_INVALID_PARAM;
-       }
 
        return result;
 }
 
-
-
-aid_info_t *net_nfc_server_route_table_find_aid(const char *package,
-       const char *aid)
+aid_info_t *net_nfc_server_route_table_find_aid(const char *package, const char *aid)
 {
        route_table_handler_t *handler;
 
@@ -1425,24 +1294,21 @@ aid_info_t *net_nfc_server_route_table_find_aid(const char *package,
                for (i = 0; i < handler->aids[0]->len; i++) {
                        info = handler->aids[0]->pdata[i];
 
-                       if (g_ascii_strcasecmp(aid, info->aid) == 0) {
+                       if (g_ascii_strcasecmp(aid, info->aid) == 0)
                                return info;
-                       }
                }
        }
 
        return NULL;
 }
 
-static bool __find_handler_iter_cb(const char *package,
-       route_table_handler_t *handler, void *user_data)
+static bool __find_handler_iter_cb(const char *package, route_table_handler_t * handler, void *user_data)
 {
        bool result = true;
-       gpointer *params = (gpointer *)user_data;
+       gpointer *params = (gpointer *) user_data;
        aid_info_t *aid;
 
-       aid = net_nfc_server_route_table_find_aid(package,
-               (const char *)params[0]);
+       aid = net_nfc_server_route_table_find_aid(package, (const char *)params[0]);
        if (aid != NULL) {
                if (handler->activated[aid->category] == true) {
                        params[1] = handler;
@@ -1455,8 +1321,7 @@ static bool __find_handler_iter_cb(const char *package,
        return result;
 }
 
-route_table_handler_t *net_nfc_server_route_table_find_handler_by_aid(
-       const char *aid)
+route_table_handler_t *net_nfc_server_route_table_find_handler_by_aid(const char *aid)
 {
        gpointer params[2];
 
@@ -1467,23 +1332,20 @@ route_table_handler_t *net_nfc_server_route_table_find_handler_by_aid(
 
        g_free(params[0]);
 
-       return (route_table_handler_t *)params[1];
+       return (route_table_handler_t *) params[1];
 }
 
-static bool __check_conflict_aid_cb(
-       const char *package, route_table_handler_t *handler,
-       aid_info_t *aid, void *user_data)
+static bool __check_conflict_aid_cb(const char *package, route_table_handler_t * handler, aid_info_t * aid, void *user_data)
 {
        bool result;
-       gpointer *params = (gpointer *)user_data;
+       gpointer *params = (gpointer *) user_data;
 
        if (g_strcmp0(package, (const char *)params[0]) == 0) {
                /* skip same package */
                return true;
        }
 
-       if (handler->activated[aid->category] == true &&
-               g_strcmp0(aid->aid, (const char *)params[1]) == 0) {
+       if (handler->activated[aid->category] == true && g_strcmp0(aid->aid, (const char *)params[1]) == 0) {
                net_nfc_error_e *res = params[3];
 
                SECURE_MSG("conflict!!! [%s|%s] vs [%s|%s]", handler->package, aid->aid, (const char *)params[0], (const char *)params[1]);
@@ -1497,10 +1359,7 @@ static bool __check_conflict_aid_cb(
        return result;
 }
 
-static net_nfc_error_e __route_table_add_aid(const char *id,
-       const char *package, net_nfc_se_type_e se_type,
-       net_nfc_card_emulation_category_t category,
-       const char *aid, bool unlock, int power, bool manifest, bool routing)
+static net_nfc_error_e __route_table_add_aid(const char *id, const char *package, net_nfc_se_type_e se_type, net_nfc_card_emulation_category_t category, const char *aid, bool unlock, int power, bool manifest, bool routing)
 {
        net_nfc_error_e result = NET_NFC_OK;
        route_table_handler_t *data;
@@ -1509,9 +1368,9 @@ static net_nfc_error_e __route_table_add_aid(const char *id,
        if (category == NET_NFC_CARD_EMULATION_CATEGORY_OTHER) {
                gpointer params[4];
 
-               params[0] = (gpointer)package;
-               params[1] = (gpointer)aid;
-               params[2] = (gpointer)category;
+               params[0] = (gpointer) package;
+               params[1] = (gpointer) aid;
+               params[2] = (gpointer) category;
                params[3] = &result;
 
                net_nfc_server_route_table_iterate_aids(__check_conflict_aid_cb, params);
@@ -1530,7 +1389,7 @@ static net_nfc_error_e __route_table_add_aid(const char *id,
                        info->se_type = se_type;
                        info->category = category;
                        info->unlock = unlock;
-                       info->power = 0x39;/*Temp code for Screen off Transaction*/
+                       info->power = 0x39;     /*Temp code for Screen off Transaction */
                        info->manifest = manifest;
 
                        g_ptr_array_add(data->aids[0], info);
@@ -1575,28 +1434,24 @@ static net_nfc_error_e __route_table_add_aid(const char *id,
        return result;
 }
 
-static net_nfc_error_e __route_table_del_aid(const char *id,
-       const char *package, const char *aid, bool force)
+static net_nfc_error_e __route_table_del_aid(const char *id, const char *package, const char *aid, bool force)
 {
        net_nfc_error_e result = NET_NFC_NO_DATA_FOUND;
        route_table_handler_t *data;
 
        data = net_nfc_server_route_table_find_handler(package);
-       if (data != NULL &&
-               (id == NULL || data->id == NULL ||
-                       g_ascii_strcasecmp(id, data->id) == 0)) {
+       if (data != NULL && (id == NULL || data->id == NULL || g_ascii_strcasecmp(id, data->id) == 0)) {
                int i;
 
                for (i = 0; i < data->aids[0]->len; i++) {
-                       aid_info_t *info = (aid_info_t *)data->aids[0]->pdata[i];
+                       aid_info_t *info = (aid_info_t *) data->aids[0]->pdata[i];
 
                        if (g_ascii_strcasecmp(info->aid, aid) == 0) {
                                if (force == true || info->manifest == false) {
                                        SECURE_MSG("remove aid, package [%s], aid [%s]", package, aid);
 
-                                       if (info->is_routed == true) {
+                                       if (info->is_routed == true)
                                                __do_unrouting_aid(info, true);
-                                       }
 
                                        g_ptr_array_remove(data->aids[info->category], info);
                                        g_ptr_array_remove_index(data->aids[0], i);
@@ -1614,37 +1469,31 @@ static net_nfc_error_e __route_table_del_aid(const char *id,
 
                if (data->aids[0]->len == 0) {
                        result = net_nfc_server_route_table_del_handler(id, package, force);
-                       if (result == NET_NFC_OK) {
+                       if (result == NET_NFC_OK)
                                INFO_MSG("route table package removed");
-                       } else {
+                       else
                                DEBUG_ERR_MSG("net_nfc_server_route_table_del_handler failed, [%d]", result);
-                       }
                }
        }
 
        return result;
 }
 
-net_nfc_error_e net_nfc_server_route_table_add_aid(const char *id,
-       const char *package, net_nfc_se_type_e se_type,
-       net_nfc_card_emulation_category_t category,
-       const char *aid)
+net_nfc_error_e net_nfc_server_route_table_add_aid(const char *id, const char *package, net_nfc_se_type_e se_type, net_nfc_card_emulation_category_t category, const char *aid)
 {
        net_nfc_error_e result;
 
        result = net_nfc_server_route_table_add_handler(id, package);
        if (result == NET_NFC_OK) {
-               result = __route_table_add_aid(id,
-                       package, se_type, category, aid, true, 1, false, true);
+               result = __route_table_add_aid(id, package, se_type, category, aid, true, 1, false, true);
                if (result == NET_NFC_OK) {
                        result = __insert_into_db(package, se_type, category, aid, true, 1, false);
                        if (result != NET_NFC_OK) {
                                DEBUG_ERR_MSG("__insert_into_db failed, [%d]", result);
 
                                result = __route_table_del_aid(id, package, aid, false);
-                               if (result != NET_NFC_OK) {
+                               if (result != NET_NFC_OK)
                                        DEBUG_ERR_MSG("__route_table_del_aid failed, [%d]", result);
-                               }
                        }
                } else if (result == NET_NFC_INSUFFICIENT_STORAGE) {
                        DEBUG_ERR_MSG("no space. cannot add aid, [%d]", result);
@@ -1663,56 +1512,47 @@ net_nfc_error_e net_nfc_server_route_table_add_aid(const char *id,
        return result;
 }
 
-net_nfc_error_e net_nfc_server_route_table_del_aid(const char *id,
-       const char *package, const char *aid, bool force)
+net_nfc_error_e net_nfc_server_route_table_del_aid(const char *id, const char *package, const char *aid, bool force)
 {
        net_nfc_error_e result = NET_NFC_OK;
 
        result = __route_table_del_aid(id, package, aid, force);
-       if (result == NET_NFC_OK) {
-       } else {
+       if (result == NET_NFC_OK)
+               DEBUG_ERR_MSG("__route_table_del_aid success");
+       else
                DEBUG_ERR_MSG("__route_table_del_aid failed, [%d]", result);
-       }
 
        result = __delete_from_db(package, aid);
-       if (result != NET_NFC_OK) {
+       if (result != NET_NFC_OK)
                DEBUG_ERR_MSG("__delete_from_db failed, [%d]", result);
-       }
-
 #ifdef PRINT_TABLE
        __display_route_table();
 #endif
        return result;
 }
 
-net_nfc_error_e net_nfc_server_route_table_del_aids(const char *id,
-       const char *package, bool force)
+net_nfc_error_e net_nfc_server_route_table_del_aids(const char *id, const char *package, bool force)
 {
        net_nfc_error_e result = NET_NFC_NO_DATA_FOUND;
        route_table_handler_t *data;
        bool need_commit = false;
 
        data = net_nfc_server_route_table_find_handler(package);
-       if (data != NULL &&
-               (id == NULL || data->id == NULL ||
-                       g_ascii_strcasecmp(id, data->id) == 0)) {
+       if (data != NULL && (id == NULL || data->id == NULL || g_ascii_strcasecmp(id, data->id) == 0)) {
                int i;
 
                for (i = (int)data->aids[0]->len - 1; i >= 0; i--) {
-                       aid_info_t *info = (aid_info_t *)data->aids[0]->pdata[i];
+                       aid_info_t *info = (aid_info_t *) data->aids[0]->pdata[i];
 
                        if (force == true || info->manifest == false) {
                                SECURE_MSG("remove aid, package [%s], aid [%s]", package, info->aid);
 
-                               if (info->is_routed == true &&
-                                       __do_unrouting_aid(info, false) == NET_NFC_OK) {
+                               if (info->is_routed == true && __do_unrouting_aid(info, false) == NET_NFC_OK)
                                        need_commit = true;
-                               }
 
                                result = __delete_from_db(package, info->aid);
-                               if (result != NET_NFC_OK) {
+                               if (result != NET_NFC_OK)
                                        DEBUG_ERR_MSG("__delete_from_db failed, [%d]", result);
-                               }
 
                                g_ptr_array_remove(data->aids[info->category], info);
                                g_ptr_array_remove_index(data->aids[0], i);
@@ -1723,28 +1563,24 @@ net_nfc_error_e net_nfc_server_route_table_del_aids(const char *id,
 
                if (data->aids[0]->len == 0) {
                        result = net_nfc_server_route_table_del_handler(id, package, force);
-                       if (result == NET_NFC_OK) {
+                       if (result == NET_NFC_OK)
                                INFO_MSG("route table package removed");
-                       } else {
+                       else
                                DEBUG_ERR_MSG("net_nfc_server_route_table_del_handler failed, [%d]", result);
-                       }
                }
        } else {
                SECURE_MSG("not found, package [%s]", package);
        }
 
-       if (need_commit == true) {
+       if (need_commit == true)
                net_nfc_controller_secure_element_commit_routing(&result);
-       }
-
 #ifdef PRINT_TABLE
        __display_route_table();
 #endif
        return result;
 }
 
-void net_nfc_server_route_table_iterate_aids(
-       net_nfc_server_route_table_aid_iter_cb cb, void *user_data)
+void net_nfc_server_route_table_iterate_aids(net_nfc_server_route_table_aid_iter_cb cb, void *user_data)
 {
        GHashTableIter iter;
        gpointer key;
@@ -1757,19 +1593,17 @@ void net_nfc_server_route_table_iterate_aids(
 
        g_hash_table_iter_init(&iter, routing_handlers);
 
-       while (g_hash_table_iter_next(&iter, &key, (gpointer)&data)) {
+       while (g_hash_table_iter_next(&iter, &key, (gpointer) & data)) {
                for (i = 0; i < data->aids[0]->len; i++) {
-                       info = (aid_info_t *)data->aids[0]->pdata[i];
+                       info = (aid_info_t *) data->aids[0]->pdata[i];
 
-                       if (cb((const char *)key, data, info, user_data) == false) {
+                       if (cb((const char *)key, data, info, user_data) == false)
                                break;
-                       }
                }
        }
 }
 
-void net_nfc_server_route_table_iterate_handler_aids(const char *package,
-       net_nfc_server_route_table_aid_iter_cb cb, void *user_data)
+void net_nfc_server_route_table_iterate_handler_aids(const char *package, net_nfc_server_route_table_aid_iter_cb cb, void *user_data)
 {
        route_table_handler_t *data;
        int i;
@@ -1778,93 +1612,72 @@ void net_nfc_server_route_table_iterate_handler_aids(const char *package,
        if (routing_handlers == NULL)
                return;
 
-       data = (route_table_handler_t *)g_hash_table_lookup(routing_handlers,
-               package);
+       data = (route_table_handler_t *) g_hash_table_lookup(routing_handlers, package);
        if (data != NULL) {
                for (i = 0; i < data->aids[0]->len; i++) {
-                       info = (aid_info_t *)data->aids[0]->pdata[i];
+                       info = (aid_info_t *) data->aids[0]->pdata[i];
 
-                       if (cb(package, data, info, user_data) == false) {
+                       if (cb(package, data, info, user_data) == false)
                                break;
-                       }
                }
        }
 }
 
-aid_info_t *net_nfc_server_route_table_find_aid_by_id(const char *id,
-       const char *aid)
+aid_info_t *net_nfc_server_route_table_find_aid_by_id(const char *id, const char *aid)
 {
        aid_info_t *result;
        char package[1024];
 
-       if (__get_package_name(id, package, sizeof(package)) == true) {
+       if (__get_package_name(id, package, sizeof(package)) == true)
                result = net_nfc_server_route_table_find_aid(package, aid);
-       } else {
+       else
                result = NULL;
-       }
 
        return result;
 
 }
 
-net_nfc_error_e net_nfc_server_route_table_add_aid_by_id(const char *id,
-       net_nfc_se_type_e se_type,
-       net_nfc_card_emulation_category_t category,
-       const char *aid)
+net_nfc_error_e net_nfc_server_route_table_add_aid_by_id(const char *id, net_nfc_se_type_e se_type, net_nfc_card_emulation_category_t category, const char *aid)
 {
        net_nfc_error_e result;
        char package[1024];
 
-       if (__get_package_name(id, package, sizeof(package)) == true) {
-               result = net_nfc_server_route_table_add_aid(id,
-                       package, se_type, category, aid);
-       } else {
+       if (__get_package_name(id, package, sizeof(package)) == true)
+               result = net_nfc_server_route_table_add_aid(id, package, se_type, category, aid);
+       else
                result = NET_NFC_INVALID_PARAM;
-       }
 
        return result;
 }
 
-net_nfc_error_e net_nfc_server_route_table_del_aid_by_id(const char *id,
-       const char *aid, bool force)
+net_nfc_error_e net_nfc_server_route_table_del_aid_by_id(const char *id, const char *aid, bool force)
 {
        net_nfc_error_e result = NET_NFC_NO_DATA_FOUND;
        char package[1024];
 
-       if (__get_package_name(id, package, sizeof(package)) == true) {
-               result = net_nfc_server_route_table_del_aid(id,
-                       package, aid, force);
-       }
+       if (__get_package_name(id, package, sizeof(package)) == true)
+               result = net_nfc_server_route_table_del_aid(id, package, aid, force);
 
        return result;
 }
 
-
-void net_nfc_server_route_table_iterate_aids_by_id(const char *id,
-       net_nfc_server_route_table_aid_iter_cb cb, void *user_data)
+void net_nfc_server_route_table_iterate_aids_by_id(const char *id, net_nfc_server_route_table_aid_iter_cb cb, void *user_data)
 {
        char package[1024];
 
-       if (__get_package_name(id, package, sizeof(package)) == true) {
+       if (__get_package_name(id, package, sizeof(package)) == true)
                net_nfc_server_route_table_iterate_handler_aids(package, cb, user_data);
-       }
 }
 
-net_nfc_error_e net_nfc_server_route_table_insert_aid_into_db(
-       const char *package, net_nfc_se_type_e se_type,
-       net_nfc_card_emulation_category_t category,
-       const char *aid, bool unlock, int power)
+net_nfc_error_e net_nfc_server_route_table_insert_aid_into_db(const char *package, net_nfc_se_type_e se_type, net_nfc_card_emulation_category_t category, const char *aid, bool unlock, int power)
 {
        net_nfc_error_e result;
 
-       result = __insert_into_db(package, se_type, category,
-               aid, unlock, power, true);
+       result = __insert_into_db(package, se_type, category, aid, unlock, power, true);
        if (result == NET_NFC_OK) {
                result = net_nfc_server_route_table_add_handler(NULL, package);
                if (result == NET_NFC_OK) {
-                       result = __route_table_add_aid(NULL,
-                               package, se_type, category, aid,
-                               unlock, power, true, net_nfc_server_manager_get_active());
+                       result = __route_table_add_aid(NULL, package, se_type, category, aid, unlock, power, true, net_nfc_server_manager_get_active());
                        if (result == NET_NFC_OK) {
                                if (category == NET_NFC_CARD_EMULATION_CATEGORY_PAYMENT) {
                                        char *handler;
@@ -1876,34 +1689,26 @@ net_nfc_error_e net_nfc_server_route_table_insert_aid_into_db(
                                                __activate_handler(package, category);
                                        }
 
-                                       if (handler != NULL) {
+                                       if (handler != NULL)
                                                free(handler);
-                                       }
                                } else {
-                                       if (__is_activated_handler(category, package) == false) {
+                                       if (__is_activated_handler(category, package) == false)
                                                __activate_handler(package, category);
-                                       }
                                }
                        } else if (result == NET_NFC_INSUFFICIENT_STORAGE) {
                                net_nfc_card_emulation_category_t temp;
 
                                DEBUG_ERR_MSG("no space. deactive handler, [%d]", result);
 
-                               for (temp = NET_NFC_CARD_EMULATION_CATEGORY_PAYMENT;
-                                       temp < NET_NFC_CARD_EMULATION_CATEGORY_MAX;
-                                       temp++) {
+                               for (temp = NET_NFC_CARD_EMULATION_CATEGORY_PAYMENT; temp < NET_NFC_CARD_EMULATION_CATEGORY_MAX; temp++)
                                        __deactivate_handler(package, temp);
-                               }
                        } else if (result == NET_NFC_DATA_CONFLICTED) {
                                net_nfc_card_emulation_category_t temp;
 
                                DEBUG_ERR_MSG("conflict occured. deactive handler, [%d]", result);
 
-                               for (temp = NET_NFC_CARD_EMULATION_CATEGORY_PAYMENT;
-                                       temp < NET_NFC_CARD_EMULATION_CATEGORY_MAX;
-                                       temp++) {
+                               for (temp = NET_NFC_CARD_EMULATION_CATEGORY_PAYMENT; temp < NET_NFC_CARD_EMULATION_CATEGORY_MAX; temp++)
                                        __deactivate_handler(package, temp);
-                               }
                        } else {
                                DEBUG_ERR_MSG("net_nfc_server_route_table_add_aid failed, [%d]", result);
                        }
@@ -1920,8 +1725,7 @@ net_nfc_error_e net_nfc_server_route_table_insert_aid_into_db(
        return result;
 }
 
-net_nfc_error_e net_nfc_server_route_table_delete_aid_from_db(
-       const char *package, const char *aid)
+net_nfc_error_e net_nfc_server_route_table_delete_aid_from_db(const char *package, const char *aid)
 {
        net_nfc_error_e result;
 
@@ -1930,8 +1734,7 @@ net_nfc_error_e net_nfc_server_route_table_delete_aid_from_db(
        return result;
 }
 
-net_nfc_error_e net_nfc_server_route_table_delete_aids_from_db(
-       const char *package)
+net_nfc_error_e net_nfc_server_route_table_delete_aids_from_db(const char *package)
 {
        net_nfc_error_e result;
 
@@ -1940,10 +1743,9 @@ net_nfc_error_e net_nfc_server_route_table_delete_aids_from_db(
        return result;
 }
 
-static bool __update_table_iter_cb(const char *package,
-       route_table_handler_t *handler, void *user_data)
+static bool __update_table_iter_cb(const char *package, route_table_handler_t * handler, void *user_data)
 {
-       gpointer *params = (gpointer *)user_data;
+       gpointer *params = (gpointer *) user_data;
        int i;
        aid_info_t *info;
        net_nfc_se_type_e se_type;
@@ -1951,35 +1753,30 @@ static bool __update_table_iter_cb(const char *package,
        int *ret;
        bool routing;
 
-       se_type = (net_nfc_se_type_e)params[0];
+       se_type = (net_nfc_se_type_e) params[0];
        ret = (int *)params[1];
-       routing = (bool)params[2];
+       routing = (bool) params[2];
 
-       for (category = NET_NFC_CARD_EMULATION_CATEGORY_PAYMENT;
-               category < NET_NFC_CARD_EMULATION_CATEGORY_MAX;
-               category++) {
-               if (__is_preferred_handler(category, package) == true ||
-                       (preferred_handler == NULL && __is_activated_handler(category, package) == true)) {
+       for (category = NET_NFC_CARD_EMULATION_CATEGORY_PAYMENT; category < NET_NFC_CARD_EMULATION_CATEGORY_MAX; category++) {
+               if (__is_preferred_handler(category, package) == true || (preferred_handler == NULL && __is_activated_handler(category, package) == true)) {
                        /* update used aid count */
                        used_aids_count[category] += handler->aids[category]->len;
                        used_aids_count[NET_NFC_CARD_EMULATION_CATEGORY_MAX] += handler->aids[category]->len;
 
                        if (routing == true) {
                                for (i = 0; i < handler->aids[category]->len; i++) {
-                                       info = (aid_info_t *)handler->aids[category]->pdata[i];
+                                       info = (aid_info_t *) handler->aids[category]->pdata[i];
 
                                        if (info->se_type == se_type) {
                                                /* unroute aid when se type is same with default */
-                                               if (info->is_routed == true) {
+                                               if (info->is_routed == true)
                                                        __do_unrouting_aid(info, false);
-                                               }
 
                                                continue;
                                        }
 
-                                       if (info->is_routed == false) {
+                                       if (info->is_routed == false)
                                                __do_routing_aid(info, false);
-                                       }
                                }
                        }
 
@@ -1987,11 +1784,10 @@ static bool __update_table_iter_cb(const char *package,
                } else {
                        if (routing == true) {
                                for (i = 0; i < handler->aids[category]->len; i++) {
-                                       info = (aid_info_t *)handler->aids[category]->pdata[i];
+                                       info = (aid_info_t *) handler->aids[category]->pdata[i];
 
-                                       if (info->is_routed == true) {
+                                       if (info->is_routed == true)
                                                __do_unrouting_aid(info, false);
-                                       }
                                }
                        }
 
@@ -2012,24 +1808,20 @@ net_nfc_error_e net_nfc_server_route_table_do_update(bool routing)
        int ret = 0;
        net_nfc_card_emulation_category_t category;
 
-//     if (net_nfc_controller_secure_element_clear_aid_table(&result) == false) {
-//             DEBUG_ERR_MSG("net_nfc_controller_secure_element_clear_aid_table failed, [%d]", result);
-//     }
+//  if (net_nfc_controller_secure_element_clear_aid_table(&result) == false) {
+//      DEBUG_ERR_MSG("net_nfc_controller_secure_element_clear_aid_table failed, [%d]", result);
+//  }
 
        se_type = net_nfc_server_se_get_se_type();
 
-       params[0] = (gpointer)se_type;
-       params[1] = (gpointer)&ret;
-       params[2] = (gpointer)routing;
+       params[0] = (gpointer) se_type;
+       params[1] = (gpointer) & ret;
+       params[2] = (gpointer) routing;
 
-       for (category = NET_NFC_CARD_EMULATION_CATEGORY_PAYMENT;
-               category <= NET_NFC_CARD_EMULATION_CATEGORY_MAX;
-               category++) {
+       for (category = NET_NFC_CARD_EMULATION_CATEGORY_PAYMENT; category <= NET_NFC_CARD_EMULATION_CATEGORY_MAX; category++)
                used_aids_count[category] = 0;
-       }
 
-       net_nfc_server_route_table_iterate_handler_activated_last(__update_table_iter_cb,
-               (void *)params);
+       net_nfc_server_route_table_iterate_handler_activated_last(__update_table_iter_cb, (void *)params);
 
        if (ret == 0) {
                INFO_MSG("routing table update complete, [%d/%d]", used_aids_count[NET_NFC_CARD_EMULATION_CATEGORY_MAX], maximum_aids_count);
@@ -2045,10 +1837,8 @@ net_nfc_error_e net_nfc_server_route_table_do_update(bool routing)
                result = NET_NFC_OPERATION_FAIL;
        }
 
-       if (routing == true) {
+       if (routing == true)
                net_nfc_controller_secure_element_commit_routing(&result);
-       }
-
 #ifdef PRINT_TABLE
        __display_route_table();
 #endif
@@ -2056,12 +1846,10 @@ net_nfc_error_e net_nfc_server_route_table_do_update(bool routing)
        return result;
 }
 
-net_nfc_error_e net_nfc_server_route_table_get_storage_info(
-       net_nfc_card_emulation_category_t category, int *used, int *max)
+net_nfc_error_e net_nfc_server_route_table_get_storage_info(net_nfc_card_emulation_category_t category, int *used, int *max)
 {
-       if (used == NULL || max == NULL) {
+       if (used == NULL || max == NULL)
                return NET_NFC_NULL_PARAMETER;
-       }
 
        *used = used_aids_count[category];
        *max = maximum_aids_count;
index 5b229ac..47d2f44 100755 (executable)
@@ -32,8 +32,7 @@
 #include "net_nfc_app_util_internal.h"
 #include "net_nfc_server_route_table.h"
 
-enum
-{
+enum {
        SE_UICC_UNAVAILABLE = -1,
        SE_UICC_ON_PROGRESS = 0,
        SE_UICC_READY = 1,
@@ -47,12 +46,11 @@ static net_nfc_target_handle_s *gdbus_ese_handle;
 
 static int gdbus_uicc_ready;
 
-static unsigned char char_to_num[] =
-{
+static unsigned char char_to_num[] = {
        -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
        -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
        -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-        0,  1,  2,  3,  4,  5,  6,  7,  8,  9, -1, -1, -1, -1, -1, -1,
+       0, 1, 2, 3, 4, 5, 6, 7, 8, 9, -1, -1, -1, -1, -1, -1,
        -1, 10, 11, 12, 13, 14, 15, -1, -1, -1, -1, -1, -1, -1, -1, -1,
        -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
        -1, 10, 11, 12, 13, 14, 15, -1, -1, -1, -1, -1, -1, -1, -1, -1,
@@ -70,8 +68,7 @@ static unsigned char char_to_num[] =
 /* server_side */
 typedef struct _ServerSeData ServerSeData;
 
-struct _ServerSeData
-{
+struct _ServerSeData {
        data_s aid;
        data_s param;
        guint event;
@@ -79,8 +76,7 @@ struct _ServerSeData
 
 typedef struct _SeSetCardEmul SeSetCardEmul;
 
-struct _SeSetCardEmul
-{
+struct _SeSetCardEmul {
        NetNfcGDbusSecureElement *object;
        GDBusMethodInvocation *invocation;
        gint mode;
@@ -88,8 +84,7 @@ struct _SeSetCardEmul
 
 typedef struct _SeDataSeType SeDataSeType;
 
-struct _SeDataSeType
-{
+struct _SeDataSeType {
        NetNfcGDbusSecureElement *object;
        GDBusMethodInvocation *invocation;
        gint se_type;
@@ -97,8 +92,7 @@ struct _SeDataSeType
 
 typedef struct _SeDataTransactionFgDispatch SeDataTransactionFgDispatch;
 
-struct _SeDataTransactionFgDispatch
-{
+struct _SeDataTransactionFgDispatch {
        NetNfcGDbusSecureElement *object;
        GDBusMethodInvocation *invocation;
        int FgDispatch;
@@ -106,27 +100,24 @@ struct _SeDataTransactionFgDispatch
 
 typedef struct _SeDataHandle SeDataHandle;
 
-struct _SeDataHandle
-{
+struct _SeDataHandle {
        NetNfcGDbusSecureElement *object;
        GDBusMethodInvocation *invocation;
-       net_nfc_target_handle_shandle;
+       net_nfc_target_handle_s *handle;
 };
 
 typedef struct _SeDataApdu SeDataApdu;
 
-struct _SeDataApdu
-{
+struct _SeDataApdu {
        NetNfcGDbusSecureElement *object;
        GDBusMethodInvocation *invocation;
-       net_nfc_target_handle_shandle;
+       net_nfc_target_handle_s *handle;
        GVariant *data;
 };
 
 typedef struct _SeSetPreferred SeSetPreferred;
 
-struct _SeSetPreferred
-{
+struct _SeSetPreferred {
        NetNfcGDbusSecureElement *object;
        GDBusMethodInvocation *invocation;
        gboolean state;
@@ -134,29 +125,26 @@ struct _SeSetPreferred
 
 typedef struct _ChangeCardEmulMode ChangeCardEmulMode;
 
-struct _ChangeCardEmulMode
-{
+struct _ChangeCardEmulMode {
        NetNfcGDbusSecureElement *object;
        GDBusMethodInvocation *invocation;
        gint mode;
 };
 
-typedef struct _SeDefaultRoute
-{
+typedef struct _SeDefaultRoute {
        NetNfcGDbusSecureElement *object;
        GDBusMethodInvocation *invocation;
-       net_nfc_target_handle_shandle;
+       net_nfc_target_handle_s *handle;
        guint switch_on;
        guint switch_off;
        guint battery_off;
-}
-SeDefaultRoute;
+} SeDefaultRoute;
 TelSimApdu_t apdu_data = { 0, };
+
 TelSimApduResp_t *resp_apdu = NULL;
-TelSimAtrResp_t *resp_atr  = NULL;
+TelSimAtrResp_t *resp_atr = NULL;
 
-typedef struct _SeDataAid
-{
+typedef struct _SeDataAid {
        NetNfcGDbusSecureElement *object;
        GDBusMethodInvocation *invocation;
        net_nfc_target_handle_s *handle;
@@ -166,9 +154,7 @@ typedef struct _SeDataAid
        guint category;
        gboolean unlock;
        guint power;
-}
-SeDataAid;
-
+} SeDataAid;
 
 static void se_close_secure_element_thread_func(gpointer user_data);
 
@@ -180,74 +166,45 @@ static void se_send_apdu_thread_func(gpointer user_data);
 
 static void se_set_data_thread_func(gpointer user_data);
 
-static gboolean se_handle_close_secure_element(
-                       NetNfcGDbusSecureElement *object,
-                       GDBusMethodInvocation *invocation,
-                       guint arg_handle,
-                       GVariant *smack_privilege);
-
-static gboolean se_handle_get_atr(
-                       NetNfcGDbusSecureElement *object,
-                       GDBusMethodInvocation *invocation,
-                       guint arg_handle,
-                       GVariant *smack_privilege);
-
+static gboolean se_handle_close_secure_element(NetNfcGDbusSecureElement * object, GDBusMethodInvocation * invocation, guint arg_handle, GVariant * smack_privilege);
 
-static gboolean se_handle_open_secure_element(
-                       NetNfcGDbusSecureElement *object,
-                       GDBusMethodInvocation *invocation,
-                       gint arg_type,
-                       GVariant *smack_privilege);
+static gboolean se_handle_get_atr(NetNfcGDbusSecureElement * object, GDBusMethodInvocation * invocation, guint arg_handle, GVariant * smack_privilege);
 
+static gboolean se_handle_open_secure_element(NetNfcGDbusSecureElement * object, GDBusMethodInvocation * invocation, gint arg_type, GVariant * smack_privilege);
 
-static gboolean se_handle_send_apdu(
-                       NetNfcGDbusSecureElement *object,
-                       GDBusMethodInvocation *invocation,
-                       guint arg_handle,
-                       GVariant* apdudata,
-                       GVariant *smack_privilege);
+static gboolean se_handle_send_apdu(NetNfcGDbusSecureElement * object, GDBusMethodInvocation * invocation, guint arg_handle, GVariant * apdudata, GVariant * smack_privilege);
 
-static gboolean se_handle_set(
-                       NetNfcGDbusSecureElement *object,
-                       GDBusMethodInvocation *invocation,
-                       gint arg_type,
-                       GVariant *smack_privilege);
+static gboolean se_handle_set(NetNfcGDbusSecureElement * object, GDBusMethodInvocation * invocation, gint arg_type, GVariant * smack_privilege);
 
-static net_nfc_card_emulation_mode_t __se_get_se_state(
-       net_nfc_secure_element_policy_e policy);
+static net_nfc_card_emulation_mode_t __se_get_se_state(net_nfc_secure_element_policy_e policy);
 
-static net_nfc_se_type_e __se_get_se_type(
-       net_nfc_secure_element_policy_e policy);
+static net_nfc_se_type_e __se_get_se_type(net_nfc_secure_element_policy_e policy);
 
 static void __stop_lcd_on_timer();
 
-
 static net_nfc_secure_element_policy_e current_policy;
 
-
-static net_nfc_card_emulation_mode_t __se_get_se_state(
-       net_nfc_secure_element_policy_e policy)
+static net_nfc_card_emulation_mode_t __se_get_se_state(net_nfc_secure_element_policy_e policy)
 {
        net_nfc_card_emulation_mode_t state;
 
        switch (policy) {
-       case SECURE_ELEMENT_POLICY_ESE_ON :
+       case SECURE_ELEMENT_POLICY_ESE_ON:
                state = NET_NFC_CARD_EMELATION_ENABLE;
                break;
 
-       case SECURE_ELEMENT_POLICY_UICC_ON :
-               if (gdbus_uicc_ready == SE_UICC_READY) {
+       case SECURE_ELEMENT_POLICY_UICC_ON:
+               if (gdbus_uicc_ready == SE_UICC_READY)
                        state = NET_NFC_CARD_EMELATION_ENABLE;
-               } else {
+               else
                        state = NET_NFC_CARD_EMULATION_DISABLE;
-               }
                break;
 
-       case SECURE_ELEMENT_POLICY_HCE_ON :
+       case SECURE_ELEMENT_POLICY_HCE_ON:
                state = NET_NFC_CARD_EMELATION_ENABLE;
                break;
 
-       default :
+       default:
                state = NET_NFC_CARD_EMULATION_DISABLE;
                break;
        }
@@ -260,9 +217,8 @@ net_nfc_card_emulation_mode_t net_nfc_server_se_get_se_state()
        net_nfc_card_emulation_mode_t state;
        int se_policy = SECURE_ELEMENT_POLICY_INVALID;
 
-       if (vconf_get_int(VCONFKEY_NFC_SE_TYPE, &se_policy) != 0) {
+       if (vconf_get_int(VCONFKEY_NFC_SE_TYPE, &se_policy) != 0)
                DEBUG_ERR_MSG("vconf_get_int failed");
-       }
 
        state = __se_get_se_state(se_policy);
 
@@ -271,8 +227,7 @@ net_nfc_card_emulation_mode_t net_nfc_server_se_get_se_state()
        return state;
 }
 
-net_nfc_error_e net_nfc_server_se_set_se_state(
-       net_nfc_card_emulation_mode_t state)
+net_nfc_error_e net_nfc_server_se_set_se_state(net_nfc_card_emulation_mode_t state)
 {
        net_nfc_error_e result;
        int se_policy = SECURE_ELEMENT_POLICY_INVALID;
@@ -283,8 +238,7 @@ net_nfc_error_e net_nfc_server_se_set_se_state(
                return NET_NFC_OPERATION_FAIL;
        }
 
-       if (__se_get_se_type(se_policy) == NET_NFC_SE_TYPE_UICC &&
-               gdbus_uicc_ready != SE_UICC_READY) {
+       if (__se_get_se_type(se_policy) == NET_NFC_SE_TYPE_UICC && gdbus_uicc_ready != SE_UICC_READY) {
                DEBUG_ERR_MSG("UICC not initialized, changing state not permitted");
 
                return NET_NFC_OPERATION_FAIL;
@@ -298,33 +252,30 @@ net_nfc_error_e net_nfc_server_se_set_se_state(
 
        if (__se_get_se_state(se_policy) != state) {
                switch (__se_get_se_type(se_policy)) {
-               case NET_NFC_SE_TYPE_UICC :
-                       if (state == NET_NFC_CARD_EMELATION_ENABLE) {
+               case NET_NFC_SE_TYPE_UICC:
+                       if (state == NET_NFC_CARD_EMELATION_ENABLE)
                                se_policy = SECURE_ELEMENT_POLICY_UICC_ON;
-                       } else {
+                       else
                                se_policy = SECURE_ELEMENT_POLICY_UICC_OFF;
-                       }
                        break;
 
-               case NET_NFC_SE_TYPE_ESE :
+               case NET_NFC_SE_TYPE_ESE:
                        /* FIXME */
-                       if (state == NET_NFC_CARD_EMELATION_ENABLE) {
+                       if (state == NET_NFC_CARD_EMELATION_ENABLE)
                                se_policy = SECURE_ELEMENT_POLICY_ESE_ON;
-                       } else {
+                       else
                                se_policy = SECURE_ELEMENT_POLICY_ESE_OFF;
-                       }
                        break;
 
-               case NET_NFC_SE_TYPE_HCE :
+               case NET_NFC_SE_TYPE_HCE:
                        /* FIXME */
-                       if (state == NET_NFC_CARD_EMELATION_ENABLE) {
+                       if (state == NET_NFC_CARD_EMELATION_ENABLE)
                                se_policy = SECURE_ELEMENT_POLICY_HCE_ON;
-                       } else {
+                       else
                                se_policy = SECURE_ELEMENT_POLICY_HCE_OFF;
-                       }
                        break;
 
-               default :
+               default:
                        se_policy = SECURE_ELEMENT_POLICY_INVALID;
                        break;
                }
@@ -345,24 +296,24 @@ net_nfc_error_e net_nfc_server_se_set_se_state(
        return result;
 }
 
-inline static const char *__se_get_se_name(net_nfc_se_type_e type)
+static inline const char *__se_get_se_name(net_nfc_se_type_e type)
 {
        const char *name;
 
        switch (type) {
-       case NET_NFC_SE_TYPE_UICC :
+       case NET_NFC_SE_TYPE_UICC:
                name = "UICC";
                break;
 
-       case NET_NFC_SE_TYPE_ESE :
+       case NET_NFC_SE_TYPE_ESE:
                name = "eSE";
                break;
 
-       case NET_NFC_SE_TYPE_HCE :
+       case NET_NFC_SE_TYPE_HCE:
                name = "HCE";
                break;
 
-       default :
+       default:
                name = "unknown";
                break;
        }
@@ -370,25 +321,23 @@ inline static const char *__se_get_se_name(net_nfc_se_type_e type)
        return name;
 }
 
-static net_nfc_se_type_e __se_get_se_type(
-       net_nfc_secure_element_policy_e policy)
+static net_nfc_se_type_e __se_get_se_type(net_nfc_secure_element_policy_e policy)
 {
        net_nfc_se_type_e type;
 
-       switch (policy)
-       {
-       case SECURE_ELEMENT_POLICY_UICC_ON :
-       case SECURE_ELEMENT_POLICY_UICC_OFF :
+       switch (policy) {
+       case SECURE_ELEMENT_POLICY_UICC_ON:
+       case SECURE_ELEMENT_POLICY_UICC_OFF:
                type = NET_NFC_SE_TYPE_UICC;
                break;
 
-       case SECURE_ELEMENT_POLICY_ESE_ON :
-       case SECURE_ELEMENT_POLICY_ESE_OFF :
+       case SECURE_ELEMENT_POLICY_ESE_ON:
+       case SECURE_ELEMENT_POLICY_ESE_OFF:
                type = NET_NFC_SE_TYPE_ESE;
                break;
 
-       case SECURE_ELEMENT_POLICY_HCE_ON :
-       case SECURE_ELEMENT_POLICY_HCE_OFF :
+       case SECURE_ELEMENT_POLICY_HCE_ON:
+       case SECURE_ELEMENT_POLICY_HCE_OFF:
                type = NET_NFC_SE_TYPE_HCE;
                break;
 
@@ -405,17 +354,15 @@ net_nfc_se_type_e net_nfc_server_se_get_se_type()
        net_nfc_se_type_e se_type;
        int wallet_mode = 0;
 
-       if (vconf_get_int(VCONFKEY_NFC_WALLET_MODE, &wallet_mode) != 0) {
+       if (vconf_get_int(VCONFKEY_NFC_WALLET_MODE, &wallet_mode) != 0)
                DEBUG_ERR_MSG("vconf_get_int failed");
-       }
 
-       /*TODO : Modify the wallet mode*/
+       /*TODO : Modify the wallet mode */
        if (wallet_mode != NET_NFC_WALLET_MODE_UICC) {
                int se_policy = SECURE_ELEMENT_POLICY_INVALID;
 
-               if (vconf_get_int(VCONFKEY_NFC_SE_TYPE, &se_policy) != 0) {
+               if (vconf_get_int(VCONFKEY_NFC_SE_TYPE, &se_policy) != 0)
                        DEBUG_ERR_MSG("vconf_get_int failed");
-               }
 
                se_type = __se_get_se_type(se_policy);
        } else {
@@ -445,7 +392,6 @@ net_nfc_error_e net_nfc_server_se_set_se_type(net_nfc_se_type_e type)
                return NET_NFC_OPERATION_FAIL;
        }
 
-
        if (wallet_mode == NET_NFC_WALLET_MODE_UICC) {
                DEBUG_ERR_MSG("not supported in wallet mode");
 
@@ -454,34 +400,28 @@ net_nfc_error_e net_nfc_server_se_set_se_type(net_nfc_se_type_e type)
 
        if (__se_get_se_type(se_policy) != type) {
                switch (type) {
-               case NET_NFC_SE_TYPE_UICC :
-                       if (__se_get_se_state(se_policy) ==
-                               NET_NFC_CARD_EMELATION_ENABLE) {
+               case NET_NFC_SE_TYPE_UICC:
+                       if (__se_get_se_state(se_policy) == NET_NFC_CARD_EMELATION_ENABLE)
                                se_policy = SECURE_ELEMENT_POLICY_UICC_ON;
-                       } else {
+                       else
                                se_policy = SECURE_ELEMENT_POLICY_UICC_OFF;
-                       }
                        break;
 
-               case NET_NFC_SE_TYPE_ESE :
-                       if (__se_get_se_state(se_policy) ==
-                               NET_NFC_CARD_EMELATION_ENABLE) {
+               case NET_NFC_SE_TYPE_ESE:
+                       if (__se_get_se_state(se_policy) == NET_NFC_CARD_EMELATION_ENABLE)
                                se_policy = SECURE_ELEMENT_POLICY_ESE_ON;
-                       } else {
+                       else
                                se_policy = SECURE_ELEMENT_POLICY_ESE_OFF;
-                       }
                        break;
 
-               case NET_NFC_SE_TYPE_HCE :
-                       if (__se_get_se_state(se_policy) ==
-                               NET_NFC_CARD_EMELATION_ENABLE) {
+               case NET_NFC_SE_TYPE_HCE:
+                       if (__se_get_se_state(se_policy) == NET_NFC_CARD_EMELATION_ENABLE)
                                se_policy = SECURE_ELEMENT_POLICY_HCE_ON;
-                       } else {
+                       else
                                se_policy = SECURE_ELEMENT_POLICY_HCE_OFF;
-                       }
                        break;
 
-               default :
+               default:
                        se_policy = SECURE_ELEMENT_POLICY_INVALID;
                        break;
                }
@@ -507,45 +447,34 @@ static net_nfc_secure_element_policy_e __se_get_se_policy()
        int se_policy = SECURE_ELEMENT_POLICY_INVALID;
        int wallet_mode = 0;
 
-       if (vconf_get_int(VCONFKEY_NFC_WALLET_MODE, &wallet_mode) != 0) {
+       if (vconf_get_int(VCONFKEY_NFC_WALLET_MODE, &wallet_mode) != 0)
                DEBUG_ERR_MSG("vconf_get_int failed");
-       }
 
-       if (vconf_get_int(VCONFKEY_NFC_SE_TYPE, &se_policy) != 0) {
+       if (vconf_get_int(VCONFKEY_NFC_SE_TYPE, &se_policy) != 0)
                DEBUG_ERR_MSG("vconf_get_int failed");
-       }
 
        if (wallet_mode == NET_NFC_WALLET_MODE_UICC) {
-               if (__se_get_se_state(se_policy) ==
-                       NET_NFC_CARD_EMELATION_ENABLE) {
+               if (__se_get_se_state(se_policy) == NET_NFC_CARD_EMELATION_ENABLE)
                        se_policy = SECURE_ELEMENT_POLICY_UICC_ON;
-               } else {
+               else
                        se_policy = SECURE_ELEMENT_POLICY_UICC_OFF;
-               }
-       }
-       else if(wallet_mode == NET_NFC_WALLET_MODE_ESE) {
-               if (__se_get_se_state(se_policy) ==
-                       NET_NFC_CARD_EMELATION_ENABLE) {
+       } else if (wallet_mode == NET_NFC_WALLET_MODE_ESE) {
+               if (__se_get_se_state(se_policy) == NET_NFC_CARD_EMELATION_ENABLE)
                        se_policy = SECURE_ELEMENT_POLICY_ESE_ON;
-               } else {
+               else
                        se_policy = SECURE_ELEMENT_POLICY_ESE_OFF;
-               }
-       }
-       else if(wallet_mode == NET_NFC_WALLET_MODE_HCE) {
-               if (__se_get_se_state(se_policy) ==
-                       NET_NFC_CARD_EMELATION_ENABLE) {
+       } else if (wallet_mode == NET_NFC_WALLET_MODE_HCE) {
+               if (__se_get_se_state(se_policy) == NET_NFC_CARD_EMELATION_ENABLE)
                        se_policy = SECURE_ELEMENT_POLICY_HCE_ON;
-               } else {
+               else
                        se_policy = SECURE_ELEMENT_POLICY_HCE_OFF;
-               }
        }
 
-
        return se_policy;
 }
+
 #if 0
-net_nfc_error_e net_nfc_server_se_set_se_policy(
-       net_nfc_secure_element_policy_e policy)
+net_nfc_error_e net_nfc_server_se_set_se_policy(net_nfc_secure_element_policy_e policy)
 {
        net_nfc_error_e result = NET_NFC_OK;
        int vconf_key;
@@ -554,43 +483,36 @@ net_nfc_error_e net_nfc_server_se_set_se_policy(
 
        DEBUG_SERVER_MSG("set se policy [%d]", policy);
 
-       if (vconf_get_int(VCONFKEY_NFC_WALLET_MODE, &wallet_mode) != 0) {
+       if (vconf_get_int(VCONFKEY_NFC_WALLET_MODE, &wallet_mode) != 0)
                DEBUG_ERR_MSG("vconf_get_int failed");
-       }
 
-       if (vconf_get_int(VCONFKEY_NFC_SE_TYPE, &se_type) != 0) {
+       if (vconf_get_int(VCONFKEY_NFC_SE_TYPE, &se_type) != 0)
                DEBUG_ERR_MSG("vconf_get_int failed");
-       }
 
        if (wallet_mode == VCONFKEY_NFC_WALLET_MODE_MANUAL) {
                if (policy == SECURE_ELEMENT_POLICY_UICC_ON) {
-                       if (se_type == SECURE_ELEMENT_POLICY_ESE_ON ||
-                               se_type == SECURE_ELEMENT_POLICY_ESE_OFF) {
+                       if (se_type == SECURE_ELEMENT_POLICY_ESE_ON || se_type == SECURE_ELEMENT_POLICY_ESE_OFF)
                                policy = SECURE_ELEMENT_POLICY_ESE_ON;
-                       }
                } else if (policy == SECURE_ELEMENT_POLICY_UICC_OFF) {
-                       if (se_type == SECURE_ELEMENT_POLICY_ESE_ON ||
-                               se_type == SECURE_ELEMENT_POLICY_ESE_OFF) {
+                       if (se_type == SECURE_ELEMENT_POLICY_ESE_ON || se_type == SECURE_ELEMENT_POLICY_ESE_OFF)
                                policy = SECURE_ELEMENT_POLICY_ESE_OFF;
-                       }
                }
        }
 
-       switch (policy)
-       {
-       case SECURE_ELEMENT_POLICY_UICC_ON :
+       switch (policy) {
+       case SECURE_ELEMENT_POLICY_UICC_ON:
                vconf_key = VCONFKEY_NFC_SE_POLICY_UICC_ON;
                break;
 
-       case SECURE_ELEMENT_POLICY_UICC_OFF :
+       case SECURE_ELEMENT_POLICY_UICC_OFF:
                vconf_key = VCONFKEY_NFC_SE_POLICY_UICC_OFF;
                break;
 
-       case SECURE_ELEMENT_POLICY_ESE_ON :
+       case SECURE_ELEMENT_POLICY_ESE_ON:
                vconf_key = VCONFKEY_NFC_SE_POLICY_ESE_ON;
                break;
 
-       case SECURE_ELEMENT_POLICY_ESE_OFF :
+       case SECURE_ELEMENT_POLICY_ESE_OFF:
                vconf_key = VCONFKEY_NFC_SE_POLICY_ESE_OFF;
                break;
 
@@ -608,14 +530,12 @@ net_nfc_error_e net_nfc_server_se_set_se_policy(
 }
 #endif
 /* eSE functions */
-static bool net_nfc_server_se_is_ese_handle(net_nfc_target_handle_s *handle)
+static bool net_nfc_server_se_is_ese_handle(net_nfc_target_handle_s * handle)
 {
-       return (gdbus_ese_handle != NULL &&
-               gdbus_ese_handle == handle);
+       return (gdbus_ese_handle != NULL && gdbus_ese_handle == handle);
 }
 
-static void net_nfc_server_se_set_current_ese_handle(
-                       net_nfc_target_handle_s *handle)
+static void net_nfc_server_se_set_current_ese_handle(net_nfc_target_handle_s * handle)
 {
        gdbus_ese_handle = handle;
 }
@@ -626,18 +546,12 @@ static net_nfc_target_handle_s *net_nfc_server_se_open_ese()
                net_nfc_error_e result = NET_NFC_OK;
                net_nfc_target_handle_s *handle = NULL;
 
-               if (net_nfc_controller_secure_element_open(
-                       NET_NFC_SE_TYPE_ESE,
-                       &handle, &result) == true)
-               {
+               if (net_nfc_controller_secure_element_open(NET_NFC_SE_TYPE_ESE, &handle, &result) == true) {
                        net_nfc_server_se_set_current_ese_handle(handle);
 
                        SECURE_MSG("handle [%p]", handle);
-               }
-               else
-               {
-                       DEBUG_ERR_MSG("net_nfc_controller_secure_element_open failed [%d]",
-                               result);
+               } else {
+                       DEBUG_ERR_MSG("net_nfc_controller_secure_element_open failed [%d]", result);
                }
        }
 
@@ -648,43 +562,34 @@ static net_nfc_error_e net_nfc_server_se_close_ese()
 {
        net_nfc_error_e result = NET_NFC_OK;
 
-       if (gdbus_ese_handle != NULL &&
-               net_nfc_server_gdbus_is_server_busy() == false) {
-               if (net_nfc_controller_secure_element_close(
-                       gdbus_ese_handle,
-                       &result) == false)
-               {
+       if (gdbus_ese_handle != NULL && net_nfc_server_gdbus_is_server_busy() == false) {
+               if (net_nfc_controller_secure_element_close(gdbus_ese_handle, &result) == false)
                        net_nfc_controller_exception_handler();
-               }
                net_nfc_server_se_set_current_ese_handle(NULL);
        }
 
        return result;
 }
 
-static void _sim_apdu_cb(TapiHandle *handle, int result,
-                   void *data, void *user_data)
+static void _sim_apdu_cb(TapiHandle * handle, int result, void *data, void *user_data)
 {
-    resp_apdu = (TelSimApduResp_t *)data;
-    GMainLoop *loop = (GMainLoop *)user_data;
+       resp_apdu = (TelSimApduResp_t *) data;
+       GMainLoop *loop = (GMainLoop *) user_data;
 
        g_main_loop_quit(loop);
        g_main_loop_unref(loop);
 }
 
-static void _sim_atr_cb(TapiHandle *handle, int result,
-               void *data, void *user_data)
+static void _sim_atr_cb(TapiHandle * handle, int result, void *data, void *user_data)
 {
-       resp_atr  = (TelSimAtrResp_t *)data;
-       GMainLoop *loop = (GMainLoop *)user_data;
+       resp_atr = (TelSimAtrResp_t *) data;
+       GMainLoop *loop = (GMainLoop *) user_data;
 
        g_main_loop_quit(loop);
        g_main_loop_unref(loop);
 }
 
-
-static bool _se_uicc_send_apdu(net_nfc_target_handle_s *handle,
-       data_s *apdu, data_s **response)
+static bool _se_uicc_send_apdu(net_nfc_target_handle_s * handle, data_s * apdu, data_s ** response)
 {
        bool ret;
        int result;
@@ -697,18 +602,15 @@ static bool _se_uicc_send_apdu(net_nfc_target_handle_s *handle,
        apdu_data.apdu_len = apdu->length;
        loop = g_main_loop_new(NULL, false);
 
-       result = tel_req_sim_apdu((TapiHandle *)handle, &apdu_data, _sim_apdu_cb, &loop);
-       if (result == 0 &&
-               resp_apdu->apdu_resp_len > 0) {
+       result = tel_req_sim_apdu((TapiHandle *) handle, &apdu_data, _sim_apdu_cb, &loop);
+       if (result == 0 && resp_apdu->apdu_resp_len > 0) {
                data_s *temp = NULL;
 
                g_main_loop_run(loop);
 
                temp = net_nfc_util_create_data(resp_apdu->apdu_resp_len);
                if (temp != NULL) {
-                       memcpy(temp->buffer,
-                               resp_apdu->apdu_resp,
-                               temp->length);
+                       memcpy(temp->buffer, resp_apdu->apdu_resp, temp->length);
 
                        *response = temp;
                        ret = true;
@@ -726,7 +628,7 @@ static bool _se_uicc_send_apdu(net_nfc_target_handle_s *handle,
        return ret;
 }
 
-static bool _se_uicc_get_atr(net_nfc_target_handle_s *handle, data_s **atr)
+static bool _se_uicc_get_atr(net_nfc_target_handle_s * handle, data_s ** atr)
 {
        bool ret;
        int result;
@@ -737,16 +639,15 @@ static bool _se_uicc_get_atr(net_nfc_target_handle_s *handle, data_s **atr)
 
        loop = g_main_loop_new(NULL, false);
 
-       result = tel_req_sim_atr((TapiHandle *)handle, _sim_atr_cb, &loop);
-       if (result == 0){
+       result = tel_req_sim_atr((TapiHandle *) handle, _sim_atr_cb, &loop);
+       if (result == 0) {
                data_s *temp = NULL;
 
                g_main_loop_run(loop);
 
                temp = net_nfc_util_create_data(resp_atr->atr_resp_len);
                if (temp != NULL) {
-                       memcpy(temp->buffer, resp_atr->atr_resp,
-                               temp->length);
+                       memcpy(temp->buffer, resp_atr->atr_resp, temp->length);
 
                        *atr = temp;
                        ret = true;
@@ -768,26 +669,22 @@ static net_nfc_target_handle_s *_se_uicc_open(void)
 {
        net_nfc_target_handle_s *result = NULL;
 
-       if (gdbus_uicc_ready == SE_UICC_READY && gdbus_uicc_handle != NULL) {
-               result = (net_nfc_target_handle_s *)gdbus_uicc_handle;
-       }
+       if (gdbus_uicc_ready == SE_UICC_READY && gdbus_uicc_handle != NULL)
+               result = (net_nfc_target_handle_s *) gdbus_uicc_handle;
 
        return result;
 }
 
-static bool _se_is_uicc_handle(net_nfc_target_handle_s *handle)
+static bool _se_is_uicc_handle(net_nfc_target_handle_s * handle)
 {
-       return (gdbus_uicc_ready == SE_UICC_READY &&
-               gdbus_uicc_handle != NULL &&
-               (TapiHandle *)handle == gdbus_uicc_handle);
+       return (gdbus_uicc_ready == SE_UICC_READY && gdbus_uicc_handle != NULL && (TapiHandle *) handle == gdbus_uicc_handle);
 }
 
-static void _se_uicc_close(net_nfc_target_handle_s *handle)
+static void _se_uicc_close(net_nfc_target_handle_s * handle)
 {
 }
 
-net_nfc_error_e net_nfc_server_se_apply_se_policy(
-       net_nfc_secure_element_policy_e policy)
+net_nfc_error_e net_nfc_server_se_apply_se_policy(net_nfc_secure_element_policy_e policy)
 {
        net_nfc_error_e result = NET_NFC_OK;
 
@@ -795,142 +692,78 @@ net_nfc_error_e net_nfc_server_se_apply_se_policy(
 
        net_nfc_controller_secure_element_clear_routing_entry(NET_NFC_SE_PROTOCOL_ENTRY, &result);
 
-       switch (policy)
-       {
-       case SECURE_ELEMENT_POLICY_UICC_ON :
-               if (gdbus_uicc_ready == SE_UICC_READY)
-               {
-                       net_nfc_controller_set_secure_element_mode(
-                               SECURE_ELEMENT_TYPE_ESE,
-                               SECURE_ELEMENT_OFF_MODE,
-                               &result);
-
-                       net_nfc_controller_set_secure_element_mode(
-                               SECURE_ELEMENT_TYPE_HCE,
-                               SECURE_ELEMENT_OFF_MODE,
-                               &result);
-
-                       net_nfc_controller_set_secure_element_mode(
-                               SECURE_ELEMENT_TYPE_UICC,
-                               SECURE_ELEMENT_VIRTUAL_MODE,
-                               &result);
+       switch (policy) {
+       case SECURE_ELEMENT_POLICY_UICC_ON:
+               if (gdbus_uicc_ready == SE_UICC_READY) {
+                       net_nfc_controller_set_secure_element_mode(SECURE_ELEMENT_TYPE_ESE, SECURE_ELEMENT_OFF_MODE, &result);
+
+                       net_nfc_controller_set_secure_element_mode(SECURE_ELEMENT_TYPE_HCE, SECURE_ELEMENT_OFF_MODE, &result);
+
+                       net_nfc_controller_set_secure_element_mode(SECURE_ELEMENT_TYPE_UICC, SECURE_ELEMENT_VIRTUAL_MODE, &result);
 #if 0
-                       net_nfc_controller_secure_element_set_default_route(
-                               NET_NFC_SE_TYPE_UICC, NET_NFC_SE_TYPE_NONE,
-                               NET_NFC_SE_TYPE_UICC, &result);
+                       net_nfc_controller_secure_element_set_default_route(NET_NFC_SE_TYPE_UICC, NET_NFC_SE_TYPE_NONE, NET_NFC_SE_TYPE_UICC, &result);
 #else
-                       net_nfc_controller_secure_element_set_route_entry(
-                       NET_NFC_SE_TECH_ENTRY, NET_NFC_SE_TECH_A_B_ISO_NFC_DEP,
-                       NET_NFC_SE_TYPE_UICC, 0x39, &result);
+                       net_nfc_controller_secure_element_set_route_entry(NET_NFC_SE_TECH_ENTRY, NET_NFC_SE_TECH_A_B_ISO_NFC_DEP, NET_NFC_SE_TYPE_UICC, 0x39, &result);
 
-                       net_nfc_controller_secure_element_set_route_entry(
-                       NET_NFC_SE_PROTOCOL_ENTRY, NET_NFC_SE_TECH_A_B_ISO_NFC_DEP,
-                       NET_NFC_SE_TYPE_UICC, 0x39, &result);
+                       net_nfc_controller_secure_element_set_route_entry(NET_NFC_SE_PROTOCOL_ENTRY, NET_NFC_SE_TECH_A_B_ISO_NFC_DEP, NET_NFC_SE_TYPE_UICC, 0x39, &result);
 
 #endif
 
                        current_policy = policy;
-               }
-               else
-               {
+               } else {
                        current_policy = SECURE_ELEMENT_POLICY_UICC_OFF;
                }
                break;
 
-       case SECURE_ELEMENT_POLICY_ESE_ON :
-               net_nfc_controller_set_secure_element_mode(
-                       SECURE_ELEMENT_TYPE_UICC,
-                       SECURE_ELEMENT_OFF_MODE,
-                       &result);
-
-               net_nfc_controller_set_secure_element_mode(
-                       SECURE_ELEMENT_TYPE_HCE,
-                       SECURE_ELEMENT_OFF_MODE,
-                       &result);
-
-               net_nfc_controller_set_secure_element_mode(
-                       SECURE_ELEMENT_TYPE_ESE,
-                       SECURE_ELEMENT_VIRTUAL_MODE,
-                       &result);
+       case SECURE_ELEMENT_POLICY_ESE_ON:
+               net_nfc_controller_set_secure_element_mode(SECURE_ELEMENT_TYPE_UICC, SECURE_ELEMENT_OFF_MODE, &result);
+
+               net_nfc_controller_set_secure_element_mode(SECURE_ELEMENT_TYPE_HCE, SECURE_ELEMENT_OFF_MODE, &result);
+
+               net_nfc_controller_set_secure_element_mode(SECURE_ELEMENT_TYPE_ESE, SECURE_ELEMENT_VIRTUAL_MODE, &result);
 #if 0
-               net_nfc_controller_secure_element_set_default_route(
-                       NET_NFC_SE_TYPE_ESE, NET_NFC_SE_TYPE_NONE,
-                       NET_NFC_SE_TYPE_ESE, &result);
+               net_nfc_controller_secure_element_set_default_route(NET_NFC_SE_TYPE_ESE, NET_NFC_SE_TYPE_NONE, NET_NFC_SE_TYPE_ESE, &result);
 #else
-               net_nfc_controller_secure_element_set_route_entry(
-               NET_NFC_SE_TECH_ENTRY, NET_NFC_SE_TECH_A_B_ISO_NFC_DEP,
-               NET_NFC_SE_TYPE_ESE, 0x39, &result);
+               net_nfc_controller_secure_element_set_route_entry(NET_NFC_SE_TECH_ENTRY, NET_NFC_SE_TECH_A_B_ISO_NFC_DEP, NET_NFC_SE_TYPE_ESE, 0x39, &result);
 
-               net_nfc_controller_secure_element_set_route_entry(
-               NET_NFC_SE_PROTOCOL_ENTRY, NET_NFC_SE_TECH_A_B_ISO_NFC_DEP,
-               NET_NFC_SE_TYPE_ESE, 0x39, &result);
+               net_nfc_controller_secure_element_set_route_entry(NET_NFC_SE_PROTOCOL_ENTRY, NET_NFC_SE_TECH_A_B_ISO_NFC_DEP, NET_NFC_SE_TYPE_ESE, 0x39, &result);
 
 #endif
                current_policy = policy;
                break;
 
-       case SECURE_ELEMENT_POLICY_HCE_ON :
-               net_nfc_controller_set_secure_element_mode(
-                       SECURE_ELEMENT_TYPE_UICC,
-                       SECURE_ELEMENT_OFF_MODE,
-                       &result);
-
-               net_nfc_controller_set_secure_element_mode(
-                       SECURE_ELEMENT_TYPE_ESE,
-                       SECURE_ELEMENT_OFF_MODE,
-                       &result);
-
-               net_nfc_controller_set_secure_element_mode(
-                       SECURE_ELEMENT_TYPE_HCE,
-                       SECURE_ELEMENT_VIRTUAL_MODE,
-                       &result);
+       case SECURE_ELEMENT_POLICY_HCE_ON:
+               net_nfc_controller_set_secure_element_mode(SECURE_ELEMENT_TYPE_UICC, SECURE_ELEMENT_OFF_MODE, &result);
+
+               net_nfc_controller_set_secure_element_mode(SECURE_ELEMENT_TYPE_ESE, SECURE_ELEMENT_OFF_MODE, &result);
+
+               net_nfc_controller_set_secure_element_mode(SECURE_ELEMENT_TYPE_HCE, SECURE_ELEMENT_VIRTUAL_MODE, &result);
 #if 0
-               net_nfc_controller_secure_element_set_default_route(
-                       NET_NFC_SE_TYPE_HCE, NET_NFC_SE_TYPE_NONE,
-                       NET_NFC_SE_TYPE_HCE, &result);
+               net_nfc_controller_secure_element_set_default_route(NET_NFC_SE_TYPE_HCE, NET_NFC_SE_TYPE_NONE, NET_NFC_SE_TYPE_HCE, &result);
 #else
-               net_nfc_controller_secure_element_set_route_entry(
-               NET_NFC_SE_TECH_ENTRY, NET_NFC_SE_TECH_A_B_ISO_NFC_DEP,
-               NET_NFC_SE_TYPE_HCE, 0x39, &result);
+               net_nfc_controller_secure_element_set_route_entry(NET_NFC_SE_TECH_ENTRY, NET_NFC_SE_TECH_A_B_ISO_NFC_DEP, NET_NFC_SE_TYPE_HCE, 0x39, &result);
 
-               net_nfc_controller_secure_element_set_route_entry(
-               NET_NFC_SE_PROTOCOL_ENTRY, NET_NFC_SE_TECH_A_B_ISO_NFC_DEP,
-               NET_NFC_SE_TYPE_HCE, 0x39, &result);
+               net_nfc_controller_secure_element_set_route_entry(NET_NFC_SE_PROTOCOL_ENTRY, NET_NFC_SE_TECH_A_B_ISO_NFC_DEP, NET_NFC_SE_TYPE_HCE, 0x39, &result);
 
 #endif
                current_policy = policy;
                break;
 
-       case SECURE_ELEMENT_POLICY_UICC_OFF :
-       case SECURE_ELEMENT_POLICY_ESE_OFF :
-       case SECURE_ELEMENT_POLICY_HCE_OFF :
-       default :
-               net_nfc_controller_set_secure_element_mode(
-                       SECURE_ELEMENT_TYPE_ESE,
-                       SECURE_ELEMENT_OFF_MODE,
-                       &result);
-
-               net_nfc_controller_set_secure_element_mode(
-                       SECURE_ELEMENT_TYPE_UICC,
-                       SECURE_ELEMENT_OFF_MODE,
-                       &result);
-
-               net_nfc_controller_set_secure_element_mode(
-                       SECURE_ELEMENT_TYPE_HCE,
-                       SECURE_ELEMENT_OFF_MODE,
-                       &result);
+       case SECURE_ELEMENT_POLICY_UICC_OFF:
+       case SECURE_ELEMENT_POLICY_ESE_OFF:
+       case SECURE_ELEMENT_POLICY_HCE_OFF:
+       default:
+               net_nfc_controller_set_secure_element_mode(SECURE_ELEMENT_TYPE_ESE, SECURE_ELEMENT_OFF_MODE, &result);
+
+               net_nfc_controller_set_secure_element_mode(SECURE_ELEMENT_TYPE_UICC, SECURE_ELEMENT_OFF_MODE, &result);
+
+               net_nfc_controller_set_secure_element_mode(SECURE_ELEMENT_TYPE_HCE, SECURE_ELEMENT_OFF_MODE, &result);
 #if 0
-               net_nfc_controller_secure_element_set_default_route(
-                       NET_NFC_SE_TYPE_NONE, NET_NFC_SE_TYPE_NONE,
-                       NET_NFC_SE_TYPE_NONE, &result);
+               net_nfc_controller_secure_element_set_default_route(NET_NFC_SE_TYPE_NONE, NET_NFC_SE_TYPE_NONE, NET_NFC_SE_TYPE_NONE, &result);
 #else
-               net_nfc_controller_secure_element_set_route_entry(
-               NET_NFC_SE_INVALID_ENTRY, NET_NFC_SE_INVALID_TECH_PROTO,
-               NET_NFC_SE_TYPE_NONE, 0x39, &result);
+               net_nfc_controller_secure_element_set_route_entry(NET_NFC_SE_INVALID_ENTRY, NET_NFC_SE_INVALID_TECH_PROTO, NET_NFC_SE_TYPE_NONE, 0x39, &result);
 
-               net_nfc_controller_secure_element_set_route_entry(
-               NET_NFC_SE_INVALID_ENTRY, NET_NFC_SE_INVALID_TECH_PROTO,
-               NET_NFC_SE_TYPE_NONE, 0x39, &result);
+               net_nfc_controller_secure_element_set_route_entry(NET_NFC_SE_INVALID_ENTRY, NET_NFC_SE_INVALID_TECH_PROTO, NET_NFC_SE_TYPE_NONE, 0x39, &result);
 
 #endif
                current_policy = policy;
@@ -951,8 +784,7 @@ net_nfc_error_e net_nfc_server_se_apply_se_current_policy()
        return net_nfc_server_se_apply_se_policy(policy);
 }
 
-net_nfc_error_e net_nfc_server_se_change_wallet_mode(
-       net_nfc_wallet_mode_e wallet_mode)
+net_nfc_error_e net_nfc_server_se_change_wallet_mode(net_nfc_wallet_mode_e wallet_mode)
 {
        net_nfc_error_e result = NET_NFC_OK;
        net_nfc_secure_element_policy_e new_policy;
@@ -963,88 +795,66 @@ net_nfc_error_e net_nfc_server_se_change_wallet_mode(
 
        SECURE_MSG("current policy [%d], new policy [%d]", current_policy, new_policy);
 
-       if (__se_get_se_type(current_policy) != __se_get_se_type(new_policy)) {
+       if (__se_get_se_type(current_policy) != __se_get_se_type(new_policy))
                is_type_changed = true;
-       }
 
-       if (__se_get_se_state(current_policy) != __se_get_se_state(new_policy)) {
+       if (__se_get_se_state(current_policy) != __se_get_se_state(new_policy))
                is_card_mode_changed = true;
-       }
 
-       if (is_type_changed == true || is_card_mode_changed == true) {
+       if (is_type_changed == true || is_card_mode_changed == true)
                result = net_nfc_server_se_apply_se_current_policy();
-       }
 
-       if (is_type_changed == true) {
-               net_nfc_gdbus_secure_element_emit_se_type_changed(NULL,
-                       __se_get_se_type(new_policy));
-       }
+       if (is_type_changed == true)
+               net_nfc_gdbus_secure_element_emit_se_type_changed(NULL, __se_get_se_type(new_policy));
 
-       if (is_card_mode_changed == true) {
-               net_nfc_gdbus_secure_element_emit_card_emulation_mode_changed(
-                       NULL, __se_get_se_state(new_policy));
-       }
+       if (is_card_mode_changed == true)
+               net_nfc_gdbus_secure_element_emit_card_emulation_mode_changed(NULL, __se_get_se_state(new_policy));
 
        return result;
 }
 
 static void se_close_secure_element_thread_func(gpointer user_data)
 {
-       SeDataHandle *detail = (SeDataHandle *)user_data;
+       SeDataHandle *detail = (SeDataHandle *) user_data;
        net_nfc_error_e result;
 
        g_assert(detail != NULL);
        g_assert(detail->object != NULL);
        g_assert(detail->invocation != NULL);
 
-       if (_se_is_uicc_handle(detail->handle) == true)
-       {
+       if (_se_is_uicc_handle(detail->handle) == true) {
                _se_uicc_close(detail->handle);
 
                result = NET_NFC_OK;
-       }
-       else if (net_nfc_server_se_is_ese_handle(detail->handle) == true)
-       {
+       } else if (net_nfc_server_se_is_ese_handle(detail->handle) == true) {
                /* decrease client reference count */
-               net_nfc_server_gdbus_decrease_se_count(
-                       g_dbus_method_invocation_get_sender(
-                               detail->invocation));
+               net_nfc_server_gdbus_decrease_se_count(g_dbus_method_invocation_get_sender(detail->invocation));
 
                result = net_nfc_server_se_close_ese();
-       }
-       else
-       {
+       } else {
                result = NET_NFC_INVALID_HANDLE;
        }
 
-       net_nfc_gdbus_secure_element_complete_close_secure_element(
-               detail->object, detail->invocation, result);
+       net_nfc_gdbus_secure_element_complete_close_secure_element(detail->object, detail->invocation, result);
 
        g_object_unref(detail->invocation);
        g_object_unref(detail->object);
 
        g_free(detail);
 
-#if 0 /* it causes some problems when user repeats open/close */
+#if 0                                                  /* it causes some problems when user repeats open/close */
        /* shutdown process if it doesn't need */
-       if (net_nfc_server_manager_get_active() == false &&
-               net_nfc_server_gdbus_is_server_busy() == false) {
+       if (net_nfc_server_manager_get_active() == false && net_nfc_server_gdbus_is_server_busy() == false)
                net_nfc_server_controller_deinit();
-       }
 #endif
 }
 
-static gboolean se_handle_close_secure_element(
-       NetNfcGDbusSecureElement *object,
-       GDBusMethodInvocation *invocation,
-       guint arg_handle,
-       GVariant *smack_privilege)
+static gboolean se_handle_close_secure_element(NetNfcGDbusSecureElement * object, GDBusMethodInvocation * invocation, guint arg_handle, GVariant * smack_privilege)
 {
        SeDataHandle *data = NULL;
        gint result;
 
-       INFO_MSG(">>> REQUEST from [%s]",
-               g_dbus_method_invocation_get_sender(invocation));
+       INFO_MSG(">>> REQUEST from [%s]", g_dbus_method_invocation_get_sender(invocation));
 
        /* check privilege and update client context */
        if (net_nfc_server_gdbus_check_privilege(invocation, NET_NFC_PRIVILEGE_NFC_CARD_EMUL) == false) {
@@ -1055,8 +865,7 @@ static gboolean se_handle_close_secure_element(
        }
 
        data = g_try_new0(SeDataHandle, 1);
-       if (data == NULL)
-       {
+       if (data == NULL) {
                DEBUG_ERR_MSG("Memory allocation failed");
                result = NET_NFC_ALLOC_FAIL;
 
@@ -1065,11 +874,9 @@ static gboolean se_handle_close_secure_element(
 
        data->object = g_object_ref(object);
        data->invocation = g_object_ref(invocation);
-       data->handle = (net_nfc_target_handle_s *)arg_handle;
+       data->handle = (net_nfc_target_handle_s *) arg_handle;
 
-       if (net_nfc_server_controller_async_queue_push_force(
-               se_close_secure_element_thread_func, data) == FALSE)
-       {
+       if (net_nfc_server_controller_async_queue_push_force(se_close_secure_element_thread_func, data) == FALSE) {
                /* return error if queue was blocked */
                DEBUG_SERVER_MSG("controller is processing important message..");
                result = NET_NFC_BUSY;
@@ -1079,7 +886,7 @@ static gboolean se_handle_close_secure_element(
 
        return TRUE;
 
-ERROR :
+ ERROR:
        if (data != NULL) {
                g_object_unref(data->invocation);
                g_object_unref(data->object);
@@ -1087,15 +894,14 @@ ERROR :
                g_free(data);
        }
 
-       net_nfc_gdbus_secure_element_complete_close_secure_element(
-               object, invocation, result);
+       net_nfc_gdbus_secure_element_complete_close_secure_element(object, invocation, result);
 
        return TRUE;
 }
 
 static void se_get_atr_thread_func(gpointer user_data)
 {
-       SeDataHandle *detail = (SeDataHandle *)user_data;
+       SeDataHandle *detail = (SeDataHandle *) user_data;
        net_nfc_error_e result = NET_NFC_OK;
        data_s *atr = NULL;
        GVariant *data;
@@ -1104,21 +910,14 @@ static void se_get_atr_thread_func(gpointer user_data)
        g_assert(detail->object != NULL);
        g_assert(detail->invocation != NULL);
 
-       if (_se_is_uicc_handle(detail->handle) == true)
-       {
-               if (_se_uicc_get_atr(detail->handle, &atr) == true) {
+       if (_se_is_uicc_handle(detail->handle) == true) {
+               if (_se_uicc_get_atr(detail->handle, &atr) == true)
                        result = NET_NFC_OK;
-               } else {
+               else
                        result = NET_NFC_OPERATION_FAIL;
-               }
-       }
-       else if (net_nfc_server_se_is_ese_handle(detail->handle) == true)
-       {
-               net_nfc_controller_secure_element_get_atr(detail->handle, &atr,
-                       &result);
-       }
-       else
-       {
+       } else if (net_nfc_server_se_is_ese_handle(detail->handle) == true) {
+               net_nfc_controller_secure_element_get_atr(detail->handle, &atr, &result);
+       } else {
                DEBUG_ERR_MSG("invalid se handle");
 
                result = NET_NFC_INVALID_HANDLE;
@@ -1126,15 +925,10 @@ static void se_get_atr_thread_func(gpointer user_data)
 
        data = net_nfc_util_gdbus_data_to_variant(atr);
 
-       net_nfc_gdbus_secure_element_complete_get_atr(
-               detail->object,
-               detail->invocation,
-               result,
-               data);
+       net_nfc_gdbus_secure_element_complete_get_atr(detail->object, detail->invocation, result, data);
 
-       if (atr != NULL) {
+       if (atr != NULL)
                net_nfc_util_free_data(atr);
-       }
 
        g_object_unref(detail->invocation);
        g_object_unref(detail->object);
@@ -1142,17 +936,12 @@ static void se_get_atr_thread_func(gpointer user_data)
        g_free(detail);
 }
 
-static gboolean se_handle_get_atr(
-       NetNfcGDbusSecureElement *object,
-       GDBusMethodInvocation *invocation,
-       guint arg_handle,
-       GVariant *smack_privilege)
+static gboolean se_handle_get_atr(NetNfcGDbusSecureElement * object, GDBusMethodInvocation * invocation, guint arg_handle, GVariant * smack_privilege)
 {
        SeDataHandle *data = NULL;
        gint result;
 
-       INFO_MSG(">>> REQUEST from [%s]",
-               g_dbus_method_invocation_get_sender(invocation));
+       INFO_MSG(">>> REQUEST from [%s]", g_dbus_method_invocation_get_sender(invocation));
 
        /* check privilege and update client context */
        if (net_nfc_server_gdbus_check_privilege(invocation, NET_NFC_PRIVILEGE_NFC_CARD_EMUL) == false) {
@@ -1163,8 +952,7 @@ static gboolean se_handle_get_atr(
        }
 
        data = g_try_new0(SeDataHandle, 1);
-       if (data == NULL)
-       {
+       if (data == NULL) {
                DEBUG_ERR_MSG("Memory allocation failed");
                result = NET_NFC_ALLOC_FAIL;
 
@@ -1173,11 +961,9 @@ static gboolean se_handle_get_atr(
 
        data->object = g_object_ref(object);
        data->invocation = g_object_ref(invocation);
-       data->handle = (net_nfc_target_handle_s *)arg_handle;
+       data->handle = (net_nfc_target_handle_s *) arg_handle;
 
-       if (net_nfc_server_controller_async_queue_push_force(
-               se_get_atr_thread_func, data) == FALSE)
-       {
+       if (net_nfc_server_controller_async_queue_push_force(se_get_atr_thread_func, data) == FALSE) {
                /* return error if queue was blocked */
                DEBUG_SERVER_MSG("controller is processing important message..");
                result = NET_NFC_BUSY;
@@ -1187,7 +973,7 @@ static gboolean se_handle_get_atr(
 
        return TRUE;
 
-ERROR :
+ ERROR:
        if (data != NULL) {
                g_object_unref(data->invocation);
                g_object_unref(data->object);
@@ -1195,15 +981,14 @@ ERROR :
                g_free(data);
        }
 
-       net_nfc_gdbus_secure_element_complete_get_atr(object, invocation,
-               result, net_nfc_util_gdbus_buffer_to_variant(NULL, 0));
+       net_nfc_gdbus_secure_element_complete_get_atr(object, invocation, result, net_nfc_util_gdbus_buffer_to_variant(NULL, 0));
 
        return TRUE;
 }
 
 static void se_open_secure_element_thread_func(gpointer user_data)
 {
-       SeDataSeType *detail = (SeDataSeType *)user_data;
+       SeDataSeType *detail = (SeDataSeType *) user_data;
        net_nfc_target_handle_s *handle = NULL;
        net_nfc_error_e result = NET_NFC_OK;
 
@@ -1219,11 +1004,9 @@ static void se_open_secure_element_thread_func(gpointer user_data)
        name = g_dbus_method_invocation_get_sender(detail->invocation);
        pid = net_nfc_server_gdbus_get_pid(name);
 
-       ret = net_nfc_service_check_access_control(pid,
-               NET_NFC_ACCESS_CONTROL_PLATFORM);
+       ret = net_nfc_service_check_access_control(pid, NET_NFC_ACCESS_CONTROL_PLATFORM);
 
-       if (ret == false)
-       {
+       if (ret == false) {
                DEBUG_ERR_MSG("access control denied");
                result = NET_NFC_SECURITY_FAIL;
 
@@ -1231,52 +1014,35 @@ static void se_open_secure_element_thread_func(gpointer user_data)
        }
 #endif
 
-       if (detail->se_type == NET_NFC_SE_TYPE_UICC)
-       {
-               handle = (net_nfc_target_handle_s *)_se_uicc_open();
-               if (handle != NULL)
-               {
+       if (detail->se_type == NET_NFC_SE_TYPE_UICC) {
+               handle = (net_nfc_target_handle_s *) _se_uicc_open();
+               if (handle != NULL) {
                        result = NET_NFC_OK;
-               }
-               else
-               {
+               } else {
                        result = NET_NFC_INVALID_STATE;
                        handle = NULL;
                }
-       }
-       else if (detail->se_type == NET_NFC_SE_TYPE_ESE)
-       {
+       } else if (detail->se_type == NET_NFC_SE_TYPE_ESE) {
                handle = net_nfc_server_se_open_ese();
-               if (handle != NULL)
-               {
+               if (handle != NULL) {
                        result = NET_NFC_OK;
 
                        SECURE_MSG("handle [%p]", handle);
 
                        /* increase client reference count */
-                       net_nfc_server_gdbus_increase_se_count(
-                               g_dbus_method_invocation_get_sender(
-                                       detail->invocation));
-               }
-               else
-               {
+                       net_nfc_server_gdbus_increase_se_count(g_dbus_method_invocation_get_sender(detail->invocation));
+               } else {
                        result = NET_NFC_INVALID_STATE;
                        handle = NULL;
                }
-       }
-       else
-       {
+       } else {
                result = NET_NFC_INVALID_PARAM;
                handle = NULL;
        }
 #ifdef ACCESS_CONTROL
-END :
+ END:
 #endif
-       net_nfc_gdbus_secure_element_complete_open_secure_element(
-               detail->object,
-               detail->invocation,
-               result,
-               (guint)handle);
+       net_nfc_gdbus_secure_element_complete_open_secure_element(detail->object, detail->invocation, result, (guint) handle);
 
        g_object_unref(detail->invocation);
        g_object_unref(detail->object);
@@ -1284,20 +1050,15 @@ END :
        g_free(detail);
 }
 
-static gboolean se_handle_open_secure_element(
-       NetNfcGDbusSecureElement *object,
-       GDBusMethodInvocation *invocation,
-       gint arg_type,
-       GVariant *smack_privilege)
+static gboolean se_handle_open_secure_element(NetNfcGDbusSecureElement * object, GDBusMethodInvocation * invocation, gint arg_type, GVariant * smack_privilege)
 {
        SeDataSeType *data = NULL;
        gint result;
 
-       INFO_MSG(">>> REQUEST from [%s]",
-               g_dbus_method_invocation_get_sender(invocation));
+       INFO_MSG(">>> REQUEST from [%s]", g_dbus_method_invocation_get_sender(invocation));
 
        /* check privilege and update client context */
-       if (net_nfc_server_gdbus_check_privilege(invocation, NET_NFC_PRIVILEGE_NFC_CARD_EMUL) == false) {
+       if (net_nfc_server_gdbus_check_privilege(invocation, NET_NFC_PRIVILEGE_NFC_CARD_EMUL) == false) {
                DEBUG_ERR_MSG("permission denied, and finished request");
                result = NET_NFC_PERMISSION_DENIED;
 
@@ -1305,8 +1066,7 @@ static gboolean se_handle_open_secure_element(
        }
 
        data = g_try_new0(SeDataSeType, 1);
-       if (data == NULL)
-       {
+       if (data == NULL) {
                DEBUG_ERR_MSG("Memory allocation failed");
                result = NET_NFC_ALLOC_FAIL;
 
@@ -1315,11 +1075,9 @@ static gboolean se_handle_open_secure_element(
 
        data->object = g_object_ref(object);
        data->invocation = g_object_ref(invocation);
-       data->se_type= arg_type;
+       data->se_type = arg_type;
 
-       if (net_nfc_server_controller_async_queue_push_force(
-               se_open_secure_element_thread_func, data) == FALSE)
-       {
+       if (net_nfc_server_controller_async_queue_push_force(se_open_secure_element_thread_func, data) == FALSE) {
                /* return error if queue was blocked */
                DEBUG_SERVER_MSG("controller is processing important message..");
                result = NET_NFC_BUSY;
@@ -1329,7 +1087,7 @@ static gboolean se_handle_open_secure_element(
 
        return TRUE;
 
-ERROR :
+ ERROR:
        if (data != NULL) {
                g_object_unref(data->invocation);
                g_object_unref(data->object);
@@ -1337,15 +1095,14 @@ ERROR :
                g_free(data);
        }
 
-       net_nfc_gdbus_secure_element_complete_open_secure_element(
-               object, invocation, result, 0);
+       net_nfc_gdbus_secure_element_complete_open_secure_element(object, invocation, result, 0);
 
        return TRUE;
 }
 
 static void se_send_apdu_thread_func(gpointer user_data)
 {
-       SeDataApdu *detail = (SeDataApdu *)user_data;
+       SeDataApdu *detail = (SeDataApdu *) user_data;
        data_s apdu_data = { NULL, 0 };
        data_s *response = NULL;
        net_nfc_error_e result = NET_NFC_OK;
@@ -1358,8 +1115,7 @@ static void se_send_apdu_thread_func(gpointer user_data)
 
        net_nfc_util_gdbus_variant_to_data_s(detail->data, &apdu_data);
 
-       if (_se_is_uicc_handle(detail->handle) == true)
-       {
+       if (_se_is_uicc_handle(detail->handle) == true) {
                ret = _se_uicc_send_apdu(detail->handle, &apdu_data, &response);
                if (ret == false) {
                        DEBUG_ERR_MSG("_se_uicc_send_apdu failed");
@@ -1368,29 +1124,18 @@ static void se_send_apdu_thread_func(gpointer user_data)
                } else {
                        result = NET_NFC_OK;
                }
-       }
-       else if (net_nfc_server_se_is_ese_handle(detail->handle) == true)
-       {
-               ret = net_nfc_controller_secure_element_send_apdu(
-                       detail->handle, &apdu_data, &response, &result);
-       }
-       else
-       {
+       } else if (net_nfc_server_se_is_ese_handle(detail->handle) == true) {
+               ret = net_nfc_controller_secure_element_send_apdu(detail->handle, &apdu_data, &response, &result);
+       } else {
                result = NET_NFC_INVALID_HANDLE;
        }
 
        rspdata = net_nfc_util_gdbus_data_to_variant(response);
 
-       net_nfc_gdbus_secure_element_complete_send_apdu(
-               detail->object,
-               detail->invocation,
-               result,
-               rspdata);
+       net_nfc_gdbus_secure_element_complete_send_apdu(detail->object, detail->invocation, result, rspdata);
 
        if (response != NULL)
-       {
                net_nfc_util_free_data(response);
-       }
 
        net_nfc_util_clear_data(&apdu_data);
 
@@ -1402,18 +1147,12 @@ static void se_send_apdu_thread_func(gpointer user_data)
        g_free(detail);
 }
 
-static gboolean se_handle_send_apdu(
-       NetNfcGDbusSecureElement *object,
-       GDBusMethodInvocation *invocation,
-       guint arg_handle,
-       GVariant *apdudata,
-       GVariant *smack_privilege)
+static gboolean se_handle_send_apdu(NetNfcGDbusSecureElement * object, GDBusMethodInvocation * invocation, guint arg_handle, GVariant * apdudata, GVariant * smack_privilege)
 {
        SeDataApdu *data = NULL;
        gint result;
 
-       INFO_MSG(">>> REQUEST from [%s]",
-               g_dbus_method_invocation_get_sender(invocation));
+       INFO_MSG(">>> REQUEST from [%s]", g_dbus_method_invocation_get_sender(invocation));
 
        /* check privilege and update client context */
        if (net_nfc_server_gdbus_check_privilege(invocation, NET_NFC_PRIVILEGE_NFC_CARD_EMUL) == false) {
@@ -1424,8 +1163,7 @@ static gboolean se_handle_send_apdu(
        }
 
        data = g_try_new0(SeDataApdu, 1);
-       if (data == NULL)
-       {
+       if (data == NULL) {
                DEBUG_ERR_MSG("Memory allocation failed");
                result = NET_NFC_ALLOC_FAIL;
 
@@ -1434,12 +1172,10 @@ static gboolean se_handle_send_apdu(
 
        data->object = g_object_ref(object);
        data->invocation = g_object_ref(invocation);
-       data->handle = (net_nfc_target_handle_s *)arg_handle;
+       data->handle = (net_nfc_target_handle_s *) arg_handle;
        data->data = g_variant_ref(apdudata);
 
-       if (net_nfc_server_controller_async_queue_push_force(
-               se_send_apdu_thread_func, data) == FALSE)
-       {
+       if (net_nfc_server_controller_async_queue_push_force(se_send_apdu_thread_func, data) == FALSE) {
                /* return error if queue was blocked */
                DEBUG_SERVER_MSG("controller is processing important message..");
                result = NET_NFC_BUSY;
@@ -1449,7 +1185,7 @@ static gboolean se_handle_send_apdu(
 
        return TRUE;
 
-ERROR :
+ ERROR:
        if (data != NULL) {
                g_variant_unref(data->data);
 
@@ -1459,15 +1195,14 @@ ERROR :
                g_free(data);
        }
 
-       net_nfc_gdbus_secure_element_complete_send_apdu(object, invocation,
-               result, net_nfc_util_gdbus_buffer_to_variant(NULL, 0));
+       net_nfc_gdbus_secure_element_complete_send_apdu(object, invocation, result, net_nfc_util_gdbus_buffer_to_variant(NULL, 0));
 
        return TRUE;
 }
 
 static void se_set_data_thread_func(gpointer user_data)
 {
-       SeDataSeType *data = (SeDataSeType *)user_data;
+       SeDataSeType *data = (SeDataSeType *) user_data;
        gboolean isTypeChanged = FALSE;
        net_nfc_error_e result = NET_NFC_OPERATION_FAIL;
 
@@ -1484,24 +1219,15 @@ static void se_set_data_thread_func(gpointer user_data)
        pid = net_nfc_server_gdbus_get_pid(name);
 
        if (data->se_type == NET_NFC_SE_TYPE_UICC)
-       {
-               ret = net_nfc_service_check_access_control(pid,
-                       NET_NFC_ACCESS_CONTROL_PLATFORM |
-                       NET_NFC_ACCESS_CONTROL_UICC);
-       }
+               ret = net_nfc_service_check_access_control(pid, NET_NFC_ACCESS_CONTROL_PLATFORM | NET_NFC_ACCESS_CONTROL_UICC);
        else if (data->se_type == NET_NFC_SE_TYPE_ESE)
-       {
-               ret = net_nfc_service_check_access_control(pid,
-                       NET_NFC_ACCESS_CONTROL_PLATFORM |
-                       NET_NFC_ACCESS_CONTROL_ESE);
-       }
+               ret = net_nfc_service_check_access_control(pid, NET_NFC_ACCESS_CONTROL_PLATFORM | NET_NFC_ACCESS_CONTROL_ESE);
        else if (data->se_type == NET_NFC_SE_TYPE_HCE)
-       {
-               /* TODO */
-       }
+               DEBUG_ERR_MSG("se_type is HCE");
+       else
+               DEBUG_ERR_MSG("Unexpected SE");
 
-       if (ret == false)
-       {
+       if (ret == false) {
                DEBUG_ERR_MSG("access control denied");
                result = NET_NFC_SECURITY_FAIL;
 
@@ -1511,18 +1237,15 @@ static void se_set_data_thread_func(gpointer user_data)
        result = net_nfc_server_se_set_se_type(data->se_type);
 
 #ifdef ACCESS_CONTROL
-END :
+ END:
 #endif
        if (result == NET_NFC_OK)
                isTypeChanged = TRUE;
 
-       net_nfc_gdbus_secure_element_complete_set(data->object,
-               data->invocation, result);
+       net_nfc_gdbus_secure_element_complete_set(data->object, data->invocation, result);
 
-       if (isTypeChanged) {
-               net_nfc_gdbus_secure_element_emit_se_type_changed(data->object,
-                       data->se_type);
-       }
+       if (isTypeChanged)
+               net_nfc_gdbus_secure_element_emit_se_type_changed(data->object, data->se_type);
 
        g_object_unref(data->invocation);
        g_object_unref(data->object);
@@ -1530,17 +1253,12 @@ END :
        g_free(data);
 }
 
-static gboolean se_handle_set(
-       NetNfcGDbusSecureElement *object,
-       GDBusMethodInvocation *invocation,
-       gint arg_type,
-       GVariant *smack_privilege)
+static gboolean se_handle_set(NetNfcGDbusSecureElement * object, GDBusMethodInvocation * invocation, gint arg_type, GVariant * smack_privilege)
 {
        SeDataSeType *data = NULL;
        gint result;
 
-       INFO_MSG(">>> REQUEST from [%s]",
-               g_dbus_method_invocation_get_sender(invocation));
+       INFO_MSG(">>> REQUEST from [%s]", g_dbus_method_invocation_get_sender(invocation));
 
        /* check privilege and update client context */
        if (net_nfc_server_gdbus_check_privilege(invocation, NET_NFC_PRIVILEGE_NFC_CARD_EMUL) == false) {
@@ -1551,8 +1269,7 @@ static gboolean se_handle_set(
        }
 
        data = g_try_new0(SeDataSeType, 1);
-       if (data == NULL)
-       {
+       if (data == NULL) {
                DEBUG_ERR_MSG("Memory allocation failed");
                result = NET_NFC_ALLOC_FAIL;
 
@@ -1563,9 +1280,7 @@ static gboolean se_handle_set(
        data->invocation = g_object_ref(invocation);
        data->se_type = arg_type;
 
-       if (net_nfc_server_controller_async_queue_push(
-               se_set_data_thread_func, data) == FALSE)
-       {
+       if (net_nfc_server_controller_async_queue_push(se_set_data_thread_func, data) == FALSE) {
                /* return error if queue was blocked */
                DEBUG_SERVER_MSG("controller is processing important message..");
                result = NET_NFC_BUSY;
@@ -1575,7 +1290,7 @@ static gboolean se_handle_set(
 
        return TRUE;
 
-ERROR :
+ ERROR:
        if (data != NULL) {
                g_object_unref(data->invocation);
                g_object_unref(data->object);
@@ -1590,17 +1305,14 @@ ERROR :
 
 static void se_get_data_thread_func(gpointer user_data)
 {
-       SeDataSeType *data = (SeDataSeType *)user_data;
+       SeDataSeType *data = (SeDataSeType *) user_data;
        net_nfc_error_e result = NET_NFC_OK;
 
        g_assert(data != NULL);
        g_assert(data->object != NULL);
        g_assert(data->invocation != NULL);
 
-       net_nfc_gdbus_secure_element_complete_get(data->object,
-               data->invocation,
-               result,
-               net_nfc_server_se_get_se_type());
+       net_nfc_gdbus_secure_element_complete_get(data->object, data->invocation, result, net_nfc_server_se_get_se_type());
 
        g_object_unref(data->invocation);
        g_object_unref(data->object);
@@ -1608,16 +1320,12 @@ static void se_get_data_thread_func(gpointer user_data)
        g_free(data);
 }
 
-static gboolean se_handle_get(
-       NetNfcGDbusSecureElement *object,
-       GDBusMethodInvocation *invocation,
-       GVariant *smack_privilege)
+static gboolean se_handle_get(NetNfcGDbusSecureElement * object, GDBusMethodInvocation * invocation, GVariant * smack_privilege)
 {
        SeDataSeType *data = NULL;
        gint result;
 
-       INFO_MSG(">>> REQUEST from [%s]",
-               g_dbus_method_invocation_get_sender(invocation));
+       INFO_MSG(">>> REQUEST from [%s]", g_dbus_method_invocation_get_sender(invocation));
 
        /* check privilege and update client context */
        if (net_nfc_server_gdbus_check_privilege(invocation, NET_NFC_PRIVILEGE_NFC_CARD_EMUL) == false) {
@@ -1628,8 +1336,7 @@ static gboolean se_handle_get(
        }
 
        data = g_try_new0(SeDataSeType, 1);
-       if (data == NULL)
-       {
+       if (data == NULL) {
                DEBUG_ERR_MSG("Memory allocation failed");
                result = NET_NFC_ALLOC_FAIL;
 
@@ -1639,9 +1346,7 @@ static gboolean se_handle_get(
        data->object = g_object_ref(object);
        data->invocation = g_object_ref(invocation);
 
-       if (net_nfc_server_controller_async_queue_push(
-               se_get_data_thread_func, data) == FALSE)
-       {
+       if (net_nfc_server_controller_async_queue_push(se_get_data_thread_func, data) == FALSE) {
                /* return error if queue was blocked */
                DEBUG_SERVER_MSG("controller is processing important message..");
                result = NET_NFC_BUSY;
@@ -1651,7 +1356,7 @@ static gboolean se_handle_get(
 
        return TRUE;
 
-ERROR :
+ ERROR:
        if (data != NULL) {
                g_object_unref(data->invocation);
                g_object_unref(data->object);
@@ -1659,15 +1364,14 @@ ERROR :
                g_free(data);
        }
 
-       net_nfc_gdbus_secure_element_complete_get(object, invocation,
-               result, 0);
+       net_nfc_gdbus_secure_element_complete_get(object, invocation, result, 0);
 
        return TRUE;
 }
 
 static void _se_change_card_emulation_mode_thread_func(gpointer user_data)
 {
-       ChangeCardEmulMode *data = (ChangeCardEmulMode *)user_data;
+       ChangeCardEmulMode *data = (ChangeCardEmulMode *) user_data;
        net_nfc_error_e result = NET_NFC_OPERATION_FAIL;
 
        g_assert(data != NULL);
@@ -1686,24 +1390,15 @@ static void _se_change_card_emulation_mode_thread_func(gpointer user_data)
        se_type = net_nfc_server_se_get_se_type();
 
        if (se_type == NET_NFC_SE_TYPE_UICC)
-       {
-               ret = net_nfc_service_check_access_control(pid,
-                       NET_NFC_ACCESS_CONTROL_PLATFORM |
-                       NET_NFC_ACCESS_CONTROL_UICC);
-       }
+               ret = net_nfc_service_check_access_control(pid, NET_NFC_ACCESS_CONTROL_PLATFORM | NET_NFC_ACCESS_CONTROL_UICC);
        else if (se_type == NET_NFC_SE_TYPE_ESE)
-       {
-               ret = net_nfc_service_check_access_control(pid,
-                       NET_NFC_ACCESS_CONTROL_PLATFORM |
-                       NET_NFC_ACCESS_CONTROL_ESE);
-       }
+               ret = net_nfc_service_check_access_control(pid, NET_NFC_ACCESS_CONTROL_PLATFORM | NET_NFC_ACCESS_CONTROL_ESE);
        else if (se_type == NET_NFC_SE_TYPE_HCE)
-       {
-               /* TODO */
-       }
+               DEBUG_ERR_MSG("se type is HCE");
+       else
+               DEBUG_ERR_MSG("Unexpected SE");
 
-       if (ret == false)
-       {
+       if (ret == false) {
                DEBUG_ERR_MSG("access control denied");
                result = NET_NFC_SECURITY_FAIL;
 
@@ -1713,15 +1408,12 @@ static void _se_change_card_emulation_mode_thread_func(gpointer user_data)
        result = net_nfc_server_se_set_se_state(data->mode);
 
 #ifdef ACCESS_CONTROL
-END :
+ END:
 #endif
-       net_nfc_gdbus_secure_element_complete_set_card_emulation(
-               data->object, data->invocation, result);
+       net_nfc_gdbus_secure_element_complete_set_card_emulation(data->object, data->invocation, result);
 
-       if (result == NET_NFC_OK) {
-               net_nfc_gdbus_secure_element_emit_card_emulation_mode_changed(
-                       data->object, data->mode);
-       }
+       if (result == NET_NFC_OK)
+               net_nfc_gdbus_secure_element_emit_card_emulation_mode_changed(data->object, data->mode);
 
        g_object_unref(data->invocation);
        g_object_unref(data->object);
@@ -1729,17 +1421,12 @@ END :
        g_free(data);
 }
 
-static gboolean se_handle_change_card_emulation_mode(
-       NetNfcGDbusSecureElement *object,
-       GDBusMethodInvocation *invocation,
-       gint arg_mode,
-       GVariant *smack_privilege)
+static gboolean se_handle_change_card_emulation_mode(NetNfcGDbusSecureElement * object, GDBusMethodInvocation * invocation, gint arg_mode, GVariant * smack_privilege)
 {
        ChangeCardEmulMode *data = NULL;
        gboolean result;
 
-       INFO_MSG(">>> REQUEST from [%s]",
-               g_dbus_method_invocation_get_sender(invocation));
+       INFO_MSG(">>> REQUEST from [%s]", g_dbus_method_invocation_get_sender(invocation));
 
        /* check privilege and update client context */
        if (net_nfc_server_gdbus_check_privilege(invocation, NET_NFC_PRIVILEGE_NFC_CARD_EMUL) == false) {
@@ -1750,12 +1437,9 @@ static gboolean se_handle_change_card_emulation_mode(
        }
 
        data = g_try_new0(ChangeCardEmulMode, 1);
-       if (data == NULL)
-       {
+       if (data == NULL) {
                DEBUG_ERR_MSG("Memory allocation failed");
-               g_dbus_method_invocation_return_dbus_error(invocation,
-                       "org.tizen.NetNfcService.AllocationError",
-                       "Can not allocate memory");
+               g_dbus_method_invocation_return_dbus_error(invocation, "org.tizen.NetNfcService.AllocationError", "Can not allocate memory");
                result = NET_NFC_ALLOC_FAIL;
 
                goto ERROR;
@@ -1765,10 +1449,8 @@ static gboolean se_handle_change_card_emulation_mode(
        data->invocation = g_object_ref(invocation);
        data->mode = arg_mode;
 
-       result = net_nfc_server_controller_async_queue_push(
-               _se_change_card_emulation_mode_thread_func, data);
-       if (result == FALSE)
-       {
+       result = net_nfc_server_controller_async_queue_push(_se_change_card_emulation_mode_thread_func, data);
+       if (result == FALSE) {
                /* return error if queue was blocked */
                DEBUG_SERVER_MSG("controller is processing important message..");
                result = NET_NFC_BUSY;
@@ -1778,7 +1460,7 @@ static gboolean se_handle_change_card_emulation_mode(
 
        return TRUE;
 
-ERROR :
+ ERROR:
        if (data != NULL) {
                g_object_unref(data->invocation);
                g_object_unref(data->object);
@@ -1786,8 +1468,7 @@ ERROR :
                g_free(data);
        }
 
-       net_nfc_gdbus_secure_element_complete_set_card_emulation(object,
-               invocation, result);
+       net_nfc_gdbus_secure_element_complete_set_card_emulation(object, invocation, result);
 
        return TRUE;
 
@@ -1795,7 +1476,7 @@ ERROR :
 
 static void se_get_secure_element_mode_thread_func(gpointer user_data)
 {
-       SeDataSeType *data = (SeDataSeType *)user_data;
+       SeDataSeType *data = (SeDataSeType *) user_data;
        net_nfc_error_e result = NET_NFC_OK;
        net_nfc_card_emulation_mode_t card_emulation_state;
 
@@ -1805,10 +1486,7 @@ static void se_get_secure_element_mode_thread_func(gpointer user_data)
 
        card_emulation_state = net_nfc_server_se_get_se_state();
 
-       net_nfc_gdbus_secure_element_complete_get_card_emulation(data->object,
-               data->invocation,
-               result,
-               card_emulation_state);
+       net_nfc_gdbus_secure_element_complete_get_card_emulation(data->object, data->invocation, result, card_emulation_state);
 
        g_object_unref(data->invocation);
        g_object_unref(data->object);
@@ -1818,7 +1496,7 @@ static void se_get_secure_element_mode_thread_func(gpointer user_data)
 
 static void se_enable_transaction_fg_dispatch(gpointer user_data)
 {
-       SeDataTransactionFgDispatch *data = (SeDataTransactionFgDispatch *)user_data;
+       SeDataTransactionFgDispatch *data = (SeDataTransactionFgDispatch *) user_data;
        net_nfc_error_e result = NET_NFC_OK;
 
        g_assert(data != NULL);
@@ -1836,56 +1514,38 @@ static void se_enable_transaction_fg_dispatch(gpointer user_data)
        net_nfc_se_type_e se_type = net_nfc_server_se_get_se_type();
 
        if (se_type == NET_NFC_SE_TYPE_UICC)
-       {
-               ret = net_nfc_service_check_access_control(pid,
-                       NET_NFC_ACCESS_CONTROL_PLATFORM |
-                       NET_NFC_ACCESS_CONTROL_UICC);
-       }
+               ret = net_nfc_service_check_access_control(pid, NET_NFC_ACCESS_CONTROL_PLATFORM | NET_NFC_ACCESS_CONTROL_UICC);
        else if (se_type == NET_NFC_SE_TYPE_ESE)
-       {
-               ret = net_nfc_service_check_access_control(pid,
-                       NET_NFC_ACCESS_CONTROL_PLATFORM |
-                       NET_NFC_ACCESS_CONTROL_ESE);
-       }
+               ret = net_nfc_service_check_access_control(pid, NET_NFC_ACCESS_CONTROL_PLATFORM | NET_NFC_ACCESS_CONTROL_ESE);
        else if (se_type == NET_NFC_SE_TYPE_HCE)
-       {
-               /* TODO */
-       }
+               DEBUG_ERR_MSG("se_type is HCE");
+       else
+               DEBUG_ERR_MSG("Unexpected SE");
 
-       if (ret == false)
-       {
+       if (ret == false) {
                DEBUG_ERR_MSG("access control denied");
                result = NET_NFC_SECURITY_FAIL;
 
                goto END;
        }
 #endif
-       result = net_nfc_server_gdbus_set_transaction_fg_dispatch(
-               g_dbus_method_invocation_get_sender(data->invocation),
-               data->FgDispatch);
+       result = net_nfc_server_gdbus_set_transaction_fg_dispatch(g_dbus_method_invocation_get_sender(data->invocation), data->FgDispatch);
 #ifdef ACCESS_CONTROL
-END :
+ END:
 #endif
-       net_nfc_gdbus_secure_element_complete_set_transaction_fg_dispatch (
-               data->object,
-               data->invocation,
-               result);
+       net_nfc_gdbus_secure_element_complete_set_transaction_fg_dispatch(data->object, data->invocation, result);
 
        g_object_unref(data->invocation);
        g_object_unref(data->object);
        g_free(data);
 }
 
-static gboolean se_handle_get_card_emulation_mode(
-       NetNfcGDbusSecureElement *object,
-       GDBusMethodInvocation *invocation,
-       GVariant *smack_privilege)
+static gboolean se_handle_get_card_emulation_mode(NetNfcGDbusSecureElement * object, GDBusMethodInvocation * invocation, GVariant * smack_privilege)
 {
        SeDataSeType *data = NULL;
        gint result;
 
-       INFO_MSG(">>> REQUEST from [%s]",
-               g_dbus_method_invocation_get_sender(invocation));
+       INFO_MSG(">>> REQUEST from [%s]", g_dbus_method_invocation_get_sender(invocation));
 
        /* check privilege and update client context */
        if (net_nfc_server_gdbus_check_privilege(invocation, NET_NFC_PRIVILEGE_NFC_CARD_EMUL) == false) {
@@ -1896,8 +1556,7 @@ static gboolean se_handle_get_card_emulation_mode(
        }
 
        data = g_try_new0(SeDataSeType, 1);
-       if (data == NULL)
-       {
+       if (data == NULL) {
                DEBUG_ERR_MSG("Memory allocation failed");
                result = NET_NFC_ALLOC_FAIL;
 
@@ -1907,9 +1566,7 @@ static gboolean se_handle_get_card_emulation_mode(
        data->object = g_object_ref(object);
        data->invocation = g_object_ref(invocation);
 
-       if (net_nfc_server_controller_async_queue_push(
-               se_get_secure_element_mode_thread_func, data) == FALSE)
-       {
+       if (net_nfc_server_controller_async_queue_push(se_get_secure_element_mode_thread_func, data) == FALSE) {
                /* return error if queue was blocked */
                DEBUG_SERVER_MSG("controller is processing important message..");
                result = NET_NFC_BUSY;
@@ -1919,7 +1576,7 @@ static gboolean se_handle_get_card_emulation_mode(
 
        return TRUE;
 
-ERROR :
+ ERROR:
        if (data != NULL) {
                g_object_unref(data->invocation);
                g_object_unref(data->object);
@@ -1927,23 +1584,17 @@ ERROR :
                g_free(data);
        }
 
-       net_nfc_gdbus_secure_element_complete_get_card_emulation(object, invocation,
-               result, 0);
+       net_nfc_gdbus_secure_element_complete_get_card_emulation(object, invocation, result, 0);
 
        return TRUE;
 }
 
-static gboolean se_handle_set_transaction_fg_dispatch(
-       NetNfcGDbusSecureElement *object,
-       GDBusMethodInvocation *invocation,
-       gint arg_mode,
-       GVariant *smack_privilege)
+static gboolean se_handle_set_transaction_fg_dispatch(NetNfcGDbusSecureElement * object, GDBusMethodInvocation * invocation, gint arg_mode, GVariant * smack_privilege)
 {
        SeDataTransactionFgDispatch *data = NULL;
        gint result;
 
-       INFO_MSG(">>> REQUEST from [%s]",
-               g_dbus_method_invocation_get_sender(invocation));
+       INFO_MSG(">>> REQUEST from [%s]", g_dbus_method_invocation_get_sender(invocation));
 
        /* check privilege and update client context */
        if (net_nfc_server_gdbus_check_privilege(invocation, NET_NFC_PRIVILEGE_NFC_CARD_EMUL) == false) {
@@ -1954,8 +1605,7 @@ static gboolean se_handle_set_transaction_fg_dispatch(
        }
 
        data = g_try_new0(SeDataTransactionFgDispatch, 1);
-       if (data == NULL)
-       {
+       if (data == NULL) {
                DEBUG_ERR_MSG("Memory allocation failed");
                result = NET_NFC_ALLOC_FAIL;
 
@@ -1964,11 +1614,9 @@ static gboolean se_handle_set_transaction_fg_dispatch(
 
        data->object = g_object_ref(object);
        data->invocation = g_object_ref(invocation);
-       data->FgDispatch= arg_mode;
+       data->FgDispatch = arg_mode;
 
-       if (net_nfc_server_controller_async_queue_push(
-               se_enable_transaction_fg_dispatch, data) == FALSE)
-       {
+       if (net_nfc_server_controller_async_queue_push(se_enable_transaction_fg_dispatch, data) == FALSE) {
                /* return error if queue was blocked */
                DEBUG_SERVER_MSG("controller is processing important message..");
                result = NET_NFC_BUSY;
@@ -1978,7 +1626,7 @@ static gboolean se_handle_set_transaction_fg_dispatch(
 
        return TRUE;
 
-ERROR :
+ ERROR:
        if (data != NULL) {
                g_object_unref(data->invocation);
                g_object_unref(data->object);
@@ -1986,15 +1634,14 @@ ERROR :
                g_free(data);
        }
 
-       net_nfc_gdbus_secure_element_complete_get_card_emulation(object, invocation,
-               result, 0);
+       net_nfc_gdbus_secure_element_complete_get_card_emulation(object, invocation, result, 0);
 
        return TRUE;
 }
 
 static void se_check_transaction_permission(gpointer user_data)
 {
-       SeDataApdu *data = (SeDataApdu *)user_data;
+       SeDataApdu *data = (SeDataApdu *) user_data;
        net_nfc_error_e result;
 
        g_assert(data != NULL);
@@ -2003,10 +1650,7 @@ static void se_check_transaction_permission(gpointer user_data)
 
        result = NET_NFC_OK;
 
-       net_nfc_gdbus_secure_element_complete_check_transaction_permission(
-               data->object,
-               data->invocation,
-               result);
+       net_nfc_gdbus_secure_element_complete_check_transaction_permission(data->object, data->invocation, result);
 
        g_variant_unref(data->data);
        g_object_unref(data->invocation);
@@ -2015,17 +1659,12 @@ static void se_check_transaction_permission(gpointer user_data)
        g_free(data);
 }
 
-static gboolean se_handle_check_transaction_permission(
-       NetNfcGDbusSecureElement *object,
-       GDBusMethodInvocation *invocation,
-       GVariant *arg_aid,
-       GVariant *smack_privilege)
+static gboolean se_handle_check_transaction_permission(NetNfcGDbusSecureElement * object, GDBusMethodInvocation * invocation, GVariant * arg_aid, GVariant * smack_privilege)
 {
        SeDataApdu *data = NULL;
        gint result;
 
-       INFO_MSG(">>> REQUEST from [%s]",
-               g_dbus_method_invocation_get_sender(invocation));
+       INFO_MSG(">>> REQUEST from [%s]", g_dbus_method_invocation_get_sender(invocation));
 
        /* check privilege and update client context */
        if (net_nfc_server_gdbus_check_privilege(invocation, NET_NFC_PRIVILEGE_NFC_CARD_EMUL) == false) {
@@ -2036,8 +1675,7 @@ static gboolean se_handle_check_transaction_permission(
        }
 
        data = g_try_new0(SeDataApdu, 1);
-       if (data == NULL)
-       {
+       if (data == NULL) {
                DEBUG_ERR_MSG("Memory allocation failed");
                result = NET_NFC_ALLOC_FAIL;
 
@@ -2048,9 +1686,7 @@ static gboolean se_handle_check_transaction_permission(
        data->invocation = g_object_ref(invocation);
        data->data = g_variant_ref(arg_aid);
 
-       if (net_nfc_server_controller_async_queue_push(
-               se_check_transaction_permission, data) == FALSE)
-       {
+       if (net_nfc_server_controller_async_queue_push(se_check_transaction_permission, data) == FALSE) {
                /* return error if queue was blocked */
                DEBUG_SERVER_MSG("controller is processing important message..");
                result = NET_NFC_BUSY;
@@ -2060,7 +1696,7 @@ static gboolean se_handle_check_transaction_permission(
 
        return TRUE;
 
-ERROR :
+ ERROR:
        if (data != NULL) {
                g_object_unref(data->data);
                g_object_unref(data->invocation);
@@ -2069,8 +1705,7 @@ ERROR :
                g_free(data);
        }
 
-       net_nfc_gdbus_secure_element_complete_check_transaction_permission(
-               object, invocation, result);
+       net_nfc_gdbus_secure_element_complete_check_transaction_permission(object, invocation, result);
 
        return TRUE;
 }
@@ -2079,7 +1714,7 @@ ERROR :
 
 static void se_set_default_route_thread_func(gpointer user_data)
 {
-       SeDefaultRoute *detail = (SeDefaultRoute *)user_data;
+       SeDefaultRoute *detail = (SeDefaultRoute *) user_data;
        net_nfc_error_e result = NET_NFC_OK;
 
        g_assert(detail != NULL);
@@ -2096,10 +1731,8 @@ static void se_set_default_route_thread_func(gpointer user_data)
        name = g_dbus_method_invocation_get_sender(detail->invocation);
        pid = net_nfc_server_gdbus_get_pid(name);
 
-       ret = net_nfc_service_check_access_control(pid,
-               NET_NFC_ACCESS_CONTROL_PLATFORM);
-       if (ret == false)
-       {
+       ret = net_nfc_service_check_access_control(pid, NET_NFC_ACCESS_CONTROL_PLATFORM);
+       if (ret == false) {
                DEBUG_ERR_MSG("access control denied");
                result = NET_NFC_SECURITY_FAIL;
 
@@ -2107,16 +1740,12 @@ static void se_set_default_route_thread_func(gpointer user_data)
        }
 #endif
 
-       net_nfc_controller_secure_element_set_default_route(detail->switch_on,
-               detail->switch_off, detail->battery_off, &result);
+       net_nfc_controller_secure_element_set_default_route(detail->switch_on, detail->switch_off, detail->battery_off, &result);
 
 #ifdef ACCESS_CONTROL
-END :
+ END:
 #endif
-       net_nfc_gdbus_secure_element_complete_set_default_route(
-               detail->object,
-               detail->invocation,
-               result);
+       net_nfc_gdbus_secure_element_complete_set_default_route(detail->object, detail->invocation, result);
 
        g_object_unref(detail->invocation);
        g_object_unref(detail->object);
@@ -2124,19 +1753,12 @@ END :
        g_free(detail);
 }
 
-static gboolean se_handle_set_default_route(
-       NetNfcGDbusSecureElement *object,
-       GDBusMethodInvocation *invocation,
-       guint switch_on,
-       guint switch_off,
-       guint battery_off,
-       GVariant *smack_privilege)
+static gboolean se_handle_set_default_route(NetNfcGDbusSecureElement * object, GDBusMethodInvocation * invocation, guint switch_on, guint switch_off, guint battery_off, GVariant * smack_privilege)
 {
        SeDefaultRoute *data = NULL;
        gint result;
 
-       INFO_MSG(">>> REQUEST from [%s]",
-               g_dbus_method_invocation_get_sender(invocation));
+       INFO_MSG(">>> REQUEST from [%s]", g_dbus_method_invocation_get_sender(invocation));
 
        /* check privilege and update client context */
        if (net_nfc_server_gdbus_check_privilege(invocation, NET_NFC_PRIVILEGE_NFC_CARD_EMUL) == false) {
@@ -2147,8 +1769,7 @@ static gboolean se_handle_set_default_route(
        }
 
        data = g_try_new0(SeDefaultRoute, 1);
-       if (data == NULL)
-       {
+       if (data == NULL) {
                DEBUG_ERR_MSG("Memory allocation failed");
                result = NET_NFC_ALLOC_FAIL;
 
@@ -2161,9 +1782,7 @@ static gboolean se_handle_set_default_route(
        data->switch_off = switch_off;
        data->battery_off = battery_off;
 
-       if (net_nfc_server_controller_async_queue_push_force(
-               se_set_default_route_thread_func, data) == FALSE)
-       {
+       if (net_nfc_server_controller_async_queue_push_force(se_set_default_route_thread_func, data) == FALSE) {
                /* return error if queue was blocked */
                DEBUG_SERVER_MSG("controller is processing important message..");
                result = NET_NFC_BUSY;
@@ -2173,7 +1792,7 @@ static gboolean se_handle_set_default_route(
 
        return TRUE;
 
-ERROR :
+ ERROR:
        if (data != NULL) {
                g_object_unref(data->invocation);
                g_object_unref(data->object);
@@ -2181,17 +1800,14 @@ ERROR :
                g_free(data);
        }
 
-       net_nfc_gdbus_secure_element_complete_set_default_route(
-               object, invocation, result);
+       net_nfc_gdbus_secure_element_complete_set_default_route(object, invocation, result);
 
        return TRUE;
 }
 
-
-
 static void se_is_activated_aid_handler_thread_func(gpointer user_data)
 {
-       SeDataAid *data = (SeDataAid *)user_data;
+       SeDataAid *data = (SeDataAid *) user_data;
        net_nfc_error_e result = NET_NFC_OK;
        route_table_handler_t *handler;
        gboolean activated = false;
@@ -2211,7 +1827,7 @@ static void se_is_activated_aid_handler_thread_func(gpointer user_data)
                aid_info_t *info;
 
                for (i = 0; i < handler->aids[0]->len; i++) {
-                       info = (aid_info_t *)handler->aids[0]->pdata[i];
+                       info = (aid_info_t *) handler->aids[0]->pdata[i];
 
                        if (g_ascii_strcasecmp(info->aid, data->aid) == 0) {
                                activated = handler->activated[info->category];
@@ -2219,17 +1835,15 @@ static void se_is_activated_aid_handler_thread_func(gpointer user_data)
                        }
                }
 
-               if (i < handler->aids[0]->len) {
+               if (i < handler->aids[0]->len)
                        result = NET_NFC_OK;
-               } else {
+               else
                        result = NET_NFC_NO_DATA_FOUND;
-               }
        } else {
                result = NET_NFC_NO_DATA_FOUND;
        }
 
-       net_nfc_gdbus_secure_element_complete_is_activated_aid_handler(
-               data->object, data->invocation, result, activated);
+       net_nfc_gdbus_secure_element_complete_is_activated_aid_handler(data->object, data->invocation, result, activated);
 
        g_free(data->aid);
 
@@ -2239,18 +1853,12 @@ static void se_is_activated_aid_handler_thread_func(gpointer user_data)
        g_free(data);
 }
 
-static gboolean se_handle_is_activated_aid_handler(
-       NetNfcGDbusSecureElement *object,
-       GDBusMethodInvocation *invocation,
-       guint se_type,
-       const gchar *aid,
-       GVariant *smack_privilege)
+static gboolean se_handle_is_activated_aid_handler(NetNfcGDbusSecureElement * object, GDBusMethodInvocation * invocation, guint se_type, const gchar * aid, GVariant * smack_privilege)
 {
        SeDataAid *data = NULL;
        gint result;
 
-       INFO_MSG(">>> REQUEST from [%s]",
-               g_dbus_method_invocation_get_sender(invocation));
+       INFO_MSG(">>> REQUEST from [%s]", g_dbus_method_invocation_get_sender(invocation));
 
        /* check privilege and update client context */
        if (net_nfc_server_gdbus_check_privilege(invocation, NET_NFC_PRIVILEGE_NFC_CARD_EMUL) == false) {
@@ -2261,8 +1869,7 @@ static gboolean se_handle_is_activated_aid_handler(
        }
 
        data = g_try_new0(SeDataAid, 1);
-       if (data == NULL)
-       {
+       if (data == NULL) {
                DEBUG_ERR_MSG("Memory allocation failed");
                result = NET_NFC_ALLOC_FAIL;
 
@@ -2274,9 +1881,7 @@ static gboolean se_handle_is_activated_aid_handler(
        data->se_type = se_type;
        data->aid = g_strdup(aid);
 
-       if (net_nfc_server_controller_async_queue_push_force(
-               se_is_activated_aid_handler_thread_func, data) == FALSE)
-       {
+       if (net_nfc_server_controller_async_queue_push_force(se_is_activated_aid_handler_thread_func, data) == FALSE) {
                /* return error if queue was blocked */
                DEBUG_SERVER_MSG("controller is processing important message..");
                result = NET_NFC_BUSY;
@@ -2286,7 +1891,7 @@ static gboolean se_handle_is_activated_aid_handler(
 
        return TRUE;
 
-ERROR :
+ ERROR:
        if (data != NULL) {
                g_free(data->aid);
 
@@ -2296,15 +1901,14 @@ ERROR :
                g_free(data);
        }
 
-       net_nfc_gdbus_secure_element_complete_is_activated_aid_handler(
-               object, invocation, result, false);
+       net_nfc_gdbus_secure_element_complete_is_activated_aid_handler(object, invocation, result, false);
 
        return TRUE;
 }
 
 static void se_is_activated_category_handler_thread_func(gpointer user_data)
 {
-       SeDataAid *data = (SeDataAid *)user_data;
+       SeDataAid *data = (SeDataAid *) user_data;
        net_nfc_error_e result;
        route_table_handler_t *handler;
        gboolean activated = false;
@@ -2326,8 +1930,7 @@ static void se_is_activated_category_handler_thread_func(gpointer user_data)
                result = NET_NFC_NO_DATA_FOUND;
        }
 
-       net_nfc_gdbus_secure_element_complete_is_activated_category_handler(
-               data->object, data->invocation, result, activated);
+       net_nfc_gdbus_secure_element_complete_is_activated_category_handler(data->object, data->invocation, result, activated);
 
        g_free(data->aid);
 
@@ -2337,18 +1940,12 @@ static void se_is_activated_category_handler_thread_func(gpointer user_data)
        g_free(data);
 }
 
-static gboolean se_handle_is_activated_category_handler(
-       NetNfcGDbusSecureElement *object,
-       GDBusMethodInvocation *invocation,
-       guint se_type,
-       guint category,
-       GVariant *smack_privilege)
+static gboolean se_handle_is_activated_category_handler(NetNfcGDbusSecureElement * object, GDBusMethodInvocation * invocation, guint se_type, guint category, GVariant * smack_privilege)
 {
        SeDataAid *data = NULL;
        gint result;
 
-       INFO_MSG(">>> REQUEST from [%s]",
-               g_dbus_method_invocation_get_sender(invocation));
+       INFO_MSG(">>> REQUEST from [%s]", g_dbus_method_invocation_get_sender(invocation));
 
        /* check privilege and update client context */
        if (net_nfc_server_gdbus_check_privilege(invocation, NET_NFC_PRIVILEGE_NFC_CARD_EMUL) == false) {
@@ -2359,8 +1956,7 @@ static gboolean se_handle_is_activated_category_handler(
        }
 
        data = g_try_new0(SeDataAid, 1);
-       if (data == NULL)
-       {
+       if (data == NULL) {
                DEBUG_ERR_MSG("Memory allocation failed");
                result = NET_NFC_ALLOC_FAIL;
 
@@ -2372,9 +1968,7 @@ static gboolean se_handle_is_activated_category_handler(
        data->se_type = se_type;
        data->category = category;
 
-       if (net_nfc_server_controller_async_queue_push_force(
-               se_is_activated_category_handler_thread_func, data) == FALSE)
-       {
+       if (net_nfc_server_controller_async_queue_push_force(se_is_activated_category_handler_thread_func, data) == FALSE) {
                /* return error if queue was blocked */
                DEBUG_SERVER_MSG("controller is processing important message..");
                result = NET_NFC_BUSY;
@@ -2384,7 +1978,7 @@ static gboolean se_handle_is_activated_category_handler(
 
        return TRUE;
 
-ERROR :
+ ERROR:
        if (data != NULL) {
                g_object_unref(data->invocation);
                g_object_unref(data->object);
@@ -2392,28 +1986,24 @@ ERROR :
                g_free(data);
        }
 
-       net_nfc_gdbus_secure_element_complete_is_activated_category_handler(
-               object, invocation, result, false);
+       net_nfc_gdbus_secure_element_complete_is_activated_category_handler(object, invocation, result, false);
 
        return TRUE;
 }
 
-static bool __get_aids_iter_cb(const char *package,
-       route_table_handler_t *handler, aid_info_t *aid, void *user_data)
+static bool __get_aids_iter_cb(const char *package, route_table_handler_t * handler, aid_info_t * aid, void *user_data)
 {
-       gpointer* params = (gpointer *)user_data;
+       gpointer *params = (gpointer *) user_data;
 
-       if (aid->category == (net_nfc_card_emulation_category_t)params[0] && aid->se_type == (net_nfc_se_type_e)params[1]) {
-               g_variant_builder_add((GVariantBuilder *)params[2],
-                       "(sb)", aid->aid, (gboolean)aid->manifest);
-       }
+       if (aid->category == (net_nfc_card_emulation_category_t) params[0] && aid->se_type == (net_nfc_se_type_e) params[1])
+               g_variant_builder_add((GVariantBuilder *) params[2], "(sb)", aid->aid, (gboolean) aid->manifest);
 
        return true;
 }
 
 static void se_get_registered_aids_thread_func(gpointer user_data)
 {
-       SeDataAid *data = (SeDataAid *)user_data;
+       SeDataAid *data = (SeDataAid *) user_data;
        net_nfc_error_e result = NET_NFC_OK;
        const char *id;
        GVariantBuilder builder;
@@ -2430,17 +2020,15 @@ static void se_get_registered_aids_thread_func(gpointer user_data)
 
        g_variant_builder_init(&builder, G_VARIANT_TYPE("a(sb)"));
 
-       params[0] = (gpointer)data->category;
-       params[1] = (gpointer)data->se_type;
+       params[0] = (gpointer) data->category;
+       params[1] = (gpointer) data->se_type;
        params[2] = &builder;
 
-       net_nfc_server_route_table_iterate_aids_by_id(id, __get_aids_iter_cb,
-               params);
+       net_nfc_server_route_table_iterate_aids_by_id(id, __get_aids_iter_cb, params);
 
        aids = g_variant_builder_end(&builder);
 
-       net_nfc_gdbus_secure_element_complete_get_registered_aids(
-               data->object, data->invocation, result, aids);
+       net_nfc_gdbus_secure_element_complete_get_registered_aids(data->object, data->invocation, result, aids);
 
        g_object_unref(data->invocation);
        g_object_unref(data->object);
@@ -2448,18 +2036,12 @@ static void se_get_registered_aids_thread_func(gpointer user_data)
        g_free(data);
 }
 
-static gboolean se_handle_get_registered_aids(
-       NetNfcGDbusSecureElement *object,
-       GDBusMethodInvocation *invocation,
-       guint se_type,
-       guint category,
-       GVariant *smack_privilege)
+static gboolean se_handle_get_registered_aids(NetNfcGDbusSecureElement * object, GDBusMethodInvocation * invocation, guint se_type, guint category, GVariant * smack_privilege)
 {
        SeDataAid *data = NULL;
        gint result;
 
-       INFO_MSG(">>> REQUEST from [%s]",
-               g_dbus_method_invocation_get_sender(invocation));
+       INFO_MSG(">>> REQUEST from [%s]", g_dbus_method_invocation_get_sender(invocation));
 
        /* check privilege and update client context */
        if (net_nfc_server_gdbus_check_privilege(invocation, NET_NFC_PRIVILEGE_NFC_CARD_EMUL) == false) {
@@ -2470,8 +2052,7 @@ static gboolean se_handle_get_registered_aids(
        }
 
        data = g_try_new0(SeDataAid, 1);
-       if (data == NULL)
-       {
+       if (data == NULL) {
                DEBUG_ERR_MSG("Memory allocation failed");
                result = NET_NFC_ALLOC_FAIL;
 
@@ -2483,9 +2064,7 @@ static gboolean se_handle_get_registered_aids(
        data->se_type = se_type;
        data->category = category;
 
-       if (net_nfc_server_controller_async_queue_push_force(
-               se_get_registered_aids_thread_func, data) == FALSE)
-       {
+       if (net_nfc_server_controller_async_queue_push_force(se_get_registered_aids_thread_func, data) == FALSE) {
                /* return error if queue was blocked */
                DEBUG_SERVER_MSG("controller is processing important message..");
                result = NET_NFC_BUSY;
@@ -2495,7 +2074,7 @@ static gboolean se_handle_get_registered_aids(
 
        return TRUE;
 
-ERROR :
+ ERROR:
        if (data != NULL) {
                g_object_unref(data->invocation);
                g_object_unref(data->object);
@@ -2509,15 +2088,14 @@ ERROR :
        g_variant_builder_init(&builder, G_VARIANT_TYPE("a(sb)"));
        aids = g_variant_builder_end(&builder);
 
-       net_nfc_gdbus_secure_element_complete_get_registered_aids(
-               object, invocation, result, aids);
+       net_nfc_gdbus_secure_element_complete_get_registered_aids(object, invocation, result, aids);
 
        return TRUE;
 }
 
 static void se_register_aid_thread_func(gpointer user_data)
 {
-       SeDataAid *data = (SeDataAid *)user_data;
+       SeDataAid *data = (SeDataAid *) user_data;
        net_nfc_error_e result = NET_NFC_OK;
        route_table_handler_t *handler;
        const char *id;
@@ -2535,18 +2113,14 @@ static void se_register_aid_thread_func(gpointer user_data)
        handler = net_nfc_server_route_table_find_handler_by_id(id);
        if (handler == NULL) {
                result = net_nfc_server_route_table_add_handler_by_id(id);
-               if (result == NET_NFC_OK) {
+               if (result == NET_NFC_OK)
                        handler = net_nfc_server_route_table_find_handler_by_id(id);
-               }
        }
 
-       if (handler != NULL) {
-               result = net_nfc_server_route_table_add_aid_by_id(id,
-                       data->se_type, data->category, data->aid);
-       }
+       if (handler != NULL)
+               result = net_nfc_server_route_table_add_aid_by_id(id, data->se_type, data->category, data->aid);
 
-       net_nfc_gdbus_secure_element_complete_register_aid(
-               data->object, data->invocation, result);
+       net_nfc_gdbus_secure_element_complete_register_aid(data->object, data->invocation, result);
 
        g_free(data->aid);
 
@@ -2556,19 +2130,12 @@ static void se_register_aid_thread_func(gpointer user_data)
        g_free(data);
 }
 
-static gboolean se_handle_register_aid(
-       NetNfcGDbusSecureElement *object,
-       GDBusMethodInvocation *invocation,
-       guint se_type,
-       guint category,
-       const gchar *aid,
-       GVariant *smack_privilege)
+static gboolean se_handle_register_aid(NetNfcGDbusSecureElement * object, GDBusMethodInvocation * invocation, guint se_type, guint category, const gchar * aid, GVariant * smack_privilege)
 {
        SeDataAid *data = NULL;
        gint result;
 
-       INFO_MSG(">>> REQUEST from [%s]",
-               g_dbus_method_invocation_get_sender(invocation));
+       INFO_MSG(">>> REQUEST from [%s]", g_dbus_method_invocation_get_sender(invocation));
 
        /* check privilege and update client context */
        if (net_nfc_server_gdbus_check_privilege(invocation, NET_NFC_PRIVILEGE_NFC_CARD_EMUL) == false) {
@@ -2579,8 +2146,7 @@ static gboolean se_handle_register_aid(
        }
 
        data = g_try_new0(SeDataAid, 1);
-       if (data == NULL)
-       {
+       if (data == NULL) {
                DEBUG_ERR_MSG("Memory allocation failed");
                result = NET_NFC_ALLOC_FAIL;
 
@@ -2593,9 +2159,7 @@ static gboolean se_handle_register_aid(
        data->category = category;
        data->aid = g_strdup(aid);
 
-       if (net_nfc_server_controller_async_queue_push_force(
-               se_register_aid_thread_func, data) == FALSE)
-       {
+       if (net_nfc_server_controller_async_queue_push_force(se_register_aid_thread_func, data) == FALSE) {
                /* return error if queue was blocked */
                DEBUG_SERVER_MSG("controller is processing important message..");
                result = NET_NFC_BUSY;
@@ -2605,7 +2169,7 @@ static gboolean se_handle_register_aid(
 
        return TRUE;
 
-ERROR :
+ ERROR:
        if (data != NULL) {
                g_free(data->aid);
 
@@ -2615,15 +2179,14 @@ ERROR :
                g_free(data);
        }
 
-       net_nfc_gdbus_secure_element_complete_register_aid(
-               object, invocation, result);
+       net_nfc_gdbus_secure_element_complete_register_aid(object, invocation, result);
 
        return TRUE;
 }
 
 static void se_unregister_aid_thread_func(gpointer user_data)
 {
-       SeDataAid *data = (SeDataAid *)user_data;
+       SeDataAid *data = (SeDataAid *) user_data;
        net_nfc_error_e result = NET_NFC_OK;
        route_table_handler_t *handler;
        const char *id;
@@ -2645,8 +2208,7 @@ static void se_unregister_aid_thread_func(gpointer user_data)
                result = NET_NFC_NO_DATA_FOUND;
        }
 
-       net_nfc_gdbus_secure_element_complete_unregister_aid(
-               data->object, data->invocation, result);
+       net_nfc_gdbus_secure_element_complete_unregister_aid(data->object, data->invocation, result);
 
        g_free(data->aid);
 
@@ -2656,19 +2218,12 @@ static void se_unregister_aid_thread_func(gpointer user_data)
        g_free(data);
 }
 
-static gboolean se_handle_unregister_aid(
-       NetNfcGDbusSecureElement *object,
-       GDBusMethodInvocation *invocation,
-       guint se_type,
-       guint category,
-       const gchar *aid,
-       GVariant *smack_privilege)
+static gboolean se_handle_unregister_aid(NetNfcGDbusSecureElement * object, GDBusMethodInvocation * invocation, guint se_type, guint category, const gchar * aid, GVariant * smack_privilege)
 {
        SeDataAid *data = NULL;
        gint result;
 
-       INFO_MSG(">>> REQUEST from [%s]",
-               g_dbus_method_invocation_get_sender(invocation));
+       INFO_MSG(">>> REQUEST from [%s]", g_dbus_method_invocation_get_sender(invocation));
 
        /* check privilege and update client context */
        if (net_nfc_server_gdbus_check_privilege(invocation, NET_NFC_PRIVILEGE_NFC_CARD_EMUL) == false) {
@@ -2679,8 +2234,7 @@ static gboolean se_handle_unregister_aid(
        }
 
        data = g_try_new0(SeDataAid, 1);
-       if (data == NULL)
-       {
+       if (data == NULL) {
                DEBUG_ERR_MSG("Memory allocation failed");
                result = NET_NFC_ALLOC_FAIL;
 
@@ -2693,9 +2247,7 @@ static gboolean se_handle_unregister_aid(
        data->category = category;
        data->aid = g_strdup(aid);
 
-       if (net_nfc_server_controller_async_queue_push_force(
-               se_unregister_aid_thread_func, data) == FALSE)
-       {
+       if (net_nfc_server_controller_async_queue_push_force(se_unregister_aid_thread_func, data) == FALSE) {
                /* return error if queue was blocked */
                DEBUG_SERVER_MSG("controller is processing important message..");
                result = NET_NFC_BUSY;
@@ -2705,7 +2257,7 @@ static gboolean se_handle_unregister_aid(
 
        return TRUE;
 
-ERROR :
+ ERROR:
        if (data != NULL) {
                g_free(data->aid);
 
@@ -2715,15 +2267,14 @@ ERROR :
                g_free(data);
        }
 
-       net_nfc_gdbus_secure_element_complete_unregister_aid(
-               object, invocation, result);
+       net_nfc_gdbus_secure_element_complete_unregister_aid(object, invocation, result);
 
        return TRUE;
 }
 
 static void se_unregister_aids_thread_func(gpointer user_data)
 {
-       SeDataAid *data = (SeDataAid *)user_data;
+       SeDataAid *data = (SeDataAid *) user_data;
        net_nfc_error_e result = NET_NFC_OK;
        route_table_handler_t *handler;
        const char *id;
@@ -2737,15 +2288,12 @@ static void se_unregister_aids_thread_func(gpointer user_data)
        id = g_dbus_method_invocation_get_sender(data->invocation);
 
        handler = net_nfc_server_route_table_find_handler_by_id(id);
-       if (handler != NULL) {
-               result = net_nfc_server_route_table_del_aids(id,
-                       handler->package, false);
-       } else {
+       if (handler != NULL)
+               result = net_nfc_server_route_table_del_aids(id, handler->package, false);
+       else
                result = NET_NFC_NO_DATA_FOUND;
-       }
 
-       net_nfc_gdbus_secure_element_complete_unregister_aids(
-               data->object, data->invocation, result);
+       net_nfc_gdbus_secure_element_complete_unregister_aids(data->object, data->invocation, result);
 
        g_object_unref(data->invocation);
        g_object_unref(data->object);
@@ -2753,18 +2301,12 @@ static void se_unregister_aids_thread_func(gpointer user_data)
        g_free(data);
 }
 
-static gboolean se_handle_unregister_aids(
-       NetNfcGDbusSecureElement *object,
-       GDBusMethodInvocation *invocation,
-       guint se_type,
-       guint category,
-       GVariant *smack_privilege)
+static gboolean se_handle_unregister_aids(NetNfcGDbusSecureElement * object, GDBusMethodInvocation * invocation, guint se_type, guint category, GVariant * smack_privilege)
 {
        SeDataAid *data = NULL;
        gint result;
 
-       INFO_MSG(">>> REQUEST from [%s]",
-               g_dbus_method_invocation_get_sender(invocation));
+       INFO_MSG(">>> REQUEST from [%s]", g_dbus_method_invocation_get_sender(invocation));
 
        /* check privilege and update client context */
        if (net_nfc_server_gdbus_check_privilege(invocation, NET_NFC_PRIVILEGE_NFC_CARD_EMUL) == false) {
@@ -2775,8 +2317,7 @@ static gboolean se_handle_unregister_aids(
        }
 
        data = g_try_new0(SeDataAid, 1);
-       if (data == NULL)
-       {
+       if (data == NULL) {
                DEBUG_ERR_MSG("Memory allocation failed");
                result = NET_NFC_ALLOC_FAIL;
 
@@ -2788,9 +2329,7 @@ static gboolean se_handle_unregister_aids(
        data->se_type = se_type;
        data->category = category;
 
-       if (net_nfc_server_controller_async_queue_push_force(
-               se_unregister_aids_thread_func, data) == FALSE)
-       {
+       if (net_nfc_server_controller_async_queue_push_force(se_unregister_aids_thread_func, data) == FALSE) {
                /* return error if queue was blocked */
                DEBUG_SERVER_MSG("controller is processing important message..");
                result = NET_NFC_BUSY;
@@ -2800,7 +2339,7 @@ static gboolean se_handle_unregister_aids(
 
        return TRUE;
 
-ERROR :
+ ERROR:
        if (data != NULL) {
                g_object_unref(data->invocation);
                g_object_unref(data->object);
@@ -2808,15 +2347,14 @@ ERROR :
                g_free(data);
        }
 
-       net_nfc_gdbus_secure_element_complete_unregister_aids(
-               object, invocation, result);
+       net_nfc_gdbus_secure_element_complete_unregister_aids(object, invocation, result);
 
        return TRUE;
 }
 
 static void se_add_route_aid_thread_func(gpointer user_data)
 {
-       SeDataAid *detail = (SeDataAid *)user_data;
+       SeDataAid *detail = (SeDataAid *) user_data;
        net_nfc_error_e result = NET_NFC_OK;
 
        g_assert(detail != NULL);
@@ -2825,12 +2363,9 @@ static void se_add_route_aid_thread_func(gpointer user_data)
 
        DEBUG_SERVER_MSG(">>> Call se_add_route_aid_thread_func");
 
-       result = net_nfc_server_route_table_insert_aid_into_db(detail->package,
-               detail->se_type, detail->category, detail->aid,
-               detail->unlock, detail->power);
+       result = net_nfc_server_route_table_insert_aid_into_db(detail->package, detail->se_type, detail->category, detail->aid, detail->unlock, detail->power);
 
-       net_nfc_gdbus_secure_element_complete_add_route_aid(
-               detail->object, detail->invocation, result);
+       net_nfc_gdbus_secure_element_complete_add_route_aid(detail->object, detail->invocation, result);
 
        g_free(detail->aid);
        g_free(detail->package);
@@ -2841,22 +2376,12 @@ static void se_add_route_aid_thread_func(gpointer user_data)
        g_free(detail);
 }
 
-static gboolean se_handle_add_route_aid(
-       NetNfcGDbusSecureElement *object,
-       GDBusMethodInvocation *invocation,
-       const gchar *package,
-       const gchar *aid,
-       guint se_type,
-       guint category,
-       gboolean unlock,
-       guint power,
-       GVariant *smack_privilege)
+static gboolean se_handle_add_route_aid(NetNfcGDbusSecureElement * object, GDBusMethodInvocation * invocation, const gchar * package, const gchar * aid, guint se_type, guint category, gboolean unlock, guint power, GVariant * smack_privilege)
 {
        SeDataAid *data = NULL;
        gint result;
 
-       INFO_MSG(">>> REQUEST from [%s]",
-               g_dbus_method_invocation_get_sender(invocation));
+       INFO_MSG(">>> REQUEST from [%s]", g_dbus_method_invocation_get_sender(invocation));
 
        /* check privilege and update client context */
        if (net_nfc_server_gdbus_check_privilege(invocation, NET_NFC_PRIVILEGE_NFC_CARD_EMUL) == false) {
@@ -2867,8 +2392,7 @@ static gboolean se_handle_add_route_aid(
        }
 
        data = g_try_new0(SeDataAid, 1);
-       if (data == NULL)
-       {
+       if (data == NULL) {
                DEBUG_ERR_MSG("Memory allocation failed");
                result = NET_NFC_ALLOC_FAIL;
 
@@ -2886,9 +2410,7 @@ static gboolean se_handle_add_route_aid(
 
        DEBUG_SERVER_MSG(">>> hce_add_aid_thread_func");
 
-       if (net_nfc_server_controller_async_queue_push_force(
-               se_add_route_aid_thread_func, data) == FALSE)
-       {
+       if (net_nfc_server_controller_async_queue_push_force(se_add_route_aid_thread_func, data) == FALSE) {
                /* return error if queue was blocked */
                DEBUG_SERVER_MSG("controller is processing important message..");
                result = NET_NFC_BUSY;
@@ -2898,7 +2420,7 @@ static gboolean se_handle_add_route_aid(
 
        return TRUE;
 
-ERROR :
+ ERROR:
        if (data != NULL) {
                g_free(data->aid);
                g_free(data->package);
@@ -2909,15 +2431,14 @@ ERROR :
                g_free(data);
        }
 
-       net_nfc_gdbus_secure_element_complete_add_route_aid(object, invocation,
-               result);
+       net_nfc_gdbus_secure_element_complete_add_route_aid(object, invocation, result);
 
        return TRUE;
 }
 
 static void se_remove_route_aid_thread_func(gpointer user_data)
 {
-       SeDataAid *detail = (SeDataAid *)user_data;
+       SeDataAid *detail = (SeDataAid *) user_data;
        net_nfc_error_e result = NET_NFC_OK;
 
        g_assert(detail != NULL);
@@ -2926,11 +2447,9 @@ static void se_remove_route_aid_thread_func(gpointer user_data)
 
        DEBUG_SERVER_MSG(">>> Call se_remove_route_aid_thread_func");
 
-       result = net_nfc_server_route_table_delete_aid_from_db(detail->package,
-               detail->aid);
+       result = net_nfc_server_route_table_delete_aid_from_db(detail->package, detail->aid);
 
-       net_nfc_gdbus_secure_element_complete_remove_route_aid(
-               detail->object, detail->invocation, result);
+       net_nfc_gdbus_secure_element_complete_remove_route_aid(detail->object, detail->invocation, result);
 
        g_free(detail->aid);
        g_free(detail->package);
@@ -2941,19 +2460,12 @@ static void se_remove_route_aid_thread_func(gpointer user_data)
        g_free(detail);
 }
 
-
-static gboolean se_handle_remove_route_aid(
-       NetNfcGDbusSecureElement *object,
-       GDBusMethodInvocation *invocation,
-       const gchar *package,
-       const gchar *aid,
-       GVariant *smack_privilege)
+static gboolean se_handle_remove_route_aid(NetNfcGDbusSecureElement * object, GDBusMethodInvocation * invocation, const gchar * package, const gchar * aid, GVariant * smack_privilege)
 {
        SeDataAid *data = NULL;
        gint result;
 
-       INFO_MSG(">>> REQUEST from [%s]",
-               g_dbus_method_invocation_get_sender(invocation));
+       INFO_MSG(">>> REQUEST from [%s]", g_dbus_method_invocation_get_sender(invocation));
 
        /* check privilege and update client context */
        if (net_nfc_server_gdbus_check_privilege(invocation, NET_NFC_PRIVILEGE_NFC_CARD_EMUL) == false) {
@@ -2964,8 +2476,7 @@ static gboolean se_handle_remove_route_aid(
        }
 
        data = g_try_new0(SeDataAid, 1);
-       if (data == NULL)
-       {
+       if (data == NULL) {
                DEBUG_ERR_MSG("Memory allocation failed");
                result = NET_NFC_ALLOC_FAIL;
 
@@ -2977,9 +2488,7 @@ static gboolean se_handle_remove_route_aid(
        data->package = g_strdup(package);
        data->aid = g_strdup(aid);
 
-       if (net_nfc_server_controller_async_queue_push_force(
-               se_remove_route_aid_thread_func, data) == FALSE)
-       {
+       if (net_nfc_server_controller_async_queue_push_force(se_remove_route_aid_thread_func, data) == FALSE) {
                /* return error if queue was blocked */
                DEBUG_SERVER_MSG("controller is processing important message..");
                result = NET_NFC_BUSY;
@@ -2989,7 +2498,7 @@ static gboolean se_handle_remove_route_aid(
 
        return TRUE;
 
-ERROR :
+ ERROR:
        if (data != NULL) {
                g_free(data->aid);
                g_free(data->package);
@@ -3000,15 +2509,14 @@ ERROR :
                g_free(data);
        }
 
-       net_nfc_gdbus_secure_element_complete_remove_route_aid(
-               object, invocation, result);
+       net_nfc_gdbus_secure_element_complete_remove_route_aid(object, invocation, result);
 
        return TRUE;
 }
 
 static void se_remove_package_aids_thread_func(gpointer user_data)
 {
-       SeDataAid *detail = (SeDataAid *)user_data;
+       SeDataAid *detail = (SeDataAid *) user_data;
        net_nfc_error_e result = NET_NFC_OK;
 
        g_assert(detail != NULL);
@@ -3019,8 +2527,7 @@ static void se_remove_package_aids_thread_func(gpointer user_data)
 
        result = net_nfc_server_route_table_delete_aids_from_db(detail->package);
 
-       net_nfc_gdbus_secure_element_complete_remove_package_aids(
-               detail->object, detail->invocation, result);
+       net_nfc_gdbus_secure_element_complete_remove_package_aids(detail->object, detail->invocation, result);
 
        g_free(detail->package);
 
@@ -3030,17 +2537,12 @@ static void se_remove_package_aids_thread_func(gpointer user_data)
        g_free(detail);
 }
 
-static gboolean se_handle_remove_package_aids(
-       NetNfcGDbusSecureElement *object,
-       GDBusMethodInvocation *invocation,
-       const gchar *package,
-       GVariant *smack_privilege)
+static gboolean se_handle_remove_package_aids(NetNfcGDbusSecureElement * object, GDBusMethodInvocation * invocation, const gchar * package, GVariant * smack_privilege)
 {
        SeDataAid *data = NULL;
        gint result;
 
-       INFO_MSG(">>> REQUEST from [%s]",
-               g_dbus_method_invocation_get_sender(invocation));
+       INFO_MSG(">>> REQUEST from [%s]", g_dbus_method_invocation_get_sender(invocation));
 
        /* check privilege and update client context */
        if (net_nfc_server_gdbus_check_privilege(invocation, NET_NFC_PRIVILEGE_NFC_CARD_EMUL) == false) {
@@ -3051,8 +2553,7 @@ static gboolean se_handle_remove_package_aids(
        }
 
        data = g_try_new0(SeDataAid, 1);
-       if (data == NULL)
-       {
+       if (data == NULL) {
                DEBUG_ERR_MSG("Memory allocation failed");
                result = NET_NFC_ALLOC_FAIL;
 
@@ -3063,9 +2564,7 @@ static gboolean se_handle_remove_package_aids(
        data->invocation = g_object_ref(invocation);
        data->package = g_strdup(package);
 
-       if (net_nfc_server_controller_async_queue_push_force(
-               se_remove_package_aids_thread_func, data) == FALSE)
-       {
+       if (net_nfc_server_controller_async_queue_push_force(se_remove_package_aids_thread_func, data) == FALSE) {
                /* return error if queue was blocked */
                DEBUG_SERVER_MSG("controller is processing important message..");
                result = NET_NFC_BUSY;
@@ -3075,7 +2574,7 @@ static gboolean se_handle_remove_package_aids(
 
        return TRUE;
 
-ERROR :
+ ERROR:
        if (data != NULL) {
                g_free(data->package);
 
@@ -3085,18 +2584,16 @@ ERROR :
                g_free(data);
        }
 
-       net_nfc_gdbus_secure_element_complete_remove_package_aids(
-               object, invocation, result);
+       net_nfc_gdbus_secure_element_complete_remove_package_aids(object, invocation, result);
 
        return TRUE;
 }
 
-static bool __check_category_iter_cb(const char *package,
-       route_table_handler_t *handler, aid_info_t *aid, void *user_data)
+static bool __check_category_iter_cb(const char *package, route_table_handler_t * handler, aid_info_t * aid, void *user_data)
 {
-       gpointer *params = (gpointer *)user_data;
+       gpointer *params = (gpointer *) user_data;
 
-       if (aid->category == (net_nfc_card_emulation_category_t)params[0]) {
+       if (aid->category == (net_nfc_card_emulation_category_t) params[0]) {
                int *count = (int *)params[2];
 
                (*count)++;
@@ -3105,33 +2602,28 @@ static bool __check_category_iter_cb(const char *package,
        return true;
 }
 
-static bool __get_handlers_iter_cb(const char *package,
-       route_table_handler_t *handler, void *user_data)
+static bool __get_handlers_iter_cb(const char *package, route_table_handler_t * handler, void *user_data)
 {
-       gpointer *params = (gpointer *)user_data;
+       gpointer *params = (gpointer *) user_data;
        int count = 0;
 
        /* skip current package */
-       if (g_strcmp0(package, "nfc-manager") == 0) {
+       if (g_strcmp0(package, "nfc-manager") == 0)
                return true;
-       }
 
        params[2] = &count;
 
-       net_nfc_server_route_table_iterate_handler_aids(package,
-               __check_category_iter_cb, params);
+       net_nfc_server_route_table_iterate_handler_aids(package, __check_category_iter_cb, params);
 
-       if (count > 0) {
-               g_variant_builder_add((GVariantBuilder *)params[1],
-                       "(is)", count, package);
-       }
+       if (count > 0)
+               g_variant_builder_add((GVariantBuilder *) params[1], "(is)", count, package);
 
        return true;
 }
 
 static void se_get_registered_handlers_thread_func(gpointer user_data)
 {
-       SeDataAid *data = (SeDataAid *)user_data;
+       SeDataAid *data = (SeDataAid *) user_data;
        net_nfc_error_e result = NET_NFC_OK;
        GVariantBuilder builder;
        GVariant *handlers;
@@ -3153,29 +2645,25 @@ static void se_get_registered_handlers_thread_func(gpointer user_data)
        name = g_dbus_method_invocation_get_sender(data->invocation);
        pid = net_nfc_server_gdbus_get_pid(name);
 
-       ret = net_nfc_service_check_access_control(pid,
-               NET_NFC_ACCESS_CONTROL_PLATFORM);
-       if (ret == false)
-       {
+       ret = net_nfc_service_check_access_control(pid, NET_NFC_ACCESS_CONTROL_PLATFORM);
+       if (ret == false) {
                DEBUG_ERR_MSG("access control denied");
                result = NET_NFC_SECURITY_FAIL;
 
                goto END;
        }
 #endif
-       params[0] = (gpointer)data->category;
+       params[0] = (gpointer) data->category;
        params[1] = &builder;
 
-       net_nfc_server_route_table_iterate_handler(__get_handlers_iter_cb,
-               params);
+       net_nfc_server_route_table_iterate_handler(__get_handlers_iter_cb, params);
 
 #ifdef ACCESS_CONTROL
-END :
+ END:
 #endif
        handlers = g_variant_builder_end(&builder);
 
-       net_nfc_gdbus_secure_element_complete_get_registered_handlers(
-               data->object, data->invocation, result, handlers);
+       net_nfc_gdbus_secure_element_complete_get_registered_handlers(data->object, data->invocation, result, handlers);
 
        g_object_unref(data->invocation);
        g_object_unref(data->object);
@@ -3183,17 +2671,12 @@ END :
        g_free(data);
 }
 
-static gboolean se_handle_get_registered_handlers(
-       NetNfcGDbusSecureElement *object,
-       GDBusMethodInvocation *invocation,
-       guint category,
-       GVariant *smack_privilege)
+static gboolean se_handle_get_registered_handlers(NetNfcGDbusSecureElement * object, GDBusMethodInvocation * invocation, guint category, GVariant * smack_privilege)
 {
        SeDataAid *data = NULL;
        gint result;
 
-       INFO_MSG(">>> REQUEST from [%s]",
-               g_dbus_method_invocation_get_sender(invocation));
+       INFO_MSG(">>> REQUEST from [%s]", g_dbus_method_invocation_get_sender(invocation));
 
        /* check privilege and update client context */
        if (net_nfc_server_gdbus_check_privilege(invocation, NET_NFC_PRIVILEGE_NFC_CARD_EMUL) == false) {
@@ -3204,8 +2687,7 @@ static gboolean se_handle_get_registered_handlers(
        }
 
        data = g_try_new0(SeDataAid, 1);
-       if (data == NULL)
-       {
+       if (data == NULL) {
                DEBUG_ERR_MSG("Memory allocation failed");
                result = NET_NFC_ALLOC_FAIL;
 
@@ -3216,9 +2698,7 @@ static gboolean se_handle_get_registered_handlers(
        data->invocation = g_object_ref(invocation);
        data->category = category;
 
-       if (net_nfc_server_controller_async_queue_push_force(
-               se_get_registered_handlers_thread_func, data) == FALSE)
-       {
+       if (net_nfc_server_controller_async_queue_push_force(se_get_registered_handlers_thread_func, data) == FALSE) {
                /* return error if queue was blocked */
                DEBUG_SERVER_MSG("controller is processing important message..");
                result = NET_NFC_BUSY;
@@ -3228,7 +2708,7 @@ static gboolean se_handle_get_registered_handlers(
 
        return TRUE;
 
-ERROR :
+ ERROR:
        if (data != NULL) {
                g_object_unref(data->invocation);
                g_object_unref(data->object);
@@ -3242,15 +2722,14 @@ ERROR :
        g_variant_builder_init(&builder, G_VARIANT_TYPE("a(is)"));
        packages = g_variant_builder_end(&builder);
 
-       net_nfc_gdbus_secure_element_complete_get_registered_handlers(
-               object, invocation, result, packages);
+       net_nfc_gdbus_secure_element_complete_get_registered_handlers(object, invocation, result, packages);
 
        return TRUE;
 }
 
 static void se_get_handler_storage_info_thread_func(gpointer user_data)
 {
-       SeDataAid *data = (SeDataAid *)user_data;
+       SeDataAid *data = (SeDataAid *) user_data;
        net_nfc_error_e result = NET_NFC_OK;
        int used = -1;
        int max = -1;
@@ -3269,10 +2748,8 @@ static void se_get_handler_storage_info_thread_func(gpointer user_data)
        name = g_dbus_method_invocation_get_sender(data->invocation);
        pid = net_nfc_server_gdbus_get_pid(name);
 
-       ret = net_nfc_service_check_access_control(pid,
-               NET_NFC_ACCESS_CONTROL_PLATFORM);
-       if (ret == false)
-       {
+       ret = net_nfc_service_check_access_control(pid, NET_NFC_ACCESS_CONTROL_PLATFORM);
+       if (ret == false) {
                DEBUG_ERR_MSG("access control denied");
                result = NET_NFC_SECURITY_FAIL;
 
@@ -3282,10 +2759,9 @@ static void se_get_handler_storage_info_thread_func(gpointer user_data)
        net_nfc_server_route_table_get_storage_info(data->category, &used, &max);
 
 #ifdef ACCESS_CONTROL
-END :
+ END:
 #endif
-       net_nfc_gdbus_secure_element_complete_get_handler_storage_info(
-               data->object, data->invocation, result, used, max);
+       net_nfc_gdbus_secure_element_complete_get_handler_storage_info(data->object, data->invocation, result, used, max);
 
        g_object_unref(data->invocation);
        g_object_unref(data->object);
@@ -3293,17 +2769,12 @@ END :
        g_free(data);
 }
 
-static gboolean se_handle_get_handler_storage_info(
-       NetNfcGDbusSecureElement *object,
-       GDBusMethodInvocation *invocation,
-       guint category,
-       GVariant *smack_privilege)
+static gboolean se_handle_get_handler_storage_info(NetNfcGDbusSecureElement * object, GDBusMethodInvocation * invocation, guint category, GVariant * smack_privilege)
 {
        SeDataAid *data = NULL;
        gint result;
 
-       INFO_MSG(">>> REQUEST from [%s]",
-               g_dbus_method_invocation_get_sender(invocation));
+       INFO_MSG(">>> REQUEST from [%s]", g_dbus_method_invocation_get_sender(invocation));
 
        /* check privilege and update client context */
        if (net_nfc_server_gdbus_check_privilege(invocation, NET_NFC_PRIVILEGE_NFC_CARD_EMUL) == false) {
@@ -3314,8 +2785,7 @@ static gboolean se_handle_get_handler_storage_info(
        }
 
        data = g_try_new0(SeDataAid, 1);
-       if (data == NULL)
-       {
+       if (data == NULL) {
                DEBUG_ERR_MSG("Memory allocation failed");
                result = NET_NFC_ALLOC_FAIL;
 
@@ -3326,9 +2796,7 @@ static gboolean se_handle_get_handler_storage_info(
        data->invocation = g_object_ref(invocation);
        data->category = category;
 
-       if (net_nfc_server_controller_async_queue_push_force(
-               se_get_handler_storage_info_thread_func, data) == FALSE)
-       {
+       if (net_nfc_server_controller_async_queue_push_force(se_get_handler_storage_info_thread_func, data) == FALSE) {
                /* return error if queue was blocked */
                DEBUG_SERVER_MSG("controller is processing important message..");
                result = NET_NFC_BUSY;
@@ -3338,7 +2806,7 @@ static gboolean se_handle_get_handler_storage_info(
 
        return TRUE;
 
-ERROR :
+ ERROR:
        if (data != NULL) {
                g_object_unref(data->invocation);
                g_object_unref(data->object);
@@ -3346,37 +2814,34 @@ ERROR :
                g_free(data);
        }
 
-       net_nfc_gdbus_secure_element_complete_get_handler_storage_info(
-               object, invocation, result, -1, -1);
+       net_nfc_gdbus_secure_element_complete_get_handler_storage_info(object, invocation, result, -1, -1);
 
        return TRUE;
 }
 
-static bool __iterate_conflict_handlers(
-       const char *package, route_table_handler_t *handler, void *user_data)
+static bool __iterate_conflict_handlers(const char *package, route_table_handler_t * handler, void *user_data)
 {
-       gpointer *params = (gpointer *)user_data;
+       gpointer *params = (gpointer *) user_data;
        net_nfc_card_emulation_category_t category;
        size_t i;
        aid_info_t *aid;
 
-       if (g_strcmp0(package, (const char *)params[0]) == 0) {
+       if (g_strcmp0(package, (const char *)params[0]) == 0)
                return true;
-       }
 
-       category = (net_nfc_card_emulation_category_t)params[1];
+       category = (net_nfc_card_emulation_category_t) params[1];
 
        for (i = 0; i < handler->aids[category]->len; i++) {
-               aid = (aid_info_t *)(handler->aids[category]->pdata[i]);
+               aid = (aid_info_t *) (handler->aids[category]->pdata[i]);
 
                if (g_strcmp0(aid->aid, (const char *)params[2]) == 0) {
                        /* conflicted */
 
                        SECURE_MSG("conflict with [%s]", package);
 
-                       *(net_nfc_error_e *)(params[3]) = NET_NFC_DATA_CONFLICTED;
+                       *(net_nfc_error_e *) (params[3]) = NET_NFC_DATA_CONFLICTED;
 
-                       g_variant_builder_add((GVariantBuilder *)params[4], "(s)", package);
+                       g_variant_builder_add((GVariantBuilder *) params[4], "(s)", package);
                        break;
                }
        }
@@ -3386,7 +2851,7 @@ static bool __iterate_conflict_handlers(
 
 static void se_get_conflict_handlers_thread_func(gpointer user_data)
 {
-       SeDataAid *data = (SeDataAid *)user_data;
+       SeDataAid *data = (SeDataAid *) user_data;
        net_nfc_error_e result = NET_NFC_OK;
        GVariantBuilder builder;
 
@@ -3400,18 +2865,15 @@ static void se_get_conflict_handlers_thread_func(gpointer user_data)
 
        gpointer params[5];
 
-       params[0] = (gpointer)data->package;
-       params[1] = (gpointer)data->category;
-       params[2] = (gpointer)data->aid;
+       params[0] = (gpointer) data->package;
+       params[1] = (gpointer) data->category;
+       params[2] = (gpointer) data->aid;
        params[3] = &result;
        params[4] = &builder;
 
-       net_nfc_server_route_table_iterate_handler(__iterate_conflict_handlers,
-               params);
+       net_nfc_server_route_table_iterate_handler(__iterate_conflict_handlers, params);
 
-       net_nfc_gdbus_secure_element_complete_get_conflict_handlers(
-               data->object, data->invocation, result,
-               g_variant_builder_end(&builder));
+       net_nfc_gdbus_secure_element_complete_get_conflict_handlers(data->object, data->invocation, result, g_variant_builder_end(&builder));
 
        g_free(data->package);
        g_free(data->aid);
@@ -3421,25 +2883,15 @@ static void se_get_conflict_handlers_thread_func(gpointer user_data)
        g_free(data);
 }
 
-static gboolean se_handle_get_conflict_handlers(
-       NetNfcGDbusSecureElement *object,
-       GDBusMethodInvocation *invocation,
-       gchar *package,
-       guint category,
-       gchar *aid,
-       GVariant *smack_privilege)
+static gboolean se_handle_get_conflict_handlers(NetNfcGDbusSecureElement * object, GDBusMethodInvocation * invocation, gchar * package, guint category, gchar * aid, GVariant * smack_privilege)
 {
        SeDataAid *data = NULL;
        gint result;
 
-       INFO_MSG(">>> REQUEST from [%s]",
-               g_dbus_method_invocation_get_sender(invocation));
+       INFO_MSG(">>> REQUEST from [%s]", g_dbus_method_invocation_get_sender(invocation));
 #if 0
        /* check privilege and update client context */
-       if (net_nfc_server_gdbus_check_privilege(invocation,
-               smack_privilege,
-               "nfc-manager",
-               "r") == false) {
+       if (net_nfc_server_gdbus_check_privilege(invocation, smack_privilege, "nfc-manager", "r") == false) {
                DEBUG_ERR_MSG("permission denied, and finished request");
                result = NET_NFC_PERMISSION_DENIED;
 
@@ -3447,8 +2899,7 @@ static gboolean se_handle_get_conflict_handlers(
        }
 #endif
        data = g_try_new0(SeDataAid, 1);
-       if (data == NULL)
-       {
+       if (data == NULL) {
                DEBUG_ERR_MSG("Memory allocation failed");
                result = NET_NFC_ALLOC_FAIL;
 
@@ -3461,9 +2912,7 @@ static gboolean se_handle_get_conflict_handlers(
        data->category = category;
        data->aid = g_strdup(aid);
 
-       if (net_nfc_server_controller_async_queue_push_force(
-               se_get_conflict_handlers_thread_func, data) == FALSE)
-       {
+       if (net_nfc_server_controller_async_queue_push_force(se_get_conflict_handlers_thread_func, data) == FALSE) {
                /* return error if queue was blocked */
                DEBUG_SERVER_MSG("controller is processing important message..");
                result = NET_NFC_BUSY;
@@ -3473,7 +2922,7 @@ static gboolean se_handle_get_conflict_handlers(
 
        return TRUE;
 
-ERROR :
+ ERROR:
        if (data != NULL) {
                g_free(data->package);
                g_free(data->aid);
@@ -3487,8 +2936,7 @@ ERROR :
 
        g_variant_builder_init(&builder, G_VARIANT_TYPE("a(s)"));
 
-       net_nfc_gdbus_secure_element_complete_get_conflict_handlers(
-               object, invocation, result, g_variant_builder_end(&builder));
+       net_nfc_gdbus_secure_element_complete_get_conflict_handlers(object, invocation, result, g_variant_builder_end(&builder));
 
        return TRUE;
 }
@@ -3497,22 +2945,16 @@ static net_nfc_error_e __se_close_ese_no_lock()
 {
        net_nfc_error_e result = NET_NFC_OK;
 
-       if (gdbus_ese_handle != NULL &&
-               net_nfc_server_gdbus_is_server_busy_no_lock() == false) {
-               if (net_nfc_controller_secure_element_close(
-                       gdbus_ese_handle,
-                       &result) == false)
-               {
+       if (gdbus_ese_handle != NULL && net_nfc_server_gdbus_is_server_busy_no_lock() == false) {
+               if (net_nfc_controller_secure_element_close(gdbus_ese_handle, &result) == false)
                        net_nfc_controller_exception_handler();
-               }
                net_nfc_server_se_set_current_ese_handle(NULL);
        }
 
        return result;
 }
 
-
-static void __llcp_on_client_detached_cb(net_nfc_client_context_info_t *client)
+static void __llcp_on_client_detached_cb(net_nfc_client_context_info_t * client)
 {
        if (client->ref_se > 0) {
                DEBUG_SERVER_MSG("close opened secure element");
@@ -3525,7 +2967,7 @@ static void __llcp_on_client_detached_cb(net_nfc_client_context_info_t *client)
 
 static void se_set_preferred_handler_thread_func(gpointer user_data)
 {
-       SeSetPreferred *data = (SeSetPreferred *)user_data;
+       SeSetPreferred *data = (SeSetPreferred *) user_data;
        route_table_handler_t *handler;
        net_nfc_error_e result = NET_NFC_OK;
        bool ret;
@@ -3568,8 +3010,7 @@ static void se_set_preferred_handler_thread_func(gpointer user_data)
 
        net_nfc_server_route_table_preferred_handler_dump();
 
-       net_nfc_gdbus_secure_element_complete_set_preferred_handler(
-               data->object, data->invocation, result);
+       net_nfc_gdbus_secure_element_complete_set_preferred_handler(data->object, data->invocation, result);
 
        g_object_unref(data->invocation);
        g_object_unref(data->object);
@@ -3577,17 +3018,12 @@ static void se_set_preferred_handler_thread_func(gpointer user_data)
        g_free(data);
 }
 
-static gboolean se_handle_set_preferred_handler(
-       NetNfcGDbusSecureElement *object,
-       GDBusMethodInvocation *invocation,
-       bool state,
-       GVariant *smack_privilege)
+static gboolean se_handle_set_preferred_handler(NetNfcGDbusSecureElement * object, GDBusMethodInvocation * invocation, bool state, GVariant * smack_privilege)
 {
        SeSetPreferred *data = NULL;
        gint result;
 
-       INFO_MSG(">>> REQUEST from [%s]",
-               g_dbus_method_invocation_get_sender(invocation));
+       INFO_MSG(">>> REQUEST from [%s]", g_dbus_method_invocation_get_sender(invocation));
 
        if (net_nfc_server_gdbus_check_privilege(invocation, NET_NFC_PRIVILEGE_NFC_CARD_EMUL) == false) {
                DEBUG_ERR_MSG("permission denied, and finished request");
@@ -3597,8 +3033,7 @@ static gboolean se_handle_set_preferred_handler(
        }
 
        data = g_try_new0(SeSetPreferred, 1);
-       if (data == NULL)
-       {
+       if (data == NULL) {
                DEBUG_ERR_MSG("Memory allocation failed");
                result = NET_NFC_ALLOC_FAIL;
 
@@ -3609,9 +3044,7 @@ static gboolean se_handle_set_preferred_handler(
        data->invocation = g_object_ref(invocation);
        data->state = state;
 
-       if (net_nfc_server_controller_async_queue_push_force(
-               se_set_preferred_handler_thread_func, data) == FALSE)
-       {
+       if (net_nfc_server_controller_async_queue_push_force(se_set_preferred_handler_thread_func, data) == FALSE) {
                /* return error if queue was blocked */
                DEBUG_SERVER_MSG("controller is processing important message..");
                result = NET_NFC_BUSY;
@@ -3621,7 +3054,7 @@ static gboolean se_handle_set_preferred_handler(
 
        return TRUE;
 
-ERROR :
+ ERROR:
        if (data != NULL) {
                g_object_unref(data->invocation);
                g_object_unref(data->object);
@@ -3629,13 +3062,12 @@ ERROR :
                g_free(data);
        }
 
-       net_nfc_gdbus_secure_element_complete_set_preferred_handler(
-               object, invocation, result);
+       net_nfc_gdbus_secure_element_complete_set_preferred_handler(object, invocation, result);
 
        return TRUE;
 }
 
-gboolean net_nfc_server_se_init(GDBusConnection *connection)
+gboolean net_nfc_server_se_init(GDBusConnection * connection)
 {
        GError *error = NULL;
        gboolean result;
@@ -3651,134 +3083,57 @@ gboolean net_nfc_server_se_init(GDBusConnection *connection)
 #endif
        se_skeleton = net_nfc_gdbus_secure_element_skeleton_new();
 
-       g_signal_connect(se_skeleton,
-               "handle-set",
-               G_CALLBACK(se_handle_set),
-               NULL);
-
-       g_signal_connect(se_skeleton,
-               "handle-get",
-               G_CALLBACK(se_handle_get),
-               NULL);
-
-       g_signal_connect(se_skeleton,
-               "handle-set-card-emulation",
-               G_CALLBACK(se_handle_change_card_emulation_mode),
-               NULL);
-
-       g_signal_connect(se_skeleton,
-               "handle-get-card-emulation",
-               G_CALLBACK(se_handle_get_card_emulation_mode),
-               NULL);
-
-       g_signal_connect(se_skeleton,
-               "handle-open-secure-element",
-               G_CALLBACK(se_handle_open_secure_element),
-               NULL);
-
-       g_signal_connect(se_skeleton,
-               "handle-close-secure-element",
-               G_CALLBACK(se_handle_close_secure_element),
-               NULL);
-
-       g_signal_connect(se_skeleton,
-               "handle-get-atr",
-               G_CALLBACK(se_handle_get_atr),
-               NULL);
-
-       g_signal_connect(se_skeleton,
-               "handle-send-apdu",
-               G_CALLBACK(se_handle_send_apdu),
-               NULL);
-
-       g_signal_connect(se_skeleton,
-               "handle-set-transaction-fg-dispatch",
-               G_CALLBACK(se_handle_set_transaction_fg_dispatch),
-               NULL);
-
-       g_signal_connect(se_skeleton,
-               "handle-check-transaction-permission",
-               G_CALLBACK(se_handle_check_transaction_permission),
-               NULL);
-
-       g_signal_connect(se_skeleton,
-               "handle-set-default-route",
-               G_CALLBACK(se_handle_set_default_route),
-               NULL);
-
-       g_signal_connect(se_skeleton,
-               "handle-is-activated-aid-handler",
-               G_CALLBACK(se_handle_is_activated_aid_handler),
-               NULL);
-
-       g_signal_connect(se_skeleton,
-               "handle-is-activated-category-handler",
-               G_CALLBACK(se_handle_is_activated_category_handler),
-               NULL);
-
-       g_signal_connect(se_skeleton,
-               "handle-get-registered-aids",
-               G_CALLBACK(se_handle_get_registered_aids),
-               NULL);
-
-       g_signal_connect(se_skeleton,
-               "handle-register-aid",
-               G_CALLBACK(se_handle_register_aid),
-               NULL);
-
-       g_signal_connect(se_skeleton,
-               "handle-unregister-aid",
-               G_CALLBACK(se_handle_unregister_aid),
-               NULL);
-
-       g_signal_connect(se_skeleton,
-               "handle-unregister-aids",
-               G_CALLBACK(se_handle_unregister_aids),
-               NULL);
-
-       g_signal_connect(se_skeleton,
-               "handle-add-route-aid",
-               G_CALLBACK(se_handle_add_route_aid),
-               NULL);
-
-       g_signal_connect(se_skeleton,
-               "handle-remove-route-aid",
-               G_CALLBACK(se_handle_remove_route_aid),
-               NULL);
-
-       g_signal_connect(se_skeleton,
-               "handle-remove-package-aids",
-               G_CALLBACK(se_handle_remove_package_aids),
-               NULL);
-
-       g_signal_connect(se_skeleton,
-               "handle-get-registered-handlers",
-               G_CALLBACK(se_handle_get_registered_handlers),
-               NULL);
-
-       g_signal_connect(se_skeleton,
-               "handle-get-handler-storage-info",
-               G_CALLBACK(se_handle_get_handler_storage_info),
-               NULL);
-
-       g_signal_connect(se_skeleton,
-               "handle-get-conflict-handlers",
-               G_CALLBACK(se_handle_get_conflict_handlers),
-               NULL);
-
-       g_signal_connect(se_skeleton,
-               "handle-set-preferred-handler",
-               G_CALLBACK(se_handle_set_preferred_handler),
-               NULL);
-
-       result = g_dbus_interface_skeleton_export(
-               G_DBUS_INTERFACE_SKELETON(se_skeleton),
-               connection,
-               "/org/tizen/NetNfcService/SecureElement",
-               &error);
+       g_signal_connect(se_skeleton, "handle-set", G_CALLBACK(se_handle_set), NULL);
+
+       g_signal_connect(se_skeleton, "handle-get", G_CALLBACK(se_handle_get), NULL);
+
+       g_signal_connect(se_skeleton, "handle-set-card-emulation", G_CALLBACK(se_handle_change_card_emulation_mode), NULL);
+
+       g_signal_connect(se_skeleton, "handle-get-card-emulation", G_CALLBACK(se_handle_get_card_emulation_mode), NULL);
+
+       g_signal_connect(se_skeleton, "handle-open-secure-element", G_CALLBACK(se_handle_open_secure_element), NULL);
+
+       g_signal_connect(se_skeleton, "handle-close-secure-element", G_CALLBACK(se_handle_close_secure_element), NULL);
+
+       g_signal_connect(se_skeleton, "handle-get-atr", G_CALLBACK(se_handle_get_atr), NULL);
+
+       g_signal_connect(se_skeleton, "handle-send-apdu", G_CALLBACK(se_handle_send_apdu), NULL);
+
+       g_signal_connect(se_skeleton, "handle-set-transaction-fg-dispatch", G_CALLBACK(se_handle_set_transaction_fg_dispatch), NULL);
+
+       g_signal_connect(se_skeleton, "handle-check-transaction-permission", G_CALLBACK(se_handle_check_transaction_permission), NULL);
+
+       g_signal_connect(se_skeleton, "handle-set-default-route", G_CALLBACK(se_handle_set_default_route), NULL);
+
+       g_signal_connect(se_skeleton, "handle-is-activated-aid-handler", G_CALLBACK(se_handle_is_activated_aid_handler), NULL);
+
+       g_signal_connect(se_skeleton, "handle-is-activated-category-handler", G_CALLBACK(se_handle_is_activated_category_handler), NULL);
+
+       g_signal_connect(se_skeleton, "handle-get-registered-aids", G_CALLBACK(se_handle_get_registered_aids), NULL);
+
+       g_signal_connect(se_skeleton, "handle-register-aid", G_CALLBACK(se_handle_register_aid), NULL);
+
+       g_signal_connect(se_skeleton, "handle-unregister-aid", G_CALLBACK(se_handle_unregister_aid), NULL);
+
+       g_signal_connect(se_skeleton, "handle-unregister-aids", G_CALLBACK(se_handle_unregister_aids), NULL);
+
+       g_signal_connect(se_skeleton, "handle-add-route-aid", G_CALLBACK(se_handle_add_route_aid), NULL);
+
+       g_signal_connect(se_skeleton, "handle-remove-route-aid", G_CALLBACK(se_handle_remove_route_aid), NULL);
+
+       g_signal_connect(se_skeleton, "handle-remove-package-aids", G_CALLBACK(se_handle_remove_package_aids), NULL);
+
+       g_signal_connect(se_skeleton, "handle-get-registered-handlers", G_CALLBACK(se_handle_get_registered_handlers), NULL);
+
+       g_signal_connect(se_skeleton, "handle-get-handler-storage-info", G_CALLBACK(se_handle_get_handler_storage_info), NULL);
+
+       g_signal_connect(se_skeleton, "handle-get-conflict-handlers", G_CALLBACK(se_handle_get_conflict_handlers), NULL);
+
+       g_signal_connect(se_skeleton, "handle-set-preferred-handler", G_CALLBACK(se_handle_set_preferred_handler), NULL);
+
+       result = g_dbus_interface_skeleton_export(G_DBUS_INTERFACE_SKELETON(se_skeleton), connection, "/org/tizen/NetNfcService/SecureElement", &error);
        if (result == true) {
-               net_nfc_server_gdbus_register_on_client_detached_cb(
-                       __llcp_on_client_detached_cb);
+               net_nfc_server_gdbus_register_on_client_detached_cb(__llcp_on_client_detached_cb);
        } else {
                DEBUG_ERR_MSG("can not skeleton_export %s", error->message);
 
@@ -3792,13 +3147,11 @@ gboolean net_nfc_server_se_init(GDBusConnection *connection)
 
 void net_nfc_server_se_deinit(void)
 {
-       net_nfc_server_gdbus_unregister_on_client_detached_cb(
-               __llcp_on_client_detached_cb);
+       net_nfc_server_gdbus_unregister_on_client_detached_cb(__llcp_on_client_detached_cb);
 
        __stop_lcd_on_timer();
 
-       if (se_skeleton)
-       {
+       if (se_skeleton) {
                g_object_unref(se_skeleton);
                se_skeleton = NULL;
 
@@ -3818,42 +3171,31 @@ static void se_detected_thread_func(gpointer user_data)
 
        g_assert(user_data != NULL);
 
-       if (se_skeleton == NULL)
-       {
+       if (se_skeleton == NULL) {
                DEBUG_ERR_MSG("se skeleton is not initialized");
 
-               g_variant_unref((GVariant *)user_data);
+               g_variant_unref((GVariant *) user_data);
 
                return;
        }
 
-       g_variant_get((GVariant *)user_data,
-               "uu@a(y)",
-               (guint *)&handle,
-               &devType,
-               &data);
+       g_variant_get((GVariant *) user_data, "uu@a(y)", (guint *) & handle, &devType, &data);
 
        net_nfc_server_se_set_current_ese_handle(handle);
 
        SECURE_MSG("trying to connect to ESE = [0x%p]", handle);
 
        if (!net_nfc_controller_connect(handle, &result))
-       {
                DEBUG_SERVER_MSG("connect failed = [%d]", result);
-       }
 
-       net_nfc_gdbus_secure_element_emit_ese_detected(
-               se_skeleton,
-               GPOINTER_TO_UINT(handle),
-               devType,
-               data);
+       net_nfc_gdbus_secure_element_emit_ese_detected(se_skeleton, GPOINTER_TO_UINT(handle), devType, data);
 
-       g_variant_unref((GVariant *)user_data);
+       g_variant_unref((GVariant *) user_data);
 }
 
 static void se_transcation_thread_func(gpointer user_data)
 {
-       ServerSeData *detail = (ServerSeData *)user_data;
+       ServerSeData *detail = (ServerSeData *) user_data;
        bool fg_dispatch;
        pid_t focus_app_pid;
 
@@ -3873,28 +3215,12 @@ static void se_transcation_thread_func(gpointer user_data)
                SECURE_MSG("TRANSACTION event fg dispatch [%d]", fg_dispatch);
 
                /* TODO : check access control */
-               net_nfc_gdbus_secure_element_emit_transaction_event(
-                       se_skeleton,
-                       se_type,
-                       aid,
-                       param,
-                       fg_dispatch,
-                       focus_app_pid);
+               net_nfc_gdbus_secure_element_emit_transaction_event(se_skeleton, se_type, aid, param, fg_dispatch, focus_app_pid);
 
                if (fg_dispatch != true) {
-                       net_nfc_app_util_launch_se_transaction_app(
-                               se_type,
-                               detail->aid.buffer,
-                               detail->aid.length,
-                               detail->param.buffer,
-                               detail->param.length);
-
-                       net_nfc_app_util_launch_se_off_host_apdu_service_app(
-                               se_type,
-                               detail->aid.buffer,
-                               detail->aid.length,
-                               detail->param.buffer,
-                               detail->param.length);
+                       net_nfc_app_util_launch_se_transaction_app(se_type, detail->aid.buffer, detail->aid.length, detail->param.buffer, detail->param.length);
+
+                       net_nfc_app_util_launch_se_off_host_apdu_service_app(se_type, detail->aid.buffer, detail->aid.length, detail->param.buffer, detail->param.length);
                }
 
                DEBUG_SERVER_MSG("launch se app end");
@@ -3908,35 +3234,25 @@ static void se_transcation_thread_func(gpointer user_data)
 
 static void se_rf_field_thread_func(gpointer user_data)
 {
-       if (se_skeleton == NULL)
-       {
+       if (se_skeleton == NULL) {
                DEBUG_ERR_MSG("se skeleton is not initialized");
                return;
        }
 
-       net_nfc_gdbus_secure_element_emit_rf_detected(
-               se_skeleton);
+       net_nfc_gdbus_secure_element_emit_rf_detected(se_skeleton);
 }
 
 void net_nfc_server_se_detected(void *info)
 {
-       net_nfc_request_target_detected_t *se_target =
-               (net_nfc_request_target_detected_t *)info;
+       net_nfc_request_target_detected_t *se_target = (net_nfc_request_target_detected_t *) info;
        GVariant *parameter;
        GVariant *data;
 
-       data = net_nfc_util_gdbus_buffer_to_variant(
-               se_target->target_info_values.buffer,
-               se_target->target_info_values.length);
+       data = net_nfc_util_gdbus_buffer_to_variant(se_target->target_info_values.buffer, se_target->target_info_values.length);
 
-       parameter = g_variant_new("uu@a(y)",
-               GPOINTER_TO_UINT(se_target->handle),
-               se_target->devType,
-               data);
+       parameter = g_variant_new("uu@a(y)", GPOINTER_TO_UINT(se_target->handle), se_target->devType, data);
        if (parameter != NULL) {
-               if (net_nfc_server_controller_async_queue_push_force(
-                       se_detected_thread_func,
-                       parameter) == FALSE) {
+               if (net_nfc_server_controller_async_queue_push_force(se_detected_thread_func, parameter) == FALSE) {
                        DEBUG_ERR_MSG("can not push to controller thread");
 
                        g_variant_unref(parameter);
@@ -3945,14 +3261,13 @@ void net_nfc_server_se_detected(void *info)
                DEBUG_ERR_MSG("g_variant_new failed");
        }
 
-       /* FIXME : should be removed when plugins would be fixed*/
+       /* FIXME : should be removed when plugins would be fixed */
        _net_nfc_util_free_mem(info);
 }
 
 void net_nfc_server_se_transaction_received(void *info)
 {
-       net_nfc_request_se_event_t *se_event =
-               (net_nfc_request_se_event_t *)info;
+       net_nfc_request_se_event_t *se_event = (net_nfc_request_se_event_t *) info;
        ServerSeData *detail;
 
        detail = g_try_new0(ServerSeData, 1);
@@ -3960,25 +3275,16 @@ void net_nfc_server_se_transaction_received(void *info)
                detail->event = se_event->request_type;
 
                if (se_event->aid.buffer != NULL && se_event->aid.length > 0) {
-                       if (net_nfc_util_init_data(&detail->aid,
-                               se_event->aid.length) == true) {
-                               memcpy(detail->aid.buffer, se_event->aid.buffer,
-                                       se_event->aid.length);
-                       }
+                       if (net_nfc_util_init_data(&detail->aid, se_event->aid.length) == true)
+                               memcpy(detail->aid.buffer, se_event->aid.buffer, se_event->aid.length);
                }
 
-               if (se_event->param.buffer != NULL &&
-                       se_event->param.length > 0) {
-                       if (net_nfc_util_init_data(&detail->param,
-                               se_event->param.length) == true) {
-                               memcpy(detail->param.buffer,
-                                       se_event->param.buffer,
-                                       se_event->param.length);
-                       }
+               if (se_event->param.buffer != NULL && se_event->param.length > 0) {
+                       if (net_nfc_util_init_data(&detail->param, se_event->param.length) == true)
+                               memcpy(detail->param.buffer, se_event->param.buffer, se_event->param.length);
                }
 
-               if (net_nfc_server_controller_async_queue_push_force(
-                       se_transcation_thread_func, detail) == FALSE) {
+               if (net_nfc_server_controller_async_queue_push_force(se_transcation_thread_func, detail) == FALSE) {
                        DEBUG_ERR_MSG("can not push to controller thread");
 
                        net_nfc_util_clear_data(&detail->param);
@@ -3990,7 +3296,7 @@ void net_nfc_server_se_transaction_received(void *info)
                DEBUG_ERR_MSG("g_new0 failed");
        }
 
-       /* FIXME : should be removed when plugins would be fixed*/
+       /* FIXME : should be removed when plugins would be fixed */
        net_nfc_util_clear_data(&se_event->param);
        net_nfc_util_clear_data(&se_event->aid);
 
@@ -4001,13 +3307,10 @@ void net_nfc_server_se_rf_field_on(void *info)
 {
        DEBUG_SERVER_MSG("net_nfc_server_se_rf_field_on");
 
-       if (net_nfc_server_controller_async_queue_push_force(
-               se_rf_field_thread_func,
-               NULL) == FALSE) {
+       if (net_nfc_server_controller_async_queue_push_force(se_rf_field_thread_func, NULL) == FALSE)
                DEBUG_ERR_MSG("can not push to controller thread");
-       }
 
-       /* FIXME : should be removed when plugins would be fixed*/
+       /* FIXME : should be removed when plugins would be fixed */
        _net_nfc_util_free_mem(info);
 }
 
@@ -4022,11 +3325,8 @@ static void ____delayed_change_screen_state_thread_func(gpointer user_data)
 
        DEBUG_SERVER_MSG(">>>");
 
-       if (net_nfc_controller_set_screen_state(
-               (net_nfc_screen_state_type_e)user_data, &result) == true)
-       {
+       if (net_nfc_controller_set_screen_state((net_nfc_screen_state_type_e) user_data, &result) == true)
                DEBUG_SERVER_MSG("Set Screen State [%d]", (int)user_data);
-       }
 }
 
 static gboolean __delayed_change_screen_state(gpointer user_data)
@@ -4039,11 +3339,8 @@ static gboolean __delayed_change_screen_state(gpointer user_data)
                if (__lcd_state != NET_NFC_SCREEN_INVALID) {
                        DEBUG_SERVER_MSG("update screen state");
 
-                       if (net_nfc_server_controller_async_queue_push_force(
-                               ____delayed_change_screen_state_thread_func,
-                               (void *)__lcd_state) == FALSE) {
+                       if (net_nfc_server_controller_async_queue_push_force(____delayed_change_screen_state_thread_func, (void *)__lcd_state) == FALSE)
                                DEBUG_ERR_MSG("can not push to controller thread");
-                       }
                } else {
                        DEBUG_SERVER_MSG("no update");
                }
@@ -4124,16 +3421,16 @@ int __get_display_state()
        result = vconf_get_int(VCONFKEY_PM_STATE, &pm_state);
        if (result == 0) {
                switch (pm_state) {
-               case VCONFKEY_PM_STATE_NORMAL :
+               case VCONFKEY_PM_STATE_NORMAL:
                        result = LCD_NORMAL;
                        break;
 
-               case VCONFKEY_PM_STATE_LCDDIM :
+               case VCONFKEY_PM_STATE_LCDDIM:
                        result = LCD_DIM;
                        break;
 
-               case VCONFKEY_PM_STATE_LCDOFF :
-               case VCONFKEY_PM_STATE_SLEEP :
+               case VCONFKEY_PM_STATE_LCDOFF:
+               case VCONFKEY_PM_STATE_SLEEP:
                        result = LCD_OFF;
                        break;
                }
@@ -4157,9 +3454,8 @@ static void se_connected_thread_func(gpointer user_data)
 
                /* lock state */
                ret = display_lock_state(__display_state, STAY_CUR_STATE, 0);
-               if (ret < 0) {
+               if (ret < 0)
                        DEBUG_ERR_MSG("display_lock_state failed, [%d]", ret);
-               }
        }
 #endif
 }
@@ -4168,13 +3464,10 @@ void net_nfc_server_se_connected(void *info)
 {
        DEBUG_SERVER_MSG("net_nfc_server_se_connected");
 
-       if (net_nfc_server_controller_async_queue_push_force(
-               se_connected_thread_func,
-               NULL) == FALSE) {
+       if (net_nfc_server_controller_async_queue_push_force(se_connected_thread_func, NULL) == FALSE)
                DEBUG_ERR_MSG("can not push to controller thread");
-       }
 
-       /* FIXME : should be removed when plugins would be fixed*/
+       /* FIXME : should be removed when plugins would be fixed */
        _net_nfc_util_free_mem(info);
 }
 
@@ -4189,9 +3482,8 @@ static void se_rf_field_off_thread_func(gpointer user_data)
 
                /* lock timeout */
                ret = display_lock_state(__display_state, STAY_CUR_STATE, 1000);
-               if (ret < 0) {
+               if (ret < 0)
                        DEBUG_ERR_MSG("display_lock_state failed, [%d]", ret);
-               }
 #endif
        }
 }
@@ -4200,18 +3492,14 @@ void net_nfc_server_se_rf_field_off(void *info)
 {
        DEBUG_SERVER_MSG("net_nfc_server_se_rf_field_off");
 
-       if (net_nfc_server_controller_async_queue_push_force(
-               se_rf_field_off_thread_func,
-               NULL) == FALSE) {
+       if (net_nfc_server_controller_async_queue_push_force(se_rf_field_off_thread_func, NULL) == FALSE)
                DEBUG_ERR_MSG("can not push to controller thread");
-       }
 
-       /* FIXME : should be removed when plugins would be fixed*/
+       /* FIXME : should be removed when plugins would be fixed */
        _net_nfc_util_free_mem(info);
 }
 
-void net_nfc_server_se_convert_to_binary(uint8_t *orig, size_t len,
-       uint8_t **dest, size_t *destLen)
+void net_nfc_server_se_convert_to_binary(uint8_t * orig, size_t len, uint8_t ** dest, size_t * destLen)
 {
        size_t i = 0;
 
@@ -4230,7 +3518,7 @@ void net_nfc_server_se_convert_to_binary(uint8_t *orig, size_t len,
        }
 }
 
-void net_nfc_server_se_create_deactivate_apdu_command(uint8_t *orig, uint8_t **dest, size_t *destLen)
+void net_nfc_server_se_create_deactivate_apdu_command(uint8_t * orig, uint8_t ** dest, size_t * destLen)
 {
 }
 
@@ -4240,7 +3528,7 @@ void net_nfc_server_se_create_deactivate_apdu_command(uint8_t *orig, uint8_t **d
 static void net_nfc_server_se_deactivated_card_thread_func(gpointer user_data)
 {
        net_nfc_target_handle_s *handle = NULL;
-       uint8_t cmd_select_scrs[] = {0x00, 0xA4, 0x04, 0x00, 0x09, 0xA0, 0x00, 0x00, 0x01, 0x51, 0x43, 0x52, 0x53, 0x00};
+       uint8_t cmd_select_scrs[] = { 0x00, 0xA4, 0x04, 0x00, 0x09, 0xA0, 0x00, 0x00, 0x01, 0x51, 0x43, 0x52, 0x53, 0x00 };
        uint8_t *cmd = NULL;
        data_s *command = NULL;
        data_s *response = NULL;
@@ -4262,43 +3550,34 @@ static void net_nfc_server_se_deactivated_card_thread_func(gpointer user_data)
                fp = fopen(FIRST_BOOT_USEESE_FILE_PATH, "w+");
                if (!fp) {
                        DEBUG_ERR_MSG("error");
-                                       printf( "is_first_boot.daopen error = %dn", errno);
+                       printf("is_first_boot.daopen error = %dn", errno);
                }
                fclose(fp);
-       }
-       else {
+       } else {
                fclose(fp);
        }
 
 #endif
-       result = access( FIRST_BOOT_USEESE_FILE_PATH, 0 );
-
+       result = access(FIRST_BOOT_USEESE_FILE_PATH, 0);
 
-       if( result == 0 )
-       {
+       if (result == 0) {
                DEBUG_SERVER_MSG("first boot NO");
                return;
-       }
-       else if( result == -1 )
-       {
+       } else if (result == -1) {
                DEBUG_SERVER_MSG("first boot YES");
                fp = fopen(FIRST_BOOT_USEESE_FILE_PATH, "w+");
-               if (fp)
-               {
+               if (fp) {
                        fclose(fp);
-               }
-               else
-               {
+               } else {
                        DEBUG_ERR_MSG("error");
-                       DEBUG_ERR_MSG( "is_first_boot.daopen error = %dn", errno);
+                       DEBUG_ERR_MSG("is_first_boot.daopen error = %dn", errno);
                }
        }
 
-
        fp = fopen(USEESE_FILE_PATH, "r");
        if (!fp) {
                DEBUG_SERVER_MSG("fp is null");
-               DEBUG_ERR_MSG( "aid.dat open error = %dn", errno);
+               DEBUG_ERR_MSG("aid.dat open error = %dn", errno);
                return;
        }
        fseek(fp, 0, SEEK_SET);
@@ -4317,7 +3596,7 @@ static void net_nfc_server_se_deactivated_card_thread_func(gpointer user_data)
 
        if (count > 0) {
                token = strtok(buf, ";");
-               while(token) {
+               while (token) {
                        SECURE_MSG("Token[%d] : %s", token_counter, token);
                        list = g_list_append(list, strdup(token));
                        token_counter++;
@@ -4329,60 +3608,54 @@ static void net_nfc_server_se_deactivated_card_thread_func(gpointer user_data)
        DEBUG_SERVER_MSG("start sleep");
        sleep(1);
        DEBUG_SERVER_MSG("end sleep");
-       if (net_nfc_server_se_is_ese_handle(handle) == true)
-       {
+       if (net_nfc_server_se_is_ese_handle(handle) == true) {
                command = net_nfc_util_create_data(14);
                memcpy(command->buffer, cmd_select_scrs, command->length);
-               (void)net_nfc_controller_secure_element_send_apdu(
-                               handle, command, &response, &result);
+               (void)net_nfc_controller_secure_element_send_apdu(handle, command, &response, &result);
                SECURE_MSG("net_nfc_controller_secure_element_send_apdu[scrs] : %d", result);
 
                if (response != NULL) {
-                       for (k=0; k<response->length;k++) {
+                       for (k = 0; k < response->length; k++)
                                SECURE_MSG("%02X", (int)response->buffer[k]);
-                       }
                }
 
-               if (result == NET_NFC_OK /*&& response->buffer*/) {
+               if (result == NET_NFC_OK) {
                        net_nfc_util_clear_data(command);
                        net_nfc_util_clear_data(response);
 
                        for (i = 0; i < g_list_length(list); i++) {
-                               GListnode;
+                               GList *node;
                                node = g_list_nth(list, i);
 
                                if (node == NULL)
                                        continue;
 
-                               SECURE_MSG("[%d]th list value is %s", i, (char*)node->data);
+                               SECURE_MSG("[%d]th list value is %s", i, (char *)node->data);
 
-                               net_nfc_server_se_convert_to_binary((uint8_t *)node->data, strlen((char *)node->data), &cmd, &size);
+                               net_nfc_server_se_convert_to_binary((uint8_t *) node->data, strlen((char *)node->data), &cmd, &size);
 
                                net_nfc_util_free_data(command);
 
-                               command = net_nfc_util_create_data(size+7);
+                               command = net_nfc_util_create_data(size + 7);
                                command->buffer[0] = (unsigned char)0x80;
                                command->buffer[1] = (unsigned char)0xF0;
                                command->buffer[2] = (unsigned char)0x01;
                                command->buffer[3] = (unsigned char)0x00;
-                               command->buffer[4] = (unsigned char)((size+2) & 0xFF);
+                               command->buffer[4] = (unsigned char)((size + 2) & 0xFF);
                                command->buffer[5] = (unsigned char)0x4F;
                                command->buffer[6] = (unsigned char)(size & 0xFF);
                                memcpy(command->buffer + 7, cmd, size);
 
                                SECURE_MSG("COMMAND : ");
-                               for (j=0; j<command->length;j++) {
+                               for (j = 0; j < command->length; j++)
                                        SECURE_MSG("%02X", (int)command->buffer[j]);
-                               }
 
-                               net_nfc_controller_secure_element_send_apdu(
-                                               handle, command, &response, &result);
+                               net_nfc_controller_secure_element_send_apdu(handle, command, &response, &result);
                                SECURE_MSG("net_nfc_controller_secure_element_send_apdu[%d] : %d", i, result);
 
                                if (response != NULL) {
-                                       for (k=0; k<response->length;k++) {
+                                       for (k = 0; k < response->length; k++)
                                                SECURE_MSG("%02X", (int)response->buffer[k]);
-                                       }
                                        if (response->buffer[response->length - 2] == (unsigned char)0x63 && response->buffer[response->length - 1] == (unsigned char)0x20) {
                                                //remove default card
                                                net_nfc_util_clear_data(command);
@@ -4390,7 +3663,7 @@ static void net_nfc_server_se_deactivated_card_thread_func(gpointer user_data)
 
                                                net_nfc_util_free_data(command);
 
-                                               command = net_nfc_util_create_data(size+5);
+                                               command = net_nfc_util_create_data(size + 5);
                                                command->buffer[0] = (unsigned char)0x80;
                                                command->buffer[1] = (unsigned char)0xF0;
                                                command->buffer[2] = (unsigned char)0x28;
@@ -4399,16 +3672,13 @@ static void net_nfc_server_se_deactivated_card_thread_func(gpointer user_data)
                                                memcpy(command->buffer + 5, cmd, size);
 
                                                DEBUG_SERVER_MSG("COMMAND : ");
-                                               for (k =0; k <command->length;k++) {
+                                               for (k = 0; k < command->length; k++)
                                                        DEBUG_SERVER_MSG("%02X", (int)command->buffer[k]);
-                                               }
 
-                                               net_nfc_controller_secure_element_send_apdu(
-                                                               handle, command, &response, &result);
+                                               net_nfc_controller_secure_element_send_apdu(handle, command, &response, &result);
                                                DEBUG_SERVER_MSG("net_nfc_controller_secure_element_send_apdu[%d] : %d", i, result);
-                                               for (k=0; k<response->length;k++) {
+                                               for (k = 0; k < response->length; k++)
                                                        SECURE_MSG("%02X", (int)response->buffer[k]);
-                                               }
                                        } else {
                                                DEBUG_SERVER_MSG("error none");
                                        }
@@ -4418,17 +3688,15 @@ static void net_nfc_server_se_deactivated_card_thread_func(gpointer user_data)
                                net_nfc_util_clear_data(response);
 
                        }
-                       g_list_free_full(list, (GDestroyNotify)free);
+                       g_list_free_full(list, (GDestroyNotify) free);
 
                        result = remove(USEESE_FILE_PATH);
-                       if (result != 0) {
+                       if (result != 0)
                                DEBUG_ERR_MSG("remove failed, [%d]", result);
-                       }
                }
                result = net_nfc_server_se_close_ese();
                SECURE_MSG("net_nfc_server_se_close_ese() : %d", result);
-       }
-       else {
+       } else {
                DEBUG_ERR_MSG("failed to net_nfc_server_se_open_ese()");
        }
 
@@ -4440,10 +3708,6 @@ static void net_nfc_server_se_deactivated_card_thread_func(gpointer user_data)
 
 void net_nfc_server_se_deactivate_card(void)
 {
-       if (net_nfc_server_controller_async_queue_push_force(
-                       net_nfc_server_se_deactivated_card_thread_func,
-                                       NULL) == FALSE)
-       {
+       if (net_nfc_server_controller_async_queue_push_force(net_nfc_server_se_deactivated_card_thread_func, NULL) == FALSE)
                DEBUG_ERR_MSG("Failed to push onto the queue");
-       }
 }
index 31019cf..7667850 100755 (executable)
 #include "net_nfc_server_context_internal.h"
 
 /* declaration */
-static gboolean _handle_start_server(
-       NetNfcGDbusSnep *object,
-       GDBusMethodInvocation *invocation,
-       guint arg_handle,
-       guint arg_sap,
-       const gchar *arg_san,
-       guint arg_user_data,
-       GVariant *arg_privilege);
-
-static gboolean _handle_start_client(
-       NetNfcGDbusSnep *object,
-       GDBusMethodInvocation *invocation,
-       guint arg_handle,
-       guint arg_sap,
-       const gchar *arg_san,
-       guint arg_user_data,
-       GVariant *arg_privilege);
-
-static gboolean _handle_client_send_request(
-       NetNfcGDbusSnep *object,
-       GDBusMethodInvocation *invocation,
-       guint arg_snep_handle,
-       guint arg_type,
-       GVariant *arg_ndef_msg,
-       GVariant *arg_privilege);
-
-static gboolean _handle_stop_snep(
-       NetNfcGDbusSnep *object,
-       GDBusMethodInvocation *invocation,
-       guint arg_handle,
-       guint arg_snep_handle,
-       GVariant *arg_privilege);
+static gboolean _handle_start_server(NetNfcGDbusSnep * object, GDBusMethodInvocation * invocation, guint arg_handle, guint arg_sap, const gchar * arg_san, guint arg_user_data, GVariant * arg_privilege);
+
+static gboolean _handle_start_client(NetNfcGDbusSnep * object, GDBusMethodInvocation * invocation, guint arg_handle, guint arg_sap, const gchar * arg_san, guint arg_user_data, GVariant * arg_privilege);
+
+static gboolean _handle_client_send_request(NetNfcGDbusSnep * object, GDBusMethodInvocation * invocation, guint arg_snep_handle, guint arg_type, GVariant * arg_ndef_msg, GVariant * arg_privilege);
+
+static gboolean _handle_stop_snep(NetNfcGDbusSnep * object, GDBusMethodInvocation * invocation, guint arg_handle, guint arg_snep_handle, GVariant * arg_privilege);
 
 static void snep_server_start_thread_func(gpointer user_data);
 
@@ -70,13 +45,9 @@ static void snep_client_send_request_thread_func(gpointer user_data);
 static void snep_stop_service_thread_func(gpointer user_data);
 
 /* definition */
-static NetNfcGDbusSnep *snep_skeleton =  NULL;
+static NetNfcGDbusSnep *snep_skeleton = NULL;
 
-static void _emit_snep_event_signal(GVariant *parameter,
-       net_nfc_snep_handle_h handle,
-       net_nfc_error_e result,
-       uint32_t type,
-       data_s *data)
+static void _emit_snep_event_signal(GVariant * parameter, net_nfc_snep_handle_h handle, net_nfc_error_e result, uint32_t type, data_s * data)
 {
        GDBusConnection *connection;
        char *client_id;
@@ -84,74 +55,49 @@ static void _emit_snep_event_signal(GVariant *parameter,
        GVariant *arg_data;
        GError *error = NULL;
 
-       g_variant_get(parameter, "(usu)",
-               (guint *)&connection,
-               &client_id,
-               (guint *)&user_data);
+       g_variant_get(parameter, "(usu)", (guint *) & connection, &client_id, (guint *) & user_data);
 
        arg_data = net_nfc_util_gdbus_data_to_variant(data);
 
-       if (g_dbus_connection_emit_signal(
-               connection,
-               client_id,
-               "/org/tizen/NetNfcService/Snep",
-               "org.tizen.NetNfcService.Snep",
-               "SnepEvent",
-               g_variant_new("(uui@a(y)u)",
-                       GPOINTER_TO_UINT(handle),
-                       type,
-                       (gint)result,
-                       arg_data,
-                       GPOINTER_TO_UINT(user_data)),
-               &error) == false) {
-               if (error != NULL && error->message != NULL) {
+       if (g_dbus_connection_emit_signal(connection, client_id, "/org/tizen/NetNfcService/Snep", "org.tizen.NetNfcService.Snep", "SnepEvent", g_variant_new("(uui@a(y)u)", GPOINTER_TO_UINT(handle), type, (gint) result, arg_data, GPOINTER_TO_UINT(user_data)), &error) == false) {
+               if (error != NULL && error->message != NULL)
                        DEBUG_ERR_MSG("g_dbus_connection_emit_signal failed : %s", error->message);
-               } else {
+               else
                        DEBUG_ERR_MSG("g_dbus_connection_emit_signal failed");
-               }
        }
 
        g_free(client_id);
 }
 
-static net_nfc_error_e _snep_server_cb(net_nfc_snep_handle_h handle,
-       net_nfc_error_e result,
-       uint32_t type,
-       data_s *data,
-       void *user_param)
+static net_nfc_error_e _snep_server_cb(net_nfc_snep_handle_h handle, net_nfc_error_e result, uint32_t type, data_s * data, void *user_param)
 {
-       GVariant *parameter = (GVariant *)user_param;
+       GVariant *parameter = (GVariant *) user_param;
 
        data_s *temp = data;
 
-       DEBUG_SERVER_MSG("type [%d], result [%d], data [%p], user_param [%p]",
-                       type, result, data, user_param);
+       DEBUG_SERVER_MSG("type [%d], result [%d], data [%p], user_param [%p]", type, result, data, user_param);
 
-       switch (type)
-       {
-       case SNEP_REQ_GET :
+       switch (type) {
+       case SNEP_REQ_GET:
                {
                        uint32_t max_len = 0;
 
-                       net_nfc_server_snep_parse_get_request(data, &max_len,
-                               temp);
+                       net_nfc_server_snep_parse_get_request(data, &max_len, temp);
                }
                break;
 
-       case SNEP_REQ_PUT :
-                       break;
+       case SNEP_REQ_PUT:
+               break;
 
-       default :
+       default:
                DEBUG_ERR_MSG("error [%d]", result);
                break;
        }
 
-       if (result < NET_NFC_OK) {
+       if (result < NET_NFC_OK)
                type = NET_NFC_LLCP_STOP;
-       }
 
-       _emit_snep_event_signal(parameter, handle,
-               result, type, data);
+       _emit_snep_event_signal(parameter, handle, result, type, data);
 
        if (type == NET_NFC_LLCP_STOP) {
 
@@ -159,10 +105,7 @@ static net_nfc_error_e _snep_server_cb(net_nfc_snep_handle_h handle,
                char *client_id;
                void *user_data;
 
-               g_variant_get(parameter, "(usu)",
-                       (guint *)&connection,
-                       &client_id,
-                       (guint *)&user_data);
+               g_variant_get(parameter, "(usu)", (guint *) & connection, &client_id, (guint *) & user_data);
 
                g_object_unref(connection);
                g_variant_unref(parameter);
@@ -184,40 +127,24 @@ static void snep_server_start_thread_func(gpointer user_data)
        GVariant *parameter;
        GDBusConnection *connection;
 
-       if (user_data == NULL)
-       {
+       if (user_data == NULL) {
                DEBUG_ERR_MSG("cannot get SNEP client data");
 
                return;
        }
 
-       g_variant_get((GVariant *)user_data,
-               "(uuuusu)",
-               (guint *)&object,
-               (guint *)&invocation,
-               (guint *)&arg_handle,
-               &arg_sap,
-               &arg_san,
-               (guint *)&arg_user_data);
+       g_variant_get((GVariant *) user_data, "(uuuusu)", (guint *) & object, (guint *) & invocation, (guint *) & arg_handle, &arg_sap, &arg_san, (guint *) & arg_user_data);
 
        g_assert(object != NULL);
        g_assert(invocation != NULL);
 
        connection = g_dbus_method_invocation_get_connection(invocation);
 
-       parameter = g_variant_new("(usu)",
-               GPOINTER_TO_UINT(g_object_ref(connection)),
-               g_dbus_method_invocation_get_sender(invocation),
-               GPOINTER_TO_UINT(arg_user_data));
+       parameter = g_variant_new("(usu)", GPOINTER_TO_UINT(g_object_ref(connection)), g_dbus_method_invocation_get_sender(invocation), GPOINTER_TO_UINT(arg_user_data));
        if (parameter != NULL) {
-               result = net_nfc_server_snep_server(arg_handle,
-                       arg_san,
-                       arg_sap,
-                       _snep_server_cb,
-                       parameter);
+               result = net_nfc_server_snep_server(arg_handle, arg_san, arg_sap, _snep_server_cb, parameter);
                if (result != NET_NFC_OK) {
-                       DEBUG_ERR_MSG("net_nfc_server_snep_server failed, [%d]",
-                                       result);
+                       DEBUG_ERR_MSG("net_nfc_server_snep_server failed, [%d]", result);
                        g_object_unref(connection);
 
                        g_variant_unref(parameter);
@@ -237,20 +164,12 @@ static void snep_server_start_thread_func(gpointer user_data)
        g_variant_unref(user_data);
 }
 
-static gboolean _handle_start_server(
-       NetNfcGDbusSnep *object,
-       GDBusMethodInvocation *invocation,
-       guint arg_handle,
-       guint arg_sap,
-       const gchar *arg_san,
-       guint arg_user_data,
-       GVariant *arg_privilege)
+static gboolean _handle_start_server(NetNfcGDbusSnep * object, GDBusMethodInvocation * invocation, guint arg_handle, guint arg_sap, const gchar * arg_san, guint arg_user_data, GVariant * arg_privilege)
 {
        GVariant *parameter = NULL;
        gint result;
 
-       INFO_MSG(">>> REQUEST from [%s]",
-               g_dbus_method_invocation_get_sender(invocation));
+       INFO_MSG(">>> REQUEST from [%s]", g_dbus_method_invocation_get_sender(invocation));
 
        /* check privilege and update client context */
        if (net_nfc_server_gdbus_check_privilege(invocation, NET_NFC_PRIVILEGE_NFC_P2P) == false) {
@@ -260,24 +179,15 @@ static gboolean _handle_start_server(
                goto ERROR;
        }
 
-       parameter = g_variant_new("(uuuusu)",
-               GPOINTER_TO_UINT(g_object_ref(object)),
-               GPOINTER_TO_UINT(g_object_ref(invocation)),
-               arg_handle,
-               arg_sap,
-               arg_san,
-               arg_user_data);
-       if (parameter == NULL)
-       {
+       parameter = g_variant_new("(uuuusu)", GPOINTER_TO_UINT(g_object_ref(object)), GPOINTER_TO_UINT(g_object_ref(invocation)), arg_handle, arg_sap, arg_san, arg_user_data);
+       if (parameter == NULL) {
                DEBUG_ERR_MSG("Memory allocation failed");
                result = NET_NFC_ALLOC_FAIL;
 
                goto ERROR;
        }
 
-       if (net_nfc_server_controller_async_queue_push(
-               snep_server_start_thread_func, parameter) == FALSE)
-       {
+       if (net_nfc_server_controller_async_queue_push(snep_server_start_thread_func, parameter) == FALSE) {
                /* return error if queue was blocked */
                DEBUG_SERVER_MSG("controller is processing important message..");
                result = NET_NFC_BUSY;
@@ -287,7 +197,7 @@ static gboolean _handle_start_server(
 
        return TRUE;
 
-ERROR :
+ ERROR:
        if (parameter != NULL) {
                g_object_unref(invocation);
                g_object_unref(object);
@@ -300,23 +210,16 @@ ERROR :
        return TRUE;
 }
 
-static net_nfc_error_e _snep_start_client_cb(
-       net_nfc_snep_handle_h handle,
-       net_nfc_error_e result,
-       uint32_t type,
-       data_s *data,
-       void *user_param)
+static net_nfc_error_e _snep_start_client_cb(net_nfc_snep_handle_h handle, net_nfc_error_e result, uint32_t type, data_s * data, void *user_param)
 {
-       GVariant *parameter = (GVariant *)user_param;
+       GVariant *parameter = (GVariant *) user_param;
 
-       DEBUG_SERVER_MSG("type [%d], result [%d], data [%p], user_param [%p]",
-                       type, result, data, user_param);
+       DEBUG_SERVER_MSG("type [%d], result [%d], data [%p], user_param [%p]", type, result, data, user_param);
 
        _emit_snep_event_signal(parameter, handle, result, type, data);
 
-       if (type == NET_NFC_LLCP_STOP) {
+       if (type == NET_NFC_LLCP_STOP)
                g_variant_unref(parameter);
-       }
 
        return result;
 }
@@ -334,40 +237,24 @@ static void snep_client_start_thread_func(gpointer user_data)
        GVariant *parameter;
        GDBusConnection *connection;
 
-       if (user_data == NULL)
-       {
+       if (user_data == NULL) {
                DEBUG_ERR_MSG("cannot get SNEP client data");
 
                return;
        }
 
-       g_variant_get((GVariant *)user_data,
-               "(uuuusu)",
-               (guint *)&object,
-               (guint *)&invocation,
-               (guint *)&arg_handle,
-               &arg_sap,
-               &arg_san,
-               (guint *)&arg_user_data);
+       g_variant_get((GVariant *) user_data, "(uuuusu)", (guint *) & object, (guint *) & invocation, (guint *) & arg_handle, &arg_sap, &arg_san, (guint *) & arg_user_data);
 
        g_assert(object != NULL);
        g_assert(invocation != NULL);
 
        connection = g_dbus_method_invocation_get_connection(invocation);
 
-       parameter = g_variant_new("(usu)",
-               GPOINTER_TO_UINT(g_object_ref(connection)),
-               g_dbus_method_invocation_get_sender(invocation),
-               GPOINTER_TO_UINT(arg_user_data));
+       parameter = g_variant_new("(usu)", GPOINTER_TO_UINT(g_object_ref(connection)), g_dbus_method_invocation_get_sender(invocation), GPOINTER_TO_UINT(arg_user_data));
        if (parameter != NULL) {
-               result = net_nfc_server_snep_client(arg_handle,
-                       arg_san,
-                       arg_sap,
-                       _snep_start_client_cb,
-                       parameter);
+               result = net_nfc_server_snep_client(arg_handle, arg_san, arg_sap, _snep_start_client_cb, parameter);
                if (result != NET_NFC_OK) {
-                       DEBUG_ERR_MSG("net_nfc_server_snep_client failed, [%d]",
-                                       result);
+                       DEBUG_ERR_MSG("net_nfc_server_snep_client failed, [%d]", result);
                        g_object_unref(connection);
 
                        g_variant_unref(parameter);
@@ -387,20 +274,12 @@ static void snep_client_start_thread_func(gpointer user_data)
        g_variant_unref(user_data);
 }
 
-static gboolean _handle_start_client(
-       NetNfcGDbusSnep *object,
-       GDBusMethodInvocation *invocation,
-       guint arg_handle,
-       guint arg_sap,
-       const gchar *arg_san,
-       guint arg_user_data,
-       GVariant *arg_privilege)
+static gboolean _handle_start_client(NetNfcGDbusSnep * object, GDBusMethodInvocation * invocation, guint arg_handle, guint arg_sap, const gchar * arg_san, guint arg_user_data, GVariant * arg_privilege)
 {
        GVariant *parameter = NULL;
        gint result;
 
-       INFO_MSG(">>> REQUEST from [%s]",
-               g_dbus_method_invocation_get_sender(invocation));
+       INFO_MSG(">>> REQUEST from [%s]", g_dbus_method_invocation_get_sender(invocation));
 
        /* check privilege and update client context */
        if (net_nfc_server_gdbus_check_privilege(invocation, NET_NFC_PRIVILEGE_NFC_P2P) == false) {
@@ -410,24 +289,15 @@ static gboolean _handle_start_client(
                goto ERROR;
        }
 
-       parameter = g_variant_new("(uuuusu)",
-               GPOINTER_TO_UINT(g_object_ref(object)),
-               GPOINTER_TO_UINT(g_object_ref(invocation)),
-               arg_handle,
-               arg_sap,
-               arg_san,
-               arg_user_data);
-       if (parameter == NULL)
-       {
+       parameter = g_variant_new("(uuuusu)", GPOINTER_TO_UINT(g_object_ref(object)), GPOINTER_TO_UINT(g_object_ref(invocation)), arg_handle, arg_sap, arg_san, arg_user_data);
+       if (parameter == NULL) {
                DEBUG_ERR_MSG("Memory allocation failed");
                result = NET_NFC_ALLOC_FAIL;
 
                goto ERROR;
        }
 
-       if (net_nfc_server_controller_async_queue_push(
-               snep_client_start_thread_func, parameter) == FALSE)
-       {
+       if (net_nfc_server_controller_async_queue_push(snep_client_start_thread_func, parameter) == FALSE) {
                /* return error if queue was blocked */
                DEBUG_SERVER_MSG("controller is processing important message..");
                result = NET_NFC_BUSY;
@@ -437,7 +307,7 @@ static gboolean _handle_start_client(
 
        return TRUE;
 
-ERROR :
+ ERROR:
        if (parameter != NULL) {
                g_object_unref(invocation);
                g_object_unref(object);
@@ -450,17 +320,11 @@ ERROR :
        return TRUE;
 }
 
-static net_nfc_error_e _snep_client_request_cb(
-       net_nfc_snep_handle_h handle,
-       net_nfc_error_e result,
-       net_nfc_snep_type_t type,
-       data_s *data,
-       void *user_param)
+static net_nfc_error_e _snep_client_request_cb(net_nfc_snep_handle_h handle, net_nfc_error_e result, net_nfc_snep_type_t type, data_s * data, void *user_param)
 {
-       GVariant *parameter = (GVariant *)user_param;
+       GVariant *parameter = (GVariant *) user_param;
 
-       DEBUG_SERVER_MSG("type [%d], result [%d], data [%p], user_param [%p]",
-               type, result, data, user_param);
+       DEBUG_SERVER_MSG("type [%d], result [%d], data [%p], user_param [%p]", type, result, data, user_param);
 
        if (parameter != NULL) {
                NetNfcGDbusSnep *object;
@@ -470,25 +334,14 @@ static net_nfc_error_e _snep_client_request_cb(
                GVariant *arg_ndef_msg;
                GVariant *arg_data = NULL;
 
-               g_variant_get(parameter,
-                       "(uuuu@a(y))",
-                       (guint *)&object,
-                       (guint *)&invocation,
-                       (guint *)&arg_snep_handle,
-                       (guint *)&arg_type,
-                       &arg_ndef_msg);
+               g_variant_get(parameter, "(uuuu@a(y))", (guint *) & object, (guint *) & invocation, (guint *) & arg_snep_handle, (guint *) & arg_type, &arg_ndef_msg);
 
-               if (data != NULL && data->buffer != NULL && data->length > 0) {
+               if (data != NULL && data->buffer != NULL && data->length > 0)
                        arg_data = net_nfc_util_gdbus_data_to_variant(data);
-               } else {
+               else
                        arg_data = net_nfc_util_gdbus_buffer_to_variant(NULL, 0);
-               }
 
-               net_nfc_gdbus_snep_complete_client_request(object,
-                       invocation,
-                       result,
-                       type,
-                       arg_data);
+               net_nfc_gdbus_snep_complete_client_request(object, invocation, result, type, arg_data);
 
                g_variant_unref(arg_ndef_msg);
 
@@ -515,42 +368,28 @@ static void snep_client_send_request_thread_func(gpointer user_data)
        data_s data = { NULL, };
        net_nfc_error_e result;
 
-       if (user_data == NULL)
-       {
+       if (user_data == NULL) {
                DEBUG_ERR_MSG("cannot get SNEP client data");
 
                return;
        }
 
-       g_variant_get((GVariant *)user_data,
-               "(uuuu@a(y))",
-               (guint *)&object,
-               (guint *)&invocation,
-               (guint *)&arg_snep_handle,
-               (guint *)&arg_type,
-               &arg_ndef_msg);
+       g_variant_get((GVariant *) user_data, "(uuuu@a(y))", (guint *) & object, (guint *) & invocation, (guint *) & arg_snep_handle, (guint *) & arg_type, &arg_ndef_msg);
 
        g_assert(object != NULL);
        g_assert(invocation != NULL);
 
        net_nfc_util_gdbus_variant_to_data_s(arg_ndef_msg, &data);
 
-       result = net_nfc_server_snep_client_request(arg_snep_handle,
-               arg_type,
-               &data,
-               _snep_client_request_cb,
-               user_data);
-       if (result != NET_NFC_OK)
-       {
+       result = net_nfc_server_snep_client_request(arg_snep_handle, arg_type, &data, _snep_client_request_cb, user_data);
+       if (result != NET_NFC_OK) {
                GVariant *resp;
 
-               DEBUG_ERR_MSG("net_nfc_server_snep_client_request  "
-                       "failed, [%d]",result);
+               DEBUG_ERR_MSG("net_nfc_server_snep_client_request  " "failed, [%d]", result);
 
                resp = net_nfc_util_gdbus_buffer_to_variant(NULL, 0);
 
-               net_nfc_gdbus_snep_complete_client_request(object,
-                       invocation, result, NET_NFC_LLCP_STOP, resp);
+               net_nfc_gdbus_snep_complete_client_request(object, invocation, result, NET_NFC_LLCP_STOP, resp);
 
                g_object_unref(invocation);
                g_object_unref(object);
@@ -563,19 +402,12 @@ static void snep_client_send_request_thread_func(gpointer user_data)
        g_variant_unref(arg_ndef_msg);
 }
 
-static gboolean _handle_client_send_request(
-       NetNfcGDbusSnep *object,
-       GDBusMethodInvocation *invocation,
-       guint arg_snep_handle,
-       guint arg_type,
-       GVariant *arg_ndef_msg,
-       GVariant *arg_privilege)
+static gboolean _handle_client_send_request(NetNfcGDbusSnep * object, GDBusMethodInvocation * invocation, guint arg_snep_handle, guint arg_type, GVariant * arg_ndef_msg, GVariant * arg_privilege)
 {
        GVariant *parameter = NULL;
        gint result;
 
-       INFO_MSG(">>> REQUEST from [%s]",
-               g_dbus_method_invocation_get_sender(invocation));
+       INFO_MSG(">>> REQUEST from [%s]", g_dbus_method_invocation_get_sender(invocation));
 
        /* check privilege and update client context */
        if (net_nfc_server_gdbus_check_privilege(invocation, NET_NFC_PRIVILEGE_NFC_P2P) == false) {
@@ -585,24 +417,16 @@ static gboolean _handle_client_send_request(
                goto ERROR;
        }
 
-       parameter = g_variant_new("(uuuu@a(y))",
-               GPOINTER_TO_UINT(g_object_ref(object)),
-               GPOINTER_TO_UINT(g_object_ref(invocation)),
-               arg_snep_handle,
-               arg_type,
-               arg_ndef_msg);
+       parameter = g_variant_new("(uuuu@a(y))", GPOINTER_TO_UINT(g_object_ref(object)), GPOINTER_TO_UINT(g_object_ref(invocation)), arg_snep_handle, arg_type, arg_ndef_msg);
 
-       if (parameter == NULL)
-       {
+       if (parameter == NULL) {
                DEBUG_ERR_MSG("Memory allocation failed");
                result = NET_NFC_ALLOC_FAIL;
 
                goto ERROR;
        }
 
-       if (net_nfc_server_controller_async_queue_push(
-               snep_client_send_request_thread_func, parameter) == FALSE)
-       {
+       if (net_nfc_server_controller_async_queue_push(snep_client_send_request_thread_func, parameter) == FALSE) {
                /* return error if queue was blocked */
                DEBUG_SERVER_MSG("controller is processing important message..");
                result = NET_NFC_BUSY;
@@ -612,7 +436,7 @@ static gboolean _handle_client_send_request(
 
        return TRUE;
 
-ERROR :
+ ERROR:
        if (parameter != NULL) {
                g_object_unref(invocation);
                g_object_unref(object);
@@ -620,11 +444,7 @@ ERROR :
                g_variant_unref(parameter);
        }
 
-       net_nfc_gdbus_snep_complete_client_request(object,
-               invocation,
-               result,
-               NET_NFC_LLCP_STOP,
-               net_nfc_util_gdbus_buffer_to_variant(NULL, 0));
+       net_nfc_gdbus_snep_complete_client_request(object, invocation, result, NET_NFC_LLCP_STOP, net_nfc_util_gdbus_buffer_to_variant(NULL, 0));
 
        return TRUE;
 }
@@ -636,33 +456,25 @@ static void snep_stop_service_thread_func(gpointer user_data)
        net_nfc_target_handle_s *handle;
        net_nfc_snep_handle_h snep_handle;
 
-       if (user_data == NULL)
-       {
+       if (user_data == NULL) {
                DEBUG_ERR_MSG("cannot get SNEP client data");
 
                return;
        }
 
-       g_variant_get((GVariant *)user_data,
-               "(uuuu)",
-               (guint *)&object,
-               (guint *)&invocation,
-               (guint *)&handle,
-               (guint *)&snep_handle);
+       g_variant_get((GVariant *) user_data, "(uuuu)", (guint *) & object, (guint *) & invocation, (guint *) & handle, (guint *) & snep_handle);
 
        g_assert(object != NULL);
        g_assert(invocation != NULL);
 
        /* TODO :
-       g_dbus_method_invocation_return_dbus_error(
-               invocation,
-               "org.tizen.NetNfcService.Snep.DataError",
-               "Cannot stop SNEP service");
-       */
+          g_dbus_method_invocation_return_dbus_error(
+          invocation,
+          "org.tizen.NetNfcService.Snep.DataError",
+          "Cannot stop SNEP service");
+        */
 
-       net_nfc_gdbus_snep_complete_stop_snep(object,
-               invocation,
-               NET_NFC_OK);
+       net_nfc_gdbus_snep_complete_stop_snep(object, invocation, NET_NFC_OK);
 
        g_object_unref(invocation);
        g_object_unref(object);
@@ -670,18 +482,12 @@ static void snep_stop_service_thread_func(gpointer user_data)
        g_variant_unref(user_data);
 }
 
-static gboolean _handle_stop_snep(
-       NetNfcGDbusSnep *object,
-       GDBusMethodInvocation *invocation,
-       guint arg_handle,
-       guint arg_snep_handle,
-       GVariant *arg_privilege)
+static gboolean _handle_stop_snep(NetNfcGDbusSnep * object, GDBusMethodInvocation * invocation, guint arg_handle, guint arg_snep_handle, GVariant * arg_privilege)
 {
        GVariant *parameter = NULL;
        gint result;
 
-       INFO_MSG(">>> REQUEST from [%s]",
-               g_dbus_method_invocation_get_sender(invocation));
+       INFO_MSG(">>> REQUEST from [%s]", g_dbus_method_invocation_get_sender(invocation));
 
        /* check privilege and update client context */
        if (net_nfc_server_gdbus_check_privilege(invocation, NET_NFC_PRIVILEGE_NFC_P2P) == false) {
@@ -691,22 +497,15 @@ static gboolean _handle_stop_snep(
                goto ERROR;
        }
 
-       parameter = g_variant_new("(uuuu)",
-               GPOINTER_TO_UINT(g_object_ref(object)),
-               GPOINTER_TO_UINT(g_object_ref(invocation)),
-               arg_handle,
-               arg_snep_handle);
-       if (parameter == NULL)
-       {
+       parameter = g_variant_new("(uuuu)", GPOINTER_TO_UINT(g_object_ref(object)), GPOINTER_TO_UINT(g_object_ref(invocation)), arg_handle, arg_snep_handle);
+       if (parameter == NULL) {
                DEBUG_ERR_MSG("Memory allocation failed");
                result = NET_NFC_ALLOC_FAIL;
 
                goto ERROR;
        }
 
-       if (net_nfc_server_controller_async_queue_push(
-               snep_stop_service_thread_func, parameter) == FALSE)
-       {
+       if (net_nfc_server_controller_async_queue_push(snep_stop_service_thread_func, parameter) == FALSE) {
                /* return error if queue was blocked */
                DEBUG_SERVER_MSG("controller is processing important message..");
                result = NET_NFC_BUSY;
@@ -716,7 +515,7 @@ static gboolean _handle_stop_snep(
 
        return TRUE;
 
-ERROR :
+ ERROR:
        if (parameter != NULL) {
                g_object_unref(invocation);
                g_object_unref(object);
@@ -724,21 +523,17 @@ ERROR :
                g_variant_unref(parameter);
        }
 
-       net_nfc_gdbus_snep_complete_stop_snep(object,
-               invocation,
-               result);
+       net_nfc_gdbus_snep_complete_stop_snep(object, invocation, result);
 
        return TRUE;
 }
 
-static void _snep_activate_cb(int event, net_nfc_target_handle_s *handle,
-       uint32_t sap, const char *san, void *user_param)
+static void _snep_activate_cb(int event, net_nfc_target_handle_s * handle, uint32_t sap, const char *san, void *user_param)
 {
-       GVariant *parameter = (GVariant *)user_param;
+       GVariant *parameter = (GVariant *) user_param;
        net_nfc_error_e result = NET_NFC_OK;
 
-       DEBUG_SERVER_MSG("event [%d], handle [%p], sap [%d], san [%s]",
-               event, handle, sap, san);
+       DEBUG_SERVER_MSG("event [%d], handle [%p], sap [%d], san [%s]", event, handle, sap, san);
 
        if (event == NET_NFC_LLCP_START) {
                GDBusConnection *connection;
@@ -747,32 +542,22 @@ static void _snep_activate_cb(int event, net_nfc_target_handle_s *handle,
                void *user_data;
 
                /* start server */
-               g_variant_get(parameter, "(usu)",
-                       (guint *)&connection,
-                       &client_id,
-                       (guint *)&user_data);
+               g_variant_get(parameter, "(usu)", (guint *) & connection, &client_id, (guint *) & user_data);
 
-               param = g_variant_new("(usu)",
-                       GPOINTER_TO_UINT(g_object_ref(connection)),
-                       client_id,
-                       GPOINTER_TO_UINT(user_data));
+               param = g_variant_new("(usu)", GPOINTER_TO_UINT(g_object_ref(connection)), client_id, GPOINTER_TO_UINT(user_data));
 
                g_free(client_id);
 
-               result = net_nfc_server_snep_server(handle, (char *)san, sap,
-                       _snep_server_cb, param);
+               result = net_nfc_server_snep_server(handle, (char *)san, sap, _snep_server_cb, param);
                if (result == NET_NFC_OK) {
-                       _emit_snep_event_signal(parameter, handle,
-                               result, event, NULL);
+                       _emit_snep_event_signal(parameter, handle, result, event, NULL);
                } else {
-                       DEBUG_ERR_MSG("net_nfc_server_snep_server failed, [%d]",
-                               result);
+                       DEBUG_ERR_MSG("net_nfc_server_snep_server failed, [%d]", result);
 
                        g_variant_unref(param);
                }
        } else {
-               _emit_snep_event_signal(parameter, handle,
-                       result, NET_NFC_LLCP_UNREGISTERED, NULL);
+               _emit_snep_event_signal(parameter, handle, result, NET_NFC_LLCP_UNREGISTERED, NULL);
 
                /* unregister server */
                g_variant_unref(parameter);
@@ -793,31 +578,17 @@ static void snep_register_server_thread_func(gpointer user_data)
 
        g_assert(user_data != NULL);
 
-       g_variant_get((GVariant *)user_data,
-               "(uuusu)",
-               (guint *)&object,
-               (guint *)&invocation,
-               &arg_sap,
-               &arg_san,
-               &arg_user_data);
+       g_variant_get((GVariant *) user_data, "(uuusu)", (guint *) & object, (guint *) & invocation, &arg_sap, &arg_san, &arg_user_data);
 
        g_assert(object != NULL);
        g_assert(invocation != NULL);
 
        connection = g_dbus_method_invocation_get_connection(invocation);
 
-       parameter = g_variant_new("(usu)",
-               GPOINTER_TO_UINT(g_object_ref(connection)),
-               g_dbus_method_invocation_get_sender(invocation),
-               arg_user_data);
+       parameter = g_variant_new("(usu)", GPOINTER_TO_UINT(g_object_ref(connection)), g_dbus_method_invocation_get_sender(invocation), arg_user_data);
        if (parameter != NULL) {
                /* register default snep server */
-               result = net_nfc_server_llcp_register_service(
-                       g_dbus_method_invocation_get_sender(invocation),
-                       arg_sap,
-                       arg_san,
-                       _snep_activate_cb,
-                       parameter);
+               result = net_nfc_server_llcp_register_service(g_dbus_method_invocation_get_sender(invocation), arg_sap, arg_san, _snep_activate_cb, parameter);
                if (result != NET_NFC_OK) {
                        DEBUG_ERR_MSG("net_nfc_service_llcp_register_service failed, [%d]", result);
                        g_object_unref(connection);
@@ -828,9 +599,7 @@ static void snep_register_server_thread_func(gpointer user_data)
                g_object_unref(connection);
        }
 
-       net_nfc_gdbus_snep_complete_server_register(object,
-               invocation,
-               result);
+       net_nfc_gdbus_snep_complete_server_register(object, invocation, result);
 
        g_free(arg_san);
 
@@ -839,19 +608,12 @@ static void snep_register_server_thread_func(gpointer user_data)
        g_variant_unref(user_data);
 }
 
-static gboolean _handle_register_server(
-       NetNfcGDbusSnep *object,
-       GDBusMethodInvocation *invocation,
-       guint arg_sap,
-       const gchar *arg_san,
-       guint arg_user_data,
-       GVariant *arg_privilege)
+static gboolean _handle_register_server(NetNfcGDbusSnep * object, GDBusMethodInvocation * invocation, guint arg_sap, const gchar * arg_san, guint arg_user_data, GVariant * arg_privilege)
 {
        GVariant *parameter = NULL;
        gint result;
 
-       INFO_MSG(">>> REQUEST from [%s]",
-               g_dbus_method_invocation_get_sender(invocation));
+       INFO_MSG(">>> REQUEST from [%s]", g_dbus_method_invocation_get_sender(invocation));
 
        /* check privilege and update client context */
        if (net_nfc_server_gdbus_check_privilege(invocation, NET_NFC_PRIVILEGE_NFC_P2P) == false) {
@@ -861,23 +623,15 @@ static gboolean _handle_register_server(
                goto ERROR;
        }
 
-       parameter = g_variant_new("(uuusu)",
-               GPOINTER_TO_UINT(g_object_ref(object)),
-               GPOINTER_TO_UINT(g_object_ref(invocation)),
-               arg_sap,
-               arg_san,
-               arg_user_data);
-       if (parameter == NULL)
-       {
+       parameter = g_variant_new("(uuusu)", GPOINTER_TO_UINT(g_object_ref(object)), GPOINTER_TO_UINT(g_object_ref(invocation)), arg_sap, arg_san, arg_user_data);
+       if (parameter == NULL) {
                DEBUG_ERR_MSG("Memory allocation failed");
                result = NET_NFC_ALLOC_FAIL;
 
                goto ERROR;
        }
 
-       if (net_nfc_server_controller_async_queue_push(
-               snep_register_server_thread_func, parameter) == FALSE)
-       {
+       if (net_nfc_server_controller_async_queue_push(snep_register_server_thread_func, parameter) == FALSE) {
                /* return error if queue was blocked */
                DEBUG_SERVER_MSG("controller is processing important message..");
                result = NET_NFC_BUSY;
@@ -887,7 +641,7 @@ static gboolean _handle_register_server(
 
        return TRUE;
 
-ERROR :
+ ERROR:
        if (parameter != NULL) {
                g_object_unref(invocation);
                g_object_unref(object);
@@ -895,9 +649,7 @@ ERROR :
                g_variant_unref(parameter);
        }
 
-       net_nfc_gdbus_snep_complete_server_register(object,
-               invocation,
-               result);
+       net_nfc_gdbus_snep_complete_server_register(object, invocation, result);
 
        return TRUE;
 }
@@ -913,24 +665,14 @@ static void snep_unregister_server_thread_func(gpointer user_data)
 
        g_assert(user_data != NULL);
 
-       g_variant_get((GVariant *)user_data,
-               "(uuus)",
-               (guint *)&object,
-               (guint *)&invocation,
-               &arg_sap,
-               &arg_san);
+       g_variant_get((GVariant *) user_data, "(uuus)", (guint *) & object, (guint *) & invocation, &arg_sap, &arg_san);
 
        g_assert(object != NULL);
        g_assert(invocation != NULL);
 
-       result = net_nfc_server_llcp_unregister_service(
-               g_dbus_method_invocation_get_sender(invocation),
-               arg_sap,
-               arg_san);
+       result = net_nfc_server_llcp_unregister_service(g_dbus_method_invocation_get_sender(invocation), arg_sap, arg_san);
 
-       net_nfc_gdbus_snep_complete_server_unregister(object,
-               invocation,
-               result);
+       net_nfc_gdbus_snep_complete_server_unregister(object, invocation, result);
 
        g_free(arg_san);
 
@@ -940,18 +682,12 @@ static void snep_unregister_server_thread_func(gpointer user_data)
        g_variant_unref(user_data);
 }
 
-static gboolean _handle_unregister_server(
-       NetNfcGDbusSnep *object,
-       GDBusMethodInvocation *invocation,
-       guint arg_sap,
-       const gchar *arg_san,
-       GVariant *arg_privilege)
+static gboolean _handle_unregister_server(NetNfcGDbusSnep * object, GDBusMethodInvocation * invocation, guint arg_sap, const gchar * arg_san, GVariant * arg_privilege)
 {
        GVariant *parameter = NULL;
        gint result;
 
-       INFO_MSG(">>> REQUEST from [%s]",
-               g_dbus_method_invocation_get_sender(invocation));
+       INFO_MSG(">>> REQUEST from [%s]", g_dbus_method_invocation_get_sender(invocation));
 
        /* check privilege and update client context */
        if (net_nfc_server_gdbus_check_privilege(invocation, NET_NFC_PRIVILEGE_NFC_P2P) == false) {
@@ -961,22 +697,15 @@ static gboolean _handle_unregister_server(
                goto ERROR;
        }
 
-       parameter = g_variant_new("(uuus)",
-               GPOINTER_TO_UINT(g_object_ref(object)),
-               GPOINTER_TO_UINT(g_object_ref(invocation)),
-               arg_sap,
-               arg_san);
-       if (parameter == NULL)
-       {
+       parameter = g_variant_new("(uuus)", GPOINTER_TO_UINT(g_object_ref(object)), GPOINTER_TO_UINT(g_object_ref(invocation)), arg_sap, arg_san);
+       if (parameter == NULL) {
                DEBUG_ERR_MSG("Memory allocation failed");
                result = NET_NFC_ALLOC_FAIL;
 
                goto ERROR;
        }
 
-       if (net_nfc_server_controller_async_queue_push(
-               snep_unregister_server_thread_func, parameter) == FALSE)
-       {
+       if (net_nfc_server_controller_async_queue_push(snep_unregister_server_thread_func, parameter) == FALSE) {
                /* return error if queue was blocked */
                DEBUG_SERVER_MSG("controller is processing important message..");
                result = NET_NFC_BUSY;
@@ -986,7 +715,7 @@ static gboolean _handle_unregister_server(
 
        return TRUE;
 
-ERROR :
+ ERROR:
        if (parameter != NULL) {
                g_object_unref(invocation);
                g_object_unref(object);
@@ -994,14 +723,12 @@ ERROR :
                g_variant_unref(parameter);
        }
 
-       net_nfc_gdbus_snep_complete_server_unregister(object,
-               invocation,
-               result);
+       net_nfc_gdbus_snep_complete_server_unregister(object, invocation, result);
 
        return TRUE;
 }
 
-gboolean net_nfc_server_snep_init(GDBusConnection *connection)
+gboolean net_nfc_server_snep_init(GDBusConnection * connection)
 {
        GError *error = NULL;
        gboolean result;
@@ -1011,43 +738,20 @@ gboolean net_nfc_server_snep_init(GDBusConnection *connection)
 
        snep_skeleton = net_nfc_gdbus_snep_skeleton_new();
 
-       g_signal_connect(snep_skeleton,
-               "handle-server-register",
-               G_CALLBACK(_handle_register_server),
-               NULL);
-
-       g_signal_connect(snep_skeleton,
-               "handle-server-unregister",
-               G_CALLBACK(_handle_unregister_server),
-               NULL);
-
-       g_signal_connect(snep_skeleton,
-               "handle-server-start",
-               G_CALLBACK(_handle_start_server),
-               NULL);
-
-       g_signal_connect(snep_skeleton,
-               "handle-client-start",
-               G_CALLBACK(_handle_start_client),
-               NULL);
-
-       g_signal_connect(snep_skeleton,
-               "handle-client-request",
-               G_CALLBACK(_handle_client_send_request),
-               NULL);
-
-       g_signal_connect(snep_skeleton,
-               "handle-stop-snep",
-               G_CALLBACK(_handle_stop_snep),
-               NULL);
-
-       result = g_dbus_interface_skeleton_export(
-               G_DBUS_INTERFACE_SKELETON(snep_skeleton),
-               connection,
-               "/org/tizen/NetNfcService/Snep",
-               &error);
-       if (result == FALSE)
-       {
+       g_signal_connect(snep_skeleton, "handle-server-register", G_CALLBACK(_handle_register_server), NULL);
+
+       g_signal_connect(snep_skeleton, "handle-server-unregister", G_CALLBACK(_handle_unregister_server), NULL);
+
+       g_signal_connect(snep_skeleton, "handle-server-start", G_CALLBACK(_handle_start_server), NULL);
+
+       g_signal_connect(snep_skeleton, "handle-client-start", G_CALLBACK(_handle_start_client), NULL);
+
+       g_signal_connect(snep_skeleton, "handle-client-request", G_CALLBACK(_handle_client_send_request), NULL);
+
+       g_signal_connect(snep_skeleton, "handle-stop-snep", G_CALLBACK(_handle_stop_snep), NULL);
+
+       result = g_dbus_interface_skeleton_export(G_DBUS_INTERFACE_SKELETON(snep_skeleton), connection, "/org/tizen/NetNfcService/Snep", &error);
+       if (result == FALSE) {
                g_error_free(error);
 
                net_nfc_server_snep_deinit();
@@ -1058,8 +762,7 @@ gboolean net_nfc_server_snep_init(GDBusConnection *connection)
 
 void net_nfc_server_snep_deinit(void)
 {
-       if (snep_skeleton)
-       {
+       if (snep_skeleton) {
                g_object_unref(snep_skeleton);
                snep_skeleton = NULL;
        }
index 46aa745..5a71759 100755 (executable)
 #include "net_nfc_server_context_internal.h"
 #include "net_nfc_server_system_handler.h"
 
-
 static NetNfcGDbusPopup *popup_skeleton = NULL;
 
-static gboolean popup_handle_set(NetNfcGDbusPopup *popup_manager,
-       GDBusMethodInvocation *invocation,
-       int state,
-       gint focus_state,
-       GVariant *smack_privilege,
-       gpointer user_data);
-
-static gboolean popup_handle_get(NetNfcGDbusPopup *popup_manager,
-       GDBusMethodInvocation *invocation,
-       GVariant *smack_privilege,
-       gpointer user_data);
-
-static gboolean popup_handle_set(NetNfcGDbusPopup *popup_manager,
-       GDBusMethodInvocation *invocation,
-       gint state,
-       gint focus_state,
-       GVariant *smack_privilege,
-       gpointer user_data)
+static gboolean popup_handle_set(NetNfcGDbusPopup * popup_manager, GDBusMethodInvocation * invocation, int state, gint focus_state, GVariant * smack_privilege, gpointer user_data);
+
+static gboolean popup_handle_get(NetNfcGDbusPopup * popup_manager, GDBusMethodInvocation * invocation, GVariant * smack_privilege, gpointer user_data);
+
+static gboolean popup_handle_set(NetNfcGDbusPopup * popup_manager, GDBusMethodInvocation * invocation, gint state, gint focus_state, GVariant * smack_privilege, gpointer user_data)
 {
        int result = NET_NFC_OK;
 
-       INFO_MSG(">>> REQUEST from [%s]",
-               g_dbus_method_invocation_get_sender(invocation));
+       INFO_MSG(">>> REQUEST from [%s]", g_dbus_method_invocation_get_sender(invocation));
 
        /* check privilege and update client context */
        if (net_nfc_server_gdbus_check_privilege(invocation, NET_NFC_PRIVILEGE_NFC) == false) {
@@ -55,27 +40,21 @@ static gboolean popup_handle_set(NetNfcGDbusPopup *popup_manager,
                goto ERROR;
        }
 
-       net_nfc_server_gdbus_set_launch_state(
-               g_dbus_method_invocation_get_sender(invocation),
-               state, focus_state);
+       net_nfc_server_gdbus_set_launch_state(g_dbus_method_invocation_get_sender(invocation), state, focus_state);
 
-ERROR :
+ ERROR:
 
        net_nfc_gdbus_popup_complete_set(popup_manager, invocation, result);
 
        return TRUE;
 }
 
-static gboolean popup_handle_get(NetNfcGDbusPopup *popup_manager,
-       GDBusMethodInvocation *invocation,
-       GVariant *smack_privilege,
-       gpointer user_data)
+static gboolean popup_handle_get(NetNfcGDbusPopup * popup_manager, GDBusMethodInvocation * invocation, GVariant * smack_privilege, gpointer user_data)
 {
        gboolean state = FALSE;
        int result = NET_NFC_OK;
 
-       INFO_MSG(">>> REQUEST from [%s]",
-               g_dbus_method_invocation_get_sender(invocation));
+       INFO_MSG(">>> REQUEST from [%s]", g_dbus_method_invocation_get_sender(invocation));
 
        /* check privilege and update client context */
        if (net_nfc_server_gdbus_check_privilege(invocation, NET_NFC_PRIVILEGE_NFC) == false) {
@@ -85,18 +64,16 @@ static gboolean popup_handle_get(NetNfcGDbusPopup *popup_manager,
                goto ERROR;
        }
 
-       state = net_nfc_server_gdbus_get_launch_state(
-               g_dbus_method_invocation_get_sender(invocation));
+       state = net_nfc_server_gdbus_get_launch_state(g_dbus_method_invocation_get_sender(invocation));
 
-ERROR :
+ ERROR:
 
-       net_nfc_gdbus_popup_complete_get(popup_manager, invocation,
-               result, state);
+       net_nfc_gdbus_popup_complete_get(popup_manager, invocation, result, state);
 
        return TRUE;
 }
 
-gboolean net_nfc_server_system_handler_init(GDBusConnection *connection)
+gboolean net_nfc_server_system_handler_init(GDBusConnection * connection)
 {
        GError *error = NULL;
        gboolean result;
@@ -105,30 +82,18 @@ gboolean net_nfc_server_system_handler_init(GDBusConnection *connection)
                g_object_unref(popup_skeleton);
 
        popup_skeleton = net_nfc_gdbus_popup_skeleton_new();
-       if (popup_skeleton == NULL)
-       {
+       if (popup_skeleton == NULL) {
                DEBUG_ERR_MSG("Failed to allocate popup skeleton");
 
                return FALSE;
        }
 
-       g_signal_connect(popup_skeleton,
-               "handle-set",
-               G_CALLBACK(popup_handle_set),
-               NULL);
-
-       g_signal_connect(popup_skeleton,
-               "handle-get",
-               G_CALLBACK(popup_handle_get),
-               NULL);
-
-       result = g_dbus_interface_skeleton_export(
-               G_DBUS_INTERFACE_SKELETON(popup_skeleton),
-               connection,
-               "/org/tizen/NetNfcService/Popup",
-               &error);
-       if (result == FALSE)
-       {
+       g_signal_connect(popup_skeleton, "handle-set", G_CALLBACK(popup_handle_set), NULL);
+
+       g_signal_connect(popup_skeleton, "handle-get", G_CALLBACK(popup_handle_get), NULL);
+
+       result = g_dbus_interface_skeleton_export(G_DBUS_INTERFACE_SKELETON(popup_skeleton), connection, "/org/tizen/NetNfcService/Popup", &error);
+       if (result == FALSE) {
                DEBUG_ERR_MSG("Can not skeleton_export %s", error->message);
 
                g_error_free(error);
@@ -141,8 +106,7 @@ gboolean net_nfc_server_system_handler_init(GDBusConnection *connection)
 
 void net_nfc_server_system_handler_deinit(void)
 {
-       if (popup_skeleton)
-       {
+       if (popup_skeleton) {
                g_object_unref(popup_skeleton);
                popup_skeleton = NULL;
        }
index 37e89dd..3400d22 100755 (executable)
 #include "net_nfc_server_tag.h"
 #include "net_nfc_server_p2p.h"
 
-#define CHECK_PRESENCE_DELAY   50 /* ms */
+#define CHECK_PRESENCE_DELAY   50      /* ms */
 
 typedef struct _CurrentTagInfoData CurrentTagInfoData;
 
-struct _CurrentTagInfoData
-{
+struct _CurrentTagInfoData {
        NetNfcGDbusTag *tag;
        GDBusMethodInvocation *invocation;
 };
 
 typedef struct _CheckPresenceData CheckPresenceData;
 
-struct _CheckPresenceData
-{
+struct _CheckPresenceData {
        net_nfc_target_type_e dev_type;
        net_nfc_target_handle_s *handle;
 };
 
-static gboolean tag_read_ndef_message(net_nfc_target_handle_s *handle,
-                               int dev_type,
-                               data_s **read_ndef);
+static gboolean tag_read_ndef_message(net_nfc_target_handle_s * handle, int dev_type, data_s ** read_ndef);
 
 static void tag_check_presence_thread_func(gpointer user_data);
 
@@ -59,34 +55,20 @@ static void tag_get_current_tag_info_thread_func(gpointer user_data);
 
 static void tag_slave_target_detected_thread_func(gpointer user_data);
 
-
 /* methods */
-static gboolean tag_handle_is_tag_connected(NetNfcGDbusTag *tag,
-                                       GDBusMethodInvocation *invocation,
-                                       GVariant *smack_privilege,
-                                       gpointer user_data);
-
-static gboolean tag_handle_get_barcode(NetNfcGDbusTag *tag,
-                                       GDBusMethodInvocation *invocation,
-                                       GVariant *smack_privilege,
-                                       gpointer user_data);
-
-static gboolean tag_handle_get_current_tag_info(NetNfcGDbusTag *tag,
-                                       GDBusMethodInvocation *invocation,
-                                       GVariant *smack_privilege,
-                                       gpointer user_data);
-
-static gboolean tag_handle_get_current_target_handle(NetNfcGDbusTag *tag,
-                                       GDBusMethodInvocation *invocation,
-                                       GVariant *smack_privilege,
-                                       gpointer user_data);
+static gboolean tag_handle_is_tag_connected(NetNfcGDbusTag * tag, GDBusMethodInvocation * invocation, GVariant * smack_privilege, gpointer user_data);
+
+static gboolean tag_handle_get_barcode(NetNfcGDbusTag * tag, GDBusMethodInvocation * invocation, GVariant * smack_privilege, gpointer user_data);
+
+static gboolean tag_handle_get_current_tag_info(NetNfcGDbusTag * tag, GDBusMethodInvocation * invocation, GVariant * smack_privilege, gpointer user_data);
+
+static gboolean tag_handle_get_current_target_handle(NetNfcGDbusTag * tag, GDBusMethodInvocation * invocation, GVariant * smack_privilege, gpointer user_data);
 
 static NetNfcGDbusTag *tag_skeleton = NULL;
 
 static net_nfc_current_target_info_s *current_target_info = NULL;
 #if 0
-static gboolean tag_is_isp_dep_ndef_formatable(net_nfc_target_handle_s *handle,
-                                       int dev_type)
+static gboolean tag_is_isp_dep_ndef_formatable(net_nfc_target_handle_s * handle, int dev_type)
 {
        uint8_t cmd[] = { 0x90, 0x60, 0x00, 0x00, 0x00 };
 
@@ -99,38 +81,25 @@ static gboolean tag_is_isp_dep_ndef_formatable(net_nfc_target_handle_s *handle,
        info.trans_data.buffer = cmd;
        info.trans_data.length = sizeof(cmd);
 
-       if (net_nfc_controller_transceive(handle,
-                               &info,
-                               &response,
-                               &error) == false)
-       {
+       if (net_nfc_controller_transceive(handle, &info, &response, &error) == false) {
                DEBUG_ERR_MSG("net_nfc_controller_transceive is failed");
 
                return result;
        }
 
-       if (response != NULL)
-       {
-               if (response->length == 9 &&
-                       response->buffer[7] == (uint8_t)0x91 &&
-                       response->buffer[8] == (uint8_t)0xAF)
-               {
-                       result =  TRUE;
-               }
+       if (response != NULL) {
+               if (response->length == 9 && response->buffer[7] == (uint8_t) 0x91 && response->buffer[8] == (uint8_t) 0xAF)
+                       result = TRUE;
 
                net_nfc_util_free_data(response);
-       }
-       else
-       {
+       } else {
                DEBUG_ERR_MSG("response is NULL");
        }
 
        return result;
 }
 #endif
-static gboolean tag_read_ndef_message(net_nfc_target_handle_s *handle,
-                               int dev_type,
-                               data_s **read_ndef)
+static gboolean tag_read_ndef_message(net_nfc_target_handle_s * handle, int dev_type, data_s ** read_ndef)
 {
        net_nfc_error_e result = NET_NFC_OK;
        data_s *temp = NULL;
@@ -143,38 +112,28 @@ static gboolean tag_read_ndef_message(net_nfc_target_handle_s *handle,
 
        *read_ndef = NULL;
 
-       if (dev_type == NET_NFC_MIFARE_DESFIRE_PICC)
-       {
+       if (dev_type == NET_NFC_MIFARE_DESFIRE_PICC) {
 #if 0
-               if (tag_is_isp_dep_ndef_formatable(handle, dev_type) == FALSE)
-               {
-                       DEBUG_ERR_MSG(
-                               "DESFIRE : ISO-DEP ndef not formatable");
+               if (tag_is_isp_dep_ndef_formatable(handle, dev_type) == FALSE) {
+                       DEBUG_ERR_MSG("DESFIRE : ISO-DEP ndef not formatable");
                        return FALSE;
                }
 
                DEBUG_SERVER_MSG("DESFIRE : ISO-DEP ndef formatable");
 #endif
-               if (net_nfc_controller_connect(handle, &result) == false)
-               {
+               if (net_nfc_controller_connect(handle, &result) == false) {
                        DEBUG_ERR_MSG("net_nfc_controller_connect failed");
 #if 0
                        DEBUG_ERR_MSG("net_nfc_controller_connect failed, & retry polling!!");
 
-                       if (net_nfc_controller_configure_discovery(
-                                               NET_NFC_DISCOVERY_MODE_RESUME,
-                                               NET_NFC_ALL_ENABLE,
-                                               &result) == false)
-                       {
+                       if (net_nfc_controller_configure_discovery(NET_NFC_DISCOVERY_MODE_RESUME, NET_NFC_ALL_ENABLE, &result) == false)
                                net_nfc_controller_exception_handler();
-                       }
 #endif
                        return FALSE;
                }
        }
 
-       if (net_nfc_controller_read_ndef(handle, &temp, &result) == false)
-       {
+       if (net_nfc_controller_read_ndef(handle, &temp, &result) == false) {
                DEBUG_ERR_MSG("net_nfc_controller_read_ndef failed, [%d]", result);
 
                return FALSE;
@@ -182,24 +141,16 @@ static gboolean tag_read_ndef_message(net_nfc_target_handle_s *handle,
 
        DEBUG_SERVER_MSG("net_nfc_controller_read_ndef success");
 
-       if (dev_type == NET_NFC_MIFARE_DESFIRE_PICC)
-       {
-               if (net_nfc_controller_connect(handle, &result) == false)
-               {
+       if (dev_type == NET_NFC_MIFARE_DESFIRE_PICC) {
+               if (net_nfc_controller_connect(handle, &result) == false) {
                        DEBUG_ERR_MSG("net_nfc_controller_connect failed");
 #if 0
                        DEBUG_ERR_MSG("net_nfc_controller_connect failed, & retry polling!!");
 
-                       if (net_nfc_controller_configure_discovery(
-                                               NET_NFC_DISCOVERY_MODE_RESUME,
-                                               NET_NFC_ALL_ENABLE,
-                                               &result) == false)
-                       {
+                       if (net_nfc_controller_configure_discovery(NET_NFC_DISCOVERY_MODE_RESUME, NET_NFC_ALL_ENABLE, &result) == false)
                                net_nfc_controller_exception_handler();
-                       }
 #endif
-                       if (temp)
-                       {
+                       if (temp) {
                                net_nfc_util_free_data(temp);
                                temp = NULL;
                        }
@@ -215,7 +166,7 @@ static gboolean tag_read_ndef_message(net_nfc_target_handle_s *handle,
 
 static void tag_check_presence_thread_func(gpointer user_data)
 {
-       CheckPresenceData *data = (CheckPresenceData *)user_data;
+       CheckPresenceData *data = (CheckPresenceData *) user_data;
        net_nfc_error_e result = NET_NFC_OK;
        net_nfc_target_handle_s *handle;
 
@@ -224,27 +175,17 @@ static void tag_check_presence_thread_func(gpointer user_data)
 
        handle = data->handle;
 
-       if (handle->connection_type == NET_NFC_P2P_CONNECTION_TARGET ||
-               handle->connection_type == NET_NFC_TAG_CONNECTION)
-       {
+       if (handle->connection_type == NET_NFC_P2P_CONNECTION_TARGET || handle->connection_type == NET_NFC_TAG_CONNECTION) {
                bool present = false;
 
-               present = net_nfc_controller_check_target_presence(
-                       handle, &result);
+               present = net_nfc_controller_check_target_presence(handle, &result);
                if (present == true) {
-                       net_nfc_server_controller_async_queue_delayed_push_force(
-                               CHECK_PRESENCE_DELAY,
-                               tag_check_presence_thread_func,
-                               user_data);
+                       net_nfc_server_controller_async_queue_delayed_push_force(CHECK_PRESENCE_DELAY, tag_check_presence_thread_func, user_data);
                } else {
                        INFO_MSG("all tags were detached");
 
-                       if (result != NET_NFC_NOT_INITIALIZED &&
-                               result != NET_NFC_INVALID_HANDLE)
-                       {
-                               if (net_nfc_controller_disconnect(handle,
-                                       &result) == false)
-                               {
+                       if (result != NET_NFC_NOT_INITIALIZED && result != NET_NFC_INVALID_HANDLE) {
+                               if (net_nfc_controller_disconnect(handle, &result) == false) {
                                        DEBUG_ERR_MSG("try to disconnect result = [%d]", result);
 #if 0
                                        net_nfc_controller_exception_handler();
@@ -262,19 +203,17 @@ static void tag_check_presence_thread_func(gpointer user_data)
 
        return;
 
-END :
+ END:
        net_nfc_server_free_target_info();
 
        net_nfc_server_set_state(NET_NFC_SERVER_IDLE);
 
-       net_nfc_gdbus_tag_emit_tag_detached(tag_skeleton,
-               handle->connection_id,
-               data->dev_type);
+       net_nfc_gdbus_tag_emit_tag_detached(tag_skeleton, handle->connection_id, data->dev_type);
 
        g_free(data);
 }
 
-static data_s *_get_barcode_from_target_info(net_nfc_current_target_info_s *target_info)
+static data_s *_get_barcode_from_target_info(net_nfc_current_target_info_s * target_info)
 {
        gint i = 0;
        gint length;
@@ -282,14 +221,13 @@ static data_s *_get_barcode_from_target_info(net_nfc_current_target_info_s *targ
        gchar *str = NULL;
        guint8 *pos = target_info->target_info_values.buffer;
 
-       while (i < target_info->number_of_keys)
-       {
+       while (i < target_info->number_of_keys) {
                /* key */
-               length = *pos; /* first values is length of key */
+               length = *pos;                  /* first values is length of key */
                pos++;
 
                str = g_new0(gchar, length + 1);
-               if(str == NULL)
+               if (str == NULL)
                        return NULL;
 
                memcpy(str, pos, length);
@@ -298,23 +236,20 @@ static data_s *_get_barcode_from_target_info(net_nfc_current_target_info_s *targ
 
                pos += length;
 
-               length = *pos; /* first value is length of value */
+               length = *pos;                  /* first value is length of value */
                pos++;
 
-               if(strncmp(str, "UID", 3) == 0 && length > 0)
-               {
-                       data = (data_s *)calloc(1, sizeof(data_s));
-                       if(data == NULL)
-                       {
+               if (strncmp(str, "UID", 3) == 0 && length > 0) {
+                       data = (data_s *) calloc(1, sizeof(data_s));
+                       if (data == NULL) {
                                g_free(str);
                                return NULL;
                        }
 
                        data->length = length;
 
-                       data->buffer = (uint8_t *)calloc(data->length, sizeof(uint8_t));
-                       if(data->buffer == NULL)
-                       {
+                       data->buffer = (uint8_t *) calloc(data->length, sizeof(uint8_t));
+                       if (data->buffer == NULL) {
                                free(data);
                                g_free(str);
                                return NULL;
@@ -332,7 +267,7 @@ static data_s *_get_barcode_from_target_info(net_nfc_current_target_info_s *targ
                i++;
        }
 
-       if(str != NULL)
+       if (str != NULL)
                g_free(str);
 
        return data;
@@ -343,41 +278,30 @@ static void tag_get_barcode_thread_func(gpointer user_data)
        data_s *data = NULL;
        net_nfc_current_target_info_s *target_info;
        net_nfc_error_e result = NET_NFC_OPERATION_FAIL;
-       CurrentTagInfoData *info_data = (CurrentTagInfoData *)user_data;
+       CurrentTagInfoData *info_data = (CurrentTagInfoData *) user_data;
 
        g_assert(info_data != NULL);
        g_assert(info_data->tag != NULL);
        g_assert(info_data->invocation != NULL);
 
        target_info = net_nfc_server_get_target_info();
-       if(target_info != NULL)
-       {
-               if (target_info->devType == NET_NFC_BARCODE_128_PICC ||
-                       target_info->devType == NET_NFC_BARCODE_256_PICC)
-               {
+       if (target_info != NULL) {
+               if (target_info->devType == NET_NFC_BARCODE_128_PICC || target_info->devType == NET_NFC_BARCODE_256_PICC) {
                        data = _get_barcode_from_target_info(target_info);
 
-                       if(data != NULL && data->length != 0 && data->buffer != NULL)
+                       if (data != NULL && data->length != 0 && data->buffer != NULL)
                                result = NET_NFC_OK;
-               }
-               else
-               {
+               } else {
                        result = NET_NFC_NOT_SUPPORTED;
                }
-       }
-       else
-       {
+       } else {
                result = NET_NFC_NOT_CONNECTED;
        }
 
-       net_nfc_gdbus_tag_complete_get_barcode(info_data->tag,
-               info_data->invocation,
-               result,
-               net_nfc_util_gdbus_data_to_variant(data));
+       net_nfc_gdbus_tag_complete_get_barcode(info_data->tag, info_data->invocation, result, net_nfc_util_gdbus_data_to_variant(data));
 
-       if (data != NULL) {
+       if (data != NULL)
                net_nfc_util_free_data(data);
-       }
 
        g_object_unref(info_data->invocation);
        g_object_unref(info_data->tag);
@@ -387,8 +311,7 @@ static void tag_get_barcode_thread_func(gpointer user_data)
 
 static void tag_get_current_tag_info_thread_func(gpointer user_data)
 {
-       CurrentTagInfoData *info_data =
-               (CurrentTagInfoData *)user_data;
+       CurrentTagInfoData *info_data = (CurrentTagInfoData *) user_data;
 
        /* FIXME : net_nfc_current_target_info_s should be removed */
        net_nfc_current_target_info_s *target_info;
@@ -408,55 +331,28 @@ static void tag_get_current_tag_info_thread_func(gpointer user_data)
        g_assert(info_data->invocation != NULL);
 
        target_info = net_nfc_server_get_target_info();
-       if (target_info != NULL &&
-               target_info->devType != NET_NFC_NFCIP1_TARGET &&
-               target_info->devType != NET_NFC_NFCIP1_INITIATOR)
-       {
+       if (target_info != NULL && target_info->devType != NET_NFC_NFCIP1_TARGET && target_info->devType != NET_NFC_NFCIP1_INITIATOR) {
                handle = target_info->handle;
                number_of_keys = target_info->number_of_keys;
 
                target_info_values.buffer = target_info->target_info_values.buffer;
                target_info_values.length = target_info->target_info_values.length;
 
-               dev_type = target_info->devType ;
+               dev_type = target_info->devType;
 
-               if (net_nfc_controller_check_ndef(target_info->handle,
-                                       &ndef_card_state,
-                                       (int *)&max_data_size,
-                                       (int *)&actual_data_size,
-                                       &result) == true)
-               {
+               if (net_nfc_controller_check_ndef(target_info->handle, &ndef_card_state, (int *)&max_data_size, (int *)&actual_data_size, &result) == true)
                        is_ndef_supported = TRUE;
-               }
 
-               if (is_ndef_supported)
-               {
-                       if (net_nfc_controller_read_ndef(target_info->handle,
-                                       &raw_data, &result) == true)
-                       {
-                               DEBUG_SERVER_MSG("%s is success",
-                                               "net_nfc_controller_read_ndef");
-                       }
+               if (is_ndef_supported) {
+                       if (net_nfc_controller_read_ndef(target_info->handle, &raw_data, &result) == true)
+                               DEBUG_SERVER_MSG("%s is success", "net_nfc_controller_read_ndef");
                }
        }
 
-       net_nfc_gdbus_tag_complete_get_current_tag_info(info_data->tag,
-               info_data->invocation,
-               result,
-               (dev_type != NET_NFC_UNKNOWN_TARGET),
-               GPOINTER_TO_UINT(handle),
-               dev_type,
-               is_ndef_supported,
-               ndef_card_state,
-               max_data_size,
-               actual_data_size,
-               number_of_keys,
-               net_nfc_util_gdbus_data_to_variant(&target_info_values),
-               net_nfc_util_gdbus_data_to_variant(raw_data));
-
-       if (raw_data != NULL) {
+       net_nfc_gdbus_tag_complete_get_current_tag_info(info_data->tag, info_data->invocation, result, (dev_type != NET_NFC_UNKNOWN_TARGET), GPOINTER_TO_UINT(handle), dev_type, is_ndef_supported, ndef_card_state, max_data_size, actual_data_size, number_of_keys, net_nfc_util_gdbus_data_to_variant(&target_info_values), net_nfc_util_gdbus_data_to_variant(raw_data));
+
+       if (raw_data != NULL)
                net_nfc_util_free_data(raw_data);
-       }
 
        g_object_unref(info_data->invocation);
        g_object_unref(info_data->tag);
@@ -464,12 +360,12 @@ static void tag_get_current_tag_info_thread_func(gpointer user_data)
        g_free(info_data);
 }
 
-static bool _is_supported_tags(net_nfc_current_target_info_s *target)
+static bool _is_supported_tags(net_nfc_current_target_info_s * target)
 {
        return true;
 }
 
-static void _start_check_presence(net_nfc_current_target_info_s *target)
+static void _start_check_presence(net_nfc_current_target_info_s * target)
 {
        CheckPresenceData *presence_data = NULL;
 
@@ -480,13 +376,10 @@ static void _start_check_presence(net_nfc_current_target_info_s *target)
        presence_data->dev_type = target->devType;
        presence_data->handle = target->handle;
 
-       net_nfc_server_controller_async_queue_delayed_push_force(
-               CHECK_PRESENCE_DELAY,
-               tag_check_presence_thread_func,
-               presence_data);
+       net_nfc_server_controller_async_queue_delayed_push_force(CHECK_PRESENCE_DELAY, tag_check_presence_thread_func, presence_data);
 }
 
-static bool _process_attached_tags(net_nfc_current_target_info_s *target)
+static bool _process_attached_tags(net_nfc_current_target_info_s * target)
 {
        net_nfc_error_e result = NET_NFC_OK;
 
@@ -503,19 +396,13 @@ static bool _process_attached_tags(net_nfc_current_target_info_s *target)
 
        g_assert(target != NULL);
 
-       if (net_nfc_controller_connect(target->handle, &result) == false)
-       {
+       if (net_nfc_controller_connect(target->handle, &result) == false) {
                DEBUG_ERR_MSG("net_nfc_controller_connect failed, [%d]", result);
 #if 0
                DEBUG_ERR_MSG("net_nfc_controller_connect failed & Retry Polling!!");
 
-               if (net_nfc_controller_configure_discovery(
-                                       NET_NFC_DISCOVERY_MODE_RESUME,
-                                       NET_NFC_ALL_ENABLE,
-                                       &result) == false)
-               {
+               if (net_nfc_controller_configure_discovery(NET_NFC_DISCOVERY_MODE_RESUME, NET_NFC_ALL_ENABLE, &result) == false)
                        net_nfc_controller_exception_handler();
-               }
 #endif
                return false;
        }
@@ -524,40 +411,26 @@ static bool _process_attached_tags(net_nfc_current_target_info_s *target)
 
        INFO_MSG("tags are connected");
 
-       target_info_values = net_nfc_util_gdbus_buffer_to_variant(
-                       target->target_info_values.buffer,
-                       target->target_info_values.length);
+       target_info_values = net_nfc_util_gdbus_buffer_to_variant(target->target_info_values.buffer, target->target_info_values.length);
 #if 1
        if (_is_supported_tags(target) == true) {
 #endif
-               is_ndef_supported = net_nfc_controller_check_ndef(target->handle,
-                       &ndef_card_state,
-                       (int *)&max_data_size,
-                       (int *)&actual_data_size,
-                       &result);
-               if (is_ndef_supported)
-               {
+               is_ndef_supported = net_nfc_controller_check_ndef(target->handle, &ndef_card_state, (int *)&max_data_size, (int *)&actual_data_size, &result);
+               if (is_ndef_supported) {
                        data_s *recv_data = NULL;
 
                        DEBUG_SERVER_MSG("support NDEF");
 
-                       if (tag_read_ndef_message(target->handle,
-                                               target->devType,
-                                               &recv_data) == TRUE)
-                       {
+                       if (tag_read_ndef_message(target->handle, target->devType, &recv_data) == TRUE) {
                                net_nfc_app_util_process_ndef(recv_data);
                                raw_data = net_nfc_util_gdbus_data_to_variant(recv_data);
 
                                net_nfc_util_free_data(recv_data);
-                       }
-                       else
-                       {
+                       } else {
                                DEBUG_ERR_MSG("tag_read_ndef_message failed");
                                raw_data = net_nfc_util_gdbus_buffer_to_variant(NULL, 0);
                        }
-               }
-               else
-               {
+               } else {
                        /* raw-data of empty ndef msseages */
                        uint8_t empty[] = { 0xd0, 0x00, 0x00 };
                        data_s empty_data = { empty, sizeof(empty) };
@@ -579,16 +452,7 @@ static bool _process_attached_tags(net_nfc_current_target_info_s *target)
 
        if (tag_skeleton != NULL) {
                /* send TagDiscoverd signal */
-               net_nfc_gdbus_tag_emit_tag_discovered(tag_skeleton,
-                       target->handle->connection_id,
-                       target->devType,
-                       is_ndef_supported,
-                       ndef_card_state,
-                       max_data_size,
-                       actual_data_size,
-                       target->number_of_keys,
-                       target_info_values,
-                       raw_data);
+               net_nfc_gdbus_tag_emit_tag_discovered(tag_skeleton, target->handle->connection_id, target->devType, is_ndef_supported, ndef_card_state, max_data_size, actual_data_size, target->number_of_keys, target_info_values, raw_data);
 
                net_nfc_manager_util_play_sound(NET_NFC_TASK_START);
        } else {
@@ -600,15 +464,13 @@ static bool _process_attached_tags(net_nfc_current_target_info_s *target)
 
 static void tag_slave_target_detected_thread_func(gpointer user_data)
 {
-       net_nfc_current_target_info_s *target =
-               (net_nfc_current_target_info_s *)user_data;
+       net_nfc_current_target_info_s *target = (net_nfc_current_target_info_s *) user_data;
 
 #if 0
        if (_is_supported_tags(target) == true) {
 #endif
-               if (_process_attached_tags(target) == false) {
+               if (_process_attached_tags(target) == false)
                        DEBUG_ERR_MSG("_process_attached_tags failed");
-               }
 #if 0
        } else {
                INFO_MSG("unsupported tags are attached");
@@ -623,11 +485,7 @@ static void tag_slave_target_detected_thread_func(gpointer user_data)
        g_free(user_data);
 }
 
-
-static gboolean tag_handle_is_tag_connected(NetNfcGDbusTag *tag,
-                                       GDBusMethodInvocation *invocation,
-                                       GVariant *smack_privilege,
-                                       gpointer user_data)
+static gboolean tag_handle_is_tag_connected(NetNfcGDbusTag * tag, GDBusMethodInvocation * invocation, GVariant * smack_privilege, gpointer user_data)
 {
        /* FIXME : net_nfc_current_target_info_s should be removed */
        net_nfc_current_target_info_s *target_info;
@@ -635,8 +493,7 @@ static gboolean tag_handle_is_tag_connected(NetNfcGDbusTag *tag,
        gboolean is_connected = FALSE;
        gint result;
 
-       INFO_MSG(">>> REQUEST from [%s]",
-               g_dbus_method_invocation_get_sender(invocation));
+       INFO_MSG(">>> REQUEST from [%s]", g_dbus_method_invocation_get_sender(invocation));
 
        /* check privilege and update client context */
        if (net_nfc_server_gdbus_check_privilege(invocation, NET_NFC_PRIVILEGE_NFC_TAG) == false) {
@@ -647,34 +504,25 @@ static gboolean tag_handle_is_tag_connected(NetNfcGDbusTag *tag,
        }
 
        target_info = net_nfc_server_get_target_info();
-       if (target_info != NULL)
-       {
+       if (target_info != NULL) {
                dev_type = target_info->devType;
                is_connected = TRUE;
        }
 
        result = NET_NFC_OK;
 
-END :
-       net_nfc_gdbus_tag_complete_is_tag_connected(tag,
-               invocation,
-               result,
-               is_connected,
-               (gint32)dev_type);
+ END:
+       net_nfc_gdbus_tag_complete_is_tag_connected(tag, invocation, result, is_connected, (gint32) dev_type);
 
        return TRUE;
 }
 
-static gboolean tag_handle_get_barcode(NetNfcGDbusTag *tag,
-                               GDBusMethodInvocation *invocation,
-                               GVariant *smack_privilege,
-                               gpointer user_data)
+static gboolean tag_handle_get_barcode(NetNfcGDbusTag * tag, GDBusMethodInvocation * invocation, GVariant * smack_privilege, gpointer user_data)
 {
        CurrentTagInfoData *info_data = NULL;
        gint result;
 
-       INFO_MSG(">>> REQUEST from [%s]",
-               g_dbus_method_invocation_get_sender(invocation));
+       INFO_MSG(">>> REQUEST from [%s]", g_dbus_method_invocation_get_sender(invocation));
 
        /* check privilege and update client context */
        if (net_nfc_server_gdbus_check_privilege(invocation, NET_NFC_PRIVILEGE_NFC_TAG) == false) {
@@ -685,8 +533,7 @@ static gboolean tag_handle_get_barcode(NetNfcGDbusTag *tag,
        }
 
        info_data = g_try_new0(CurrentTagInfoData, 1);
-       if (info_data == NULL)
-       {
+       if (info_data == NULL) {
                DEBUG_ERR_MSG("Memory allocation failed");
                result = NET_NFC_ALLOC_FAIL;
 
@@ -696,9 +543,7 @@ static gboolean tag_handle_get_barcode(NetNfcGDbusTag *tag,
        info_data->tag = g_object_ref(tag);
        info_data->invocation = g_object_ref(invocation);
 
-       if (net_nfc_server_controller_async_queue_push(
-               tag_get_barcode_thread_func, info_data) == FALSE)
-       {
+       if (net_nfc_server_controller_async_queue_push(tag_get_barcode_thread_func, info_data) == FALSE) {
                DEBUG_SERVER_MSG("controller is processing important message..");
                result = NET_NFC_BUSY;
 
@@ -706,7 +551,7 @@ static gboolean tag_handle_get_barcode(NetNfcGDbusTag *tag,
        }
        return TRUE;
 
-ERROR :
+ ERROR:
 
        if (info_data != NULL) {
                g_object_unref(info_data->invocation);
@@ -715,24 +560,17 @@ ERROR :
                g_free(info_data);
        }
 
-       net_nfc_gdbus_tag_complete_get_barcode(tag,
-               invocation,
-               result,
-               net_nfc_util_gdbus_data_to_variant(NULL));
+       net_nfc_gdbus_tag_complete_get_barcode(tag, invocation, result, net_nfc_util_gdbus_data_to_variant(NULL));
 
        return TRUE;
 }
 
-static gboolean tag_handle_get_current_tag_info(NetNfcGDbusTag *tag,
-                               GDBusMethodInvocation *invocation,
-                               GVariant *smack_privilege,
-                               gpointer user_data)
+static gboolean tag_handle_get_current_tag_info(NetNfcGDbusTag * tag, GDBusMethodInvocation * invocation, GVariant * smack_privilege, gpointer user_data)
 {
        CurrentTagInfoData *info_data = NULL;
        gint result;
 
-       INFO_MSG(">>> REQUEST from [%s]",
-               g_dbus_method_invocation_get_sender(invocation));
+       INFO_MSG(">>> REQUEST from [%s]", g_dbus_method_invocation_get_sender(invocation));
 
        /* check privilege and update client context */
        if (net_nfc_server_gdbus_check_privilege(invocation, NET_NFC_PRIVILEGE_NFC_TAG) == false) {
@@ -743,8 +581,7 @@ static gboolean tag_handle_get_current_tag_info(NetNfcGDbusTag *tag,
        }
 
        info_data = g_try_new0(CurrentTagInfoData, 1);
-       if (info_data == NULL)
-       {
+       if (info_data == NULL) {
                DEBUG_ERR_MSG("Memory allocation failed");
                result = NET_NFC_ALLOC_FAIL;
 
@@ -754,9 +591,7 @@ static gboolean tag_handle_get_current_tag_info(NetNfcGDbusTag *tag,
        info_data->tag = g_object_ref(tag);
        info_data->invocation = g_object_ref(invocation);
 
-       if (net_nfc_server_controller_async_queue_push(
-               tag_get_current_tag_info_thread_func, info_data) == FALSE)
-       {
+       if (net_nfc_server_controller_async_queue_push(tag_get_current_tag_info_thread_func, info_data) == FALSE) {
                /* return error if queue was blocked */
                DEBUG_SERVER_MSG("controller is processing important message..");
                result = NET_NFC_BUSY;
@@ -766,7 +601,7 @@ static gboolean tag_handle_get_current_tag_info(NetNfcGDbusTag *tag,
 
        return TRUE;
 
-ERROR :
+ ERROR:
        if (info_data != NULL) {
                g_object_unref(info_data->invocation);
                g_object_unref(info_data->tag);
@@ -774,27 +609,12 @@ ERROR :
                g_free(info_data);
        }
 
-       net_nfc_gdbus_tag_complete_get_current_tag_info(tag,
-               invocation,
-               result,
-               false,
-               GPOINTER_TO_UINT(NULL),
-               NET_NFC_UNKNOWN_TARGET,
-               false,
-               0,
-               0,
-               0,
-               0,
-               net_nfc_util_gdbus_buffer_to_variant(NULL, 0),
-               net_nfc_util_gdbus_buffer_to_variant(NULL, 0));
+       net_nfc_gdbus_tag_complete_get_current_tag_info(tag, invocation, result, false, GPOINTER_TO_UINT(NULL), NET_NFC_UNKNOWN_TARGET, false, 0, 0, 0, 0, net_nfc_util_gdbus_buffer_to_variant(NULL, 0), net_nfc_util_gdbus_buffer_to_variant(NULL, 0));
 
        return TRUE;
 }
 
-static gboolean tag_handle_get_current_target_handle(NetNfcGDbusTag *tag,
-       GDBusMethodInvocation *invocation,
-       GVariant *smack_privilege,
-       gpointer user_data)
+static gboolean tag_handle_get_current_target_handle(NetNfcGDbusTag * tag, GDBusMethodInvocation * invocation, GVariant * smack_privilege, gpointer user_data)
 {
        /* FIXME : net_nfc_current_target_info_s should be removed */
        net_nfc_current_target_info_s *target_info;
@@ -802,8 +622,7 @@ static gboolean tag_handle_get_current_target_handle(NetNfcGDbusTag *tag,
        uint32_t devType = NET_NFC_UNKNOWN_TARGET;
        gint result;
 
-       INFO_MSG(">>> REQUEST from [%s]",
-               g_dbus_method_invocation_get_sender(invocation));
+       INFO_MSG(">>> REQUEST from [%s]", g_dbus_method_invocation_get_sender(invocation));
 
        /* check privilege and update client context */
        if (net_nfc_server_gdbus_check_privilege(invocation, NET_NFC_PRIVILEGE_NFC_P2P) == false) {
@@ -814,27 +633,20 @@ static gboolean tag_handle_get_current_target_handle(NetNfcGDbusTag *tag,
        }
 
        target_info = net_nfc_server_get_target_info();
-       if (target_info != NULL)
-       {
+       if (target_info != NULL) {
                handle = target_info->handle;
                devType = target_info->devType;
        }
 
        result = NET_NFC_OK;
 
-END :
-       net_nfc_gdbus_tag_complete_get_current_target_handle(tag,
-               invocation,
-               result,
-               (handle != NULL),
-               GPOINTER_TO_UINT(handle),
-               devType);
+ END:
+       net_nfc_gdbus_tag_complete_get_current_target_handle(tag, invocation, result, (handle != NULL), GPOINTER_TO_UINT(handle), devType);
 
        return TRUE;
 }
 
-
-gboolean net_nfc_server_tag_init(GDBusConnection *connection)
+gboolean net_nfc_server_tag_init(GDBusConnection * connection)
 {
        GError *error = NULL;
        gboolean result;
@@ -844,33 +656,16 @@ gboolean net_nfc_server_tag_init(GDBusConnection *connection)
 
        tag_skeleton = net_nfc_gdbus_tag_skeleton_new();
 
-       g_signal_connect(tag_skeleton,
-                       "handle-is-tag-connected",
-                       G_CALLBACK(tag_handle_is_tag_connected),
-                       NULL);
-
-       g_signal_connect(tag_skeleton,
-                       "handle-get-barcode",
-                       G_CALLBACK(tag_handle_get_barcode),
-                       NULL);
-
-       g_signal_connect(tag_skeleton,
-                       "handle-get-current-tag-info",
-                       G_CALLBACK(tag_handle_get_current_tag_info),
-                       NULL);
-
-       g_signal_connect(tag_skeleton,
-                       "handle-get-current-target-handle",
-                       G_CALLBACK(tag_handle_get_current_target_handle),
-                       NULL);
-
-       result = g_dbus_interface_skeleton_export(
-               G_DBUS_INTERFACE_SKELETON(tag_skeleton),
-               connection,
-               "/org/tizen/NetNfcService/Tag",
-               &error);
-       if (result == FALSE)
-       {
+       g_signal_connect(tag_skeleton, "handle-is-tag-connected", G_CALLBACK(tag_handle_is_tag_connected), NULL);
+
+       g_signal_connect(tag_skeleton, "handle-get-barcode", G_CALLBACK(tag_handle_get_barcode), NULL);
+
+       g_signal_connect(tag_skeleton, "handle-get-current-tag-info", G_CALLBACK(tag_handle_get_current_tag_info), NULL);
+
+       g_signal_connect(tag_skeleton, "handle-get-current-target-handle", G_CALLBACK(tag_handle_get_current_target_handle), NULL);
+
+       result = g_dbus_interface_skeleton_export(G_DBUS_INTERFACE_SKELETON(tag_skeleton), connection, "/org/tizen/NetNfcService/Tag", &error);
+       if (result == FALSE) {
                DEBUG_ERR_MSG("can not skeleton_export %s", error->message);
 
                g_error_free(error);
@@ -883,34 +678,27 @@ gboolean net_nfc_server_tag_init(GDBusConnection *connection)
 
 void net_nfc_server_tag_deinit(void)
 {
-       if (tag_skeleton)
-       {
+       if (tag_skeleton) {
                g_object_unref(tag_skeleton);
                tag_skeleton = NULL;
        }
 }
 
-void net_nfc_server_set_target_info(net_nfc_current_target_info_s *info)
+void net_nfc_server_set_target_info(net_nfc_current_target_info_s * info)
 {
        if (current_target_info)
                g_free(current_target_info);
 
-       current_target_info = g_malloc0(sizeof(net_nfc_current_target_info_s) +
-               info->target_info_values.length);
+       current_target_info = g_malloc0(sizeof(net_nfc_current_target_info_s) + info->target_info_values.length);
 
        current_target_info->handle = info->handle;
        current_target_info->devType = info->devType;
 
-       if (current_target_info->devType != NET_NFC_NFCIP1_INITIATOR &&
-                       current_target_info->devType != NET_NFC_NFCIP1_TARGET)
-       {
+       if (current_target_info->devType != NET_NFC_NFCIP1_INITIATOR && current_target_info->devType != NET_NFC_NFCIP1_TARGET) {
                current_target_info->number_of_keys = info->number_of_keys;
-               current_target_info->target_info_values.length =
-                       info->target_info_values.length;
+               current_target_info->target_info_values.length = info->target_info_values.length;
 
-               memcpy(&current_target_info->target_info_values,
-                       &info->target_info_values,
-                       current_target_info->target_info_values.length + sizeof(int));
+               memcpy(&current_target_info->target_info_values, &info->target_info_values, current_target_info->target_info_values.length + sizeof(int));
        }
 }
 
@@ -951,9 +739,7 @@ void net_nfc_server_free_target_info(void)
 
 bool net_nfc_server_tag_target_detected(void *info)
 {
-       if (net_nfc_server_controller_async_queue_push_force(
-               tag_slave_target_detected_thread_func, info) == FALSE)
-       {
+       if (net_nfc_server_controller_async_queue_push_force(tag_slave_target_detected_thread_func, info) == FALSE) {
                DEBUG_ERR_MSG("can not push to controller thread");
                return false;
        }
index 7ea731c..a8fe77b 100755 (executable)
 
 typedef struct _TestData TestData;
 
-struct _TestData
-{
+struct _TestData {
        NetNfcGDbusTest *test;
        GDBusMethodInvocation *invocation;
 };
 
 typedef struct _TestPrbsData TestPrbsData;
 
-struct _TestPrbsData
-{
+struct _TestPrbsData {
        NetNfcGDbusTest *test;
        GDBusMethodInvocation *invocation;
        guint32 tech;
@@ -44,8 +42,7 @@ struct _TestPrbsData
 
 typedef struct _TestSetEeData TestSetEeData;
 
-struct _TestSetEeData
-{
+struct _TestSetEeData {
        NetNfcGDbusTest *test;
        GDBusMethodInvocation *invocation;
 
@@ -56,15 +53,13 @@ struct _TestSetEeData
 
 typedef struct _TestSetListenTechData TestSetListenTechData;
 
-struct _TestSetListenTechData
-{
+struct _TestSetListenTechData {
        NetNfcGDbusTest *test;
        GDBusMethodInvocation *invocation;
 
        guint32 mode;
 };
 
-
 static void test_handle_sim_test_thread_func(gpointer user_data);
 
 static void test_handle_prbs_test_thread_func(gpointer user_data);
@@ -73,38 +68,19 @@ static void test_handle_get_firmware_version_thread_func(gpointer user_data);
 
 static void test_handle_set_ee_data_thread_func(gpointer user_data);
 
+static gboolean test_handle_sim_test(NetNfcGDbusTest * test, GDBusMethodInvocation * invocation, GVariant * smack_privilege, gpointer user_data);
 
-static gboolean test_handle_sim_test(NetNfcGDbusTest *test,
-                               GDBusMethodInvocation *invocation,
-                               GVariant *smack_privilege,
-                               gpointer user_data);
+static gboolean test_handle_prbs_test(NetNfcGDbusTest * test, GDBusMethodInvocation * invocation, guint32 arg_tech, guint32 arg_rate, GVariant * smack_privilege, gpointer user_data);
 
-static gboolean test_handle_prbs_test(NetNfcGDbusTest *test,
-                               GDBusMethodInvocation *invocation,
-                               guint32 arg_tech,
-                               guint32 arg_rate,
-                               GVariant *smack_privilege,
-                               gpointer user_data);
-
-static gboolean test_handle_get_firmware_version(NetNfcGDbusTest *test,
-                               GDBusMethodInvocation *invocation,
-                               GVariant *smack_privilege,
-                               gpointer user_data);
-
-static gboolean test_handle_set_ee_data(NetNfcGDbusTest *test,
-                               GDBusMethodInvocation *invocation,
-                               guint32 mode,
-                               guint32 reg_id,
-                               GVariant *variant,
-                               GVariant *smack_privilege,
-                               gpointer user_data);
+static gboolean test_handle_get_firmware_version(NetNfcGDbusTest * test, GDBusMethodInvocation * invocation, GVariant * smack_privilege, gpointer user_data);
 
+static gboolean test_handle_set_ee_data(NetNfcGDbusTest * test, GDBusMethodInvocation * invocation, guint32 mode, guint32 reg_id, GVariant * variant, GVariant * smack_privilege, gpointer user_data);
 
 static NetNfcGDbusTest *test_skeleton = NULL;
 
 static void test_handle_sim_test_thread_func(gpointer user_data)
 {
-       TestData *data = (TestData *)user_data;
+       TestData *data = (TestData *) user_data;
        net_nfc_error_e result = NET_NFC_OK;
 
        g_assert(data != NULL);
@@ -113,9 +89,7 @@ static void test_handle_sim_test_thread_func(gpointer user_data)
 
        net_nfc_controller_sim_test(&result);
 
-       net_nfc_gdbus_test_complete_sim_test(data->test,
-               data->invocation,
-               (gint)result);
+       net_nfc_gdbus_test_complete_sim_test(data->test, data->invocation, (gint) result);
 
        g_object_unref(data->invocation);
        g_object_unref(data->test);
@@ -125,7 +99,7 @@ static void test_handle_sim_test_thread_func(gpointer user_data)
 
 static void test_handle_prbs_test_thread_func(gpointer user_data)
 {
-       TestPrbsData *data = (TestPrbsData *)user_data;
+       TestPrbsData *data = (TestPrbsData *) user_data;
        net_nfc_error_e result = NET_NFC_OK;
 
        g_assert(data != NULL);
@@ -134,9 +108,7 @@ static void test_handle_prbs_test_thread_func(gpointer user_data)
 
        net_nfc_controller_prbs_test(&result, data->tech, data->rate);
 
-       net_nfc_gdbus_test_complete_prbs_test(data->test,
-               data->invocation,
-               (gint)result);
+       net_nfc_gdbus_test_complete_prbs_test(data->test, data->invocation, (gint) result);
 
        g_object_unref(data->invocation);
        g_object_unref(data->test);
@@ -146,7 +118,7 @@ static void test_handle_prbs_test_thread_func(gpointer user_data)
 
 static void test_handle_get_firmware_version_thread_func(gpointer user_data)
 {
-       TestData *data = (TestData *)user_data;
+       TestData *data = (TestData *) user_data;
        data_s *tmp_data = NULL;
        net_nfc_error_e result = NET_NFC_OK;
        gchar *version = NULL;
@@ -157,22 +129,16 @@ static void test_handle_get_firmware_version_thread_func(gpointer user_data)
 
        net_nfc_controller_get_firmware_version(&tmp_data, &result);
 
-       if (tmp_data)
-       {
-               version = g_new0(gchar, tmp_data->length +1);
+       if (tmp_data) {
+               version = g_new0(gchar, tmp_data->length + 1);
                memcpy((void *)version, tmp_data->buffer, tmp_data->length);
 
                net_nfc_util_free_data(tmp_data);
-       }
-       else
-       {
+       } else {
                version = g_strdup("");
        }
 
-       net_nfc_gdbus_test_complete_get_firmware_version(data->test,
-               data->invocation,
-               (gint)result,
-               version);
+       net_nfc_gdbus_test_complete_get_firmware_version(data->test, data->invocation, (gint) result, version);
 
        g_free(version);
 
@@ -184,21 +150,16 @@ static void test_handle_get_firmware_version_thread_func(gpointer user_data)
 
 static void test_handle_set_ee_data_thread_func(gpointer user_data)
 {
-       TestSetEeData *data = (TestSetEeData *)user_data;
+       TestSetEeData *data = (TestSetEeData *) user_data;
        net_nfc_error_e result = NET_NFC_OK;
 
        g_assert(data != NULL);
        g_assert(data->test != NULL);
        g_assert(data->invocation != NULL);
 
-       net_nfc_controller_eedata_register_set(&result,
-               data->mode,
-               data->reg_id,
-               &data->data);
+       net_nfc_controller_eedata_register_set(&result, data->mode, data->reg_id, &data->data);
 
-       net_nfc_gdbus_test_complete_set_ee_data(data->test,
-               data->invocation,
-               (gint)result);
+       net_nfc_gdbus_test_complete_set_ee_data(data->test, data->invocation, (gint) result);
 
        net_nfc_util_clear_data(&data->data);
 
@@ -210,7 +171,7 @@ static void test_handle_set_ee_data_thread_func(gpointer user_data)
 
 static void test_handle_ese_test_thread_func(gpointer user_data)
 {
-       TestData *data = (TestData *)user_data;
+       TestData *data = (TestData *) user_data;
        net_nfc_error_e result = NET_NFC_OK;
 
        DEBUG_SERVER_MSG("test_handle_ese_test_thread_func working!!");
@@ -221,9 +182,7 @@ static void test_handle_ese_test_thread_func(gpointer user_data)
 
        net_nfc_controller_ese_test(&result);
 
-       net_nfc_gdbus_test_complete_ese_test(data->test,
-               data->invocation,
-               (gint)result);
+       net_nfc_gdbus_test_complete_ese_test(data->test, data->invocation, (gint) result);
 
        g_object_unref(data->invocation);
        g_object_unref(data->test);
@@ -231,17 +190,12 @@ static void test_handle_ese_test_thread_func(gpointer user_data)
        g_free(data);
 }
 
-
-static gboolean test_handle_sim_test(NetNfcGDbusTest *test,
-       GDBusMethodInvocation *invocation,
-       GVariant *smack_privilege,
-       gpointer user_data)
+static gboolean test_handle_sim_test(NetNfcGDbusTest * test, GDBusMethodInvocation * invocation, GVariant * smack_privilege, gpointer user_data)
 {
        TestData *data = NULL;
        gint result;
 
-       INFO_MSG(">>> REQUEST from [%s]",
-               g_dbus_method_invocation_get_sender(invocation));
+       INFO_MSG(">>> REQUEST from [%s]", g_dbus_method_invocation_get_sender(invocation));
 
        /* check privilege and update client context */
        if (net_nfc_server_gdbus_check_privilege(invocation, NET_NFC_PRIVILEGE_NFC) == false) {
@@ -254,8 +208,7 @@ static gboolean test_handle_sim_test(NetNfcGDbusTest *test,
        DEBUG_SERVER_MSG("sim_test");
 
        data = g_try_new0(TestData, 1);
-       if (data == NULL)
-       {
+       if (data == NULL) {
                DEBUG_ERR_MSG("Memory allocation failed");
                result = NET_NFC_ALLOC_FAIL;
 
@@ -265,9 +218,7 @@ static gboolean test_handle_sim_test(NetNfcGDbusTest *test,
        data->test = g_object_ref(test);
        data->invocation = g_object_ref(invocation);
 
-       if (net_nfc_server_controller_async_queue_push(
-               test_handle_sim_test_thread_func, data) == FALSE)
-       {
+       if (net_nfc_server_controller_async_queue_push(test_handle_sim_test_thread_func, data) == FALSE) {
                /* return error if queue was blocked */
                DEBUG_SERVER_MSG("controller is processing important message..");
                result = NET_NFC_BUSY;
@@ -277,7 +228,7 @@ static gboolean test_handle_sim_test(NetNfcGDbusTest *test,
 
        return TRUE;
 
-ERROR :
+ ERROR:
        if (data != NULL) {
                g_object_unref(data->invocation);
                g_object_unref(data->test);
@@ -290,18 +241,12 @@ ERROR :
        return TRUE;
 }
 
-static gboolean test_handle_prbs_test(NetNfcGDbusTest *test,
-       GDBusMethodInvocation *invocation,
-       guint32 arg_tech,
-       guint32 arg_rate,
-       GVariant *smack_privilege,
-       gpointer user_data)
+static gboolean test_handle_prbs_test(NetNfcGDbusTest * test, GDBusMethodInvocation * invocation, guint32 arg_tech, guint32 arg_rate, GVariant * smack_privilege, gpointer user_data)
 {
        TestPrbsData *data = NULL;
        gint result;
 
-       INFO_MSG(">>> REQUEST from [%s]",
-               g_dbus_method_invocation_get_sender(invocation));
+       INFO_MSG(">>> REQUEST from [%s]", g_dbus_method_invocation_get_sender(invocation));
 
        /* check privilege and update client context */
        if (net_nfc_server_gdbus_check_privilege(invocation, NET_NFC_PRIVILEGE_NFC) == false) {
@@ -314,8 +259,7 @@ static gboolean test_handle_prbs_test(NetNfcGDbusTest *test,
        DEBUG_SERVER_MSG("prbs_test");
 
        data = g_try_new0(TestPrbsData, 1);
-       if (data == NULL)
-       {
+       if (data == NULL) {
                DEBUG_ERR_MSG("Memory allocation failed");
                result = NET_NFC_ALLOC_FAIL;
 
@@ -327,9 +271,7 @@ static gboolean test_handle_prbs_test(NetNfcGDbusTest *test,
        data->tech = arg_tech;
        data->rate = arg_rate;
 
-       if (net_nfc_server_controller_async_queue_push(
-               test_handle_prbs_test_thread_func, data) == FALSE)
-       {
+       if (net_nfc_server_controller_async_queue_push(test_handle_prbs_test_thread_func, data) == FALSE) {
                /* return error if queue was blocked */
                DEBUG_SERVER_MSG("controller is processing important message..");
                result = NET_NFC_BUSY;
@@ -339,7 +281,7 @@ static gboolean test_handle_prbs_test(NetNfcGDbusTest *test,
 
        return TRUE;
 
-ERROR :
+ ERROR:
        if (data != NULL) {
                g_object_unref(data->invocation);
                g_object_unref(data->test);
@@ -352,16 +294,12 @@ ERROR :
        return TRUE;
 }
 
-static gboolean test_handle_get_firmware_version(NetNfcGDbusTest *test,
-       GDBusMethodInvocation *invocation,
-       GVariant *smack_privilege,
-       gpointer user_data)
+static gboolean test_handle_get_firmware_version(NetNfcGDbusTest * test, GDBusMethodInvocation * invocation, GVariant * smack_privilege, gpointer user_data)
 {
        TestData *data = NULL;
        gint result;
 
-       INFO_MSG(">>> REQUEST from [%s]",
-               g_dbus_method_invocation_get_sender(invocation));
+       INFO_MSG(">>> REQUEST from [%s]", g_dbus_method_invocation_get_sender(invocation));
 #if 0
        /* check privilege and update client context */
        if (net_nfc_server_gdbus_check_privilege(invocation, NET_NFC_PRIVILEGE_NFC) == false) {
@@ -372,8 +310,7 @@ static gboolean test_handle_get_firmware_version(NetNfcGDbusTest *test,
        }
 #endif
        data = g_try_new0(TestData, 1);
-       if (data == NULL)
-       {
+       if (data == NULL) {
                DEBUG_ERR_MSG("Memory allocation failed");
                result = NET_NFC_ALLOC_FAIL;
 
@@ -383,9 +320,7 @@ static gboolean test_handle_get_firmware_version(NetNfcGDbusTest *test,
        data->test = g_object_ref(test);
        data->invocation = g_object_ref(invocation);
 
-       if (net_nfc_server_controller_async_queue_push(
-               test_handle_get_firmware_version_thread_func, data) == FALSE)
-       {
+       if (net_nfc_server_controller_async_queue_push(test_handle_get_firmware_version_thread_func, data) == FALSE) {
                /* return error if queue was blocked */
                DEBUG_SERVER_MSG("controller is processing important message..");
                result = NET_NFC_BUSY;
@@ -395,7 +330,7 @@ static gboolean test_handle_get_firmware_version(NetNfcGDbusTest *test,
 
        return TRUE;
 
-ERROR :
+ ERROR:
        if (data != NULL) {
                g_object_unref(data->invocation);
                g_object_unref(data->test);
@@ -403,27 +338,17 @@ ERROR :
                g_free(data);
        }
 
-       net_nfc_gdbus_test_complete_get_firmware_version(test,
-               invocation,
-               result,
-               NULL);
+       net_nfc_gdbus_test_complete_get_firmware_version(test, invocation, result, NULL);
 
        return TRUE;
 }
 
-static gboolean test_handle_set_ee_data(NetNfcGDbusTest *test,
-       GDBusMethodInvocation *invocation,
-       guint32 mode,
-       guint32 reg_id,
-       GVariant *variant,
-       GVariant *smack_privilege,
-       gpointer user_data)
+static gboolean test_handle_set_ee_data(NetNfcGDbusTest * test, GDBusMethodInvocation * invocation, guint32 mode, guint32 reg_id, GVariant * variant, GVariant * smack_privilege, gpointer user_data)
 {
        TestSetEeData *data = NULL;
        gint result;
 
-       INFO_MSG(">>> REQUEST from [%s]",
-               g_dbus_method_invocation_get_sender(invocation));
+       INFO_MSG(">>> REQUEST from [%s]", g_dbus_method_invocation_get_sender(invocation));
 
        /* check privilege and update client context */
        if (net_nfc_server_gdbus_check_privilege(invocation, NET_NFC_PRIVILEGE_NFC) == false) {
@@ -434,8 +359,7 @@ static gboolean test_handle_set_ee_data(NetNfcGDbusTest *test,
        }
 
        data = g_try_new0(TestSetEeData, 1);
-       if (data == NULL)
-       {
+       if (data == NULL) {
                DEBUG_ERR_MSG("Memory allocation failed");
                result = NET_NFC_ALLOC_FAIL;
 
@@ -448,9 +372,7 @@ static gboolean test_handle_set_ee_data(NetNfcGDbusTest *test,
        data->reg_id = reg_id;
        net_nfc_util_gdbus_variant_to_data_s(variant, &data->data);
 
-       if (net_nfc_server_controller_async_queue_push(
-               test_handle_set_ee_data_thread_func, data) == FALSE)
-       {
+       if (net_nfc_server_controller_async_queue_push(test_handle_set_ee_data_thread_func, data) == FALSE) {
                /* return error if queue was blocked */
                DEBUG_SERVER_MSG("controller is processing important message..");
                result = NET_NFC_BUSY;
@@ -460,7 +382,7 @@ static gboolean test_handle_set_ee_data(NetNfcGDbusTest *test,
 
        return TRUE;
 
-ERROR :
+ ERROR:
        if (data != NULL) {
                g_object_unref(data->invocation);
                g_object_unref(data->test);
@@ -473,16 +395,12 @@ ERROR :
        return TRUE;
 }
 
-static gboolean test_handle_ese_test(NetNfcGDbusTest *test,
-       GDBusMethodInvocation *invocation,
-       GVariant *smack_privilege,
-       gpointer user_data)
+static gboolean test_handle_ese_test(NetNfcGDbusTest * test, GDBusMethodInvocation * invocation, GVariant * smack_privilege, gpointer user_data)
 {
        TestData *data = NULL;
        gint result;
 
-       INFO_MSG(">>> ESE TEST REQUEST from [%s]",
-               g_dbus_method_invocation_get_sender(invocation));
+       INFO_MSG(">>> ESE TEST REQUEST from [%s]", g_dbus_method_invocation_get_sender(invocation));
 #if 0
        /* check privilege and update client context */
        if (net_nfc_server_gdbus_check_privilege(invocation, NET_NFC_PRIVILEGE_NFC) == false) {
@@ -495,8 +413,7 @@ static gboolean test_handle_ese_test(NetNfcGDbusTest *test,
        DEBUG_SERVER_MSG("ese_test");
 
        data = g_try_new0(TestData, 1);
-       if (data == NULL)
-       {
+       if (data == NULL) {
                DEBUG_ERR_MSG("Memory allocation failed");
                result = NET_NFC_ALLOC_FAIL;
 
@@ -506,9 +423,7 @@ static gboolean test_handle_ese_test(NetNfcGDbusTest *test,
        data->test = g_object_ref(test);
        data->invocation = g_object_ref(invocation);
 
-       if (net_nfc_server_controller_async_queue_push(
-               test_handle_ese_test_thread_func, data) == FALSE)
-       {
+       if (net_nfc_server_controller_async_queue_push(test_handle_ese_test_thread_func, data) == FALSE) {
                /* return error if queue was blocked */
                DEBUG_SERVER_MSG("controller is processing important message..");
                result = NET_NFC_BUSY;
@@ -518,7 +433,7 @@ static gboolean test_handle_ese_test(NetNfcGDbusTest *test,
 
        return TRUE;
 
-ERROR :
+ ERROR:
        if (data != NULL) {
                g_object_unref(data->invocation);
                g_object_unref(data->test);
@@ -533,19 +448,16 @@ ERROR :
 
 static void test_handle_set_se_tech_type_thread_func(gpointer user_data)
 {
-       TestSetEeData *data = (TestSetEeData *)user_data;
+       TestSetEeData *data = (TestSetEeData *) user_data;
        net_nfc_error_e result = NET_NFC_OK;
 
        g_assert(data != NULL);
        g_assert(data->test != NULL);
        g_assert(data->invocation != NULL);
 
-       net_nfc_controller_test_set_se_tech_type(&result,
-               (net_nfc_se_type_e)data->mode, data->reg_id);
+       net_nfc_controller_test_set_se_tech_type(&result, (net_nfc_se_type_e) data->mode, data->reg_id);
 
-       net_nfc_gdbus_test_complete_set_se_tech_type(data->test,
-               data->invocation,
-               (gint)result);
+       net_nfc_gdbus_test_complete_set_se_tech_type(data->test, data->invocation, (gint) result);
 
        g_object_unref(data->invocation);
        g_object_unref(data->test);
@@ -553,18 +465,12 @@ static void test_handle_set_se_tech_type_thread_func(gpointer user_data)
        g_free(data);
 }
 
-static gboolean test_handle_set_se_tech_type(NetNfcGDbusTest *test,
-       GDBusMethodInvocation *invocation,
-       guint32 type,
-       guint32 tech,
-       GVariant *smack_privilege,
-       gpointer user_data)
+static gboolean test_handle_set_se_tech_type(NetNfcGDbusTest * test, GDBusMethodInvocation * invocation, guint32 type, guint32 tech, GVariant * smack_privilege, gpointer user_data)
 {
        TestSetEeData *data = NULL;
        gint result;
 
-       INFO_MSG(">>> REQUEST from [%s]",
-               g_dbus_method_invocation_get_sender(invocation));
+       INFO_MSG(">>> REQUEST from [%s]", g_dbus_method_invocation_get_sender(invocation));
 
        /* check privilege and update client context */
        if (net_nfc_server_gdbus_check_privilege(invocation, NET_NFC_PRIVILEGE_NFC) == false) {
@@ -575,8 +481,7 @@ static gboolean test_handle_set_se_tech_type(NetNfcGDbusTest *test,
        }
 
        data = g_try_new0(TestSetEeData, 1);
-       if (data == NULL)
-       {
+       if (data == NULL) {
                DEBUG_ERR_MSG("Memory allocation failed");
                result = NET_NFC_ALLOC_FAIL;
 
@@ -588,9 +493,7 @@ static gboolean test_handle_set_se_tech_type(NetNfcGDbusTest *test,
        data->mode = type;
        data->reg_id = tech;
 
-       if (net_nfc_server_controller_async_queue_push(
-               test_handle_set_se_tech_type_thread_func, data) == FALSE)
-       {
+       if (net_nfc_server_controller_async_queue_push(test_handle_set_se_tech_type_thread_func, data) == FALSE) {
                /* return error if queue was blocked */
                DEBUG_SERVER_MSG("controller is processing important message..");
                result = NET_NFC_BUSY;
@@ -600,7 +503,7 @@ static gboolean test_handle_set_se_tech_type(NetNfcGDbusTest *test,
 
        return TRUE;
 
-ERROR :
+ ERROR:
        if (data != NULL) {
                g_object_unref(data->invocation);
                g_object_unref(data->test);
@@ -615,7 +518,7 @@ ERROR :
 
 static void test_set_listen_tech_mask_thread_func(gpointer user_data)
 {
-       TestSetListenTechData *data = (TestSetListenTechData *)user_data;
+       TestSetListenTechData *data = (TestSetListenTechData *) user_data;
        net_nfc_error_e result = NET_NFC_OK;
 
        g_assert(data != NULL);
@@ -626,8 +529,7 @@ static void test_set_listen_tech_mask_thread_func(gpointer user_data)
 
        net_nfc_controller_secure_element_set_listen_tech_mask(data->mode, &result);
 
-       net_nfc_gdbus_test_complete_set_listen_tech_mask(
-               data->test, data->invocation, result);
+       net_nfc_gdbus_test_complete_set_listen_tech_mask(data->test, data->invocation, result);
 
        g_object_unref(data->invocation);
        g_object_unref(data->test);
@@ -635,17 +537,12 @@ static void test_set_listen_tech_mask_thread_func(gpointer user_data)
        g_free(data);
 }
 
-static gboolean test_handle_set_listen_tech_mask(
-       NetNfcGDbusTest *test,
-       GDBusMethodInvocation *invocation,
-       guint listen_tech_mask,
-       GVariant *smack_privilege)
+static gboolean test_handle_set_listen_tech_mask(NetNfcGDbusTest * test, GDBusMethodInvocation * invocation, guint listen_tech_mask, GVariant * smack_privilege)
 {
        TestSetListenTechData *data = NULL;
        gint result;
 
-       INFO_MSG(">>> REQUEST from [%s]",
-               g_dbus_method_invocation_get_sender(invocation));
+       INFO_MSG(">>> REQUEST from [%s]", g_dbus_method_invocation_get_sender(invocation));
 
        /* check privilege and update client context */
        if (net_nfc_server_gdbus_check_privilege(invocation, NET_NFC_PRIVILEGE_NFC) == false) {
@@ -656,8 +553,7 @@ static gboolean test_handle_set_listen_tech_mask(
        }
 
        data = g_try_new0(TestSetListenTechData, 1);
-       if (data == NULL)
-       {
+       if (data == NULL) {
                DEBUG_ERR_MSG("Memory allocation failed");
                result = NET_NFC_ALLOC_FAIL;
 
@@ -668,9 +564,7 @@ static gboolean test_handle_set_listen_tech_mask(
        data->invocation = g_object_ref(invocation);
        data->mode = listen_tech_mask;
 
-       if (net_nfc_server_controller_async_queue_push_force(
-               test_set_listen_tech_mask_thread_func, data) == FALSE)
-       {
+       if (net_nfc_server_controller_async_queue_push_force(test_set_listen_tech_mask_thread_func, data) == FALSE) {
                /* return error if queue was blocked */
                DEBUG_SERVER_MSG("controller is processing important message..");
                result = NET_NFC_BUSY;
@@ -680,10 +574,9 @@ static gboolean test_handle_set_listen_tech_mask(
 
        return TRUE;
 
-ERROR :
+ ERROR:
 
-       net_nfc_gdbus_test_complete_set_listen_tech_mask(
-               test, invocation, result);
+       net_nfc_gdbus_test_complete_set_listen_tech_mask(test, invocation, result);
 
        if (data != NULL) {
                g_object_unref(data->invocation);
@@ -695,8 +588,7 @@ ERROR :
        return TRUE;
 }
 
-
-gboolean net_nfc_server_test_init(GDBusConnection *connection)
+gboolean net_nfc_server_test_init(GDBusConnection * connection)
 {
        GError *error = NULL;
        gboolean result;
@@ -706,48 +598,22 @@ gboolean net_nfc_server_test_init(GDBusConnection *connection)
 
        test_skeleton = net_nfc_gdbus_test_skeleton_new();
 
-       g_signal_connect(test_skeleton,
-                       "handle-sim-test",
-                       G_CALLBACK(test_handle_sim_test),
-                       NULL);
-
-       g_signal_connect(test_skeleton,
-                       "handle-prbs-test",
-                       G_CALLBACK(test_handle_prbs_test),
-                       NULL);
-
-       g_signal_connect(test_skeleton,
-                       "handle-get-firmware-version",
-                       G_CALLBACK(test_handle_get_firmware_version),
-                       NULL);
-
-       g_signal_connect(test_skeleton,
-                       "handle-set-ee-data",
-                       G_CALLBACK(test_handle_set_ee_data),
-                       NULL);
-
-       g_signal_connect(test_skeleton,
-                       "handle-ese-test",
-                       G_CALLBACK(test_handle_ese_test),
-                       NULL);
-
-       g_signal_connect(test_skeleton,
-                       "handle-set-se-tech-type",
-                       G_CALLBACK(test_handle_set_se_tech_type),
-                       NULL);
-
-       g_signal_connect(test_skeleton,
-                       "handle-set-listen-tech-mask",
-                       G_CALLBACK(test_handle_set_listen_tech_mask),
-                       NULL);
-
-       result = g_dbus_interface_skeleton_export(
-               G_DBUS_INTERFACE_SKELETON(test_skeleton),
-               connection,
-               "/org/tizen/NetNfcService/Test",
-               &error);
-       if (result == FALSE)
-       {
+       g_signal_connect(test_skeleton, "handle-sim-test", G_CALLBACK(test_handle_sim_test), NULL);
+
+       g_signal_connect(test_skeleton, "handle-prbs-test", G_CALLBACK(test_handle_prbs_test), NULL);
+
+       g_signal_connect(test_skeleton, "handle-get-firmware-version", G_CALLBACK(test_handle_get_firmware_version), NULL);
+
+       g_signal_connect(test_skeleton, "handle-set-ee-data", G_CALLBACK(test_handle_set_ee_data), NULL);
+
+       g_signal_connect(test_skeleton, "handle-ese-test", G_CALLBACK(test_handle_ese_test), NULL);
+
+       g_signal_connect(test_skeleton, "handle-set-se-tech-type", G_CALLBACK(test_handle_set_se_tech_type), NULL);
+
+       g_signal_connect(test_skeleton, "handle-set-listen-tech-mask", G_CALLBACK(test_handle_set_listen_tech_mask), NULL);
+
+       result = g_dbus_interface_skeleton_export(G_DBUS_INTERFACE_SKELETON(test_skeleton), connection, "/org/tizen/NetNfcService/Test", &error);
+       if (result == FALSE) {
                DEBUG_ERR_MSG("Can not skeleton_export %s", error->message);
                g_error_free(error);
                g_object_unref(test_skeleton);
@@ -760,8 +626,7 @@ gboolean net_nfc_server_test_init(GDBusConnection *connection)
 
 void net_nfc_server_test_deinit(void)
 {
-       if (test_skeleton)
-       {
+       if (test_skeleton) {
                g_object_unref(test_skeleton);
                test_skeleton = NULL;
        }
index e6d3d49..42cb417 100755 (executable)
 #include "net_nfc_server_context_internal.h"
 #include "net_nfc_server_transceive.h"
 
-
 static NetNfcGDbusTransceive *transceive_skeleton = NULL;
 
 static void transceive_thread_func(gpointer user_data);
 
 static void transceive_data_thread_func(gpointer user_data);
 
-static gboolean transceive_handle(NetNfcGDbusTransceive *transceive,
-       GDBusMethodInvocation *invocation,
-       guint handle,
-       guint dev_type,
-       GVariant *arg_data,
-       GVariant *smack_privilege,
-       gpointer user_data);
-
-static gboolean transceive_data_handle(NetNfcGDbusTransceive *transceive,
-       GDBusMethodInvocation *invocation,
-       guint handle,
-       guint dev_type,
-       GVariant *arg_data,
-       GVariant *smack_privilege,
-       gpointer user_data);
+static gboolean transceive_handle(NetNfcGDbusTransceive * transceive, GDBusMethodInvocation * invocation, guint handle, guint dev_type, GVariant * arg_data, GVariant * smack_privilege, gpointer user_data);
 
+static gboolean transceive_data_handle(NetNfcGDbusTransceive * transceive, GDBusMethodInvocation * invocation, guint handle, guint dev_type, GVariant * arg_data, GVariant * smack_privilege, gpointer user_data);
 
 typedef struct _TransceiveSendData TransceiveSendData;
 
-struct _TransceiveSendData
-{
+struct _TransceiveSendData {
        NetNfcGDbusTransceive *transceive;
        GDBusMethodInvocation *invocation;
        guint transceive_handle;
@@ -61,7 +46,7 @@ struct _TransceiveSendData
 
 static void transceive_data_thread_func(gpointer user_data)
 {
-       TransceiveSendData *transceive_data = (TransceiveSendData*)user_data;
+       TransceiveSendData *transceive_data = (TransceiveSendData *) user_data;
        net_nfc_target_handle_s *handle;
        net_nfc_error_e result = NET_NFC_OK;
        data_s *data = NULL;
@@ -72,25 +57,15 @@ static void transceive_data_thread_func(gpointer user_data)
        g_assert(transceive_data->transceive != NULL);
        g_assert(transceive_data->invocation != NULL);
 
-       if (net_nfc_server_target_connected(transceive_data->transceive_handle) == true)
-       {
+       if (net_nfc_server_target_connected(transceive_data->transceive_handle) == true) {
                DEBUG_SERVER_MSG("call transceive");
                handle = net_nfc_server_get_target_handle();
 
-               if (net_nfc_controller_transceive(handle,
-                       &transceive_data->transceive_info,
-                       &data,
-                       &result) == true)
-               {
+               if (net_nfc_controller_transceive(handle, &transceive_data->transceive_info, &data, &result) == true) {
                        if (data != NULL)
-                       {
-                               DEBUG_SERVER_MSG("Transceive data received [%d]",
-                                       data->length);
-                       }
+                               DEBUG_SERVER_MSG("Transceive data received [%d]", data->length);
                }
-       }
-       else
-       {
+       } else {
                result = NET_NFC_TARGET_IS_MOVED_AWAY;
        }
 
@@ -98,16 +73,10 @@ static void transceive_data_thread_func(gpointer user_data)
 
        resp_data = net_nfc_util_gdbus_data_to_variant(data);
 
-       net_nfc_gdbus_transceive_complete_transceive_data(
-               transceive_data->transceive,
-               transceive_data->invocation,
-               (gint)result,
-               resp_data);
+       net_nfc_gdbus_transceive_complete_transceive_data(transceive_data->transceive, transceive_data->invocation, (gint) result, resp_data);
 
        if (data)
-       {
                net_nfc_util_free_data(data);
-       }
 
        net_nfc_util_clear_data(&transceive_data->transceive_info.trans_data);
 
@@ -117,19 +86,12 @@ static void transceive_data_thread_func(gpointer user_data)
        g_free(transceive_data);
 }
 
-static gboolean transceive_data_handle(NetNfcGDbusTransceive *transceive,
-       GDBusMethodInvocation *invocation,
-       guint handle,
-       guint dev_type,
-       GVariant *arg_data,
-       GVariant *smack_privilege,
-       gpointer user_data)
+static gboolean transceive_data_handle(NetNfcGDbusTransceive * transceive, GDBusMethodInvocation * invocation, guint handle, guint dev_type, GVariant * arg_data, GVariant * smack_privilege, gpointer user_data)
 {
        TransceiveSendData *data = NULL;
        gint result;
 
-       INFO_MSG(">>> REQUEST from [%s]",
-               g_dbus_method_invocation_get_sender(invocation));
+       INFO_MSG(">>> REQUEST from [%s]", g_dbus_method_invocation_get_sender(invocation));
 
        /* check privilege and update client context */
        if (net_nfc_server_gdbus_check_privilege(invocation, NET_NFC_PRIVILEGE_NFC_P2P) == false) {
@@ -140,8 +102,7 @@ static gboolean transceive_data_handle(NetNfcGDbusTransceive *transceive,
        }
 
        data = g_try_new0(TransceiveSendData, 1);
-       if (data == NULL)
-       {
+       if (data == NULL) {
                DEBUG_ERR_MSG("Memory allocation failed");
                result = NET_NFC_ALLOC_FAIL;
 
@@ -152,12 +113,9 @@ static gboolean transceive_data_handle(NetNfcGDbusTransceive *transceive,
        data->invocation = g_object_ref(invocation);
        data->transceive_handle = handle;
        data->transceive_info.dev_type = dev_type;
-       net_nfc_util_gdbus_variant_to_data_s(arg_data,
-               &data->transceive_info.trans_data);
+       net_nfc_util_gdbus_variant_to_data_s(arg_data, &data->transceive_info.trans_data);
 
-       if (net_nfc_server_controller_async_queue_push(
-               transceive_data_thread_func, data) == FALSE)
-       {
+       if (net_nfc_server_controller_async_queue_push(transceive_data_thread_func, data) == FALSE) {
                /* return error if queue was blocked */
                DEBUG_SERVER_MSG("controller is processing important message..");
                result = NET_NFC_BUSY;
@@ -167,7 +125,7 @@ static gboolean transceive_data_handle(NetNfcGDbusTransceive *transceive,
 
        return TRUE;
 
-ERROR :
+ ERROR:
        if (data != NULL) {
                net_nfc_util_clear_data(&data->transceive_info.trans_data);
 
@@ -177,18 +135,14 @@ ERROR :
                g_free(data);
        }
 
-       net_nfc_gdbus_transceive_complete_transceive_data(
-               transceive,
-               invocation,
-               result,
-               net_nfc_util_gdbus_buffer_to_variant(NULL, 0));
+       net_nfc_gdbus_transceive_complete_transceive_data(transceive, invocation, result, net_nfc_util_gdbus_buffer_to_variant(NULL, 0));
 
        return TRUE;
 }
 
 static void transceive_thread_func(gpointer user_data)
 {
-       TransceiveSendData *transceive_data = (TransceiveSendData *)user_data;
+       TransceiveSendData *transceive_data = (TransceiveSendData *) user_data;
        net_nfc_target_handle_s *handle;
        net_nfc_error_e result = NET_NFC_OK;
        data_s *data = NULL;
@@ -198,29 +152,19 @@ static void transceive_thread_func(gpointer user_data)
        g_assert(transceive_data->transceive != NULL);
        g_assert(transceive_data->invocation != NULL);
 
-       if (net_nfc_server_target_connected(transceive_data->transceive_handle) == true)
-       {
+       if (net_nfc_server_target_connected(transceive_data->transceive_handle) == true) {
                DEBUG_MSG("call transceive");
                handle = net_nfc_server_get_target_handle();
 
-               if (net_nfc_controller_transceive(handle,
-                       &transceive_data->transceive_info,
-                       &data,
-                       &result) == true)
-               {
-                       if (data != NULL)
-                       {
-                               DEBUG_SERVER_MSG(
-                                       "Transceive data received [%d]",
-                                       data->length);
+               if (net_nfc_controller_transceive(handle, &transceive_data->transceive_info, &data, &result) == true) {
+                       if (data != NULL) {
+                               DEBUG_SERVER_MSG("Transceive data received [%d]", data->length);
 
                                /* free resource because it doesn't need */
                                net_nfc_util_free_data(data);
                        }
                }
-       }
-       else
-       {
+       } else {
                DEBUG_SERVER_MSG("target is not connected");
 
                result = NET_NFC_TARGET_IS_MOVED_AWAY;
@@ -228,10 +172,7 @@ static void transceive_thread_func(gpointer user_data)
 
        DEBUG_SERVER_MSG("transceive result : %d", result);
 
-       net_nfc_gdbus_transceive_complete_transceive(
-               transceive_data->transceive,
-               transceive_data->invocation,
-               (gint)result);
+       net_nfc_gdbus_transceive_complete_transceive(transceive_data->transceive, transceive_data->invocation, (gint) result);
 
        net_nfc_util_clear_data(&transceive_data->transceive_info.trans_data);
 
@@ -241,19 +182,12 @@ static void transceive_thread_func(gpointer user_data)
        g_free(transceive_data);
 }
 
-static gboolean transceive_handle(NetNfcGDbusTransceive *transceive,
-       GDBusMethodInvocation *invocation,
-       guint handle,
-       guint dev_type,
-       GVariant *arg_data,
-       GVariant *smack_privilege,
-       gpointer user_data)
+static gboolean transceive_handle(NetNfcGDbusTransceive * transceive, GDBusMethodInvocation * invocation, guint handle, guint dev_type, GVariant * arg_data, GVariant * smack_privilege, gpointer user_data)
 {
        TransceiveSendData *data = NULL;
        gint result;
 
-       INFO_MSG(">>> REQUEST from [%s]",
-               g_dbus_method_invocation_get_sender(invocation));
+       INFO_MSG(">>> REQUEST from [%s]", g_dbus_method_invocation_get_sender(invocation));
 
        /* check privilege and update client context */
        if (net_nfc_server_gdbus_check_privilege(invocation, NET_NFC_PRIVILEGE_NFC_P2P) == false) {
@@ -264,8 +198,7 @@ static gboolean transceive_handle(NetNfcGDbusTransceive *transceive,
        }
 
        data = g_try_new0(TransceiveSendData, 1);
-       if (data == NULL)
-       {
+       if (data == NULL) {
                DEBUG_ERR_MSG("Memory allocation failed");
                result = NET_NFC_ALLOC_FAIL;
 
@@ -276,12 +209,9 @@ static gboolean transceive_handle(NetNfcGDbusTransceive *transceive,
        data->invocation = g_object_ref(invocation);
        data->transceive_handle = handle;
        data->transceive_info.dev_type = dev_type;
-       net_nfc_util_gdbus_variant_to_data_s(arg_data,
-               &data->transceive_info.trans_data);
+       net_nfc_util_gdbus_variant_to_data_s(arg_data, &data->transceive_info.trans_data);
 
-       if (net_nfc_server_controller_async_queue_push(
-               transceive_thread_func, data) == FALSE)
-       {
+       if (net_nfc_server_controller_async_queue_push(transceive_thread_func, data) == FALSE) {
                /* return error if queue was blocked */
                DEBUG_SERVER_MSG("controller is processing important message..");
                result = NET_NFC_BUSY;
@@ -291,7 +221,7 @@ static gboolean transceive_handle(NetNfcGDbusTransceive *transceive,
 
        return TRUE;
 
-ERROR :
+ ERROR:
        if (data != NULL) {
                net_nfc_util_clear_data(&data->transceive_info.trans_data);
 
@@ -301,14 +231,12 @@ ERROR :
                g_free(data);
        }
 
-       net_nfc_gdbus_transceive_complete_transceive(transceive,
-               invocation, result);
+       net_nfc_gdbus_transceive_complete_transceive(transceive, invocation, result);
 
        return TRUE;
 }
 
-
-gboolean net_nfc_server_transceive_init(GDBusConnection *connection)
+gboolean net_nfc_server_transceive_init(GDBusConnection * connection)
 {
        GError *error = NULL;
        gboolean result;
@@ -318,23 +246,12 @@ gboolean net_nfc_server_transceive_init(GDBusConnection *connection)
 
        transceive_skeleton = net_nfc_gdbus_transceive_skeleton_new();
 
-       g_signal_connect(transceive_skeleton,
-                       "handle-transceive-data",
-                       G_CALLBACK(transceive_data_handle),
-                       NULL);
-
-       g_signal_connect(transceive_skeleton,
-                       "handle-transceive",
-                       G_CALLBACK(transceive_handle),
-                       NULL);
-
-       result = g_dbus_interface_skeleton_export(
-               G_DBUS_INTERFACE_SKELETON(transceive_skeleton),
-               connection,
-               "/org/tizen/NetNfcService/Transceive",
-               &error);
-       if (result == FALSE)
-       {
+       g_signal_connect(transceive_skeleton, "handle-transceive-data", G_CALLBACK(transceive_data_handle), NULL);
+
+       g_signal_connect(transceive_skeleton, "handle-transceive", G_CALLBACK(transceive_handle), NULL);
+
+       result = g_dbus_interface_skeleton_export(G_DBUS_INTERFACE_SKELETON(transceive_skeleton), connection, "/org/tizen/NetNfcService/Transceive", &error);
+       if (result == FALSE) {
                g_error_free(error);
                g_object_unref(transceive_skeleton);
                transceive_skeleton = NULL;
@@ -345,8 +262,7 @@ gboolean net_nfc_server_transceive_init(GDBusConnection *connection)
 
 void net_nfc_server_transceive_deinit(void)
 {
-       if (transceive_skeleton)
-       {
+       if (transceive_skeleton) {
                g_object_unref(transceive_skeleton);
                transceive_skeleton = NULL;
        }
index 2cbaa1f..5f1e240 100755 (executable)
 
 static bool is_screen_state_on = false;
 
-static void net_nfc_server_vconf_lock_state_changed(keynode_t *key,
-                                               void *user_data);
+static void net_nfc_server_vconf_lock_state_changed(keynode_t * key, void *user_data);
 
-static void net_nfc_server_vconf_pm_state_changed(keynode_t *key,
-                                               void *user_data);
+static void net_nfc_server_vconf_pm_state_changed(keynode_t * key, void *user_data);
 
-static void net_nfc_server_vconf_lock_state_changed(keynode_t *key,
-                                               void *user_data)
+static void net_nfc_server_vconf_lock_state_changed(keynode_t * key, void *user_data)
 {
 
        gint state = 0;
@@ -44,20 +41,17 @@ static void net_nfc_server_vconf_lock_state_changed(keynode_t *key,
        if (result != 0)
                DEBUG_ERR_MSG("can not get %s", "VCONFKEY_NFC_STATE");
 
-       if (state == false)
-       {
+       if (state == false) {
                DEBUG_SERVER_MSG("NFC off");
                return;
        }
 
-       if (is_screen_state_on == true) {
+       if (is_screen_state_on == true)
                net_nfc_server_restart_polling_loop();
-       }
 
 }
 
-static void net_nfc_server_vconf_pm_state_changed(keynode_t *key,
-                                               void *user_data)
+static void net_nfc_server_vconf_pm_state_changed(keynode_t * key, void *user_data)
 {
        gint state = 0;
        gint pm_state = 0;
@@ -68,8 +62,7 @@ static void net_nfc_server_vconf_pm_state_changed(keynode_t *key,
        if (result != 0)
                DEBUG_ERR_MSG("can not get %s", "VCONFKEY_NFC_STATE");
 
-       if (state == false)
-       {
+       if (state == false) {
                DEBUG_SERVER_MSG("NFC off");
                return;
        }
@@ -81,25 +74,20 @@ static void net_nfc_server_vconf_pm_state_changed(keynode_t *key,
 
        DEBUG_SERVER_MSG("pm_state : %d", pm_state);
 
-       if (pm_state == VCONFKEY_PM_STATE_NORMAL ||
-               pm_state == VCONFKEY_PM_STATE_LCDOFF)
-       {
-               if (is_screen_state_on == true) {
+       if (pm_state == VCONFKEY_PM_STATE_NORMAL || pm_state == VCONFKEY_PM_STATE_LCDOFF) {
+               if (is_screen_state_on == true)
                        net_nfc_server_restart_polling_loop();
-               }
        }
 }
 
-static void net_nfc_server_vconf_se_type_changed(keynode_t *key,
-                                               void *user_data)
+static void net_nfc_server_vconf_se_type_changed(keynode_t * key, void *user_data)
 {
        net_nfc_server_se_apply_se_current_policy();
 
        net_nfc_server_route_table_do_update(net_nfc_server_manager_get_active());
 }
 
-static void net_nfc_server_vconf_wallet_mode_changed(keynode_t *key,
-                                               void *user_data)
+static void net_nfc_server_vconf_wallet_mode_changed(keynode_t * key, void *user_data)
 {
        int wallet_mode;
 
@@ -120,24 +108,18 @@ static void __on_payment_handler_changed_func(gpointer user_data)
 
        SECURE_MSG("PAYMENT handler changed, [%s]", package);
 
-       net_nfc_server_route_table_update_category_handler(package,
-               NET_NFC_CARD_EMULATION_CATEGORY_PAYMENT);
+       net_nfc_server_route_table_update_category_handler(package, NET_NFC_CARD_EMULATION_CATEGORY_PAYMENT);
 
-       if (package != NULL) {
+       if (package != NULL)
                g_free(package);
-       }
 }
 
-static void net_nfc_server_vconf_payment_handlers_changed(keynode_t *key,
-       void *user_data)
+static void net_nfc_server_vconf_payment_handlers_changed(keynode_t * key, void *user_data)
 {
        g_assert(key != NULL);
 
-       if (net_nfc_server_controller_async_queue_push(
-               __on_payment_handler_changed_func,
-               g_strdup(key->value.s)) == false) {
+       if (net_nfc_server_controller_async_queue_push(__on_payment_handler_changed_func, g_strdup(key->value.s)) == false)
                DEBUG_ERR_MSG("net_nfc_server_controller_async_queue_push failed");
-       }
 }
 
 static void __on_other_handlers_changed_func(gpointer user_data)
@@ -146,70 +128,47 @@ static void __on_other_handlers_changed_func(gpointer user_data)
 
        SECURE_MSG("OTHER handlers changed, [%s]", packages);
 
-       net_nfc_server_route_table_update_category_handler(packages,
-               NET_NFC_CARD_EMULATION_CATEGORY_OTHER);
+       net_nfc_server_route_table_update_category_handler(packages, NET_NFC_CARD_EMULATION_CATEGORY_OTHER);
 
-       if (packages != NULL) {
+       if (packages != NULL)
                g_free(packages);
-       }
 }
 
-static void net_nfc_server_vconf_other_handlers_changed(keynode_t *key,
-       void *user_data)
+static void net_nfc_server_vconf_other_handlers_changed(keynode_t * key, void *user_data)
 {
        g_assert(key != NULL);
 
-       if (net_nfc_server_controller_async_queue_push(
-               __on_other_handlers_changed_func,
-               g_strdup(key->value.s)) == false) {
+       if (net_nfc_server_controller_async_queue_push(__on_other_handlers_changed_func, g_strdup(key->value.s)) == false)
                DEBUG_ERR_MSG("net_nfc_server_controller_async_queue_push failed");
-       }
 }
 
 void net_nfc_server_vconf_init(void)
 {
-       vconf_notify_key_changed(VCONFKEY_IDLE_LOCK_STATE,
-                       net_nfc_server_vconf_lock_state_changed,
-                       NULL);
+       vconf_notify_key_changed(VCONFKEY_IDLE_LOCK_STATE, net_nfc_server_vconf_lock_state_changed, NULL);
 #if 1
-       vconf_notify_key_changed(VCONFKEY_PM_STATE,
-                       net_nfc_server_vconf_pm_state_changed,
-                       NULL);
+       vconf_notify_key_changed(VCONFKEY_PM_STATE, net_nfc_server_vconf_pm_state_changed, NULL);
 #endif
 
-       vconf_notify_key_changed(VCONFKEY_NFC_SE_TYPE,
-                       net_nfc_server_vconf_se_type_changed,
-                       NULL);
+       vconf_notify_key_changed(VCONFKEY_NFC_SE_TYPE, net_nfc_server_vconf_se_type_changed, NULL);
 
-       vconf_notify_key_changed(VCONFKEY_NFC_WALLET_MODE,
-                       net_nfc_server_vconf_wallet_mode_changed,
-                       NULL);
+       vconf_notify_key_changed(VCONFKEY_NFC_WALLET_MODE, net_nfc_server_vconf_wallet_mode_changed, NULL);
 
-       vconf_notify_key_changed(VCONFKEY_NFC_PAYMENT_HANDLERS,
-                       net_nfc_server_vconf_payment_handlers_changed,
-                       NULL);
+       vconf_notify_key_changed(VCONFKEY_NFC_PAYMENT_HANDLERS, net_nfc_server_vconf_payment_handlers_changed, NULL);
 
-       vconf_notify_key_changed(VCONFKEY_NFC_OTHER_HANDLERS,
-                       net_nfc_server_vconf_other_handlers_changed,
-                       NULL);
+       vconf_notify_key_changed(VCONFKEY_NFC_OTHER_HANDLERS, net_nfc_server_vconf_other_handlers_changed, NULL);
 }
 
 void net_nfc_server_vconf_deinit(void)
 {
-       vconf_ignore_key_changed(VCONFKEY_IDLE_LOCK_STATE,
-                       net_nfc_server_vconf_lock_state_changed);
+       vconf_ignore_key_changed(VCONFKEY_IDLE_LOCK_STATE, net_nfc_server_vconf_lock_state_changed);
 
-       vconf_ignore_key_changed(VCONFKEY_NFC_SE_TYPE,
-                       net_nfc_server_vconf_se_type_changed);
+       vconf_ignore_key_changed(VCONFKEY_NFC_SE_TYPE, net_nfc_server_vconf_se_type_changed);
 
-       vconf_ignore_key_changed(VCONFKEY_NFC_WALLET_MODE,
-                       net_nfc_server_vconf_wallet_mode_changed);
+       vconf_ignore_key_changed(VCONFKEY_NFC_WALLET_MODE, net_nfc_server_vconf_wallet_mode_changed);
 
-       vconf_ignore_key_changed(VCONFKEY_NFC_PAYMENT_HANDLERS,
-                       net_nfc_server_vconf_payment_handlers_changed);
+       vconf_ignore_key_changed(VCONFKEY_NFC_PAYMENT_HANDLERS, net_nfc_server_vconf_payment_handlers_changed);
 
-       vconf_ignore_key_changed(VCONFKEY_NFC_OTHER_HANDLERS,
-                       net_nfc_server_vconf_other_handlers_changed);
+       vconf_ignore_key_changed(VCONFKEY_NFC_OTHER_HANDLERS, net_nfc_server_vconf_other_handlers_changed);
 }
 
 bool net_nfc_check_start_polling_vconf(void)
@@ -227,34 +186,25 @@ bool net_nfc_check_start_polling_vconf(void)
        if (vconf_get_int(VCONFKEY_PM_STATE, &pm_state) != 0)
                DEBUG_ERR_MSG("%s does not exist", "VCONFKEY_PM_STATE");
 
+       DEBUG_SERVER_MSG("lock_screen_set:%d ,pm_state:%d,lock_state:%d", lock_screen_set, pm_state, lock_state);
 
-       DEBUG_SERVER_MSG("lock_screen_set:%d ,pm_state:%d,lock_state:%d",
-               lock_screen_set , pm_state , lock_state);
-
-       if (lock_screen_set == SETTING_SCREEN_LOCK_TYPE_NONE)
-       {
-               if (pm_state == VCONFKEY_PM_STATE_NORMAL)
-               {
+       if (lock_screen_set == SETTING_SCREEN_LOCK_TYPE_NONE) {
+               if (pm_state == VCONFKEY_PM_STATE_NORMAL) {
                        DEBUG_SERVER_MSG("polling enable");
                        return TRUE;
                }
 
-               if (pm_state == VCONFKEY_PM_STATE_LCDOFF)
-               {
+               if (pm_state == VCONFKEY_PM_STATE_LCDOFF) {
                        DEBUG_SERVER_MSG("polling disabled");
                        return FALSE;
                }
-       }
-       else
-       {
-               if (lock_state == VCONFKEY_IDLE_UNLOCK)
-               {
+       } else {
+               if (lock_state == VCONFKEY_IDLE_UNLOCK) {
                        DEBUG_SERVER_MSG("polling enable");
                        return TRUE;
                }
 
-               if (lock_state == VCONFKEY_IDLE_LOCK || pm_state == VCONFKEY_PM_STATE_LCDOFF)
-               {
+               if (lock_state == VCONFKEY_IDLE_LOCK || pm_state == VCONFKEY_PM_STATE_LCDOFF) {
                        DEBUG_SERVER_MSG("polling disabled");
                        return FALSE;
                }