如何通过BLE连接ACR1555U读取ISO14443标签ID?
如何通过BLE连接ACR1555U读取ISO14443标签ID?
设备BLE服务与特征
已获取ACR1555U暴露的自定义服务:
- 服务UUID:
00003970-817c-48df-8db2-476a8134ede0
该服务包含以下特征:
#00: Custom Characteristic: (00003971-817c-48df-8db2-476a8134ede0) (Write only) #01: Response (00003972-817c-48df-8db2-476a8134ede0) (Notify Only) #02: PICC NOTIFY (00003973-817c-48df-8db2-476a8134ede0) (Notify Only)
标签检测通知正常
卡片靠近读卡器时,能收到00003973-817c-48df-8db2-476a8134ede0特征的2字节通知:
十六进制值:
50 03
卡片移开时,收到该特征的2字节通知:
十六进制值:
50 02
特征订阅功能正常。
写入指令无有效响应
无论向#00特征写入什么数据,返回的响应始终无有效内容,示例如下:
BLE: write #00 62 00 00 00 00 00 00 00 00 00 Value changed for 00003972-817c-48df-8db2-476a8134ede0 (19 bytes): utf8: U ♣S ♣ Y? hex: 55 00 00 0A 00 00 05 53 00 00 00 00 00 00 00 05 00 59 AA BLE: write #00 FF CA 00 00 00 Value changed for 00003972-817c-48df-8db2-476a8134ede0 (19 bytes): utf8: U S ♣ ? hex: 55 00 00 0A 00 00 00 53 00 00 00 00 00 00 00 05 00 5C AA
.NET MAUI实现代码
目前用.NET MAUI实现,Windows原生BLE控制台测试也得到相同结果:
ICharacteristic writeCharacteristic; private async Task ProcessBleServicesDiscovered(IDevice device, IReadOnlyList<IService> services) { foreach (var service in services) { if (service.Id.ToString().ToLower() == "00003970-817c-48df-8db2-476a8134ede0") { Console.WriteLine($"Service UUID: {service.Id}-Name:{service.Name}"); var characteristics = await service.GetCharacteristicsAsync(); foreach (var characteristic in characteristics) { Console.WriteLine($"Characteristic UUID: {characteristic.Id}-Name:{characteristic.Name} CanRead:{characteristic.CanRead} CanUpdate:{characteristic.CanUpdate} CanWrite:{characteristic.CanWrite} "); if (characteristic.CanUpdate) { Console.WriteLine($"Characteristic UUID {characteristic.Id} subscribed to update "); characteristic.ValueUpdated += async (o, args) => { try { Console.WriteLine($"Characteristic {args.Characteristic.Id}-{characteristic.Name} updated Value:{(String.Join(',', args.Characteristic.Value))} "); } catch (Exception ex) { Console.WriteLine("Something went wrong updating value...." + ex.Message); } if (args.Characteristic.Id.ToString() == "00003973-817c-48df-8db2-476a8134ede0") { _ = Task.Run(async () => { await Task.Delay(500); var result = await writeCharacteristic.WriteAsync(new byte[] { 0xFF ,0xCA ,0x00 ,0x00 ,0x00 }); }); } }; await characteristic.StartUpdatesAsync(); } if (characteristic.CanWrite) { writeCharacteristic = characteristic; } } } } }
求助解决思路
怀疑遗漏了激活流程的某个步骤,或者数据帧格式不完整,但始终无法解决。需求是识别到标签存在后,通过BLE连接获取其ID,尝试过不同数据帧但始终收到类似无效响应,求提供解决方向。
内容的提问来源于stack exchange,提问作者raul garcia
相关产品推荐
相关产品推荐

