D-Bus: Add model number in WPS property
Signed-off-by: Avichal Agarwal <avichal.a@samsung.com> Signed-off-by: Mayank Haarit <mayank.h@samsung.com>
This commit is contained in:
parent
ae66822cd8
commit
3ee6a3ab35
3 changed files with 67 additions and 0 deletions
|
@ -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_model_number,
|
||||
wpas_dbus_setter_wps_device_model_number,
|
||||
NULL
|
||||
},
|
||||
#endif /* CONFIG_WPS */
|
||||
#ifdef CONFIG_P2P
|
||||
{ "P2PDeviceConfig", WPAS_DBUS_NEW_IFACE_P2PDEVICE, "a{sv}",
|
||||
|
|
|
@ -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_model_number);
|
||||
DECLARE_ACCESSOR(wpas_dbus_setter_wps_device_model_number);
|
||||
|
||||
DBusMessage * wpas_dbus_handler_tdls_discover(DBusMessage *message,
|
||||
struct wpa_supplicant *wpa_s);
|
||||
|
|
|
@ -630,3 +630,62 @@ dbus_bool_t wpas_dbus_setter_wps_device_model_name(
|
|||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* wpas_dbus_getter_wps_device_model_number - 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.
|
||||
*/
|
||||
dbus_bool_t wpas_dbus_getter_wps_device_model_number(
|
||||
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)
|
||||
model_number = "";
|
||||
return wpas_dbus_simple_property_getter(iter, DBUS_TYPE_STRING,
|
||||
&model_number, error);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* wpas_dbus_setter_wps_device_model_number - 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.
|
||||
*/
|
||||
dbus_bool_t wpas_dbus_setter_wps_device_model_number(
|
||||
const struct wpa_dbus_property_desc *property_desc,
|
||||
DBusMessageIter *iter, DBusError *error, void *user_data)
|
||||
{
|
||||
struct wpa_supplicant *wpa_s = user_data;
|
||||
char *methods, *model_number;
|
||||
|
||||
if (!wpas_dbus_simple_property_setter(iter, error, DBUS_TYPE_STRING,
|
||||
&methods))
|
||||
return FALSE;
|
||||
|
||||
if (os_strlen(methods) > WPS_MODEL_NUMBER_MAX_LEN)
|
||||
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;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue