當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。