//the ignore connection flag will prevent reinitilization of the connection if the connection is not null public void Start(bool ignoreconn = false) { FileTextLogger.logger.AppendLog("REM - Starting"); if (expconn != null && !ignoreconn) { Stop(); } if (expconn == null) { expconn = new RemoteExpanderConnection(device_id, DeviceServerTracker.DeviceServerHostInfo); } //write the base state ExpanderState bs_copy; lock (base_state_lock) bs_copy = new ExpanderState(base_state); Task.Run(() => { WriteExpanders(new bool[] { true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true }, new bool[] { true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true }, bs_copy.Expander0State, bs_copy.Expander1State); }); GenerateWorkers(); FileTextLogger.logger.AppendLog("REM - Started"); }
public void Stop(bool ignoreconn = false) { monitor_stop = true; Task.Delay(1000); if (expconn != null && !ignoreconn) { //while (expconn.Busy) // await Task.Delay(100); //expconn.Stop(); expconn = null; } //lock (expander_state_lock) // expst = null; }