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 } }
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 } }
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 } }
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 } }