数据特征已更改只能在一台设备上工作,而不能在另一台设备上工作

时间:2019-03-11 21:00:10

标签: xamarin.forms bluetoothlescanner

我有一个小程序可以在Xamarin Forms应用程序上发送BluetoothLE数据。

蓝牙设备是霍尼韦尔Dex适配器。 手持设备是运行7.1.1的Honeywell CT60 我使用的端口嗅探器是Device Monitoring Studio

我写一个特征并通过DataCharacteristicChange事件接收数据。

这就是我获得写特征的方式

WriteCharacteristic = gatt.GetService(DEX_SERVICE_SPP)
                        .GetCharacteristic(DEX_CHARACTERISTIC_DATAWRITE);

然后我这样做

gatt.SetCharacteristicNotification(WriteCharacteristic, true)

最后是这个

BluetoothGattDescriptor descWrite = WriteCharacteristic.GetDescriptor(CLIENT_CHARACTERISTIC_CONFIG);

descWrite.SetValue(BluetoothGattDescriptor.EnableIndicationValue.ToArray());                 gatt.WriteDescriptor(descWrite);

这是在设备#1而非设备#2上触发的事件

public override void OnCharacteristicChanged(BluetoothGatt gatt, BluetoothGattCharacteristic characteristic)

在设备#1上,它可以工作,我发送0x05并取回0x10 0x30。 0x10 0x30在DataCharacteristicChanged事件中处理。我在端口嗅探器中也看到了它。

在与#1相同(相同的OS 7.1.1,升级等)的设备#2上,相同的操作将发送0x05,但是我将0x10 0x30发送到端口嗅探器,但是从没有到达设备2中的DataCharacteristicEvent。

我的问题有两个方面。有谁知道什么可能导致此行为。我可以使用哪些工具来检测2个相同设备之间的配置差异。

谢谢

0 个答案:

没有答案