void Form1_close(object e, FormClosingEventArgs arg) { if (_ThreadSendSensorAsk != null) { _ThreadSendSensorAsk.Abort(); } _AutomateComm.Dispose(); _ArduinoManager = null; //g_Serial.StopListenSerial(); }
public void OpenSerialPort(string SerialName) { _ArduinoManager = new ArduinoManagerComm(); _AutomateComm = new AutomateCommunication(SerialName, true, _ArduinoManager); _AutomateComm.OpenSerialPort(SerialName); _Follower = new Follower(_ArduinoManager, _AutomateComm); _tUpdate = new Thread(new ThreadStart(_threadUpdate)); _tUpdate.Start(); //_AutomateComm.OnNewTrameArduinoReceived += new AutomateCommunication.NewTrameArduinoReceivedEventHandler(_AutomateComm_OnNewTrameArduinoReceived); }
public Follower(ArduinoManagerComm AM, AutomateCommunication AUTO) { // Partie communication this._ArduinoManager = AM; this._AutomateComm = AUTO; _ListArduino = new List <ArduinoBotIA>(); // Createur de trajectoire _TrackMaker = new TrackMaker(); this._AutomateComm.OnArduinoTimeout += new AutomateCommunication.ArduinoTimeoutEventHandler(_AutomateComm_OnArduinoTimeout); this._AutomateComm.OnNewTrameArduinoReceived += new AutomateCommunication.NewTrameArduinoReceivedEventHandler(_AutomateComm_OnNewTrameArduinoReceived); }
public void Dispose() { if (_tUpdate != null) { _tUpdate.Abort(); } _tUpdate = null; _Follower = null; _ArduinoManager = null; if (_AutomateComm != null) { _AutomateComm.Dispose(); } _AutomateComm = null; }
public Form1() { InitializeComponent(); g_Logger.attachToRTB(txtbox_debug_log); g_Logger.levelDebug = 1; // Enlever le gros debug Logger.GlobalLogger = g_Logger; // Met a la disposition le logger getListePortSerie(); this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(Form1_close); _ArduinoManager = new ArduinoManagerComm(); _AutomateComm = new AutomateCommunication("COM0", true, _ArduinoManager); // Initialise l'automate sur le port 0 _AutomateComm.OnNewTrameArduinoReceived += new AutomateCommunication.NewTrameArduinoReceivedEventHandler(_OnNewTrameArduinoReceived); _AutomateComm.OnArduinoTimeout += new AutomateCommunication.ArduinoTimeoutEventHandler(_OnArduinoTimeout); /* Set de la source */ _AutomateComm.IdPc = 0xFE; MessageBuilder.src = 0xFE; }
public void CloseSerialPort() { if (_tUpdate != null) { _tUpdate.Abort(); } _tUpdate = null; if (_AutomateComm != null) { _AutomateComm.CloseSerialPort(); } if (_AutomateComm != null) { _AutomateComm.Dispose(); } _AutomateComm = null; _ArduinoManager = null; }