Added init service method to check privilege 47/128947/1
authorhyunuktak <hyunuk.tak@samsung.com>
Fri, 12 May 2017 06:38:47 +0000 (15:38 +0900)
committerhyunuktak <hyunuk.tak@samsung.com>
Fri, 12 May 2017 06:38:49 +0000 (15:38 +0900)
Change-Id: Ia3298e116b7c787e565706e07e57c91425b0b43d
Signed-off-by: hyunuktak <hyunuk.tak@samsung.com>
packaging/capi-network-stc.spec
src/internal/include/stc-dbus.h
src/internal/stc-event.c

index 021d03ded27a1aa894992e05a8b3ee78271bbfd5..035163f78aaca8b73d511546941eeb6f3ba8364d 100755 (executable)
@@ -1,6 +1,6 @@
 Name:       capi-network-stc
 Summary:    A Smart Traffic Control (STC) libraries in Native API
-Version:    0.0.3
+Version:    0.0.4
 Release:    1
 Group:      Network & Connectivity/API
 License:    Apache-2.0
index 0c98cf35033a04450ba29804f0e22155e8ff6704..dd2bbb9abb41393bfb7c6d3f3578791218f48825 100755 (executable)
@@ -59,6 +59,7 @@ extern "C" {
 #define STC_MANAGER_STATS_PATH                 "/net/stc/statistics"
 #define STC_MANAGER_RESTRICTION_PATH   "/net/stc/restriction"
 
+#define STC_MANAGER_METHOD_STATS_INIT                          "Init"
 #define STC_MANAGER_METHOD_STATS_GET_PER_APP_ID                "Get"
 #define STC_MANAGER_METHOD_STATS_GET_ALL                       "GetAll"
 #define STC_MANAGER_METHOD_STATS_GET_TOTAL                     "Get"
index 419e56e7c2f5c6076efc81a32fe915663ab0c572..03d79b9cfa5597aa29241ab432921e961fbaa11e 100755 (executable)
@@ -98,6 +98,28 @@ static gboolean __stc_event_client_idle_cb(gpointer idle_data)
        return false;
 }
 
+static int __stc_init_service(void)
+{
+       GVariant *message = NULL;
+       stc_error_e error = STC_ERROR_NONE;
+       int result = 0;
+
+       message = _stc_dbus_invoke_method(
+               STC_MANAGER_SERVICE,
+               STC_MANAGER_STATS_PATH,
+               STC_MANAGER_STATS_INTERFACE,
+               STC_MANAGER_METHOD_STATS_INIT,
+               NULL,
+               &error);
+
+       STC_RETURN_VAL_IF(message == NULL,
+               error, "Failed to invoke dbus method");
+
+       STC_LOGI("Successfully init service [%d]", result);
+
+       return STC_ERROR_NONE;
+}
+
 int _stc_register_event_cb(stc_event_cb event_cb, void *user_data)
 {
        int ret = STC_ERROR_NONE;
@@ -124,6 +146,13 @@ int _stc_register_event_cb(stc_event_cb event_cb, void *user_data)
                                _stc_convert_error_type_to_string(ret));
                        return ret;
                }
+
+               ret = __stc_init_service();
+               if (ret != STC_ERROR_NONE) {
+                       STC_LOGE("Failed to init manager [%s]",
+                               _stc_convert_error_type_to_string(ret));
+                       return ret;
+               }
        }
 
        g_stc_event_handle.event_callback = event_cb;