com.jpeterson.x10.module
Class MacroInitiator

java.lang.Object
  |
  +--com.jpeterson.x10.module.MacroInitiator

public class MacroInitiator
extends java.lang.Object
implements java.io.Serializable

See Also:
Serialized Form

Field Summary
static int SIZEOF_MACRO_INITIATOR
           
 
Constructor Summary
MacroInitiator()
          Empty constructor for serialization.
MacroInitiator(int device, OffEvent function)
          Create a new MacroInitiator that is initiated by an OffEvent recieved for the specified device for the specified house code.
MacroInitiator(int device, OnEvent function)
          Create a new MacroInitiator that is initiated by an OnEvent recieved for the specified device for the specified house code.
 
Method Summary
 byte[] getBytes(int macroOffset)
          Get the byte array representing this macro initiator.
 int getDevice()
          Return the device number assigned to this MacroInitiator.
 FunctionEvent getFunction()
          Return the function assigned to this MacroInitiator.
 Macro getMacro()
          Retrieve the macro assigned to this MacroInitiator.
 void setMacro(Macro macro)
          Assign a macro to be initiated by this MacroInitiator.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

SIZEOF_MACRO_INITIATOR

public static final int SIZEOF_MACRO_INITIATOR
Constructor Detail

MacroInitiator

public MacroInitiator()
Empty constructor for serialization.

MacroInitiator

public MacroInitiator(int device,
                      OnEvent function)
               throws java.lang.IllegalArgumentException
Create a new MacroInitiator that is initiated by an OnEvent recieved for the specified device for the specified house code.
Parameters:
device - Device number. Must be between 1 and 16, inclusive.
function - An OnEvent that designates that the macro will execute. The OnEvent contains the house code that this MacroInitiator is assigned to as well. For proper use with a macro, the source of the OnEvent will be ignored.
Throws:
java.lang.IllegalArgumentException - Thrown if the device number is less than 1 or greater than 16.

MacroInitiator

public MacroInitiator(int device,
                      OffEvent function)
               throws java.lang.IllegalArgumentException
Create a new MacroInitiator that is initiated by an OffEvent recieved for the specified device for the specified house code.
Parameters:
device - Device number. Must be between 1 and 16, inclusive.
function - An OffEvent that designates that the macro will execute. The OffEvent contains the house code that this MacroInitiator is assigned to as well. For proper use with a macro, the source of the OffEvent will be ignored.
Throws:
java.lang.IllegalArgumentException - Thrown if the device number is less than 1 or greater than 16.
Method Detail

getDevice

public int getDevice()
Return the device number assigned to this MacroInitiator.
Returns:
The assigned device number.

getFunction

public FunctionEvent getFunction()
Return the function assigned to this MacroInitiator. Will be an OnEvent or an OffEvent.
Returns:
Assigned function.

setMacro

public void setMacro(Macro macro)
Assign a macro to be initiated by this MacroInitiator.
Parameters:
macro - Macro to be initiated by this MacroInitiator.

getMacro

public Macro getMacro()
Retrieve the macro assigned to this MacroInitiator.
Returns:
Macro to be initiated by this MacroInitiator.

getBytes

public byte[] getBytes(int macroOffset)
Get the byte array representing this macro initiator.
Parameters:
macroOffset - Integer offset to macro to initiate.
Returns:
Byte array containing the macro initiator.