Lines Matching refs:data
35 struct bgscan_simple_data *data = eloop_ctx;
36 struct wpa_supplicant *wpa_s = data->wpa_s;
41 params.ssids[0].ssid = data->ssid->ssid;
42 params.ssids[0].ssid_len = data->ssid->ssid_len;
43 params.freqs = data->ssid->scan_freq;
48 * every now and then) to reduce effect on the data connection.
54 eloop_register_timeout(data->scan_interval, 0,
55 bgscan_simple_timeout, data, NULL);
57 if (data->scan_interval == data->short_interval) {
58 data->short_scan_count++;
64 if (data->short_scan_count > data->max_short_scans) {
65 data->scan_interval = data->long_interval;
69 } else if (data->short_scan_count > 0) {
76 data->short_scan_count--;
78 os_get_time(&data->last_bgscan);
83 static int bgscan_simple_get_params(struct bgscan_simple_data *data,
91 data->short_interval = atoi(params);
97 data->signal_threshold = atoi(pos);
105 data->long_interval = atoi(pos);
115 struct bgscan_simple_data *data;
117 data = os_zalloc(sizeof(*data));
118 if (data == NULL)
120 data->wpa_s = wpa_s;
121 data->ssid = ssid;
122 if (bgscan_simple_get_params(data, params) < 0) {
123 os_free(data);
126 if (data->short_interval <= 0)
127 data->short_interval = 30;
128 if (data->long_interval <= 0)
129 data->long_interval = 30;
133 data->signal_threshold, data->short_interval,
134 data->long_interval);
136 if (data->signal_threshold &&
137 wpa_drv_signal_monitor(wpa_s, data->signal_threshold, 4) < 0) {
142 data->scan_interval = data->short_interval;
143 data->max_short_scans = data->long_interval / data->short_interval + 1;
144 if (data->signal_threshold) {
148 siginfo.current_signal >= data->signal_threshold)
149 data->scan_interval = data->long_interval;
152 data->scan_interval);
153 eloop_register_timeout(data->scan_interval, 0, bgscan_simple_timeout,
154 data, NULL);
162 os_get_time(&data->last_bgscan);
164 return data;
170 struct bgscan_simple_data *data = priv;
171 eloop_cancel_timeout(bgscan_simple_timeout, data, NULL);
172 if (data->signal_threshold)
173 wpa_drv_signal_monitor(data->wpa_s, 0, 0);
174 os_free(data);
181 struct bgscan_simple_data *data = priv;
185 eloop_cancel_timeout(bgscan_simple_timeout, data, NULL);
186 eloop_register_timeout(data->scan_interval, 0, bgscan_simple_timeout,
187 data, NULL);
212 struct bgscan_simple_data *data = priv;
216 if (data->short_interval == data->long_interval ||
217 data->signal_threshold == 0)
224 if (data->scan_interval == data->long_interval && !above) {
227 data->scan_interval = data->short_interval;
229 if (now.sec > data->last_bgscan.sec + 1 &&
230 data->short_scan_count <= data->max_short_scans)
238 else if (data->last_bgscan.sec + data->long_interval >
239 now.sec + data->scan_interval) {
244 eloop_cancel_timeout(bgscan_simple_timeout, data,
246 eloop_register_timeout(data->scan_interval, 0,
247 bgscan_simple_timeout, data,
250 } else if (data->scan_interval == data->short_interval && above) {
253 data->scan_interval = data->long_interval;
254 eloop_cancel_timeout(bgscan_simple_timeout, data, NULL);
255 eloop_register_timeout(data->scan_interval, 0,
256 bgscan_simple_timeout, data, NULL);
263 if (now.sec > data->last_bgscan.sec + 10)
269 eloop_cancel_timeout(bgscan_simple_timeout, data, NULL);
270 eloop_register_timeout(0, 0, bgscan_simple_timeout, data,