pdominique
Member since May 2015 • Last active Jun 2017Most recent activity
-
- 31 comments
- 14,350 views
-
-
Ok I just sniffed the communication between the nrf app and the candle and then the Puck and the candle. The opcode is definitely different and that seems to be the issue (WriteWithResponse not supported by the candle?).
nrf app Write Request:
Bluetooth Attribute Protocol (0x0004) Opcode: Write Request (0x52) Handle: 0x0016 Value: 000000ff
Puck Write Request:
Bluetooth Attribute Protocol (0x0004) Opcode: Write Request (0x12) Handle: 0x0016 Value: 00ff0000
Puck Error Response:
Bluetooth Attribute Protocol Opcode: Error Response (0x01) Request Opcode in Error: Write Request (0x12) Handle in Error: 0x0016 Error Code: Write Not Permitted (0x03)
-
-
nRF Connect says Read and WriteWithoutResponse.
I tried to simulate the device with LightBlue but the Puck can't connect to the fake device (unhandled exception in promise or something). The official app doesn't seem to work with the fake device either. nRF Connect can connect and write to the characteristic just fine though. I can see the new value being written in the LightBlue app.
-
Here you go:
Connected - finding services [ BluetoothRemoteGATTService { "uuid": "0x1800", "isPrimary": true, "start_handle": 1, "end_handle": 7 }, BluetoothRemoteGATTService { "uuid": "0x1801", "isPrimary": true, "start_handle": 8, "end_handle": 8 }, BluetoothRemoteGATTService { "uuid": "0xff02", "isPrimary": true, "start_handle": 9, "end_handle": 28 }, BluetoothRemoteGATTService { "uuid": "0x180f", "isPrimary": true, "start_handle": 29, "end_handle": 32 }, BluetoothRemoteGATTService { "uuid": "0x180a", "isPrimary": true, "start_handle": 33, "end_handle": 65535 } ] Finding characteristics Service 0x1800 => [ BluetoothRemoteGATTCharacteristic { "uuid": "0x2a00", "handle_value": 3, "handle_decl": 2 }, BluetoothRemoteGATTCharacteristic { "uuid": "0x2a01", "handle_value": 5, "handle_decl": 4 }, BluetoothRemoteGATTCharacteristic { "uuid": "0x2a04", "handle_value": 7, "handle_decl": 6 } ] Service 0x1801 => [ ] Service 0xff02 => [ BluetoothRemoteGATTCharacteristic { "uuid": "0x2a37", "handle_value": 11, "handle_decl": 10 }, BluetoothRemoteGATTCharacteristic { "uuid": "0xfff8", "handle_value": 14, "handle_decl": 13 }, BluetoothRemoteGATTCharacteristic { "uuid": "0xfff9", "handle_value": 16, "handle_decl": 15 }, BluetoothRemoteGATTCharacteristic { "uuid": "0xfffa", "handle_value": 18, "handle_decl": 17 }, BluetoothRemoteGATTCharacteristic { "uuid": "0xfffb", "handle_value": 20, "handle_decl": 19 }, BluetoothRemoteGATTCharacteristic { "uuid": "0xfffc", "handle_value": 22, "handle_decl": 21 }, BluetoothRemoteGATTCharacteristic { "uuid": "0xfffd", "handle_value": 24, "handle_decl": 23 }, BluetoothRemoteGATTCharacteristic { "uuid": "0xfffe", "handle_value": 26, "handle_decl": 25 }, BluetoothRemoteGATTCharacteristic { "uuid": "0xffff", "handle_value": 28, "handle_decl": 27 } ] Service 0x180f => [ BluetoothRemoteGATTCharacteristic { "uuid": "0x2a19", "handle_value": 31, "handle_decl": 30 } ] Service 0x180a => [ BluetoothRemoteGATTCharacteristic { "uuid": "0x2a25", "handle_value": 35, "handle_decl": 34 }, BluetoothRemoteGATTCharacteristic { "uuid": "0x2a27", "handle_value": 37, "handle_decl": 36 }, BluetoothRemoteGATTCharacteristic { "uuid": "0x2a26", "handle_value": 39, "handle_decl": 38 }, BluetoothRemoteGATTCharacteristic { "uuid": "0x2a28", "handle_value": 41, "handle_decl": 40 }, BluetoothRemoteGATTCharacteristic { "uuid": "0x2a29", "handle_value": 43, "handle_decl": 42 }, BluetoothRemoteGATTCharacteristic { "uuid": "0x2a50", "handle_value": 45, "handle_decl": 44 } ] Done! Disconnected.
-
-
-
Well actually this is what I get when I use readValue() and stringify it:
console.log("Got:", JSON.stringify(value));
> _____ _ | __|___ ___ ___ _ _|_|___ ___ | __|_ -| . | _| | | | | . | |_____|___| _|_| |___|_|_|_|___| |_| http://espruino.com 1v91 Copyright 2016 G.Williams > =undefined Got: "\x00\x00\xFF\x00" Done! >
It's working now, thanks Gordon!
Would it be a good idea to have a WriteWithResponse and a WriteWithoutResponse? Might be useful for other devices to have the option.