If you are asking a question, please follow this template:
- My goal is: [describe your goal]
Using ‘api_bt_gap.js’; on an olimex esp32. I would like to read all of the Advertising data on EV_SCAN_RESULT.
I suspect that the data is being truncated or lost or not read???
- My actions are: [describe your actions - code, commands, etc]
On EV_SCAN RESULT
let sr = GAP.getScanResultArg(evdata);
print('sr', JSON.stringify(sr));
//
[Apr 15 11:29:25.373] sr {"addr":"ea:cb:3e:cf:00:0f,1","rssi":-56,"advData":"\u0002\u0001\u0006\u0003\u0003\n\u0018\u0007\xff2\v\u0000\u0000\u0000\u0000","scanRsp":""}
Scanning the same device on my local machine using Adafruit BLE library for Python:
from adafruit_ble import BLERadio
from adafruit_ble.advertising import Advertisement
from adafruit_ble.advertising.standard import ProvideServicesAdvertisement
ble = BLERadio()
for ad in ble.start_scan(ProvideServicesAdvertisement, timeout=10):
print("repr advert" + repr(ad))
>>>
repr advertAdvertisement(data=b"\x03\x03\x0a\x18\x07\xff\x32\x0b\x00\x00\x00\x00\x0e\x09\x48\x61\x6c\x61\x54\x61\x6e\x67\x65\x72\x69\x6e\x65")
You can see that the bytes start to line up (bytes 4 and onward from mongoose… are the beginning of the Python output)
- The result I see is: [show the result - log, etc]
Mongoose output (pretty print):
\x02\x01\x06\x03\x03\x0a\x18\x07\xff2\x0b\x00\x00\x00\x00
Python output: (what I am hoping to see)
\x03\x03\x0a\x18\x07\xff\x32\x0b\x00\x00\x00\x00\x0e\x09\x48\x61\x6c\x61\x54\x61\x6e\x67\x65\x72\x69\x6e\x65
- My expectation & question is: [describe your expectation and your question]
Is mongoose truncating the Ad data? my yml config just in case I am missing something
config_schema:
- ["eth.enable", true]
- ["eth.clk_mode", 3]
- ["wifi.sta.enable", false]
- ["wifi.ap.enable", false]
- ["wifi.sta_connect_timeout", 0]
- ["bt.enable", true]
- ["bt.keep_enabled", true]
- ["bt.gatt_mtu", 30] # To test long reads/writes.
- ["board.btn1.pin", 34]
- ["mqtt.enable", true]
- ["mqtt.server", "a18ksecrets.iot.us-east-1.amazonaws.com"]
- ["mqtt.ssl_ca_cert", "ca.pem"]
- ["mqtt.ssl_cert", aws-esp32_3XXX34.crt.pem]
- ["mqtt.ssl_key", aws-esp32_3XXX34.key.pem]
Thanks!