Commit 79da48c3176e71c90d71da1504e43ab8eb743a3f

Authored by jason
1 parent 35756df0

fix:parse content length error

HDFwear/Tools/BluetoothManager+Function.swift
... ... @@ -868,7 +868,7 @@ extension BluetoothManager {
868 868 }
869 869  
870 870 private func parseContentFromBytes(_ bytes: [UInt8]) -> [UInt8] {
871   - let contentLength = Int(bytes[9]) // 获取内容长度
  871 + let contentLength = Int(UInt16(bytes[8]) << 8 | UInt16(bytes[9])) // 获取内容长度
872 872 guard bytes.count >= 10 + contentLength else {
873 873 return [] // 如果字节数组长度不足以包含内容,返回空数组
874 874 }
... ...
HDFwear/Tools/BluetoothManager+Plate.swift 0 → 100644
  1 +//
  2 +// BluetoothManager+Plate.swift
  3 +// HDFwear
  4 +//
  5 +// Created by admin on 2024/3/5.
  6 +//
  7 +
  8 +import Foundation
... ...