Name: nfc-manager
Summary: NFC framework manager
-Version: 0.1.152
+Version: 0.1.155
Release: 0
Group: Network & Connectivity/NFC
License: Flora-1.1
# this for NFC flag
-SET(EXTRA_CFLAGS "${EXTRA_CFLAGS} -pipe -fomit-frame-pointer -Wall -Wno-trigraphs -Werror-implicit-function-declaration -fno-strict-aliasing -Wl,-zdefs")
+SET(EXTRA_CFLAGS "${EXTRA_CFLAGS} -pipe -fomit-frame-pointer -Wall -Wno-trigraphs -Werror-implicit-function-declaration -fno-strict-aliasing -Wl,-zdefs")
SET(ARM_CFLAGS "${ARM_CLAGS} -mapcs -mno-sched-prolog -mabi=aapcs-linux -Uarm -fno-common -fpic")
uint32_t request_type; \
uint32_t client_fd; \
uint32_t flags; \
- uint32_t user_param; \
+ void *user_param; \
/* DON'T MODIFY THIS CODE - END */
typedef struct _net_nfc_request_msg_t
# this for NFC flag
-SET(EXTRA_CFLAGS "${EXTRA_CFLAGS} -pipe -fomit-frame-pointer -Wall -Wno-trigraphs -Werror-implicit-function-declaration -fno-strict-aliasing -Wl,-zdefs -fvisibility=hidden")
+SET(EXTRA_CFLAGS "${EXTRA_CFLAGS} -pipe -fomit-frame-pointer -Wall -Wno-trigraphs -Werror-implicit-function-declaration -fno-strict-aliasing -Wl,-zdefs -fvisibility=hidden")
SET(ARM_CFLAGS "${ARM_CLAGS} -mapcs -mno-sched-prolog -mabi=aapcs-linux -Uarm -fno-common -fpic")
net_nfc_current_target_info_s *net_nfc_server_get_target_info(void);
-gboolean net_nfc_server_target_connected(net_nfc_target_handle_s *handle);
+net_nfc_target_handle_s *net_nfc_server_get_target_handle(void);
+
+gboolean net_nfc_server_target_connected(uint32_t handle);
void net_nfc_server_free_target_info(void);
void net_nfc_server_vconf_deinit(void);
-bool net_nfc_check_csc_vconf(void);
-
bool net_nfc_check_start_polling_vconf(void);
void net_nfc_server_vconf_set_screen_on_flag(bool flag);
int main(int argc, char *argv[])
{
-
void *handle = NULL;
guint id = 0;
gboolean use_daemon = FALSE;
GOptionContext *option_context;
GError *error = NULL;
- bool check_csc = 0;
option_context = g_option_context_new("Nfc manager");
g_option_context_add_main_entries(option_context,
DEBUG_SERVER_MSG("start nfc manager");
DEBUG_SERVER_MSG("use_daemon : %d", use_daemon);
- check_csc = net_nfc_check_csc_vconf();
- if (check_csc)
- return 0;
-
net_nfc_manager_init_log();
net_nfc_app_util_clean_storage(MESSAGE_STORAGE);
if (ret == SOUND_MANAGER_ERROR_NONE) {
ret = sound_manager_acquire_focus(stream_info, SOUND_STREAM_FOCUS_FOR_PLAYBACK, SOUND_BEHAVIOR_NONE, NULL);
if (ret == SOUND_MANAGER_ERROR_NONE) {
- ret = wav_player_start_with_stream_info(sound_path,
+ ret = wav_player_start_new(sound_path,
stream_info, __wav_start_completed_cb, stream_info, &id);
if (ret == WAV_PLAYER_ERROR_NONE) {
DEBUG_SERVER_MSG("wav_player_start_with_stream_info success");
g_assert(info != NULL);
- req->user_param = (uint32_t)user_context;
+ req->user_param = user_context;
DEBUG_SERVER_MSG("SE Transaction = [%d]", req->request_type );
net_nfc_request_llcp_msg_t *req_msg = info;
if(user_context != NULL)
- req_msg->user_param = (uint32_t)user_context;
+ req_msg->user_param = user_context;
if (net_nfc_server_controller_async_queue_push_force(
_controller_llcp_event_cb, req_msg) == FALSE)
if (controller_thread == NULL)
{
- DEBUG_ERR_MSG("can not create controller thread: %s",
- error->message);
- g_error_free(error);
+ DEBUG_ERR_MSG("can not create controller thread");
+ if (error != NULL) {
+ DEBUG_ERR_MSG("error msg : %s", error->message);
+ g_error_free(error);
+ }
return FALSE;
}
int ret;
ret = wifi_ap_get_essid(ap, &ssid);
- if (ret == WIFI_ERROR_NONE && ssid != NULL) {
+ if (ssid == NULL) {
+ DEBUG_ERR_MSG("ssid is NULL");
+ return true;
+ }
+
+ if (ret == WIFI_ERROR_NONE) {
SECURE_MSG("ssid [%s]", ssid);
if (g_strcmp0(ssid, (char *)context[0]) == 0) {
} else {
result = true;
}
-
- g_free(ssid);
} else {
DEBUG_ERR_MSG("wifi_ap_get_bssid failed, [%d]", ret);
result = true;
}
+ g_free(ssid);
+
return result;
}
g_assert(data->ndef != NULL);
g_assert(data->invocation != NULL);
- handle = GUINT_TO_POINTER(data->handle);
-
- if (net_nfc_server_target_connected(handle) == true) {
+ if (net_nfc_server_target_connected(data->handle) == true) {
+ handle = net_nfc_server_get_target_handle();
net_nfc_controller_read_ndef(handle, &read_data, &result);
} else {
result = NET_NFC_TARGET_IS_MOVED_AWAY;
g_assert(data->ndef != NULL);
g_assert(data->invocation != NULL);
- handle = GUINT_TO_POINTER(data->handle);
-
- if (net_nfc_server_target_connected(handle) == true) {
+ if (net_nfc_server_target_connected(data->handle) == true) {
+ handle = net_nfc_server_get_target_handle();
net_nfc_controller_write_ndef(handle, &data->data, &result);
} else {
result = NET_NFC_TARGET_IS_MOVED_AWAY;
g_assert(data->ndef != NULL);
g_assert(data->invocation != NULL);
- handle = GUINT_TO_POINTER(data->handle);
-
- if (net_nfc_server_target_connected(handle) == true) {
+ if (net_nfc_server_target_connected(data->handle) == true) {
+ handle = net_nfc_server_get_target_handle();
net_nfc_controller_make_read_only_ndef(handle, &result);
} else {
result = NET_NFC_TARGET_IS_MOVED_AWAY;
g_assert(data->ndef != NULL);
g_assert(data->invocation != NULL);
- handle = GUINT_TO_POINTER(data->handle);
-
- if (net_nfc_server_target_connected(handle) == true) {
+ if (net_nfc_server_target_connected(data->handle) == true) {
+ handle = net_nfc_server_get_target_handle();
net_nfc_controller_format_ndef(handle, &data->key, &result);
} else {
result = NET_NFC_TARGET_IS_MOVED_AWAY;
return;
}
- net_nfc_gdbus_p2p_emit_discovered(p2p_skeleton,
- GPOINTER_TO_UINT(handle));
+ net_nfc_gdbus_p2p_emit_discovered(p2p_skeleton, handle->connection_id);
net_nfc_manager_util_play_sound(NET_NFC_TASK_START);
}
return NET_NFC_NULL_PARAMETER;
}
- if (net_nfc_server_target_connected(handle) == false) {
+ if (net_nfc_server_target_connected(handle->connection_id) == false) {
return NET_NFC_NOT_CONNECTED;
}
return NET_NFC_INVALID_PARAM;
}
- if (net_nfc_server_target_connected(context->handle) == false) {
+ if (net_nfc_server_target_connected(context->handle->connection_id) == false) {
return NET_NFC_NOT_CONNECTED;
}
return NET_NFC_NULL_PARAMETER;
}
- if (net_nfc_server_target_connected(handle) == false) {
+ if (net_nfc_server_target_connected(handle->connection_id) == false) {
return NET_NFC_NOT_CONNECTED;
}
return NET_NFC_NULL_PARAMETER;
}
- if (net_nfc_server_target_connected(context->handle) == false) {
+ if (net_nfc_server_target_connected(context->handle->connection_id) == false) {
return NET_NFC_NOT_CONNECTED;
}
else {
DEBUG_ERR_MSG("failed to net_nfc_server_se_open_ese()");
}
+
+ if (cmd != NULL)
+ g_free(cmd);
}
void net_nfc_server_se_deactivate_card(void)
net_nfc_server_set_state(NET_NFC_SERVER_IDLE);
net_nfc_gdbus_tag_emit_tag_detached(tag_skeleton,
- GPOINTER_TO_UINT(handle),
+ handle->connection_id,
data->dev_type);
g_free(data);
if (tag_skeleton != NULL) {
/* send TagDiscoverd signal */
net_nfc_gdbus_tag_emit_tag_discovered(tag_skeleton,
- GPOINTER_TO_UINT(target->handle),
+ target->handle->connection_id,
target->devType,
is_ndef_supported,
ndef_card_state,
return current_target_info;
}
-gboolean net_nfc_server_target_connected(net_nfc_target_handle_s *handle)
+net_nfc_target_handle_s *net_nfc_server_get_target_handle(void)
+{
+ net_nfc_target_handle_s *handle = NULL;
+
+ if (current_target_info != NULL)
+ handle = current_target_info->handle;
+
+ return handle;
+}
+
+gboolean net_nfc_server_target_connected(uint32_t handle)
{
if (current_target_info == NULL)
return FALSE;
- if (current_target_info->handle != handle)
+ if (current_target_info->handle == NULL)
+ return FALSE;
+
+ if (current_target_info->handle->connection_id != handle)
return FALSE;
return TRUE;
static void transceive_data_thread_func(gpointer user_data)
{
TransceiveSendData *transceive_data = (TransceiveSendData*)user_data;
- net_nfc_target_handle_s *handle =
- (net_nfc_target_handle_s *)transceive_data->transceive_handle;
+ net_nfc_target_handle_s *handle;
net_nfc_error_e result = NET_NFC_OK;
data_s *data = NULL;
GVariant *resp_data = NULL;
g_assert(transceive_data->transceive != NULL);
g_assert(transceive_data->invocation != NULL);
- if (net_nfc_server_target_connected(handle) == true)
+ if (net_nfc_server_target_connected(transceive_data->transceive_handle) == true)
{
DEBUG_SERVER_MSG("call transceive");
+ handle = net_nfc_server_get_target_handle();
if (net_nfc_controller_transceive(handle,
&transceive_data->transceive_info,
static void transceive_thread_func(gpointer user_data)
{
TransceiveSendData *transceive_data = (TransceiveSendData *)user_data;
- net_nfc_target_handle_s *handle =
- (net_nfc_target_handle_s *)transceive_data->transceive_handle;
+ net_nfc_target_handle_s *handle;
net_nfc_error_e result = NET_NFC_OK;
data_s *data = NULL;
g_assert(transceive_data->transceive != NULL);
g_assert(transceive_data->invocation != NULL);
- if (net_nfc_server_target_connected(handle) == true)
+ if (net_nfc_server_target_connected(transceive_data->transceive_handle) == true)
{
DEBUG_MSG("call transceive");
+ handle = net_nfc_server_get_target_handle();
if (net_nfc_controller_transceive(handle,
&transceive_data->transceive_info,
net_nfc_server_vconf_other_handlers_changed);
}
-bool net_nfc_check_csc_vconf(void)
-{
- int state = 0;;
-
- if (state == true)
- {
- DEBUG_ERR_MSG("This is CSC Booting!!");
- return true;
- }
- else
- {
- DEBUG_ERR_MSG("This is Normal Booting!!");
- return false;
- }
-}
-
bool net_nfc_check_start_polling_vconf(void)
{
gint lock_state = 0;