Skip to content

Commit

Permalink
Merge pull request #112 from NordicSemiconductor/byte-count-logs
Browse files Browse the repository at this point in the history
McuMgrBleTransport write logs now adds byte count
  • Loading branch information
dinesharjani authored Jun 30, 2023
2 parents ed628d9 + a0609b4 commit 48507f3
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions Source/Bluetooth/McuMgrBleTransport.swift
Original file line number Diff line number Diff line change
Expand Up @@ -361,7 +361,7 @@ extension McuMgrBleTransport: McuMgrTransport {
}

for chunk in dataChunks {
log(msg: "-> \(chunk.hexEncodedString(options: .prepend0x))", atLevel: .debug)
log(msg: "-> \(chunk.hexEncodedString(options: .prepend0x)) (\(chunk.count) bytes)", atLevel: .debug)
targetPeripheral.writeValue(chunk, for: smpCharacteristic, type: .withoutResponse)
}
} else {
Expand All @@ -371,7 +371,7 @@ extension McuMgrBleTransport: McuMgrTransport {
return .failure(McuMgrTransportError.insufficientMtu(mtu: mtu))
}

log(msg: "-> \(data.hexEncodedString(options: .prepend0x))", atLevel: .debug)
log(msg: "-> \(data.hexEncodedString(options: .prepend0x)) (\(data.count) bytes)", atLevel: .debug)
targetPeripheral.writeValue(data, for: smpCharacteristic, type: .withoutResponse)
}

Expand All @@ -389,7 +389,7 @@ extension McuMgrBleTransport: McuMgrTransport {
guard let returnData = writeState[sequenceNumber]?.chunk else {
return .failure(McuMgrTransportError.badHeader)
}
log(msg: "<- \(returnData.hexEncodedString(options: .prepend0x))", atLevel: .debug)
log(msg: "<- \(returnData.hexEncodedString(options: .prepend0x)) (\(returnData.count) bytes)", atLevel: .debug)
return .success(returnData)
}
}
Expand Down

0 comments on commit 48507f3

Please sign in to comment.