示例#1
0
 public bool Connect()
 {
     x10lib.PortName  = this.GetOption("Port").Value.Replace("|", "/");
     x10lib.HouseCode = this.GetOption("HouseCodes").Value;
     OnInterfaceModulesChanged(this.GetDomain());
     return(x10lib.Connect());
 }
示例#2
0
        public static void Main(string[] args)
        {
            // NOTE: To disable debug output uncomment the following two lines
            //LogManager.Configuration.LoggingRules.RemoveAt(0);
            //LogManager.Configuration.Reload();

            Console.WriteLine("XTenLib test program, waiting for connection.");
            var x10 = new XTenManager();

            // Listen to XTenManager events
            x10.ConnectionStatusChanged += X10_ConnectionStatusChanged;
            x10.ModuleChanged           += X10_ModuleChanged;
            x10.PlcAddressReceived      += X10_PlcAddressReceived;
            x10.PlcFunctionReceived     += X10_PlcFunctionReceived;
            // These RF events are only used for CM15
            x10.RfDataReceived     += X10_RfDataReceived;
            x10.RfCommandReceived  += X10_RfCommandReceived;
            x10.RfSecurityReceived += X10_RfSecurityReceived;
            // Setup X10 interface. For CM15 set PortName = "USB"; for CM11 use serial port path intead (eg. "COM7" or "/dev/ttyUSB0")
            x10.PortName  = "USB";
            x10.HouseCode = "A,C";
            // Connect to the interface
            x10.Connect();

            // Prevent the program from quitting with a noop loop
            while (true)
            {
                Thread.Sleep(1000);
            }
        }
示例#3
0
 public bool Connect()
 {
     if (portName == Cm19LibDriverPort)
     {
         // use CM19 driver
         return(cm19Lib.Connect());
     }
     // else use default driver for CM11 / CM15
     x10Lib.PortName = portName;
     return(x10Lib.Connect());
 }
示例#4
0
 public bool Connect()
 {
     x10lib.PortName  = this.GetOption("Port").Value.Replace("|", "/");
     x10lib.HouseCode = this.GetOption("HouseCodes").Value;
     if (InterfaceModulesChangedAction != null)
     {
         InterfaceModulesChangedAction(new InterfaceModulesChangedAction()
         {
             Domain = this.Domain
         });
     }
     return(x10lib.Connect());
 }
示例#5
0
 public bool Connect()
 {
     return(x10lib.Connect());
 }