public ControllerCommandHandle EnqueueCommand(ControllerCommand ccmd) { ControllerCommandHandle cmdhdl = new ControllerCommandHandle(new AutoResetEvent(false), ccmd); Task.Run(() => { var sw = new Stopwatch(); sw.Start(); var t = new System.Timers.Timer(1000); t.AutoReset = true; t.Elapsed += (a, b) => { FileTextLogger.logger.AppendLog("LCC - Waiting for simplex-command execution to complete. " + TimeSpan.FromTicks(sw.ElapsedTicks).ToString()); }; t.Start(); FileTextLogger.logger.AppendLog("LCC - connecting to = " + connprop.IPAddress + " " + connprop.TCPPort); FileTextLogger.logger.AppendLog("LCC - executing command"); lock (pending_command_queue_lock) pending_command_queue.Enqueue(cmdhdl); sw.Stop(); t.Stop(); FileTextLogger.logger.AppendLog("LCC, SCE - Command Enqueued"); }); return(cmdhdl); }
public ControllerCommandHandle(AutoResetEvent handle, ControllerCommand command) { this.handle = handle; this.command = command; }