diff options
author | Christopher Peplin <chris.peplin@rhubarbtech.com> | 2014-02-14 18:35:24 -0500 |
---|---|---|
committer | Christopher Peplin <chris.peplin@rhubarbtech.com> | 2014-02-14 18:35:48 -0500 |
commit | 2ec5044b09a9c5ff9ffa1531371cc5095e278d3d (patch) | |
tree | 9bb06b2da94b9045ef765f309263dffb27c616b3 /src/uds/uds.h | |
parent | 2e37a1f1000d2ce827a028206e6b42b10536e7b3 (diff) |
Clarify when we are using int vs float and move decoders up a level.
Fixed #4 - the Decoder function type signature actually belonged one
level higher, in the application, since there's no capability of
actually using it in this library at the moment.
Diffstat (limited to 'src/uds/uds.h')
-rw-r--r-- | src/uds/uds.h | 17 |
1 files changed, 15 insertions, 2 deletions
diff --git a/src/uds/uds.h b/src/uds/uds.h index a4761ca2..cb132330 100644 --- a/src/uds/uds.h +++ b/src/uds/uds.h @@ -83,7 +83,11 @@ DiagnosticResponse diagnostic_receive_can_frame(DiagnosticShims* shims, const uint16_t arbitration_id, const uint8_t data[], const uint8_t size); -float diagnostic_payload_to_float(const DiagnosticResponse* response); +/* Public: Parse the entier payload of the reponse as a single integer. + * + * response - the received DiagnosticResponse. + */ +int diagnostic_payload_to_integer(const DiagnosticResponse* response); /* Public: Render a DiagnosticResponse as a string into the given buffer. * @@ -97,7 +101,16 @@ float diagnostic_payload_to_float(const DiagnosticResponse* response); // void diagnostic_response_to_string(const DiagnosticResponse* response, // char* destination, size_t destination_length); -float diagnostic_decode_obd2_pid(const DiagnosticResponse* response); +/* Public: For many OBD-II PIDs with a numerical result, translate a diagnostic + * response payload into a meaningful number using the standard formulas. + * + * Functions pulled from http://en.wikipedia.org/wiki/OBD-II_PIDs#Mode_01 + * + * Returns the translated value or 0 if the PID is not in the OBD-II standard or + * does not use a numerical value (e.g. VIN). + */ +float diagnostic_decode_obd2_pid(const DiagnosticResponse* response, + int parsed_payload); #ifdef __cplusplus } |