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
Requires SDK feature(s):PolarBleSdkFeature.feature_polar_offline_recording
Note, offline recording is supported in Polar Verity Sense device (starting from firmware version 2.1.0)
-
getAvailableOfflineRecordingDataTypes(_:Asynchronous) Get the data types available in this device for offline recording
Requires
Requires SDK feature(s):
PolarBleSdkFeature.feature_polar_offline_recordingThrows
PolarErrorsfor possible errors invokedDeclaration
Swift
func getAvailableOfflineRecordingDataTypes(_ identifier: String) async throws -> Set<PolarDeviceDataType>Return Value
set of available offline recording data types in this device
-
requestOfflineRecordingSettings(_:Asynchronousfeature: ) 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.
Requires
Requires SDK feature(s):
PolarBleSdkFeature.feature_polar_offline_recordingThrows
PolarErrorsfor possible errors invokedDeclaration
Swift
func requestOfflineRecordingSettings(_ identifier: String, feature: PolarDeviceDataType) async throws -> PolarSensorSettingReturn Value
PolarSensorSettingwith the available settings received from the device -
requestFullOfflineRecordingSettings(_:Asynchronousfeature: ) 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.
Requires
Requires SDK feature(s):
PolarBleSdkFeature.feature_polar_offline_recordingThrows
PolarErrorsfor possible errors invokedDeclaration
Swift
func requestFullOfflineRecordingSettings(_ identifier: String, feature: PolarDeviceDataType) async throws -> PolarSensorSettingReturn Value
PolarSensorSettingwith all available settings received from the device -
getOfflineRecordingStatus(_:Asynchronous) Get status of offline recordings.
Requires
Requires SDK feature(s):
PolarBleSdkFeature.feature_polar_offline_recordingThrows
PolarErrorsfor possible errors invokedDeclaration
Swift
func getOfflineRecordingStatus(_ identifier: String) async throws -> [PolarDeviceDataType : Bool]Parameters
identifierpolar device id
Return Value
dictionary mapping each
PolarDeviceDataTypeto aBoolindicating whether offline recording is currently active for that type -
List offline recordings stored in the device.
Requires
Requires SDK feature(s):
PolarBleSdkFeature.feature_polar_offline_recordingDeclaration
Swift
func listOfflineRecordings(_ identifier: String) -> AsyncThrowingStream<PolarOfflineRecordingEntry, Error>Parameters
identifierpolar device id
Return Value
AsyncThrowingStreamemittingPolarOfflineRecordingEntryvalues as they are found, or throwing an error -
getOfflineRecord(_:Asynchronousentry: secret: ) Fetch recjiöording from the device.
Note, the fetching of the recording may take several seconds if the recording is big. Note, if a faulty data block is encountered while parsing offline data from device that particular data block will be discarded. This will lead to gaps in the data.
Requires
Requires SDK feature(s):
PolarBleSdkFeature.feature_polar_offline_recordingThrows
PolarErrorsfor possible errors invokedDeclaration
Swift
func getOfflineRecord(_ identifier: String, entry: PolarOfflineRecordingEntry, secret: PolarRecordingSecret?) async throws -> PolarOfflineRecordingDataParameters
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
PolarOfflineRecordingDatacontaining the fetched offline recording data -
Fetch recording from the device with progress updates.
Note, the fetching of the recording may take several seconds if the recording is big. Note, if a faulty data block is encountered while parsing offline data from device that particular data block will be discarded. This will lead to gaps in the data.
Requires
Requires SDK feature(s):
PolarBleSdkFeature.feature_polar_offline_recordingDeclaration
Swift
func getOfflineRecordWithProgress(_ identifier: String, entry: PolarOfflineRecordingEntry, secret: PolarRecordingSecret?) -> AsyncThrowingStream<PolarOfflineRecordingResult, Error>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
AsyncThrowingStreamemittingPolarOfflineRecordingResultvalues containing either progress updates or the complete recording data, or throwing an error -
getSubRecordingCount(identifier:Asynchronousentry: ) Fetch number of sub recordings in recording from the device.
Requires
Requires SDK feature(s):
PolarBleSdkFeature.feature_polar_offline_recordingThrows
PolarErrorsfor possible errors invokedDeclaration
Swift
@available(*, deprecated, message: "Getting subrecordings has been deprecated. Use getOfflineRecord to get full recording instead.") func getSubRecordingCount(identifier: String, entry: PolarOfflineRecordingEntry) async throws -> IntParameters
identifierpolar device id
entrythe offline recording whose subrecording count will be checked
Return Value
the number of sub recordings in the offline recording
-
List split offline recordings stored in the device.
Requires
Requires SDK feature(s):
PolarBleSdkFeature.feature_polar_offline_recordingDeclaration
Swift
@available(*, deprecated, message: "Listing split offline recordings has been deprecated. Use getOfflineRecord to get full recording instead.") func listSplitOfflineRecordings(_ identifier: String) -> AsyncThrowingStream<PolarOfflineRecordingEntry, Error>Parameters
identifierpolar device id
Return Value
AsyncThrowingStreamemittingPolarOfflineRecordingEntryvalues as they are found, or throwing an error -
getSplitOfflineRecord(_:Asynchronousentry: secret: ) Fetch split recording from the device.
Note, the fetching of the recording may take several seconds if the recording is big. Note, if a faulty data block is encountered while parsing offline data from device that particular data block will be discarded. This will lead to gaps in the data.
Requires
Requires SDK feature(s):
PolarBleSdkFeature.feature_polar_offline_recordingThrows
PolarErrorsfor possible errors invokedDeclaration
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?) async throws -> PolarOfflineRecordingDataParameters
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
PolarOfflineRecordingDatacontaining the fetched offline recording data -
removeOfflineRecord(_:Asynchronousentry: ) Removes offline recording from the device. Empty parent directories are removed up to day directory.
Requires
Requires SDK feature(s):
PolarBleSdkFeature.feature_polar_offline_recordingThrows
PolarErrorsfor possible errors invokedDeclaration
Swift
func removeOfflineRecord(_ identifier: String, entry: PolarOfflineRecordingEntry) async throwsParameters
identifierpolar device id
entryentry to be removed
-
removeOfflineRecords(_:Asynchronousentry: ) Removes offline recording with all the subrecordings from the device. Empty parent directories are removed up to day directory.
Requires
Requires SDK feature(s):
PolarBleSdkFeature.feature_polar_offline_recordingThrows
PolarErrorsfor possible errors invokedDeclaration
Swift
@available(*, deprecated, message: "Use removeOfflineRecord to remove recording including subrecords instead.") func removeOfflineRecords(_ identifier: String, entry: PolarOfflineRecordingEntry) async throws -> BoolParameters
identifierpolar device id
entryentry with the path to the offline recording
Return Value
trueif the offline record and its subrecords were successfully removed -
startOfflineRecording(_:Asynchronousfeature: settings: secret: ) Start offline recording.
Requires
Requires SDK feature(s):
PolarBleSdkFeature.feature_polar_offline_recordingThrows
PolarErrorsfor possible errors invokedDeclaration
Swift
func startOfflineRecording(_ identifier: String, feature: PolarDeviceDataType, settings: PolarSensorSetting?, secret: PolarRecordingSecret?) async throwsParameters
identifierpolar device id
featurethe feature to be started
settingsoptional settings used for offline recording.
PolarDeviceDataType.hrandPolarDeviceDataType.ppido not require settingssecretif the secret is provided the offline recordings are encrypted in device
-
stopOfflineRecording(_:Asynchronousfeature: ) Request to stop offline recording.
Requires
Requires SDK feature(s):
PolarBleSdkFeature.feature_polar_offline_recordingThrows
PolarErrorsfor possible errors invokedDeclaration
Swift
func stopOfflineRecording(_ identifier: String, feature: PolarDeviceDataType) async throwsParameters
identifierpolar device id
featurethe feature to be stopped
-
setOfflineRecordingTrigger(_:Asynchronoustrigger: secret: ) 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.Requires
Requires SDK feature(s):
PolarBleSdkFeature.feature_polar_offline_recordingThrows
PolarErrorsfor possible errors invokedDeclaration
Swift
func setOfflineRecordingTrigger( _ identifier: String, trigger: PolarOfflineRecordingTrigger, secret: PolarRecordingSecret? ) async throwsParameters
identifierPolar device ID
triggertype of trigger to set
secretoptional secret; if provided, the offline recordings are encrypted in the device
-
getOfflineRecordingTriggerSetup(_:Asynchronous) Retrieves the current offline recording trigger setup in the device.
Requires
Requires SDK feature(s):
PolarBleSdkFeature.feature_polar_offline_recordingThrows
PolarErrorsfor possible errors invokedDeclaration
Swift
func getOfflineRecordingTriggerSetup(_ identifier: String) async throws -> PolarOfflineRecordingTriggerParameters
identifierpolar device id
Return Value
PolarOfflineRecordingTriggerdescribing the current trigger setup in the device