MCPcopy Create free account
hub / github.com/PowerBroker2/ELMduino / ELM327

Class ELM327

src/ELMduino.h:290–472  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

288
289
290class ELM327
291{
292public:
293 Stream* elm_port;
294
295 bool connected = false;
296 bool specifyNumResponses = true;
297 bool debugMode;
298 char* payload;
299 uint16_t PAYLOAD_LEN;
300 int8_t nb_rx_state = ELM_GETTING_MSG;
301 uint64_t response = 0;
302 uint16_t recBytes;
303 uint8_t numPayChars;
304 uint16_t timeout_ms;
305 byte responseByte_0;
306 byte responseByte_1;
307 byte responseByte_2;
308 byte responseByte_3;
309 byte responseByte_4;
310 byte responseByte_5;
311 byte responseByte_6;
312 byte responseByte_7;
313
314
315 struct dtcResponse {
316 uint8_t codesFound = 0;
317 char codes[DTC_MAX_CODES][DTC_CODE_LEN];
318 } DTC_Response;
319
320 bool begin(Stream& stream, const bool& debug = false, const uint16_t& timeout = 1000, const char& protocol = '0', const uint16_t& payloadLen = 128, const byte& dataTimeout = 0);
321 ~ELM327();
322 bool initializeELM(const char& protocol = '0', const byte& dataTimeout = 0);
323 void flushInputBuff();
324 uint64_t findResponse();
325 void queryPID(const uint8_t& service, const uint16_t& pid, const uint8_t& num_responses = 1);
326 void queryPID(char queryStr[]);
327 double processPID(const uint8_t& service, const uint16_t& pid, const uint8_t& num_responses, const uint8_t& numExpectedBytes, const double& scaleFactor = 1, const float& bias = 0);
328 void sendCommand(const char *cmd);
329 int8_t sendCommand_Blocking(const char *cmd);
330 int8_t get_response();
331 bool timeout();
332 double conditionResponse(const uint8_t& numExpectedBytes, const double& scaleFactor = 1, const double& bias = 0);
333 double conditionResponse(double (*func)());
334 double (*selectCalculator(uint16_t pid))();
335 float batteryVoltage(void);
336 int8_t get_vin_blocking(char vin[]);
337 bool resetDTC();
338 void currentDTCCodes(const bool& isBlocking = true);
339 bool isPidSupported(uint8_t pid);
340 void parseMultiLineResponse();
341
342 uint32_t supportedPIDs_1_20();
343
344 uint32_t monitorStatus();
345 uint16_t freezeDTC();
346 uint16_t fuelSystemStatus();
347 float engineLoad();

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected