aboutsummaryrefslogtreecommitdiffstats
path: root/src/can/can-decoder.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/can/can-decoder.cpp')
-rw-r--r--src/can/can-decoder.cpp19
1 files changed, 19 insertions, 0 deletions
diff --git a/src/can/can-decoder.cpp b/src/can/can-decoder.cpp
index aef042c3..fce43fc6 100644
--- a/src/can/can-decoder.cpp
+++ b/src/can/can-decoder.cpp
@@ -215,3 +215,22 @@ openxc_DynamicField decoder_t::decodeSignal( can_signal_t& signal,
float value = parseSignalBitfield(signal, message);
return decodeSignal(signal, value, signals, send);
}
+
+
+/**
+* @brief Decode the payload of an OBD-II PID.
+*
+* This function matches the type signature for a DiagnosticResponseDecoder, so
+* it can be used as the decoder for a DiagnosticRequest. It returns the decoded
+* value of the PID, using the standard formulas (see
+* http://en.wikipedia.org/wiki/OBD-II_PIDs#Mode_01).
+*
+* @param[in] response - the received DiagnosticResponse (the data is in response.payload,
+* a byte array). This is most often used when the byte order is
+* signiticant, i.e. with many OBD-II PID formulas.
+* @param[in] parsed_payload - the entire payload of the response parsed as an int.
+*/
+float decoder_t::decode_obd2_response(const DiagnosticResponse* response, float parsedPayload)
+{
+ return diagnostic_decode_obd2_pid(response);
+} \ No newline at end of file