[PATCH 4/6] adding model number in wps property on dbus

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


Signed-off-by: Avichal Agarwal <avichal.a at samsung.com>
Signed-off-by: Mayank Haarit <mayank.h at samsung.com>
---
 wpa_supplicant/dbus/dbus_new.c              |  6 +++
 wpa_supplicant/dbus/dbus_new_handlers.h     |  2 +
 wpa_supplicant/dbus/dbus_new_handlers_wps.c | 60 +++++++++++++++++++++++++++++
 3 files changed, 68 insertions(+)

diff --git a/wpa_supplicant/dbus/dbus_new.c b/wpa_supplicant/dbus/dbus_new.c
index 887dcc3..b5c4e49 100644
--- a/wpa_supplicant/dbus/dbus_new.c
+++ b/wpa_supplicant/dbus/dbus_new.c
@@ -3252,6 +3252,12 @@ static const struct wpa_dbus_property_desc wpas_dbus_interface_properties[] = {
 	  wpas_dbus_setter_wps_device_model_name,
 	  NULL
 	},
+	{
+	  "ModelNumber" ,WPAS_DBUS_NEW_IFACE_WPS, "s" ,
+	  wpas_dbus_getter_wps_device_ModelNumber,
+	  wpas_dbus_setter_wps_device_ModelNumber,
+	  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 cc80fc3..2367b13 100644
--- a/wpa_supplicant/dbus/dbus_new_handlers.h
+++ b/wpa_supplicant/dbus/dbus_new_handlers.h
@@ -192,6 +192,8 @@ 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);
+DECLARE_ACCESSOR(wpas_dbus_getter_wps_device_ModelNumber);
+DECLARE_ACCESSOR(wpas_dbus_setter_wps_device_ModelNumber);
 
 
 DBusMessage * wpas_dbus_handler_tdls_discover(DBusMessage *message,
diff --git a/wpa_supplicant/dbus/dbus_new_handlers_wps.c b/wpa_supplicant/dbus/dbus_new_handlers_wps.c
index 6c12efc..48a027a 100644
--- a/wpa_supplicant/dbus/dbus_new_handlers_wps.c
+++ b/wpa_supplicant/dbus/dbus_new_handlers_wps.c
@@ -576,6 +576,66 @@ dbus_bool_t wpas_dbus_getter_wps_device_model_name(
 }
 
 /**
+ * wpas_dbus_setter_wps_device_ModelNumber - Set current device model number
+ * @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 "ModelNumber" property. Returned boolean will be true if
+ * providing the relevant string worked, or false otherwise.
+ */
+dbus_bool_t wpas_dbus_setter_wps_device_ModelNumber(
+	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_number;
+
+	if (!wpas_dbus_simple_property_setter(iter, error, DBUS_TYPE_STRING,
+					      &methods))
+		return FALSE;
+
+	if(os_strlen(methods) > 32 )
+		return FALSE;
+
+	model_number = os_strdup(methods);
+	if (!model_number)
+		return FALSE;
+
+	os_free(wpa_s->conf->model_number);
+	wpa_s->conf->model_number = model_number;
+	wpa_s->conf->changed_parameters |= CFG_CHANGED_WPS_STRING;
+	wpa_supplicant_update_config(wpa_s);
+
+	return TRUE;
+}
+
+/**
+ * wpas_dbus_getter_wps_device_ModelNumber - Get current device model number
+ * @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 "ModelNumber" property. Returned boolean will be true if
+ * providing the relevant string worked, or false otherwise.
+ */
+dbus_bool_t wpas_dbus_getter_wps_device_ModelNumber(
+	const struct wpa_dbus_property_desc *property_desc,
+	DBusMessageIter *iter, DBusError *error, void *user_data)
+{
+	struct wpa_supplicant *wpa_s = user_data;
+	char *model_number = wpa_s->conf->model_number;
+
+	if (model_number == NULL)
+		model_number = "";
+	return wpas_dbus_simple_property_getter(iter, DBUS_TYPE_STRING,
+						&model_number, 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