commit d347100ac2d25e80da9dae38c65d60497bb9bf2f
parent 42e5dbf6f86753df9165bac316d66c774f2b4665
Author: Denis Kenzior <denkenz@gmail.com>
Date: Fri, 14 Sep 2018 21:53:01 -0500
device: Remove the rest of the legacy Device properties
Diffstat:
| M | src/device.c | | | 75 | --------------------------------------------------------------------------- |
| M | src/station.c | | | 49 | +++++++++++++++++++++++++++++++++---------------- |
| M | src/station.h | | | 32 | -------------------------------- |
3 files changed, 33 insertions(+), 123 deletions(-)
diff --git a/src/device.c b/src/device.c
@@ -98,23 +98,6 @@ static bool device_property_get_address(struct l_dbus *dbus,
return true;
}
-static bool device_property_get_connected_network(struct l_dbus *dbus,
- struct l_dbus_message *message,
- struct l_dbus_message_builder *builder,
- void *user_data)
-{
- struct device *device = user_data;
- struct station *station = device->station;
-
- if (!station || !station->connected_network)
- return false;
-
- l_dbus_message_builder_append_basic(builder, 'o',
- network_get_path(station->connected_network));
-
- return true;
-}
-
static bool device_property_get_powered(struct l_dbus *dbus,
struct l_dbus_message *message,
struct l_dbus_message_builder *builder,
@@ -256,57 +239,6 @@ static struct l_dbus_message *device_property_set_4addr(struct l_dbus *dbus,
return NULL;
}
-static bool device_property_get_scanning(struct l_dbus *dbus,
- struct l_dbus_message *message,
- struct l_dbus_message_builder *builder,
- void *user_data)
-{
- struct device *device = user_data;
- struct station *station = device->station;
- bool scanning;
-
- if (!station)
- return false;
-
- scanning = station->scanning;
-
- l_dbus_message_builder_append_basic(builder, 'b', &scanning);
-
- return true;
-}
-
-static bool device_property_get_state(struct l_dbus *dbus,
- struct l_dbus_message *message,
- struct l_dbus_message_builder *builder,
- void *user_data)
-{
- struct device *device = user_data;
- const char *statestr;
-
- /* TODO: Remove when Device/Station split is done */
- if (netdev_get_iftype(device->netdev) != NETDEV_IFTYPE_STATION) {
- uint32_t iftype = netdev_get_iftype(device->netdev);
- l_dbus_message_builder_append_basic(builder, 's',
- dbus_iftype_to_string(iftype));
- return true;
- }
-
- if (device->powered == false) {
- l_dbus_message_builder_append_basic(builder,
- 's', "disconnected");
- return true;
- }
-
- statestr = station_state_to_string(device->station->state);
-
- /* Special case. For now we treat AUTOCONNECT as disconnected */
- if (device->station->state == STATION_STATE_AUTOCONNECT)
- statestr = "disconnected";
-
- l_dbus_message_builder_append_basic(builder, 's', statestr);
- return true;
-}
-
static bool device_property_get_adapter(struct l_dbus *dbus,
struct l_dbus_message *message,
struct l_dbus_message_builder *builder,
@@ -410,19 +342,12 @@ static void setup_device_interface(struct l_dbus_interface *interface)
device_property_get_name, NULL);
l_dbus_interface_property(interface, "Address", 0, "s",
device_property_get_address, NULL);
- l_dbus_interface_property(interface, "ConnectedNetwork", 0, "o",
- device_property_get_connected_network,
- NULL);
l_dbus_interface_property(interface, "WDS", 0, "b",
device_property_get_4addr,
device_property_set_4addr);
l_dbus_interface_property(interface, "Powered", 0, "b",
device_property_get_powered,
device_property_set_powered);
- l_dbus_interface_property(interface, "Scanning", 0, "b",
- device_property_get_scanning, NULL);
- l_dbus_interface_property(interface, "State", 0, "s",
- device_property_get_state, NULL);
l_dbus_interface_property(interface, "Adapter", 0, "o",
device_property_get_adapter, NULL);
l_dbus_interface_property(interface, "Mode", 0, "s",
diff --git a/src/station.c b/src/station.c
@@ -49,6 +49,38 @@
static struct l_queue *station_list;
static uint32_t netdev_watch;
+struct station {
+ enum station_state state;
+ struct watchlist state_watches;
+ struct scan_bss *connected_bss;
+ struct network *connected_network;
+ struct l_queue *autoconnect_list;
+ struct l_queue *bss_list;
+ struct l_hashmap *networks;
+ struct l_queue *networks_sorted;
+ struct l_dbus_message *connect_pending;
+ struct l_dbus_message *disconnect_pending;
+ struct l_dbus_message *scan_pending;
+ struct signal_agent *signal_agent;
+
+ /* Roaming related members */
+ struct timespec roam_min_time;
+ struct l_timeout *roam_trigger_timeout;
+ uint32_t roam_scan_id;
+ uint8_t preauth_bssid[6];
+
+ struct wiphy *wiphy;
+ struct netdev *netdev;
+
+ bool seen_hidden_networks : 1;
+ bool preparing_roam : 1;
+ bool signal_low : 1;
+ bool roam_no_orig_ap : 1;
+ bool ap_directed_roaming : 1;
+ bool scanning : 1;
+ bool autoconnect : 1;
+};
+
struct wiphy *station_get_wiphy(struct station *station)
{
return station->wiphy;
@@ -539,8 +571,6 @@ static bool new_scan_results(uint32_t wiphy_id, uint32_t ifindex, int err,
station->scanning = false;
l_dbus_property_changed(dbus, netdev_get_path(station->netdev),
IWD_STATION_INTERFACE, "Scanning");
- l_dbus_property_changed(dbus, netdev_get_path(station->netdev),
- IWD_DEVICE_INTERFACE, "Scanning");
}
if (err)
@@ -563,8 +593,6 @@ static void periodic_scan_trigger(int err, void *user_data)
station->scanning = true;
l_dbus_property_changed(dbus, netdev_get_path(station->netdev),
IWD_STATION_INTERFACE, "Scanning");
- l_dbus_property_changed(dbus, netdev_get_path(station->netdev),
- IWD_DEVICE_INTERFACE, "Scanning");
}
static void periodic_scan_stop(struct station *station)
@@ -578,8 +606,6 @@ static void periodic_scan_stop(struct station *station)
station->scanning = false;
l_dbus_property_changed(dbus, netdev_get_path(station->netdev),
IWD_STATION_INTERFACE, "Scanning");
- l_dbus_property_changed(dbus, netdev_get_path(station->netdev),
- IWD_DEVICE_INTERFACE, "Scanning");
}
}
@@ -617,12 +643,9 @@ static void station_enter_state(struct station *station,
disconnected = station->state <= STATION_STATE_AUTOCONNECT;
if ((disconnected && state > STATION_STATE_AUTOCONNECT) ||
- (!disconnected && state != station->state)) {
+ (!disconnected && state != station->state))
l_dbus_property_changed(dbus, netdev_get_path(station->netdev),
IWD_STATION_INTERFACE, "State");
- l_dbus_property_changed(dbus, netdev_get_path(station->netdev),
- IWD_DEVICE_INTERFACE, "State");
- }
switch (state) {
case STATION_STATE_AUTOCONNECT:
@@ -712,8 +735,6 @@ static void station_reset_connection_state(struct station *station)
l_dbus_property_changed(dbus, netdev_get_path(station->netdev),
IWD_STATION_INTERFACE, "ConnectedNetwork");
- l_dbus_property_changed(dbus, netdev_get_path(station->netdev),
- IWD_DEVICE_INTERFACE, "ConnectedNetwork");
l_dbus_property_changed(dbus, network_get_path(network),
IWD_NETWORK_INTERFACE, "Connected");
}
@@ -1610,8 +1631,6 @@ int __station_connect_network(struct station *station, struct network *network,
l_dbus_property_changed(dbus, netdev_get_path(netdev),
IWD_STATION_INTERFACE, "ConnectedNetwork");
- l_dbus_property_changed(dbus, netdev_get_path(netdev),
- IWD_DEVICE_INTERFACE, "ConnectedNetwork");
l_dbus_property_changed(dbus, network_get_path(network),
IWD_NETWORK_INTERFACE, "Connected");
@@ -1900,8 +1919,6 @@ static void station_dbus_scan_triggered(int err, void *user_data)
station->scanning = true;
l_dbus_property_changed(dbus, netdev_get_path(station->netdev),
IWD_STATION_INTERFACE, "Scanning");
- l_dbus_property_changed(dbus, netdev_get_path(station->netdev),
- IWD_DEVICE_INTERFACE, "Scanning");
}
static struct l_dbus_message *station_dbus_scan(struct l_dbus *dbus,
diff --git a/src/station.h b/src/station.h
@@ -42,38 +42,6 @@ typedef void (*station_foreach_func_t)(struct station *, void *data);
typedef void (*station_state_watch_func_t)(enum station_state, void *userdata);
typedef void (*station_destroy_func_t)(void *userdata);
-struct station {
- enum station_state state;
- struct watchlist state_watches;
- struct scan_bss *connected_bss;
- struct network *connected_network;
- struct l_queue *autoconnect_list;
- struct l_queue *bss_list;
- struct l_hashmap *networks;
- struct l_queue *networks_sorted;
- struct l_dbus_message *connect_pending;
- struct l_dbus_message *disconnect_pending;
- struct l_dbus_message *scan_pending;
- struct signal_agent *signal_agent;
-
- /* Roaming related members */
- struct timespec roam_min_time;
- struct l_timeout *roam_trigger_timeout;
- uint32_t roam_scan_id;
- uint8_t preauth_bssid[6];
-
- struct wiphy *wiphy;
- struct netdev *netdev;
-
- bool seen_hidden_networks : 1;
- bool preparing_roam : 1;
- bool signal_low : 1;
- bool roam_no_orig_ap : 1;
- bool ap_directed_roaming : 1;
- bool scanning : 1;
- bool autoconnect : 1;
-};
-
struct wiphy *station_get_wiphy(struct station *station);
struct netdev *station_get_netdev(struct station *station);
struct network *station_get_connected_network(struct station *station);