add GSMA api
authorJi-hoon Jung <jh8801.jung@samsung.com>
Wed, 23 Oct 2013 08:52:09 +0000 (17:52 +0900)
committerJi-hoon Jung <jh8801.jung@samsung.com>
Wed, 23 Oct 2013 11:02:14 +0000 (20:02 +0900)
Change-Id: Ia39279fac346d981cb50d1361e790f1df189d80e

15 files changed:
TC/testcase/utc_net_nfc_client_ndef_message.c
packaging/nfc-manager.spec
src/clientlib/include/net_nfc_internal_se.h
src/clientlib/include/net_nfc_ndef_message.h
src/clientlib/net_nfc_client_dispatcher.c
src/clientlib/net_nfc_client_internal_se.c
src/clientlib/net_nfc_client_ipc.c
src/clientlib/net_nfc_client_ndef_message.c
src/commonlib/include/net_nfc_typedef.h
src/commonlib/include/net_nfc_typedef_private.h
src/manager/include/net_nfc_app_util_private.h
src/manager/include/net_nfc_service_se_private.h
src/manager/net_nfc_app_util.c
src/manager/net_nfc_server_dispatcher.c
src/manager/net_nfc_service_se.c

index f6d7609..7383ebd 100755 (executable)
@@ -162,7 +162,7 @@ static void utc_net_nfc_get_ndef_message_byte_length_p(void)
        char url[] = "samsung.com";
        ndef_record_h record = NULL;
        ndef_message_h msg = NULL;
-       int length = 0;
+       uint32_t length = 0;
 
        net_nfc_create_uri_type_record(&record, url, NET_NFC_SCHEMA_HTTPS_WWW);
 
index c52b618..d409384 100644 (file)
@@ -1,6 +1,6 @@
 Name:       nfc-manager
 Summary:    NFC framework manager
-Version:    0.0.50
+Version:    0.0.51
 Release:    0
 Group:      libs
 License:    Flora Software License
index f0a391d..20b5df0 100755 (executable)
@@ -202,6 +202,37 @@ net_nfc_error_e net_nfc_get_atr(net_nfc_target_handle_h handle, void *trans_para
 */
 net_nfc_error_e net_nfc_get_atr_sync(net_nfc_target_handle_h handle, data_h *atr);
 
+/**
+       set card emulation mode of secure element
+
+       \par Sync (or) Async: Sync
+       This is a Synchronous API
+
+       @param[in]   se_mode            the mode of card emulation
+
+       @return         return the result of the calling the function
+
+       @exception NET_NFC_INVALID_PARAM        invalid
+
+*/
+net_nfc_error_e net_nfc_set_card_emulation_mode_sync(net_nfc_card_emulation_mode_t se_mode);
+
+
+/**
+       set type of secure element
+
+       \par Sync (or) Async: Sync
+       This is a Synchronous API
+
+       @param[in]   se_type            the type of secure element
+
+       @return         return the result of the calling the function
+
+       @exception NET_NFC_INVALID_PARAM        invalid
+
+*/
+net_nfc_error_e net_nfc_set_secure_element_type_sync(net_nfc_se_type_e se_type);
+
 #ifdef __cplusplus
 }
 #endif
index 2406d40..66eb8c5 100755 (executable)
@@ -240,7 +240,7 @@ net_nfc_error_e net_nfc_create_ndef_message_from_rawdata (ndef_message_h* ndef_m
 
 */
 
-net_nfc_error_e net_nfc_get_ndef_message_byte_length(ndef_message_h ndef_message, int * length) ;
+net_nfc_error_e net_nfc_get_ndef_message_byte_length(ndef_message_h ndef_message, uint32_t *length) ;
 /**
        Append a record to ndef message structure.
        This API help to create NDEF message and it control Record flags to follow the NDEF forum specification
index 89b30a7..ce2f9b0 100755 (executable)
@@ -198,6 +198,15 @@ static bool net_nfc_client_dispatch_response(client_dispatcher_param_t *param)
                }
                break;
 
+       case NET_NFC_MESSAGE_SE_CARD_EMULATION_CHANGED :
+               {
+                       if (client_cb != NULL)
+                       {
+                               client_cb(msg->response_type, NET_NFC_OK, NULL, NULL, NULL);
+                       }
+               }
+               break;
+
        case NET_NFC_MESSAGE_OPEN_INTERNAL_SE :
                {
                        DEBUG_CLIENT_MSG("handle = [0x%p]", ((net_nfc_response_open_internal_se_t *)(msg->detail_message))->handle);
@@ -555,6 +564,9 @@ static bool net_nfc_client_dispatch_response(client_dispatcher_param_t *param)
 
                        info.aid = se_event->aid;
                        info.param = se_event->param;
+                       info.se_type = se_event->se_type;
+                       info.fg_dispatch = se_event->fg_dispatch;
+                       info.focus_app_pid = se_event->focus_app_pid;
 
                        if (client_cb != NULL)
                                client_cb(msg->response_type, NET_NFC_OK, (void *)&info, client_context->register_user_param, NULL);
@@ -893,6 +905,16 @@ net_nfc_error_e net_nfc_client_dispatch_sync_response(net_nfc_response_msg_t *ms
        case NET_NFC_MESSAGE_SE_TYPE_CHANGED :
                break;
 
+       case NET_NFC_MESSAGE_CARD_EMULATION_CHANGE_SE :
+               {
+                       net_nfc_response_se_change_card_emulation_t *response
+                               = (net_nfc_response_se_change_card_emulation_t *)msg->detail_message;
+
+                       /* return */
+                       result = response->result;
+               }
+               break;
+
        case NET_NFC_MESSAGE_OPEN_INTERNAL_SE :
                {
                        net_nfc_response_open_internal_se_t *response = (net_nfc_response_open_internal_se_t *)msg->detail_message;
index 6462ebd..c8bf5fe 100755 (executable)
 #define NET_NFC_EXPORT_API __attribute__((visibility("default")))
 #endif
 
+NET_NFC_EXPORT_API
+net_nfc_error_e net_nfc_set_card_emulation_mode_sync(
+    net_nfc_card_emulation_mode_t se_mode)
+{
+   net_nfc_error_e ret = NET_NFC_OK;
+       net_nfc_request_se_change_card_emulation_t request = { 0, };
+
+       if (se_mode < NET_NFC_SE_TYPE_NONE || se_mode > NET_NFC_SE_TYPE_UICC)
+       {
+               return NET_NFC_INVALID_PARAM;
+       }
+
+       request.length = sizeof(net_nfc_request_se_change_card_emulation_t);
+       request.request_type = NET_NFC_MESSAGE_CARD_EMULATION_CHANGE_SE;
+       request.se_mode = se_mode;
+
+       ret = net_nfc_client_send_request_sync((net_nfc_request_msg_t *)&request, NULL);
+
+       if (ret != NET_NFC_OK)
+               DEBUG_ERR_MSG("net_nfc_set_card_emulation_mode_sync failed [%d]", ret);
+
+       return ret;
+}
+
+NET_NFC_EXPORT_API net_nfc_error_e net_nfc_set_secure_element_type_sync(
+       net_nfc_se_type_e se_type)
+{
+       net_nfc_error_e ret = NET_NFC_OK;
+       net_nfc_request_set_se_t request = { 0, };
+
+       if (se_type < NET_NFC_SE_TYPE_NONE || se_type > NET_NFC_SE_TYPE_UICC)
+       {
+               return NET_NFC_INVALID_PARAM;
+       }
+
+       request.length = sizeof(net_nfc_request_set_se_t);
+       request.request_type = NET_NFC_MESSAGE_SET_SE;
+       request.se_type = se_type;
+
+       ret = net_nfc_client_send_request_sync((net_nfc_request_msg_t *)&request, NULL);
+       if (ret != NET_NFC_OK)
+               DEBUG_ERR_MSG("net_nfc_set_secure_element_type_sync failed [%d]", ret);
+
+       return ret;
+}
+
+
 NET_NFC_EXPORT_API net_nfc_error_e net_nfc_set_secure_element_type(net_nfc_se_type_e se_type, void *trans_param)
 {
        net_nfc_error_e ret;
index dffeaea..97d8ba9 100755 (executable)
@@ -994,6 +994,42 @@ net_nfc_response_msg_t *net_nfc_client_read_response_msg(net_nfc_error_e *result
                }
                break;
 
+       case NET_NFC_MESSAGE_CARD_EMULATION_CHANGE_SE :
+               {
+                       net_nfc_response_se_change_card_emulation_t *resp_detail = NULL;
+                       int res = 0;
+
+                       DEBUG_CLIENT_MSG("Client Receive the NET_NFC_MESSAGE_CARD_EMULATION_CHANGE_SE");
+
+                       res = __net_nfc_client_read_util((void **)&resp_detail,
+                                                       sizeof(net_nfc_response_se_change_card_emulation_t));
+                       if (res != 1)
+                       {
+                               _net_nfc_util_free_mem(resp_msg);
+                               return NULL;
+                       }
+                       resp_msg->detail_message = resp_detail;
+
+               }
+               break;
+
+       case NET_NFC_MESSAGE_SE_CARD_EMULATION_CHANGED :
+               {
+                       net_nfc_response_notify_t *resp_detail = NULL;
+                       int res = 0;
+
+                       DEBUG_CLIENT_MSG("Client Receive the NET_NFC_MESSAGE_SE_CARD_EMULATION_CHANGED");
+
+                       res = __net_nfc_client_read_util((void **)&resp_detail, sizeof(net_nfc_response_notify_t));
+                       if (res != 1)
+                       {
+                               _net_nfc_util_free_mem(resp_msg);
+                               return NULL;
+                       }
+                       resp_msg->detail_message = resp_detail;
+               }
+               break;
+
        case NET_NFC_MESSAGE_TRANSCEIVE :
                {
                        net_nfc_response_transceive_t *resp_detail = NULL;
index f95313c..f8268a0 100644 (file)
@@ -50,7 +50,7 @@ NET_NFC_EXPORT_API net_nfc_error_e net_nfc_create_ndef_message (ndef_message_h*
 
 NET_NFC_EXPORT_API net_nfc_error_e net_nfc_create_rawdata_from_ndef_message (ndef_message_h ndef_message, data_h* rawdata)
 {
-       int count;
+       uint32_t count;
        net_nfc_error_e result;
        data_h tmp_data;
 
@@ -94,7 +94,7 @@ NET_NFC_EXPORT_API net_nfc_error_e net_nfc_create_ndef_message_from_rawdata (nde
 }
 
 
-NET_NFC_EXPORT_API net_nfc_error_e net_nfc_get_ndef_message_byte_length(ndef_message_h ndef_message, int * length)
+NET_NFC_EXPORT_API net_nfc_error_e net_nfc_get_ndef_message_byte_length(ndef_message_h ndef_message, uint32_t *length)
 {
        if (ndef_message == NULL || length == NULL){
                return NET_NFC_NULL_PARAMETER;
index 22dbced..e1e3398 100644 (file)
@@ -181,7 +181,7 @@ typedef enum
        NET_NFC_MESSAGE_TAG_DETACHED, /**< Type: Notify Event, <br> When a tag or SE is disappeared, you got this event.
                                                                         <br> The data contains the target info , need to cast to net_nfc_target_info_h but it does not have detail target info
                                                                         <br> please, do not use "net_nfc_get_tag_info_keys" when you got this event*/
-       NET_NFC_MESSAGE_FORMAT_NDEF, /**< Type: Response Event <br> After complete "net_nfc_format_ndef", this event is delivered */
+       /*10*/NET_NFC_MESSAGE_FORMAT_NDEF, /**< Type: Response Event <br> After complete "net_nfc_format_ndef", this event is delivered */
        NET_NFC_MESSAGE_LLCP_DISCOVERED,/**< Type: Notify Event <br> When LLCP is discovered and remote device is support llcp, you receive this event
                                                                         <br> data pointer contains the remote llcp configuration info. Cast to net_nfc_llcp_config_info_h*/
        NET_NFC_MESSAGE_P2P_DETACHED, /**< Type: Notify Event <br> When LLCP is de-activated by removing the device, you receive this event*/
@@ -194,10 +194,11 @@ typedef enum
        NET_NFC_MESSAGE_SE_START_TRANSACTION, /**< Type: Notify Event, indicates external reader start transaction*/
        NET_NFC_MESSAGE_SE_END_TRANSACTION, /**< Type: Notify Event, indicates external reader end transaction*/
        NET_NFC_MESSAGE_SE_TYPE_TRANSACTION, /**< Type: Notify Event, Indicates external reader trying to access secure element */
-       NET_NFC_MESSAGE_SE_CONNECTIVITY, /**< Type: Notify Event, This event notifies the terminal host that it shall send a connectivity event from UICC */
+       /*20*/NET_NFC_MESSAGE_SE_CONNECTIVITY, /**< Type: Notify Event, This event notifies the terminal host that it shall send a connectivity event from UICC */
        NET_NFC_MESSAGE_SE_FIELD_ON, /**< Type: Notify Event, indicates external reader field is on*/
        NET_NFC_MESSAGE_SE_FIELD_OFF, /**< Type: Notify Event, indicates external reader field is off*/
        NET_NFC_MESSAGE_SE_TYPE_CHANGED, /**< Type: Notify Event, indicates secure element type is changed*/
+       NET_NFC_MESSAGE_SE_CARD_EMULATION_CHANGED, /**< Type: Notify Event, indicates card emulation mode is changed*/
 
        NET_NFC_MESSAGE_CONNECTION_HANDOVER, /**< Type: Response Event. <br> The result of connection handover. If it has been completed successfully, this event will include the information of alternative carrier. */
 
@@ -205,13 +206,14 @@ typedef enum
        NET_NFC_MESSAGE_GET_SE,
        NET_NFC_MESSAGE_OPEN_INTERNAL_SE,
        NET_NFC_MESSAGE_CLOSE_INTERNAL_SE,
-       NET_NFC_MESSAGE_SEND_APDU_SE,
+       /*30*/NET_NFC_MESSAGE_SEND_APDU_SE,
        NET_NFC_MESSAGE_GET_ATR_SE,
+       NET_NFC_MESSAGE_CARD_EMULATION_CHANGE_SE,
        NET_NFC_GET_SERVER_STATE,
 
        NET_NFC_MESSAGE_SIM_TEST,
 
-       NET_NFC_MESSAGE_INIT,/*31*/
+       NET_NFC_MESSAGE_INIT,
        NET_NFC_MESSAGE_DEINIT,
 
        NET_NFC_MESSAGE_PRBS_TEST,
@@ -501,6 +503,13 @@ typedef enum
 
 typedef enum
 {
+    NET_NFC_CARD_EMELATION_ENABLE = 0,
+    NET_NFC_CARD_EMULATION_DISABLE,
+}
+net_nfc_card_emulation_mode_t;
+
+typedef enum
+{
        NET_NFC_SIGN_TYPE_NO_SIGN = 0,
        NET_NFC_SIGN_TYPE_PKCS_1,
        NET_NFC_SIGN_TYPE_PKCS_1_V_1_5,
index 07a39de..a64ecaf 100755 (executable)
@@ -341,10 +341,21 @@ typedef struct _net_nfc_target_info_s
        data_s raw_data;
 } net_nfc_target_info_s;
 
+typedef enum _net_nfc_secure_element_type_e
+{
+       SECURE_ELEMENT_TYPE_INVALID = 0x00, /**< Indicates SE type is Invalid */
+       SECURE_ELEMENT_TYPE_ESE = 0x01, /**< Indicates SE type is SmartMX */
+       SECURE_ELEMENT_TYPE_UICC = 0x02, /**<Indicates SE type is   UICC */
+       SECURE_ELEMENT_TYPE_UNKNOWN = 0x03 /**< Indicates SE type is Unknown */
+} net_nfc_secure_element_type_e;
+
 typedef struct _net_nfc_se_event_info_s
 {
        data_s aid;
        data_s param;
+       bool fg_dispatch;
+       pid_t focus_app_pid;
+       net_nfc_secure_element_type_e se_type;
 }net_nfc_se_event_info_s;
 
 typedef struct _net_nfc_transceive_info_s
@@ -792,6 +803,14 @@ typedef struct _net_nfc_request_get_atr_t
        net_nfc_target_handle_s *handle;
 } net_nfc_request_get_atr_t;
 
+typedef struct _net_nfc_request_se_change_card_emulation_t
+{
+       NET_NFC_REQUEST_MSG_HEADER
+
+       void *trans_param;
+       uint8_t se_mode;
+} net_nfc_request_se_change_card_emulation_t;
+
 typedef struct _net_nfc_request_connection_handover_t
 {
        NET_NFC_REQUEST_MSG_HEADER
@@ -861,6 +880,9 @@ typedef struct _net_nfc_response_se_event_t
 
        data_s aid;
        data_s param;
+       bool fg_dispatch;
+       pid_t focus_app_pid;
+       net_nfc_secure_element_type_e se_type;
 } net_nfc_response_se_event_t;
 
 typedef struct _net_nfc_response_get_current_tag_info_t
@@ -1090,6 +1112,14 @@ typedef struct _net_nfc_response_get_se_t
        void *trans_param;
 } net_nfc_response_get_se_t;
 
+typedef struct _net_nfc_response_se_change_card_emulation_t
+{
+       NET_NFC_RESPONSE_MSG_HEADER
+
+       uint8_t se_mode;
+       void *trans_param;
+} net_nfc_response_se_change_card_emulation_t;
+
 typedef struct _net_nfc_response_open_internal_se_t
 {
        NET_NFC_RESPONSE_MSG_HEADER
@@ -1193,14 +1223,6 @@ typedef enum _net_nfc_discovery_mode_e
        NET_NFC_DISCOVERY_MODE_RESUME,
 } net_nfc_discovery_mode_e;
 
-typedef enum _net_nfc_secure_element_type_e
-{
-       SECURE_ELEMENT_TYPE_INVALID = 0x00, /**< Indicates SE type is Invalid */
-       SECURE_ELEMENT_TYPE_ESE = 0x01, /**< Indicates SE type is SmartMX */
-       SECURE_ELEMENT_TYPE_UICC = 0x02, /**<Indicates SE type is   UICC */
-       SECURE_ELEMENT_TYPE_UNKNOWN = 0x03 /**< Indicates SE type is Unknown */
-} net_nfc_secure_element_type_e;
-
 typedef enum _net_nfc_secure_element_state_e
 {
        SECURE_ELEMENT_ACTIVE_STATE = 0x00, /**< state of the SE is active  */
index ee035e0..498b455 100644 (file)
@@ -32,9 +32,11 @@ void net_nfc_app_util_aul_launch_app(char* package_name, bundle* kb);
 void net_nfc_app_util_clean_storage(char* src_path);
 bool net_nfc_app_util_is_dir(const char* path_name);
 int net_nfc_app_util_appsvc_launch(const char *operation, const char *uri, const char *mime, const char *data);
-int net_nfc_app_util_launch_se_transaction_app(uint8_t *aid, uint32_t aid_len, uint8_t *param, uint32_t param_len);
+int net_nfc_app_util_launch_se_transaction_app(net_nfc_secure_element_type_e se_type,
+                       uint8_t *aid, uint32_t aid_len, uint8_t *param, uint32_t param_len);
 int net_nfc_app_util_encode_base64(uint8_t *buffer, uint32_t buf_len, char *result, uint32_t max_result);
 int net_nfc_app_util_decode_base64(const char *buffer, uint32_t buf_len, uint8_t *result, uint32_t *res_len);
 bool net_nfc_app_util_check_launch_state();
+pid_t net_nfc_app_util_get_focus_app_pid();
 
 #endif
index 150352f..a448b0b 100755 (executable)
@@ -24,6 +24,7 @@ typedef struct _se_setting_t
        net_nfc_target_handle_s *current_ese_handle;
        void *open_request_trans_param;
        uint8_t type;
+       uint8_t return_type;
        uint8_t mode;
 }
 net_nfc_se_setting_t;
@@ -55,5 +56,6 @@ void net_nfc_service_se_open_se(net_nfc_request_msg_t *msg);
 void net_nfc_service_se_set_se(net_nfc_request_msg_t *msg);
 void net_nfc_service_se_get_se(net_nfc_request_msg_t *msg);
 void net_nfc_service_se_cleanup();
+void net_nfc_service_se_change_card_emulation_mode(net_nfc_request_msg_t *req_msg);
 
 #endif
index e277e4d..cdb6f1a 100644 (file)
@@ -801,7 +801,8 @@ void _string_to_binary(const char *input, uint8_t *output, uint32_t *length)
        *length = current / 2;
 }
 
-int net_nfc_app_util_launch_se_transaction_app(uint8_t *aid, uint32_t aid_len, uint8_t *param, uint32_t param_len)
+int net_nfc_app_util_launch_se_transaction_app(net_nfc_secure_element_type_e se_type,
+               uint8_t *aid, uint32_t aid_len, uint8_t *param, uint32_t param_len)
 {
        int result;
        bundle *bd = NULL;
@@ -818,7 +819,18 @@ int net_nfc_app_util_launch_se_transaction_app(uint8_t *aid, uint32_t aid_len, u
                char aid_string[1024] = { 0, };
 
                _binary_to_string(aid, aid_len, temp_string, sizeof(temp_string));
-               snprintf(aid_string, sizeof(aid_string), "nfc://secure/aid/%s", temp_string);
+               switch(se_type)
+               {
+                       case SECURE_ELEMENT_TYPE_UICC:
+                               snprintf(aid_string, sizeof(aid_string), "nfc://secure/SIM1/aid/%s", temp_string);
+                               break;
+                       case SECURE_ELEMENT_TYPE_ESE:
+                               snprintf(aid_string, sizeof(aid_string), "nfc://secure/eSE/aid/%s", temp_string);
+                               break;
+                       default:
+                               snprintf(aid_string, sizeof(aid_string), "nfc://secure/aid/%s", temp_string);
+                               break;
+               }
                DEBUG_SERVER_MSG("aid_string : %s", aid_string);
                appsvc_set_uri(bd, aid_string);
        }
@@ -908,7 +920,7 @@ int net_nfc_app_util_decode_base64(const char *buffer, uint32_t buf_len, uint8_t
        return ret;
 }
 
-static pid_t _net_nfc_app_util_get_focus_app_pid()
+pid_t net_nfc_app_util_get_focus_app_pid()
 {
        Ecore_X_Window focus;
        pid_t pid;
@@ -928,7 +940,7 @@ bool net_nfc_app_util_check_launch_state()
        net_nfc_launch_popup_state_e popup_state;
        bool result = false;
 
-       focus_app_pid = _net_nfc_app_util_get_focus_app_pid();
+       focus_app_pid = net_nfc_app_util_get_focus_app_pid();
 
        popup_state = net_nfc_server_get_client_popup_state(focus_app_pid);
 
index cc09b31..f94052c 100644 (file)
@@ -243,6 +243,12 @@ static void *_net_nfc_dispatcher_thread_func(void *data)
                        }
                        break;
 
+               case NET_NFC_MESSAGE_CARD_EMULATION_CHANGE_SE :
+                       {
+                               net_nfc_service_se_change_card_emulation_mode(req_msg);
+                       }
+                       break;
+
                case NET_NFC_MESSAGE_P2P_SEND :
                        {
                                net_nfc_request_p2p_send_t *exchanger = (net_nfc_request_p2p_send_t *)req_msg;
index a2659e5..2becb17 100755 (executable)
@@ -71,9 +71,15 @@ uint8_t net_nfc_service_se_get_se_type()
 
 void net_nfc_service_se_set_se_type(uint8_t type)
 {
+       g_se_setting.return_type = g_se_setting.type;
        g_se_setting.type = type;
 }
 
+uint8_t net_nfc_service_se_get_return_se_mode()
+{
+    return g_se_setting.return_type;
+}
+
 uint8_t net_nfc_service_se_get_se_mode()
 {
        return g_se_setting.mode;
@@ -84,6 +90,28 @@ void net_nfc_service_se_set_se_mode(uint8_t mode)
        g_se_setting.mode = mode;
 }
 
+net_nfc_error_e net_nfc_service_se_disable_card_emulation()
+{
+    net_nfc_error_e result;
+
+    net_nfc_service_se_set_se_type(SECURE_ELEMENT_TYPE_INVALID);
+    net_nfc_service_se_set_se_mode(SECURE_ELEMENT_OFF_MODE);
+
+    /*turn off ESE*/
+    net_nfc_controller_set_secure_element_mode(
+        SECURE_ELEMENT_TYPE_ESE,
+        SECURE_ELEMENT_OFF_MODE,
+        &result);
+
+    /*turn off UICC*/
+    net_nfc_controller_set_secure_element_mode(
+        SECURE_ELEMENT_TYPE_UICC,
+        SECURE_ELEMENT_OFF_MODE,
+        &result);
+
+    return NET_NFC_OK;
+}
+
 net_nfc_error_e net_nfc_service_se_change_se(uint8_t type)
 {
        net_nfc_error_e result = NET_NFC_OK;
@@ -438,16 +466,40 @@ void _uicc_status_noti_cb(TapiHandle *handle, const char *noti_id, void *data, v
 bool net_nfc_service_se_transaction_receive(net_nfc_request_msg_t* msg)
 {
        bool res = true;
+       bool fg_dispatch;
+       pid_t focus_app_pid;
+       net_nfc_secure_element_type_e se_type;
        net_nfc_request_se_event_t *se_event = (net_nfc_request_se_event_t *)msg;
 
        if (se_event->request_type == NET_NFC_MESSAGE_SE_START_TRANSACTION)
        {
                DEBUG_SERVER_MSG("launch se app");
 
-               net_nfc_app_util_launch_se_transaction_app(se_event->aid.buffer,
+               se_type = net_nfc_service_se_get_se_type();
+               fg_dispatch = net_nfc_app_util_check_launch_state();
+               focus_app_pid = net_nfc_app_util_get_focus_app_pid();
+
+               res = net_nfc_app_util_launch_se_transaction_app(se_type, se_event->aid.buffer,
                        se_event->aid.length, se_event->param.buffer, se_event->param.length);
 
                DEBUG_SERVER_MSG("launch se app end");
+
+               if (net_nfc_server_check_client_is_running(msg->client_fd))
+               {
+                       net_nfc_response_se_event_t resp = { 0 };
+
+                       resp.length = sizeof(net_nfc_response_se_event_t);
+                       resp.flags = se_event->flags;
+                       resp.result = res;
+                       resp.aid = se_event->aid;
+                       resp.param = se_event->param;
+                       resp.fg_dispatch = fg_dispatch;
+                       resp.focus_app_pid = focus_app_pid;
+                       resp.se_type = se_type;
+
+                       net_nfc_broadcast_response_msg(NET_NFC_MESSAGE_SE_START_TRANSACTION,
+                               (void *)&resp, sizeof(net_nfc_response_se_event_t), NULL);
+               }
        }
 
        return res;
@@ -709,6 +761,54 @@ void net_nfc_service_se_open_se(net_nfc_request_msg_t *msg)
        }
 }
 
+void net_nfc_service_se_change_card_emulation_mode(net_nfc_request_msg_t *msg)
+{
+   bool isModeChange = false;
+   uint8_t current_mode, return_mode;
+       net_nfc_error_e result = NET_NFC_OK;
+       net_nfc_request_se_change_card_emulation_t *detail
+               = (net_nfc_request_se_change_card_emulation_t *)msg;
+
+       current_mode = net_nfc_service_se_get_se_mode();
+
+       if(detail->se_mode == SECURE_ELEMENT_ACTIVE_STATE
+                       && current_mode == SECURE_ELEMENT_TYPE_INVALID)
+       {
+               return_mode = net_nfc_service_se_get_return_se_mode();
+               result = net_nfc_service_se_change_se(return_mode);
+               isModeChange = true;
+       }
+       else if(detail->se_mode == SECURE_ELEMENT_INACTIVE_STATE
+                       && current_mode != SECURE_ELEMENT_TYPE_INVALID)
+       {
+               result = net_nfc_service_se_disable_card_emulation();
+               isModeChange = true;
+       }
+
+       if (net_nfc_server_check_client_is_running(msg->client_fd))
+       {
+               net_nfc_response_se_change_card_emulation_t resp = { 0 };
+
+               resp.length = sizeof(net_nfc_response_se_change_card_emulation_t);
+               resp.flags = detail->flags;
+               resp.user_param = detail->user_param;
+               resp.trans_param = detail->trans_param;
+               resp.result = result;
+               resp.se_mode = detail->se_mode;
+
+               net_nfc_send_response_msg(msg->client_fd, msg->request_type,
+                       (void *)&resp, sizeof(net_nfc_response_se_change_card_emulation_t), NULL);
+       }
+
+       if(isModeChange)
+       {
+               net_nfc_response_notify_t noti_se = { 0, };
+
+               net_nfc_broadcast_response_msg(NET_NFC_MESSAGE_SE_CARD_EMULATION_CHANGED,
+                       (void *)&noti_se, sizeof(net_nfc_response_notify_t), NULL);
+       }
+}
+
 void net_nfc_service_se_set_se(net_nfc_request_msg_t *msg)
 {
 #if 1