Skip to content

Commit

Permalink
Merge pull request #113 from NordicSemiconductor/delayed-timeout
Browse files Browse the repository at this point in the history
Extended 'Fast Timeout' for Commands
  • Loading branch information
dinesharjani authored Jun 30, 2023
2 parents 48507f3 + 185d1f3 commit 453fa95
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 3 deletions.
2 changes: 1 addition & 1 deletion Source/Managers/BasicManager.swift
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ public class BasicManager: McuManager {
///
/// - parameter callback: The response callback with a ``McuMgrResponse``.
public func eraseAppSettings(callback: @escaping McuMgrCallback<McuMgrResponse>) {
send(op: .write, commandId: ID.Reset, payload: [:], timeout: 1, callback: callback)
send(op: .write, commandId: ID.Reset, payload: [:], timeout: McuManager.FAST_TIMEOUT, callback: callback)
}
}

Expand Down
2 changes: 1 addition & 1 deletion Source/Managers/DefaultManager.swift
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ public class DefaultManager: McuManager {
///
/// - parameter callback: The response callback.
public func params(callback: @escaping McuMgrCallback<McuMgrParametersResponse>) {
send(op: .read, commandId: ID.McuMgrParameters, payload: nil, timeout: 1, callback: callback)
send(op: .read, commandId: ID.McuMgrParameters, payload: nil, timeout: McuManager.FAST_TIMEOUT, callback: callback)
}
}

2 changes: 1 addition & 1 deletion Source/Managers/ImageManager.swift
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ public class ImageManager: McuManager {
// Hence, the longer timeout.
uploadTimeoutInSeconds = McuManager.DEFAULT_SEND_TIMEOUT_SECONDS
} else {
uploadTimeoutInSeconds = 1
uploadTimeoutInSeconds = McuManager.FAST_TIMEOUT
}
send(op: .write, commandId: ImageID.Upload, payload: payload, timeout: uploadTimeoutInSeconds,
callback: callback)
Expand Down
3 changes: 3 additions & 0 deletions Source/McuManager.swift
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,9 @@ open class McuManager {
/// allowed to elapse before a send request is considered to have failed
/// due to a timeout if no response is received.
public static let DEFAULT_SEND_TIMEOUT_SECONDS = 40
/// This is the default time to wait for a command to be sent, executed
/// and received (responded to) by the firmware on the other end.
public static let FAST_TIMEOUT = 2

//**************************************************************************
// MARK: Properties
Expand Down

0 comments on commit 453fa95

Please sign in to comment.