noble / noble-device Goto Github PK
View Code? Open in Web Editor NEWA Node.js lib to abstract BLE (Bluetooth Low Energy) peripherals, uses noble
License: MIT License
A Node.js lib to abstract BLE (Bluetooth Low Energy) peripherals, uses noble
License: MIT License
Any ideas on this?
[Fri Apr 01 2016 11:25:25] [ERROR] (node) warning: possible EventEmitter memory leak detected. 11 disconnect listeners added. Use emitter.setMaxListeners() to increase limit.
[Fri Apr 01 2016 11:25:25] [ERROR] Trace
at Peripheral.addListener (events.js:179:15)
at NobleDevice (/home/pi/prophecy-gateway/src/node_modules/sensortag/node_modules/noble-device/lib/noble-device.js:18:20)
at Noble.constructor.onDiscover (/home/pi/prophecy-gateway/src/node_modules/sensortag/node_modules/noble-device/lib/util.js:28:22)
at Noble.emit (events.js:129:20)
at Noble.onDiscover (/home/pi/prophecy-gateway/src/node_modules/noble/lib/noble.js:152:10)
at emit (events.js:118:17)
at NobleBindings.onDiscover (/home/pi/prophecy-gateway/src/node_modules/noble/lib/hci-socket/bindings.js:160:10)
at emit (events.js:118:17)
at Gap.onHciLeAdvertisingReport (/home/pi/prophecy-gateway/src/node_modules/noble/lib/hci-socket/gap.js:160:10)
Hi,
I am playing with a RedBear Duo that provides some example BLE peripheral code for Arduino:
I tried to translate this:
static uint8_t service1_uuid[16] ={0x71,0x3d,0x00,0x00,0x50,0x3e,0x4c,0x75,0xba,0x94,0x31,0x48,0xf1,0x8d,0x94,0x1e};
static uint8_t char1_uuid[16] ={0x71,0x3d,0x00,0x02,0x50,0x3e,0x4c,0x75,0xba,0x94,0x31,0x48,0xf1,0x8d,0x94,0x1e};
static uint8_t char2_uuid[16] ={0x71,0x3d,0x00,0x03,0x50,0x3e,0x4c,0x75,0xba,0x94,0x31,0x48,0xf1,0x8d,0x94,0x1e};
into an example MyThing:
var YOUR_THING_SERVICE_UUID = new Buffer([0x71,0x3d,0x00,0x00,0x50,0x3e,0x4c,0x75,0xba,0x94,0x31,0x48,0xf1,0x8d,0x94,0x1e]).toString('hex');
var YOUR_THING_NOTIFY_CHAR = new Buffer([0x71,0x3d,0x00,0x02,0x50,0x3e,0x4c,0x75,0xba,0x94,0x31,0x48,0xf1,0x8d,0x94,0x1e]).toString('hex');
var YOUR_THING_READ_CHAR = new Buffer([0x71,0x3d,0x00,0x02,0x50,0x3e,0x4c,0x75,0xba,0x94,0x31,0x48,0xf1,0x8d,0x94,0x1e]).toString('hex');
var YOUR_THING_WRITE_CHAR = new Buffer([0x71,0x3d,0x00,0x02,0x50,0x3e,0x4c,0x75,0xba,0x94,0x31,0x48,0xf1,0x8d,0x94,0x1e]).toString('hex');
But when I try to discover the peripheral, there is no output:
$ cat disco.js
var YourThing = require('./my_thing');
YourThing.discover(function(yourThing) {
// you can be notified of disconnects
yourThing.on('disconnect', function() {
console.log('we got disconnected! :( ');
});
// you'll need to call connect and set up
yourThing.connectAndSetUp(function(error) {
console.log('were connected!');
});
});
pm:ble_device pmu$ node disco.js
What might be good to try debugging?
Hey @sandeepmistry, what are your thoughts on adding an additional Noble device state that is "connectedAndSetup”? When connectAndSetup() has completed, the device’s state could automatically switch to “connectedAndSetup”, indicating that its services and characteristics are ready to be interacted with.
Looping in @raykamp here too.
Hey Sandeep, great work on this project and noble. It's been a huge help to the BLE community!
As a bit of context.. I'm developing a node-red node for the Light Blue Bean and I'm using Jacob Rosenthal's Ble-Bean project.
I'm looking to use Noble-device to scan for multiple devices of the "Bean" type simultaneously. The current mechanism for searching for a unique device appears to be defining the "if" method of the "Bean" (Noble-device) class. This works great when I'm looking for only one device at a time, but doesn't support the use case of uniquely searching for multiple devices at once.
Here's a snippet of my code. I have something like a "bean manager" instance that is calling this code before it attempts to discover it's associated Bean.
bleBean.is = function(peripheral){
return ( peripheral.advertisement.localName === this.name || peripheral.uuid === this.uuid );
}.bind(this);
Any support/help/suggestions that you have are much appreciated
This feature request came from this issue: #9 (comment)
"It seems like there should be a way to have a user request that a discovery attempt should end. If I call "discoverAll", then I can end this attempt by calling "stopDiscoverAll" with the same listener function. If I call "discover", "discoverWithFilter", or "discoverByUuid" then I'm unable to cancel these discovery attempts."
i'm running the latest test.js from https://github.com/TheThingSystem/node-air-air
mrose% node test.js
found b47e52dc92b546e6bdfbc5d5354c976f
connectAndSetup
readValues
buffer.js:582
throw new RangeError('Trying to access beyond buffer length');
^
RangeError: Trying to access beyond buffer length
at checkOffset (buffer.js:582:11)
at Buffer.readUInt16LE (buffer.js:609:5)
at /Users/mrose/Documents/projects/node-air-air/node_modules/noble-device/lib/noble-device.js:107:19
at /Users/mrose/Documents/projects/node-air-air/node_modules/noble-device/lib/noble-device.js:69:5
at Characteristic.<anonymous> (/Users/mrose/Documents/projects/node-air-air/node_modules/noble-device/node_modules/noble/lib/characteristic.js:40:7)
at Characteristic.g (events.js:180:16)
at Characteristic.EventEmitter.emit (events.js:98:17)
at Noble.onRead (/Users/mrose/Documents/projects/node-air-air/node_modules/noble-device/node_modules/noble/lib/noble.js:263:20)
at EventEmitter.emit (events.js:106:17)
at nobleBindings.write.sendCBMsg.kCBMsgArgDeviceUUID (/Users/mrose/Documents/projects/node-air-air/node_modules/noble-device/node_modules/noble/lib/mac/mavericks.js:378:12)
Greetings,
I'm using the node-metawear library to collect accelerometer data over BLE and have been running into a consistent disconnect problem using a raspberry pi 3 running the latest raspbian jessie image with updates and the latest build of bluez (5.44) I downloaded and compiled. I've dug around here, on the node-metawear git, and noble git. Posting here seems the most relevant spot because it seems to be a NobleDevice related problem.
Anyhow, I'm running into disconnect problems fairly regularly. Basically, the 'disconnect' event fires sometime between discovery and connectAndSetup completion. My disconnect event callback simply schedule a new discovery/connect 1000ms later using setTimeout; however, when this problem occurs the app never successfully connects to the sensor. I've included an hcidump log capturing the intial discovery and connected attempt followed by roughly 10 seconds of thrashing before the app closes. Please let me know if I can include any additional information.
HCI sniffer - Bluetooth packet analyzer ver 5.23
device: hci0 snap_len: 1500 filter: 0xffffffff
2017-03-22 21:32:43.859630 < HCI Command: Set Event Mask (0x03|0x0001) plen 8
Mask: 0xfffffbff07f8bf3d
2017-03-22 21:32:43.860118 > HCI Event: Command Complete (0x0e) plen 4
Set Event Mask (0x03|0x0001) ncmd 1
status 0x00
2017-03-22 21:32:43.860732 < HCI Command: LE Set Event Mask (0x08|0x0001) plen 8
mask 0x1f00000000000000 (Reserved)
2017-03-22 21:32:43.861193 > HCI Event: Command Complete (0x0e) plen 4
LE Set Event Mask (0x08|0x0001) ncmd 1
status 0x00
2017-03-22 21:32:43.861307 < HCI Command: Read Local Version Information (0x04|0x0001) plen 0
2017-03-22 21:32:43.861796 > HCI Event: Command Complete (0x0e) plen 12
Read Local Version Information (0x04|0x0001) ncmd 1
status 0x00
HCI Version: 4.1 (0x7) HCI Revision: 0xb6
LMP Version: 4.1 (0x7) LMP Subversion: 0x2209
Manufacturer: Broadcom Corporation (15)
2017-03-22 21:32:43.861821 < HCI Command: Write LE Host Supported (0x03|0x006d) plen 2
01 00
2017-03-22 21:32:43.862219 > HCI Event: Command Complete (0x0e) plen 4
Write LE Host Supported (0x03|0x006d) ncmd 1
00
2017-03-22 21:32:43.862323 < HCI Command: Read LE Host Supported (0x03|0x006c) plen 0
2017-03-22 21:32:43.862699 > HCI Event: Command Complete (0x0e) plen 6
Read LE Host Supported (0x03|0x006c) ncmd 1
00 01 00
2017-03-22 21:32:43.862800 < HCI Command: Read BD ADDR (0x04|0x0009) plen 0
2017-03-22 21:32:43.863217 > HCI Event: Command Complete (0x0e) plen 10
Read BD ADDR (0x04|0x0009) ncmd 1
status 0x00 bdaddr B8:27:EB:68:62:DA
2017-03-22 21:32:43.989258 < HCI Command: LE Set Scan Enable (0x08|0x000c) plen 2
value 0x00 (scanning disabled)
filter duplicates 0x01 (enabled)
2017-03-22 21:32:43.989692 > HCI Event: Command Complete (0x0e) plen 4
LE Set Scan Enable (0x08|0x000c) ncmd 1
status 0x0c
Error: Command Disallowed
2017-03-22 21:32:43.989916 < HCI Command: LE Set Scan Parameters (0x08|0x000b) plen 7
type 0x01 (active)
interval 10.000ms window 10.000ms
own address: 0x00 (Public) policy: All
2017-03-22 21:32:43.990420 > HCI Event: Command Complete (0x0e) plen 4
LE Set Scan Parameters (0x08|0x000b) ncmd 1
status 0x00
2017-03-22 21:32:43.996589 < HCI Command: LE Set Scan Enable (0x08|0x000c) plen 2
value 0x00 (scanning disabled)
filter duplicates 0x01 (enabled)
2017-03-22 21:32:43.996987 > HCI Event: Command Complete (0x0e) plen 4
LE Set Scan Enable (0x08|0x000c) ncmd 1
status 0x0c
Error: Command Disallowed
2017-03-22 21:32:43.997014 < HCI Command: LE Set Scan Parameters (0x08|0x000b) plen 7
type 0x01 (active)
interval 10.000ms window 10.000ms
own address: 0x00 (Public) policy: All
2017-03-22 21:32:43.997454 > HCI Event: Command Complete (0x0e) plen 4
LE Set Scan Parameters (0x08|0x000b) ncmd 1
status 0x00
2017-03-22 21:32:43.997478 < HCI Command: LE Set Scan Enable (0x08|0x000c) plen 2
value 0x01 (scanning enabled)
filter duplicates 0x01 (enabled)
2017-03-22 21:32:43.997944 > HCI Event: Command Complete (0x0e) plen 4
LE Set Scan Enable (0x08|0x000c) ncmd 1
status 0x00
2017-03-22 21:32:44.075638 > HCI Event: LE Meta Event (0x3e) plen 43
LE Advertising Report
ADV_IND - Connectable undirected advertising (0)
bdaddr F8:04:2E:E7:73:BD (Public)
Flags: 0x00
Unknown type 0xff with 26 bytes data
RSSI: -50
2017-03-22 21:32:44.088803 > HCI Event: LE Meta Event (0x3e) plen 33
LE Advertising Report
ADV_IND - Connectable undirected advertising (0)
bdaddr 75:C2:E7:72:E2:0C (Random)
Flags: 0x1a
Unknown type 0x07 with 16 bytes data
RSSI: -71
2017-03-22 21:32:44.195711 > HCI Event: LE Meta Event (0x3e) plen 12
LE Advertising Report
SCAN_RSP - Scan Response (4)
bdaddr 75:C2:E7:72:E2:0C (Random)
RSSI: -86
2017-03-22 21:32:44.200553 > HCI Event: LE Meta Event (0x3e) plen 43
LE Advertising Report
ADV_IND - Connectable undirected advertising (0)
bdaddr E9:D1:C1:68:0D:86 (Random)
Shortened local name: 'MetaWear'
Flags: 0x06
Unknown type 0x06 with 16 bytes data
RSSI: -75
2017-03-22 21:32:44.200770 > HCI Event: LE Meta Event (0x3e) plen 12
LE Advertising Report
SCAN_RSP - Scan Response (4)
bdaddr E9:D1:C1:68:0D:86 (Random)
RSSI: -75
2017-03-22 21:32:44.207076 < HCI Command: LE Set Scan Enable (0x08|0x000c) plen 2
value 0x00 (scanning disabled)
filter duplicates 0x01 (enabled)
2017-03-22 21:32:44.209143 > HCI Event: Command Complete (0x0e) plen 4
LE Set Scan Enable (0x08|0x000c) ncmd 1
status 0x00
2017-03-22 21:32:44.211708 < HCI Command: LE Create Connection (0x08|0x000d) plen 25
bdaddr E9:D1:C1:68:0D:86 type 1
interval 96 window 48 initiator_filter 0
own_bdaddr_type 0 min_interval 6 max_interval 12
latency 0 supervision_to 200 min_ce 4 max_ce 6
2017-03-22 21:32:44.212492 > HCI Event: Command Status (0x0f) plen 4
LE Create Connection (0x08|0x000d) status 0x00 ncmd 1
2017-03-22 21:32:45.053082 > HCI Event: LE Meta Event (0x3e) plen 19
LE Connection Complete
status 0x00 handle 64, role master
bdaddr E9:D1:C1:68:0D:86 (Random)
2017-03-22 21:32:45.053291 < HCI Command: LE Read Remote Used Features (0x08|0x0016) plen 2
40 00
2017-03-22 21:32:45.054921 > HCI Event: Command Status (0x0f) plen 4
LE Read Remote Used Features (0x08|0x0016) status 0x00 ncmd 1
2017-03-22 21:32:45.137374 > HCI Event: LE Meta Event (0x3e) plen 12
LE Read Remote Used Features Complete
status 0x13 handle 64
Error: Remote User Terminated Connection
2017-03-22 21:32:45.137961 > HCI Event: Disconn Complete (0x05) plen 4
status 0x00 handle 64 reason 0x13
Reason: Remote User Terminated Connection
2017-03-22 21:32:45.244871 < ACL data: handle 64 flags 0x00 dlen 7
ATT: MTU req (0x02)
client rx mtu 256
2017-03-22 21:32:45.417203 > HCI Event: Number of Completed Packets (0x13) plen 5
handle 64 packets 1
2017-03-22 21:32:46.191944 < HCI Command: LE Set Scan Enable (0x08|0x000c) plen 2
value 0x00 (scanning disabled)
filter duplicates 0x01 (enabled)
2017-03-22 21:32:46.192363 > HCI Event: Command Complete (0x0e) plen 4
LE Set Scan Enable (0x08|0x000c) ncmd 1
status 0x0c
Error: Command Disallowed
2017-03-22 21:32:46.192392 < HCI Command: LE Set Scan Parameters (0x08|0x000b) plen 7
type 0x01 (active)
interval 10.000ms window 10.000ms
own address: 0x00 (Public) policy: All
2017-03-22 21:32:46.192880 > HCI Event: Command Complete (0x0e) plen 4
LE Set Scan Parameters (0x08|0x000b) ncmd 1
status 0x00
2017-03-22 21:32:46.192903 < HCI Command: LE Set Scan Enable (0x08|0x000c) plen 2
value 0x01 (scanning enabled)
filter duplicates 0x01 (enabled)
2017-03-22 21:32:46.193314 > HCI Event: Command Complete (0x0e) plen 4
LE Set Scan Enable (0x08|0x000c) ncmd 1
status 0x00
2017-03-22 21:32:46.201766 > HCI Event: LE Meta Event (0x3e) plen 43
LE Advertising Report
ADV_IND - Connectable undirected advertising (0)
bdaddr F8:04:2E:E7:73:BD (Public)
Flags: 0x00
Unknown type 0xff with 26 bytes data
RSSI: -46
2017-03-22 21:32:46.216384 > HCI Event: LE Meta Event (0x3e) plen 33
LE Advertising Report
ADV_IND - Connectable undirected advertising (0)
bdaddr 75:C2:E7:72:E2:0C (Random)
Flags: 0x1a
Unknown type 0x07 with 16 bytes data
RSSI: -56
2017-03-22 21:32:46.320490 > HCI Event: LE Meta Event (0x3e) plen 12
LE Advertising Report
SCAN_RSP - Scan Response (4)
bdaddr 75:C2:E7:72:E2:0C (Random)
RSSI: -83
2017-03-22 21:32:46.966325 > HCI Event: LE Meta Event (0x3e) plen 29
LE Advertising Report
SCAN_RSP - Scan Response (4)
bdaddr F8:04:2E:E7:73:BD (Public)
Shortened local name: '[TV] UN60JS7000'
RSSI: -67
2017-03-22 21:32:47.080360 > HCI Event: LE Meta Event (0x3e) plen 27
LE Advertising Report
ADV_IND - Connectable undirected advertising (0)
bdaddr 1C:1A:C0:69:F9:00 (Public)
Flags: 0x1a
Unknown type 0xff with 10 bytes data
RSSI: -81
2017-03-22 21:32:47.257026 > HCI Event: LE Meta Event (0x3e) plen 39
LE Advertising Report
ADV_IND - Connectable undirected advertising (0)
bdaddr F6:0D:BF:1F:57:92 (Random)
Flags: 0x06
Unknown type 0x06 with 16 bytes data
Unknown type 0x16 with 4 bytes data
RSSI: -94
2017-03-22 21:32:47.263132 > HCI Event: LE Meta Event (0x3e) plen 12
LE Advertising Report
SCAN_RSP - Scan Response (4)
bdaddr 1C:1A:C0:69:F9:00 (Public)
RSSI: -94
2017-03-22 21:32:47.511798 > HCI Event: LE Meta Event (0x3e) plen 43
LE Advertising Report
ADV_IND - Connectable undirected advertising (0)
bdaddr E9:D1:C1:68:0D:86 (Random)
Shortened local name: 'MetaWear'
Flags: 0x06
Unknown type 0x06 with 16 bytes data
RSSI: -59
2017-03-22 21:32:48.775608 > HCI Event: LE Meta Event (0x3e) plen 12
LE Advertising Report
SCAN_RSP - Scan Response (4)
bdaddr E9:D1:C1:68:0D:86 (Random)
RSSI: -84
2017-03-22 21:32:48.779280 < HCI Command: LE Set Scan Enable (0x08|0x000c) plen 2
value 0x00 (scanning disabled)
filter duplicates 0x01 (enabled)
2017-03-22 21:32:48.780431 > HCI Event: Command Complete (0x0e) plen 4
LE Set Scan Enable (0x08|0x000c) ncmd 1
status 0x00
2017-03-22 21:32:48.780796 < HCI Command: LE Create Connection (0x08|0x000d) plen 25
bdaddr E9:D1:C1:68:0D:86 type 1
interval 96 window 48 initiator_filter 0
own_bdaddr_type 0 min_interval 6 max_interval 12
latency 0 supervision_to 200 min_ce 4 max_ce 6
2017-03-22 21:32:48.781640 > HCI Event: Command Status (0x0f) plen 4
LE Create Connection (0x08|0x000d) status 0x00 ncmd 1
2017-03-22 21:32:53.982540 < HCI Command: Disconnect (0x01|0x0006) plen 3
handle 0 reason 0x13
Reason: Remote User Terminated Connection
2017-03-22 21:32:53.983037 > HCI Event: Command Status (0x0f) plen 4
Disconnect (0x01|0x0006) status 0x02 ncmd 1
Error: Unknown Connection Identifier
2017-03-22 21:32:53.983652 < HCI Command: LE Set Scan Enable (0x08|0x000c) plen 2
value 0x00 (scanning disabled)
filter duplicates 0x01 (enabled)
2017-03-22 21:32:53.984051 > HCI Event: Command Complete (0x0e) plen 4
LE Set Scan Enable (0x08|0x000c) ncmd 1
status 0x0c
Error: Command Disallowed
2017-03-22 21:32:54.279386 > HCI Event: LE Meta Event (0x3e) plen 19
LE Connection Complete
status 0x00 handle 64, role master
bdaddr E9:D1:C1:68:0D:86 (Random)
2017-03-22 21:32:54.279717 < HCI Command: LE Read Remote Used Features (0x08|0x0016) plen 2
40 00
2017-03-22 21:32:54.282515 > HCI Event: Command Status (0x0f) plen 4
LE Read Remote Used Features (0x08|0x0016) status 0x00 ncmd 1
2017-03-22 21:32:54.450029 > HCI Event: LE Meta Event (0x3e) plen 12
LE Read Remote Used Features Complete
status 0x00 handle 64
Features: 0x01 0x00 0x00 0x00 0x00 0x00 0x00 0x00
2017-03-22 21:32:54.475813 < ACL data: handle 64 flags 0x00 dlen 7
ATT: MTU req (0x02)
client rx mtu 517
2017-03-22 21:32:54.584864 > ACL data: handle 64 flags 0x02 dlen 7
ATT: MTU resp (0x03)
server rx mtu 23
2017-03-22 21:32:54.585056 < ACL data: handle 64 flags 0x00 dlen 11
ATT: Read By Group req (0x10)
start 0x0001, end 0xffff
type-uuid 0x2800
2017-03-22 21:32:54.667179 > HCI Event: Number of Completed Packets (0x13) plen 5
handle 64 packets 1
2017-03-22 21:32:54.735679 > ACL data: handle 64 flags 0x02 dlen 24
ATT: Read By Group resp (0x11)
attr handle 0x0001, end group handle 0x0007
value 0x00 0x18
attr handle 0x0008, end group handle 0x000b
value 0x01 0x18
attr handle 0x000c, end group handle 0x000f
value 0x0f 0x18
2017-03-22 21:32:54.735779 < ACL data: handle 64 flags 0x00 dlen 11
ATT: Read By Group req (0x10)
start 0x0010, end 0xffff
type-uuid 0x2800
2017-03-22 21:32:54.809920 > HCI Event: Number of Completed Packets (0x13) plen 5
handle 64 packets 2
2017-03-22 21:32:54.854957 > ACL data: handle 64 flags 0x02 dlen 12
ATT: Read By Group resp (0x11)
attr handle 0x0010, end group handle 0x001a
value 0x0a 0x18
2017-03-22 21:32:54.855097 < ACL data: handle 64 flags 0x00 dlen 11
ATT: Read By Group req (0x10)
start 0x001b, end 0xffff
type-uuid 0x2800
2017-03-22 21:32:54.915710 > ACL data: handle 64 flags 0x02 dlen 26
ATT: Read By Group resp (0x11)
attr handle 0x001b, end group handle 0xffff
value 0x5a 0xe7 0xba 0xfb 0x4c 0x46 0xdd 0xd9 0x95 0x91 0xcb 0x85 0x00 0x90 0x6a 0x32
2017-03-22 21:32:54.916190 < ACL data: handle 64 flags 0x00 dlen 11
ATT: Read By Group req (0x10)
start 0x0001, end 0xffff
type-uuid 0x2801
2017-03-22 21:32:55.019959 > HCI Event: Number of Completed Packets (0x13) plen 5
handle 64 packets 2
2017-03-22 21:32:55.034904 > ACL data: handle 64 flags 0x02 dlen 9
ATT: Error (0x01)
Error: Attribute not found (10)
Read By Group req (0x10) on handle 0x0001
2017-03-22 21:32:55.035037 < ACL data: handle 64 flags 0x00 dlen 11
ATT: Read By Type req (0x08)
start 0x0001, end 0x0007
type-uuid 0x2802
2017-03-22 21:32:55.064903 > ACL data: handle 64 flags 0x02 dlen 9
ATT: Error (0x01)
Error: Attribute not found (10)
Read By Type req (0x08) on handle 0x0001
2017-03-22 21:32:55.064990 < ACL data: handle 64 flags 0x00 dlen 11
ATT: Read By Type req (0x08)
start 0x0008, end 0x000b
type-uuid 0x2802
2017-03-22 21:32:55.139978 > HCI Event: Number of Completed Packets (0x13) plen 5
handle 64 packets 2
2017-03-22 21:32:55.214906 > ACL data: handle 64 flags 0x02 dlen 9
ATT: Error (0x01)
Error: Attribute not found (10)
Read By Type req (0x08) on handle 0x0008
2017-03-22 21:32:55.214998 < ACL data: handle 64 flags 0x00 dlen 11
ATT: Read By Type req (0x08)
start 0x000c, end 0x000f
type-uuid 0x2802
2017-03-22 21:32:55.379908 > ACL data: handle 64 flags 0x02 dlen 9
ATT: Error (0x01)
Error: Attribute not found (10)
Read By Type req (0x08) on handle 0x000c
2017-03-22 21:32:55.380002 < ACL data: handle 64 flags 0x00 dlen 11
ATT: Read By Type req (0x08)
start 0x0010, end 0x001a
type-uuid 0x2802
2017-03-22 21:32:55.394958 > HCI Event: Number of Completed Packets (0x13) plen 5
handle 64 packets 2
2017-03-22 21:32:55.454927 > ACL data: handle 64 flags 0x02 dlen 9
ATT: Error (0x01)
Error: Attribute not found (10)
Read By Type req (0x08) on handle 0x0010
2017-03-22 21:32:55.455015 < ACL data: handle 64 flags 0x00 dlen 11
ATT: Read By Type req (0x08)
start 0x001b, end 0xffff
type-uuid 0x2802
2017-03-22 21:32:55.530522 > ACL data: handle 64 flags 0x02 dlen 9
ATT: Error (0x01)
Error: Attribute not found (10)
Read By Type req (0x08) on handle 0x001b
2017-03-22 21:32:55.530611 < ACL data: handle 64 flags 0x00 dlen 11
ATT: Read By Type req (0x08)
start 0x0001, end 0x0007
type-uuid 0x2803
2017-03-22 21:32:55.604922 > HCI Event: Number of Completed Packets (0x13) plen 5
handle 64 packets 2
2017-03-22 21:32:55.605787 > ACL data: handle 64 flags 0x02 dlen 27
ATT: Read By Type resp (0x09)
length: 7
handle 0x0002, value 0x0a 0x03 0x00 0x00 0x2a
handle 0x0004, value 0x02 0x05 0x00 0x01 0x2a
handle 0x0006, value 0x02 0x07 0x00 0x04 0x2a
2017-03-22 21:32:55.605872 < ACL data: handle 64 flags 0x00 dlen 11
ATT: Read By Type req (0x08)
start 0x0007, end 0x0007
type-uuid 0x2803
2017-03-22 21:32:55.709908 > ACL data: handle 64 flags 0x02 dlen 9
ATT: Error (0x01)
Error: Attribute not found (10)
Read By Type req (0x08) on handle 0x0007
2017-03-22 21:32:55.710038 < ACL data: handle 64 flags 0x00 dlen 11
ATT: Read By Type req (0x08)
start 0x0008, end 0x000b
type-uuid 0x2803
2017-03-22 21:32:55.844968 > HCI Event: Number of Completed Packets (0x13) plen 5
handle 64 packets 2
2017-03-22 21:32:55.934984 > ACL data: handle 64 flags 0x02 dlen 13
ATT: Read By Type resp (0x09)
length: 7
handle 0x0009, value 0x20 0x0a 0x00 0x05 0x2a
2017-03-22 21:32:55.935121 < ACL data: handle 64 flags 0x00 dlen 11
ATT: Read By Type req (0x08)
start 0x000a, end 0x000b
type-uuid 0x2803
2017-03-22 21:32:56.009909 > ACL data: handle 64 flags 0x02 dlen 9
ATT: Error (0x01)
Error: Attribute not found (10)
Read By Type req (0x08) on handle 0x000a
2017-03-22 21:32:56.010025 < ACL data: handle 64 flags 0x00 dlen 9
ATT: Find Information req (0x04)
start 0x000b, end 0x000b
2017-03-22 21:32:56.144909 > HCI Event: Number of Completed Packets (0x13) plen 5
handle 64 packets 2
2017-03-22 21:32:56.145537 > ACL data: handle 64 flags 0x02 dlen 10
ATT: Find Information resp (0x05)
format: uuid-16
handle 0x000b, uuid 0x2902 (GATT(desc) Client Characteristic Configuration)
2017-03-22 21:32:56.145668 < ACL data: handle 64 flags 0x00 dlen 11
ATT: Read By Type req (0x08)
start 0x000c, end 0x000f
type-uuid 0x2803
2017-03-22 21:32:56.249985 > ACL data: handle 64 flags 0x02 dlen 13
ATT: Read By Type resp (0x09)
length: 7
handle 0x000d, value 0x12 0x0e 0x00 0x19 0x2a
2017-03-22 21:32:56.250127 < ACL data: handle 64 flags 0x00 dlen 11
ATT: Read By Type req (0x08)
start 0x000e, end 0x000f
type-uuid 0x2803
2017-03-22 21:32:56.339963 > HCI Event: Number of Completed Packets (0x13) plen 5
handle 64 packets 2
2017-03-22 21:32:56.369909 > ACL data: handle 64 flags 0x02 dlen 9
ATT: Error (0x01)
Error: Attribute not found (10)
Read By Type req (0x08) on handle 0x000e
2017-03-22 21:32:56.370026 < ACL data: handle 64 flags 0x00 dlen 9
ATT: Find Information req (0x04)
start 0x000f, end 0x000f
2017-03-22 21:32:56.519929 > ACL data: handle 64 flags 0x02 dlen 10
ATT: Find Information resp (0x05)
format: uuid-16
handle 0x000f, uuid 0x2902 (GATT(desc) Client Characteristic Configuration)
2017-03-22 21:32:56.520044 < ACL data: handle 64 flags 0x00 dlen 11
ATT: Read By Type req (0x08)
start 0x0010, end 0x001a
type-uuid 0x2803
2017-03-22 21:32:56.534983 > HCI Event: Number of Completed Packets (0x13) plen 5
handle 64 packets 2
2017-03-22 21:32:56.625694 > ACL data: handle 64 flags 0x02 dlen 27
ATT: Read By Type resp (0x09)
length: 7
handle 0x0011, value 0x02 0x12 0x00 0x29 0x2a
handle 0x0013, value 0x02 0x14 0x00 0x24 0x2a
handle 0x0015, value 0x02 0x16 0x00 0x25 0x2a
2017-03-22 21:32:56.625880 < ACL data: handle 64 flags 0x00 dlen 11
ATT: Read By Type req (0x08)
start 0x0016, end 0x001a
type-uuid 0x2803
2017-03-22 21:32:56.715148 > ACL data: handle 64 flags 0x02 dlen 20
ATT: Read By Type resp (0x09)
length: 7
handle 0x0017, value 0x02 0x18 0x00 0x27 0x2a
handle 0x0019, value 0x02 0x1a 0x00 0x26 0x2a
2017-03-22 21:32:56.715314 < ACL data: handle 64 flags 0x00 dlen 11
ATT: Read By Type req (0x08)
start 0x001a, end 0x001a
type-uuid 0x2803
2017-03-22 21:32:56.774983 > HCI Event: Number of Completed Packets (0x13) plen 5
handle 64 packets 2
2017-03-22 21:32:56.864923 > ACL data: handle 64 flags 0x02 dlen 9
ATT: Error (0x01)
Error: Attribute not found (10)
Read By Type req (0x08) on handle 0x001a
2017-03-22 21:32:56.865220 < ACL data: handle 64 flags 0x00 dlen 11
ATT: Read By Type req (0x08)
start 0x001b, end 0xffff
type-uuid 0x2803
2017-03-22 21:32:56.955696 > ACL data: handle 64 flags 0x02 dlen 27
ATT: Read By Type resp (0x09)
length: 21
handle 0x001c, value 0x0e 0x1d 0x00 0x5a 0xe7 0xba 0xfb 0x4c 0x46 0xdd 0xd9 0x95 0x91 0xcb 0x85 0x01 0x90 0x6a 0x32
2017-03-22 21:32:56.955867 < ACL data: handle 64 flags 0x00 dlen 11
ATT: Read By Type req (0x08)
start 0x001d, end 0xffff
type-uuid 0x2803
2017-03-22 21:32:57.030000 > HCI Event: Number of Completed Packets (0x13) plen 5
handle 64 packets 2
2017-03-22 21:32:57.105698 > ACL data: handle 64 flags 0x02 dlen 27
ATT: Read By Type resp (0x09)
length: 21
handle 0x001e, value 0x12 0x1f 0x00 0x5a 0xe7 0xba 0xfb 0x4c 0x46 0xdd 0xd9 0x95 0x91 0xcb 0x85 0x06 0x90 0x6a 0x32
2017-03-22 21:32:57.105890 < ACL data: handle 64 flags 0x00 dlen 11
ATT: Read By Type req (0x08)
start 0x001f, end 0xffff
type-uuid 0x2803
2017-03-22 21:32:57.134924 > ACL data: handle 64 flags 0x02 dlen 9
ATT: Error (0x01)
Error: Attribute not found (10)
Read By Type req (0x08) on handle 0x001f
2017-03-22 21:32:57.135153 < ACL data: handle 64 flags 0x00 dlen 9
ATT: Find Information req (0x04)
start 0x0020, end 0xffff
2017-03-22 21:32:57.209984 > HCI Event: Number of Completed Packets (0x13) plen 5
handle 64 packets 2
2017-03-22 21:32:57.239945 > ACL data: handle 64 flags 0x02 dlen 10
ATT: Find Information resp (0x05)
format: uuid-16
handle 0x0020, uuid 0x2902 (GATT(desc) Client Characteristic Configuration)
2017-03-22 21:32:57.240113 < ACL data: handle 64 flags 0x00 dlen 9
ATT: Find Information req (0x04)
start 0x0021, end 0xffff
2017-03-22 21:32:57.359927 > ACL data: handle 64 flags 0x02 dlen 9
ATT: Error (0x01)
Error: Attribute not found (10)
Find Information req (0x04) on handle 0x0021
2017-03-22 21:32:57.375516 < ACL data: handle 64 flags 0x00 dlen 9
ATT: Write req (0x12)
handle 0x000b value 0x02 0x00
2017-03-22 21:32:57.480015 > HCI Event: Number of Completed Packets (0x13) plen 5
handle 64 packets 2
2017-03-22 21:32:57.539850 > ACL data: handle 64 flags 0x02 dlen 5
ATT: Write resp (0x13)
2017-03-22 21:32:57.540113 < ACL data: handle 64 flags 0x00 dlen 7
ATT: Read req (0x0a)
handle 0x0003
2017-03-22 21:32:57.779992 > ACL data: handle 64 flags 0x02 dlen 13
ATT: Read resp (0x0b)
4D 65 74 61 57 65 61 72
2017-03-22 21:32:57.780330 < ACL data: handle 64 flags 0x00 dlen 7
ATT: Read req (0x0a)
handle 0x0005
2017-03-22 21:32:57.917233 > HCI Event: Number of Completed Packets (0x13) plen 5
handle 64 packets 1
2017-03-22 21:32:57.930513 > ACL data: handle 64 flags 0x02 dlen 7
ATT: Read resp (0x0b)
80 01
2017-03-22 21:32:58.167532 > HCI Event: Number of Completed Packets (0x13) plen 5
handle 64 packets 1
It would be great if noble-device can be used with es6 features such as classes and promises
Noble 1.1.0 is out, but the latest release of noble-device's noble dependency is ~1.0.0
which wont allow installing [email protected]
.
ps: I'm really looking for this because as I was testing my four device (2 sensortag, 1 flower-power and 1 minew minibeacon) setup and I found [email protected]
way more stable.
Seems to be some typos in the Readme, the code snippet:
YourThing.prototype.connectAndSetup = function(callback) {
NobleDevice.prototype.connectAndSetup.call(this, function(error) {
// maybe notify on a characteristic ?
this.notifyCharacteristic(YOUR_THING_SERVICE_UUID, YOUR_THING_NOTIFY_CHAR, true, this._onRead.bind(this), function(err) {
callback(err);
});
}.bind(this);
};
Does not work properly, also connectAndSetup
/connectAndSetUp
have to spellings, is this intentional or just another typo?
Hi again!
I am trying to explore the Echo service example from a peripheral (an Intel Edison) running Bleno. On the central side I use the following noble-device code: https://github.com/embeddednodejs/ch_10_physical_internet/blob/master/bleno_peripheral/connect_noble_device.js
When running noble-device code, I see:
root@eddie2:~/ch_10_physical_internet/bleno_peripheral# node test_noble_device.js
found 984fee02dd25
connect
discoverServicesAndCharacteristics
But then nothing happens. I would expect to see the EC02 service and possibly write data from Eddie2 to the bleno device.
What could be wrong?
Hi,
full issue here ont the cool node-red-contrib-eq3-bluetooth project : alikh31/node-red-contrib-eq3-bluetooth#10 (comment)
if you input a higher cased Mac address like 00:1A:22:0D:E9:B4 , this will lead the noble-device function discoverWithFilter (in utils.js from the noble-device JS libs) to never match with 00:1a:22:0d:e9:b4 as represented by noble. I suggest you to insert a function to force the letters to be lowerecased before passing it to the different discover functions in order to let the users of the library to have the freedom of Case sensitiveness of the Input.
Hey @sandeepmistry, I've been racking my brain over this one all morning, and could really use some help. Here's the context:
I'm testing this on a Mac
Is there a way that we can clean up stale listeners on the 'discovery' event?
Perhaps we can add error parameters to the discovery callbacks. In the event that the Bluetooth adapter changes state, scanning is stopped, callbacks fired with an error, and 'discover' listeners are removed.
Very curious to hear your thoughts.
-Ray
Sometimes, there is no callback from connectAndSetup.
Then If I try to disconnect() and call connectAndSetup() again, It will hit the callback twice.
If we could have something, that either cancels a connectAndSetup callback, or much cleaner, if we could have the callback hit at all times.
Hci dump when the connectAndSetup is stuck
HCI Event: Command Complete (0x0e) plen 4
LE Set Scan Enable (0x08|0x000c) ncmd 1
status 0x0c
Error: Command Disallowed
< HCI Command: LE Create Connection (0x08|0x000d) plen 25
bdaddr 00:1E:C0:24:C7:2A type 0
interval 96 window 48 initiator_filter 0
own_bdaddr_type 0 min_interval 6 max_interval 12
latency 0 supervision_to 200 min_ce 4 max_ce 6
> HCI Event: Command Status (0x0f) plen 4
LE Create Connection (0x08|0x000d) status 0x00 ncmd 1
> HCI Event: LE Meta Event (0x3e) plen 19
LE Connection Complete
status 0x00 handle 64, role master
bdaddr 00:1E:C0:24:C7:2A (Public)
< HCI Command: LE Read Remote Used Features (0x08|0x0016) plen 2
> HCI Event: Command Status (0x0f) plen 4
LE Read Remote Used Features (0x08|0x0016) status 0x00 ncmd 1
> HCI Event: LE Meta Event (0x3e) plen 12
LE Read Remote Used Features Complete
status 0x3e handle 64
Error: Connection Failed to be Established
> HCI Event: Disconn Complete (0x05) plen 4
status 0x00 handle 64 reason 0x3e
Reason: Connection Failed to be Established
< ACL data: handle 64 flags 0x00 dlen 7
ATT: MTU req (0x02)
client rx mtu 256
> HCI Event: Number of Completed Packets (0x13) plen 5
handle 64 packets 1
Why does noble-device track its own list of services and chars instead of just looking at the list that the peripheral tracks?
I have noticed that if noble receives an event from its binding of a new service or char, this doesn't bubble up to the noble-device list.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.