예제 #1
0
        private void Can_MessageAvailable(ControllerAreaNetwork sender, ControllerAreaNetwork.MessageAvailableEventArgs e)
        {
            var messages = sender.ReadMessages();

            foreach (var message in messages)
            {
                OnMessageReceived(new CanMessage(message));
            }
        }
예제 #2
0
        void m_busCan_MessageAvailable(ControllerAreaNetwork sender, ControllerAreaNetwork.MessageAvailableEventArgs e)
        {
            m_msgRecu[0] = sender.ReadMessage();
            Debug.Print("CanId reçu" + m_msgRecu[0].ArbitrationId.ToString());

            AutoResetEvent evtDONE    = (AutoResetEvent)m_tabWaitDONE[0];
            AutoResetEvent evtSTOP    = (AutoResetEvent)m_tabWaitDONE[1];
            AutoResetEvent evtBLOCKED = (AutoResetEvent)m_tabWaitDONE[2];
            AutoResetEvent evtACK     = (AutoResetEvent)m_waitACK[0];
            AutoResetEvent evtACKSTOP = (AutoResetEvent)m_waitACK[1];

            // Etude de la commande reçue.

            if ((m_msgRecu[0].ArbitrationId != (uint)IDcommande.WStopACK) && (m_msgRecu[0].ArbitrationId != (uint)IDcommande.WStopDONE))
            {
                if (m_msgRecu[0].ArbitrationId == m_id + 1)
                {
                    evtACK.Set();
                }
                else if (m_msgRecu[0].ArbitrationId == m_id + 2)
                {
                    evtDONE.Set();
                }
            }

            switch (m_msgRecu[0].ArbitrationId)
            {
            case (uint)IDcommande.WStopACK:
                evtACKSTOP.Set();
                break;

            case (uint)IDcommande.WStopDONE:
                evtSTOP.Set();
                break;

            case (uint)IDcommande.WBeBlocked:
                evtBLOCKED.Set();
                break;
            }
        }
예제 #3
0
 private void OnCanMessagesAvailable(ControllerAreaNetwork sender, ControllerAreaNetwork.MessageAvailableEventArgs e)
 {
     this.OnMessagesReceived(this, new MessagesReceivedEventArgs(this.can.ReadMessages()));
 }