serialinfo.cpp 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503
  1. #include "serialinfo.h"
  2. SerialInfo::SerialInfo()
  3. {
  4. }
  5. void SerialInfo::on_startWork()
  6. {
  7. timer = new QTimer(this);
  8. connect(timer, &QTimer::timeout, this, &SerialInfo::on_Check_PDUStatus);
  9. timer->start(1000); // Start the timer
  10. }
  11. void SerialInfo::on_closeWork()
  12. {
  13. if(timer)timer->stop();
  14. deleteLater();
  15. }
  16. void SerialInfo::on_Check_PDUStatus()
  17. {
  18. //initPDUStatus();
  19. //轮询PDU信息
  20. char OrderArray[8];
  21. uint16_t crc=0;
  22. OrderArray[0]=0x01;
  23. OrderArray[1]=0x03;
  24. //查询设备类型及通道数
  25. OrderArray[2] = (_SWITCH_T_AC_TYPE_CHN_INFO >> 8) & 0xFF; // High byte
  26. OrderArray[3] = _SWITCH_T_AC_TYPE_CHN_INFO & 0xFF; // Low byte
  27. OrderArray[4]=0x00;
  28. OrderArray[5]=0x01;
  29. crc = crc16_ccitt(OrderArray, 6);
  30. OrderArray[6] = crc & 0xFF; // Low byte
  31. OrderArray[7] = (crc >> 8) & 0xFF; // High byte
  32. SendString=on_SendInfo(OrderArray,8);
  33. QThread::msleep(QUERYSTAMP);
  34. RecString=on_Rec_PDUStatus();
  35. on_Parse_PDUStatus(SendString,RecString,_SWITCH_T_AC_TYPE_CHN_INFO);
  36. //QThread::msleep(QUERYSTAMP);
  37. //查询L1信息
  38. OrderArray[2] = (_SWITCH_T_AC_IN_L1_INFO >> 8) & 0xFF; // High byte
  39. OrderArray[3] = _SWITCH_T_AC_IN_L1_INFO & 0xFF; // Low byte
  40. OrderArray[4]=0x00;
  41. OrderArray[5]=0x08;
  42. crc = crc16_ccitt(OrderArray, 6);
  43. OrderArray[6] = crc & 0xFF; // Low byte
  44. OrderArray[7] = (crc >> 8) & 0xFF; // High byte
  45. SendString=on_SendInfo(OrderArray,8);
  46. QThread::msleep(QUERYSTAMP);
  47. RecString=on_Rec_PDUStatus();
  48. on_Parse_PDUStatus(SendString,RecString,_SWITCH_T_AC_IN_L1_INFO);
  49. //QThread::msleep(QUERYSTAMP);
  50. //查询L2信息
  51. OrderArray[2] = (_SWITCH_T_AC_IN_L2_INFO >> 8) & 0xFF; // High byte
  52. OrderArray[3] = _SWITCH_T_AC_IN_L2_INFO & 0xFF; // Low byte
  53. OrderArray[4]=0x00;
  54. OrderArray[5]=0x08;
  55. crc = crc16_ccitt(OrderArray, 6);
  56. OrderArray[6] = crc & 0xFF; // Low byte
  57. OrderArray[7] = (crc >> 8) & 0xFF; // High byte
  58. SendString=on_SendInfo(OrderArray,8);
  59. QThread::msleep(QUERYSTAMP);
  60. RecString=on_Rec_PDUStatus();
  61. on_Parse_PDUStatus(SendString,RecString,_SWITCH_T_AC_IN_L2_INFO);
  62. //QThread::msleep(QUERYSTAMP);
  63. //查询L3信息
  64. OrderArray[2] = (_SWITCH_T_AC_IN_L3_INFO >> 8) & 0xFF; // High byte
  65. OrderArray[3] = _SWITCH_T_AC_IN_L3_INFO & 0xFF; // Low byte
  66. OrderArray[4]=0x00;
  67. OrderArray[5]=0x08;
  68. crc = crc16_ccitt(OrderArray, 6);
  69. OrderArray[6] = crc & 0xFF; // Low byte
  70. OrderArray[7] = (crc >> 8) & 0xFF; // High byte
  71. SendString=on_SendInfo(OrderArray,8);
  72. QThread::msleep(QUERYSTAMP);
  73. RecString=on_Rec_PDUStatus();
  74. on_Parse_PDUStatus(SendString,RecString,_SWITCH_T_AC_IN_L3_INFO);
  75. //QThread::msleep(QUERYSTAMP);
  76. //查询相信息
  77. for(int i=0;i<m_TotalCHTemp;i++)
  78. {
  79. OrderArray[2] = ((_SWITCH_T_AC_CH_PHASE_INFO + 30*i)>> 8) & 0xFF; // High byte
  80. OrderArray[3] = (_SWITCH_T_AC_CH_PHASE_INFO + 30*i) & 0xFF; // Low byte
  81. OrderArray[4]=0x00;
  82. OrderArray[5]=0x1E;
  83. crc = crc16_ccitt(OrderArray, 6);
  84. OrderArray[6] = crc & 0xFF; // Low byte
  85. OrderArray[7] = (crc >> 8) & 0xFF; // High byte
  86. SendString=on_SendInfo(OrderArray,8);
  87. QThread::msleep(QUERYSTAMP);
  88. RecString=on_Rec_PDUStatus();
  89. on_Parse_PDUStatus(SendString,RecString,(_SWITCH_T_AC_CH_PHASE_INFO + 30*i));
  90. //QThread::msleep(QUERYSTAMP);
  91. }
  92. //查询通道状态
  93. OrderArray[2] = (_SWITCH_T_AC_CH_STATUS >> 8) & 0xFF; // High byte
  94. OrderArray[3] = _SWITCH_T_AC_CH_STATUS & 0xFF; // Low byte
  95. OrderArray[4]=0x00;
  96. OrderArray[5]=0x0E;
  97. crc = crc16_ccitt(OrderArray, 6);
  98. OrderArray[6] = crc & 0xFF; // Low byte
  99. OrderArray[7] = (crc >> 8) & 0xFF; // High byte
  100. SendString=on_SendInfo(OrderArray,8);
  101. QThread::msleep(QUERYSTAMP);
  102. RecString=on_Rec_PDUStatus();
  103. on_Parse_PDUStatus(SendString,RecString,_SWITCH_T_AC_CH_STATUS);
  104. //QThread::msleep(QUERYSTAMP);
  105. //查询modbus传感器
  106. OrderArray[2] = (_SWITCH_T_AC_SENSOR_INFO >> 8) & 0xFF; // High byte
  107. OrderArray[3] = _SWITCH_T_AC_SENSOR_INFO & 0xFF; // Low byte
  108. OrderArray[4]=0x00;
  109. OrderArray[5]=0x10;
  110. crc = crc16_ccitt(OrderArray, 6);
  111. OrderArray[6] = crc & 0xFF; // Low byte
  112. OrderArray[7] = (crc >> 8) & 0xFF; // High byte
  113. SendString=on_SendInfo(OrderArray,8);
  114. QThread::msleep(QUERYSTAMP);
  115. RecString=on_Rec_PDUStatus();
  116. on_Parse_PDUStatus(SendString,RecString,_SWITCH_T_AC_SENSOR_INFO);
  117. //QThread::msleep(QUERYSTAMP);
  118. //查询干节点传感器
  119. OrderArray[2] =(_SWITCH_T_AC_SENSOR_INFO1 >> 8) & 0xFF; // High byte
  120. OrderArray[3] = _SWITCH_T_AC_SENSOR_INFO1 & 0xFF; // Low byte
  121. OrderArray[4]=0x00;
  122. OrderArray[5]=0x04;
  123. crc = crc16_ccitt(OrderArray, 6);
  124. OrderArray[6] = crc & 0xFF; // Low byte
  125. OrderArray[7] = (crc >> 8) & 0xFF; // High byte
  126. SendString=on_SendInfo(OrderArray,8);
  127. QThread::msleep(QUERYSTAMP);
  128. RecString=on_Rec_PDUStatus();
  129. on_Parse_PDUStatus(SendString,RecString,_SWITCH_T_AC_SENSOR_INFO1);
  130. //QThread::msleep(QUERYSTAMP);
  131. }
  132. void SerialInfo::on_Parse_PDUStatus(const QString &Sendstr,const QString &Recstr,uint16_t infoType)
  133. {
  134. if(Recstr=="") return;
  135. if(_SWITCH_T_AC_TYPE_CHN_INFO==infoType)
  136. {
  137. QVector<quint16> pRecVector=parseModbusResponse(Recstr,1);
  138. if(pRecVector.size()<1)
  139. {
  140. //m_TotalCHTemp =0;
  141. // m_PDUType =0;
  142. return;
  143. }
  144. m_TotalCHTemp = pRecVector[0] & 0xFF; // Low byte
  145. m_PDUType = (pRecVector[0] >> 8) & 0xFF; // High byte
  146. }
  147. else if(_SWITCH_T_AC_IN_L1_INFO==infoType)
  148. {
  149. QVector<quint16> pRecVector=parseModbusResponse(Recstr,8);
  150. if(pRecVector.size()<8)
  151. {
  152. m_PDUAllInfo.AllVoltage_L1 = 0;
  153. m_PDUAllInfo.AllCurrent_L1 = 0;
  154. m_PDUAllInfo.AllPower_L1 = 0;
  155. m_PDUAllInfo.AllConsumption_L1 = 0;
  156. return;
  157. }
  158. m_PDUAllInfo.AllVoltage_L1 = ((pRecVector[1] << 16) + pRecVector[0] )/1000.0f; // Low byte
  159. m_PDUAllInfo.AllCurrent_L1 = ((pRecVector[3] << 16) + pRecVector[2] )/1000.0f; // Low byte
  160. m_PDUAllInfo.AllPower_L1 = ((pRecVector[5] << 16) + pRecVector[4] )/1000.0f; // Low byte
  161. m_PDUAllInfo.AllConsumption_L1 = ((pRecVector[7] << 16)+ pRecVector[6])/1000.0f; // Low byte
  162. }
  163. else if(_SWITCH_T_AC_IN_L2_INFO==infoType)
  164. {
  165. QVector<quint16> pRecVector=parseModbusResponse(Recstr,8);
  166. if(pRecVector.size()<8)
  167. {
  168. m_PDUAllInfo.AllVoltage_L2 = 0;
  169. m_PDUAllInfo.AllCurrent_L2 = 0;
  170. m_PDUAllInfo.AllPower_L2 = 0;
  171. m_PDUAllInfo.AllConsumption_L2 = 0;
  172. return;
  173. }
  174. m_PDUAllInfo.AllVoltage_L2 = ((pRecVector[1] << 16) + pRecVector[0] )/1000.0f; // Low byte
  175. m_PDUAllInfo.AllCurrent_L2 = ((pRecVector[3] << 16) + pRecVector[2] )/1000.0f; // Low byte
  176. m_PDUAllInfo.AllPower_L2 = ((pRecVector[5] << 16) + pRecVector[4] )/1000.0f; // Low byte
  177. m_PDUAllInfo.AllConsumption_L2 = ((pRecVector[7] << 16)+ pRecVector[6])/1000.0f; // Low byte
  178. }
  179. else if(_SWITCH_T_AC_IN_L3_INFO==infoType)
  180. {
  181. QVector<quint16> pRecVector=parseModbusResponse(Recstr,8);
  182. if(pRecVector.size()<8)
  183. {
  184. m_PDUAllInfo.AllVoltage_L3 = 0;
  185. m_PDUAllInfo.AllCurrent_L3 = 0;
  186. m_PDUAllInfo.AllPower_L3 = 0;
  187. m_PDUAllInfo.AllConsumption_L3 = 0;
  188. return;
  189. }
  190. m_PDUAllInfo.AllVoltage_L3 = ((pRecVector[1] << 16) + pRecVector[0] )/1000.0f; // Low byte
  191. m_PDUAllInfo.AllCurrent_L3 = ((pRecVector[3] << 16) + pRecVector[2] )/1000.0f; // Low byte
  192. m_PDUAllInfo.AllPower_L3 = ((pRecVector[5] << 16) + pRecVector[4] )/1000.0f; // Low byte
  193. m_PDUAllInfo.AllConsumption_L3 = ((pRecVector[7] << 16)+ pRecVector[6])/1000.0f; // Low byte
  194. }
  195. else if(_SWITCH_T_AC_CH_STATUS==infoType)
  196. {
  197. QVector<quint16> pRecVector=parseModbusResponse(Recstr,14);
  198. if(pRecVector.size()<14)
  199. {
  200. for(int i=0;i<14;i++)
  201. {
  202. m_PDUCHInfo[i].CHStatus= false; // Low byte
  203. }
  204. return;
  205. }
  206. for(int i=0;i<14;i++)
  207. {
  208. m_PDUCHInfo[i].CHStatus=pRecVector[i] & 0xFFFF; // Low byte
  209. }
  210. }
  211. else if(_SWITCH_T_AC_SENSOR_INFO==infoType)
  212. {
  213. QVector<quint16> pRecVector=parseModbusResponse(Recstr,16);
  214. if(pRecVector.size()<16)
  215. {
  216. m_PDUAllInfo.Sensor_Temperature = 0;
  217. m_PDUAllInfo.Sensor_Humidity = 0;
  218. m_PDUAllInfo.Sensor_LeakFlag = false;
  219. m_PDUAllInfo.Sensor_INTemperature = 0;
  220. m_PDUAllInfo.Sensor_OUTTemperature = 0;
  221. return;
  222. }
  223. m_PDUAllInfo.Sensor_Temperature = ((pRecVector[1] << 16) + pRecVector[0] )/1000.0f;
  224. m_PDUAllInfo.Sensor_Humidity = ((pRecVector[3] << 16) + pRecVector[2] )/1000.0f;
  225. m_PDUAllInfo.Sensor_LeakFlag=((pRecVector[5] << 16) + pRecVector[4] );
  226. //m_PDUAllInfo.Sensor_CO2 = ((pRecVector[5] << 16) + pRecVector[4] )/1000.0f;
  227. m_PDUAllInfo.Sensor_INTemperature = ((pRecVector[9] << 16)+ pRecVector[8])/1000.0f;
  228. m_PDUAllInfo.Sensor_OUTTemperature = ((pRecVector[13] << 16)+ pRecVector[12])/1000.0f;
  229. }
  230. else if(_SWITCH_T_AC_SENSOR_INFO1==infoType)
  231. {
  232. QVector<quint16> pRecVector=parseModbusResponse(Recstr,4);
  233. if(pRecVector.size()<4)
  234. {
  235. m_PDUAllInfo.Sensor_WaterImmersion=false;
  236. return;
  237. }
  238. bool immFlag = pRecVector[0] & 0xFFFF; // Low byte
  239. m_PDUAllInfo.Sensor_WaterImmersion =!immFlag;
  240. }
  241. else
  242. {
  243. for(int i=0;i<m_TotalCHTemp;i++)
  244. {
  245. if((_SWITCH_T_AC_CH_PHASE_INFO+30*i)==infoType)
  246. {
  247. QVector<quint16> pRecVector=parseModbusResponse(Recstr,30);
  248. if(pRecVector.size()<30)
  249. {
  250. m_PDUCHInfo[i].CHVoltage=0;
  251. m_PDUCHInfo[i].CHCurrent=0;
  252. m_PDUCHInfo[i].CHPower=0;
  253. m_PDUCHInfo[i].CHConsumption=0;
  254. return;
  255. }
  256. // bool L1flag=pRecVector[8] & 0xFFFF; // Low byte
  257. //bool L2flag=pRecVector[18] & 0xFFFF; // Low byte
  258. //bool L3flag=pRecVector[28] & 0xFFFF; // Low byte
  259. float VL1=((pRecVector[1] << 16) + pRecVector[0] )/1000.0f;
  260. float IL1=((pRecVector[3] << 16) + pRecVector[2] )/1000.0f;
  261. float PL1=((pRecVector[5] << 16) + pRecVector[4] )/1000.0f;
  262. float CL1=((pRecVector[7] << 16) + pRecVector[6] )/1000.0f;
  263. float VL2=((pRecVector[11] << 16) + pRecVector[10] )/1000.0f;
  264. float IL2=((pRecVector[13] << 16) + pRecVector[12] )/1000.0f;
  265. float PL2=((pRecVector[15] << 16) + pRecVector[14] )/1000.0f;
  266. float CL2=((pRecVector[17] << 16) + pRecVector[16] )/1000.0f;
  267. float VL3=((pRecVector[21] << 16) + pRecVector[20] )/1000.0f;
  268. float IL3=((pRecVector[23] << 16) + pRecVector[22] )/1000.0f;
  269. float PL3=((pRecVector[25] << 16) + pRecVector[24] )/1000.0f;
  270. float CL3=((pRecVector[27] << 16) + pRecVector[26] )/1000.0f;
  271. if(VL1>=VL2 && VL1>=VL3)
  272. {
  273. m_PDUCHInfo[i].CHVoltage=VL1;
  274. m_PDUCHInfo[i].CHCurrent=IL1;
  275. m_PDUCHInfo[i].CHPower=PL1;
  276. m_PDUCHInfo[i].CHConsumption=CL1;
  277. }
  278. if(VL2>=VL1 && VL2>=VL3)
  279. {
  280. m_PDUCHInfo[i].CHVoltage=VL2;
  281. m_PDUCHInfo[i].CHCurrent=IL2;
  282. m_PDUCHInfo[i].CHPower=PL2;
  283. m_PDUCHInfo[i].CHConsumption=CL2;
  284. }
  285. if(VL3>=VL1 && VL3>=VL2)
  286. {
  287. m_PDUCHInfo[i].CHVoltage=VL3;
  288. m_PDUCHInfo[i].CHCurrent=IL3;
  289. m_PDUCHInfo[i].CHPower=PL3;
  290. m_PDUCHInfo[i].CHConsumption=CL3;
  291. }
  292. break;
  293. }
  294. }
  295. }
  296. if(m_printflag) emit addPDUInfo(Sendstr, Recstr);
  297. }
  298. /*发送数据*/
  299. QString SerialInfo::on_SendInfo(char* OrderArray,int sendsize)
  300. {
  301. if(!m_openflag) return "";
  302. QString hexString="";
  303. // 创建一个JNI环境并调用Java静态方法
  304. QAndroidJniEnvironment env;
  305. jbyteArray byteArray = env->NewByteArray(sendsize);
  306. env->SetByteArrayRegion(byteArray, 0, sendsize, reinterpret_cast<const jbyte*>(OrderArray));
  307. QAndroidJniObject sendbacktring = QAndroidJniObject::callStaticObjectMethod(
  308. "usb/USBListActivity",
  309. "writeData",
  310. "([B)Ljava/lang/String;", // 方法签名:接收字节数组并返回字符串
  311. byteArray // 参数
  312. );
  313. QString recsendinfo=sendbacktring.toString();
  314. // 发送字节计数并显示
  315. if(recsendinfo!="")
  316. {
  317. QByteArray byteArray = recsendinfo.toLatin1(); // 将 QString 转换为 QByteArray,使用 UTF-8 编码
  318. for (unsigned char byte : byteArray) {
  319. // 使用 printf 格式化输出或 qDebug() 输出每个字节的十六进制表示
  320. hexString += QString("%1 ").arg(static_cast<unsigned char>(byte), 2, 16, QChar('0'));
  321. }
  322. }
  323. return hexString;
  324. }
  325. QString SerialInfo::on_Rec_PDUStatus()
  326. {
  327. if(!m_openflag) return "";
  328. /*
  329. // 如接收成功,会返回接收的字符串,失败返回空字符串
  330. QString Allrecinfo="";
  331. for (int i=0;i<10;i++)
  332. {
  333. QAndroidJniObject recbacktring = QAndroidJniObject::callStaticObjectMethod(
  334. "usb/USBListActivity",
  335. "readData",
  336. "()Ljava/lang/String;");
  337. QString recinfo=recbacktring.toString();
  338. // 发送字节计数并显示
  339. if(recinfo!="")
  340. {
  341. QString hexString;
  342. QByteArray byteArray = recinfo.toLatin1(); // 将 QString 转换为 QByteArray,使用 UTF-8 编码
  343. for (char byte : byteArray) {
  344. // 使用 printf 格式化输出或 qDebug() 输出每个字节的十六进制表示
  345. hexString += QString("%1 ").arg(static_cast<unsigned char>(byte), 2, 16, QChar('0'));
  346. }
  347. Allrecinfo+=hexString;
  348. }
  349. else
  350. {
  351. break;
  352. }
  353. }
  354. return Allrecinfo;
  355. */
  356. // 如接收成功,会返回接收的字符串,失败返回空字符串
  357. QString Allrecinfo="";
  358. QAndroidJniObject recbacktring = QAndroidJniObject::callStaticObjectMethod(
  359. "usb/USBListActivity",
  360. "readData",
  361. "()Ljava/lang/String;");
  362. QString recinfo=recbacktring.toString();
  363. // 发送字节计数并显示
  364. if(recinfo!="")
  365. {
  366. QString hexString;
  367. QByteArray byteArray = recinfo.toLatin1(); // 将 QString 转换为 QByteArray,使用 UTF-8 编码
  368. for (char byte : byteArray) {
  369. // 使用 printf 格式化输出或 qDebug() 输出每个字节的十六进制表示
  370. hexString += QString("%1 ").arg(static_cast<unsigned char>(byte), 2, 16, QChar('0'));
  371. }
  372. Allrecinfo=hexString;
  373. }
  374. else
  375. {
  376. }
  377. return Allrecinfo;
  378. }
  379. uint16_t SerialInfo::crc16_ccitt(char* data, size_t length) {
  380. uint16_t crc = 0xFFFF;
  381. uint16_t i, j;
  382. for (i = 0; i < length; i++) {
  383. crc ^= data[i];
  384. for (j = 0; j < 8; j++) {
  385. if (crc & 0x0001) {
  386. crc >>= 1;
  387. crc ^= 0xA001;
  388. } else {
  389. crc >>= 1;
  390. }
  391. }
  392. }
  393. // data[7] = crc & 0xFF; // Low byte
  394. //data[6] = (crc >> 8) & 0xFF; // High byte
  395. return crc; // No final XOR value for CRC16-CCITT (XMODEM)
  396. }
  397. QVector<quint16> SerialInfo::parseModbusResponse(const QString &hexString, int registerCount) {
  398. QVector<quint16> registers;
  399. QString TempHexString=hexString;
  400. // Remove spaces from the input string for easier parsing
  401. QString cleanHexString = TempHexString.remove(QRegularExpression("\\s"));
  402. // Verify the length of the cleaned string matches what we expect
  403. if (cleanHexString.length() != (registerCount * 4 + 5 * 2)) { // +5*2 for the modubus 03 code head 3 byte +tail 2 byte = 5 byte
  404. qWarning() << "Invalid response length.";
  405. return registers; // Return empty vector on error
  406. }
  407. // Skip the first byte which is the byte count in a Modbus TCP response
  408. QTextStream stream(&cleanHexString);
  409. stream.skipWhiteSpace();
  410. stream.seek(6); // Skip the head byte count
  411. for (int i = 0; i < registerCount; ++i) {
  412. QString byteStr = stream.read(4); // Each register is represented by 4 hex chars (2 bytes)
  413. if (byteStr.length() != 4) {
  414. qWarning() << "Unexpected end of data at register" << i;
  415. break;
  416. }
  417. // Convert the 4 hex chars into a quint16 value
  418. bool ok1, ok2;
  419. quint8 byte1 = byteStr.left(2).toInt(&ok1, 16); // 前两位转换为整数
  420. quint8 byte2 = byteStr.right(2).toInt(&ok2, 16); // 后两位转换为整数
  421. quint16 regValue = (byte1 << 8) | byte2;
  422. registers.append(regValue);
  423. }
  424. return registers;
  425. }
  426. void SerialInfo::initPDUStatus()
  427. {
  428. /*
  429. m_PDUAllInfo.AllVoltage_L1 =0;
  430. m_PDUAllInfo.AllCurrent_L1=0;
  431. m_PDUAllInfo.AllPower_L1=0;
  432. m_PDUAllInfo.AllConsumption_L1=0;
  433. m_PDUAllInfo.AllVoltage_L2=0;
  434. m_PDUAllInfo.AllCurrent_L2=0;
  435. m_PDUAllInfo.AllPower_L2=0;
  436. m_PDUAllInfo.AllConsumption_L2=0;
  437. m_PDUAllInfo.AllVoltage_L3=0;
  438. m_PDUAllInfo.AllCurrent_L3=0;
  439. m_PDUAllInfo.AllPower_L3=0;
  440. m_PDUAllInfo.AllConsumption_L3=0;
  441. */
  442. m_PDUAllInfo.Sensor_Temperature=0;
  443. m_PDUAllInfo.Sensor_Humidity=0;
  444. m_PDUAllInfo.Sensor_CO2=0;
  445. m_PDUAllInfo.Sensor_INTemperature=0;
  446. m_PDUAllInfo.Sensor_OUTTemperature=0;
  447. m_PDUAllInfo.Sensor_WaterImmersion=false;
  448. }