41 #include <QJsonObject>
50 #define PACK(__Declaration__) __pragma(pack(push, 1)) __Declaration__ __pragma(pack(pop))
52 #define PACK(__Declaration__) __Declaration__ __attribute__((__packed__))
55 #define UAVOBJ_ACCESS_SHIFT 0
56 #define UAVOBJ_GCS_ACCESS_SHIFT 1
57 #define UAVOBJ_TELEMETRY_ACKED_SHIFT 2
58 #define UAVOBJ_GCS_TELEMETRY_ACKED_SHIFT 3
59 #define UAVOBJ_TELEMETRY_UPDATE_MODE_SHIFT 4
60 #define UAVOBJ_GCS_TELEMETRY_UPDATE_MODE_SHIFT 6
61 #define UAVOBJ_UPDATE_MODE_MASK 0x3
74 UPDATEMODE_MANUAL = 0,
75 UPDATEMODE_PERIODIC = 1,
76 UPDATEMODE_ONCHANGE = 2,
77 UPDATEMODE_THROTTLED =
84 typedef enum { ACCESS_READWRITE = 0, ACCESS_READONLY = 1 } AccessMode;
111 quint16 flightTelemetryUpdatePeriod;
113 quint16 gcsTelemetryUpdatePeriod;
115 quint16 loggingUpdatePeriod;
120 UAVObject(quint32 objID,
bool isSingleInst,
const QString &name);
121 void initialize(quint32 instID);
124 bool isSingleInstance();
126 QString getDescription();
127 quint32 getNumBytes();
128 qint32 pack(quint8 *dataOut);
129 qint32 unpack(
const quint8 *dataIn);
130 virtual void setMetadata(
const Metadata &mdata) = 0;
131 virtual Metadata getMetadata() = 0;
133 qint32 getNumFields();
137 QString toStringBrief();
138 QString toStringData();
139 QJsonObject getJsonRepresentation();
140 void emitTransactionCompleted(
bool success);
141 void emitTransactionCompleted(
bool success,
bool nacked);
146 static void MetadataInitialize(Metadata &meta);
147 static AccessMode GetFlightAccess(
const Metadata &meta);
148 static void SetFlightAccess(Metadata &meta, AccessMode mode);
149 static AccessMode GetGcsAccess(
const Metadata &meta);
150 static void SetGcsAccess(Metadata &meta, AccessMode mode);
151 static quint8 GetFlightTelemetryAcked(
const Metadata &meta);
152 static void SetFlightTelemetryAcked(Metadata &meta, quint8 val);
153 static quint8 GetGcsTelemetryAcked(
const Metadata &meta);
154 static void SetGcsTelemetryAcked(Metadata &meta, quint8 val);
155 static UpdateMode GetFlightTelemetryUpdateMode(
const Metadata &meta);
156 static void SetFlightTelemetryUpdateMode(Metadata &meta, UpdateMode val);
157 static UpdateMode GetGcsTelemetryUpdateMode(
const Metadata &meta);
158 static void SetGcsTelemetryUpdateMode(Metadata &meta, UpdateMode val);
161 void requestUpdate();
162 void requestUpdateAllInstances();
194 void objectUpdatedManual(
UAVObject *obj);
200 void objectUpdatedPeriodic(
UAVObject *obj);
219 void updateAllInstancesRequested(
UAVObject *obj);
227 void transactionCompleted(
UAVObject *obj,
bool success);
228 void transactionCompleted(
UAVObject *obj,
bool success,
bool nack);
255 void setDescription(
const QString &description);
258 #endif // UAVOBJECT_H
Metadata getDefaultMetadata()
QList< UAVObjectField * > fields
PACK(typedef struct{uint VTOLMotorN:4;uint VTOLMotorS:4;uint VTOLMotorE:4;uint VTOLMotorW:4;uint VTOLMotorNW:4;uint VTOLMotorNE:4;uint VTOLMotorSW:4;uint VTOLMotorSE:4;uint TRIYaw:4;quint32 padding:28;quint32 padding1;quint32 padding2;}) multiGUISettingsStruct