import java.io.*; import java.net.*; import java.util.*; import sophware.home.util.*; import sophware.home.lang.*; import sophware.home.io.*; import sophware.home.net.*; import sophware.home.x10.*; import sophware.home.insteon.*; /** * This is an example of how to setup a network bridge, exposing your * powerline interface to any computer on the same network. * * You could also use the Home instance in this program to support * an application on this computer. * * You will need to update the HomeExample.java to use the * HomeNetworkTransceiver * */ public class NetworkServerExample { Home m_home; NetworkHomeServer m_server; public static void main(String args[]) { DEBUG.setLevel(args); // looks for debug= where level 0-9 new NetworkServerExample(); } public NetworkServerExample() { try { /** * define error log if you don't want it on stderr * * Home.m_errorStream = new PrintStream(new FileOutputStream("bridge.log",true)); */ /** * setup shell home with interface to your * controller. This example uses Insteon PLC Controller */ m_home = new Home(new InsteonPLCTransceiver(new SerialAccess("COM1"))); /** * Use this line the X10 CM11A device * * m_home = new Home(new X10CM11ATransceiver(new SerialAccess("COM1"))); */ /** * Create the Network Server for this home and define * port on which it will listen for clients */ m_server = new NetworkHomeServer(m_home,8001); /** * start the home services */ m_home.start(); } catch (Exception e) { e.printStackTrace(System.err); } } }