本文整理汇总了C#中TrionicCANLib.CAN.CANMessage.setTimeStamp方法的典型用法代码示例。如果您正苦于以下问题:C# CANMessage.setTimeStamp方法的具体用法?C# CANMessage.setTimeStamp怎么用?C# CANMessage.setTimeStamp使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TrionicCANLib.CAN.CANMessage
的用法示例。
在下文中一共展示了CANMessage.setTimeStamp方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: readMessages
/// <summary>
/// readMessages is the "run" method of this class. It reads all incomming messages
/// and publishes them to registered ICANListeners.
/// </summary>
public void readMessages()
{
int readResult = 0;
Lawicel.CANUSB.CANMsg r_canMsg = new Lawicel.CANUSB.CANMsg();
CANMessage canMessage = new CANMessage();
logger.Debug("readMessages started");
while (true)
{
lock (m_synchObject)
{
if (m_endThread)
{
logger.Debug("readMessages thread ended");
return;
}
}
readResult = Lawicel.CANUSB.canusb_Read(m_deviceHandle, out r_canMsg);
if (readResult == Lawicel.CANUSB.ERROR_CANUSB_OK)
{
if (acceptMessageId(r_canMsg.id))
{
canMessage.setID(r_canMsg.id);
canMessage.setLength(r_canMsg.len);
canMessage.setTimeStamp(r_canMsg.timestamp);
canMessage.setFlags(r_canMsg.flags);
canMessage.setData(r_canMsg.data);
receivedMessage(canMessage);
}
}
else if (readResult == Lawicel.CANUSB.ERROR_CANUSB_NO_MESSAGE)
{
Thread.Sleep(1);
}
}
}
示例2: readMessages
/// <summary>
/// readMessages is the "run" method of this class. It reads all incomming messages
/// and publishes them to registered ICANListeners.
/// </summary>
public void readMessages()
{
int readResult = 0;
Lawicel.CANUSB.CANMsg r_canMsg = new Lawicel.CANUSB.CANMsg();
CANMessage canMessage = new CANMessage();
Console.WriteLine("readMessages started");
while (true)
{
lock (m_synchObject)
{
if (m_endThread)
{
Console.WriteLine("readMessages ended");
return;
}
}
readResult = Lawicel.CANUSB.canusb_Read(m_deviceHandle, out r_canMsg);
if (readResult == Lawicel.CANUSB.ERROR_CANUSB_OK)
{
if (acceptMessageId(r_canMsg.id))
{
canMessage.setID(r_canMsg.id);
canMessage.setLength(r_canMsg.len);
canMessage.setTimeStamp(r_canMsg.timestamp);
canMessage.setFlags(r_canMsg.flags);
canMessage.setData(r_canMsg.data);
lock (m_listeners)
{
AddToCanTrace(string.Format("RX: {0} {1}", canMessage.getID().ToString("X3"), canMessage.getData().ToString("X16")));
foreach (ICANListener listener in m_listeners)
{
listener.handleMessage(canMessage);
}
}
}
}
else if (readResult == Lawicel.CANUSB.ERROR_CANUSB_NO_MESSAGE)
{
Thread.Sleep(1);
}
}
}
示例3: readMessages
/// <summary>
/// readMessages is the "run" method of this class. It reads all incomming messages
/// and publishes them to registered ICANListeners.
/// </summary>
public void readMessages()
{
int readResult = 0;
EASYSYNC.CANMsg r_canMsg = new EASYSYNC.CANMsg();
CANMessage canMessage = new CANMessage();
while (true)
{
lock (m_synchObject)
{
if (m_endThread)
return;
}
readResult = EASYSYNC.canusb_Read(m_deviceHandle, out r_canMsg);
if (readResult == EASYSYNC.ERROR_CANUSB_OK)
{
canMessage.setID(r_canMsg.id);
canMessage.setLength(r_canMsg.len);
canMessage.setTimeStamp(r_canMsg.timestamp);
canMessage.setFlags(r_canMsg.flags);
canMessage.setData(r_canMsg.data);
lock (m_listeners)
{
foreach (ICANListener listener in m_listeners)
{
listener.handleMessage(canMessage);
}
}
}
else if (readResult == EASYSYNC.ERROR_CANUSB_NO_MESSAGE)
{
Thread.Sleep(1);
}
}
}