Signed-off-by: Avichal Agarwal <avichal.a@xxxxxxxxxxx> --- wpa_supplicant/dbus/dbus_new.c | 6 +++ wpa_supplicant/dbus/dbus_new_handlers.h | 2 + wpa_supplicant/dbus/dbus_new_handlers_wps.c | 61 +++++++++++++++++++++++++++++ 3 files changed, 69 insertions(+) diff --git a/wpa_supplicant/dbus/dbus_new.c b/wpa_supplicant/dbus/dbus_new.c index 429945b..cade4de 100644 --- a/wpa_supplicant/dbus/dbus_new.c +++ b/wpa_supplicant/dbus/dbus_new.c @@ -3264,6 +3264,12 @@ static const struct wpa_dbus_property_desc wpas_dbus_interface_properties[] = { wpas_dbus_setter_wps_device_SerialNumber, NULL }, + { + "DeviceType" ,WPAS_DBUS_NEW_IFACE_WPS, "ay" , + wpas_dbus_getter_wps_device_DeviceType, + wpas_dbus_setter_wps_device_DeviceType, + 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 d898b81..fc7184b 100644 --- a/wpa_supplicant/dbus/dbus_new_handlers.h +++ b/wpa_supplicant/dbus/dbus_new_handlers.h @@ -196,6 +196,8 @@ DECLARE_ACCESSOR(wpas_dbus_getter_wps_device_ModelNumber); DECLARE_ACCESSOR(wpas_dbus_setter_wps_device_ModelNumber); DECLARE_ACCESSOR(wpas_dbus_getter_wps_device_SerialNumber); DECLARE_ACCESSOR(wpas_dbus_setter_wps_device_SerialNumber); +DECLARE_ACCESSOR(wpas_dbus_getter_wps_device_DeviceType); +DECLARE_ACCESSOR(wpas_dbus_setter_wps_device_DeviceType); 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 2f99fdf..4ec5ba8 100644 --- a/wpa_supplicant/dbus/dbus_new_handlers_wps.c +++ b/wpa_supplicant/dbus/dbus_new_handlers_wps.c @@ -695,6 +695,67 @@ dbus_bool_t wpas_dbus_setter_wps_device_SerialNumber( } /** + * wpas_dbus_setter_wps_device_DeviceType - Set current device type + * @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 "DeviceType" property. Returned boolean will be true if + * providing the relevant string worked, or false otherwise. + */ +dbus_bool_t wpas_dbus_setter_wps_device_DeviceType( + const struct wpa_dbus_property_desc *property_desc, + DBusMessageIter *iter, DBusError *error, void *user_data) +{ + struct wpa_supplicant *wpa_s = user_data; + + u8 * devType; + int dev_len; + DBusMessageIter *array_iter; + + dbus_message_iter_recurse(iter, array_iter); + dbus_message_iter_get_fixed_array(array_iter, &devType, &dev_len); + + if(dev_len <=0 || dev_len != WPS_DEV_TYPE_LEN ) + return FALSE; + + os_memcpy(wpa_s->conf->device_type, devType, WPS_DEV_TYPE_LEN); + wpa_s->conf->changed_parameters |= CFG_CHANGED_DEVICE_TYPE;; + wpa_supplicant_update_config(wpa_s); + + return TRUE; +} + +/** + * wpas_dbus_getter_wps_device_DeviceType - Set current device Type + * @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 "DeviceType" property. Returned boolean will be true if + * providing the relevant string worked, or false otherwise. + */ +dbus_bool_t wpas_dbus_getter_wps_device_DeviceType( + const struct wpa_dbus_property_desc *property_desc, + DBusMessageIter *iter, DBusError *error, void *user_data) +{ + struct wpa_supplicant *wpa_s = user_data; + DBusMessageIter *array_iter; + + if ( ! dbus_message_iter_open_container(iter, DBUS_TYPE_ARRAY, DBUS_TYPE_BYTE_AS_STRING, array_iter) || + ! dbus_message_iter_append_fixed_array(array_iter, DBUS_TYPE_BYTE, + &(wpa_s->conf->device_type), WPS_DEV_TYPE_LEN) || + !dbus_message_iter_close_container(iter, array_iter)) { + dbus_set_error(error, DBUS_ERROR_FAILED, "%s: error constructing reply", __func__); + return FALSE; + } + return TRUE; + +} + +/** * 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 _______________________________________________ Hostap mailing list Hostap@xxxxxxxxxxxxxxxxxxx http://lists.infradead.org/mailman/listinfo/hostap