Added option to set target client id in app-comm service 88/105588/1
authorkmook <kmook.choi@samsung.com>
Mon, 19 Dec 2016 05:21:11 +0000 (14:21 +0900)
committerkmook <kmook.choi@samsung.com>
Mon, 19 Dec 2016 05:21:11 +0000 (14:21 +0900)
Change-Id: I6335e86c95ccab12dda34eb5302bf5879cb4a40f
Signed-off-by: kmook <kmook.choi@samsung.com>
common/Types.h
daemon/service_provider/AppCommServiceProvider.cpp

index bd8cf9c..637a500 100644 (file)
@@ -179,6 +179,7 @@ enum AccessControlState {
 #define CONV_JSON_CLIENT_CONNECT_TIME                  "client_connect_time"
 #define CONV_JSON_CLIENT_CLIENT_ID                             "client_id"
 #define CONV_JSON_SECURE_MODE                                  "secure_mode"
+#define CONV_JSON_TARGET_CLIENT_ID                             "target_client_id"
 
 #define CONV_JSON_ON_START                                             "onStart"
 #define CONV_JSON_ON_CONNECT                                   "onConnect"
index 8cce18f..48ab640 100755 (executable)
@@ -428,9 +428,16 @@ int conv::AppCommServiceProvider::publishRequest(Request* requestObj)
 
                                Json payload;
                                requestObj->getPayloadFromDescription(&payload);
+                               string targetClient;
 
-                               (*iter)->application->publish("d2d_service_message", payload.str().c_str(), requestObj->getBinary(), requestObj->getBinaryLength(), NULL);
-                               _D("publishing done");
+                               payload.get(NULL, CONV_JSON_TARGET_CLIENT_ID, &targetClient);
+
+                               if (targetClient.empty()) {
+                                       (*iter)->application->publish("d2d_service_message", payload.str().c_str(), requestObj->getBinary(), requestObj->getBinaryLength(), NULL);
+                                       _D("publishing broadcast done");
+                               } else {
+                                       (*iter)->application->publish("d2d_service_message", payload.str().c_str(), targetClient.c_str(), requestObj->getBinary(), requestObj->getBinaryLength(), NULL);
+                               }
                                return CONV_ERROR_NONE;
                        }
                }