Add a DBus method to access vconf via DBus 56/266256/7
authorJaehyun Kim <jeik01.kim@samsung.com>
Wed, 10 Nov 2021 01:56:53 +0000 (10:56 +0900)
committerJaehyun Kim <jeik01.kim@samsung.com>
Thu, 11 Nov 2021 11:30:37 +0000 (20:30 +0900)
Change-Id: I62dd5fe43506e1bb7f09b069b4e2c1e01324d5e6
Signed-off-by: Jaehyun Kim <jeik01.kim@samsung.com>
interfaces/netconfig-iface-network-state.xml
resources/etc/dbus-1/system.d/net-config-robot.conf
resources/etc/dbus-1/system.d/net-config.conf
src/network-state.c

index 5b8b46a..ddcafe6 100755 (executable)
                        <arg type="s" name="profile" direction="in"/>
                        <arg type="s" name="address" direction="out"/>
                </method>
+               <method name="RequestVconfValue">
+                       <arg type="s" name="key" direction="in"/>
+                       <arg type="s" name="type" direction="in"/>
+                       <arg type="i" name="ret" direction="out"/>
+                       <arg type="i" name="int_value" direction="out"/>
+                       <arg type="s" name="str_value" direction="out"/>
+               </method>
        </interface>
        <interface name="net.netconfig.tcpdump">
                <method name="StartTCPDump">
index 7c497e2..1f3150e 100755 (executable)
@@ -48,6 +48,7 @@
                <allow send_destination="net.netconfig" send_interface="net.netconfig.network" send_member="CheckProfilePrivilege" />
                <allow send_destination="net.netconfig" send_interface="net.netconfig.network" send_member="CheckInternetPrivilege" />
                <allow send_destination="net.netconfig" send_interface="net.netconfig.network" send_member="GetMeteredInfo" />
+               <allow send_destination="net.netconfig" send_interface="net.netconfig.network" send_member="RequestVconfValue" />
 
                <allow send_destination="net.netconfig" send_interface="net.netconfig.network_statistics" send_member="GetWifiLastRxBytes" />
                <allow send_destination="net.netconfig" send_interface="net.netconfig.network_statistics" send_member="GetWifiLastTxBytes" />
index c651886..a8cb76b 100755 (executable)
@@ -48,6 +48,7 @@
                <check send_destination="net.netconfig" send_interface="net.netconfig.network" send_member="CheckProfilePrivilege" privilege="http://tizen.org/privilege/network.profile" />
                <check send_destination="net.netconfig" send_interface="net.netconfig.network" send_member="CheckInternetPrivilege" privilege="http://tizen.org/privilege/internet" />
                <check send_destination="net.netconfig" send_interface="net.netconfig.network" send_member="GetMeteredInfo" privilege="http://tizen.org/privilege/network.get" />
+               <check send_destination="net.netconfig" send_interface="net.netconfig.network" send_member="RequestVconfValue" privilege="http://tizen.org/privilege/network.get" />
 
                <check send_destination="net.netconfig" send_interface="net.netconfig.network_statistics" send_member="GetWifiLastRxBytes" privilege="http://tizen.org/privilege/network.get" />
                <check send_destination="net.netconfig" send_interface="net.netconfig.network_statistics" send_member="GetWifiLastTxBytes" privilege="http://tizen.org/privilege/network.get" />
index a137aff..586ef7f 100755 (executable)
@@ -1440,6 +1440,30 @@ gboolean handle_preferred_ipv6_address(Network *object,
        return TRUE;
 }
 
+gboolean handle_request_vconf_value(Network *object,
+       GDBusMethodInvocation *context, gchar *key, gchar *type)
+{
+       int ret = 0;
+       int int_value = 0;
+       char *str_value = "";
+
+       if (!g_strcmp0(type, "string"))
+               str_value = vconf_get_str(key);
+       else if (!g_strcmp0(type, "int"))
+               ret = vconf_get_int(key, &int_value);
+       else if (!g_strcmp0(type, "bool"))
+               ret = vconf_get_bool(key, &int_value);
+
+       DBG("Vconf key: %s, type: %s, int_value: %d, str_value: %s, ret: %d",
+                       key, type, int_value, str_value, ret);
+       network_complete_request_vconf_value(object, context, ret, int_value, str_value);
+
+       if (!g_strcmp0(type, "string"))
+               g_free(str_value);
+
+       return TRUE;
+}
+
 gboolean handle_get_battery_dn_list(Battery *object,
        GDBusMethodInvocation *context)
 {
@@ -1530,6 +1554,8 @@ void state_object_create_and_init(void)
                                G_CALLBACK(handle_device_policy_get_wifi_profile), NULL);
        g_signal_connect(netconfigstate, "handle-get-metered-info",
                                G_CALLBACK(handle_get_metered_info), NULL);
+       g_signal_connect(netconfigstate, "handle-request-vconf-value",
+                               G_CALLBACK(handle_request_vconf_value), NULL);
 
        if (!g_dbus_interface_skeleton_export(interface_network, connection,
                        NETCONFIG_NETWORK_STATE_PATH, NULL)) {