Add missing RDE definitions
In the previous commit, some RDE definitions were moved to this
repo from libbej repo but some definitions were missed.
This CL adds the missing definitions.
Signed-off-by: Kasun Athukorala <kasunath@google.com>
Change-Id: I00c63a5ccb02dc3dfe3018d343a633458ef23c14
diff --git a/include/rde/rde_handler.hpp b/include/rde/rde_handler.hpp
index 4b63790..59a8f0a 100644
--- a/include/rde/rde_handler.hpp
+++ b/include/rde/rde_handler.hpp
@@ -57,6 +57,25 @@
RdeStopFlagReceived,
};
+enum class RdeOperationInitType : uint8_t
+{
+ RdeOpInitOperationHead = 0,
+ RdeOpInitOperationRead = 1,
+ RdeOpInitOperationCreate = 2,
+ RdeOpInitOperationDelete = 3,
+ RdeOpInitOperationUpdate = 4,
+ RdeOpInitOperationReplace = 5,
+ RdeOpInitOperationAction = 6,
+};
+
+enum class RdeMultiReceiveTransferFlag : uint8_t
+{
+ RdeMRecFlagStart = 0,
+ RdeMRecFlagMiddle = 1,
+ RdeMRecFlagEnd = 2,
+ RdeMRecFlagStartAndEnd = 3,
+};
+
/**
* @brief RDEOperationInit response header.
*
diff --git a/src/rde/rde_handler.cpp b/src/rde/rde_handler.cpp
index e5100e2..d020b63 100644
--- a/src/rde/rde_handler.cpp
+++ b/src/rde/rde_handler.cpp
@@ -58,7 +58,8 @@
return RdeDecodeStatus::RdeOk;
}
- if (header->operationType != rdeOpInitOperationUpdate)
+ if (header->operationType !=
+ static_cast<uint8_t>(RdeOperationInitType::RdeOpInitOperationUpdate))
{
fmt::print(stderr, "Operation not supported\n");
return RdeDecodeStatus::RdeUnsupportedOperation;
@@ -135,16 +136,19 @@
switch (header->transferFlag)
{
- case rdeMRecFlagStart:
+ case static_cast<uint8_t>(
+ RdeMultiReceiveTransferFlag::RdeMRecFlagStart):
handleFlagStart(header, data, resourceId);
break;
- case rdeMRecFlagMiddle:
+ case static_cast<uint8_t>(
+ RdeMultiReceiveTransferFlag::RdeMRecFlagMiddle):
ret = handleFlagMiddle(header, data, resourceId);
break;
- case rdeMRecFlagEnd:
+ case static_cast<uint8_t>(RdeMultiReceiveTransferFlag::RdeMRecFlagEnd):
ret = handleFlagEnd(rdeCommand, header, data, resourceId);
break;
- case rdeMRecFlagStartAndEnd:
+ case static_cast<uint8_t>(
+ RdeMultiReceiveTransferFlag::RdeMRecFlagStartAndEnd):
ret = handleFlagStartAndEnd(rdeCommand, header, data, resourceId);
break;
default: