mirror of
https://git.kernel.org/pub/scm/network/wireless/iwd.git
synced 2024-12-22 13:02:44 +01:00
station: Update GetOrderedNetworks API implementation
The Station interface GetOrderedNetworks signature now matches the API documentation. Device.GetOrderedNetworks still uses the legacy signature.
This commit is contained in:
parent
854ce2b062
commit
0a42f63d42
@ -112,7 +112,7 @@ static struct l_dbus_message *device_get_networks(struct l_dbus *dbus,
|
|||||||
if (!device->powered || !device->station)
|
if (!device->powered || !device->station)
|
||||||
return dbus_error_not_available(message);
|
return dbus_error_not_available(message);
|
||||||
|
|
||||||
return station_dbus_get_networks(dbus, message, station);
|
return station_build_get_networks_reply(station, message, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool device_property_get_name(struct l_dbus *dbus,
|
static bool device_property_get_name(struct l_dbus *dbus,
|
||||||
|
@ -1843,11 +1843,11 @@ struct l_dbus_message *station_dbus_disconnect(struct l_dbus *dbus,
|
|||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
struct l_dbus_message *station_dbus_get_networks(struct l_dbus *dbus,
|
struct l_dbus_message *station_build_get_networks_reply(
|
||||||
|
struct station *station,
|
||||||
struct l_dbus_message *message,
|
struct l_dbus_message *message,
|
||||||
void *user_data)
|
bool legacy)
|
||||||
{
|
{
|
||||||
struct station *station = user_data;
|
|
||||||
struct l_dbus_message *reply;
|
struct l_dbus_message *reply;
|
||||||
struct l_dbus_message_builder *builder;
|
struct l_dbus_message_builder *builder;
|
||||||
struct l_queue *sorted = station->networks_sorted;
|
struct l_queue *sorted = station->networks_sorted;
|
||||||
@ -1856,22 +1856,35 @@ struct l_dbus_message *station_dbus_get_networks(struct l_dbus *dbus,
|
|||||||
reply = l_dbus_message_new_method_return(message);
|
reply = l_dbus_message_new_method_return(message);
|
||||||
builder = l_dbus_message_builder_new(reply);
|
builder = l_dbus_message_builder_new(reply);
|
||||||
|
|
||||||
l_dbus_message_builder_enter_array(builder, "(osns)");
|
if (legacy)
|
||||||
|
l_dbus_message_builder_enter_array(builder, "(osns)");
|
||||||
|
else
|
||||||
|
l_dbus_message_builder_enter_array(builder, "(on)");
|
||||||
|
|
||||||
for (entry = l_queue_get_entries(sorted); entry; entry = entry->next) {
|
for (entry = l_queue_get_entries(sorted); entry; entry = entry->next) {
|
||||||
const struct network *network = entry->data;
|
const struct network *network = entry->data;
|
||||||
enum security security = network_get_security(network);
|
enum security security = network_get_security(network);
|
||||||
int16_t signal_strength = network_get_signal_strength(network);
|
int16_t signal_strength = network_get_signal_strength(network);
|
||||||
|
|
||||||
l_dbus_message_builder_enter_struct(builder, "osns");
|
if (legacy)
|
||||||
|
l_dbus_message_builder_enter_struct(builder, "osns");
|
||||||
|
else
|
||||||
|
l_dbus_message_builder_enter_struct(builder, "on");
|
||||||
|
|
||||||
l_dbus_message_builder_append_basic(builder, 'o',
|
l_dbus_message_builder_append_basic(builder, 'o',
|
||||||
network_get_path(network));
|
network_get_path(network));
|
||||||
l_dbus_message_builder_append_basic(builder, 's',
|
|
||||||
|
if (legacy)
|
||||||
|
l_dbus_message_builder_append_basic(builder, 's',
|
||||||
network_get_ssid(network));
|
network_get_ssid(network));
|
||||||
|
|
||||||
l_dbus_message_builder_append_basic(builder, 'n',
|
l_dbus_message_builder_append_basic(builder, 'n',
|
||||||
&signal_strength);
|
&signal_strength);
|
||||||
l_dbus_message_builder_append_basic(builder, 's',
|
|
||||||
|
if (legacy)
|
||||||
|
l_dbus_message_builder_append_basic(builder, 's',
|
||||||
security_to_str(security));
|
security_to_str(security));
|
||||||
|
|
||||||
l_dbus_message_builder_leave_struct(builder);
|
l_dbus_message_builder_leave_struct(builder);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1883,6 +1896,14 @@ struct l_dbus_message *station_dbus_get_networks(struct l_dbus *dbus,
|
|||||||
return reply;
|
return reply;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static struct l_dbus_message *station_dbus_get_networks(struct l_dbus *dbus,
|
||||||
|
struct l_dbus_message *message,
|
||||||
|
void *user_data)
|
||||||
|
{
|
||||||
|
struct station *station = user_data;
|
||||||
|
return station_build_get_networks_reply(station, message, false);
|
||||||
|
}
|
||||||
|
|
||||||
static void station_dbus_scan_triggered(int err, void *user_data)
|
static void station_dbus_scan_triggered(int err, void *user_data)
|
||||||
{
|
{
|
||||||
struct station *station = user_data;
|
struct station *station = user_data;
|
||||||
@ -2259,7 +2280,7 @@ static void station_setup_interface(struct l_dbus_interface *interface)
|
|||||||
l_dbus_interface_method(interface, "Disconnect", 0,
|
l_dbus_interface_method(interface, "Disconnect", 0,
|
||||||
station_dbus_disconnect, "", "");
|
station_dbus_disconnect, "", "");
|
||||||
l_dbus_interface_method(interface, "GetOrderedNetworks", 0,
|
l_dbus_interface_method(interface, "GetOrderedNetworks", 0,
|
||||||
station_dbus_get_networks, "a(osns)", "",
|
station_dbus_get_networks, "a(on)", "",
|
||||||
"networks");
|
"networks");
|
||||||
l_dbus_interface_method(interface, "Scan", 0,
|
l_dbus_interface_method(interface, "Scan", 0,
|
||||||
station_dbus_scan, "", "");
|
station_dbus_scan, "", "");
|
||||||
|
@ -102,9 +102,10 @@ void station_ap_directed_roam(struct station *station,
|
|||||||
struct l_dbus_message *station_dbus_disconnect(struct l_dbus *dbus,
|
struct l_dbus_message *station_dbus_disconnect(struct l_dbus *dbus,
|
||||||
struct l_dbus_message *message,
|
struct l_dbus_message *message,
|
||||||
void *user_data);
|
void *user_data);
|
||||||
struct l_dbus_message *station_dbus_get_networks(struct l_dbus *dbus,
|
struct l_dbus_message *station_build_get_networks_reply(
|
||||||
|
struct station *station,
|
||||||
struct l_dbus_message *message,
|
struct l_dbus_message *message,
|
||||||
void *user_data);
|
bool legacy);
|
||||||
struct l_dbus_message *station_dbus_scan(struct l_dbus *dbus,
|
struct l_dbus_message *station_dbus_scan(struct l_dbus *dbus,
|
||||||
struct l_dbus_message *message,
|
struct l_dbus_message *message,
|
||||||
void *user_data);
|
void *user_data);
|
||||||
|
Loading…
Reference in New Issue
Block a user