2 * Network Configuration Module
\r
4 * Copyright (c) 2012-2013 Samsung Electronics Co., Ltd. All rights reserved.
\r
6 * Licensed under the Apache License, Version 2.0 (the "License");
\r
7 * you may not use this file except in compliance with the License.
\r
8 * You may obtain a copy of the License at
\r
10 * http://www.apache.org/licenses/LICENSE-2.0
\r
12 * Unless required by applicable law or agreed to in writing, software
\r
13 * distributed under the License is distributed on an "AS IS" BASIS,
\r
14 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
\r
15 * See the License for the specific language governing permissions and
\r
16 * limitations under the License.
\r
24 #include "neterror.h"
\r
25 #include "netdbus.h"
\r
26 #include "netsupplicant.h"
\r
27 #include "wifi-passpoint.h"
\r
30 static gboolean netconfig_wifi_get_passpoint(gint32 *enabled)
\r
33 DBusMessageIter iter, variant;
\r
35 gboolean result = FALSE;
\r
37 reply = netconfig_supplicant_invoke_dbus_interface_property_get(SUPPLICANT_IFACE_INTERFACE,
\r
39 if (reply == NULL) {
\r
40 ERR("Error!!! Failed to get passpoint property");
\r
44 if (dbus_message_get_type(reply) == DBUS_MESSAGE_TYPE_ERROR) {
\r
45 const char *err_msg = dbus_message_get_error_name(reply);
\r
46 ERR("Error!!! Error message received [%s]", err_msg);
\r
50 dbus_message_iter_init(reply, &iter);
\r
52 if (dbus_message_iter_get_arg_type(&iter) == DBUS_TYPE_VARIANT) {
\r
53 dbus_message_iter_recurse(&iter, &variant);
\r
54 if (dbus_message_iter_get_arg_type(&variant) == DBUS_TYPE_INT32) {
\r
55 dbus_message_iter_get_basic(&variant, &value);
\r
65 dbus_message_unref(reply);
\r
70 static gboolean netconfig_wifi_set_passpoint(gint32 enable)
\r
72 gint32 value = enable;
\r
73 gboolean result = FALSE;
\r
74 GList *input_args = NULL;
\r
76 struct dbus_input_arguments args_enable[2] = {
\r
77 {DBUS_TYPE_INT32, &value},
\r
78 {DBUS_TYPE_INVALID, NULL}
\r
81 input_args = setup_input_args(input_args, args_enable);
\r
83 result = netconfig_supplicant_invoke_dbus_interface_property_set(SUPPLICANT_IFACE_INTERFACE,
\r
84 "Passpoint", DBUS_TYPE_INT32_AS_STRING, input_args, NULL);
\r
85 if (result == FALSE)
\r
86 ERR("Fail to set passpoint enable [%d]", enable);
\r
88 g_list_free(input_args);
\r
93 gboolean netconfig_iface_wifi_get_passpoint(NetconfigWifi *wifi,
\r
94 gint32 *result, GError **error)
\r
96 g_return_val_if_fail(wifi != NULL, FALSE);
\r
98 if (netconfig_wifi_get_passpoint(result))
\r
104 gboolean netconfig_iface_wifi_set_passpoint(NetconfigWifi *wifi,
\r
105 gint32 enable, GError **error)
\r
107 g_return_val_if_fail(wifi != NULL, FALSE);//Verifies that the expression expr , usually representing a precondition, evaluates to TRUE. If the function does not return a value, use g_return_if_fail() instead
\r
109 return netconfig_wifi_set_passpoint(enable);
\r