2 * Network Configuration Module
4 * Copyright (c) 2000 - 2012 Samsung Electronics Co., Ltd. All rights reserved.
6 * Licensed under the Apache License, Version 2.0 (the "License");
7 * you may not use this file except in compliance with the License.
8 * You may obtain a copy of the License at
10 * http://www.apache.org/licenses/LICENSE-2.0
12 * Unless required by applicable law or agreed to in writing, software
13 * distributed under the License is distributed on an "AS IS" BASIS,
14 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 * See the License for the specific language governing permissions and
16 * limitations under the License.
26 #include "netsupplicant.h"
27 #include "wifi-passpoint.h"
29 #if defined TIZEN_WLAN_PASSPOINT
30 static gboolean netconfig_wifi_get_passpoint(gint32 *enabled)
32 GVariant *reply, *var = NULL;
34 gboolean result = FALSE;
36 reply = netconfig_supplicant_invoke_dbus_interface_property_get(SUPPLICANT_IFACE_INTERFACE,
39 ERR("Error!!! Failed to get passpoint property");
43 g_variant_get(reply, "(v)", &var);
45 if (g_variant_is_of_type(var, G_VARIANT_TYPE_INT32)) {
46 value = g_variant_get_int32(var);
58 g_variant_unref(reply);
63 static gboolean netconfig_wifi_set_passpoint(gint32 enable)
65 gint32 value = enable ? 1 : 0;
66 gboolean result = FALSE;
67 GVariant *input_args = NULL;
69 input_args = g_variant_new_int32(value);
71 result = netconfig_supplicant_invoke_dbus_interface_property_set(
72 SUPPLICANT_IFACE_INTERFACE, "Passpoint", input_args, NULL);
74 ERR("Fail to set passpoint enable[%d]", enable);
80 gboolean handle_get_passpoint(Wifi *wifi, GDBusMethodInvocation *context)
83 g_return_val_if_fail(wifi != NULL, FALSE);
85 #if defined TIZEN_WLAN_PASSPOINT
86 if (netconfig_wifi_get_passpoint(&enable)) {
87 wifi_complete_get_passpoint(wifi, context, enable);
90 wifi_complete_get_passpoint(wifi, context, enable);
94 wifi_complete_get_passpoint(wifi, context, enable);
99 gboolean handle_set_passpoint(Wifi *wifi, GDBusMethodInvocation *context, gint enable)
101 gboolean result = FALSE;
102 g_return_val_if_fail(wifi != NULL, FALSE);
104 #if defined TIZEN_WLAN_PASSPOINT
105 result = netconfig_wifi_set_passpoint(enable);
106 wifi_complete_set_passpoint(wifi, context);
109 wifi_complete_set_passpoint(wifi, context);