org.wcb.autohome.implementations
Class MacroTrigger

java.lang.Object
  extended byorg.wcb.autohome.implementations.MacroTrigger
All Implemented Interfaces:
IMacroTrigger, java.io.Serializable, X10DeviceConstants

public class MacroTrigger
extends java.lang.Object
implements IMacroTrigger, java.io.Serializable, X10DeviceConstants

Filename: $Id: MacroTrigger.java,v 1.4 2004/02/28 00:21:49 wbogaardt Exp $ Abstract: This is the triggering event that will cause a macro and its associated events to execut. A trigger can be thought of as an action sent or started by an X10Module or a time period being met. Macro triggers are capable of running only on CM11A enabled interfaces. CM17A devices do not have any capability to store information or macros. If you want to run timed events with the CM17A then you are required to have a program running constantly such as a daemon. This also means that your computer is always on. $Log: MacroTrigger.java,v $ Revision 1.4 2004/02/28 00:21:49 wbogaardt fixed formating to be compliant with sun coding convention Revision 1.3 2004/01/15 21:05:20 wbogaardt major revamp of Modules and interfaces changes overall structure of how information is stored Revision 1.2 2003/10/10 21:39:07 wbogaardt modified macro triggers to use calendar in stead of strings

Version:
1.1
Author:
wbogaardt
See Also:
Serialized Form

Field Summary
 
Fields inherited from interface org.wcb.autohome.interfaces.X10DeviceConstants
APPLIANCE_MODULE_OFF, APPLIANCE_MODULE_ON, BAUD, BAUD_RATE_ARRAY, BRIGHT_ACTION, BROWSER, CM11A_TRANSMITTER, CM17A_TRANSMITTER, CONNECT_ON_START, COUNTRY, DATA_BIT, DATA_BITS_ARRAY, DEVICE_ARRAY, DIM_ACTION, EMAIL_AUTHORIZE, EMAIL_FREQUENCY, EMAIL_FROM, EMAIL_PASSWORD, EMAIL_SMTP, EMAIL_TO, EMAIL_USERNAME, FALSE, HOUSE_CODES_ARRAY, INTERFACE_TYPE, LAMP_MODULE_OFF, LAMP_MODULE_ON, LANGUAGE, LAST_FILE, LOCALHOST, LOOK_AND_FEEL, MAC, METAL, MOTIF, OFF_ACTION, ON_ACTION, PARITY, PARITY_ARRAY, RECOVER_CM11A, RMI_HOST, SEPARATOR, SERIAL_PORT, SPEECH_ENGINE, STOP_BIT, STOP_BITS_ARRAY, TEST_TRANSMITTER, TIMER_EVENT, TRIGGER_EVENT, TRUE, USER_HOME, WINDOWS
 
Constructor Summary
MacroTrigger()
          Default Constructor for macro triggers
MacroTrigger(IMacroTrigger newO)
          This will clone and create an object from the macro trigger interface
MacroTrigger(int t, IX10Module iModule, java.lang.String desc, java.lang.String act, java.util.Calendar start, java.util.Calendar end, IMacro[] m)
          Full constructor to build a macro trigger
 
Method Summary
 java.lang.String getAction()
          The action that this trigger will execute on this is either the ON_ACTION or OFF_ACTION commands
 java.lang.String getDescription()
          Get the description of the macro trigger
 int getDeviceCode()
          the zone code of is used in instances for module activated events.
 boolean getFriday()
          Execute trigger on a Friday
 java.lang.String getFullDeviceCode()
          Returns the full X10 module identifier which is in housecode followed by zone code.
 char getHouseCode()
          the house code of is used in instances for module activated events.
 java.lang.String getInitiator()
          Get the initator type for the trigger this can be either a detected event as identified by TRIGGER_EVENT constants or a time of day to execute the trigger which is startTime/stopTime
 IMacro[] getMacros()
          This method returns an array of IMacros which are stored as the first element in the array as the start macro and the second element is the stop macro Start and stop macros are also associated mainly with timer based triggers and not trigger or action related.
 boolean getMonday()
          Execute trigger on a monday
 boolean getSaturday()
          Execute trigger on a Saturday
 java.util.Calendar getStartTime()
          Returns simple string with 24 hour formated start time of this trigger;
 java.util.Calendar getStopTime()
          Returns simple string with 24 hour formated start time of this trigger;
 boolean getSunday()
          Execute trigger on a Sunday
 boolean getThursday()
          Execute trigger on a Thursday
 int getTriggerType()
          The types of triggers that can fire off a macro.
 boolean getTuesday()
          Execute trigger on a Tuesday
 boolean getWednesday()
          Execute trigger on a Wednesday
 IX10Module getX10Module()
          The X10 Module associated witht he macro trigger.
 void print()
          Used to do debug printing
 void setAction(java.lang.String act)
          Set the action of the trigger.
 void setDescription(java.lang.String desc)
          User defined description of the Trigger macro
 void setDeviceCode(int i)
          Device or zone code of x10 device being executed.
 void setFriday(boolean f)
          For time based triggers enable execution on Friday
 void setHouseCode(char a)
          House code for action or trigger based event X10 module.
 void setInitiator(java.lang.String initiat)
          Based on trigger type this is the initiators information.
 void setMacros(IMacro[] mac)
          Allows seting of the Macro by name and not by type which should be IMacro
 void setMonday(boolean m)
          For time based triggers enable execution on Monday
 void setSaturday(boolean s)
          For time based triggers enable execution on Saturday
 void setStartTime(java.util.Calendar startTime)
          This is the the time in 24 hour format this is in hh:mm format.
 void setStopTime(java.util.Calendar stp)
          This is the the time in 24 hour format this is in hh:mm format.
 void setSunday(boolean s)
          For time based triggers enable execution on Sunday
 void setThursday(boolean t)
          For time based triggers enable execution on Thursday
 void setTriggerType(int n)
          Trigger type is either a time event or X10 module excuting some action.
 void setTuesday(boolean t)
          For time based triggers enable execution on Tuesday
 void setWednesday(boolean w)
          For time based triggers enable execution on Wednesday
 void setX10Module(IX10Module imod)
          Sets the X10 module that will execute based on the trigger.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

MacroTrigger

public MacroTrigger(int t,
                    IX10Module iModule,
                    java.lang.String desc,
                    java.lang.String act,
                    java.util.Calendar start,
                    java.util.Calendar end,
                    IMacro[] m)
Full constructor to build a macro trigger

Parameters:
t - Trigger type either event detected type or time based
iModule - X10 module to execute the trigger event on
desc - Description of the trigger
act - Type of action that the X10 module should take place
start - The start time of the trigger
end - The end time of the trigger
m - List of macros associated with this trigger

MacroTrigger

public MacroTrigger()
Default Constructor for macro triggers


MacroTrigger

public MacroTrigger(IMacroTrigger newO)
This will clone and create an object from the macro trigger interface

Parameters:
newO - The interface to clone as an object.
Method Detail

print

public void print()
Used to do debug printing


setTriggerType

public void setTriggerType(int n)
Trigger type is either a time event or X10 module excuting some action.

Specified by:
setTriggerType in interface IMacroTrigger
Parameters:
n - - See X10DeviceConstants for TRIGGER_EVENT or TIMER_EVENT

setHouseCode

public void setHouseCode(char a)
House code for action or trigger based event X10 module.

Parameters:
a - - House code of X10 device.

setDeviceCode

public void setDeviceCode(int i)
Device or zone code of x10 device being executed.

Parameters:
i - - Device/zone code.

setX10Module

public void setX10Module(IX10Module imod)
Sets the X10 module that will execute based on the trigger.

Specified by:
setX10Module in interface IMacroTrigger
Parameters:
imod - X10Module to run when trigger requirements are met.

setInitiator

public void setInitiator(java.lang.String initiat)
Based on trigger type this is the initiators information. The initiator is another x10 module that may have fired an action.

Specified by:
setInitiator in interface IMacroTrigger
Parameters:
initiat - - Initiator information this is a an X10 module code such as A1

setAction

public void setAction(java.lang.String act)
Set the action of the trigger.

Specified by:
setAction in interface IMacroTrigger
Parameters:
act - Action type for the trigger ON_ACTION OR OFF_ACTION

setDescription

public void setDescription(java.lang.String desc)
User defined description of the Trigger macro

Specified by:
setDescription in interface IMacroTrigger
Parameters:
desc - - description for user

setMacros

public void setMacros(IMacro[] mac)
Allows seting of the Macro by name and not by type which should be IMacro

Parameters:
mac - An array of IMacro objects

setStartTime

public void setStartTime(java.util.Calendar startTime)
This is the the time in 24 hour format this is in hh:mm format.

Specified by:
setStartTime in interface IMacroTrigger
Parameters:
startTime - For time based triggers the calendar time of starting

setStopTime

public void setStopTime(java.util.Calendar stp)
This is the the time in 24 hour format this is in hh:mm format.

Specified by:
setStopTime in interface IMacroTrigger
Parameters:
stp - for time based triggers the calendar time of stoping the trigger

getTriggerType

public int getTriggerType()
The types of triggers that can fire off a macro. There are two types of triggers Trigger/event based and timmer based. Event based triggers are if an X10 module is activated,either turned on or off, and its detected by the CM11A interface then the macro is executed. Timer based triggers wait for a particular time or day of week to pass which will be the excecutor.

Specified by:
getTriggerType in interface IMacroTrigger
Returns:
int - 10 = Timer event, 11 = Trigger event

getHouseCode

public char getHouseCode()
the house code of is used in instances for module activated events.

Returns:
char - House code ranges from A - P

getDeviceCode

public int getDeviceCode()
the zone code of is used in instances for module activated events.

Returns:
int - zone code ranges 1-16;

getX10Module

public IX10Module getX10Module()
The X10 Module associated witht he macro trigger.

Specified by:
getX10Module in interface IMacroTrigger
Returns:
The interface to an X10Module object

getInitiator

public java.lang.String getInitiator()
Get the initator type for the trigger this can be either a detected event as identified by TRIGGER_EVENT constants or a time of day to execute the trigger which is startTime/stopTime

Specified by:
getInitiator in interface IMacroTrigger
Returns:
The type of initiator to run

getAction

public java.lang.String getAction()
The action that this trigger will execute on this is either the ON_ACTION or OFF_ACTION commands

Specified by:
getAction in interface IMacroTrigger
Returns:
ON_ACTION or OFF_ACTION string

setSunday

public void setSunday(boolean s)
For time based triggers enable execution on Sunday

Specified by:
setSunday in interface IMacroTrigger
Parameters:
s - True enables execute trigger on specified weekday.

setMonday

public void setMonday(boolean m)
For time based triggers enable execution on Monday

Specified by:
setMonday in interface IMacroTrigger
Parameters:
m - True enables execute trigger on specified weekday.

setTuesday

public void setTuesday(boolean t)
For time based triggers enable execution on Tuesday

Specified by:
setTuesday in interface IMacroTrigger
Parameters:
t - True enables execute trigger on specified weekday.

setWednesday

public void setWednesday(boolean w)
For time based triggers enable execution on Wednesday

Specified by:
setWednesday in interface IMacroTrigger
Parameters:
w - True enables execute trigger on specified weekday.

setThursday

public void setThursday(boolean t)
For time based triggers enable execution on Thursday

Specified by:
setThursday in interface IMacroTrigger
Parameters:
t - True enables execute trigger on specified weekday.

setFriday

public void setFriday(boolean f)
For time based triggers enable execution on Friday

Specified by:
setFriday in interface IMacroTrigger
Parameters:
f - True enables execute trigger on specified weekday.

setSaturday

public void setSaturday(boolean s)
For time based triggers enable execution on Saturday

Specified by:
setSaturday in interface IMacroTrigger
Parameters:
s - True enables execute trigger on specified weekday.

getSunday

public boolean getSunday()
Execute trigger on a Sunday

Specified by:
getSunday in interface IMacroTrigger
Returns:
true indicates execute event for the day of week

getMonday

public boolean getMonday()
Execute trigger on a monday

Specified by:
getMonday in interface IMacroTrigger
Returns:
true indicates execute event for the day of week

getTuesday

public boolean getTuesday()
Execute trigger on a Tuesday

Specified by:
getTuesday in interface IMacroTrigger
Returns:
true indicates execute event for the day of week

getWednesday

public boolean getWednesday()
Execute trigger on a Wednesday

Specified by:
getWednesday in interface IMacroTrigger
Returns:
true indicates execute event for the day of week

getThursday

public boolean getThursday()
Execute trigger on a Thursday

Specified by:
getThursday in interface IMacroTrigger
Returns:
true indicates execute event for the day of week

getFriday

public boolean getFriday()
Execute trigger on a Friday

Specified by:
getFriday in interface IMacroTrigger
Returns:
true indicates execute event for the day of week

getSaturday

public boolean getSaturday()
Execute trigger on a Saturday

Specified by:
getSaturday in interface IMacroTrigger
Returns:
true indicates execute event for the day of week

getDescription

public java.lang.String getDescription()
Get the description of the macro trigger

Specified by:
getDescription in interface IMacroTrigger
Returns:
Defaults to NO DESCRIPTION if it has not been set.

getMacros

public IMacro[] getMacros()
This method returns an array of IMacros which are stored as the first element in the array as the start macro and the second element is the stop macro Start and stop macros are also associated mainly with timer based triggers and not trigger or action related.

Specified by:
getMacros in interface IMacroTrigger
Returns:
IMacro[] - array with start and stop macro elements

getStartTime

public java.util.Calendar getStartTime()
Returns simple string with 24 hour formated start time of this trigger;

Specified by:
getStartTime in interface IMacroTrigger
Returns:
String - Simple time in hh:mm format

getStopTime

public java.util.Calendar getStopTime()
Returns simple string with 24 hour formated start time of this trigger;

Specified by:
getStopTime in interface IMacroTrigger
Returns:
String - Simple time in hh:mm format

getFullDeviceCode

public java.lang.String getFullDeviceCode()
Returns the full X10 module identifier which is in housecode followed by zone code.

Returns:
String - X10 module identifier in A1 format


Copyright © 1999-2004 Walter Bogaardt. All Rights Reserved.