obd_rx_states ELM327::sendCommand_Blocking(const char* cmd) Description: ------------ * Sends a command/query and waits for a respoonse (blocking function) Sometimes it's desirable to use a blocking command, e.g when sending an AT command. This function removes the need for the caller to set up a loop waiting for the command to finish. Caller is free to parse the payload
| 2418 | * int8_t - the ELM_XXX status of getting the OBD response |
| 2419 | */ |
| 2420 | int8_t ELM327::sendCommand_Blocking(const char *cmd) |
| 2421 | { |
| 2422 | sendCommand(cmd); |
| 2423 | uint32_t startTime = millis(); |
| 2424 | while (get_response() == ELM_GETTING_MSG) { |
| 2425 | if (millis() - startTime > timeout_ms) break; |
| 2426 | } |
| 2427 | return nb_rx_state; |
| 2428 | } |
| 2429 | |
| 2430 | /* |
| 2431 | obd_rx_states ELM327::get_response(void) |
nothing calls this directly
no outgoing calls
no test coverage detected