Unable to Write and read in plugin BLE

Suriya_KalidossSuriya_Kalidoss Member ✭✭✭
edited September 2019 in Xamarin.Forms

Unable to read the values from read characteristic. Correct me if I'm wrong in code. or provide me the code snippet for better understanding

` var services = await connectedDevice.GetServicesAsync();

    var serviceid = services[0].Id;

    var service = await connectedDevice.GetServiceAsync(serviceid);

    var characteristics = await service.GetCharacteristicsAsync();

    var characteristicread= await service.GetCharacteristicAsync(characteristics[1].Id);

    var characteristicWrite = await service.GetCharacteristicAsync(characteristics[0].Id);

    byte[] bytes = Encoding.ASCII.GetBytes("LIST_DIR,audio");

    await characteristicWrite.WriteAsync(bytes);
    characteristicread.ValueUpdated += (s, ee) =>
            var result = ee.Characteristic.Value;
            var stre = System.Text.Encoding.UTF8.GetString(result, 0, result.Length);
           //i can't able read charecterstic
        await characteristicread.StartUpdatesAsync();`

here is no value updated in the characteristics. Please guide
i got this exception after read
Objective-C exception thrown. Name: NSInternalInconsistencyException Reason: Client Characteristic Configuration descriptors must be configured using setNotifyValue:forCharacteristic:

Sign In or Register to comment.