Beispiel #1
0
        public bool Send(IMessage message)
        {
            if (this.IsOpen)
            {
                //TPCANStatus status = PCANBasic.GetStatus(m_handle);
                //while ((status & TPCANStatus.PCAN_ERROR_XMTFULL) != 0)
                //{
                //    if ((status & ~TPCANStatus.PCAN_ERROR_ANYBUSERR) != 0)
                //    {
                //        m_errorStatus = status.ToString();
                //        return false;
                //    }
                //    status = PCANBasic.GetStatus(m_handle);
                //}
                PCANMessage pmsg   = (PCANMessage)message;
                var         msg    = pmsg.NativeMessage;
                TPCANStatus result = PCANBasic.Write(m_handle, ref msg);
                pmsg.NativeMessage = msg;   // Save possibly updated message data.

                if (this.UpdateStatusFromOperation(result) == TPCANStatus.PCAN_ERROR_OK)
                {
                    return(true);
                }
            }
            return(false);
        }
Beispiel #2
0
 private void PutReceivedInQueue(PCANMessage message)
 {
     lock (m_receiveLock)
     {
         foreach (var rq in m_receivers)
         {
             if (rq.TryAddHandover(message))
             {
                 return;
             }
         }
     }
 }