Compare commits
65 Commits
fix-lost
...
4e15ffff06
| Author | SHA1 | Date | |
|---|---|---|---|
| 4e15ffff06 | |||
| fbbb96a64a | |||
| 987dba34dc | |||
| a43afb15c5 | |||
| c494225b38 | |||
| 35231baae7 | |||
| caf3c308c1 | |||
| 5616d9096a | |||
| a6127f0d28 | |||
| 4fe8aee149 | |||
| e997c88d82 | |||
| b976795573 | |||
| 1b00804522 | |||
| 0f16968452 | |||
| db8aa8c07d | |||
| 169aa9b34a | |||
| 825315440d | |||
| 016caeb07c | |||
| 7183cc1673 | |||
| cc5d5e2f81 | |||
| 0638b1dbf8 | |||
| 6056ea167a | |||
| 729a6b8fda | |||
| c301de5aab | |||
| 03a1ae4583 | |||
| f27d208959 | |||
| a298ff847a | |||
| e434f66986 | |||
| 58ffb3a6aa | |||
| 5d20597993 | |||
| 124df41911 | |||
| 2ef5b69dd8 | |||
| 8dd6b1f0ea | |||
| d526ffe415 | |||
| 374dd3e7b0 | |||
| 1e2dcf76a0 | |||
| 9dc138a617 | |||
| 869189d18e | |||
| 722512fad6 | |||
| bf805e1238 | |||
| f4c74c7d67 | |||
| 24fc98407f | |||
| 0af8d02bb2 | |||
| 077c3f45a2 | |||
| 13e0bc18b3 | |||
| e0b2c6d356 | |||
| f310cb49a3 | |||
| 16ccb567d0 | |||
| 83986c35cb | |||
| ee6d9c2689 | |||
| afc079465e | |||
| 81667f3b0d | |||
| 5539c10c0d | |||
| 0eab1e6fb5 | |||
| 868de7a909 | |||
| 78938827f7 | |||
| cc9d651b5a | |||
| fff1312c6e | |||
| 95cd3049a7 | |||
| 900569e5de | |||
| 8e4e45ce31 | |||
| 3fb8ac84f5 | |||
| b1963098eb | |||
| 7cfcdd0c5a | |||
| 3ae8ba5900 |
3
.vscode/settings.json
vendored
3
.vscode/settings.json
vendored
@@ -128,5 +128,6 @@
|
||||
"typeinfo": "cpp",
|
||||
"valarray": "cpp",
|
||||
"variant": "cpp"
|
||||
}
|
||||
},
|
||||
"cmake.sourceDirectory": "D:/canneng/云前置移植项目/zw/Linux_Front1056/LFtid1056/lib/libuv-v1.51.0"
|
||||
}
|
||||
BIN
LFtid1056.rar
Normal file
BIN
LFtid1056.rar
Normal file
Binary file not shown.
@@ -147,7 +147,6 @@
|
||||
<ClInclude Include="cloudfront\code\log4cplus\internal\internal.h" />
|
||||
<ClInclude Include="cloudfront\code\log4cplus\internal\socket.h" />
|
||||
<ClInclude Include="cloudfront\code\log4cplus\layout.h" />
|
||||
<ClInclude Include="cloudfront\code\log4cplus\log4.h" />
|
||||
<ClInclude Include="cloudfront\code\log4cplus\log4cplus.h" />
|
||||
<ClInclude Include="cloudfront\code\log4cplus\log4judpappender.h" />
|
||||
<ClInclude Include="cloudfront\code\log4cplus\logger.h" />
|
||||
|
||||
@@ -169,9 +169,6 @@
|
||||
<ClInclude Include="cloudfront\code\nlohmann\thirdparty\hedley\hedley_undef.hpp">
|
||||
<Filter>cloudfront\code\nlohmann\thirdparty\hedley</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="cloudfront\code\log4cplus\log4.h">
|
||||
<Filter>cloudfront\code\log4cplus</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="cloudfront\code\log4cplus\logger.h">
|
||||
<Filter>cloudfront\code\log4cplus</Filter>
|
||||
</ClInclude>
|
||||
|
||||
@@ -7,6 +7,8 @@
|
||||
#include <cctype>
|
||||
#include <cstdlib>
|
||||
#include "client2.h"
|
||||
#include <iostream>
|
||||
|
||||
// <20><><EFBFBD><EFBFBD>ת<EFBFBD><D7AA><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
float IntToFloat(int num) {
|
||||
return static_cast<float>(num) / 65536.0f;
|
||||
@@ -23,8 +25,71 @@ float ShorToFloat1000(short num) {
|
||||
float ShorToFloat10000(short num) {
|
||||
return static_cast<float>(num) / 10000.0f;
|
||||
}
|
||||
|
||||
// <20>ֽ<EFBFBD><D6BD><EFBFBD>ת<EFBFBD><D7AA><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
void ReversalBuff(uint8_t* buff, int start, int length) {
|
||||
for (int i = 0; i < length / 2; i++) {
|
||||
std::swap(buff[start + i], buff[start + length - 1 - i]);
|
||||
}
|
||||
}
|
||||
|
||||
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>MAC<41><43>ַ<EFBFBD><D6B7><EFBFBD><EFBFBD><EFBFBD>䵽<EFBFBD><E4B5BD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
void GetMAC(const std::string& strMAC, std::vector<unsigned char>& packet, size_t startIndex) {
|
||||
//lnk20250808
|
||||
static inline int hex_nibble(char c) {
|
||||
if (c >= '0' && c <= '9') return c - '0';
|
||||
c = static_cast<char>(std::tolower(static_cast<unsigned char>(c)));
|
||||
if (c >= 'a' && c <= 'f') return 10 + (c - 'a');
|
||||
return -1;
|
||||
}
|
||||
|
||||
// <20><>ȫ<EFBFBD>棺<EFBFBD><E6A3BA><EFBFBD><EFBFBD><EFBFBD>쳣<EFBFBD><ECB3A3><EFBFBD><EFBFBD><EFBFBD><EFBFBD> true/false
|
||||
bool GetMAC(const std::string& strMAC,
|
||||
std::vector<unsigned char>& packet,
|
||||
size_t startIndex,
|
||||
std::string* err = nullptr) {
|
||||
// 1) <20>淶<EFBFBD><E6B7B6><EFBFBD><EFBFBD>ȥ<EFBFBD><C8A5> '-', ':', ' '
|
||||
std::string s;
|
||||
s.reserve(strMAC.size());
|
||||
for (char c : strMAC) {
|
||||
if (c == '-' || c == ':' || c == ' ') continue;
|
||||
s.push_back(c);
|
||||
}
|
||||
|
||||
// 2) <20><><EFBFBD><EFBFBD>У<EFBFBD><D0A3>
|
||||
if (s.size() != 12) {
|
||||
if (err) *err = "MAC<EFBFBD><EFBFBD><EFBFBD>ȱ<EFBFBD><EFBFBD><EFBFBD>Ϊ12<EFBFBD><EFBFBD>ʮ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ַ<EFBFBD>";
|
||||
return false;
|
||||
}
|
||||
|
||||
// 3) ʮ<><CAAE><EFBFBD><EFBFBD><EFBFBD><EFBFBD>У<EFBFBD><D0A3> + <20><><EFBFBD><EFBFBD>
|
||||
std::array<unsigned char, 6> mac{};
|
||||
for (int i = 0; i < 6; ++i) {
|
||||
int hi = hex_nibble(s[2*i]);
|
||||
int lo = hex_nibble(s[2*i + 1]);
|
||||
if (hi < 0 || lo < 0) {
|
||||
if (err) *err = "MAC<EFBFBD><EFBFBD><EFBFBD>Ƿ<EFBFBD><EFBFBD>ַ<EFBFBD>(<28><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>0-9<><39>A-F)";
|
||||
return false;
|
||||
}
|
||||
mac[i] = static_cast<unsigned char>((hi << 4) | lo);
|
||||
}
|
||||
|
||||
// 4) ȷ<><C8B7><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>㹻д<E3B9BB><D0B4>64<36>ֽڣ<D6BD>MAC 6<>ֽ<EFBFBD> + <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>㣩
|
||||
const size_t need = startIndex + 64;
|
||||
if (packet.size() < need) packet.resize(need, 0);
|
||||
|
||||
// 5) д<><D0B4>MAC
|
||||
for (int i = 0; i < 6; ++i) {
|
||||
packet[startIndex + i] = mac[i];
|
||||
}
|
||||
|
||||
// 6) <20><><EFBFBD><EFBFBD>λ<EFBFBD>ò<EFBFBD><C3B2>㣨<EFBFBD><E3A3A8> resize <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>0<EFBFBD><30><EFBFBD><EFBFBD><EFBFBD><EFBFBD>֤һ<D6A4>£<EFBFBD>
|
||||
for (size_t i = 6; i < 64; ++i) {
|
||||
packet[startIndex + i] = 0;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
/*void GetMAC(const std::string& strMAC, std::vector<unsigned char>& packet, size_t startIndex) {
|
||||
// <20>Ƴ<EFBFBD><C6B3><EFBFBD><EFBFBD>пո<D0BF><D5B8>Ͷ̺<CDB6><CCBA><EFBFBD>
|
||||
std::string cleanedMAC = strMAC;
|
||||
cleanedMAC.erase(std::remove(cleanedMAC.begin(), cleanedMAC.end(), ' '), cleanedMAC.end());
|
||||
@@ -62,7 +127,7 @@ void GetMAC(const std::string& strMAC, std::vector<unsigned char>& packet, size_
|
||||
catch (const std::exception& e) {
|
||||
throw std::invalid_argument("<22><>Ч<EFBFBD><D0A7>MAC<41><43>ַ: " + std::string(e.what()));
|
||||
}
|
||||
}
|
||||
}*/
|
||||
|
||||
// CRC<52><43><EFBFBD>㺯<EFBFBD><E3BAAF>
|
||||
unsigned char GetCrcSum(const std::vector<unsigned char>& Check, int nOffset, int nLen) {
|
||||
@@ -76,6 +141,139 @@ unsigned char GetCrcSum(const std::vector<unsigned char>& Check, int nOffset, in
|
||||
return reg_b;
|
||||
}
|
||||
|
||||
// ʱ<><CAB1>ת<EFBFBD><D7AA><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>TagMsTime -> <20><><EFBFBD><EFBFBD>ʱ<EFBFBD><CAB1><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
uint64_t convertTagMsTimeToMsTimestamp(const TagMsTime& t) {
|
||||
struct tm tm_time = {};
|
||||
tm_time.tm_year = t.Year - 1900;
|
||||
tm_time.tm_mon = t.Month - 1;
|
||||
tm_time.tm_mday = t.Day;
|
||||
tm_time.tm_hour = t.Hour;
|
||||
tm_time.tm_min = t.Min;
|
||||
tm_time.tm_sec = t.Sec;
|
||||
tm_time.tm_isdst = -1; // <20>Զ<EFBFBD><D4B6>ж<EFBFBD><D0B6><EFBFBD><EFBFBD><EFBFBD>ʱ
|
||||
|
||||
// ת<><D7AA>Ϊʱ<CEAA><CAB1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>룩
|
||||
time_t seconds = mktime(&tm_time);
|
||||
if (seconds == -1) return 0;
|
||||
|
||||
// <20><><EFBFBD>Ϻ<EFBFBD><CFBA><EFBFBD>
|
||||
return static_cast<uint64_t>(seconds) * 1000 + t.Ms;
|
||||
}
|
||||
|
||||
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>־<EFBFBD><D6BE><EFBFBD><EFBFBD>QVVRRecord
|
||||
QVVRRecord DynamicLog_GetQVVRRecordFromLogBuffer(
|
||||
const std::string& strScale,
|
||||
uint32_t nPTType,
|
||||
float fPT,
|
||||
const NewTaglogbuffer& log) {
|
||||
|
||||
QVVRRecord record;
|
||||
|
||||
try {
|
||||
// ת<><D7AA>ʱ<EFBFBD><CAB1>
|
||||
record.triggerTimeMs = convertTagMsTimeToMsTimestamp(log.head.Devtime);
|
||||
|
||||
// <20><>ȡ<EFBFBD><C8A1><EFBFBD><EFBFBD>
|
||||
float fParam1 = 0.0f; // <20><><EFBFBD><EFBFBD>ʱ<EFBFBD><CAB1>
|
||||
float fParam2 = 0.0f; // <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ֵ
|
||||
float fParam3 = 0.0f; // <20><><EFBFBD><EFBFBD><EFBFBD>ż<EFBFBD>ֵ
|
||||
|
||||
for (const auto& body : log.bodyList) {
|
||||
switch (body.ParaCode) {
|
||||
case 0: // <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ֵ<EFBFBD><D6B5><EFBFBD><EFBFBD>̬<EFBFBD><CCAC><EFBFBD><EFBFBD>ʹ<EFBFBD>ã<EFBFBD>
|
||||
fParam2 = static_cast<float>(body.ParaValue) / 65536.0f;
|
||||
break;
|
||||
case 1: // <20><><EFBFBD><EFBFBD>ʱ<EFBFBD><CAB1>(˲̬<CBB2><CCAC><EFBFBD><EFBFBD>̬<EFBFBD><CCAC><EFBFBD><EFBFBD>)
|
||||
fParam1 = static_cast<float>(body.ParaValue) / 65536.0f;
|
||||
break;
|
||||
case 25: // <20><><EFBFBD><EFBFBD><EFBFBD>ż<EFBFBD>ֵ(˲̬<CBB2><CCAC><EFBFBD><EFBFBD>̬<EFBFBD><CCAC><EFBFBD><EFBFBD>)
|
||||
fParam3 = static_cast<float>(body.ParaValue) / 65536.0f;
|
||||
break;
|
||||
case 3: //<2F><>ѹ<EFBFBD><D1B9><EFBFBD>ȣ<EFBFBD>˲̬<CBB2><CCAC><EFBFBD><EFBFBD>ʹ<EFBFBD>ã<EFBFBD>
|
||||
record.fMagntitude = (static_cast<float>(body.ParaValue) / 65536.0f) / 100.0f;
|
||||
break;
|
||||
case 5: //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>˲̬<CBB2><CCAC><EFBFBD><EFBFBD>ʹ<EFBFBD>ã<EFBFBD>
|
||||
record.phase = static_cast<float>(body.ParaValue) / 65536.0f;
|
||||
break;
|
||||
case 6: //˲<><CBB2><EFBFBD><EFBFBD><EFBFBD>ȣ<EFBFBD>˲̬<CBB2><CCAC><EFBFBD><EFBFBD>ʹ<EFBFBD>ã<EFBFBD>
|
||||
record.transientValue = (static_cast<float>(body.ParaValue) / 65536.0f) / 100.0f;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
record.fPersisstime = fParam1;
|
||||
|
||||
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ֵfBase
|
||||
float fBase = 0.0f;
|
||||
if (fParam3 < 50.0f) { // δ<><CEB4><EFBFBD><EFBFBD><CDB8><EFBFBD><EFBFBD>ż<EFBFBD>
|
||||
if (fPT != 1.0f) { // <20><><EFBFBD>Ȳ<EFBFBD>Ϊ1
|
||||
fBase = (nPTType == 0) ? 57.74f : 100.0f;
|
||||
}
|
||||
else {
|
||||
std::string strTemp = strScale;
|
||||
std::transform(strTemp.begin(), strTemp.end(), strTemp.begin(), ::tolower);
|
||||
size_t pos = strTemp.find('k');
|
||||
if (pos != std::string::npos) {
|
||||
std::string numPart = strTemp.substr(0, pos);
|
||||
try {
|
||||
float fTemp = std::stof(numPart) * 1000.0f;
|
||||
fBase = (nPTType == 0) ? (fTemp / std::sqrt(3.0f)) : fTemp;
|
||||
}
|
||||
catch (...) {
|
||||
fBase = (nPTType == 0) ? 57.74f : 100.0f;
|
||||
}
|
||||
}
|
||||
else {
|
||||
fBase = (nPTType == 0) ? 57.74f : 100.0f;
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
fBase = fParam3; // ʹ<>ø<EFBFBD><C3B8><EFBFBD><EFBFBD>ż<EFBFBD>ֵ
|
||||
}
|
||||
|
||||
// <20><><EFBFBD><EFBFBD><EFBFBD>¼<EFBFBD><C2BC><EFBFBD><EFBFBD><EFBFBD>
|
||||
switch (log.head.LogCode) {
|
||||
case 0: case 26: case 40: case 54: case 68: case 82:
|
||||
record.nType = 3;
|
||||
break;
|
||||
case 1: case 27: case 41: case 55: case 69: case 83:
|
||||
record.nType = 1;
|
||||
break;
|
||||
case 13: case 36: case 50: case 64: case 78: case 92:
|
||||
record.nType = 2;
|
||||
break;
|
||||
case 24:
|
||||
// <20>ֶ<EFBFBD><D6B6><EFBFBD><EFBFBD><EFBFBD>¼<EFBFBD><C2BC><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ĭ<EFBFBD><C4AC><EFBFBD><EFBFBD><EFBFBD><EFBFBD>0
|
||||
break;
|
||||
case 100:
|
||||
record.nType = 1; // ģ<><C4A3><EFBFBD><EFBFBD>ѹ<EFBFBD>ݽ<EFBFBD>
|
||||
break;
|
||||
case 3:
|
||||
record.nType = 4; // ˲̬<CBB2>¼<EFBFBD>
|
||||
default:
|
||||
// δ֪<CEB4><D6AA><EFBFBD>ͱ<EFBFBD><CDB1><EFBFBD>0
|
||||
break;
|
||||
}
|
||||
|
||||
// <20><><EFBFBD><EFBFBD><E2B4A6><EFBFBD><EFBFBD><EFBFBD>ж<EFBFBD><D0B6>¼<EFBFBD><C2BC>ҷ<EFBFBD>ֵ<EFBFBD>ϴ<EFBFBD>
|
||||
if (record.nType == 3 && fParam2 > fBase * 0.1f) {
|
||||
fParam2 /= 100.0f;
|
||||
}
|
||||
|
||||
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ֵ<EFBFBD><D6B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ֵ<EFBFBD><D6B5>
|
||||
record.fMagntitude = fParam2 / fBase;
|
||||
}
|
||||
catch (...) {
|
||||
// <20>쳣ʱ<ECB3A3><CAB1><EFBFBD>ؿռ<D8BF>¼
|
||||
record = QVVRRecord{};
|
||||
}
|
||||
|
||||
return record;
|
||||
}
|
||||
|
||||
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>װ<EFBFBD><D7B0><EFBFBD><EFBFBD><EFBFBD>Ʊ<EFBFBD><C6B1><EFBFBD>
|
||||
std::vector<unsigned char> GetMsg(const std::vector<unsigned char>& SrcData, unsigned char nType) {
|
||||
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
@@ -151,7 +349,13 @@ std::vector<unsigned char> generate_frontlogin_message(const std::string& strMac
|
||||
// [16-19] <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>2 (<28><><EFBFBD><EFBFBD>Ϊ0)
|
||||
|
||||
// <20><><EFBFBD><EFBFBD>MAC<41><43>ַ (<28><>λ<EFBFBD><CEBB>20<32><30>ʼ<EFBFBD><CABC>64<36>ֽ<EFBFBD>)
|
||||
GetMAC(strMac, packet, 20);
|
||||
//GetMAC(strMac, packet, 20);
|
||||
//lnk20250808
|
||||
std::string err;
|
||||
if (!GetMAC(strMac, packet, 20, &err)) {
|
||||
std::cerr << "[GetMAC] parse failed: " << err << "\n";
|
||||
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
}
|
||||
|
||||
// <20><><EFBFBD><EFBFBD>У<EFBFBD><D0A3><EFBFBD><EFBFBD> (<28><>ƫ<EFBFBD><C6AB>8<EFBFBD><38>137)
|
||||
unsigned char checksum = 0;
|
||||
@@ -163,6 +367,15 @@ std::vector<unsigned char> generate_frontlogin_message(const std::string& strMac
|
||||
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
packet[packetSize - 1] = 0x16;
|
||||
|
||||
//lnk20250808
|
||||
// ======= <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> =======
|
||||
std::cout << "[generate_frontlogin_message] Packet (" << packet.size() << " bytes):\n";
|
||||
for (size_t i = 0; i < packet.size(); ++i) {
|
||||
printf("%02X ", packet[i]);
|
||||
if ((i + 1) % 16 == 0) printf("\n");
|
||||
}
|
||||
if (packet.size() % 16 != 0) printf("\n");
|
||||
|
||||
return packet;
|
||||
}
|
||||
|
||||
@@ -203,5 +416,353 @@ std::vector<unsigned char> generate_statequerystat_message(tagTime time, uint16_
|
||||
return GetMsg(DataBuf, static_cast<unsigned char>(MsgRequestType::Request_Stat));
|
||||
}
|
||||
|
||||
//ѯ<><D1AF>ʵʱ<CAB5><CAB1><EFBFBD>ݱ<EFBFBD><DDB1><EFBFBD> <20><><EFBFBD><EFBFBD>1-6 <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>1-11 г<><D0B3><EFBFBD><EFBFBD><EFBFBD><EFBFBD>0-2
|
||||
std::vector<unsigned char> generate_realstat_message(unsigned char nCpuNo,
|
||||
unsigned char StaTtype,
|
||||
unsigned char flag)
|
||||
{
|
||||
// <20><><EFBFBD><EFBFBD><EFBFBD>ܴ<EFBFBD>С<EFBFBD><D0A1>3(<28><><EFBFBD><EFBFBD>) + 1(nCpuNo) + 1(StaTtype) + 1(<28>̶<EFBFBD>ֵ) + 1(flag)
|
||||
const size_t totalSize = 7;
|
||||
std::vector<unsigned char> DataBuf(totalSize, 0x00); // <20><>ʼ<EFBFBD><CABC>Ϊȫ0
|
||||
|
||||
size_t offset = 0;
|
||||
|
||||
// 1. <20><><EFBFBD><EFBFBD>3<EFBFBD>ֽڱ<D6BD><DAB1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ѳ<EFBFBD>ʼ<EFBFBD><CABC>Ϊ0<CEAA><30>
|
||||
offset += 3;
|
||||
|
||||
// 2. д<><D0B4>nCpuNo<4E><6F>1<EFBFBD>ֽڣ<D6BD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> 1-6
|
||||
memcpy(DataBuf.data() + offset, &nCpuNo, sizeof(unsigned char));
|
||||
offset += sizeof(unsigned char);
|
||||
|
||||
// 3. д<><D0B4>StaTtype<70><65>1<EFBFBD>ֽڣ<D6BD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> 1-11 һ<><D2BB><EFBFBD><EFBFBD><EFBFBD><EFBFBD> 1-6
|
||||
memcpy(DataBuf.data() + offset, &StaTtype, sizeof(unsigned char));
|
||||
offset += sizeof(unsigned char);
|
||||
|
||||
// 4. д<><D0B4><EFBFBD>̶<EFBFBD>ֵ1<D6B5><31>1<EFBFBD>ֽڣ<D6BD> 3<><33>ʵʱ<CAB5><CAB1><EFBFBD>ݽ<EFBFBD><DDBD><EFBFBD>1 <20><>ʾƽ<CABE><C6BD>ֵ
|
||||
const unsigned char fixedValue = 1;
|
||||
memcpy(DataBuf.data() + offset, &fixedValue, sizeof(unsigned char));
|
||||
offset += sizeof(unsigned char);
|
||||
|
||||
// 5. д<><D0B4>flag<61><67>1<EFBFBD>ֽڣ<D6BD> <20><>־λ 0-2 г<><D0B3><EFBFBD><EFBFBD><EFBFBD><EFBFBD> 25 50 100<30><30>
|
||||
memcpy(DataBuf.data() + offset, &flag, sizeof(unsigned char));
|
||||
|
||||
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
return GetMsg(DataBuf, static_cast<unsigned char>(MsgRequestType::Request_New_3S));
|
||||
}
|
||||
|
||||
// <20><><EFBFBD><EFBFBD><EFBFBD>ļ<EFBFBD><C4BC><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><>ǰ֡<C7B0><D6A1><EFBFBD><EFBFBD>+<2B>ļ<EFBFBD><C4BC><EFBFBD>
|
||||
std::vector<unsigned char> generate_downloadfile_message(int frameIndex, const std::string& fileName) {
|
||||
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>С: 3(<28><><EFBFBD><EFBFBD>) + 4(֡<><D6A1><EFBFBD><EFBFBD>) + 128(<28>ļ<EFBFBD><C4BC><EFBFBD>) = 135<33>ֽ<EFBFBD>
|
||||
std::vector<unsigned char> dataBuf(135, 0x00);
|
||||
|
||||
// д<><D0B4>֡<EFBFBD><D6A1><EFBFBD><EFBFBD> (4<>ֽڣ<D6BD><DAA3><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>)
|
||||
//uint32_t netFrameIndex = htonl(static_cast<uint32_t>(frameIndex));
|
||||
//memcpy(dataBuf.data() + 3, &netFrameIndex, sizeof(uint32_t));
|
||||
// <20>Ƴ<EFBFBD>htonlת<6C><D7AA><EFBFBD><EFBFBD>ֱ<EFBFBD><D6B1>ʹ<EFBFBD><CAB9>ԭʼ֡<CABC><D6A1><EFBFBD><EFBFBD>(С<><D0A1><EFBFBD><EFBFBD>)
|
||||
uint32_t rawFrameIndex = static_cast<uint32_t>(frameIndex);
|
||||
memcpy(dataBuf.data() + 3, &rawFrameIndex, sizeof(uint32_t));
|
||||
|
||||
// д<><D0B4><EFBFBD>ļ<EFBFBD><C4BC><EFBFBD> (<28><><EFBFBD><EFBFBD>128<32>ֽ<EFBFBD>)
|
||||
size_t copyLen = std::min(fileName.size(), static_cast<size_t>(128));
|
||||
if (copyLen > 0) {
|
||||
memcpy(dataBuf.data() + 7, fileName.c_str(), copyLen);
|
||||
}
|
||||
|
||||
// <20><><EFBFBD><EFBFBD>GetMsg<73><67><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
return GetMsg(dataBuf, static_cast<unsigned char>(MsgRequestType::Request_File_Download));
|
||||
}
|
||||
|
||||
//<2F>ļ<EFBFBD>Ŀ¼<C4BF><C2BC>ȡ<EFBFBD><C8A1><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ҫ<EFBFBD><D2AA>ȡ<EFBFBD><C8A1><EFBFBD>ļ<EFBFBD>·<EFBFBD><C2B7>
|
||||
std::vector<unsigned char> generate_getfilemenu_message(const std::string& filedir) {
|
||||
// <20><><EFBFBD><EFBFBD><EFBFBD>̶<EFBFBD>131<33>ֽڻ<D6BD><DABB><EFBFBD><EFBFBD><EFBFBD> (3 + 128)<29><><EFBFBD><EFBFBD>ʼ<EFBFBD><CABC>Ϊ0
|
||||
std::vector<unsigned char> dataBuf(131, 0x00);
|
||||
|
||||
// <20><><EFBFBD><EFBFBD><EFBFBD>ļ<EFBFBD><C4BC><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ƫ<EFBFBD><C6AB><EFBFBD><EFBFBD>3<EFBFBD><33>ʼ<EFBFBD><CABC>
|
||||
size_t copyLen = std::min(filedir.size(), static_cast<size_t>(128));
|
||||
if (copyLen > 0) {
|
||||
memcpy(dataBuf.data() + 3, filedir.c_str(), copyLen);
|
||||
}
|
||||
|
||||
// <20><><EFBFBD><EFBFBD>GetMsg<73><67><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
return GetMsg(dataBuf, static_cast<unsigned char>(MsgRequestType::Request_FileDir));
|
||||
}
|
||||
|
||||
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ֵ<EFBFBD><D6B5><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
std::vector<unsigned char> generate_requestFixValue_message(unsigned char nCpuNo) {
|
||||
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
if (nCpuNo < 1 || nCpuNo > 6)
|
||||
return std::vector<unsigned char>();
|
||||
|
||||
// <20><><EFBFBD><EFBFBD>4<EFBFBD>ֽڻ<D6BD><DABB><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʼ<EFBFBD><CABC>
|
||||
std::vector<unsigned char> DataBuf(4, 0x00);
|
||||
DataBuf[3] = nCpuNo; // CPU<50><55><EFBFBD>ŷ<EFBFBD><C5B7>ڵ<EFBFBD>4<EFBFBD>ֽ<EFBFBD>
|
||||
|
||||
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
return GetMsg(DataBuf, static_cast<unsigned char>(MsgRequestType::Request_FixValue));
|
||||
}
|
||||
|
||||
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ֵ<EFBFBD><D6B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
std::vector<unsigned char> generate_requestFixDes_message() {
|
||||
// <20><><EFBFBD><EFBFBD>3<EFBFBD>ֽڻ<D6BD><DABB><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʼ<EFBFBD><CABC>
|
||||
std::vector<unsigned char> DataBuf(3, 0x00);
|
||||
|
||||
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
return GetMsg(DataBuf, static_cast<unsigned char>(MsgRequestType::Request_FixDes));
|
||||
}
|
||||
|
||||
// <20><><EFBFBD>ö<EFBFBD>ֵ<EFBFBD><D6B5><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>+<2B>ĵĶ<C4B5>ֵ<EFBFBD><D6B5><EFBFBD>ݶ<EFBFBD><DDB6><EFBFBD>
|
||||
std::vector<unsigned char> generate_requestSetFixValue_message(
|
||||
unsigned char nCpuNo,
|
||||
const std::vector<float>& value)
|
||||
{
|
||||
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
if (nCpuNo < 1 || nCpuNo > 6)
|
||||
return std::vector<unsigned char>();
|
||||
|
||||
// <20><><EFBFBD>㻺<EFBFBD><E3BBBA><EFBFBD><EFBFBD><EFBFBD><EFBFBD>С: 4(ͷ<><CDB7>) + <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>鳤<EFBFBD><E9B3A4>*4
|
||||
const size_t bufSize = 4 + value.size() * 4;
|
||||
std::vector<unsigned char> DataBuf(bufSize, 0x00);
|
||||
DataBuf[3] = nCpuNo; // CPU<50><55><EFBFBD>ŷ<EFBFBD><C5B7>ڵ<EFBFBD>4<EFBFBD>ֽ<EFBFBD>
|
||||
|
||||
// <20><><EFBFBD><EFBFBD>ÿ<EFBFBD><C3BF><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ֵ
|
||||
for (size_t i = 0; i < value.size(); i++) {
|
||||
// <20><>floatת<74><D7AA>Ϊ<EFBFBD><CEAA><EFBFBD><EFBFBD><EFBFBD>ֽ<EFBFBD><D6BD><EFBFBD>
|
||||
uint32_t intValue;
|
||||
memcpy(&intValue, &value[i], sizeof(float));
|
||||
uint32_t netValue = htonl(intValue);
|
||||
|
||||
// <20><>ת<EFBFBD><D7AA><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ֵ<EFBFBD><D6B5><EFBFBD>Ƶ<EFBFBD><C6B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
unsigned char* dest = DataBuf.data() + 4 + i * 4;
|
||||
memcpy(dest, &netValue, sizeof(uint32_t));
|
||||
}
|
||||
|
||||
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
return GetMsg(DataBuf, static_cast<unsigned char>(MsgRequestType::Request_Set_Fix));
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>װ<EFBFBD><D7B0><EFBFBD>ڲ<EFBFBD><DAB2><EFBFBD>ֵ<EFBFBD>ı<EFBFBD><C4B1><EFBFBD>
|
||||
* @return <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ĵ<EFBFBD><C4B5>ֽ<EFBFBD><D6BD><EFBFBD><EFBFBD><EFBFBD>
|
||||
*/
|
||||
std::vector<unsigned char> generate_requestinterfixvalue_message()
|
||||
{
|
||||
// <20><><EFBFBD><EFBFBD>3<EFBFBD>ֽ<EFBFBD><D6BD><EFBFBD><EFBFBD>ݻ<EFBFBD><DDBB><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʼ<EFBFBD><CABC>Ϊ0
|
||||
std::vector<unsigned char> dataBuf(3, 0x00);
|
||||
|
||||
// <20><><EFBFBD><EFBFBD>ͨ<EFBFBD>ñ<EFBFBD><C3B1><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ɺ<EFBFBD><C9BA><EFBFBD>
|
||||
return GetMsg(dataBuf, static_cast<unsigned char>(MsgRequestType::Request_Read_InterFix));
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>װ<EFBFBD><D7B0><EFBFBD>ڲ<EFBFBD><DAB2><EFBFBD>ֵ<EFBFBD><D6B5><EFBFBD><EFBFBD><EFBFBD>ı<EFBFBD><C4B1><EFBFBD>
|
||||
* @param nDesCW <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> (1-<2D>ڲ<EFBFBD><DAB2><EFBFBD>ֵ<EFBFBD><D6B5><EFBFBD><EFBFBD>, 2-<2D><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>)
|
||||
* @return <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ĵ<EFBFBD><C4B5>ֽ<EFBFBD><D6BD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Чʱ<D0A7><CAB1><EFBFBD>ؿ<EFBFBD><D8BF><EFBFBD><EFBFBD><EFBFBD>
|
||||
*/
|
||||
std::vector<unsigned char> generate_requestinterfixdes_message(unsigned char nDesCW)
|
||||
{
|
||||
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ч<EFBFBD>Լ<EFBFBD><D4BC><EFBFBD>
|
||||
if (nDesCW < 1 || nDesCW > 2) {
|
||||
return std::vector<unsigned char>();
|
||||
}
|
||||
|
||||
// <20><><EFBFBD><EFBFBD>3<EFBFBD>ֽ<EFBFBD><D6BD><EFBFBD><EFBFBD>ݻ<EFBFBD><DDBB><EFBFBD><EFBFBD><EFBFBD>
|
||||
std::vector<unsigned char> dataBuf(3, 0x00);
|
||||
|
||||
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
dataBuf[0] = nDesCW;
|
||||
|
||||
// <20><><EFBFBD><EFBFBD>ͨ<EFBFBD>ñ<EFBFBD><C3B1><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ɺ<EFBFBD><C9BA><EFBFBD>
|
||||
return GetMsg(dataBuf, static_cast<unsigned char>(MsgRequestType::Request_Read_InterFixDes));
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>װ<EFBFBD><D7B0><EFBFBD>ڲ<EFBFBD><DAB2><EFBFBD>ֵ<EFBFBD>ı<EFBFBD><C4B1><EFBFBD>
|
||||
* @param values Ҫ<><D2AA><EFBFBD>õĶ<C3B5>ֵ<EFBFBD><D6B5><EFBFBD><EFBFBD> (ushortֵ)
|
||||
* @return <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ĵ<EFBFBD><C4B5>ֽ<EFBFBD><D6BD><EFBFBD><EFBFBD><EFBFBD>
|
||||
*/
|
||||
std::vector<unsigned char> generate_requestsetinterfixvalue_message(const std::vector<uint16_t>& values)
|
||||
{
|
||||
// <20><><EFBFBD>㻺<EFBFBD><E3BBBA><EFBFBD><EFBFBD><EFBFBD><EFBFBD>С: 3<>ֽ<EFBFBD>ͷ<EFBFBD><CDB7> + ÿ<><C3BF>ֵռ2<D5BC>ֽ<EFBFBD>
|
||||
const size_t bufSize = 3 + values.size() * 2;
|
||||
std::vector<unsigned char> dataBuf(bufSize, 0x00);
|
||||
|
||||
// <20><><EFBFBD>䶨ֵ<E4B6A8><D6B5><EFBFBD><EFBFBD>
|
||||
for (size_t i = 0; i < values.size(); i++) {
|
||||
// <20><>ushortֵת<D6B5><D7AA>Ϊ<EFBFBD><CEAA><EFBFBD><EFBFBD><EFBFBD>ֽ<EFBFBD><D6BD><EFBFBD> (<28><><EFBFBD><EFBFBD>)
|
||||
uint16_t netValue = htons(values[i]);
|
||||
|
||||
// <20><><EFBFBD><EFBFBD>Ŀ<EFBFBD><C4BF>λ<EFBFBD><CEBB>ƫ<EFBFBD><C6AB><EFBFBD><EFBFBD> (<28><><EFBFBD><EFBFBD>3<EFBFBD>ֽ<EFBFBD>ͷ<EFBFBD><CDB7>)
|
||||
unsigned char* dest = dataBuf.data() + 3 + i * 2;
|
||||
|
||||
// <20><><EFBFBD><EFBFBD>ת<EFBFBD><D7AA><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ֵ<EFBFBD><D6B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
memcpy(dest, &netValue, sizeof(uint16_t));
|
||||
}
|
||||
|
||||
// <20><><EFBFBD><EFBFBD>ͨ<EFBFBD>ñ<EFBFBD><C3B1><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ɺ<EFBFBD><C9BA><EFBFBD>
|
||||
return GetMsg(dataBuf, static_cast<unsigned char>(MsgRequestType::Request_Set_InterFix));
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>װ<EFBFBD><D7B0><EFBFBD>ڲ<EFBFBD><DAB2><EFBFBD>ֵ<EFBFBD>ı<EFBFBD><C4B1><EFBFBD>
|
||||
* @param values Ҫ<><D2AA><EFBFBD>õĶ<C3B5>ֵ<EFBFBD><D6B5><EFBFBD><EFBFBD> (ushortֵ)
|
||||
* @return <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ĵ<EFBFBD><C4B5>ֽ<EFBFBD><D6BD><EFBFBD><EFBFBD><EFBFBD>
|
||||
*/
|
||||
std::vector<unsigned char> generate_requestsetinterfixvalue_message_new(const std::vector<uint16_t>& value)
|
||||
{
|
||||
// <20><><EFBFBD>㻺<EFBFBD><E3BBBA><EFBFBD><EFBFBD><EFBFBD><EFBFBD>С: 3<>ֽ<EFBFBD>ͷ<EFBFBD><CDB7> + ÿ<><C3BF>ֵռ2<D5BC>ֽ<EFBFBD>
|
||||
const size_t bufSize = 3 + value.size() * 2;
|
||||
std::vector<unsigned char> dataBuf(bufSize, 0x00);
|
||||
|
||||
// <20><><EFBFBD>䶨ֵ<E4B6A8><D6B5><EFBFBD><EFBFBD>
|
||||
for (size_t i = 0; i < value.size(); i++) {
|
||||
// <20><>ֵת<D6B5><D7AA>Ϊ<EFBFBD>ֽ<EFBFBD><D6BD><EFBFBD><EFBFBD><EFBFBD>
|
||||
uint16_t rawValue = value[i];
|
||||
unsigned char* bytes = reinterpret_cast<unsigned char*>(&rawValue);
|
||||
|
||||
// <20><>ת<EFBFBD>ֽ<EFBFBD><D6BD><EFBFBD><EFBFBD><EFBFBD>ģ<EFBFBD><C4A3>C#<23><>ReversalBuff<66><66>
|
||||
std::swap(bytes[0], bytes[1]);
|
||||
|
||||
// <20><><EFBFBD><EFBFBD>Ŀ<EFBFBD><C4BF>λ<EFBFBD><CEBB>ƫ<EFBFBD><C6AB><EFBFBD><EFBFBD> (<28><><EFBFBD><EFBFBD>3<EFBFBD>ֽ<EFBFBD>ͷ<EFBFBD><CDB7>)
|
||||
unsigned char* dest = dataBuf.data() + 3 + i * 2;
|
||||
|
||||
// <20><><EFBFBD><EFBFBD>ת<EFBFBD><D7AA><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ֵ<EFBFBD><D6B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
memcpy(dest, bytes, sizeof(uint16_t));
|
||||
}
|
||||
|
||||
// <20><><EFBFBD><EFBFBD>ͨ<EFBFBD>ñ<EFBFBD><C3B1><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ɺ<EFBFBD><C9BA><EFBFBD>
|
||||
return GetMsg(dataBuf, static_cast<unsigned char>(MsgRequestType::Request_Set_InterFix));
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief <20><><EFBFBD><EFBFBD>װ<EFBFBD><D7B0><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϣ<EFBFBD><CFA2>ȡָ<C8A1><EFBFBD><EEB1A8>
|
||||
* @return <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ĵ<EFBFBD><C4B5>ֽ<EFBFBD><D6BD><EFBFBD><EFBFBD><EFBFBD>
|
||||
*/
|
||||
std::vector<unsigned char> generate_machinestatus_message()
|
||||
{
|
||||
// <20><><EFBFBD><EFBFBD>10<31>ֽ<EFBFBD><D6BD><EFBFBD><EFBFBD>ݻ<EFBFBD><DDBB><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʼ<EFBFBD><CABC>Ϊ0
|
||||
std::vector<unsigned char> DataBuf(10, 0x00);
|
||||
|
||||
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>3<EFBFBD><33>ֵΪ1<CEAA><31><EFBFBD><EFBFBD>4<EFBFBD><34><EFBFBD>ֽڣ<D6BD>
|
||||
DataBuf[3] = 0x01;
|
||||
|
||||
// <20><><EFBFBD><EFBFBD>ͨ<EFBFBD>ñ<EFBFBD><C3B1><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ɺ<EFBFBD><C9BA><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>14<31><34>Ӧװ<D3A6><D7B0>״̬<D7B4><CCAC>ȡ
|
||||
return GetMsg(DataBuf, static_cast<unsigned char>(MsgRequestType::Request_Read_RunningInformation));
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief <20><><EFBFBD><EFBFBD>װ<EFBFBD>ð汾<C3B0><E6B1BE><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϣ<EFBFBD><CFA2>ȡָ<C8A1><EFBFBD><EEB1A8>
|
||||
* @return <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ĵ<EFBFBD><C4B5>ֽ<EFBFBD><D6BD><EFBFBD><EFBFBD><EFBFBD>
|
||||
*/
|
||||
std::vector<unsigned char> generate_machineversion_message()
|
||||
{
|
||||
// <20><><EFBFBD><EFBFBD>10<31>ֽ<EFBFBD><D6BD><EFBFBD><EFBFBD>ݻ<EFBFBD><DDBB><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʼ<EFBFBD><CABC>Ϊ0
|
||||
std::vector<unsigned char> DataBuf(10, 0x00);
|
||||
|
||||
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>3<EFBFBD><33>ֵΪ1<CEAA><31><EFBFBD><EFBFBD>4<EFBFBD><34><EFBFBD>ֽڣ<D6BD>
|
||||
DataBuf[3] = 0x02;
|
||||
|
||||
// <20><><EFBFBD><EFBFBD>ͨ<EFBFBD>ñ<EFBFBD><C3B1><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ɺ<EFBFBD><C9BA><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>14<31><34>Ӧװ<D3A6><D7B0>״̬<D7B4><CCAC>ȡ
|
||||
return GetMsg(DataBuf, static_cast<unsigned char>(MsgRequestType::Request_Read_RunningInformation));
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>װ<EFBFBD>ö<EFBFBD>ʱ<EFBFBD>ı<EFBFBD><C4B1><EFBFBD>
|
||||
* @param time <20>·<EFBFBD><C2B7>Ķ<EFBFBD>ʱʱ<CAB1><CAB1> (tmֵ)
|
||||
* @return <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ĵ<EFBFBD><C4B5>ֽ<EFBFBD><D6BD><EFBFBD><EFBFBD><EFBFBD>
|
||||
*/
|
||||
std::vector<uint8_t> generate_righttime_message(const std::tm& time) {
|
||||
std::vector<uint8_t> DataBuf(15, 0x00); // <20><><EFBFBD><EFBFBD>15<31>ֽڻ<D6BD><DABB><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʼ<EFBFBD><CABC>Ϊ0
|
||||
|
||||
// ǰ3<C7B0>ֽ<EFBFBD>Ϊ<EFBFBD><CEAA><EFBFBD>ã<EFBFBD><C3A3>ѳ<EFBFBD>ʼ<EFBFBD><CABC>Ϊ0
|
||||
|
||||
// ֱ<><D6B1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʱ<EFBFBD><CAB1><EFBFBD>루<EFBFBD><EBA3A8>ռ2<D5BC>ֽڣ<D6BD><DAA3><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
uint16_t year = static_cast<uint16_t>(time.tm_year + 1900);
|
||||
DataBuf[3] = static_cast<uint8_t>((year >> 8) & 0xFF); // <20><><EFBFBD>ֽ<EFBFBD>
|
||||
DataBuf[4] = static_cast<uint8_t>(year & 0xFF); // <20><><EFBFBD>ֽ<EFBFBD>
|
||||
|
||||
uint16_t month = static_cast<uint16_t>(time.tm_mon + 1);
|
||||
DataBuf[5] = static_cast<uint8_t>((month >> 8) & 0xFF);
|
||||
DataBuf[6] = static_cast<uint8_t>(month & 0xFF);
|
||||
|
||||
uint16_t day = static_cast<uint16_t>(time.tm_mday);
|
||||
DataBuf[7] = static_cast<uint8_t>((day >> 8) & 0xFF);
|
||||
DataBuf[8] = static_cast<uint8_t>(day & 0xFF);
|
||||
|
||||
uint16_t hour = static_cast<uint16_t>(time.tm_hour);
|
||||
DataBuf[9] = static_cast<uint8_t>((hour >> 8) & 0xFF);
|
||||
DataBuf[10] = static_cast<uint8_t>(hour & 0xFF);
|
||||
|
||||
uint16_t minute = static_cast<uint16_t>(time.tm_min);
|
||||
DataBuf[11] = static_cast<uint8_t>((minute >> 8) & 0xFF);
|
||||
DataBuf[12] = static_cast<uint8_t>(minute & 0xFF);
|
||||
|
||||
uint16_t second = static_cast<uint16_t>(time.tm_sec);
|
||||
DataBuf[13] = static_cast<uint8_t>((second >> 8) & 0xFF);
|
||||
DataBuf[14] = static_cast<uint8_t>(second & 0xFF);
|
||||
|
||||
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>е<EFBFBD>GetMsg<73><67><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ģ<EFBFBD><C4A3><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>134(0x86)
|
||||
return GetMsg(DataBuf, static_cast<unsigned char>(MsgRequestType::Request_RightTime));
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief <20><><EFBFBD><EFBFBD><EFBFBD>ݽ<EFBFBD><DDBD>¼<EFBFBD><C2BC><EFBFBD><EFBFBD>б<EFBFBD><D0B1><EFBFBD>
|
||||
* @param Time1 <20><>ʼʱ<CABC><CAB1>
|
||||
* @param Time2 <20><><EFBFBD><EFBFBD>ʱ<EFBFBD><CAB1>
|
||||
* @param eventType <20>¼<EFBFBD><C2BC><EFBFBD><EFBFBD>ͣ<EFBFBD>Ĭ<EFBFBD><C4AC>2-<2D><>̬<EFBFBD>¼<EFBFBD> 4-<2D>澯ʱ<E6BEAF><CAB1>
|
||||
* @param monitorPoint <20><><EFBFBD><EFBFBD><EFBFBD>㣬Ĭ<E3A3AC><C4AC>1-<2D><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>1 1-6 <20><>Ӧ<EFBFBD><D3A6><EFBFBD><EFBFBD>
|
||||
* @return <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ĵ<EFBFBD><C4B5>ֽ<EFBFBD><D6BD><EFBFBD><EFBFBD><EFBFBD>
|
||||
*/
|
||||
std::vector<uint8_t> generate_recallevent_message(const std::tm& Time1, const std::tm& Time2,
|
||||
uint8_t eventType, uint8_t monitorPoint)
|
||||
{
|
||||
std::vector<uint8_t> DataBuf(25, 0x00); // <20><><EFBFBD><EFBFBD>25<32>ֽڻ<D6BD><DABB><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʼ<EFBFBD><CABC>Ϊ0
|
||||
|
||||
// ǰ3<C7B0>ֽ<EFBFBD>Ϊ<EFBFBD><CEAA><EFBFBD>ã<EFBFBD><C3A3>ѳ<EFBFBD>ʼ<EFBFBD><CABC>Ϊ0
|
||||
|
||||
DataBuf[3] = eventType; // 2-<2D><>̬<EFBFBD>¼<EFBFBD> 4-<2D>澯<EFBFBD>¼<EFBFBD>
|
||||
DataBuf[4] = monitorPoint; // 0-<2D><><EFBFBD>м<EFBFBD><D0BC><EFBFBD><EFBFBD><EFBFBD>
|
||||
|
||||
// <20><>ʱ<EFBFBD><CAB1>ת<EFBFBD><D7AA>Ϊ<EFBFBD><CEAA><EFBFBD><EFBFBD><EFBFBD><EFBFBD>2<EFBFBD>ֽڸ<D6BD>ʽ<EFBFBD><CABD><EFBFBD><EFBFBD><EFBFBD>䵽<EFBFBD><E4B5BD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
uint16_t year1 = static_cast<uint16_t>(Time1.tm_year + 1900);
|
||||
DataBuf[5] = static_cast<uint8_t>((year1 >> 8) & 0xFF);
|
||||
DataBuf[6] = static_cast<uint8_t>(year1 & 0xFF);
|
||||
|
||||
uint16_t month1 = static_cast<uint16_t>(Time1.tm_mon + 1);
|
||||
DataBuf[7] = static_cast<uint8_t>((month1 >> 8) & 0xFF);
|
||||
DataBuf[8] = static_cast<uint8_t>(month1 & 0xFF);
|
||||
|
||||
uint16_t day1 = static_cast<uint16_t>(Time1.tm_mday);
|
||||
DataBuf[9] = static_cast<uint8_t>((day1 >> 8) & 0xFF);
|
||||
DataBuf[10] = static_cast<uint8_t>(day1 & 0xFF);
|
||||
|
||||
uint16_t hour1 = static_cast<uint16_t>(Time1.tm_hour);
|
||||
DataBuf[11] = static_cast<uint8_t>((hour1 >> 8) & 0xFF);
|
||||
DataBuf[12] = static_cast<uint8_t>(hour1 & 0xFF);
|
||||
|
||||
uint16_t minute1 = static_cast<uint16_t>(Time1.tm_min);
|
||||
DataBuf[13] = static_cast<uint8_t>((minute1 >> 8) & 0xFF);
|
||||
DataBuf[14] = static_cast<uint8_t>(minute1 & 0xFF);
|
||||
|
||||
uint16_t year2 = static_cast<uint16_t>(Time2.tm_year + 1900);
|
||||
DataBuf[15] = static_cast<uint8_t>((year2 >> 8) & 0xFF);
|
||||
DataBuf[16] = static_cast<uint8_t>(year2 & 0xFF);
|
||||
|
||||
uint16_t month2 = static_cast<uint16_t>(Time2.tm_mon + 1);
|
||||
DataBuf[17] = static_cast<uint8_t>((month2 >> 8) & 0xFF);
|
||||
DataBuf[18] = static_cast<uint8_t>(month2 & 0xFF);
|
||||
|
||||
uint16_t day2 = static_cast<uint16_t>(Time2.tm_mday);
|
||||
DataBuf[19] = static_cast<uint8_t>((day2 >> 8) & 0xFF);
|
||||
DataBuf[20] = static_cast<uint8_t>(day2 & 0xFF);
|
||||
|
||||
uint16_t hour2 = static_cast<uint16_t>(Time2.tm_hour);
|
||||
DataBuf[21] = static_cast<uint8_t>((hour2 >> 8) & 0xFF);
|
||||
DataBuf[22] = static_cast<uint8_t>(hour2 & 0xFF);
|
||||
|
||||
uint16_t minute2 = static_cast<uint16_t>(Time2.tm_min);
|
||||
DataBuf[23] = static_cast<uint8_t>((minute2 >> 8) & 0xFF);
|
||||
DataBuf[24] = static_cast<uint8_t>(minute2 & 0xFF);
|
||||
|
||||
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>е<EFBFBD>GetMsg<73><67><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ģ<EFBFBD><C4A3><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>0x0D(<28>¼<EFBFBD><C2BC><EFBFBD><EFBFBD>й<EFBFBD><D0B9><EFBFBD><EFBFBD><EFBFBD>)
|
||||
return GetMsg(DataBuf, static_cast<unsigned char>(MsgRequestType::Request_Read_Event));
|
||||
}
|
||||
1485
LFtid1056/PQSMsg.h
1485
LFtid1056/PQSMsg.h
File diff suppressed because it is too large
Load Diff
29
LFtid1056/boot/feservice
Normal file
29
LFtid1056/boot/feservice
Normal file
@@ -0,0 +1,29 @@
|
||||
#!/bin/bash
|
||||
|
||||
export CLOUD_PATH=/FeProject
|
||||
|
||||
if [ -z "$CLOUD_PATH" ]; then
|
||||
echo "Error: CLOUD_PATH is not set. Please set it first."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
case "$1" in
|
||||
'start')
|
||||
$CLOUD_PATH/boot/start_fe.sh
|
||||
;;
|
||||
|
||||
'stop')
|
||||
$CLOUD_PATH/boot/stop_fe.sh
|
||||
;;
|
||||
|
||||
'restart')
|
||||
$CLOUD_PATH/boot/stop_fe.sh
|
||||
$CLOUD_PATH/boot/start_fe.sh
|
||||
;;
|
||||
|
||||
*)
|
||||
echo "Usage: feservice start|stop|restart"
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
|
||||
62
LFtid1056/boot/ps_fe.sh
Normal file
62
LFtid1056/boot/ps_fe.sh
Normal file
@@ -0,0 +1,62 @@
|
||||
#!/bin/bash
|
||||
|
||||
# ========= 0. 获取脚本所在路径的上一层,设置为 FEP_ENV =========
|
||||
SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)"
|
||||
FEP_ENV="$(dirname "$SCRIPT_DIR")"
|
||||
export FEP_ENV
|
||||
|
||||
# ========= 1. 初始化软连接 =========
|
||||
TEMP_LINK_CREATED=0
|
||||
if [ ! -L "/FeProject" ]; then
|
||||
if [ ! -e "/FeProject" ]; then
|
||||
sudo ln -s "$FEP_ENV" /FeProject
|
||||
TEMP_LINK_CREATED=1
|
||||
echo "Temporary symlink /FeProject created."
|
||||
else
|
||||
echo "/FeProject exists but is not a symlink. Please check manually."
|
||||
fi
|
||||
fi
|
||||
|
||||
if [ -z "$FEP_ENV" ]; then
|
||||
echo "Error: FEP_ENV is not set. Please set it first."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
RUNTIME_CF_FILE="$FEP_ENV/etc/runtime.cf"
|
||||
|
||||
while read LINE ; do
|
||||
if [ -n "$LINE" ] ; then
|
||||
if [ ${LINE:0:1} != "#" ]; then
|
||||
BINPATH=`echo $LINE | awk -F '^' '{printf $1}'`
|
||||
BINPATH=`echo "$BINPATH" | grep -o "[^ ]\+\( \+[^ ]\+\)*"`
|
||||
# echo $BINPATH
|
||||
BIN=`echo $LINE | awk -F '^' '{printf $2}'`
|
||||
BIN=`echo "$BIN" | grep -o "[^ ]\+\( \+[^ ]\+\)*"`
|
||||
# echo $BIN
|
||||
SPECIAL=`echo $LINE | awk -F '^' '{printf $4}'`
|
||||
SPECIAL=`echo "$SPECIAL" | grep -o "[^ ]\+\( \+[^ ]\+\)*"`
|
||||
# echo $SPECIAL
|
||||
|
||||
SLEEPSEC=`echo $LINE | awk -F '^' '{printf $5}'`
|
||||
SLEEPSEC=`echo "$SLEEPSEC" | grep -o "[^ ]\+\( \+[^ ]\+\)*"`
|
||||
# echo $SLEEPSEC
|
||||
STARTFLAG=`echo $LINE | awk -F '^' '{printf $7}'`
|
||||
STARTFLAG=`echo "$STARTFLAG" | grep -o "[^ ]\+\( \+[^ ]\+\)*"`
|
||||
# echo $STARTFLAG
|
||||
|
||||
# if [ "`echo $STARTFLAG`" != "IGNORE_START" ]; then
|
||||
CMD_STR=" ps -w | grep `echo "'"``echo $BIN``echo "'"` | grep -v 'grep'"
|
||||
BIN2=`echo $BIN`
|
||||
ps -ef | grep "$BIN2" | grep -v 'grep'
|
||||
# fi
|
||||
fi
|
||||
fi
|
||||
done < $RUNTIME_CF_FILE
|
||||
|
||||
# ========= 4. 清理软链接(仅在本次脚本中创建) =========
|
||||
if [ "$TEMP_LINK_CREATED" -eq 1 ]; then
|
||||
if [ -L "/FeProject" ]; then
|
||||
sudo rm -f /FeProject
|
||||
echo "Temporary symlink /FeProject removed."
|
||||
fi
|
||||
fi
|
||||
97
LFtid1056/boot/start_fe.sh
Normal file
97
LFtid1056/boot/start_fe.sh
Normal file
@@ -0,0 +1,97 @@
|
||||
#!/bin/bash
|
||||
|
||||
# ========= 0. <20><>ȡ<EFBFBD>ű<EFBFBD><C5B1><EFBFBD><EFBFBD><EFBFBD>·<EFBFBD><C2B7><EFBFBD><EFBFBD><EFBFBD><EFBFBD>һ<EFBFBD>㣬<EFBFBD><E3A3AC><EFBFBD><EFBFBD>Ϊ FEP_ENV =========
|
||||
SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)"
|
||||
FEP_ENV="$(dirname "$SCRIPT_DIR")"
|
||||
export FEP_ENV
|
||||
|
||||
# ========= 1. <20><>ʼ<EFBFBD><CABC><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> =========
|
||||
TEMP_LINK_CREATED=0
|
||||
if [ ! -L "/FeProject" ]; then
|
||||
if [ ! -e "/FeProject" ]; then
|
||||
sudo ln -s "$FEP_ENV" /FeProject
|
||||
TEMP_LINK_CREATED=1
|
||||
echo "Temporary symlink /FeProject created."
|
||||
else
|
||||
echo "/FeProject exists but is not a symlink. Please check manually."
|
||||
fi
|
||||
fi
|
||||
|
||||
if [ -z "$FEP_ENV" ]; then
|
||||
echo "Error: FEP_ENV is not set. Please set it first."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# ========= 2. <20><>־<EFBFBD><D6BE>ת<EFBFBD><D7AA><EFBFBD><EFBFBD> =========
|
||||
check_log_file() {
|
||||
if [ -n "$1" ]; then
|
||||
FILE_SIZE=$(du "$1" | awk '{print $1}')
|
||||
if [ "$FILE_SIZE" -ge 5120 ]; then
|
||||
[ -f "$1.3" ] && rm -f "$1.3"
|
||||
[ -f "$1.2" ] && mv "$1.2" "$1.3"
|
||||
[ -f "$1.1" ] && mv "$1.1" "$1.2"
|
||||
mv "$1" "$1.1"
|
||||
fi
|
||||
fi
|
||||
}
|
||||
|
||||
LOGFILE="$FEP_ENV/dat/log/start_fe.log"
|
||||
check_log_file "$LOGFILE"
|
||||
|
||||
echo "" ; echo ""
|
||||
echo "******* $(date "+%F %R:%S") Start Processes *******"
|
||||
echo "" >>"$LOGFILE"
|
||||
echo "" >>"$LOGFILE"
|
||||
echo "******* $(date "+%F %R:%S") Start Processes *******" >>"$LOGFILE"
|
||||
|
||||
# ========= 3. <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> =========
|
||||
RUNTIME_CF_FILE="$FEP_ENV/etc/runtime.cf"
|
||||
|
||||
echo "Using config file name: $RUNTIME_CF_FILE"
|
||||
echo "Using config file name: $RUNTIME_CF_FILE" >>"$LOGFILE"
|
||||
|
||||
cd "$FEP_ENV/boot" || exit 1
|
||||
CURDIR=$(pwd)
|
||||
|
||||
while read -r LINE; do
|
||||
if [ -n "$LINE" ] && [[ ${LINE:0:1} != "#" ]]; then
|
||||
BINPATH=$(echo "$LINE" | awk -F '^' '{print $1}' | grep -o "[^ ]\+\( \+[^ ]\+\)*")
|
||||
echo "$BINPATH"
|
||||
BIN=$(echo "$LINE" | awk -F '^' '{print $2}' | grep -o "[^ ]\+\( \+[^ ]\+\)*")
|
||||
echo "$BIN"
|
||||
SPECIAL=$(echo "$LINE" | awk -F '^' '{print $4}' | grep -o "[^ ]\+\( \+[^ ]\+\)*")
|
||||
echo "$SPECIAL"
|
||||
SLEEPSEC=$(echo "$LINE" | awk -F '^' '{print $5}' | grep -o "[^ ]\+\( \+[^ ]\+\)*")
|
||||
echo "$SLEEPSEC"
|
||||
STARTFLAG=$(echo "$LINE" | awk -F '^' '{print $7}' | grep -o "[^ ]\+\( \+[^ ]\+\)*")
|
||||
echo "$STARTFLAG"
|
||||
RESTARTFLAG=$(echo "$LINE" | awk -F '^' '{print $6}' | grep -o "[^ ]\+\( \+[^ ]\+\)*")
|
||||
echo "$RESTARTFLAG"
|
||||
|
||||
if [ "$RESTARTFLAG" = "IGNORE_RESTART" ]; then
|
||||
CMD_STR="sleep $SLEEPSEC"
|
||||
echo "$CMD_STR"
|
||||
echo "$CMD_STR" >>"$LOGFILE"
|
||||
eval "$CMD_STR"
|
||||
|
||||
CMD_STR="$BINPATH$BIN $SPECIAL"
|
||||
echo "$CMD_STR"
|
||||
echo "$CMD_STR" >>"$LOGFILE"
|
||||
eval "$CMD_STR" &>/dev/null
|
||||
fi
|
||||
fi
|
||||
done < "$RUNTIME_CF_FILE"
|
||||
|
||||
cd "$CURDIR"
|
||||
|
||||
DT=$(date "+%F %R:%S.%N")
|
||||
echo "******* ${DT:0:23} Start Processes Succcessfully *******"
|
||||
echo "******* ${DT:0:23} Start Processes Succcessfully *******" >>"$LOGFILE"
|
||||
|
||||
# ========= 4. <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ӣ<EFBFBD><D3A3><EFBFBD><EFBFBD>ڱ<EFBFBD><DAB1>νű<CEBD><C5B1>д<EFBFBD><D0B4><EFBFBD><EFBFBD><EFBFBD> =========
|
||||
if [ "$TEMP_LINK_CREATED" -eq 1 ]; then
|
||||
if [ -L "/FeProject" ]; then
|
||||
sudo rm -f /FeProject
|
||||
echo "Temporary symlink /FeProject removed."
|
||||
fi
|
||||
fi
|
||||
129
LFtid1056/boot/stop_fe.sh
Normal file
129
LFtid1056/boot/stop_fe.sh
Normal file
@@ -0,0 +1,129 @@
|
||||
#!/bin/bash
|
||||
|
||||
# ========= 0. 获取脚本所在路径的上一层,设置为 FEP_ENV =========
|
||||
SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)"
|
||||
FEP_ENV="$(dirname "$SCRIPT_DIR")"
|
||||
export FEP_ENV
|
||||
|
||||
# ========= 1. 初始化软连接 =========
|
||||
TEMP_LINK_CREATED=0
|
||||
if [ ! -L "/FeProject" ]; then
|
||||
if [ ! -e "/FeProject" ]; then
|
||||
sudo ln -s "$FEP_ENV" /FeProject
|
||||
TEMP_LINK_CREATED=1
|
||||
echo "Temporary symlink /FeProject created."
|
||||
else
|
||||
echo "/FeProject exists but is not a symlink. Please check manually."
|
||||
fi
|
||||
fi
|
||||
|
||||
if [ -z "$FEP_ENV" ]; then
|
||||
echo "Error: FEP_ENV is not set. Please set it first."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
check_log_file()
|
||||
{
|
||||
if [ -n "$1" ] ; then
|
||||
FILE_SIZE=0
|
||||
FILE_SIZE=`du $1 | awk '{print $1}'`
|
||||
if [ $FILE_SIZE -ge 5120 ]
|
||||
then
|
||||
if [ -f "$1".3 ]; then
|
||||
rm -f "$1".3
|
||||
fi
|
||||
if [ -f "$1".2 ]; then
|
||||
mv "$1".2 "$1".3
|
||||
fi
|
||||
if [ -f "$1".1 ]; then
|
||||
mv "$1".1 "$1".2
|
||||
fi
|
||||
mv "$1" "$1".1
|
||||
fi
|
||||
fi
|
||||
}
|
||||
|
||||
LOGFILE="$FEP_ENV/dat/log/start_fe.log"
|
||||
check_log_file $LOGFILE
|
||||
|
||||
echo "" ; echo ""
|
||||
echo "****** `date "+%F %R:%S"` Stop Processes ******"
|
||||
echo "" >>"$LOGFILE"
|
||||
echo "" >>"$LOGFILE"
|
||||
echo "****** `date "+%F %R:%S"` Stop Processes ******" >>"$LOGFILE"
|
||||
|
||||
RUNTIME_CF_FILE="$FEP_ENV/etc/runtime.cf"
|
||||
|
||||
#cat $RUNTIME_CF_FILE |tac > /tmp/runtime.cf
|
||||
sed '1!G;h;$!d' $RUNTIME_CF_FILE > /tmp/runtime.cf
|
||||
|
||||
echo "Using config file name: $RUNTIME_CF_FILE"
|
||||
echo "Using config file name: $RUNTIME_CF_FILE">>"$LOGFILE"
|
||||
|
||||
while read LINE ; do
|
||||
if [ -n "$LINE" ] ; then
|
||||
if [ ${LINE:0:1} != "#" ]; then
|
||||
BINPATH=`echo $LINE | awk -F '^' '{printf $1}'`
|
||||
BINPATH=`echo "$BINPATH" | grep -o "[^ ]\+\( \+[^ ]\+\)*"`
|
||||
# echo $BINPATH
|
||||
BIN=`echo $LINE | awk -F '^' '{printf $2}'`
|
||||
BIN=`echo "$BIN" | grep -o "[^ ]\+\( \+[^ ]\+\)*"`
|
||||
# echo $BIN
|
||||
SPECIAL=`echo $LINE | awk -F '^' '{printf $4}'`
|
||||
SPECIAL=`echo "$SPECIAL" | grep -o "[^ ]\+\( \+[^ ]\+\)*"`
|
||||
# echo $SPECIAL
|
||||
|
||||
SLEEPSEC=`echo $LINE | awk -F '^' '{printf $5}'`
|
||||
SLEEPSEC=`echo "$SLEEPSEC" | grep -o "[^ ]\+\( \+[^ ]\+\)*"`
|
||||
# echo $SLEEPSEC
|
||||
STARTFLAG=`echo $LINE | awk -F '^' '{printf $7}'`
|
||||
STARTFLAG=`echo "$STARTFLAG" | grep -o "[^ ]\+\( \+[^ ]\+\)*"`
|
||||
# echo $STARTFLAG
|
||||
|
||||
if [ "`echo $STARTFLAG`" != "IGNORE_START" ]; then
|
||||
# echo ""
|
||||
# echo "" >>"$LOGFILE"
|
||||
CMD_STR=" ps -w | grep `echo "'"``echo $BIN``echo "'"` | grep -v 'grep'"
|
||||
BIN2=`echo $BIN`
|
||||
BIN3=`echo $BIN |awk '{print$1}'`
|
||||
# CMD_STR="killall `echo $BIN | awk '{print$1}'` 2>&1 "
|
||||
PIDSTR=`ps -ef | grep "$BIN2" | grep -v 'grep'`
|
||||
if [ -n "$PIDSTR" ] ; then
|
||||
if [ "$BIN3" == "fe_main" ]; then
|
||||
CMD_STR=" sleep 3 "
|
||||
echo "$CMD_STR"
|
||||
echo "$CMD_STR" >>"$LOGFILE"
|
||||
$CMD_STR
|
||||
fi
|
||||
|
||||
CMD_STR="kill -15 `echo $PIDSTR | awk '{print$2}'` "
|
||||
echo " Kill process: \"$BIN\" with PID `echo $PIDSTR | awk '{print$2}'`"
|
||||
echo " Kill process: \"$BIN\" with PID `echo $PIDSTR | awk '{print$2}'`" >>"$LOGFILE"
|
||||
echo " Executing: $CMD_STR"
|
||||
echo " Executing: $CMD_STR" >>"$LOGFILE"
|
||||
CMD_RESULT=`$CMD_STR`
|
||||
if [ -n "$CMD_RESULT" ] ; then
|
||||
echo "$CMD_RESULT"
|
||||
echo "$CMD_RESULT" >>"$LOGFILE"
|
||||
fi
|
||||
|
||||
else
|
||||
echo " Process \"$BIN\" not running."
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
done < /tmp/runtime.cf
|
||||
|
||||
DT=`date "+%F %R:%S.%N"`
|
||||
echo "****** ${DT:0:23} Stop Processes Succcessfully ******"
|
||||
echo "" >>"$LOGFILE"
|
||||
echo "****** ${DT:0:23} Stop Processes Succcessfully ******" >>"$LOGFILE"
|
||||
|
||||
# ========= 4. 清理软链接(仅在本次脚本中创建) =========
|
||||
if [ "$TEMP_LINK_CREATED" -eq 1 ]; then
|
||||
if [ -L "/FeProject" ]; then
|
||||
sudo rm -f /FeProject
|
||||
echo "Temporary symlink /FeProject removed."
|
||||
fi
|
||||
fi
|
||||
@@ -7,6 +7,9 @@
|
||||
#include <memory>
|
||||
#include <mutex>
|
||||
#include <unordered_map>
|
||||
#include <sstream>
|
||||
#include <algorithm>
|
||||
#include <interface.h>
|
||||
|
||||
// 配置参数
|
||||
constexpr int BASE_RECONNECT_DELAY = 20000; // 基础重连延迟(ms)
|
||||
@@ -53,7 +56,7 @@ void ClientContext::init_tcp() {
|
||||
|
||||
void ClientContext::start_timer() {
|
||||
if (!uv_is_active((uv_handle_t*)&timer)) {
|
||||
uv_timer_start(&timer, on_timer, 5000,5000);
|
||||
uv_timer_start(&timer, on_timer, 1000,1000);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -248,7 +251,7 @@ void ClientContext::process_next_action() {
|
||||
// 新增方法:发送当前状态对应的报文
|
||||
void ClientContext::send_current_packet() {
|
||||
if (!current_packet_.empty()) {
|
||||
send_binary_data(this, current_packet_.data(), current_packet_.size());
|
||||
safe_send_binary_data(this, current_packet_);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -281,6 +284,37 @@ void ClientContext::clear_stat_cache() {
|
||||
stat_packets_cache_.clear();
|
||||
expected_total_packets_ = 0;
|
||||
}
|
||||
|
||||
bool ClientContext::event_add_stat_packet(const std::vector<unsigned char>& packet, int current_packet, int total_packets) {
|
||||
std::lock_guard<std::mutex> lock(event_stat_cache_mutex_);
|
||||
|
||||
// 如果是第一帧,初始化缓存
|
||||
if (current_packet == 1) {
|
||||
event_stat_packets_cache_.clear();
|
||||
event_expected_total_packets_ = total_packets;
|
||||
}
|
||||
|
||||
// 添加到缓存
|
||||
event_stat_packets_cache_.push_back({ current_packet, packet });
|
||||
|
||||
// 检查是否收齐所有帧
|
||||
return (event_stat_packets_cache_.size() >= event_expected_total_packets_);
|
||||
}
|
||||
|
||||
std::vector<ClientContext::StatPacket> ClientContext::event_get_and_clear_stat_packets() {
|
||||
std::lock_guard<std::mutex> lock(event_stat_cache_mutex_);
|
||||
auto packets = std::move(event_stat_packets_cache_);
|
||||
event_stat_packets_cache_.clear();
|
||||
event_expected_total_packets_ = 0;
|
||||
return packets;
|
||||
}
|
||||
|
||||
void ClientContext::event_clear_stat_cache() {
|
||||
std::lock_guard<std::mutex> lock(event_stat_cache_mutex_);
|
||||
event_stat_packets_cache_.clear();
|
||||
event_expected_total_packets_ = 0;
|
||||
}
|
||||
|
||||
// 添加浮点数据到缓存
|
||||
bool ClientContext::add_float_data(ushort point_id, int data_type, const tagPqData_Float& float_data) {
|
||||
if (data_type < 0 || data_type > 3) return false;
|
||||
@@ -312,6 +346,48 @@ void ClientContext::clear_float_cache() {
|
||||
std::lock_guard<std::mutex> lock(float_cache_mutex_);
|
||||
point_float_cache_.clear();
|
||||
}
|
||||
// 版本比较函数的辅助函数:分割字符串并转换为整数向量
|
||||
std::vector<int> splitVersionString(const std::string& versionStr) {
|
||||
std::vector<int> segments;
|
||||
std::stringstream ss(versionStr);
|
||||
std::string segment;
|
||||
|
||||
while (std::getline(ss, segment, '.')) {
|
||||
segments.push_back(std::stoi(segment));
|
||||
}
|
||||
return segments;
|
||||
}
|
||||
// 版本比较函数
|
||||
bool isVersionGreaterOrEqual(const std::string& version1, const std::string& version2) {
|
||||
// 去除开头的'V'(如果存在)
|
||||
std::string v1 = version1;
|
||||
if (!v1.empty() && v1[0] == 'V') {
|
||||
v1.erase(0, 1);
|
||||
}
|
||||
|
||||
std::string v2 = version2;
|
||||
if (!v2.empty() && v2[0] == 'V') {
|
||||
v2.erase(0, 1);
|
||||
}
|
||||
|
||||
// 分割版本号
|
||||
std::vector<int> seg1 = splitVersionString(v1);
|
||||
std::vector<int> seg2 = splitVersionString(v2);
|
||||
|
||||
// 逐段比较版本号
|
||||
size_t maxSize = std::max(seg1.size(), seg2.size());
|
||||
for (size_t i = 0; i < maxSize; ++i) {
|
||||
int num1 = (i < seg1.size()) ? seg1[i] : 0;
|
||||
int num2 = (i < seg2.size()) ? seg2[i] : 0;
|
||||
|
||||
if (num1 != num2) {
|
||||
return num1 > num2;
|
||||
}
|
||||
}
|
||||
|
||||
return true; // 所有段都相等
|
||||
}
|
||||
|
||||
/* 缓冲区分配回调 */
|
||||
void alloc_buffer(uv_handle_t* handle, size_t suggested_size, uv_buf_t* buf) {
|
||||
buf->base = new char[suggested_size];
|
||||
@@ -355,34 +431,88 @@ void on_write(uv_write_t* req, int status) {
|
||||
}
|
||||
|
||||
/* 定时发送回调 */
|
||||
//5秒执行一次定时器
|
||||
//1秒执行一次定时器
|
||||
void on_timer(uv_timer_t* handle) {
|
||||
ClientContext* ctx = static_cast<ClientContext*>(handle->data);
|
||||
|
||||
if (ctx->state != ConnectionState::CONNECTED) {
|
||||
return;
|
||||
}
|
||||
|
||||
static int statequerytime = 0;//询问统计数据时间标志 20秒执行一次
|
||||
|
||||
// 检查状态超时 30秒状态未更新则重置为空闲状态
|
||||
ctx->check_state_timeout();
|
||||
|
||||
//检查当前装置最新通讯时间是否超过1分钟,如果1分钟内没有收到任何装置通讯消息,则调整为未登录状态,通讯状态设置为离线.
|
||||
uint64_t timecheck = uv_now(ctx->loop);//当前时间戳
|
||||
if (timecheck - ctx->get_cloudmessage_time >= 60000) {
|
||||
ctx->get_cloudmessage_time = timecheck;
|
||||
//不管原状态是什么,这里都设置装置登录状态为未登录
|
||||
ClientManager::instance().set_cloud_status(ctx->device_info.device_id, 0);
|
||||
}
|
||||
|
||||
// 装置登录成功后,只在空闲状态处理后续动作
|
||||
if (ctx->cloudstatus == 1) {
|
||||
|
||||
uint64_t now = uv_now(ctx->loop);//当前时间戳
|
||||
//20秒一次 执行统计数据时间询问
|
||||
if (++statequerytime >= 4 && ctx->current_state_ == DeviceState::IDLE) {
|
||||
statequerytime = 0;//重置计时
|
||||
if (ctx->current_state_ == DeviceState::IDLE && now - ctx->last_state_query_time_ >= 20000) {
|
||||
// 更新统计数据最后查询时间
|
||||
ctx->last_state_query_time_ = now;
|
||||
|
||||
auto sendbuff = generate_statequerytime_message();//组装询问统计数据时间报文
|
||||
ctx->add_action(DeviceState::READING_STATS_TIME, sendbuff);//将该状态以及待发送报文存入队列
|
||||
}
|
||||
//一秒一次 执行实时数据询问 仅执行指定次数
|
||||
now = uv_now(ctx->loop);
|
||||
if (ctx->current_state_ == DeviceState::IDLE && now - ctx->real_state_query_time_ >= 1000 && ctx->real_state_count > 0) {
|
||||
// 更新实时数据执行时间和实时收发计数
|
||||
ctx->real_state_query_time_ = now;
|
||||
ctx->real_state_count--;
|
||||
|
||||
auto sendbuff = generate_realstat_message(static_cast<unsigned char>(ctx->real_point_id_), static_cast<unsigned char>(0x01), static_cast<unsigned char>(0x01));//组装询问实时数据报文
|
||||
ctx->add_action(DeviceState::READING_REALSTAT, sendbuff);//将该状态以及待发送报文存入队列
|
||||
}
|
||||
//30分钟一次 读取装置运行信息
|
||||
now = uv_now(ctx->loop);
|
||||
if (ctx->current_state_ == DeviceState::IDLE && now - ctx->read_runninginformationMsg >= 60000 * 30)
|
||||
{
|
||||
// 更新运行信息最后读取时间
|
||||
ctx->read_runninginformationMsg = now;
|
||||
|
||||
auto sendbuff = generate_machinestatus_message();//组装读取装置运行信息报文
|
||||
ctx->add_action(DeviceState::READING_RUNNINGINFORMATION_2, sendbuff);//将该状态以及待发送报文存入队列
|
||||
}
|
||||
//30分钟一次 启动装置对时 仅在台账开启对时且云协议版本大于1.5时开启对时 60000 * 30
|
||||
now = uv_now(ctx->loop);
|
||||
if (ctx->current_state_ == DeviceState::IDLE && now - ctx->right_time >= 60000 * 30 && ctx->device_info.righttime && isVersionGreaterOrEqual(ctx->dev_CloudProtocolVer,"V1.5"))
|
||||
{
|
||||
// 更新对时功能最后运行时间
|
||||
ctx->right_time = now;
|
||||
|
||||
// 获取当前时间
|
||||
auto now = std::chrono::system_clock::now();
|
||||
std::time_t time = std::chrono::system_clock::to_time_t(now);
|
||||
std::tm tm_time = *std::localtime(&time);
|
||||
auto sendbuff = generate_righttime_message(tm_time);//组装装置对时报文
|
||||
ctx->add_action(DeviceState::SET_RIGHTTIME, sendbuff);//将该状态以及待发送报文存入队列
|
||||
//auto sendbuff = generate_machinestatus_message();//组装读取装置运行信息报文
|
||||
//ctx->add_action(DeviceState::READING_RUNNINGINFORMATION_2, sendbuff);//将该状态以及待发送报文存入队列
|
||||
}
|
||||
//处理后续工作队列的工作 取出一个并执行
|
||||
if (ctx->current_state_ == DeviceState::IDLE) {
|
||||
ctx->process_next_action();
|
||||
}
|
||||
}
|
||||
else {
|
||||
//装置登录状态异常,预备重发登录报文,检查最新登录报文发送时间,超过限制则重发登录报文
|
||||
uint64_t now = uv_now(ctx->loop);//当前时间戳
|
||||
if (now - ctx->login_cloud_time >= 60000) {
|
||||
//更新最后一次登录报文发送时间
|
||||
ctx->login_cloud_time = now;
|
||||
|
||||
//装置未登录,且60秒内没有发送装置登录报文,预备发送登录报文
|
||||
auto binary_data = generate_frontlogin_message(ctx->device_info.mac);
|
||||
safe_send_binary_data(ctx, binary_data);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* 发送二进制报文函数 */
|
||||
@@ -410,6 +540,37 @@ void send_binary_data(ClientContext* ctx, const unsigned char* data, size_t data
|
||||
}
|
||||
}
|
||||
|
||||
// 新增函数:在事件循环线程中安全发送数据
|
||||
void safe_send_binary_data(ClientContext* ctx, std::vector<unsigned char> data) {
|
||||
uv_work_t* req = new uv_work_t;
|
||||
req->data = new std::pair<ClientContext*, std::vector<unsigned char>>(ctx, std::move(data));
|
||||
|
||||
uv_queue_work(ctx->loop, req, [](uv_work_t* req) {
|
||||
// 在工作线程中不执行实际工作
|
||||
}, [](uv_work_t* req, int status) {
|
||||
// 在事件循环线程中执行实际发送
|
||||
auto* pair = static_cast<std::pair<ClientContext*, std::vector<unsigned char>>*>(req->data);
|
||||
ClientContext* ctx = pair->first;
|
||||
const auto& data = pair->second;
|
||||
|
||||
if (ctx->state == ConnectionState::CONNECTED) {
|
||||
// 实际发送逻辑(原 send_binary_data 的核心部分)
|
||||
uv_buf_t buf = uv_buf_init(const_cast<char*>(reinterpret_cast<const char*>(data.data())), data.size());
|
||||
uv_write_t* write_req = new uv_write_t;
|
||||
write_req->data = new std::vector<unsigned char>(data); // 复制数据
|
||||
|
||||
int ret = uv_write(write_req, (uv_stream_t*)&ctx->client, &buf, 1, on_write);
|
||||
if (ret < 0) {
|
||||
// 错误处理
|
||||
delete static_cast<std::vector<unsigned char>*>(write_req->data);
|
||||
delete write_req;
|
||||
}
|
||||
}
|
||||
|
||||
delete pair;
|
||||
delete req;
|
||||
});
|
||||
}
|
||||
/* 连接关闭回调 */
|
||||
void on_close(uv_handle_t* handle) {
|
||||
ClientContext* ctx = static_cast<ClientContext*>(handle->data);
|
||||
@@ -419,10 +580,11 @@ void on_close(uv_handle_t* handle) {
|
||||
ctx->stop_timers();
|
||||
// 清空缓存
|
||||
ctx->clear_stat_cache();
|
||||
ctx->event_clear_stat_cache();
|
||||
// 清除浮点数据缓存
|
||||
ctx->clear_float_cache();
|
||||
|
||||
ctx->cloudstatus = 0;
|
||||
// 装置登录状态调整为离线
|
||||
ClientManager::instance().set_cloud_status(ctx->device_info.device_id, 0);
|
||||
{
|
||||
std::lock_guard<std::mutex> state_lock(ctx->state_mutex_);
|
||||
ctx->current_state_ = DeviceState::IDLE; // 直接修改状态
|
||||
@@ -489,11 +651,18 @@ void on_connect(uv_connect_t* req, int status) {
|
||||
|
||||
ctx->state = ConnectionState::CONNECTED;
|
||||
ctx->reconnect_attempts = 0;
|
||||
|
||||
// 新增:初始化各个计时时间戳
|
||||
ctx->last_state_query_time_ = uv_now(ctx->loop);//初始化统计数据时间戳
|
||||
ctx->real_state_query_time_ = uv_now(ctx->loop);//初始化实时数据时间戳
|
||||
ctx->read_runninginformationMsg = uv_now(ctx->loop);//初始化读取装置运行信息时间戳
|
||||
ctx->right_time = uv_now(ctx->loop);//初始化对时时间戳
|
||||
ctx->get_cloudmessage_time = uv_now(ctx->loop);//初始化最新装置通讯报文时间戳
|
||||
ctx->login_cloud_time = uv_now(ctx->loop);//初始化装置登录报文超时发送时标
|
||||
ctx->real_state_count = 0;//实时数据收发计数
|
||||
//客户端连接完毕后,发送装置登陆消息
|
||||
std::cout << "connected: " << ctx->device_info.mac << " send login msg!" << std::endl;
|
||||
auto binary_data = generate_frontlogin_message(ctx->device_info.mac);
|
||||
send_binary_data(ctx, binary_data.data(), binary_data.size());
|
||||
safe_send_binary_data(ctx, binary_data);
|
||||
|
||||
uv_read_start((uv_stream_t*)&ctx->client, alloc_buffer, on_read);
|
||||
ctx->start_timer();
|
||||
@@ -613,30 +782,6 @@ void ClientManager::remove_device(const std::string& device_id) {
|
||||
std::cout << "[Device " << device_id << "] Removed successfully\n";
|
||||
}
|
||||
|
||||
bool ClientManager::send_to_device(const std::string& identifier,
|
||||
const unsigned char* data,
|
||||
size_t size) {
|
||||
std::lock_guard<std::mutex> lock(mutex_);
|
||||
|
||||
for (auto& pair : clients_) {
|
||||
auto& ctx = pair.second;
|
||||
// 匹配装置ID或MAC地址
|
||||
if (ctx->device_info.device_id == identifier ||
|
||||
ctx->device_info.mac == identifier) {
|
||||
|
||||
if (ctx->state == ConnectionState::CONNECTED) {
|
||||
send_binary_data(ctx.get(), data, size);
|
||||
return true;
|
||||
}
|
||||
std::cerr << "[Device " << identifier << "] Not connected\n";
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
std::cerr << "[Device " << identifier << "] Not found\n";
|
||||
return false;
|
||||
}
|
||||
|
||||
void ClientManager::stop_all() {
|
||||
std::lock_guard<std::mutex> lock(mutex_);
|
||||
for (auto& pair : clients_) {
|
||||
@@ -688,6 +833,35 @@ void ClientManager::restart_device(const std::string& device_id) {
|
||||
}
|
||||
}
|
||||
|
||||
//设备运行情况判断
|
||||
bool ClientManager::get_dev_status(const std::string& identifier) {
|
||||
std::lock_guard<std::mutex> lock(mutex_);
|
||||
|
||||
for (auto& pair : clients_) {
|
||||
auto& ctx = pair.second;
|
||||
// 匹配装置ID或MAC地址
|
||||
if (ctx->device_info.device_id == identifier ||
|
||||
ctx->device_info.mac == identifier) {
|
||||
|
||||
if (ctx->cloudstatus == 1) {
|
||||
//设备已登录
|
||||
std::cout << "[Device " << identifier
|
||||
<< "] online!" <<std::endl;
|
||||
return true;
|
||||
}
|
||||
else{
|
||||
//设备状态异常
|
||||
//设备已登录
|
||||
std::cout << "[Device " << identifier
|
||||
<< "] offline!" << std::endl;
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
//修改客户端云前置登录状态
|
||||
bool ClientManager::set_cloud_status(const std::string& identifier, int status) {
|
||||
std::lock_guard<std::mutex> lock(mutex_);
|
||||
@@ -698,6 +872,19 @@ bool ClientManager::set_cloud_status(const std::string& identifier, int status)
|
||||
if (ctx->device_info.device_id == identifier ||
|
||||
ctx->device_info.mac == identifier) {
|
||||
|
||||
if (ctx->cloudstatus == 0 && status == 1) {
|
||||
//设备从离线转换至在线,通知前台状态发生翻转
|
||||
connect_status_update(identifier, status);
|
||||
std::cout << "[Device " << identifier
|
||||
<< "] ****Cloud status: " << ctx->cloudstatus << " updated to: " << status << std::endl;
|
||||
}
|
||||
else if (ctx->cloudstatus == 1 && status == 0) {
|
||||
//设备从在线转换至离线,通知前台状态发生翻转
|
||||
connect_status_update(identifier, status);
|
||||
std::cout << "[Device " << identifier
|
||||
<< "] ****Cloud status: " << ctx->cloudstatus << " updated to: " << status << std::endl;
|
||||
}
|
||||
|
||||
// 修改云前置登录状态
|
||||
ctx->cloudstatus = status;
|
||||
std::cout << "[Device " << identifier
|
||||
@@ -710,6 +897,48 @@ bool ClientManager::set_cloud_status(const std::string& identifier, int status)
|
||||
return false;
|
||||
}
|
||||
|
||||
//刷新客户端装置最新接收通讯报文时间
|
||||
bool ClientManager::set_cloudmessage_time(const std::string& identifier) {
|
||||
std::lock_guard<std::mutex> lock(mutex_);
|
||||
|
||||
for (auto& pair : clients_) {
|
||||
auto& ctx = pair.second;
|
||||
// 匹配装置ID或MAC地址
|
||||
if (ctx->device_info.device_id == identifier ||
|
||||
ctx->device_info.mac == identifier) {
|
||||
|
||||
// 修改云前置登录状态
|
||||
ctx->get_cloudmessage_time = uv_now(ctx->loop);//刷新最新装置通讯报文时间戳
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
std::cerr << "[set_cloud_status] Device not found: " << identifier << std::endl;
|
||||
return false;
|
||||
}
|
||||
|
||||
//修改客户端读取到的配置信息:云协议版本
|
||||
bool ClientManager::set_versioninformation(const std::string& identifier, string cloud_version) {
|
||||
std::lock_guard<std::mutex> lock(mutex_);
|
||||
|
||||
for (auto& pair : clients_) {
|
||||
auto& ctx = pair.second;
|
||||
// 匹配装置ID或MAC地址
|
||||
if (ctx->device_info.device_id == identifier ||
|
||||
ctx->device_info.mac == identifier) {
|
||||
|
||||
// 修改云前置登录状态
|
||||
ctx->dev_CloudProtocolVer = cloud_version;
|
||||
std::cout << "[Device " << identifier
|
||||
<< "] Cloud version updated to: " << cloud_version << std::endl;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
std::cerr << "[set_cloud_status] Device not found: " << identifier << std::endl;
|
||||
return false;
|
||||
}
|
||||
|
||||
bool ClientManager::add_action_to_device(const std::string& identifier,
|
||||
DeviceState state,
|
||||
const std::vector<unsigned char>& packet) {
|
||||
@@ -890,6 +1119,52 @@ bool ClientManager::clear_stat_cache(const std::string& identifier) {
|
||||
return false;
|
||||
}
|
||||
|
||||
//保存多帧事件日志报文至缓存区等待收全
|
||||
bool ClientManager::add_eventlog_packet_to_device(const std::string& identifier,
|
||||
const std::vector<unsigned char>& packet,
|
||||
int current_packet,
|
||||
int total_packets) {
|
||||
std::lock_guard<std::mutex> lock(mutex_);
|
||||
|
||||
for (auto& pair : clients_) {
|
||||
auto& ctx = pair.second;
|
||||
if (ctx->device_info.device_id == identifier ||
|
||||
ctx->device_info.mac == identifier) {
|
||||
return ctx->event_add_stat_packet(packet, current_packet, total_packets);
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
//获取缓存区内所有多帧事件日志报文并清空缓存
|
||||
std::vector<ClientContext::StatPacket> ClientManager::get_and_clear_event_packets(const std::string& identifier) {
|
||||
std::lock_guard<std::mutex> lock(mutex_);
|
||||
|
||||
for (auto& pair : clients_) {
|
||||
auto& ctx = pair.second;
|
||||
if (ctx->device_info.device_id == identifier ||
|
||||
ctx->device_info.mac == identifier) {
|
||||
return ctx->event_get_and_clear_stat_packets();
|
||||
}
|
||||
}
|
||||
return {};
|
||||
}
|
||||
|
||||
//清空所有事件日志缓存区
|
||||
bool ClientManager::clear_event_cache(const std::string& identifier) {
|
||||
std::lock_guard<std::mutex> lock(mutex_);
|
||||
|
||||
for (auto& pair : clients_) {
|
||||
auto& ctx = pair.second;
|
||||
if (ctx->device_info.device_id == identifier ||
|
||||
ctx->device_info.mac == identifier) {
|
||||
ctx->event_clear_stat_cache();
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
// 获取pt和CT变比
|
||||
bool ClientManager::get_pt_ct_ratio(const std::string& identifier,
|
||||
int16_t nCpuNo,
|
||||
@@ -928,6 +1203,25 @@ bool ClientManager::get_pt_ct_ratio(const std::string& identifier,
|
||||
return false;
|
||||
}
|
||||
|
||||
// 获取待补招测点序号
|
||||
bool ClientManager::get_event_lineid(const std::string& identifier,int& nCpuNo) {
|
||||
std::lock_guard<std::mutex> lock(mutex_);
|
||||
|
||||
for (auto& pair : clients_) {
|
||||
auto& ctx = pair.second;
|
||||
// 匹配装置ID或MAC地址
|
||||
if (ctx->device_info.device_id == identifier ||
|
||||
ctx->device_info.mac == identifier) {
|
||||
|
||||
nCpuNo = ctx->event_lineNo;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
std::cerr << "[get_pt_ct_ratio] Device not found: " << identifier << std::endl;
|
||||
return false;
|
||||
}
|
||||
|
||||
// 添加浮点数据到指定设备的缓存
|
||||
bool ClientManager::add_float_data_to_device(const std::string& identifier,
|
||||
ushort point_id,
|
||||
@@ -974,3 +1268,505 @@ bool ClientManager::clear_float_cache(const std::string& identifier) {
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
//实时数据调用
|
||||
bool ClientManager::set_real_state_count(const std::string& identifier, int count, ushort point_id) {
|
||||
std::lock_guard<std::mutex> lock(mutex_);
|
||||
|
||||
for (auto& pair : clients_) {
|
||||
auto& ctx = pair.second;
|
||||
if (ctx->device_info.device_id == identifier ||
|
||||
ctx->device_info.mac == identifier) {
|
||||
|
||||
// 设置实时计数
|
||||
ctx->real_state_count = count;
|
||||
|
||||
// 设置测点序号(如果提供了有效值)
|
||||
if (point_id != 0) {
|
||||
ctx->real_point_id_ = point_id;
|
||||
}
|
||||
|
||||
std::cout << "[Device " << identifier
|
||||
<< "] Real state params set - count: " << count
|
||||
<< ", point_id: " << ctx->real_point_id_.load()
|
||||
<< std::endl;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
std::cerr << "[set_real_state_count] Device not found: " << identifier << std::endl;
|
||||
return false;
|
||||
}
|
||||
|
||||
//读取文件目录调用
|
||||
bool ClientManager::add_file_menu_action_to_device(
|
||||
const std::string& identifier,
|
||||
const std::string& file_path)
|
||||
{
|
||||
std::lock_guard<std::mutex> lock(mutex_);
|
||||
|
||||
// 查找匹配的设备
|
||||
for (auto& pair : clients_) {
|
||||
auto& ctx = pair.second;
|
||||
if (ctx->device_info.device_id == identifier ||
|
||||
ctx->device_info.mac == identifier)
|
||||
{
|
||||
// 生成文件目录读取报文
|
||||
auto packet = generate_getfilemenu_message(file_path);
|
||||
|
||||
// 添加动作到队列 (状态: 读取文件目录)
|
||||
ctx->add_action(DeviceState::READING_FILEMENU, packet);
|
||||
|
||||
// 如果当前空闲则立即执行
|
||||
if (ctx->current_state_ == DeviceState::IDLE) {
|
||||
ctx->process_next_action();
|
||||
}
|
||||
|
||||
return true; // 成功添加
|
||||
}
|
||||
}
|
||||
return false; // 设备未找到
|
||||
}
|
||||
|
||||
//文件下载调用
|
||||
bool ClientManager::add_file_download_action_to_device(
|
||||
const std::string& identifier,
|
||||
const std::string& file_path)
|
||||
{
|
||||
std::lock_guard<std::mutex> lock(mutex_);
|
||||
|
||||
// 查找匹配的设备
|
||||
for (auto& pair : clients_) {
|
||||
auto& ctx = pair.second;
|
||||
if (ctx->device_info.device_id == identifier ||
|
||||
ctx->device_info.mac == identifier)
|
||||
{
|
||||
// 生成下载请求报文 (帧序号固定为1,代表开始新文件的下载)
|
||||
auto downloadMsg = generate_downloadfile_message(1, file_path);
|
||||
|
||||
// 添加动作到队列 (状态: 读取文件目录)
|
||||
ctx->add_action(DeviceState::READING_FILEDATA, downloadMsg);
|
||||
|
||||
// 如果当前空闲则立即执行
|
||||
if (ctx->current_state_ == DeviceState::IDLE) {
|
||||
ctx->process_next_action();
|
||||
}
|
||||
|
||||
return true; // 成功添加
|
||||
}
|
||||
}
|
||||
return false; // 设备未找到
|
||||
}
|
||||
|
||||
//获取指定装置指定测点下的定值数据
|
||||
bool ClientManager::get_fixedvalue_action_to_device(const std::string& identifier, ushort point_id) {
|
||||
std::lock_guard<std::mutex> lock(mutex_);
|
||||
|
||||
// 查找匹配的设备
|
||||
for (auto& pair : clients_) {
|
||||
auto& ctx = pair.second;
|
||||
if (ctx->device_info.device_id == identifier ||
|
||||
ctx->device_info.mac == identifier)
|
||||
{
|
||||
// 生成定值数据报文
|
||||
auto packet = generate_requestFixValue_message(point_id);
|
||||
|
||||
// 添加动作到队列 (状态: 读取文件目录)
|
||||
ctx->add_action(DeviceState::READING_FIXEDVALUE, packet);
|
||||
|
||||
// 如果当前空闲则立即执行
|
||||
if (ctx->current_state_ == DeviceState::IDLE) {
|
||||
ctx->process_next_action();
|
||||
}
|
||||
|
||||
return true; // 成功添加
|
||||
}
|
||||
}
|
||||
return false; // 设备未找到
|
||||
}
|
||||
|
||||
//获取指定装置的定值描述
|
||||
bool ClientManager::get_fixedvaluedes_action_to_device(const std::string& identifier) {
|
||||
std::lock_guard<std::mutex> lock(mutex_);
|
||||
|
||||
// 查找匹配的设备
|
||||
for (auto& pair : clients_) {
|
||||
auto& ctx = pair.second;
|
||||
if (ctx->device_info.device_id == identifier ||
|
||||
ctx->device_info.mac == identifier)
|
||||
{
|
||||
// 生成定值描述报文
|
||||
auto packet = generate_requestFixDes_message();
|
||||
|
||||
// 添加动作到队列 (状态: 读取文件目录)
|
||||
ctx->add_action(DeviceState::READING_FIXEDVALUEDES, packet);
|
||||
|
||||
// 如果当前空闲则立即执行
|
||||
if (ctx->current_state_ == DeviceState::IDLE) {
|
||||
ctx->process_next_action();
|
||||
}
|
||||
|
||||
return true; // 成功添加
|
||||
}
|
||||
}
|
||||
return false; // 设备未找到
|
||||
}
|
||||
|
||||
//设置指定测点定值配置
|
||||
bool ClientManager::set_fixedvalue_action_to_device(const std::string& identifier, ushort point_id, const std::vector<float>& value) {
|
||||
std::lock_guard<std::mutex> lock(mutex_);
|
||||
|
||||
// 查找匹配的设备
|
||||
for (auto& pair : clients_) {
|
||||
auto& ctx = pair.second;
|
||||
if (ctx->device_info.device_id == identifier ||
|
||||
ctx->device_info.mac == identifier)
|
||||
{
|
||||
// 生成定值描述报文
|
||||
auto packet = generate_requestSetFixValue_message(point_id, value);
|
||||
|
||||
// 添加动作到队列 (状态: 读取文件目录)
|
||||
ctx->add_action(DeviceState::SET_FIXEDVALUE, packet);
|
||||
|
||||
// 如果当前空闲则立即执行
|
||||
if (ctx->current_state_ == DeviceState::IDLE) {
|
||||
ctx->process_next_action();
|
||||
}
|
||||
|
||||
return true; // 成功添加
|
||||
}
|
||||
}
|
||||
return false; // 设备未找到
|
||||
}
|
||||
|
||||
//获取装置内部定值
|
||||
bool ClientManager::get_interfixedvalue_action_to_device(const std::string& identifier) {
|
||||
std::lock_guard<std::mutex> lock(mutex_);
|
||||
|
||||
// 查找匹配的设备
|
||||
for (auto& pair : clients_) {
|
||||
auto& ctx = pair.second;
|
||||
if (ctx->device_info.device_id == identifier ||
|
||||
ctx->device_info.mac == identifier)
|
||||
{
|
||||
// 生成定值描述报文
|
||||
auto packet = generate_requestinterfixvalue_message();
|
||||
|
||||
// 添加动作到队列 (状态: 读取文件目录)
|
||||
ctx->add_action(DeviceState::READING_INTERFIXEDVALUE, packet);
|
||||
|
||||
// 如果当前空闲则立即执行
|
||||
if (ctx->current_state_ == DeviceState::IDLE) {
|
||||
ctx->process_next_action();
|
||||
}
|
||||
|
||||
return true; // 成功添加
|
||||
}
|
||||
}
|
||||
return false; // 设备未找到
|
||||
}
|
||||
|
||||
//获取装置内部定值控制字描述or内部定值描述 1-内部定值描述,2-控制字位描述
|
||||
bool ClientManager::get_fixedvalucontrolword_action_to_device(const std::string& identifier, unsigned char nDesCW) {
|
||||
std::lock_guard<std::mutex> lock(mutex_);
|
||||
|
||||
// 查找匹配的设备
|
||||
for (auto& pair : clients_) {
|
||||
auto& ctx = pair.second;
|
||||
if (ctx->device_info.device_id == identifier ||
|
||||
ctx->device_info.mac == identifier)
|
||||
{
|
||||
// 生成定值描述报文
|
||||
auto packet = generate_requestinterfixdes_message(nDesCW);
|
||||
|
||||
if (nDesCW == 1) {
|
||||
// 添加内部定值描述
|
||||
ctx->add_action(DeviceState::READING_INTERFIXEDVALUEDES, packet);
|
||||
}
|
||||
else {
|
||||
// 添加控制字描述
|
||||
ctx->add_action(DeviceState::READING_CONTROLWORD, packet);
|
||||
}
|
||||
|
||||
// 如果当前空闲则立即执行
|
||||
if (ctx->current_state_ == DeviceState::IDLE) {
|
||||
ctx->process_next_action();
|
||||
}
|
||||
|
||||
return true; // 成功添加
|
||||
}
|
||||
}
|
||||
return false; // 设备未找到
|
||||
}
|
||||
|
||||
//设置装置内部定值配置
|
||||
bool ClientManager::set_interfixedvalue_action_to_device(const std::string& identifier, const std::vector<uint16_t>& values) {
|
||||
std::lock_guard<std::mutex> lock(mutex_);
|
||||
|
||||
// 查找匹配的设备
|
||||
for (auto& pair : clients_) {
|
||||
auto& ctx = pair.second;
|
||||
if (ctx->device_info.device_id == identifier ||
|
||||
ctx->device_info.mac == identifier)
|
||||
{
|
||||
// 生成定值描述报文
|
||||
auto packet = generate_requestsetinterfixvalue_message(values);
|
||||
//auto packet = generate_requestsetinterfixvalue_message_new(values);
|
||||
|
||||
// 添加动作到队列 (状态: 读取文件目录)
|
||||
ctx->add_action(DeviceState::SET_INTERFIXEDVALUE, packet);
|
||||
|
||||
// 如果当前空闲则立即执行
|
||||
if (ctx->current_state_ == DeviceState::IDLE) {
|
||||
ctx->process_next_action();
|
||||
}
|
||||
|
||||
return true; // 成功添加
|
||||
}
|
||||
}
|
||||
return false; // 设备未找到
|
||||
}
|
||||
|
||||
//读取装置运行信息
|
||||
bool ClientManager::read_runninginformation_action_to_device(const std::string& identifier) {
|
||||
std::lock_guard<std::mutex> lock(mutex_);
|
||||
|
||||
// 查找匹配的设备
|
||||
for (auto& pair : clients_) {
|
||||
auto& ctx = pair.second;
|
||||
if (ctx->device_info.device_id == identifier ||
|
||||
ctx->device_info.mac == identifier)
|
||||
{
|
||||
// 生成定值描述报文
|
||||
auto packet = generate_machinestatus_message();
|
||||
|
||||
// 添加动作到队列 (状态: 读取文件目录)
|
||||
ctx->add_action(DeviceState::READING_RUNNINGINFORMATION_1, packet);
|
||||
|
||||
// 如果当前空闲则立即执行
|
||||
if (ctx->current_state_ == DeviceState::IDLE) {
|
||||
ctx->process_next_action();
|
||||
}
|
||||
|
||||
return true; // 成功添加
|
||||
}
|
||||
}
|
||||
return false; // 设备未找到
|
||||
}
|
||||
|
||||
//读取装置版本配置信息
|
||||
bool ClientManager::read_devversion_action_to_device(const std::string& identifier) {
|
||||
std::lock_guard<std::mutex> lock(mutex_);
|
||||
|
||||
// 查找匹配的设备
|
||||
for (auto& pair : clients_) {
|
||||
auto& ctx = pair.second;
|
||||
if (ctx->device_info.device_id == identifier ||
|
||||
ctx->device_info.mac == identifier)
|
||||
{
|
||||
// 生成定值描述报文
|
||||
auto packet = generate_machineversion_message();
|
||||
|
||||
// 添加动作到队列 (状态: 读取文件目录)
|
||||
ctx->add_action(DeviceState::READING_DEVVERSION, packet);
|
||||
|
||||
// 如果当前空闲则立即执行
|
||||
if (ctx->current_state_ == DeviceState::IDLE) {
|
||||
ctx->process_next_action();
|
||||
}
|
||||
|
||||
return true; // 成功添加
|
||||
}
|
||||
}
|
||||
return false; // 设备未找到
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief 补招事件日志动作
|
||||
* @param Time1 起始时间
|
||||
* @param Time2 结束时间
|
||||
* @param eventType 事件类型,默认2-暂态事件 4-告警时间
|
||||
* @param monitorPoint 监测点,默认1-监测点1 1-6 对应测点
|
||||
* @return 调用成功或失败的结果
|
||||
*/
|
||||
bool ClientManager::read_eventlog_action_to_device(const std::string& identifier, const std::tm& Time1, const std::tm& Time2,
|
||||
uint8_t eventType, uint8_t monitorPoint) {
|
||||
std::lock_guard<std::mutex> lock(mutex_);
|
||||
|
||||
// 查找匹配的设备
|
||||
for (auto& pair : clients_) {
|
||||
auto& ctx = pair.second;
|
||||
if (ctx->device_info.device_id == identifier ||
|
||||
ctx->device_info.mac == identifier)
|
||||
{
|
||||
ctx->event_lineNo = monitorPoint;
|
||||
// 生成定值描述报文
|
||||
auto packet = generate_recallevent_message(Time1, Time2, eventType, monitorPoint);
|
||||
|
||||
// 添加动作到队列 (状态: 读取文件目录)
|
||||
ctx->add_action(DeviceState::READING_EVENTLOG, packet);
|
||||
|
||||
// 如果当前空闲则立即执行
|
||||
if (ctx->current_state_ == DeviceState::IDLE) {
|
||||
ctx->process_next_action();
|
||||
}
|
||||
|
||||
return true; // 成功添加
|
||||
}
|
||||
}
|
||||
return false; // 设备未找到
|
||||
}
|
||||
|
||||
//获取指定装置测点的电压等级与接线方式
|
||||
bool ClientManager::get_point_scale_and_pttype(const std::string& identifier,
|
||||
ushort nCpuNo,
|
||||
std::string& out_scale,
|
||||
int& out_pttype) {
|
||||
std::lock_guard<std::mutex> lock(mutex_);
|
||||
|
||||
// 遍历所有客户端上下文
|
||||
for (auto& pair : clients_) {
|
||||
auto& ctx = pair.second;
|
||||
|
||||
// 检查标识符是否匹配设备ID或MAC地址
|
||||
if (ctx->device_info.device_id == identifier ||
|
||||
ctx->device_info.mac == identifier) {
|
||||
|
||||
// 在装置的测点列表中查找匹配的测点
|
||||
for (const auto& point : ctx->device_info.points) {
|
||||
if (point.nCpuNo == nCpuNo) {
|
||||
out_scale = point.strScale;
|
||||
out_pttype = point.nPTType;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
// 测点未找到
|
||||
std::cerr << "Point with nCpuNo " << nCpuNo
|
||||
<< " not found for device: " << identifier << std::endl;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
// 设备未找到
|
||||
std::cerr << "Device not found: " << identifier << std::endl;
|
||||
return false;
|
||||
}
|
||||
|
||||
//修改待发送报文的帧序号(仅在暂态文件中使用)
|
||||
bool ClientManager::update_current_packet_frame(const std::string& identifier, int next_frame) {
|
||||
std::lock_guard<std::mutex> lock(mutex_);
|
||||
|
||||
for (auto& pair : clients_) {
|
||||
auto& ctx = pair.second;
|
||||
if (ctx->device_info.device_id == identifier || ctx->device_info.mac == identifier) {
|
||||
std::lock_guard<std::mutex> state_lock(ctx->state_mutex_);
|
||||
|
||||
// 检查报文长度是否足够
|
||||
if (ctx->current_packet_.size() < 16) {
|
||||
std::cerr << "Packet too short to update frame number" << std::endl;
|
||||
return false;
|
||||
}
|
||||
|
||||
// 小端序写入新帧序号 (位置12-15字节)
|
||||
ctx->current_packet_[12] = (next_frame >> 0) & 0xFF;
|
||||
ctx->current_packet_[13] = (next_frame >> 8) & 0xFF;
|
||||
ctx->current_packet_[14] = (next_frame >> 16) & 0xFF;
|
||||
ctx->current_packet_[15] = (next_frame >> 24) & 0xFF;
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
bool ClientManager::parse_download_packet(const std::string& identifier, DownloadInfo& out_info) {
|
||||
std::lock_guard<std::mutex> lock(mutex_);
|
||||
|
||||
for (auto& pair : clients_) {
|
||||
auto& ctx = pair.second;
|
||||
if (ctx->device_info.device_id == identifier ||
|
||||
ctx->device_info.mac == identifier) {
|
||||
|
||||
// 获取当前状态报文
|
||||
std::vector<unsigned char> current_packet;
|
||||
{
|
||||
std::lock_guard<std::mutex> state_lock(ctx->state_mutex_);
|
||||
current_packet = ctx->current_packet_;
|
||||
}
|
||||
|
||||
// 解析帧序号 (12-15字节小端序)
|
||||
if (current_packet.size() >= 16) {
|
||||
out_info.current_frame =
|
||||
(static_cast<int>(current_packet[12])) |
|
||||
(static_cast<int>(current_packet[13]) << 8) |
|
||||
(static_cast<int>(current_packet[14]) << 16) |
|
||||
(static_cast<int>(current_packet[15]) << 24);
|
||||
|
||||
// 解析文件名 (从偏移量16开始)
|
||||
if (current_packet.size() > 16) {
|
||||
const char* filename_start = reinterpret_cast<const char*>(current_packet.data()) + 16;
|
||||
size_t filename_len = 128;
|
||||
out_info.filename.assign(filename_start, filename_len);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
bool ClientManager::add_file_packet_to_device(const std::string& identifier,
|
||||
int frame_index,
|
||||
const unsigned char* data,
|
||||
size_t size) {
|
||||
std::lock_guard<std::mutex> lock(mutex_);
|
||||
for (auto& pair : clients_) {
|
||||
auto& ctx = pair.second;
|
||||
if (ctx->device_info.device_id == identifier ||
|
||||
ctx->device_info.mac == identifier) {
|
||||
ctx->add_file_packet(frame_index, data, size);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
std::vector<std::vector<unsigned char>>
|
||||
ClientManager::get_and_clear_file_packets(const std::string& identifier) {
|
||||
std::lock_guard<std::mutex> lock(mutex_);
|
||||
for (auto& pair : clients_) {
|
||||
auto& ctx = pair.second;
|
||||
if (ctx->device_info.device_id == identifier ||
|
||||
ctx->device_info.mac == identifier) {
|
||||
return ctx->get_and_clear_file_packets();
|
||||
}
|
||||
}
|
||||
return {};
|
||||
}
|
||||
|
||||
bool ClientManager::update_current_filename(const std::string& identifier,
|
||||
const std::string& filename) {
|
||||
std::lock_guard<std::mutex> lock(mutex_);
|
||||
for (auto& pair : clients_) {
|
||||
auto& ctx = pair.second;
|
||||
if (ctx->device_info.device_id == identifier ||
|
||||
ctx->device_info.mac == identifier) {
|
||||
ctx->set_current_filename(filename);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
std::string ClientManager::get_current_filename(const std::string& identifier) {
|
||||
std::lock_guard<std::mutex> lock(mutex_);
|
||||
for (auto& pair : clients_) {
|
||||
auto& ctx = pair.second;
|
||||
if (ctx->device_info.device_id == identifier ||
|
||||
ctx->device_info.mac == identifier) {
|
||||
return ctx->get_current_filename();
|
||||
}
|
||||
}
|
||||
return "";
|
||||
}
|
||||
@@ -20,6 +20,8 @@ struct PointInfo {
|
||||
double PT2; // <20><>ѹ<EFBFBD><D1B9><EFBFBD><EFBFBD>2
|
||||
double CT1; // <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>1
|
||||
double CT2; // <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>2
|
||||
std::string strScale; // <20><>ѹ<EFBFBD>ȼ<EFBFBD>
|
||||
int nPTType; // <20><><EFBFBD>߷<EFBFBD>ʽ 0-<2D><><EFBFBD><EFBFBD> 1-<2D><><EFBFBD><EFBFBD>
|
||||
};
|
||||
|
||||
// װ<><D7B0><EFBFBD><EFBFBD>Ϣ<EFBFBD>ṹ
|
||||
@@ -30,6 +32,7 @@ struct DeviceInfo {
|
||||
std::string mac; // װ<><D7B0>MAC<41><43>ַ
|
||||
int status; // <20><><EFBFBD><EFBFBD>״̬ (0: <20><><EFBFBD><EFBFBD>, 1: <20><><EFBFBD><EFBFBD>)
|
||||
std::vector<PointInfo> points; // <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
bool righttime; //<2F><>ʱ<EFBFBD><CAB1><EFBFBD><EFBFBD><EFBFBD><EFBFBD>־
|
||||
};
|
||||
|
||||
enum class ConnectionState {
|
||||
@@ -40,9 +43,26 @@ enum class ConnectionState {
|
||||
|
||||
// <20><><EFBFBD>ӵ<EFBFBD>״̬ö<CCAC><C3B6>
|
||||
enum class DeviceState {
|
||||
IDLE, // <20><><EFBFBD><EFBFBD>״̬
|
||||
READING_STATS, // <20><>ȡͳ<C8A1><CDB3><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
READING_STATS_TIME, // <20><>ȡͳ<C8A1><CDB3>ʱ<EFBFBD><CAB1>
|
||||
IDLE, // <20><><EFBFBD><EFBFBD>״̬
|
||||
READING_STATS, // <20><>ȡͳ<C8A1><CDB3><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
READING_STATS_TIME, // <20><>ȡͳ<C8A1><CDB3>ʱ<EFBFBD><CAB1>
|
||||
READING_REALSTAT, // <20><>ȡʵʱ<CAB5><CAB1><EFBFBD><EFBFBD>
|
||||
READING_EVENTFILE, // <20><>̬<EFBFBD><CCAC><EFBFBD><EFBFBD><EFBFBD>ļ<EFBFBD><C4BC><EFBFBD><EFBFBD><EFBFBD>
|
||||
READING_FILEMENU, // <20><>ȡ<EFBFBD>ļ<EFBFBD>Ŀ¼
|
||||
READING_FILEDATA, // <20><><EFBFBD><EFBFBD><EFBFBD>ļ<EFBFBD><C4BC><EFBFBD><EFBFBD><EFBFBD>
|
||||
READING_FIXEDVALUE, // <20><>ȡ<EFBFBD><C8A1><EFBFBD>㶨ֵ
|
||||
READING_FIXEDVALUEDES, // <20><>ȡ<EFBFBD><C8A1><EFBFBD>㶨ֵ<E3B6A8><D6B5><EFBFBD><EFBFBD>
|
||||
SET_FIXEDVALUE, // <20><><EFBFBD>ò<EFBFBD><C3B2>㶨ֵ
|
||||
READING_INTERFIXEDVALUE, // <20><>ȡ<EFBFBD>ڲ<EFBFBD><DAB2><EFBFBD>ֵ
|
||||
READING_INTERFIXEDVALUEDES, // <20><>ȡ<EFBFBD>ڲ<EFBFBD><DAB2><EFBFBD>ֵ<EFBFBD><D6B5><EFBFBD><EFBFBD>
|
||||
READING_CONTROLWORD, // <20><>ȡ<EFBFBD><C8A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
SET_INTERFIXEDVALUE, // <20><><EFBFBD><EFBFBD><EFBFBD>ڲ<EFBFBD><DAB2><EFBFBD>ֵ
|
||||
READING_RUNNINGINFORMATION_1,// <20><>ȡװ<C8A1><D7B0><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϣ(<28><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>)
|
||||
READING_RUNNINGINFORMATION_2,// <20><>ȡװ<C8A1><D7B0><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϣ(<28><>ʱִ<CAB1><D6B4>)
|
||||
READING_DEVVERSION, // <20><>ȡװ<C8A1>ð汾<C3B0><E6B1BE><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϣ
|
||||
SET_RIGHTTIME, // <20><><EFBFBD><EFBFBD>װ<EFBFBD>ö<EFBFBD>ʱ
|
||||
READING_EVENTLOG, // <20><><EFBFBD><EFBFBD><EFBFBD>¼<EFBFBD><C2BC><EFBFBD>־
|
||||
READING_STATSFILE, // <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>̬<EFBFBD><CCAC><EFBFBD><EFBFBD><EFBFBD>ļ<EFBFBD>
|
||||
// <20>ɸ<EFBFBD><C9B8><EFBFBD><EFBFBD><EFBFBD>Ҫ<EFBFBD><D2AA><EFBFBD>Ӹ<EFBFBD><D3B8><EFBFBD>״̬
|
||||
CUSTOM_ACTION // <20>Զ<EFBFBD><D4B6>嶯<EFBFBD><E5B6AF>
|
||||
};
|
||||
@@ -62,9 +82,18 @@ public:
|
||||
ConnectionState state;
|
||||
int reconnect_attempts;
|
||||
volatile bool shutdown;
|
||||
uint64_t last_state_query_time_ = 0; // ͳ<><CDB3><EFBFBD><EFBFBD><EFBFBD>ݼ<EFBFBD>ʱʱ<CAB1><CAB1><EFBFBD><EFBFBD>
|
||||
uint64_t real_state_query_time_ = 0; // ʵʱ<CAB5><CAB1><EFBFBD>ݼ<EFBFBD>ʱʱ<CAB1><CAB1><EFBFBD><EFBFBD>
|
||||
std::atomic<int> real_state_count{ 0 };//ʵʱ<CAB5><CAB1><EFBFBD><EFBFBD><EFBFBD>շ<EFBFBD><D5B7><EFBFBD><EFBFBD><EFBFBD> ԭ<>Ӳ<EFBFBD><D3B2><EFBFBD><EFBFBD><EFBFBD>֤<EFBFBD>̰߳<DFB3>ȫ
|
||||
std::atomic<ushort> real_point_id_{ 1 }; // <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʵʱ<CAB5><CAB1><EFBFBD>ݶ<EFBFBD>ȡ<EFBFBD>IJ<EFBFBD><C4B2><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ţ<EFBFBD>ԭ<EFBFBD>Ӳ<EFBFBD><D3B2><EFBFBD><EFBFBD><EFBFBD>
|
||||
uint64_t read_runninginformationMsg = 0; // װ<>ö<EFBFBD>ʱ<EFBFBD><CAB1>ȡ<EFBFBD><C8A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϣʱ<CFA2><CAB1><EFBFBD><EFBFBD>
|
||||
uint64_t right_time = 0; // װ<>ö<EFBFBD>ʱ<EFBFBD><CAB1>ʱʱ<CAB1><CAB1><EFBFBD><EFBFBD>
|
||||
|
||||
DeviceInfo device_info; // װ<><D7B0><EFBFBD><EFBFBD>Ϣ
|
||||
int cloudstatus; // <20><>ǰ<EFBFBD>õ<EFBFBD>¼״̬<D7B4><CCAC>0<EFBFBD><30>δ<EFBFBD><CEB4>¼ 1<><31><EFBFBD>ѵ<EFBFBD>¼<EFBFBD><C2BC>
|
||||
int cloudstatus = 0; // <20><>ǰ<EFBFBD>õ<EFBFBD>¼״̬<D7B4><CCAC>0<EFBFBD><30>δ<EFBFBD><CEB4>¼ 1<><31><EFBFBD>ѵ<EFBFBD>¼<EFBFBD><C2BC><EFBFBD><EFBFBD>ʼ<EFBFBD><EFBFBD>Ĭ<EFBFBD><EFBFBD>Ϊ0
|
||||
uint64_t get_cloudmessage_time = 0;//<2F><>ȡ<EFBFBD><C8A1><EFBFBD><EFBFBD>װ<EFBFBD><D7B0>ͨѶ<CDA8><D1B6><EFBFBD><EFBFBD>ʱ<EFBFBD><CAB1>
|
||||
uint64_t login_cloud_time = 0;//װ<>õ<EFBFBD>¼<EFBFBD><C2BC><EFBFBD>ij<EFBFBD>ʱ<EFBFBD><CAB1><EFBFBD><EFBFBD>ʱ<EFBFBD><CAB1>
|
||||
std::string dev_CloudProtocolVer = "V1.0";//װ<><D7B0><EFBFBD><EFBFBD>Э<EFBFBD><D0AD><EFBFBD>汾<EFBFBD><E6B1BE> <20><><EFBFBD><EFBFBD>V1.5<EFBFBD><EFBFBD>װ<EFBFBD>õ<EFBFBD>¼<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ȡһ<EFBFBD>Σ<EFBFBD><EFBFBD><EFBFBD>ǰ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ж϶<EFBFBD>ʱ<EFBFBD>汾<EFBFBD><EFBFBD>,<2C><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ĭ<EFBFBD><C4AC>ΪV1.0
|
||||
|
||||
// <20><><EFBFBD><EFBFBD>״̬<D7B4><CCAC><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ա
|
||||
DeviceState current_state_; // <20><>ǰװ<C7B0><D7B0>״̬
|
||||
@@ -96,14 +125,21 @@ public:
|
||||
std::vector<unsigned char> data;
|
||||
};
|
||||
|
||||
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>------------------------------------------------------------------------
|
||||
std::vector<StatPacket> stat_packets_cache_; // <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>֡<EFBFBD><D6A1><EFBFBD><EFBFBD>
|
||||
int expected_total_packets_ = 0; // Ԥ<><D4A4><EFBFBD><EFBFBD>֡<EFBFBD><D6A1>
|
||||
std::mutex stat_cache_mutex_; // <20><><EFBFBD>滥<EFBFBD><E6BBA5><EFBFBD><EFBFBD>
|
||||
|
||||
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
bool add_stat_packet(const std::vector<unsigned char>& packet, int current_packet, int total_packets);//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>֡<EFBFBD><D6A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
std::vector<StatPacket> get_and_clear_stat_packets();//ȡ<><C8A1><EFBFBD><EFBFBD><EFBFBD>л<EFBFBD><D0BB><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ݲ<EFBFBD><DDB2><EFBFBD><EFBFBD>ջ<EFBFBD><D5BB><EFBFBD>
|
||||
void clear_stat_cache();//<2F><><EFBFBD>ջ<EFBFBD><D5BB><EFBFBD>
|
||||
// <20><><EFBFBD><EFBFBD><EFBFBD>¼<EFBFBD><C2BC><EFBFBD>־<EFBFBD><D6BE><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>-----------------------------------------------------------------
|
||||
ushort event_lineNo = 1; // <20>¼<EFBFBD><C2BC><EFBFBD>־<EFBFBD><D6BE><EFBFBD><EFBFBD><EFBFBD>в<EFBFBD><D0B2><EFBFBD>
|
||||
std::vector<StatPacket> event_stat_packets_cache_; // <20>¼<EFBFBD><C2BC><EFBFBD>־<EFBFBD><D6BE><EFBFBD><EFBFBD><EFBFBD><EFBFBD>֡<EFBFBD><D6A1><EFBFBD><EFBFBD>
|
||||
int event_expected_total_packets_ = 0; // <20>¼<EFBFBD><C2BC><EFBFBD>־Ԥ<D6BE><D4A4><EFBFBD><EFBFBD>֡<EFBFBD><D6A1>
|
||||
std::mutex event_stat_cache_mutex_; // <20>¼<EFBFBD><C2BC><EFBFBD>־<EFBFBD><D6BE><EFBFBD>滥<EFBFBD><E6BBA5><EFBFBD><EFBFBD>
|
||||
bool event_add_stat_packet(const std::vector<unsigned char>& packet, int current_packet, int total_packets);//<2F>¼<EFBFBD><C2BC><EFBFBD>־<EFBFBD><D6BE><EFBFBD><EFBFBD><EFBFBD><EFBFBD>֡<EFBFBD><D6A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
std::vector<StatPacket> event_get_and_clear_stat_packets();//<2F>¼<EFBFBD><C2BC><EFBFBD>־ȡ<D6BE><C8A1><EFBFBD><EFBFBD><EFBFBD>л<EFBFBD><D0BB><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ݲ<EFBFBD><DDB2><EFBFBD><EFBFBD>ջ<EFBFBD><D5BB><EFBFBD>
|
||||
void event_clear_stat_cache();//<2F>¼<EFBFBD><C2BC><EFBFBD>־<EFBFBD><D6BE><EFBFBD>ջ<EFBFBD><D5BB><EFBFBD>
|
||||
|
||||
// ͳ<><CDB3><EFBFBD><EFBFBD><EFBFBD>ݻ<EFBFBD><DDBB><EFBFBD>
|
||||
struct PointFloatCache {
|
||||
@@ -122,6 +158,94 @@ public:
|
||||
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>и<EFBFBD><D0B8><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ݻ<EFBFBD><DDBB><EFBFBD>
|
||||
void clear_float_cache();
|
||||
|
||||
// ʵʱ<CAB5><CAB1><EFBFBD>ݰ<EFBFBD><DDB0><EFBFBD><EFBFBD><EFBFBD>
|
||||
struct RealtimePacket {
|
||||
unsigned char packet_type;
|
||||
std::vector<unsigned char> data;
|
||||
};
|
||||
|
||||
std::vector<RealtimePacket> realtime_packets_cache_; // <20><><EFBFBD><EFBFBD>ʵʱ<CAB5><CAB1><EFBFBD>ݰ<EFBFBD>
|
||||
std::mutex realtime_cache_mutex_; // <20><><EFBFBD>滥<EFBFBD><E6BBA5><EFBFBD><EFBFBD>
|
||||
|
||||
// <20><><EFBFBD><EFBFBD>ʵʱ<CAB5><CAB1><EFBFBD>ݰ<EFBFBD><DDB0><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
void add_realtime_packet(unsigned char packet_type,
|
||||
const unsigned char* data,
|
||||
size_t size) {
|
||||
std::lock_guard<std::mutex> lock(realtime_cache_mutex_);
|
||||
realtime_packets_cache_.push_back({
|
||||
packet_type,
|
||||
std::vector<unsigned char>(data, data + size)
|
||||
});
|
||||
}
|
||||
|
||||
// <20><>ȡ<EFBFBD><C8A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʵʱ<CAB5><CAB1><EFBFBD>ݻ<EFBFBD><DDBB><EFBFBD>
|
||||
std::vector<RealtimePacket> get_and_clear_realtime_packets() {
|
||||
std::lock_guard<std::mutex> lock(realtime_cache_mutex_);
|
||||
auto packets = std::move(realtime_packets_cache_);
|
||||
realtime_packets_cache_.clear();
|
||||
return packets;
|
||||
}
|
||||
|
||||
// <20><><EFBFBD><EFBFBD>ʵʱ<CAB5><CAB1><EFBFBD>ݣ<EFBFBD><DDA3><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>棩
|
||||
void reset_realtime_data() {
|
||||
std::lock_guard<std::mutex> lock(realtime_cache_mutex_);
|
||||
realtime_packets_cache_.clear();
|
||||
}
|
||||
|
||||
//<2F><>̬<EFBFBD>ļ<EFBFBD><C4BC><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
struct FileDownloadPacket {
|
||||
int frame_index;
|
||||
std::vector<unsigned char> data;
|
||||
};
|
||||
|
||||
std::vector<FileDownloadPacket> file_download_cache_; // <20>ļ<EFBFBD><C4BC><EFBFBD>Ƭ<EFBFBD><C6AC><EFBFBD><EFBFBD>
|
||||
std::string current_filename_; // <20><>ǰ<EFBFBD><C7B0><EFBFBD>ص<EFBFBD><D8B5>ļ<EFBFBD><C4BC><EFBFBD>
|
||||
std::mutex file_cache_mutex_; // <20><><EFBFBD>滥<EFBFBD><E6BBA5><EFBFBD><EFBFBD>
|
||||
|
||||
// <20><><EFBFBD><EFBFBD><EFBFBD>ļ<EFBFBD><C4BC><EFBFBD>Ƭ<EFBFBD><C6AC><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
void add_file_packet(int frame_index, const unsigned char* data, size_t size) {
|
||||
std::lock_guard<std::mutex> lock(file_cache_mutex_);
|
||||
file_download_cache_.push_back({ frame_index, std::vector<unsigned char>(data, data + size) });
|
||||
}
|
||||
|
||||
// <20><>ȡ<EFBFBD><C8A1><EFBFBD><EFBFBD><EFBFBD>ջ<EFBFBD><D5BB><EFBFBD><EFBFBD>е<EFBFBD><D0B5><EFBFBD><EFBFBD>з<EFBFBD>Ƭ<EFBFBD><C6AC><EFBFBD><EFBFBD>֡<EFBFBD><D6A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
std::vector<std::vector<unsigned char>> get_and_clear_file_packets() {
|
||||
std::lock_guard<std::mutex> lock(file_cache_mutex_);
|
||||
|
||||
// <20><>֡<EFBFBD><D6A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
std::sort(file_download_cache_.begin(), file_download_cache_.end(),
|
||||
[](const FileDownloadPacket& a, const FileDownloadPacket& b) {
|
||||
return a.frame_index < b.frame_index;
|
||||
});
|
||||
|
||||
// <20><>ȡ<EFBFBD><C8A1><EFBFBD><EFBFBD>
|
||||
std::vector<std::vector<unsigned char>> packets;
|
||||
for (const auto& pkt : file_download_cache_) {
|
||||
packets.push_back(pkt.data);
|
||||
}
|
||||
|
||||
// <20><><EFBFBD>ջ<EFBFBD><D5BB><EFBFBD>
|
||||
file_download_cache_.clear();
|
||||
return packets;
|
||||
}
|
||||
|
||||
// <20><><EFBFBD><EFBFBD><EFBFBD>ļ<EFBFBD><C4BC><EFBFBD><EFBFBD><EFBFBD>
|
||||
void clear_file_cache() {
|
||||
std::lock_guard<std::mutex> lock(file_cache_mutex_);
|
||||
file_download_cache_.clear();
|
||||
}
|
||||
|
||||
// <20><><EFBFBD>õ<EFBFBD>ǰ<EFBFBD><C7B0><EFBFBD>ص<EFBFBD><D8B5>ļ<EFBFBD><C4BC><EFBFBD>
|
||||
void set_current_filename(const std::string& filename) {
|
||||
std::lock_guard<std::mutex> lock(file_cache_mutex_);
|
||||
current_filename_ = filename;
|
||||
}
|
||||
|
||||
// <20><>ȡ<EFBFBD><C8A1>ǰ<EFBFBD><C7B0><EFBFBD>ص<EFBFBD><D8B5>ļ<EFBFBD><C4BC><EFBFBD>
|
||||
std::string get_current_filename() {
|
||||
std::lock_guard<std::mutex> lock(file_cache_mutex_);
|
||||
return current_filename_;
|
||||
}
|
||||
private:
|
||||
int index_;
|
||||
|
||||
@@ -146,7 +270,6 @@ public:
|
||||
|
||||
void add_device(const DeviceInfo& device);//<2F><><EFBFBD><EFBFBD>һ<EFBFBD><D2BB>װ<EFBFBD><D7B0><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
void remove_device(const std::string& device_id);//ɾ<><C9BE>һ<EFBFBD><D2BB>װ<EFBFBD><D7B0><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
bool send_to_device(const std::string& identifier, const unsigned char* data, size_t size);//ѡ<><D1A1>ָ<EFBFBD><D6B8><EFBFBD><EFBFBD>װ<EFBFBD>÷<EFBFBD><C3B7><EFBFBD><EFBFBD><EFBFBD>Ϣ<EFBFBD><CFA2><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
void restart_device(const std::string& device_id);//<2F>ر<EFBFBD>ָ<EFBFBD><D6B8>װ<EFBFBD><D7B0><EFBFBD><EFBFBD><EFBFBD>ӣ<EFBFBD><D3A3>ȴ<EFBFBD><C8B4><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
void stop_all();//ֹͣ<CDA3><D6B9><EFBFBD>пͻ<D0BF><CDBB><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
bool set_cloud_status(const std::string& identifier, int status);//<2F><EFBFBD><DEB8><EFBFBD>ǰ<EFBFBD>õ<EFBFBD>¼״̬
|
||||
@@ -182,12 +305,27 @@ public:
|
||||
//<2F><><EFBFBD>ն<EFBFBD>֡<EFBFBD><D6A1><EFBFBD>ı<EFBFBD><C4B1>滺<EFBFBD><E6BBBA><EFBFBD><EFBFBD>
|
||||
bool clear_stat_cache(const std::string& identifier);
|
||||
|
||||
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>֡<EFBFBD>¼<EFBFBD><C2BC><EFBFBD>־<EFBFBD><D6BE><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ȴ<EFBFBD><C8B4><EFBFBD>ȫ
|
||||
bool add_eventlog_packet_to_device(const std::string& identifier,
|
||||
const std::vector<unsigned char>& packet,
|
||||
int current_packet,
|
||||
int total_packets);
|
||||
|
||||
//<2F><>ȡ<EFBFBD><C8A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ж<EFBFBD>֡<EFBFBD>¼<EFBFBD><C2BC><EFBFBD>־<EFBFBD><D6BE><EFBFBD>IJ<EFBFBD><C4B2><EFBFBD><EFBFBD>ջ<EFBFBD><D5BB><EFBFBD>
|
||||
std::vector<ClientContext::StatPacket> get_and_clear_event_packets(const std::string& identifier);
|
||||
|
||||
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>¼<EFBFBD><C2BC><EFBFBD>־<EFBFBD><D6BE><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
bool clear_event_cache(const std::string& identifier);
|
||||
|
||||
// <20><>ȡָ<C8A1><D6B8><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>PT<50><54>CT<43><54><EFBFBD><EFBFBD>ֵ
|
||||
bool get_pt_ct_ratio(const std::string& identifier,
|
||||
int16_t nCpuNo,
|
||||
float& pt_ratio,
|
||||
float& ct_ratio);
|
||||
|
||||
// <20><>ȡ<EFBFBD><C8A1><EFBFBD><EFBFBD><EFBFBD>в<EFBFBD><D0B2><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
bool get_event_lineid(const std::string& identifier, int& nCpuNo);
|
||||
|
||||
// <20><>ȡ<EFBFBD>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
size_t client_count() {
|
||||
std::lock_guard<std::mutex> lock(mutex_);
|
||||
@@ -207,6 +345,114 @@ public:
|
||||
// <20><><EFBFBD><EFBFBD><EFBFBD>豸<EFBFBD><E8B1B8><EFBFBD><EFBFBD><EFBFBD>и<EFBFBD><D0B8>㻺<EFBFBD><E3BBBA>
|
||||
bool clear_float_cache(const std::string& identifier);
|
||||
|
||||
// <20><><EFBFBD><EFBFBD>ʵʱ<CAB5><CAB1><EFBFBD>ݰ<EFBFBD><DDB0><EFBFBD><EFBFBD>豸<EFBFBD><E8B1B8><EFBFBD><EFBFBD>
|
||||
bool add_realtime_packet_to_device(const std::string& identifier,
|
||||
unsigned char packet_type,
|
||||
const unsigned char* data,
|
||||
size_t size) {
|
||||
std::lock_guard<std::mutex> lock(mutex_);
|
||||
for (auto& pair : clients_) {
|
||||
auto& ctx = pair.second;
|
||||
if (ctx->device_info.device_id == identifier ||
|
||||
ctx->device_info.mac == identifier) {
|
||||
ctx->add_realtime_packet(packet_type, data, size);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
// <20><>ȡ<EFBFBD><C8A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʵʱ<CAB5><CAB1><EFBFBD>ݻ<EFBFBD><DDBB><EFBFBD>
|
||||
std::vector<ClientContext::RealtimePacket>
|
||||
get_and_clear_realtime_packets(const std::string& identifier) {
|
||||
std::lock_guard<std::mutex> lock(mutex_);
|
||||
for (auto& pair : clients_) {
|
||||
auto& ctx = pair.second;
|
||||
if (ctx->device_info.device_id == identifier ||
|
||||
ctx->device_info.mac == identifier) {
|
||||
return ctx->get_and_clear_realtime_packets();
|
||||
}
|
||||
}
|
||||
return {};
|
||||
}
|
||||
|
||||
// <20><>ȡָ<C8A1><D6B8><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ĵ<EFBFBD>ѹ<EFBFBD>ȼ<EFBFBD><C8BC>ͽ<EFBFBD><CDBD>߷<EFBFBD>ʽ
|
||||
bool get_point_scale_and_pttype(const std::string& identifier,
|
||||
ushort nCpuNo,
|
||||
std::string& out_scale,
|
||||
int& out_pttype);
|
||||
|
||||
//<2F><EFBFBD><DEB8><EFBFBD>̬<EFBFBD><CCAC><EFBFBD><EFBFBD><EFBFBD>ļ<EFBFBD><C4BC><EFBFBD><EFBFBD>ĵ<EFBFBD>֡<EFBFBD><D6A1><EFBFBD><EFBFBD>
|
||||
bool update_current_packet_frame(const std::string& identifier, int next_frame);
|
||||
|
||||
//<2F><>ȡ<EFBFBD><C8A1>̬<EFBFBD>ļ<EFBFBD><C4BC><EFBFBD><EFBFBD>ر<EFBFBD><D8B1><EFBFBD><EFBFBD>е<EFBFBD><D0B5><EFBFBD>Ϣ
|
||||
struct DownloadInfo {
|
||||
std::string filename;
|
||||
int current_frame;
|
||||
};
|
||||
bool parse_download_packet(const std::string& identifier, DownloadInfo& out_info);
|
||||
|
||||
bool add_file_packet_to_device(const std::string& identifier,
|
||||
int frame_index,
|
||||
const unsigned char* data,
|
||||
size_t size);
|
||||
|
||||
std::vector<std::vector<unsigned char>> get_and_clear_file_packets(const std::string& identifier);
|
||||
|
||||
bool update_current_filename(const std::string& identifier, const std::string& filename);
|
||||
|
||||
std::string get_current_filename(const std::string& identifier);
|
||||
|
||||
//ˢ<>¿ͻ<C2BF><CDBB><EFBFBD>װ<EFBFBD><D7B0><EFBFBD><EFBFBD><EFBFBD>½<EFBFBD><C2BD><EFBFBD>ͨѶ<CDA8><D1B6><EFBFBD><EFBFBD>ʱ<EFBFBD><CAB1>
|
||||
bool set_cloudmessage_time(const std::string& identifier);
|
||||
|
||||
//<2F><>ȡ<EFBFBD><C8A1><EFBFBD>Ŀͻ<C4BF><CDBB>˵<EFBFBD>װ<EFBFBD><D7B0><EFBFBD><EFBFBD>ά<EFBFBD><CEAC>Ϣ<EFBFBD>Ա<EFBFBD><D4B1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><E0B9A6>ʹ<EFBFBD><CAB9>
|
||||
bool set_versioninformation(const std::string& identifier, string cloud_version);
|
||||
|
||||
//<2F><>ȡ<EFBFBD>ļ<EFBFBD>Ŀ¼<C4BF><C2BC><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD>mac/id + <20>ļ<EFBFBD>·<EFBFBD><C2B7>
|
||||
bool add_file_menu_action_to_device(const std::string& identifier, const std::string& file_path);
|
||||
|
||||
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʵʱ<CAB5><CAB1><EFBFBD><EFBFBD><EFBFBD>շ<EFBFBD><D5B7><EFBFBD><EFBFBD><EFBFBD> ʵʱ<CAB5><CAB1><EFBFBD>ݵ<EFBFBD><DDB5><EFBFBD> <20><><EFBFBD><EFBFBD>mac/id + ʵʱ<CAB5><CAB1><EFBFBD><EFBFBD> + <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
bool set_real_state_count(const std::string& identifier, int count, ushort point_id);
|
||||
|
||||
//<2F>ļ<EFBFBD><C4BC><EFBFBD><EFBFBD>ص<EFBFBD><D8B5><EFBFBD> <20><><EFBFBD><EFBFBD>mac/id + <20>ļ<EFBFBD>λ<EFBFBD><CEBB>
|
||||
bool add_file_download_action_to_device(const std::string& identifier, const std::string& file_path);
|
||||
|
||||
//<2F><>ȡָ<C8A1><D6B8>װ<EFBFBD><D7B0>ָ<EFBFBD><D6B8><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>µĶ<C2B5>ֵ<EFBFBD><D6B5><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD>mac/id + <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
bool get_fixedvalue_action_to_device(const std::string& identifier, ushort point_id);
|
||||
|
||||
//<2F><>ȡָ<C8A1><D6B8>װ<EFBFBD>ö<EFBFBD>ֵ<EFBFBD><D6B5><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD>mac/id
|
||||
bool get_fixedvaluedes_action_to_device(const std::string& identifier);
|
||||
|
||||
//<2F><><EFBFBD><EFBFBD>ָ<EFBFBD><D6B8><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ķ<EFBFBD>ֵ<EFBFBD><D6B5><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD>mac/id + <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> + <20><>ʱ<EFBFBD><CAB1><EFBFBD><EFBFBD>
|
||||
bool set_fixedvalue_action_to_device(const std::string& identifier, ushort point_id, const std::vector<float>& value);
|
||||
|
||||
//<2F><>ȡװ<C8A1><D7B0><EFBFBD>ڲ<EFBFBD><DAB2><EFBFBD>ֵ <20><><EFBFBD><EFBFBD>mac/id
|
||||
bool get_interfixedvalue_action_to_device(const std::string& identifier);
|
||||
|
||||
//<2F><>ȡװ<C8A1><D7B0><EFBFBD>ڲ<EFBFBD><DAB2><EFBFBD>ֵ<EFBFBD><D6B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>or<6F>ڲ<EFBFBD><DAB2><EFBFBD>ֵ<EFBFBD><D6B5><EFBFBD><EFBFBD> 1-<2D>ڲ<EFBFBD><DAB2><EFBFBD>ֵ<EFBFBD><D6B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD>2-<2D><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>λ<EFBFBD><CEBB><EFBFBD><EFBFBD>
|
||||
bool get_fixedvalucontrolword_action_to_device(const std::string& identifier, unsigned char nDesCW);
|
||||
|
||||
//<2F><><EFBFBD><EFBFBD>װ<EFBFBD><D7B0><EFBFBD>ڲ<EFBFBD><DAB2><EFBFBD>ֵ <20><><EFBFBD><EFBFBD>mac/id + <20>ڲ<EFBFBD><DAB2><EFBFBD>ֵ<EFBFBD><D6B5><EFBFBD><EFBFBD>
|
||||
bool set_interfixedvalue_action_to_device(const std::string& identifier, const std::vector<uint16_t>& values);
|
||||
|
||||
//<2F><>ȡװ<C8A1><D7B0><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϣ
|
||||
bool read_runninginformation_action_to_device(const std::string& identifier);
|
||||
|
||||
//<2F><>ȡװ<C8A1>ð汾<C3B0><E6B1BE><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϣ
|
||||
bool read_devversion_action_to_device(const std::string& identifier);
|
||||
|
||||
//<2F>豸<EFBFBD><E8B1B8><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ж<EFBFBD>
|
||||
bool get_dev_status(const std::string& identifier);
|
||||
/**
|
||||
* @brief <20><><EFBFBD><EFBFBD><EFBFBD>¼<EFBFBD><C2BC><EFBFBD>־<EFBFBD><D6BE><EFBFBD><EFBFBD>
|
||||
* @param Time1 <20><>ʼʱ<CABC><CAB1>
|
||||
* @param Time2 <20><><EFBFBD><EFBFBD>ʱ<EFBFBD><CAB1>
|
||||
* @param eventType <20>¼<EFBFBD><C2BC><EFBFBD><EFBFBD>ͣ<EFBFBD>Ĭ<EFBFBD><C4AC>2-<2D><>̬<EFBFBD>¼<EFBFBD> 4-<2D>澯ʱ<E6BEAF><CAB1>
|
||||
* @param monitorPoint <20><><EFBFBD><EFBFBD><EFBFBD>㣬Ĭ<E3A3AC><C4AC>1-<2D><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>1 1-6 <20><>Ӧ<EFBFBD><D3A6><EFBFBD><EFBFBD>
|
||||
* @return <20><><EFBFBD>óɹ<C3B3><C9B9><EFBFBD>ʧ<EFBFBD>ܵĽ<DCB5><C4BD><EFBFBD>
|
||||
*/
|
||||
bool read_eventlog_action_to_device(const std::string& identifier, const std::tm& Time1, const std::tm& Time2,uint8_t eventType = 2, uint8_t monitorPoint = 1);
|
||||
private:
|
||||
ClientManager() : loop_(nullptr) {}
|
||||
std::unordered_map<std::string, std::unique_ptr<ClientContext>> clients_;
|
||||
@@ -217,6 +463,7 @@ private:
|
||||
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
void start_client_connect(const std::vector<DeviceInfo>& devices);
|
||||
void send_binary_data(ClientContext* ctx, const unsigned char* data, size_t data_size);
|
||||
void safe_send_binary_data(ClientContext* ctx, std::vector<unsigned char> data);
|
||||
void on_timer(uv_timer_t* handle);
|
||||
void try_reconnect(uv_timer_t* timer);
|
||||
void on_connect(uv_connect_t* req, int status);
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -25,7 +25,7 @@
|
||||
#include "interface.h"
|
||||
#include "rocketmq.h"
|
||||
#include "nlohmann/json.hpp"
|
||||
#include "log4cplus/log4.h"
|
||||
#include "log4.h"
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
@@ -48,9 +48,9 @@ std::vector<terminal_dev> terminal_devlist;
|
||||
std::mutex ledgermtx;
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
extern int g_front_seg_index;
|
||||
|
||||
extern int g_front_seg_num;
|
||||
extern std::string FRONT_IP;
|
||||
|
||||
extern uint32_t g_node_id;
|
||||
|
||||
//筛选的终端状态:数组【0,1】筛选运行和在运
|
||||
@@ -181,14 +181,14 @@ void handleUploadResponse(const std::string& response, std::string& wavepath) {
|
||||
std::cout << "File URL: " << url << std::endl;
|
||||
|
||||
// 找到最后一个 '.'
|
||||
size_t pos = fileName.find_last_of('.');
|
||||
size_t pos = name.find_last_of('.');
|
||||
std::string nameWithoutExt;
|
||||
if (pos != std::string::npos) {
|
||||
// 截取去掉后缀的部分
|
||||
nameWithoutExt = fileName.substr(0, pos);
|
||||
nameWithoutExt = name.substr(0, pos);
|
||||
} else {
|
||||
// 如果没有后缀,直接使用原文件名
|
||||
nameWithoutExt = fileName;
|
||||
nameWithoutExt = name;
|
||||
}
|
||||
|
||||
// 拷贝到 wavepath
|
||||
@@ -200,9 +200,28 @@ void handleUploadResponse(const std::string& response, std::string& wavepath) {
|
||||
|
||||
//上传文件
|
||||
void SendFileWeb(const std::string& strUrl, const std::string& localpath, const std::string& cloudpath, std::string& wavepath) {
|
||||
|
||||
// 基本存在性检查
|
||||
if (access(localpath.c_str(), F_OK) != 0) {
|
||||
std::cerr << "Local file does not exist: " << localpath << std::endl;
|
||||
return;
|
||||
}
|
||||
// ★新增:stat 打印大小,便于快速确认读源
|
||||
struct stat st {};
|
||||
if (stat(localpath.c_str(), &st) != 0) {
|
||||
perror("stat");
|
||||
} else {
|
||||
std::cout << "[debug] upload file: " << localpath
|
||||
<< ", size=" << static_cast<long long>(st.st_size) << " bytes\n";
|
||||
}
|
||||
|
||||
// 初始化 curl
|
||||
CURL* curl = curl_easy_init();
|
||||
if (curl) {
|
||||
// ★新增:错误缓冲,便于看到更具体的错误
|
||||
char errbuf[CURL_ERROR_SIZE] = {0};
|
||||
curl_easy_setopt(curl, CURLOPT_ERRORBUFFER, errbuf); // ★新增
|
||||
|
||||
// 设置请求 URL 和 POST 请求
|
||||
curl_easy_setopt(curl, CURLOPT_URL, strUrl.c_str());
|
||||
curl_easy_setopt(curl, CURLOPT_POST, 1);
|
||||
@@ -211,21 +230,16 @@ void SendFileWeb(const std::string& strUrl, const std::string& localpath, const
|
||||
curl_httppost* formpost = nullptr;
|
||||
curl_httppost* lastptr = nullptr;
|
||||
|
||||
if (access(localpath.c_str(), F_OK) != 0) {
|
||||
std::cerr << "Local file does not exist: " << localpath << std::endl;
|
||||
return;
|
||||
}
|
||||
|
||||
// 添加文件字段,直接从本地路径读取文件内容
|
||||
curl_formadd(&formpost, &lastptr,
|
||||
CURLFORM_COPYNAME, "file",
|
||||
CURLFORM_FILE, localpath,
|
||||
CURLFORM_FILE, localpath.c_str(),
|
||||
CURLFORM_END);
|
||||
|
||||
// 添加 `path` 字段
|
||||
curl_formadd(&formpost, &lastptr,
|
||||
CURLFORM_COPYNAME, "path",
|
||||
CURLFORM_COPYCONTENTS, cloudpath,
|
||||
CURLFORM_COPYCONTENTS, cloudpath.c_str(),
|
||||
CURLFORM_END);
|
||||
|
||||
// 添加 `isReserveName` 字段
|
||||
@@ -238,13 +252,14 @@ void SendFileWeb(const std::string& strUrl, const std::string& localpath, const
|
||||
curl_easy_setopt(curl, CURLOPT_HTTPPOST, formpost);
|
||||
|
||||
// 设置头信息
|
||||
struct curl_slist* header_list = nullptr;
|
||||
header_list = curl_slist_append(header_list, "Content-Type: multipart/form-data");
|
||||
curl_easy_setopt(curl, CURLOPT_HTTPHEADER, header_list);
|
||||
//struct curl_slist* header_list = nullptr;
|
||||
//header_list = curl_slist_append(header_list, "Content-Type: multipart/form-data");
|
||||
//curl_easy_setopt(curl, CURLOPT_HTTPHEADER, header_list);
|
||||
|
||||
// 设置超时时间
|
||||
curl_easy_setopt(curl, CURLOPT_CONNECTTIMEOUT, 10);
|
||||
curl_easy_setopt(curl, CURLOPT_TIMEOUT, 10);
|
||||
curl_easy_setopt(curl, CURLOPT_NOSIGNAL, 1L); // ★新增:避免多线程环境下超时触发信号
|
||||
|
||||
// 设置写入响应数据的函数
|
||||
std::string resPost0;
|
||||
@@ -254,7 +269,8 @@ void SendFileWeb(const std::string& strUrl, const std::string& localpath, const
|
||||
// 执行请求
|
||||
CURLcode res = curl_easy_perform(curl);
|
||||
if (res != CURLE_OK) {
|
||||
std::cerr << "http web failed: " << curl_easy_strerror(res) << std::endl;
|
||||
const char* em = errbuf[0] ? errbuf : curl_easy_strerror(res);
|
||||
std::cerr << "http web failed: " << em << std::endl;
|
||||
DIY_ERRORLOG("process","【ERROR】前置上传暂态录波文件 %s 失败,请检查文件上传接口配置",localpath);
|
||||
} else {
|
||||
std::cout << "http web success, response: " << resPost0 << std::endl;
|
||||
@@ -263,7 +279,7 @@ void SendFileWeb(const std::string& strUrl, const std::string& localpath, const
|
||||
|
||||
// 清理
|
||||
curl_formfree(formpost); // 释放表单数据
|
||||
curl_slist_free_all(header_list); // 释放头部列表
|
||||
//curl_slist_free_all(header_list); // 释放头部列表
|
||||
curl_easy_cleanup(curl);
|
||||
} else {
|
||||
std::cerr << ">>> curl init failed" << std::endl;
|
||||
@@ -408,8 +424,8 @@ void download_xml_for_icd(const std::string& MODEL_ID,
|
||||
|
||||
//读最新本地台账
|
||||
std::string read_latest_ledger_file() {
|
||||
const char* dir = std::string(FRONT_PATH + "/dat/ledger").c_str();
|
||||
DIR* dp = opendir(dir);
|
||||
std::string dir = FRONT_PATH + "/dat/ledger";
|
||||
DIR* dp = opendir(dir.c_str());
|
||||
if (!dp) return "";
|
||||
|
||||
struct dirent* entry;
|
||||
@@ -500,7 +516,7 @@ int get_max_stat_data_index(const std::string& filepath) {
|
||||
|
||||
while (std::getline(file, line)) {
|
||||
// 查找符合要求的行
|
||||
if (line.find("pt61850netd_pqfe -d cfg_stat_data -s") != std::string::npos) {
|
||||
if (line.find("cloud-front") != std::string::npos) {
|
||||
// 找到 -s 参数位置
|
||||
std::size_t pos = line.find("-s");
|
||||
if (pos != std::string::npos) {
|
||||
@@ -609,38 +625,39 @@ int terminal_ledger_web(std::map<std::string, terminal_dev>& terminal_dev_map,
|
||||
dev.terminal_id = safe_str(item, "id");
|
||||
dev.addr_str = safe_str(item, "ip");
|
||||
dev.terminal_name = safe_str(item, "name");
|
||||
dev.org_name = safe_str(item, "org_name");
|
||||
dev.maint_name = safe_str(item, "maint_name");
|
||||
dev.station_name = safe_str(item, "stationName");
|
||||
dev.tmnl_factory = safe_str(item, "manufacturer");
|
||||
dev.tmnl_status = safe_str(item, "status");
|
||||
//dev.org_name = safe_str(item, "org_name");
|
||||
//dev.maint_name = safe_str(item, "maint_name");
|
||||
//dev.station_name = safe_str(item, "stationName");
|
||||
//dev.tmnl_factory = safe_str(item, "manufacturer");
|
||||
//dev.tmnl_status = safe_str(item, "status");
|
||||
dev.dev_type = safe_str(item, "devType");
|
||||
dev.dev_key = safe_str(item, "devKey");
|
||||
dev.dev_series = safe_str(item, "series");
|
||||
dev.port = safe_str(item, "port");
|
||||
dev.timestamp = safe_str(item, "updateTime");
|
||||
dev.processNo = safe_str(item, "processNo");
|
||||
//dev.dev_key = safe_str(item, "devKey");
|
||||
//dev.dev_series = safe_str(item, "series");
|
||||
//dev.port = safe_str(item, "port");
|
||||
//dev.timestamp = safe_str(item, "updateTime");
|
||||
dev.Righttime = safe_str(item, "Righttime");
|
||||
dev.processNo = safe_str(item, "node");
|
||||
dev.maxProcessNum = safe_str(item, "maxProcessNum");
|
||||
|
||||
dev.mac = safe_str(item, "mac");//添加mac
|
||||
//dev.mac = safe_str(item, "mac");//添加mac
|
||||
|
||||
if (item.contains("monitorData") && item["monitorData"].is_array()) {
|
||||
for (auto& mon : item["monitorData"]) {
|
||||
if (dev.line.size() >= 10) break;
|
||||
ledger_monitor m;
|
||||
m.monitor_id = safe_str(mon, "id");
|
||||
m.terminal_id = safe_str(mon, "terminal_id");
|
||||
m.terminal_id = safe_str(mon, "deviceId");
|
||||
m.monitor_name = safe_str(mon, "name");
|
||||
m.logical_device_seq = safe_str(mon, "lineNo");
|
||||
m.voltage_level = safe_str(mon, "voltageLevel");
|
||||
m.terminal_connect = safe_str(mon, "ptType");
|
||||
m.timestamp = safe_str(mon, "updateTime");
|
||||
//m.timestamp = safe_str(mon, "updateTime");
|
||||
m.status = safe_str(mon, "status");
|
||||
|
||||
m.CT1 = mon.value("CT1", 0.0);
|
||||
m.CT2 = mon.value("CT2", 0.0);
|
||||
m.PT1 = mon.value("PT1", 0.0);
|
||||
m.PT2 = mon.value("PT2", 0.0);
|
||||
m.CT1 = mon.value("ct1", 0.0);
|
||||
m.CT2 = mon.value("ct2", 0.0);
|
||||
m.PT1 = mon.value("pt1", 0.0);
|
||||
m.PT2 = mon.value("pt2", 0.0);
|
||||
|
||||
dev.line.push_back(m);
|
||||
}
|
||||
@@ -687,7 +704,7 @@ int parse_device_cfg_web()
|
||||
|
||||
// 1. 构造入参 JSON
|
||||
std::string input_jstr = "{";
|
||||
input_jstr += "\"ip\":\"" + FRONT_IP + "\",";
|
||||
input_jstr += "\"id\":\"" + FRONT_INST + "\",";
|
||||
input_jstr += "\"runFlag\":" + TERMINAL_STATUS;
|
||||
input_jstr += "}";
|
||||
|
||||
@@ -735,17 +752,53 @@ int parse_device_cfg_web()
|
||||
DIY_DEBUGLOG("process", "【DEBUG】前置的%d号进程调用获取到的台账的数量为:%d", g_front_seg_index, count_cfg);
|
||||
|
||||
if (IED_COUNT < count_cfg) {
|
||||
std::cout << "!!!!!!!!!!single process can not add any ledger unless reboot!!!!!!!" << std::endl;
|
||||
DIY_WARNLOG("process","【WARN】前置的%d号进程获取到的台账的数量大于配置文件中给单个进程配置的台账数量:%d,这个进程将按照获取到的台账的数量来创建台账空间,这个进程不能直接通过台账添加来新增台账,只能通过重启进程或者先删除已有台账再添加台账的方式来添加新台账", g_front_seg_index, IED_COUNT);
|
||||
std::cout << "!!!!!!!!!!single process has ledger count more than config!!!!!!!" << std::endl;
|
||||
//DIY_WARNLOG("process","【WARN】前置的%d号进程获取到的台账的数量大于配置文件中给单个进程配置的台账数量:%d,这个进程将按照获取到的台账的数量来创建台账空间,这个进程不能直接通过台账添加来新增台账,只能通过重启进程或者先删除已有台账再添加台账的方式来添加新台账", g_front_seg_index, IED_COUNT);
|
||||
} else {
|
||||
DIY_INFOLOG("process","【NORMAL】前置的%d号进程根据配置文件中给单个进程配置的台账数量:%d来创建台账空间", g_front_seg_index, IED_COUNT);
|
||||
//DIY_INFOLOG("process","【NORMAL】前置的%d号进程根据配置文件中给单个进程配置的台账数量:%d来创建台账空间", g_front_seg_index, IED_COUNT);
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////用例这里将局部的map拷贝到全局map,后续根据协议台账修改
|
||||
// 先清空全局 container,再逐个拷贝 map 中的 terminal_dev
|
||||
std::lock_guard<std::mutex> lock(ledgermtx);
|
||||
|
||||
terminal_devlist.clear();
|
||||
|
||||
int idx = 0;
|
||||
for (const auto& kv : terminal_dev_map) {
|
||||
terminal_devlist.push_back(kv.second); // kv.second 是对象,不用判断指针
|
||||
|
||||
terminal_dev dev = kv.second; // kv.second 是对象,不用判断指针
|
||||
|
||||
//dev.dev_index = static_cast<int>(idx++);
|
||||
|
||||
// ======= [新增] 对 terminal_dev 中 web 未返回/未设置字段做统一初始化,避免脏值 =======
|
||||
dev.guid.clear(); // [新增] 业务 guid 初始为空
|
||||
dev.busytype = 0; // [新增] 业务类型(状态机)默认 0
|
||||
dev.isbusy = 0; // [新增] 未进行业务
|
||||
dev.busytimecount = 0; // [新增] 业务计时清零
|
||||
|
||||
dev.internal_values.clear(); // [新增] 内部定值清空,等后续业务真实填充
|
||||
dev.dz_internal_info_list.clear(); // [新增] 内部定值信息清空,等后续业务真实填充
|
||||
dev.control_words.clear();
|
||||
// ------------------------------------------------------------------------------------
|
||||
|
||||
// ======= [新增] 对每个监测点做必要的内部结构初始化 =======
|
||||
for (auto &mon : dev.line) {
|
||||
// 暂态事件容器显式清理(虽然默认构造已空,但这里确保无脏数据)
|
||||
mon.qvvrevent.qvvrdata.clear(); // [新增]
|
||||
mon.qvvrevent.qvvrfile.clear(); // [新增]
|
||||
|
||||
// 定值列表清理,等待后续配置/采集填充
|
||||
mon.set_values.clear(); // [新增]
|
||||
mon.dz_info_list.clear(); // [新增]
|
||||
|
||||
//补招列表清理
|
||||
mon.recall_list.clear();
|
||||
mon.recall_list_static.clear();
|
||||
}
|
||||
// ------------------------------------------------------------------------------------
|
||||
|
||||
terminal_devlist.push_back(dev);
|
||||
}
|
||||
|
||||
// 判断监测点接线类型
|
||||
@@ -1149,32 +1202,43 @@ static void scanAndResendOfflineFiles(const std::string& dirPath)
|
||||
}
|
||||
}
|
||||
|
||||
int transfer_json_qvvr_data(unsigned int func_type, int monitor_id,
|
||||
double mag, double dur, long long start_tm, long long end_tm, int dis_kind,
|
||||
const std::string& uuid_cfg, const std::string& uuid_dat,
|
||||
const std::string& mp_id, const std::string& Qvvr_rptname, const std::string& devtype) {
|
||||
|
||||
// 监测点日志的 key, lnk20250526
|
||||
std::string full_key_m_c = "monitor." + mp_id + ".COM";
|
||||
std::string full_key_m_d = "monitor." + mp_id + ".DATA";
|
||||
// 监测点日志的 key, lnk20250526
|
||||
|
||||
// 获取装置类型的映射配置
|
||||
XmlConfig c_xmlcfg;
|
||||
if (xmlinfo_list.count(devtype)) {
|
||||
c_xmlcfg = xmlinfo_list[devtype]->xmlcfg;
|
||||
} else {
|
||||
c_xmlcfg = xmlcfg;
|
||||
// 0->"A", 1->"B", 2->"C", 3->"AB", 4->"BC", 5->"CA", 6/其它->"ABC"
|
||||
inline std::string phase_to_text(int phase) {
|
||||
switch (phase) {
|
||||
case 0: return "A";
|
||||
case 1: return "B";
|
||||
case 2: return "C";
|
||||
case 3: return "AB";
|
||||
case 4: return "BC";
|
||||
case 5: return "CA";
|
||||
default: return "ABC"; // 包含 6 和其他任何值
|
||||
}
|
||||
}
|
||||
|
||||
if (mp_id.empty()) {
|
||||
std::cout << "mp_id is null" << std::endl;
|
||||
return 0;
|
||||
int transfer_json_qvvr_data(const std::string& dev_id, ushort monitor_id,
|
||||
double mag, double dur, long long start_tm, int dis_kind,int phase,
|
||||
const std::string& wavepath) {
|
||||
|
||||
if (dev_id.empty()) {
|
||||
std::cout << "qvvr send error ,dev_id is null" << std::endl;
|
||||
return 1;
|
||||
}
|
||||
|
||||
// 构造 JSON 对象
|
||||
json root;
|
||||
root["monitorId"] = mp_id;
|
||||
|
||||
//找监测点id
|
||||
std::string mpid;
|
||||
|
||||
get_monitor_id_by_dev_and_seq(dev_id, monitor_id, mpid);
|
||||
if(mpid.empty()) {
|
||||
std::cout << "qvvr send error ,monitorId is null" << std::endl;
|
||||
return 1;
|
||||
}
|
||||
|
||||
root["monitorId"] = mpid;
|
||||
root["devId"] = dev_id;
|
||||
root["CpuNo"] = monitor_id;
|
||||
root["amplitude"] = mag;
|
||||
root["duration"] = dur;
|
||||
root["eventType"] = dis_kind;
|
||||
@@ -1189,21 +1253,9 @@ int transfer_json_qvvr_data(unsigned int func_type, int monitor_id,
|
||||
std::string start_time_str = start_time_stream.str();
|
||||
|
||||
root["startTime"] = start_time_str;
|
||||
root["wavePath"] = uuid_dat; //接口提供了两个文件名入参,实际上名字一样只用一个,可优化
|
||||
root["wavePath"] = wavepath;
|
||||
root["phase"] = phase_to_text(phase);
|
||||
|
||||
if (c_xmlcfg.WavePhasicFlag == "1") { //映射配置分相
|
||||
if (Qvvr_rptname.find(c_xmlcfg.WavePhasicA) != std::string::npos) {
|
||||
root["phase"] = "A";
|
||||
} else if (Qvvr_rptname.find(c_xmlcfg.WavePhasicB) != std::string::npos) {
|
||||
root["phase"] = "B";
|
||||
} else if (Qvvr_rptname.find(c_xmlcfg.WavePhasicC) != std::string::npos) {
|
||||
root["phase"] = "C";
|
||||
} else {
|
||||
root["phase"] = "unknow";
|
||||
}
|
||||
} else {
|
||||
root["phase"] = "unknow"; //不分相
|
||||
}
|
||||
|
||||
std::string json_string = root.dump(4);
|
||||
std::cout << json_string << std::endl;
|
||||
@@ -1212,28 +1264,28 @@ int transfer_json_qvvr_data(unsigned int func_type, int monitor_id,
|
||||
std::string response;
|
||||
SendJsonAPI_web(WEB_EVENT, "", json_string, response);
|
||||
|
||||
// ================ 插入新功能 =========================
|
||||
// ================ 暂态重发功能 =========================
|
||||
if (!response.empty()) {
|
||||
try {
|
||||
json j_r = json::parse(response);
|
||||
// 有效响应,略过
|
||||
} catch (...) {
|
||||
// 响应异常,保存 json
|
||||
DIY_ERRORLOG(full_key_m_d.c_str(), "【ERROR】暂态接口响应异常,无法上送监测点%s的暂态事件", mp_id.c_str());
|
||||
DIY_ERRORLOG(mpid.c_str(), "【ERROR】暂态接口响应异常,无法上送装置%s监测点%s的暂态事件",dev_id, monitor_id);
|
||||
|
||||
std::cout << "qvvr send fail ,store in local" << std::endl;
|
||||
std::string qvvrDir = FRONT_PATH + "/dat/qvvr/";
|
||||
std::string fileName = qvvrDir + mp_id + "-" + FormatTimeForFilename(start_time_str) + "-" + std::to_string(dis_kind) + ".txt";
|
||||
std::string fileName = qvvrDir + dev_id + "-" + std::to_string(monitor_id) + "-" + FormatTimeForFilename(start_time_str) + "-" + std::to_string(dis_kind) + ".txt";
|
||||
writeJsonToFile(fileName, json_string);
|
||||
checkAndRemoveOldestIfNeeded(qvvrDir, 10LL * 1024 * 1024);
|
||||
}
|
||||
} else {
|
||||
// 无响应,保存 json
|
||||
DIY_ERRORLOG(full_key_m_d.c_str(), "【ERROR】暂态接口无响应,无法上送监测点%s的暂态事件", mp_id.c_str());
|
||||
DIY_ERRORLOG(mpid.c_str(), "【ERROR】暂态接口无响应,无法上送装置%s监测点%s的暂态事件",dev_id, monitor_id);
|
||||
|
||||
std::cout << "qvvr send fail ,store in local" << std::endl;
|
||||
std::string qvvrDir = FRONT_PATH + "/dat/qvvr/";
|
||||
std::string fileName = qvvrDir + mp_id + "-" + FormatTimeForFilename(start_time_str) + "-" + std::to_string(dis_kind) + ".txt";
|
||||
std::string fileName = qvvrDir + dev_id + "-" + std::to_string(monitor_id) + "-" + FormatTimeForFilename(start_time_str) + "-" + std::to_string(dis_kind) + ".txt";
|
||||
writeJsonToFile(fileName, json_string);
|
||||
checkAndRemoveOldestIfNeeded(qvvrDir, 10LL * 1024 * 1024);
|
||||
return 1;
|
||||
@@ -1254,13 +1306,9 @@ int transfer_json_qvvr_data(unsigned int func_type, int monitor_id,
|
||||
|
||||
void qvvr_test()
|
||||
{
|
||||
char uuid_cfg[] = {"/comtrade/"};
|
||||
char uuid_dat[] = {"/comtrade/"};
|
||||
char mp_id[] = {"qvvrtest123"};
|
||||
char Qvvr_rptname[] = {"unknow"};
|
||||
char devtype[] = {"01"};
|
||||
|
||||
transfer_json_qvvr_data(1, 123456789, 220, 180, 1730894400.123, 1730894580, 1210001,uuid_cfg,uuid_dat,mp_id,Qvvr_rptname,devtype);
|
||||
transfer_json_qvvr_data("qvvrtest123", 6,
|
||||
10.98, 1234, 1754566628692, 1,1,
|
||||
"testwavepath");
|
||||
}
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////////////////通用接口响应
|
||||
@@ -1298,3 +1346,36 @@ void handleCommentResponse(const std::string& response) {
|
||||
}
|
||||
}
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////////////找监测点id
|
||||
bool get_monitor_id_by_dev_and_seq(const std::string& terminal_id,
|
||||
unsigned short logical_seq,
|
||||
std::string& out_monitor_id)
|
||||
{
|
||||
std::lock_guard<std::mutex> lk(ledgermtx);
|
||||
|
||||
for (const auto& dev : terminal_devlist) {
|
||||
if (dev.terminal_id != terminal_id) continue;
|
||||
|
||||
// 命中该装置后,仅遍历它的监测点
|
||||
for (const auto& mon : dev.line) {
|
||||
try {
|
||||
// logical_device_seq 存在台账里是字符串,转成数值再比对
|
||||
unsigned long v = std::stoul(mon.logical_device_seq);
|
||||
unsigned short seq = static_cast<unsigned short>(v);
|
||||
if (seq == logical_seq) {
|
||||
out_monitor_id = mon.monitor_id;
|
||||
return true;
|
||||
}
|
||||
} catch (...) {
|
||||
|
||||
// 非法数值(空/非数字等)直接跳过
|
||||
continue;
|
||||
}
|
||||
}
|
||||
break; // 已找到对应装置,没必要再看其它装置
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -7,6 +7,8 @@
|
||||
#include <array>
|
||||
#include <map>
|
||||
#include <mutex>
|
||||
#include <sstream>
|
||||
#include <iostream>
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
@@ -30,7 +32,7 @@ class Front;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
//单条补招结构
|
||||
//单条补招时间结构
|
||||
class RecallInfo
|
||||
{
|
||||
public:
|
||||
@@ -38,10 +40,109 @@ public:
|
||||
long long endtime; //结束时间
|
||||
};
|
||||
|
||||
//日志补招结构类
|
||||
//测点记录的补招结构
|
||||
class RecallMonitor
|
||||
{
|
||||
public:
|
||||
int recall_status; //补招状态 0-未补招 1-补招中 2-补招完成 3-补招失败
|
||||
std::string StartTime; //数据补招起始时间
|
||||
std::string EndTime; //数据补招结束时间
|
||||
std::string STEADY; //补招历史统计数据标识 0-不补招;1-补招
|
||||
std::string VOLTAGE; //补招暂态事件标识 0-不补招;1-补招
|
||||
};
|
||||
|
||||
// ====== ★新增:下载/列目录阶段枚举与结果枚举 ======
|
||||
enum class RecallPhase {
|
||||
IDLE = 0,
|
||||
LISTING, // 正在请求并等待“目录文件名列表”
|
||||
DOWNLOADING // 正在按队列逐个下载
|
||||
};
|
||||
|
||||
enum class ActionResult {
|
||||
PENDING = -1, // 还未返回
|
||||
FAIL = 0,
|
||||
OK = 1
|
||||
};
|
||||
|
||||
// ====== ★修改:扩展 RecallFile,支持“多目录 + 文件筛选 + 串行下载”的状态机 ======
|
||||
class RecallFile
|
||||
{
|
||||
public:
|
||||
int recall_status; // 补招状态 0-未补招 1-补招中 2-补招完成 3-补招失败
|
||||
std::string StartTime; // 数据补招起始时间(yyyy-MM-dd HH:mm:ss)
|
||||
std::string EndTime; // 数据补招结束时间(yyyy-MM-dd HH:mm:ss)
|
||||
std::string STEADY; // 补招历史统计数据标识 0-不补招;1-补招
|
||||
std::string VOLTAGE; // 补招暂态事件标识 0-不补招;1-补招
|
||||
|
||||
//暂态文件用
|
||||
bool direct_mode = false; // 直下文件开关:true 表示不按时间窗,仅按目标文件名
|
||||
std::string target_filename; // 直下文件名(不含目录)
|
||||
|
||||
std::list<std::string> file_paths; // 已下载/要上报的完整路径(用于最终结果)
|
||||
|
||||
// ★新增:按“目录名 -> 文件名列表”的映射;由“其他线程”在目录请求成功后回填
|
||||
std::map<std::string, std::vector<tag_dir_info>> dir_files;
|
||||
|
||||
// ★新增:候选目录(可扩展)
|
||||
std::vector<std::string> dir_candidates{
|
||||
"/cf/COMTRADE",
|
||||
"/bd0/COMTRADE",
|
||||
"/sd0/COMTRADE",
|
||||
"/sd0:1/COMTRADE"
|
||||
};
|
||||
|
||||
// ★新增:状态机运行时变量
|
||||
RecallPhase phase = RecallPhase::IDLE;
|
||||
int cur_dir_index = 0; // 正在尝试的目录下标
|
||||
std::string cur_dir; // 正在处理的目录
|
||||
|
||||
// ★新增:列目录/下载请求“回执位”,由其他线程置位
|
||||
ActionResult list_result = ActionResult::PENDING; // 当前目录的列举结果
|
||||
ActionResult download_result = ActionResult::PENDING; // 当前文件的下载结果
|
||||
|
||||
// ★新增:下载队列(已筛选出在时间窗内的文件,含完整路径)
|
||||
std::list<std::string> download_queue;
|
||||
std::string downloading_file; // 当前正在下载的文件(完整路径)
|
||||
|
||||
// ★新增:一个便捷复位
|
||||
void reset_runtime(bool keep_direct = false)
|
||||
{
|
||||
phase = RecallPhase::IDLE;
|
||||
cur_dir_index = 0;
|
||||
cur_dir.clear();
|
||||
list_result = ActionResult::PENDING;
|
||||
download_result = ActionResult::PENDING;
|
||||
download_queue.clear();
|
||||
downloading_file.clear();
|
||||
dir_files.clear();
|
||||
// ★新增:按需保留直下文件开关和目标名
|
||||
if (!keep_direct) {
|
||||
direct_mode = false;
|
||||
target_filename.clear();
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
enum class RecallStatus {
|
||||
NOT_STARTED = 0, // 未补招
|
||||
RUNNING = 1, // 补招中
|
||||
DONE = 2, // 补招完成
|
||||
FAILED = 3 // 补招失败
|
||||
};
|
||||
|
||||
// 本轮要下发的一条任务(每个终端最多一条)
|
||||
struct RecallTask {
|
||||
std::string dev_id;
|
||||
std::string start_time;
|
||||
std::string end_time;
|
||||
std::string monitor_index;
|
||||
};
|
||||
|
||||
//日志补招结构类,当前不使用
|
||||
class JournalRecall
|
||||
{
|
||||
public:
|
||||
std::string DevID; //装置号
|
||||
std::string MonitorID; //线路监测点号
|
||||
std::string StartTime; //数据补招起始时间
|
||||
std::string EndTime; //数据补招结束时间
|
||||
@@ -49,30 +150,61 @@ public:
|
||||
std::string VOLTAGE; //补招暂态事件标识 0-不补招;1-补招
|
||||
};
|
||||
|
||||
//监测点台账
|
||||
class ledger_monitor
|
||||
//录波文件和暂态事件
|
||||
class qvvr_data
|
||||
{
|
||||
public:
|
||||
bool used_status; //是否占用
|
||||
int QVVR_type; //暂态类型
|
||||
uint64_t QVVR_time; //暂态开始时间 unsigned longlong
|
||||
double QVVR_PerTime; //暂态持续时间
|
||||
double QVVR_Amg; //暂态幅值
|
||||
int phase; //相别(仅瞬态上送)0-A 1-B 2-C 3-AB 4-BC 5-CA 其他-ABC/异常
|
||||
};
|
||||
|
||||
class qvvr_file
|
||||
{
|
||||
public:
|
||||
bool used_status;
|
||||
int file_time_count; //组内文件下载时间计数(第一个文件下载后十分钟内如果其他文件没下载全或者下载全了没匹配事件则将已下载的文件都移到备份区comtrade_bak)
|
||||
bool is_download; //文件是否下载完全,最后一个文件下载成功后对比成功则更新这个标志
|
||||
bool is_pair; //文件是否和事件匹配,从comtrade/mac/路径下取file_download中的cfg文件提取时间和持续时间来匹配,匹配后接口发送这组file_download全部文件,发送成功后删除这组文件,然后更新事件中的文件列表
|
||||
std::list<std::string> file_name; //文件列表(文件列表上送后就记录)
|
||||
std::list<std::string> file_download; //文件已下载列表(每次列表上送会有多个文件,多个文件都下载完全则开始匹配,每次更新都去重并对比file_name)
|
||||
};
|
||||
|
||||
class qvvr_event
|
||||
{
|
||||
public:
|
||||
std::vector<qvvr_data> qvvrdata; //暂态事件列表
|
||||
std::vector<qvvr_file> qvvrfile; //暂态文件组列表
|
||||
};
|
||||
|
||||
////////////////////////////////////////////////////////////////台账更新用
|
||||
|
||||
class update_monitor
|
||||
{
|
||||
public:
|
||||
std::string monitor_id; //监测点id
|
||||
std::string terminal_id; //监测点
|
||||
std::string terminal_id; //监测点的终端id
|
||||
std::string monitor_name; //监测点名
|
||||
std::string logical_device_seq; //监测点序号
|
||||
std::string voltage_level; //监测点电压等级
|
||||
std::string terminal_connect; //监测点接线方式
|
||||
std::string timestamp; //更新时间
|
||||
std::string status; //监测点状态
|
||||
|
||||
double PT1; // 电压变比1
|
||||
double PT2; // 电压变比2
|
||||
double CT1; // 电流变比1
|
||||
double CT2; // 电流变比2
|
||||
|
||||
};
|
||||
|
||||
//终端台账
|
||||
class terminal_dev
|
||||
class update_dev
|
||||
{
|
||||
public:
|
||||
std::string guid; //台账更新回复用
|
||||
std::string guid; // ★新增:供发送回复使用
|
||||
|
||||
std::string terminal_id;
|
||||
std::string terminal_name;
|
||||
@@ -84,13 +216,82 @@ public:
|
||||
std::string dev_type;
|
||||
std::string dev_key;
|
||||
std::string dev_series;
|
||||
std::string addr_str;
|
||||
std::string port;
|
||||
std::string timestamp;
|
||||
std::string addr_str; //装置ip
|
||||
std::string port; //装置端口
|
||||
std::string timestamp; //更新时间
|
||||
std::string Righttime; //对时
|
||||
std::string processNo;
|
||||
std::string maxProcessNum;
|
||||
std::string mac; // 装置MAC地址,接口中从addr_str获取,因为ip和mac放同一位置
|
||||
|
||||
std::string mac; // 装置MAC地址
|
||||
std::vector<update_monitor> line;
|
||||
};
|
||||
|
||||
////////////////////////////////////////////////////////////////////台账更新用
|
||||
|
||||
//监测点台账
|
||||
class ledger_monitor
|
||||
{
|
||||
public:
|
||||
std::string monitor_id; //监测点id
|
||||
std::string terminal_id; //监测点的终端id
|
||||
std::string monitor_name; //监测点名
|
||||
std::string logical_device_seq; //监测点序号
|
||||
std::string voltage_level; //监测点电压等级
|
||||
std::string terminal_connect; //监测点接线方式
|
||||
std::string timestamp; //更新时间
|
||||
std::string status; //监测点状态
|
||||
double PT1; // 电压变比1
|
||||
double PT2; // 电压变比2
|
||||
double CT1; // 电流变比1
|
||||
double CT2; // 电流变比2
|
||||
|
||||
//暂态事件
|
||||
qvvr_event qvvrevent;
|
||||
|
||||
//补招列表
|
||||
std::list<RecallMonitor> recall_list; //事件
|
||||
std::list<RecallFile> recall_list_static;//稳态文件
|
||||
|
||||
//定值list
|
||||
std::list<float> set_values;
|
||||
std::vector<DZ_TAB_STRUCT> dz_info_list; //定值信息列表
|
||||
|
||||
};
|
||||
|
||||
//终端台账
|
||||
class terminal_dev
|
||||
{
|
||||
public:
|
||||
//int dev_index;
|
||||
|
||||
std::string guid; //正在进行的guid
|
||||
int busytype; //业务类型,使用状态机
|
||||
int isbusy; //业务进行标志
|
||||
int busytimecount; //业务进行计时
|
||||
|
||||
//内部定值list
|
||||
std::list<ushort> internal_values;
|
||||
std::vector<NameFixValue> dz_internal_info_list; //内部定值信息列表
|
||||
std::vector<DZ_kzz_bit> control_words;
|
||||
|
||||
std::string terminal_id;
|
||||
std::string terminal_name;
|
||||
std::string org_name;
|
||||
std::string maint_name;
|
||||
std::string station_name;
|
||||
std::string tmnl_factory;
|
||||
std::string tmnl_status;
|
||||
std::string dev_type;
|
||||
std::string dev_key;
|
||||
std::string dev_series;
|
||||
std::string addr_str; //装置ip
|
||||
std::string port; //装置端口
|
||||
std::string timestamp; //更新时间
|
||||
std::string Righttime; //对时
|
||||
std::string processNo;
|
||||
std::string maxProcessNum;
|
||||
std::string mac; // 装置MAC地址,接口中从addr_str获取,因为ip和mac放同一位置
|
||||
|
||||
std::vector<ledger_monitor> line;
|
||||
};
|
||||
@@ -117,6 +318,15 @@ public:
|
||||
std::string strTopic; //发送topic
|
||||
std::string strText; //发送的json字符串
|
||||
std::string mp_id; //监测点id
|
||||
std::string tag; //消息tag
|
||||
std::string key; // 消息key
|
||||
};
|
||||
|
||||
//台账更新回复
|
||||
struct DeviceReply {
|
||||
std::string deviceId;
|
||||
int code;
|
||||
std::string result;
|
||||
};
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
@@ -248,10 +458,10 @@ public:
|
||||
#define MAX_UPDATEA_NUM 10
|
||||
typedef struct trigger_update_xml_t trigger_update_xml_t;
|
||||
struct trigger_update_xml_t {
|
||||
std::vector<terminal_dev> new_updates;
|
||||
std::vector<terminal_dev> modify_updates;
|
||||
std::vector<terminal_dev> delete_updates;
|
||||
std::vector<terminal_dev> work_updates;
|
||||
std::vector<update_dev> new_updates;
|
||||
std::vector<update_dev> modify_updates;
|
||||
std::vector<update_dev> delete_updates;
|
||||
std::vector<update_dev> work_updates;
|
||||
|
||||
trigger_update_xml_t() = default;
|
||||
};
|
||||
@@ -328,7 +538,6 @@ std::string get_current_time();
|
||||
|
||||
bool is_blank(const std::string& str);
|
||||
|
||||
void print_terminal(const terminal_dev& tmnl);
|
||||
void printTerminalDevMap(const std::map<std::string, terminal_dev>& terminal_dev_map);
|
||||
|
||||
void upload_data_test();
|
||||
@@ -380,8 +589,8 @@ typedef struct {
|
||||
// 单条 DataArray 数据
|
||||
struct DataArrayItem {
|
||||
int DataAttr;
|
||||
int DataTimeSec;
|
||||
int DataTimeUSec;
|
||||
time_t DataTimeSec;
|
||||
time_t DataTimeUSec;
|
||||
int DataTag;
|
||||
std::string Data;
|
||||
};
|
||||
@@ -397,6 +606,7 @@ struct MsgObj {
|
||||
|
||||
// 整体
|
||||
struct FullObj {
|
||||
std::string mac;
|
||||
int Mid;
|
||||
int Did;
|
||||
int Pri;
|
||||
@@ -409,11 +619,25 @@ void to_json(nlohmann::json& j, const DataArrayItem& d);
|
||||
void to_json(nlohmann::json& j, const MsgObj& m);
|
||||
void to_json(nlohmann::json& j, const FullObj& f);
|
||||
|
||||
/////////////////////////////////////////////////////////////////////云平台下发指令的解析
|
||||
struct MsgParsed {
|
||||
int type; // 指令编号
|
||||
std::string name; // 文件名/目录名
|
||||
int cldid; // 测点号
|
||||
int datatype; // 指令细分
|
||||
int operate; // 操作读写
|
||||
std::vector<float> dataArray_f; // 定值写入,严格按照顺序
|
||||
std::vector<uint16_t> dataArray_us; // 内部定值写入,严格按照顺序
|
||||
|
||||
bool ok;
|
||||
};
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////提供给通讯部分调用的函数
|
||||
|
||||
std::vector<DeviceInfo> GenerateDeviceInfoFromLedger(const std::vector<terminal_dev>& terminal_devlist);//接口读取台账后,再调用这个将台账拷贝过来
|
||||
|
||||
std::string generate_json( //构造装置主动上送数据的报文
|
||||
const std::string mac,
|
||||
int Mid, //需应答的报文订阅者收到后需以此ID应答,无需应答填入“-1”
|
||||
int Did, //设备唯一标识Ldid,填入0代表Ndid。
|
||||
int Pri, //报文处理的优先级
|
||||
@@ -425,8 +649,258 @@ std::string generate_json( //构造装置主动上送数据的报文
|
||||
const std::vector<DataArrayItem>& dataArray //数据数组。
|
||||
);
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
//暂态事件接口
|
||||
bool append_qvvr_event(const std::string& terminal_id,
|
||||
int logical_seq, // 监测点序号(如 1)
|
||||
int nType, // 事件类型
|
||||
double fPersisstime_sec, // 持续时间(秒)
|
||||
double fMagnitude_pu, // 幅值(pu)
|
||||
uint64_t triggerTimeMs, // 触发时间(毫秒)
|
||||
int phase);
|
||||
int transfer_json_qvvr_data(const std::string& dev_id, ushort monitor_id,
|
||||
double mag, double dur, long long start_tm, int dis_kind,int phase,
|
||||
const std::string& wavepath);
|
||||
//录波文件上传接口
|
||||
void SOEFileWeb(std::string& localpath,std::string& cloudpath, std::string& wavepath);
|
||||
|
||||
//录波文件目录接口
|
||||
bool assign_qvvr_file_list(const std::string& id, ushort nCpuNo, const std::vector<std::string>& file_list_raw);
|
||||
|
||||
//录波文件下载完成通知接口
|
||||
bool update_qvvr_file_download(const std::string& filename_with_mac, const std::string& terminal_id);
|
||||
|
||||
//上送文件列表接口
|
||||
bool send_file_list(terminal_dev* dev, const std::vector<tag_dir_info> &FileList);
|
||||
|
||||
//提取mac
|
||||
std::string normalize_mac(const std::string& mac);
|
||||
|
||||
//暂态文件超时检测
|
||||
void check_and_backup_qvvr_files();
|
||||
|
||||
//业务超时检查
|
||||
void check_device_busy_timeout();
|
||||
|
||||
//业务上报
|
||||
void send_reply_to_cloud(int reply_code, const std::string& dev_id, int type, const std::string& guid, const std::string& mac);
|
||||
void send_batch_reply_to_queue(const std::string& guid,
|
||||
const std::vector<DeviceReply>& replies);
|
||||
|
||||
//内部定值响应
|
||||
bool send_internal_value_reply(const std::string &dev_id, const std::vector<DZ_kzz_bit> &control_words);
|
||||
|
||||
//定值响应
|
||||
bool send_set_value_reply(const std::string &dev_id, unsigned char mp_index, const std::vector<DZ_TAB_STRUCT> &dz_info);
|
||||
|
||||
//保存内部定值描述
|
||||
bool save_internal_info(const std::string &dev_id, const std::vector<NameFixValue> &fixValueList);
|
||||
|
||||
//保存内部定值数值
|
||||
bool save_internal_value(const std::string &dev_id, const std::vector<ushort> &fabsf);
|
||||
|
||||
//保存定值数值
|
||||
bool save_set_value(const std::string &dev_id, unsigned char mp_index, const std::vector<float> &fabsf);
|
||||
|
||||
//发送文件
|
||||
void SendFileWeb(const std::string& strUrl, const std::string& localpath, const std::string& cloudpath, std::string& wavepath);
|
||||
|
||||
//状态翻转
|
||||
void connect_status_update(const std::string& id, int status);
|
||||
|
||||
|
||||
//业务响应
|
||||
void on_device_response_minimal(int response_code,
|
||||
const std::string& id,
|
||||
unsigned char cid,
|
||||
int device_state_int);
|
||||
|
||||
//找监测点id
|
||||
bool get_monitor_id_by_dev_and_seq(const std::string& terminal_id,
|
||||
unsigned short logical_seq,
|
||||
std::string& out_monitor_id);
|
||||
|
||||
//处理补招的任务
|
||||
void check_recall_event();
|
||||
void check_recall_file();
|
||||
|
||||
//补招响应
|
||||
void send_reply_to_kafka_recall(const std::string& guid, const std::string& step,int code, const std::string& result,const std::string& terminalId,const std::string& lineIndex,const std::string& recallStartDate,const std::string& recallEndDate);
|
||||
|
||||
//缓存目录信息
|
||||
void filemenu_cache_put(const std::string& dev_id,
|
||||
std::vector<tag_dir_info> FileList);
|
||||
//提取目录信息
|
||||
bool filemenu_cache_take(const std::string& dev_id, std::vector<tag_dir_info>& out);
|
||||
|
||||
//清空装置台账
|
||||
size_t erase_one_terminals_by_id(const std::string& terminal_id);
|
||||
|
||||
//转换结构
|
||||
DeviceInfo make_device_from_terminal(const terminal_dev& t);
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////////////////模板打印
|
||||
// ===== 通用打印实现(模板) =====
|
||||
|
||||
template <typename Mon>
|
||||
inline void print_monitor_common(const Mon& mon) {
|
||||
auto safe = [](const std::string& s) -> const std::string& {
|
||||
static const std::string NA = "N/A";
|
||||
return s.empty() ? NA : s;
|
||||
};
|
||||
|
||||
std::cout << "Monitor ID: " << safe(mon.monitor_id) << "\n";
|
||||
std::cout << "Terminal ID: " << safe(mon.terminal_id) << "\n";
|
||||
std::cout << "Monitor Name: " << safe(mon.monitor_name) << "\n";
|
||||
std::cout << "Logical Device Sequence: " << safe(mon.logical_device_seq) << "\n";
|
||||
std::cout << "Voltage Level: " << safe(mon.voltage_level) << "\n";
|
||||
std::cout << "Terminal Connect: " << safe(mon.terminal_connect) << "\n";
|
||||
std::cout << "Timestamp: " << safe(mon.timestamp) << "\n";
|
||||
std::cout << "Status: " << safe(mon.status) << "\n";
|
||||
std::cout << "CT1: " << mon.CT1 << "\n";
|
||||
std::cout << "CT2: " << mon.CT2 << "\n";
|
||||
std::cout << "PT1: " << mon.PT1 << "\n";
|
||||
std::cout << "PT2: " << mon.PT2 << "\n";
|
||||
}
|
||||
|
||||
template <typename Dev>
|
||||
inline void print_terminal_common(const Dev& tmnl) {
|
||||
auto safe = [](const std::string& s) -> const std::string& {
|
||||
static const std::string NA = "N/A";
|
||||
return s.empty() ? NA : s;
|
||||
};
|
||||
|
||||
std::cout << "GUID: " << safe(tmnl.guid) << "\n";
|
||||
std::cout << "Terminal ID: " << safe(tmnl.terminal_id) << "\n";
|
||||
std::cout << "Terminal Code: " << safe(tmnl.terminal_name) << "\n";
|
||||
std::cout << "Organization Name: "<< safe(tmnl.org_name) << "\n";
|
||||
std::cout << "Maintenance Name: " << safe(tmnl.maint_name) << "\n";
|
||||
std::cout << "Station Name: " << safe(tmnl.station_name) << "\n";
|
||||
std::cout << "Factory Name: " << safe(tmnl.tmnl_factory) << "\n";
|
||||
std::cout << "Terminal Status: " << safe(tmnl.tmnl_status) << "\n";
|
||||
std::cout << "Device Type: " << safe(tmnl.dev_type) << "\n";
|
||||
std::cout << "Device Key: " << safe(tmnl.dev_key) << "\n";
|
||||
std::cout << "Device Series: " << safe(tmnl.dev_series) << "\n";
|
||||
std::cout << "Address: " << safe(tmnl.addr_str) << "\n";
|
||||
std::cout << "Port: " << safe(tmnl.port) << "\n";
|
||||
std::cout << "Timestamp: " << safe(tmnl.timestamp) << "\n";
|
||||
std::cout << "Righttime: " << safe(tmnl.Righttime) << "\n";
|
||||
std::cout << "mac: " << safe(tmnl.mac) << "\n";
|
||||
|
||||
// 安全遍历最多前 10 个测点(不越界),且跳过空 monitor_id 的项
|
||||
const size_t n = std::min<size_t>(tmnl.line.size(), 10);
|
||||
for (size_t i = 0; i < n; ++i) {
|
||||
if (tmnl.line[i].monitor_id.empty()) continue;
|
||||
std::cout << " Monitor " << (i + 1) << ":\n";
|
||||
print_monitor_common(tmnl.line[i]); // 模板会自动匹配 update/ledger 的 monitor
|
||||
}
|
||||
}
|
||||
|
||||
// ===== 薄包装重载(保持原有函数名不变)=====
|
||||
|
||||
inline void print_monitor(const update_monitor& mon) { print_monitor_common(mon); }
|
||||
inline void print_monitor(const ledger_monitor& mon) { print_monitor_common(mon); }
|
||||
|
||||
inline void print_terminal(const update_dev& tmnl) { print_terminal_common(tmnl); }
|
||||
inline void print_terminal(const terminal_dev& tmnl) { print_terminal_common(tmnl); }
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////////////////////小工具
|
||||
inline std::string trim_cstr(const char* s, size_t n) {
|
||||
if (!s) return {};
|
||||
size_t end = 0;
|
||||
while (end < n && s[end] != '\0') ++end;
|
||||
std::string out(s, s + end);
|
||||
while (!out.empty() && (out.back() == ' ' || out.back() == '\t' || out.back() == '\r' || out.back() == '\n'))
|
||||
out.pop_back();
|
||||
return out;
|
||||
}
|
||||
|
||||
inline std::string sanitize(std::string s) {
|
||||
// 截断第一个 NUL 及其后内容
|
||||
size_t z = s.find('\0');
|
||||
if (z != std::string::npos) s.erase(z);
|
||||
// 去掉尾部不可打印字符(含 \r \n 等)
|
||||
while (!s.empty()) {
|
||||
unsigned char c = static_cast<unsigned char>(s.back());
|
||||
if (c >= 32 && c != 127) break;
|
||||
s.pop_back();
|
||||
}
|
||||
return s;
|
||||
}
|
||||
|
||||
// 当前本地时间,格式 "YYYY-MM-DD HH:MM:SS"
|
||||
inline std::string now_yyyy_mm_dd_hh_mm_ss() {
|
||||
std::time_t t = std::time(nullptr);
|
||||
std::tm tmv;
|
||||
#if defined(_WIN32)
|
||||
localtime_s(&tmv, &t); // Windows 线程安全
|
||||
#else
|
||||
localtime_r(&t, &tmv); // POSIX 线程安全
|
||||
#endif
|
||||
std::ostringstream oss;
|
||||
oss << std::put_time(&tmv, "%Y-%m-%d %H:%M:%S");
|
||||
return oss.str();
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////实时数据用
|
||||
// === 专用锁 + 数据表(仅管实时 idx 映射) ===
|
||||
extern std::mutex devidx_lock; // 新锁(不要用 ledgermtx)
|
||||
extern std::unordered_map<std::string,int> devIdxMap; // id -> idx,一对一
|
||||
|
||||
// === 常用操作:全部用这把锁保护 ===
|
||||
inline void devidx_set(const std::string& id, int idx) {
|
||||
std::lock_guard<std::mutex> lk(devidx_lock);
|
||||
devIdxMap[id] = idx; // 覆盖更新
|
||||
}
|
||||
|
||||
inline bool devidx_get(const std::string& id, int& out_idx) {
|
||||
std::lock_guard<std::mutex> lk(devidx_lock);
|
||||
auto it = devIdxMap.find(id);
|
||||
if (it == devIdxMap.end()) return false;
|
||||
out_idx = it->second;
|
||||
return true;
|
||||
}
|
||||
|
||||
void enqueue_realtime_pq(const RealtagPqDate_float& realdata,
|
||||
int nPTType,
|
||||
unsigned char cid,
|
||||
const std::string& mac,
|
||||
const std::string& devid);
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////统计数据
|
||||
void enqueue_stat_pq(const std::string& max_base64Str,
|
||||
const std::string& min_base64Str,
|
||||
const std::string& avg_base64Str,
|
||||
const std::string& cp95_base64Str,
|
||||
time_t data_time,
|
||||
const std::string& mac,
|
||||
short cid);
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
extern int g_front_seg_index;
|
||||
extern std::string FRONT_INST;
|
||||
extern std::string FRONT_PATH;
|
||||
extern std::string WEB_FILEUPLOAD;
|
||||
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
// 云平台响应码枚举
|
||||
enum class ResponseCode : int {
|
||||
OK = 200, // 请求成功
|
||||
ACCEPTED = 201, // 请求被接受,开始处理
|
||||
PROCESSING = 202, // 请求被接受,但是未处理完
|
||||
BAD_REQUEST = 400, // 请求失败
|
||||
UNAUTHORIZED = 401, // 请求未认证/认证错误(不支持的请求)
|
||||
REJECTED_BUSY = 402, // 请求被拒绝,在处理同类命令
|
||||
FORBIDDEN = 403, // 请求被拒绝(未知原因)
|
||||
NOT_FOUND = 404, // 请求的资源不存在
|
||||
BUSY = 405, // 当前忙,无法响应
|
||||
TIMEOUT = 406, // 请求超出了等待时间
|
||||
INTERNAL_ERROR = 500 // 其他错误
|
||||
};
|
||||
static inline bool is_ok(int rc) { return rc == static_cast<int>(ResponseCode::OK); }
|
||||
|
||||
static bool parse_datetime_tm(const std::string& s, std::tm& out) {
|
||||
std::memset(&out, 0, sizeof(out));
|
||||
return strptime(s.c_str(), "%Y-%m-%d %H:%M:%S", &out) != nullptr;
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
@@ -24,12 +24,11 @@
|
||||
#include "log4cplus/fileappender.h"
|
||||
#include "log4cplus/layout.h"
|
||||
#include "log4cplus/ndc.h"
|
||||
#include "log4cplus/log4.h"
|
||||
#include "log4cplus/spi/loggingevent.h"
|
||||
|
||||
#include "rocketmq.h"
|
||||
#include "interface.h"
|
||||
#include "log4cplus/log4.h"
|
||||
#include "log4.h"
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
//log4命名空间
|
||||
@@ -50,19 +49,16 @@ extern std::string subdir;
|
||||
//日志主题
|
||||
extern std::string G_LOG_TOPIC;
|
||||
|
||||
//////////////////////////////////////////////////////////
|
||||
/* log4.cpp 顶部 */
|
||||
#if __cplusplus >= 201103L
|
||||
thread_local int g_log_code_tls = 0;
|
||||
#else
|
||||
__thread int g_log_code_tls = 0;
|
||||
#endif
|
||||
|
||||
////////////////////////////////////////////////////////辅助函数
|
||||
/*std::string get_front_type_from_subdir() {
|
||||
if (subdir == "cfg_3s_data")
|
||||
return "realTime";
|
||||
else if (subdir == "cfg_soe_comtrade")
|
||||
return "comtrade";
|
||||
else if (subdir == "cfg_recallhis_data")
|
||||
return "recall";
|
||||
else if (subdir == "cfg_stat_data")
|
||||
return "stat";
|
||||
else
|
||||
return "unknown";
|
||||
}*/
|
||||
|
||||
|
||||
// 递归创建目录
|
||||
bool create_directory_recursive(const std::string& path) {
|
||||
@@ -145,15 +141,19 @@ protected:
|
||||
else
|
||||
level_str = "terminal";
|
||||
|
||||
// ★读取 TLS 中的 code(在打日志的线程里由宏设定)
|
||||
int code = g_log_code_tls; // 若未显式传入,则为 0
|
||||
|
||||
if (level == ERROR_LOG_LEVEL || level == WARN_LOG_LEVEL || g_debug_switch.match(logger_name, level, logtype)) {
|
||||
std::ostringstream oss;
|
||||
oss << "{\"processNo\":\"" << std::to_string(g_front_seg_index)
|
||||
<< "\",\"nodeId\":\"" << FRONT_INST
|
||||
<< "\",\"businessId\":\"" << extract_logger_id(logger_name)
|
||||
<< "\",\"level\":\"" << level_str
|
||||
<< "\",\"time\":\"" << now_yyyy_mm_dd_hh_mm_ss()
|
||||
<< "\",\"grade\":\"" << get_level_str(level)
|
||||
<< "\",\"logtype\":\"" << (logtype == LOGTYPE_COM ? "com" : "data")
|
||||
<< "\",\"frontType\":\"" << "cloudfront"
|
||||
// ★新增:输出 code 字段(整型)
|
||||
<< "\",\"code\":\"" << code
|
||||
<< "\",\"log\":\"" << escape_json(msg) << "\"}";
|
||||
|
||||
std::string jsonString = oss.str();
|
||||
@@ -161,6 +161,8 @@ protected:
|
||||
queue_data_t connect_info;
|
||||
connect_info.strTopic = G_LOG_TOPIC;
|
||||
connect_info.strText = jsonString;
|
||||
connect_info.tag = G_LOG_TAG;
|
||||
connect_info.key = G_LOG_KEY;
|
||||
|
||||
std::lock_guard<std::mutex> lock(queue_data_list_mutex);
|
||||
queue_data_list.push_back(connect_info);
|
||||
@@ -307,12 +309,10 @@ void init_loggers_bydevid(const std::string& dev_id)
|
||||
|
||||
std::string ip_str = term.addr_str.empty() ? "unknown" : term.addr_str;
|
||||
std::string device_dir = base_dir + "/" + ip_str;
|
||||
std::string device_key_c = std::string("terminal.") + dev_id + ".COM";
|
||||
std::string device_key_d = std::string("terminal.") + dev_id + ".DATA";
|
||||
std::string device_key = std::string("terminal.") + dev_id;
|
||||
|
||||
// 添加判断:终端日志 logger 是否已存在
|
||||
if (logger_map.find(device_key_c) == logger_map.end() &&
|
||||
logger_map.find(device_key_d) == logger_map.end()) {
|
||||
if (logger_map.find(device_key) == logger_map.end()) {
|
||||
|
||||
// 所有终端日志(com 和 data)写到同一个 device 日志文件中
|
||||
std::string file_path_t = device_dir + "/" + dev_id + ".log";
|
||||
@@ -321,27 +321,23 @@ void init_loggers_bydevid(const std::string& dev_id)
|
||||
SharedAppenderPtr device_appender(new RollingFileAppender(file_path_t, 1 * 1024 * 1024, 2));
|
||||
device_appender->setLayout(std::unique_ptr<Layout>(new PatternLayout("%D{%Y-%m-%d %H:%M:%S} [%p] [%c] %m%n")));
|
||||
|
||||
Logger device_logger_c = init_logger(device_key_c, device_dir, dev_id, device_appender);
|
||||
Logger device_logger_d = init_logger(device_key_d, device_dir, dev_id, device_appender);
|
||||
logger_map[device_key_c] = TypedLogger(device_logger_c, LOGTYPE_COM);
|
||||
logger_map[device_key_d] = TypedLogger(device_logger_d, LOGTYPE_DATA);
|
||||
Logger device_logger = init_logger(device_key, device_dir, dev_id, device_appender);
|
||||
logger_map[device_key] = TypedLogger(device_logger, LOGTYPE_DATA);
|
||||
|
||||
DIY_WARNLOG(device_key_d.c_str(), "【WARN】终端id:%s终端级日志初始化完毕", term.terminal_id.c_str());
|
||||
//DIY_WARNLOG(dev_id.c_str(), "【WARN】终端id:%s终端级日志初始化完毕", term.terminal_id.c_str());
|
||||
}
|
||||
|
||||
// 初始化监测点日志,monitor.<mp_id>.COM / .DATA
|
||||
for (size_t j = 0; j < term.line.size(); ++j) {
|
||||
const ledger_monitor& monitor = term.line[j];
|
||||
if (!monitor.monitor_id.empty()) {
|
||||
std::ostringstream mon_key_c, mon_key_d, mon_path, mon_name;
|
||||
mon_key_c << "monitor." << monitor.monitor_id << ".COM";
|
||||
mon_key_d << "monitor." << monitor.monitor_id << ".DATA";
|
||||
std::ostringstream mon_key, mon_path, mon_name;
|
||||
mon_key << "monitor." << monitor.monitor_id;
|
||||
mon_path << device_dir << "/monitor" << j;
|
||||
mon_name << monitor.monitor_id;
|
||||
|
||||
// 判断监测点 logger 是否已存在
|
||||
if (logger_map.find(mon_key_c.str()) == logger_map.end() &&
|
||||
logger_map.find(mon_key_d.str()) == logger_map.end()) {
|
||||
if (logger_map.find(mon_key.str()) == logger_map.end()) {
|
||||
|
||||
// 所有监测点日志(com 和 data)写到同一个 monitor 日志文件中
|
||||
std::string file_path_m = mon_path.str() + "/" + mon_name.str() + ".log";
|
||||
@@ -350,12 +346,10 @@ void init_loggers_bydevid(const std::string& dev_id)
|
||||
SharedAppenderPtr monitor_appender(new RollingFileAppender(file_path_m, 1 * 1024 * 1024, 2));
|
||||
monitor_appender->setLayout(std::unique_ptr<Layout>(new PatternLayout("%D{%Y-%m-%d %H:%M:%S} [%p] [%c] %m%n")));
|
||||
|
||||
Logger mon_logger_c = init_logger(mon_key_c.str(), mon_path.str(), mon_name.str(), monitor_appender);
|
||||
Logger mon_logger_d = init_logger(mon_key_d.str(), mon_path.str(), mon_name.str(), monitor_appender);
|
||||
logger_map[mon_key_c.str()] = TypedLogger(mon_logger_c, LOGTYPE_COM);
|
||||
logger_map[mon_key_d.str()] = TypedLogger(mon_logger_d, LOGTYPE_DATA);
|
||||
Logger mon_logger = init_logger(mon_key.str(), mon_path.str(), mon_name.str(), monitor_appender);
|
||||
logger_map[mon_key.str()] = TypedLogger(mon_logger, LOGTYPE_DATA);
|
||||
|
||||
DIY_WARNLOG(mon_key_d.str().c_str(), "【WARN】监测点:%s - id:%s监测点级日志初始化完毕", monitor.monitor_name.c_str(), monitor.monitor_id.c_str());
|
||||
//DIY_WARNLOG(monitor.monitor_id.c_str(), "【WARN】监测点:%s - id:%s监测点级日志初始化完毕", monitor.monitor_name.c_str(), monitor.logical_device_seq.c_str());
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -382,8 +376,7 @@ void init_loggers()
|
||||
std::string ip_str = term.addr_str.empty() ? "unknown" : term.addr_str;
|
||||
std::string device_dir = base_dir + "/" + ip_str;
|
||||
|
||||
std::string device_key_c = std::string("terminal.") + term.terminal_id + ".COM";
|
||||
std::string device_key_d = std::string("terminal.") + term.terminal_id + ".DATA";
|
||||
std::string device_key = std::string("terminal.") + term.terminal_id;
|
||||
|
||||
// 所有终端日志(com 和 data)写到同一个 device 日志文件中
|
||||
std::string file_path_t = device_dir + "/" + term.terminal_id + ".log";
|
||||
@@ -392,22 +385,19 @@ void init_loggers()
|
||||
SharedAppenderPtr device_appender(new RollingFileAppender(file_path_t, 1 * 1024 * 1024, 2));
|
||||
device_appender->setLayout(std::unique_ptr<Layout>(new PatternLayout("%D{%Y-%m-%d %H:%M:%S} [%p] [%c] %m%n")));
|
||||
|
||||
Logger device_logger_c = init_logger(device_key_c, device_dir, term.terminal_id, device_appender);
|
||||
Logger device_logger_d = init_logger(device_key_d, device_dir, term.terminal_id, device_appender);
|
||||
Logger device_logger = init_logger(device_key, device_dir, term.terminal_id, device_appender);
|
||||
|
||||
logger_map[device_key_c] = TypedLogger(device_logger_c, LOGTYPE_COM);
|
||||
logger_map[device_key_d] = TypedLogger(device_logger_d, LOGTYPE_DATA);
|
||||
logger_map[device_key] = TypedLogger(device_logger, LOGTYPE_DATA);
|
||||
|
||||
DIY_WARNLOG(device_key_d.c_str(), "【WARN】终端id:%s终端级日志初始化完毕", term.terminal_id.c_str());
|
||||
//DIY_WARNLOG(term.terminal_id.c_str(), "【WARN】终端id:%s终端级日志初始化完毕", term.terminal_id.c_str());
|
||||
|
||||
// 初始化监测点日志
|
||||
for (size_t i = 0; i < term.line.size(); ++i) {
|
||||
const ledger_monitor& monitor = term.line[i];
|
||||
|
||||
if (!monitor.monitor_id.empty()) {
|
||||
std::ostringstream mon_key_c, mon_key_d, mon_path, mon_name;
|
||||
mon_key_c << "monitor." << monitor.monitor_id << ".COM";
|
||||
mon_key_d << "monitor." << monitor.monitor_id << ".DATA";
|
||||
std::ostringstream mon_key, mon_path, mon_name;
|
||||
mon_key << "monitor." << monitor.monitor_id;
|
||||
|
||||
mon_path << device_dir << "/monitor" << i; // 用monitor+序号作为目录
|
||||
mon_name << monitor.monitor_id;
|
||||
@@ -418,14 +408,12 @@ void init_loggers()
|
||||
SharedAppenderPtr monitor_appender(new RollingFileAppender(file_path_m, 1 * 1024 * 1024, 2));
|
||||
monitor_appender->setLayout(std::unique_ptr<Layout>(new PatternLayout("%D{%Y-%m-%d %H:%M:%S} [%p] [%c] %m%n")));
|
||||
|
||||
Logger mon_logger_c = init_logger(mon_key_c.str(), mon_path.str(), mon_name.str(), monitor_appender);
|
||||
Logger mon_logger_d = init_logger(mon_key_d.str(), mon_path.str(), mon_name.str(), monitor_appender);
|
||||
Logger mon_logger = init_logger(mon_key.str(), mon_path.str(), mon_name.str(), monitor_appender);
|
||||
|
||||
logger_map[mon_key_c.str()] = TypedLogger(mon_logger_c, LOGTYPE_COM);
|
||||
logger_map[mon_key_d.str()] = TypedLogger(mon_logger_d, LOGTYPE_DATA);
|
||||
logger_map[mon_key.str()] = TypedLogger(mon_logger, LOGTYPE_DATA);
|
||||
|
||||
DIY_WARNLOG(mon_key_d.str().c_str(), "【WARN】监测点:%s - id:%s监测点级日志初始化完毕",
|
||||
monitor.monitor_name.c_str(), monitor.monitor_id.c_str());
|
||||
//DIY_WARNLOG(mon_key.str().c_str(), "【WARN】监测点:%s - id:%s监测点级日志初始化完毕",
|
||||
//monitor.monitor_name.c_str(), monitor.logical_device_seq.c_str());
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -439,17 +427,11 @@ void remove_loggers_by_terminal_id(const std::string& terminal_id) {
|
||||
if (term.terminal_id != terminal_id) continue;
|
||||
|
||||
// 删除终端日志 logger
|
||||
std::string com_key = "terminal." + terminal_id + ".COM";
|
||||
std::string data_key = "terminal." + terminal_id + ".DATA";
|
||||
std::string terminal_key = "terminal." + terminal_id;
|
||||
|
||||
if (logger_map.count(com_key)) {
|
||||
logger_map[com_key].logger.removeAllAppenders();
|
||||
logger_map.erase(com_key);
|
||||
}
|
||||
|
||||
if (logger_map.count(data_key)) {
|
||||
logger_map[data_key].logger.removeAllAppenders();
|
||||
logger_map.erase(data_key);
|
||||
if (logger_map.count(terminal_key)) {
|
||||
logger_map[terminal_key].logger.removeAllAppenders();
|
||||
logger_map.erase(terminal_key);
|
||||
}
|
||||
|
||||
// 删除监测点日志 logger
|
||||
@@ -457,18 +439,13 @@ void remove_loggers_by_terminal_id(const std::string& terminal_id) {
|
||||
const ledger_monitor& monitor = term.line[i];
|
||||
if (!monitor.monitor_id.empty()) {
|
||||
std::string mon_prefix = "monitor." + monitor.monitor_id;
|
||||
std::string mon_com_key = mon_prefix + ".COM";
|
||||
std::string mon_data_key = mon_prefix + ".DATA";
|
||||
std::string mon_key = mon_prefix;
|
||||
|
||||
if (logger_map.count(mon_com_key)) {
|
||||
logger_map[mon_com_key].logger.removeAllAppenders();
|
||||
logger_map.erase(mon_com_key);
|
||||
if (logger_map.count(mon_key)) {
|
||||
logger_map[mon_key].logger.removeAllAppenders();
|
||||
logger_map.erase(mon_key);
|
||||
}
|
||||
|
||||
if (logger_map.count(mon_data_key)) {
|
||||
logger_map[mon_data_key].logger.removeAllAppenders();
|
||||
logger_map.erase(mon_data_key);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -504,22 +481,28 @@ extern "C" {
|
||||
void log_warn (const char* key, const char* msg) { log4_log_with_level(key, msg, 2); }
|
||||
void log_error(const char* key, const char* msg) { log4_log_with_level(key, msg, 3); }
|
||||
|
||||
void send_reply_to_queue_c(const char* guid, const char* step, const char* result) {
|
||||
send_reply_to_queue(std::string(guid), std::string(step), std::string(result));
|
||||
}
|
||||
|
||||
//标准化日志接口
|
||||
// #define LOGMSG_WITH_TS // 需要时间时再打开
|
||||
|
||||
void format_log_msg(char* buf, size_t buf_size, const char* fmt, ...) {
|
||||
if (!buf || buf_size == 0) return;
|
||||
buf[0] = '\0';
|
||||
if (!fmt) return;
|
||||
|
||||
va_list args;
|
||||
va_start(args, fmt);
|
||||
#ifdef LOGMSG_WITH_TS
|
||||
// 写入时间
|
||||
time_t now = time(NULL);
|
||||
struct tm tm_info;
|
||||
localtime_r(&now, &tm_info);
|
||||
strftime(buf, buf_size, "%Y-%m-%d %H:%M:%S ", &tm_info); // 时间+空格
|
||||
|
||||
// 处理可变参数并写入剩余内容
|
||||
va_list args;
|
||||
va_start(args, fmt);
|
||||
vsnprintf(buf + strlen(buf), buf_size - strlen(buf), fmt, args);
|
||||
size_t n = strftime(buf, buf_size, "%Y-%m-%d %H:%M:%S ", &tm_info);
|
||||
if (n < buf_size) {
|
||||
vsnprintf(buf + n, buf_size - n, fmt, args);
|
||||
}
|
||||
#else
|
||||
vsnprintf(buf, buf_size, fmt, args);
|
||||
#endif
|
||||
va_end(args);
|
||||
}
|
||||
|
||||
|
||||
@@ -1,6 +1,16 @@
|
||||
#ifndef LOG4_H
|
||||
#define LOG4_H
|
||||
|
||||
#if defined(__cplusplus) && __cplusplus >= 201103L
|
||||
#define LOG_TLS_SPEC thread_local
|
||||
#else
|
||||
/* C 或旧编译器,走 GCC 扩展 */
|
||||
#define LOG_TLS_SPEC __thread
|
||||
#endif
|
||||
|
||||
/* ★统一的对外声明(别在其他头/源里再声明不同版本!) */
|
||||
extern LOG_TLS_SPEC int g_log_code_tls;
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
||||
#include <string>
|
||||
@@ -51,7 +61,7 @@ struct DebugSwitch {
|
||||
extern std::map<std::string, TypedLogger> logger_map;
|
||||
extern DebugSwitch g_debug_switch;
|
||||
|
||||
extern void send_reply_to_queue(const std::string& guid, const std::string& step, const std::string& result);
|
||||
extern void send_reply_to_queue(const std::string& guid, const int code, const std::string& result);
|
||||
|
||||
|
||||
//std::string get_front_type_from_subdir();
|
||||
@@ -84,23 +94,95 @@ void log_debug(const char* key, const char* msg);
|
||||
void log_info(const char* key, const char* msg);
|
||||
void log_warn(const char* key, const char* msg);
|
||||
void log_error(const char* key, const char* msg);
|
||||
|
||||
void send_reply_to_queue_c(const char* guid, const char* step, const char* result);
|
||||
void format_log_msg(char* buf, size_t buf_size, const char* fmt, ...);
|
||||
|
||||
//宏定义
|
||||
#define DIY_LOG(LEVEL_FUNC, KEY, ...) \
|
||||
do { \
|
||||
char buf[256]; \
|
||||
format_log_msg(buf, sizeof(buf), __VA_ARGS__); \
|
||||
LEVEL_FUNC(KEY, buf); \
|
||||
// ====================== ★新增:线程局部变量透传 code ======================
|
||||
// 说明:使用编译器的 TLS(__thread)保存当前日志的 code 值。
|
||||
// 在每次打日志前写入,打完后恢复,Appender 读取该值写入 JSON。
|
||||
|
||||
|
||||
// ====================== ★新增结束 ======================
|
||||
|
||||
typedef enum LogCode {
|
||||
LOG_CODE_OTHER = 99, /* 其他类型 */
|
||||
LOG_CODE_LEDGER = 100, /* 台账类型 */
|
||||
LOG_CODE_RPTINIT = 101, /* 报告初始化 */
|
||||
LOG_CODE_ICD_AND_DOWNLOAD = 200, /* ICD 和文件下载类型 */
|
||||
LOG_CODE_TRANSIENT = 300, /* 暂态发生 */
|
||||
LOG_CODE_TRANSIENT_COMM = 301, /* 暂态接口 */
|
||||
LOG_CODE_COMTRADE_FILE = 302, /* 录波文件(Comtrade) */
|
||||
LOG_CODE_MQ = 400, /* MQ发送 */
|
||||
LOG_CODE_RT_DATA = 401, /* 实时数据 */
|
||||
LOG_CODE_LEDGER_UPDATE = 402, /* 台账更新 */
|
||||
LOG_CODE_PROCESS_CONTROL = 403, /* 进程控制 */
|
||||
LOG_CODE_RECALL = 404, /* 补招相关 */
|
||||
LOG_CODE_LOG_REQUEST = 405, /* 日志请求 */
|
||||
LOG_CODE_REPORT = 500, /* 报告处理 */
|
||||
LOG_CODE_COMM = 600, /* 通讯状态 */
|
||||
LOG_CODE_SPACE_ALARM = 700, /* 空间告警 */
|
||||
LOG_CODE_DEV_ALARM = 800 /* 设备告警 */
|
||||
} LogCode;
|
||||
|
||||
// ====================== 日志宏区域 ======================
|
||||
|
||||
// ★新增:带 code 的实现(C/C++ 通用,使用 TLS 保存/恢复)
|
||||
#define DIY_LOG_CODE(LEVEL_FUNC, KEY, LEVEL_INT, CODE_INT, ...) \
|
||||
do { \
|
||||
/* 备份并设置本次日志 code */ \
|
||||
int __old_code__ = g_log_code_tls; \
|
||||
g_log_code_tls = static_cast<int>(CODE_INT); \
|
||||
\
|
||||
/* 组装消息 */ \
|
||||
char __msg_buf__[256]; \
|
||||
format_log_msg(__msg_buf__, sizeof(__msg_buf__), __VA_ARGS__); \
|
||||
\
|
||||
/* 将 KEY 规范化为字符串(兼容 const char* / std::string 等) */ \
|
||||
std::ostringstream __oss_key__; \
|
||||
__oss_key__ << (KEY); \
|
||||
std::string __key_raw__ = __oss_key__.str(); \
|
||||
\
|
||||
/* 根据 LEVEL_INT 构造最终 key */ \
|
||||
char __key_buf__[256]; \
|
||||
switch (static_cast<int>(LEVEL_INT)) { \
|
||||
case 0: \
|
||||
std::snprintf(__key_buf__, sizeof(__key_buf__), "process"); \
|
||||
break; \
|
||||
case 1: \
|
||||
std::snprintf(__key_buf__, sizeof(__key_buf__), \
|
||||
"terminal.%s", __key_raw__.c_str()); \
|
||||
break; \
|
||||
case 2: \
|
||||
std::snprintf(__key_buf__, sizeof(__key_buf__), \
|
||||
"monitor.%s", __key_raw__.c_str()); \
|
||||
break; \
|
||||
default: \
|
||||
std::snprintf(__key_buf__, sizeof(__key_buf__), "%s", \
|
||||
__key_raw__.c_str()); \
|
||||
break; \
|
||||
} \
|
||||
\
|
||||
/* 输出日志 */ \
|
||||
LEVEL_FUNC(__key_buf__, __msg_buf__); \
|
||||
\
|
||||
/* 恢复旧值 */ \
|
||||
g_log_code_tls = __old_code__; \
|
||||
} while (0)
|
||||
|
||||
#define DIY_ERRORLOG(KEY, ...) DIY_LOG(log_error, KEY, __VA_ARGS__)
|
||||
#define DIY_WARNLOG(KEY, ...) DIY_LOG(log_warn, KEY, __VA_ARGS__)
|
||||
#define DIY_INFOLOG(KEY, ...) DIY_LOG(log_info, KEY, __VA_ARGS__)
|
||||
#define DIY_DEBUGLOG(KEY, ...) DIY_LOG(log_debug, KEY, __VA_ARGS__)
|
||||
// ★修改:默认宏改为 code=0(兼容原有用法)
|
||||
#define DIY_ERRORLOG(KEY, ...) DIY_LOG_CODE(log_error, KEY, 0, LOG_CODE_OTHER,__VA_ARGS__) // ★修改:默认 code=0
|
||||
#define DIY_WARNLOG(KEY, ...) DIY_LOG_CODE(log_warn, KEY, 0, LOG_CODE_OTHER,__VA_ARGS__) // ★修改:默认 code=0
|
||||
#define DIY_INFOLOG(KEY, ...) DIY_LOG_CODE(log_info, KEY, 0, LOG_CODE_OTHER,__VA_ARGS__) // ★修改:默认 code=0
|
||||
#define DIY_DEBUGLOG(KEY, ...) DIY_LOG_CODE(log_debug, KEY, 0, LOG_CODE_OTHER,__VA_ARGS__) // ★修改:默认 code=0
|
||||
|
||||
// ★新增:显式传入 code 的便捷宏
|
||||
// 用法示例:DIY_WARNLOG_CODE(full_key_m_c, warn_recallstart, "【WARN】监测点:%s ...", ...);
|
||||
#define DIY_ERRORLOG_CODE(KEY, LEVEL_INT,CODE_INT, ...) DIY_LOG_CODE(log_error, KEY, LEVEL_INT, CODE_INT, __VA_ARGS__) // ★新增
|
||||
#define DIY_WARNLOG_CODE(KEY, LEVEL_INT,CODE_INT, ...) DIY_LOG_CODE(log_warn, KEY, LEVEL_INT, CODE_INT, __VA_ARGS__) // ★新增
|
||||
#define DIY_INFOLOG_CODE(KEY, LEVEL_INT,CODE_INT, ...) DIY_LOG_CODE(log_info, KEY, LEVEL_INT, CODE_INT, __VA_ARGS__) // ★新增
|
||||
#define DIY_DEBUGLOG_CODE(KEY, LEVEL_INT,CODE_INT, ...) DIY_LOG_CODE(log_debug, KEY, LEVEL_INT, CODE_INT, __VA_ARGS__) // ★新增
|
||||
|
||||
|
||||
// ====================== 日志宏区域 ======================
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
||||
@@ -1,111 +0,0 @@
|
||||
#ifndef LOG4_H
|
||||
#define LOG4_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
||||
#include <string>
|
||||
#include <map>
|
||||
|
||||
//防止#include <log4cplus/logger.h>里的冲突
|
||||
#ifdef min
|
||||
#undef min
|
||||
#endif
|
||||
|
||||
#ifdef max
|
||||
#undef max
|
||||
#endif
|
||||
//防止#include <log4cplus/logger.h>里的冲突
|
||||
|
||||
#include "logger.h"
|
||||
#include <set>
|
||||
#include "loggingmacros.h"
|
||||
|
||||
#include "appender.h"
|
||||
|
||||
#define LOGTYPE_COM 1
|
||||
#define LOGTYPE_DATA 2
|
||||
|
||||
struct TypedLogger {
|
||||
log4cplus::Logger logger;
|
||||
int logtype;
|
||||
TypedLogger();
|
||||
TypedLogger(const log4cplus::Logger& l, int t);
|
||||
};
|
||||
|
||||
struct DebugSwitch {
|
||||
bool debug_open;
|
||||
std::set<std::string> targets;
|
||||
int min_level;
|
||||
std::map<int, bool> type_enable;
|
||||
|
||||
DebugSwitch();
|
||||
void open();
|
||||
void close();
|
||||
void set_target(const std::string& name);
|
||||
void set_level(int level);
|
||||
void enable_type(int type);
|
||||
void disable_type(int type);
|
||||
bool match(const std::string& logger_name, int level, int logtype);
|
||||
};
|
||||
|
||||
extern std::map<std::string, TypedLogger> logger_map;
|
||||
extern DebugSwitch g_debug_switch;
|
||||
|
||||
extern void send_reply_to_queue(const std::string& guid, const std::string& step, const std::string& result);
|
||||
|
||||
|
||||
//std::string get_front_type_from_subdir();
|
||||
|
||||
|
||||
// 不带 Appender 的版本
|
||||
log4cplus::Logger init_logger(const std::string& full_name,
|
||||
const std::string& file_dir,
|
||||
const std::string& base_file);
|
||||
|
||||
// 带 Appender 的版本
|
||||
log4cplus::Logger init_logger(const std::string& full_name,
|
||||
const std::string& file_dir,
|
||||
const std::string& base_file,
|
||||
log4cplus::SharedAppenderPtr fileAppender);
|
||||
|
||||
void process_log_command(const std::string& id, const std::string& level, const std::string& grade, const std::string& logtype_str);
|
||||
|
||||
|
||||
void update_log_entries_countdown();
|
||||
|
||||
extern "C" {
|
||||
#endif
|
||||
void remove_loggers_by_terminal_id(const std::string& terminal_id_cstr);
|
||||
void init_logger_process();
|
||||
void init_loggers();
|
||||
void init_loggers_bydevid(const std::string& dev_id);
|
||||
|
||||
void log_debug(const char* key, const char* msg);
|
||||
void log_info(const char* key, const char* msg);
|
||||
void log_warn(const char* key, const char* msg);
|
||||
void log_error(const char* key, const char* msg);
|
||||
|
||||
void send_reply_to_queue_c(const char* guid, const char* step, const char* result);
|
||||
void format_log_msg(char* buf, size_t buf_size, const char* fmt, ...);
|
||||
|
||||
//宏定义
|
||||
#define DIY_LOG(LEVEL_FUNC, KEY, ...) \
|
||||
do { \
|
||||
char buf[256]; \
|
||||
format_log_msg(buf, sizeof(buf), __VA_ARGS__); \
|
||||
LEVEL_FUNC(KEY, buf); \
|
||||
} while (0)
|
||||
|
||||
#define DIY_ERRORLOG(KEY, ...) DIY_LOG(log_error, KEY, __VA_ARGS__)
|
||||
#define DIY_WARNLOG(KEY, ...) DIY_LOG(log_warn, KEY, __VA_ARGS__)
|
||||
#define DIY_INFOLOG(KEY, ...) DIY_LOG(log_info, KEY, __VA_ARGS__)
|
||||
#define DIY_DEBUGLOG(KEY, ...) DIY_LOG(log_debug, KEY, __VA_ARGS__)
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
#endif // LOG4_H
|
||||
@@ -29,7 +29,7 @@
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#include "interface.h" //用于访问接口
|
||||
#include "log4cplus/log4.h" //用于日志
|
||||
#include "log4.h" //用于日志
|
||||
#include "curl/curl.h" //用于访问接口
|
||||
#include "nlohmann/json.hpp" //用于构造json
|
||||
#include "worker.h" //shell接口
|
||||
@@ -215,7 +215,7 @@ std::string get_parent_directory() {
|
||||
init_loggers();
|
||||
|
||||
//读取模型,下载模板文件
|
||||
parse_model_cfg_web();
|
||||
//parse_model_cfg_web();
|
||||
|
||||
//解析模板文件
|
||||
//Set_xml_nodeinfo();
|
||||
@@ -317,9 +317,12 @@ void Front::FrontThread() {
|
||||
|
||||
try {
|
||||
while (!m_bIsFrontThreadCancle) {
|
||||
check_3s_config(); // 实时数据触发
|
||||
//create_recall_xml(); // 生成待补招xml文件
|
||||
check_ledger_update(); // 触发台账更新
|
||||
|
||||
check_recall_file(); //处理补招文件-稳态和暂态
|
||||
check_recall_event(); // 处理补招事件,从list中读取然后直接调用接口,每一条可能都不同测点,每个测点自己做好记录
|
||||
//check_ledger_update(); // 触发台账更新
|
||||
|
||||
std::this_thread::sleep_for(std::chrono::milliseconds(100));
|
||||
}
|
||||
} catch (const std::exception& e) {
|
||||
std::cerr << "[FrontThread] Caught exception: " << e.what() << std::endl;
|
||||
@@ -344,18 +347,32 @@ void Front::OnTimerThread()
|
||||
std::this_thread::sleep_for(std::chrono::milliseconds(1000));
|
||||
std::cout << "OnTimerThread::run() is called ...... \n";
|
||||
|
||||
int counter = 0;
|
||||
int hbCounter = 0; // 心跳计数
|
||||
int backupCounter = 0; // 备份计数(分钟用)
|
||||
|
||||
send_heartbeat_to_queue("1");
|
||||
|
||||
while (!m_IsTimerCancel)
|
||||
{
|
||||
update_log_entries_countdown();
|
||||
|
||||
if (counter >= 30) {
|
||||
//业务超时检查
|
||||
check_device_busy_timeout();
|
||||
|
||||
// 每 30 秒发一次心跳
|
||||
if (hbCounter >= 30) {
|
||||
send_heartbeat_to_queue("1");
|
||||
counter = 0;
|
||||
hbCounter = 0;
|
||||
}
|
||||
counter++;
|
||||
|
||||
// 每 60 秒调用一次录波文件检查
|
||||
if (backupCounter >= 60) {
|
||||
check_and_backup_qvvr_files();
|
||||
backupCounter = 0;
|
||||
}
|
||||
|
||||
hbCounter++;
|
||||
backupCounter++;
|
||||
|
||||
g_ontime_blocked_times = 0;
|
||||
std::this_thread::sleep_for(std::chrono::milliseconds(1000));
|
||||
@@ -366,7 +383,6 @@ void Front::OnTimerThread()
|
||||
std::cerr << "[OnTimerThread] Caught unknown exception" << std::endl;
|
||||
}
|
||||
|
||||
// 设置重启标志
|
||||
{
|
||||
std::lock_guard<std::mutex> lock(m_threadCheckMutex);
|
||||
m_needRestartTimerThread = true;
|
||||
@@ -385,14 +401,14 @@ void Front::mqconsumerThread()
|
||||
std::vector<rocketmq::Subscription> subscriptions;
|
||||
|
||||
//if (g_node_id == THREE_SECS_DATA_BASE_NODE_ID) {
|
||||
subscriptions.emplace_back(FRONT_INST + "_" + G_MQCONSUMER_TOPIC_RT, G_MQCONSUMER_TAG_RT, myMessageCallbackrtdata);
|
||||
subscriptions.emplace_back(G_MQCONSUMER_TOPIC_RT, FRONT_INST, myMessageCallbackrtdata);
|
||||
//}
|
||||
subscriptions.emplace_back(FRONT_INST + "_" + G_MQCONSUMER_TOPIC_UD, G_MQCONSUMER_TAG_UD, myMessageCallbackupdate);
|
||||
subscriptions.emplace_back(G_MQCONSUMER_TOPIC_UD, FRONT_INST, myMessageCallbackupdate);
|
||||
//if (g_node_id == RECALL_HIS_DATA_BASE_NODE_ID) {
|
||||
subscriptions.emplace_back(FRONT_INST + "_" + G_MQCONSUMER_TOPIC_RC, G_MQCONSUMER_TAG_RC, myMessageCallbackrecall);
|
||||
subscriptions.emplace_back(G_MQCONSUMER_TOPIC_RC, FRONT_INST, myMessageCallbackrecall);
|
||||
//}
|
||||
subscriptions.emplace_back(FRONT_INST + "_" + G_MQCONSUMER_TOPIC_SET, G_MQCONSUMER_TAG_SET, myMessageCallbackset);
|
||||
subscriptions.emplace_back(FRONT_INST + "_" + G_MQCONSUMER_TOPIC_LOG, G_MQCONSUMER_TAG_LOG, myMessageCallbacklog);
|
||||
subscriptions.emplace_back(G_MQCONSUMER_TOPIC_SET, FRONT_INST, myMessageCallbackset);
|
||||
subscriptions.emplace_back(G_MQCONSUMER_TOPIC_LOG, FRONT_INST, myMessageCallbacklog);
|
||||
|
||||
m_mqConsumer = make_unique<rocketmq::DefaultMQPushConsumer>(consumerGroup);
|
||||
m_mqConsumer->setNamesrvAddr(nameServer);
|
||||
@@ -518,16 +534,35 @@ void Front::mqproducerThread()
|
||||
|
||||
extern thread_info_t thread_info[THREAD_CONNECTIONS];
|
||||
|
||||
void cleanup_args(ThreadArgs* args) {
|
||||
for (int i = 0; i < args->argc; ++i) {
|
||||
free(args->argv[i]); // strdup 分配的
|
||||
}
|
||||
delete[] args->argv;
|
||||
delete args;
|
||||
}
|
||||
|
||||
void* cloudfrontthread(void* arg) {
|
||||
///////////////////////////////////////
|
||||
ThreadArgs* args = static_cast<ThreadArgs*>(arg);
|
||||
int argc = args->argc;
|
||||
char **argv = args->argv;
|
||||
|
||||
printf("argc = %d, argv[0] = %s\n", argc, argv[0]);
|
||||
printf("[cloudfrontthread] argc = %d\n", argc);
|
||||
for (int i = 0; i < argc; ++i) {
|
||||
printf(" argv[%d] = %s\n", i, argv[i]);
|
||||
}
|
||||
|
||||
//添加线程处理
|
||||
int index = *(int*)argv[0];
|
||||
// 动态解析线程 index
|
||||
int index = 0;
|
||||
if (argc > 0 && argv[0]) {
|
||||
try {
|
||||
index = std::stoi(argv[0]);
|
||||
} catch (...) {
|
||||
std::cerr << "[cloudfrontthread] Failed to parse index from argv[0]: " << argv[0] << "\n";
|
||||
return nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
// 更新线程状态为运行中
|
||||
pthread_mutex_lock(&thread_info[index].lock);
|
||||
@@ -539,11 +574,12 @@ void* cloudfrontthread(void* arg) {
|
||||
// 解析命令行参数
|
||||
if(!parse_param(argc,argv)){
|
||||
std::cerr << "process param error,exit" << std::endl;
|
||||
cleanup_args(args);
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
// 线程使用完后清理参数
|
||||
delete args;
|
||||
cleanup_args(args);
|
||||
|
||||
//路径获取
|
||||
FRONT_PATH = get_parent_directory();
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -60,6 +60,10 @@ extern std::string TOPIC_RTDATA;
|
||||
extern std::string G_ROCKETMQ_TAG;
|
||||
extern std::string G_ROCKETMQ_KEY;
|
||||
|
||||
//添加rt的tagkey
|
||||
extern std::string G_RT_TAG;
|
||||
extern std::string G_RT_KEY;
|
||||
|
||||
extern std::string G_ROCKETMQ_CONSUMER;
|
||||
extern std::string G_MQCONSUMER_IPPORT;
|
||||
extern std::string G_MQCONSUMER_ACCESSKEY;
|
||||
@@ -86,6 +90,10 @@ extern std::string G_MQCONSUMER_TOPIC_LOG;
|
||||
extern std::string G_MQCONSUMER_TAG_LOG;
|
||||
extern std::string G_MQCONSUMER_KEY_LOG;
|
||||
|
||||
extern std::string G_MQCONSUMER_TOPIC_CLOUD;
|
||||
extern std::string G_MQCONSUMER_TAG_CLOUD;
|
||||
extern std::string G_MQCONSUMER_KEY_CLOUD;
|
||||
|
||||
extern std::string G_LOG_TOPIC;
|
||||
extern std::string G_LOG_TAG;
|
||||
extern std::string G_LOG_KEY;
|
||||
@@ -336,7 +344,7 @@ void rocketmq_test_rc(Front* front);
|
||||
void rocketmq_test_set(Front* front);
|
||||
void rocketmq_test_ud(Front* front);
|
||||
void rocketmq_test_rt(Front* front);
|
||||
|
||||
void rocketmq_test_getdir(Front* front);
|
||||
void InitializeProducer(rocketmq::RocketMQProducer*& producer);
|
||||
|
||||
#endif // _ROCKETMQ_CLIENT_WRAPPER_H_
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#include <fstream>
|
||||
#include <iostream>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
@@ -35,7 +35,7 @@
|
||||
#include "worker.h"
|
||||
#include "interface.h"
|
||||
#include "rocketmq.h"
|
||||
#include "log4cplus/log4.h"
|
||||
#include "log4.h"
|
||||
#include "front.h"
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
@@ -294,6 +294,7 @@ extern bool normalOutputEnabled;
|
||||
"G_TEST_NUM=<num> - Set the G_TEST_NUM\r\n"
|
||||
"G_TEST_TYPE=<num> - Set the G_TEST_TYPE 0:use ledger,1:use number\r\n"
|
||||
"LOG=<bool> - Set the LOG\r\n"
|
||||
"dir - Execute rocketmq_test_getdir\r\n"
|
||||
"rc - Execute rocketmq_test_rc\r\n"
|
||||
"rt - Execute rocketmq_test_rt\r\n"
|
||||
"ud - Execute rocketmq_test_ud\r\n"
|
||||
@@ -325,6 +326,9 @@ extern bool normalOutputEnabled;
|
||||
} else if (cmd == "rc") {
|
||||
rocketmq_test_rc(m_front);
|
||||
sendStr(clientFD, "\r\x1B[KExecuted rocketmq_test_rc\r\n");
|
||||
} else if (cmd == "getdir") {
|
||||
rocketmq_test_getdir(m_front);
|
||||
sendStr(clientFD, "\r\x1B[KExecuted rocketmq_test_getdir\r\n");
|
||||
} else if (cmd == "rt") {
|
||||
rocketmq_test_rt(m_front);
|
||||
sendStr(clientFD, "\r\x1B[KExecuted rocketmq_test_rt\r\n");
|
||||
@@ -405,49 +409,205 @@ extern bool normalOutputEnabled;
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////测试shell用的函数
|
||||
|
||||
void Worker::printLedgerinshell(const terminal_dev& dev, int fd) {
|
||||
// —— 显示控制:最多打印的元素数量(防止过长)——
|
||||
constexpr size_t MAX_ITEMS = 5; // 可按需调整或删除限制
|
||||
|
||||
std::ostringstream os;
|
||||
os << "\r\x1B[K------------------------------------\n";
|
||||
os << "\r\x1B[K|-- terminal_id: " << dev.terminal_id << "\n";
|
||||
os << "\r\x1B[K|-- terminal_name: " << dev.terminal_name << "\n";
|
||||
os << "\r\x1B[K|-- dev_ip: " << dev.addr_str << "\n";
|
||||
os << "\r\x1B[K|-- dev_port: " << dev.port << "\n";
|
||||
os << "\r\x1B[K|-- dev_type: " << dev.dev_type << "\n";
|
||||
os << "\r\x1B[K|-- dev_key: " << dev.dev_key << "\n";
|
||||
os << "\r\x1B[K|-- dev_series: " << dev.dev_series << "\n";
|
||||
os << "\r\x1B[K|-- dev_processNo: " << dev.processNo << "\n";
|
||||
os << "\r\x1B[K|-- maxProcessNum: " << dev.maxProcessNum << "\n";
|
||||
os << "\r\x1B[K|-- org_name: " << dev.org_name << "\n";
|
||||
os << "\r\x1B[K|-- maint_name: " << dev.maint_name << "\n";
|
||||
os << "\r\x1B[K|-- station_name: " << dev.station_name << "\n";
|
||||
os << "\r\x1B[K|-- tmnl_factory: " << dev.tmnl_factory << "\n";
|
||||
os << "\r\x1B[K|-- tmnl_status: " << dev.tmnl_status << "\n";
|
||||
os << "\r\x1B[K|-- timestamp: " << dev.timestamp << "\n";
|
||||
//os << "\r\x1B[K|-- dev_index : " << dev.dev_index << "\n";
|
||||
os << "\r\x1B[K|-- terminal_id : " << dev.terminal_id << "\n";
|
||||
os << "\r\x1B[K|-- terminal_name : " << dev.terminal_name << "\n";
|
||||
os << "\r\x1B[K|-- dev_ip : " << dev.addr_str << "\n";
|
||||
os << "\r\x1B[K|-- dev_port : " << dev.port << "\n";
|
||||
os << "\r\x1B[K|-- dev_type : " << dev.dev_type << "\n";
|
||||
os << "\r\x1B[K|-- dev_key : " << dev.dev_key << "\n";
|
||||
os << "\r\x1B[K|-- dev_series : " << dev.dev_series << "\n";
|
||||
os << "\r\x1B[K|-- dev_processNo : " << dev.processNo << "\n";
|
||||
os << "\r\x1B[K|-- maxProcessNum : " << dev.maxProcessNum << "\n";
|
||||
os << "\r\x1B[K|-- org_name : " << dev.org_name << "\n";
|
||||
os << "\r\x1B[K|-- maint_name : " << dev.maint_name << "\n";
|
||||
os << "\r\x1B[K|-- station_name : " << dev.station_name << "\n";
|
||||
os << "\r\x1B[K|-- tmnl_factory : " << dev.tmnl_factory << "\n";
|
||||
os << "\r\x1B[K|-- tmnl_status : " << dev.tmnl_status << "\n";
|
||||
os << "\r\x1B[K|-- timestamp : " << dev.timestamp << "\n";
|
||||
os << "\r\x1B[K|-- Righttime : " << dev.Righttime << "\n";
|
||||
os << "\r\x1B[K|-- mac : " << dev.mac << "\n";
|
||||
|
||||
os << "\r\x1B[K|-- mac: " << dev.mac << "\n";
|
||||
// ========================= 终端级 · 内部定值 =========================
|
||||
// internal_values(ushort 列表)与 dz_internal_info_list 一一对应,仅展示前 MAX_ITEMS 条
|
||||
os << "\r\x1B[K|-- Internal Values (" << dev.internal_values.size() << "):\n";
|
||||
{
|
||||
size_t idx = 0;
|
||||
for (auto itv = dev.internal_values.begin();
|
||||
itv != dev.internal_values.end() && idx < MAX_ITEMS;
|
||||
++itv, ++idx) {
|
||||
os << "\r\x1B[K |-- [" << idx << "] value: " << static_cast<unsigned>(*itv) << "\n";
|
||||
}
|
||||
if (dev.internal_values.size() > MAX_ITEMS) {
|
||||
os << "\r\x1B[K |.. (+" << (dev.internal_values.size() - MAX_ITEMS) << " more)\n";
|
||||
}
|
||||
}
|
||||
|
||||
// dz_internal_info_list(NameFixValue 描述,和 internal_values 对应)
|
||||
os << "\r\x1B[K|-- Internal Value Descriptions (" << dev.dz_internal_info_list.size() << "):\n";
|
||||
{
|
||||
const size_t n = dev.dz_internal_info_list.size();
|
||||
for (size_t i = 0; i < n && i < MAX_ITEMS; ++i) {
|
||||
const auto& nf = dev.dz_internal_info_list[i];
|
||||
os << "\r\x1B[K |-- [" << i << "] "
|
||||
<< "Name=" << trim_cstr(nf.sFixValueName, sizeof(nf.sFixValueName))
|
||||
<< ", Type=" << nf.DataType
|
||||
<< ", Unit=" << trim_cstr(nf.sDimension, sizeof(nf.sDimension))
|
||||
<< ", Min=" << nf.MinValue
|
||||
<< ", Max=" << nf.MaxValue
|
||||
<< ", Default=" << nf.DefaultValue
|
||||
<< "\n";
|
||||
}
|
||||
if (n > MAX_ITEMS) {
|
||||
os << "\r\x1B[K |.. (+" << (n - MAX_ITEMS) << " more)\n";
|
||||
}
|
||||
}
|
||||
|
||||
// control_words(控制字描述)
|
||||
os << "\r\x1B[K|-- Control Words (" << dev.control_words.size() << "):\n";
|
||||
{
|
||||
const size_t n = dev.control_words.size();
|
||||
for (size_t i = 0; i < n && i < MAX_ITEMS; ++i) {
|
||||
const DZ_kzz_bit& b = dev.control_words[i];
|
||||
os << "\r\x1B[K |-- [" << i << "] "
|
||||
<< "name=\"" << trim_cstr(b.kzz_bit, sizeof(b.kzz_bit)) << "\""
|
||||
<< ", enable=" << static_cast<int>(b.bit_enable) << "\n";
|
||||
}
|
||||
if (n > MAX_ITEMS) {
|
||||
os << "\r\x1B[K |.. (+" << (n - MAX_ITEMS) << " more)\n";
|
||||
}
|
||||
}
|
||||
|
||||
// ========================= 监测点级 · line =========================
|
||||
for (size_t i = 0; i < dev.line.size(); ++i) {
|
||||
const auto& ld = dev.line[i];
|
||||
if (ld.monitor_id.empty()) continue;
|
||||
|
||||
os << "\r\x1B[K|-- line[" << i << "]:\n";
|
||||
os << "\r\x1B[K |-- monitor_id: " << ld.monitor_id << "\n";
|
||||
os << "\r\x1B[K |-- monitor_name: " << ld.monitor_name << "\n";
|
||||
os << "\r\x1B[K |-- logical_device_seq: " << ld.logical_device_seq << "\n";
|
||||
os << "\r\x1B[K |-- terminal_id: " << ld.terminal_id << "\n";
|
||||
os << "\r\x1B[K |-- voltage_level: " << ld.voltage_level << "\n";
|
||||
os << "\r\x1B[K |-- terminal_connect: " << ld.terminal_connect << "\n";
|
||||
os << "\r\x1B[K |-- status: " << ld.status << "\n";
|
||||
os << "\r\x1B[K |-- timestamp: " << ld.timestamp << "\n";
|
||||
os << "\r\x1B[K |-- monitor_id : " << ld.monitor_id << "\n";
|
||||
os << "\r\x1B[K |-- monitor_name : " << ld.monitor_name << "\n";
|
||||
os << "\r\x1B[K |-- logical_device_seq : " << ld.logical_device_seq << "\n";
|
||||
os << "\r\x1B[K |-- terminal_id : " << ld.terminal_id << "\n";
|
||||
os << "\r\x1B[K |-- voltage_level : " << ld.voltage_level << "\n";
|
||||
os << "\r\x1B[K |-- terminal_connect : " << ld.terminal_connect << "\n";
|
||||
os << "\r\x1B[K |-- status : " << ld.status << "\n";
|
||||
os << "\r\x1B[K |-- timestamp : " << ld.timestamp << "\n";
|
||||
os << "\r\x1B[K |-- CT1=" << ld.CT1 << ", CT2=" << ld.CT2
|
||||
<< ", PT1=" << ld.PT1 << ", PT2=" << ld.PT2 << "\n";
|
||||
|
||||
os << "\r\x1B[K |-- CT1: " << ld.CT1 << "\n";
|
||||
os << "\r\x1B[K |-- CT2: " << ld.CT2 << "\n";
|
||||
os << "\r\x1B[K |-- PT1: " << ld.PT1 << "\n";
|
||||
os << "\r\x1B[K |-- PT2: " << ld.PT2 << "\n";
|
||||
// --- 监测点 · 定值(set_values) ---
|
||||
os << "\r\x1B[K |-- Set Values (" << ld.set_values.size() << "):\n";
|
||||
{
|
||||
size_t idx = 0;
|
||||
for (auto it = ld.set_values.begin();
|
||||
it != ld.set_values.end() && idx < MAX_ITEMS;
|
||||
++it, ++idx) {
|
||||
os << "\r\x1B[K |-- [" << idx << "] " << *it << "\n";
|
||||
}
|
||||
if (ld.set_values.size() > MAX_ITEMS) {
|
||||
os << "\r\x1B[K |.. (+" << (ld.set_values.size() - MAX_ITEMS) << " more)\n";
|
||||
}
|
||||
}
|
||||
|
||||
// --- 监测点 · 定值描述文件(dz_info_list) ---
|
||||
os << "\r\x1B[K |-- DZ Table (" << ld.dz_info_list.size() << "):\n";
|
||||
{
|
||||
const size_t n = ld.dz_info_list.size();
|
||||
for (size_t j = 0; j < n && j < MAX_ITEMS; ++j) {
|
||||
const DZ_TAB_STRUCT& z = ld.dz_info_list[j];
|
||||
os << "\r\x1B[K |-- [" << j << "] "
|
||||
<< "LN=" << z.LN_Num
|
||||
<< ", DZ=" << z.DZ_Num
|
||||
<< ", Name=" << trim_cstr(z.DZ_Name, sizeof(z.DZ_Name))
|
||||
<< ", Type=" << z.DZ_Type
|
||||
<< ", Min=" << z.DZ_Min
|
||||
<< ", Max=" << z.DZ_Max
|
||||
<< ", Def=" << z.DZ_Default
|
||||
<< ", Unit=" << trim_cstr(z.DZ_UNIT, sizeof(z.DZ_UNIT))
|
||||
<< "\n";
|
||||
}
|
||||
if (n > MAX_ITEMS) {
|
||||
os << "\r\x1B[K |.. (+" << (n - MAX_ITEMS) << " more)\n";
|
||||
}
|
||||
}
|
||||
|
||||
// --- 监测点 · 暂态事件(qvvrevent) ---
|
||||
os << "\r\x1B[K |-- QVVR Event:\n";
|
||||
|
||||
// 1) 暂态事件列表
|
||||
os << "\r\x1B[K |-- Events (" << ld.qvvrevent.qvvrdata.size() << "):\n";
|
||||
{
|
||||
const size_t n = ld.qvvrevent.qvvrdata.size();
|
||||
for (size_t k = 0; k < n && k < MAX_ITEMS; ++k) {
|
||||
const qvvr_data& e = ld.qvvrevent.qvvrdata[k];
|
||||
os << "\r\x1B[K |-- [" << k << "] "
|
||||
<< "used=" << e.used_status
|
||||
<< ", type=" << e.QVVR_type
|
||||
<< ", time=" << static_cast<unsigned long long>(e.QVVR_time)
|
||||
<< ", per=" << e.QVVR_PerTime
|
||||
<< ", amp=" << e.QVVR_Amg
|
||||
<< ", phase="<< e.phase
|
||||
<< "\n";
|
||||
}
|
||||
if (n > MAX_ITEMS) {
|
||||
os << "\r\x1B[K |.. (+" << (n - MAX_ITEMS) << " more)\n";
|
||||
}
|
||||
}
|
||||
|
||||
// 2) 文件组列表
|
||||
os << "\r\x1B[K |-- File Groups (" << ld.qvvrevent.qvvrfile.size() << "):\n";
|
||||
{
|
||||
const size_t n = ld.qvvrevent.qvvrfile.size();
|
||||
for (size_t g = 0; g < n && g < MAX_ITEMS; ++g) {
|
||||
const qvvr_file& fg = ld.qvvrevent.qvvrfile[g];
|
||||
os << "\r\x1B[K |-- [" << g << "] "
|
||||
<< "used=" << fg.used_status
|
||||
<< ", tcount=" << fg.file_time_count
|
||||
<< ", downloaded=" << fg.is_download
|
||||
<< ", paired=" << fg.is_pair
|
||||
<< "\n";
|
||||
|
||||
// 文件名列表(file_name)
|
||||
os << "\r\x1B[K |-- file_name (" << fg.file_name.size() << "):\n";
|
||||
{
|
||||
size_t c = 0;
|
||||
for (const auto& fn : fg.file_name) {
|
||||
if (c++ >= MAX_ITEMS) break;
|
||||
os << "\r\x1B[K |-- " << fn << "\n";
|
||||
}
|
||||
if (fg.file_name.size() > MAX_ITEMS) {
|
||||
os << "\r\x1B[K |.. (+" << (fg.file_name.size() - MAX_ITEMS) << " more)\n";
|
||||
}
|
||||
}
|
||||
|
||||
// 已下载列表(file_download)
|
||||
os << "\r\x1B[K |-- file_download (" << fg.file_download.size() << "):\n";
|
||||
{
|
||||
size_t c = 0;
|
||||
for (const auto& fn : fg.file_download) {
|
||||
if (c++ >= MAX_ITEMS) break;
|
||||
os << "\r\x1B[K |-- " << fn << "\n";
|
||||
}
|
||||
if (fg.file_download.size() > MAX_ITEMS) {
|
||||
os << "\r\x1B[K |.. (+" << (fg.file_download.size() - MAX_ITEMS) << " more)\n";
|
||||
}
|
||||
}
|
||||
}
|
||||
if (n > MAX_ITEMS) {
|
||||
os << "\r\x1B[K |.. (+" << (n - MAX_ITEMS) << " more)\n";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
os << "\r\x1B[K------------------------------------\n";
|
||||
sendStr(fd, os.str());
|
||||
}
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////////////////打印所有的终端列表
|
||||
|
||||
void Worker::ledger(const std::string& terminal_id, int fd) {
|
||||
sendStr(fd, "\r\x1B[Kprint ledger in shell\n");
|
||||
@@ -547,12 +707,54 @@ void Worker::handleViewLogCommand(const std::string& command, int clientFD) {
|
||||
|
||||
stopViewLog = false;
|
||||
showinshellflag = true;
|
||||
sendStr(clientFD, "\r\x1B[KViewing logs for level: " + level + " (Press '`' to exit)\r\n> ");
|
||||
sendStr(clientFD, std::string("\r\x1B[KViewing logs for level: ") + level + " (Press '`' to exit)\r\n> ");
|
||||
|
||||
char inputBuf[16];
|
||||
|
||||
// --- 新增 begin: 目录创建 + 唯一文件名生成 + 打开文件 ---
|
||||
// 递归创建目录的小工具(最小实现,按‘/’逐级创建)
|
||||
auto ensure_dir = [](const std::string& path) -> bool {
|
||||
if (path.empty()) return false;
|
||||
std::string cur;
|
||||
cur.reserve(path.size());
|
||||
for (size_t i = 0; i < path.size(); ++i) {
|
||||
cur.push_back(path[i]);
|
||||
if (path[i] == '/' && cur.size() > 1) {
|
||||
if (::access(cur.c_str(), F_OK) != 0) {
|
||||
if (::mkdir(cur.c_str(), 0755) != 0 && errno != EEXIST) return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
// 末级(若不以 / 结尾)
|
||||
if (cur.back() != '/') {
|
||||
if (::access(cur.c_str(), F_OK) != 0) {
|
||||
if (::mkdir(cur.c_str(), 0755) != 0 && errno != EEXIST) return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
};
|
||||
|
||||
const std::string logDir = "/FeProject/dat/log";
|
||||
if (!ensure_dir(logDir)) {
|
||||
sendStr(clientFD, "\r\x1B[KFailed to create log directory: /FeProject/dat/log\r\n> ");
|
||||
return;
|
||||
}
|
||||
|
||||
std::string filePath = logDir + "/temp.log";
|
||||
int index = 1;
|
||||
while (::access(filePath.c_str(), F_OK) == 0) {
|
||||
filePath = logDir + "/temp_" + std::to_string(index++) + ".log";
|
||||
}
|
||||
|
||||
std::ofstream logFile(filePath.c_str(), std::ios::out | std::ios::trunc);
|
||||
if (!logFile.is_open()) {
|
||||
sendStr(clientFD, "\r\x1B[KFailed to open log file for writing.\r\n> ");
|
||||
return;
|
||||
}
|
||||
// --- 新增 end ---
|
||||
|
||||
while (!stopViewLog) {
|
||||
// 1. 监听 shell 输入退出符号 `
|
||||
// 1) 监听 shell 输入退出符号 `
|
||||
fd_set read_fds;
|
||||
FD_ZERO(&read_fds);
|
||||
FD_SET(clientFD, &read_fds);
|
||||
@@ -564,31 +766,47 @@ void Worker::handleViewLogCommand(const std::string& command, int clientFD) {
|
||||
int activity = select(clientFD + 1, &read_fds, nullptr, nullptr, &timeout);
|
||||
if (activity > 0 && FD_ISSET(clientFD, &read_fds)) {
|
||||
int n = recv(clientFD, inputBuf, sizeof(inputBuf), 0);
|
||||
if (n > 0 && strchr(inputBuf, '`')) {
|
||||
if (n > 0 && std::memchr(inputBuf, '`', static_cast<size_t>(n))) {
|
||||
stopViewLog = true;
|
||||
showinshellflag = false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// 2. 输出日志
|
||||
std::string logEntry;
|
||||
// --- 修改 begin: 批量获取日志(swap 全取,减少加锁时间) ---
|
||||
std::list<std::string> tempLogs;
|
||||
{
|
||||
std::lock_guard<std::mutex> lock(*logMutex);
|
||||
if (!logList->empty()) {
|
||||
logEntry = logList->front();
|
||||
logList->pop_front();
|
||||
tempLogs.swap(*logList); // 把 logList 中的内容全取出
|
||||
}
|
||||
}
|
||||
// --- 修改 end ---
|
||||
|
||||
if (!logEntry.empty()) {
|
||||
sendStr(clientFD, "\r\x1B[K" + logEntry + "\r\n");
|
||||
if (!tempLogs.empty()) {
|
||||
for (const auto& logEntry : tempLogs) {
|
||||
if (!logEntry.empty()) {
|
||||
sendStr(clientFD, std::string("\r\x1B[K") + logEntry + "\r\n");
|
||||
|
||||
// --- 新增 begin: 写入文件 + 及时落盘 ---
|
||||
logFile << logEntry << '\n';
|
||||
// --- 新增 end ---
|
||||
}
|
||||
}
|
||||
// --- 新增 begin: 刷新文件缓冲,保证实时可见 ---
|
||||
logFile.flush();
|
||||
// --- 新增 end ---
|
||||
} else {
|
||||
std::this_thread::sleep_for(std::chrono::milliseconds(500));
|
||||
}
|
||||
}
|
||||
|
||||
// 3. 打印退出提示
|
||||
// 3) 打印退出提示
|
||||
sendStr(clientFD, "\r\x1B[K\nLog view stopped. Returning to shell.\r\n> ");
|
||||
|
||||
// --- 新增 begin: 关闭文件 ---
|
||||
logFile.close();
|
||||
// --- 新增 end ---
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -2,18 +2,21 @@
|
||||
BrokerList=
|
||||
|
||||
RTDataTopic=Real_Time_Data_Topic
|
||||
HisTopic=LN_Topic
|
||||
PSTTopic=LN_Topic
|
||||
PLTTopic=LN_Topic
|
||||
HisTopic=njcnAppAutoDataTopic
|
||||
PSTTopic=njcnAppAutoDataTopic
|
||||
PLTTopic=njcnAppAutoDataTopic
|
||||
AlmTopic=AlmTopic
|
||||
SngTopic=SngTopic
|
||||
|
||||
QUEUE_TAG=Test_Tag
|
||||
QUEUE_KEY=Test_Keys
|
||||
QUEUE_TAG=stat
|
||||
QUEUE_KEY=stat
|
||||
|
||||
RT_TAG=rt
|
||||
RT_KEY=rt
|
||||
|
||||
[Flag]
|
||||
FrontInst=22de160455a30cc2154890e5502d6433
|
||||
FrontIP=192.168.1.67
|
||||
FrontInst=914b94563ca7f272c90ee8580ed6adc6
|
||||
FrontIP=192.168.1.138
|
||||
|
||||
[Ledger]
|
||||
TerminalStatus="[0]"
|
||||
@@ -22,35 +25,34 @@ IcdFlag=0
|
||||
IedCount=300
|
||||
|
||||
[Http]
|
||||
WebDevice=http://192.168.1.67:10202/nodeDevice/nodeDeviceList
|
||||
WebIcd=http://192.168.1.67:10202/icd/icdPathList
|
||||
WebEvent=http://192.168.1.67:10203/event/addEventDetail
|
||||
WebFileupload=http://192.168.1.67:10207/file/upload
|
||||
WebFiledownload=http://192.168.1.67:10207/file/download
|
||||
WebDevice=http://192.168.1.103:10220/icd/getLedgerInfo
|
||||
WebEvent=http://192.168.1.103:10222/event/addCldEvent
|
||||
WebFileupload=http://192.168.1.103:10207/file/upload
|
||||
WebFiledownload=
|
||||
|
||||
|
||||
[RocketMq]
|
||||
producer=Group_producer
|
||||
Ipport=192.168.1.24:9876
|
||||
AccessKey=rmquser
|
||||
SecretKey=001njcnmq
|
||||
Ipport=192.168.1.103:9876
|
||||
AccessKey=rmqroot
|
||||
SecretKey=001@#njcnmq
|
||||
|
||||
Topic_Test=LN_Topic
|
||||
Topic_Test=lnk_Topic
|
||||
Tag_Test=Test_Tag
|
||||
Key_Test=Test_Keys
|
||||
Testflag=1
|
||||
Testnum=400
|
||||
Testtype=1
|
||||
Testnum=0
|
||||
Testtype=0
|
||||
TestPort=11000
|
||||
TestList=8ad28e2e36dfbd19906f9e2a4894b375
|
||||
TestList=
|
||||
|
||||
consumer=Group_consumer
|
||||
ConsumerIpport=192.168.1.24:9876
|
||||
ConsumerIpport=192.168.1.103:9876
|
||||
ConsumerTopicRT=ask_real_data_topic
|
||||
ConsumerTagRT=Test_Tag
|
||||
ConsumerKeyRT=Test_Keys
|
||||
ConsumerAccessKey=rmquser
|
||||
ConsumerSecretKey=001njcnmq
|
||||
ConsumerAccessKey=rmqroot
|
||||
ConsumerSecretKey=001@#njcnmq
|
||||
ConsumerChannel=
|
||||
ConsumerTopicUD=control_Topic
|
||||
ConsumerTagUD=Test_Tag
|
||||
|
||||
80
LFtid1056/config/front.cfg
Normal file
80
LFtid1056/config/front.cfg
Normal file
@@ -0,0 +1,80 @@
|
||||
[Queue]
|
||||
BrokerList=
|
||||
|
||||
RTDataTopic=Real_Time_Data_Topic
|
||||
HisTopic=njcnAppAutoDataTopic
|
||||
PSTTopic=njcnAppAutoDataTopic
|
||||
PLTTopic=njcnAppAutoDataTopic
|
||||
AlmTopic=AlmTopic
|
||||
SngTopic=SngTopic
|
||||
|
||||
QUEUE_TAG=stat
|
||||
QUEUE_KEY=stat
|
||||
|
||||
RT_TAG=rt
|
||||
RT_KEY=rt
|
||||
|
||||
[Flag]
|
||||
FrontInst=914b94563ca7f272c90ee8580ed6adc6
|
||||
FrontIP=192.168.1.138
|
||||
|
||||
[Ledger]
|
||||
TerminalStatus="[0]"
|
||||
MonitorStatus="[1,2]"
|
||||
IcdFlag=0
|
||||
IedCount=300
|
||||
|
||||
[Http]
|
||||
WebDevice=http://192.168.1.103:10220/icd/getLedgerInfo
|
||||
WebEvent=http://192.168.1.103:10222/event/addCldEvent
|
||||
WebFileupload=http://192.168.1.103:10207/file/upload
|
||||
WebFiledownload=
|
||||
|
||||
|
||||
[RocketMq]
|
||||
producer=Group_producer
|
||||
Ipport=192.168.1.103:9876
|
||||
AccessKey=rmqroot
|
||||
SecretKey=001@#njcnmq
|
||||
|
||||
Topic_Test=lnk_Topic
|
||||
Tag_Test=Test_Tag
|
||||
Key_Test=Test_Keys
|
||||
Testflag=1
|
||||
Testnum=0
|
||||
Testtype=0
|
||||
TestPort=11000
|
||||
TestList=
|
||||
|
||||
consumer=Group_consumer
|
||||
ConsumerIpport=192.168.1.103:9876
|
||||
ConsumerTopicRT=ask_real_data_topic
|
||||
ConsumerTagRT=Test_Tag
|
||||
ConsumerKeyRT=Test_Keys
|
||||
ConsumerAccessKey=rmqroot
|
||||
ConsumerSecretKey=001@#njcnmq
|
||||
ConsumerChannel=
|
||||
ConsumerTopicUD=control_Topic
|
||||
ConsumerTagUD=Test_Tag
|
||||
ConsumerKeyUD=Test_Keys
|
||||
ConsumerTopicRC=recall_Topic
|
||||
ConsumerTagRC=Test_Tag
|
||||
ConsumerKeyRC=Test_Keys
|
||||
ConsumerTopicSET=process_Topic
|
||||
ConsumerTagSET=Test_Tag
|
||||
ConsumerKeySET=Test_Keys
|
||||
ConsumerTopicLOG=ask_log_Topic
|
||||
ConsumerTagLOG=Test_Tag
|
||||
ConsumerKeyLOG=Test_Keys
|
||||
LOGTopic=log_Topic
|
||||
LOGTag=Test_Tag
|
||||
LOGKey=Test_Keys
|
||||
CONNECTTopic=Device_Run_Flag_Topic
|
||||
CONNECTTag=Test_Tag
|
||||
CONNECTKey=Test_Keys
|
||||
Heart_Beat_Topic=Heart_Beat_Topic
|
||||
Heart_Beat_Tag=Test_Tag
|
||||
Heart_Beat_Key=Test_Key
|
||||
Topic_Reply_Topic=Topic_Reply_Topic
|
||||
Topic_Reply_Tag=Test_Tag
|
||||
Topic_Reply_Key=Test_Key
|
||||
1
LFtid1056/dat/095a84f23ec7e283a9ffe8e182708f04.xml
Normal file
1
LFtid1056/dat/095a84f23ec7e283a9ffe8e182708f04.xml
Normal file
@@ -0,0 +1 @@
|
||||
{"code":"A00555","message":"下载文件,文件服务器下载文件流为空","data":null}
|
||||
1
LFtid1056/dat/0b53c730f88d4b69a73f239475fc3876.xml
Normal file
1
LFtid1056/dat/0b53c730f88d4b69a73f239475fc3876.xml
Normal file
@@ -0,0 +1 @@
|
||||
{"code":"A00555","message":"下载文件,文件服务器下载文件流为空","data":null}
|
||||
1
LFtid1056/dat/0c6e1be36f19fb4d809836ed96f7796f.xml
Normal file
1
LFtid1056/dat/0c6e1be36f19fb4d809836ed96f7796f.xml
Normal file
@@ -0,0 +1 @@
|
||||
{"code":"A00555","message":"下载文件,文件服务器下载文件流为空","data":null}
|
||||
1
LFtid1056/dat/0fc2e86ded1ed4cbbda8830acd331314.xml
Normal file
1
LFtid1056/dat/0fc2e86ded1ed4cbbda8830acd331314.xml
Normal file
@@ -0,0 +1 @@
|
||||
{"code":"A00555","message":"下载文件,文件服务器下载文件流为空","data":null}
|
||||
1
LFtid1056/dat/112e261cb8e804600104ffebfd9cbefd.xml
Normal file
1
LFtid1056/dat/112e261cb8e804600104ffebfd9cbefd.xml
Normal file
@@ -0,0 +1 @@
|
||||
{"code":"A00555","message":"下载文件,文件服务器下载文件流为空","data":null}
|
||||
1
LFtid1056/dat/134e25eb59a22cc8394ff3bc1dde554c.xml
Normal file
1
LFtid1056/dat/134e25eb59a22cc8394ff3bc1dde554c.xml
Normal file
@@ -0,0 +1 @@
|
||||
{"code":"A00555","message":"下载文件,文件服务器下载文件流为空","data":null}
|
||||
1
LFtid1056/dat/148f24a2664fa054ede4f686fd984292.xml
Normal file
1
LFtid1056/dat/148f24a2664fa054ede4f686fd984292.xml
Normal file
@@ -0,0 +1 @@
|
||||
{"code":"A00555","message":"下载文件,文件服务器下载文件流为空","data":null}
|
||||
1
LFtid1056/dat/14e2078291f3a2f800480a6ca699fbcd.xml
Normal file
1
LFtid1056/dat/14e2078291f3a2f800480a6ca699fbcd.xml
Normal file
@@ -0,0 +1 @@
|
||||
{"code":"A00555","message":"下载文件,文件服务器下载文件流为空","data":null}
|
||||
1
LFtid1056/dat/1654a86f7cb25a322573bbf3571b1765.xml
Normal file
1
LFtid1056/dat/1654a86f7cb25a322573bbf3571b1765.xml
Normal file
@@ -0,0 +1 @@
|
||||
{"code":"A00555","message":"下载文件,文件服务器下载文件流为空","data":null}
|
||||
1
LFtid1056/dat/180735bfe2c59f4d8e1d85bd2a1984ef.xml
Normal file
1
LFtid1056/dat/180735bfe2c59f4d8e1d85bd2a1984ef.xml
Normal file
@@ -0,0 +1 @@
|
||||
{"code":"A00555","message":"下载文件,文件服务器下载文件流为空","data":null}
|
||||
1
LFtid1056/dat/1f2c42ee0e8d689005b3f58967054e5c.xml
Normal file
1
LFtid1056/dat/1f2c42ee0e8d689005b3f58967054e5c.xml
Normal file
@@ -0,0 +1 @@
|
||||
{"code":"A00555","message":"下载文件,文件服务器下载文件流为空","data":null}
|
||||
1
LFtid1056/dat/1ff4038a4574dbc52ccf005bef20041b.xml
Normal file
1
LFtid1056/dat/1ff4038a4574dbc52ccf005bef20041b.xml
Normal file
@@ -0,0 +1 @@
|
||||
{"code":"A00555","message":"下载文件,文件服务器下载文件流为空","data":null}
|
||||
1
LFtid1056/dat/2bd3d80c86e078d77f8482e48c3b3f99.xml
Normal file
1
LFtid1056/dat/2bd3d80c86e078d77f8482e48c3b3f99.xml
Normal file
@@ -0,0 +1 @@
|
||||
{"code":"A00555","message":"下载文件,文件服务器下载文件流为空","data":null}
|
||||
1
LFtid1056/dat/35d62f0ad688a14583290a0ba0fc2b42.xml
Normal file
1
LFtid1056/dat/35d62f0ad688a14583290a0ba0fc2b42.xml
Normal file
@@ -0,0 +1 @@
|
||||
{"code":"A00555","message":"下载文件,文件服务器下载文件流为空","data":null}
|
||||
1
LFtid1056/dat/38c2ec0e305b07c04674ddbb4c972a2a.xml
Normal file
1
LFtid1056/dat/38c2ec0e305b07c04674ddbb4c972a2a.xml
Normal file
@@ -0,0 +1 @@
|
||||
{"code":"A00555","message":"下载文件,文件服务器下载文件流为空","data":null}
|
||||
1
LFtid1056/dat/393c172bcd297f8cd68a41f202f78b2f.xml
Normal file
1
LFtid1056/dat/393c172bcd297f8cd68a41f202f78b2f.xml
Normal file
@@ -0,0 +1 @@
|
||||
{"code":"A00555","message":"下载文件,文件服务器下载文件流为空","data":null}
|
||||
1
LFtid1056/dat/3ef998435d692c62f58a8dc26dec99cc.xml
Normal file
1
LFtid1056/dat/3ef998435d692c62f58a8dc26dec99cc.xml
Normal file
@@ -0,0 +1 @@
|
||||
{"code":"A00555","message":"下载文件,文件服务器下载文件流为空","data":null}
|
||||
1
LFtid1056/dat/49dd3d79e7cdd27597ba2526858c372e.xml
Normal file
1
LFtid1056/dat/49dd3d79e7cdd27597ba2526858c372e.xml
Normal file
@@ -0,0 +1 @@
|
||||
{"code":"A00555","message":"下载文件,文件服务器下载文件流为空","data":null}
|
||||
1
LFtid1056/dat/4b1e55fba360f30a5e91bcf6fae63d82.xml
Normal file
1
LFtid1056/dat/4b1e55fba360f30a5e91bcf6fae63d82.xml
Normal file
@@ -0,0 +1 @@
|
||||
{"code":"A00555","message":"下载文件,文件服务器下载文件流为空","data":null}
|
||||
1
LFtid1056/dat/4fd8f3fb39c8333e525aad2cfed8d4ba.xml
Normal file
1
LFtid1056/dat/4fd8f3fb39c8333e525aad2cfed8d4ba.xml
Normal file
@@ -0,0 +1 @@
|
||||
{"code":"A00555","message":"下载文件,文件服务器下载文件流为空","data":null}
|
||||
1
LFtid1056/dat/52f48442032e85d8257b9e6e409ae727.xml
Normal file
1
LFtid1056/dat/52f48442032e85d8257b9e6e409ae727.xml
Normal file
@@ -0,0 +1 @@
|
||||
{"code":"A00555","message":"下载文件,文件服务器下载文件流为空","data":null}
|
||||
1
LFtid1056/dat/5c26d1a34a996a64645334cf36fc65cd.xml
Normal file
1
LFtid1056/dat/5c26d1a34a996a64645334cf36fc65cd.xml
Normal file
@@ -0,0 +1 @@
|
||||
{"code":"A00555","message":"下载文件,文件服务器下载文件流为空","data":null}
|
||||
1
LFtid1056/dat/5d623f8d16d2f66473c4ae04661fc995.xml
Normal file
1
LFtid1056/dat/5d623f8d16d2f66473c4ae04661fc995.xml
Normal file
@@ -0,0 +1 @@
|
||||
{"code":"A00555","message":"下载文件,文件服务器下载文件流为空","data":null}
|
||||
1
LFtid1056/dat/5ff7ad05e7bcd2cc2f540b5e06849776.xml
Normal file
1
LFtid1056/dat/5ff7ad05e7bcd2cc2f540b5e06849776.xml
Normal file
@@ -0,0 +1 @@
|
||||
{"code":"A00555","message":"下载文件,文件服务器下载文件流为空","data":null}
|
||||
1
LFtid1056/dat/62f1441d04b665b1b598974b411d45eb.xml
Normal file
1
LFtid1056/dat/62f1441d04b665b1b598974b411d45eb.xml
Normal file
@@ -0,0 +1 @@
|
||||
{"code":"A00555","message":"下载文件,文件服务器下载文件流为空","data":null}
|
||||
1
LFtid1056/dat/63a5b90766f86a484c84f22c9ce29e44.xml
Normal file
1
LFtid1056/dat/63a5b90766f86a484c84f22c9ce29e44.xml
Normal file
@@ -0,0 +1 @@
|
||||
{"code":"A00555","message":"下载文件,文件服务器下载文件流为空","data":null}
|
||||
1
LFtid1056/dat/63cb5f7437e1922be7f0b606b12679ce.xml
Normal file
1
LFtid1056/dat/63cb5f7437e1922be7f0b606b12679ce.xml
Normal file
@@ -0,0 +1 @@
|
||||
{"code":"A00555","message":"下载文件,文件服务器下载文件流为空","data":null}
|
||||
1
LFtid1056/dat/643f3997e9c31173d8c93cc38c1d5129.xml
Normal file
1
LFtid1056/dat/643f3997e9c31173d8c93cc38c1d5129.xml
Normal file
@@ -0,0 +1 @@
|
||||
{"code":"A00555","message":"下载文件,文件服务器下载文件流为空","data":null}
|
||||
1
LFtid1056/dat/64992cafdb7bf7e94b0ae3556c6dd2b3.xml
Normal file
1
LFtid1056/dat/64992cafdb7bf7e94b0ae3556c6dd2b3.xml
Normal file
@@ -0,0 +1 @@
|
||||
{"code":"A00555","message":"下载文件,文件服务器下载文件流为空","data":null}
|
||||
1
LFtid1056/dat/669466052823ae6ce09cd6bc575176be.xml
Normal file
1
LFtid1056/dat/669466052823ae6ce09cd6bc575176be.xml
Normal file
@@ -0,0 +1 @@
|
||||
{"code":"A00555","message":"下载文件,文件服务器下载文件流为空","data":null}
|
||||
1
LFtid1056/dat/66aac8de119b48126ae0fa3fd28b8499.xml
Normal file
1
LFtid1056/dat/66aac8de119b48126ae0fa3fd28b8499.xml
Normal file
@@ -0,0 +1 @@
|
||||
{"code":"A00555","message":"下载文件,文件服务器下载文件流为空","data":null}
|
||||
1
LFtid1056/dat/68d618ae6a52e34483c90bb7642ef353.xml
Normal file
1
LFtid1056/dat/68d618ae6a52e34483c90bb7642ef353.xml
Normal file
@@ -0,0 +1 @@
|
||||
{"code":"A00555","message":"下载文件,文件服务器下载文件流为空","data":null}
|
||||
1
LFtid1056/dat/69d6bebce232d3949d9f1d75c66d90c4.xml
Normal file
1
LFtid1056/dat/69d6bebce232d3949d9f1d75c66d90c4.xml
Normal file
@@ -0,0 +1 @@
|
||||
{"code":"A00555","message":"下载文件,文件服务器下载文件流为空","data":null}
|
||||
1
LFtid1056/dat/6a9b0cae90ca3ea6b750f1117e93816b.xml
Normal file
1
LFtid1056/dat/6a9b0cae90ca3ea6b750f1117e93816b.xml
Normal file
@@ -0,0 +1 @@
|
||||
{"code":"A00555","message":"下载文件,文件服务器下载文件流为空","data":null}
|
||||
1
LFtid1056/dat/6cd6498c079396e9d42d6764bdad21ab.xml
Normal file
1
LFtid1056/dat/6cd6498c079396e9d42d6764bdad21ab.xml
Normal file
@@ -0,0 +1 @@
|
||||
{"code":"A00555","message":"下载文件,文件服务器下载文件流为空","data":null}
|
||||
1
LFtid1056/dat/74a0fe58192a690f2037dab8bcff5e25.xml
Normal file
1
LFtid1056/dat/74a0fe58192a690f2037dab8bcff5e25.xml
Normal file
@@ -0,0 +1 @@
|
||||
{"code":"A00555","message":"下载文件,文件服务器下载文件流为空","data":null}
|
||||
1
LFtid1056/dat/7677814fc1e2bc194ca2d82a62f3dd1d.xml
Normal file
1
LFtid1056/dat/7677814fc1e2bc194ca2d82a62f3dd1d.xml
Normal file
@@ -0,0 +1 @@
|
||||
{"code":"A00555","message":"下载文件,文件服务器下载文件流为空","data":null}
|
||||
1
LFtid1056/dat/7a0fb4cc2013497797dc46d50526d1b1.xml
Normal file
1
LFtid1056/dat/7a0fb4cc2013497797dc46d50526d1b1.xml
Normal file
@@ -0,0 +1 @@
|
||||
{"code":"A00555","message":"下载文件,文件服务器下载文件流为空","data":null}
|
||||
1
LFtid1056/dat/7be60bf2c9265b2f91ff11a21c62edbb.xml
Normal file
1
LFtid1056/dat/7be60bf2c9265b2f91ff11a21c62edbb.xml
Normal file
@@ -0,0 +1 @@
|
||||
{"code":"A00555","message":"下载文件,文件服务器下载文件流为空","data":null}
|
||||
1
LFtid1056/dat/824cf5433d2d8c82eaf816a28f9a232d.xml
Normal file
1
LFtid1056/dat/824cf5433d2d8c82eaf816a28f9a232d.xml
Normal file
@@ -0,0 +1 @@
|
||||
{"code":"A00555","message":"下载文件,文件服务器下载文件流为空","data":null}
|
||||
1
LFtid1056/dat/82c0ffe9b6a6e54ff6768aa4b151759d.xml
Normal file
1
LFtid1056/dat/82c0ffe9b6a6e54ff6768aa4b151759d.xml
Normal file
@@ -0,0 +1 @@
|
||||
{"code":"A00555","message":"下载文件,文件服务器下载文件流为空","data":null}
|
||||
1
LFtid1056/dat/895f951309513397852cafbe846c9298.xml
Normal file
1
LFtid1056/dat/895f951309513397852cafbe846c9298.xml
Normal file
@@ -0,0 +1 @@
|
||||
{"code":"A00555","message":"下载文件,文件服务器下载文件流为空","data":null}
|
||||
1
LFtid1056/dat/8c84b8c0ae99b17afa0c79c0e2e848e3.xml
Normal file
1
LFtid1056/dat/8c84b8c0ae99b17afa0c79c0e2e848e3.xml
Normal file
@@ -0,0 +1 @@
|
||||
{"code":"A00555","message":"下载文件,文件服务器下载文件流为空","data":null}
|
||||
1
LFtid1056/dat/8dd12600976ac6c95e18c5980400eee3.xml
Normal file
1
LFtid1056/dat/8dd12600976ac6c95e18c5980400eee3.xml
Normal file
@@ -0,0 +1 @@
|
||||
{"code":"A00555","message":"下载文件,文件服务器下载文件流为空","data":null}
|
||||
1
LFtid1056/dat/8e051a07f6fc2ff03487bc87cb3e4d91.xml
Normal file
1
LFtid1056/dat/8e051a07f6fc2ff03487bc87cb3e4d91.xml
Normal file
@@ -0,0 +1 @@
|
||||
{"code":"A00555","message":"下载文件,文件服务器下载文件流为空","data":null}
|
||||
1
LFtid1056/dat/942b70650cb8d099401c01446d3c08de.xml
Normal file
1
LFtid1056/dat/942b70650cb8d099401c01446d3c08de.xml
Normal file
@@ -0,0 +1 @@
|
||||
{"code":"A00555","message":"下载文件,文件服务器下载文件流为空","data":null}
|
||||
1
LFtid1056/dat/950c2c11da36897552766fd7a02af6d5.xml
Normal file
1
LFtid1056/dat/950c2c11da36897552766fd7a02af6d5.xml
Normal file
@@ -0,0 +1 @@
|
||||
{"code":"A00555","message":"下载文件,文件服务器下载文件流为空","data":null}
|
||||
1
LFtid1056/dat/9667fe63920c038605911d88b0f9e9a2.xml
Normal file
1
LFtid1056/dat/9667fe63920c038605911d88b0f9e9a2.xml
Normal file
@@ -0,0 +1 @@
|
||||
{"code":"A00555","message":"下载文件,文件服务器下载文件流为空","data":null}
|
||||
1
LFtid1056/dat/a25d58d7780a51de20223c7ffffa3219.xml
Normal file
1
LFtid1056/dat/a25d58d7780a51de20223c7ffffa3219.xml
Normal file
@@ -0,0 +1 @@
|
||||
{"code":"A00555","message":"下载文件,文件服务器下载文件流为空","data":null}
|
||||
1
LFtid1056/dat/ab5204b5e2222712f70233741ff7bfb0.xml
Normal file
1
LFtid1056/dat/ab5204b5e2222712f70233741ff7bfb0.xml
Normal file
@@ -0,0 +1 @@
|
||||
{"code":"A00555","message":"下载文件,文件服务器下载文件流为空","data":null}
|
||||
1
LFtid1056/dat/b3f054b07c0cd6eae366c3f7c0178dc8.xml
Normal file
1
LFtid1056/dat/b3f054b07c0cd6eae366c3f7c0178dc8.xml
Normal file
@@ -0,0 +1 @@
|
||||
{"code":"A00555","message":"下载文件,文件服务器下载文件流为空","data":null}
|
||||
1
LFtid1056/dat/b59349bf7d426611102acd7ef65f8861.xml
Normal file
1
LFtid1056/dat/b59349bf7d426611102acd7ef65f8861.xml
Normal file
@@ -0,0 +1 @@
|
||||
{"code":"A00555","message":"下载文件,文件服务器下载文件流为空","data":null}
|
||||
1
LFtid1056/dat/ba674fe68e95b86478683610ad7790df.xml
Normal file
1
LFtid1056/dat/ba674fe68e95b86478683610ad7790df.xml
Normal file
@@ -0,0 +1 @@
|
||||
{"code":"A00555","message":"下载文件,文件服务器下载文件流为空","data":null}
|
||||
1
LFtid1056/dat/c1c0d4bbf50a11e76c378ce5ac116f5f.xml
Normal file
1
LFtid1056/dat/c1c0d4bbf50a11e76c378ce5ac116f5f.xml
Normal file
@@ -0,0 +1 @@
|
||||
{"code":"A00555","message":"下载文件,文件服务器下载文件流为空","data":null}
|
||||
1
LFtid1056/dat/c6ec71e6dcd9e9c2aae7eb5eddd59099.xml
Normal file
1
LFtid1056/dat/c6ec71e6dcd9e9c2aae7eb5eddd59099.xml
Normal file
@@ -0,0 +1 @@
|
||||
{"code":"A00555","message":"下载文件,文件服务器下载文件流为空","data":null}
|
||||
1
LFtid1056/dat/c8a4b43c08da8a44b3d08ee730dc5d56.xml
Normal file
1
LFtid1056/dat/c8a4b43c08da8a44b3d08ee730dc5d56.xml
Normal file
@@ -0,0 +1 @@
|
||||
{"code":"A00555","message":"下载文件,文件服务器下载文件流为空","data":null}
|
||||
1
LFtid1056/dat/c9a030d97e42865d4fc24b4424e87ad0.xml
Normal file
1
LFtid1056/dat/c9a030d97e42865d4fc24b4424e87ad0.xml
Normal file
@@ -0,0 +1 @@
|
||||
{"code":"A00555","message":"下载文件,文件服务器下载文件流为空","data":null}
|
||||
1
LFtid1056/dat/ca16b843d971cb760168c797e24e81f9.xml
Normal file
1
LFtid1056/dat/ca16b843d971cb760168c797e24e81f9.xml
Normal file
@@ -0,0 +1 @@
|
||||
{"code":"A00555","message":"下载文件,文件服务器下载文件流为空","data":null}
|
||||
1
LFtid1056/dat/ca42aa3651b65244924374397fbffa80.xml
Normal file
1
LFtid1056/dat/ca42aa3651b65244924374397fbffa80.xml
Normal file
@@ -0,0 +1 @@
|
||||
{"code":"A00555","message":"下载文件,文件服务器下载文件流为空","data":null}
|
||||
1
LFtid1056/dat/caf9a220fe671f9e82d282c88edad459.xml
Normal file
1
LFtid1056/dat/caf9a220fe671f9e82d282c88edad459.xml
Normal file
@@ -0,0 +1 @@
|
||||
{"code":"A00555","message":"下载文件,文件服务器下载文件流为空","data":null}
|
||||
1
LFtid1056/dat/cb5275b81d36cf6fc7069fafa121d734.xml
Normal file
1
LFtid1056/dat/cb5275b81d36cf6fc7069fafa121d734.xml
Normal file
@@ -0,0 +1 @@
|
||||
{"code":"A00555","message":"下载文件,文件服务器下载文件流为空","data":null}
|
||||
1
LFtid1056/dat/d2526e08196f7dfdc4ca81c67264c0c1.xml
Normal file
1
LFtid1056/dat/d2526e08196f7dfdc4ca81c67264c0c1.xml
Normal file
@@ -0,0 +1 @@
|
||||
{"code":"A00555","message":"下载文件,文件服务器下载文件流为空","data":null}
|
||||
1
LFtid1056/dat/dab107086ada2504be4f40a158858838.xml
Normal file
1
LFtid1056/dat/dab107086ada2504be4f40a158858838.xml
Normal file
@@ -0,0 +1 @@
|
||||
{"code":"A00555","message":"下载文件,文件服务器下载文件流为空","data":null}
|
||||
1
LFtid1056/dat/dab72e86a7b30990285976169c0dfb3f.xml
Normal file
1
LFtid1056/dat/dab72e86a7b30990285976169c0dfb3f.xml
Normal file
@@ -0,0 +1 @@
|
||||
{"code":"A00555","message":"下载文件,文件服务器下载文件流为空","data":null}
|
||||
1
LFtid1056/dat/dc0a7739bdeb18d6c82b493bcd49d5d3.xml
Normal file
1
LFtid1056/dat/dc0a7739bdeb18d6c82b493bcd49d5d3.xml
Normal file
@@ -0,0 +1 @@
|
||||
{"code":"A00555","message":"下载文件,文件服务器下载文件流为空","data":null}
|
||||
1
LFtid1056/dat/dc9bef9ba55574c5e7d1d3c78afa2c45.xml
Normal file
1
LFtid1056/dat/dc9bef9ba55574c5e7d1d3c78afa2c45.xml
Normal file
@@ -0,0 +1 @@
|
||||
{"code":"A00555","message":"下载文件,文件服务器下载文件流为空","data":null}
|
||||
1
LFtid1056/dat/deba4e29af5efbf756557661ec254ec3.xml
Normal file
1
LFtid1056/dat/deba4e29af5efbf756557661ec254ec3.xml
Normal file
@@ -0,0 +1 @@
|
||||
{"code":"A00555","message":"下载文件,文件服务器下载文件流为空","data":null}
|
||||
1
LFtid1056/dat/e6585f5e6837be74ba04350f133340d9.xml
Normal file
1
LFtid1056/dat/e6585f5e6837be74ba04350f133340d9.xml
Normal file
@@ -0,0 +1 @@
|
||||
{"code":"A00555","message":"下载文件,文件服务器下载文件流为空","data":null}
|
||||
1
LFtid1056/dat/eeaa3bdc02c4e50b48eb92716d5c14db.xml
Normal file
1
LFtid1056/dat/eeaa3bdc02c4e50b48eb92716d5c14db.xml
Normal file
@@ -0,0 +1 @@
|
||||
{"code":"A00555","message":"下载文件,文件服务器下载文件流为空","data":null}
|
||||
1
LFtid1056/dat/f0386b207f416a1bf7948d478087a0fb.xml
Normal file
1
LFtid1056/dat/f0386b207f416a1bf7948d478087a0fb.xml
Normal file
@@ -0,0 +1 @@
|
||||
{"code":"A00555","message":"下载文件,文件服务器下载文件流为空","data":null}
|
||||
1
LFtid1056/dat/fa1050bdce7efd63508e881536157058.xml
Normal file
1
LFtid1056/dat/fa1050bdce7efd63508e881536157058.xml
Normal file
@@ -0,0 +1 @@
|
||||
{"code":"A00555","message":"下载文件,文件服务器下载文件流为空","data":null}
|
||||
1
LFtid1056/dat/fc205e2c998c64fc5afb8ec62b54129a.xml
Normal file
1
LFtid1056/dat/fc205e2c998c64fc5afb8ec62b54129a.xml
Normal file
@@ -0,0 +1 @@
|
||||
{"code":"A00555","message":"下载文件,文件服务器下载文件流为空","data":null}
|
||||
1
LFtid1056/dat/ledger/20250807185343_ledger.txt
Normal file
1
LFtid1056/dat/ledger/20250807185343_ledger.txt
Normal file
@@ -0,0 +1 @@
|
||||
{"code":"A0000","message":"根据前置ip获取对应的终端台账信息,成功","data":[{"id":"175427bfa6ed1de818464e43dd09e04f","ip":"192.168.1.242","devType":"PQS882_B4_MMS(4U4I)","org_name":null,"port":"102","stationName":null,"name":"南昌终端_242","subName":"南昌变电站","updateTime":"2025-08-07 14:58:03","manufacturer":"南京灿能","status":"0","series":"","devKey":"","processNo":2,"maxProcessNum":3,"monitorData":[{"id":"4067998c0327a624b83610879c7de4c6","name":"监测点3","lineNo":"3","voltageLevel":"10kV","ptType":"0","status":"0"},{"id":"74203b186428c1684aa450ad05257b06","name":"监测点1","lineNo":"1","voltageLevel":"10kV","ptType":"0","status":"0"},{"id":"777737a13b16cf860d65d9f71e54f858","name":"监测点4","lineNo":"4","voltageLevel":"10kV","ptType":"0","status":"0"},{"id":"e07c34b721ac9ccd62e03d796a2f7fa8","name":"监测点2","lineNo":"2","voltageLevel":"10kV","ptType":"0","status":"0"}]},{"id":"438a3bc6cb9c04c91d572973b5760d25","ip":"192.168.1.234","devType":"PQS_882B4","org_name":null,"port":"102","stationName":null,"name":"宜春终端_234","subName":"宜春变电站","updateTime":"2025-08-07 14:58:02","manufacturer":"浪拜迪","status":"0","series":"","devKey":"","processNo":1,"maxProcessNum":3,"monitorData":[{"id":"5f99b9ba4e563439ec8490a0c598da8d","name":"监测点1","lineNo":"1","voltageLevel":"110kV","ptType":"0","status":"0"}]},{"id":"8cb7a1abcd70b26716358267ea517a22","ip":"192.168.1.238","devType":"NPQS_682","org_name":null,"port":"102","stationName":null,"name":"赣州终端_238","subName":"赣州变电站","updateTime":"2025-08-07 14:58:03","manufacturer":"浪拜迪","status":"0","series":"","devKey":"","processNo":1,"maxProcessNum":3,"monitorData":[{"id":"1b9cece8b66b100a52c4a31f469e8e0a","name":"监测点1","lineNo":"1","voltageLevel":"220kV","ptType":"0","status":"0"},{"id":"6072c5deecdae5d1b4dd5c475517444b","name":"监测点2","lineNo":"2","voltageLevel":"220kV","ptType":"0","status":"0"}]},{"id":"ad60520f9294864f41ca48b5acee62d6","ip":"192.168.1.229","devType":"PQS882_B4_MMS(4U4I)","org_name":null,"port":"102","stationName":null,"name":"南昌终端_229","subName":"南昌变电站","updateTime":"2025-08-07 11:43:07","manufacturer":"南京灿能","status":"0","series":"","devKey":"","processNo":1,"maxProcessNum":3,"monitorData":[{"id":"683e77d95099a315fb777b16113e34ae","name":"监测点3","lineNo":"3","voltageLevel":"10kV","ptType":"0","status":"0"},{"id":"824ab9440f0c9c279c2fc2080e19d07a","name":"监测点2","lineNo":"2","voltageLevel":"10kV","ptType":"0","status":"0"},{"id":"d446071b8bd8dd493687bae4746c02e5","name":"监测点1","lineNo":"1","voltageLevel":"10kV","ptType":"1","status":"0"},{"id":"fde41900cbaef358c9a9e23960ee2593","name":"监测点4","lineNo":"4","voltageLevel":"10kV","ptType":"0","status":"0"}]},{"id":"e8d14ec6395262c4984f1f8152a9135b","ip":"192.168.1.230","devType":"NPQS_681","org_name":null,"port":"102","stationName":null,"name":"上饶终端","subName":"上饶变电站","updateTime":"2025-08-07 11:43:07","manufacturer":"北京四方","status":"0","series":"5nfaNZS5ukTZ3L4rQiMinA==","devKey":"g/4565/nRBWbqxo7gZ8JZdg4ozz2DutoY/MaCC1PMIw=","processNo":1,"maxProcessNum":3,"monitorData":[{"id":"401a696fe9918bb4cce7d9393d0d5df7","name":"上饶监测点1","lineNo":"1","voltageLevel":"750kV","ptType":"0","status":"0"}]},{"id":"f3a02c4a89e75fe0cc377088fd1cb2f1","ip":"192.168.1.240","devType":"NPQS_882B4","org_name":null,"port":"102","stationName":null,"name":"九江终端_240","subName":"九江变电站","updateTime":"2025-08-07 14:58:03","manufacturer":"浪拜迪","status":"0","series":"","devKey":"","processNo":1,"maxProcessNum":3,"monitorData":[{"id":"cfc481a71953f85a23fd448c3cffc884","name":"监测点1","lineNo":"1","voltageLevel":"35kV","ptType":"0","status":"0"}]}]}
|
||||
File diff suppressed because it is too large
Load Diff
585
LFtid1056/etc/Default_Config.xml
Normal file
585
LFtid1056/etc/Default_Config.xml
Normal file
@@ -0,0 +1,585 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!--注:#7#代表通配符,用于通配数据类型 采用8421码,8-CP95、4-最小值、2-最大值、1-平均值-->
|
||||
<!-- %2,50%代表通配符,用于通配谐波数据,采用范围编码,第一个数字表示谐波起始号,第二个数字谐波结束号-->
|
||||
<!-- SEQ=后面的值采用8421码 8-T、4-C、2-B、1-A-->
|
||||
<!--注:send类型:0-不发送kafka、1-发送kafka-->
|
||||
<!--注:type类型:0-DataType、1-监测点、2-剔除标记、3-发生时刻,毫秒、4-数据链表、5-相位、6-值索引、9-实时SOE事件-->
|
||||
<!--注:nane:参数项、desc:参数描述、type:参数等级、DO:数据对象名、DA:数据属性名、Coefficient:数据系数、Offset:起始序号偏移量、PltFlag:长时闪变标志-->
|
||||
<!--注:角型接线时,相角为0,不再进行DO、DA路径值扩展-->
|
||||
<JSConfigTemplate version="2021-12-15" author="ww" SelectStat="JiangSu" SelectReal="Kafka Producer" desc="昆明长水机场增加谐波类数据配置">
|
||||
<!--注:暂态事件解析规则配置 Flag:0-不分相 1-分相 如果Flag=0 A,B,C配置成一样,如果Flag=1,A,B,C根据实际配置-->
|
||||
<WavePhasic Flag="1" A="QVVR1" B="QVVR2" C="QVVR3" />
|
||||
<!--注:暂态事件持续事件单位:0-毫秒 1-秒-->
|
||||
<UnitOfTime Unit="1" />
|
||||
<!--注:上送值的时间:UTC-UTC时间 beijing-北京时间-->
|
||||
<ValueOfTime Unit="UTC" />
|
||||
<!--注:录波文件的时间:UTC-UTC时间 beijing-北京时间-->
|
||||
<ComtradeFile WaveTimeFlag="beijing" />
|
||||
<IED name="PQMonitor" desc="电能质量监测装置" />
|
||||
<LDevice Prefix="PQM" desc="监测点" />
|
||||
<ReportMap>
|
||||
<!--用于映射需要触发那些报告-->
|
||||
<!--ReportControl:ID,RCBName,intgPd,dchg,qchg,dupd,period,gi,issuffixed,seqNum,timeStamp,reasonCode,dataSet,dataRef,bufOvfl,entryID,configRef,segmentation,FlickerFlag-->
|
||||
<!--600/60秒,即10分钟/1分钟-->
|
||||
<!--0,0,0,1,0为周期触发报告-->
|
||||
<!--1,0,0,0,0为变位触发报告-->
|
||||
<ReportStat>
|
||||
<Report ReportControl="LLN0$BR$brcbFlickerData,60,1,0,0,0,0,yes,1,1,1,1,1,0,1,1,1,3,1" />
|
||||
<Report ReportControl="LLN0$BR$brcbStatisticData,60,1,0,0,0,0,yes,1,1,1,1,1,0,1,1,1,1,0" />
|
||||
</ReportStat>
|
||||
<ReportReal>
|
||||
<Report ReportControl="LLN0$RP$urcbRealData,3,0,0,0,1,0,yes,1,1,1,1,1,0,1,1,1,3,2" />
|
||||
</ReportReal>
|
||||
<ReportEvent>
|
||||
<Report ReportControl="LLN0$BR$brcbQVVR,60,1,0,0,0,0,yes,1,1,1,1,1,0,1,1,1,8,1,0"/>
|
||||
<Report ReportControl="LLN0$BR$brcbRDRE,60,1,0,0,0,0,yes,1,1,1,1,1,0,1,1,1,8,1,0"/>
|
||||
<Report ReportControl="LLN0$BR$brcbGGIO,60,1,0,0,0,0,yes,1,1,1,1,1,0,1,1,1,8,1,0"/>
|
||||
<Report ReportControl="LLN0$BR$brcbLPHD,60,1,0,0,0,0,yes,1,1,1,1,1,0,1,1,1,8,1,0"/>
|
||||
</ReportEvent>
|
||||
</ReportMap>
|
||||
<Topic name="HISDATA" desc="历史稳态数据">
|
||||
<DataType name="DATA_TYPE" value="02" desc="历史短时闪变数据" type="0">
|
||||
<Monitor name="MONITOR" desc="监测点" type="1">
|
||||
<Item name="FLAG" value="0" desc="剔除标记" type="2" />
|
||||
<Item name="TIME" desc="发生时刻" type="3" />
|
||||
<Item name="F_S" desc="短时闪变和波动" type="4" >
|
||||
<Sequence name="SEQ" value="7" desc="相别" type="5" >
|
||||
<Value name="PST" desc="短时闪变" type="6" DO="MFLK0$MX$PhPst" DA="phs*$cVal$mag$f" />
|
||||
<Value name="FLUC" desc="电压波动幅度" type="6" DO="MFLK0$MX$PhFluc" DA="phs*$cVal$mag$f" />
|
||||
<Value name="FLUCF" desc="电压波动频度" type="6" DO="MFLK0$MX$PhFlucf" DA="phs*$cVal$mag$f" />
|
||||
</Sequence>
|
||||
</Item>
|
||||
</Monitor>
|
||||
</DataType>
|
||||
<DataType name="DATA_TYPE" value="03" desc="历史长时闪变数据" type="0">
|
||||
<Monitor name="MONITOR" desc="监测点" type="1">
|
||||
<Item name="FLAG" value="0" desc="剔除标记" type="2" />
|
||||
<Item name="TIME" desc="发生时刻" type="3" />
|
||||
<Item name="F_L" desc="闪变" type="4" >
|
||||
<Sequence name="SEQ" value="7" desc="相别" type="5" >
|
||||
<Value name="PLT" desc="长时闪变" type="6" DO="MFLK0$MX$PhPlt" DA="phs*$cVal$mag$f" />
|
||||
</Sequence>
|
||||
</Item>
|
||||
</Monitor>
|
||||
</DataType>
|
||||
<DataType name="DATA_TYPE" value="04" desc="历史暂态数据" type="0" >
|
||||
<Monitor name="MONITOR" desc="监测点" type="1" >
|
||||
<Item name="VOLTAGE" desc="暂态指标" type="4" >
|
||||
<Sequence name="SEQ" value="7" desc="相别" type="5">
|
||||
<Value name="MAG" desc="残余电压" type="6" DO="QVVR0$MX$VVa" DA="mag$f" />
|
||||
<Value name="DUR" desc="持续时间" type="6" DO="QVVR0$MX$VVaTm" DA="mag$f" />
|
||||
<Value name="SEQ" desc="相别" type="6" DO="" DA="" />
|
||||
<Value name="STARTTIME" desc="开始时间" type="6" DO="" DA="" />
|
||||
<Value name="ENDTIME" desc="结束时间" type="6" DO="" DA="" />
|
||||
<Value name="DISKIND" desc="暂降类型" type="6" DO="" DA="" />
|
||||
<Value name="WAVEFILE" desc="波形文件名称" type="6" DO="" DA="" />
|
||||
</Sequence>
|
||||
</Item>
|
||||
</Monitor>
|
||||
</DataType>
|
||||
<DataType name="DATA_TYPE" value="01" desc="历史稳态数据" type="0">
|
||||
<Monitor name="MONITOR" desc="监测点" type="1">
|
||||
<Item name="FLAG" value="0" desc="剔除标记" type="2" />
|
||||
<Item name="TIME" desc="发生时刻" type="3" />
|
||||
<Item name="V" desc="电压" type="4" >
|
||||
<!--电压V部分(A-C相)-->
|
||||
<Sequence name="SEQ" value="7" desc="相别(A-C相)" type="5">
|
||||
<!--注:Coefficient 值系数,转成kafka的时候乘以系数;BaseFlag 基础数据标志 0或没有-非基础数据 1-基础数据;LimitUp 数据合理上限,如果包含*%UN字符表示需要乘以电压等级电压,如果包含*%U字符表示需要乘以电压等级/1.732电压例如:220kV则相电压上限为1.5*220;LimitDown 数据合理下限 如果包含*%U字符表示需要乘以电压等级电压-->
|
||||
<Value name="G_DELTA_V" desc="电压偏差95值" type="6" DO="MMXU4$MX$PhVDev" DA="phs*$cVal$mag$f" BaseFlag="1" LimitUp="20" LimitDown="-20" Coefficient="1"/>
|
||||
<Value name="DELTA_V" desc="电压偏差平均值" type="6" DO="MMXU2$MX$PhVDev" DA="phs*$cVal$mag$f" BaseFlag="1" LimitUp="20" LimitDown="-20" Coefficient="1"/>
|
||||
<Value name="MAX_DELTA_V" desc="电压偏差最大值" type="6" DO="MMXU1$MX$PhVDev" DA="phs*$cVal$mag$f" BaseFlag="1" LimitUp="20" LimitDown="-20" Coefficient="1"/>
|
||||
<Value name="MIN_DELTA_V" desc="电压偏差最小值" type="6" DO="MMXU3$MX$PhVDev" DA="phs*$cVal$mag$f" BaseFlag="1" LimitUp="20" LimitDown="-20" Coefficient="1"/>
|
||||
<Value name="G_VRMS" desc="电压有效值95值" type="6" DO="MMXU4$MX$PhV" DA="phs*$cVal$mag$f" BaseFlag="1" LimitUp="0*%U" LimitDown="150*%U" />
|
||||
<Value name="VRMS" desc="电压有效值平均值" type="6" DO="MMXU2$MX$PhV" DA="phs*$cVal$mag$f" BaseFlag="1" LimitUp="0*%U" LimitDown="150*%U" />
|
||||
<Value name="MAX_VRMS" desc="电压有效值最大值" type="6" DO="MMXU1$MX$PhV" DA="phs*$cVal$mag$f" BaseFlag="1" LimitUp="0*%U" LimitDown="150*%U" />
|
||||
<Value name="MIN_VRMS" desc="电压有效值最小值" type="6" DO="MMXU3$MX$PhV" DA="phs*$cVal$mag$f" BaseFlag="1" LimitUp="0*%U" LimitDown="150*%U" />
|
||||
<Value name="G_VRMS_LVR" desc="线电压有效值95值" type="6" DO="MMXU4$MX$PPV" DA="l_phs*$cVal$mag$f" BaseFlag="1" LimitUp="0*%U" LimitDown="150*%U" />
|
||||
<Value name="VRMS_LVR" desc="线电压有效值平均值" type="6" DO="MMXU2$MX$PPV" DA="l_phs*$cVal$mag$f" BaseFlag="1" LimitUp="0*%U" LimitDown="150*%U" />
|
||||
<Value name="MAX_VRMS_LVR" desc="线电压有效值最大值" type="6" DO="MMXU1$MX$PPV" DA="l_phs*$cVal$mag$f" BaseFlag="1" LimitUp="0*%U" LimitDown="150*%U" />
|
||||
<Value name="MIN_VRMS_LVR" desc="线电压有效值最小值" type="6" DO="MMXU3$MX$PPV" DA="l_phs*$cVal$mag$f" BaseFlag="1" LimitUp="0*%U" LimitDown="150*%U" />
|
||||
<Value name="G_VTHD" desc="电压总谐波畸变率95值" type="6" DO="MHAI4$MX$ThdPhV" DA="phs*$cVal$mag$f" />
|
||||
<Value name="VTHD" desc="电压总谐波畸变率平均值" type="6" DO="MHAI2$MX$ThdPhV" DA="phs*$cVal$mag$f" />
|
||||
<Value name="MAX_VTHD" desc="电压总谐波畸变率最大值" type="6" DO="MHAI1$MX$ThdPhV" DA="phs*$cVal$mag$f" />
|
||||
<Value name="MIN_VTHD" desc="电压总谐波畸变率最小值" type="6" DO="MHAI3$MX$ThdPhV" DA="phs*$cVal$mag$f" />
|
||||
<Value name="G_VFUND_ANGLE" desc="基波电压相角95值" type="6" DO="MHAI4$MX$HFundPhV" DA="phs*$cVal$ang$f" />
|
||||
<Value name="VFUND_ANGLE" desc="基波电压相角平均值" type="6" DO="MHAI2$MX$HFundPhV" DA="phs*$cVal$ang$f" />
|
||||
<Value name="MAX_VFUND_ANGLE" desc="基波电压相角最大值" type="6" DO="MHAI1$MX$HFundPhV" DA="phs*$cVal$ang$f" />
|
||||
<Value name="MIN_VFUND_ANGLE" desc="基波电压相角最小值" type="6" DO="MHAI3$MX$HFundPhV" DA="phs*$cVal$ang$f" />
|
||||
<Value name="G_V1" desc="基波电压有效值95值" type="6" DO="MHAI4$MX$HFundPhV" DA="phs*$cVal$mag$f" />
|
||||
<Value name="V1" desc="基波电压有效值平均值" type="6" DO="MHAI2$MX$HFundPhV" DA="phs*$cVal$mag$f" />
|
||||
<Value name="MAX_V1" desc="基波电压有效值最大值" type="6" DO="MHAI1$MX$HFundPhV" DA="phs*$cVal$mag$f" />
|
||||
<Value name="MIN_V1" desc="基波电压有效值最小值" type="6" DO="MHAI3$MX$HFundPhV" DA="phs*$cVal$mag$f" />
|
||||
<Value name="G_SV_%0,49%" desc="间谐波电压含有率(f25-2475)95值" type="6" DO="MHAI9$MX$HRPhV" DA="phs*Har[%-0]$mag$f" />
|
||||
<Value name="SV_%0,49%" desc="间谐波电压含有率(f25-2475)平均值" type="6" DO="MHAI7$MX$HRPhV" DA="phs*Har[%-0]$mag$f" />
|
||||
<Value name="MAX_SV_%0,49%" desc="间谐波电压含有率(f25-2475)最大值" type="6" DO="MHAI6$MX$HRPhV" DA="phs*Har[%-0]$mag$f" />
|
||||
<Value name="MIN_SV_%0,49%" desc="间谐波电压含有率(f25-2475)最小值" type="6" DO="MHAI8$MX$HRPhV" DA="phs*Har[%-0]$mag$f" />
|
||||
<Value name="G_V%2,50%" desc="谐波电压含有率(2-50)95值" type="6" DO="MHAI4$MX$HRPhV" DA="phs*Har[%-2]$mag$f" />
|
||||
<Value name="V%2,50%" desc="谐波电压含有率(2-50)平均值" type="6" DO="MHAI2$MX$HRPhV" DA="phs*Har[%-2]$mag$f" />
|
||||
<Value name="MAX_V%2,50%" desc="谐波电压含有率(2-50)最大值" type="6" DO="MHAI1$MX$HRPhV" DA="phs*Har[%-2]$mag$f" />
|
||||
<Value name="MIN_V%2,50%" desc="谐波电压含有率(2-50)最小值" type="6" DO="MHAI3$MX$HRPhV" DA="phs*Har[%-2]$mag$f" />
|
||||
<Value name="G_VA%2,50%" desc="谐波电压相角(2-50)95值" type="6" DO="MHAI4$MX$HRPhV" DA="phs*Har[%-2]$ang$f" />
|
||||
<Value name="VA%2,50%" desc="谐波电压相角(2-50)平均值" type="6" DO="MHAI2$MX$HRPhV" DA="phs*Har[%-2]$ang$f" />
|
||||
<Value name="MAX_VA%2,50%" desc="谐波电压相角(2-50)最大值" type="6" DO="MHAI1$MX$HRPhV" DA="phs*Har[%-2]$ang$f" />
|
||||
<Value name="MIN_VA%2,50%" desc="谐波电压相角(2-50)最小值" type="6" DO="MHAI3$MX$HRPhV" DA="phs*Har[%-2]$ang$f" />
|
||||
</Sequence>
|
||||
<!--电压V部分(A-C相)角型接线-->
|
||||
<Sequence name="SEQ" value="112" desc="相别(A-C相)" type="5">
|
||||
<!--注:Coefficient 值系数,转成kafka的时候乘以系数;BaseFlag 基础数据标志 0或没有-非基础数据 1-基础数据;LimitUp 数据合理上限,如果包含*%UN字符表示需要乘以电压等级电压,如果包含*%U字符表示需要乘以电压等级/1.732电压例如:220kV则相电压上限为1.5*220;LimitDown 数据合理下限 如果包含*%U字符表示需要乘以电压等级电压-->
|
||||
<Value name="G_DELTA_V" desc="电压偏差95值" type="6" DO="MMXU4$MX$PPVDev" DA="phs*$cVal$mag$f" BaseFlag="1" LimitUp="20" LimitDown="-20" Coefficient="1"/>
|
||||
<Value name="DELTA_V" desc="电压偏差平均值" type="6" DO="MMXU2$MX$PPVDev" DA="phs*$cVal$mag$f" BaseFlag="1" LimitUp="20" LimitDown="-20" Coefficient="1"/>
|
||||
<Value name="MAX_DELTA_V" desc="电压偏差最大值" type="6" DO="MMXU1$MX$PPVDev" DA="phs*$cVal$mag$f" BaseFlag="1" LimitUp="20" LimitDown="-20" Coefficient="1"/>
|
||||
<Value name="MIN_DELTA_V" desc="电压偏差最小值" type="6" DO="MMXU3$MX$PPVDev" DA="phs*$cVal$mag$f" BaseFlag="1" LimitUp="20" LimitDown="-20" Coefficient="1"/>
|
||||
<Value name="G_VRMS_LVR" desc="电压有效值95值" type="6" DO="MMXU4$MX$PPV" DA="phs*$cVal$mag$f" BaseFlag="1" LimitUp="0*%U" LimitDown="150*%U" />
|
||||
<Value name="VRMS_LVR" desc="电压有效值平均值" type="6" DO="MMXU2$MX$PPV" DA="phs*$cVal$mag$f" BaseFlag="1" LimitUp="0*%U" LimitDown="150*%U" />
|
||||
<Value name="MAX_VRMS_LVR" desc="电压有效值最大值" type="6" DO="MMXU1$MX$PPV" DA="phs*$cVal$mag$f" BaseFlag="1" LimitUp="0*%U" LimitDown="150*%U" />
|
||||
<Value name="MIN_VRMS_LVR" desc="电压有效值最小值" type="6" DO="MMXU3$MX$PPV" DA="phs*$cVal$mag$f" BaseFlag="1" LimitUp="0*%U" LimitDown="150*%U" />
|
||||
<Value name="G_VTHD" desc="电压总谐波畸变率95值" type="6" DO="MHAI4$MX$ThdPPV" DA="phs*$cVal$mag$f" />
|
||||
<Value name="VTHD" desc="电压总谐波畸变率平均值" type="6" DO="MHAI2$MX$ThdPPV" DA="phs*$cVal$mag$f" />
|
||||
<Value name="MAX_VTHD" desc="电压总谐波畸变率最大值" type="6" DO="MHAI1$MX$ThdPPV" DA="phs*$cVal$mag$f" />
|
||||
<Value name="MIN_VTHD" desc="电压总谐波畸变率最小值" type="6" DO="MHAI3$MX$ThdPPV" DA="phs*$cVal$mag$f" />
|
||||
<Value name="G_VFUND_ANGLE" desc="基波电压相角95值" type="6" DO="MHAI4$MX$HFundPPVAng" DA="phs*$cVal$ang$f" />
|
||||
<Value name="VFUND_ANGLE" desc="基波电压相角平均值" type="6" DO="MHAI2$MX$HFundPPVAng" DA="phs*$cVal$ang$f" />
|
||||
<Value name="MAX_VFUND_ANGLE" desc="基波电压相角最大值" type="6" DO="MHAI1$MX$HFundPPVAng" DA="phs*$cVal$ang$f" />
|
||||
<Value name="MIN_VFUND_ANGLE" desc="基波电压相角最小值" type="6" DO="MHAI3$MX$HFundPPVAng" DA="phs*$cVal$ang$f" />
|
||||
<Value name="G_V1" desc="基波电压有效值95值" type="6" DO="MHAI4$MX$HFundPPV" DA="phs*$cVal$mag$f" />
|
||||
<Value name="V1" desc="基波电压有效值平均值" type="6" DO="MHAI2$MX$HFundPPV" DA="phs*$cVal$mag$f" />
|
||||
<Value name="MAX_V1" desc="基波电压有效值最大值" type="6" DO="MHAI1$MX$HFundPPV" DA="phs*$cVal$mag$f" />
|
||||
<Value name="MIN_V1" desc="基波电压有效值最小值" type="6" DO="MHAI3$MX$HFundPPV" DA="phs*$cVal$mag$f" />
|
||||
<Value name="G_SV_%0,49%" desc="间谐波电压含有率(f25-2475)95值" type="6" DO="MHAI9$MX$HRPPV" DA="phs*Har[%-0]$mag$f" />
|
||||
<Value name="SV_%0,49%" desc="间谐波电压含有率(f25-2475)平均值" type="6" DO="MHAI7$MX$HRPPV" DA="phs*Har[%-0]$mag$f" />
|
||||
<Value name="MAX_SV_%0,49%" desc="间谐波电压含有率(f25-2475)最大值" type="6" DO="MHAI6$MX$HRPPV" DA="phs*Har[%-0]$mag$f" />
|
||||
<Value name="MIN_SV_%0,49%" desc="间谐波电压含有率(f25-2475)最小值" type="6" DO="MHAI8$MX$HRPPV" DA="phs*Har[%-0]$mag$f" />
|
||||
<Value name="G_V%2,50%" desc="谐波电压含有率(2-50)95值" type="6" DO="MHAI4$MX$HRPPV" DA="phs*Har[%-2]$mag$f" />
|
||||
<Value name="V%2,50%" desc="谐波电压含有率(2-50)平均值" type="6" DO="MHAI2$MX$HRPPV" DA="phs*Har[%-2]$mag$f" />
|
||||
<Value name="MAX_V%2,50%" desc="谐波电压含有率(2-50)最大值" type="6" DO="MHAI1$MX$HRPPV" DA="phs*Har[%-2]$mag$f" />
|
||||
<Value name="MIN_V%2,50%" desc="谐波电压含有率(2-50)最小值" type="6" DO="MHAI3$MX$HRPPV" DA="phs*Har[%-2]$mag$f" />
|
||||
<Value name="G_VA%2,50%" desc="谐波电压相角(2-50)95值" type="6" DO="MHAI4$MX$HRPPV" DA="phs*Har[%-2]$ang$f" />
|
||||
<Value name="VA%2,50%" desc="谐波电压相角(2-50)平均值" type="6" DO="MHAI2$MX$HRPPV" DA="phs*Har[%-2]$ang$f" />
|
||||
<Value name="MAX_VA%2,50%" desc="谐波电压相角(2-50)最大值" type="6" DO="MHAI1$MX$HRPPV" DA="phs*Har[%-2]$ang$f" />
|
||||
<Value name="MIN_VA%2,50%" desc="谐波电压相角(2-50)最小值" type="6" DO="MHAI3$MX$HRPPV" DA="phs*Har[%-2]$ang$f" />
|
||||
</Sequence>
|
||||
<Sequence name="SEQ" value="8" desc="相别(T相)" type="5">
|
||||
<!--电压V部分(T相)-->
|
||||
<Value name="G_VNSEQ" desc="负序电压95值" type="6" DO="MSQI4$MX$SeqV" DA="c2$cVal$mag$f" />
|
||||
<Value name="VNSEQ" desc="负序电压平均值" type="6" DO="MSQI2$MX$SeqV" DA="c2$cVal$mag$f" />
|
||||
<Value name="MAX_VNSEQ" desc="负序电压最大值" type="6" DO="MSQI1$MX$SeqV" DA="c2$cVal$mag$f" />
|
||||
<Value name="MIN_VNSEQ" desc="负序电压最小值" type="6" DO="MSQI3$MX$SeqV" DA="c2$cVal$mag$f" />
|
||||
<Value name="G_V_UNBAN" desc="负序电压不平衡95值" type="6" DO="MSQI4$MX$ImbNgV" DA="mag$f" />
|
||||
<Value name="V_UNBAN" desc="负序电压不平衡平均值" type="6" DO="MSQI2$MX$ImbNgV" DA="mag$f" />
|
||||
<Value name="MAX_V_UNBAN" desc="负序电压不平衡最大值" type="6" DO="MSQI1$MX$ImbNgV" DA="mag$f" />
|
||||
<Value name="MIN_V_UNBAN" desc="负序电压不平衡最小值" type="6" DO="MSQI3$MX$ImbNgV" DA="mag$f" />
|
||||
<Value name="G_VZSEQ" desc="零序电压95值" type="6" DO="MSQI4$MX$SeqV" DA="c3$cVal$mag$f" />
|
||||
<Value name="VZSEQ" desc="零序电压平均值" type="6" DO="MSQI2$MX$SeqV" DA="c3$cVal$mag$f" />
|
||||
<Value name="MAX_VZSEQ" desc="零序电压最大值" type="6" DO="MSQI1$MX$SeqV" DA="c3$cVal$mag$f" />
|
||||
<Value name="MIN_VZSEQ" desc="零序电压最小值" type="6" DO="MSQI3$MX$SeqV" DA="c3$cVal$mag$f" />
|
||||
<Value name="G_VZSEQ_UNBAN" desc="零序电压不平衡95值" type="6" DO="MSQI4$MX$ImbZroV" DA="mag$f" />
|
||||
<Value name="VZSEQ_UNBAN" desc="零序电压不平衡平均值" type="6" DO="MSQI2$MX$ImbZroV" DA="mag$f" />
|
||||
<Value name="MAX_VZSEQ_UNBAN" desc="零序电压不平衡最大值" type="6" DO="MSQI1$MX$ImbZroV" DA="mag$f" />
|
||||
<Value name="MIN_VZSEQ_UNBAN" desc="零序电压不平衡最小值" type="6" DO="MSQI3$MX$ImbZroV" DA="mag$f" />
|
||||
<Value name="G_FREQ" desc="频率95值" type="6" DO="MMXU4$MX$Hz" DA="mag$f" />
|
||||
<Value name="FREQ" desc="频率平均值" type="6" DO="MMXU2$MX$Hz" DA="mag$f" />
|
||||
<Value name="MAX_FREQ" desc="频率最大值" type="6" DO="MMXU1$MX$Hz" DA="mag$f" />
|
||||
<Value name="MIN_FREQ" desc="频率最小值" type="6" DO="MMXU3$MX$Hz" DA="mag$f" />
|
||||
<Value name="G_DELTA_FREQ" desc="频率偏差95值" type="6" DO="MMXU4$MX$HzDev" DA="mag$f" />
|
||||
<Value name="DELTA_FREQ" desc="频率偏差平均值" type="6" DO="MMXU2$MX$HzDev" DA="mag$f" />
|
||||
<Value name="MAX_DELTA_FREQ" desc="频率偏差最大值" type="6" DO="MMXU1$MX$HzDev" DA="mag$f" />
|
||||
<Value name="MIN_DELTA_FREQ" desc="频率偏差最小值" type="6" DO="MMXU3$MX$HzDev" DA="mag$f" />
|
||||
<Value name="G_VPSEQ" desc="正序电压95值" type="6" DO="MSQI4$MX$SeqV" DA="c1$cVal$mag$f" />
|
||||
<Value name="VPSEQ" desc="正序电压平均值" type="6" DO="MSQI2$MX$SeqV" DA="c1$cVal$mag$f" />
|
||||
<Value name="MAX_VPSEQ" desc="正序电压最大值" type="6" DO="MSQI1$MX$SeqV" DA="c1$cVal$mag$f" />
|
||||
<Value name="MIN_VPSEQ" desc="正序电压最小值" type="6" DO="MSQI3$MX$SeqV" DA="c1$cVal$mag$f" />
|
||||
</Sequence>
|
||||
</Item>
|
||||
<Item name="I" desc="电流" type="4" >
|
||||
<!--电流I部分(A-C相)-->
|
||||
<Sequence name="SEQ" value="7" desc="相别(A-C相)" type="5">
|
||||
<Value name="G_IRMS" desc="电流有效值95值" type="6" DO="MMXU4$MX$A" DA="phs*$cVal$mag$f" />
|
||||
<Value name="IRMS" desc="电流有效值平均值" type="6" DO="MMXU2$MX$A" DA="phs*$cVal$mag$f" />
|
||||
<Value name="MAX_IRMS" desc="电流有效值最大值" type="6" DO="MMXU1$MX$A" DA="phs*$cVal$mag$f" />
|
||||
<Value name="MIN_IRMS" desc="电流有效值最小值" type="6" DO="MMXU3$MX$A" DA="phs*$cVal$mag$f" />
|
||||
<Value name="G_I1" desc="基波电流有效值95值" type="6" DO="MHAI4$MX$HA" DA="phs*Har[0]$mag$f" />
|
||||
<Value name="I1" desc="基波电流有效值平均值" type="6" DO="MHAI2$MX$HA" DA="phs*Har[0]$mag$f" />
|
||||
<Value name="MAX_I1" desc="基波电流有效值最大值" type="6" DO="MHAI1$MX$HA" DA="phs*Har[0]$mag$f" />
|
||||
<Value name="MIN_I1" desc="基波电流有效值最小值" type="6" DO="MHAI3$MX$HA" DA="phs*Har[0]$mag$f" />
|
||||
<Value name="G_IFUND_ANGLE" desc="基波电流相角95值" type="6" DO="MHAI4$MX$HA" DA="phs*Har[0]$ang$f" />
|
||||
<Value name="IFUND_ANGLE" desc="基波电流相角平均值" type="6" DO="MHAI2$MX$HA" DA="phs*Har[0]$ang$f" />
|
||||
<Value name="MAX_IFUND_ANGLE" desc="基波电流相角最大值" type="6" DO="MHAI1$MX$HA" DA="phs*Har[0]$ang$f" />
|
||||
<Value name="MIN_IFUND_ANGLE" desc="基波电流相角最小值" type="6" DO="MHAI3$MX$HA" DA="phs*Har[0]$ang$f" />
|
||||
<Value name="G_SI_%0,49%" desc="间谐波电流幅值(f25-2475)95值" type="6" DO="MHAI9$MX$HA" DA="phs*Har[%-0]$mag$f" />
|
||||
<Value name="SI_%0,49%" desc="间谐波电流幅值(f25-2475)平均值" type="6" DO="MHAI7$MX$HA" DA="phs*Har[%-0]$mag$f" />
|
||||
<Value name="MAX_SI_%0,49%" desc="间谐波电流幅值(f25-2475)最大值" type="6" DO="MHAI6$MX$HA" DA="phs*Har[%-0]$mag$f" />
|
||||
<Value name="MAX_SI_%0,49%" desc="间谐波电流幅值(f25-2475)最小值" type="6" DO="MHAI8$MX$HA" DA="phs*Har[%-0]$mag$f" />
|
||||
<Value name="G_I%1,50%" desc="谐波电流幅值(2-50)95值" type="6" DO="MHAI4$MX$HA" DA="phs*Har[%-1]$mag$f" />
|
||||
<Value name="I%1,50%" desc="谐波电流幅值(2-50)平均值" type="6" DO="MHAI2$MX$HA" DA="phs*Har[%-1]$mag$f" />
|
||||
<Value name="MAX_I%1,50%" desc="谐波电流幅值(2-50)最大值" type="6" DO="MHAI1$MX$HA" DA="phs*Har[%-1]$mag$f" />
|
||||
<Value name="MIN_I%1,50%" desc="谐波电流幅值(2-50)最小值" type="6" DO="MHAI3$MX$HA" DA="phs*Har[%-1]$mag$f" />
|
||||
<Value name="G_IA%1,50%" desc="谐波电流相角(2-50)95值" type="6" DO="MHAI4$MX$HA" DA="phs*Har[%-1]$ang$f" />
|
||||
<Value name="IA%1,50%" desc="谐波电流相角(2-50)平均值" type="6" DO="MHAI2$MX$HA" DA="phs*Har[%-1]$ang$f" />
|
||||
<Value name="MAX_IA%1,50%" desc="谐波电流相角(2-50)最大值" type="6" DO="MHAI1$MX$HA" DA="phs*Har[%-1]$ang$f" />
|
||||
<Value name="MIN_IA%1,50%" desc="谐波电流相角(2-50)最小值" type="6" DO="MHAI3$MX$HA" DA="phs*Har[%-1]$ang$f" />
|
||||
<Value name="ITHD" desc="电流总谐波畸变率平均" type="6" DO="MHAI2$MX$ThdA" DA="phs*$cVal$mag$f" Coefficient="1" />
|
||||
<Value name="MAX_ITHD" desc="电流总谐波畸变率最大" type="6" DO="MHAI1$MX$ThdA" DA="phs*$cVal$mag$f" Coefficient="1" />
|
||||
<Value name="MIN_ITHD" desc="电流总谐波畸变率最小" type="6" DO="MHAI3$MX$ThdA" DA="phs*$cVal$mag$f" Coefficient="1" />
|
||||
<Value name="G_ITHD" desc="电流总谐波畸变率95" type="6" DO="MHAI4$MX$ThdA" DA="phs*$cVal$mag$f" Coefficient="1" />
|
||||
</Sequence>
|
||||
<!--电流I部分(T相)-->
|
||||
<Sequence name="SEQ" value="8" desc="相别(T相)" type="5">
|
||||
<Value name="G_INSEQ" desc="负序电流95值" type="6" DO="MSQI4$MX$SeqA" DA="c2$cVal$mag$f" />
|
||||
<Value name="INSEQ" desc="负序电流平均值" type="6" DO="MSQI2$MX$SeqA" DA="c2$cVal$mag$f" />
|
||||
<Value name="MAX_INSEQ" desc="负序电流最大值" type="6" DO="MSQI1$MX$SeqA" DA="c2$cVal$mag$f" />
|
||||
<Value name="MIN_INSEQ" desc="负序电流最小值" type="6" DO="MSQI3$MX$SeqA" DA="c2$cVal$mag$f" />
|
||||
<Value name="G_I_UNBAN" desc="负序电流不平衡95值" type="6" DO="MSQI4$MX$ImbNgA" DA="mag$f" />
|
||||
<Value name="I_UNBAN" desc="负序电流不平衡平均值" type="6" DO="MSQI2$MX$ImbNgA" DA="mag$f" />
|
||||
<Value name="MAX_I_UNBAN" desc="负序电流不平衡最大值" type="6" DO="MSQI1$MX$ImbNgA" DA="mag$f" />
|
||||
<Value name="MIN_I_UNBAN" desc="负序电流不平衡最小值" type="6" DO="MSQI3$MX$ImbNgA" DA="mag$f" />
|
||||
<Value name="G_IZSEQ" desc="零序电流95值" type="6" DO="MSQI4$MX$SeqA" DA="c3$cVal$mag$f" />
|
||||
<Value name="IZSEQ" desc="零序电流平均值" type="6" DO="MSQI2$MX$SeqA" DA="c3$cVal$mag$f" />
|
||||
<Value name="MAX_IZSEQ" desc="零序电流最大值" type="6" DO="MSQI1$MX$SeqA" DA="c3$cVal$mag$f" />
|
||||
<Value name="MIN_IZSEQ" desc="零序电流最小值" type="6" DO="MSQI3$MX$SeqA" DA="c3$cVal$mag$f" />
|
||||
<Value name="G_VZSEQ_UNBAN" desc="零序电流不平衡95值" type="6" DO="MSQI4$MX$ImbZroA" DA="mag$f" />
|
||||
<Value name="VZSEQ_UNBAN" desc="零序电流不平衡平均值" type="6" DO="MSQI2$MX$ImbZroA" DA="mag$f" />
|
||||
<Value name="MAX_IZSEQ_UNBAN" desc="零序电流不平衡最大值" type="6" DO="MSQI1$MX$ImbZroA" DA="mag$f" />
|
||||
<Value name="MIN_IZSEQ_UNBAN" desc="零序电流不平衡最小值" type="6" DO="MSQI3$MX$ImbZroA" DA="mag$f" />
|
||||
<Value name="G_IPSEQ" desc="正序电流95值" type="6" DO="MSQI4$MX$SeqA" DA="c1$cVal$mag$f" />
|
||||
<Value name="IPSEQ" desc="正序电流平均值" type="6" DO="MSQI2$MX$SeqA" DA="c1$cVal$mag$f" />
|
||||
<Value name="MAX_IPSEQ" desc="正序电流最大值" type="6" DO="MSQI1$MX$SeqA" DA="c1$cVal$mag$f" />
|
||||
<Value name="MIN_IPSEQ" desc="正序电流最小值" type="6" DO="MSQI3$MX$SeqA" DA="c1$cVal$mag$f" />
|
||||
</Sequence>
|
||||
</Item>
|
||||
<Item name="PQ" desc="功率" type="4" >
|
||||
<!--功率PQ部分(A-C相)-->
|
||||
<Sequence name="SEQ" value="7" desc="相别(A-C相)" type="5">
|
||||
<Value name="G_PF" desc="功率因数95值" type="6" DO="MMXU4$MX$PF" DA="phs*$cVal$mag$f" />
|
||||
<Value name="PF" desc="功率因数平均值" type="6" DO="MMXU2$MX$PF" DA="phs*$cVal$mag$f" />
|
||||
<Value name="MAX_PF" desc="功率因数最大值" type="6" DO="MMXU1$MX$PF" DA="phs*$cVal$mag$f" />
|
||||
<Value name="MIN_PF" desc="功率因数最小值" type="6" DO="MMXU3$MX$PF" DA="phs*$cVal$mag$f" />
|
||||
<Value name="G_DF" desc="位移功率因数95值" type="6" DO="MMXU4$MX$DF" DA="phs*$cVal$mag$f" />
|
||||
<Value name="DF" desc="位移功率因数平均值" type="6" DO="MMXU2$MX$DF" DA="phs*$cVal$mag$f" />
|
||||
<Value name="MAX_DF" desc="位移功率因数最大值" type="6" DO="MMXU1$MX$DF" DA="phs*$cVal$mag$f" />
|
||||
<Value name="MIN_DF" desc="位移功率因数最小值" type="6" DO="MMXU3$MX$DF" DA="phs*$cVal$mag$f" />
|
||||
<Value name="G_P_FUND" desc="基波有功功率95值" type="6" DO="MHAI4$MX$HW" DA="phs*Har[0]$mag$f" />
|
||||
<Value name="P_FUND" desc="基波有功功率平均值" type="6" DO="MHAI2$MX$HW" DA="phs*Har[0]$mag$f" />
|
||||
<Value name="MAX_P_FUND" desc="基波有功功率最大值" type="6" DO="MHAI1$MX$HW" DA="phs*Har[0]$mag$f" />
|
||||
<Value name="MIN_P_FUND" desc="基波有功功率最小值" type="6" DO="MHAI3$MX$HW" DA="phs*Har[0]$mag$f" />
|
||||
<Value name="G_S" desc="视在功率95值" type="6" DO="MMXU4$MX$VA" DA="phs*$cVal$mag$f" />
|
||||
<Value name="S" desc="视在功率平均值" type="6" DO="MMXU2$MX$VA" DA="phs*$cVal$mag$f" />
|
||||
<Value name="MAX_S" desc="视在功率最大值" type="6" DO="MMXU1$MX$VA" DA="phs*$cVal$mag$f" />
|
||||
<Value name="MIN_S" desc="视在功率最小值" type="6" DO="MMXU3$MX$VA" DA="phs*$cVal$mag$f" />
|
||||
<Value name="G_Q" desc="无功功率95值" type="6" DO="MMXU4$MX$VAr" DA="phs*$cVal$mag$f" />
|
||||
<Value name="Q" desc="无功功率平均值" type="6" DO="MMXU2$MX$VAr" DA="phs*$cVal$mag$f" />
|
||||
<Value name="MAX_Q" desc="无功功率最大值" type="6" DO="MMXU1$MX$VAr" DA="phs*$cVal$mag$f" />
|
||||
<Value name="MIN_Q" desc="无功功率最小值" type="6" DO="MMXU3$MX$VAr" DA="phs*$cVal$mag$f" />
|
||||
<Value name="G_P%1,50%" desc="谐波有功功率(2-50)95值" type="6" DO="MHAI4$MX$HW" DA="phs*Har[%-1]$mag$f" />
|
||||
<Value name="P%1,50%" desc="谐波有功功率(2-50)平均值" type="6" DO="MHAI2$MX$HW" DA="phs*Har[%-1]$mag$f" />
|
||||
<Value name="MAX_P%1,50%" desc="谐波有功功率(2-50)最大值" type="6" DO="MHAI1$MX$HW" DA="phs*Har[%-1]$mag$f" />
|
||||
<Value name="MIN_P%1,50%" desc="谐波有功功率(2-50)最小值" type="6" DO="MHAI3$MX$HW" DA="phs*Har[%-1]$mag$f" />
|
||||
<Value name="G_Q%1,50%" desc="谐波无功功率(2-50)95值" type="6" DO="MHAI4$MX$HVAr" DA="phs*Har[%-1]$mag$f" />
|
||||
<Value name="Q%1,50%" desc="谐波无功功率(2-50)平均值" type="6" DO="MHAI2$MX$HVAr" DA="phs*Har[%-1]$mag$f" />
|
||||
<Value name="MAX_Q%1,50%" desc="谐波无功功率(2-50)最大值" type="6" DO="MHAI1$MX$HVAr" DA="phs*Har[%-1]$mag$f" />
|
||||
<Value name="MIN_Q%1,50%" desc="谐波无功功率(2-50)最小值" type="6" DO="MHAI3$MX$HVAr" DA="phs*Har[%-1]$mag$f" />
|
||||
<Value name="G_S%1,50%" desc="谐波视在功率(2-50)95值" type="6" DO="MHAI4$MX$HVA" DA="phs*Har[%-1]$mag$f" />
|
||||
<Value name="S%1,50%" desc="谐波视在功率(2-50)平均值" type="6" DO="MHAI2$MX$HVA" DA="phs*Har[%-1]$mag$f" />
|
||||
<Value name="MAX_S%1,50%" desc="谐波视在功率(2-50)最大值" type="6" DO="MHAI1$MX$HVA" DA="phs*Har[%-1]$mag$f" />
|
||||
<Value name="MIN_S%1,50%" desc="谐波视在功率(2-50)最小值" type="6" DO="MHAI3$MX$HVA" DA="phs*Har[%-1]$mag$f" />
|
||||
<Value name="G_P" desc="有功功率95值" type="6" DO="MMXU4$MX$W" DA="phs*$cVal$mag$f" />
|
||||
<Value name="P" desc="有功功率平均值" type="6" DO="MMXU2$MX$W" DA="phs*$cVal$mag$f" />
|
||||
<Value name="MAX_P" desc="有功功率最大值" type="6" DO="MMXU1$MX$W" DA="phs*$cVal$mag$f" />
|
||||
<Value name="MIN_P" desc="有功功率最小值" type="6" DO="MMXU3$MX$W" DA="phs*$cVal$mag$f" />
|
||||
</Sequence>
|
||||
<!--功率PQ部分(T相)-->
|
||||
<Sequence name="SEQ" value="8" desc="相别(T相)" type="5">
|
||||
<Value name="G_PF" desc="功率因数95值" type="6" DO="MMXU4$MX$TotPF" DA="mag$f" />
|
||||
<Value name="PF" desc="功率因数平均值" type="6" DO="MMXU2$MX$TotPF" DA="mag$f" />
|
||||
<Value name="MAX_PF" desc="功率因数最大值" type="6" DO="MMXU1$MX$TotPF" DA="mag$f" />
|
||||
<Value name="MIN_PF" desc="功率因数最小值" type="6" DO="MMXU3$MX$TotPF" DA="mag$f" />
|
||||
<Value name="G_DF" desc="位移功率因数95值" type="6" DO="MMXU4$MX$TotDF" DA="mag$f" />
|
||||
<Value name="DF" desc="位移功率因数平均值" type="6" DO="MMXU2$MX$TotDF" DA="mag$f" />
|
||||
<Value name="MAX_DF" desc="位移功率因数最大值" type="6" DO="MMXU1$MX$TotDF" DA="mag$f" />
|
||||
<Value name="MIN_DF" desc="位移功率因数最小值" type="6" DO="MMXU3$MX$TotDF" DA="mag$f" />
|
||||
<Value name="G_S" desc="视在功率95值" type="6" DO="MMXU4$MX$TotVA" DA="mag$f" />
|
||||
<Value name="S" desc="视在功率平均值" type="6" DO="MMXU2$MX$TotVA" DA="mag$f" />
|
||||
<Value name="MAX_S" desc="视在功率最大值" type="6" DO="MMXU1$MX$TotVA" DA="mag$f" />
|
||||
<Value name="MIN_S" desc="视在功率最小值" type="6" DO="MMXU3$MX$TotVA" DA="mag$f" />
|
||||
<Value name="G_Q" desc="无功功率95值" type="6" DO="MMXU4$MX$TotVAr" DA="mag$f" />
|
||||
<Value name="Q" desc="无功功率平均值" type="6" DO="MMXU2$MX$TotVAr" DA="mag$f" />
|
||||
<Value name="MAX_Q" desc="无功功率最大值" type="6" DO="MMXU1$MX$TotVAr" DA="mag$f" />
|
||||
<Value name="MIN_Q" desc="无功功率最小值" type="6" DO="MMXU3$MX$TotVAr" DA="mag$f" />
|
||||
<Value name="G_P" desc="有功功率95值" type="6" DO="MMXU4$MX$TotW" DA="mag$f" />
|
||||
<Value name="P" desc="有功功率平均值" type="6" DO="MMXU2$MX$TotW" DA="mag$f" />
|
||||
<Value name="MAX_P" desc="有功功率最大值" type="6" DO="MMXU1$MX$TotW" DA="mag$f" />
|
||||
<Value name="MIN_P" desc="有功功率最小值" type="6" DO="MMXU3$MX$TotW" DA="mag$f" />
|
||||
</Sequence>
|
||||
</Item>
|
||||
</Monitor>
|
||||
</DataType>
|
||||
</Topic>
|
||||
<Topic name="RTDATA" desc="实时数据">
|
||||
<DataType name="DATA_TYPE" value="01" desc="实时稳态数据" send="1" type="0">
|
||||
<Monitor name="-" desc="监测点" type="1">
|
||||
<Item name="FLAG" value="0" desc="剔除标记" type="3" />
|
||||
<Item name="TIME" desc="发生时刻" type="3" />
|
||||
<Item name="V" desc="电压" type="4" >
|
||||
<!--电压V部分(A-C相)-->
|
||||
<Sequence name="SEQ" value="7" desc="相别(A-C相)" type="5">
|
||||
<Value name="VRMS" desc="电压有效值" type="6" DO="MMXU0$MX$PhV" DA="phs*$cVal$mag$f" Coefficient="1" />
|
||||
<Value name="DELTA_V" desc="电压偏差" type="6" DO="MMXU0$MX$PhVDev" DA="phs*$cVal$mag$f" Coefficient="1" />
|
||||
<Value name="VTHD" desc="电压总谐波畸变率" type="6" DO="MHAI0$MX$ThdPhV" DA="phs*$cVal$mag$f" Coefficient="1" />
|
||||
<!--icd101/102模型-->
|
||||
<Value name="VFUND_ANGLE" desc="基波电压相角" type="6" DO="MHAI0$MX$HFundPhV" DA="phs*$cVal$ang$f" Coefficient="1" />
|
||||
<Value name="VRMS_LVR" desc="线电压有效值" type="6" DO="MMXU0$MX$PPV" DA="l_phs*$cVal$mag$f" BaseFlag="1" LimitUp="0*%U" LimitDown="150*%U" />
|
||||
<!--icd100模型-->
|
||||
<!--<Value name="V_ANGLE" desc="基波电压相角" type="6" DO="MMXU0$MX$PhV||MMXU0$MX$PPV" DA="phs*$cVal$ang$f||phs##$cVal$ang$f" Coefficient="1" /-->
|
||||
<!--icd101/102模型-->
|
||||
<Value name="V1" desc="基波电压有效值" type="6" DO="MHAI0$MX$HFundPhV" DA="phs*$cVal$mag$f" Coefficient="1" />
|
||||
<!--icd100模型-->
|
||||
<!--Value name="V1" desc="基波电压有效值" type="6" DO="MHAI2$MX$HFundPhV||MHAI2$MX$HFundPPV" DA="phs*$cVal$mag$f||phs##$cVal$mag$f" Coefficient="1" /-->
|
||||
<Value name="V%2,50%" desc="2-50次谐波电压含有率" type="6" DO="MHAI0$MX$HRPhV" DA="phs*Har[%-2]$mag$f" Coefficient="1" Offset="0" />
|
||||
<Value name="SV_%0,49%" desc="1-50次间谐波电压含有率" type="6" DO="MHAI5$MX$HRPhV" DA="phs*Har[%-0]$mag$f" Coefficient="1" Offset="0" />
|
||||
<Value name="VA%2,50%" desc="谐波电压相角(2-50)" type="6" DO="MHAI5$MX$HRPhV" DA="phs*Har[%-2]$ang$f" />
|
||||
</Sequence>
|
||||
<!--电压V部分(A-C相)角型接线-->
|
||||
<Sequence name="SEQ" value="112" desc="相别(A-C相)" type="5">
|
||||
<!--注:Coefficient 值系数,转成kafka的时候乘以系数;BaseFlag 基础数据标志 0或没有-非基础数据 1-基础数据;LimitUp 数据合理上限,如果包含*%UN字符表示需要乘以电压等级电压,如果包含*%U字符表示需要乘以电压等级/1.732电压例如:220kV则相电压上限为1.5*220;LimitDown 数据合理下限 如果包含*%U字符表示需要乘以电压等级电压-->
|
||||
<Value name="DELTA_V" desc="电压偏差" type="6" DO="MMXU0$MX$PPVDev" DA="phs*$cVal$mag$f" Coefficient="1"/>
|
||||
<Value name="VRMS_LVR" desc="电压有效值" type="6" DO="MMXU0$MX$PPV" DA="phs*$cVal$mag$f" BaseFlag="1" LimitUp="0*%U" LimitDown="150*%U" Coefficient="1" />
|
||||
<Value name="VTHD" desc="电压总谐波畸变率" type="6" DO="MHAI0$MX$ThdPPV" DA="phs*$cVal$mag$f" Coefficient="1"/>
|
||||
<Value name="VFUND_ANGLE" desc="基波电压相角" type="6" DO="MHAI0$MX$HFundPPV" DA="phs*$cVal$ang$f" Coefficient="1" />
|
||||
<Value name="V1" desc="基波电压有效值" type="6" DO="MHAI0$MX$HFundPPV" DA="phs*$cVal$mag$f" Coefficient="1"/>
|
||||
<Value name="SV_%0,49%" desc="间谐波电压含有率(f25-2475)" type="6" DO="MHAI0$MX$HRPPV" DA="phs*Har[%-0]$mag$f" Coefficient="1" Offset="0" />
|
||||
<Value name="V%2,50%" desc="谐波电压含有率(2-50)" type="6" DO="MHAI5$MX$HRPPV" DA="phs*Har[%-2]$mag$f" Coefficient="1" Offset="0" />
|
||||
<Value name="VA%2,50%" desc="谐波电压相角(2-50)" type="6" DO="MHAI5$MX$HRPPV" DA="phs*Har[%-2]$ang$f" />
|
||||
</Sequence>
|
||||
<Sequence name="SEQ" value="8" desc="相别(T相)" type="5">
|
||||
<!--电压V部分(T相)-->
|
||||
<Value name="VNSEQ" desc="负序电压" type="6" DO="MSQI0$MX$SeqV" DA="c2$cVal$mag$f" Coefficient="1" />
|
||||
<Value name="V_UNBAN" desc="负序电压不平衡" type="6" DO="MSQI0$MX$ImbNgV" DA="mag$f" Coefficient="1" />
|
||||
<Value name="VZSEQ" desc="零序电压" type="6" DO="MSQI0$MX$SeqV" DA="c3$cVal$mag$f" Coefficient="1" />
|
||||
<Value name="VZSEQ_UNBAN" desc="零序电压不平衡" type="6" DO="MSQI0$MX$ImbZroV" DA="mag$f" Coefficient="1" />
|
||||
<Value name="FREQ" desc="频率" type="6" DO="MMXU0$MX$Hz" DA="mag$f" Coefficient="1" />
|
||||
<Value name="DELTA_FREQ" desc="频率偏差" type="6" DO="MMXU0$MX$HzDev" DA="mag$f" Coefficient="1" />
|
||||
<Value name="VPSEQ" desc="正序电压" type="6" DO="MSQI0$MX$SeqV" DA="c1$cVal$mag$f" Coefficient="1" />
|
||||
</Sequence>
|
||||
</Item>
|
||||
<Item name="I" desc="电流" type="4" >
|
||||
<!--电流I部分(A-C相)-->
|
||||
<Sequence name="SEQ" value="7" desc="相别(A-C相)" type="5">
|
||||
<Value name="IRMS" desc="电流有效值" type="6" DO="MMXU0$MX$A" DA="phs*$cVal$mag$f" Coefficient="1" />
|
||||
<Value name="I1" desc="基波电流有效值" type="6" DO="MHAI0$MX$HA" DA="phs*Har[0]$mag$f" Coefficient="1" />
|
||||
<Value name="ITHD" desc="电流总谐波畸变率" type="6" DO="MHAI0$MX$ThdA" DA="phs*$cVal$mag$f" Coefficient="1" />
|
||||
<!--icd101/102模型-->
|
||||
<Value name="I_ANGLE" desc="基波电流相角" type="6" DO="MHAI0$MX$HA" DA="phs*Har[0]$ang$f" Coefficient="1" />
|
||||
<!--icd100模型-->
|
||||
<!--Value name="I_ANGLE" desc="基波电流相角" type="6" DO="MMXU0$MX$A" DA="phs*$cVal$ang$f" Coefficient="1" /-->
|
||||
<Value name="I%2,50%" desc="2-50次谐波电流幅值" type="6" DO="MHAI0$MX$HA" DA="phs*Har[%-1]$mag$f" Coefficient="1" Offset="0" />
|
||||
<Value name="SI_%0,49%" desc="1-50次间谐波电流含有率" type="6" DO="MHAI5$MX$HA" DA="phs*Har[%-0]$mag$f" Coefficient="1" Offset="0" />
|
||||
<!--Value name="I%1,49%" desc="1-50次谐波电流含有率" type="6" DO="MHAI0$MX$HA" DA="phs*Har[%-2]$mag$f" Coefficient="1" Offset="1" /-->
|
||||
</Sequence>
|
||||
<!--电流I部分(T相)-->
|
||||
<Sequence name="SEQ" value="8" desc="相别(T相)" type="5">
|
||||
<Value name="INSEQ" desc="负序电流" type="6" DO="MSQI0$MX$SeqA" DA="c2$cVal$mag$f" Coefficient="1" />
|
||||
<Value name="I_UNBAN" desc="负序电流不平衡" type="6" DO="MSQI0$MX$ImbNgA" DA="mag$f" Coefficient="1" />
|
||||
<Value name="IZSEQ" desc="零序电流" type="6" DO="MSQI0$MX$SeqA" DA="c3$cVal$mag$f" Coefficient="1" />
|
||||
<Value name="IZSEQ_UNBAN" desc="零序电流不平衡" type="6" DO="MSQI0$MX$ImbZroA" DA="mag$f" Coefficient="1" />
|
||||
<Value name="IPSEQ" desc="正序电流" type="6" DO="MSQI0$MX$SeqA" DA="c1$cVal$mag$f" Coefficient="1" />
|
||||
</Sequence>
|
||||
</Item>
|
||||
<Item name="PQ" desc="功率" type="4" >
|
||||
<!--功率PQ部分(A-C相)-->
|
||||
<Sequence name="SEQ" value="7" desc="相别(A-C相)" type="5">
|
||||
<Value name="PF" desc="功率因数" type="6" DO="MMXU0$MX$PF" DA="phs*$cVal$mag$f" Coefficient="1" />
|
||||
<Value name="DF" desc="基波功率因数" type="6" DO="MMXU0$MX$DF" DA="phs*$cVal$mag$f" Coefficient="1" />
|
||||
<Value name="P_FUND" desc="基波有功功率" type="6" DO="MHAI0$MX$HW" DA="phs*Har[0]$mag$f" Coefficient="1" />
|
||||
<Value name="S" desc="视在功率" type="6" DO="MMXU0$MX$VA" DA="phs*$cVal$mag$f" Coefficient="1" />
|
||||
<Value name="Q" desc="无功功率" type="6" DO="MMXU0$MX$VAr" DA="phs*$cVal$mag$f" Coefficient="1" />
|
||||
<Value name="P" desc="有功功率" type="6" DO="MMXU0$MX$W" DA="phs*$cVal$mag$f" Coefficient="1" />
|
||||
</Sequence>
|
||||
<!--功率PQ部分(T相)-->
|
||||
<Sequence name="SEQ" value="8" desc="相别(T相)" type="5">
|
||||
<Value name="PF" desc="功率因数" type="6" DO="MMXU0$MX$TotPF" DA="mag$f" Coefficient="1" />
|
||||
<Value name="DF" desc="基波功率因数" type="6" DO="MMXU0$MX$TotDF" DA="mag$f" Coefficient="1" />
|
||||
<Value name="S" desc="视在功率" type="6" DO="MMXU0$MX$TotVA" DA="mag$f" Coefficient="1" />
|
||||
<Value name="Q" desc="无功功率" type="6" DO="MMXU0$MX$TotVAr" DA="mag$f" Coefficient="1" />
|
||||
<Value name="P" desc="有功功率" type="6" DO="MMXU0$MX$TotW" DA="mag$f" Coefficient="1" />
|
||||
</Sequence>
|
||||
</Item>
|
||||
</Monitor>
|
||||
</DataType>
|
||||
<DataType name="DATA_TYPE" value="02" desc="实时闪变数据" send="0" type="0">
|
||||
<Monitor name="MONITOR" desc="监测点" type="1">
|
||||
<Item name="TIME" desc="发生时刻" type="3" />
|
||||
<Item name="F" desc="闪变" type="4" >
|
||||
<Sequence name="SEQ" value="7" desc="相别" type="5" >
|
||||
<Value name="SF" desc="短时闪变" type="6" DO="MFLK0$MX$PhPst||MFLK0$MX$PPPst" DA="phs*$cVal$mag$f||phs##$cVal$mag$f" Coefficient="1" PltFlag="False" />
|
||||
<Value name="LF" desc="长时闪变" type="6" DO="MFLK0$MX$PhPlt||MFLK0$MX$PPPlt" DA="phs*$cVal$mag$f||phs##$cVal$mag$f" Coefficient="1" PltFlag="True" />
|
||||
</Sequence>
|
||||
</Item>
|
||||
</Monitor>
|
||||
</DataType>
|
||||
<DataType name="DATA_TYPE" value="03" desc="实时暂态事件" send="0" type="0" >
|
||||
<Monitor name="MONITOR" desc="监测点" type="1" >
|
||||
<Item name="VOLTAGE" desc="暂态指标" type="4" >
|
||||
<Sequence name="SEQ" value="-" desc="相别" type="5">
|
||||
<Value name="MAG" desc="残余电压" type="6" DO="QVVR0$MX$VVa" DA="mag$f" Coefficient="1" />
|
||||
<Value name="DUR" desc="持续时间" type="6" DO="QVVR0$MX$VVaTm" DA="mag$f" Coefficient="1" />
|
||||
<!--Value name="STARTTIME" desc="开始时间" type="6" DO="" DA="" Coefficient="1" />
|
||||
<Value name="ENDTIME" desc="结束时间" type="6" DO="" DA="" Coefficient="1" />
|
||||
<Value name="DISKIND" desc="暂降类型" type="6" DO="" DA="" Coefficient="1" />
|
||||
<Value name="WAVEFILE" desc="波形文件名称" type="6" DO="" DA="" Coefficient="1" /-->
|
||||
</Sequence>
|
||||
</Item>
|
||||
</Monitor>
|
||||
</DataType>
|
||||
</Topic>
|
||||
<Topic name="RTDATASOE" desc="实时SOE事件">
|
||||
<DataType name="DATA_TYPE" value="01" desc="稳态SOE事件" type="0" >
|
||||
<SOE desc="频率偏差越上限" type="9" DO="GGIO0$ST$Alm1" DA="stVal" TriggerFlag="Alm1" />
|
||||
<SOE desc="频率偏差越下限" type="9" DO="GGIO0$ST$Alm2" DA="stVal" TriggerFlag="Alm2" />
|
||||
<SOE desc="电压偏差越上限" type="9" DO="GGIO0$ST$Alm3" DA="stVal" TriggerFlag="Alm3" />
|
||||
<SOE desc="电压偏差越下限" type="9" DO="GGIO0$ST$Alm4" DA="stVal" TriggerFlag="Alm4" />
|
||||
<SOE desc="短时闪变越限" type="9" DO="GGIO0$ST$Alm5" DA="stVal" TriggerFlag="Alm5" />
|
||||
<SOE desc="长时闪变越限" type="9" DO="GGIO0$ST$Alm6" DA="stVal" TriggerFlag="Alm6" />
|
||||
<SOE desc="电压波动越限" type="9" DO="GGIO0$ST$Alm7" DA="stVal" TriggerFlag="Alm7" />
|
||||
<SOE desc="电压负序不平衡度越限" type="9" DO="GGIO0$ST$Alm8" DA="stVal" TriggerFlag="Alm8" />
|
||||
<SOE desc="电压总谐波畸变率越限" type="9" DO="GGIO0$ST$Alm9" DA="stVal" TriggerFlag="Alm9" />
|
||||
<SOE desc="2次谐波电压越限" type="9" DO="GGIO0$ST$Alm10" DA="stVal" TriggerFlag="Alm10" />
|
||||
<SOE desc="3次谐波电压越限" type="9" DO="GGIO0$ST$Alm11" DA="stVal" TriggerFlag="Alm11" />
|
||||
<SOE desc="4次谐波电压越限" type="9" DO="GGIO0$ST$Alm12" DA="stVal" TriggerFlag="Alm12" />
|
||||
<SOE desc="5次谐波电压越限" type="9" DO="GGIO0$ST$Alm13" DA="stVal" TriggerFlag="Alm13" />
|
||||
<SOE desc="6次谐波电压越限" type="9" DO="GGIO0$ST$Alm14" DA="stVal" TriggerFlag="Alm14" />
|
||||
<SOE desc="7次谐波电压越限" type="9" DO="GGIO0$ST$Alm15" DA="stVal" TriggerFlag="Alm15" />
|
||||
<SOE desc="8次谐波电压越限" type="9" DO="GGIO0$ST$Alm16" DA="stVal" TriggerFlag="Alm16" />
|
||||
<SOE desc="9次谐波电压越限" type="9" DO="GGIO0$ST$Alm17" DA="stVal" TriggerFlag="Alm17" />
|
||||
<SOE desc="10次谐波电压越限" type="9" DO="GGIO0$ST$Alm18" DA="stVal" TriggerFlag="Alm18" />
|
||||
<SOE desc="11次谐波电压越限" type="9" DO="GGIO0$ST$Alm19" DA="stVal" TriggerFlag="Alm19" />
|
||||
<SOE desc="12次谐波电压越限" type="9" DO="GGIO0$ST$Alm20" DA="stVal" TriggerFlag="Alm20" />
|
||||
<SOE desc="13次谐波电压越限" type="9" DO="GGIO0$ST$Alm21" DA="stVal" TriggerFlag="Alm21" />
|
||||
<SOE desc="14次谐波电压越限" type="9" DO="GGIO0$ST$Alm22" DA="stVal" TriggerFlag="Alm22" />
|
||||
<SOE desc="15次谐波电压越限" type="9" DO="GGIO0$ST$Alm23" DA="stVal" TriggerFlag="Alm23" />
|
||||
<SOE desc="16次谐波电压越限" type="9" DO="GGIO0$ST$Alm24" DA="stVal" TriggerFlag="Alm24" />
|
||||
<SOE desc="17次谐波电压越限" type="9" DO="GGIO0$ST$Alm25" DA="stVal" TriggerFlag="Alm25" />
|
||||
<SOE desc="18次谐波电压越限" type="9" DO="GGIO0$ST$Alm26" DA="stVal" TriggerFlag="Alm26" />
|
||||
<SOE desc="19次谐波电压越限" type="9" DO="GGIO0$ST$Alm27" DA="stVal" TriggerFlag="Alm27" />
|
||||
<SOE desc="20次谐波电压越限" type="9" DO="GGIO0$ST$Alm28" DA="stVal" TriggerFlag="Alm28" />
|
||||
<SOE desc="21次谐波电压越限" type="9" DO="GGIO0$ST$Alm29" DA="stVal" TriggerFlag="Alm29" />
|
||||
<SOE desc="22次谐波电压越限" type="9" DO="GGIO0$ST$Alm30" DA="stVal" TriggerFlag="Alm30" />
|
||||
<SOE desc="23次谐波电压越限" type="9" DO="GGIO0$ST$Alm31" DA="stVal" TriggerFlag="Alm31" />
|
||||
<SOE desc="24次谐波电压越限" type="9" DO="GGIO0$ST$Alm32" DA="stVal" TriggerFlag="Alm32" />
|
||||
<SOE desc="25次谐波电压越限" type="9" DO="GGIO0$ST$Alm33" DA="stVal" TriggerFlag="Alm33" />
|
||||
<SOE desc="26次谐波电压越限" type="9" DO="GGIO0$ST$Alm34" DA="stVal" TriggerFlag="Alm34" />
|
||||
<SOE desc="27次谐波电压越限" type="9" DO="GGIO0$ST$Alm35" DA="stVal" TriggerFlag="Alm35" />
|
||||
<SOE desc="28次谐波电压越限" type="9" DO="GGIO0$ST$Alm36" DA="stVal" TriggerFlag="Alm36" />
|
||||
<SOE desc="29次谐波电压越限" type="9" DO="GGIO0$ST$Alm37" DA="stVal" TriggerFlag="Alm37" />
|
||||
<SOE desc="30次谐波电压越限" type="9" DO="GGIO0$ST$Alm38" DA="stVal" TriggerFlag="Alm38" />
|
||||
<SOE desc="31次谐波电压越限" type="9" DO="GGIO0$ST$Alm39" DA="stVal" TriggerFlag="Alm39" />
|
||||
<SOE desc="32次谐波电压越限" type="9" DO="GGIO0$ST$Alm40" DA="stVal" TriggerFlag="Alm40" />
|
||||
<SOE desc="33次谐波电压越限" type="9" DO="GGIO0$ST$Alm41" DA="stVal" TriggerFlag="Alm41" />
|
||||
<SOE desc="34次谐波电压越限" type="9" DO="GGIO0$ST$Alm42" DA="stVal" TriggerFlag="Alm42" />
|
||||
<SOE desc="35次谐波电压越限" type="9" DO="GGIO0$ST$Alm43" DA="stVal" TriggerFlag="Alm43" />
|
||||
<SOE desc="36次谐波电压越限" type="9" DO="GGIO0$ST$Alm44" DA="stVal" TriggerFlag="Alm44" />
|
||||
<SOE desc="37次谐波电压越限" type="9" DO="GGIO0$ST$Alm45" DA="stVal" TriggerFlag="Alm45" />
|
||||
<SOE desc="38次谐波电压越限" type="9" DO="GGIO0$ST$Alm46" DA="stVal" TriggerFlag="Alm46" />
|
||||
<SOE desc="39次谐波电压越限" type="9" DO="GGIO0$ST$Alm47" DA="stVal" TriggerFlag="Alm47" />
|
||||
<SOE desc="40次谐波电压越限" type="9" DO="GGIO0$ST$Alm48" DA="stVal" TriggerFlag="Alm48" />
|
||||
<SOE desc="41次谐波电压越限" type="9" DO="GGIO0$ST$Alm49" DA="stVal" TriggerFlag="Alm49" />
|
||||
<SOE desc="42次谐波电压越限" type="9" DO="GGIO0$ST$Alm50" DA="stVal" TriggerFlag="Alm50" />
|
||||
<SOE desc="43次谐波电压越限" type="9" DO="GGIO0$ST$Alm51" DA="stVal" TriggerFlag="Alm51" />
|
||||
<SOE desc="44次谐波电压越限" type="9" DO="GGIO0$ST$Alm52" DA="stVal" TriggerFlag="Alm52" />
|
||||
<SOE desc="45次谐波电压越限" type="9" DO="GGIO0$ST$Alm53" DA="stVal" TriggerFlag="Alm53" />
|
||||
<SOE desc="46次谐波电压越限" type="9" DO="GGIO0$ST$Alm54" DA="stVal" TriggerFlag="Alm54" />
|
||||
<SOE desc="47次谐波电压越限" type="9" DO="GGIO0$ST$Alm55" DA="stVal" TriggerFlag="Alm55" />
|
||||
<SOE desc="48次谐波电压越限" type="9" DO="GGIO0$ST$Alm56" DA="stVal" TriggerFlag="Alm56" />
|
||||
<SOE desc="49次谐波电压越限" type="9" DO="GGIO0$ST$Alm57" DA="stVal" TriggerFlag="Alm57" />
|
||||
<SOE desc="50次谐波电压越限" type="9" DO="GGIO0$ST$Alm58" DA="stVal" TriggerFlag="Alm58" />
|
||||
<SOE desc="2次谐波电流越限" type="9" DO="GGIO0$ST$Alm59" DA="stVal" TriggerFlag="Alm59" />
|
||||
<SOE desc="3次谐波电流越限" type="9" DO="GGIO0$ST$Alm60" DA="stVal" TriggerFlag="Alm60" />
|
||||
<SOE desc="4次谐波电流越限" type="9" DO="GGIO0$ST$Alm61" DA="stVal" TriggerFlag="Alm61" />
|
||||
<SOE desc="5次谐波电流越限" type="9" DO="GGIO0$ST$Alm62" DA="stVal" TriggerFlag="Alm62" />
|
||||
<SOE desc="6次谐波电流越限" type="9" DO="GGIO0$ST$Alm63" DA="stVal" TriggerFlag="Alm63" />
|
||||
<SOE desc="7次谐波电流越限" type="9" DO="GGIO0$ST$Alm64" DA="stVal" TriggerFlag="Alm64" />
|
||||
<SOE desc="8次谐波电流越限" type="9" DO="GGIO0$ST$Alm65" DA="stVal" TriggerFlag="Alm65" />
|
||||
<SOE desc="9次谐波电流越限" type="9" DO="GGIO0$ST$Alm66" DA="stVal" TriggerFlag="Alm66" />
|
||||
<SOE desc="10次谐波电流越限" type="9" DO="GGIO0$ST$Alm67" DA="stVal" TriggerFlag="Alm67" />
|
||||
<SOE desc="11次谐波电流越限" type="9" DO="GGIO0$ST$Alm68" DA="stVal" TriggerFlag="Alm68" />
|
||||
<SOE desc="12次谐波电流越限" type="9" DO="GGIO0$ST$Alm69" DA="stVal" TriggerFlag="Alm69" />
|
||||
<SOE desc="13次谐波电流越限" type="9" DO="GGIO0$ST$Alm70" DA="stVal" TriggerFlag="Alm70" />
|
||||
<SOE desc="14次谐波电流越限" type="9" DO="GGIO0$ST$Alm71" DA="stVal" TriggerFlag="Alm71" />
|
||||
<SOE desc="15次谐波电流越限" type="9" DO="GGIO0$ST$Alm72" DA="stVal" TriggerFlag="Alm72" />
|
||||
<SOE desc="16次谐波电流越限" type="9" DO="GGIO0$ST$Alm73" DA="stVal" TriggerFlag="Alm73" />
|
||||
<SOE desc="17次谐波电流越限" type="9" DO="GGIO0$ST$Alm74" DA="stVal" TriggerFlag="Alm74" />
|
||||
<SOE desc="18次谐波电流越限" type="9" DO="GGIO0$ST$Alm75" DA="stVal" TriggerFlag="Alm75" />
|
||||
<SOE desc="19次谐波电流越限" type="9" DO="GGIO0$ST$Alm76" DA="stVal" TriggerFlag="Alm76" />
|
||||
<SOE desc="20次谐波电流越限" type="9" DO="GGIO0$ST$Alm77" DA="stVal" TriggerFlag="Alm77" />
|
||||
<SOE desc="21次谐波电流越限" type="9" DO="GGIO0$ST$Alm78" DA="stVal" TriggerFlag="Alm78" />
|
||||
<SOE desc="22次谐波电流越限" type="9" DO="GGIO0$ST$Alm79" DA="stVal" TriggerFlag="Alm79" />
|
||||
<SOE desc="23次谐波电流越限" type="9" DO="GGIO0$ST$Alm80" DA="stVal" TriggerFlag="Alm80" />
|
||||
<SOE desc="24次谐波电流越限" type="9" DO="GGIO0$ST$Alm81" DA="stVal" TriggerFlag="Alm81" />
|
||||
<SOE desc="25次谐波电流越限" type="9" DO="GGIO0$ST$Alm82" DA="stVal" TriggerFlag="Alm82" />
|
||||
<SOE desc="26次谐波电流越限" type="9" DO="GGIO0$ST$Alm83" DA="stVal" TriggerFlag="Alm83" />
|
||||
<SOE desc="27次谐波电流越限" type="9" DO="GGIO0$ST$Alm84" DA="stVal" TriggerFlag="Alm84" />
|
||||
<SOE desc="28次谐波电流越限" type="9" DO="GGIO0$ST$Alm85" DA="stVal" TriggerFlag="Alm85" />
|
||||
<SOE desc="29次谐波电流越限" type="9" DO="GGIO0$ST$Alm86" DA="stVal" TriggerFlag="Alm86" />
|
||||
<SOE desc="30次谐波电流越限" type="9" DO="GGIO0$ST$Alm87" DA="stVal" TriggerFlag="Alm87" />
|
||||
<SOE desc="31次谐波电流越限" type="9" DO="GGIO0$ST$Alm88" DA="stVal" TriggerFlag="Alm88" />
|
||||
<SOE desc="32次谐波电流越限" type="9" DO="GGIO0$ST$Alm89" DA="stVal" TriggerFlag="Alm89" />
|
||||
<SOE desc="33次谐波电流越限" type="9" DO="GGIO0$ST$Alm90" DA="stVal" TriggerFlag="Alm90" />
|
||||
<SOE desc="34次谐波电流越限" type="9" DO="GGIO0$ST$Alm91" DA="stVal" TriggerFlag="Alm91" />
|
||||
<SOE desc="35次谐波电流越限" type="9" DO="GGIO0$ST$Alm92" DA="stVal" TriggerFlag="Alm92" />
|
||||
<SOE desc="36次谐波电流越限" type="9" DO="GGIO0$ST$Alm93" DA="stVal" TriggerFlag="Alm93" />
|
||||
<SOE desc="37次谐波电流越限" type="9" DO="GGIO0$ST$Alm94" DA="stVal" TriggerFlag="Alm94" />
|
||||
<SOE desc="38次谐波电流越限" type="9" DO="GGIO0$ST$Alm95" DA="stVal" TriggerFlag="Alm95" />
|
||||
<SOE desc="39次谐波电流越限" type="9" DO="GGIO0$ST$Alm96" DA="stVal" TriggerFlag="Alm96" />
|
||||
<SOE desc="40次谐波电流越限" type="9" DO="GGIO0$ST$Alm97" DA="stVal" TriggerFlag="Alm97" />
|
||||
<SOE desc="41次谐波电流越限" type="9" DO="GGIO0$ST$Alm98" DA="stVal" TriggerFlag="Alm98" />
|
||||
<SOE desc="42次谐波电流越限" type="9" DO="GGIO0$ST$Alm99" DA="stVal" TriggerFlag="Alm99" />
|
||||
<SOE desc="43次谐波电流越限" type="9" DO="GGIO0$ST$Alm100" DA="stVal" TriggerFlag="Alm100" />
|
||||
<SOE desc="44次谐波电流越限" type="9" DO="GGIO0$ST$Alm101" DA="stVal" TriggerFlag="Alm101" />
|
||||
<SOE desc="45次谐波电流越限" type="9" DO="GGIO0$ST$Alm102" DA="stVal" TriggerFlag="Alm102" />
|
||||
<SOE desc="46次谐波电流越限" type="9" DO="GGIO0$ST$Alm103" DA="stVal" TriggerFlag="Alm103" />
|
||||
<SOE desc="47次谐波电流越限" type="9" DO="GGIO0$ST$Alm104" DA="stVal" TriggerFlag="Alm104" />
|
||||
<SOE desc="48次谐波电流越限" type="9" DO="GGIO0$ST$Alm105" DA="stVal" TriggerFlag="Alm105" />
|
||||
<SOE desc="49次谐波电流越限" type="9" DO="GGIO0$ST$Alm106" DA="stVal" TriggerFlag="Alm106" />
|
||||
<SOE desc="50次谐波电流越限" type="9" DO="GGIO0$ST$Alm107" DA="stVal" TriggerFlag="Alm107" />
|
||||
<SOE desc="电压越上限(自定义触发)" type="9" DO="GGIO0$ST$Alm108" DA="stVal" TriggerFlag="Alm108" />
|
||||
<SOE desc="电压越下限(自定义触发)" type="9" DO="GGIO0$ST$Alm109" DA="stVal" TriggerFlag="Alm109" />
|
||||
<SOE desc="电流越上限(自定义触发)" type="9" DO="GGIO0$ST$Alm110" DA="stVal" TriggerFlag="Alm110" />
|
||||
<SOE desc="电流越下限(自定义触发)" type="9" DO="GGIO0$ST$Alm111" DA="stVal" TriggerFlag="Alm111" />
|
||||
<SOE desc="电压变化量越限(自定义触发)" type="9" DO="GGIO0$ST$Alm112" DA="stVal" TriggerFlag="Alm112" />
|
||||
<SOE desc="电流变化量越限(自定义触发)" type="9" DO="GGIO0$ST$Alm113" DA="stVal" TriggerFlag="Alm113" />
|
||||
</DataType>
|
||||
<DataType name="DATA_TYPE" value="02" desc="暂态SOE事件" type="0" >
|
||||
</DataType>
|
||||
<DataType name="DATA_TYPE" value="03" desc="状态SOE事件" type="0" >
|
||||
<SOE desc="终端工作电源上电" type="9" DO="LPHD0$ST$PwrUp" DA="stVal" TriggerFlag="PwrUp" />
|
||||
<SOE desc="终端工作电源掉电" type="9" DO="GGIO0$ST$PwrDn" DA="stVal" TriggerFlag="PwrDn" />
|
||||
</DataType>
|
||||
</Topic>
|
||||
<Topic name="SOEDATA" desc="告警SOE">
|
||||
<SOE name="ThdVVal" desc="电压总畸变率越限告警" type="9" DO="GGIO0$ST$Alm9" DA="stVal" />
|
||||
<SOE name="ThdAVal" desc="电流总畸变率越限告警" type="9" DO="" DA="" />
|
||||
<SOE name="HToddVVal" desc="奇次谐波电压含有率越限告警" type="9" DO="" DA="" />
|
||||
<SOE name="HTeddVVal" desc="偶次谐波电压含有率越限告警" type="9" DO="" DA="" />
|
||||
<SOE name="H2AVal" desc="2次谐波电流越限告警" type="9" DO="GGIO0$ST$Alm59" DA="stVal" />
|
||||
<SOE name="H3AVal" desc="3次谐波电流越限告警" type="9" DO="GGIO0$ST$Alm60" DA="stVal" />
|
||||
<SOE name="H4AVal" desc="4次谐波电流越限告警" type="9" DO="GGIO0$ST$Alm61" DA="stVal" />
|
||||
<SOE name="H5AVal" desc="5次谐波电流越限告警" type="9" DO="GGIO0$ST$Alm62" DA="stVal" />
|
||||
<SOE name="H7AVal" desc="7次谐波电流越限告警" type="9" DO="GGIO0$ST$Alm64" DA="stVal" />
|
||||
<SOE name="H9AVal" desc="9次谐波电流越限告警" type="9" DO="GGIO0$ST$Alm66" DA="stVal" />
|
||||
<SOE name="H11AVal" desc="11次谐波电流越限告警" type="9" DO="GGIO0$ST$Alm68" DA="stVal" />
|
||||
<SOE name="H13AVal" desc="13次谐波电流越限告警" type="9" DO="GGIO0$ST$Alm70" DA="" />
|
||||
<SOE name="ImbNgVFVal" desc="电压负序不平衡度越限告警" type="9" DO="GGIO0$ST$Alm8" DA="stVal" />
|
||||
<SOE name="ImbNgAFVal" desc="电流负序不平衡度越限告警" type="9" DO="" DA="" />
|
||||
<SOE name="OvHzStrVal" desc="频率高越限告警" type="9" DO="GGIO0$ST$Alm1" DA="stVal" />
|
||||
<SOE name="UnHzStrVal" desc="频率低越限告警" type="9" DO="GGIO0$ST$Alm2" DA="" />
|
||||
<SOE name="LRVInterrup" desc="长期电压中断告警" type="9" DO="" DA="" />
|
||||
<SOE name="LRVSwell" desc="电压上偏差越限告警" type="9" DO="GGIO0$ST$Alm3" DA="stVal" />
|
||||
<SOE name="LRVSag" desc="电压下偏差越限告警" type="9" DO="GGIO0$ST$Alm4" DA="stVal" />
|
||||
<SOE name="PhPstVal" desc="短时闪变越限告警" type="9" DO="GGIO0$ST$Alm5" DA="stVal" />
|
||||
<SOE name="PhPltVal" desc="长时闪变越限告警" type="9" DO="GGIO0$ST$Alm6" DA="stVal" />
|
||||
<SOE name="PhyStateFault" desc="终端运行状态:故障" type="9" DO="" DA="" />
|
||||
<SOE name="PhyStateRun" desc="终端运行状态:运行" type="9" DO="" DA="" />
|
||||
<SOE name="PwrUp" desc="终端上电" type="9" DO="" DA="" />
|
||||
<SOE name="PwrDn" desc="终端掉电" type="9" DO="" DA="" />
|
||||
<SOE name="CommInterrupt" desc="终端通信中断" type="9" DO="" DA="" />
|
||||
<SOE name="CommResume" desc="终端通信恢复" type="9" DO="" DA="" />
|
||||
</Topic>
|
||||
</JSConfigTemplate>
|
||||
6
LFtid1056/etc/runtime.cf
Normal file
6
LFtid1056/etc/runtime.cf
Normal file
@@ -0,0 +1,6 @@
|
||||
# 文件名:runtime.cf
|
||||
# 执行程序路径 ^ 可执行程序名 启动参数 ^ 重启特有参数 ^ 首次启动特有参数 ^ 程序首次启动前的延时秒数 ^ 重启是否忽略 ^ 首次启动是否忽略
|
||||
/FeProject/bin/ ^ cloud-front-test -s 3_3^ ^ ^ 1 ^ ^
|
||||
/FeProject/bin/ ^ cloud-front-test -s 2_3^ ^ ^ 1 ^ ^
|
||||
/FeProject/bin/ ^ cloud-front-test -s 1_3^ ^ ^ 1 ^ ^
|
||||
/FeProject/bin/ ^ fe_watchdog -m 18192 ^ ^ ^ 1 ^ IGNORE_RESTART ^
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user