Timeular / noble-mac

Noble MacOS bindings using the official CoreBluetooth API
MIT License
94 stars 34 forks source link

Unable to Set ArrayBuffer Value for Descriptor #27

Closed drewcovi closed 5 years ago

drewcovi commented 5 years ago

Attempting to set the following descriptors fails on the second descriptor. This approach works flawlessly on Linux, assuming something is getting lost in translation for the second descriptors arraybuffer

descriptors: [
                new Descriptor({
                    uuid: '2901',
                    value: Buffer.from('Volume', 'utf8')
                }),
                new Descriptor({
                    uuid: '2904', // https://www.bluetooth.com/specifications/gatt/viewer?attributeXmlFile=org.bluetooth.descriptor.gatt.characteristic_presentation_format.xml
                    value: new Buffer([
                        0x04, // Uint8 0-255 value is allowed (numeric keypad)
                        0x00, // no exponent (value === value)
                        0x27, 0x25, // https://www.bluetooth.com/specifications/assigned-numbers/units joules (energy)
                        0x01, // Bluetooth SIG Assigned Numbers
                        0x00, // No description
                        0x00])
                })
            ]
*** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'Expecting NSData value type for Format descriptor'
geovie commented 5 years ago

Could you provide a small code snippet which reproduces this?

drewcovi commented 5 years ago

gah! i mixed up bleno and noble again :) sorry.