PolarTrainingSessionApi

public protocol PolarTrainingSessionApi

Protocol defining methods to access training session data.

  • Get training session references for a given period. If fromDate and/or toDate are not given this method will return all training session references in the device.

    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.

  • Get a specific training session using a reference with progress updates.

    Declaration

    Swift

    func getTrainingSessionWithProgress(
        identifier: String,
        trainingSessionReference: PolarTrainingSessionReference
    ) -> Observable<PolarTrainingSessionFetchResult>

    Parameters

    identifier

    The Polar device ID or BT address.

    trainingSessionReference

    The reference to the training session to retrieve.

    Return Value

    An Observable emitting PolarTrainingSessionFetchResult containing either progress updates or the complete session data.

  • Api for removing single training session from a Polar device. You can get a list of training sessions with getTrainingSessionReferences API.

    Declaration

    Swift

    func deleteTrainingSession(identifier: String, reference: PolarTrainingSessionReference) -> Completable

    Parameters

    identifier

    The Polar device ID or BT address.

    reference

    PolarTrainingSessionReference with path in device to the training session to be removed.

    Return Value

    Completable

    • success: When the training session has been deleted from the device
    • onError: see PolarErrors for possible errors invoked

  • 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.

  • Observe exercise session status notifications from the device.

    Declaration

    Swift

    func observeExerciseStatus(identifier: String) -> Observable<PolarExerciseSession.ExerciseInfo>

    Parameters

    identifier

    The Polar device ID or BT address.

    Return Value

    An Observable emitting PolarExerciseSession.ExerciseInfo whenever the session status changes.