本文整理汇总了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();
}
}
}
示例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;
}
}
示例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;
}
}
示例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;
}