Skip to content

Instantly share code, notes, and snippets.

@vicary
Last active May 11, 2018 08:36
Show Gist options
  • Save vicary/599807a5a04bb0f6670a43577067ab79 to your computer and use it in GitHub Desktop.
Save vicary/599807a5a04bb0f6670a43577067ab79 to your computer and use it in GitHub Desktop.
Bleno DEBUG=*
gatt handles = [
gatt {},
gatt {
gatt "type": "service",
gatt "uuid": "1800",
gatt "startHandle": 1,
gatt "endHandle": 5
gatt },
gatt {
gatt "type": "characteristic",
gatt "uuid": "2a00",
gatt "properties": 2,
gatt "secure": 0,
gatt "startHandle": 2,
gatt "valueHandle": 3
gatt },
gatt {
gatt "type": "characteristicValue",
gatt "handle": 3,
gatt "value": "Buffer('626c6f6b7a2d6d76737549594e55', 'hex')"
gatt },
gatt {
gatt "type": "characteristic",
gatt "uuid": "2a01",
gatt "properties": 2,
gatt "secure": 0,
gatt "startHandle": 4,
gatt "valueHandle": 5
gatt },
gatt {
gatt "type": "characteristicValue",
gatt "handle": 5,
gatt "value": "Buffer('8000', 'hex')"
gatt },
gatt {
gatt "type": "service",
gatt "uuid": "1801",
gatt "startHandle": 6,
gatt "endHandle": 9
gatt },
gatt {
gatt "type": "characteristic",
gatt "uuid": "2a05",
gatt "properties": 32,
gatt "secure": 0,
gatt "startHandle": 7,
gatt "valueHandle": 8
gatt },
gatt {
gatt "type": "characteristicValue",
gatt "handle": 8,
gatt "value": "Buffer('00000000', 'hex')"
gatt },
gatt {
gatt "type": "descriptor",
gatt "handle": 9,
gatt "uuid": "2902",
gatt "properties": 14,
gatt "secure": 0,
gatt "value": "Buffer('0000', 'hex')"
gatt }
gatt ] +0ms
bleno platform linux +57ms
hci setting filter to: 1400000020c10800000000400000 +12ms
hci set event mask - writing: 01010c08fffffbff07f8bf3d +9ms
hci set le event mask - writing: 010120081f00000000000000 +3ms
hci read local version - writing: 01011000 +3ms
hci write LE host supported - writing: 016d0c020100 +3ms
hci read LE host supported - writing: 016c0c00 +4ms
hci read bd addr - writing: 01091000 +3ms
hci le read buffer size - writing: 01022000 +3ms
hci onSocketData: 040e0401010c00 +32ms
hci event type = 4 +4ms
hci sub event type = 14 +4ms
hci ncmd = 1 +9ms
hci cmd = 3073 +3ms
hci status = 0 +5ms
hci result = +3ms
hci onSocketData: 040e0401012000 +13ms
hci event type = 4 +4ms
hci sub event type = 14 +4ms
hci ncmd = 1 +3ms
hci cmd = 8193 +6ms
hci status = 0 +3ms
hci result = +1ms
hci onSocketData: 040e0c01011000076801070f000922 +1ms
hci event type = 4 +1ms
hci sub event type = 14 +1ms
hci ncmd = 1 +1ms
hci cmd = 4097 +1ms
hci status = 0 +0ms
hci result = 076801070f000922 +1ms
hci set advertise enable - writing: 010a200100 +10ms
hci set advertisement parameters - writing: 0106200fa000a0000000000000000000000700 +6ms
hci onSocketData: 040e04016d0c00 +4ms
hci event type = 4 +2ms
hci sub event type = 14 +3ms
hci ncmd = 1 +3ms
hci cmd = 3181 +4ms
hci status = 0 +2ms
hci result = +2ms
hci onSocketData: 040e06016c0c000100 +8ms
hci event type = 4 +2ms
hci sub event type = 14 +3ms
hci ncmd = 1 +4ms
hci cmd = 3180 +5ms
hci status = 0 +3ms
hci result = 0100 +1ms
hci le = 1 +0ms
hci simul = 0 +1ms
hci onSocketData: 040e0a01091000a6e8d8eb27b8 +2ms
hci event type = 4 +2ms
hci sub event type = 14 +5ms
hci ncmd = 1 +4ms
hci cmd = 4105 +4ms
hci status = 0 +5ms
hci result = a6e8d8eb27b8 +3ms
hci address = b8:27:eb:d8:e8:a6 +7ms
bleno addressChange b8:27:eb:d8:e8:a6 +4ms
hci onSocketData: 040e0701022000fb0008 +4ms
hci event type = 4 +3ms
hci sub event type = 14 +3ms
hci ncmd = 1 +4ms
hci cmd = 8194 +6ms
hci status = 0 +4ms
hci result = fb0008 +4ms
hci le acl mtu = 251 +3ms
hci le acl max in progress = 8 +4ms
hci onSocketData: 040e04010a200c +3ms
hci event type = 4 +4ms
hci sub event type = 14 +4ms
hci ncmd = 1 +5ms
hci cmd = 8202 +4ms
hci status = 12 +4ms
hci result = +3ms
hci onSocketData: 040e0401062000 +5ms
hci event type = 4 +2ms
hci sub event type = 14 +8ms
hci ncmd = 1 +2ms
hci cmd = 8198 +6ms
hci status = 0 +1ms
hci result = +4ms
bleno stateChange poweredOn +7ms
gap startAdvertising: name = blokz-mvsuIYNU, serviceUuids = [
gap "76c8df6361d649ea85945bacb97a4805"
gap ] +18ms
gap startAdvertisingWithEIRData: advertisement data = 020106110605487ab9ac5b9485ea49d66163dfc876, scan data = 0f08626c6f6b7a2d6d76737549594e55 +8ms
hci set scan response data - writing: 01092020100f08626c6f6b7a2d6d76737549594e55000000000000000000000000000000 +10ms
hci set advertisement data - writing: 0108202015020106110605487ab9ac5b9485ea49d66163dfc87600000000000000000000 +4ms
hci set advertise enable - writing: 010a200101 +3ms
hci set scan response data - writing: 01092020100f08626c6f6b7a2d6d76737549594e55000000000000000000000000000000 +5ms
hci set advertisement data - writing: 0108202015020106110605487ab9ac5b9485ea49d66163dfc87600000000000000000000 +3ms
hci onSocketData: 040e0401092000 +5ms
hci event type = 4 +4ms
hci sub event type = 14 +2ms
hci ncmd = 1 +6ms
hci cmd = 8201 +4ms
hci status = 0 +4ms
hci result = +3ms
hci onSocketData: 040e0401082000 +3ms
hci event type = 4 +5ms
hci sub event type = 14 +4ms
hci ncmd = 1 +3ms
hci cmd = 8200 +5ms
hci status = 0 +4ms
hci result = +1ms
hci onSocketData: 040e04010a2000 +2ms
hci event type = 4 +3ms
hci sub event type = 14 +3ms
hci ncmd = 1 +5ms
hci cmd = 8202 +4ms
hci status = 0 +4ms
hci result = +1ms
bleno advertisingStart: null +10ms
hci onSocketData: 040e0401092000 +3ms
hci event type = 4 +3ms
hci sub event type = 14 +3ms
hci ncmd = 1 +3ms
hci cmd = 8201 +5ms
hci status = 0 +4ms
hci result = +4ms
hci onSocketData: 040e0401082000 +4ms
hci event type = 4 +5ms
hci sub event type = 14 +4ms
hci ncmd = 1 +3ms
hci cmd = 8200 +3ms
hci status = 0 +4ms
hci result = +6ms
# At this line it stops generating logs for a while (usually 30s - 1m) and advertises normally,
# but when it starts going with the following lines advertisement stops.
hci onSocketData: 040e0401010c00 +15s
hci event type = 4 +2ms
hci sub event type = 14 +0ms
hci ncmd = 1 +3ms
hci cmd = 3073 +6ms
hci status = 0 +3ms
hci result = +4ms
hci onSocketData: 040e0401012000 +3ms
hci event type = 4 +4ms
hci sub event type = 14 +2ms
hci ncmd = 1 +4ms
hci cmd = 8193 +2ms
hci status = 0 +5ms
hci result = +2ms
hci onSocketData: 040e0c01011000076801070f000922 +5ms
hci event type = 4 +9ms
hci sub event type = 14 +3ms
hci ncmd = 1 +6ms
hci cmd = 4097 +3ms
hci status = 0 +3ms
hci result = 076801070f000922 +5ms
hci onSocketData: 040e04016d0c00 +10ms
hci event type = 4 +2ms
hci sub event type = 14 +6ms
hci ncmd = 1 +8ms
hci cmd = 3181 +3ms
hci status = 0 +4ms
hci result = +8ms
hci onSocketData: 040e06016c0c000100 +3ms
hci event type = 4 +3ms
hci sub event type = 14 +6ms
hci ncmd = 1 +0ms
hci cmd = 3180 +1ms
hci status = 0 +1ms
hci result = 0100 +1ms
hci le = 1 +0ms
hci simul = 0 +1ms
hci onSocketData: 040e0a01091000a6e8d8eb27b8 +13ms
hci event type = 4 +2ms
hci sub event type = 14 +8ms
hci ncmd = 1 +5ms
hci cmd = 4105 +5ms
hci status = 0 +5ms
hci result = a6e8d8eb27b8 +3ms
hci address = b8:27:eb:d8:e8:a6 +11ms
bleno addressChange b8:27:eb:d8:e8:a6 +1ms
hci onSocketData: 040e0701022000fb0008 +9ms
hci event type = 4 +3ms
hci sub event type = 14 +5ms
hci ncmd = 1 +8ms
hci cmd = 8194 +3ms
hci status = 0 +4ms
hci result = fb0008 +8ms
hci le acl mtu = 251 +6ms
hci le acl max in progress = 8 +0ms
hci onSocketData: 040e04010a2000 +293ms
hci event type = 4 +2ms
hci sub event type = 14 +1ms
hci ncmd = 1 +1ms
hci cmd = 8202 +0ms
hci status = 0 +8ms
hci result = +7ms
HCI sniffer - Bluetooth packet analyzer ver 5.43
device: hci0 snap_len: 1500 filter: 0xffffffff
> HCI Event: Command Complete (0x0e) plen 4
Set Event Mask (0x03|0x0001) ncmd 1
status 0x00
> HCI Event: Command Complete (0x0e) plen 4
LE Set Event Mask (0x08|0x0001) ncmd 1
status 0x00
> HCI Event: Command Complete (0x0e) plen 12
Read Local Version Information (0x04|0x0001) ncmd 1
status 0x00
HCI Version: 4.1 (0x7) HCI Revision: 0x168
LMP Version: 4.1 (0x7) LMP Subversion: 0x2209
Manufacturer: Broadcom Corporation (15)
> HCI Event: Command Complete (0x0e) plen 4
Write LE Host Supported (0x03|0x006d) ncmd 1
> HCI Event: Command Complete (0x0e) plen 6
Read LE Host Supported (0x03|0x006c) ncmd 1
> HCI Event: Command Complete (0x0e) plen 10
Read BD ADDR (0x04|0x0009) ncmd 1
status 0x00 bdaddr B8:27:EB:D8:E8:A6
> HCI Event: Command Complete (0x0e) plen 7
LE Read Buffer Size (0x08|0x0002) ncmd 1
status 0x00 pktlen 0x00fb maxpkt 0x08
> HCI Event: Command Complete (0x0e) plen 4
LE Set Advertise Enable (0x08|0x000a) ncmd 1
status 0x0c
Error: Command Disallowed
> HCI Event: Command Complete (0x0e) plen 4
Set Event Mask (0x03|0x0001) ncmd 1
status 0x00
> HCI Event: Command Complete (0x0e) plen 4
LE Set Event Mask (0x08|0x0001) ncmd 1
status 0x00
> HCI Event: Command Complete (0x0e) plen 12
Read Local Version Information (0x04|0x0001) ncmd 1
status 0x00
HCI Version: 4.1 (0x7) HCI Revision: 0x168
LMP Version: 4.1 (0x7) LMP Subversion: 0x2209
Manufacturer: Broadcom Corporation (15)
> HCI Event: Command Complete (0x0e) plen 4
Write LE Host Supported (0x03|0x006d) ncmd 1
> HCI Event: Command Complete (0x0e) plen 6
Read LE Host Supported (0x03|0x006c) ncmd 1
> HCI Event: Command Complete (0x0e) plen 10
Read BD ADDR (0x04|0x0009) ncmd 1
status 0x00 bdaddr B8:27:EB:D8:E8:A6
> HCI Event: Command Complete (0x0e) plen 7
LE Read Buffer Size (0x08|0x0002) ncmd 1
status 0x00 pktlen 0x00fb maxpkt 0x08
> HCI Event: Command Complete (0x0e) plen 4
LE Set Advertise Enable (0x08|0x000a) ncmd 1
status 0x0c
Error: Command Disallowed
> HCI Event: Command Complete (0x0e) plen 4
LE Set Advertising Parameters (0x08|0x0006) ncmd 1
status 0x00
> HCI Event: Command Complete (0x0e) plen 4
LE Set Scan Response Data (0x08|0x0009) ncmd 1
status 0x00
> HCI Event: Command Complete (0x0e) plen 4
LE Set Advertising Data (0x08|0x0008) ncmd 1
status 0x00
> HCI Event: Command Complete (0x0e) plen 4
LE Set Advertise Enable (0x08|0x000a) ncmd 1
status 0x00
> HCI Event: Command Complete (0x0e) plen 4
LE Set Scan Response Data (0x08|0x0009) ncmd 1
status 0x00
> HCI Event: Command Complete (0x0e) plen 4
LE Set Advertising Data (0x08|0x0008) ncmd 1
status 0x00
# This is where the 30s-60s "normal" state goes, then follows the failing sequence.
> HCI Event: Command Complete (0x0e) plen 4
Set Event Mask (0x03|0x0001) ncmd 1
status 0x00
> HCI Event: Command Complete (0x0e) plen 4
LE Set Event Mask (0x08|0x0001) ncmd 1
status 0x00
> HCI Event: Command Complete (0x0e) plen 12
Read Local Version Information (0x04|0x0001) ncmd 1
status 0x00
HCI Version: 4.1 (0x7) HCI Revision: 0x168
LMP Version: 4.1 (0x7) LMP Subversion: 0x2209
Manufacturer: Broadcom Corporation (15)
> HCI Event: Command Complete (0x0e) plen 4
Write LE Host Supported (0x03|0x006d) ncmd 1
> HCI Event: Command Complete (0x0e) plen 6
Read LE Host Supported (0x03|0x006c) ncmd 1
> HCI Event: Command Complete (0x0e) plen 10
Read BD ADDR (0x04|0x0009) ncmd 1
status 0x00 bdaddr B8:27:EB:D8:E8:A6
> HCI Event: Command Complete (0x0e) plen 7
LE Read Buffer Size (0x08|0x0002) ncmd 1
status 0x00 pktlen 0x00fb maxpkt 0x08
> HCI Event: Command Complete (0x0e) plen 4
LE Set Scan Response Data (0x08|0x0009) ncmd 1
status 0x00
> HCI Event: Command Complete (0x0e) plen 4
LE Set Advertising Data (0x08|0x0008) ncmd 1
status 0x00
> HCI Event: Command Complete (0x0e) plen 4
LE Set Advertise Enable (0x08|0x000a) ncmd 1
status 0x0c
Error: Command Disallowed
> HCI Event: Command Complete (0x0e) plen 4
LE Set Scan Response Data (0x08|0x0009) ncmd 1
status 0x00
> HCI Event: Command Complete (0x0e) plen 4
LE Set Advertising Data (0x08|0x0008) ncmd 1
status 0x00
> HCI Event: Command Complete (0x0e) plen 4
LE Set Advertise Enable (0x08|0x000a) ncmd 1
status 0x00
// sudo DEBUG=* NOBLE_MULTI_ROLE=1 node test-nobleno.js
const os = require("os");
const uuid = require("uuid/v4");
const noble = require("noble");
const bleno = require("bleno");
const serviceUuids = [
uuid()
];
// here it advertises normally for about 30s - 60s.
bleno.on("stateChange", ()=> {
if ( bleno.state === "poweredOn" ) {
bleno.startAdvertising(os.hostname(), serviceUuids);
}
});
// hacking into the bindings will have it advertise exactly **one** single tick, it then stops again.
bleno._bindings.on("addressChange", ()=> {
if ( bleno.state === "poweredOn" ) {
bleno.stopAdvertising(()=> {
bleno.startAdvertising(os.hostname(), serviceUuids);
});
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment