[ITC][media-controller][Non-ACR][Fixed issue in API mc_server_send_cmd_reply, client... 18/201518/5
authorPriya Kohli <priya.kohli@samsung.com>
Fri, 15 Mar 2019 06:59:08 +0000 (12:29 +0530)
committershobhit verma <shobhit.v@samsung.com>
Tue, 26 Mar 2019 06:43:48 +0000 (06:43 +0000)
Change-Id: I6db5b04335a6710954737d9e805b9411a977db97
Signed-off-by: Priya Kohli <priya.kohli@samsung.com>
src/itc/media-controller/ITs-media-controller-client.c
src/itc/media-controller/ITs-media-controller-server.c

index 53ac8edcb347b4791d8fb520564a468325fd0b24..9b6404d1844fca77712094d1638559d866b53d74 100755 (executable)
@@ -219,24 +219,6 @@ bool ForeachServerSubscribedCallBack(const char *server_name, void *user_data)
        return false;
 }
 
-/**
- * @function           ServerCustomCommandCallBack
- * @description                Callback Function
- * @parameter          const char* client_name, const char *command, bundle *data, void *user_data
- * @return                     NA
- */
-void ServerCustomCommandCallBack(const char* client_name, const char *command, bundle *data, void *user_data)
-{
-#if DEBUG
-       FPRINTF("[Line : %d][%s] %s Callback Invoked\\n", __LINE__, API_NAMESPACE, "ServerCustomCommandCallBack");
-#endif
-
-       strncpy(g_szClientName, client_name, PATHLEN);
-       g_CallBackHit = true;
-       QuitGmainLoop();
-       return;
-}
-
 /**
  * @function           ClientCustomComandReplyCallBack
  * @description                Callback Function
@@ -442,13 +424,16 @@ void McServerSearchCmdReceivedCallBack(const char *client_name, const char *requ
  * @parameter          const char client_name, const char *request_id, const char *command, bundle *data, void *user_data
  * @return                     NA
  */
-void ServerCustomCmdReceivedCallback(const char client_name, const char *request_id, const char *command, bundle *data, void *user_data)
+void ServerCustomCmdReceivedCallback(const char client_name, const char *request_id, const char *command, bundle *data, void *user_data)
 {
 #if DEBUG
        FPRINTF("[Line : %d][%s] %s Callback Invoked\\n", __LINE__, API_NAMESPACE, "ServerCustomCmdReceivedCallback");
 #endif
+       if(client_name)
+               strncpy(g_szClientName, client_name, strlen(client_name)+1);
        g_CallBackHit = true;
        QuitGmainLoop();
+       return;
 }
 /*****************************************************Callback End*****************************************************/
 
@@ -1373,7 +1358,7 @@ int ITc_mc_client_send_custom_cmd_p(void)
        nRet = GetCompleteServerInfo();
        PRINT_RESULT(MEDIA_CONTROLLER_ERROR_NONE, nRet, "GetCompleteServerInfo", "Return Value Not Correct");
 
-       nRet = mc_client_send_custom_cmd(g_hMcClient, g_szServerName, TESTCOMMAND, bundle_data, g_request_id);
+       nRet = mc_client_send_custom_cmd(g_hMcClient, g_szServerName, TESTCOMMAND, bundle_data, &g_request_id);
        PRINT_RESULT(MEDIA_CONTROLLER_ERROR_NONE, nRet, "mc_client_send_custom_cmd", MediaControllerGetError(nRet));
 
        return 0;
@@ -1415,7 +1400,7 @@ int ITc_mc_client_set_unset_cmd_reply_received_cb_p(void)
        PRINT_RESULT_CLEANUP(MEDIA_CONTROLLER_ERROR_NONE, nRet, "ServerCustomCmdReceivedCallback", MediaControllerGetError(nRet), mc_client_unset_cmd_reply_received_cb(g_hMcClient));
 
        g_CallBackHit = false;
-       nRet = mc_client_send_custom_cmd(g_hMcClient, g_szServerName, TESTCOMMAND, bundle_data, g_request_id);
+       nRet = mc_client_send_custom_cmd(g_hMcClient, g_szServerName, TESTCOMMAND, bundle_data, &g_request_id);
        PRINT_RESULT_CLEANUP(MEDIA_CONTROLLER_ERROR_NONE, nRet, "mc_client_send_custom_cmd", MediaControllerGetError(nRet), mc_client_unset_cmd_reply_received_cb(g_hMcClient); mc_server_unset_custom_cmd_received_cb(g_hMcServer));
 
        IterateGmainLoop();
index 4e74ac4451410a53dbc17f08f4eb9480799df309..b68af5950e6edcb9c1eeebc4040113a647181e30 100755 (executable)
@@ -767,7 +767,7 @@ int ITc_mc_server_set_unset_custom_cmd_received_cb_p(void)
        nRet = mc_server_set_custom_cmd_received_cb(g_hMcServer, ServerCustomCommandReceivedCallback, g_UserData);
        PRINT_RESULT(MEDIA_CONTROLLER_ERROR_NONE, nRet, "mc_server_set_custom_cmd_received_cb", MediaControllerGetError(nRet));
 
-       nRet = mc_client_send_custom_cmd(g_hMcClient, g_szServerName, TESTCOMMAND, bundle_data, g_request_id);
+       nRet = mc_client_send_custom_cmd(g_hMcClient, g_szServerName, TESTCOMMAND, bundle_data, &g_request_id);
        PRINT_RESULT_CLEANUP(MEDIA_CONTROLLER_ERROR_NONE, nRet, "mc_client_send_custom_cmd", MediaControllerGetError(nRet), mc_server_unset_custom_cmd_received_cb(g_hMcServer));
 
        IterateGmainLoop();