com.micheldalal.x10
Class CM17A

java.lang.Object
  extended bycom.micheldalal.x10.CM17A

public class CM17A
extends java.lang.Object

CM17A is the FireCracker Computer Interface shipped with The FireCracker Ultimate Home Control Kit. This class uses the Java Communications API (COMM) to communicate via the CM17A with the Wireless Link Module(TM) (a.k.a. Transiever Module).

This is an implementation of the FireCracker (CM17A) Communications Specification. The basics of the interface are:


        Standby | '1' | Wait | '0' | Wait | '1' | Wait...
        _____________________       _____________________
 RTS  _|                     |_____|
        ________       ___________________       ________
 DTR  _|        |_____|                   |_____|
 

The recommended time for the '1', '0' and 'Wait' states is at least 0.5ms.

Each transmission consists of 40 bits. This is made up of the following:

 	Header		16 bits
 	Data		16 bits
 	Footer		8 bits
 

The header and footer never change and are defined as follows:

 	Header		11010101 10101010
 	Footer		10101101
 

The following table defines the states of the RTS and DTR signals required to send a logical '1' and logical '0' to the interface:

 	Signal			RTS	DTR
 	Reset			0	0
 	Logical '1'		1	0
 	Logical '0'		0	1
 	Standby			1	1
 

Version:
1.0 07/05/2001: Initial Version.,
1.0.1 10/20/2003: Comment updates
Author:
Michel Dalal

Constructor Summary
CM17A()
          Creates this object and maintains a reference to the serial port.
CM17A(javax.comm.SerialPort serialPort)
          Creates this object and maintains a reference to the serial port.
 
Method Summary
 void adjustBrightness(char house, boolean mode, int percent)
          Dims/brightens the lamp modules in the specified house.
protected  void finalize()
          Finalizes this object.
 javax.comm.SerialPort getSerialPort()
          Returns the serial port used for communication.
 void setSerialPort(javax.comm.SerialPort serialPort)
          Sets the serial port used for communication.
 void setState(char house, int unit, boolean state)
          Turns off/on the specified of the selected house.
 
Methods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

CM17A

public CM17A()
Creates this object and maintains a reference to the serial port. The serial port must be set prior to use.


CM17A

public CM17A(javax.comm.SerialPort serialPort)
Creates this object and maintains a reference to the serial port.

Method Detail

setSerialPort

public void setSerialPort(javax.comm.SerialPort serialPort)
Sets the serial port used for communication. Also resets the attached CM17A device if the supplied serialPort is not null.

Parameters:
serialPort - the serial port object.

getSerialPort

public javax.comm.SerialPort getSerialPort()
Returns the serial port used for communication.


setState

public void setState(char house,
                     int unit,
                     boolean state)
              throws java.lang.IllegalArgumentException
Turns off/on the specified of the selected house.

Parameters:
house - the house to control. 'A' to 'P'.
unit - the unit to control. 1 to 16.
state - true to turn on and false to turn off.
Throws:
java.lang.IllegalArgumentException - thrown if the house or unit are within the allowable range.

adjustBrightness

public void adjustBrightness(char house,
                             boolean mode,
                             int percent)
                      throws java.lang.IllegalArgumentException
Dims/brightens the lamp modules in the specified house.

Parameters:
house - the house to control. 'A' to 'P'.
mode - true to brighten and false to dim.
percent - the percentage to change. Changes will occur is 5% increments.
Throws:
java.lang.IllegalArgumentException - thrown if the house or unit are within the allowable range.

finalize

protected void finalize()
                 throws java.lang.Throwable
Finalizes this object.

Throws:
java.lang.Throwable