|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object java.rmi.server.RemoteObject java.rmi.server.RemoteServer java.rmi.server.UnicastRemoteObject org.wcb.autohome.factories.HAGateway
Project: Home Automation Interface
Filename: $Id: HAGateway.java,v 1.43 2004/06/09 18:49:36 wbogaardt Exp $
Abstract: Centralized backend for various components to send events to
Serial port output.
This is the main entry point as far as interfacing with the comm port the JPeterson libary to send appropriate byte streams to the x10 interface. This class can run either as a remote service wich is instantiated from the JHomeServer class or directly from the AutoHomeSession class.
Field Summary |
Fields inherited from class java.rmi.server.RemoteObject |
ref |
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 | |
HAGateway()
Default constructor which will automatically load properties files from the user home directory. |
|
HAGateway(java.lang.String sDirectory)
Constructor which takes a directory information and loads the properties configuration from the specified directory. |
Method Summary | |
void |
allCommandToSection(char cHouseCode,
int cmnd)
These are commands that can be sent to the entire section of a house indicated by the House code, which is a value between 'A' and 'P' The comands work for lights and apppliance modules in that section. |
com.jpeterson.x10.module.Macro |
buildMacros(IMacro im)
Takes a macro name to parse the properties file with and finds the macro and associated events to return a macro grouping. |
void |
clearMacroEvents()
Clears only the event driven macros from the CM11A. |
void |
clearTimerMacros()
Clears only the timer event driven macros from the CM11A. |
void |
closeSerialPort()
This closes the port that had been opened by the user to the CM11A or CM17A interface module |
void |
connectPortToX10Gateway(SerialPortBean bean,
int deviceType)
Based on the user's select it will set the port to the string variable that is sent. |
void |
connectSerialOnStartup(boolean bValue)
Saves the setting in jhome.prop with the key initial.on.start with a string of true or false. |
void |
deviceCommands(IX10Module x10evt,
int cmnd)
This controls the appliance modules for only On/Off events |
boolean |
disableMonitorCM11A()
this disables monitoring of the cm11a gateway by removing the address and function listeners |
void |
enableSpeechEngine(boolean bVal)
This sets the speech engine settings if the user wants to enable it or disable it on startup. |
java.util.Vector |
getAvailablePorts()
This enumerates all the available ports in the Comm api A try catch clause has been wrapped around to catch a possible missing comm API in the user's class path. |
int |
getBatteryUsage()
Retrieves the CM11A's current battery usage. |
java.util.Calendar |
getCM11ADate()
Gets the calendar date from the CM11A/CM12U interface. |
boolean |
getConnectSerialOnStartup()
Returns boolean value if the jhome.prop file connect.on.start has a string of true or false. |
EmailHeaderBean |
getEmailInformation()
Gets Email information from the property file and puts it into an object that can be used by the application. |
java.util.ResourceBundle |
getI18n()
|
int |
getInterfaceType()
Get the type of the interface this can either be a CM11A or CM17a wich returns an int value representation of either of these devices. |
java.util.Locale |
getLocal()
This gets the Locale I18n settings |
java.lang.String |
getLookAndFeel()
Gets the last saved look and feel value. |
SerialPortBean |
getSerialPort()
This returns a bean of the serial port settings saved in a properties file. |
boolean |
isAutoRecoverCM11A()
Method call to get the property value of Auto recovering of the CM11A from the HASConfig.ini file |
boolean |
isEventDaemonRunning()
|
boolean |
isPortActive()
returns a boolean based on if the selected port has been activated or shutdown by the user/application. |
boolean |
isSpeechEnabled()
This returns a boolean if the speech engine is to be enabled or disabled. |
void |
lampIntensity(IX10Module x10Evt,
int cmnd,
int iPercentage)
This controls the lights for only for dim and brighten events |
boolean |
monitorCM11A()
Used to listen to the CM11A gateway. |
protected void |
printMessage(java.lang.String messages)
Prints a message into the events log or if the speech plug in is added to the system then the speech will occure |
void |
recoverCM11A(boolean bValue)
Indicates that the user either wants the CM11A to autorecover upon detecting a power failure. |
boolean |
runEventsDaemon(java.util.Vector table)
|
void |
saveServerProperty()
|
void |
sendMacrosToInterface(java.util.Vector triggers)
This builds the macro trigger events for both the timer type triggers and for the macro module initiators. |
void |
setClock(java.util.Calendar calendar,
char houseCode,
boolean batteryTimer,
boolean clrMonitored,
boolean purgeTimer)
allows the user to set or send commands to set the CM11A clock settings This command needs the hours,minutes, seconds, month, day , day of week, house code character value, whether to reset the battery timer, clear the CM11A from monitoring the house, or purge the macro timer. |
void |
setEmailInformation(EmailHeaderBean emailBean)
This takes the EmailHeaderBean and saves it into the HASConfig.ini file for use by the application on its next start up. |
void |
setInterfaceType(int type)
Sets the interface type to either the CM11A or CM17 a device. |
void |
setLocal(java.util.Locale loc)
This method allows setting of the internationalization local to the value passed and saves this information into the HASConfig.ini file |
void |
setLookAndFeel(java.lang.String sLook)
Saves the look and feel value in the HASConfig.ini file so that the gui starts up again the last look and feel can be reloaded. |
void |
setMonitorModel(MonitorTableModel mModel)
Sets the monitoring model to the Alice Listener objects AliceListener and AliceX10AddressListener |
void |
setSerialPort(SerialPortBean bean)
|
void |
speakMessage(java.lang.String messages)
Prints a message into the events log or if the speech plug in is added to the system then the speech will occur |
void |
stopEventsDaemon()
|
void |
updateCM11AStatus()
|
Methods inherited from class java.rmi.server.UnicastRemoteObject |
clone, exportObject, exportObject, exportObject, unexportObject |
Methods inherited from class java.rmi.server.RemoteServer |
getClientHost, getLog, setLog |
Methods inherited from class java.rmi.server.RemoteObject |
equals, getRef, hashCode, toString, toStub |
Methods inherited from class java.lang.Object |
finalize, getClass, notify, notifyAll, wait, wait, wait |
Constructor Detail |
public HAGateway() throws java.rmi.RemoteException
java.rmi.RemoteException
- when running in client server modepublic HAGateway(java.lang.String sDirectory) throws java.rmi.RemoteException
sDirectory
- Directory to load HASConfig.ini from
java.rmi.RemoteException
- when running in client server modeMethod Detail |
public boolean isPortActive() throws java.rmi.RemoteException
isPortActive
in interface IHAGateway
java.rmi.RemoteException
- when running in client server modepublic java.util.Vector getAvailablePorts() throws java.rmi.RemoteException
getAvailablePorts
in interface IHAGateway
java.rmi.RemoteException
- when running in client server modepublic void connectSerialOnStartup(boolean bValue)
connectSerialOnStartup
in interface IHAGateway
bValue
- Boolean to be saved in property hash.public void enableSpeechEngine(boolean bVal)
enableSpeechEngine
in interface IHAGateway
bVal
- true enables the speech engine false is otherwise.public java.lang.String getLookAndFeel() throws java.rmi.RemoteException
getLookAndFeel
in interface IHAGateway
java.rmi.RemoteException
- when running in client server modepublic void setLookAndFeel(java.lang.String sLook) throws java.rmi.RemoteException
setLookAndFeel
in interface IHAGateway
sLook
- The class name of the look and feel.
java.rmi.RemoteException
- when running in client server modepublic boolean getConnectSerialOnStartup()
getConnectSerialOnStartup
in interface IHAGateway
public boolean isSpeechEnabled()
isSpeechEnabled
in interface IHAGateway
public EmailHeaderBean getEmailInformation()
getEmailInformation
in interface IHAGateway
public void setEmailInformation(EmailHeaderBean emailBean)
setEmailInformation
in interface IHAGateway
emailBean
- Information to be savedpublic void connectPortToX10Gateway(SerialPortBean bean, int deviceType) throws java.rmi.RemoteException, HomeException
connectPortToX10Gateway
in interface IHAGateway
bean
- SerialPortBean object which persists information that will be put in a property file.deviceType
- Either CM11A or CM17A device
java.rmi.RemoteException
- when running in client server mode
HomeException
- Catchable exception sent back to user.public void closeSerialPort() throws java.rmi.RemoteException, HomeException
closeSerialPort
in interface IHAGateway
java.rmi.RemoteException
- when running in client server mode
HomeException
- Catchable exception sent back to user.public void allCommandToSection(char cHouseCode, int cmnd) throws java.rmi.RemoteException, HomeException
allCommandToSection
in interface IHAGateway
cHouseCode
- House section between 'A' and 'P'cmnd
- Command is 0 all lights off, 1 all lights on, and 2 all units off.
java.rmi.RemoteException
- when running in client server mode
HomeException
- Catchable exception sent back to user.public void lampIntensity(IX10Module x10Evt, int cmnd, int iPercentage) throws java.rmi.RemoteException, HomeException
lampIntensity
in interface IHAGateway
x10Evt
- x10 modulecmnd
- Either 0 for dim 1 for brighteniPercentage
- percentation to change between 1 and 100.
java.rmi.RemoteException
- when running in client server mode
HomeException
- Catchable exception sent back to user.public void deviceCommands(IX10Module x10evt, int cmnd) throws java.rmi.RemoteException, HomeException
deviceCommands
in interface IHAGateway
x10evt
- The X10Module to send the command tocmnd
- 0 is the off command, 1 is the on command
java.rmi.RemoteException
- when running in client server mode
HomeException
- Catchable exception sent back to user.public void setClock(java.util.Calendar calendar, char houseCode, boolean batteryTimer, boolean clrMonitored, boolean purgeTimer) throws java.rmi.RemoteException, HomeException
setClock
in interface IHAGateway
calendar
- The day to set the clockhouseCode
- the house code of the event. Valid codes are 'A' through 'P', uppercase.batteryTimer
- If true, the interface's battery timer will be cleared.clrMonitored
- If true, the interface's monitored statuses will be cleared.purgeTimer
- If true, this will purge the interfaces timer
java.rmi.RemoteException
- when running in client server mode
HomeException
- Catchable exception sent back to user.public java.util.Calendar getCM11ADate()
getCM11ADate
in interface IHAGateway
public boolean monitorCM11A() throws java.rmi.RemoteException
monitorCM11A
in interface IHAGateway
java.rmi.RemoteException
- when running in client server modepublic boolean disableMonitorCM11A() throws java.rmi.RemoteException
disableMonitorCM11A
in interface IHAGateway
java.rmi.RemoteException
- when running in client server modepublic void setMonitorModel(MonitorTableModel mModel)
setMonitorModel
in interface IHAGateway
mModel
- MonitorTableModel to add to the listeners.public void recoverCM11A(boolean bValue) throws java.rmi.RemoteException
recoverCM11A
in interface IHAGateway
bValue
- true indicates recover CM11A clock
java.rmi.RemoteException
- when running in client server modepublic void updateCM11AStatus()
updateCM11AStatus
in interface IHAGateway
public boolean isAutoRecoverCM11A() throws java.rmi.RemoteException
isAutoRecoverCM11A
in interface IHAGateway
java.rmi.RemoteException
- when running in client server modepublic int getBatteryUsage() throws java.rmi.RemoteException
getBatteryUsage
in interface IHAGateway
java.rmi.RemoteException
- when running in client server modepublic void clearTimerMacros() throws java.rmi.RemoteException, HomeException
clearTimerMacros
in interface IHAGateway
java.rmi.RemoteException
- when running in client server mode
HomeException
- Catchable exception sent back to user.public void clearMacroEvents() throws java.rmi.RemoteException, HomeException
clearMacroEvents
in interface IHAGateway
java.rmi.RemoteException
- when running in client server mode
HomeException
- Catchable exception sent back to user.public void sendMacrosToInterface(java.util.Vector triggers) throws java.rmi.RemoteException, HomeException
sendMacrosToInterface
in interface IHAGateway
triggers
- are the list of IMacroTrigger objects
java.rmi.RemoteException
- when running in client server mode
HomeException
- Catchable exception sent back to user.public com.jpeterson.x10.module.Macro buildMacros(IMacro im)
im
- Macro interface.
public int getInterfaceType() throws java.rmi.RemoteException
getInterfaceType
in interface IHAGateway
java.rmi.RemoteException
- when running in client server modepublic void setInterfaceType(int type) throws java.rmi.RemoteException
setInterfaceType
in interface IHAGateway
type
- sets the interface type
java.rmi.RemoteException
- when running in client server modepublic SerialPortBean getSerialPort() throws java.rmi.RemoteException
getSerialPort
in interface IHAGateway
java.rmi.RemoteException
- when running in client server modepublic void setSerialPort(SerialPortBean bean) throws java.rmi.RemoteException
setSerialPort
in interface IHAGateway
java.rmi.RemoteException
public void saveServerProperty() throws java.rmi.RemoteException
saveServerProperty
in interface IHAGateway
java.rmi.RemoteException
public boolean runEventsDaemon(java.util.Vector table) throws java.rmi.RemoteException
runEventsDaemon
in interface IHAGateway
java.rmi.RemoteException
public void stopEventsDaemon() throws java.rmi.RemoteException
stopEventsDaemon
in interface IHAGateway
java.rmi.RemoteException
public boolean isEventDaemonRunning() throws java.rmi.RemoteException
isEventDaemonRunning
in interface IHAGateway
java.rmi.RemoteException
public java.util.Locale getLocal() throws java.rmi.RemoteException
getLocal
in interface IHAGateway
java.rmi.RemoteException
- when running in client server modepublic void setLocal(java.util.Locale loc) throws java.rmi.RemoteException
setLocal
in interface IHAGateway
loc
- Local setting to set and save to file
java.rmi.RemoteException
- when running in client server modepublic java.util.ResourceBundle getI18n() throws java.rmi.RemoteException
getI18n
in interface IHAGateway
java.rmi.RemoteException
protected void printMessage(java.lang.String messages)
messages
- message to print and speak.public void speakMessage(java.lang.String messages) throws java.rmi.RemoteException
speakMessage
in interface IHAGateway
messages
- to speek
java.rmi.RemoteException
- when running in client server mode
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |