serial
Class SerialLED
java.lang.Object
|
+--serial.SerialLED
- public class SerialLED
- extends Object
The SerialX10 class is designed to control the X10 control devices,
which in turn control the X10 modules which govern current from electrical
outlets to various devices. Of primary use in the room are the "lamp"
modules, which handle enough current to run a halogen lamp, and can even
dim the light level to one of 16 settings.
The modules are referred to by Housecode and Module numbers. The Housecode
is actually a letter setting on the module, ranging from A-P, but in the
SerialX10 class it is a byte from 0-15 (0-->A). The module number ranges
from 1-16 on the modules themselves, but in the SerialX10 class it is a
byte from 0-15 (1-->0). Thus Housecode C, Module 4 can be turned on by
calling x10inst.turnOn(2,3);
The usage of this class is intended as follows:
- create a new instance with
LED = new SerialLED()
- open a port with
LED.open("/dev/whatever")
- send commands with the
display(), turnOff(), and dim()
functions.
- close the port with
LED.close()
The origin of the X10 packet encoding method is unknown. The original
x10a.c serial server (found in /hci/metaglue/old-stuff/src/serial2/old/old-serial-servers/old/x10/old)
contains a complex encoding scheme. I have no idea where Chris Barnhart got
that scheme. It has been greatly simplified here.
Methods inherited from class java.lang.Object |
clone,
equals,
finalize,
getClass,
hashCode,
notify,
notifyAll,
toString,
wait,
wait,
wait |
SerialLED
public SerialLED()
Hello
public void Hello()
throws IOException
say
public void say(String stuff)
throws IOException
open
public void open(String in_device)
throws javax.comm.NoSuchPortException,
javax.comm.PortInUseException,
IOException
- Parameters:
in_device
- the name of the serial device to speak to. (e.g. "/dev/ttyrg")
close
public void close()
throws IOException
- Closes the port.
main
public static void main(String[] args)
- Used for standalone debugging and hardware tests.