From 4f6399f0b06a673a2aab5697aa8be6acd58f149c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E2=80=9C=E8=99=9E=E6=B8=A0=E6=88=90=E2=80=9D?= <“yuqucheng2006@qq.com”> Date: Thu, 9 Jul 2026 10:17:11 +0800 Subject: [PATCH] =?UTF-8?q?fix(ble):=20=E8=B0=83=E6=95=B4BLE=E9=80=9A?= =?UTF-8?q?=E7=9F=A5=E5=A4=84=E7=90=86=E7=9A=84=E5=8F=82=E6=95=B0=E4=BC=A0?= =?UTF-8?q?=E9=80=92=E9=80=BB=E8=BE=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 移除HandleNotification方法的command参数,直接从数据首字节获取命令号,简化调用传参 --- Assets/Scripts/Bluetooth/BLECommunicationManager.cs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/Assets/Scripts/Bluetooth/BLECommunicationManager.cs b/Assets/Scripts/Bluetooth/BLECommunicationManager.cs index c90539b..2fd276e 100644 --- a/Assets/Scripts/Bluetooth/BLECommunicationManager.cs +++ b/Assets/Scripts/Bluetooth/BLECommunicationManager.cs @@ -2420,7 +2420,7 @@ namespace Kill.Bluetooth // 优先处理设备主动通知,避免被等待响应的流程拦截 if (frame.ReadWrite == BLEConstants.RW_NOTIFY) { - HandleNotification(frame.Command, frame.Data); + HandleNotification(frame.Data); } else if (IsWaitingResponse && frame.Command == LastCommand) { @@ -2453,8 +2453,9 @@ namespace Kill.Bluetooth /// /// 通用的设备通知分发器,按命令类型路由到对应处理逻辑 /// - private void HandleNotification(byte command, byte[] data) + private void HandleNotification(byte[] data) { + byte command=data[0]; switch (command) { case BLEConstants.NOTIFY_MOSQUITO_DATA: