我使用corebluetooh API将数据发送到蓝牙设备。 在Android上其工作正常,但在iOS上它不工作。
我送的数据如下
public override void DiscoveredCharacteristic(CBPeripheral peripheral, CBService service, NSError error)
{
System.Console.WriteLine("Discovered characteristics of " + peripheral);
foreach (var characteristic in service.Characteristics)
{
Console.WriteLine("Write Value of characteristic " + characteristic.ToString() + " is " + characteristic.Value);
var str = characteristic.UUID.ToString();
if (str.ToLower() == "00C957FB-8F6F-4E08-9ACB-000000000004".ToLower())
{
var hh1 = NSData.FromArray(new byte[] { 0x03, 0x1d, 0x00, 0x32, 0xb1, 0xc0 });
peripheral.WriteValue(hh1, characteristic, CBCharacteristicWriteType.WithResponse);
}
if (str.ToLower() == "00C957FB-8F6F-4E08-9ACB-000000000002".ToLower())
{
var hh = NSData.FromArray(new byte[] { 3, 29, 0, 50, 177, 192 });
peripheral.WriteValue(hh, characteristic, CBCharacteristicWriteType.WithResponse);
}
}}
写入数据之后WroteCharacteristicValue
获取调用但在UpdatedCharacterteristicValue
方法的特点。 值为null
请帮忙