PolarOfflineExerciseV2Api
public protocol PolarOfflineExerciseV2Api
Offline Exercise V2 API.
Allows managing offline exercise sessions on supported Polar devices. This API supports devices that use the Data Merge protocol for offline exercise recording, enabling recording of exercise data even when the device is not connected.
All methods require the SDK feature
PolarBleSdkFeature.FEATURE_POLAR_OFFLINE_EXERCISE_V2
and the device must have the dm_exercise capability.
All operations are asynchronous and use Swift async/await or AsyncThrowingStream.
-
startOfflineExerciseV2(identifier:AsynchronoussportProfile: ) Start an offline exercise session on the device.
Throws
SeePolarErrorsfor possible errors.Declaration
Swift
func startOfflineExerciseV2(identifier: String, sportProfile: PolarExerciseSession.SportProfile) async throws -> OfflineExerciseStartResultParameters
identifierPolar device ID or BT address.
sportProfileThe sport profile to use for the session.
Return Value
OfflineExerciseStartResultcontaining the outcome and created directory path. -
stopOfflineExerciseV2(identifier:Asynchronous) Stop the ongoing offline exercise session on the device.
Throws
SeePolarErrorsfor possible errors.Declaration
Swift
func stopOfflineExerciseV2(identifier: String) async throwsParameters
identifierPolar device ID or BT address.
-
getOfflineExerciseStatusV2(identifier:Asynchronous) Check whether an offline exercise session is currently ongoing on the device.
Throws
SeePolarErrorsfor possible errors.Declaration
Swift
func getOfflineExerciseStatusV2(identifier: String) async throws -> BoolParameters
identifierPolar device ID or BT address.
Return Value
trueif an exercise session is ongoing,falseotherwise. -
List offline exercise entries found under the given directory path on the device.
Declaration
Swift
func listOfflineExercisesV2(identifier: String, directoryPath: String) -> AsyncThrowingStream<PolarExerciseEntry, Error>Parameters
identifierPolar device ID or BT address.
directoryPathRoot directory path to search. Use
"/"to list all exercises.Return Value
AsyncThrowingStreamemittingPolarExerciseEntryfor each found exercise file. -
fetchOfflineExerciseV2(identifier:Asynchronousentry: ) Fetch the data for a specific offline exercise entry.
Throws
SeePolarErrorsfor possible errors.Declaration
Swift
func fetchOfflineExerciseV2(identifier: String, entry: PolarExerciseEntry) async throws -> PolarExerciseDataParameters
identifierPolar device ID or BT address.
entryThe
PolarExerciseEntryreferencing the exercise to fetch.Return Value
PolarExerciseDatacontaining the recorded exercise data. -
removeOfflineExerciseV2(identifier:Asynchronousentry: ) Remove a specific offline exercise entry from the device.
Throws
SeePolarErrorsfor possible errors.Declaration
Swift
func removeOfflineExerciseV2(identifier: String, entry: PolarExerciseEntry) async throwsParameters
identifierPolar device ID or BT address.
entryThe
PolarExerciseEntryreferencing the exercise to delete. -
isOfflineExerciseV2Supported(identifier:Asynchronous) Check whether the device supports the Offline Exercise V2 feature.
Throws
SeePolarErrorsfor possible errors.Declaration
Swift
func isOfflineExerciseV2Supported(identifier: String) async throws -> BoolParameters
identifierPolar device ID or BT address.
Return Value
trueif the device supports Offline Exercise V2,falseotherwise. -
exerciseSamplesFileDefault implementationThe filename used for exercise sample data files on the device.
Default Implementation
Declaration
Swift
static var exerciseSamplesFile: String { get } -
startOfflineExerciseV2(identifier:Extension method, asynchronous) Undocumented
Declaration
Swift
func startOfflineExerciseV2(identifier: String) async throws -> OfflineExerciseStartResult -
listOfflineExercisesV2(identifier:Extension method) Undocumented
Declaration
Swift
func listOfflineExercisesV2(identifier: String) -> AsyncThrowingStream<PolarExerciseEntry, Error>