|
@@ -2,33 +2,25 @@
|
|
#include <QVariant>
|
|
#include <QVariant>
|
|
#include "LibraryLoader.h"
|
|
#include "LibraryLoader.h"
|
|
#include "Publisher.h"
|
|
#include "Publisher.h"
|
|
-
|
|
|
|
|
|
+#include <QDebug>
|
|
DataSubscribe::DataSubscribe()
|
|
DataSubscribe::DataSubscribe()
|
|
{
|
|
{
|
|
-
|
|
|
|
|
|
+ //shares = new SharedData();
|
|
}
|
|
}
|
|
|
|
|
|
-
|
|
|
|
-
|
|
|
|
-void DataSubscribe::run()
|
|
|
|
|
|
+DataSubscribe::~DataSubscribe()
|
|
{
|
|
{
|
|
- while(!isInterruptionRequested()){
|
|
|
|
- if(shares.sem->tryAcquire(1, 500)){
|
|
|
|
- shares.mutex->lock();
|
|
|
|
- shares.commandList.dequeue();
|
|
|
|
- shares.mutex->unlock();
|
|
|
|
- dataConsumer->OnData(QString(dataName.c_str()), "time", QVariant());
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
|
|
+ //delete shares;
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+
|
|
void DataSubscribe::Setup(ModuleInfo &mi)
|
|
void DataSubscribe::Setup(ModuleInfo &mi)
|
|
{
|
|
{
|
|
std::string assemblyName = mi.AssemblyName;
|
|
std::string assemblyName = mi.AssemblyName;
|
|
std::string className = mi.ClassName;
|
|
std::string className = mi.ClassName;
|
|
-
|
|
|
|
- BaseModule* pModule = nullptr;// = (BaseModule)Assembly.LoadFile(Path.GetFullPath(@".\" + assemblyName)).CreateInstance(className);
|
|
|
|
- pModule = LibraryLoader::load<BaseModule>(assemblyName);
|
|
|
|
|
|
+ dataName = className;
|
|
|
|
+ Publisher* pModule = nullptr;// = (BaseModule)Assembly.LoadFile(Path.GetFullPath(@".\" + assemblyName)).CreateInstance(className);
|
|
|
|
+ pModule = LibraryLoader::load<Publisher>(assemblyName);
|
|
if( pModule == nullptr )
|
|
if( pModule == nullptr )
|
|
{
|
|
{
|
|
// qCritical() << LOG_HEADER << " load " << szPlugin.c_str() << " failed.";
|
|
// qCritical() << LOG_HEADER << " load " << szPlugin.c_str() << " failed.";
|
|
@@ -43,7 +35,8 @@ void DataSubscribe::Setup(ModuleInfo &mi)
|
|
|
|
|
|
{
|
|
{
|
|
Publisher* runable = dynamic_cast<Publisher*>(pModule);
|
|
Publisher* runable = dynamic_cast<Publisher*>(pModule);
|
|
- runable->shares(shares);
|
|
|
|
|
|
+ //runable->shares(shares);
|
|
|
|
+ connect(runable, SIGNAL(pubData(const QString& ,const QString& ,const QVariant& )), dataConsumer, SLOT(OnData(const QString& ,const QString& ,const QVariant&)));
|
|
runable->Run();
|
|
runable->Run();
|
|
}
|
|
}
|
|
}
|
|
}
|
|
@@ -55,20 +48,19 @@ std::string DataSubscribe::getTypeList()
|
|
return "DataStorage::RunnableModule";
|
|
return "DataStorage::RunnableModule";
|
|
}
|
|
}
|
|
|
|
|
|
-void DataSubscribe::setLoader(QLibrary *)
|
|
|
|
-{
|
|
|
|
|
|
+// void DataSubscribe::setLoader(QLibrary *)
|
|
|
|
+// {
|
|
|
|
|
|
-}
|
|
|
|
|
|
+// }
|
|
|
|
|
|
void DataSubscribe::regConsumer(DataConsumer *dc)
|
|
void DataSubscribe::regConsumer(DataConsumer *dc)
|
|
{
|
|
{
|
|
dataConsumer = dc;
|
|
dataConsumer = dc;
|
|
|
|
+ qDebug() << "register consumer";
|
|
}
|
|
}
|
|
|
|
|
|
-void DataSubscribe::Run()
|
|
|
|
-{
|
|
|
|
- start();
|
|
|
|
-}
|
|
|
|
|
|
+
|
|
|
|
+
|
|
|
|
|
|
|
|
|
|
|
|
|