sensorhander: Create overrides for SensorDataEventRecordBody
set_id_strlen + set_id_type does not have function to support
SensorDataEventRecordBody, but is currently being used.
Without it the build failed like the following
```
../dbus-sdr/sensorcommands.cpp: In function 'bool ipmi::constructVrSdr(Context::ptr, const std::unordered_set<std::__cxx11::basic_string<char> >&, uint16_t, uint16_t, const std::string&, const std::string&, get_sdr::SensorDataEventRecord&)':
../dbus-sdr/sensorcommands.cpp:1916:44: error: cannot convert 'get_sdr::SensorDataEventRecordBody*' to 'get_sdr::SensorDataFullRecordBody*'
1916 | get_sdr::body::set_id_strlen(nameSize, &record.body);
| ^~~~~~~~~~~~
| |
| get_sdr::SensorDataEventRecordBody*
In file included from ../include/dbus-sdr/storagecommands.hpp:18,
from ../dbus-sdr/sensorcommands.cpp:21:
../sensorhandler.hpp:572:66: note: initializing argument 2 of 'void get_sdr::body::set_id_strlen(uint8_t, get_sdr::SensorDataFullRecordBody*)'
572 | inline void set_id_strlen(uint8_t len, SensorDataFullRecordBody* body)
| ~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~
../dbus-sdr/sensorcommands.cpp:1917:35: error: cannot convert 'get_sdr::SensorDataEventRecordBody*' to 'get_sdr::SensorDataFullRecordBody*'
1917 | get_sdr::body::set_id_type(3, &record.body); // "8-bit ASCII + Latin 1"
| ^~~~~~~~~~~~
| |
| get_sdr::SensorDataEventRecordBody*
../sensorhandler.hpp:581:65: note: initializing argument 2 of 'void get_sdr::body::set_id_type(uint8_t, get_sdr::SensorDataFullRecordBody*)'
581 | inline void set_id_type(uint8_t type, SensorDataFullRecordBody* body
```
Change-Id: Ic780a1f848a9e6bcea79fd9822539184d1d985cf
Signed-off-by: Willy Tu <wltu@google.com>
diff --git a/sensorhandler.hpp b/sensorhandler.hpp
index ea9fa3c..66c9bbb 100644
--- a/sensorhandler.hpp
+++ b/sensorhandler.hpp
@@ -574,6 +574,11 @@
body->id_string_info &= ~(0x1f);
body->id_string_info |= len & 0x1f;
};
+inline void set_id_strlen(uint8_t len, SensorDataEventRecordBody* body)
+{
+ body->id_string_info &= ~(0x1f);
+ body->id_string_info |= len & 0x1f;
+};
inline uint8_t get_id_strlen(SensorDataFullRecordBody* body)
{
return body->id_string_info & 0x1f;
@@ -583,6 +588,11 @@
body->id_string_info &= ~(3 << 6);
body->id_string_info |= (type & 0x3) << 6;
};
+inline void set_id_type(uint8_t type, SensorDataEventRecordBody* body)
+{
+ body->id_string_info &= ~(3 << 6);
+ body->id_string_info |= (type & 0x3) << 6;
+};
inline void set_device_id_strlen(uint8_t len, SensorDataFruRecordBody* body)
{