PolarSleepApi
public protocol PolarSleepApi
Protocol defining methods to get Polar Sleep Data
-
Get sleep recording state
Requires
Requires SDK feature(s):PolarBleSdkFeature.feature_polar_sleep_dataDeclaration
Swift
func getSleepRecordingState(identifier: String) -> Single<Bool>Parameters
identifierThe Polar device ID or BT address
Return Value
Single Bool value indicating if sleep recording is ongoing
-
Observe sleep recording state
Requires
Requires SDK feature(s):PolarBleSdkFeature.feature_polar_sleep_dataDeclaration
Swift
func observeSleepRecordingState(identifier: String) -> Observable<[Bool]>Parameters
identifierThe Polar device ID or BT address
Return Value
Observable of Bool value indicating if sleep recording is ongoing
-
Stop sleep recording
Requires
Requires SDK feature(s):PolarBleSdkFeature.feature_polar_sleep_dataDeclaration
Swift
func stopSleepRecording(identifier: String) -> CompletableParameters
identifierThe Polar device ID or BT address
Return Value
Completable stream
- success: when sleep recording has been stopped
- onError: see
PolarErrorsfor possible errors invoked
-
Get sleep analysis data for a given period.
Requires
Requires SDK feature(s):PolarBleSdkFeature.feature_polar_sleep_dataThrows
Throws Invalid argument exception if toDate is not after or equal to fromDateDeclaration
Swift
func getSleep(identifier: String, fromDate: Date, toDate: Date) -> Single<[PolarSleepData.PolarSleepAnalysisResult]>Parameters
identifierThe Polar device ID or BT address.
fromDateThe starting date of the period to retrieve sleep data from.
toDateThe ending date of the period to retrieve sleep until.
Return Value
A Single emitting an array of
PolarSleepDatarepresenting the sleep analysis data for the specified period. -
getSleepData(identifier:Default implementationfromDate: 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) -> Single<[PolarSleepData.PolarSleepAnalysisResult]> - Deprecated: Use