Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

scanDeviceForWifiList throws error and then completes successfully #74

Open
robbeman opened this issue Nov 16, 2023 · 0 comments
Open

Comments

@robbeman
Copy link

Scenario

  1. successfully connect to BLE device with security 2
  2. start scanning for wifi devices
  3. completionHandler is called twice
    a. throws scanRequestError SwiftProtobuf.BinaryDecodingError malformedProtobuf with empty wifilist
    b. with resulting wifilist

BLE device boot output

���� Loaded app from partition at offset 0x10000
I (531) boot: Disabling RNG early entropy source...
I (542) cpu_start: Multicore app
I (542) cpu_start: Pro cpu up.
I (543) cpu_start: Starting app cpu, entry point is 0x40081364
I (0) cpu_start: App cpu up.
I (560) cpu_start: Pro cpu start user code
I (560) cpu_start: cpu freq: 160000000 Hz
I (560) cpu_start: Application information:
I (565) cpu_start: Project name:     project-name
I (570) cpu_start: App version:      1
I (575) cpu_start: Compile time:     Oct 30 2023 14:00:19
I (581) cpu_start: ELF file SHA256:  60cd1c436...
I (586) cpu_start: ESP-IDF:          v5.2-dev-2590-g62ee4135e0-dirty
I (593) cpu_start: Min chip rev:     v0.0
I (598) cpu_start: Max chip rev:     v3.99
I (603) cpu_start: Chip rev:         v3.0
I (608) heap_init: Initializing. RAM available for dynamic allocation:
I (615) heap_init: At 3FFAFF10 len 000000F0 (0 KiB): DRAM
I (621) heap_init: At 3FFB6388 len 00001C78 (7 KiB): DRAM
I (627) heap_init: At 3FFB9A20 len 00004108 (16 KiB): DRAM
I (633) heap_init: At 3FFC9598 len 00016A68 (90 KiB): DRAM
I (639) heap_init: At 3FFE0440 len 00003AE0 (14 KiB): D/IRAM
I (646) heap_init: At 3FFE4350 len 0001BCB0 (111 KiB): D/IRAM
I (652) heap_init: At 4009FCBC len 00000344 (0 KiB): IRAM
I (660) spi_flash: detected chip: generic
I (663) spi_flash: flash io: dio
W (667) spi_flash: Detected size(8192k) larger than the size in the binary image header(2048k). Using the size in the binary image header.
I (681) coexist: coex firmware version: 80b0d89
I (686) app_start: Starting scheduler on CPU0
I (690) app_start: Starting scheduler on CPU1
I (690) main_task: Started on CPU0
I (700) main_task: Calling app_main()
I (770) wifi:wifi driver task: 3ffcd6dc, prio:23, stack:6656, core=0
I (800) wifi:wifi firmware version: 341633f
I (800) wifi:wifi certification version: v7.0
I (800) wifi:config NVS flash: enabled
I (800) wifi:config nano formating: disabled
I (810) wifi:Init data frame dynamic rx buffer num: 32
I (810) wifi:Init management frame dynamic rx buffer num: 32
I (820) wifi:Init management short buffer num: 32
I (820) wifi:Init dynamic tx buffer num: 32
I (820) wifi:Init static rx buffer size: 1600
I (830) wifi:Init static rx buffer num: 10
I (830) wifi:Init dynamic rx buffer num: 32
I (840) wifi_init: rx ba win: 6
I (840) wifi_init: tcpip mbox: 32
I (840) wifi_init: udp mbox: 6
I (850) wifi_init: tcp mbox: 6
I (850) wifi_init: tcp tx win: 5744
I (850) wifi_init: tcp rx win: 5744
I (860) wifi_init: tcp mss: 1440
I (860) wifi_init: WiFi IRAM OP enabled
I (870) wifi_init: WiFi RX IRAM OP enabled
I (870) wifi_prov_scheme_ble: BT memory released
I (920) app: Starting provisioning
I (920) app: Development mode: using hard coded salt
I (920) app: Development mode: using hard coded verifier
I (930) phy_init: phy_version 4771,450c73b,Aug 16 2023,11:03:10
I (1000) wifi:mode : sta (7c:87:ce:e3:45:70)
I (1000) wifi:enable tsf
I (1010) BTDM_INIT: BT controller compile version [714174d]
I (1010) BTDM_INIT: Bluetooth MAC: 7c:87:ce:e3:45:72
I (1250) protocomm_nimble: BLE Host Task Started
I (1250) wifi_prov_mgr: Provisioning started with service name : ****
I (1250) app: Provisioning started
I (1260) app: Scan this QR code from the provisioning application for Provisioning.
I (1260) QRCODE: Encoding below text with ECC LVL 0 & QR Code Version 10
I (1270) QRCODE: {"ver":"v1","name":"****","username":"****","pop":"****","transport":"ble"}
I (1290) NimBLE: GAP procedure initiated: advertise;
I (1290) NimBLE: disc_mode=2
I (1290) NimBLE:  adv_channel_map=0 own_addr_type=0 adv_filter_policy=0 adv_itvl_min=256 adv_itvl_max=256
I (1300) NimBLE:

Sample app ignores errors

espDevice.scanWifiList { wifiList, _ in
DispatchQueue.main.async {
self.tableView.isHidden = false
self.headerView.isHidden = false
if let list = wifiList {
self.wifiDetailList = list.sorted { $0.rssi > $1.rssi }
}
self.tableView.reloadData()
Utility.hideLoader(view: self.view)
}
}

Which sort of works, but if you get an error and decide to stop scanning at that point you will never get any results.

Solution?

I'm not quite sure how to handle this scenario. Please let me know if I can provide more useful info to fix this together. 😇

Thoughts

  • sample app should show errors when they occur
  • fix this particular error, but I do not know how to debug this any further, is there a problem with my device specifically or does this always happen?
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant