fix(ble): 调整BLE通知处理的参数传递逻辑
移除HandleNotification方法的command参数,直接从数据首字节获取命令号,简化调用传参
This commit is contained in:
parent
753cadb4a1
commit
4f6399f0b0
@ -2420,7 +2420,7 @@ namespace Kill.Bluetooth
|
|||||||
// 优先处理设备主动通知,避免被等待响应的流程拦截
|
// 优先处理设备主动通知,避免被等待响应的流程拦截
|
||||||
if (frame.ReadWrite == BLEConstants.RW_NOTIFY)
|
if (frame.ReadWrite == BLEConstants.RW_NOTIFY)
|
||||||
{
|
{
|
||||||
HandleNotification(frame.Command, frame.Data);
|
HandleNotification(frame.Data);
|
||||||
}
|
}
|
||||||
else if (IsWaitingResponse && frame.Command == LastCommand)
|
else if (IsWaitingResponse && frame.Command == LastCommand)
|
||||||
{
|
{
|
||||||
@ -2453,8 +2453,9 @@ namespace Kill.Bluetooth
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// 通用的设备通知分发器,按命令类型路由到对应处理逻辑
|
/// 通用的设备通知分发器,按命令类型路由到对应处理逻辑
|
||||||
/// </summary>
|
/// </summary>
|
||||||
private void HandleNotification(byte command, byte[] data)
|
private void HandleNotification(byte[] data)
|
||||||
{
|
{
|
||||||
|
byte command=data[0];
|
||||||
switch (command)
|
switch (command)
|
||||||
{
|
{
|
||||||
case BLEConstants.NOTIFY_MOSQUITO_DATA:
|
case BLEConstants.NOTIFY_MOSQUITO_DATA:
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user