/// <summary> /// Creates a new insance of a central class /// </summary> /// <param name="port">Serial port for connetion to interface (eg. 'COM2')</param> /// <param name="baudRate">Baudrate of serial port to interface</param> /// <param name="parityBits">ParityBits of serial port to interface</param> /// <param name="dataBits">DataBits of serial port to interface</param> /// <param name="stopBits">StopBits of serial port to interface</param> public Central(string port = "COM2", int baudRate = 57600, ComPortParity parityBits = ComPortParity.None, int dataBits = 8, ComPortStopBits stopBits = ComPortStopBits.One) { Config = new FlakeLIConfiguration(); _RigisteredEntities = new List <ILIEntity>(); _ErrorInARow = 0; // Open connection to interface InitConnection(port, baudRate, parityBits, dataBits, stopBits); // start command queue worker process //System.Threading.ThreadPool.QueueUserWorkItem(delegate { _AnswerListener = new LIListener(this); }, null); logme.Log(string.Format(i18n.FlakeLIMsgs.StartLIListener, Port), logme.LogLevel.info); SerialPortConnection.ComDataReceived += new ComPortEventHandler(DataReceivedHandler); GetInterfaceAndCentralInfo(); }
/// <summary> /// Creates a new XpressNet LI central /// </summary> /// <param name="serialPortConnection">an existing serialport connection</param> public Central(IComPort serialPortConnection) { Config = new FlakeLIConfiguration(); _RigisteredEntities = new List <ILIEntity>(); _ErrorInARow = 0; // Open connection to interface SerialPortConnection = serialPortConnection; SerialPortConnection.Open(); // start command queue worker process //System.Threading.ThreadPool.QueueUserWorkItem(delegate { _AnswerListener = new LIListener(this); }, null); logme.Log(string.Format(i18n.FlakeLIMsgs.StartLIListener, Port), logme.LogLevel.info); SerialPortConnection.ComDataReceived += new ComPortEventHandler(DataReceivedHandler); GetInterfaceAndCentralInfo(); }
/// <summary> /// Creates a new XpressNet LI central /// </summary> /// <param name="serialPortConnection">an existing serialport connection</param> public Central(IComPort serialPortConnection) { Config = new FlakeLIConfiguration(); _RigisteredEntities = new List<ILIEntity>(); _ErrorInARow = 0; // Open connection to interface SerialPortConnection = serialPortConnection; SerialPortConnection.Open(); // start command queue worker process //System.Threading.ThreadPool.QueueUserWorkItem(delegate { _AnswerListener = new LIListener(this); }, null); logme.Log(string.Format(i18n.FlakeLIMsgs.StartLIListener, Port), logme.LogLevel.info); SerialPortConnection.ComDataReceived += new ComPortEventHandler(DataReceivedHandler); GetInterfaceAndCentralInfo(); }
/// <summary> /// Creates a new insance of a central class /// </summary> /// <param name="port">Serial port for connetion to interface (eg. 'COM2')</param> /// <param name="baudRate">Baudrate of serial port to interface</param> /// <param name="parityBits">ParityBits of serial port to interface</param> /// <param name="dataBits">DataBits of serial port to interface</param> /// <param name="stopBits">StopBits of serial port to interface</param> public Central(string port = "COM2", int baudRate = 57600, ComPortParity parityBits = ComPortParity.None, int dataBits = 8, ComPortStopBits stopBits = ComPortStopBits.One) { Config = new FlakeLIConfiguration(); _RigisteredEntities = new List<ILIEntity>(); _ErrorInARow = 0; // Open connection to interface InitConnection(port, baudRate, parityBits, dataBits, stopBits); // start command queue worker process //System.Threading.ThreadPool.QueueUserWorkItem(delegate { _AnswerListener = new LIListener(this); }, null); logme.Log(string.Format(i18n.FlakeLIMsgs.StartLIListener, Port), logme.LogLevel.info); SerialPortConnection.ComDataReceived += new ComPortEventHandler(DataReceivedHandler); GetInterfaceAndCentralInfo(); }