#include "DataManagerProxy.h" #include "RedisClient.h" DataManagerProxy::DataManagerProxy() { } DataManagerInfo DataManagerProxy::loadModuleInfos(int id, std::string app) { /* DataItem objDataItem; objDataItem.Id = 1; objDataItem.Code = "CEJINGYI-001.TEMP"; objDataItem.DataName = "1号测径仪温度"; objDataItem.DataType = "Integer"; objDataItem.Description = "1号测径仪温度值"; objDataItem.Displayed = true; ModuleInfo objModule; objModule.Id = 1; objModule.Name = "Modbus000"; objModule.Model = "Modbus Com A0001"; objModule.Code = "Modbus000-1"; objModule.Type = ModuleType::Sensor; objModule.AssemblyName = "plugins/SampleTemperature.dll"; objModule.ClassName = "Lanpeng.Module.Sensors.Modbus001"; objModule.Version = "1.0"; DeviceInfo objDevice; objDevice.Id = 1; objDevice.Name = "测径仪温度传感器"; objDevice.Type = "传感器"; objDevice.Model = "Temperatur Sensor A001"; objDevice.Code = "ASCDSC001221S"; objDevice.Description = "aaaaa"; objDevice.ModuleInfo = objModule; objDevice.Properties.push_back(objDataItem); */ RedisClient* redis = new RedisClient(); /*DeviceInfo di; if( redis != nullptr) { ModuleInfo mi; mi.Code = "alarm"; mi.AssemblyName = app; DataItem oDT; oDT.Code = "data"; mi.Properties.push_back(oDT); QStringList lst = redis->hvals(id.c_str()); foreach (QString str, lst) { if( str.isEmpty() ) { continue; } AlarmRuler ar; if( parse(str,ar) ) { QString szJson; szJson += "{"; szJson += QString("\"Operator\":\"%1\",").arg(ar.Operator.c_str()); szJson += QString("\"Operator1\":%1,").arg(ar.dbOperator1); szJson += QString("\"Operator2\":%1,").arg(ar.dbOperator2); szJson += QString("\"KeepTimes\":%1").arg(ar.nKeepTimes); szJson += "}"; Setting oSet; oSet.Name = ar.NodeCode; oSet.qValue = szJson; mi.vSettings.push_back(oSet); } } di.ModuleInfo = mi; } return di; */ ModuleInfo mi; mi.Name = "RedisSubscriber"; mi.AssemblyName = "plugins/RedisSubscriber.dll"; mi.ClassName = "RedisSubscriber"; ConsumerInfo ci; ci.name = "TDengine"; ci.AssemblyName = "plugins/TDengine.dll"; ci.ClassName = "TDengine"; ci.SubscribeName = "RedisSubscriber"; DataManagerInfo listDataManageInfo; listDataManageInfo.consumers.push_back(ci); listDataManageInfo.modules.push_back(mi); return listDataManageInfo; }