Requrements = To be able to use your TellStick from Java your OS must look at it as a serial unit. In Linux this is relatively simple as the unit is installed as a usual unit under /dev and you can then use e.g. javacomm to work with the unit. In Windows it is harder as the unit does not show up as a usual serial connection. You can use JNI to call one of the DLL's that exist to communicate with TellStick. If there will be VCP-drivers for Windows (Virtual Communication Port, make a USB-unit look like a regular serial port) the same example as for Linux can be used. You also need a deveopment kit for Java and the possibility to edit your own softwares. The simplest solution is to use one of the free development environments that are available: * [http://www.netbeans.org/ Netbeans] * [http://www.eclipse.org/ Eclipse] Development kit (JDK): * Sun's javahemsida It is very simple to write a class in javacomm representing your TellStick making it possible for you to send the right strings to it. Remember that the Java coding usually is unicode but when you work with TellStick you want the regular 8-bits ASCII. This means you have to be extra careful if you are to send non-ASCII-letters and digits (e.g. åäö). Also remember the data type in java is byte 8 bits while a char can contain a "java sign" (normally 16 bits). For a simple start project you can retrieve [http://flax.homelinux.org/~flax/rfcmd_java.tar.gz Simple project in Netbeans] and look in the code. TellStick has an own class and there is a first try to create a hierarchy to manage several types of units. In the example (which is a straight adjustment of rfcmd.c) the following is assumed about the managed units (NEXA): * A command to a remote unit is 12 bits long. The bits are sent in reverse order (low to high) and in the order house (4 bits), channel (4 bits) and command (4 bits). Command is somewhat special as bit 1 is zero, bit 2 and 3 in the block have to be ones, while the command is stored in bit 4. (i.e. in the normal order command is always 011X, where X is one for "one" and zero for "off") House is given as A-P (numerical value 0-15) channel is given as 1-16 (numerical value 0-15) In the string that is sent the following is applied: The string is started out with the character "S", the bit string is then sent with the string " `` " for a one, the string " ` `" for a zero and is ended with the character "}+". Example: House C, channel 5 and the command "on", leads to numerical house = 2, channel = 4 and command = 1. Bit pattern: (command)1110 (channel)0100 (house)0010. As we have to send them in reverse order the pattern to send is: 010000100111 After conversion to strings for one/zero we retrieve: {{{ " ` ` `` ` ` ` ` ` ` ` ` `` ` ` ` ` `` `` `` " 0 1 0 0 0 0 1 0 0 1 1 1 }}} Add start/end characters: "S ` ` `` ` ` ` ` ` ` ` ` `` ` ` ` ` `` `` `` }+" About the same procedure is used for other types of units but the represenation for one/zero can differ. Se rfcmd.c for example. Eventually also the order of the bit string can vary. I klassen NEXAUnit.java finns en del kod som kan vara till hjälp.