[ml-service] Fix session type of ml-service API
authorYongjoo Ahn <yongjoo1.ahn@samsung.com>
Mon, 22 Aug 2022 08:57:52 +0000 (17:57 +0900)
committerjaeyun-jung <39614140+jaeyun-jung@users.noreply.github.com>
Thu, 25 Aug 2022 01:40:31 +0000 (10:40 +0900)
- Set System type for ml-service API.
- If fails to get system bus, try with session type (for unittest)

Signed-off-by: Yongjoo Ahn <yongjoo1.ahn@samsung.com>
c/src/ml-api-service-agent-client.c

index 93e944a..997396b 100644 (file)
@@ -31,12 +31,24 @@ typedef struct
 static MachinelearningServicePipeline *
 _get_proxy_new_for_bus_sync (void)
 {
+  MachinelearningServicePipeline *mlsp;
+
   /** @todo deal with GError */
-  return
-      machinelearning_service_pipeline_proxy_new_for_bus_sync
+  mlsp = machinelearning_service_pipeline_proxy_new_for_bus_sync
+      (G_BUS_TYPE_SYSTEM, G_DBUS_PROXY_FLAGS_NONE,
+      "org.tizen.machinelearning.service",
+      "/Org/Tizen/MachineLearning/Service/Pipeline", NULL, NULL);
+
+  if (mlsp)
+    return mlsp;
+
+  /** Try with session type */
+  mlsp = machinelearning_service_pipeline_proxy_new_for_bus_sync
       (G_BUS_TYPE_SESSION, G_DBUS_PROXY_FLAGS_NONE,
       "org.tizen.machinelearning.service",
       "/Org/Tizen/MachineLearning/Service/Pipeline", NULL, NULL);
+
+  return mlsp;
 }
 
 /**