Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/Duet3D/RepRapFirmware.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'src/ObjectModel/ObjectModel.cpp')
-rw-r--r--src/ObjectModel/ObjectModel.cpp17
1 files changed, 17 insertions, 0 deletions
diff --git a/src/ObjectModel/ObjectModel.cpp b/src/ObjectModel/ObjectModel.cpp
index 7628ed0a..8e3d4f72 100644
--- a/src/ObjectModel/ObjectModel.cpp
+++ b/src/ObjectModel/ObjectModel.cpp
@@ -14,6 +14,10 @@
#include <cstring>
#include <General/SafeStrtod.h>
+ExpressionValue::ExpressionValue(const MacAddress& mac) noexcept : type(TYPE_OF(MacAddress)), param(mac.HighWord()), uVal(mac.LowWord())
+{
+}
+
void ObjectExplorationContext::AddIndex(int32_t index)
{
if (numIndicesCounted == MaxIndices)
@@ -425,6 +429,12 @@ void ObjectModel::ReportItemAsJson(OutputBuffer *buf, ObjectExplorationContext&
#endif
break;
+ case TYPE_OF(MacAddress):
+ buf->catf("%02x:%02x:%02x:%02x:%02x:%02x",
+ (unsigned int)(val.uVal & 0xFF), (unsigned int)((val.uVal >> 8) & 0xFF), (unsigned int)((val.uVal >> 16) & 0xFF), (unsigned int)((val.uVal >> 24) & 0xFF),
+ (unsigned int)(val.param & 0xFF), (unsigned int)((val.param >> 8) & 0xFF));
+ break;
+
case NoType:
buf->cat("null");
break;
@@ -656,6 +666,13 @@ ExpressionValue ObjectModel::GetObjectValue(const StringParser& sp, ObjectExplor
}
return ExpressionValue((int32_t)val.uVal);
+ case TYPE_OF(MacAddress):
+ if (*idString == 0)
+ {
+ return (context.WantArrayLength()) ? ExpressionValue((int32_t)17) : val;
+ }
+ break;
+
case TYPE_OF(const char*):
if (*idString == 0 && context.WantArrayLength())
{