[PATCH 3/6] adding wps model name as property in dbus

Avichal Agarwal avichal.a at samsung.com
Wed Dec 21 04:24:22 PST 2016


Signed-off-by: Avichal Agarwal <avichal.a at samsung.com>
Signed-off-by: Kyeong-Chae Lim <kcya.lim at samsung.com>
---
 wpa_supplicant/dbus/dbus_new.c              |  6 +++
 wpa_supplicant/dbus/dbus_new_handlers.h     |  3 ++
 wpa_supplicant/dbus/dbus_new_handlers_wps.c | 61 ++++++++++++++++++++++++++++-
 3 files changed, 69 insertions(+), 1 deletion(-)

diff --git a/wpa_supplicant/dbus/dbus_new.c b/wpa_supplicant/dbus/dbus_new.c
index 055a86d..887dcc3 100644
--- a/wpa_supplicant/dbus/dbus_new.c
+++ b/wpa_supplicant/dbus/dbus_new.c
@@ -3246,6 +3246,12 @@ static const struct wpa_dbus_property_desc wpas_dbus_interface_properties[] = {
 	  wpas_dbus_setter_wps_manufacturer,
 	  NULL
 	},
+	{
+	  "ModelName" ,WPAS_DBUS_NEW_IFACE_WPS, "s" ,
+	  wpas_dbus_getter_wps_device_model_name,
+	  wpas_dbus_setter_wps_device_model_name,
+	  NULL
+	},
 #endif /* CONFIG_WPS */
 #ifdef CONFIG_P2P
 	{ "P2PDeviceConfig", WPAS_DBUS_NEW_IFACE_P2PDEVICE, "a{sv}",
diff --git a/wpa_supplicant/dbus/dbus_new_handlers.h b/wpa_supplicant/dbus/dbus_new_handlers.h
index a12f483..cc80fc3 100644
--- a/wpa_supplicant/dbus/dbus_new_handlers.h
+++ b/wpa_supplicant/dbus/dbus_new_handlers.h
@@ -190,6 +190,9 @@ DECLARE_ACCESSOR(wpas_dbus_getter_wps_device_name);
 DECLARE_ACCESSOR(wpas_dbus_setter_wps_device_name);
 DECLARE_ACCESSOR(wpas_dbus_getter_wps_manufacturer);
 DECLARE_ACCESSOR(wpas_dbus_setter_wps_manufacturer);
+DECLARE_ACCESSOR(wpas_dbus_getter_wps_device_model_name);
+DECLARE_ACCESSOR(wpas_dbus_setter_wps_device_model_name);
+
 
 DBusMessage * wpas_dbus_handler_tdls_discover(DBusMessage *message,
 					      struct wpa_supplicant *wpa_s);
diff --git a/wpa_supplicant/dbus/dbus_new_handlers_wps.c b/wpa_supplicant/dbus/dbus_new_handlers_wps.c
index 1fe176e..6c12efc 100644
--- a/wpa_supplicant/dbus/dbus_new_handlers_wps.c
+++ b/wpa_supplicant/dbus/dbus_new_handlers_wps.c
@@ -457,7 +457,7 @@ dbus_bool_t wpas_dbus_getter_wps_device_name(
 }
 
 /**
- * wpas_dbus_setter_wps_manufacturer - Get current manufacturer name
+ * wpas_dbus_setter_wps_manufacturer - Set current manufacturer name
  * @iter: Pointer to incoming dbus message iter
  * @error: Location to store error on failure
  * @user_data: Function specific data
@@ -517,6 +517,65 @@ dbus_bool_t wpas_dbus_getter_wps_manufacturer(
 }
 
 /**
+ * wpas_dbus_setter_wps_device_model_name - Set current device model name
+ * @iter: Pointer to incoming dbus message iter
+ * @error: Location to store error on failure
+ * @user_data: Function specific data
+ * Returns: TRUE on success, FALSE on failure
+ *
+ * Setter for "ModelName" property. Returned boolean will be true if
+ * providing the relevant string worked, or false otherwise.
+ */
+dbus_bool_t wpas_dbus_setter_wps_device_model_name(
+	const struct wpa_dbus_property_desc *property_desc,
+	DBusMessageIter *iter, DBusError *error, void *user_data)
+{
+	struct wpa_supplicant *wpa_s = user_data;
+	char *methods;
+	char *model_name;
+
+	if (!wpas_dbus_simple_property_setter(iter, error, DBUS_TYPE_STRING,
+					      &methods))
+		return FALSE;
+
+	if(os_strlen(methods) > 32 )
+		return FALSE;
+
+	model_name = os_strdup(methods);
+	if (!model_name)
+		return FALSE;
+	os_free(wpa_s->conf->model_name);
+	wpa_s->conf->model_name = model_name;
+	wpa_s->conf->changed_parameters |= CFG_CHANGED_WPS_STRING;
+	wpa_supplicant_update_config(wpa_s);
+
+	return TRUE;
+}
+
+/**
+ * wpas_dbus_getter_wps_device_model_name - Get current device model name
+ * @iter: Pointer to incoming dbus message iter
+ * @error: Location to store error on failure
+ * @user_data: Function specific data
+ * Returns: TRUE on success, FALSE on failure
+ *
+ * Getter for "ModelName" property. Returned boolean will be true if
+ * providing the relevant string worked, or false otherwise.
+ */
+dbus_bool_t wpas_dbus_getter_wps_device_model_name(
+	const struct wpa_dbus_property_desc *property_desc,
+	DBusMessageIter *iter, DBusError *error, void *user_data)
+{
+	struct wpa_supplicant *wpa_s = user_data;
+	char *model_name = wpa_s->conf->model_name;
+
+	if (model_name == NULL)
+		model_name = "";
+	return wpas_dbus_simple_property_getter(iter, DBUS_TYPE_STRING,
+						&model_name, error);
+}
+
+/**
  * wpas_dbus_getter_config_methods - Get current WPS configuration methods
  * @iter: Pointer to incoming dbus message iter
  * @error: Location to store error on failure
-- 
2.7.4




More information about the Hostap mailing list