3742d6d1c464558267220d571571fe68afe27113
[apps/agl-service-can-low-level.git] / src / canutil / read.h
1 #ifndef __READ_H__
2 #define __READ_H__
3
4 #include <stdint.h>
5 #include <stdbool.h>
6
7 #ifdef __cplusplus
8 extern "C" {
9 #endif
10
11 /* Public: Parse a CAN signal from a message and apply required transformation.
12  *
13  * signal - The details of the signal to decode and forward.
14  * data   - The raw bytes of the CAN message that contains the signal, assumed
15  *      to be in big-endian byte order from CAN.
16  *
17  * Returns the final, transformed value of the signal.
18  */
19 float bitfield_parse_float(uint64_t data, uint8_t bit_offset, uint8_t bit_size,
20         float factor, float offset);
21
22 bool bitfield_parse_bool(uint64_t data, uint8_t bit_offset, uint8_t bit_size,
23         float factor, float offset);
24
25 #ifdef __cplusplus
26 }
27 #endif
28
29 #endif // __READ_H__