SleepClassifyEvent

public class SleepClassifyEvent extends Object
implements Parcelable

Represents a sleep classification event including the classification timestamp, the sleep confidence, and the supporting data such as device motion and ambient light level. Classification events are reported at a regular intervals, such as every 10 minutes.

Inherited Constant Summary

Field Summary

public static final Creator<SleepClassifyEvent> CREATOR

Public Method Summary

boolean
static List<SleepClassifyEvent>
extractEvents(Intent intent)
Extracts the SleepClassifyEvent from an Intent.
int
getConfidence()
Returns a sleep confidence value between 0 and 100.
int
getLight()
Returns the brightness of the space around the device, based on the device's ambient light sensor readings.
int
getMotion()
Returns the amount of device motion, based on the device's accelerometer readings.
long
getTimestampMillis()
Returns the UNIX epoch time when the event happened, expressed as the number of milliseconds since 1/1/1970 UTC.
static boolean
hasEvents(Intent intent)
Checks whether the Intent has any SleepClassifyEvent.
int
String
void
writeToParcel(Parcel out, int flags)

Inherited Method Summary

Fields

public static final Creator<SleepClassifyEvent> CREATOR

Public Methods

public boolean equals (Object o)

public static List<SleepClassifyEvent> extractEvents (Intent intent)

Extracts the SleepClassifyEvent from an Intent.

Parameters
intent the Intent to extract from
Returns
  • a list of SleepClassifyEvents if the intent has events, or an empty list if the intent doesn't contain any events.

public int getConfidence ()

Returns a sleep confidence value between 0 and 100. Higher values indicate that the user is more likely sleeping, while lower values indicate that the user is more likely awake.

public int getLight ()

Returns the brightness of the space around the device, based on the device's ambient light sensor readings. Value ranges from 1 to 6, inclusive. Higher values indicate brighter surroundings, while lower values indicate darker surroundings.

public int getMotion ()

Returns the amount of device motion, based on the device's accelerometer readings. Value ranges from 1 to 6, inclusive. Higher values indicate more movement of the device.

public long getTimestampMillis ()

Returns the UNIX epoch time when the event happened, expressed as the number of milliseconds since 1/1/1970 UTC.

public static boolean hasEvents (Intent intent)

Checks whether the Intent has any detected sleep classify events.

Parameters
intent the Intent to extract from
Returns
  • true if the Intent has events

public int hashCode ()

public String toString ()

public void writeToParcel (Parcel out, int flags)