fix ledger update
This commit is contained in:
@@ -3935,6 +3935,7 @@ int parse_rpt_log_ini()
|
||||
LD_info = &(ied_usr->LD_info[cpuno]);
|
||||
char str[256]; //256<35><36>С
|
||||
char* tmp = Get_IED(ied_usr->dev_type);
|
||||
if(tmp == NULL){std::cerr << "front read ied config error!" << std::endl;continue;}
|
||||
qDebug() << tmp << endl;
|
||||
|
||||
apr_snprintf(str, sizeof(str), tmp, cpuno + 1);
|
||||
@@ -3966,6 +3967,7 @@ int parse_rpt_log_ini()
|
||||
for (int i = 0; i < log_cfg_strlists[type]->size(); ++i) {
|
||||
apr_snprintf(buf, sizeof(buf), "%s", log_cfg_strlists[type]->at(i).toAscii().constData());
|
||||
char* tmp = Get_LDevice(ied_usr->dev_type);
|
||||
if(tmp == NULL){std::cerr << "front read monitor config error!" << std::endl;continue;}
|
||||
fill_logctrl_by_cfg(LD_info, i, buf, tmp);
|
||||
delete[] tmp;
|
||||
}
|
||||
@@ -11758,13 +11760,29 @@ void printLedgerinshell(const ied_usr_t& ied_usr, QIODevice* outputDevice) {
|
||||
//recall
|
||||
outputDevice->write("\r\x1B[K");outputDevice->write(" |-- autorecallflag: " + QByteArray::number(ied_usr.LD_info[i].autorecallflag) + "\n");
|
||||
outputDevice->write("\r\x1B[K");outputDevice->write(" |-- autorecallcount: " + QByteArray::number(ied_usr.LD_info[i].autorecallcount) + "\n");
|
||||
for (int j = 0; j < ied_usr.LD_info[i].autorecallcount && ied_usr.LD_info->autorecall[j] != NULL; j++){
|
||||
outputDevice->write("\r\x1B[K");outputDevice->write(" |-- autorecall_t[" + QByteArray::number(j) + "]:\n");
|
||||
outputDevice->write("\r\x1B[K");outputDevice->write(" |-- start_time: " + QByteArray::number(ied_usr.LD_info->autorecall[j]->start) + "\n");
|
||||
outputDevice->write("\r\x1B[K");outputDevice->write(" |-- end_time: " + QByteArray::number(ied_usr.LD_info->autorecall[j]->end) + "\n");
|
||||
outputDevice->write("\r\x1B[K");outputDevice->write(" |-- need_steady: " + QByteArray::number(ied_usr.LD_info->autorecall[j]->need_steady) + "\n");
|
||||
outputDevice->write("\r\x1B[K");outputDevice->write(" |-- need_voltage: " + QByteArray::number(ied_usr.LD_info->autorecall[j]->need_voltage) + "\n");
|
||||
}
|
||||
for (int j = 0;
|
||||
j < ied_usr.LD_info[i].autorecallcount &&
|
||||
ied_usr.LD_info[i].autorecall != NULL && // <20><><EFBFBD><EFBFBD> LD_info->autorecall <20><><EFBFBD><EFBFBD>
|
||||
ied_usr.LD_info[i].autorecall[j] != NULL;
|
||||
j++)
|
||||
{
|
||||
outputDevice->write("\r\x1B[K");
|
||||
outputDevice->write(" |-- autorecall_t[" + QByteArray::number(j) + "]:\n");
|
||||
|
||||
if (ied_usr.LD_info[i].autorecall[j] == NULL) {
|
||||
outputDevice->write(" |-- [Error] autorecall[j] is NULL\n");
|
||||
continue; // <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> NULL ָ<><D6B8>
|
||||
}
|
||||
|
||||
outputDevice->write("\r\x1B[K");
|
||||
outputDevice->write(" |-- start_time: " + QByteArray::number(ied_usr.LD_info[i].autorecall[j]->start) + "\n");
|
||||
outputDevice->write("\r\x1B[K");
|
||||
outputDevice->write(" |-- end_time: " + QByteArray::number(ied_usr.LD_info[i].autorecall[j]->end) + "\n");
|
||||
outputDevice->write("\r\x1B[K");
|
||||
outputDevice->write(" |-- need_steady: " + QByteArray::number(ied_usr.LD_info[i].autorecall[j]->need_steady) + "\n");
|
||||
outputDevice->write("\r\x1B[K");
|
||||
outputDevice->write(" |-- need_voltage: " + QByteArray::number(ied_usr.LD_info[i].autorecall[j]->need_voltage) + "\n");
|
||||
}
|
||||
// rpt
|
||||
outputDevice->write("\r\x1B[K");outputDevice->write(" |-- rptRecvFlag: " + QByteArray::number(ied_usr.LD_info[i].rptRecvFlag) + "\n");
|
||||
outputDevice->write("\r\x1B[K");outputDevice->write(" |-- rptRecvCheckFlag: " + QByteArray::number(ied_usr.LD_info[i].rptRecvCheckFlag) + "\n");
|
||||
@@ -14746,6 +14764,7 @@ int parse_rpt_log_ini_one(ied_t* ied)
|
||||
//<2F><>Щ<EFBFBD><D0A9><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>е<EFBFBD><D0B5>ڴ棬<DAB4><E6A3AC><EFBFBD><EFBFBD><EFBFBD>жϲ<D0B6><CFB2>ܴ<EFBFBD>g_init_pool<6F>з<EFBFBD><D0B7><EFBFBD><EFBFBD>ڴ棬lnk20250122
|
||||
char str[256];
|
||||
char* tmp = Get_IED(ied_usr->dev_type);
|
||||
if(tmp == NULL){std::cerr << "front read ied config error!" << std::endl;continue;}
|
||||
qDebug() << tmp << endl;
|
||||
apr_snprintf(str, sizeof(str), tmp, cpuno + 1);
|
||||
//ied_usr->LD_info[cpuno].LD_name = apr_pstrdup(g_init_pool, str);//lnk20250122
|
||||
@@ -14801,6 +14820,7 @@ int parse_rpt_log_ini_one(ied_t* ied)
|
||||
for (int i = 0; i < log_cfg_strlists[type]->size(); ++i) {
|
||||
apr_snprintf(buf, sizeof(buf), "%s", log_cfg_strlists[type]->at(i).toAscii().constData());
|
||||
char* tmp = Get_LDevice(ied_usr->dev_type);
|
||||
if(tmp == NULL){std::cerr << "front read monitor config error!" << std::endl;continue;}
|
||||
fill_logctrl_by_cfg(LD_info, i, buf, tmp);
|
||||
delete[] tmp;
|
||||
}
|
||||
|
||||
@@ -3820,9 +3820,13 @@ char* Get_xmlpath(char* devtype)
|
||||
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>lnk20241125
|
||||
std::cout << type.toStdString() << std::endl;
|
||||
|
||||
if (xmlinfo_list.contains(type)) {
|
||||
if (xmlinfo_list.contains(devtype) &&
|
||||
xmlinfo_list[devtype] != NULL && // <20>ȼ<EFBFBD><C8BC><EFBFBD>ָ<EFBFBD><D6B8><EFBFBD>Ƿ<EFBFBD>Ϊ<EFBFBD><CEAA>
|
||||
!xmlinfo_list[devtype]->xmlbase.MODEL_ID.isNull() && // ȷ<><C8B7> QString <20><><EFBFBD><EFBFBD> NULL
|
||||
!xmlinfo_list[devtype]->xmlbase.MODEL_ID.isEmpty() && // ȷ<><C8B7><EFBFBD>ַ<EFBFBD><D6B7><EFBFBD><EFBFBD><EFBFBD>Ϊ<EFBFBD><CEAA>
|
||||
xmlinfo_list[devtype]->xmlbase.MODEL_ID.trimmed().length() >= 4) { //ȷ<><C8B7>modelid<69><64><EFBFBD><EFBFBD>lnk20250313
|
||||
cout << "!!!!!!!!!! xmlinfo_list.contains(devtype) == 1 !!!!!!!!!!!" << endl;
|
||||
QByteArray byteArray = xmlinfo_list[devtype]->xmlbase.MODEL_ID.toLocal8Bit();
|
||||
QByteArray byteArray = xmlinfo_list[devtype]->xmlbase.MODEL_ID.toLocal8Bit();//<2F>ױ<EFBFBD><D7B1><EFBFBD><EFBFBD><EFBFBD>,һ<><D2BB>Ҫȷ<D2AA><C8B7>modelid<69><64><EFBFBD><EFBFBD>lnk20250313
|
||||
char* charArray = new char[byteArray.size()+1];//<2F><><EFBFBD><EFBFBD><EFBFBD>ڴ<EFBFBD>ʱ+1<><31>ֹ<EFBFBD>ڴ<EFBFBD>й©lnk20250305
|
||||
memcpy(charArray, byteArray.data(), byteArray.size());
|
||||
charArray[byteArray.size()] = '\0';
|
||||
@@ -3838,18 +3842,39 @@ char* Get_IED(char* devtype)
|
||||
{
|
||||
QString type;
|
||||
type.append(devtype);
|
||||
if (xmlinfo_list.contains(type)) {
|
||||
if (xmlinfo_list.contains(type) && xmlinfo_list[type] != NULL) {
|
||||
cout << "!!!!!!!!!! Get_IED xmlinfo_list.contains(devtype) == 1 !!!!!!!!!!!" << endl;
|
||||
|
||||
// ȷ<><C8B7> xmlcfg <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ա<EFBFBD>ǿ<EFBFBD>
|
||||
if (xmlinfo_list[type]->xmlcfg.IEDname.isNull() || xmlinfo_list[type]->xmlcfg.LDevicePrefix.isNull()) {
|
||||
cout << "Error: IEDname or LDevicePrefix is NULL in Get_IED!" << endl;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
QString ied;
|
||||
ied.append(xmlinfo_list[devtype]->xmlcfg.IEDname);//PQMonitor
|
||||
ied.append(xmlinfo_list[devtype]->xmlcfg.LDevicePrefix);
|
||||
ied.append(xmlinfo_list[type]->xmlcfg.IEDname); // PQMonitor
|
||||
ied.append(xmlinfo_list[type]->xmlcfg.LDevicePrefix);
|
||||
ied.append("%d");
|
||||
|
||||
QByteArray byteArray = ied.toLocal8Bit();
|
||||
char* charArray = new char[byteArray.size()+1];//<2F><><EFBFBD><EFBFBD><EFBFBD>ڴ<EFBFBD>ʱ+1<><31>ֹ<EFBFBD>ڴ<EFBFBD>й©lnk20250305
|
||||
|
||||
if (byteArray.isEmpty()) {
|
||||
cout << "Error: Generated QByteArray is empty!" << endl;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
// <20><><EFBFBD><EFBFBD><EFBFBD>ڴ棬ȷ<E6A3AC><C8B7><EFBFBD>㹻<EFBFBD><E3B9BB>С<EFBFBD><D0A1><EFBFBD><EFBFBD>ȫ<EFBFBD><C8AB><EFBFBD><EFBFBD>
|
||||
char* charArray = new char[byteArray.size() + 1];
|
||||
if (!charArray) {
|
||||
cout << "Error: Memory allocation failed!" << endl;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
memcpy(charArray, byteArray.data(), byteArray.size());
|
||||
charArray[byteArray.size()] = '\0';
|
||||
charArray[byteArray.size()] = '\0'; // ȷ<><C8B7><EFBFBD>ַ<EFBFBD><D6B7><EFBFBD><EFBFBD><EFBFBD> '\0' <20><>β
|
||||
|
||||
return charArray;
|
||||
}
|
||||
}
|
||||
else {
|
||||
cout << "!!!!!!!!!! Get_IED xmlinfo_list.contains(devtype) == 0 !!!!!!!!!!!" << endl;
|
||||
//cout << "ttttttttttttttt" << topicList.size() << endl;
|
||||
@@ -3869,14 +3894,33 @@ char* Get_LDevice(char* devtype)
|
||||
{
|
||||
QString type;
|
||||
type.append(devtype);
|
||||
if (xmlinfo_list.contains(type)) {//<2F><><EFBFBD><EFBFBD><EFBFBD>б<EFBFBD><EFBFBD>а<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ն<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
if (xmlinfo_list.contains(type) && xmlinfo_list[type] != NULL) { // ȷ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʹ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ҳ<EFBFBD>Ϊ<EFBFBD><EFBFBD>
|
||||
if (xmlinfo_list[type]->xmlcfg.LDevicePrefix.isNull() || xmlinfo_list[type]->xmlcfg.LDevicePrefix.isEmpty()) {
|
||||
cout << "Error: LDevicePrefix is NULL or empty in Get_IED!" << endl;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
QString ied;
|
||||
ied.append(xmlinfo_list[devtype]->xmlcfg.LDevicePrefix);//ʹ<>ý<EFBFBD><C3BD><EFBFBD><EFBFBD>б<EFBFBD><D0B1><EFBFBD><EFBFBD>ն<EFBFBD>ǰ
|
||||
ied.append(xmlinfo_list[type]->xmlcfg.LDevicePrefix); // ʹ<EFBFBD>ý<EFBFBD><EFBFBD><EFBFBD><EFBFBD>б<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ն<EFBFBD>ǰ
|
||||
ied.append("%d");
|
||||
|
||||
QByteArray byteArray = ied.toLocal8Bit();
|
||||
char* charArray = new char[byteArray.size()+1];//<2F><><EFBFBD><EFBFBD><EFBFBD>ڴ<EFBFBD>ʱ+1<><31>ֹ<EFBFBD>ڴ<EFBFBD>й©lnk20250305
|
||||
|
||||
if (byteArray.isEmpty()) {
|
||||
cout << "Error: Generated QByteArray is empty!" << endl;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
// <20><><EFBFBD><EFBFBD><EFBFBD>ڴ棬ȷ<E6A3AC><C8B7><EFBFBD>㹻<EFBFBD><E3B9BB>С
|
||||
char* charArray = new char[byteArray.size() + 1];
|
||||
if (!charArray) {
|
||||
cout << "Error: Memory allocation failed!" << endl;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
memcpy(charArray, byteArray.data(), byteArray.size());
|
||||
charArray[byteArray.size()] = '\0';
|
||||
charArray[byteArray.size()] = '\0'; // ȷ<><C8B7><EFBFBD>ַ<EFBFBD><D6B7><EFBFBD><EFBFBD><EFBFBD> '\0' <20><>β
|
||||
|
||||
return charArray;
|
||||
}
|
||||
else {
|
||||
|
||||
@@ -832,6 +832,23 @@ void check_3s_config()
|
||||
}
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
//lnk20250114<31><34><EFBFBD><EFBFBD>ʵʱ<CAB5><CAB1><EFBFBD>ݷ<EFBFBD><DDB7><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>̨<EFBFBD><CCA8><EFBFBD><EFBFBD>Ϣ
|
||||
int isValidModelId(const char* model_id) {
|
||||
size_t i;
|
||||
|
||||
if (model_id == NULL) return 0; // NULL <20><>Ч
|
||||
|
||||
size_t len = strlen(model_id);
|
||||
if (len < 4) return 0; // <20><><EFBFBD><EFBFBD> < 4 <20><>Ч
|
||||
|
||||
// <20><><EFBFBD><EFBFBD><EFBFBD>Ƿ<EFBFBD>ȫ<EFBFBD>ǿո<C7BF>
|
||||
for (i = 0; i < len; i++) {
|
||||
if (!isspace((unsigned char)model_id[i])) {
|
||||
return 1; // ֻҪ<D6BB><D2AA><EFBFBD><EFBFBD><EFBFBD>ǿո<C7BF><D5B8>ַ<EFBFBD><D6B7><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ǺϷ<C7BA><CFB7><EFBFBD>
|
||||
}
|
||||
}
|
||||
return 0; // <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ո<EFBFBD><D5B8><EFBFBD><EFBFBD><EFBFBD>Ч
|
||||
}
|
||||
|
||||
void process_ledger_update(trigger_update_xml_t *ledger_update_xml)
|
||||
{
|
||||
int i,j;
|
||||
@@ -969,17 +986,18 @@ void process_ledger_update(trigger_update_xml_t *ledger_update_xml)
|
||||
//3-д<><D0B4>̨<EFBFBD><CCA8><EFBFBD><EFBFBD><EFBFBD><EFBFBD>///////////////////////////////////
|
||||
|
||||
//4-<2D><><EFBFBD><EFBFBD>ӳ<EFBFBD><D3B3><EFBFBD>ļ<EFBFBD>//////////////////////////////
|
||||
char model[64] = {0};
|
||||
char model[64];
|
||||
// <20><>ȡģ<C8A1><C4A3>ID<49><44><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ƿ<C7B7> NULL
|
||||
char* model_id = parse_model_cfg_web_one(ied);//<2F>洢<EFBFBD><E6B4A2>/FeProject/dat/
|
||||
|
||||
if (model_id != NULL) {
|
||||
if (isValidModelId(model_id)) { //lnk20250313<31><33>ֹ<EFBFBD>ò<EFBFBD><C3B2><EFBFBD>ӳ<EFBFBD><D3B3><EFBFBD>ļ<EFBFBD>
|
||||
// <20><>ȫ<EFBFBD><C8AB><EFBFBD><EFBFBD><EFBFBD>ַ<EFBFBD><D6B7><EFBFBD><EFBFBD><EFBFBD> model <20><><EFBFBD><EFBFBD>
|
||||
strncpy(model, model_id, sizeof(model) - 1);
|
||||
model[sizeof(model) - 1] = '\0'; // ȷ<><C8B7><EFBFBD><EFBFBD> null <20><>β
|
||||
printf("ledger Model ID: %s\n", model);
|
||||
} else {
|
||||
printf("ledger No model ID found.\n");
|
||||
printf("ledger No model ID found.quit\n");
|
||||
return ;
|
||||
}
|
||||
char full_path[128];
|
||||
snprintf(full_path, sizeof(full_path), "/FeProject/dat/%s.xml", model); // ƴ<><C6B4>·<EFBFBD><C2B7>
|
||||
|
||||
Reference in New Issue
Block a user