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


C# CANMessage.Clone方法代码示例

本文整理汇总了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
            }
        }
开发者ID:ChrisPea,项目名称:Trionic,代码行数:28,代码来源:CANMXWiFiDevice.cs

示例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
            }
        }
开发者ID:josla972,项目名称:Trionic,代码行数:50,代码来源:CANELM327Device.cs


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