PolarDerivedMeasurementApi
public protocol PolarDerivedMeasurementApi
Derived measurement API.
Derived measurements compute statistical summaries (e.g. min, max, std) over a configurable time window of raw sensor data and store one result per window.
-
requestDerivedMeasurementGroupIds(_:AsynchronoussourceType: ) Query which Derived Measurement Settings Group IDs are supported for the given source type.
Call this before
requestDerivedMeasurementSettingsGroupto discover which group IDs the device advertises for a source type (e.g. ACC).Throws
PolarErrorsfor possible errors invokedDeclaration
Swift
func requestDerivedMeasurementGroupIds( _ identifier: String, sourceType: PolarDeviceDataType ) async throws -> Set<Int>Parameters
identifierPolar device id found printed on the sensor/device or bt address
sourceTypethe source measurement type to query (typically
.acc)Return Value
set of Derived Measurement Settings Group IDs advertised by the device for this source type
-
requestDerivedMeasurementSettingsGroup(_:AsynchronousgroupId: ) Request the full contents of one Derived Measurement Settings Group from the device.
Use this before starting a derived recording to discover which source types, sample rates, time windows, and computation methods are supported by a group.
Typical flow:
- Call
requestDerivedMeasurementGroupIdsfor the source type to get available group IDs. - Call this function for each group ID of interest.
- Present
supportedMethodsto the user for selection. - Build
PolarDerivedMeasurementSettingsfrom the user’s choices. - Call
startDerivedOfflineRecording.
Throws
PolarErrorsfor possible errors invokedDeclaration
Swift
func requestDerivedMeasurementSettingsGroup( _ identifier: String, groupId: Int ) async throws -> PolarDerivedMeasurementSettingsGroupParameters
identifierPolar device id found printed on the sensor/device or bt address
groupIdthe Derived Measurement Settings Group ID to query
Return Value
PolarDerivedMeasurementSettingsGroupdescribing the available options for this group - Call
-
startDerivedOfflineRecording(_:Asynchronoussettings: secret: ) Start a derived offline recording on the device.
The device computes the selected derived methods over each
PolarDerivedMeasurementSettings.timeWindowMstime window of source data and stores one derived sample per window. Fetch results withgetOfflineRecord.Throws
PolarErrorsfor possible errors invokedDeclaration
Swift
func startDerivedOfflineRecording( _ identifier: String, settings: PolarDerivedMeasurementSettings, secret: PolarRecordingSecret? ) async throwsParameters
identifierPolar device id found printed on the sensor/device or bt address
settingsthe derived measurement settings including the chosen methods
secretoptional encryption secret; if provided, the recording is encrypted on device
-
stopDerivedOfflineRecording(_:Asynchronous) Stop the active derived offline recording on the device.
Throws
PolarErrorsfor possible errors invokedDeclaration
Swift
func stopDerivedOfflineRecording(_ identifier: String) async throwsParameters
identifierPolar device id found printed on the sensor/device or bt address