当前位置: 首页>>代码示例>>C#>>正文


C# CANMessage.getFlags方法代码示例

本文整理汇总了C#中TrionicCANLib.CAN.CANMessage.getFlags方法的典型用法代码示例。如果您正苦于以下问题:C# CANMessage.getFlags方法的具体用法?C# CANMessage.getFlags怎么用?C# CANMessage.getFlags使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在TrionicCANLib.CAN.CANMessage的用法示例。


在下文中一共展示了CANMessage.getFlags方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: handleMessage

 public override void handleMessage(CANMessage a_message)
 {
     lock (m_canMessage)
     {
         if (a_message.getID() == m_waitMsgID)
         {
             m_canMessage.setData(a_message.getData());
             m_canMessage.setFlags(a_message.getFlags());
             m_canMessage.setID(a_message.getID());
             m_canMessage.setLength(a_message.getLength());
             m_canMessage.setTimeStamp(a_message.getTimeStamp());
             messageReceived = true;
             m_resetEvent.Set();
         }
     }
 }
开发者ID:ChrisPea,项目名称:Trionic,代码行数:16,代码来源:KWPCANListener.cs

示例2: sendMessage

 /// <summary>
 /// sendMessage send a CANMessage.
 /// </summary>
 /// <param name="a_message">A CANMessage.</param>
 /// <returns>true on success, othewise false.</returns>
 public override bool sendMessage(CANMessage a_message)
 {
     Lawicel.CANUSB.CANMsg msg = new Lawicel.CANUSB.CANMsg();
     msg.id = a_message.getID();
     msg.len = a_message.getLength();
     msg.flags = a_message.getFlags();
     msg.data = a_message.getData();
     int writeResult;
     AddToCanTrace("TX: " + msg.id.ToString("X4") + " " + msg.data.ToString("X16"));
     writeResult = Lawicel.CANUSB.canusb_Write(m_deviceHandle, ref msg);
     if (writeResult == Lawicel.CANUSB.ERROR_CANUSB_OK)
     {
         AddToCanTrace("Message sent successfully");
         return true;
     }
     else
     {
         switch (writeResult)
         {
             case Lawicel.CANUSB.ERROR_CANUSB_COMMAND_SUBSYSTEM:
                 AddToCanTrace("Message failed to send: ERROR_CANUSB_COMMAND_SUBSYSTEM");
                 break;
             case Lawicel.CANUSB.ERROR_CANUSB_INVALID_PARAM:
                 AddToCanTrace("Message failed to send: ERROR_CANUSB_INVALID_PARAM");
                 break;
             case Lawicel.CANUSB.ERROR_CANUSB_NO_MESSAGE:
                 AddToCanTrace("Message failed to send: ERROR_CANUSB_NO_MESSAGE");
                 break;
             case Lawicel.CANUSB.ERROR_CANUSB_NOT_OPEN:
                 AddToCanTrace("Message failed to send: ERROR_CANUSB_NOT_OPEN");
                 break;
             case Lawicel.CANUSB.ERROR_CANUSB_OPEN_SUBSYSTEM:
                 AddToCanTrace("Message failed to send: ERROR_CANUSB_OPEN_SUBSYSTEM");
                 break;
             case Lawicel.CANUSB.ERROR_CANUSB_TX_FIFO_FULL:
                 AddToCanTrace("Message failed to send: ERROR_CANUSB_TX_FIFO_FULL");
                 break;
             default:
                 AddToCanTrace("Message failed to send: " + writeResult.ToString());
                 break;
         }
         return false;
     }
 }
开发者ID:josla972,项目名称:Trionic,代码行数:49,代码来源:CANUSBDevice.cs

示例3: sendMessageDevice

 /// <summary>
 /// sendMessage send a CANMessage.
 /// </summary>
 /// <param name="a_message">A CANMessage.</param>
 /// <returns>true on success, othewise false.</returns>
 protected override bool sendMessageDevice(CANMessage a_message)
 {
     Lawicel.CANUSB.CANMsg msg = new Lawicel.CANUSB.CANMsg();
     msg.id = a_message.getID();
     msg.len = a_message.getLength();
     msg.flags = a_message.getFlags();
     msg.data = a_message.getData();
     int writeResult;
     writeResult = Lawicel.CANUSB.canusb_Write(m_deviceHandle, ref msg);
     if (writeResult == Lawicel.CANUSB.ERROR_CANUSB_OK)
     {
         return true;
     }
     else
     {
         logger.Debug("tx failed writeResult: " + writeResult);
         return false;
     }
 }
开发者ID:ChrisPea,项目名称:Trionic,代码行数:24,代码来源:CANUSBDevice.cs

示例4: sendMessage

        /// <summary>
        /// sendMessage send a CANMessage.
        /// </summary>
        /// <param name="a_message">A CANMessage.</param>
        /// <returns>true on success, othewise false.</returns>
        public override bool sendMessage(CANMessage a_message)
        {
            lock (lockObj)
            {
                while (interfaceBusy)
                {
                    if (lastSentTimestamp < Environment.TickCount - timeoutWithoutReadyChar)
                    {
                        //Console.WriteLine("released");
                        break;
                    }
                }

                lastSentTimestamp = Environment.TickCount;
                interfaceBusy = true;
                //Console.WriteLine("set");

                Lawicel.CANUSB.CANMsg msg = new Lawicel.CANUSB.CANMsg();
                msg.id = a_message.getID();
                msg.len = a_message.getLength();
                msg.flags = a_message.getFlags();
                msg.data = a_message.getData();

                if (m_serialPort.IsOpen)
                {
                    //m_serialPort.Write("\r");
                    string txstring = "t";
                    txstring += msg.id.ToString("X3");
                    txstring += "8"; // always 8 bytes to transmit
                    for (int t = 0; t < 8; t++)
                    {
                        byte b = (byte)(((msg.data >> t * 8) & 0x0000000000000000FF));
                        txstring += b.ToString("X2");
                    }
                    txstring += "\r";
                    AddToCanTrace(string.Format("TX: {0} {1} {2}", a_message.getID().ToString("X3"), a_message.getData().ToString("X16"), txstring));
                    m_serialPort.Write(txstring);
                    return true;
                }
            }
            return false;
        }
开发者ID:josla972,项目名称:Trionic,代码行数:47,代码来源:CANUSBDirectDevice.cs


注:本文中的TrionicCANLib.CAN.CANMessage.getFlags方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。