SleepData

interface SleepData

RxJava2 interface for retrieving measurements about sleep.

Smart band gather information about sleeps, rem phases and sleep anxiety and gives sleep recommendations.

Sleep consist of episodes of sleep and episodes of awake. If awake more than SleepCacheConfiguration.sleepGap, than there will be several sleeps for one day. All sleeps ended in a day counts in the day even if sleep has started in previous day.

This module have settings. See SleepCacheConfiguration.

Functions

Link copied to clipboard
abstract fun clearCache(immediately: Boolean)

Clear sleep cache. All current subscriptions will emit empty values.

Link copied to clipboard
abstract fun configureCache(newConfiguration: SleepCacheConfiguration)

Update sleep cache configuration.

Link copied to clipboard
Link copied to clipboard
abstract fun getRemEpisodes(since: Timestamp): Maybe<List<RemEpisode>>

Returns Maybe that emits list of episodes of rem sleep since specified time sorted ascending by time or completes if there are no episodes of rem sleep since specified time.

Link copied to clipboard
abstract fun getSleeps(since: Timestamp): Maybe<List<Sleep>>

Returns Maybe that emits list of sleeps since specified time sorted ascending by time or completes if there are no sleeps since specified time.

Link copied to clipboard
abstract fun observeAnxietyData(daysBack: Int): Flowable<List<AnxietyData>>

Returns Flowable that emits list of anxiety in sleep for day daysBack ago sorted ascending by time.

Link copied to clipboard
abstract fun observeLastTimestamp(): Flowable<Timestamp>

Returns Flowable that emits UNIX-timestamp of last anxiety at sleep data.

Link copied to clipboard
abstract fun observeRemEpisodes(daysBack: Int): Flowable<List<RemEpisode>>

Returns Flowable that emits list of episodes of rem sleep for day daysBack ago sorted ascending by time.

Link copied to clipboard
abstract fun observeSleepEvents(from: Timestamp, to: Timestamp, vararg events: SleepEventType): Flowable<List<SleepEvent>>

Returns Flowable that emits list of sleep events filtered by events for specified period sorted ascending by time.

Link copied to clipboard

Returns Flowable that emits container with sleep recommendations.

Link copied to clipboard
abstract fun observeSleeps(daysBack: Int): Flowable<List<Sleep>>

Returns Flowable that emits list of sleeps for days daysBack ago sorted ascending by time.

Link copied to clipboard
abstract fun observeSleepSummary(daysBack: Int): Flowable<Container<SleepSummary>>

Returns Flowable that emits container with sleep summary for day daysBack ago.