Enum SleepStage
- All Implemented Interfaces:
Comparable<SleepStage>
One stage within a SleepSample. The values mirror Health Connect's
eight stage constants; the iOS mapping is noted per value.
Not every source reports stages. Check
SleepSample.hasStageDetail() before drawing a hypnogram -- a session
recorded by a phone rather than a watch will only say "asleep".
-
Enum Constant Summary
Enum ConstantsEnum ConstantDescriptionAsleep, with no stage breakdown available.Awake during the sleep session.Awake but in bed, before or after sleeping.Deep sleep.Light sleep.Out of bed during the session.REM sleep.The source did not classify this span. -
Method Summary
Modifier and TypeMethodDescriptionstatic SleepStageReturns the enum constant of this type with the specified name.static SleepStage[]values()Returns an array containing the constants of this enum type, in the order they are declared.Methods inherited from class Enum
clone, compareTo, equals, getDeclaringClass, getEnumValues, hashCode, name, ordinal, setEnumValues, toString, valueOf
-
Enum Constant Details
-
UNKNOWN
The source did not classify this span. -
AWAKE
Awake during the sleep session. HealthKitawake. -
AWAKE_IN_BED
Awake but in bed, before or after sleeping. HealthKitinBed. -
OUT_OF_BED
Out of bed during the session. Android only -- HealthKit has no equivalent and never reports it. -
ASLEEP_UNSPECIFIED
Asleep, with no stage breakdown available. HealthKitasleepUnspecified, and the only asleep value iOS reported before iOS 16. -
LIGHT
Light sleep. Mapped from HealthKit's
asleepCore.This mapping is an approximation: Apple's "core" is that vendor's own classification and is not clinically identical to the N1+N2 light-sleep stages the Health Connect value denotes. Treat it as indicative rather than diagnostic.
-
DEEP
Deep sleep. HealthKitasleepDeep, iOS 16+. -
REM
REM sleep. HealthKitasleepREM, iOS 16+.
-
-
Method Details
-
values
Returns an array containing the constants of this enum type, in the order they are declared.- Returns:
- an array containing the constants of this enum type, in the order they are declared
-
valueOf
Returns the enum constant of this type with the specified name. The string must match exactly an identifier used to declare an enum constant in this type. (Extraneous whitespace characters are not permitted.)- Parameters:
name- the name of the enum constant to be returned.- Returns:
- the enum constant with the specified name
- Throws:
IllegalArgumentException- if this enum type has no constant with the specified nameNullPointerException- if the argument is null
-