PolarDeviceTelemetryApi

public protocol PolarDeviceTelemetryApi

NOTE: this is an experimental API intended for Polar internal use only. Polar will not support 3rd party users with this API. Polar Telemetry API for streaming telemetry data from devices.

Provides access to telemetry specific BLE services for streaming telemetry data from device.

Typical usage:


1. Get available telemetry types for the device using `getAvailableTelemetryTypes` API.
2. Read connection parameters from the device
let configuration = try await api.getDeviceTelemetryConfiguration(identifier)

2. Start streaming and listen for telemetry data using `startTelemetryStreaming` API.
for try await telemetry in api.startTelemetry(identifier) {
    try await sendTelemetryData(telemetry, configuration: configuration) // Not SDK API
}
  • NOTE: this is an experimental API intended for Polar internal use only. Polar will not support 3rd party users with this API. Read telemetry configuration from the device.

    Reads the telemetry configuration from device or from BLE service.

    Requires

    Requires SDK feature(s): PolarBleSdkFeature.feature_telemetry_data_streaming

    Throws

    See PolarErrors for possible errors.

    Declaration

    Swift

    func getDeviceTelemetryConfiguration(telemetryType: PolarDeviceTelemetryType, _ identifier: String) async throws -> DeviceTelemetryConfiguration?

    Parameters

    identifier

    Polar device ID or BT address.

    telemetryType

    PolarDeviceTelemetryType to stream. If the desired telemetry type is not supported by the device, the API will throw an error.

    Return Value

    DeviceTelemetryConfiguration containing items that describe the incoming data configuration. Nil if configuration is not available.

  • NOTE: this is an experimental API intended for Polar internal use only. Polar will not support 3rd party users with this API. Request a device to start streaming telemetry data. Each element emitted by the stream is one unmodified raw data sent by the device.

    The stream finishes when the device disconnects, an error occurs, or the returned stream is cancelled (which also disables the device notification).

    Requires

    Requires SDK feature(s): PolarBleSdkFeature.feature_telemetry_data_streaming

    Declaration

    Swift

    func startTelemetry(telemetryType: PolarDeviceTelemetryType, _ identifier: String) async throws -> AsyncThrowingStream<DeviceTelemetryEvent, Error>

    Parameters

    identifier

    Polar device ID or BT address.

    telemetryType

    PolarDeviceTelemetryType to stream. If the desired telemetry type is not supported by the device, the API will throw an error.

    Return Value

    AsyncThrowingStream<DeviceTelemetryEvent, Error> that emits one DeviceTelemetryEvent per received telemetry data item.

  • NOTE: this is an experimental API intended for Polar internal use only. Polar will not support 3rd party users with this API. Request a device to stop streaming telemetry data.

    Requires

    Requires SDK feature(s): PolarBleSdkFeature.feature_telemetry_data_streaming

    Throws

    See PolarErrors for possible errors.

    Declaration

    Swift

    func stopTelemetry(telemetryType: PolarDeviceTelemetryType, _ identifier: String) async throws

    Parameters

    identifier

    Polar device ID or BT address.

    telemetryType

    PolarDeviceTelemetryType the device is desired to stop streaming. If the desired PolarDeviceTelemetryType is not supported by the device, the API will throw an error.

  • NOTE: this is an experimental API intended for Polar internal use only. Polar will not support 3rd party users with this API. Returns all telemetry types supported by this SDK for the given device.

    The returned values are the DeviceTelemetrySupport representation of each currently available telemetry streaming type in device. Use this list to discover which telemetry types can be requested before starting a stream.

    Declaration

    Swift

    func getAvailableTelemetryTypes(_ identifier: String) -> DeviceTelemetrySupport

    Parameters

    identifier

    Polar device ID or BT address.

    Return Value

    DeviceTelemetrySupport containing available telemetry types for the device.