Continues migration with DDS, Common
This commit is contained in:
1 parent
9b15cee841
commit
fa48db111e
668 files changed
+111841
-2
No files matched your search
Executable
+47
@@ -0,0 +1,47 @@
|
||||
#include "topic_lock_master.h"
|
||||
|
||||
#include <DDS/DDSConnector/dds_connector.h>
|
||||
|
||||
namespace Core
|
||||
{
|
||||
|
||||
TopicLockMaster::TopicLockMaster(const std::shared_ptr<DDSConnector::DdsConnector> &ddsConnector)
|
||||
: QObject(nullptr)
|
||||
, m_coreDtc(nullptr)
|
||||
{
|
||||
init(ddsConnector);
|
||||
}
|
||||
|
||||
TopicLockMaster::~TopicLockMaster()
|
||||
{
|
||||
m_coreDtc.reset();
|
||||
}
|
||||
|
||||
bool TopicLockMaster::init(const std::shared_ptr<DDSConnector::DdsConnector> &ddsConnector)
|
||||
{
|
||||
if (!ddsConnector)
|
||||
return false;
|
||||
|
||||
m_coreDtc = Core::Interface::Dtc::create(ddsConnector);
|
||||
if (!m_coreDtc)
|
||||
return false;
|
||||
m_coreDtc->enableAll();
|
||||
|
||||
m_coreDtc->lockedEntitys([this] (const LockedEntity &data) {
|
||||
m_lockedEntitys << key(data.entityId(), data.exerciseId(), QString::fromStdString(data.entityTypeName()));
|
||||
});
|
||||
|
||||
connect(m_coreDtc.get(), &Interface::Dtc::lockedEntityChanged, this,
|
||||
[this] (const LockedEntity &data, DataModification modType)
|
||||
{
|
||||
key k(data.entityId(), data.exerciseId(), QString::fromStdString(data.entityTypeName()));
|
||||
if (modType == DataModification::eAdded)
|
||||
m_lockedEntitys << k;
|
||||
else if (modType == DataModification::eRemoved)
|
||||
m_lockedEntitys.remove(k);
|
||||
} );
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
||||
Reference in new issue
Block a user