Пример #1
0
        public void NotifySendFailure(BadgeConnection badge, byte[] packet)
        {
            var handler = SendFailureHandler;

            if (handler != null)
            {
                handler(this, new BadgeSendFailureEventArgs(badge, packet));
            }
        }
Пример #2
0
 public void Disconnect()
 {
     if (Connected)
     {
         m_connection.Close();
         m_connection = null;
         m_responseDispatcher.ResponseHandler -= ResponseHandler;
     }
 }
Пример #3
0
        public void EnqueueResponse(BadgeConnection badge, byte[][] responses)
        {
            var handler = ResponseHandler;

            if (handler != null)
            {
                foreach (byte[] response in responses)
                {
                    handler(this, new BadgeResponseEventArgs(badge, response));
                }
            }
        }
Пример #4
0
 public void Connect(string port, BadgeCaps device)
 {
     if (!Connected)
     {
         m_device         = device;
         m_prevBrightness = -1;
         m_responseDispatcher.ResponseHandler += ResponseHandler;
         m_connection = new BadgeConnection(port, device.Baud, m_responseDispatcher);
     }
     else
     {
         throw new Exception("Already connected");
     }
 }
Пример #5
0
 public void Disconnect()
 {
     if(Connected)
     {
         m_connection.Close();
         m_connection = null;
     }
 }
Пример #6
0
 public void Connect(string port)
 {
     if(!Connected)
     {
         m_prevBrightness = -1;
         m_connection = new BadgeConnection(port, m_responseDispatcher);
     }
     else
     {
         throw new Exception("Already connected");
     }
 }
Пример #7
0
 public void EnqueueResponse(BadgeConnection badge, byte[][] responses)
 {
     m_Responses.Enqueue(Tuple.Create(badge, responses));
     m_hasWork.Release();
 }
Пример #8
0
 public void EnqueueResponse(BadgeConnection badge, byte[][] responses)
 {
     var handler = ResponseHandler;
     if(handler != null)
     {
         foreach(byte[] response in responses)
         {
             handler(this, new BadgeResponseEventArgs(badge, response));
         }
     }
 }
Пример #9
0
 public BadgeResponseEventArgs(BadgeConnection badge, byte[] response)
 {
     FromBadge = badge;
     Response = response;
 }
Пример #10
0
 public BadgeSendFailureEventArgs(BadgeConnection badge, byte[] packet)
 {
     FromBadge = badge;
     Packet    = packet;
 }
Пример #11
0
 public BadgeResponseEventArgs(BadgeConnection badge, byte[] response)
 {
     FromBadge = badge;
     Response  = response;
 }
Пример #12
0
 public void NotifySendFailure(BadgeConnection badge, byte[] packet)
 {
     m_failures.Enqueue(Tuple.Create(badge, packet));
     m_hasWork.Release();
 }
Пример #13
0
 public void EnqueueResponse(BadgeConnection badge, byte[][] responses)
 {
     m_responses.Enqueue(Tuple.Create(badge, responses));
     m_hasWork.Release();
 }