25#include <QtCore/QString>
26#include <QtCore/QJsonObject>
27#include <QtCore/QJsonDocument>
28#include <QtCore/QByteArray>
30#include "comms/comms.h"
31#include "property/field.h"
32#include "ProtocolMessageBase.h"
41template <
typename TFieldBase>
42struct ExtraInfoMessageData :
public comms::field::String<TFieldBase>
46 using Base = comms::field::String<TFieldBase>;
48 auto& val = Base::value();
53 auto doc = QJsonDocument::fromJson(QByteArray(val.c_str(),
static_cast<int>(val.size())));
54 return doc.isObject();
58template <
typename TMsgBase>
59class ExtraInfoMessageImpl :
public
62 comms::option::NoIdImpl,
63 comms::option::FieldsImpl<std::tuple<ExtraInfoMessageData<typename TMsgBase::Field> > >,
64 comms::option::MsgType<ExtraInfoMessageImpl<TMsgBase> >
72template <
typename TMsgBase>
73class ExtraInfoMessage :
public
75 details::ExtraInfoMessageImpl<TMsgBase>,
76 ExtraInfoMessage<TMsgBase>
80 virtual ~ExtraInfoMessage() noexcept = default;
84 nameImpl()
const override
86 static const char* Str =
"Generic Extra Info Message";
91 virtual const QVariantList& extraTransportFieldsPropertiesImpl()
const override
93 static const QVariantList List;
97 virtual const QVariantList& fieldsPropertiesImpl()
const override
99 static const QVariantList Props = createFieldsProperties();
103 virtual QString idAsStringImpl()
const override
105 [[maybe_unused]]
static constexpr bool Must_not_be_called =
false;
106 assert(Must_not_be_called);
110 virtual void resetImpl()
override
112 [[maybe_unused]]
static constexpr bool Must_not_be_called =
false;
113 assert(Must_not_be_called);
118 [[maybe_unused]]
static constexpr bool Must_not_be_called =
false;
119 assert(Must_not_be_called);
125 static QVariantList createFieldsProperties()
129 property::field::String().serialisedHidden().asMap());