xamarin / Monkey.BluetoothLE

BluetoothLE abstraction for use with Xamarin projects, including Xamarin.Forms.
Apache License 2.0
349 stars 223 forks source link

Write to Characteristics (Droid) throws object reference not set to an instance exception. #17

Open Dragon160 opened 9 years ago

Dragon160 commented 9 years ago

Hi,

Iam trying to write a byte[] value to a specific characteristics using the method

characteristics.Write(command); // command = byte[2] / [0] = 0x30, [1] = 0

This ends with the following output:

12-11 13:48:38.273 I/mono-stdout(17978): OnServicesDiscovered: Success 12-11 13:48:38.333 D/Mono (17978): Assembly Ref addref Robotics.Mobile.Core[0x79339798] -> System.Threading.Tasks[0x7b57b940]: 3 12-11 13:48:42.327 D/BluetoothGatt(17978): writeCharacteristic() - uuid: 6bed05a0-1bab-11e3-82ea-0002a5d5c51b .....Write 12-11 13:48:42.327 I/mono-stdout(17978): .....Write 12-11 13:48:42.377 D/BluetoothGatt(17978): onCharacteristicWrite() - Device=D0:5F:B8:52:24:56 UUID=6aed05a0-1bab-11e4-82ea-0002a7d5c51b Status=0 [0:] Object reference not set to an instance of an object [0:] Object reference not set to an instance of an object 12-11 13:48:44.849 I/mono-stdout(17978): Object reference not set to an instance of an object

According to your code this method is not tested under Droid but the "...Write" debug output is at the end of the method. Do I miss something?

bryancostanich commented 9 years ago

@Dragon160 - do you have a repro project you can share with us?

Dragon160 commented 9 years ago

@bryancostanich unfortunately not. I switched to an 'native' implementation after several tries implementing my own Droid BLE service. I had a look on Monkeys implementation and its basically the same. I couldnt find out my this error occured. Are you able to write characteristics?