PolarTrainingSessionApi

public protocol PolarTrainingSessionApi

Protocol defining methods to access training session data.

  • Get training session references for a given period.

    Declaration

    Swift

    func getTrainingSessionReferences(
        identifier: String,
        fromDate: Date?,
        toDate: Date?
    ) -> Observable<PolarTrainingSessionReference>

    Parameters

    identifier

    The Polar device ID or BT address.

    fromDate

    The starting date of the period to retrieve training session references from. Optional.

    toDate

    The ending date of the period to retrieve training session references from. Optional.

    Return Value

    An Observable emitting PolarTrainingSessionReference objects for the specified period.

  • Get a specific training session using a reference.

    Declaration

    Swift

    func getTrainingSession(
        identifier: String,
        trainingSessionReference: PolarTrainingSessionReference
    ) -> Single<PolarTrainingSession>

    Parameters

    identifier

    The Polar device ID or BT address.

    trainingSessionReference

    The reference to the training session to retrieve.

    Return Value

    A Single emitting a PolarTrainingSession containing the session data.

  • Start an exercise session on the device.

    Declaration

    Swift

    func startExercise(identifier: String, profile: PolarExerciseSession.SportProfile) -> Completable

    Parameters

    identifier

    The Polar device ID or BT address.

    profile

    The sport profile to use for the exercise session.

    Return Value

    A Completable that completes when the command has been delivered to the device.

  • Pause an ongoing exercise session.

    Declaration

    Swift

    func pauseExercise(identifier: String) -> Completable

    Parameters

    identifier

    The Polar device ID or BT address.

    Return Value

    A Completable that completes when the command has been delivered to the device.

  • Resume a paused exercise session.

    Declaration

    Swift

    func resumeExercise(identifier: String) -> Completable

    Parameters

    identifier

    The Polar device ID or BT address.

    Return Value

    A Completable that completes when the command has been delivered to the device.

  • Stop the current exercise session.

    By default, the session is saved on the device.

    Declaration

    Swift

    func stopExercise(identifier: String) -> Completable

    Parameters

    identifier

    The Polar device ID or BT address.

    Return Value

    A Completable that completes when the command has been delivered to the device.

  • Get the current exercise session status from the device.

    Declaration

    Swift

    func getExerciseStatus(identifier: String) -> Single<PolarExerciseSession.ExerciseInfo>

    Parameters

    identifier

    The Polar device ID or BT address.

    Return Value

    A Single emitting the current PolarExerciseSession.ExerciseInfo for the device.