2016-06-15 23:48:41 +02:00
|
|
|
#ifndef MODEDEFINITIONS_H_
|
|
|
|
#define MODEDEFINITIONS_H_
|
|
|
|
|
2020-08-13 20:53:35 +02:00
|
|
|
#include "../../modes/HasModesIF.h"
|
|
|
|
#include "../../objectmanager/SystemObjectIF.h"
|
|
|
|
#include "../../serialize/SerializeIF.h"
|
|
|
|
#include "../../serialize/SerialLinkedListAdapter.h"
|
2016-06-15 23:48:41 +02:00
|
|
|
class ModeListEntry: public SerializeIF, public LinkedElement<ModeListEntry> {
|
|
|
|
public:
|
|
|
|
ModeListEntry() :
|
2018-07-12 16:29:32 +02:00
|
|
|
LinkedElement<ModeListEntry>(this), value1(0), value2(0), value3(0), value4(
|
|
|
|
0) {
|
2016-06-15 23:48:41 +02:00
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
uint32_t value1;
|
|
|
|
uint32_t value2;
|
|
|
|
uint8_t value3;
|
2018-07-12 16:29:32 +02:00
|
|
|
uint8_t value4;
|
2016-06-15 23:48:41 +02:00
|
|
|
|
2020-04-21 22:28:43 +02:00
|
|
|
virtual ReturnValue_t serialize(uint8_t** buffer, size_t* size,
|
|
|
|
size_t maxSize, Endianness streamEndianness) const {
|
2016-06-15 23:48:41 +02:00
|
|
|
|
|
|
|
ReturnValue_t result;
|
|
|
|
|
2020-04-21 21:34:03 +02:00
|
|
|
result = SerializeAdapter::serialize(&value1, buffer, size,
|
2020-04-21 22:28:43 +02:00
|
|
|
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(&value2, buffer, size,
|
2020-04-21 22:28:43 +02:00
|
|
|
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(&value3, buffer, size,
|
2020-04-21 22:28:43 +02:00
|
|
|
maxSize, streamEndianness);
|
2016-06-15 23:48:41 +02:00
|
|
|
|
2018-07-12 16:29:32 +02:00
|
|
|
if (result != HasReturnvaluesIF::RETURN_OK) {
|
|
|
|
return result;
|
|
|
|
}
|
|
|
|
|
2020-04-21 21:34:03 +02:00
|
|
|
result = SerializeAdapter::serialize(&value4, buffer, size,
|
2020-04-21 22:28:43 +02:00
|
|
|
maxSize, streamEndianness);
|
2018-07-12 16:29:32 +02:00
|
|
|
|
2016-06-15 23:48:41 +02:00
|
|
|
return result;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
2020-04-21 22:28:43 +02:00
|
|
|
virtual size_t getSerializedSize() const {
|
2018-07-12 16:29:32 +02:00
|
|
|
return sizeof(value1) + sizeof(value2) + sizeof(value3) + sizeof(value4);
|
2016-06-15 23:48:41 +02:00
|
|
|
}
|
|
|
|
|
2020-04-21 22:28:43 +02:00
|
|
|
virtual ReturnValue_t deSerialize(const uint8_t** buffer, size_t* size,
|
|
|
|
Endianness streamEndianness) {
|
2016-06-15 23:48:41 +02:00
|
|
|
ReturnValue_t result;
|
|
|
|
|
2020-04-21 21:34:03 +02:00
|
|
|
result = SerializeAdapter::deSerialize(&value1, buffer, size,
|
2020-04-21 22:28:43 +02:00
|
|
|
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(&value2, buffer, size,
|
2020-04-21 22:28:43 +02:00
|
|
|
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(&value3, buffer, size,
|
2020-04-21 22:28:43 +02:00
|
|
|
streamEndianness);
|
2016-06-15 23:48:41 +02:00
|
|
|
|
2018-07-12 16:29:32 +02:00
|
|
|
if (result != HasReturnvaluesIF::RETURN_OK) {
|
|
|
|
return result;
|
|
|
|
}
|
2020-04-21 21:34:03 +02:00
|
|
|
result = SerializeAdapter::deSerialize(&value4, buffer, size,
|
2020-04-21 22:28:43 +02:00
|
|
|
streamEndianness);
|
2018-07-12 16:29:32 +02:00
|
|
|
|
2016-06-15 23:48:41 +02:00
|
|
|
return result;
|
|
|
|
}
|
|
|
|
|
|
|
|
//for Sequences
|
|
|
|
Mode_t getTableId() const {
|
|
|
|
return value1;
|
|
|
|
}
|
|
|
|
|
|
|
|
void setTableId(Mode_t tableId) {
|
|
|
|
this->value1 = tableId;
|
|
|
|
}
|
|
|
|
|
|
|
|
uint8_t getWaitSeconds() const {
|
|
|
|
return value2;
|
|
|
|
}
|
|
|
|
|
|
|
|
void setWaitSeconds(uint8_t waitSeconds) {
|
|
|
|
this->value2 = waitSeconds;
|
|
|
|
}
|
|
|
|
|
|
|
|
bool checkSuccess() const {
|
|
|
|
return value3 == 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
void setCheckSuccess(bool checkSuccess) {
|
|
|
|
this->value3 = checkSuccess;
|
|
|
|
}
|
|
|
|
|
|
|
|
//for Tables
|
|
|
|
object_id_t getObject() const {
|
|
|
|
return value1;
|
|
|
|
}
|
|
|
|
|
|
|
|
void setObject(object_id_t object) {
|
|
|
|
this->value1 = object;
|
|
|
|
}
|
|
|
|
|
|
|
|
Mode_t getMode() const {
|
|
|
|
return value2;
|
|
|
|
}
|
|
|
|
|
|
|
|
void setMode(Mode_t mode) {
|
|
|
|
this->value2 = mode;
|
|
|
|
}
|
|
|
|
|
|
|
|
Submode_t getSubmode() const {
|
|
|
|
return value3;
|
|
|
|
}
|
|
|
|
|
|
|
|
void setSubmode(Submode_t submode) {
|
|
|
|
this->value3 = submode;
|
|
|
|
}
|
|
|
|
|
2018-07-12 16:29:32 +02:00
|
|
|
bool inheritSubmode() const {
|
|
|
|
return value4 == 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
void setInheritSubmode(bool inherit){
|
|
|
|
if (inherit){
|
|
|
|
value4 = 1;
|
|
|
|
} else {
|
|
|
|
value4 = 0;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2016-06-15 23:48:41 +02:00
|
|
|
bool operator==(ModeListEntry other) {
|
|
|
|
return ((value1 == other.value1) && (value2 == other.value2)
|
|
|
|
&& (value3 == other.value3));
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
#endif //MODEDEFINITIONS_H_
|