PolarOfflineRecordingApi
public protocol PolarOfflineRecordingApi
Offline recording API.
Offline recording makes it possible to record PolarBleApi.PolarDeviceDataType data to device memory.
With Offline recording the Polar device and phone don’t need to be connected all the time, as offline recording continues in Polar device even the BLE disconnects.
Offline records saved into the device can be encrypted. The PolarRecordingSecret is provided for
startOfflineRecording and setOfflineRecordingTrigger when encryption is wanted.
The PolarRecordingSecret with same key must be provided in getOfflineRecord to correctly
decrypt the data in the device.
Requires feature PolarBleSdkFeature.feature_polar_offline_recording
Note, offline recording is supported in Polar Verity Sense device (starting from firmware version 2.1.0)
-
Get the data types available in this device for offline recording
Declaration
Swift
func getAvailableOfflineRecordingDataTypes(_ identifier: String) -> Single<Set<PolarDeviceDataType>>Return Value
Single stream
- success: set of available offline recording data types in this device
- onError: see
PolarErrorsfor possible errors invoked
-
Request the offline recording settings available in current operation mode. This request shall be used before the offline recording is started to decide currently available settings. The available settings depend on the state of the device.
Declaration
Swift
func requestOfflineRecordingSettings(_ identifier: String, feature: PolarDeviceDataType) -> Single<PolarSensorSetting>Return Value
Single stream
- success: once after settings received from device
- onError: see
PolarErrorsfor possible errors invoked
-
Request all the settings available in the device. The request returns the all capabilities of the requested streaming feature not limited by the current operation mode.
Declaration
Swift
func requestFullOfflineRecordingSettings(_ identifier: String, feature: PolarDeviceDataType) -> Single<PolarSensorSetting>Return Value
Single stream
- success: once after settings received from device
- onError: see
PolarErrorsfor possible errors invoked
-
Get status of offline recordings.
Declaration
Swift
func getOfflineRecordingStatus(_ identifier: String) -> Single<[PolarDeviceDataType : Bool]>Parameters
identifierpolar device id
Return Value
Single stream
- success: the dictionary indicating the offline recording status, if the value in dictionary is true the offline recording is currently recording
- error: see
PolarErrorsfor possible errors invoked
-
List offline recordings stored in the device.
Declaration
Swift
func listOfflineRecordings(_ identifier: String) -> Observable<PolarOfflineRecordingEntry>Parameters
identifierpolar device id
Return Value
Completable
- next : the found offline recording entry
- completed: the listing completed
- error: see
PolarErrorsfor possible errors invoked
-
Fetch recording from the device.
Note, the fetching of the recording may take several seconds if the recording is big.
Declaration
Swift
func getOfflineRecord(_ identifier: String, entry: PolarOfflineRecordingEntry, secret: PolarRecordingSecret?) -> Single<PolarOfflineRecordingData>Parameters
identifierpolar device id
entryThe offline recording to be fetched
secretIf the secret is provided in
startOfflineRecordingorsetOfflineRecordingTriggerthen the same secret must be provided when fetching the offline recordReturn Value
Single
- success : the offline recording data
- error: fetch recording request failed. see
PolarErrorsfor possible errors invoked
-
Fetch recording from the device with progress updates.
Note, the fetching of the recording may take several seconds if the recording is big.
Declaration
Swift
func getOfflineRecordWithProgress(_ identifier: String, entry: PolarOfflineRecordingEntry, secret: PolarRecordingSecret?) -> Observable<PolarOfflineRecordingResult>Parameters
identifierpolar device id
entryThe offline recording to be fetched
secretIf the secret is provided in
startOfflineRecordingorsetOfflineRecordingTriggerthen the same secret must be provided when fetching the offline recordReturn Value
Observable
- next:
PolarOfflineRecordingResultcontaining either progress updates or the complete recording data - error: fetch recording request failed. see
PolarErrorsfor possible errors invoked
- next:
-
Fetch number sub recordings in recording from the device.
Declaration
Swift
@available(*, deprecated, message: "Getting subrecordings has been deprecated. Use getOfflineRecord to get full recording instead.") func getSubRecordingCount(identifier: String, entry: PolarOfflineRecordingEntry) -> Single<Int>Parameters
identifierpolar device id
entryThe offline recording whose subrecording count will be checked
Return Value
Single
- success : the offline recording subrecording count
- error: fetch recording request failed. see
PolarErrorsfor possible errors invoked
-
List split offline recordings stored in the device.
Declaration
Swift
@available(*, deprecated, message: "Listing split offline recordings has been deprecated. Use getOfflineRecord to get full recording instead.") func listSplitOfflineRecordings(_ identifier: String) -> Observable<PolarOfflineRecordingEntry>Parameters
identifierpolar device id
Return Value
Completable
- next : the found split offline recording entry
- completed: the listing completed
- error: see
PolarErrorsfor possible errors invoked
-
Fetch split recording from the device.
Note, the fetching of the recording may take several seconds if the recording is big.
Declaration
Swift
@available(*, deprecated, message: "Getting split offline records has been deprecated. Use getOfflineRecord to get full recording instead.") func getSplitOfflineRecord(_ identifier: String, entry: PolarOfflineRecordingEntry, secret: PolarRecordingSecret?) -> Single<PolarOfflineRecordingData>Parameters
identifierpolar device id
entryThe split offline recording to be fetched
secretIf the secret is provided in
startOfflineRecordingorsetOfflineRecordingTriggerthen the same secret must be provided when fetching the offline recordReturn Value
Single
- success : the offline recording data
- error: fetch recording request failed. see
PolarErrorsfor possible errors invoked
-
Removes offline recording from the device. Empty parent directories are removed up to day directory.
Declaration
Swift
func removeOfflineRecord(_ identifier: String, entry: PolarOfflineRecordingEntry) -> CompletableParameters
identifierpolar device id
entryentry to be removed
Return Value
Completable
- completed : offline record or record with subrecords is removed
- error: offline record removal failed, see
PolarErrorsfor possible errors invoked
-
Removes offline recording with all the subrecordings from the device. Empty parent directories are removed up to day directory.
Declaration
Swift
@available(*, deprecated, message: "Use removeOfflineRecord to remove recording including subrecords instead.") func removeOfflineRecords(_ identifier: String, entry: PolarOfflineRecordingEntry) -> Single<Bool>Parameters
identifierpolar device id
entryentry with the path to the offline recording
Return Value
Single
- success : Offline record and its subrecords is/are removed. All empty parent directories up to day directory are removed.
- error: offline record removal failed, see
PolarErrorsfor possible errors invoked
-
Start offline recording.
Declaration
Swift
func startOfflineRecording(_ identifier: String, feature: PolarDeviceDataType, settings: PolarSensorSetting?, secret: PolarRecordingSecret?) -> CompletableParameters
identifierpolar device id
featurethe feature to be started
settingsoptional settings used for offline recording.
PolarDeviceDataType.hrandPolarDeviceDataType.ppido not require settingsReturn Value
Completable
- completed : offline recording is started successfully
- error: see
PolarErrorsfor possible errors invoked
-
Request to stop offline recording.
Declaration
Swift
func stopOfflineRecording(_ identifier: String, feature: PolarDeviceDataType) -> CompletableParameters
identifierpolar device id
featurethe feature to be stopped
Return Value
Completable
- completed : offline recording is stop successfully
- error: offline recording stop failed. see
PolarErrorsfor possible errors invoked
-
Sets the offline recording triggers for a given Polar device. The offline recording can be started automatically in the device by setting the triggers. The changes to the trigger settings will take effect on the next device startup.
Automatically started offline recording can be stopped by
stopOfflineRecording(). Also if user switches off the device power, the offline recording is stopped but starts again once power is switched on and the trigger event happens.Trigger functionality can be disabled by setting
PolarOfflineRecordingTriggerMode.TRIGGER_DISABLED, the already running offline recording is not stopped by disable.Declaration
Swift
func setOfflineRecordingTrigger( _ identifier: String, trigger: PolarOfflineRecordingTrigger, secret: PolarRecordingSecret? ) -> CompletableParameters
identifierPolar device ID
triggertype of trigger to set
secretoptional secret; if provided, the offline recordings are encrypted in the device
Return Value
Completable
- completed : the offline recording trigger was set successfully
- error: the offline recording trigger was not set successfully; see PolarErrors for possible errors that may be invoked.
-
Retrieves the current offline recording trigger setup in the device.
Declaration
Swift
func getOfflineRecordingTriggerSetup(_ identifier: String) -> Single<PolarOfflineRecordingTrigger>Parameters
identifierpolar device id
Return Value
Completable
- success : the offline recording trigger setup in the device
- error: fetching recording trigger setup failed, see
PolarErrorsfor possible errors invoked