-
Notifications
You must be signed in to change notification settings - Fork 8
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
Cannot effectively scan with OSX, RasPi, or Feather Sense #15
Comments
I do notice that # AdafruitColor
match_prefixes = (
struct.pack(
"<BHBH",
_MANUFACTURING_DATA_ADT,
_ADAFRUIT_COMPANY_ID,
struct.calcsize("<HI"),
_COLOR_DATA_ID,
),
) Adafruit_CircuitPython_BLE_BroadcastNet/adafruit_ble_broadcastnet.py Lines 81 to 83 in 82899ad
Is that "3" out of order for matching? |
Also maybe relevant: if it's supposed to be match_prefixes = (
struct.pack("<BBH", _MANUFACTURING_DATA_ADT, _ADAFRUIT_COMPANY_ID, 3),
) where the 3 = 0x03 = 0x0003 from |
Definitely some competing factors here - No - I just figured out: advertisements ALWAYS get assigned an ascending%256 In other words, # This works, since sequence_number gets put out front.
measurement = adafruit_ble_broadcastnet.AdafruitSensorMeasurement()
measurement.sequence_number = 0
measurement.battery_voltage = 1234
measurement.temperature = 55.55 vs # This fails, since sequence_number gets tagged on the end of the struct and doesn't get caught as a prefix match.
measurement = adafruit_ble_broadcastnet.AdafruitSensorMeasurement()
#measurement.sequence_number = 0
measurement.battery_voltage = 1234
measurement.temperature = 55.55 |
Restructured match_prefixes to correctly match sequence number field Added insurance that sequence number comes first to do so Also caught the (macOS) case where adapter has no address (WIP) Fixes adafruit#15
This might be related to #11 but I can't say for sure - the symptoms don't totally overlap. The gist is,
ble.start_scan(adafruit_ble_broadcastnet.AdafruitSensorMeasurement)
will never return any advertisements to process, tested on Mac and RasPi. If, on the other hand, Ible.start_scan()
, plenty of the relevant ads ARE getting scanned.I'm running the following code on a Feather Sense:
On the RasPi, I'm using the following to scan:
On Mac, I'm using the following to implement the same test:
The result of this test:
I'm not quite sure what to make of this, but it looks like the check of
match_prefixes
is failing for some non-obvious reason, given that the ad data payload looks pretty matchy to me in the Mac case, and in at least the shorter Pi case.EDIT: I just tested with a second Feather Sense running the RasPi version of the gateway code, and got matching results to the Pi. I noticed at the same time that the manufacturer data appears to be included in the first advertisement but not the second, which I guess is normal - the scan_response doesn't duplicate the original manufacturer data payload.
The text was updated successfully, but these errors were encountered: