diff --git a/ground/openpilotgcs/src/plugins/uavobjects/uavobject.cpp b/ground/openpilotgcs/src/plugins/uavobjects/uavobject.cpp index c68fbd517..df26259a5 100644 --- a/ground/openpilotgcs/src/plugins/uavobjects/uavobject.cpp +++ b/ground/openpilotgcs/src/plugins/uavobjects/uavobject.cpp @@ -63,6 +63,7 @@ UAVObject::UAVObject(quint32 objID, bool isSingleInst, const QString & name) this->data = 0; this->numBytes = 0; this->mutex = new QMutex(QMutex::Recursive); + m_isKnown = false; } /** @@ -603,6 +604,25 @@ void UAVObject::emitNewInstance(UAVObject *obj) emit newInstance(obj); } +bool UAVObject::isKnown() const +{ + QMutexLocker locker(mutex); + + return m_isKnown; +} + +void UAVObject::setIsKnown(bool isKnown) +{ + lock(); + bool changed = m_isKnown != isKnown; + m_isKnown = isKnown; + unlock(); + + if (changed) { + emit isKnownChanged(this, isKnown); + } +} + bool UAVObject::isSettingsObject() { return false; diff --git a/ground/openpilotgcs/src/plugins/uavobjects/uavobject.h b/ground/openpilotgcs/src/plugins/uavobjects/uavobject.h index 0bd0081a8..1ad0e7a5b 100644 --- a/ground/openpilotgcs/src/plugins/uavobjects/uavobject.h +++ b/ground/openpilotgcs/src/plugins/uavobjects/uavobject.h @@ -142,6 +142,9 @@ public: void emitTransactionCompleted(bool success); void emitNewInstance(UAVObject *); + bool isKnown() const; + void setIsKnown(bool isKnown); + virtual bool isSettingsObject(); virtual bool isDataObject(); virtual bool isMetaDataObject(); @@ -178,9 +181,7 @@ signals: void updateRequested(UAVObject *obj, bool all = false); void transactionCompleted(UAVObject *obj, bool success); void newInstance(UAVObject *obj); - -private slots: - void fieldUpdated(UAVObjectField *field); + void isKnownChanged(UAVObject *obj, bool isKnown); protected: quint32 objID; @@ -197,6 +198,12 @@ protected: void initializeFields(QList & fields, quint8 *data, quint32 numBytes); void setDescription(const QString & description); void setCategory(const QString & category); + +private: + bool m_isKnown; + +private slots: + void fieldUpdated(UAVObjectField *field); }; #endif // UAVOBJECT_H