device: Move device_disassociated out of wiphy.c

This commit is contained in:
Denis Kenzior 2016-06-14 11:14:45 -05:00
parent 64604ed59c
commit 6bd71066ff
4 changed files with 26 additions and 21 deletions

View File

@ -26,6 +26,9 @@
#include <ell/ell.h>
#include "src/common.h"
#include "src/dbus.h"
#include "src/network.h"
#include "src/device.h"
struct device_watchlist_item {
@ -112,6 +115,27 @@ void __device_watch_call_removed(struct device *device)
}
}
void device_disassociated(struct device *device)
{
struct network *network = device->connected_network;
struct l_dbus *dbus = dbus_get_bus();
if (!network)
return;
network_disconnected(network);
device->connected_bss = NULL;
device->connected_network = NULL;
device_enter_state(device, DEVICE_STATE_AUTOCONNECT);
l_dbus_property_changed(dbus, device_get_path(device),
IWD_DEVICE_INTERFACE, "ConnectedNetwork");
l_dbus_property_changed(dbus, network_get_path(network),
IWD_NETWORK_INTERFACE, "Connected");
}
bool device_init(void)
{
device_watches = l_queue_new();

View File

@ -77,6 +77,7 @@ uint32_t device_get_ifindex(struct device *device);
const uint8_t *device_get_address(struct device *device);
void device_enter_state(struct device *device, enum device_state state);
void device_disassociated(struct device *device);
void device_connect_network(struct device *device, struct network *network,
struct scan_bss *bss,
struct l_dbus_message *message);

View File

@ -24,6 +24,7 @@
struct device;
struct network;
struct scan_bss;
bool network_seen(struct network *network, struct timespec *when);
bool network_connected(struct network *network);

View File

@ -184,27 +184,6 @@ void device_enter_state(struct device *device, enum device_state state)
device->state = state;
}
static void device_disassociated(struct device *device)
{
struct network *network = device->connected_network;
struct l_dbus *dbus = dbus_get_bus();
if (!network)
return;
network_disconnected(network);
device->connected_bss = NULL;
device->connected_network = NULL;
device_enter_state(device, DEVICE_STATE_AUTOCONNECT);
l_dbus_property_changed(dbus, device_get_path(device),
IWD_DEVICE_INTERFACE, "ConnectedNetwork");
l_dbus_property_changed(dbus, network_get_path(network),
IWD_NETWORK_INTERFACE, "Connected");
}
static void device_lost_beacon(struct device *device)
{
if (device->connect_pending)