예제 #1
0
        private void StreamData()
        {
            while (stream)
            {
                if (dongleConnected)
                {
                    dongleMessageMutex.WaitOne();
                    dongleLastMessage = myFtdiDevice.getLastMessage();
                    dongleMessageMutex.ReleaseMutex();
                }
                else
                    connectDongle();

                if (clientConnected)
                {
                    if (dongleLastMessage!= null)
                    {
                        Send(dongleLastMessage.ToByteArray());
                        dongleLastMessage = null;
                    }
                }
                Thread.Sleep(1000 / outputDataRate);
            }
            if (clientConnected)
            {
                myHandler.Shutdown(SocketShutdown.Both);
                myHandler.Close();
            }
        }
예제 #2
0
 public void setMessage(Message m)
 {
     dongleMessageMutex.WaitOne();
     dongleLastMessage = m;
     dongleMessageMutex.ReleaseMutex();
 }