public ControllerCommandHandle[] EnqueueCommands(ControllerCommand[] expcmds)
        {
            ControllerCommandHandle[] cmdhdls = new ControllerCommandHandle[expcmds.Length];
            for (int index_counter = 0; index_counter < expcmds.Length; index_counter++)
            {
                cmdhdls[index_counter] = new ControllerCommandHandle(new AutoResetEvent(false), expcmds[index_counter]);
            }

            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 multi-command execution to complete." + TimeSpan.FromTicks(sw.ElapsedTicks).ToString()); };
                t.Start();

                lock (pending_command_queue_lock)
                    for (int index_counter = 0; index_counter < expcmds.Length; index_counter++)
                    {
                        pending_command_queue.Enqueue(cmdhdls[index_counter]);
                    }

                sw.Stop();
                t.Stop();

                FileTextLogger.logger.AppendLog("LCC, MCE - Commands Enqueued");
            });

            return(cmdhdls);
        }
        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);
        }