public Cm11LowLevelDriverWorker(CM11aHouseCode houseCode, string comPort, int baudRate, Parity parity, int dataBits, StopBits stopBits) { x10HouseCode = houseCode; // We defer creation of comPort until first communication attempt // until then, store settings, that way we will also be able to // restore a comPort if configured ComPort is on a USB device that is // temporarily disconnected. this.comPort = comPort; this.baudRate = baudRate; this.parity = parity; this.dataBits = dataBits; this.stopBits = stopBits; }
/// <summary> /// Constructor for the X10CM11aController object. /// </summary> /// <param name="houseCode">House Code to control</param> /// <param name="comPort">Comm port the CM11a is on</param> /// <param name="baudRate">BaudRate of the CM11a </param> /// <param name="parity">Parity for serial Communications</param> /// <param name="dataBits">Databits for serial Commnunication</param> /// <param name="stopBits">Stop bits for serial Communication</param> public Cm11LowLevelDriver(String houseCode, string comPort, int baudRate, Parity parity, int dataBits, StopBits stopBits) { x10HouseCode = (CM11aHouseCode)Enum.Parse(typeof(CM11aHouseCode), houseCode); worker = new Cm11LowLevelDriverWorker(x10HouseCode, comPort, baudRate, parity, dataBits, stopBits); worker.Error += new EventHandler<Cm11LowLevelDriverError>(worker_Error); try { workerThread = new System.Threading.Thread(worker.StartProcessing); workerThread.IsBackground = true; workerThread.Start(); } catch (ApplicationException ae) { throw (new ApplicationException("Error Initializing CM11 X10 Controller", ae)); } }
/// <summary> /// Constructor for the X10CM11aController object. /// </summary> /// <param name="houseCode">House Code to control</param> /// <param name="comPort">Comm port the CM11a is on</param> /// <param name="baudRate">BaudRate of the CM11a </param> /// <param name="parity">Parity for serial Communications</param> /// <param name="dataBits">Databits for serial Commnunication</param> /// <param name="stopBits">Stop bits for serial Communication</param> public Cm11LowLevelDriver(String houseCode, string comPort, int baudRate, Parity parity, int dataBits, StopBits stopBits) { x10HouseCode = (CM11aHouseCode)Enum.Parse(typeof(CM11aHouseCode), houseCode); worker = new Cm11LowLevelDriverWorker(x10HouseCode, comPort, baudRate, parity, dataBits, stopBits); worker.Error += new EventHandler <Cm11LowLevelDriverError>(worker_Error); try { workerThread = new System.Threading.Thread(worker.StartProcessing); workerThread.IsBackground = true; workerThread.Start(); } catch (ApplicationException ae) { throw (new ApplicationException("Error Initializing CM11 X10 Controller", ae)); } }