diff --git a/HDFwear/Tools/BluetoothManager+Function.swift b/HDFwear/Tools/BluetoothManager+Function.swift index 11b0574..e90b601 100644 --- a/HDFwear/Tools/BluetoothManager+Function.swift +++ b/HDFwear/Tools/BluetoothManager+Function.swift @@ -868,7 +868,7 @@ extension BluetoothManager { } private func parseContentFromBytes(_ bytes: [UInt8]) -> [UInt8] { - let contentLength = Int(bytes[9]) // 获取内容长度 + let contentLength = Int(UInt16(bytes[8]) << 8 | UInt16(bytes[9])) // 获取内容长度 guard bytes.count >= 10 + contentLength else { return [] // 如果字节数组长度不足以包含内容,返回空数组 } diff --git a/HDFwear/Tools/BluetoothManager+Plate.swift b/HDFwear/Tools/BluetoothManager+Plate.swift new file mode 100644 index 0000000..e282e9c --- /dev/null +++ b/HDFwear/Tools/BluetoothManager+Plate.swift @@ -0,0 +1,8 @@ +// +// BluetoothManager+Plate.swift +// HDFwear +// +// Created by admin on 2024/3/5. +// + +import Foundation