Skip to content

Commit 837efac

Browse files
committed
don't infer addImageData() asynchronous nature automatically
instead, make it a function parameter (with a default value of true). not all devices can handle out-of-order updates.
1 parent e545de1 commit 837efac

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

Sources/SwiftOCA/OCC/ControlClasses/Managers/FirmwareManager.swift

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -46,11 +46,12 @@ open class OcaFirmwareManager: OcaManager, @unchecked Sendable {
4646
}
4747
}
4848

49-
public func addImageData(id: OcaUint32, _ imageData: OcaBlob) async throws {
50-
let parameters = AddImageDataParameters(id: id, imageData: imageData)
51-
52-
// to improve performance, don't wait for a response for stream connections
53-
if let connectionDelegate, await connectionDelegate.isDatagram {
49+
public func addImageData(
50+
id: OcaUint32,
51+
_ imageData: OcaBlob,
52+
sync: Bool = true
53+
) async throws {
54+
if sync {
5455
try await sendCommandRrq(methodID: OcaMethodID("3.4"), parameters: parameters)
5556
} else {
5657
try await sendCommand(methodID: OcaMethodID("3.4"), parameters: parameters)

0 commit comments

Comments
 (0)