我正在尝试订阅我的 Adafruit 板的通知功能以获取一些数据。设备成功连接到我的 c# 应用程序。但是,当我尝试执行此操作时:
await characteristic.WriteClientCharacteristicConfigurationDescriptorAsync(GattClientCharacteristicConfigurationDescriptorValue.Notify);
我得到一个System.ObjectDisposedException
对象已关闭。我不知道为什么会发生这种情况......
董事会不断写信给我的应用程序,这会是一个问题吗?我只能在板子开始写之前写一个客户特征描述符吗?或者错误是由其他原因引起的?
该板与 Adafruit 手机应用程序完美配合。
var tmp = await characteristic.WriteClientCharacteristicConfigurationDescriptorAsync(GattClientCharacteristicConfigurationDescriptorValue.Notify);
if (tmp == GattCommunicationStatus.Success)
{
Console.WriteLine("Subscribed");
characteristic.ValueChanged += characteristicValueChanged;
break;
}
else
{
Console.WriteLine(device.ConnectionStatus + " : " + tmp);
}