# Enum SleepStage

java.lang.Object
java.lang.Enum<SleepStage>
com.codename1.health.SleepStage

All Implemented Interfaces:
  `Comparable<SleepStage>`

public enum SleepStage extends Enum<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 Constants
  Enum Constant
  Description
  `ASLEEP_UNSPECIFIED`
  Asleep, with no stage breakdown available.
  `AWAKE`
  Awake during the sleep session.
  `AWAKE_IN_BED`
  Awake but in bed, before or after sleeping.
  `CORE`
  Apple's "core" sleep, from HealthKit `asleepCore` (iOS 16+).
  `DEEP`
  Deep sleep.
  `LIGHT`
  Light sleep, as Health Connect classifies it -- the N1 and N2 stages.
  `OUT_OF_BED`
  Out of bed during the session.
  `REM`
  REM sleep.
  `UNKNOWN`
  The source did not classify this span.

- ## Method Summary

  Modifier and Type
  Method
  Description
  `static SleepStage`
  `valueOf(String name)`
  Returns 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`

  ### Methods inherited from class Object

  `getClass, notify, notifyAll, wait, wait, wait`

- ## Enum Constant Details

  - ### UNKNOWN

    public static final SleepStage UNKNOWN
    The source did not classify this span.

  - ### AWAKE

    public static final SleepStage AWAKE
    Awake during the sleep session. HealthKit `awake`.

  - ### AWAKE_IN_BED

    public static final SleepStage AWAKE_IN_BED
    Awake but in bed, before or after sleeping. HealthKit `inBed`.

  - ### OUT_OF_BED

    public static final SleepStage OUT_OF_BED
    Out of bed during the session. Android only -- HealthKit has no equivalent and never reports it.

  - ### ASLEEP_UNSPECIFIED

    public static final SleepStage ASLEEP_UNSPECIFIED
    Asleep, with no stage breakdown available. HealthKit `asleepUnspecified`, and the only asleep value iOS reported before iOS 16.

  - ### LIGHT

    public static final SleepStage LIGHT

    Light sleep, as Health Connect classifies it -- the N1 and N2 stages.

    HealthKit does not report this. Its nearest value is `asleepCore`, which arrives as `CORE` rather than being folded in here.

  - ### CORE

    public static final SleepStage CORE

    Apple's "core" sleep, from HealthKit `asleepCore` (iOS 16+).

    Its own value rather than a synonym for `LIGHT`. This used to be mapped there with the approximation written into the javadoc, and a documented approximation is still a value the caller cannot tell from a real one: an app drawing a hypnogram, or comparing a night on iOS with a night on Android, was handed Apple's classification labelled as the clinical one.

    Apple's core is a vendor classification and is not clinically identical to N1+N2. If your reading of the two is the same, treat them the same; the API will not do it for you.

  - ### DEEP

    public static final SleepStage DEEP
    Deep sleep. HealthKit `asleepDeep`, iOS 16+.

  - ### REM

    public static final SleepStage REM
    REM sleep. HealthKit `asleepREM`, iOS 16+.

- ## Method Details

  - ### values

    public static SleepStage[] 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

    public static SleepStage valueOf(String name)
    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 name
      `NullPointerException` - if the argument is null