diff --git a/Sources/HCILEAdvertisingReport.swift b/Sources/HCILEAdvertisingReport.swift index 5f83d912b..6edf7b9bf 100644 --- a/Sources/HCILEAdvertisingReport.swift +++ b/Sources/HCILEAdvertisingReport.swift @@ -65,7 +65,7 @@ public struct HCILEAdvertisingReport: HCIEventParameter { public let address: Address // Address /// Advertising or scan response data - public let responseData: Data // Data + public let responseData: LowEnergyAdvertisingData // Data /// RSSI /// @@ -103,7 +103,11 @@ public struct HCILEAdvertisingReport: HCIEventParameter { let responseData = Data(data[9 ..< (9 + length)]) assert(responseData.count == length) - self.responseData = responseData + + guard let advertisingData = LowEnergyAdvertisingData(data: responseData) + else { return nil } + + self.responseData = advertisingData // not enough bytes guard data.count == (Report.length + length)