3
0
mirror of https://git.kernel.org/pub/scm/network/wireless/iwd.git synced 2024-11-10 14:09:22 +01:00

scan: Add a trigger callback to scan_periodic_start

This commit is contained in:
Andrew Zaborowski 2016-06-25 20:42:23 +02:00 committed by Denis Kenzior
parent 4ac1cd0ac0
commit 6819cb8907
3 changed files with 12 additions and 5 deletions

View File

@ -478,7 +478,8 @@ void device_enter_state(struct device *device, enum device_state state)
scan_periodic_stop(device->index);
break;
case DEVICE_STATE_AUTOCONNECT:
scan_periodic_start(device->index, new_scan_results, device);
scan_periodic_start(device->index, NULL,
new_scan_results, device);
break;
case DEVICE_STATE_DISCONNECTED:
scan_periodic_stop(device->index);

View File

@ -51,6 +51,7 @@ uint32_t next_scan_request_id = 0;
struct scan_periodic {
struct l_timeout *timeout;
uint16_t interval;
scan_trigger_func_t trigger;
scan_notify_func_t callback;
void *userdata;
bool rearm:1;
@ -427,10 +428,13 @@ static void scan_periodic_done(struct l_genl_msg *msg, void *user_data)
sc->state = SCAN_STATE_PASSIVE;
l_debug("Periodic scan triggered for ifindex: %u", sc->ifindex);
if (sc->sp.trigger)
sc->sp.trigger(0, sc->sp.userdata);
}
void scan_periodic_start(uint32_t ifindex, scan_notify_func_t func,
void *userdata)
void scan_periodic_start(uint32_t ifindex, scan_trigger_func_t trigger,
scan_notify_func_t func, void *userdata)
{
struct scan_context *sc;
@ -448,6 +452,7 @@ void scan_periodic_start(uint32_t ifindex, scan_notify_func_t func,
l_debug("Starting periodic scan for ifindex: %u", ifindex);
sc->sp.interval = SCAN_INIT_INTERVAL;
sc->sp.trigger = trigger;
sc->sp.callback = func;
sc->sp.userdata = userdata;
sc->sp.retry = false;
@ -477,6 +482,7 @@ bool scan_periodic_stop(uint32_t ifindex)
}
sc->sp.interval = 0;
sc->sp.trigger = NULL;
sc->sp.callback = NULL;
sc->sp.userdata = NULL;
sc->sp.rearm = false;

View File

@ -68,8 +68,8 @@ uint32_t scan_active(uint32_t ifindex, uint8_t *extra_ie, size_t extra_ie_size,
scan_destroy_func_t destroy);
bool scan_cancel(uint32_t ifindex, uint32_t id);
void scan_periodic_start(uint32_t ifindex, scan_notify_func_t func,
void *userdata);
void scan_periodic_start(uint32_t ifindex, scan_trigger_func_t trigger,
scan_notify_func_t func, void *userdata);
bool scan_periodic_stop(uint32_t ifindex);
void scan_sched_start(struct l_genl_family *nl80211, uint32_t ifindex,