3
0
mirror of https://git.kernel.org/pub/scm/network/wireless/iwd.git synced 2024-11-26 02:19:26 +01:00

ap: expose property 'Started' property on the Dbus

This commit is contained in:
Tim Kourt 2018-07-29 15:32:55 -07:00 committed by Denis Kenzior
parent 412a03f236
commit dda350a93d

View File

@ -133,6 +133,9 @@ static void ap_reset(struct ap_state *ap)
l_uintset_free(ap->rates); l_uintset_free(ap->rates);
ap->started = false; ap->started = false;
l_dbus_property_changed(dbus_get_bus(), device_get_path(ap->device),
IWD_AP_INTERFACE, "Started");
} }
static void ap_free(void *data) static void ap_free(void *data)
@ -1156,6 +1159,9 @@ static void ap_start_cb(struct l_genl_msg *msg, void *user_data)
l_dbus_message_new_method_return(ap->pending)); l_dbus_message_new_method_return(ap->pending));
ap->started = true; ap->started = true;
l_dbus_property_changed(dbus_get_bus(), device_get_path(ap->device),
IWD_AP_INTERFACE, "Started");
} }
static struct l_genl_msg *ap_build_cmd_start_ap(struct ap_state *ap) static struct l_genl_msg *ap_build_cmd_start_ap(struct ap_state *ap)
@ -1406,11 +1412,27 @@ static struct l_dbus_message *ap_dbus_stop(struct l_dbus *dbus,
return NULL; return NULL;
} }
static bool ap_dbus_property_get_started(struct l_dbus *dbus,
struct l_dbus_message *message,
struct l_dbus_message_builder *builder,
void *user_data)
{
struct ap_state *ap = user_data;
bool started = ap->started;
l_dbus_message_builder_append_basic(builder, 'b', &started);
return true;
}
static void ap_setup_interface(struct l_dbus_interface *interface) static void ap_setup_interface(struct l_dbus_interface *interface)
{ {
l_dbus_interface_method(interface, "Start", 0, ap_dbus_start, "", l_dbus_interface_method(interface, "Start", 0, ap_dbus_start, "",
"ss", "ssid", "wpa2_psk"); "ss", "ssid", "wpa2_psk");
l_dbus_interface_method(interface, "Stop", 0, ap_dbus_stop, "", ""); l_dbus_interface_method(interface, "Stop", 0, ap_dbus_stop, "", "");
l_dbus_interface_property(interface, "Started", 0, "b",
ap_dbus_property_get_started, NULL);
} }
static void ap_destroy_interface(void *user_data) static void ap_destroy_interface(void *user_data)