本文整理汇总了C#中TrionicCANLib.CAN.CANMessage.Clone方法的典型用法代码示例。如果您正苦于以下问题:C# CANMessage.Clone方法的具体用法?C# CANMessage.Clone怎么用?C# CANMessage.Clone使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TrionicCANLib.CAN.CANMessage
的用法示例。
在下文中一共展示了CANMessage.Clone方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: sendMessageDevice
protected override bool sendMessageDevice(CANMessage a_message)
{
lock (lockObj)
{
interfaceBusy = true;
if (a_message.getID() != _ECUAddress)
{
_ECUAddress = a_message.getID();
string command = String.Format("ATSH{0:X3}\r", a_message.getID());
SendControlMessage(command, false);
}
lastSentCanMessage = a_message.Clone();
string sendString = GetELMRequest(a_message);
//add expected responses, but this has to be one char only :(
if (a_message.elmExpectedResponses != -1 && a_message.elmExpectedResponses < 16)
sendString += " " + a_message.elmExpectedResponses.ToString("X1");
sendString += "\r";
lastSentTimestamp = Environment.TickCount;
rawString = WriteToTelnetAndWait(sendString);
return true; // remove after implementation
}
}
示例2: sendMessage
public override bool sendMessage(CANMessage a_message)
{
lock (lockObj)
{
sendDataSempahore.WaitOne(timeoutWithoutReadyChar);
interfaceBusy = true;
if (a_message.getID() != _ECUAddress)
{
_ECUAddress = a_message.getID();
string command = "ATSH" + a_message.getID().ToString("X3") + "\r";
SendControlMessage(command, false);
}
//check if it is beneficial to send ATR0 and ATR1 for ELM clones
if (!supports8ByteResponse)
{
if ((a_message.elmExpectedResponses == 0) != request0Responses)
{
if (a_message.elmExpectedResponses == 0)
{
SendControlMessage("ATR0\r", false);
request0Responses = true;
}
else
{
SendControlMessage("ATR1\r", false);
request0Responses = false;
}
}
}
lastSentCanMessage = a_message.Clone();
string sendString = GetELMRequest(a_message);
if (a_message.getLength() < 8 || supports8ByteResponse) //ELM 2.0 supports 8 bytes + response count, previous versions dont
{
//add expected responses, but this has to be one char only :(
if (a_message.elmExpectedResponses != -1 && a_message.elmExpectedResponses < 16)
sendString += " " + a_message.elmExpectedResponses.ToString("X1");
}
sendString += "\r";
if (m_serialPort.IsOpen)
{
lastSentTimestamp = Environment.TickCount;
WriteToSerialWithTrace(sendString);
AddToCanTrace(string.Format("TX: {0} {1}", a_message.getID().ToString("X3"), sendString));
}
return true; // remove after implementation
}
}