MCPcopy Create free account
hub / github.com/TactilityProject/Tactility / getScanResults

Function getScanResults

Tactility/Source/service/wifi/WifiEsp.cpp:249–278  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

247}
248
249std::vector<ApRecord> getScanResults() {
250 LOGGER.info("getScanResults()");
251 auto wifi = wifi_singleton;
252
253 std::vector<ApRecord> records;
254
255 if (wifi == nullptr) {
256 return records;
257 }
258
259 auto lock = wifi->dataMutex.asScopedLock();
260 if (!lock.lock(10 / portTICK_PERIOD_MS)) {
261 return records;
262 }
263
264 if (wifi->scan_list_count > 0) {
265 uint16_t i = 0;
266 for (; i < wifi->scan_list_count; ++i) {
267 const auto& scanned_item = wifi->scan_list[i];
268 records.push_back((ApRecord) {
269 .ssid = reinterpret_cast<const char*>(scanned_item.ssid),
270 .rssi = scanned_item.rssi,
271 .channel = scanned_item.primary,
272 .auth_mode = scanned_item.authmode
273 });
274 }
275 }
276
277 return records;
278}
279
280void setEnabled(bool enabled) {
281 LOGGER.info("setEnabled({})", enabled);

Callers

nothing calls this directly

Calls 3

infoMethod · 0.80
asScopedLockMethod · 0.80
lockMethod · 0.45

Tested by

no test coverage detected