Forum Xamarin Xamarin.Forms

How to read value in the BLE using ACR Reactive BluetoothLE plugin?

Im using ACR Reactive Bluetooth Plugin to communicate with BLE device.I can able to two characteristics

1.write/write response

2.Notify.(Considering as Read)

characteristic images-

plugin link:https://github.com/aritchie/bluetoothle

I can able to write data by write characteristic from Bluetooth device using write code. But I can't able to read the characteristic using read code. Please correct if I did anything wrong in code. Please guide. Your guidance will be greatly helpful Advance thanks.

`Write code
private async void
WriteCharacteristicAsync(IGattCharacteristic
characteristic)
{
string writetest = "LIST_DIR,audio";

        byte[] bytes = Encoding.ASCII.GetBytes(writetest);

        await characteristic.Write(bytes);
}

 // read code

  if (readcharecters.CanNotify())

    {

   readcharecters.EnableNotifications();              

readcharecters.WhenNotificationReceived().Subscribe(result => {
            var test = result.Data;
       // i don't get data here.
        });

        readcharecters.DisableNotifications().Subscribe();

    }`

I need to get a response from the device. But there is no response from the device

Answers

Sign In or Register to comment.