aboutsummaryrefslogtreecommitdiffstats
path: root/src/uds/uds.c
diff options
context:
space:
mode:
authorChristopher Peplin <chris.peplin@rhubarbtech.com>2014-02-14 18:35:24 -0500
committerChristopher Peplin <chris.peplin@rhubarbtech.com>2014-02-14 18:35:48 -0500
commit2ec5044b09a9c5ff9ffa1531371cc5095e278d3d (patch)
tree9bb06b2da94b9045ef765f309263dffb27c616b3 /src/uds/uds.c
parent2e37a1f1000d2ce827a028206e6b42b10536e7b3 (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.c')
-rw-r--r--src/uds/uds.c14
1 files changed, 5 insertions, 9 deletions
diff --git a/src/uds/uds.c b/src/uds/uds.c
index 9fec9a88..412f077d 100644
--- a/src/uds/uds.c
+++ b/src/uds/uds.c
@@ -258,17 +258,13 @@ DiagnosticResponse diagnostic_receive_can_frame(DiagnosticShims* shims,
return response;
}
-float diagnostic_payload_to_float(const DiagnosticResponse* response) {
- return bitfield_parse_float(response->payload,
- response->payload_length, 0,
- response->payload_length * CHAR_BIT, 1.0, 0);
+int diagnostic_payload_to_integer(const DiagnosticResponse* response) {
+ return get_bitfield(response->payload, response->payload_length, 0,
+ response->payload_length * CHAR_BIT);
}
-/* Public:
- *
- * Functions pulled from http://en.wikipedia.org/wiki/OBD-II_PIDs#Mode_01
- */
-float diagnostic_decode_obd2_pid(const DiagnosticResponse* response) {
+float diagnostic_decode_obd2_pid(const DiagnosticResponse* response,
+ int parsed_payload) {
// handles on the single number values, not the bit encoded ones
switch(response->pid) {
case 0xa: