我有一种使用Bluetooth Gatt读取特定特征的方法。
public void ReadNotificationCommand(BluetoothGatt gatt)
{
try
{
var a = UUID.FromString("503C2500-802E-11E8-AF7D-0800200C9A66");
var b = UUID.FromString("503C2503-802E-11E8-AF7D-0800200C9A66");
var x = gatt.GetService(a).GetCharacteristic(b);
gatt.ReadCharacteristic(x);
}
catch (Exception ex)
{
}
}
如何在以下覆盖方法中触发此方法ReadNotificationCommand
?
public override void OnCharacteristicRead(BluetoothGatt gatt, BluetoothGattCharacteristic characteristic, [GeneratedEnum] GattStatus status)
{
base.OnCharacteristicRead(gatt, characteristic, status);
}
方法ReadNotificationCommand
向我返回一个值。我想在我的视图中访问此值。请帮忙。