From: Hyihong Chae Date: Wed, 8 Jun 2016 10:42:57 +0000 (+0900) Subject: apply Tizen Coding Rules. X-Git-Tag: accepted/tizen/ivi/20160609.091935^0 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=refs%2Fchanges%2F19%2F73519%2F1;p=platform%2Fcore%2Fapi%2Fnfc.git apply Tizen Coding Rules. Change-Id: I172f3f91f8d965872c99164fc288a8b0f34c1a1d Signed-off-by: HyiHong Chae --- diff --git a/include/net_nfc.h b/include/net_nfc.h index 1e97731..f12db53 100755 --- a/include/net_nfc.h +++ b/include/net_nfc.h @@ -43,4 +43,4 @@ #include "net_nfc_client_hce.h" -#endif //__NET_NFC_H__ +#endif /* __NET_NFC_H__ */ diff --git a/include/net_nfc_client.h b/include/net_nfc_client.h index b32bb72..804fb9b 100755 --- a/include/net_nfc_client.h +++ b/include/net_nfc_client.h @@ -31,4 +31,4 @@ void net_nfc_client_gdbus_deinit(void); } #endif -#endif //__NET_NFC_CLIENT_H__ +#endif /* __NET_NFC_CLIENT_H__ */ diff --git a/include/net_nfc_client_context.h b/include/net_nfc_client_context.h index 36b9864..79bf268 100755 --- a/include/net_nfc_client_context.h +++ b/include/net_nfc_client_context.h @@ -46,4 +46,4 @@ net_nfc_error_e net_nfc_client_get_nfc_state(int *state); } #endif -#endif //__NET_NFC_CLIENT_CONTEXT_H__ +#endif /* __NET_NFC_CLIENT_CONTEXT_H__ */ diff --git a/include/net_nfc_client_handover.h b/include/net_nfc_client_handover.h index 52aaf98..afa69c3 100755 --- a/include/net_nfc_client_handover.h +++ b/include/net_nfc_client_handover.h @@ -22,8 +22,7 @@ extern "C" { #endif -typedef enum -{ +typedef enum { NET_NFC_HANDOVER_START, NET_NFC_HANDOVER_FINISH, } @@ -87,4 +86,4 @@ void net_nfc_client_handover_deinit(void); } #endif -#endif //__NET_NFC_CLIENT_HANDOVER_H__ +#endif /* __NET_NFC_CLIENT_HANDOVER_H__ */ diff --git a/include/net_nfc_client_hce.h b/include/net_nfc_client_hce.h index d4b8d38..84de71a 100755 --- a/include/net_nfc_client_hce.h +++ b/include/net_nfc_client_hce.h @@ -52,4 +52,4 @@ void net_nfc_client_hce_process_received_event(int event, } #endif -#endif //__NET_NFC_CLIENT_HCE_H__ +#endif /* __NET_NFC_CLIENT_HCE_H__ */ diff --git a/include/net_nfc_client_hce_ipc.h b/include/net_nfc_client_hce_ipc.h index cc5ca6d..259780c 100755 --- a/include/net_nfc_client_hce_ipc.h +++ b/include/net_nfc_client_hce_ipc.h @@ -35,4 +35,4 @@ bool net_nfc_server_hce_ipc_send_to_server(int type, } #endif -#endif //__NET_NFC_CLIENT_HCE_IPC_H__ +#endif /* __NET_NFC_CLIENT_HCE_IPC_H__ */ diff --git a/include/net_nfc_client_llcp.h b/include/net_nfc_client_llcp.h index a8204e7..7e8de1f 100755 --- a/include/net_nfc_client_llcp.h +++ b/include/net_nfc_client_llcp.h @@ -273,4 +273,4 @@ void net_nfc_client_llcp_deinit(void); } #endif -#endif //__NET_NFC_CLIENT_LLCP_H__ +#endif /* __NET_NFC_CLIENT_LLCP_H__ */ diff --git a/include/net_nfc_client_manager.h b/include/net_nfc_client_manager.h index 094d437..0beaf45 100755 --- a/include/net_nfc_client_manager.h +++ b/include/net_nfc_client_manager.h @@ -64,4 +64,4 @@ void net_nfc_client_manager_deinit(void); } #endif -#endif //__NET_NFC_CLIENT_MANAGER_H__ +#endif /* __NET_NFC_CLIENT_MANAGER_H__ */ diff --git a/include/net_nfc_client_ndef.h b/include/net_nfc_client_ndef.h index cdaf312..00ec8ed 100755 --- a/include/net_nfc_client_ndef.h +++ b/include/net_nfc_client_ndef.h @@ -78,4 +78,4 @@ void net_nfc_client_ndef_deinit(void); } #endif -#endif //__NET_NFC_CLIENT_NDEF_H__ +#endif /* __NET_NFC_CLIENT_NDEF_H__ */ diff --git a/include/net_nfc_client_p2p.h b/include/net_nfc_client_p2p.h index 58b97aa..547e267 100755 --- a/include/net_nfc_client_p2p.h +++ b/include/net_nfc_client_p2p.h @@ -76,4 +76,4 @@ void net_nfc_client_p2p_deinit(void); } #endif -#endif //__NET_NFC_CLIENT_P2P_H__ +#endif /* __NET_NFC_CLIENT_P2P_H__ */ diff --git a/include/net_nfc_client_se.h b/include/net_nfc_client_se.h index 6e01c5d..097646f 100755 --- a/include/net_nfc_client_se.h +++ b/include/net_nfc_client_se.h @@ -223,7 +223,7 @@ net_nfc_error_e net_nfc_client_se_get_conflict_handlers_sync( net_nfc_error_e net_nfc_client_se_set_preferred_handler_sync(bool state); -//net_nfc_error_e net_nfc_client_hce_get_route_table_sync(data_h arg_aid); +/*net_nfc_error_e net_nfc_client_hce_get_route_table_sync(data_h arg_aid);*/ /* TODO : move to internal header */ @@ -237,4 +237,4 @@ void net_nfc_client_se_deinit(void); } #endif -#endif //__NET_NFC_CLIENT_SE_H__ +#endif /* __NET_NFC_CLIENT_SE_H__ */ diff --git a/include/net_nfc_client_snep.h b/include/net_nfc_client_snep.h index 25c925e..063f43d 100755 --- a/include/net_nfc_client_snep.h +++ b/include/net_nfc_client_snep.h @@ -85,4 +85,4 @@ void net_nfc_client_snep_deinit(void); } #endif -#endif //__NET_NFC_CLIENT_SNEP_H__ +#endif /* __NET_NFC_CLIENT_SNEP_H__ */ diff --git a/include/net_nfc_client_system_handler.h b/include/net_nfc_client_system_handler.h index b384fa6..6287a19 100755 --- a/include/net_nfc_client_system_handler.h +++ b/include/net_nfc_client_system_handler.h @@ -55,4 +55,4 @@ void net_nfc_client_sys_handler_deinit(void); } #endif -#endif //__NET_NFC_CLIENT_SYSTEM_HANDLER_H__ +#endif /* __NET_NFC_CLIENT_SYSTEM_HANDLER_H__ */ diff --git a/include/net_nfc_client_tag.h b/include/net_nfc_client_tag.h index 3f67bf1..d81aed8 100755 --- a/include/net_nfc_client_tag.h +++ b/include/net_nfc_client_tag.h @@ -96,4 +96,4 @@ void net_nfc_client_tag_deinit(void); } #endif -#endif //__NET_NFC_CLIENT_TAG_H__ +#endif /* __NET_NFC_CLIENT_TAG_H__ */ diff --git a/include/net_nfc_client_tag_felica.h b/include/net_nfc_client_tag_felica.h index 29231bf..c28c52c 100755 --- a/include/net_nfc_client_tag_felica.h +++ b/include/net_nfc_client_tag_felica.h @@ -49,14 +49,14 @@ extern "C" { \par Sync (or) Async: Sync This is a Asynchronous API - @param[in] handle target handle of detected tag - @param[in] req_code request code with this command - @param[in] time_slot time slot value + @param[in] handle target handle of detected tag + @param[in] req_code request code with this command + @param[in] time_slot time slot value @return return the result of the calling the function @exception NET_NFC_NULL_PARAMETER parameter has illigal NULL pointer - @exception NET_NFC_ALLOC_FAIL memory allocation is failed + @exception NET_NFC_ALLOC_FAIL memory allocation is failed @exception NET_NFC_NOT_INITIALIZED Try to operate without initialization @exception NET_NFC_BUSY Device is too busy to handle your request @exception NET_NFC_OPERATION_FAIL Operation is failed because of the internal oal error @@ -82,14 +82,14 @@ net_nfc_error_e net_nfc_client_felica_poll(net_nfc_target_handle_h handle, \par Sync (or) Async: Sync This is a Asynchronous API - @param[in] handle target handle of detected tag - @param[in] number_of_area_service the number of specified Area / Service list - @param[in] area_service_list specified Area / Service list + @param[in] handle target handle of detected tag + @param[in] number_of_area_service the number of specified Area / Service list + @param[in] area_service_list specified Area / Service list @return return the result of the calling the function @exception NET_NFC_NULL_PARAMETER parameter has illigal NULL pointer - @exception NET_NFC_ALLOC_FAIL memory allocation is failed + @exception NET_NFC_ALLOC_FAIL memory allocation is failed @exception NET_NFC_NOT_INITIALIZED Try to operate without initialization @exception NET_NFC_BUSY Device is too busy to handle your request @exception NET_NFC_OPERATION_FAIL Operation is failed because of the internal oal error @@ -124,12 +124,12 @@ net_nfc_error_e net_nfc_client_felica_request_service( \par Sync (or) Async: Sync This is a Asynchronous API - @param[in] handle target handle of detected tag + @param[in] handle target handle of detected tag @return return the result of the calling the function @exception NET_NFC_NULL_PARAMETER parameter has illigal NULL pointer - @exception NET_NFC_ALLOC_FAIL memory allocation is failed + @exception NET_NFC_ALLOC_FAIL memory allocation is failed @exception NET_NFC_NOT_INITIALIZED Try to operate without initialization @exception NET_NFC_BUSY Device is too busy to handle your request @exception NET_NFC_OPERATION_FAIL Operation is failed because of the internal oal error @@ -153,16 +153,16 @@ net_nfc_error_e net_nfc_client_felica_request_response( \par Sync (or) Async: Sync This is a Asynchronous API - @param[in] handle target handle of detected tag - @param[in] number_of_service the number of service list to read - @param[in] service_list specified Service list to read - @param[in] number_of_blocks the number of blocks to read - @param[in] block_list the blocks to read + @param[in] handle target handle of detected tag + @param[in] number_of_service the number of service list to read + @param[in] service_list specified Service list to read + @param[in] number_of_blocks the number of blocks to read + @param[in] block_list the blocks to read @return return the result of the calling the function @exception NET_NFC_NULL_PARAMETER parameter has illigal NULL pointer - @exception NET_NFC_ALLOC_FAIL memory allocation is failed + @exception NET_NFC_ALLOC_FAIL memory allocation is failed @exception NET_NFC_NOT_INITIALIZED Try to operate without initialization @exception NET_NFC_BUSY Device is too busy to handle your request @exception NET_NFC_OPERATION_FAIL Operation is failed because of the internal oal error @@ -190,17 +190,17 @@ net_nfc_error_e net_nfc_client_felica_read_without_encryption( \par Sync (or) Async: Sync This is a Asynchronous API - @param[in] handle target handle of detected tag - @param[in] number_of_service the number of service list to write - @param[in] service_list specified Service list to write - @param[in] number_of_blocks the number of blocks to write - @param[in] block_list the blocks to write - @param[in] data the data to write + @param[in] handle target handle of detected tag + @param[in] number_of_service the number of service list to write + @param[in] service_list specified Service list to write + @param[in] number_of_blocks the number of blocks to write + @param[in] block_list the blocks to write + @param[in] data the data to write @return return the result of the calling the function @exception NET_NFC_NULL_PARAMETER parameter has illigal NULL pointer - @exception NET_NFC_ALLOC_FAIL memory allocation is failed + @exception NET_NFC_ALLOC_FAIL memory allocation is failed @exception NET_NFC_NOT_INITIALIZED Try to operate without initialization @exception NET_NFC_BUSY Device is too busy to handle your request @exception NET_NFC_OPERATION_FAIL Operation is failed because of the internal oal error @@ -230,12 +230,12 @@ net_nfc_error_e net_nfc_client_felica_write_without_encryption( \par Sync (or) Async: Sync This is a Asynchronous API - @param[in] handle target handle of detected tag + @param[in] handle target handle of detected tag @return return the result of the calling the function @exception NET_NFC_NULL_PARAMETER parameter has illigal NULL pointer - @exception NET_NFC_ALLOC_FAIL memory allocation is failed + @exception NET_NFC_ALLOC_FAIL memory allocation is failed @exception NET_NFC_NOT_INITIALIZED Try to operate without initialization @exception NET_NFC_BUSY Device is too busy to handle your request @exception NET_NFC_OPERATION_FAIL Operation is failed because of the internal oal error @@ -263,4 +263,4 @@ net_nfc_error_e net_nfc_client_felica_request_system_code( #endif -#endif //__NET_NFC_CLIENT_TAG_FELICA_H__ +#endif /* __NET_NFC_CLIENT_TAG_FELICA_H__ */ diff --git a/include/net_nfc_client_tag_internal.h b/include/net_nfc_client_tag_internal.h index 11220d9..28d76d3 100755 --- a/include/net_nfc_client_tag_internal.h +++ b/include/net_nfc_client_tag_internal.h @@ -32,4 +32,4 @@ net_nfc_target_info_s *net_nfc_client_tag_get_client_target_info(void); } #endif -#endif //__NET_NFC_CLIENT_TAG_INTERNAL_H__ +#endif /* __NET_NFC_CLIENT_TAG_INTERNAL_H__ */ diff --git a/include/net_nfc_client_tag_jewel.h b/include/net_nfc_client_tag_jewel.h index 04774cb..781acc0 100755 --- a/include/net_nfc_client_tag_jewel.h +++ b/include/net_nfc_client_tag_jewel.h @@ -33,12 +33,12 @@ extern "C" { \par Sync (or) Async: Sync This is a Asynchronous API - @param[in] handle target handle of detected tag + @param[in] handle target handle of detected tag @return return the result of the calling the function @exception NET_NFC_NULL_PARAMETER parameter has illigal NULL pointer - @exception NET_NFC_ALLOC_FAIL memory allocation is failed + @exception NET_NFC_ALLOC_FAIL memory allocation is failed @exception NET_NFC_NOT_INITIALIZED Try to operate without initialization @exception NET_NFC_BUSY Device is too busy to handle your request @exception NET_NFC_OPERATION_FAIL Operation is failed because of the internal oal error @@ -60,14 +60,14 @@ net_nfc_error_e net_nfc_client_jewel_read_id(net_nfc_target_handle_h handle, \par Sync (or) Async: Sync This is a Asynchronous API - @param[in] handle target handle of detected tag - @param[in] block block number. (block 0 ~ block E) - @param[in] byte byte number. Each block has 8 bytes. (byte 0 ~ byte 7) + @param[in] handle target handle of detected tag + @param[in] block block number. (block 0 ~ block E) + @param[in] byte byte number. Each block has 8 bytes. (byte 0 ~ byte 7) @return return the result of the calling the function @exception NET_NFC_NULL_PARAMETER parameter has illigal NULL pointer - @exception NET_NFC_ALLOC_FAIL memory allocation is failed + @exception NET_NFC_ALLOC_FAIL memory allocation is failed @exception NET_NFC_NOT_INITIALIZED Try to operate without initialization @exception NET_NFC_BUSY Device is too busy to handle your request @exception NET_NFC_OPERATION_FAIL Operation is failed because of the internal oal error @@ -91,12 +91,12 @@ net_nfc_error_e net_nfc_client_jewel_read_byte(net_nfc_target_handle_h handle, \par Sync (or) Async: Sync This is a Asynchronous API - @param[in] handle target handle of detected tag + @param[in] handle target handle of detected tag @return return the result of the calling the function @exception NET_NFC_NULL_PARAMETER parameter has illigal NULL pointer - @exception NET_NFC_ALLOC_FAIL memory allocation is failed + @exception NET_NFC_ALLOC_FAIL memory allocation is failed @exception NET_NFC_NOT_INITIALIZED Try to operate without initialization @exception NET_NFC_BUSY Device is too busy to handle your request @exception NET_NFC_OPERATION_FAIL Operation is failed because of the internal oal error @@ -121,15 +121,15 @@ net_nfc_error_e net_nfc_client_jewel_read_all(net_nfc_target_handle_h handle, \par Sync (or) Async: Sync This is a Asynchronous API - @param[in] handle target handle of detected tag - @param[in] block block number. (block 0 ~ block E) - @param[in] data the data to write - @param[in] byte byte number. Each block has 8 bytes. (byte 0 ~ byte 7) + @param[in] handle target handle of detected tag + @param[in] block block number. (block 0 ~ block E) + @param[in] data the data to write + @param[in] byte byte number. Each block has 8 bytes. (byte 0 ~ byte 7) @return return the result of the calling the function @exception NET_NFC_NULL_PARAMETER parameter has illigal NULL pointer - @exception NET_NFC_ALLOC_FAIL memory allocation is failed + @exception NET_NFC_ALLOC_FAIL memory allocation is failed @exception NET_NFC_NOT_INITIALIZED Try to operate without initialization @exception NET_NFC_BUSY Device is too busy to handle your request @exception NET_NFC_OPERATION_FAIL Operation is failed because of the internal oal error @@ -161,15 +161,15 @@ net_nfc_error_e net_nfc_client_jewel_write_with_erase( \par Sync (or) Async: Sync This is a Asynchronous API - @param[in] handle target handle of detected tag - @param[in] block block number. (block 0 ~ block E) - @param[in] data the data to write - @param[in] byte byte number. Each block has 8 bytes. (byte 0 ~ byte 7) + @param[in] handle target handle of detected tag + @param[in] block block number. (block 0 ~ block E) + @param[in] data the data to write + @param[in] byte byte number. Each block has 8 bytes. (byte 0 ~ byte 7) @return return the result of the calling the function @exception NET_NFC_NULL_PARAMETER parameter has illigal NULL pointer - @exception NET_NFC_ALLOC_FAIL memory allocation is failed + @exception NET_NFC_ALLOC_FAIL memory allocation is failed @exception NET_NFC_NOT_INITIALIZED Try to operate without initialization @exception NET_NFC_BUSY Device is too busy to handle your request @exception NET_NFC_OPERATION_FAIL Operation is failed because of the internal oal error @@ -199,4 +199,4 @@ net_nfc_error_e net_nfc_client_jewel_write_with_no_erase( #endif -#endif //__NET_NFC_CLIENT_TAG_JEWEL_H__ +#endif /* __NET_NFC_CLIENT_TAG_JEWEL_H__ */ diff --git a/include/net_nfc_client_test.h b/include/net_nfc_client_test.h index 418f8bd..3ec6e4a 100755 --- a/include/net_nfc_client_test.h +++ b/include/net_nfc_client_test.h @@ -94,4 +94,4 @@ net_nfc_error_e net_nfc_client_test_set_listen_tech_mask_sync(uint32_t tech); } #endif -#endif //__NET_NFC_CLIENT_TEST_H__ +#endif /* __NET_NFC_CLIENT_TEST_H__ */ diff --git a/include/net_nfc_client_transceive.h b/include/net_nfc_client_transceive.h index 95bfb75..771d7bd 100755 --- a/include/net_nfc_client_transceive.h +++ b/include/net_nfc_client_transceive.h @@ -57,4 +57,4 @@ void net_nfc_client_transceive_deinit(void); } #endif -#endif //__NET_NFC_CLIENT_TRANSCEIVE_H__ +#endif /* __NET_NFC_CLIENT_TRANSCEIVE_H__ */ diff --git a/include/net_nfc_client_util_internal.h b/include/net_nfc_client_util_internal.h index 54bc92f..e4945f2 100755 --- a/include/net_nfc_client_util_internal.h +++ b/include/net_nfc_client_util_internal.h @@ -21,8 +21,7 @@ extern "C" { #endif -typedef struct _NetNfcCallback -{ +typedef struct _NetNfcCallback { void *callback; void *user_data; } @@ -32,4 +31,4 @@ NetNfcCallback; } #endif -#endif //__NET_NFC_CLIENT_UTIL_INTERNAL_H__ +#endif /* __NET_NFC_CLIENT_UTIL_INTERNAL_H__ */ diff --git a/include/net_nfc_data.h b/include/net_nfc_data.h index 07c2a73..dbc82cf 100755 --- a/include/net_nfc_data.h +++ b/include/net_nfc_data.h @@ -30,18 +30,18 @@ extern "C" { @{ This document is for the APIs reference document - NFC Manager defines are defined in + NFC Manager defines are defined in - @li @c #net_nfc_initialize Initialize the nfc device. + @li @c #net_nfc_initialize Initialize the nfc device. */ /** create data handler only. - @param[out] data data handler + @param[out] data data handler - @return return the result of this operation + @return return the result of this operation @exception NET_NFC_NULL_PARAMETER parameter(s) has(have) illegal NULL pointer(s) @exception NET_NFC_ALLOC_FAIL memory allocation is failed @@ -52,11 +52,11 @@ net_nfc_error_e net_nfc_create_data_only(data_h *data); /** create data handler with initial values, bytes will be copied into the data handler. - @param[out] data data handler - @param[in] bytes binary data + @param[out] data data handler + @param[in] bytes binary data @param[in] length size of binary data; - @return return the result of this operation + @return return the result of this operation @exception NET_NFC_NULL_PARAMETER parameter(s) has(have) illegal NULL pointer(s) @exception NET_NFC_ALLOC_FAIL memory allocation is failed @@ -67,11 +67,11 @@ net_nfc_error_e net_nfc_create_data(data_h *data, const uint8_t *bytes, size_t l get the byes and length from data handler. data handler assume bytes may have '0x0' value. that's why this function also provides the length. - @param[in] data data handler + @param[in] data data handler @param[out] bytes binary pointer (it returns the direct pointer of handler's data) do not free this @param[out] length length of the binary data; - @return return the result of this operation + @return return the result of this operation @exception NET_NFC_NULL_PARAMETER parameter(s) has(have) illegal NULL pointer(s) */ @@ -81,11 +81,11 @@ net_nfc_error_e net_nfc_get_data(const data_h data, uint8_t **bytes, size_t *len replace the data handler with given bytes. binary data (bytes) will be copied to data hander. application should free or use local variable for given byte pointer. - @param[in] data data handler - @param[in] bytes binary data + @param[in] data data handler + @param[in] bytes binary data @param[in] length size of binary data - @return return the result of this operation + @return return the result of this operation @exception NET_NFC_NULL_PARAMETER parameter(s) has(have) illegal NULL pointer(s) */ @@ -95,11 +95,11 @@ net_nfc_error_e net_nfc_set_data(data_h data, const uint8_t *bytes, size_t lengt /** get length of data handler's bytes. - @param[in] data data handler + @param[in] data data handler - @return return the length of bytes + @return return the length of bytes - @exception 0 is returned if data is NULL + @exception 0 is returned if data is NULL */ size_t net_nfc_get_data_length(const data_h data); @@ -107,11 +107,11 @@ size_t net_nfc_get_data_length(const data_h data); /** get pointer of the handler's bytes (do not free this. it should be freed when the application call "net_nfc_free_data" function) - @param[in] data data handler + @param[in] data data handler - @return return the pointer of bytes. + @return return the pointer of bytes. - @exception NULL is returned if data is NULL + @exception NULL is returned if data is NULL */ uint8_t *net_nfc_get_data_buffer(const data_h data); @@ -119,9 +119,9 @@ uint8_t *net_nfc_get_data_buffer(const data_h data); /** free data handler. (it also free the copied bytes) - @param[in] data data handler + @param[in] data data handler - @return return the result of this operation + @return return the result of this operation @exception NET_NFC_NULL_PARAMETER parameter(s) has(have) illegal NULL pointer(s) */ @@ -136,4 +136,4 @@ net_nfc_error_e net_nfc_free_data(data_h data); } #endif -#endif //__NET_NFC_DATA_H__ +#endif /* __NET_NFC_DATA_H__ */ diff --git a/include/net_nfc_ndef_message.h b/include/net_nfc_ndef_message.h index a6b608a..ff5a2d4 100755 --- a/include/net_nfc_ndef_message.h +++ b/include/net_nfc_ndef_message.h @@ -30,9 +30,9 @@ extern "C" { @{ This document is for the APIs reference document - NFC Manager defines are defined in + NFC Manager defines are defined in - @li @c #net_nfc_initialize Initialize the nfc device. + @li @c #net_nfc_initialize Initialize the nfc device. */ @@ -44,7 +44,7 @@ extern "C" { @param[out] ndef_message instance of the ndef_message is retuened - @return return the result of the calling the function + @return return the result of the calling the function @exception NET_NFC_NULL_PARAMETER parameter(s) has(have) illigal NULL pointer(s) @exception NET_NFC_ALLOC_FAIL memory allocation is failed @@ -80,8 +80,8 @@ net_nfc_error_e net_nfc_create_ndef_message(ndef_message_h *ndef_message); \par Sync (or) Async: sync This is a Synchronous API - @param[in] ndef_message output structure to get the record - @param[out] count number of record count + @param[in] ndef_message output structure to get the record + @param[out] count number of record count @return return the result of the calling the function @@ -120,8 +120,8 @@ net_nfc_error_e net_nfc_get_ndef_message_record_count(ndef_message_h ndef_messag \par Sync (or) Async: sync This is a Synchronous API - @param[in] ndef_message output structure to get the record - @param[out] rawdata this is the raw data that will be formed into the + @param[in] ndef_message output structure to get the record + @param[out] rawdata this is the raw data that will be formed into the @return return the result of the calling the function @@ -177,7 +177,7 @@ net_nfc_error_e net_nfc_create_rawdata_from_ndef_message(ndef_message_h ndef_mes This is a Synchronous API @param[out] ndef_message ndef message handler that will be returned - @param[in] rawdata ndef message that formed in bytes array + @param[in] rawdata ndef message that formed in bytes array @return return the result of the calling the function @@ -248,7 +248,7 @@ net_nfc_error_e net_nfc_get_ndef_message_byte_length(ndef_message_h ndef_message This is a Synchronous API @param[in] ndef_message NDEF message structure - @param[in] record a record will be added into the ndef message + @param[in] record a record will be added into the ndef message @return return the result of the calling the function @@ -297,10 +297,10 @@ net_nfc_error_e net_nfc_append_record_to_ndef_message(ndef_message_h ndef_messag \par Sync (or) Async: sync This is a Synchronous API - @param[in] ndef_message the message wil be freed - @param[in] index index of record + @param[in] ndef_message the message wil be freed + @param[in] index index of record - @return return the result of the calling the function + @return return the result of the calling the function @exception NET_NFC_NULL_PARAMETER parameter(s) has(have) illigal NULL pointer(s) @exception NET_NFC_OUT_OF_BOUND index is out of bound @@ -441,4 +441,4 @@ net_nfc_error_e net_nfc_retrieve_current_ndef_message(ndef_message_h *ndef_messa } #endif -#endif //__NET_NFC_NDEF_MESSAGE_H__ +#endif /* __NET_NFC_NDEF_MESSAGE_H__ */ diff --git a/include/net_nfc_ndef_message_handover.h b/include/net_nfc_ndef_message_handover.h index 55d1705..be67ca4 100755 --- a/include/net_nfc_ndef_message_handover.h +++ b/include/net_nfc_ndef_message_handover.h @@ -25,8 +25,8 @@ extern "C" { /** This function create carrier configure handler instance. - @param[out] config instance handler - @param[in] type Carrier types. It would be BT or WPS or etc. + @param[out] config instance handler + @param[in] type Carrier types. It would be BT or WPS or etc. @return return the result of the calling the function @@ -126,7 +126,7 @@ net_nfc_error_e net_nfc_get_carrier_config_group(net_nfc_carrier_config_h config /** free the configure handle - @param[in] config instance handler + @param[in] config instance handler @return return the result of the calling the function @@ -174,7 +174,7 @@ net_nfc_error_e net_nfc_add_carrier_config_group_property(net_nfc_property_group @return return the result of the calling the function @exception NET_NFC_NULL_PARAMETER parameter(s) has(have) illegal NULL pointer(s) - @exception NET_NFC_NO_DATA_FOUND the attribute does not exist in the group + @exception NET_NFC_NO_DATA_FOUND the attribute does not exist in the group */ net_nfc_error_e net_nfc_get_carrier_config_group_property(net_nfc_property_group_h group, uint16_t attribute, uint16_t *size, uint8_t **data); @@ -187,7 +187,7 @@ net_nfc_error_e net_nfc_get_carrier_config_group_property(net_nfc_property_group @return return the result of the calling the function @exception NET_NFC_NULL_PARAMETER parameter(s) has(have) illegal NULL pointer(s) - @exception NET_NFC_NO_DATA_FOUND the attribute does not exist in the group + @exception NET_NFC_NO_DATA_FOUND the attribute does not exist in the group */ net_nfc_error_e net_nfc_remove_carrier_config_group_property(net_nfc_property_group_h group, uint16_t attribute); @@ -328,4 +328,4 @@ net_nfc_error_e net_nfc_create_handover_error_record(ndef_record_h * record, uin #endif -#endif //__NET_NFC_NDEF_MESSAGE_HANDOVER_H__ +#endif /* __NET_NFC_NDEF_MESSAGE_HANDOVER_H__ */ diff --git a/include/net_nfc_ndef_record.h b/include/net_nfc_ndef_record.h index 36957c3..2b9e6d2 100755 --- a/include/net_nfc_ndef_record.h +++ b/include/net_nfc_ndef_record.h @@ -30,7 +30,7 @@ extern "C" { @{ This document is for the APIs reference document - NFC Manager defines are defined in + NFC Manager defines are defined in */ @@ -38,8 +38,8 @@ extern "C" { /** This define gives you Message Begin from the flag byte - @param[in] flag flag that comes from "net_nfc_get_record_flags" function - @return the mb flag + @param[in] flag flag that comes from "net_nfc_get_record_flags" function + @return the mb flag @exception NONE */ @@ -47,8 +47,8 @@ uint8_t net_nfc_get_record_mb(uint8_t flag); /** This define gives you Message end from the flag byte - @param[in] flag flag that comes from "net_nfc_get_record_flags" function - @return the me flag + @param[in] flag flag that comes from "net_nfc_get_record_flags" function + @return the me flag @exception NONE */ @@ -56,8 +56,8 @@ uint8_t net_nfc_get_record_me(uint8_t flag); /** This define gives you Chun Flag that indicate that either the first record chunk or a middle record chunk of a chunked payload - @param[in] flag flag that comes from "net_nfc_get_record_flags" function - @return the chunk flag + @param[in] flag flag that comes from "net_nfc_get_record_flags" function + @return the chunk flag @exception NONE */ @@ -65,8 +65,8 @@ uint8_t net_nfc_get_record_cf(uint8_t flag); /** This define gives you ID length present flag - @param[in] flag flag that comes from "net_nfc_get_record_flags" function - @return the il (id length flag) flag + @param[in] flag flag that comes from "net_nfc_get_record_flags" function + @return the il (id length flag) flag @exception NONE @@ -76,7 +76,7 @@ uint8_t net_nfc_get_record_il(uint8_t flag); This define gives you short record flag. This flag indicates that the payload length filed is a single octet @param[in] flag flag that comes from "net_nfc_get_record_flags" function - @return the short record flag + @return the short record flag @exception NONE */ @@ -89,9 +89,9 @@ uint8_t net_nfc_get_record_sr(uint8_t flag); @param[out] record Record handler @param[in] tnf record type (TNF value) empty, well known, mime type, URI, external, or unchanged - @param[in] typeName specify type name ex) Sp, U, or Hr ... - @param[in] id record id - @param[in] payload payload of this record + @param[in] typeName specify type name ex) Sp, U, or Hr ... + @param[in] id record id + @param[in] payload payload of this record @return return the result of the calling the function @@ -185,8 +185,8 @@ net_nfc_error_e net_nfc_create_uri_type_record(ndef_record_h *record, const char this function gives you the pointer of pyaload that is contained by record. Do not free the payload. it will be freed when the record is freed - @param[in] record Record handler - @param[out] payload data_h type payload pointer (it gives you the pointer of payload; not copied) + @param[in] record Record handler + @param[out] payload data_h type payload pointer (it gives you the pointer of payload; not copied) @return return the result of the calling the function @@ -200,8 +200,8 @@ net_nfc_error_e net_nfc_get_record_payload(ndef_record_h record, data_h *payload this function gives you the pointer of record type that is contained by record. Do not free the type. it will be freed when the record is freed - @param[in] record Record handler - @param[out] type dat_h type pointer (it gives you the pointer of type; not copied) + @param[in] record Record handler + @param[out] type dat_h type pointer (it gives you the pointer of type; not copied) @return return the result of the calling the function @@ -216,8 +216,8 @@ net_nfc_error_e net_nfc_get_record_type(ndef_record_h record, data_h *type); it may return NULL pointer if the ID is not exist Do not free the type. it will be freed when the record is freed. - @param[in] record Record handler - @param[out] id dat_h type ID pointer (it gives you the pointer of payload not copied) + @param[in] record Record handler + @param[out] id dat_h type ID pointer (it gives you the pointer of payload not copied) @return return the result of the calling the function @@ -228,8 +228,8 @@ net_nfc_error_e net_nfc_get_record_id(ndef_record_h record, data_h *id); /** this function is getter of record TNF value. - @param[in] record Record handler - @param[out] tnf TNF value + @param[in] record Record handler + @param[out] tnf TNF value @return return the result of the calling the function @@ -243,8 +243,8 @@ net_nfc_error_e net_nfc_get_record_tnf(ndef_record_h record, net_nfc_record_tnf_ this function is getter of record flags. you can get the each flag value by using defines "RECORD_GET_XX" - @param[in] record Record handler - @param[out] flag flag value (it gives you the pointer of payload not copied) + @param[in] record Record handler + @param[out] flag flag value (it gives you the pointer of payload not copied) @return return the result of the calling the function @@ -275,7 +275,7 @@ net_nfc_error_e net_nfc_get_record_flags(ndef_record_h record, uint8_t *flag); /** you can set record ID with this function - @param[in] record Record handler + @param[in] record Record handler @param[in] id Record ID @return return the result of the calling the function @@ -288,7 +288,7 @@ net_nfc_error_e net_nfc_set_record_id(ndef_record_h record, data_h id); /** this function free the record handler. do not use this function after appending the ndef message - @param[in] record Record handler + @param[in] record Record handler @return return the result of the calling the function @@ -301,8 +301,8 @@ net_nfc_error_e net_nfc_free_record(ndef_record_h record); /** this function get text from text record. it allocate buffer char and store the text string. you should free this string. - @param[in] record Record handler - @param[out] buffer text string + @param[in] record Record handler + @param[out] buffer text string @return return the result of the calling the function @@ -317,8 +317,8 @@ net_nfc_error_e net_nfc_create_text_string_from_text_record(ndef_record_h record /** this function get language code from text record. (ex: US-en) - @param[in] record Record handler - @param[out] lang_code_str lang code string value followed by IANA + @param[in] record Record handler + @param[out] lang_code_str lang code string value followed by IANA @return return the result of the calling the function @@ -333,8 +333,8 @@ net_nfc_error_e net_nfc_get_languange_code_string_from_text_record(ndef_record_h /** this function get encoding type from text record (ex: UTF-8) - @param[in] record Record handler - @param[out] encoding encoding type + @param[in] record Record handler + @param[out] encoding encoding type @return return the result of the calling the function @@ -349,8 +349,8 @@ net_nfc_error_e net_nfc_get_encoding_type_from_text_record(ndef_record_h record, /** this function get URI from uri record. you should free the uri string. - @param[in] record Record handler - @param[out] uri uri text string + @param[in] record Record handler + @param[out] uri uri text string @return return the result of the calling the function @@ -366,4 +366,4 @@ net_nfc_error_e net_nfc_create_uri_string_from_uri_record(ndef_record_h record, #endif -#endif //__NET_NFC_NDEF_RECORD_H__ +#endif /* __NET_NFC_NDEF_RECORD_H__ */ diff --git a/include/net_nfc_sign_record.h b/include/net_nfc_sign_record.h index b1ab6c2..b5d1e85 100755 --- a/include/net_nfc_sign_record.h +++ b/include/net_nfc_sign_record.h @@ -30,7 +30,7 @@ extern "C" @{ This document is for the APIs reference document - NFC Manager defines are defined in + NFC Manager defines are defined in */ @@ -145,4 +145,4 @@ net_nfc_error_e net_nfc_verify_signature_ndef_message(ndef_message_h msg); #endif -#endif //__NET_NFC_SIGN_RECORD_H__ +#endif /* __NET_NFC_SIGN_RECORD_H__ */ diff --git a/include/net_nfc_tag_mifare.h b/include/net_nfc_tag_mifare.h index 6bca641..7909179 100755 --- a/include/net_nfc_tag_mifare.h +++ b/include/net_nfc_tag_mifare.h @@ -44,14 +44,14 @@ extern "C" { \par Sync (or) Async: Sync This is a Asynchronous API - @param[in] handle target handle of detected tag - @param[in] sector sector to authenticate with key A - @param[in] auth_key 6 byte key to authenticate the sector + @param[in] handle target handle of detected tag + @param[in] sector sector to authenticate with key A + @param[in] auth_key 6 byte key to authenticate the sector @return return the result of the calling the function @exception NET_NFC_NULL_PARAMETER parameter has illigal NULL pointer - @exception NET_NFC_ALLOC_FAIL memory allocation is failed + @exception NET_NFC_ALLOC_FAIL memory allocation is failed @exception NET_NFC_NOT_INITIALIZED Try to operate without initialization @exception NET_NFC_BUSY Device is too busy to handle your request @exception NET_NFC_OPERATION_FAIL Operation is failed because of the @@ -90,14 +90,14 @@ net_nfc_error_e net_nfc_client_mifare_authenticate_with_keyA( \par Sync (or) Async: Sync This is a Asynchronous API - @param[in] handle target handle of detected tag - @param[in] sector sector to authenticate with key B - @param[in] auth_key 6 byte key to authenticate the sector + @param[in] handle target handle of detected tag + @param[in] sector sector to authenticate with key B + @param[in] auth_key 6 byte key to authenticate the sector @return return the result of the calling the function @exception NET_NFC_NULL_PARAMETER parameter has illigal NULL pointer - @exception NET_NFC_ALLOC_FAIL memory allocation is failed + @exception NET_NFC_ALLOC_FAIL memory allocation is failed @exception NET_NFC_NOT_INITIALIZED Try to operate without initialization @exception NET_NFC_BUSY Device is too busy to handle your request @exception NET_NFC_OPERATION_FAIL Operation is failed because of the @@ -127,13 +127,13 @@ net_nfc_error_e net_nfc_client_mifare_authenticate_with_keyB( \par Sync (or) Async: Sync This is a Asynchronous API - @param[in] handle target handle of detected tag - @param[in] addr block or starting page number + @param[in] handle target handle of detected tag + @param[in] addr block or starting page number @return return the result of the calling the function @exception NET_NFC_NULL_PARAMETER parameter has illigal NULL pointer - @exception NET_NFC_ALLOC_FAIL memory allocation is failed + @exception NET_NFC_ALLOC_FAIL memory allocation is failed @exception NET_NFC_NOT_INITIALIZED Try to operate without initialization @exception NET_NFC_BUSY Device is too busy to handle your request @exception NET_NFC_OPERATION_FAIL Operation is failed because of the @@ -160,14 +160,14 @@ net_nfc_error_e net_nfc_client_mifare_read(net_nfc_target_handle_h handle, \par Sync (or) Async: Sync This is a Asynchronous API - @param[in] handle target handle of detected tag - @param[in] addr block or starting page number - @param[in] data data to write + @param[in] handle target handle of detected tag + @param[in] addr block or starting page number + @param[in] data data to write @return return the result of the calling the function @exception NET_NFC_NULL_PARAMETER parameter has illigal NULL pointer - @exception NET_NFC_ALLOC_FAIL memory allocation is failed + @exception NET_NFC_ALLOC_FAIL memory allocation is failed @exception NET_NFC_NOT_INITIALIZED Try to operate without initialization @exception NET_NFC_BUSY Device is too busy to handle your request @exception NET_NFC_OPERATION_FAIL Operation is failed because of the @@ -196,14 +196,14 @@ net_nfc_error_e net_nfc_client_mifare_write_block( \par Sync (or) Async: Sync This is a Asynchronous API - @param[in] handle target handle of detected tag - @param[in] addr block or starting page number - @param[in] data data to write + @param[in] handle target handle of detected tag + @param[in] addr block or starting page number + @param[in] data data to write @return return the result of the calling the function @exception NET_NFC_NULL_PARAMETER parameter has illigal NULL pointer - @exception NET_NFC_ALLOC_FAIL memory allocation is failed + @exception NET_NFC_ALLOC_FAIL memory allocation is failed @exception NET_NFC_NOT_INITIALIZED Try to operate without initialization @exception NET_NFC_BUSY Device is too busy to handle your request @exception NET_NFC_OPERATION_FAIL Operation is failed because of the @@ -233,14 +233,14 @@ net_nfc_error_e net_nfc_client_mifare_write_page( \par Sync (or) Async: Sync This is a Asynchronous API - @param[in] handle target handle of detected tag - @param[in] addr block - @param[in] value index of block to increase, starting from 0 + @param[in] handle target handle of detected tag + @param[in] addr block + @param[in] value index of block to increase, starting from 0 @return return the result of the calling the function @exception NET_NFC_NULL_PARAMETER parameter has illigal NULL pointer - @exception NET_NFC_ALLOC_FAIL memory allocation is failed + @exception NET_NFC_ALLOC_FAIL memory allocation is failed @exception NET_NFC_NOT_INITIALIZED Try to operate without initialization @exception NET_NFC_BUSY Device is too busy to handle your request @exception NET_NFC_OPERATION_FAIL Operation is failed because of the @@ -268,14 +268,14 @@ net_nfc_error_e net_nfc_client_mifare_increment(net_nfc_target_handle_h handle, \par Sync (or) Async: Sync This is a Asynchronous API - @param[in] handle target handle of detected tag - @param[in] addr block - @param[in] value index of block to decrease, starting from 0 + @param[in] handle target handle of detected tag + @param[in] addr block + @param[in] value index of block to decrease, starting from 0 @return return the result of the calling the function @exception NET_NFC_NULL_PARAMETER parameter has illigal NULL pointer - @exception NET_NFC_ALLOC_FAIL memory allocation is failed + @exception NET_NFC_ALLOC_FAIL memory allocation is failed @exception NET_NFC_NOT_INITIALIZED Try to operate without initialization @exception NET_NFC_BUSY Device is too busy to handle your request @exception NET_NFC_OPERATION_FAIL Operation is failed because of the @@ -302,14 +302,14 @@ net_nfc_error_e net_nfc_client_mifare_decrement(net_nfc_target_handle_h handle, \par Sync (or) Async: Sync This is a Asynchronous API - @param[in] handle target handle of detected tag - @param[in] addr block - @param[in] value index of block to decrease, starting from 0 + @param[in] handle target handle of detected tag + @param[in] addr block + @param[in] value index of block to decrease, starting from 0 @return return the result of the calling the function @exception NET_NFC_NULL_PARAMETER parameter has illigal NULL pointer - @exception NET_NFC_ALLOC_FAIL memory allocation is failed + @exception NET_NFC_ALLOC_FAIL memory allocation is failed @exception NET_NFC_NOT_INITIALIZED Try to operate without initialization @exception NET_NFC_BUSY Device is too busy to handle your request @exception NET_NFC_OPERATION_FAIL Operation is failed because of the @@ -335,14 +335,14 @@ net_nfc_error_e net_nfc_client_mifare_transfer(net_nfc_target_handle_h handle, \par Sync (or) Async: Sync This is a Asynchronous API - @param[in] handle target handle of detected tag - @param[in] addr block - @param[in] value index of block to decrease, starting from 0 + @param[in] handle target handle of detected tag + @param[in] addr block + @param[in] value index of block to decrease, starting from 0 @return return the result of the calling the function @exception NET_NFC_NULL_PARAMETER parameter has illigal NULL pointer - @exception NET_NFC_ALLOC_FAIL memory allocation is failed + @exception NET_NFC_ALLOC_FAIL memory allocation is failed @exception NET_NFC_NOT_INITIALIZED Try to operate without initialization @exception NET_NFC_BUSY Device is too busy to handle your request @exception NET_NFC_OPERATION_FAIL Operation is failed because of the @@ -367,7 +367,7 @@ net_nfc_error_e net_nfc_client_mifare_restore(net_nfc_target_handle_h handle, \par Sync (or) Async: Sync This is a Asynchronous API - @param[in] key the handle to create key + @param[in] key the handle to create key @return return the result of the calling the function @@ -384,7 +384,7 @@ net_nfc_error_e net_nfc_client_mifare_create_default_key(data_h* key); \par Sync (or) Async: Sync This is a Asynchronous API - @param[in] key the handle to create key + @param[in] key the handle to create key @return return the result of the calling the function @@ -402,7 +402,7 @@ net_nfc_error_e net_nfc_client_mifare_create_application_directory_key( \par Sync (or) Async: Sync This is a Asynchronous API - @param[in] key the handle to create key + @param[in] key the handle to create key @return return the result of the calling the function @@ -420,4 +420,4 @@ net_nfc_error_e net_nfc_client_mifare_create_net_nfc_forum_key(data_h* key); } #endif -#endif //__NET_NFC_TAG_MIFARE_H__ +#endif /* __NET_NFC_TAG_MIFARE_H__ */ diff --git a/include/net_nfc_target_info.h b/include/net_nfc_target_info.h index 914a040..77968ac 100755 --- a/include/net_nfc_target_info.h +++ b/include/net_nfc_target_info.h @@ -29,14 +29,14 @@ extern "C" { @{ This document is for the APIs reference document - NFC Manager defines are defined in - - These APIs help to get information of detected target. these target info handler holds - - type of target - - target ID - - ndef message supporting - - max data size (if this tag is ndef message tag) - - actual data size (if this tag is ndef message tag) + NFC Manager defines are defined in + + These APIs help to get information of detected target. these target info handler holds + - type of target + - target ID + - ndef message supporting + - max data size (if this tag is ndef message tag) + - actual data size (if this tag is ndef message tag) */ /** @@ -45,12 +45,12 @@ extern "C" { \par Sync (or) Async: Sync This is a Synchronous API - @param[in] target_info target info handler + @param[in] target_info target info handler @param[out] type tag type these type is one of the enum "net_nfc_target_type_e" defined @return return the result of calling this functions - @exception NET_NFC_NULL_PARAMETER parameter(s) has(have) illegal NULL pointer(s) + @exception NET_NFC_NULL_PARAMETER parameter(s) has(have) illegal NULL pointer(s) */ @@ -62,12 +62,12 @@ net_nfc_error_e net_nfc_get_tag_type(net_nfc_target_info_h target_info, net_nfc_ \par Sync (or) Async: Sync This is a Synchronous API - @param[in] target_info target info handler + @param[in] target_info target info handler @param[out] handle target handle that is generated by nfc-manager @return return the result of calling this functions - @exception NET_NFC_NULL_PARAMETER parameter(s) has(have) illegal NULL pointer(s) + @exception NET_NFC_NULL_PARAMETER parameter(s) has(have) illegal NULL pointer(s) */ @@ -80,12 +80,12 @@ net_nfc_error_e net_nfc_get_tag_handle(net_nfc_target_info_h target_info, net_nf \par Sync (or) Async: Sync This is a Synchronous API - @param[in] target_info target info handler + @param[in] target_info target info handler @param[out] is_support boolean value of NDEF supporting @return return the result of calling this functions - @exception NET_NFC_NULL_PARAMETER parameter(s) has(have) illegal NULL pointer(s) + @exception NET_NFC_NULL_PARAMETER parameter(s) has(have) illegal NULL pointer(s) */ @@ -97,12 +97,12 @@ net_nfc_error_e net_nfc_get_tag_ndef_support(net_nfc_target_info_h target_info, \par Sync (or) Async: Sync This is a Synchronous API - @param[in] target_info target info handler + @param[in] target_info target info handler @param[out] state ndef tag state @return return the result of calling this functions - @exception NET_NFC_NULL_PARAMETER parameter(s) has(have) illegal NULL pointer(s) + @exception NET_NFC_NULL_PARAMETER parameter(s) has(have) illegal NULL pointer(s) */ net_nfc_error_e net_nfc_get_tag_ndef_state(net_nfc_target_info_h target_info, net_nfc_ndef_card_state_e *state); @@ -113,12 +113,12 @@ net_nfc_error_e net_nfc_get_tag_ndef_state(net_nfc_target_info_h target_info, ne \par Sync (or) Async: Sync This is a Synchronous API - @param[in] target_info target info handler + @param[in] target_info target info handler @param[out] max_size max size of NDEF message that can be stored in this detected tag. @return return the result of calling this functions - @exception NET_NFC_NULL_PARAMETER parameter(s) has(have) illegal NULL pointer(s) + @exception NET_NFC_NULL_PARAMETER parameter(s) has(have) illegal NULL pointer(s) */ @@ -130,12 +130,12 @@ net_nfc_error_e net_nfc_get_tag_max_data_size(net_nfc_target_info_h target_info, \par Sync (or) Async: Sync This is a Synchronous API - @param[in] target_info target info handler + @param[in] target_info target info handler @param[out] actual_data the actual NDEF message size that stored in the tag @return return the result of calling this functions - @exception NET_NFC_NULL_PARAMETER parameter(s) has(have) illegal NULL pointer(s) + @exception NET_NFC_NULL_PARAMETER parameter(s) has(have) illegal NULL pointer(s) */ @@ -148,13 +148,13 @@ net_nfc_error_e net_nfc_get_tag_actual_data_size(net_nfc_target_info_h target_in \par Sync (or) Async: Sync This is a Synchronous API. keys will be freed by user. - @param[in] target_info target info handler - @param[out] keys pointer of double array. it will be array of string. + @param[in] target_info target info handler + @param[out] keys pointer of double array. it will be array of string. @param[out] number_of_keys length of array. - @exception NET_NFC_NULL_PARAMETER parameter(s) has(have) illegal NULL pointer(s) - @exception NET_NFC_ALLOC_FAIL memory allocation is failed - @exception NET_NFC_NO_DATA_FOUND No data is returned + @exception NET_NFC_NULL_PARAMETER parameter(s) has(have) illegal NULL pointer(s) + @exception NET_NFC_ALLOC_FAIL memory allocation is failed + @exception NET_NFC_NO_DATA_FOUND No data is returned @code void user_cb(net_nfc_message_e message, net_nfc_error_e result, void* data, void* trans_param) @@ -200,7 +200,7 @@ net_nfc_error_e net_nfc_get_tag_info_keys(net_nfc_target_info_h target_info, cha \par Sync (or) Async: Sync This is a Synchronous API - @param[in] target_info target info handler + @param[in] target_info target info handler @param[in] key key to retrieve @param[out] value value which is matched with key @@ -239,8 +239,8 @@ net_nfc_error_e net_nfc_get_tag_info_keys(net_nfc_target_info_h target_info, cha @return return the result of calling this functions - @exception NET_NFC_NULL_PARAMETER parameter(s) has(have) illegal NULL pointer(s) - @exception NET_NFC_NO_DATA_FOUND No data is returned + @exception NET_NFC_NULL_PARAMETER parameter(s) has(have) illegal NULL pointer(s) + @exception NET_NFC_NO_DATA_FOUND No data is returned */ net_nfc_error_e net_nfc_get_tag_info_value(net_nfc_target_info_h target_info, const char *key, data_h *value); @@ -254,12 +254,12 @@ net_nfc_error_e net_nfc_get_tag_info_value(net_nfc_target_info_h target_info, co \par Sync (or) Async: Sync This is a Synchronous API - @param[in] target_info target info handler + @param[in] target_info target info handler @param[out] msg ndef message @return return the result of calling this functions - @exception NET_NFC_NULL_PARAMETER parameter(s) has(have) illegal NULL pointer(s) + @exception NET_NFC_NULL_PARAMETER parameter(s) has(have) illegal NULL pointer(s) */ net_nfc_error_e net_nfc_get_tag_ndef_message(net_nfc_target_info_h target_info, ndef_message_h *msg); @@ -273,8 +273,8 @@ net_nfc_error_e net_nfc_get_tag_ndef_message(net_nfc_target_info_h target_info, \par Sync (or) Async: Sync This is a Synchronous API - @param[in] origin The original handle you want to duplicate - @param[out] result The result of this function. + @param[in] origin The original handle you want to duplicate + @param[out] result The result of this function. @code void user_cb(net_nfc_message_e message, net_nfc_error_e result, void *data, void *trans_param) @@ -300,7 +300,7 @@ net_nfc_error_e net_nfc_get_tag_ndef_message(net_nfc_target_info_h target_info, @return return the result of calling this functions - @exception NET_NFC_NULL_PARAMETER parameter(s) has(have) illegal NULL pointer(s) + @exception NET_NFC_NULL_PARAMETER parameter(s) has(have) illegal NULL pointer(s) */ net_nfc_error_e net_nfc_duplicate_target_info(net_nfc_target_info_h origin, net_nfc_target_info_h *result); @@ -314,7 +314,7 @@ net_nfc_error_e net_nfc_duplicate_target_info(net_nfc_target_info_h origin, net_ \par Sync (or) Async: Sync This is a Synchronous API - @param[in] target_info target info handle + @param[in] target_info target info handle @code net_nfc_target_info_h handle; @@ -328,7 +328,7 @@ net_nfc_error_e net_nfc_duplicate_target_info(net_nfc_target_info_h origin, net_ @return return the result of calling this functions - @exception NET_NFC_NULL_PARAMETER parameter(s) has(have) illegal NULL pointer(s) + @exception NET_NFC_NULL_PARAMETER parameter(s) has(have) illegal NULL pointer(s) */ net_nfc_error_e net_nfc_release_tag_info(net_nfc_target_info_h target_info); @@ -343,4 +343,4 @@ net_nfc_error_e net_nfc_release_tag_info(net_nfc_target_info_h target_info); #endif -#endif //__NET_NFC_TARGET_INFO_H__ +#endif /* __NET_NFC_TARGET_INFO_H__ */ diff --git a/include/nfc_internal.h b/include/nfc_internal.h index 03966c3..883acb7 100755 --- a/include/nfc_internal.h +++ b/include/nfc_internal.h @@ -119,8 +119,7 @@ typedef void (*nfc_p2p_connection_handover_completed_cb)(nfc_error_e result, nfc */ typedef void (*nfc_connection_handover_event_cb)(nfc_error_e result, nfc_handover_event_e event, nfc_ac_type_e carrier, char *address, nfc_ndef_message_h msg, void *user_data); -typedef bool (*nfc_se_registered_handler_cb)(const char *handler, int count, - void *user_data); +typedef bool (*nfc_se_registered_handler_cb)(const char *handler, int count, void *user_data); /** * @brief NFC Connection handover between NFC peer-to-peer target diff --git a/src/net_nfc_client_context.c b/src/net_nfc_client_context.c index f151390..de6afd0 100755 --- a/src/net_nfc_client_context.c +++ b/src/net_nfc_client_context.c @@ -51,19 +51,12 @@ net_nfc_error_e net_nfc_client_is_nfc_supported(int *state) { net_nfc_error_e ret; - if (state != NULL) - { + if (state != NULL) { if (vconf_get_bool(VCONFKEY_NFC_FEATURE, state) == 0) - { ret = NET_NFC_OK; - } else - { ret = NET_NFC_INVALID_STATE; - } - } - else - { + } else { ret = NET_NFC_NULL_PARAMETER; } @@ -76,19 +69,12 @@ net_nfc_error_e net_nfc_client_get_nfc_state(int *state) { net_nfc_error_e ret; - if (state != NULL) - { + if (state != NULL) { if (vconf_get_bool(VCONFKEY_NFC_STATE, state) == 0) - { ret = NET_NFC_OK; - } else - { ret = NET_NFC_INVALID_STATE; - } - } - else - { + } else { ret = NET_NFC_NULL_PARAMETER; } diff --git a/src/net_nfc_client_data.c b/src/net_nfc_client_data.c index 0e97fd4..a2109d1 100755 --- a/src/net_nfc_client_data.c +++ b/src/net_nfc_client_data.c @@ -35,9 +35,7 @@ NET_NFC_EXPORT_API net_nfc_error_e net_nfc_create_data(data_h *data, data_s *tmp_data = NULL; if (data == NULL) - { return NET_NFC_NULL_PARAMETER; - } *data = NULL; @@ -46,9 +44,7 @@ NET_NFC_EXPORT_API net_nfc_error_e net_nfc_create_data(data_h *data, return NET_NFC_ALLOC_FAIL; if (length > 0 && bytes != NULL) - { memcpy(tmp_data->buffer, bytes, length); - } *data = (data_h)tmp_data; @@ -67,9 +63,7 @@ NET_NFC_EXPORT_API net_nfc_error_e net_nfc_get_data(const data_h data, *length = 0; if (data == NULL) - { return NET_NFC_NULL_PARAMETER; - } *bytes = tmp_data->buffer; *length = tmp_data->length; @@ -83,25 +77,18 @@ NET_NFC_EXPORT_API net_nfc_error_e net_nfc_set_data(data_h data, data_s *tmp_data = (data_s *)data; if (data == NULL) - { return NET_NFC_NULL_PARAMETER; - } if (tmp_data->buffer == bytes && tmp_data->length == length) - { return NET_NFC_OK; - } net_nfc_util_clear_data(tmp_data); - if (length > 0) - { + if (length > 0) { net_nfc_util_init_data(tmp_data, length); if (bytes != NULL) - { memcpy(tmp_data->buffer, bytes, length); - } } return NET_NFC_OK; @@ -112,9 +99,7 @@ NET_NFC_EXPORT_API size_t net_nfc_get_data_length(const data_h data) data_s *tmp_data = (data_s *)data; if (data == NULL) - { return 0; - } return tmp_data->length; } @@ -124,9 +109,7 @@ NET_NFC_EXPORT_API uint8_t *net_nfc_get_data_buffer(const data_h data) data_s *tmp_data = (data_s *)data; if (data == NULL) - { return NULL; - } return tmp_data->buffer; } @@ -136,14 +119,11 @@ NET_NFC_EXPORT_API net_nfc_error_e net_nfc_free_data(data_h data) data_s *tmp_data = (data_s *)data; if (data == NULL) - { return NET_NFC_NULL_PARAMETER; - } if (tmp_data->buffer != NULL) - { _net_nfc_util_free_mem(tmp_data->buffer); - } + _net_nfc_util_free_mem(tmp_data); return NET_NFC_OK; diff --git a/src/net_nfc_client_handover.c b/src/net_nfc_client_handover.c index 7bcd49c..312b329 100755 --- a/src/net_nfc_client_handover.c +++ b/src/net_nfc_client_handover.c @@ -30,8 +30,7 @@ #define NET_NFC_EXPORT_API __attribute__((visibility("default"))) #endif -typedef struct _handover_handler_t -{ +typedef struct _handover_handler_t { net_nfc_connection_handover_event_cb handover_event_cb; gpointer handover_event_data; } @@ -100,10 +99,8 @@ static void p2p_connection_handover(GObject *source_object, g_assert(user_data != NULL); - if (handover_proxy == NULL) - { - if (net_nfc_client_handover_init() != NET_NFC_OK) - { + if (handover_proxy == NULL) { + if (net_nfc_client_handover_init() != NET_NFC_OK) { DEBUG_ERR_MSG("handover_proxy fail"); /* FIXME : return result of this error */ return; @@ -115,8 +112,7 @@ static void p2p_connection_handover(GObject *source_object, (gint *)&type, &data, res, - &error) == FALSE) - { + &error) == FALSE) { DEBUG_ERR_MSG("Can not finish" " connection handover: %s", error->message); result = NET_NFC_IPC_FAIL; @@ -124,8 +120,7 @@ static void p2p_connection_handover(GObject *source_object, g_error_free(error); } - if (func_data->callback != NULL) - { + if (func_data->callback != NULL) { net_nfc_p2p_connection_handover_completed_cb callback = (net_nfc_p2p_connection_handover_completed_cb)func_data->callback; @@ -154,9 +149,7 @@ net_nfc_error_e net_nfc_client_handover_free_alternative_carrier_data( return NET_NFC_NULL_PARAMETER; if (info->data.buffer != NULL) - { _net_nfc_util_free_mem(info->data.buffer); - } _net_nfc_util_free_mem(info); @@ -206,24 +199,20 @@ net_nfc_error_e net_nfc_client_p2p_connection_handover( net_nfc_target_handle_s *tag_handle = (net_nfc_target_handle_s *)handle; NetNfcCallback *funcdata; - if (handover_proxy == NULL) - { - if(net_nfc_client_handover_init() != NET_NFC_OK) - { + if (handover_proxy == NULL) { + if (net_nfc_client_handover_init() != NET_NFC_OK) { DEBUG_ERR_MSG("handover_proxy fail"); return NET_NFC_NOT_INITIALIZED; } - } + } /* prevent executing daemon when nfc is off */ - if (net_nfc_client_manager_is_activated() == false) { + if (net_nfc_client_manager_is_activated() == false) return NET_NFC_NOT_ACTIVATED; - } funcdata = g_try_new0(NetNfcCallback, 1); - if (funcdata == NULL) { + if (funcdata == NULL) return NET_NFC_ALLOC_FAIL; - } funcdata->callback = (gpointer)callback; funcdata->user_data = cb_data; @@ -253,19 +242,16 @@ net_nfc_error_e net_nfc_client_p2p_connection_handover_sync( NET_NFC_CONN_HANDOVER_CARRIER_UNKNOWN; GError *error = NULL; - if (handover_proxy == NULL) - { - if(net_nfc_client_handover_init() != NET_NFC_OK) - { + if (handover_proxy == NULL) { + if (net_nfc_client_handover_init() != NET_NFC_OK) { DEBUG_ERR_MSG("handover_proxy fail"); return NET_NFC_NOT_INITIALIZED; } } /* prevent executing daemon when nfc is off */ - if (net_nfc_client_manager_is_activated() == false) { + if (net_nfc_client_manager_is_activated() == false) return NET_NFC_NOT_ACTIVATED; - } if (net_nfc_gdbus_handover_call_request_sync(handover_proxy, GPOINTER_TO_UINT(tag_handle), @@ -275,15 +261,13 @@ net_nfc_error_e net_nfc_client_p2p_connection_handover_sync( &out_data, NULL, &error) == TRUE) { - if (out_carrier) { + if (out_carrier) *out_carrier = out_type; - } - if (out_ac_data) { + if (out_ac_data) *out_ac_data = net_nfc_util_gdbus_variant_to_data(out_data); - } } else { - DEBUG_ERR_MSG("handover (sync call) failed: %s",error->message); + DEBUG_ERR_MSG("handover (sync call) failed: %s", error->message); out_result = NET_NFC_IPC_FAIL; g_error_free(error); @@ -300,10 +284,8 @@ void net_nfc_client_handover_set_handover_event_cb( if (callback == NULL) return; - if (handover_proxy == NULL) - { - if (net_nfc_client_handover_init() != NET_NFC_OK) - { + if (handover_proxy == NULL) { + if (net_nfc_client_handover_init() != NET_NFC_OK) { DEBUG_ERR_MSG("handover_proxy fail"); return; } @@ -326,8 +308,7 @@ net_nfc_error_e net_nfc_client_handover_init(void) { GError *error = NULL; - if (handover_proxy) - { + if (handover_proxy) { DEBUG_CLIENT_MSG("Already initialized"); return NET_NFC_OK; @@ -340,8 +321,7 @@ net_nfc_error_e net_nfc_client_handover_init(void) "/org/tizen/NetNfcService/Handover", NULL, &error); - if (handover_proxy == NULL) - { + if (handover_proxy == NULL) { DEBUG_ERR_MSG("Can not create proxy : %s", error->message); g_error_free(error); @@ -360,8 +340,7 @@ net_nfc_error_e net_nfc_client_handover_init(void) void net_nfc_client_handover_deinit(void) { - if (handover_proxy) - { + if (handover_proxy) { g_object_unref(handover_proxy); handover_proxy = NULL; } diff --git a/src/net_nfc_client_hce.c b/src/net_nfc_client_hce.c index 770b4dc..0e8a628 100755 --- a/src/net_nfc_client_hce.c +++ b/src/net_nfc_client_hce.c @@ -35,8 +35,7 @@ typedef struct _HceHandler HceHandler; -struct _HceHandler -{ +struct _HceHandler { net_nfc_client_hce_event_cb hce_event_cb; gpointer hce_data; }; @@ -94,15 +93,12 @@ net_nfc_error_e net_nfc_client_hce_set_event_received_cb( net_nfc_error_e result = NET_NFC_OK; GError *error = NULL; - if (callback == NULL) { + if (callback == NULL) return net_nfc_client_hce_unset_event_received_cb(); - } - if (hce_proxy == NULL) - { + if (hce_proxy == NULL) { result = net_nfc_client_hce_init(); - if (result != NET_NFC_OK) - { + if (result != NET_NFC_OK) { DEBUG_ERR_MSG("net_nfc_client_hce_init failed, [%d]", result); return result; @@ -171,11 +167,9 @@ net_nfc_error_e net_nfc_client_hce_response_apdu_sync( INFO_MSG(">>> net_nfc_client_hce_response_apdu_sync!!"); - if (hce_proxy == NULL) - { + if (hce_proxy == NULL) { result = net_nfc_client_hce_init(); - if (result != NET_NFC_OK) - { + if (result != NET_NFC_OK) { DEBUG_ERR_MSG("net_nfc_client_hce_init failed, [%d]", result); return result; @@ -183,8 +177,7 @@ net_nfc_error_e net_nfc_client_hce_response_apdu_sync( } arg_data = net_nfc_util_gdbus_data_to_variant((data_s *)resp_apdu_data); - if (arg_data == NULL) - { + if (arg_data == NULL) { INFO_MSG(">>> resp_apdu_data is null !!"); return NET_NFC_INVALID_PARAM; @@ -250,8 +243,7 @@ net_nfc_error_e net_nfc_client_hce_init(void) DEBUG_CLIENT_MSG("net_nfc_client_hce_init call"); - if (hce_proxy) - { + if (hce_proxy) { DEBUG_CLIENT_MSG("Already initialized"); return NET_NFC_OK; @@ -265,8 +257,7 @@ net_nfc_error_e net_nfc_client_hce_init(void) NULL, &error); - if (hce_proxy == NULL) - { + if (hce_proxy == NULL) { DEBUG_ERR_MSG("Can not create proxy : %s", error->message); g_error_free(error); @@ -285,8 +276,7 @@ net_nfc_error_e net_nfc_client_hce_init(void) void net_nfc_client_hce_deinit(void) { - if (hce_proxy != NULL) - { + if (hce_proxy != NULL) { net_nfc_client_hce_ipc_deinit(); g_object_unref(hce_proxy); diff --git a/src/net_nfc_client_hce_ipc.c b/src/net_nfc_client_hce_ipc.c index fe1d028..37b18c6 100755 --- a/src/net_nfc_client_hce_ipc.c +++ b/src/net_nfc_client_hce_ipc.c @@ -48,8 +48,6 @@ static GIOChannel *hce_client_channel = NULL; static guint hce_client_src_id = 0; /* static function */ - -///////////////////// static void __set_non_block_socket(int socket) { int flags; @@ -57,9 +55,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 bool __receive_data_from_server(int socket, data_s *data) @@ -89,9 +86,8 @@ static bool __receive_data_from_server(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); @@ -160,9 +156,8 @@ bool net_nfc_server_hce_ipc_send_to_server(int type, 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)); if (ret == true) { @@ -174,9 +169,8 @@ bool net_nfc_server_hce_ipc_send_to_server(int type, header->type = type; header->handle = GPOINTER_TO_UINT(handle); - if (data != NULL && data->length > 0) { + if (data != NULL && data->length > 0) memcpy(header->data, data->buffer, data->length); - } ret = __send_data_to_server(hce_client_socket, &temp); @@ -249,7 +243,7 @@ static gboolean __on_io_event_cb(GIOChannel *channel, GIOCondition condition, return FALSE; } else if (G_IO_IN & condition) { - if(channel != hce_client_channel) { + if (channel != hce_client_channel) { DEBUG_CLIENT_MSG("unknown channel"); return FALSE; @@ -283,8 +277,7 @@ net_nfc_error_e net_nfc_client_hce_ipc_init() socklen_t len_saddr = 0; pthread_mutexattr_t attr; - if (net_nfc_client_hce_ipc_is_initialized() == true) - { + if (net_nfc_client_hce_ipc_is_initialized() == true) { DEBUG_CLIENT_MSG("client is already initialized"); return NET_NFC_ALREADY_INITIALIZED; @@ -299,8 +292,7 @@ net_nfc_error_e net_nfc_client_hce_ipc_init() net_nfc_client_ipc_lock(); hce_client_socket = socket(AF_UNIX, SOCK_STREAM, 0); - if (hce_client_socket == -1) - { + if (hce_client_socket == -1) { DEBUG_ERR_MSG("get socket is failed"); result = NET_NFC_IPC_FAIL; @@ -346,7 +338,7 @@ net_nfc_error_e net_nfc_client_hce_ipc_init() return NET_NFC_OK; -ERROR : +ERROR: DEBUG_ERR_MSG("error while initializing client ipc"); net_nfc_client_ipc_unlock(); @@ -358,7 +350,6 @@ ERROR : void net_nfc_client_hce_ipc_deinit() { - if (net_nfc_client_hce_ipc_is_initialized() == true) { + if (net_nfc_client_hce_ipc_is_initialized() == true) _finalize_client_socket(); - } } diff --git a/src/net_nfc_client_llcp.c b/src/net_nfc_client_llcp.c index 12d8b04..fb74dd0 100755 --- a/src/net_nfc_client_llcp.c +++ b/src/net_nfc_client_llcp.c @@ -29,8 +29,7 @@ typedef struct _LlcpFuncData LlcpFuncData; -struct _LlcpFuncData -{ +struct _LlcpFuncData { gpointer callback; gpointer user_data; }; @@ -108,8 +107,7 @@ void llcp_socket_data_append(net_nfc_llcp_internal_socket_s *socket_data) if (socket_data_list == NULL) return; - if (socket_data) - { + if (socket_data) { socket_data_list = g_list_append(socket_data_list, socket_data); } @@ -120,8 +118,7 @@ void llcp_socket_data_remove(net_nfc_llcp_internal_socket_s *socket_data) if (socket_data_list == NULL) return; - if (socket_data) - { + if (socket_data) { socket_data_list = g_list_remove(socket_data_list, socket_data); @@ -139,8 +136,7 @@ net_nfc_llcp_internal_socket_s *llcp_socket_data_find return NULL; - for (pos = g_list_first(socket_data_list); pos ; pos = pos->data) - { + for (pos = g_list_first(socket_data_list); pos ; pos = pos->data) { net_nfc_llcp_internal_socket_s *data; data = pos->data; @@ -171,8 +167,7 @@ static void llcp_call_config(GObject *source_object, NET_NFC_GDBUS_LLCP(source_object), &result, res, - &error) == FALSE) - { + &error) == FALSE) { DEBUG_ERR_MSG("Can not finish config: %s", error->message); result = NET_NFC_IPC_FAIL; @@ -180,8 +175,7 @@ static void llcp_call_config(GObject *source_object, g_error_free(error); } - if (func_data->callback != NULL) - { + if (func_data->callback != NULL) { net_nfc_client_llcp_config_completed callback = (net_nfc_client_llcp_config_completed)func_data->callback; @@ -209,8 +203,7 @@ static void llcp_call_listen(GObject *source_object, &result, &out_client_socket, res, - &error) == FALSE) - { + &error) == FALSE) { DEBUG_ERR_MSG("Can not finish listen: %s", error->message); result = NET_NFC_IPC_FAIL; @@ -219,16 +212,14 @@ static void llcp_call_listen(GObject *source_object, } socket_data = llcp_socket_data_find(out_client_socket); - if (socket_data == NULL) - { + if (socket_data == NULL) { DEBUG_ERR_MSG("Wrong client socket is returned"); return; } socket_data->oal_socket = out_oal_socket; - if (func_data->callback != NULL) - { + if (func_data->callback != NULL) { net_nfc_client_llcp_listen_completed callback = (net_nfc_client_llcp_listen_completed)func_data->callback; @@ -236,7 +227,7 @@ static void llcp_call_listen(GObject *source_object, } /* TODO : release resource when socket is closed */ -// g_free(func_data); + /* g_free(func_data); */ } static void llcp_call_accept(GObject *source_object, @@ -253,8 +244,7 @@ static void llcp_call_accept(GObject *source_object, NET_NFC_GDBUS_LLCP(source_object), &result, res, - &error) == FALSE) - { + &error) == FALSE) { DEBUG_ERR_MSG("Can not finish accept: %s", error->message); result = NET_NFC_IPC_FAIL; @@ -262,8 +252,7 @@ static void llcp_call_accept(GObject *source_object, g_error_free(error); } - if (func_data->callback != NULL) - { + if (func_data->callback != NULL) { net_nfc_client_llcp_accept_completed callback = (net_nfc_client_llcp_accept_completed)func_data->callback; @@ -287,8 +276,7 @@ static void llcp_call_reject(GObject *source_object, NET_NFC_GDBUS_LLCP(source_object), &result, res, - &error) == FALSE) - { + &error) == FALSE) { DEBUG_ERR_MSG("Can not finish reject: %s", error->message); result = NET_NFC_IPC_FAIL; @@ -296,8 +284,7 @@ static void llcp_call_reject(GObject *source_object, g_error_free(error); } - if (func_data->callback != NULL) - { + if (func_data->callback != NULL) { net_nfc_client_llcp_reject_completed callback = (net_nfc_client_llcp_reject_completed)func_data->callback; @@ -325,8 +312,7 @@ static void llcp_call_connect(GObject *source_object, &result, &out_client_socket, res, - &error) == FALSE) - { + &error) == FALSE) { DEBUG_ERR_MSG("Can not finish connect: %s", error->message); result = NET_NFC_IPC_FAIL; @@ -334,16 +320,14 @@ static void llcp_call_connect(GObject *source_object, } socket_data = llcp_socket_data_find(out_client_socket); - if (socket_data == NULL) - { + if (socket_data == NULL) { DEBUG_ERR_MSG("Wrong client socket is returned"); return; } socket_data->oal_socket = out_oal_socket; - if (func_data->callback != NULL) - { + if (func_data->callback != NULL) { net_nfc_client_llcp_connect_completed callback = (net_nfc_client_llcp_connect_completed)func_data->callback; @@ -351,7 +335,7 @@ static void llcp_call_connect(GObject *source_object, } /* TODO : release resource when socket is closed */ -// g_free(func_data); + /* g_free(func_data); */ } static void llcp_call_connect_sap(GObject *source_object, @@ -372,8 +356,7 @@ static void llcp_call_connect_sap(GObject *source_object, &result, &out_client_socket, res, - &error) == FALSE) - { + &error) == FALSE) { DEBUG_ERR_MSG("Can not finish connect sap: %s", error->message); result = NET_NFC_IPC_FAIL; @@ -381,16 +364,14 @@ static void llcp_call_connect_sap(GObject *source_object, } socket_data = llcp_socket_data_find(out_client_socket); - if (socket_data == NULL) - { + if (socket_data == NULL) { DEBUG_ERR_MSG("Wrong client socket is returned"); return; } socket_data->oal_socket = out_oal_socket; - if (func_data->callback != NULL) - { + if (func_data->callback != NULL) { net_nfc_client_llcp_connect_sap_completed callback = (net_nfc_client_llcp_connect_sap_completed)func_data->callback; @@ -398,7 +379,7 @@ static void llcp_call_connect_sap(GObject *source_object, } /* TODO : release resource when socket is closed */ -// g_free(func_data); + /* g_free(func_data); */ } static void llcp_call_send(GObject *source_object, @@ -417,8 +398,7 @@ static void llcp_call_send(GObject *source_object, &result, &out_client_socket, res, - &error) == FALSE) - { + &error) == FALSE) { DEBUG_ERR_MSG("Can not finish send: %s", error->message); result = NET_NFC_IPC_FAIL; @@ -426,8 +406,7 @@ static void llcp_call_send(GObject *source_object, g_error_free(error); } - if (func_data->callback != NULL) - { + if (func_data->callback != NULL) { net_nfc_client_llcp_send_completed callback = (net_nfc_client_llcp_send_completed)func_data->callback; @@ -453,16 +432,14 @@ static void llcp_call_send_to(GObject *source_object, &result, &out_client_socket, res, - &error) == FALSE) - { + &error) == FALSE) { DEBUG_ERR_MSG("Can not finish send to: %s", error->message); result = NET_NFC_IPC_FAIL; g_error_free(error); } - if (func_data->callback != NULL) - { + if (func_data->callback != NULL) { net_nfc_client_llcp_send_to_completed callback = (net_nfc_client_llcp_send_to_completed)func_data->callback; @@ -488,16 +465,14 @@ static void llcp_call_receive(GObject *source_object, &result, &variant, res, - &error) == FALSE) - { + &error) == FALSE) { DEBUG_ERR_MSG("Can not finish receive: %s", error->message); result = NET_NFC_IPC_FAIL; g_error_free(error); } - if (func_data->callback != NULL) - { + if (func_data->callback != NULL) { net_nfc_client_llcp_receive_completed callback = (net_nfc_client_llcp_receive_completed)func_data->callback; data_s data = { NULL, 0 }; @@ -530,8 +505,7 @@ static void llcp_call_receive_from(GObject *source_object, &sap, &variant, res, - &error) == FALSE) - { + &error) == FALSE) { DEBUG_ERR_MSG("Can not finish receive from: %s", error->message); result = NET_NFC_IPC_FAIL; @@ -539,8 +513,7 @@ static void llcp_call_receive_from(GObject *source_object, g_error_free(error); } - if (func_data->callback != NULL) - { + if (func_data->callback != NULL) { net_nfc_client_llcp_receive_from_completed callback = (net_nfc_client_llcp_receive_from_completed)func_data->callback; data_s data = { NULL, 0 }; @@ -573,8 +546,7 @@ static void llcp_call_close(GObject *source_object, &result, &out_client_socket, res, - &error) == FALSE) - { + &error) == FALSE) { DEBUG_ERR_MSG("Can not finish close: %s", error->message); result = NET_NFC_IPC_FAIL; @@ -582,14 +554,12 @@ static void llcp_call_close(GObject *source_object, } socket_data = llcp_socket_data_find(out_client_socket); - if (socket_data == NULL) - { + if (socket_data == NULL) { DEBUG_ERR_MSG("Wrong client socket is returned"); return; } - if (func_data->callback != NULL) - { + if (func_data->callback != NULL) { net_nfc_client_llcp_close_completed callback = (net_nfc_client_llcp_close_completed)func_data->callback; @@ -617,8 +587,7 @@ static void llcp_call_disconnect(GObject *source_object, &result, &out_client_socket, res, - &error) == FALSE) - { + &error) == FALSE) { DEBUG_ERR_MSG("Can not finish disconnect: %s", error->message); result = NET_NFC_IPC_FAIL; @@ -626,8 +595,7 @@ static void llcp_call_disconnect(GObject *source_object, } socket_data = llcp_socket_data_find(out_client_socket); - if (socket_data == NULL) - { + if (socket_data == NULL) { DEBUG_ERR_MSG("Wrong client socket is returned"); return; } @@ -669,23 +637,19 @@ net_nfc_error_e net_nfc_client_llcp_config(net_nfc_llcp_config_info_h config, LlcpFuncData *func_data; GVariant *variant; - if (config == NULL) { + if (config == NULL) return NET_NFC_NULL_PARAMETER; - } - if (llcp_proxy == NULL) - { - if(net_nfc_client_llcp_init() != NET_NFC_OK) - { + if (llcp_proxy == NULL) { + if (net_nfc_client_llcp_init() != NET_NFC_OK) { DEBUG_ERR_MSG("llcp_proxy fail"); return NET_NFC_NOT_INITIALIZED; } } /* prevent executing daemon when nfc is off */ - if (net_nfc_client_manager_is_activated() == false) { + if (net_nfc_client_manager_is_activated() == false) return NET_NFC_NOT_ACTIVATED; - } func_data = g_new0(LlcpFuncData, 1); if (func_data == NULL) { @@ -722,19 +686,16 @@ net_nfc_error_e net_nfc_client_llcp_config_sync GVariant *variant = NULL; GError *error = NULL; - if (llcp_proxy == NULL) - { - if(net_nfc_client_llcp_init() != NET_NFC_OK) - { + if (llcp_proxy == NULL) { + if (net_nfc_client_llcp_init() != NET_NFC_OK) { DEBUG_ERR_MSG("llcp_proxy fail"); return NET_NFC_NOT_INITIALIZED; } } /* prevent executing daemon when nfc is off */ - if (net_nfc_client_manager_is_activated() == false) { + if (net_nfc_client_manager_is_activated() == false) return NET_NFC_NOT_ACTIVATED; - } memcpy(&llcp_config, config, sizeof(net_nfc_llcp_config_info_s)); @@ -748,8 +709,7 @@ net_nfc_error_e net_nfc_client_llcp_config_sync variant, &result, NULL, - &error) == FALSE) - { + &error) == FALSE) { DEBUG_ERR_MSG("can not config: %s", error->message); result = NET_NFC_IPC_FAIL; @@ -781,18 +741,15 @@ net_nfc_error_e net_nfc_client_llcp_listen(net_nfc_llcp_socket_t socket, LlcpFuncData *func_data; net_nfc_llcp_internal_socket_s *socket_data = NULL; - if (llcp_proxy == NULL) - { - if(net_nfc_client_llcp_init() != NET_NFC_OK) - { + if (llcp_proxy == NULL) { + if (net_nfc_client_llcp_init() != NET_NFC_OK) { DEBUG_ERR_MSG("llcp_proxy fail"); return NET_NFC_NOT_INITIALIZED; } } socket_data = llcp_socket_data_find(socket); - if (socket_data == NULL) - { + if (socket_data == NULL) { DEBUG_ERR_MSG("can not get socket_data"); return NET_NFC_LLCP_INVALID_SOCKET; } @@ -802,9 +759,8 @@ net_nfc_error_e net_nfc_client_llcp_listen(net_nfc_llcp_socket_t socket, socket_data->sap = sap; /* prevent executing daemon when nfc is off */ - if (net_nfc_client_manager_is_activated() == false) { + if (net_nfc_client_manager_is_activated() == false) return NET_NFC_NOT_ACTIVATED; - } func_data = g_new0(LlcpFuncData, 1); if (func_data == NULL) { @@ -844,28 +800,23 @@ net_nfc_error_e net_nfc_client_llcp_listen_sync(net_nfc_llcp_socket_t socket, net_nfc_llcp_internal_socket_s *socket_data = NULL; net_nfc_llcp_internal_socket_s *out_socket_data = NULL; - if (out_socket == NULL) { + if (out_socket == NULL) return NET_NFC_NULL_PARAMETER; - } - if (llcp_proxy == NULL) - { - if(net_nfc_client_llcp_init() != NET_NFC_OK) - { + if (llcp_proxy == NULL) { + if (net_nfc_client_llcp_init() != NET_NFC_OK) { DEBUG_ERR_MSG("llcp_proxy fail"); return NET_NFC_NOT_INITIALIZED; } } - if (service_name == NULL) - { + if (service_name == NULL) { DEBUG_ERR_MSG("service_name is empty"); return NET_NFC_UNKNOWN_ERROR; } socket_data = llcp_socket_data_find(socket); - if (socket_data == NULL) - { + if (socket_data == NULL) { DEBUG_ERR_MSG("can not get socket_data"); return NET_NFC_LLCP_INVALID_SOCKET; } @@ -875,9 +826,8 @@ net_nfc_error_e net_nfc_client_llcp_listen_sync(net_nfc_llcp_socket_t socket, socket_data->sap = sap; /* prevent executing daemon when nfc is off */ - if (net_nfc_client_manager_is_activated() == false) { + if (net_nfc_client_manager_is_activated() == false) return NET_NFC_NOT_ACTIVATED; - } if (net_nfc_gdbus_llcp_call_listen_sync(llcp_proxy, GPOINTER_TO_UINT(llcp_handle), @@ -892,13 +842,12 @@ net_nfc_error_e net_nfc_client_llcp_listen_sync(net_nfc_llcp_socket_t socket, NULL, &error) == true) { out_socket_data = llcp_socket_data_find(out_client_socket); - if (out_socket_data == NULL || out_socket_data != socket_data) - { + if (out_socket_data == NULL || out_socket_data != socket_data) { DEBUG_ERR_MSG("Wrong client socket is returned"); return NET_NFC_UNKNOWN_ERROR; } -// out_socket_data->oal_socket = out_oal_socket; + /* out_socket_data->oal_socket = out_oal_socket; */ if (out_socket) *out_socket = out_client_socket; @@ -919,19 +868,16 @@ net_nfc_error_e net_nfc_client_llcp_accept(net_nfc_llcp_socket_t socket, { LlcpFuncData *func_data; - if (llcp_proxy == NULL) - { - if(net_nfc_client_llcp_init() != NET_NFC_OK) - { + if (llcp_proxy == NULL) { + if (net_nfc_client_llcp_init() != NET_NFC_OK) { DEBUG_ERR_MSG("llcp_proxy fail"); return NET_NFC_NOT_INITIALIZED; } } /* prevent executing daemon when nfc is off */ - if (net_nfc_client_manager_is_activated() == false) { + if (net_nfc_client_manager_is_activated() == false) return NET_NFC_NOT_ACTIVATED; - } func_data = g_new0(LlcpFuncData, 1); if (func_data == NULL) { @@ -959,19 +905,16 @@ net_nfc_error_e net_nfc_client_llcp_accept_sync(net_nfc_llcp_socket_t socket) net_nfc_error_e result; GError *error = NULL; - if (llcp_proxy == NULL) - { - if(net_nfc_client_llcp_init() != NET_NFC_OK) - { + if (llcp_proxy == NULL) { + if (net_nfc_client_llcp_init() != NET_NFC_OK) { DEBUG_ERR_MSG("llcp_proxy fail"); return NET_NFC_NOT_INITIALIZED; } } /* prevent executing daemon when nfc is off */ - if (net_nfc_client_manager_is_activated() == false) { + if (net_nfc_client_manager_is_activated() == false) return NET_NFC_NOT_ACTIVATED; - } if (net_nfc_gdbus_llcp_call_accept_sync(llcp_proxy, GPOINTER_TO_UINT(llcp_handle), @@ -995,19 +938,16 @@ net_nfc_error_e net_nfc_client_llcp_reject(net_nfc_llcp_socket_t socket, { LlcpFuncData *func_data; - if (llcp_proxy == NULL) - { - if(net_nfc_client_llcp_init() != NET_NFC_OK) - { + if (llcp_proxy == NULL) { + if (net_nfc_client_llcp_init() != NET_NFC_OK) { DEBUG_ERR_MSG("llcp_proxy fail"); return NET_NFC_NOT_INITIALIZED; } } /* prevent executing daemon when nfc is off */ - if (net_nfc_client_manager_is_activated() == false) { + if (net_nfc_client_manager_is_activated() == false) return NET_NFC_NOT_ACTIVATED; - } func_data = g_new0(LlcpFuncData, 1); if (func_data == NULL) { @@ -1035,19 +975,16 @@ net_nfc_error_e net_nfc_client_llcp_reject_sync(net_nfc_llcp_socket_t socket) net_nfc_error_e result; GError *error = NULL; - if (llcp_proxy == NULL) - { - if(net_nfc_client_llcp_init() != NET_NFC_OK) - { + if (llcp_proxy == NULL) { + if (net_nfc_client_llcp_init() != NET_NFC_OK) { DEBUG_ERR_MSG("llcp_proxy fail"); return NET_NFC_NOT_INITIALIZED; } } /* prevent executing daemon when nfc is off */ - if (net_nfc_client_manager_is_activated() == false) { + if (net_nfc_client_manager_is_activated() == false) return NET_NFC_NOT_ACTIVATED; - } if (net_nfc_gdbus_llcp_call_reject_sync(llcp_proxy, GPOINTER_TO_UINT(llcp_handle), @@ -1073,30 +1010,25 @@ net_nfc_error_e net_nfc_client_llcp_connect(net_nfc_llcp_socket_t socket, LlcpFuncData *func_data; net_nfc_llcp_internal_socket_s *socket_data = NULL; - if (service_name == NULL) { + if (service_name == NULL) return NET_NFC_NULL_PARAMETER; - } - if (llcp_proxy == NULL) - { - if(net_nfc_client_llcp_init() != NET_NFC_OK) - { + if (llcp_proxy == NULL) { + if (net_nfc_client_llcp_init() != NET_NFC_OK) { DEBUG_ERR_MSG("llcp_proxy fail"); return NET_NFC_NOT_INITIALIZED; } } socket_data = llcp_socket_data_find(socket); - if (socket_data == NULL) - { + if (socket_data == NULL) { DEBUG_ERR_MSG("can not get socket_data"); return NET_NFC_LLCP_INVALID_SOCKET; } /* prevent executing daemon when nfc is off */ - if (net_nfc_client_manager_is_activated() == false) { + if (net_nfc_client_manager_is_activated() == false) return NET_NFC_NOT_ACTIVATED; - } func_data = g_new0(LlcpFuncData, 1); if (func_data == NULL) { @@ -1134,30 +1066,25 @@ net_nfc_error_e net_nfc_client_llcp_connect_sync(net_nfc_llcp_socket_t socket, net_nfc_llcp_internal_socket_s *socket_data = NULL; net_nfc_llcp_internal_socket_s *out_socket_data = NULL; - if (service_name == NULL || out_socket == NULL) { + if (service_name == NULL || out_socket == NULL) return NET_NFC_NULL_PARAMETER; - } - if (llcp_proxy == NULL) - { - if(net_nfc_client_llcp_init() != NET_NFC_OK) - { + if (llcp_proxy == NULL) { + if (net_nfc_client_llcp_init() != NET_NFC_OK) { DEBUG_ERR_MSG("llcp_proxy fail"); return NET_NFC_NOT_INITIALIZED; } } socket_data = llcp_socket_data_find(socket); - if (socket_data == NULL) - { + if (socket_data == NULL) { DEBUG_ERR_MSG("can not get socket_data"); return NET_NFC_LLCP_INVALID_SOCKET; } /* prevent executing daemon when nfc is off */ - if (net_nfc_client_manager_is_activated() == false) { + if (net_nfc_client_manager_is_activated() == false) return NET_NFC_NOT_ACTIVATED; - } if (net_nfc_gdbus_llcp_call_connect_sync(llcp_proxy, GPOINTER_TO_UINT(llcp_handle), @@ -1171,13 +1098,12 @@ net_nfc_error_e net_nfc_client_llcp_connect_sync(net_nfc_llcp_socket_t socket, NULL, &error) == true) { out_socket_data = llcp_socket_data_find(out_client_socket); - if (out_socket_data == NULL || out_socket_data != socket_data) - { + if (out_socket_data == NULL || out_socket_data != socket_data) { DEBUG_ERR_MSG("Wrong client socket is returned"); return NET_NFC_UNKNOWN_ERROR; } -// out_socket_data->oal_socket = out_oal_socket; + /*out_socket_data->oal_socket = out_oal_socket;*/ if (out_socket) *out_socket = out_client_socket; @@ -1200,30 +1126,25 @@ net_nfc_error_e net_nfc_client_llcp_connect_sap(net_nfc_llcp_socket_t socket, LlcpFuncData *func_data; net_nfc_llcp_internal_socket_s *socket_data = NULL; - if (sap == 0) { + if (sap == 0) return NET_NFC_INVALID_PARAM; - } - if (llcp_proxy == NULL) - { - if(net_nfc_client_llcp_init() != NET_NFC_OK) - { + if (llcp_proxy == NULL) { + if (net_nfc_client_llcp_init() != NET_NFC_OK) { DEBUG_ERR_MSG("llcp_proxy fail"); return NET_NFC_NOT_INITIALIZED; } } socket_data = llcp_socket_data_find(socket); - if (socket_data == NULL) - { + if (socket_data == NULL) { DEBUG_ERR_MSG("can not get socket_data"); return NET_NFC_LLCP_INVALID_SOCKET; } /* prevent executing daemon when nfc is off */ - if (net_nfc_client_manager_is_activated() == false) { + if (net_nfc_client_manager_is_activated() == false) return NET_NFC_NOT_ACTIVATED; - } func_data = g_new0(LlcpFuncData, 1); if (func_data == NULL) { @@ -1262,34 +1183,28 @@ net_nfc_error_e net_nfc_client_llcp_connect_sap_sync( net_nfc_llcp_internal_socket_s *socket_data = NULL; net_nfc_llcp_internal_socket_s *out_socket_data = NULL; - if (out_socket == NULL) { + if (out_socket == NULL) return NET_NFC_NULL_PARAMETER; - } - if (sap == 0) { + if (sap == 0) return NET_NFC_INVALID_PARAM; - } - if (llcp_proxy == NULL) - { - if(net_nfc_client_llcp_init() != NET_NFC_OK) - { + if (llcp_proxy == NULL) { + if (net_nfc_client_llcp_init() != NET_NFC_OK) { DEBUG_ERR_MSG("llcp_proxy fail"); return NET_NFC_NOT_INITIALIZED; } } socket_data = llcp_socket_data_find(socket); - if (socket_data == NULL) - { + if (socket_data == NULL) { DEBUG_ERR_MSG("can not get socket_data"); return NET_NFC_LLCP_INVALID_SOCKET; } /* prevent executing daemon when nfc is off */ - if (net_nfc_client_manager_is_activated() == false) { + if (net_nfc_client_manager_is_activated() == false) return NET_NFC_NOT_ACTIVATED; - } if (net_nfc_gdbus_llcp_call_connect_sap_sync(llcp_proxy, GPOINTER_TO_UINT(llcp_handle), @@ -1303,13 +1218,12 @@ net_nfc_error_e net_nfc_client_llcp_connect_sap_sync( NULL, &error) == true) { out_socket_data = llcp_socket_data_find(out_client_socket); - if (out_socket_data == NULL || out_socket_data != socket_data) - { + if (out_socket_data == NULL || out_socket_data != socket_data) { DEBUG_ERR_MSG("Wrong client socket is returned"); return NET_NFC_UNKNOWN_ERROR; } -// out_socket_data->oal_socket = out_oal_socket; + /* out_socket_data->oal_socket = out_oal_socket; */ if (out_socket) *out_socket = out_client_socket; @@ -1333,31 +1247,25 @@ net_nfc_error_e net_nfc_client_llcp_send(net_nfc_llcp_socket_t socket, GVariant *variant; net_nfc_llcp_internal_socket_s *socket_data = NULL; - if (data == NULL) { + if (data == NULL) return NET_NFC_NULL_PARAMETER; - } - if (socket <= 0) { + if (socket <= 0) return NET_NFC_INVALID_PARAM; - } - if (llcp_proxy == NULL) - { - if(net_nfc_client_llcp_init() != NET_NFC_OK) - { + if (llcp_proxy == NULL) { + if (net_nfc_client_llcp_init() != NET_NFC_OK) { DEBUG_ERR_MSG("llcp_proxy fail"); return NET_NFC_NOT_INITIALIZED; } } /* prevent executing daemon when nfc is off */ - if (net_nfc_client_manager_is_activated() == false) { + if (net_nfc_client_manager_is_activated() == false) return NET_NFC_NOT_ACTIVATED; - } socket_data = llcp_socket_data_find(socket); - if (socket_data == NULL) - { + if (socket_data == NULL) { DEBUG_ERR_MSG("can not get socket_data"); return NET_NFC_LLCP_INVALID_SOCKET; } @@ -1397,34 +1305,28 @@ net_nfc_error_e net_nfc_client_llcp_send_sync(net_nfc_llcp_socket_t socket, net_nfc_llcp_internal_socket_s *socket_data; net_nfc_llcp_internal_socket_s *out_socket_data; - if (data == NULL) { + if (data == NULL) return NET_NFC_NULL_PARAMETER; - } - if (socket <= 0) { + if (socket <= 0) return NET_NFC_INVALID_PARAM; - } - if (llcp_proxy == NULL) - { - if(net_nfc_client_llcp_init() != NET_NFC_OK) - { + if (llcp_proxy == NULL) { + if (net_nfc_client_llcp_init() != NET_NFC_OK) { DEBUG_ERR_MSG("llcp_proxy fail"); return NET_NFC_NOT_INITIALIZED; } } socket_data = llcp_socket_data_find(socket); - if (socket_data == NULL) - { + if (socket_data == NULL) { DEBUG_ERR_MSG("can not get socket_data"); return NET_NFC_LLCP_INVALID_SOCKET; } /* prevent executing daemon when nfc is off */ - if (net_nfc_client_manager_is_activated() == false) { + if (net_nfc_client_manager_is_activated() == false) return NET_NFC_NOT_ACTIVATED; - } variant = net_nfc_util_gdbus_data_to_variant(data); @@ -1437,8 +1339,7 @@ net_nfc_error_e net_nfc_client_llcp_send_sync(net_nfc_llcp_socket_t socket, NULL, &error) == true) { out_socket_data = llcp_socket_data_find(out_client_socket); - if (out_socket_data == NULL) - { + if (out_socket_data == NULL) { DEBUG_ERR_MSG("can not find socket_data"); return NET_NFC_UNKNOWN_ERROR; } @@ -1464,34 +1365,28 @@ net_nfc_error_e net_nfc_client_llcp_send_to(net_nfc_llcp_socket_t socket, GVariant *variant; net_nfc_llcp_internal_socket_s *socket_data = NULL; - if (data == NULL) { + if (data == NULL) return NET_NFC_NULL_PARAMETER; - } - if (socket <= 0 || sap == 0) { + if (socket <= 0 || sap == 0) return NET_NFC_INVALID_PARAM; - } - if (llcp_proxy == NULL) - { - if(net_nfc_client_llcp_init() != NET_NFC_OK) - { + if (llcp_proxy == NULL) { + if (net_nfc_client_llcp_init() != NET_NFC_OK) { DEBUG_ERR_MSG("llcp_proxy fail"); return NET_NFC_NOT_INITIALIZED; } } socket_data = llcp_socket_data_find(socket); - if (socket_data == NULL) - { + if (socket_data == NULL) { DEBUG_ERR_MSG("can not get socket_data"); return NET_NFC_LLCP_INVALID_SOCKET; } /* prevent executing daemon when nfc is off */ - if (net_nfc_client_manager_is_activated() == false) { + if (net_nfc_client_manager_is_activated() == false) return NET_NFC_NOT_ACTIVATED; - } func_data = g_new0(LlcpFuncData, 1); if (func_data == NULL) { @@ -1530,34 +1425,28 @@ net_nfc_error_e net_nfc_client_llcp_send_to_sync(net_nfc_llcp_socket_t socket, net_nfc_llcp_internal_socket_s *socket_data; net_nfc_llcp_internal_socket_s *out_socket_data; - if (data == NULL) { + if (data == NULL) return NET_NFC_NULL_PARAMETER; - } - if (socket <= 0 || sap == 0) { + if (socket <= 0 || sap == 0) return NET_NFC_INVALID_PARAM; - } - if (llcp_proxy == NULL) - { - if(net_nfc_client_llcp_init() != NET_NFC_OK) - { + if (llcp_proxy == NULL) { + if (net_nfc_client_llcp_init() != NET_NFC_OK) { DEBUG_ERR_MSG("llcp_proxy fail"); return NET_NFC_NOT_INITIALIZED; } } socket_data = llcp_socket_data_find(socket); - if (socket_data == NULL) - { + if (socket_data == NULL) { DEBUG_ERR_MSG("can not get socket_data"); return NET_NFC_LLCP_INVALID_SOCKET; } /* prevent executing daemon when nfc is off */ - if (net_nfc_client_manager_is_activated() == false) { + if (net_nfc_client_manager_is_activated() == false) return NET_NFC_NOT_ACTIVATED; - } variant = net_nfc_util_gdbus_data_to_variant(data); @@ -1571,8 +1460,7 @@ net_nfc_error_e net_nfc_client_llcp_send_to_sync(net_nfc_llcp_socket_t socket, NULL, &error) == true) { out_socket_data = llcp_socket_data_find(out_client_socket); - if (out_socket_data == NULL) - { + if (out_socket_data == NULL) { DEBUG_ERR_MSG("can not find socket_data"); return NET_NFC_UNKNOWN_ERROR; } @@ -1595,30 +1483,25 @@ net_nfc_error_e net_nfc_client_llcp_receive(net_nfc_llcp_socket_t socket, LlcpFuncData *func_data; net_nfc_llcp_internal_socket_s *socket_data = NULL; - if (socket <= 0 || request_length == 0) { + if (socket <= 0 || request_length == 0) return NET_NFC_INVALID_PARAM; - } - if (llcp_proxy == NULL) - { - if(net_nfc_client_llcp_init() != NET_NFC_OK) - { + if (llcp_proxy == NULL) { + if (net_nfc_client_llcp_init() != NET_NFC_OK) { DEBUG_ERR_MSG("llcp_proxy fail"); return NET_NFC_NOT_INITIALIZED; } } socket_data = llcp_socket_data_find(socket); - if (socket_data == NULL) - { + if (socket_data == NULL) { DEBUG_ERR_MSG("can not get socket_data"); return NET_NFC_LLCP_INVALID_SOCKET; } /* prevent executing daemon when nfc is off */ - if (net_nfc_client_manager_is_activated() == false) { + if (net_nfc_client_manager_is_activated() == false) return NET_NFC_NOT_ACTIVATED; - } func_data = g_new0(LlcpFuncData, 1); if (func_data == NULL) { @@ -1651,36 +1534,30 @@ net_nfc_error_e net_nfc_client_llcp_receive_sync(net_nfc_llcp_socket_t socket, GError *error = NULL; net_nfc_llcp_internal_socket_s *socket_data; - if (out_data == NULL) { + if (out_data == NULL) return NET_NFC_NULL_PARAMETER; - } *out_data = NULL; - if (socket <= 0 || request_length == 0) { + if (socket <= 0 || request_length == 0) return NET_NFC_INVALID_PARAM; - } - if (llcp_proxy == NULL) - { - if(net_nfc_client_llcp_init() != NET_NFC_OK) - { + if (llcp_proxy == NULL) { + if (net_nfc_client_llcp_init() != NET_NFC_OK) { DEBUG_ERR_MSG("llcp_proxy fail"); return NET_NFC_NOT_INITIALIZED; } } socket_data = llcp_socket_data_find(socket); - if (socket_data == NULL) - { + if (socket_data == NULL) { DEBUG_ERR_MSG("can not get socket_data"); return NET_NFC_LLCP_INVALID_SOCKET; } /* prevent executing daemon when nfc is off */ - if (net_nfc_client_manager_is_activated() == false) { + if (net_nfc_client_manager_is_activated() == false) return NET_NFC_NOT_ACTIVATED; - } if (net_nfc_gdbus_llcp_call_receive_sync(llcp_proxy, GPOINTER_TO_UINT(llcp_handle), @@ -1710,22 +1587,18 @@ net_nfc_error_e net_nfc_client_llcp_receive_from(net_nfc_llcp_socket_t socket, LlcpFuncData *func_data; net_nfc_llcp_internal_socket_s *socket_data = NULL; - if (socket <= 0 || request_length == 0) { + if (socket <= 0 || request_length == 0) return NET_NFC_INVALID_PARAM; - } - if (llcp_proxy == NULL) - { - if(net_nfc_client_llcp_init() != NET_NFC_OK) - { + if (llcp_proxy == NULL) { + if (net_nfc_client_llcp_init() != NET_NFC_OK) { DEBUG_ERR_MSG("llcp_proxy fail"); return NET_NFC_NOT_INITIALIZED; } } socket_data = llcp_socket_data_find(socket); - if (socket_data == NULL) - { + if (socket_data == NULL) { DEBUG_ERR_MSG("can not get socket_data"); return NET_NFC_LLCP_INVALID_SOCKET; } @@ -1765,37 +1638,31 @@ net_nfc_error_e net_nfc_client_llcp_receive_from_sync( net_nfc_llcp_internal_socket_s *socket_data; - if (out_sap == NULL || out_data == NULL) { + if (out_sap == NULL || out_data == NULL) return NET_NFC_NULL_PARAMETER; - } *out_data = NULL; *out_sap = 0; - if (socket <= 0 || request_length == 0) { + if (socket <= 0 || request_length == 0) return NET_NFC_INVALID_PARAM; - } - if (llcp_proxy == NULL) - { - if(net_nfc_client_llcp_init() != NET_NFC_OK) - { + if (llcp_proxy == NULL) { + if (net_nfc_client_llcp_init() != NET_NFC_OK) { DEBUG_ERR_MSG("llcp_proxy fail"); return NET_NFC_NOT_INITIALIZED; } } socket_data = llcp_socket_data_find(socket); - if (socket_data == NULL) - { + if (socket_data == NULL) { DEBUG_ERR_MSG("can not get socket_data"); return NET_NFC_LLCP_INVALID_SOCKET; } /* prevent executing daemon when nfc is off */ - if (net_nfc_client_manager_is_activated() == false) { + if (net_nfc_client_manager_is_activated() == false) return NET_NFC_NOT_ACTIVATED; - } if (net_nfc_gdbus_llcp_call_receive_from_sync(llcp_proxy, GPOINTER_TO_UINT(llcp_handle), @@ -1826,30 +1693,25 @@ net_nfc_error_e net_nfc_client_llcp_close(net_nfc_llcp_socket_t socket, LlcpFuncData *func_data; net_nfc_llcp_internal_socket_s *socket_data = NULL; - if (socket <= 0) { + if (socket <= 0) return NET_NFC_INVALID_PARAM; - } - if (llcp_proxy == NULL) - { - if(net_nfc_client_llcp_init() != NET_NFC_OK) - { + if (llcp_proxy == NULL) { + if (net_nfc_client_llcp_init() != NET_NFC_OK) { DEBUG_ERR_MSG("llcp_proxy fail"); return NET_NFC_NOT_INITIALIZED; } } socket_data = llcp_socket_data_find(socket); - if (socket_data == NULL) - { + if (socket_data == NULL) { DEBUG_ERR_MSG("can not get socket_data"); return NET_NFC_LLCP_INVALID_SOCKET; } /* prevent executing daemon when nfc is off */ - if (net_nfc_client_manager_is_activated() == false) { + if (net_nfc_client_manager_is_activated() == false) return NET_NFC_NOT_ACTIVATED; - } func_data = g_new0(LlcpFuncData, 1); if (func_data == NULL) { @@ -1881,30 +1743,25 @@ net_nfc_error_e net_nfc_client_llcp_close_sync(net_nfc_llcp_socket_t socket) net_nfc_llcp_internal_socket_s *socket_data = NULL; net_nfc_llcp_internal_socket_s *out_socket_data = NULL; - if (socket <= 0) { + if (socket <= 0) return NET_NFC_INVALID_PARAM; - } - if (llcp_proxy == NULL) - { - if(net_nfc_client_llcp_init() != NET_NFC_OK) - { + if (llcp_proxy == NULL) { + if (net_nfc_client_llcp_init() != NET_NFC_OK) { DEBUG_ERR_MSG("llcp_proxy fail"); return NET_NFC_NOT_INITIALIZED; } } socket_data = llcp_socket_data_find(socket); - if (socket_data == NULL) - { + if (socket_data == NULL) { DEBUG_ERR_MSG("can not get socket_data"); return NET_NFC_LLCP_INVALID_SOCKET; } /* prevent executing daemon when nfc is off */ - if (net_nfc_client_manager_is_activated() == false) { + if (net_nfc_client_manager_is_activated() == false) return NET_NFC_NOT_ACTIVATED; - } if (net_nfc_gdbus_llcp_call_close_sync(llcp_proxy, GPOINTER_TO_UINT(llcp_handle), @@ -1914,8 +1771,7 @@ net_nfc_error_e net_nfc_client_llcp_close_sync(net_nfc_llcp_socket_t socket) NULL, &error) == true) { out_socket_data = llcp_socket_data_find(out_client_socket); - if (out_socket_data == NULL || out_socket_data != socket_data) - { + if (out_socket_data == NULL || out_socket_data != socket_data) { DEBUG_ERR_MSG("Wrong client socket is returned"); return NET_NFC_UNKNOWN_ERROR; } @@ -1937,30 +1793,25 @@ net_nfc_error_e net_nfc_client_llcp_disconnect(net_nfc_llcp_socket_t socket, LlcpFuncData *func_data; net_nfc_llcp_internal_socket_s *socket_data = NULL; - if (socket <= 0) { + if (socket <= 0) return NET_NFC_INVALID_PARAM; - } - if (llcp_proxy == NULL) - { - if(net_nfc_client_llcp_init() != NET_NFC_OK) - { + if (llcp_proxy == NULL) { + if (net_nfc_client_llcp_init() != NET_NFC_OK) { DEBUG_ERR_MSG("llcp_proxy fail"); return NET_NFC_NOT_INITIALIZED; } } socket_data = llcp_socket_data_find(socket); - if (socket_data == NULL) - { + if (socket_data == NULL) { DEBUG_ERR_MSG("can not get socket_data"); return NET_NFC_LLCP_INVALID_SOCKET; } /* prevent executing daemon when nfc is off */ - if (net_nfc_client_manager_is_activated() == false) { + if (net_nfc_client_manager_is_activated() == false) return NET_NFC_NOT_ACTIVATED; - } func_data = g_new0(LlcpFuncData, 1); if (func_data == NULL) { @@ -1993,30 +1844,25 @@ net_nfc_error_e net_nfc_client_llcp_disconnect_sync( net_nfc_llcp_internal_socket_s *socket_data = NULL; net_nfc_llcp_internal_socket_s *out_socket_data = NULL; - if (socket <= 0) { + if (socket <= 0) return NET_NFC_INVALID_PARAM; - } - if (llcp_proxy == NULL) - { - if(net_nfc_client_llcp_init() != NET_NFC_OK) - { + if (llcp_proxy == NULL) { + if (net_nfc_client_llcp_init() != NET_NFC_OK) { DEBUG_ERR_MSG("llcp_proxy fail"); return NET_NFC_NOT_INITIALIZED; } } socket_data = llcp_socket_data_find(socket); - if (socket_data == NULL) - { + if (socket_data == NULL) { DEBUG_ERR_MSG("can not get socket_data"); return NET_NFC_LLCP_INVALID_SOCKET; } /* prevent executing daemon when nfc is off */ - if (net_nfc_client_manager_is_activated() == false) { + if (net_nfc_client_manager_is_activated() == false) return NET_NFC_NOT_ACTIVATED; - } if (net_nfc_gdbus_llcp_call_disconnect_sync(llcp_proxy, GPOINTER_TO_UINT(llcp_handle), @@ -2026,8 +1872,7 @@ net_nfc_error_e net_nfc_client_llcp_disconnect_sync( NULL, &error) == true) { out_socket_data = llcp_socket_data_find(out_client_socket); - if (out_socket_data == NULL || out_socket_data != socket_data) - { + if (out_socket_data == NULL || out_socket_data != socket_data) { DEBUG_ERR_MSG("Wrong client socket is returned"); return NET_NFC_UNKNOWN_ERROR; } @@ -2051,14 +1896,11 @@ void net_nfc_client_llcp_create_socket(net_nfc_llcp_socket_t *socket, socket_data->client_socket = socket_handle++; - if (option) - { + if (option) { socket_data->miu = option->miu; socket_data->rw = option->rw; socket_data->type = option->type; - } - else - { + } else { socket_data->miu = 128; socket_data->rw = 1; socket_data->type = @@ -2068,7 +1910,6 @@ void net_nfc_client_llcp_create_socket(net_nfc_llcp_socket_t *socket, socket_data->device_id = llcp_handle; socket_data->close_requested = false; - if (socket) *socket = socket_data->client_socket; } @@ -2079,9 +1920,7 @@ net_nfc_error_e net_nfc_client_llcp_get_local_config( net_nfc_llcp_config_info_h *config) { if (config == NULL) - { return NET_NFC_NULL_PARAMETER; - } *config = (net_nfc_llcp_config_info_h)&llcp_config; @@ -2116,21 +1955,17 @@ net_nfc_error_e net_nfc_client_llcp_create_socket_option( net_nfc_llcp_socket_option_s *struct_option = NULL; if (option == NULL) - { return NET_NFC_NULL_PARAMETER; - } if (miu < 128 || miu > 1152 || rw < 1 || rw > 15 || type < NET_NFC_LLCP_SOCKET_TYPE_CONNECTIONORIENTED || - type > NET_NFC_LLCP_SOCKET_TYPE_CONNECTIONLESS) - { + type > NET_NFC_LLCP_SOCKET_TYPE_CONNECTIONLESS) { return NET_NFC_OUT_OF_BOUND; } _net_nfc_util_alloc_mem(struct_option, sizeof(net_nfc_llcp_socket_option_s)); - if (struct_option != NULL) - { + if (struct_option != NULL) { struct_option->miu = miu; struct_option->rw = rw; struct_option->type = type; @@ -2138,9 +1973,7 @@ net_nfc_error_e net_nfc_client_llcp_create_socket_option( *option = (net_nfc_llcp_socket_option_h)struct_option; return NET_NFC_OK; - } - else - { + } else { return NET_NFC_ALLOC_FAIL; } } @@ -2165,9 +1998,7 @@ net_nfc_error_e net_nfc_client_llcp_get_socket_option_miu( (net_nfc_llcp_socket_option_s *)option; if (option == NULL || miu == NULL) - { return NET_NFC_NULL_PARAMETER; - } *miu = struct_option->miu; @@ -2183,9 +2014,7 @@ net_nfc_error_e net_nfc_client_llcp_set_socket_option_miu( (net_nfc_llcp_socket_option_s *)option; if (option == NULL) - { return NET_NFC_NULL_PARAMETER; - } struct_option->miu = miu; @@ -2198,9 +2027,8 @@ net_nfc_error_e net_nfc_client_llcp_get_socket_option_rw( uint8_t *rw) { if (option == NULL || rw == NULL) - { return NET_NFC_NULL_PARAMETER; - } + net_nfc_llcp_socket_option_s *struct_option = (net_nfc_llcp_socket_option_s *)option; *rw = struct_option->rw; @@ -2213,9 +2041,8 @@ net_nfc_error_e net_nfc_client_llcp_set_socket_option_rw( uint8_t rw) { if (option == NULL) - { return NET_NFC_NULL_PARAMETER; - } + net_nfc_llcp_socket_option_s *struct_option = (net_nfc_llcp_socket_option_s *)option; struct_option->rw = rw; @@ -2228,9 +2055,8 @@ net_nfc_error_e net_nfc_client_llcp_get_socket_option_type( net_nfc_socket_type_e * type) { if (option == NULL || type == NULL) - { return NET_NFC_NULL_PARAMETER; - } + net_nfc_llcp_socket_option_s *struct_option = (net_nfc_llcp_socket_option_s *)option; *type = struct_option->type; @@ -2243,9 +2069,8 @@ net_nfc_error_e net_nfc_client_llcp_set_socket_option_type( net_nfc_socket_type_e type) { if (option == NULL) - { return NET_NFC_NULL_PARAMETER; - } + net_nfc_llcp_socket_option_s *struct_option = (net_nfc_llcp_socket_option_s *)option; struct_option->type = type; @@ -2257,9 +2082,7 @@ net_nfc_error_e net_nfc_client_llcp_free_socket_option( net_nfc_llcp_socket_option_h option) { if (option == NULL) - { return NET_NFC_NULL_PARAMETER; - } _net_nfc_util_free_mem(option); @@ -2275,9 +2098,7 @@ net_nfc_error_e net_nfc_client_llcp_create_config( uint8_t option) { if (config == NULL) - { return NET_NFC_NULL_PARAMETER; - } net_nfc_llcp_config_info_s **tmp_config = (net_nfc_llcp_config_info_s **)config; @@ -2308,9 +2129,7 @@ net_nfc_error_e net_nfc_client_llcp_get_config_miu( uint16_t *miu) { if (config == NULL || miu == NULL) - { return NET_NFC_NULL_PARAMETER; - } net_nfc_llcp_config_info_s *tmp_config = (net_nfc_llcp_config_info_s *)config; @@ -2326,9 +2145,7 @@ net_nfc_error_e net_nfc_client_llcp_get_config_wks( uint16_t *wks) { if (config == NULL || wks == NULL) - { return NET_NFC_NULL_PARAMETER; - } net_nfc_llcp_config_info_s *tmp_config = (net_nfc_llcp_config_info_s *)config; @@ -2344,9 +2161,7 @@ net_nfc_error_e net_nfc_client_llcp_get_config_lto( uint8_t *lto) { if (config == NULL || lto == NULL) - { return NET_NFC_NULL_PARAMETER; - } net_nfc_llcp_config_info_s *tmp_config = (net_nfc_llcp_config_info_s *)config; @@ -2362,9 +2177,7 @@ net_nfc_error_e net_nfc_client_llcp_get_config_option( uint8_t *option) { if (config == NULL || option == NULL) - { return NET_NFC_NULL_PARAMETER; - } net_nfc_llcp_config_info_s *tmp_config = (net_nfc_llcp_config_info_s *)config; @@ -2380,14 +2193,10 @@ net_nfc_error_e net_nfc_client_llcp_set_config_miu( uint16_t miu) { if (config == NULL) - { return NET_NFC_NULL_PARAMETER; - } if (miu < 128 || miu > 1152) - { return NET_NFC_OUT_OF_BOUND; - } net_nfc_llcp_config_info_s * tmp_config = (net_nfc_llcp_config_info_s *)config; @@ -2403,9 +2212,7 @@ net_nfc_error_e net_nfc_client_llcp_set_config_wks( uint16_t wks) { if (config == NULL) - { return NET_NFC_NULL_PARAMETER; - } net_nfc_llcp_config_info_s *tmp_config = (net_nfc_llcp_config_info_s *)config; @@ -2421,9 +2228,7 @@ net_nfc_error_e net_nfc_client_llcp_set_config_lto( uint8_t lto) { if (config == NULL) - { return NET_NFC_NULL_PARAMETER; - } net_nfc_llcp_config_info_s *tmp_config = (net_nfc_llcp_config_info_s *)config; @@ -2439,9 +2244,7 @@ net_nfc_error_e net_nfc_client_llcp_set_config_option( uint8_t option) { if (config == NULL) - { return NET_NFC_NULL_PARAMETER; - } net_nfc_llcp_config_info_s * tmp_config = (net_nfc_llcp_config_info_s *)config; @@ -2455,9 +2258,7 @@ NET_NFC_EXPORT_API net_nfc_error_e net_nfc_client_llcp_free_config(net_nfc_llcp_config_info_h config) { if (config == NULL) - { return NET_NFC_NULL_PARAMETER; - } _net_nfc_util_free_mem(config); return NET_NFC_OK; @@ -2467,8 +2268,7 @@ net_nfc_error_e net_nfc_client_llcp_init(void) { GError *error = NULL; - if (llcp_proxy) - { + if (llcp_proxy) { DEBUG_CLIENT_MSG("Already initialized"); return NET_NFC_OK; @@ -2481,8 +2281,7 @@ net_nfc_error_e net_nfc_client_llcp_init(void) "/org/tizen/NetNfcService/Llcp", NULL, &error); - if (llcp_proxy == NULL) - { + if (llcp_proxy == NULL) { DEBUG_ERR_MSG("Can not create proxy : %s", error->message); g_error_free(error); @@ -2501,8 +2300,7 @@ net_nfc_error_e net_nfc_client_llcp_init(void) void net_nfc_client_llcp_deinit(void) { - if (llcp_proxy) - { + if (llcp_proxy) { g_object_unref(llcp_proxy); llcp_proxy = NULL; } diff --git a/src/net_nfc_client_manager.c b/src/net_nfc_client_manager.c index 2958ccf..ca640a9 100755 --- a/src/net_nfc_client_manager.c +++ b/src/net_nfc_client_manager.c @@ -31,8 +31,7 @@ typedef struct _ManagerFuncData ManagerFuncData; -struct _ManagerFuncData -{ +struct _ManagerFuncData { gpointer callback; gpointer user_data; net_nfc_error_e result; @@ -93,8 +92,7 @@ static void manager_call_set_active_callback(GObject *source_object, NET_NFC_GDBUS_MANAGER(source_object), &result, res, - &error) == FALSE) - { + &error) == FALSE) { DEBUG_ERR_MSG("Can not finish call_set_active: %s", error->message); result = NET_NFC_IPC_FAIL; @@ -133,8 +131,7 @@ static void manager_call_get_server_state_callback(GObject *source_object, &result, &out_state, res, - &error) == FALSE) - { + &error) == FALSE) { DEBUG_ERR_MSG("Can not finish get_server_state: %s", error->message); result = NET_NFC_IPC_FAIL; @@ -142,8 +139,7 @@ static void manager_call_get_server_state_callback(GObject *source_object, g_error_free(error); } - if (func_data->callback != NULL) - { + if (func_data->callback != NULL) { net_nfc_client_manager_get_server_state_completed callback = (net_nfc_client_manager_get_server_state_completed)func_data->callback; @@ -178,8 +174,7 @@ static void manager_activated(NetNfcGDbusManager *manager, /* update current state */ is_activated = (int)activated; - if (activated_func_data.callback != NULL) - { + if (activated_func_data.callback != NULL) { if (is_activated == false) { /* FIXME : wait several times */ timeout_id[1] = g_timeout_add(DEACTIVATE_DELAY, @@ -201,10 +196,8 @@ void net_nfc_client_manager_set_activated( if (callback == NULL) return; - if (manager_proxy == NULL) - { - if (net_nfc_client_manager_init() != NET_NFC_OK) - { + if (manager_proxy == NULL) { + if (net_nfc_client_manager_init() != NET_NFC_OK) { DEBUG_ERR_MSG("manager_proxy fail"); /* FIXME : return result of this error */ return; @@ -240,8 +233,7 @@ net_nfc_error_e net_nfc_client_manager_set_active(int state, "/org/tizen/NetNfcService/Manager", NULL, &error); - if (auto_start_proxy == NULL) - { + if (auto_start_proxy == NULL) { DEBUG_ERR_MSG("Can not create proxy : %s", error->message); g_error_free(error); @@ -286,8 +278,7 @@ net_nfc_error_e net_nfc_client_manager_set_active_sync(int state) "/org/tizen/NetNfcService/Manager", NULL, &error); - if (auto_start_proxy == NULL) - { + if (auto_start_proxy == NULL) { DEBUG_ERR_MSG("Can not create proxy : %s", error->message); g_error_free(error); @@ -301,8 +292,7 @@ net_nfc_error_e net_nfc_client_manager_set_active_sync(int state) (gboolean)state, &out_result, NULL, - &error) == FALSE) - { + &error) == FALSE) { DEBUG_ERR_MSG("can not call SetActive: %s", error->message); out_result = NET_NFC_IPC_FAIL; @@ -324,9 +314,8 @@ net_nfc_error_e net_nfc_client_manager_get_server_state( return NET_NFC_NOT_INITIALIZED; /* prevent executing daemon when nfc is off */ - if (net_nfc_client_manager_is_activated() == false) { + if (net_nfc_client_manager_is_activated() == false) return NET_NFC_NOT_ACTIVATED; - } func_data = g_try_new0(NetNfcCallback, 1); if (func_data == NULL) @@ -360,20 +349,16 @@ net_nfc_error_e net_nfc_client_manager_get_server_state_sync( return NET_NFC_NOT_INITIALIZED; /* prevent executing daemon when nfc is off */ - if (net_nfc_client_manager_is_activated() == false) { + if (net_nfc_client_manager_is_activated() == false) return NET_NFC_NOT_ACTIVATED; - } if (net_nfc_gdbus_manager_call_get_server_state_sync(manager_proxy, &out_result, &out_state, NULL, - &error) == TRUE) - { + &error) == TRUE) { *state = out_state; - } - else - { + } else { DEBUG_ERR_MSG("can not call GetServerState: %s", error->message); out_result = NET_NFC_IPC_FAIL; @@ -389,8 +374,7 @@ net_nfc_error_e net_nfc_client_manager_init(void) { GError *error = NULL; - if (manager_proxy) - { + if (manager_proxy) { DEBUG_CLIENT_MSG("Already initialized"); return NET_NFC_OK; @@ -403,8 +387,7 @@ net_nfc_error_e net_nfc_client_manager_init(void) "/org/tizen/NetNfcService/Manager", NULL, &error); - if (manager_proxy == NULL) - { + if (manager_proxy == NULL) { DEBUG_ERR_MSG("Can not create proxy : %s", error->message); g_error_free(error); @@ -419,8 +402,7 @@ net_nfc_error_e net_nfc_client_manager_init(void) void net_nfc_client_manager_deinit(void) { - if (manager_proxy) - { + if (manager_proxy) { int i; for (i = 0; i < 2; i++) { @@ -443,9 +425,8 @@ void net_nfc_client_manager_deinit(void) /* internal function */ bool net_nfc_client_manager_is_activated() { - if (is_activated < 0) { + if (is_activated < 0) net_nfc_client_get_nfc_state(&is_activated); - } return is_activated; } diff --git a/src/net_nfc_client_ndef.c b/src/net_nfc_client_ndef.c index 0b7316e..3f28e63 100755 --- a/src/net_nfc_client_ndef.c +++ b/src/net_nfc_client_ndef.c @@ -57,27 +57,25 @@ static gboolean ndef_is_supported_tag(void) net_nfc_target_info_s *target_info = NULL; target_info = net_nfc_client_tag_get_client_target_info(); - if (target_info == NULL) - { + if (target_info == NULL) { DEBUG_ERR_MSG("target_info does not exist"); return FALSE; } - switch (target_info->devType) - { - case NET_NFC_ISO14443_A_PICC : - case NET_NFC_MIFARE_MINI_PICC : - case NET_NFC_MIFARE_1K_PICC : - case NET_NFC_MIFARE_4K_PICC : - case NET_NFC_MIFARE_ULTRA_PICC : - case NET_NFC_JEWEL_PICC : - return TRUE; - break; - default: - DEBUG_CLIENT_MSG( - "not supported tag for read only tag"); - return FALSE; + switch (target_info->devType) { + case NET_NFC_ISO14443_A_PICC: + case NET_NFC_MIFARE_MINI_PICC: + case NET_NFC_MIFARE_1K_PICC: + case NET_NFC_MIFARE_4K_PICC: + case NET_NFC_MIFARE_ULTRA_PICC: + case NET_NFC_JEWEL_PICC: + return TRUE; + break; + default: + DEBUG_CLIENT_MSG( + "not supported tag for read only tag"); + return FALSE; } } @@ -97,16 +95,14 @@ static void ndef_call_read(GObject *source_object, (gint *)&out_result, &out_data, res, - &error) == FALSE) - { + &error) == FALSE) { DEBUG_ERR_MSG("Can not finish read: %s", error->message); out_result = NET_NFC_IPC_FAIL; g_error_free(error); } - if (func_data->callback != NULL) - { + if (func_data->callback != NULL) { net_nfc_client_ndef_read_completed callback = (net_nfc_client_ndef_read_completed)func_data->callback; ndef_message_h message; @@ -135,16 +131,14 @@ static void ndef_call_write(GObject *source_object, NET_NFC_GDBUS_NDEF(source_object), (gint *)&out_result, res, - &error) == FALSE) - { + &error) == FALSE) { DEBUG_ERR_MSG("Can not finish write: %s", error->message); out_result = NET_NFC_IPC_FAIL; g_error_free(error); } - if (func_data->callback != NULL) - { + if (func_data->callback != NULL) { net_nfc_client_ndef_write_completed callback = (net_nfc_client_ndef_write_completed)func_data->callback; @@ -168,8 +162,7 @@ static void ndef_call_make_read_only(GObject *source_object, NET_NFC_GDBUS_NDEF(source_object), (gint *)&out_result, res, - &error) == FALSE) - { + &error) == FALSE) { DEBUG_ERR_MSG("Can not finish make read only: %s", error->message); out_result = NET_NFC_IPC_FAIL; @@ -177,8 +170,7 @@ static void ndef_call_make_read_only(GObject *source_object, g_error_free(error); } - if (func_data->callback != NULL) - { + if (func_data->callback != NULL) { net_nfc_client_ndef_make_read_only_completed callback = (net_nfc_client_ndef_make_read_only_completed)func_data->callback; @@ -202,16 +194,14 @@ static void ndef_call_format(GObject *source_object, NET_NFC_GDBUS_NDEF(source_object), (gint *)&out_result, res, - &error) == FALSE) - { + &error) == FALSE) { DEBUG_ERR_MSG("Can not finish format: %s", error->message); out_result = NET_NFC_IPC_FAIL; g_error_free(error); } - if (func_data->callback != NULL) - { + if (func_data->callback != NULL) { net_nfc_client_ndef_format_completed callback = (net_nfc_client_ndef_format_completed)func_data->callback; @@ -231,19 +221,16 @@ net_nfc_error_e net_nfc_client_ndef_read(net_nfc_target_handle_h handle, if (handle == NULL) return NET_NFC_NULL_PARAMETER; - if (ndef_proxy == NULL) - { - if(net_nfc_client_ndef_init() != NET_NFC_OK) - { + if (ndef_proxy == NULL) { + if (net_nfc_client_ndef_init() != NET_NFC_OK) { DEBUG_ERR_MSG("tag_proxy fail"); return NET_NFC_NOT_INITIALIZED; } } /* prevent executing daemon when nfc is off */ - if (net_nfc_client_manager_is_activated() == false) { + if (net_nfc_client_manager_is_activated() == false) return NET_NFC_NOT_ACTIVATED; - } if (net_nfc_client_tag_is_connected() == FALSE) return NET_NFC_NOT_CONNECTED; @@ -251,9 +238,8 @@ net_nfc_error_e net_nfc_client_ndef_read(net_nfc_target_handle_h handle, DEBUG_CLIENT_MSG("send request :: read ndef = [%p]", handle); func_data = g_try_new0(NetNfcCallback, 1); - if (func_data == NULL) { + if (func_data == NULL) return NET_NFC_ALLOC_FAIL; - } func_data->callback = (gpointer)callback; func_data->user_data = user_data; @@ -278,19 +264,16 @@ net_nfc_error_e net_nfc_client_ndef_read_sync(net_nfc_target_handle_h handle, if (handle == NULL) return NET_NFC_NULL_PARAMETER; - if (ndef_proxy == NULL) - { - if(net_nfc_client_ndef_init() != NET_NFC_OK) - { + if (ndef_proxy == NULL) { + if (net_nfc_client_ndef_init() != NET_NFC_OK) { DEBUG_ERR_MSG("tag_proxy fail"); return NET_NFC_NOT_INITIALIZED; } } /* prevent executing daemon when nfc is off */ - if (net_nfc_client_manager_is_activated() == false) { + if (net_nfc_client_manager_is_activated() == false) return NET_NFC_NOT_ACTIVATED; - } if (net_nfc_client_tag_is_connected() == FALSE) return NET_NFC_NOT_CONNECTED; @@ -327,27 +310,23 @@ net_nfc_error_e net_nfc_client_ndef_write(net_nfc_target_handle_h handle, if (handle == NULL || message == NULL) return NET_NFC_NULL_PARAMETER; - if (ndef_proxy == NULL) - { - if(net_nfc_client_ndef_init() != NET_NFC_OK) - { + if (ndef_proxy == NULL) { + if (net_nfc_client_ndef_init() != NET_NFC_OK) { DEBUG_ERR_MSG("tag_proxy fail"); return NET_NFC_NOT_INITIALIZED; } } /* prevent executing daemon when nfc is off */ - if (net_nfc_client_manager_is_activated() == false) { + if (net_nfc_client_manager_is_activated() == false) return NET_NFC_NOT_ACTIVATED; - } if (net_nfc_client_tag_is_connected() == FALSE) return NET_NFC_NOT_CONNECTED; func_data = g_try_new0(NetNfcCallback, 1); - if (func_data == NULL) { + if (func_data == NULL) return NET_NFC_ALLOC_FAIL; - } func_data->callback = (gpointer)callback; func_data->user_data = user_data; @@ -375,19 +354,16 @@ net_nfc_error_e net_nfc_client_ndef_write_sync(net_nfc_target_handle_h handle, if (handle == NULL || message == NULL) return NET_NFC_NULL_PARAMETER; - if (ndef_proxy == NULL) - { - if(net_nfc_client_ndef_init() != NET_NFC_OK) - { + if (ndef_proxy == NULL) { + if (net_nfc_client_ndef_init() != NET_NFC_OK) { DEBUG_ERR_MSG("tag_proxy fail"); return NET_NFC_NOT_INITIALIZED; } } /* prevent executing daemon when nfc is off */ - if (net_nfc_client_manager_is_activated() == false) { + if (net_nfc_client_manager_is_activated() == false) return NET_NFC_NOT_ACTIVATED; - } if (net_nfc_client_tag_is_connected() == FALSE) return NET_NFC_NOT_CONNECTED; @@ -399,8 +375,7 @@ net_nfc_error_e net_nfc_client_ndef_write_sync(net_nfc_target_handle_h handle, arg_data, (gint *)&out_result, NULL, - &error) == FALSE) - { + &error) == FALSE) { DEBUG_ERR_MSG("can not call write: %s", error->message); out_result = NET_NFC_IPC_FAIL; @@ -422,19 +397,16 @@ net_nfc_error_e net_nfc_client_ndef_make_read_only( if (handle == NULL) return NET_NFC_NULL_PARAMETER; - if (ndef_proxy == NULL) - { - if(net_nfc_client_ndef_init() != NET_NFC_OK) - { + if (ndef_proxy == NULL) { + if (net_nfc_client_ndef_init() != NET_NFC_OK) { DEBUG_ERR_MSG("tag_proxy fail"); return NET_NFC_NOT_INITIALIZED; } } /* prevent executing daemon when nfc is off */ - if (net_nfc_client_manager_is_activated() == false) { + if (net_nfc_client_manager_is_activated() == false) return NET_NFC_NOT_ACTIVATED; - } if (net_nfc_client_tag_is_connected() == FALSE) return NET_NFC_NOT_CONNECTED; @@ -443,9 +415,8 @@ net_nfc_error_e net_nfc_client_ndef_make_read_only( return NET_NFC_NOT_SUPPORTED; func_data = g_try_new0(NetNfcCallback, 1); - if (func_data == NULL) { + if (func_data == NULL) return NET_NFC_ALLOC_FAIL; - } func_data->callback = (gpointer)callback; func_data->user_data = user_data; @@ -469,19 +440,16 @@ net_nfc_error_e net_nfc_client_ndef_make_read_only_sync( if (handle == NULL) return NET_NFC_NULL_PARAMETER; - if (ndef_proxy == NULL) - { - if(net_nfc_client_ndef_init() != NET_NFC_OK) - { + if (ndef_proxy == NULL) { + if (net_nfc_client_ndef_init() != NET_NFC_OK) { DEBUG_ERR_MSG("tag_proxy fail"); return NET_NFC_NOT_INITIALIZED; } } /* prevent executing daemon when nfc is off */ - if (net_nfc_client_manager_is_activated() == false) { + if (net_nfc_client_manager_is_activated() == false) return NET_NFC_NOT_ACTIVATED; - } if (net_nfc_client_tag_is_connected() == FALSE) return NET_NFC_NOT_CONNECTED; @@ -493,8 +461,7 @@ net_nfc_error_e net_nfc_client_ndef_make_read_only_sync( GPOINTER_TO_UINT(handle), (gint *)&out_result, NULL, - &error) == FALSE) - { + &error) == FALSE) { DEBUG_ERR_MSG("can not make read only: %s", error->message); out_result = NET_NFC_IPC_FAIL; @@ -517,27 +484,23 @@ net_nfc_error_e net_nfc_client_ndef_format(net_nfc_target_handle_h handle, if (handle == NULL) return NET_NFC_NULL_PARAMETER; - if (ndef_proxy == NULL) - { - if(net_nfc_client_ndef_init() != NET_NFC_OK) - { + if (ndef_proxy == NULL) { + if (net_nfc_client_ndef_init() != NET_NFC_OK) { DEBUG_ERR_MSG("tag_proxy fail"); return NET_NFC_NOT_INITIALIZED; } } /* prevent executing daemon when nfc is off */ - if (net_nfc_client_manager_is_activated() == false) { + if (net_nfc_client_manager_is_activated() == false) return NET_NFC_NOT_ACTIVATED; - } if (net_nfc_client_tag_is_connected() == FALSE) return NET_NFC_NOT_CONNECTED; func_data = g_try_new0(NetNfcCallback, 1); - if (func_data == NULL) { + if (func_data == NULL) return NET_NFC_ALLOC_FAIL; - } func_data->callback = (gpointer)callback; func_data->user_data = user_data; @@ -566,19 +529,16 @@ net_nfc_error_e net_nfc_client_ndef_format_sync( if (handle == NULL) return NET_NFC_NULL_PARAMETER; - if (ndef_proxy == NULL) - { - if(net_nfc_client_ndef_init() != NET_NFC_OK) - { + if (ndef_proxy == NULL) { + if (net_nfc_client_ndef_init() != NET_NFC_OK) { DEBUG_ERR_MSG("tag_proxy fail"); return NET_NFC_NOT_INITIALIZED; } } /* prevent executing daemon when nfc is off */ - if (net_nfc_client_manager_is_activated() == false) { + if (net_nfc_client_manager_is_activated() == false) return NET_NFC_NOT_ACTIVATED; - } if (net_nfc_client_tag_is_connected() == FALSE) return NET_NFC_NOT_CONNECTED; @@ -590,8 +550,7 @@ net_nfc_error_e net_nfc_client_ndef_format_sync( arg_data, (gint *)&out_result, NULL, - &error) == FALSE) - { + &error) == FALSE) { DEBUG_ERR_MSG("can not call format: %s", error->message); out_result = NET_NFC_IPC_FAIL; @@ -606,8 +565,7 @@ net_nfc_error_e net_nfc_client_ndef_init(void) { GError *error = NULL; - if (ndef_proxy) - { + if (ndef_proxy) { DEBUG_CLIENT_MSG("Already initialized"); return NET_NFC_OK; @@ -620,8 +578,7 @@ net_nfc_error_e net_nfc_client_ndef_init(void) "/org/tizen/NetNfcService/Ndef", NULL, &error); - if (ndef_proxy == NULL) - { + if (ndef_proxy == NULL) { DEBUG_ERR_MSG("Can not create proxy : %s", error->message); g_error_free(error); @@ -633,8 +590,7 @@ net_nfc_error_e net_nfc_client_ndef_init(void) void net_nfc_client_ndef_deinit(void) { - if (ndef_proxy) - { + if (ndef_proxy) { g_object_unref(ndef_proxy); ndef_proxy = NULL; } diff --git a/src/net_nfc_client_ndef_message.c b/src/net_nfc_client_ndef_message.c index d8e3f74..9d6255d 100755 --- a/src/net_nfc_client_ndef_message.c +++ b/src/net_nfc_client_ndef_message.c @@ -56,29 +56,25 @@ net_nfc_error_e net_nfc_create_rawdata_from_ndef_message( net_nfc_error_e result; data_h data; - if (ndef_message == NULL || rawdata == NULL) { + if (ndef_message == NULL || rawdata == NULL) return NET_NFC_NULL_PARAMETER; - } *rawdata = NULL; result = net_nfc_get_ndef_message_byte_length(ndef_message, &count); - if (result != NET_NFC_OK) { + if (result != NET_NFC_OK) return result; - } - result = net_nfc_create_data(&data ,NULL, count); - if (result != NET_NFC_OK) { + result = net_nfc_create_data(&data, NULL, count); + if (result != NET_NFC_OK) return result; - } result = net_nfc_util_convert_ndef_message_to_rawdata( (ndef_message_s *)ndef_message, (data_s *)data); - if (result == NET_NFC_OK) { + if (result == NET_NFC_OK) *rawdata = data; - } else { + else net_nfc_free_data(data); - } return result; } @@ -90,24 +86,21 @@ net_nfc_error_e net_nfc_create_ndef_message_from_rawdata( net_nfc_error_e result; ndef_message_h msg; - if (ndef_message == NULL || rawdata == NULL) { + if (ndef_message == NULL || rawdata == NULL) return NET_NFC_NULL_PARAMETER; - } *ndef_message = NULL; result = net_nfc_create_ndef_message(&msg); - if (result != NET_NFC_OK) { + if (result != NET_NFC_OK) return result; - } result = net_nfc_util_convert_rawdata_to_ndef_message( (data_s *)rawdata, (ndef_message_s *)msg); - if (result == NET_NFC_OK) { + if (result == NET_NFC_OK) *ndef_message = msg; - } else { + else net_nfc_free_ndef_message(msg); - } return result; } @@ -118,17 +111,15 @@ net_nfc_error_e net_nfc_get_ndef_message_byte_length( { net_nfc_error_e result; - if (ndef_message == NULL || length == NULL){ + if (ndef_message == NULL || length == NULL) return NET_NFC_NULL_PARAMETER; - } *length = net_nfc_util_get_ndef_message_length( (ndef_message_s *)ndef_message); - if (*length > 0) { + if (*length > 0) result = NET_NFC_OK; - } else { + else result = NET_NFC_INVALID_PARAM; - } return result; } @@ -137,9 +128,8 @@ NET_NFC_EXPORT_API net_nfc_error_e net_nfc_append_record_to_ndef_message( ndef_message_h ndef_message, ndef_record_h record) { - if (ndef_message == NULL || record == NULL) { + if (ndef_message == NULL || record == NULL) return NET_NFC_NULL_PARAMETER; - } return net_nfc_util_append_record((ndef_message_s *)ndef_message, (ndef_record_s *)record); @@ -148,9 +138,8 @@ net_nfc_error_e net_nfc_append_record_to_ndef_message( NET_NFC_EXPORT_API net_nfc_error_e net_nfc_free_ndef_message(ndef_message_h ndef_message) { - if (ndef_message == NULL) { + if (ndef_message == NULL) return NET_NFC_NULL_PARAMETER; - } return net_nfc_util_free_ndef_message((ndef_message_s *)ndef_message); } @@ -161,9 +150,8 @@ net_nfc_error_e net_nfc_get_ndef_message_record_count( { ndef_message_s *msg = (ndef_message_s *)ndef_message; - if (ndef_message == NULL || count == NULL) { + if (ndef_message == NULL || count == NULL) return NET_NFC_NULL_PARAMETER; - } *count = msg->recordCount; @@ -220,17 +208,14 @@ net_nfc_error_e net_nfc_retrieve_current_ndef_message( FILE *fp = NULL; if (ndef_message == NULL) - { return NET_NFC_NULL_PARAMETER; - } snprintf(file_path, sizeof(file_path), "%s/%s/%s", NET_NFC_MANAGER_DATA_PATH, NET_NFC_MANAGER_DATA_PATH_MESSAGE, NET_NFC_MANAGER_NDEF_FILE_NAME); - if ((fp = fopen(file_path, "r")) != NULL) - { + if ((fp = fopen(file_path, "r")) != NULL) { long int size = 0; /* rewind to start of file */ @@ -240,12 +225,10 @@ net_nfc_error_e net_nfc_retrieve_current_ndef_message( DEBUG_CLIENT_MSG("message length = [%ld]", size); - if (size > 0) - { + if (size > 0) { data_s data = { NULL, 0 }; - if (net_nfc_util_init_data(&data, size) == true) - { + if (net_nfc_util_init_data(&data, size) == true) { int current; size_t offset = 0; @@ -259,28 +242,21 @@ net_nfc_error_e net_nfc_retrieve_current_ndef_message( break; } while (offset < data.length); - if (offset == data.length) { + if (offset == data.length) result = net_nfc_create_ndef_message_from_rawdata(ndef_message, &data); - } else { + else DEBUG_ERR_MSG("failed to read ndef message"); - } net_nfc_util_clear_data(&data); - } - else - { + } else { result = NET_NFC_ALLOC_FAIL; } - } - else - { + } else { result = NET_NFC_NO_NDEF_MESSAGE; } fclose(fp); - } - else - { + } else { result = NET_NFC_NO_NDEF_MESSAGE; } diff --git a/src/net_nfc_client_ndef_record.c b/src/net_nfc_client_ndef_record.c index 9079710..3f85f5e 100755 --- a/src/net_nfc_client_ndef_record.c +++ b/src/net_nfc_client_ndef_record.c @@ -63,9 +63,7 @@ net_nfc_error_e net_nfc_get_record_payload(ndef_record_h record, ndef_record_s *struct_record = (ndef_record_s *)record; if (record == NULL || payload == NULL) - { return NET_NFC_NULL_PARAMETER; - } *payload = (data_h)&(struct_record->payload_s); @@ -78,9 +76,7 @@ net_nfc_error_e net_nfc_get_record_type(ndef_record_h record, data_h *type) ndef_record_s *struct_record = (ndef_record_s *)record; if (record == NULL || type == NULL) - { return NET_NFC_NULL_PARAMETER; - } *type = (data_h)&(struct_record->type_s); @@ -93,9 +89,7 @@ net_nfc_error_e net_nfc_get_record_id(ndef_record_h record, data_h *id) ndef_record_s *struct_record = (ndef_record_s *)record; if (record == NULL || id == NULL) - { return NET_NFC_NULL_PARAMETER; - } *id = (data_h)&(struct_record->id_s); @@ -109,9 +103,7 @@ net_nfc_error_e net_nfc_get_record_tnf(ndef_record_h record, ndef_record_s *struct_record = (ndef_record_s *)record; if (record == NULL || TNF == NULL) - { return NET_NFC_NULL_PARAMETER; - } *TNF = (net_nfc_record_tnf_e)struct_record->TNF; @@ -124,9 +116,7 @@ net_nfc_error_e net_nfc_set_record_id(ndef_record_h record, data_h id) data_s *tmp_id = (data_s *)id; if (record == NULL || tmp_id == NULL) - { return NET_NFC_NULL_PARAMETER; - } return net_nfc_util_set_record_id((ndef_record_s *)record, tmp_id->buffer, tmp_id->length); @@ -138,9 +128,7 @@ net_nfc_error_e net_nfc_get_record_flags(ndef_record_h record, uint8_t *flag) ndef_record_s *struct_record = (ndef_record_s *)record; if (record == NULL || flag == NULL) - { return NET_NFC_NULL_PARAMETER; - } *flag = struct_record->MB; *flag <<= 1; @@ -204,22 +192,18 @@ net_nfc_error_e net_nfc_create_text_string_from_text_record( data_h payload; if (record == NULL || buffer == NULL) - { return NET_NFC_NULL_PARAMETER; - } *buffer = NULL; - if (_is_text_record(record) == false) - { + if (_is_text_record(record) == false) { DEBUG_ERR_MSG("record type is not matched"); return NET_NFC_NDEF_RECORD_IS_NOT_EXPECTED_TYPE; } result = net_nfc_get_record_payload(record, &payload); - if (result == NET_NFC_OK) - { + if (result == NET_NFC_OK) { uint8_t *buffer_temp = net_nfc_get_data_buffer(payload); uint32_t buffer_length = net_nfc_get_data_length(payload); @@ -231,16 +215,13 @@ net_nfc_error_e net_nfc_create_text_string_from_text_record( char *temp = NULL; _net_nfc_util_alloc_mem(temp, text_length + 1); - if (temp != NULL) - { + if (temp != NULL) { memcpy(temp, &(buffer_temp[index]), text_length); DEBUG_CLIENT_MSG("text = [%s]", temp); *buffer = temp; - } - else - { + } else { result = NET_NFC_ALLOC_FAIL; } } @@ -256,22 +237,18 @@ net_nfc_error_e net_nfc_get_languange_code_string_from_text_record( data_h payload; if (record == NULL || lang_code_str == NULL) - { return NET_NFC_NULL_PARAMETER; - } *lang_code_str = NULL; - if (_is_text_record(record) == false) - { + if (_is_text_record(record) == false) { DEBUG_ERR_MSG("record type is not matched"); return NET_NFC_NDEF_RECORD_IS_NOT_EXPECTED_TYPE; } result = net_nfc_get_record_payload(record, &payload); - if (result == NET_NFC_OK) - { + if (result == NET_NFC_OK) { uint8_t *buffer_temp = net_nfc_get_data_buffer(payload); char *buffer = NULL; @@ -280,16 +257,13 @@ net_nfc_error_e net_nfc_get_languange_code_string_from_text_record( int index = 1; _net_nfc_util_alloc_mem(buffer, lang_code_length + 1); - if (buffer != NULL) - { + if (buffer != NULL) { memcpy(buffer, &(buffer_temp[index]), lang_code_length); DEBUG_CLIENT_MSG("language code = [%s]", buffer); *lang_code_str = buffer; - } - else - { + } else { result = NET_NFC_ALLOC_FAIL; } } @@ -305,30 +279,24 @@ net_nfc_error_e net_nfc_get_encoding_type_from_text_record(ndef_record_h record, data_h payload; if (record == NULL || encoding == NULL) - { return NET_NFC_NULL_PARAMETER; - } *encoding = NET_NFC_ENCODE_UTF_8; - if (_is_text_record(record) == false) - { + if (_is_text_record(record) == false) { DEBUG_ERR_MSG("record type is not matched"); return NET_NFC_NDEF_RECORD_IS_NOT_EXPECTED_TYPE; } result = net_nfc_get_record_payload(record, &payload); - if (result == NET_NFC_OK) - { + if (result == NET_NFC_OK) { uint8_t *buffer_temp = net_nfc_get_data_buffer(payload); int controllbyte = buffer_temp[0]; if ((controllbyte & 0x80) == 0x80) - { *encoding = NET_NFC_ENCODE_UTF_16; - } } return result; diff --git a/src/net_nfc_client_p2p.c b/src/net_nfc_client_p2p.c index 6997d15..ffa1691 100755 --- a/src/net_nfc_client_p2p.c +++ b/src/net_nfc_client_p2p.c @@ -31,8 +31,7 @@ typedef struct _P2p_SignalHandler P2pSignalHandler; -struct _P2p_SignalHandler -{ +struct _P2p_SignalHandler { net_nfc_client_p2p_device_discovered p2p_device_discovered_cb; net_nfc_client_p2p_device_detached p2p_device_detached_cb; net_nfc_client_p2p_data_received p2p_data_received_cb; @@ -68,8 +67,7 @@ static void p2p_device_detached(GObject *source_object, /*llcp client function to set/unset the current target id needs to be implemented*/ /*net_nfc_client_llcp_current_target_id(NULL);*/ - if (p2p_signal_handler.p2p_device_detached_cb) - { + if (p2p_signal_handler.p2p_device_detached_cb) { p2p_signal_handler.p2p_device_detached_cb( p2p_signal_handler.p2p_device_detached_data); } @@ -88,8 +86,7 @@ static void p2p_device_discovered(GObject *source_object, handle_info = GUINT_TO_POINTER(arg_handle); - if (p2p_signal_handler.p2p_device_discovered_cb) - { + if (p2p_signal_handler.p2p_device_discovered_cb) { p2p_signal_handler.p2p_device_discovered_cb(handle_info, p2p_signal_handler.p2p_device_discovered_data); } @@ -101,8 +98,7 @@ static void p2p_device_data_received(GObject *source_object, { INFO_MSG(">>> SIGNAL arrived"); - if (p2p_signal_handler.p2p_data_received_cb) - { + if (p2p_signal_handler.p2p_data_received_cb) { data_s p2p_data = { NULL, }; net_nfc_util_gdbus_variant_to_data_s(arg_data, &p2p_data); @@ -128,16 +124,14 @@ static void p2p_call_send(GObject *source_object, NET_NFC_GDBUS_P2P(source_object), (gint *)&out_result, res, - &error) == FALSE) - { + &error) == FALSE) { DEBUG_ERR_MSG("Can not finish p2p send: %s", error->message); out_result = NET_NFC_IPC_FAIL; g_error_free(error); } - if (func_data->callback != NULL) - { + if (func_data->callback != NULL) { net_nfc_client_p2p_send_completed callback = (net_nfc_client_p2p_send_completed)func_data->callback; @@ -157,22 +151,19 @@ net_nfc_error_e net_nfc_client_p2p_send(net_nfc_target_handle_h handle, GVariant *arg_data; NetNfcCallback *func_data; - if (p2p_proxy == NULL) - { + if (p2p_proxy == NULL) { DEBUG_ERR_MSG("Can not get P2pProxy"); return NET_NFC_NOT_INITIALIZED; } /* prevent executing daemon when nfc is off */ - if (net_nfc_client_manager_is_activated() == false) { + if (net_nfc_client_manager_is_activated() == false) return NET_NFC_NOT_ACTIVATED; - } func_data = g_try_new0(NetNfcCallback, 1); - if (func_data == NULL) { + if (func_data == NULL) return NET_NFC_ALLOC_FAIL; - } func_data->callback = (gpointer)callback; func_data->user_data = user_data; @@ -200,17 +191,15 @@ net_nfc_error_e net_nfc_client_p2p_send_sync(net_nfc_target_handle_h handle, net_nfc_error_e out_result; - if (p2p_proxy == NULL) - { + if (p2p_proxy == NULL) { DEBUG_ERR_MSG("Can not get P2pProxy"); return NET_NFC_NOT_INITIALIZED; } /* prevent executing daemon when nfc is off */ - if (net_nfc_client_manager_is_activated() == false) { + if (net_nfc_client_manager_is_activated() == false) return NET_NFC_NOT_ACTIVATED; - } arg_data = net_nfc_util_gdbus_data_to_variant(data); @@ -220,8 +209,7 @@ net_nfc_error_e net_nfc_client_p2p_send_sync(net_nfc_target_handle_h handle, GPOINTER_TO_UINT(handle), (gint *)&out_result, NULL, - &error) == FALSE) - { + &error) == FALSE) { DEBUG_ERR_MSG("p2p send (sync call) failed: %s", error->message); out_result = NET_NFC_IPC_FAIL; @@ -241,10 +229,8 @@ void net_nfc_client_p2p_set_device_discovered( if (callback == NULL) return; - if (p2p_proxy == NULL) - { - if (net_nfc_client_p2p_init() != NET_NFC_OK) - { + if (p2p_proxy == NULL) { + if (net_nfc_client_p2p_init() != NET_NFC_OK) { DEBUG_ERR_MSG("P2pProxy fail"); /* FIXME : return result of this error */ return; @@ -264,10 +250,8 @@ void net_nfc_client_p2p_set_device_detached( if (callback == NULL) return; - if (p2p_proxy == NULL) - { - if (net_nfc_client_p2p_init() != NET_NFC_OK) - { + if (p2p_proxy == NULL) { + if (net_nfc_client_p2p_init() != NET_NFC_OK) { DEBUG_ERR_MSG("P2pProxy fail"); /* FIXME : return result of this error */ return; @@ -287,10 +271,8 @@ void net_nfc_client_p2p_set_data_received( if (callback == NULL) return; - if (p2p_proxy == NULL) - { - if (net_nfc_client_p2p_init() != NET_NFC_OK) - { + if (p2p_proxy == NULL) { + if (net_nfc_client_p2p_init() != NET_NFC_OK) { DEBUG_ERR_MSG("P2pProxy fail"); /* FIXME : return result of this error */ return; @@ -329,8 +311,7 @@ net_nfc_error_e net_nfc_client_p2p_init(void) { GError *error = NULL; - if (p2p_proxy) - { + if (p2p_proxy) { DEBUG_CLIENT_MSG("Already initialized"); return NET_NFC_OK; @@ -343,8 +324,7 @@ net_nfc_error_e net_nfc_client_p2p_init(void) "/org/tizen/NetNfcService/P2p", NULL, &error); - if (p2p_proxy == NULL) - { + if (p2p_proxy == NULL) { DEBUG_ERR_MSG("Can not create proxy : %s", error->message); g_error_free(error); @@ -368,8 +348,7 @@ net_nfc_error_e net_nfc_client_p2p_init(void) void net_nfc_client_p2p_deinit(void) { - if (p2p_proxy) - { + if (p2p_proxy) { g_object_unref(p2p_proxy); p2p_proxy = NULL; } diff --git a/src/net_nfc_client_se.c b/src/net_nfc_client_se.c index afde3f6..b9c17db 100755 --- a/src/net_nfc_client_se.c +++ b/src/net_nfc_client_se.c @@ -34,32 +34,28 @@ typedef struct _SeFuncData SeFuncData; -struct _SeFuncData -{ +struct _SeFuncData { gpointer se_callback; gpointer se_data; }; typedef struct _SeEventHandler SeEventHandler; -struct _SeEventHandler -{ +struct _SeEventHandler { net_nfc_client_se_event se_event_cb; gpointer se_event_data; }; typedef struct _SeTransEventHandler SeTransEventHandler; -struct _SeTransEventHandler -{ +struct _SeTransEventHandler { net_nfc_client_se_transaction_event transaction_event_cb; gpointer transaction_event_data; }; typedef struct _SeESEDetectedHandler SeESEDetectedHandler; -struct _SeESEDetectedHandler -{ +struct _SeESEDetectedHandler { net_nfc_client_se_ese_detected_event se_ese_detected_cb; gpointer se_ese_detected_data; }; @@ -135,8 +131,7 @@ static void se_rf_detected(GObject *source_object, INFO_MSG(">>> SIGNAL arrived"); - if (se_eventhandler.se_event_cb != NULL) - { + if (se_eventhandler.se_event_cb != NULL) { net_nfc_client_se_event callback = (net_nfc_client_se_event)se_eventhandler.se_event_cb; @@ -151,8 +146,7 @@ static void se_type_changed(GObject *source_object, { INFO_MSG(">>> SIGNAL arrived"); - if (se_eventhandler.se_event_cb != NULL) - { + if (se_eventhandler.se_event_cb != NULL) { net_nfc_client_se_event callback = (net_nfc_client_se_event)se_eventhandler.se_event_cb; @@ -196,25 +190,22 @@ static void se_transaction_event(GObject *source_object, return; } #endif - switch (arg_se_type) - { - case NET_NFC_SE_TYPE_UICC : - if (uicc_transactionEventHandler.transaction_event_cb != NULL) - { + switch (arg_se_type) { + case NET_NFC_SE_TYPE_UICC: + if (uicc_transactionEventHandler.transaction_event_cb != NULL) { callback = uicc_transactionEventHandler.transaction_event_cb; user_data = uicc_transactionEventHandler.transaction_event_data; } break; - case NET_NFC_SE_TYPE_ESE : - if (ese_transactionEventHandler.transaction_event_cb != NULL) - { + case NET_NFC_SE_TYPE_ESE: + if (ese_transactionEventHandler.transaction_event_cb != NULL) { callback = ese_transactionEventHandler.transaction_event_cb; user_data = ese_transactionEventHandler.transaction_event_data; } break; - default : + default: DEBUG_ERR_MSG("Transaction event SE type wrong [%d]", arg_se_type); break; } @@ -238,8 +229,7 @@ static void se_card_emulation_mode_changed(GObject *source_object, { INFO_MSG(">>> SIGNAL arrived"); - if (se_eventhandler.se_event_cb != NULL) - { + if (se_eventhandler.se_event_cb != NULL) { net_nfc_client_se_event callback = (net_nfc_client_se_event)se_eventhandler.se_event_cb; @@ -261,8 +251,7 @@ static void set_secure_element(GObject *source_object, if (net_nfc_gdbus_secure_element_call_set_finish(se_proxy, &result, res, - &error) == FALSE) - { + &error) == FALSE) { DEBUG_ERR_MSG("Could not set secure element: %s", error->message); @@ -271,8 +260,7 @@ static void set_secure_element(GObject *source_object, g_error_free(error); } - if (func_data->se_callback != NULL) - { + if (func_data->se_callback != NULL) { net_nfc_se_set_se_cb se_callback = (net_nfc_se_set_se_cb)func_data->se_callback; @@ -298,8 +286,7 @@ static void open_secure_element(GObject *source_object, &result, &out_handle, res, - &error) == FALSE) - { + &error) == FALSE) { DEBUG_ERR_MSG("Could not open secure element: %s", error->message); @@ -308,8 +295,7 @@ static void open_secure_element(GObject *source_object, g_error_free(error); } - if (func_data->se_callback != NULL) - { + if (func_data->se_callback != NULL) { net_nfc_se_open_se_cb se_callback = (net_nfc_se_open_se_cb)func_data->se_callback; @@ -336,16 +322,14 @@ static void close_secure_element(GObject *source_object, se_proxy, &result, res, - &error) == FALSE) - { + &error) == FALSE) { DEBUG_ERR_MSG("Could not close secure element: %s", error->message); result = NET_NFC_IPC_FAIL; g_error_free(error); } - if (func_data->se_callback != NULL) - { + if (func_data->se_callback != NULL) { net_nfc_se_close_se_cb se_callback = (net_nfc_se_close_se_cb)func_data->se_callback; @@ -372,16 +356,14 @@ static void send_apdu_secure_element(GObject *source_object, &result, &out_response, res, - &error) == FALSE) - { + &error) == FALSE) { DEBUG_ERR_MSG("Could not send apdu: %s", error->message); result = NET_NFC_IPC_FAIL; g_error_free(error); } - if (func_data->se_callback != NULL) - { + if (func_data->se_callback != NULL) { net_nfc_se_send_apdu_cb se_callback = (net_nfc_se_send_apdu_cb)func_data->se_callback; data_s data = { NULL, }; @@ -413,16 +395,14 @@ static void get_atr_secure_element(GObject *source_object, &result, &out_atr, res, - &error) == FALSE) - { + &error) == FALSE) { DEBUG_ERR_MSG("Could not get atr: %s", error->message); result = NET_NFC_IPC_FAIL; g_error_free(error); } - if (func_data->se_callback != NULL) - { + if (func_data->se_callback != NULL) { net_nfc_se_get_atr_cb se_callback = (net_nfc_se_get_atr_cb)func_data->se_callback; data_s data = { NULL, }; @@ -446,10 +426,8 @@ net_nfc_error_e net_nfc_client_se_set_secure_element_type( { SeFuncData *func_data; - if (se_proxy == NULL) - { - if (net_nfc_client_se_init() != NET_NFC_OK) - { + if (se_proxy == NULL) { + if (net_nfc_client_se_init() != NET_NFC_OK) { DEBUG_ERR_MSG("se_proxy fail"); /* FIXME : return result of this error */ return NET_NFC_NOT_INITIALIZED; @@ -457,9 +435,8 @@ net_nfc_error_e net_nfc_client_se_set_secure_element_type( } /* prevent executing daemon when nfc is off */ - if (net_nfc_client_manager_is_activated() == false) { + if (net_nfc_client_manager_is_activated() == false) return NET_NFC_NOT_ACTIVATED; - } func_data = g_try_new0(SeFuncData, 1); if (func_data == NULL) @@ -486,27 +463,23 @@ net_nfc_error_e net_nfc_client_se_set_secure_element_type_sync( net_nfc_error_e result = NET_NFC_OK; GError *error = NULL; - if (se_proxy == NULL) - { - if (net_nfc_client_se_init() != NET_NFC_OK) - { + if (se_proxy == NULL) { + if (net_nfc_client_se_init() != NET_NFC_OK) { DEBUG_ERR_MSG("se_proxy fail"); return NET_NFC_NOT_INITIALIZED; } } /* prevent executing daemon when nfc is off */ - if (net_nfc_client_manager_is_activated() == false) { + if (net_nfc_client_manager_is_activated() == false) return NET_NFC_NOT_ACTIVATED; - } if (net_nfc_gdbus_secure_element_call_set_sync( se_proxy, (gint)se_type, &result, NULL, - &error) == FALSE) - { + &error) == FALSE) { DEBUG_ERR_MSG("Set secure element failed: %s", error->message); result = NET_NFC_IPC_FAIL; @@ -525,25 +498,21 @@ net_nfc_error_e net_nfc_client_se_get_secure_element_type_sync( #if 1 GError *error = NULL; #endif - if (se_proxy == NULL) - { - if (net_nfc_client_se_init() != NET_NFC_OK) - { + if (se_proxy == NULL) { + if (net_nfc_client_se_init() != NET_NFC_OK) { DEBUG_ERR_MSG("se_proxy fail"); return NET_NFC_NOT_INITIALIZED; } } /* prevent executing daemon when nfc is off */ - if (net_nfc_client_manager_is_activated() == false) { + if (net_nfc_client_manager_is_activated() == false) return NET_NFC_NOT_ACTIVATED; - } #if 0 - if (vconf_get_int(VCONFKEY_NFC_SE_TYPE, &type) == 0) { + if (vconf_get_int(VCONFKEY_NFC_SE_TYPE, &type) == 0) *se_type = type; - } else { + else result = NET_NFC_OPERATION_FAIL; - } #else if (net_nfc_gdbus_secure_element_call_get_sync( se_proxy, @@ -572,27 +541,23 @@ net_nfc_error_e net_nfc_set_card_emulation_mode_sync( net_nfc_error_e result = NET_NFC_OK; GError *error = NULL; - if (se_proxy == NULL) - { - if (net_nfc_client_se_init() != NET_NFC_OK) - { + if (se_proxy == NULL) { + if (net_nfc_client_se_init() != NET_NFC_OK) { DEBUG_ERR_MSG("se_proxy fail"); return NET_NFC_NOT_INITIALIZED; } } /* prevent executing daemon when nfc is off */ - if (net_nfc_client_manager_is_activated() == false) { + if (net_nfc_client_manager_is_activated() == false) return NET_NFC_NOT_ACTIVATED; - } if (net_nfc_gdbus_secure_element_call_set_card_emulation_sync( se_proxy, (gint)mode, &result, NULL, - &error) == FALSE) - { + &error) == FALSE) { DEBUG_ERR_MSG("Set card emulation failed: %s", error->message); result = NET_NFC_IPC_FAIL; @@ -610,19 +575,16 @@ net_nfc_error_e net_nfc_get_card_emulation_mode_sync( gint type; GError *error = NULL; - if (se_proxy == NULL) - { - if (net_nfc_client_se_init() != NET_NFC_OK) - { + if (se_proxy == NULL) { + if (net_nfc_client_se_init() != NET_NFC_OK) { DEBUG_ERR_MSG("se_proxy fail"); return NET_NFC_NOT_INITIALIZED; } } /* prevent executing daemon when nfc is off */ - if (net_nfc_client_manager_is_activated() == false) { + if (net_nfc_client_manager_is_activated() == false) return NET_NFC_NOT_ACTIVATED; - } if (net_nfc_gdbus_secure_element_call_get_card_emulation_sync( se_proxy, @@ -650,8 +612,7 @@ net_nfc_error_e net_nfc_client_se_open_internal_secure_element( { SeFuncData *func_data; - if (auto_start_proxy == NULL) - { + if (auto_start_proxy == NULL) { GError *error = NULL; auto_start_proxy = net_nfc_gdbus_secure_element_proxy_new_for_bus_sync( @@ -661,8 +622,7 @@ net_nfc_error_e net_nfc_client_se_open_internal_secure_element( "/org/tizen/NetNfcService/SecureElement", NULL, &error); - if (auto_start_proxy == NULL) - { + if (auto_start_proxy == NULL) { DEBUG_ERR_MSG("Can not create proxy : %s", error->message); g_error_free(error); @@ -699,12 +659,10 @@ net_nfc_error_e net_nfc_client_se_open_internal_secure_element_sync( guint out_handle = 0; GError *error = NULL; - if (handle == NULL) { + if (handle == NULL) return NET_NFC_NULL_PARAMETER; - } - if (auto_start_proxy == NULL) - { + if (auto_start_proxy == NULL) { GError *error = NULL; auto_start_proxy = net_nfc_gdbus_secure_element_proxy_new_for_bus_sync( @@ -714,8 +672,7 @@ net_nfc_error_e net_nfc_client_se_open_internal_secure_element_sync( "/org/tizen/NetNfcService/SecureElement", NULL, &error); - if (auto_start_proxy == NULL) - { + if (auto_start_proxy == NULL) { DEBUG_ERR_MSG("Can not create proxy : %s", error->message); g_error_free(error); @@ -753,8 +710,7 @@ net_nfc_error_e net_nfc_client_se_close_internal_secure_element( { SeFuncData *func_data; - if (auto_start_proxy == NULL) - { + if (auto_start_proxy == NULL) { GError *error = NULL; auto_start_proxy = net_nfc_gdbus_secure_element_proxy_new_for_bus_sync( @@ -764,8 +720,7 @@ net_nfc_error_e net_nfc_client_se_close_internal_secure_element( "/org/tizen/NetNfcService/SecureElement", NULL, &error); - if (auto_start_proxy == NULL) - { + if (auto_start_proxy == NULL) { DEBUG_ERR_MSG("Can not create proxy : %s", error->message); g_error_free(error); @@ -800,8 +755,7 @@ net_nfc_error_e net_nfc_client_se_close_internal_secure_element_sync( net_nfc_error_e result = NET_NFC_OK; GError *error = NULL; - if (auto_start_proxy == NULL) - { + if (auto_start_proxy == NULL) { GError *error = NULL; auto_start_proxy = net_nfc_gdbus_secure_element_proxy_new_for_bus_sync( @@ -811,8 +765,7 @@ net_nfc_error_e net_nfc_client_se_close_internal_secure_element_sync( "/org/tizen/NetNfcService/SecureElement", NULL, &error); - if (auto_start_proxy == NULL) - { + if (auto_start_proxy == NULL) { DEBUG_ERR_MSG("Can not create proxy : %s", error->message); g_error_free(error); @@ -827,8 +780,7 @@ net_nfc_error_e net_nfc_client_se_close_internal_secure_element_sync( GPOINTER_TO_UINT(handle), &result, NULL, - &error) == FALSE) - { + &error) == FALSE) { DEBUG_ERR_MSG("close internal secure element failed: %s", error->message); result = NET_NFC_IPC_FAIL; @@ -848,8 +800,7 @@ net_nfc_error_e net_nfc_client_se_get_atr( { SeFuncData *func_data; - if (auto_start_proxy == NULL) - { + if (auto_start_proxy == NULL) { GError *error = NULL; auto_start_proxy = net_nfc_gdbus_secure_element_proxy_new_for_bus_sync( @@ -859,8 +810,7 @@ net_nfc_error_e net_nfc_client_se_get_atr( "/org/tizen/NetNfcService/SecureElement", NULL, &error); - if (auto_start_proxy == NULL) - { + if (auto_start_proxy == NULL) { DEBUG_ERR_MSG("Can not create proxy : %s", error->message); g_error_free(error); @@ -897,14 +847,12 @@ net_nfc_error_e net_nfc_client_se_get_atr_sync( GVariant *out_atr = NULL; GError *error = NULL; - if (atr == NULL) { + if (atr == NULL) return NET_NFC_NULL_PARAMETER; - } *atr = NULL; - if (auto_start_proxy == NULL) - { + if (auto_start_proxy == NULL) { GError *error = NULL; auto_start_proxy = net_nfc_gdbus_secure_element_proxy_new_for_bus_sync( @@ -914,8 +862,7 @@ net_nfc_error_e net_nfc_client_se_get_atr_sync( "/org/tizen/NetNfcService/SecureElement", NULL, &error); - if (auto_start_proxy == NULL) - { + if (auto_start_proxy == NULL) { DEBUG_ERR_MSG("Can not create proxy : %s", error->message); g_error_free(error); @@ -954,8 +901,7 @@ net_nfc_error_e net_nfc_client_se_send_apdu( SeFuncData *func_data; GVariant *arg_data; - if (auto_start_proxy == NULL) - { + if (auto_start_proxy == NULL) { GError *error = NULL; auto_start_proxy = net_nfc_gdbus_secure_element_proxy_new_for_bus_sync( @@ -965,8 +911,7 @@ net_nfc_error_e net_nfc_client_se_send_apdu( "/org/tizen/NetNfcService/SecureElement", NULL, &error); - if (auto_start_proxy == NULL) - { + if (auto_start_proxy == NULL) { DEBUG_ERR_MSG("Can not create proxy : %s", error->message); g_error_free(error); @@ -1013,14 +958,12 @@ net_nfc_error_e net_nfc_client_se_send_apdu_sync( GError *error = NULL; GVariant *arg_data; - if (response == NULL) { + if (response == NULL) return NET_NFC_NULL_PARAMETER; - } *response = NULL; - if (auto_start_proxy == NULL) - { + if (auto_start_proxy == NULL) { GError *error = NULL; auto_start_proxy = net_nfc_gdbus_secure_element_proxy_new_for_bus_sync( @@ -1030,8 +973,7 @@ net_nfc_error_e net_nfc_client_se_send_apdu_sync( "/org/tizen/NetNfcService/SecureElement", NULL, &error); - if (auto_start_proxy == NULL) - { + if (auto_start_proxy == NULL) { DEBUG_ERR_MSG("Can not create proxy : %s", error->message); g_error_free(error); @@ -1070,10 +1012,8 @@ void net_nfc_client_se_set_ese_detection_cb( net_nfc_client_se_ese_detected_event callback, void *user_data) { - if (se_proxy == NULL) - { - if (net_nfc_client_se_init() != NET_NFC_OK) - { + if (se_proxy == NULL) { + if (net_nfc_client_se_init() != NET_NFC_OK) { DEBUG_ERR_MSG("se_proxy fail"); /* FIXME : return result of this error */ return; @@ -1099,23 +1039,18 @@ void net_nfc_client_se_set_transaction_event_cb( net_nfc_client_se_transaction_event callback, void *user_data) { - if (se_proxy == NULL) - { - if (net_nfc_client_se_init() != NET_NFC_OK) - { + if (se_proxy == NULL) { + if (net_nfc_client_se_init() != NET_NFC_OK) { DEBUG_ERR_MSG("se_proxy fail"); /* FIXME : return result of this error */ return; } } - if (se_type == NET_NFC_SE_TYPE_ESE) - { + if (se_type == NET_NFC_SE_TYPE_ESE) { ese_transactionEventHandler.transaction_event_cb = callback; ese_transactionEventHandler.transaction_event_data = user_data; - } - else if (se_type == NET_NFC_SE_TYPE_UICC) - { + } else if (se_type == NET_NFC_SE_TYPE_UICC) { uicc_transactionEventHandler.transaction_event_cb = callback; uicc_transactionEventHandler.transaction_event_data = user_data; } @@ -1125,13 +1060,10 @@ void net_nfc_client_se_set_transaction_event_cb( NET_NFC_EXPORT_API void net_nfc_client_se_unset_transaction_event_cb(net_nfc_se_type_e type) { - if (type == NET_NFC_SE_TYPE_ESE) - { + if (type == NET_NFC_SE_TYPE_ESE) { ese_transactionEventHandler.transaction_event_cb = NULL; ese_transactionEventHandler.transaction_event_data = NULL; - } - else if (type == NET_NFC_SE_TYPE_UICC) - { + } else if (type == NET_NFC_SE_TYPE_UICC) { uicc_transactionEventHandler.transaction_event_cb = NULL; uicc_transactionEventHandler.transaction_event_data = NULL; } @@ -1141,10 +1073,8 @@ NET_NFC_EXPORT_API void net_nfc_client_se_set_event_cb(net_nfc_client_se_event callback, void *user_data) { - if (se_proxy == NULL) - { - if (net_nfc_client_se_init() != NET_NFC_OK) - { + if (se_proxy == NULL) { + if (net_nfc_client_se_init() != NET_NFC_OK) { DEBUG_ERR_MSG("se_proxy fail"); /* FIXME : return result of this error */ return; @@ -1169,8 +1099,7 @@ net_nfc_error_e net_nfc_client_se_set_transaction_fg_dispatch(int mode) net_nfc_error_e result = NET_NFC_OK; GError *error = NULL; - if (auto_start_proxy == NULL) - { + if (auto_start_proxy == NULL) { GError *error = NULL; auto_start_proxy = net_nfc_gdbus_secure_element_proxy_new_for_bus_sync( @@ -1180,8 +1109,7 @@ net_nfc_error_e net_nfc_client_se_set_transaction_fg_dispatch(int mode) "/org/tizen/NetNfcService/SecureElement", NULL, &error); - if (auto_start_proxy == NULL) - { + if (auto_start_proxy == NULL) { DEBUG_ERR_MSG("Can not create proxy : %s", error->message); g_error_free(error); @@ -1214,11 +1142,9 @@ net_nfc_error_e net_nfc_client_se_set_default_route_sync( net_nfc_error_e result = NET_NFC_OK; GError *error = NULL; - if (se_proxy == NULL) - { + if (se_proxy == NULL) { result = net_nfc_client_se_init(); - if (result != NET_NFC_OK) - { + if (result != NET_NFC_OK) { DEBUG_ERR_MSG("net_nfc_client_se_init failed, [%d]", result); return NET_NFC_NOT_INITIALIZED; @@ -1232,8 +1158,7 @@ net_nfc_error_e net_nfc_client_se_set_default_route_sync( battery_off, &result, NULL, - &error) == FALSE) - { + &error) == FALSE) { DEBUG_ERR_MSG("Set Route Aid failed: %s", error->message); result = NET_NFC_IPC_FAIL; @@ -1253,9 +1178,8 @@ net_nfc_error_e net_nfc_client_se_is_activated_aid_handler_sync( GError *error = NULL; gboolean ret = false; - if (activated == NULL) { + if (activated == NULL) return NET_NFC_NULL_PARAMETER; - } if (se_proxy == NULL) { result = net_nfc_client_se_init(); @@ -1294,9 +1218,8 @@ net_nfc_error_e net_nfc_client_se_is_activated_category_handler_sync( GError *error = NULL; gboolean ret = false; - if (activated == NULL) { + if (activated == NULL) return NET_NFC_NULL_PARAMETER; - } if (se_proxy == NULL) { result = net_nfc_client_se_init(); @@ -1336,9 +1259,8 @@ net_nfc_error_e net_nfc_client_se_get_registered_aids_count_sync( GError *error = NULL; GVariant *aids = NULL; - if (count == NULL) { + if (count == NULL) return NET_NFC_NULL_PARAMETER; - } if (se_proxy == NULL) { result = net_nfc_client_se_init(); @@ -1356,8 +1278,7 @@ net_nfc_error_e net_nfc_client_se_get_registered_aids_count_sync( &result, &aids, NULL, - &error) == FALSE) - { + &error) == FALSE) { DEBUG_ERR_MSG("net_nfc_gdbus_secure_element_call_get_registered_aids_sync failed : %s", error->message); result = NET_NFC_IPC_FAIL; @@ -1388,9 +1309,8 @@ net_nfc_error_e net_nfc_client_se_foreach_registered_aids_sync( GError *error = NULL; GVariant *aids = NULL; - if (callback == NULL) { + if (callback == NULL) return NET_NFC_NULL_PARAMETER; - } if (se_proxy == NULL) { result = net_nfc_client_se_init(); @@ -1408,8 +1328,7 @@ net_nfc_error_e net_nfc_client_se_foreach_registered_aids_sync( &result, &aids, NULL, - &error) == FALSE) - { + &error) == FALSE) { DEBUG_ERR_MSG("net_nfc_gdbus_secure_element_call_get_registered_aids_sync failed : %s", error->message); result = NET_NFC_IPC_FAIL; @@ -1423,9 +1342,8 @@ net_nfc_error_e net_nfc_client_se_foreach_registered_aids_sync( g_variant_iter_init(&iter, aids); - while (g_variant_iter_loop(&iter, "(sb)", &aid, &manifest) == true) { + while (g_variant_iter_loop(&iter, "(sb)", &aid, &manifest) == true) callback(se_type, aid, (bool)manifest, user_data); - } } return result; @@ -1455,8 +1373,7 @@ net_nfc_error_e net_nfc_client_se_register_aids_sync(net_nfc_se_type_e se_type, aid, &result, NULL, - &error) == FALSE) - { + &error) == FALSE) { DEBUG_ERR_MSG("net_nfc_gdbus_secure_element_call_register_aid_sync failed : %s", error->message); result = NET_NFC_IPC_FAIL; @@ -1489,8 +1406,7 @@ net_nfc_error_e net_nfc_client_se_unregister_aid_sync(net_nfc_se_type_e se_type, aid, &result, NULL, - &error) == FALSE) - { + &error) == FALSE) { DEBUG_ERR_MSG("net_nfc_gdbus_secure_element_call_unregister_aid_sync failed : %s", error->message); result = NET_NFC_IPC_FAIL; @@ -1521,8 +1437,7 @@ net_nfc_error_e net_nfc_client_se_unregister_aids_sync(net_nfc_se_type_e se_type category, &result, NULL, - &error) == FALSE) - { + &error) == FALSE) { DEBUG_ERR_MSG("net_nfc_gdbus_secure_element_call_unregister_aids_sync failed : %s", error->message); result = NET_NFC_IPC_FAIL; @@ -1542,9 +1457,8 @@ net_nfc_error_e net_nfc_client_se_foreach_registered_handlers_sync( GError *error = NULL; GVariant *handlers = NULL; - if (callback == NULL) { + if (callback == NULL) return NET_NFC_NULL_PARAMETER; - } if (se_proxy == NULL) { result = net_nfc_client_se_init(); @@ -1561,8 +1475,7 @@ net_nfc_error_e net_nfc_client_se_foreach_registered_handlers_sync( &result, &handlers, NULL, - &error) == FALSE) - { + &error) == FALSE) { DEBUG_ERR_MSG("net_nfc_gdbus_secure_element_call_get_registered_handlers_sync failed : %s", error->message); result = NET_NFC_IPC_FAIL; @@ -1576,9 +1489,8 @@ net_nfc_error_e net_nfc_client_se_foreach_registered_handlers_sync( g_variant_iter_init(&iter, handlers); - while (g_variant_iter_loop(&iter, "(is)", &count, &handler) == true) { + while (g_variant_iter_loop(&iter, "(is)", &count, &handler) == true) callback(handler, count, user_data); - } } return result; @@ -1593,8 +1505,7 @@ net_nfc_error_e net_nfc_client_se_add_route_aid_sync( net_nfc_error_e result = NET_NFC_OK; GError *error = NULL; - if (auto_start_proxy == NULL) - { + if (auto_start_proxy == NULL) { GError *error = NULL; auto_start_proxy = net_nfc_gdbus_secure_element_proxy_new_for_bus_sync( @@ -1604,8 +1515,7 @@ net_nfc_error_e net_nfc_client_se_add_route_aid_sync( "/org/tizen/NetNfcService/SecureElement", NULL, &error); - if (auto_start_proxy == NULL) - { + if (auto_start_proxy == NULL) { DEBUG_ERR_MSG("Can not create proxy : %s", error->message); g_error_free(error); @@ -1623,8 +1533,7 @@ net_nfc_error_e net_nfc_client_se_add_route_aid_sync( power, &result, NULL, - &error) == FALSE) - { + &error) == FALSE) { DEBUG_ERR_MSG("Set Route Aid failed: %s", error->message); result = NET_NFC_IPC_FAIL; @@ -1643,8 +1552,7 @@ net_nfc_error_e net_nfc_client_se_remove_route_aid_sync( net_nfc_error_e result = NET_NFC_OK; GError *error = NULL; - if (auto_start_proxy == NULL) - { + if (auto_start_proxy == NULL) { GError *error = NULL; auto_start_proxy = net_nfc_gdbus_secure_element_proxy_new_for_bus_sync( @@ -1654,8 +1562,7 @@ net_nfc_error_e net_nfc_client_se_remove_route_aid_sync( "/org/tizen/NetNfcService/SecureElement", NULL, &error); - if (auto_start_proxy == NULL) - { + if (auto_start_proxy == NULL) { DEBUG_ERR_MSG("Can not create proxy : %s", error->message); g_error_free(error); @@ -1669,8 +1576,7 @@ net_nfc_error_e net_nfc_client_se_remove_route_aid_sync( aid, &result, NULL, - &error) == FALSE) - { + &error) == FALSE) { DEBUG_ERR_MSG("Remove Route Aid failed: %s", error->message); result = NET_NFC_IPC_FAIL; @@ -1689,8 +1595,7 @@ net_nfc_error_e net_nfc_client_se_remove_package_aids_sync( net_nfc_error_e result = NET_NFC_OK; GError *error = NULL; - if (auto_start_proxy == NULL) - { + if (auto_start_proxy == NULL) { GError *error = NULL; auto_start_proxy = net_nfc_gdbus_secure_element_proxy_new_for_bus_sync( @@ -1700,8 +1605,7 @@ net_nfc_error_e net_nfc_client_se_remove_package_aids_sync( "/org/tizen/NetNfcService/SecureElement", NULL, &error); - if (auto_start_proxy == NULL) - { + if (auto_start_proxy == NULL) { DEBUG_ERR_MSG("Can not create proxy : %s", error->message); g_error_free(error); @@ -1714,8 +1618,7 @@ net_nfc_error_e net_nfc_client_se_remove_package_aids_sync( package, &result, NULL, - &error) == FALSE) - { + &error) == FALSE) { DEBUG_ERR_MSG("Remove Package Aid failed: %s", error->message); result = NET_NFC_IPC_FAIL; @@ -1856,8 +1759,7 @@ net_nfc_error_e net_nfc_client_se_init(void) { GError *error = NULL; - if (se_proxy) - { + if (se_proxy) { DEBUG_CLIENT_MSG("Already initialized"); return NET_NFC_OK; @@ -1870,8 +1772,7 @@ net_nfc_error_e net_nfc_client_se_init(void) "/org/tizen/NetNfcService/SecureElement", NULL, &error); - if (se_proxy == NULL) - { + if (se_proxy == NULL) { DEBUG_ERR_MSG("Can not create proxy : %s", error->message); g_error_free(error); @@ -1900,14 +1801,12 @@ net_nfc_error_e net_nfc_client_se_init(void) void net_nfc_client_se_deinit(void) { - if (se_proxy) - { + if (se_proxy) { g_object_unref(se_proxy); se_proxy = NULL; } - if (auto_start_proxy) - { + if (auto_start_proxy) { g_object_unref(auto_start_proxy); auto_start_proxy = NULL; } diff --git a/src/net_nfc_client_snep.c b/src/net_nfc_client_snep.c index 3920287..ebdb9b2 100755 --- a/src/net_nfc_client_snep.c +++ b/src/net_nfc_client_snep.c @@ -61,8 +61,7 @@ static void snep_send_client_request(GObject *source_object, (guint *)&out_type, &out_data, res, - &error) == FALSE) - { + &error) == FALSE) { DEBUG_ERR_MSG("Can not finish send client request %s", error->message); out_result = NET_NFC_IPC_FAIL; @@ -101,17 +100,15 @@ net_nfc_error_e net_nfc_client_snep_start_server( GError *error = NULL; GVariant *parameter; - if (snep_proxy == NULL) - { + if (snep_proxy == NULL) { DEBUG_ERR_MSG("Can not get Snep Proxy"); return NET_NFC_NOT_INITIALIZED; } /* prevent executing daemon when nfc is off */ - if (net_nfc_client_manager_is_activated() == false) { + if (net_nfc_client_manager_is_activated() == false) return NET_NFC_NOT_ACTIVATED; - } parameter = g_variant_new("(uu)", GPOINTER_TO_UINT(callback), @@ -124,8 +121,7 @@ net_nfc_error_e net_nfc_client_snep_start_server( GPOINTER_TO_UINT(parameter), (gint *)&result, NULL, - &error) == FALSE) - { + &error) == FALSE) { DEBUG_ERR_MSG("snep server(sync call) failed: %s", error->message); result = NET_NFC_IPC_FAIL; @@ -150,17 +146,15 @@ net_nfc_error_e net_nfc_client_snep_start_client( GError *error = NULL; GVariant *parameter; - if (snep_proxy == NULL) - { + if (snep_proxy == NULL) { DEBUG_ERR_MSG("Can not get Snep Proxy"); return NET_NFC_NOT_INITIALIZED; } /* prevent executing daemon when nfc is off */ - if (net_nfc_client_manager_is_activated() == false) { + if (net_nfc_client_manager_is_activated() == false) return NET_NFC_NOT_ACTIVATED; - } parameter = g_variant_new("(uu)", GPOINTER_TO_UINT(callback), @@ -173,8 +167,7 @@ net_nfc_error_e net_nfc_client_snep_start_client( GPOINTER_TO_UINT(parameter), (gint *)&result, NULL, - &error) == FALSE) - { + &error) == FALSE) { DEBUG_ERR_MSG("snep client(sync call) failed: %s", error->message); result = NET_NFC_IPC_FAIL; @@ -199,21 +192,17 @@ net_nfc_error_e net_nfc_client_snep_send_client_request( GVariant *parameter; if (target == NULL || msg == NULL) - { return NET_NFC_NULL_PARAMETER; - } - if (snep_proxy == NULL) - { + if (snep_proxy == NULL) { DEBUG_ERR_MSG("Can not get Snep Proxy"); return NET_NFC_NOT_INITIALIZED; } /* prevent executing daemon when nfc is off */ - if (net_nfc_client_manager_is_activated() == false) { + if (net_nfc_client_manager_is_activated() == false) return NET_NFC_NOT_ACTIVATED; - } parameter = g_variant_new("(uuu)", GPOINTER_TO_UINT(callback), @@ -249,14 +238,11 @@ net_nfc_error_e net_nfc_client_snep_send_client_request_sync( if (target == NULL || msg == NULL || resp_type == NULL || response == NULL) - { return NET_NFC_NULL_PARAMETER; - } *response = NULL; - if (snep_proxy == NULL) - { + if (snep_proxy == NULL) { DEBUG_ERR_MSG("Can not get Snep Proxy"); return NET_NFC_NOT_INITIALIZED; @@ -272,23 +258,19 @@ net_nfc_error_e net_nfc_client_snep_send_client_request_sync( resp_type, &resp_msg, NULL, - &error) == TRUE) - { + &error) == TRUE) { data_s ndef_data = { NULL, }; net_nfc_util_gdbus_variant_to_data_s(resp_msg, &ndef_data); - if (ndef_data.buffer != NULL && ndef_data.length > 0) - { + if (ndef_data.buffer != NULL && ndef_data.length > 0) { result = net_nfc_create_ndef_message_from_rawdata( response, &ndef_data); net_nfc_util_free_data(&ndef_data); } - } - else - { + } else { DEBUG_ERR_MSG(" send client request (sync call) failed: %s", error->message); g_error_free(error); @@ -309,21 +291,17 @@ net_nfc_error_e net_nfc_client_snep_stop_service_sync( GError *error = NULL; if (target == NULL || service == NULL) - { return NET_NFC_NULL_PARAMETER; - } - if (snep_proxy == NULL) - { + if (snep_proxy == NULL) { DEBUG_ERR_MSG("Can not get Snep Proxy"); return NET_NFC_NOT_INITIALIZED; } /* prevent executing daemon when nfc is off */ - if (net_nfc_client_manager_is_activated() == false) { + if (net_nfc_client_manager_is_activated() == false) return NET_NFC_NOT_ACTIVATED; - } if (net_nfc_gdbus_snep_call_stop_snep_sync( snep_proxy, @@ -331,8 +309,7 @@ net_nfc_error_e net_nfc_client_snep_stop_service_sync( GPOINTER_TO_UINT(service), (gint *)&result, NULL, - &error) == FALSE) - { + &error) == FALSE) { DEBUG_ERR_MSG("snep stop service(sync call) failed: %s", error->message); result = NET_NFC_IPC_FAIL; @@ -360,8 +337,7 @@ static void _snep_event_cb(NetNfcGDbusSnep *object, arg_result, parameter); - if (parameter != NULL) - { + if (parameter != NULL) { net_nfc_client_snep_event_cb callback; void *user_data; @@ -370,8 +346,7 @@ static void _snep_event_cb(NetNfcGDbusSnep *object, &callback, &user_data); - if (callback != NULL) - { + if (callback != NULL) { ndef_message_h message; message = net_nfc_util_gdbus_variant_to_ndef_message( @@ -386,9 +361,8 @@ static void _snep_event_cb(NetNfcGDbusSnep *object, net_nfc_free_ndef_message(message); } #if 0 /* remove temporary... */ - if (arg_event == NET_NFC_LLCP_UNREGISTERED) { + if (arg_event == NET_NFC_LLCP_UNREGISTERED) g_variant_unref(parameter); - } #endif } } @@ -403,19 +377,16 @@ net_nfc_error_e net_nfc_client_snep_register_server(const char *san, GError *error = NULL; GVariant *parameter; - if (snep_proxy == NULL) - { - if(net_nfc_client_snep_init() != NET_NFC_OK) - { + if (snep_proxy == NULL) { + if (net_nfc_client_snep_init() != NET_NFC_OK) { DEBUG_ERR_MSG("Snep Proxy fail"); return NET_NFC_NOT_INITIALIZED; } } /* prevent executing daemon when nfc is off */ - if (net_nfc_client_manager_is_activated() == false) { + if (net_nfc_client_manager_is_activated() == false) return NET_NFC_NOT_ACTIVATED; - } parameter = g_variant_new("(uu)", GPOINTER_TO_UINT(callback), @@ -427,8 +398,7 @@ net_nfc_error_e net_nfc_client_snep_register_server(const char *san, GPOINTER_TO_UINT(parameter), (gint *)&result, NULL, - &error) == FALSE) - { + &error) == FALSE) { DEBUG_ERR_MSG("snep register server(sync call) failed: %s", error->message); result = NET_NFC_IPC_FAIL; @@ -448,25 +418,22 @@ net_nfc_error_e net_nfc_client_snep_unregister_server(const char *san, net_nfc_error_e result = NET_NFC_OK; GError *error = NULL; - if (snep_proxy == NULL) - { + if (snep_proxy == NULL) { DEBUG_ERR_MSG("Can not get Snep Proxy"); return NET_NFC_NOT_INITIALIZED; } /* prevent executing daemon when nfc is off */ - if (net_nfc_client_manager_is_activated() == false) { + if (net_nfc_client_manager_is_activated() == false) return NET_NFC_NOT_ACTIVATED; - } if (net_nfc_gdbus_snep_call_server_unregister_sync(snep_proxy, sap, san, (gint *)&result, NULL, - &error) == FALSE) - { + &error) == FALSE) { DEBUG_ERR_MSG("snep unregister server(sync call) failed: %s", error->message); result = NET_NFC_IPC_FAIL; @@ -481,8 +448,7 @@ net_nfc_error_e net_nfc_client_snep_init(void) { GError *error = NULL; - if (snep_proxy) - { + if (snep_proxy) { DEBUG_CLIENT_MSG("Already initialized"); return NET_NFC_OK; @@ -495,8 +461,7 @@ net_nfc_error_e net_nfc_client_snep_init(void) "/org/tizen/NetNfcService/Snep", NULL, &error); - if (snep_proxy == NULL) - { + if (snep_proxy == NULL) { DEBUG_ERR_MSG("Can not create proxy : %s", error->message); g_error_free(error); @@ -511,8 +476,7 @@ net_nfc_error_e net_nfc_client_snep_init(void) void net_nfc_client_snep_deinit(void) { - if (snep_proxy) - { + if (snep_proxy) { g_object_unref(snep_proxy); snep_proxy = NULL; } diff --git a/src/net_nfc_client_system_handler.c b/src/net_nfc_client_system_handler.c index 2616b8a..338e6a8 100755 --- a/src/net_nfc_client_system_handler.c +++ b/src/net_nfc_client_system_handler.c @@ -49,8 +49,7 @@ static void popup_set_active_callback(GObject *source_object, NET_NFC_GDBUS_POPUP(source_object), &result, res, - &error) == FALSE) - { + &error) == FALSE) { DEBUG_ERR_MSG("Can not finish popup_set_active: %s", error->message); result = NET_NFC_IPC_FAIL; @@ -58,8 +57,7 @@ static void popup_set_active_callback(GObject *source_object, g_error_free(error); } - if (func_data->callback != NULL) - { + if (func_data->callback != NULL) { net_nfc_client_popup_set_state_callback callback = (net_nfc_client_popup_set_state_callback)func_data->callback; @@ -76,22 +74,19 @@ net_nfc_error_e net_nfc_client_sys_handler_set_state(int state, { NetNfcCallback *func_data; - if (popup_proxy == NULL) - { - if(net_nfc_client_sys_handler_init() != NET_NFC_OK) - { + if (popup_proxy == NULL) { + if (net_nfc_client_sys_handler_init() != NET_NFC_OK) { DEBUG_ERR_MSG("popup_proxy fail"); return NET_NFC_NOT_INITIALIZED; } } /* prevent executing daemon when nfc is off */ - if (net_nfc_client_manager_is_activated() == false) { + if (net_nfc_client_manager_is_activated() == false) return NET_NFC_NOT_ACTIVATED; - } func_data = g_try_new0(NetNfcCallback, 1); - if (func_data == NULL ) + if (func_data == NULL) return NET_NFC_ALLOC_FAIL; func_data->callback = (gpointer)callback; @@ -113,27 +108,23 @@ net_nfc_error_e net_nfc_client_sys_handler_set_state_sync(int state) net_nfc_error_e result = NET_NFC_OK; GError *error = NULL; - if (popup_proxy == NULL) - { - if(net_nfc_client_sys_handler_init() != NET_NFC_OK) - { + if (popup_proxy == NULL) { + if (net_nfc_client_sys_handler_init() != NET_NFC_OK) { DEBUG_ERR_MSG("popup_proxy fail"); return NET_NFC_NOT_INITIALIZED; } } /* prevent executing daemon when nfc is off */ - if (net_nfc_client_manager_is_activated() == false) { + if (net_nfc_client_manager_is_activated() == false) return NET_NFC_NOT_ACTIVATED; - } if (net_nfc_gdbus_popup_call_set_sync(popup_proxy, state, CHECK_FOREGROUND, &result, NULL, - &error) == FALSE) - { + &error) == FALSE) { DEBUG_ERR_MSG("can not call SetActive: %s", error->message); result = NET_NFC_IPC_FAIL; @@ -151,19 +142,16 @@ net_nfc_error_e net_nfc_client_sys_handler_set_state_force(int state, { NetNfcCallback *func_data; - if (popup_proxy == NULL) - { - if(net_nfc_client_sys_handler_init() != NET_NFC_OK) - { + if (popup_proxy == NULL) { + if (net_nfc_client_sys_handler_init() != NET_NFC_OK) { DEBUG_ERR_MSG("popup_proxy fail"); return NET_NFC_NOT_INITIALIZED; } } /* prevent executing daemon when nfc is off */ - if (net_nfc_client_manager_is_activated() == false) { + if (net_nfc_client_manager_is_activated() == false) return NET_NFC_NOT_ACTIVATED; - } func_data = g_try_new0(NetNfcCallback, 1); if (func_data == NULL) @@ -188,27 +176,23 @@ net_nfc_error_e net_nfc_client_sys_handler_set_state_force_sync(int state) net_nfc_error_e result; GError *error = NULL; - if (popup_proxy == NULL) - { - if(net_nfc_client_sys_handler_init() != NET_NFC_OK) - { + if (popup_proxy == NULL) { + if (net_nfc_client_sys_handler_init() != NET_NFC_OK) { DEBUG_ERR_MSG("popup_proxy fail"); return NET_NFC_NOT_INITIALIZED; } } /* prevent executing daemon when nfc is off */ - if (net_nfc_client_manager_is_activated() == false) { + if (net_nfc_client_manager_is_activated() == false) return NET_NFC_NOT_ACTIVATED; - } if (net_nfc_gdbus_popup_call_set_sync(popup_proxy, state, NO_CHECK_FOREGROUND, &result, NULL, - &error) == FALSE) - { + &error) == FALSE) { DEBUG_ERR_MSG("can not call SetActive: %s", error->message); result = NET_NFC_IPC_FAIL; @@ -251,17 +235,15 @@ net_nfc_error_e net_nfc_client_sys_handler_get_launch_popup_state( *state = NET_NFC_LAUNCH_APP_SELECT; if (popup_proxy == NULL) { - if(net_nfc_client_sys_handler_init() != NET_NFC_OK) - { + if (net_nfc_client_sys_handler_init() != NET_NFC_OK) { DEBUG_ERR_MSG("popup_proxy fail"); return NET_NFC_NOT_INITIALIZED; } } /* prevent executing daemon when nfc is off */ - if (net_nfc_client_manager_is_activated() == false) { + if (net_nfc_client_manager_is_activated() == false) return NET_NFC_NOT_ACTIVATED; - } if (net_nfc_gdbus_popup_call_get_sync(popup_proxy, &result, @@ -285,8 +267,7 @@ net_nfc_error_e net_nfc_client_sys_handler_init(void) { GError *error = NULL; - if (popup_proxy) - { + if (popup_proxy) { DEBUG_CLIENT_MSG("Already initialized"); return NET_NFC_OK; @@ -299,8 +280,7 @@ net_nfc_error_e net_nfc_client_sys_handler_init(void) "/org/tizen/NetNfcService/Popup", NULL, &error); - if (popup_proxy == NULL) - { + if (popup_proxy == NULL) { DEBUG_ERR_MSG("Can not create proxy : %s", error->message); g_error_free(error); @@ -312,8 +292,7 @@ net_nfc_error_e net_nfc_client_sys_handler_init(void) void net_nfc_client_sys_handler_deinit(void) { - if (popup_proxy) - { + if (popup_proxy) { g_object_unref(popup_proxy); popup_proxy = NULL; } diff --git a/src/net_nfc_client_tag.c b/src/net_nfc_client_tag.c index 6aceef1..a56b306 100755 --- a/src/net_nfc_client_tag.c +++ b/src/net_nfc_client_tag.c @@ -95,25 +95,16 @@ static gboolean tag_check_filter(net_nfc_target_type_e type) DEBUG_CLIENT_MSG("client filter = %d", client_filter); if (type >= NET_NFC_ISO14443_A_PICC && - type <= NET_NFC_MIFARE_DESFIRE_PICC) - { + type <= NET_NFC_MIFARE_DESFIRE_PICC) { converted = NET_NFC_ISO14443A_ENABLE; - } - else if (type >= NET_NFC_ISO14443_B_PICC && - type <= NET_NFC_ISO14443_BPRIME_PICC) - { + } else if (type >= NET_NFC_ISO14443_B_PICC && + type <= NET_NFC_ISO14443_BPRIME_PICC) { converted = NET_NFC_ISO14443B_ENABLE; - } - else if (type == NET_NFC_FELICA_PICC) - { + } else if (type == NET_NFC_FELICA_PICC) { converted = NET_NFC_FELICA_ENABLE; - } - else if (type == NET_NFC_JEWEL_PICC) - { + } else if (type == NET_NFC_JEWEL_PICC) { converted = NET_NFC_FELICA_ENABLE; - } - else if (type == NET_NFC_ISO15693_PICC) - { + } else if (type == NET_NFC_ISO15693_PICC) { converted = NET_NFC_ISO15693_ENABLE; } @@ -141,8 +132,7 @@ static void tag_get_info_list(guint8 *buffer, tmp_list = g_new0(net_nfc_tag_info_s, number_of_keys); current = tmp_list; - while (i < number_of_keys) - { + while (i < number_of_keys) { gchar *str = NULL; data_h value = NULL; @@ -164,8 +154,7 @@ static void tag_get_info_list(guint8 *buffer, pos++; value = NULL; - if (length > 0) - { + if (length > 0) { net_nfc_create_data(&value, pos, length); pos += length; } @@ -237,8 +226,7 @@ static void tag_is_tag_connected(GObject *source_object, &out_is_connected, (gint32 *)&out_dev_type, res, - &error) == FALSE) - { + &error) == FALSE) { DEBUG_ERR_MSG("Can not finish is_tag_connected: %s", error->message); g_error_free(error); @@ -246,8 +234,7 @@ static void tag_is_tag_connected(GObject *source_object, out_result = NET_NFC_IPC_FAIL; } - if (func_data->callback != NULL) - { + if (func_data->callback != NULL) { net_nfc_client_tag_is_tag_connected_completed callback = (net_nfc_client_tag_is_tag_connected_completed)func_data->callback; @@ -282,7 +269,7 @@ static void tag_get_current_tag_info(GObject *source_object, g_assert(user_data != NULL); - if (net_nfc_gdbus_tag_call_get_current_tag_info_finish ( + if (net_nfc_gdbus_tag_call_get_current_tag_info_finish( NET_NFC_GDBUS_TAG(source_object), &out_result, &out_is_connected, @@ -296,8 +283,7 @@ static void tag_get_current_tag_info(GObject *source_object, &out_target_info_values, &out_raw_data, res, - &error) == FALSE) - { + &error) == FALSE) { out_result = NET_NFC_IPC_FAIL; DEBUG_ERR_MSG("Can not finish get_current_tag_info: %s", @@ -327,8 +313,7 @@ static void tag_get_current_tag_info(GObject *source_object, } } - if (func_data->callback != NULL) - { + if (func_data->callback != NULL) { net_nfc_client_tag_get_current_tag_info_completed callback = (net_nfc_client_tag_get_current_tag_info_completed)func_data->callback; @@ -361,8 +346,7 @@ static void tag_get_current_target_handle(GObject *source_object, (guint *)&out_handle, (gint *)&out_dev_type, res, - &error) == FALSE) - { + &error) == FALSE) { DEBUG_ERR_MSG("Can not finish get_current_target_handle: %s", error->message); g_error_free(error); @@ -370,8 +354,7 @@ static void tag_get_current_target_handle(GObject *source_object, out_result = NET_NFC_IPC_FAIL; } - if (func_data->callback != NULL) - { + if (func_data->callback != NULL) { net_nfc_client_tag_get_current_target_handle_completed callback = (net_nfc_client_tag_get_current_target_handle_completed)func_data->callback; @@ -482,9 +465,8 @@ net_nfc_error_e net_nfc_client_tag_is_tag_connected_sync( return NET_NFC_NOT_INITIALIZED; /* prevent executing daemon when nfc is off */ - if (net_nfc_client_manager_is_activated() == false) { + if (net_nfc_client_manager_is_activated() == false) return NET_NFC_NOT_ACTIVATED; - } info = net_nfc_client_tag_get_client_target_info(); if (info == NULL) { @@ -494,8 +476,7 @@ net_nfc_error_e net_nfc_client_tag_is_tag_connected_sync( &out_is_connected, (gint *)&out_dev_type, NULL, - &error) == FALSE) - { + &error) == FALSE) { DEBUG_ERR_MSG("Can not get is_tag_connected result: %s", error->message); result = NET_NFC_IPC_FAIL; @@ -515,9 +496,8 @@ net_nfc_error_e net_nfc_client_tag_is_tag_connected_sync( } } else { /* target was connected */ - if (dev_type != NULL) { + if (dev_type != NULL) *dev_type = info->devType; - } result = NET_NFC_OK; } @@ -538,16 +518,14 @@ net_nfc_error_e net_nfc_client_barcode_get_barcode_sync( return NET_NFC_NOT_INITIALIZED; /* prevent executing daemon when nfc is off */ - if (net_nfc_client_manager_is_activated() == false) { + if (net_nfc_client_manager_is_activated() == false) return NET_NFC_NOT_ACTIVATED; - } if (net_nfc_gdbus_tag_call_get_barcode_sync(tag_proxy, &result, &out_barcode, NULL, - &error) == FALSE) - { + &error) == FALSE) { DEBUG_ERR_MSG("Can no get barcode result: %s", error->message); result = NET_NFC_IPC_FAIL; @@ -556,22 +534,20 @@ net_nfc_error_e net_nfc_client_barcode_get_barcode_sync( return result; } - if(result == NET_NFC_OK) - { + if (result == NET_NFC_OK) { data = g_new0(data_s, 1); net_nfc_util_gdbus_variant_to_data_s(out_barcode, data); - if(data == NULL || data->buffer == NULL || data->length == 0) + if (data == NULL || data->buffer == NULL || data->length == 0) return NET_NFC_OPERATION_FAIL; - //alloc barcode + /* alloc barcode */ *barcode_len = data->length; *barcode = (unsigned char *)calloc(*barcode_len, sizeof(unsigned char)); memcpy(*barcode, data->buffer, *barcode_len); - if (data != NULL) { + if (data != NULL) net_nfc_util_free_data(data); - } } return result; @@ -598,9 +574,8 @@ net_nfc_error_e net_nfc_client_tag_get_current_tag_info_sync( return NET_NFC_NOT_INITIALIZED; /* prevent executing daemon when nfc is off */ - if (net_nfc_client_manager_is_activated() == false) { + if (net_nfc_client_manager_is_activated() == false) return NET_NFC_NOT_ACTIVATED; - } if (net_nfc_client_tag_get_client_target_info() == NULL) { /* try to request target information from server */ @@ -617,8 +592,7 @@ net_nfc_error_e net_nfc_client_tag_get_current_tag_info_sync( &out_target_info_values, &out_raw_data, NULL, - &error) == FALSE) - { + &error) == FALSE) { DEBUG_ERR_MSG("Can no get current_tag_info result: %s", error->message); result = NET_NFC_IPC_FAIL; @@ -656,9 +630,8 @@ net_nfc_error_e net_nfc_client_tag_get_current_tag_info_sync( result = NET_NFC_OK; } - if (result == NET_NFC_OK && info != NULL) { + if (result == NET_NFC_OK && info != NULL) *info = client_target_info; - } return result; } @@ -678,9 +651,8 @@ net_nfc_error_e net_nfc_client_tag_get_current_target_handle_sync( return NET_NFC_NOT_INITIALIZED; /* prevent executing daemon when nfc is off */ - if (net_nfc_client_manager_is_activated() == false) { + if (net_nfc_client_manager_is_activated() == false) return NET_NFC_NOT_ACTIVATED; - } info = net_nfc_client_tag_get_client_target_info(); if (info == NULL) { @@ -691,8 +663,7 @@ net_nfc_error_e net_nfc_client_tag_get_current_target_handle_sync( &out_handle, (gint *)&out_dev_type, NULL, - &error) == FALSE) - { + &error) == FALSE) { DEBUG_ERR_MSG("Can no get current_target_handle result: %s", error->message); result = NET_NFC_IPC_FAIL; @@ -733,10 +704,8 @@ void net_nfc_client_tag_set_tag_discovered( if (callback == NULL) return; - if (tag_proxy == NULL) - { - if (net_nfc_client_tag_init() != NET_NFC_OK) - { + if (tag_proxy == NULL) { + if (net_nfc_client_tag_init() != NET_NFC_OK) { DEBUG_ERR_MSG("tag_proxy fail"); /* FIXME : return result of this error */ return; @@ -762,10 +731,8 @@ void net_nfc_client_tag_set_tag_detached( if (callback == NULL) return; - if (tag_proxy == NULL) - { - if (net_nfc_client_tag_init() != NET_NFC_OK) - { + if (tag_proxy == NULL) { + if (net_nfc_client_tag_init() != NET_NFC_OK) { DEBUG_ERR_MSG("tag_proxy fail"); /* FIXME : return result of this error */ return; @@ -799,15 +766,13 @@ net_nfc_error_e net_nfc_client_tag_init(void) { GError *error = NULL; - if (tag_proxy) - { + if (tag_proxy) { DEBUG_CLIENT_MSG("Alrady initialized"); return NET_NFC_OK; } - if (client_target_info) - { + if (client_target_info) { net_nfc_release_tag_info( (net_nfc_target_info_h)client_target_info); client_target_info = NULL; @@ -822,8 +787,7 @@ net_nfc_error_e net_nfc_client_tag_init(void) "/org/tizen/NetNfcService/Tag", NULL, &error); - if (tag_proxy == NULL) - { + if (tag_proxy == NULL) { DEBUG_ERR_MSG("Can not create proxy : %s", error->message); g_error_free(error); @@ -849,8 +813,7 @@ void net_nfc_client_tag_deinit(void) net_nfc_client_tag_unset_tag_discovered(); net_nfc_client_tag_unset_tag_detached(); - if (tag_proxy) - { + if (tag_proxy) { g_object_unref(tag_proxy); tag_proxy = NULL; } diff --git a/src/net_nfc_client_tag_felica.c b/src/net_nfc_client_tag_felica.c index 9d0226a..8fdd2df 100755 --- a/src/net_nfc_client_tag_felica.c +++ b/src/net_nfc_client_tag_felica.c @@ -53,15 +53,14 @@ net_nfc_error_e net_nfc_client_felica_poll(net_nfc_target_handle_h handle, if (handle == NULL) return NET_NFC_NULL_PARAMETER; - if(net_nfc_client_tag_is_connected() == FALSE) + if (net_nfc_client_tag_is_connected() == FALSE) return NET_NFC_OPERATION_FAIL; target_info = net_nfc_client_tag_get_client_target_info(); if (target_info == NULL) return NET_NFC_NO_DATA_FOUND; - if (target_info->devType != NET_NFC_FELICA_PICC) - { + if (target_info->devType != NET_NFC_FELICA_PICC) { DEBUG_CLIENT_MSG("only felica tag is available"); return NET_NFC_NOT_ALLOWED_OPERATION; } @@ -112,23 +111,21 @@ net_nfc_error_e net_nfc_client_felica_request_service( if (handle == NULL || area_service_list == NULL) return NET_NFC_NULL_PARAMETER; - if(net_nfc_client_tag_is_connected() == FALSE) + if (net_nfc_client_tag_is_connected() == FALSE) return NET_NFC_OPERATION_FAIL; target_info = net_nfc_client_tag_get_client_target_info(); if (target_info == NULL) return NET_NFC_NO_DATA_FOUND; - if (target_info->devType != NET_NFC_FELICA_PICC) - { + if (target_info->devType != NET_NFC_FELICA_PICC) { DEBUG_CLIENT_MSG("only felica tag is available"); return NET_NFC_NOT_ALLOWED_OPERATION; } if (net_nfc_get_tag_info_value((net_nfc_target_info_h)target_info, FELICA_TAG_KEY, - &IDm) != NET_NFC_OK) - { + &IDm) != NET_NFC_OK) { return NET_NFC_NO_DATA_FOUND; } @@ -163,8 +160,7 @@ net_nfc_error_e net_nfc_client_felica_request_service( *send_buffer = number_of_area_service; send_buffer++; - for (i = 0; i < number_of_services; i++) - { + for (i = 0; i < number_of_services; i++) { memcpy(send_buffer, &area_service_list[i], sizeof(uint16_t)); send_buffer = send_buffer + 2; } @@ -203,23 +199,21 @@ net_nfc_error_e net_nfc_client_felica_request_response( if (handle == NULL) return NET_NFC_NULL_PARAMETER; - if(net_nfc_client_tag_is_connected() == FALSE) + if (net_nfc_client_tag_is_connected() == FALSE) return NET_NFC_OPERATION_FAIL; target_info = net_nfc_client_tag_get_client_target_info(); if (target_info == NULL) return NET_NFC_NO_DATA_FOUND; - if (target_info->devType != NET_NFC_FELICA_PICC) - { + if (target_info->devType != NET_NFC_FELICA_PICC) { DEBUG_CLIENT_MSG("only felica tag is available"); return NET_NFC_NOT_ALLOWED_OPERATION; } if (net_nfc_get_tag_info_value((net_nfc_target_info_h)target_info, FELICA_TAG_KEY, - &IDm) != NET_NFC_OK) - { + &IDm) != NET_NFC_OK) { return NET_NFC_NO_DATA_FOUND; } @@ -269,23 +263,21 @@ net_nfc_error_e net_nfc_client_felica_read_without_encryption( if (handle == NULL || service_list == NULL || block_list == NULL) return NET_NFC_NULL_PARAMETER; - if(net_nfc_client_tag_is_connected() == FALSE) + if (net_nfc_client_tag_is_connected() == FALSE) return NET_NFC_OPERATION_FAIL; target_info = net_nfc_client_tag_get_client_target_info(); if (target_info == NULL) return NET_NFC_NO_DATA_FOUND; - if (target_info->devType != NET_NFC_FELICA_PICC) - { + if (target_info->devType != NET_NFC_FELICA_PICC) { DEBUG_CLIENT_MSG("only felica tag is available"); return NET_NFC_NOT_ALLOWED_OPERATION; } if (net_nfc_get_tag_info_value((net_nfc_target_info_h)target_info, FELICA_TAG_KEY, - &IDm) != NET_NFC_OK) - { + &IDm) != NET_NFC_OK) { return NET_NFC_NO_DATA_FOUND; } @@ -317,8 +309,7 @@ net_nfc_error_e net_nfc_client_felica_read_without_encryption( *send_buffer = number_of_services; send_buffer++; - for (i = 0; i < number_of_services; i++) - { + for (i = 0; i < number_of_services; i++) { memcpy(send_buffer, &service_list[i], sizeof(uint16_t)); send_buffer = send_buffer + 2; } @@ -326,8 +317,7 @@ net_nfc_error_e net_nfc_client_felica_read_without_encryption( *send_buffer = number_of_blocks; send_buffer++; - for (i = 0; i < number_of_blocks; i++) - { + for (i = 0; i < number_of_blocks; i++) { memcpy(send_buffer, &block_list[i], sizeof(uint8_t)); send_buffer++; } @@ -373,27 +363,24 @@ net_nfc_error_e net_nfc_client_felica_write_without_encryption( int i; if (handle == NULL || service_list == NULL || - block_list == NULL || data == NULL) - { + block_list == NULL || data == NULL) { return NET_NFC_NULL_PARAMETER; } - if(net_nfc_client_tag_is_connected() == FALSE) + if (net_nfc_client_tag_is_connected() == FALSE) return NET_NFC_OPERATION_FAIL; target_info = net_nfc_client_tag_get_client_target_info(); if (target_info == NULL) return NET_NFC_NO_DATA_FOUND; - if (target_info->devType != NET_NFC_FELICA_PICC) - { + if (target_info->devType != NET_NFC_FELICA_PICC) { DEBUG_CLIENT_MSG("only felica tag is available"); return NET_NFC_NOT_ALLOWED_OPERATION; } if (net_nfc_get_tag_info_value((net_nfc_target_info_h)target_info, FELICA_TAG_KEY, - &IDm) != NET_NFC_OK) - { + &IDm) != NET_NFC_OK) { return NET_NFC_NO_DATA_FOUND; } @@ -429,8 +416,7 @@ net_nfc_error_e net_nfc_client_felica_write_without_encryption( *send_buffer = number_of_services; send_buffer++; - for (i = 0; i < number_of_services; i++) - { + for (i = 0; i < number_of_services; i++) { memcpy(send_buffer, &service_list[i], sizeof(uint16_t)); send_buffer = send_buffer + 2; } @@ -438,8 +424,7 @@ net_nfc_error_e net_nfc_client_felica_write_without_encryption( *send_buffer = number_of_blocks; send_buffer++; - for (i = 0; i < number_of_blocks; i++) - { + for (i = 0; i < number_of_blocks; i++) { memcpy(send_buffer, &block_list[i], sizeof(uint8_t)); send_buffer++; } @@ -481,23 +466,21 @@ net_nfc_error_e net_nfc_client_felica_request_system_code( if (handle == NULL) return NET_NFC_NULL_PARAMETER; - if(net_nfc_client_tag_is_connected() == FALSE) + if (net_nfc_client_tag_is_connected() == FALSE) return NET_NFC_OPERATION_FAIL; target_info = net_nfc_client_tag_get_client_target_info(); if (target_info == NULL) return NET_NFC_NO_DATA_FOUND; - if (target_info->devType != NET_NFC_FELICA_PICC) - { + if (target_info->devType != NET_NFC_FELICA_PICC) { DEBUG_CLIENT_MSG("only felica tag is available"); return NET_NFC_NOT_ALLOWED_OPERATION; } if (net_nfc_get_tag_info_value((net_nfc_target_info_h)target_info, FELICA_TAG_KEY, - &IDm) != NET_NFC_OK) - { + &IDm) != NET_NFC_OK) { return NET_NFC_NO_DATA_FOUND; } diff --git a/src/net_nfc_client_tag_jewel.c b/src/net_nfc_client_tag_jewel.c index c044c5a..4763301 100755 --- a/src/net_nfc_client_tag_jewel.c +++ b/src/net_nfc_client_tag_jewel.c @@ -51,18 +51,17 @@ net_nfc_error_e net_nfc_client_jewel_read_id(net_nfc_target_handle_h handle, uint8_t send_buffer[9] = {0x00, }; - if(handle == NULL) + if (handle == NULL) return NET_NFC_NULL_PARAMETER; - if(net_nfc_client_tag_is_connected() == FALSE) + if (net_nfc_client_tag_is_connected() == FALSE) return NET_NFC_OPERATION_FAIL; target_info = net_nfc_client_tag_get_client_target_info(); if (target_info == NULL) return NET_NFC_NO_DATA_FOUND; - if(target_info->devType != NET_NFC_JEWEL_PICC) - { + if (target_info->devType != NET_NFC_JEWEL_PICC) { DEBUG_CLIENT_MSG("only Jewel tag is available"); return NET_NFC_NOT_ALLOWED_OPERATION; } @@ -97,34 +96,32 @@ net_nfc_error_e net_nfc_client_jewel_read_byte(net_nfc_target_handle_h handle, uint8_t send_buffer[9] = {0x00, }; - if(handle == NULL) + if (handle == NULL) return NET_NFC_NULL_PARAMETER; - if(block > 0xE || byte > 0x7 ) + if (block > 0xE || byte > 0x7) return NET_NFC_OUT_OF_BOUND; - if(net_nfc_client_tag_is_connected() == FALSE) + if (net_nfc_client_tag_is_connected() == FALSE) return NET_NFC_OPERATION_FAIL; target_info = net_nfc_client_tag_get_client_target_info(); if (target_info == NULL) return NET_NFC_NO_DATA_FOUND; - if(target_info->devType != NET_NFC_JEWEL_PICC) - { + if (target_info->devType != NET_NFC_JEWEL_PICC) { DEBUG_CLIENT_MSG("only Jewel tag is available"); return NET_NFC_NOT_ALLOWED_OPERATION; } - if(net_nfc_get_tag_info_value((net_nfc_target_info_h)target_info, + if (net_nfc_get_tag_info_value((net_nfc_target_info_h)target_info, JEWEL_TAG_KEY, - &UID) != NET_NFC_OK) - { + &UID) != NET_NFC_OK) { return NET_NFC_NO_DATA_FOUND; } - if(((data_s*)UID)->length != 4) + if (((data_s*)UID)->length != 4) return NET_NFC_OUT_OF_BOUND; /* command */ @@ -167,30 +164,28 @@ net_nfc_error_e net_nfc_client_jewel_read_all(net_nfc_target_handle_h handle, uint8_t send_buffer[9] = {0x00, }; - if(handle == NULL ) + if (handle == NULL) return NET_NFC_NULL_PARAMETER; - if(net_nfc_client_tag_is_connected() == FALSE) + if (net_nfc_client_tag_is_connected() == FALSE) return NET_NFC_OPERATION_FAIL; target_info = net_nfc_client_tag_get_client_target_info(); if (target_info == NULL) return NET_NFC_NO_DATA_FOUND; - if(target_info->devType != NET_NFC_JEWEL_PICC) - { + if (target_info->devType != NET_NFC_JEWEL_PICC) { DEBUG_CLIENT_MSG("only Jewel tag is available"); return NET_NFC_NOT_ALLOWED_OPERATION; } - if(net_nfc_get_tag_info_value((net_nfc_target_info_h)target_info, + if (net_nfc_get_tag_info_value((net_nfc_target_info_h)target_info, JEWEL_TAG_KEY, - &UID) != NET_NFC_OK) - { + &UID) != NET_NFC_OK) { return NET_NFC_NO_DATA_FOUND; } - if(((data_s*)UID)->length != 4) + if (((data_s*)UID)->length != 4) return NET_NFC_OUT_OF_BOUND; /* command */ @@ -237,28 +232,26 @@ net_nfc_error_e net_nfc_client_jewel_write_with_erase( uint8_t send_buffer[9] = {0x00, }; - if(handle == NULL) + if (handle == NULL) return NET_NFC_NULL_PARAMETER; - if(block > 0xE || byte > 0x7 ) + if (block > 0xE || byte > 0x7) return NET_NFC_OUT_OF_BOUND; - if(net_nfc_client_tag_is_connected() == FALSE) + if (net_nfc_client_tag_is_connected() == FALSE) return NET_NFC_OPERATION_FAIL; - target_info = net_nfc_client_tag_get_client_target_info(); if (target_info == NULL) return NET_NFC_NO_DATA_FOUND; - if(net_nfc_get_tag_info_value((net_nfc_target_info_h)target_info, + if (net_nfc_get_tag_info_value((net_nfc_target_info_h)target_info, JEWEL_TAG_KEY, - &UID) != NET_NFC_OK) - { + &UID) != NET_NFC_OK) { return NET_NFC_NO_DATA_FOUND; } - if(((data_s*)UID)->length != 4) + if (((data_s*)UID)->length != 4) return NET_NFC_OUT_OF_BOUND; /* command */ @@ -306,33 +299,31 @@ net_nfc_error_e net_nfc_client_jewel_write_with_no_erase( uint8_t send_buffer[9] = {0x00, }; - if(handle == NULL) + if (handle == NULL) return NET_NFC_NULL_PARAMETER; - if(block > 0xE || byte > 0x7 ) + if (block > 0xE || byte > 0x7) return NET_NFC_OUT_OF_BOUND; - if(net_nfc_client_tag_is_connected() == FALSE) + if (net_nfc_client_tag_is_connected() == FALSE) return NET_NFC_OPERATION_FAIL; target_info = net_nfc_client_tag_get_client_target_info(); if (target_info == NULL) return NET_NFC_NO_DATA_FOUND; - if(target_info->devType != NET_NFC_JEWEL_PICC) - { + if (target_info->devType != NET_NFC_JEWEL_PICC) { DEBUG_CLIENT_MSG("only Jewel tag is available"); return NET_NFC_NOT_ALLOWED_OPERATION; } - if(net_nfc_get_tag_info_value((net_nfc_target_info_h)target_info, + if (net_nfc_get_tag_info_value((net_nfc_target_info_h)target_info, JEWEL_TAG_KEY, - &UID) != NET_NFC_OK) - { + &UID) != NET_NFC_OK) { return NET_NFC_NO_DATA_FOUND; } - if(((data_s*)UID)->length != 4) + if (((data_s*)UID)->length != 4) return NET_NFC_OUT_OF_BOUND; /* command */ diff --git a/src/net_nfc_client_tag_mifare.c b/src/net_nfc_client_tag_mifare.c index c98e39e..bfc3913 100755 --- a/src/net_nfc_client_tag_mifare.c +++ b/src/net_nfc_client_tag_mifare.c @@ -97,11 +97,9 @@ net_nfc_error_e net_nfc_client_mifare_authenticate_with_keyA( target_info = net_nfc_client_tag_get_client_target_info(); - if (target_info) - { + if (target_info) { if (target_info->devType < NET_NFC_MIFARE_MINI_PICC || - target_info->devType > NET_NFC_MIFARE_4K_PICC) - { + target_info->devType > NET_NFC_MIFARE_4K_PICC) { DEBUG_CLIENT_MSG("not a MIFARE Classic TAG"); return NET_NFC_NOT_SUPPORTED; } @@ -109,14 +107,12 @@ net_nfc_error_e net_nfc_client_mifare_authenticate_with_keyA( if (net_nfc_get_tag_info_value((net_nfc_target_info_h)target_info, MIFARE_TAG_KEY, - &UID) != NET_NFC_OK) - { + &UID) != NET_NFC_OK) { return NET_NFC_NO_DATA_FOUND; } - switch (target_info->devType) - { - case NET_NFC_MIFARE_MINI_PICC : + switch (target_info->devType) { + case NET_NFC_MIFARE_MINI_PICC: { /* 0 ~ 4 : 5 sector and 4 block with 16 bytes */ if (sector > MIFARE_MINI_SECTORS - 1) @@ -125,7 +121,7 @@ net_nfc_error_e net_nfc_client_mifare_authenticate_with_keyA( sector_to_block = sector * MIFARE_BLOCK_4 + 3; } break; - case NET_NFC_MIFARE_1K_PICC : + case NET_NFC_MIFARE_1K_PICC: { /* 0 ~ 15 : 16 sector and 4 block with 16 bytes */ if (sector > MIFARE_1K_SECTORS) @@ -134,7 +130,7 @@ net_nfc_error_e net_nfc_client_mifare_authenticate_with_keyA( sector_to_block = sector * MIFARE_BLOCK_4 + 3; } break; - case NET_NFC_MIFARE_4K_PICC : + case NET_NFC_MIFARE_4K_PICC: { /* 0 ~ 31 : 32 sector and 4 block with 16 bytes * 32 ~ 39 : 8 sector and 16 block with 16 bytes @@ -144,15 +140,14 @@ net_nfc_error_e net_nfc_client_mifare_authenticate_with_keyA( if (sector < 32) sector_to_block = sector * MIFARE_BLOCK_4 + 3; - else - { + else { sector_to_block = (31 * MIFARE_BLOCK_4 + 3) + (sector - 32) * MIFARE_BLOCK_16 + 15; } } break; - default : + default: break; } @@ -163,8 +158,7 @@ net_nfc_error_e net_nfc_client_mifare_authenticate_with_keyA( _net_nfc_util_alloc_mem(send_buffer, send_buffer_length * sizeof(uint8_t)); - if (send_buffer == NULL) - { + if (send_buffer == NULL) { net_nfc_free_data(UID); return NET_NFC_ALLOC_FAIL; } @@ -235,11 +229,9 @@ net_nfc_error_e net_nfc_client_mifare_authenticate_with_keyB( target_info = net_nfc_client_tag_get_client_target_info(); - if (target_info != NULL) - { + if (target_info != NULL) { if (target_info->devType < NET_NFC_MIFARE_MINI_PICC || - target_info->devType > NET_NFC_MIFARE_4K_PICC) - { + target_info->devType > NET_NFC_MIFARE_4K_PICC) { DEBUG_CLIENT_MSG("not a MIFARE Classic TAG"); return NET_NFC_NOT_SUPPORTED; } @@ -247,14 +239,12 @@ net_nfc_error_e net_nfc_client_mifare_authenticate_with_keyB( if (net_nfc_get_tag_info_value((net_nfc_target_info_h)target_info, MIFARE_TAG_KEY, - &UID) != NET_NFC_OK) - { + &UID) != NET_NFC_OK) { return NET_NFC_NO_DATA_FOUND; } - switch (target_info->devType) - { - case NET_NFC_MIFARE_MINI_PICC : + switch (target_info->devType) { + case NET_NFC_MIFARE_MINI_PICC: { /* 0 ~ 4 : 5 sector and 4 block with 16 bytes */ if (sector > MIFARE_MINI_SECTORS) @@ -263,7 +253,7 @@ net_nfc_error_e net_nfc_client_mifare_authenticate_with_keyB( sector_to_block = sector * MIFARE_BLOCK_4 + 3; } break; - case NET_NFC_MIFARE_1K_PICC : + case NET_NFC_MIFARE_1K_PICC: { /* 0 ~ 15 : 16 sector and 4 block with 16 bytes */ if (sector > MIFARE_1K_SECTORS) @@ -272,7 +262,7 @@ net_nfc_error_e net_nfc_client_mifare_authenticate_with_keyB( sector_to_block = sector * MIFARE_BLOCK_4 + 3; } break; - case NET_NFC_MIFARE_4K_PICC : + case NET_NFC_MIFARE_4K_PICC: { /* 0 ~ 31 : 32 sector and 4 block with 16 bytes * 32 ~ 39 : 8 sector and 16 block with 16 bytes @@ -282,15 +272,14 @@ net_nfc_error_e net_nfc_client_mifare_authenticate_with_keyB( if (sector < 32) sector_to_block = sector * MIFARE_BLOCK_4 + 3; - else - { + else { sector_to_block = (31 * MIFARE_BLOCK_4 + 3) + (sector - 32) * MIFARE_BLOCK_16 + 15; } } break; - default : + default: break; } @@ -299,8 +288,7 @@ net_nfc_error_e net_nfc_client_mifare_authenticate_with_keyB( _net_nfc_util_alloc_mem(send_buffer, send_buffer_length * sizeof(uint8_t)); - if (send_buffer == NULL) - { + if (send_buffer == NULL) { net_nfc_free_data(UID); return NET_NFC_ALLOC_FAIL; } @@ -355,18 +343,15 @@ net_nfc_error_e net_nfc_client_mifare_read(net_nfc_target_handle_h handle, target_info = net_nfc_client_tag_get_client_target_info(); - if (target_info != NULL) - { + if (target_info != NULL) { if (target_info->devType < NET_NFC_MIFARE_MINI_PICC || - target_info->devType > NET_NFC_MIFARE_ULTRA_PICC) - { + target_info->devType > NET_NFC_MIFARE_ULTRA_PICC) { DEBUG_CLIENT_MSG("not a MIFARE TAG = [%d]", target_info->devType); return NET_NFC_NOT_SUPPORTED; } - if (target_info->devType == NET_NFC_MIFARE_ULTRA_PICC) - { + if (target_info->devType == NET_NFC_MIFARE_ULTRA_PICC) { if (addr > 7) return NET_NFC_OUT_OF_BOUND; } @@ -416,23 +401,19 @@ net_nfc_error_e net_nfc_client_mifare_write_block( return NET_NFC_NOT_INITIALIZED; if (target_info->devType < NET_NFC_MIFARE_MINI_PICC || - target_info->devType > NET_NFC_MIFARE_ULTRA_PICC) - { + target_info->devType > NET_NFC_MIFARE_ULTRA_PICC) { DEBUG_CLIENT_MSG("not a MIFARE TAG = [%d] ", target_info->devType); return NET_NFC_NOT_SUPPORTED; } - if (target_info->devType == NET_NFC_MIFARE_ULTRA_PICC) - { + if (target_info->devType == NET_NFC_MIFARE_ULTRA_PICC) { if (addr > 7) return NET_NFC_OUT_OF_BOUND; } - if (target_info->devType == NET_NFC_MIFARE_ULTRA_PICC) - { - if (((data_s *)data)->length > MIFARE_PAGE_SIZE) - { + if (target_info->devType == NET_NFC_MIFARE_ULTRA_PICC) { + if (((data_s *)data)->length > MIFARE_PAGE_SIZE) { uint8_t* temp = NULL; /* cmd + addr + page */ @@ -455,9 +436,7 @@ net_nfc_error_e net_nfc_client_mifare_write_block( ((data_s*)data)->buffer, MIFARE_PAGE_SIZE); - } - else - { + } else { uint8_t* temp = NULL; /* cmd + addr + page */ @@ -482,12 +461,8 @@ net_nfc_error_e net_nfc_client_mifare_write_block( ((data_s*)data)->length); } - } - else - { - - if (((data_s*)data)->length > MIFARE_BLOCK_SIZE) - { + } else { + if (((data_s*)data)->length > MIFARE_BLOCK_SIZE) { uint8_t* temp = NULL; /* cmd + addr + page*/ @@ -509,9 +484,7 @@ net_nfc_error_e net_nfc_client_mifare_write_block( memcpy(temp, ((data_s*)data)->buffer, MIFARE_BLOCK_SIZE); - } - else - { + } else { uint8_t* temp = NULL; /* cmd + addr + page */ @@ -577,23 +550,19 @@ net_nfc_error_e net_nfc_client_mifare_write_page( return NET_NFC_NOT_INITIALIZED; if (target_info->devType < NET_NFC_MIFARE_MINI_PICC || - target_info->devType > NET_NFC_MIFARE_ULTRA_PICC) - { + target_info->devType > NET_NFC_MIFARE_ULTRA_PICC) { DEBUG_CLIENT_MSG("not a MIFARE TAG = [%d] ", target_info->devType); return NET_NFC_NOT_SUPPORTED; } - if (target_info->devType == NET_NFC_MIFARE_ULTRA_PICC) - { + if (target_info->devType == NET_NFC_MIFARE_ULTRA_PICC) { if (addr > 7) return NET_NFC_OUT_OF_BOUND; } - if (target_info->devType == NET_NFC_MIFARE_ULTRA_PICC) - { - if (((data_s*)data)->length > MIFARE_PAGE_SIZE) - { + if (target_info->devType == NET_NFC_MIFARE_ULTRA_PICC) { + if (((data_s*)data)->length > MIFARE_PAGE_SIZE) { uint8_t* temp = NULL; /* cmd + addr + page */ @@ -615,9 +584,7 @@ net_nfc_error_e net_nfc_client_mifare_write_page( memcpy(temp, ((data_s*)data)->buffer, MIFARE_PAGE_SIZE); - } - else - { + } else { uint8_t* temp = NULL; /* cmd + addr + page */ @@ -641,11 +608,8 @@ net_nfc_error_e net_nfc_client_mifare_write_page( ((data_s*)data)->length); } - } - else - { - if (((data_s*)data)->length > MIFARE_PAGE_SIZE) - { + } else { + if (((data_s*)data)->length > MIFARE_PAGE_SIZE) { uint8_t* temp = NULL; /* cmd + addr + page */ @@ -668,9 +632,7 @@ net_nfc_error_e net_nfc_client_mifare_write_page( ((data_s*)data)->buffer, MIFARE_PAGE_SIZE); - } - else - { + } else { uint8_t* temp = NULL; /* cmd + addr + page */ @@ -735,11 +697,9 @@ net_nfc_error_e net_nfc_client_mifare_increment(net_nfc_target_handle_h handle, target_info = net_nfc_client_tag_get_client_target_info(); - if (target_info) - { + if (target_info) { if (target_info->devType < NET_NFC_MIFARE_MINI_PICC || - target_info->devType > NET_NFC_MIFARE_4K_PICC) - { + target_info->devType > NET_NFC_MIFARE_4K_PICC) { DEBUG_CLIENT_MSG( "not a MIFARE Classic TAG = [%d]", target_info->devType); @@ -788,12 +748,10 @@ net_nfc_error_e net_nfc_client_mifare_decrement(net_nfc_target_handle_h handle, target_info = net_nfc_client_tag_get_client_target_info(); - if (target_info) - { + if (target_info) { if (target_info->devType < NET_NFC_MIFARE_MINI_PICC || - target_info->devType > NET_NFC_MIFARE_4K_PICC) - { + target_info->devType > NET_NFC_MIFARE_4K_PICC) { DEBUG_CLIENT_MSG("not a MIFARE Classic TAG = [%d] ", target_info->devType); return NET_NFC_NOT_SUPPORTED; @@ -841,11 +799,9 @@ net_nfc_error_e net_nfc_client_mifare_transfer(net_nfc_target_handle_h handle, target_info = net_nfc_client_tag_get_client_target_info(); - if (target_info) - { + if (target_info) { if (target_info->devType < NET_NFC_MIFARE_MINI_PICC || - target_info->devType > NET_NFC_MIFARE_4K_PICC) - { + target_info->devType > NET_NFC_MIFARE_4K_PICC) { DEBUG_CLIENT_MSG("not a MIFARE Classic TAG = [%d]", target_info->devType); return NET_NFC_NOT_SUPPORTED; @@ -884,11 +840,9 @@ net_nfc_error_e net_nfc_client_mifare_restore(net_nfc_target_handle_h handle, target_info = net_nfc_client_tag_get_client_target_info(); - if (target_info) - { + if (target_info) { if (target_info->devType < NET_NFC_MIFARE_MINI_PICC || - target_info->devType > NET_NFC_MIFARE_4K_PICC) - { + target_info->devType > NET_NFC_MIFARE_4K_PICC) { DEBUG_CLIENT_MSG("not a MIFARE Classic TAG = [%d]", target_info->devType); return NET_NFC_NOT_SUPPORTED; diff --git a/src/net_nfc_client_target_info.c b/src/net_nfc_client_target_info.c index 3dd77de..74203fa 100755 --- a/src/net_nfc_client_target_info.c +++ b/src/net_nfc_client_target_info.c @@ -35,16 +35,12 @@ net_nfc_error_e net_nfc_get_tag_type(net_nfc_target_info_h target_info, (net_nfc_target_info_s *)target_info; if (type == NULL) - { return NET_NFC_NULL_PARAMETER; - } *type = NET_NFC_UNKNOWN_TARGET; if (target_info == NULL) - { return NET_NFC_INVALID_HANDLE; - } *type = target_info_private->devType; @@ -59,16 +55,12 @@ net_nfc_error_e net_nfc_get_tag_handle(net_nfc_target_info_h target_info, (net_nfc_target_info_s *)target_info; if (handle == NULL) - { return NET_NFC_NULL_PARAMETER; - } *handle = NULL; if (target_info == NULL) - { return NET_NFC_INVALID_HANDLE; - } *handle = (net_nfc_target_handle_h)target_info_private->handle; @@ -83,9 +75,7 @@ net_nfc_error_e net_nfc_get_tag_ndef_support(net_nfc_target_info_h target_info, (net_nfc_target_info_s *)target_info; if (target_info == NULL || is_support == NULL) - { return NET_NFC_NULL_PARAMETER; - } *is_support = (bool)target_info_private->is_ndef_supported; @@ -100,9 +90,7 @@ net_nfc_error_e net_nfc_get_tag_ndef_state(net_nfc_target_info_h target_info, (net_nfc_target_info_s *)target_info; if (target_info == NULL || state == NULL) - { return NET_NFC_NULL_PARAMETER; - } *state = (net_nfc_ndef_card_state_e)target_info_private->ndefCardState; @@ -117,9 +105,7 @@ net_nfc_error_e net_nfc_get_tag_max_data_size(net_nfc_target_info_h target_info, (net_nfc_target_info_s *)target_info; if (target_info == NULL || max_size == NULL) - { return NET_NFC_NULL_PARAMETER; - } *max_size = target_info_private->maxDataSize; @@ -134,9 +120,7 @@ net_nfc_error_e net_nfc_get_tag_actual_data_size( (net_nfc_target_info_s *)target_info; if (target_info == NULL || actual_data == NULL) - { return NET_NFC_NULL_PARAMETER; - } *actual_data = target_info_private->actualDataSize; @@ -151,24 +135,17 @@ net_nfc_error_e net_nfc_get_tag_info_keys(net_nfc_target_info_h target_info, int i = 0; if (keys == NULL || number_of_keys == NULL || target_info == NULL) - { return NET_NFC_NULL_PARAMETER; - } if (handle->tag_info_list == NULL) - { return NET_NFC_NO_DATA_FOUND; - } if (handle->number_of_keys <= 0) - { return NET_NFC_NO_DATA_FOUND; - } DEBUG_CLIENT_MSG("number of keys = [%d]", handle->number_of_keys); - if (handle->keylist != NULL) - { + if (handle->keylist != NULL) { *number_of_keys = handle->number_of_keys; *keys = handle->keylist; @@ -184,9 +161,7 @@ net_nfc_error_e net_nfc_get_tag_info_keys(net_nfc_target_info_h target_info, net_nfc_tag_info_s *tag_info = handle->tag_info_list; for (; i < handle->number_of_keys; i++, tag_info++) - { (*keys)[i] = tag_info->key; - } *number_of_keys = handle->number_of_keys; @@ -204,29 +179,20 @@ net_nfc_error_e net_nfc_get_tag_info_value(net_nfc_target_info_h target_info, net_nfc_tag_info_s *tag_info; if (target_info == NULL || key == NULL || value == NULL) - { return NET_NFC_NULL_PARAMETER; - } if (handle->tag_info_list == NULL) - { return NET_NFC_NO_DATA_FOUND; - } int i = 0; tag_info = handle->tag_info_list; - for (; i < handle->number_of_keys; i++, tag_info++) - { - if (strcmp(key, tag_info->key) == 0) - { - if (tag_info->value == NULL) - { + for (; i < handle->number_of_keys; i++, tag_info++) { + if (strcmp(key, tag_info->key) == 0) { + if (tag_info->value == NULL) { return NET_NFC_NO_DATA_FOUND; - } - else - { + } else { *value = tag_info->value; break; } @@ -248,9 +214,7 @@ net_nfc_error_e net_nfc_get_tag_ndef_message(net_nfc_target_info_h target_info, net_nfc_error_e result; if (target_info == NULL || msg == NULL) - { return NET_NFC_NULL_PARAMETER; - } result = net_nfc_create_ndef_message_from_rawdata(msg, (data_h)&target_info_private->raw_data); @@ -266,15 +230,11 @@ net_nfc_error_e net_nfc_duplicate_target_info(net_nfc_target_info_h origin, net_nfc_target_info_s *temp = NULL; if (handle == NULL || result == NULL) - { return NET_NFC_NULL_PARAMETER; - } _net_nfc_util_alloc_mem(temp, sizeof(net_nfc_target_info_s)); if (temp == NULL) - { return NET_NFC_ALLOC_FAIL; - } temp->ndefCardState = handle->ndefCardState; temp->actualDataSize = handle->actualDataSize; @@ -284,24 +244,20 @@ net_nfc_error_e net_nfc_duplicate_target_info(net_nfc_target_info_h origin, temp->is_ndef_supported = handle->is_ndef_supported; temp->number_of_keys = handle->number_of_keys; - if (temp->number_of_keys > 0) - { + if (temp->number_of_keys > 0) { int i; _net_nfc_util_alloc_mem(temp->tag_info_list, temp->number_of_keys * sizeof(net_nfc_tag_info_s)); - if (temp->tag_info_list == NULL) - { + if (temp->tag_info_list == NULL) { _net_nfc_util_free_mem(temp); return NET_NFC_ALLOC_FAIL; } - for (i = 0; i < handle->number_of_keys; i++) - { + for (i = 0; i < handle->number_of_keys; i++) { if (handle->tag_info_list[i].key != NULL) _net_nfc_util_strdup(temp->tag_info_list[i].key, handle->tag_info_list[i].key); - if (handle->tag_info_list[i].value != NULL) - { + if (handle->tag_info_list[i].value != NULL) { data_s *data = (data_s *)handle->tag_info_list[i].value; net_nfc_create_data(&temp->tag_info_list[i].value, data->buffer, data->length); @@ -309,8 +265,7 @@ net_nfc_error_e net_nfc_duplicate_target_info(net_nfc_target_info_h origin, } } - if (handle->raw_data.length > 0) - { + if (handle->raw_data.length > 0) { net_nfc_util_init_data(&temp->raw_data, handle->raw_data.length); memcpy(temp->raw_data.buffer, handle->raw_data.buffer, temp->raw_data.length); } @@ -328,12 +283,10 @@ static net_nfc_error_e _release_tag_info(net_nfc_target_info_s *info) return NET_NFC_NULL_PARAMETER; list = info->tag_info_list; - if (list != NULL) - { + if (list != NULL) { int i; - for (i = 0; i < info->number_of_keys; i++, list++) - { + for (i = 0; i < info->number_of_keys; i++, list++) { if (list->key != NULL) _net_nfc_util_free_mem(list->key); @@ -345,9 +298,7 @@ static net_nfc_error_e _release_tag_info(net_nfc_target_info_s *info) } if (info->keylist != NULL) - { _net_nfc_util_free_mem(info->keylist); - } net_nfc_util_clear_data(&info->raw_data); diff --git a/src/net_nfc_client_test.c b/src/net_nfc_client_test.c index b37e429..0f49649 100755 --- a/src/net_nfc_client_test.c +++ b/src/net_nfc_client_test.c @@ -63,8 +63,7 @@ static void test_call_sim_test_callback(GObject *source_object, NET_NFC_GDBUS_TEST(source_object), (gint *)&out_result, res, - &error) == FALSE) - { + &error) == FALSE) { DEBUG_ERR_MSG("Can not finish sim_test: %s", error->message); out_result = NET_NFC_IPC_FAIL; @@ -72,8 +71,7 @@ static void test_call_sim_test_callback(GObject *source_object, g_error_free(error); } - if (func_data->callback != NULL) - { + if (func_data->callback != NULL) { net_nfc_client_test_sim_test_completed callback = (net_nfc_client_test_sim_test_completed)func_data->callback; @@ -97,8 +95,7 @@ static void test_call_prbs_test_callback(GObject *source_object, NET_NFC_GDBUS_TEST(source_object), (gint *)&out_result, res, - &error) == FALSE) - { + &error) == FALSE) { DEBUG_ERR_MSG("Can not finish prbs test: %s", error->message); out_result = NET_NFC_IPC_FAIL; @@ -106,8 +103,7 @@ static void test_call_prbs_test_callback(GObject *source_object, g_error_free(error); } - if (func_data->callback != NULL) - { + if (func_data->callback != NULL) { net_nfc_client_test_prbs_test_completed callback = (net_nfc_client_test_prbs_test_completed)func_data->callback; @@ -133,8 +129,7 @@ static void test_call_get_firmware_version_callback(GObject *source_object, (gint *)&out_result, &out_version, res, - &error) == FALSE) - { + &error) == FALSE) { DEBUG_ERR_MSG("Can not finish get_firmware_version: %s", error->message); out_result = NET_NFC_IPC_FAIL; @@ -142,8 +137,7 @@ static void test_call_get_firmware_version_callback(GObject *source_object, g_error_free(error); } - if (func_data->callback != NULL) - { + if (func_data->callback != NULL) { net_nfc_client_test_get_firmware_version_completed callback = (net_nfc_client_test_get_firmware_version_completed)func_data->callback; @@ -168,8 +162,7 @@ static void test_call_set_ee_data_callback(GObject *source_object, NET_NFC_GDBUS_TEST(source_object), (gint *)&out_result, res, - &error) == FALSE) - { + &error) == FALSE) { DEBUG_ERR_MSG("Can not finish set_ee_data: %s", error->message); out_result = NET_NFC_IPC_FAIL; @@ -177,8 +170,7 @@ static void test_call_set_ee_data_callback(GObject *source_object, g_error_free(error); } - if (func_data->callback != NULL) - { + if (func_data->callback != NULL) { net_nfc_client_test_set_ee_data_completed callback = (net_nfc_client_test_set_ee_data_completed)func_data->callback; @@ -202,8 +194,7 @@ static void test_call_ese_test_callback(GObject *source_object, NET_NFC_GDBUS_TEST(source_object), (gint *)&out_result, res, - &error) == FALSE) - { + &error) == FALSE) { DEBUG_ERR_MSG("Can not finish sim_test: %s", error->message); out_result = NET_NFC_IPC_FAIL; @@ -211,8 +202,7 @@ static void test_call_ese_test_callback(GObject *source_object, g_error_free(error); } - if (func_data->callback != NULL) - { + if (func_data->callback != NULL) { net_nfc_client_test_ese_test_completed callback = (net_nfc_client_test_ese_test_completed)func_data->callback; @@ -230,19 +220,16 @@ net_nfc_error_e net_nfc_client_test_sim_test( { NetNfcCallback *func_data; - if (test_proxy == NULL) - { - if(net_nfc_client_test_init() != NET_NFC_OK) - { + if (test_proxy == NULL) { + if (net_nfc_client_test_init() != NET_NFC_OK) { DEBUG_ERR_MSG("test_proxy fail"); return NET_NFC_NOT_INITIALIZED; } } /* prevent executing daemon when nfc is off */ - if (net_nfc_client_manager_is_activated() == false) { + if (net_nfc_client_manager_is_activated() == false) return NET_NFC_NOT_ACTIVATED; - } func_data = g_try_new0(NetNfcCallback, 1); if (func_data == NULL) @@ -265,25 +252,21 @@ net_nfc_error_e net_nfc_client_test_sim_test_sync(void) net_nfc_error_e out_result = NET_NFC_OK; GError *error = NULL; - if (test_proxy == NULL) - { - if(net_nfc_client_test_init() != NET_NFC_OK) - { + if (test_proxy == NULL) { + if (net_nfc_client_test_init() != NET_NFC_OK) { DEBUG_ERR_MSG("test_proxy fail"); return NET_NFC_NOT_INITIALIZED; } } /* prevent executing daemon when nfc is off */ - if (net_nfc_client_manager_is_activated() == false) { + if (net_nfc_client_manager_is_activated() == false) return NET_NFC_NOT_ACTIVATED; - } if (net_nfc_gdbus_test_call_sim_test_sync(test_proxy, (gint *)&out_result, NULL, - &error) == FALSE) - { + &error) == FALSE) { DEBUG_ERR_MSG("can not call SimTest: %s", error->message); out_result = NET_NFC_IPC_FAIL; @@ -302,19 +285,16 @@ net_nfc_error_e net_nfc_client_test_prbs_test(uint32_t tech, { NetNfcCallback *func_data; - if (test_proxy == NULL) - { - if(net_nfc_client_test_init() != NET_NFC_OK) - { + if (test_proxy == NULL) { + if (net_nfc_client_test_init() != NET_NFC_OK) { DEBUG_ERR_MSG("test_proxy fail"); return NET_NFC_NOT_INITIALIZED; } } /* prevent executing daemon when nfc is off */ - if (net_nfc_client_manager_is_activated() == false) { + if (net_nfc_client_manager_is_activated() == false) return NET_NFC_NOT_ACTIVATED; - } func_data = g_try_new0(NetNfcCallback, 1); if (func_data == NULL) @@ -340,27 +320,23 @@ net_nfc_error_e net_nfc_client_test_prbs_test_sync(uint32_t tech, net_nfc_error_e out_result = NET_NFC_OK; GError *error = NULL; - if (test_proxy == NULL) - { - if(net_nfc_client_test_init() != NET_NFC_OK) - { + if (test_proxy == NULL) { + if (net_nfc_client_test_init() != NET_NFC_OK) { DEBUG_ERR_MSG("test_proxy fail"); return NET_NFC_NOT_INITIALIZED; } } /* prevent executing daemon when nfc is off */ - if (net_nfc_client_manager_is_activated() == false) { + if (net_nfc_client_manager_is_activated() == false) return NET_NFC_NOT_ACTIVATED; - } if (net_nfc_gdbus_test_call_prbs_test_sync(test_proxy, tech, rate, (gint *)&out_result, NULL, - &error) == FALSE) - { + &error) == FALSE) { DEBUG_ERR_MSG("can not call PrbsTest: %s", error->message); out_result = NET_NFC_IPC_FAIL; @@ -378,19 +354,16 @@ net_nfc_error_e net_nfc_client_test_get_firmware_version( { NetNfcCallback *func_data; - if (test_proxy == NULL) - { - if(net_nfc_client_test_init() != NET_NFC_OK) - { + if (test_proxy == NULL) { + if (net_nfc_client_test_init() != NET_NFC_OK) { DEBUG_ERR_MSG("test_proxy fail"); return NET_NFC_NOT_INITIALIZED; } } /* prevent executing daemon when nfc is off */ - if (net_nfc_client_manager_is_activated() == false) { + if (net_nfc_client_manager_is_activated() == false) return NET_NFC_NOT_ACTIVATED; - } func_data = g_try_new0(NetNfcCallback, 1); if (func_data == NULL) @@ -419,30 +392,24 @@ net_nfc_error_e net_nfc_client_test_get_firmware_version_sync(char **version) *version = NULL; - if (test_proxy == NULL) - { - if(net_nfc_client_test_init() != NET_NFC_OK) - { + if (test_proxy == NULL) { + if (net_nfc_client_test_init() != NET_NFC_OK) { DEBUG_ERR_MSG("test_proxy fail"); return NET_NFC_NOT_INITIALIZED; } } /* prevent executing daemon when nfc is off */ - if (net_nfc_client_manager_is_activated() == false) { + if (net_nfc_client_manager_is_activated() == false) return NET_NFC_NOT_ACTIVATED; - } if (net_nfc_gdbus_test_call_get_firmware_version_sync(test_proxy, (gint *)&out_result, &out_version, NULL, - &error) == TRUE) - { + &error) == TRUE) { *version = out_version; - } - else - { + } else { DEBUG_ERR_MSG("can not call Get Firmware version: %s", error->message); out_result = NET_NFC_IPC_FAIL; @@ -463,24 +430,20 @@ net_nfc_error_e net_nfc_client_test_set_ee_data(int mode, NetNfcCallback *func_data; GVariant *variant; - if (test_proxy == NULL) - { - if(net_nfc_client_test_init() != NET_NFC_OK) - { + if (test_proxy == NULL) { + if (net_nfc_client_test_init() != NET_NFC_OK) { DEBUG_ERR_MSG("test_proxy fail"); return NET_NFC_NOT_INITIALIZED; } } /* prevent executing daemon when nfc is off */ - if (net_nfc_client_manager_is_activated() == false) { + if (net_nfc_client_manager_is_activated() == false) return NET_NFC_NOT_ACTIVATED; - } func_data = g_try_new0(NetNfcCallback, 1); - if (func_data == NULL) { + if (func_data == NULL) return NET_NFC_ALLOC_FAIL; - } func_data->callback = (gpointer)callback; func_data->user_data = user_data; @@ -507,19 +470,16 @@ net_nfc_error_e net_nfc_client_test_set_ee_data_sync(int mode, GVariant *variant = NULL; GError *error = NULL; - if (test_proxy == NULL) - { - if(net_nfc_client_test_init() != NET_NFC_OK) - { + if (test_proxy == NULL) { + if (net_nfc_client_test_init() != NET_NFC_OK) { DEBUG_ERR_MSG("test_proxy fail"); return NET_NFC_NOT_INITIALIZED; } } /* prevent executing daemon when nfc is off */ - if (net_nfc_client_manager_is_activated() == false) { + if (net_nfc_client_manager_is_activated() == false) return NET_NFC_NOT_ACTIVATED; - } variant = net_nfc_util_gdbus_data_to_variant((data_s *)data); @@ -529,8 +489,7 @@ net_nfc_error_e net_nfc_client_test_set_ee_data_sync(int mode, variant, (gint *)&out_result, NULL, - &error) == FALSE) - { + &error) == FALSE) { DEBUG_ERR_MSG("can not call SetEeTest: %s", error->message); out_result = NET_NFC_IPC_FAIL; @@ -550,19 +509,16 @@ net_nfc_error_e net_nfc_client_test_ese_test( DEBUG_CLIENT_MSG("NFC ESE Test!!!!"); - if (test_proxy == NULL) - { - if(net_nfc_client_test_init() != NET_NFC_OK) - { + if (test_proxy == NULL) { + if (net_nfc_client_test_init() != NET_NFC_OK) { DEBUG_ERR_MSG("test_proxy fail"); return NET_NFC_NOT_INITIALIZED; } } /* prevent executing daemon when nfc is off */ - if (net_nfc_client_manager_is_activated() == false) { + if (net_nfc_client_manager_is_activated() == false) return NET_NFC_NOT_ACTIVATED; - } func_data = g_try_new0(NetNfcCallback, 1); if (func_data == NULL) @@ -587,25 +543,21 @@ net_nfc_error_e net_nfc_client_test_ese_test_sync(void) DEBUG_CLIENT_MSG("NFC ESE Test SYNC!!!!"); - if (test_proxy == NULL) - { - if(net_nfc_client_test_init() != NET_NFC_OK) - { + if (test_proxy == NULL) { + if (net_nfc_client_test_init() != NET_NFC_OK) { DEBUG_ERR_MSG("test_proxy fail"); return NET_NFC_NOT_INITIALIZED; } } /* prevent executing daemon when nfc is off */ - if (net_nfc_client_manager_is_activated() == false) { + if (net_nfc_client_manager_is_activated() == false) return NET_NFC_NOT_ACTIVATED; - } if (net_nfc_gdbus_test_call_ese_test_sync(test_proxy, (gint *)&out_result, NULL, - &error) == FALSE) - { + &error) == FALSE) { DEBUG_ERR_MSG("can not call ESE Test: %s", error->message); out_result = NET_NFC_IPC_FAIL; @@ -623,27 +575,23 @@ net_nfc_error_e net_nfc_client_test_set_se_tech_type_sync( net_nfc_error_e out_result = NET_NFC_OK; GError *error = NULL; - if (test_proxy == NULL) - { - if(net_nfc_client_test_init() != NET_NFC_OK) - { + if (test_proxy == NULL) { + if (net_nfc_client_test_init() != NET_NFC_OK) { DEBUG_ERR_MSG("test_proxy fail"); return NET_NFC_NOT_INITIALIZED; } } /* prevent executing daemon when nfc is off */ - if (net_nfc_client_manager_is_activated() == false) { + if (net_nfc_client_manager_is_activated() == false) return NET_NFC_NOT_ACTIVATED; - } if (net_nfc_gdbus_test_call_set_se_tech_type_sync(test_proxy, (guint32)type, (guint32)tech, (gint *)&out_result, NULL, - &error) == FALSE) - { + &error) == FALSE) { DEBUG_ERR_MSG("can not call SetSeTechType: %s", error->message); out_result = NET_NFC_IPC_FAIL; @@ -662,26 +610,22 @@ net_nfc_error_e net_nfc_client_test_set_listen_tech_mask_sync(uint32_t tech) DEBUG_CLIENT_MSG("net_nfc_client_test_set_listen_tech_mask_sync start"); - if (test_proxy == NULL) - { - if(net_nfc_client_test_init() != NET_NFC_OK) - { + if (test_proxy == NULL) { + if (net_nfc_client_test_init() != NET_NFC_OK) { DEBUG_ERR_MSG("test_proxy fail"); return NET_NFC_NOT_INITIALIZED; } } /* prevent executing daemon when nfc is off */ - if (net_nfc_client_manager_is_activated() == false) { + if (net_nfc_client_manager_is_activated() == false) return NET_NFC_NOT_ACTIVATED; - } if (net_nfc_gdbus_test_call_set_listen_tech_mask_sync(test_proxy, tech, &result, NULL, - &error) == FALSE) - { + &error) == FALSE) { DEBUG_ERR_MSG("can not call listen tech mask: %s", error->message); result = NET_NFC_IPC_FAIL; @@ -697,8 +641,7 @@ net_nfc_error_e net_nfc_client_test_init(void) { GError *error = NULL; - if (test_proxy) - { + if (test_proxy) { DEBUG_CLIENT_MSG("Already initialized"); return NET_NFC_OK; @@ -711,8 +654,7 @@ net_nfc_error_e net_nfc_client_test_init(void) "/org/tizen/NetNfcService/Test", NULL, &error); - if (test_proxy == NULL) - { + if (test_proxy == NULL) { DEBUG_ERR_MSG("Can not create proxy : %s", error->message); g_error_free(error); @@ -724,8 +666,7 @@ net_nfc_error_e net_nfc_client_test_init(void) void net_nfc_client_test_deinit(void) { - if (test_proxy) - { + if (test_proxy) { g_object_unref(test_proxy); test_proxy = NULL; } diff --git a/src/net_nfc_client_transceive.c b/src/net_nfc_client_transceive.c index 0f7f5f3..ec07506 100755 --- a/src/net_nfc_client_transceive.c +++ b/src/net_nfc_client_transceive.c @@ -52,22 +52,19 @@ static GVariant *transceive_data_to_transceive_variant( data_s transceive_info = { NULL, }; GVariant *variant; - if (data == NULL) - { + if (data == NULL) { DEBUG_ERR_MSG("data is empty"); return NULL; } - switch (devType) - { - case NET_NFC_MIFARE_MINI_PICC : - case NET_NFC_MIFARE_1K_PICC : - case NET_NFC_MIFARE_4K_PICC : - case NET_NFC_MIFARE_ULTRA_PICC : + switch (devType) { + case NET_NFC_MIFARE_MINI_PICC: + case NET_NFC_MIFARE_1K_PICC: + case NET_NFC_MIFARE_4K_PICC: + case NET_NFC_MIFARE_ULTRA_PICC: if (net_nfc_util_init_data(&transceive_info, - data->length + 2) == true) - { + data->length + 2) == true) { memcpy(transceive_info.buffer, data->buffer, data->length); @@ -78,16 +75,14 @@ static GVariant *transceive_data_to_transceive_variant( } break; - case NET_NFC_JEWEL_PICC : - if (data->length > 9) - { + case NET_NFC_JEWEL_PICC: + if (data->length > 9) { DEBUG_ERR_MSG("data length is larger than 9"); return NULL; } - if (net_nfc_util_init_data(&transceive_info, 9) == true) - { + if (net_nfc_util_init_data(&transceive_info, 9) == true) { memcpy(transceive_info.buffer, data->buffer, data->length); @@ -98,10 +93,9 @@ static GVariant *transceive_data_to_transceive_variant( } break; - default : - if(net_nfc_util_init_data(&transceive_info, - data->length) == true) - { + default: + if (net_nfc_util_init_data(&transceive_info, + data->length) == true) { memcpy(transceive_info.buffer, data->buffer, data->length); @@ -132,16 +126,14 @@ static void transceive_data_call(GObject *source_object, (gint *)&out_result, &out_data, res, - &error) == FALSE) - { + &error) == FALSE) { DEBUG_ERR_MSG("Can not finish transceive: %s", error->message); out_result = NET_NFC_IPC_FAIL; g_error_free(error); } - if (func_data->callback != NULL) - { + if (func_data->callback != NULL) { data_s resp = { NULL, }; net_nfc_util_gdbus_variant_to_data_s(out_data, &resp); @@ -171,16 +163,14 @@ static void transceive_call(GObject *source_object, NET_NFC_GDBUS_TRANSCEIVE(source_object), (gint *)&out_result, res, - &error) == FALSE) - { + &error) == FALSE) { DEBUG_ERR_MSG("Can not finish transceive: %s", error->message); out_result = NET_NFC_IPC_FAIL; g_error_free(error); } - if (func_data->callback != NULL) - { + if (func_data->callback != NULL) { ((nfc_transceive_callback)func_data->callback)( out_result, func_data->user_data); @@ -199,10 +189,8 @@ net_nfc_error_e net_nfc_client_transceive(net_nfc_target_handle_h handle, NetNfcCallback *funcdata; GVariant *arg_data; - if (transceive_proxy == NULL) - { - if(net_nfc_client_transceive_init() != NET_NFC_OK) - { + if (transceive_proxy == NULL) { + if (net_nfc_client_transceive_init() != NET_NFC_OK) { DEBUG_ERR_MSG("transceive_proxy fail"); return NET_NFC_NOT_INITIALIZED; } @@ -212,9 +200,8 @@ net_nfc_error_e net_nfc_client_transceive(net_nfc_target_handle_h handle, return NET_NFC_NULL_PARAMETER; /* prevent executing daemon when nfc is off */ - if (net_nfc_client_manager_is_activated() == false) { + if (net_nfc_client_manager_is_activated() == false) return NET_NFC_NOT_ACTIVATED; - } target_info = net_nfc_client_tag_get_client_target_info(); if (target_info == NULL || target_info->handle == NULL) @@ -224,9 +211,8 @@ net_nfc_error_e net_nfc_client_transceive(net_nfc_target_handle_h handle, arg_data = transceive_data_to_transceive_variant(target_info->devType, rawdata); - if (arg_data == NULL) { + if (arg_data == NULL) return NET_NFC_INVALID_PARAM; - } funcdata = g_try_new0(NetNfcCallback, 1); if (funcdata == NULL) { @@ -259,10 +245,8 @@ net_nfc_error_e net_nfc_client_transceive_data(net_nfc_target_handle_h handle, NetNfcCallback *funcdata; GVariant *arg_data; - if (transceive_proxy == NULL) - { - if(net_nfc_client_transceive_init() != NET_NFC_OK) - { + if (transceive_proxy == NULL) { + if (net_nfc_client_transceive_init() != NET_NFC_OK) { DEBUG_ERR_MSG("transceive_proxy fail"); return NET_NFC_NOT_INITIALIZED; } @@ -272,9 +256,8 @@ net_nfc_error_e net_nfc_client_transceive_data(net_nfc_target_handle_h handle, return NET_NFC_NULL_PARAMETER; /* prevent executing daemon when nfc is off */ - if (net_nfc_client_manager_is_activated() == false) { + if (net_nfc_client_manager_is_activated() == false) return NET_NFC_NOT_ACTIVATED; - } target_info = net_nfc_client_tag_get_client_target_info(); if (target_info == NULL || target_info->handle == NULL) @@ -284,9 +267,8 @@ net_nfc_error_e net_nfc_client_transceive_data(net_nfc_target_handle_h handle, arg_data = transceive_data_to_transceive_variant(target_info->devType, rawdata); - if (arg_data == NULL) { + if (arg_data == NULL) return NET_NFC_INVALID_PARAM; - } funcdata = g_try_new0(NetNfcCallback, 1); if (funcdata == NULL) { @@ -321,19 +303,16 @@ net_nfc_error_e net_nfc_client_transceive_sync(net_nfc_target_handle_h handle, if (handle == NULL || rawdata == NULL) return NET_NFC_NULL_PARAMETER; - if (transceive_proxy == NULL) - { - if(net_nfc_client_transceive_init() != NET_NFC_OK) - { + if (transceive_proxy == NULL) { + if (net_nfc_client_transceive_init() != NET_NFC_OK) { DEBUG_ERR_MSG("transceive_proxy fail"); return NET_NFC_NOT_INITIALIZED; } } /* prevent executing daemon when nfc is off */ - if (net_nfc_client_manager_is_activated() == false) { + if (net_nfc_client_manager_is_activated() == false) return NET_NFC_NOT_ACTIVATED; - } target_info = net_nfc_client_tag_get_client_target_info(); if (target_info == NULL || target_info->handle == NULL) @@ -352,8 +331,7 @@ net_nfc_error_e net_nfc_client_transceive_sync(net_nfc_target_handle_h handle, arg_data, (gint *)&out_result, NULL, - &error) == FALSE) - { + &error) == FALSE) { DEBUG_ERR_MSG("Transceive (sync call) failed: %s", error->message); out_result = NET_NFC_IPC_FAIL; @@ -379,19 +357,16 @@ net_nfc_error_e net_nfc_client_transceive_data_sync( if (handle == NULL || rawdata == NULL) return NET_NFC_NULL_PARAMETER; - if (transceive_proxy == NULL) - { - if(net_nfc_client_transceive_init() != NET_NFC_OK) - { + if (transceive_proxy == NULL) { + if (net_nfc_client_transceive_init() != NET_NFC_OK) { DEBUG_ERR_MSG("transceive_proxy fail"); return NET_NFC_NOT_INITIALIZED; } } /* prevent executing daemon when nfc is off */ - if (net_nfc_client_manager_is_activated() == false) { + if (net_nfc_client_manager_is_activated() == false) return NET_NFC_NOT_ACTIVATED; - } target_info = net_nfc_client_tag_get_client_target_info(); if (target_info == NULL || target_info->handle == NULL) @@ -412,8 +387,7 @@ net_nfc_error_e net_nfc_client_transceive_data_sync( (gint *)&out_result, &out_data, NULL, - &error) == FALSE) - { + &error) == FALSE) { DEBUG_ERR_MSG("Transceive (sync call) failed: %s", error->message); out_result = NET_NFC_IPC_FAIL; @@ -422,9 +396,7 @@ net_nfc_error_e net_nfc_client_transceive_data_sync( } if (response && out_data != NULL) - { *response = net_nfc_util_gdbus_variant_to_data(out_data); - } return out_result; } @@ -434,8 +406,7 @@ net_nfc_error_e net_nfc_client_transceive_init(void) { GError *error = NULL; - if (transceive_proxy) - { + if (transceive_proxy) { DEBUG_CLIENT_MSG("Already initialized"); return NET_NFC_OK; @@ -448,8 +419,7 @@ net_nfc_error_e net_nfc_client_transceive_init(void) "/org/tizen/NetNfcService/Transceive", NULL, &error); - if (transceive_proxy == NULL) - { + if (transceive_proxy == NULL) { DEBUG_ERR_MSG("Can not create proxy : %s", error->message); g_error_free(error); @@ -461,8 +431,7 @@ net_nfc_error_e net_nfc_client_transceive_init(void) void net_nfc_client_transceive_deinit(void) { - if (transceive_proxy) - { + if (transceive_proxy) { g_object_unref(transceive_proxy); transceive_proxy = NULL; } diff --git a/src/nfc_ndef.c b/src/nfc_ndef.c index 8c4dc88..9ad7d68 100755 --- a/src/nfc_ndef.c +++ b/src/nfc_ndef.c @@ -36,22 +36,22 @@ const unsigned char NFC_RECORD_URI_TYPE[1] = { 'U' }; * @brief RTD(Record type definition) Type - Alternative Carrier type. * @ingroup CAPI_NETWORK_NFC_NDEF_RECORD_MODULE */ -const unsigned char NFC_RECORD_ALTERNATIVE_CARRIER_TYPE[2] = { 'a','c' }; +const unsigned char NFC_RECORD_ALTERNATIVE_CARRIER_TYPE[2] = { 'a', 'c' }; /** * @brief RTD(Record type definition) Type - Handover Carrier type. * @ingroup CAPI_NETWORK_NFC_NDEF_RECORD_MODULE */ -const unsigned char NFC_RECORD_HANDOVER_CARRIER_TYPE[2] = { 'H','c' }; +const unsigned char NFC_RECORD_HANDOVER_CARRIER_TYPE[2] = { 'H', 'c' }; /** * @brief RTD(Record type definition) Type - Handover Request type. * @ingroup CAPI_NETWORK_NFC_NDEF_RECORD_MODULE */ -const unsigned char NFC_RECORD_HANDOVER_REQUEST_TYPE[2] = { 'H','r' }; +const unsigned char NFC_RECORD_HANDOVER_REQUEST_TYPE[2] = { 'H', 'r' }; /** * @brief RTD(Record type definition) Type - Handover Select type. * @ingroup CAPI_NETWORK_NFC_NDEF_RECORD_MODULE */ -const unsigned char NFC_RECORD_HANDOVER_SELECT_TYPE[2] = { 'H','s' }; +const unsigned char NFC_RECORD_HANDOVER_SELECT_TYPE[2] = { 'H', 's' }; int nfc_ndef_record_create(nfc_ndef_record_h *record, nfc_record_tnf_e tnf,