|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--com.jpeterson.x10.embedded.CM11AGateway
This is the main object for the embedded X10 package. It is based on
the class com.ibm.tspaces.examples.x10.X10Monitor
, an example
program included in IBM's TSpaces distribution available from
http://alphaworks.ibm.com, as well
as the full-featured X10 framework available from
http://www.jpeterson.com.
CM11AGateway gateway = new CM11AGateway();
Thread t = new Thread(gateway);
t.start();
Field Summary | |
static byte |
CHECKSUM_OK
|
static byte |
MACRO_INITIATED
|
static byte |
POLL_ACK
|
static byte |
POLL_REQ
|
static byte |
READY_REQ
|
static byte |
TIME_REQ
|
static byte |
TIMER_DOWNLOAD
|
Fields inherited from interface com.jpeterson.x10.Transmitter |
QUEUE_EMPTY,
QUEUE_NOT_EMPTY |
Constructor Summary | |
CM11AGateway(java.lang.String portName)
Create a new CM11AGateway object. |
Method Summary | |
void |
addAddressListener(AddressListener l)
Add an X10 Address listener. |
void |
addFunctionListener(FunctionListener l)
Add an X10 Function listener. |
protected static int |
dayOfYear(int month,
int day)
Convert a date in the format of month and day to day of year format. |
protected void |
fireX10Event(X10Event evt)
Fire an X10 Transmission. |
void |
issueCommand(AddressEvent address,
FunctionEvent function)
Issue a command. |
protected static int |
normalizeDay(int month,
int day)
Make sure that the day is valid. |
protected static int |
normalizeMonth(int month)
Make sure that the month is valid. |
void |
removeAddressListener(AddressListener l)
Remove an Address listener. |
void |
removeFunctionListener(FunctionListener l)
Remove a Function listener. |
void |
run()
This thread operates as the dispatch thread, dispatching X10Events to the listeners. |
void |
serialEvent(javax.comm.SerialPortEvent event)
This method is called when a serial event occurs. |
void |
setClock()
Set the clock to the current time. |
void |
setClock(int hour,
int minute,
int second,
int month,
int day,
int dayOfWeek,
char houseCode,
boolean clearBatteryTimer,
boolean clearMonitoredStatus,
boolean purgeTimer)
Update the CM11A interface's internal clock, set the monitored house code, reset battery timer, clear monitored statuses, and purge timer. |
void |
stop()
Stop the gateway. |
void |
transmit(X10Event event)
Send an event to the CM11A device. |
Methods inherited from class java.lang.Object |
clone,
equals,
finalize,
getClass,
hashCode,
notify,
notifyAll,
toString,
wait,
wait,
wait |
Field Detail |
public static final byte POLL_REQ
public static final byte TIME_REQ
public static final byte MACRO_INITIATED
public static final byte CHECKSUM_OK
public static final byte READY_REQ
public static final byte POLL_ACK
public static final byte TIMER_DOWNLOAD
Constructor Detail |
public CM11AGateway(java.lang.String portName)
portName
- Serial port nameMethod Detail |
public void stop()
public void run()
public void serialEvent(javax.comm.SerialPortEvent event)
event
- Serial port eventpublic void issueCommand(AddressEvent address, FunctionEvent function)
AddressEvent address = new AddressEvent(this, 'A', 1);
FunctionEvent function = new OnEvent(this, 'A');
cm11a.issueCommand(address, function);
address
- Address for functionfunction
- Action to take on the device addressed in the address field.public void transmit(X10Event event) throws java.io.IOException
event
- X10Event to send.public void setClock()
public void setClock(int hour, int minute, int second, int month, int day, int dayOfWeek, char houseCode, boolean clearBatteryTimer, boolean clearMonitoredStatus, boolean purgeTimer)
hour
- Current time, hours. 0 - 23.minute
- Current time, minutes. 0 - 59.second
- Current time, seconds. 0 - 59.month
- Current month, zero based. e.g., 0 for January
(Calendar.JANUARY), 1 for February (Calendar.FEBRUARY).dayOfWeek
- A day of the week constant from the class
java.util.Calendar
. Should be one of the following:
Calendar.SUNDAY
, Calendar.MONDAY
,
Calendar.TUESDAY
, Calendar.WEDNESDAY
,
Calendar.THURSDAY
, Calendar.FRIDAY
,
or Calendar.SATURDAY
.houseCode
- the house code of the event. Valid codes are 'A'
through 'P', uppercase.clearBatteryTimer
- If true, the interface's battery timer will be
cleared.clearMonitoredStatus
- If true, the interface's monitored statuses
will be cleared.purgeTimer
- If true, this will purge the interfaces timer, but I
don't know what that means???public void addAddressListener(AddressListener l)
l
- X10 AddressListener to add.removeAddressListener
public void removeAddressListener(AddressListener l)
l
- AddressListener to remove.addAddressListener
public void addFunctionListener(FunctionListener l)
l
- X10 FunctionListener to add.removeFunctionListener
public void removeFunctionListener(FunctionListener l)
l
- FunctionListener to remove.addFunctionListener
protected void fireX10Event(X10Event evt)
evt
- The event to send to X10Transmission listeners.protected static int normalizeMonth(int month)
month
- Month, zero based. e.g., 0 for January, 1 for February.protected static int normalizeDay(int month, int day)
day
- Day to normalize.month
- Month, zero based. e.g., 0 for January, 1 for February.protected static int dayOfYear(int month, int day)
month
- Month, zero based. e.g., 0 for January, 1 for February.day
- Day of month
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |