2016-06-15 23:48:41 +02:00
|
|
|
#include <framework/serialize/SerializeAdapter.h>
|
|
|
|
#include <framework/devicehandlers/DeviceTmReportingWrapper.h>
|
|
|
|
#include <framework/serialize/SerializeAdapter.h>
|
|
|
|
|
|
|
|
DeviceTmReportingWrapper::DeviceTmReportingWrapper(object_id_t objectId,
|
|
|
|
ActionId_t actionId, SerializeIF* data) :
|
|
|
|
objectId(objectId), actionId(actionId), data(data) {
|
|
|
|
}
|
|
|
|
|
|
|
|
DeviceTmReportingWrapper::~DeviceTmReportingWrapper() {
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
ReturnValue_t DeviceTmReportingWrapper::serialize(uint8_t** buffer,
|
2020-04-21 22:28:43 +02:00
|
|
|
size_t* size, size_t maxSize, Endianness streamEndianness) const {
|
2020-04-21 21:34:03 +02:00
|
|
|
ReturnValue_t result = SerializeAdapter::serialize(&objectId,
|
2020-04-21 22:28:43 +02:00
|
|
|
buffer, size, maxSize, streamEndianness);
|
2016-06-15 23:48:41 +02:00
|
|
|
if (result != HasReturnvaluesIF::RETURN_OK) {
|
|
|
|
return result;
|
|
|
|
}
|
2020-04-21 21:34:03 +02:00
|
|
|
result = SerializeAdapter::serialize(&actionId, buffer,
|
2020-04-21 22:28:43 +02:00
|
|
|
size, maxSize, streamEndianness);
|
2016-06-15 23:48:41 +02:00
|
|
|
if (result != HasReturnvaluesIF::RETURN_OK) {
|
|
|
|
return result;
|
|
|
|
}
|
2020-04-21 22:28:43 +02:00
|
|
|
return data->serialize(buffer, size, maxSize, streamEndianness);
|
2016-06-15 23:48:41 +02:00
|
|
|
}
|
|
|
|
|
2020-04-21 22:28:43 +02:00
|
|
|
size_t DeviceTmReportingWrapper::getSerializedSize() const {
|
2016-06-15 23:48:41 +02:00
|
|
|
return sizeof(objectId) + sizeof(ActionId_t) + data->getSerializedSize();
|
|
|
|
}
|
|
|
|
|
|
|
|
ReturnValue_t DeviceTmReportingWrapper::deSerialize(const uint8_t** buffer,
|
2020-04-21 22:28:43 +02:00
|
|
|
size_t* size, Endianness streamEndianness) {
|
2020-04-21 21:34:03 +02:00
|
|
|
ReturnValue_t result = SerializeAdapter::deSerialize(&objectId,
|
2020-04-21 22:28:43 +02:00
|
|
|
buffer, size, streamEndianness);
|
2016-06-15 23:48:41 +02:00
|
|
|
if (result != HasReturnvaluesIF::RETURN_OK) {
|
|
|
|
return result;
|
|
|
|
}
|
2020-04-21 21:34:03 +02:00
|
|
|
result = SerializeAdapter::deSerialize(&actionId, buffer,
|
2020-04-21 22:28:43 +02:00
|
|
|
size, streamEndianness);
|
2016-06-15 23:48:41 +02:00
|
|
|
if (result != HasReturnvaluesIF::RETURN_OK) {
|
|
|
|
return result;
|
|
|
|
}
|
2020-04-21 22:28:43 +02:00
|
|
|
return data->deSerialize(buffer, size, streamEndianness);
|
2016-06-15 23:48:41 +02:00
|
|
|
}
|