|
@@ -5,6 +5,8 @@
|
|
#include <QtCore/QTextCodec>
|
|
#include <QtCore/QTextCodec>
|
|
#include <fstream>
|
|
#include <fstream>
|
|
|
|
|
|
|
|
+#define DEVICE_NODE "devices"
|
|
|
|
+
|
|
std::string loadContent(std::string szFilename)
|
|
std::string loadContent(std::string szFilename)
|
|
{
|
|
{
|
|
szFilename = QString::fromLocal8Bit(szFilename.c_str()).toLocal8Bit().toStdString();
|
|
szFilename = QString::fromLocal8Bit(szFilename.c_str()).toLocal8Bit().toStdString();
|
|
@@ -24,7 +26,7 @@ DeviceManagerProxy::DeviceManagerProxy(RedisAgent* redis)
|
|
|
|
|
|
bool DeviceManagerProxy::parse(QString cfg,AlarmRuler& ar)
|
|
bool DeviceManagerProxy::parse(QString cfg,AlarmRuler& ar)
|
|
{
|
|
{
|
|
- qDebug() << __FILE__ << __LINE__ << cfg;
|
|
|
|
|
|
+ //qDebug() << __FILE__ << __LINE__ << cfg;
|
|
|
|
|
|
//通过网页传来的 json内承运商中文名是 utf-8 编码
|
|
//通过网页传来的 json内承运商中文名是 utf-8 编码
|
|
QTextCodec *utf8 = QTextCodec::codecForName("UTF-8");
|
|
QTextCodec *utf8 = QTextCodec::codecForName("UTF-8");
|
|
@@ -64,15 +66,14 @@ bool DeviceManagerProxy::parse(QString cfg,AlarmRuler& ar)
|
|
return true;
|
|
return true;
|
|
}
|
|
}
|
|
|
|
|
|
-std::list<DeviceInfo> DeviceManagerProxy::loadDevices(std::string id,std::string app)
|
|
|
|
|
|
+DeviceInfo DeviceManagerProxy::loadDataAlarm(std::string id,std::string app)
|
|
{
|
|
{
|
|
- std::list<DeviceInfo> lstDevices;
|
|
|
|
|
|
+ DeviceInfo di;
|
|
if( m_pRedis != nullptr)
|
|
if( m_pRedis != nullptr)
|
|
{
|
|
{
|
|
- DeviceInfo di;
|
|
|
|
ModuleInfo mi;
|
|
ModuleInfo mi;
|
|
mi.Code = "alarm";
|
|
mi.Code = "alarm";
|
|
- mi.AssemblyName = "plugins/AlarmRecognition.dll";
|
|
|
|
|
|
+ mi.AssemblyName = app;
|
|
|
|
|
|
DataItem oDT;
|
|
DataItem oDT;
|
|
oDT.Code = "data";
|
|
oDT.Code = "data";
|
|
@@ -103,8 +104,45 @@ std::list<DeviceInfo> DeviceManagerProxy::loadDevices(std::string id,std::string
|
|
}
|
|
}
|
|
}
|
|
}
|
|
di.ModuleInfo = mi;
|
|
di.ModuleInfo = mi;
|
|
- lstDevices.push_back(di);
|
|
|
|
}
|
|
}
|
|
|
|
|
|
- return lstDevices;
|
|
|
|
|
|
+ return di;
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+DeviceInfo DeviceManagerProxy::loadCommAlarm(std::string id,std::string app)
|
|
|
|
+{
|
|
|
|
+ DeviceInfo di;
|
|
|
|
+ if( m_pRedis != nullptr)
|
|
|
|
+ {
|
|
|
|
+ ModuleInfo mi;
|
|
|
|
+ mi.Code = "alarm";
|
|
|
|
+ mi.AssemblyName = app;
|
|
|
|
+
|
|
|
|
+ DataItem oDT;
|
|
|
|
+ oDT.Code = "comm";
|
|
|
|
+ mi.Properties.push_back(oDT);
|
|
|
|
+ QHash<QString, QString> mps = m_pRedis->hgetall(id.c_str());
|
|
|
|
+ QHash<QString, QString>::iterator itr;
|
|
|
|
+ for( itr = mps.begin(); itr != mps.end(); ++itr)
|
|
|
|
+ {
|
|
|
|
+ if( itr.key().isEmpty() || itr.value().isEmpty() )
|
|
|
|
+ {
|
|
|
|
+ continue;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ if( itr.key().compare(DEVICE_NODE,Qt::CaseInsensitive) != 0 )
|
|
|
|
+ {
|
|
|
|
+ continue;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ Setting oSet;
|
|
|
|
+ oSet.Name = itr.key().toLocal8Bit().toStdString();
|
|
|
|
+ oSet.qValue = itr.value();
|
|
|
|
+ mi.vSettings.push_back(oSet);
|
|
|
|
+ break;
|
|
|
|
+ }
|
|
|
|
+ di.ModuleInfo = mi;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ return di;
|
|
}
|
|
}
|