private void ReadInternal() { if (!_gatt.ReadDescriptor(_nativeDescriptor)) { throw new Exception("GATT: read characteristic FALSE"); } }
private void PlatformRead() { if (!_gatt.ReadDescriptor(_descriptor)) { RaiseReadFailed(BLEErrorCode.InternalError); } }
public override void OnServicesDiscovered(BluetoothGatt gatt, [GeneratedEnum] GattStatus status) { base.OnServicesDiscovered(gatt, status); foreach (BluetoothGattService service in gatt.Services) { string uuid = service.Uuid.ToString().ToUpper(); if (uuid != "") { foreach (BluetoothGattCharacteristic characteristic in service.Characteristics) { string c_uuid = characteristic.Uuid.ToString().ToUpper(); if (c_uuid != "") { gatt.SetCharacteristicNotification(characteristic, true); BluetoothGattDescriptor descriptor = new BluetoothGattDescriptor(UUID.FromString("00002A25-0000-1000-8000-00805F9B34FB"), GattDescriptorPermission.Read | GattDescriptorPermission.Write); characteristic.AddDescriptor(descriptor); gatt.SetCharacteristicNotification(characteristic, true); gatt.ReadDescriptor(descriptor); byte[] data = descriptor.GetValue(); descriptor.SetValue(data); gatt.WriteDescriptor(descriptor); byte[] chara = characteristic.GetValue(); if (data != null) { Log.Debug(tag, "VALOR AQUI: " + data.ToString()); Log.Debug(tag, "Chara: " + chara[0].ToString()); } Log.Debug(tag, "Chara: " + chara[0].ToString()); Log.Debug(tag, "VALOR AQUI: " + data.ToString()); //Log.Debug(tag, "VALOR AQUI: " + data.ToString()); } } } } }