|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.universAAL.lddi.fs20.connect.FHZ1000PC
public class FHZ1000PC
This class encapsulates an interface towards the FHZ1000PC device. It works on both Windows and Linux, with different internal access methods but the external interface is the same. FHZ1000PC is part of the FS20-system which is a home automation system with devices like dimmers, switches, rain sensors and so on. The devices talk with each other via radio messages. The FHZ1000PC is a USB-based interface that allows a computer to send and receive these radio messages and thereby control and monitor the devices. Unfortunatly only a german control program without any external API accompany the device, so I had to write this interface to communicate with it. The FHZ1000PC hardware is originally built for serial communication, but an FTDI-chip (http://www.ftdichip.com) is used internally to convert the serial communication to USB. In Windows The FTDI-drivers are installed when the FHZ1000PC software is installed, and API software for those drivers are provided free by FTDI. Those API:s are C-based, so some interface class is needed to access it from Java. Such an interface is provided by https://jd2xx.dev.java.net. This interface is released with a Berkeley Software Distribution (BSD) License. This interface is implemented in two files which are needed to use this interface: - jd2xx.dll - jd2xx.jar The http://fhz4linux.info/tiki-index.php site provided me with information on the serial protocol that FHZ1000PC uses. I Linux we access the device directly via the serial interface. We only have to persuade Linux that it really is a serial device. This is described on: http://fhz4linux.info/tiki-index.php?page=Driver+installation
Nested Class Summary | |
---|---|
static interface |
FHZ1000PC.FHZ1000Device
An interface to the "raw" FHZ1000 device where you can read and write data to it. |
class |
FHZ1000PC.FHZ1000SerialDevice
When running on Linux, we access the USB-device via generic serial drivers for FTDI-chips. |
class |
FHZ1000PC.JD2XXFHZ1000Device
When running on Windows, we access the USB-device via FTDI-specific drivers to access the device. |
Field Summary | |
---|---|
static byte |
COMMAND_DELIVERY_STATE
|
static byte |
COMMAND_DIM_DOWN
|
static byte |
COMMAND_DIM_LOOP
|
static byte |
COMMAND_DIM_UP
|
static byte |
COMMAND_DIM1
|
static byte |
COMMAND_OFF
|
static byte |
COMMAND_ON
|
static byte |
COMMAND_TIMER_PROG
|
static byte |
COMMAND_TOGGLE
|
protected FHZ1000PC.FHZ1000Device |
m_Device
|
protected FS20EventListener |
m_EventListener
|
protected String |
m_PortName
|
Constructor Summary | |
---|---|
FHZ1000PC(String portName)
|
Method Summary | |
---|---|
static String |
binFS20ByteToString(int value,
int bits)
Converts an integer address to the "base 4 + 1" format used by FS20 to denote the addresses for buttons and devices. |
void |
deviceEvent()
|
void |
fs20Init()
Send FS20Init command to the FHZ1000PC device. |
protected byte[] |
read()
Reads a complete message from the FHZ1000PC device and returns the payload of the message including telegram type and checksum. |
void |
registerEventListener(FS20EventListener ev)
|
void |
sendFS20Command(int houseCode,
byte button,
byte command)
Send a command (for example COMMAND_DIM_DOWN) to a FS20 device (for example a dimmer) via the FHZ1000PC. |
static int |
StringFS20ToInt(String value)
Converts an address string in the "base 4 + 1" format used by FS20 to a binary byte format actually used on the protocol. |
void |
unregisterEventListener()
|
protected int |
write(byte[] data,
byte telegramType)
Sends an string of bytes to the FHZ1000PC 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 COMMAND_OFF
public static final byte COMMAND_DIM1
public static final byte COMMAND_ON
public static final byte COMMAND_DIM_LOOP
public static final byte COMMAND_DIM_DOWN
public static final byte COMMAND_DIM_UP
public static final byte COMMAND_TOGGLE
public static final byte COMMAND_TIMER_PROG
public static final byte COMMAND_DELIVERY_STATE
protected FHZ1000PC.FHZ1000Device m_Device
protected FS20EventListener m_EventListener
protected String m_PortName
Constructor Detail |
---|
public FHZ1000PC(String portName) throws IOException
IOException
Method Detail |
---|
public void fs20Init() throws IOException
IOException
public void sendFS20Command(int houseCode, byte button, byte command) throws IOException
houseCode
- 16 bit House Code of the FS20 device in binary form, not the 1111 2222-form.button
- 8 bit button idcommand
- FS20 Command (for example COMMAND_DIM_DOWN)
IOException
public void registerEventListener(FS20EventListener ev)
public void unregisterEventListener() throws IOException
IOException
public void deviceEvent()
protected int write(byte[] data, byte telegramType) throws IOException
data
- Array of bytes to send to devicetelegramType
- Type of message
IOException
protected byte[] read() throws IOException
IOException
public static String binFS20ByteToString(int value, int bits)
value
- The binary value to convertbits
- Number of bits to convert, usually 8 or 16.
public static int StringFS20ToInt(String value)
value
- The address string to convert
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |