orbotix.robot.base
Class SleepCommand

java.lang.Object
  extended by orbotix.robot.base.DeviceMessage
      extended by orbotix.robot.base.DeviceCommand
          extended by orbotix.robot.base.SleepCommand
All Implemented Interfaces:
android.os.Parcelable

public class SleepCommand
extends DeviceCommand

Class that encapsulates a command to put the robot to sleep. Includes the ability to have it wake up after a length of time, plus run a wake up macro.


Nested Class Summary
 
Nested classes/interfaces inherited from interface android.os.Parcelable
android.os.Parcelable.Creator
 
Field Summary
static android.os.Parcelable.Creator CREATOR
           
 
Fields inherited from interface android.os.Parcelable
CONTENTS_FILE_DESCRIPTOR, PARCELABLE_WRITE_RETURN_VALUE
 
Constructor Summary
SleepCommand(int time, int identifier)
          Constructor for creating the sleep command with an optional wake up time and macro.
 
Method Summary
 int describeContents()
           
 int getWakeUpMacroId()
          Accessor to the macro identifier that is ran on wake up.
 int getWakeUpTime()
          Accessor to the wake up time out.
static void sendCommand(Robot robot, int time, int identifier)
          Convenience method for sending a sleep command to a robot.
 void writeToParcel(android.os.Parcel dest, int flags)
           
 
Methods inherited from class orbotix.robot.base.DeviceMessage
getTimeStamp
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

CREATOR

public static final android.os.Parcelable.Creator CREATOR
Constructor Detail

SleepCommand

public SleepCommand(int time,
                    int identifier)
Constructor for creating the sleep command with an optional wake up time and macro.

Parameters:
time - The time in seconds to wake the robot up. 0 seconds indicates that the robot will never wake up.
identifier - An identifier for a system macro, 1 to 8, to run when the robot wakes up. Setting this to 0 indicates that no macro should be run.
Method Detail

sendCommand

public static void sendCommand(Robot robot,
                               int time,
                               int identifier)
Convenience method for sending a sleep command to a robot.

Parameters:
robot - The robot that will receive the command.
time - The time in seconds to wake the robot up. 0 seconds indicates that the robot will never wake up.
identifier - An identifier for a system macro to run when the robot wakes up. Setting this to 0 indicates that no macro should be run.

getWakeUpTime

public int getWakeUpTime()
Accessor to the wake up time out.

Returns:
The time out in seconds.

getWakeUpMacroId

public int getWakeUpMacroId()
Accessor to the macro identifier that is ran on wake up.

Returns:
The identifier for the wake up macro.

describeContents

public int describeContents()

writeToParcel

public void writeToParcel(android.os.Parcel dest,
                          int flags)
Specified by:
writeToParcel in interface android.os.Parcelable
Overrides:
writeToParcel in class DeviceMessage