PolarSleepApi
public protocol PolarSleepApi
Protocol defining methods to get Polar Sleep Data
-
getSleepRecordingState(identifier:Asynchronous) Get sleep recording state
Requires
Requires SDK feature(s):PolarBleSdkFeature.feature_polar_sleep_dataDeclaration
Swift
func getSleepRecordingState(identifier: String) async throws -> BoolParameters
identifierThe Polar device ID or BT address
Return Value
AnyPublisher emitting a single Bool value indicating if sleep recording is ongoing
-
Declaration
Swift
func observeSleepRecordingState(identifier: String) -> AsyncThrowingStream<[Bool], Error>Return Value
Publisher stream of Bool values indicating if sleep recording is ongoing
-
stopSleepRecording(identifier:Asynchronous) Declaration
Swift
func stopSleepRecording(identifier: String) async throwsReturn Value
Publisher stream
-
getSleep(identifier:AsynchronousfromDate: toDate: ) Declaration
Swift
func getSleep(identifier: String, fromDate: Date, toDate: Date) async throws -> [PolarSleepData.PolarSleepAnalysisResult]Return Value
Publisher emitting an array of
PolarSleepDatafor the specified period. -
getSleepData(identifier:Default implementation, asynchronousfromDate: toDate: ) - Deprecated: Use
getSleep(identifier:fromDate:toDate:)instead.
Default Implementation
Declaration
Swift
@available(*, deprecated, renamed: "getSleep(identifier:fromDate:toDate:﹚") func getSleepData(identifier: String, fromDate: Date, toDate: Date) async throws -> [PolarSleepData.PolarSleepAnalysisResult] - Deprecated: Use