Windows 10蓝牙Gatt客户端值更改问题
目前我对蓝牙Gatt特性读取有问题。我试图用自己的自定义配置文件运行代码Windows 10蓝牙Gatt客户端值更改问题,windows,bluetooth,bluetooth-lowenergy,win-universal-app,gatt,Windows,Bluetooth,Bluetooth Lowenergy,Win Universal App,Gatt,目前我对蓝牙Gatt特性读取有问题。我试图用自己的自定义配置文件运行代码 thermometerCharacteristic.ValueChanged += temperatureMeasurementChanged; 它导致了这个例外 mscorlib.ni.dll中发生“System.ArgumentException”类型的异常,但未在用户代码中处理 其他信息:值不在预期范围内 我的函数参数如下所示 void temperatureMeasurementChanged(GattChara
thermometerCharacteristic.ValueChanged += temperatureMeasurementChanged;
它导致了这个例外
mscorlib.ni.dll中发生“System.ArgumentException”类型的异常,但未在用户代码中处理
其他信息:值不在预期范围内
我的函数参数如下所示
void temperatureMeasurementChanged(GattCharacteristic sender, GattValueChangedEventArgs eventArgs)
此代码类似于在MSDN上检索蓝牙LE数据的示例。你知道是什么引起的吗?非常感谢
Check for thermometerCharacteristic.CharacteristicProperties == (GattCharacteristicProperties.Read | GattCharacteristicProperties.Notify)
订阅前:
if (characteristic.CharacteristicProperties == (GattCharacteristicProperties.Read | GattCharacteristicProperties.Notify))
{
characteristic.ValueChanged += Characteristic_ValueChanged;
GattCommunicationStatus status =
await characteristic.WriteClientCharacteristicConfigurationDescriptorAsync(
CHARACTERISTIC_NOTIFICATION_TYPE);
}
谢谢我试试看。