TestSessionManager

public class TestSessionManager

The TestSessionManager class is responsible for keeping track of a test session’s state and provides an inteface to the necessary Wing API endpoints to perform a lung function test.

  • The Wing client used to interface with the Wing REST API.

    Declaration

    Swift

    public fileprivate(set) var client: Client!
  • The state of the test session.

    Declaration

    Swift

    public fileprivate(set) var state: TestSessionState = .noTest
  • The active test session.

    Declaration

    Swift

    public fileprivate(set) var testSession: TestSession
  • The number of tests that are allowed to fail processing before the test session is considered invalid.

    Declaration

    Swift

    public let failedTestsThreshold = 2
  • The number of tests that are allowed to fail due to local failure reasons before the test session is considered invalid.s

    Declaration

    Swift

    public let localTestFailureThreshold = 2
  • The interval at which the server will be pinged to check if processing is complete.

    Declaration

    Swift

    public let processingPollingInterval: Double = 0.8
  • The threshold that represents the number of times the app should attempt to refresh the test session.

    Declaration

    Swift

    public let processingTimeoutThreshold = 10
  • The number of attempts the test session has been refreshed in effort to determine the processing state.

    Declaration

    Swift

    public fileprivate(set) var numberOfProcessingAttempts = 0
  • Uploads the recording at the specified filepath to Amazon S3 to initiate processing.

    Throws

    Throws:

    Declaration

    Swift

    public func uploadRecording(atFilepath filepath: String, completion: @escaping (_ error: Swift.Error?) -> Void)

    Parameters

    filepath

    The filepath for the lung function test recording file.

    completion

    A callback closure that gets invoked after receiving the response from the upload request.

    • error: The error that occurred while uploading the recording (Optional).