z3ugma
02/12/2025, 4:44 AMmanufacturer-specific data. Toit on MacOS BLE shows only the first instance of the advertisement data:
central := adapter.central
device := find_by_name central DEV_NAME
print device.data.raw
identifier := device.identifier
remote_device := central.connect identifier
print "Address: $remote_device.identifier"
find_by_name central/ble.Central name/string:
central.scan --duration=SCAN_DURATION: | device/ble.RemoteScannedDevice |
if device.identifier and device.data.name == name:
return device
throw "no ring device found"
#[0xff, 0xff, 0x00, 0x00, 0x2b, 0x51, 0xb0, 0x23, 0x3a, 0xd1]
https://cdn.discordapp.com/attachments/1339094810455445565/1339094811076067429/image.png?ex=67ad78ba&is=67ac273a&hm=ed43a7c012bcab922c412c28109a761621fd7b04ee4ea378b8c1e895dc58d19d&z3ugma
02/12/2025, 4:45 AMble-scan-next_ central-manager:
#primitive.ble.scan-nextz3ugma
02/12/2025, 4:48 AMz3ugma
02/12/2025, 4:53 AM(venv) ?1 circul % jag run -d host ble_scan.toit
Class 'DataBlock' does not have any method 'hash-code'.
0: HashedInsertionOrderedCollection_.hash-code_ <sdk>/core/collections.toit:2188:16
1: HashedInsertionOrderedCollection_.find_ <sdk>/core/collections.toit:2303:13
2: Set.add <sdk>/core/collections.toit:2565:17
3: Set.add-all.<block> <sdk>/core/collections.toit:2577:20
4: SmallArray_.do_ <sdk>/core/collections.toit:954:3
5: List_.do <sdk>/core/collections.toit:1983:19
6: Set.add-all <sdk>/core/collections.toit:2577:16
7: main.<block> ble_scan.toit:18:12
8: Central.scan.<block> <sdk>/ble/remote.toit:135:9
9: Central.scan <sdk>/ble/remote.toit:74:3
10: main ble_scan.toit:16:11
Error: exit status 1
(venv) ?1 circul %
^^that example actually now throws an errorz3ugma
02/12/2025, 5:14 AMAD packet and not the scan response packet which contains the further infoz3ugma
02/12/2025, 5:36 AM--active scan on MacOS specifically? I would expect to be getting some true values of --.is-scan-responsez3ugma
02/12/2025, 5:37 AMmain:
adapter := ble.Adapter
central := adapter.central
// An active scan may need the responses to be merged.
central.scan --duration=(Duration --s=5) --active: | device/ble.RemoteScannedDevice |
print "$device.is-scan-response $device.rssi"
jag run -d host ble_scan.toit
false -47
false -82
false -48
false -78
false -54
false -76
false -77
false -83
false -91
false -87
false -75
false -61
false -73
false -95
false -88
false -90
false -102
false -98
false -95floitsch
02/12/2025, 11:12 AMfloitsch
02/12/2025, 11:25 AM[central_manager->central_manager() scanForPeripheralsWithServices:@[[CBUUID UUIDWithString:@"180D"]]
options:@{CBCentralManagerScanOptionAllowDuplicatesKey: @YES}];
Do you think you could test that?z3ugma
02/12/2025, 2:03 PMz3ugma
02/12/2025, 2:04 PMble_darwin.mm
That will require compiling the src, right? It's not interpreted / I can't just edit my current Jag install on the fly?z3ugma
02/12/2025, 2:35 PMoptions but the ble scan is still showing no responses where
// An active scan may need the responses to be merged.
central.scan --duration=(Duration --s=5) --active: | device/ble.RemoteScannedDevice |
print "$device.is-scan-response $device.rssi"
is-scan-response is true
https://cdn.discordapp.com/attachments/1339094810455445565/1339243377362731050/image.png?ex=67ae0317&is=67acb197&hm=a540b2bb75a95c0d58e685bcf38ff72aba0302ac75bca3692a81bb1a0880acd1&z3ugma
02/12/2025, 3:00 PMz3ugma
02/12/2025, 3:02 PMkCBAdvDataManufacturerData. In the first scan there are 37 bytes of mnfr data. in the second scan, there are 10. same peripheral ID and same identifier.
2025-02-12 08:59:07.338 toit.run[24749:1947303] Peripheral: <CBPeripheral: 0x104c05250, identifier = 6EF5B2E2-87AF-477E-D116-B27C6F7EF37E, name = MR, mtu = 0, state = disconnected>
2025-02-12 08:59:07.338 toit.run[24749:1947303] RSSI: -84
2025-02-12 08:59:07.338 toit.run[24749:1947303] Advertisement Data: {
kCBAdvDataIsConnectable = 1;
kCBAdvDataLocalName = MR;
kCBAdvDataManufacturerData = {length = 37, bytes = 0x00002b51 b0233ad1 01010100 00000000 ... 000067ac b73b0000 };
kCBAdvDataRxPrimaryPHY = 129;
kCBAdvDataRxSecondaryPHY = 0;
kCBAdvDataServiceUUIDs = (
FAB1
);
kCBAdvDataTimestamp = "761065147.33799";
}
2025-02-12 08:59:07.339 toit.run[24749:1947303] Peripheral: <CBPeripheral: 0x104c05250, identifier = 6EF5B2E2-87AF-477E-D116-B27C6F7EF37E, name = MR, mtu = 0, state = disconnected>
2025-02-12 08:59:07.339 toit.run[24749:1947303] RSSI: -83
2025-02-12 08:59:07.693 toit.run[24749:1947303] Advertisement Data: {
kCBAdvDataIsConnectable = 1;
kCBAdvDataManufacturerData = {length = 10, bytes = 0x4c001006351e1ab800cd};
kCBAdvDataRxPrimaryPHY = 1;
kCBAdvDataRxSecondaryPHY = 0;
kCBAdvDataTimestamp = "761065147.693242";
kCBAdvDataTxPowerLevel = 12;
}z3ugma
02/12/2025, 3:09 PM2025-02-12 09:05:12.713 toit.run[30024:1967859] Advertisement Mnfr Data: {length = 8, bytes = 0x00002b51b0233ad1}
2025-02-12 09:05:12.713 toit.run[30024:1967859] Peripheral: <CBPeripheral: 0x13e706860, identifier = 6EF5B2E2-87AF-477E-D116-B27C6F7EF37E, name = MR, mtu = 0, state = disconnected>
2025-02-12 09:05:12.713 toit.run[30024:1967859] RSSI: -84
false -84
2025-02-12 09:05:12.713 toit.run[30024:1967859] Advertisement Mnfr Data: {length = 37, bytes = 0x00002b51 b0233ad1 01010100 00000000 ... 000067ac b8a90000 }
2025-02-12 09:05:12.713 toit.run[30024:1967859] Peripheral: <CBPeripheral: 0x13e706860, identifier = 6EF5B2E2-87AF-477E-D116-B27C6F7EF37E, name = MR, mtu = 0, state = disconnected>
2025-02-12 09:05:12.713 toit.run[30024:1967859] RSSI: -82
2025-02-12 09:05:12.720 toit.run[30024:1967859] Advertisement Mnfr Data: {length = 6, bytes = 0x4c0012020000}
2025-02-12 09:05:12.720 toit.run[30024:1967859] Peripheral: <CBPeripheral: 0x13e611c90, identifier = 6D78A7EF-B545-7E99-B985-DED0AA52BC29, name = (null), mtu = 0, state = disconnected>
2025-02-12 09:05:12.720 toit.run[30024:1967859] RSSI: -37
^so here we see the NSLog statements followed by the Toit stdout. it appears that only the first packet is passed up to Toit. the second packet doesn't have a false -82 for examplefloitsch
02/12/2025, 3:11 PMfloitsch
03/05/2025, 9:41 AMz3ugma
03/07/2025, 1:51 PMfloitsch
03/07/2025, 2:00 PM