public ArduinoLoggerMainForm() { InitializeComponent(); XmlConfigurator.Configure(); _comPort = new CommPort(this); }
public MainLogic() { evAgg = Common.EventAggregatorProvider.EventAggregator; incommingQueue = new EventQueue <string>(HandleParsing); //var frm = new BmsSim.Form1(); //frm.Show(); //commPort = frm; commPort = new CommPort(); }
public InstrumentCommunicator(ICommPort commPort, InstrumentType instrumentType) { _commPort = commPort; switch (instrumentType) { case InstrumentType.Ec300: _miSerial = new EC300Class(commPort); break; default: _miSerial = new MiniMaxClass(commPort); break; } IsConnected = false; }
/// <summary> /// Connect to the device and begin speaking rs232 /// </summary> public void Connect() { // Lock so we only have one connection attempt at a time. This protects // from client code behaving badly. lock (_mutex) { try { _port = Config.GetCommPort(); } catch (IOException) { NotifyError(Errors.FailedToOpenPort); return; } _port.ReadTimeout = 500; DebugBufferEntry.SetEpoch(); try { _port.Connect(); // Only start if we connect without error StartRS232Loop(); IsPaused = false; } catch (Exception e) { Log.ErrorFormat("Exception Connecting to acceptor: {0}", e.Message, e); if (OnError != null) { NotifyError(Errors.PortError); } } } }