Ejemplo n.º 1
0
        /*
         * Loop that send set and get commands to plane.
         * Use messageQueue to get the 'set' commands.
         * Get messages are a defined routine given in messageByte matrix.
         */
        public void Run()
        {
            Thread t;

            byte[]       bytes = new byte[1024];
            MessageQueue queue = MessageQueue.GetInstance();
            int          i, len = _lambdas.Length;
            string       message;

            while (_keepRunning)
            {
                for (i = 0; i < len; i++)
                {
                    t = new Thread(() => StandardGetCommand(i));
                    Wait10Sec(t);
                }

                while (i-- > 0)
                {
                    if (queue.Empty())
                    {
                        break;
                    }

                    message = queue.Dequeue();

                    if (message != null)
                    {
                        t = new Thread(() => StandardSetCommand(message));
                        Wait10Sec(t);
                    }
                }
                Thread.Sleep(200);
            }

            // Release socket.
            _sender.Shutdown(SocketShutdown.Both);
            _sender.Close();
        }// End of run().
Ejemplo n.º 2
0
 public PlaneModel()
 {
     _queue = MessageQueue.GetInstance();
 }