Compare commits
15 Commits
6f7ee762ec
...
develop
| Author | SHA1 | Date | |
|---|---|---|---|
| c388bd04fe | |||
| c6ca57a204 | |||
| 2f584fda30 | |||
| 2f2e0d6430 | |||
| fc861024c3 | |||
| 3c98bf7eae | |||
| 073c98e89a | |||
| b1d8440e6a | |||
| b87da0f454 | |||
| 54c97ad103 | |||
| cf94a99cad | |||
| 1cde041e86 | |||
| fb55b76005 | |||
| 1b2dd863e9 | |||
| c78bc592a8 |
175
arm_pro/pt61850netd_pqfe.pro
Normal file
175
arm_pro/pt61850netd_pqfe.pro
Normal file
@@ -0,0 +1,175 @@
|
|||||||
|
TEMPLATE = app
|
||||||
|
TARGET = pt61850netd_pqfe
|
||||||
|
DEPENDPATH += .
|
||||||
|
|
||||||
|
INCLUDEPATH += . \
|
||||||
|
./source \
|
||||||
|
./source/include \
|
||||||
|
./source/include/mmslite \
|
||||||
|
./source/include/pg_inst \
|
||||||
|
./source/include/curl \
|
||||||
|
./source/include/oss_sdk \
|
||||||
|
./source/include/rocketmq
|
||||||
|
|
||||||
|
QMAKE_ORIG_TARGET = $$(TARGET)
|
||||||
|
|
||||||
|
QT += core xml network
|
||||||
|
CONFIG += thread
|
||||||
|
|
||||||
|
DEFINES += _CRT_SECURE_NO_WARNINGS
|
||||||
|
DEFINES += MMS_LITE LINUX=2 MOSI LEAN_T TP0_ENABLED
|
||||||
|
DEFINES += CLIENT _DEBUG _REENTRANT _GNU_SOURCE _LARGEFILE64_SOURCE
|
||||||
|
|
||||||
|
# debug/release flags
|
||||||
|
CONFIG(debug, debug|release) {
|
||||||
|
message("Building debug version with debug symbols")
|
||||||
|
QMAKE_CFLAGS_DEBUG += -g -O0
|
||||||
|
QMAKE_CXXFLAGS_DEBUG += -g -O0
|
||||||
|
CONFIG += force_debug_info
|
||||||
|
} else {
|
||||||
|
message("Building release version")
|
||||||
|
QMAKE_CFLAGS_RELEASE += -O2
|
||||||
|
QMAKE_CXXFLAGS_RELEASE += -O2
|
||||||
|
}
|
||||||
|
|
||||||
|
win32 {
|
||||||
|
DEFINES -= UNICODE
|
||||||
|
DEFINES += _AFXDLL
|
||||||
|
CONFIG += console
|
||||||
|
}
|
||||||
|
|
||||||
|
win32 {
|
||||||
|
# RC_FILE=pt61850netd_pqfe.rc
|
||||||
|
SOURCES += source/mms/event.c
|
||||||
|
INCLUDEPATH += ./source/include/apr
|
||||||
|
QMAKE_LFLAGS += /NODEFAULTLIB:libcmt.lib
|
||||||
|
LIBS += -L./lib -L./lib/mmslite -lws2_32
|
||||||
|
|
||||||
|
CONFIG(debug, debug|release) {
|
||||||
|
DEFINES += DEBUG_SISCO
|
||||||
|
MMS_LIB_SUFFIX = _ld.lib
|
||||||
|
QMAKE_POST_LINK = $$QMAKE_COPY debug\\*.exe ..\\..\\usr_bin\\jspqfe_home\\bin
|
||||||
|
} else {
|
||||||
|
MMS_LIB_SUFFIX = _n.lib
|
||||||
|
QMAKE_POST_LINK = $$QMAKE_COPY release\\*.exe ..\\..\\usr_bin\\jspqfe_home\\bin
|
||||||
|
}
|
||||||
|
|
||||||
|
LIBS += ositcps$$MMS_LIB_SUFFIX \
|
||||||
|
mvl$$MMS_LIB_SUFFIX \
|
||||||
|
mmsle$$MMS_LIB_SUFFIX \
|
||||||
|
mmsl$$MMS_LIB_SUFFIX \
|
||||||
|
asn1$$MMS_LIB_SUFFIX \
|
||||||
|
mem$$MMS_LIB_SUFFIX \
|
||||||
|
meml$$MMS_LIB_SUFFIX \
|
||||||
|
slog$$MMS_LIB_SUFFIX \
|
||||||
|
utility$$MMS_LIB_SUFFIX \
|
||||||
|
ssec0$$MMS_LIB_SUFFIX
|
||||||
|
|
||||||
|
LIBS += -llibapr-1 -llibaprutil-1 -llibjclite
|
||||||
|
}
|
||||||
|
|
||||||
|
unix {
|
||||||
|
# 清掉旧标准
|
||||||
|
QMAKE_CXXFLAGS -= -std=gnu++98
|
||||||
|
QMAKE_CXXFLAGS -= -std=c++98
|
||||||
|
QMAKE_CXXFLAGS -= -std=gnu++11
|
||||||
|
QMAKE_CXXFLAGS -= -std=c++11
|
||||||
|
|
||||||
|
# 只保留一个
|
||||||
|
QMAKE_CXXFLAGS += -std=gnu++14
|
||||||
|
|
||||||
|
include(fe_common.pri)
|
||||||
|
SOURCES += source/mms/event2.c
|
||||||
|
INCLUDEPATH += ./source/include/apr-linux
|
||||||
|
|
||||||
|
LIBS += -L/FeProject/lib
|
||||||
|
# LIBS += -L/FeProject/lib/pgodbc
|
||||||
|
|
||||||
|
DEFINES += DEBUG_SISCO
|
||||||
|
VERSION = 1.0.0
|
||||||
|
|
||||||
|
# rpath
|
||||||
|
QMAKE_LFLAGS += -Wl,-rpath,/FeProject/lib \
|
||||||
|
-Wl,-rpath,/FeProject/lib/mmslite
|
||||||
|
|
||||||
|
LIBS += -lrt -lpthread
|
||||||
|
|
||||||
|
MMS_LIB_SUFFIX = _ld.a
|
||||||
|
LIBS += /FeProject/lib/mmslite/ositcps$$MMS_LIB_SUFFIX \
|
||||||
|
/FeProject/lib/mmslite/mvl$$MMS_LIB_SUFFIX \
|
||||||
|
/FeProject/lib/mmslite/mmsle$$MMS_LIB_SUFFIX \
|
||||||
|
/FeProject/lib/mmslite/mmsl$$MMS_LIB_SUFFIX \
|
||||||
|
/FeProject/lib/mmslite/asn1l$$MMS_LIB_SUFFIX \
|
||||||
|
/FeProject/lib/mmslite/mem$$MMS_LIB_SUFFIX \
|
||||||
|
/FeProject/lib/mmslite/slog$$MMS_LIB_SUFFIX \
|
||||||
|
/FeProject/lib/mmslite/util$$MMS_LIB_SUFFIX \
|
||||||
|
/FeProject/lib/mmslite/ssec0$$MMS_LIB_SUFFIX \
|
||||||
|
/FeProject/lib/libcurl.so \
|
||||||
|
/FeProject/lib/libmxml4.so \
|
||||||
|
/FeProject/lib/librocketmq.so \
|
||||||
|
/FeProject/lib/libhttprun.so \
|
||||||
|
/FeProject/lib/liblog4cplus.so
|
||||||
|
|
||||||
|
LIBS += -lapr-1 -laprutil-1 -ljclite
|
||||||
|
LIBS += -lrdkafka++
|
||||||
|
LIBS += -lrdkafka
|
||||||
|
LIBS += -L/FeProject/lib -llog4cplus
|
||||||
|
LIBS += -L/root/JoyProject/3rdparty/boost_pic_aarch64/lib -Wl,--no-as-needed -lboost_iostreams -Wl,--as-needed
|
||||||
|
LIBS += -L/root/JoyProject/3rdparty/zlib_pic_aarch64/lib -lz
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
# install
|
||||||
|
target.path = ../../bin
|
||||||
|
INSTALLS += target
|
||||||
|
|
||||||
|
# Input
|
||||||
|
|
||||||
|
HEADERS += source/mms/db_interface.h \
|
||||||
|
source/include/otlv4.h \
|
||||||
|
source/mms/mmsclient.h \
|
||||||
|
source/mms/mmsop_en.h \
|
||||||
|
source/mms/rdb_client.h \
|
||||||
|
source/mms/ver_conf.h \
|
||||||
|
source/misc/SM4.h \
|
||||||
|
source/json/save2json.h \
|
||||||
|
source/json/mms_json_inter.h \
|
||||||
|
# source/json/rdkafka.h \
|
||||||
|
# source/json/rdkafkacpp.h \
|
||||||
|
# source/json/kafka_producer.h \
|
||||||
|
source/json/cjson.h \
|
||||||
|
source/rocketmq/SimpleProducer.h \
|
||||||
|
source/cfg_parse/custom_printf.h \
|
||||||
|
source/log4cplus/log4.h
|
||||||
|
|
||||||
|
SOURCES += source/mms/main.c \
|
||||||
|
source/mms/clntobj.c \
|
||||||
|
source/mms/logcfgx.c \
|
||||||
|
source/mms/mms_process.c \
|
||||||
|
source/mms/mmscli_rpt.c \
|
||||||
|
source/mms/mmsclient.c \
|
||||||
|
source/mms/mmslvar.c \
|
||||||
|
source/mms/mmsop_en.c \
|
||||||
|
source/mms/mvl_acse.c \
|
||||||
|
source/mms/mvlop_en.c \
|
||||||
|
source/mms/parse_xml.c \
|
||||||
|
source/mms/rdb_client.c \
|
||||||
|
source/mms/rdb_ext_utils.c \
|
||||||
|
source/mms/reject.c \
|
||||||
|
source/mms/mmscli_log.c \
|
||||||
|
source/misc/SM4.cpp \
|
||||||
|
source/misc/my_encrypt.cpp \
|
||||||
|
source/json/save2json.cpp \
|
||||||
|
source/cfg_parse/cfg_parser.cpp \
|
||||||
|
# source/json/kafka_producer.cpp \
|
||||||
|
source/json/create_json.cpp \
|
||||||
|
source/json/cjson.c \
|
||||||
|
source/cfg_parse/nacos.cpp \
|
||||||
|
source/cfg_parse/base64.cpp \
|
||||||
|
source/cfg_parse/SimpleProducer.cpp \
|
||||||
|
source/cfg_parse/log4.cpp \
|
||||||
|
# source/cfg_parse/oss_aliyun.cpp \
|
||||||
|
#source/cfg_parse/obs_huaweiyun.cpp \
|
||||||
|
# source/cfg_parse/datahub.cpp \
|
||||||
|
# source/cfg_parse/uds_huaweiyun.cpp
|
||||||
|
|
||||||
22
boot/feservice
Normal file
22
boot/feservice
Normal file
@@ -0,0 +1,22 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
case "$1" in
|
||||||
|
'start')
|
||||||
|
$FEP_ENV/boot/start_fe.sh
|
||||||
|
;;
|
||||||
|
|
||||||
|
'stop')
|
||||||
|
$FEP_ENV/boot/stop_fe.sh
|
||||||
|
;;
|
||||||
|
|
||||||
|
'restart')
|
||||||
|
$FEP_ENV/boot/stop_fe.sh
|
||||||
|
$FEP_ENV/boot/start_fe.sh
|
||||||
|
;;
|
||||||
|
|
||||||
|
*)
|
||||||
|
echo "Usage: feservice start|stop|restart"
|
||||||
|
exit 1
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
|
||||||
44
boot/ps_fe.sh
Normal file
44
boot/ps_fe.sh
Normal file
@@ -0,0 +1,44 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
# @file: $RCSfile: ps_fe.sh,v $
|
||||||
|
# @brief: $ϵͳӦ<CDB3><D3A6><EFBFBD><EFBFBD>ʾ<EFBFBD><CABE><EFBFBD>̽ű<CCBD>
|
||||||
|
# @version: $Revision: 1.2 $
|
||||||
|
# @date: $Date: 2017/02/23 03:42:58 $
|
||||||
|
# @author: $Author: zhanchengguo $
|
||||||
|
# @state: $State: Exp $
|
||||||
|
# @latest: $Id: ps_fe.sh,v 1.2 2017/02/23 03:42:58 zhanchengguo Exp $
|
||||||
|
|
||||||
|
echo ""
|
||||||
|
|
||||||
|
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
|
||||||
|
|
||||||
|
echo ""
|
||||||
106
boot/start_fe.sh
Normal file
106
boot/start_fe.sh
Normal file
@@ -0,0 +1,106 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
# @file: $RCSfile: start_fe.sh,v $
|
||||||
|
# @brief: $ϵͳӦ<CDB3><D3A6><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ű<EFBFBD>
|
||||||
|
# @version: $Revision: 1.1 $
|
||||||
|
# @date: $Date: 2018/12/26 07:19:31 $
|
||||||
|
# @author: $Author: lizhongming $
|
||||||
|
# @state: $State: Exp $
|
||||||
|
# @latest: $Id: start_fe.sh,v 1.1 2018/12/26 07:19:31 lizhongming Exp $
|
||||||
|
|
||||||
|
QTDIR=/qt-4.8.4
|
||||||
|
export QTDIR
|
||||||
|
|
||||||
|
FEP_ENV=/FeProject
|
||||||
|
export FEP_ENV
|
||||||
|
|
||||||
|
PATH=$FEP_ENV/bin:$QTDIR/bin:$PATH
|
||||||
|
export PATH
|
||||||
|
|
||||||
|
LD_LIBRARY_PATH=$FEP_ENV/lib:$FEP_ENV/lib3rd:$QTDIR/lib:$LD_LIBRARY_PATH
|
||||||
|
export LD_LIBRARY_PATH
|
||||||
|
|
||||||
|
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"` Start Processes *******"
|
||||||
|
echo "" >>"$LOGFILE"
|
||||||
|
echo "" >>"$LOGFILE"
|
||||||
|
echo "******* `date "+%F %R:%S"` Start Processes *******" >>"$LOGFILE"
|
||||||
|
#sysctl -w "kernel.core_pattern=/usr/local/sascore/%e.%p.%t.core" &> /dev/null
|
||||||
|
|
||||||
|
#ִ<>г<EFBFBD><D0B3><EFBFBD>·<EFBFBD><C2B7>^<5E><>ִ<EFBFBD>г<EFBFBD><D0B3><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> ^<5E><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>в<EFBFBD><D0B2><EFBFBD>^<5E>״<EFBFBD><D7B4><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>в<EFBFBD><D0B2><EFBFBD>^<5E><><EFBFBD><EFBFBD><EFBFBD>״<EFBFBD><D7B4><EFBFBD><EFBFBD><EFBFBD>ǰ<EFBFBD><C7B0><EFBFBD><EFBFBD>ʱ<EFBFBD><CAB1><EFBFBD><EFBFBD>^<5E><><EFBFBD><EFBFBD><EFBFBD>Ƿ<EFBFBD><C7B7><EFBFBD><EFBFBD><EFBFBD>^<5E>״<EFBFBD><D7B4><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ƿ<EFBFBD><C7B7><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"
|
||||||
|
CURDIR=`pwd`
|
||||||
|
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
|
||||||
|
|
||||||
|
RESTARTFLAG=`echo $LINE | awk -F '^' '{printf $6}'`
|
||||||
|
RESTARTFLAG=`echo "$RESTARTFLAG" | grep -o "[^ ]\+\( \+[^ ]\+\)*"`
|
||||||
|
echo $RESTARTFLAG
|
||||||
|
|
||||||
|
if [ "$RESTARTFLAG" = "IGNORE_RESTART" ]; then
|
||||||
|
# echo "" ;
|
||||||
|
CMD_STR=" sleep `echo $SLEEPSEC` "
|
||||||
|
echo "$CMD_STR"
|
||||||
|
echo "$CMD_STR" >>"$LOGFILE"
|
||||||
|
$CMD_STR
|
||||||
|
|
||||||
|
CMD_STR=" `echo $BINPATH``echo $BIN` `echo $SPECIAL` "
|
||||||
|
echo "$CMD_STR"
|
||||||
|
echo "$CMD_STR" >>"$LOGFILE"
|
||||||
|
$CMD_STR &>/dev/null
|
||||||
|
fi
|
||||||
|
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"
|
||||||
107
boot/stop_fe.sh
Normal file
107
boot/stop_fe.sh
Normal file
@@ -0,0 +1,107 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
# @file: $RCSfile: stop_fe.sh,v $
|
||||||
|
# @brief: $ϵͳӦ<CDB3><D3A6>ֹͣ<CDA3><D6B9><EFBFBD>̽ű<CCBD>
|
||||||
|
# @version: $Revision: 1.5 $
|
||||||
|
# @date: $Date: 2017/02/28 08:40:43 $
|
||||||
|
# @author: $Author: zhanchengguo $
|
||||||
|
# @state: $State: Exp $
|
||||||
|
# @latest: $Id: stop_fe.sh,v 1.5 2017/02/28 08:40:43 zhanchengguo Exp $
|
||||||
|
|
||||||
|
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="/FeProject/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="/FeProject/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"
|
||||||
@@ -3,6 +3,7 @@
|
|||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
|
#include <atomic>
|
||||||
#include <string>
|
#include <string>
|
||||||
#include "../mms/db_interface.h"
|
#include "../mms/db_interface.h"
|
||||||
|
|
||||||
@@ -28,10 +29,14 @@
|
|||||||
#include "../rocketmq/DefaultMQPushConsumer.h"
|
#include "../rocketmq/DefaultMQPushConsumer.h"
|
||||||
#include "../rocketmq/ConsumeType.h"
|
#include "../rocketmq/ConsumeType.h"
|
||||||
|
|
||||||
|
#include "../rocketmq/MQMessageListener.h"
|
||||||
|
#include "../rocketmq/MQMessageExt.h"
|
||||||
|
#include "../rocketmq/SessionCredentials.h"
|
||||||
|
|
||||||
// 引入提供的消费者接口头文件
|
// 引入提供的消费者接口头文件
|
||||||
#include "../rocketmq/CPushConsumer.h"
|
//#include "../rocketmq/CPushConsumer.h"
|
||||||
#include "../rocketmq/CCommon.h"
|
//#include "../rocketmq/CCommon.h"
|
||||||
#include "../rocketmq/CMessageExt.h"
|
//#include "../rocketmq/CMessageExt.h"
|
||||||
#include <map>
|
#include <map>
|
||||||
#include <pthread.h> // 用于互斥锁(在 C++98 中没有 std::mutex)
|
#include <pthread.h> // 用于互斥锁(在 C++98 中没有 std::mutex)
|
||||||
#include <utility> // for std::pair
|
#include <utility> // for std::pair
|
||||||
@@ -40,20 +45,31 @@
|
|||||||
|
|
||||||
using namespace std;
|
using namespace std;
|
||||||
|
|
||||||
|
static std::once_flag g_consumer_once;
|
||||||
|
static std::once_flag g_producer_once;
|
||||||
|
|
||||||
extern std::string G_ROCKETMQ_PRODUCER;//rocketmq producer
|
extern std::string G_ROCKETMQ_PRODUCER;//rocketmq producer
|
||||||
extern std::string G_ROCKETMQ_IPPORT;//rocketmq ip+port
|
extern std::string G_ROCKETMQ_IPPORT;//rocketmq ip+port
|
||||||
extern std::string G_ROCKETMQ_TOPIC;//topie
|
|
||||||
extern std::string G_ROCKETMQ_TAG;//tag
|
extern std::string G_ROCKETMQ_TOPIC_TEST;//topie
|
||||||
extern std::string G_ROCKETMQ_KEY;//key
|
extern std::string G_ROCKETMQ_TAG_TEST;//tag
|
||||||
|
extern std::string G_ROCKETMQ_KEY_TEST;//key
|
||||||
|
|
||||||
|
extern std::string G_MQCONSUMER_TOPIC_LOG;
|
||||||
|
extern std::string G_MQCONSUMER_TOPIC_SET;
|
||||||
|
extern std::string G_MQCONSUMER_TOPIC_RC;
|
||||||
|
extern std::string G_MQCONSUMER_TOPIC_UD;
|
||||||
|
extern std::string G_MQCONSUMER_TOPIC_RT;
|
||||||
|
|
||||||
|
extern std::string G_MQCONSUMER_TOPIC_TEST;
|
||||||
|
|
||||||
extern std::string FRONT_INST;
|
extern std::string FRONT_INST;
|
||||||
|
extern bool DEBUGOPEN;
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
extern "C" {
|
extern "C" {
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
extern std::string G_MQCONSUMER_TOPIC_SET; // C++ 中的全局变量声明
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
@@ -73,20 +89,40 @@ extern std::string G_MQCONSUMER_CHANNEL;
|
|||||||
class RocketMQConsumer;
|
class RocketMQConsumer;
|
||||||
|
|
||||||
// 全局映射:CPushConsumer* -> RocketMQConsumer*
|
// 全局映射:CPushConsumer* -> RocketMQConsumer*
|
||||||
std::map<CPushConsumer*, RocketMQConsumer*> g_consumerMap;//
|
//std::map<CPushConsumer*, RocketMQConsumer*> g_consumerMap;//
|
||||||
pthread_mutex_t g_consumerMapMutex = PTHREAD_MUTEX_INITIALIZER;
|
//pthread_mutex_t g_consumerMapMutex = PTHREAD_MUTEX_INITIALIZER;
|
||||||
|
|
||||||
|
////////////////////////////////
|
||||||
|
int64_t G_APP_START_MS = []() -> int64_t {
|
||||||
|
using namespace std::chrono;
|
||||||
|
return duration_cast<milliseconds>(
|
||||||
|
system_clock::now().time_since_epoch()
|
||||||
|
).count();
|
||||||
|
}();
|
||||||
|
|
||||||
|
int64_t G_START_SKEW_MS = 1000;
|
||||||
|
|
||||||
|
bool should_process_after_start(const rocketmq::MQMessageExt& msg)
|
||||||
|
{
|
||||||
|
const int64_t born_ts = static_cast<int64_t>(msg.getBornTimestamp());
|
||||||
|
return born_ts >= (G_APP_START_MS - G_START_SKEW_MS);
|
||||||
|
}
|
||||||
|
///////////////////////////////
|
||||||
|
class InternalListener;
|
||||||
|
|
||||||
class RocketMQConsumer {
|
class RocketMQConsumer {
|
||||||
public:
|
public:
|
||||||
// 构造函数:初始化消费者并启动
|
// 构造函数:初始化消费者并启动
|
||||||
RocketMQConsumer(const std::string& consumerName, const std::string& nameServer, const std::string& groupId);
|
RocketMQConsumer(const std::string& consumerName, const std::string& nameServer);
|
||||||
|
|
||||||
// 禁用拷贝和赋值
|
// 禁用拷贝和赋值
|
||||||
RocketMQConsumer(const RocketMQConsumer&) {}
|
RocketMQConsumer(const RocketMQConsumer&) = delete;
|
||||||
RocketMQConsumer& operator=(const RocketMQConsumer&) { return *this; }
|
RocketMQConsumer& operator=(const RocketMQConsumer&) = delete;
|
||||||
|
|
||||||
// 订阅主题和标签,并注册回调
|
// 订阅主题和标签,并注册回调
|
||||||
void subscribe(const std::string& topic, const std::string& tag, MessageCallBack callback);
|
void subscribe(const std::string& topic,
|
||||||
|
const std::string& tag,
|
||||||
|
MessageCallBack callback);
|
||||||
|
|
||||||
// 启动消费者
|
// 启动消费者
|
||||||
void start();
|
void start();
|
||||||
@@ -94,23 +130,47 @@ public:
|
|||||||
//修改消费模式
|
//修改消费模式
|
||||||
void setConsumerMessageModel(const std::string& topic);
|
void setConsumerMessageModel(const std::string& topic);
|
||||||
|
|
||||||
|
rocketmq::ConsumeStatus handleMessage(const rocketmq::MQMessageExt& msg);
|
||||||
|
|
||||||
// 析构函数:关闭并销毁消费者
|
// 析构函数:关闭并销毁消费者
|
||||||
~RocketMQConsumer();
|
~RocketMQConsumer();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
CPushConsumer* consumer_; // C 接口消费者指针
|
//CPushConsumer* consumer_; // C 接口消费者指针
|
||||||
//MessageCallBack messageCallback_; // 函数指针用于回调
|
//MessageCallBack messageCallback_; // 函数指针用于回调
|
||||||
|
rocketmq::DefaultMQPushConsumer consumer_;
|
||||||
|
InternalListener* listener_;
|
||||||
|
|
||||||
std::map<std::pair<std::string, std::string>, MessageCallBack> callbacks_; // 订阅到回调的映射
|
std::map<std::pair<std::string, std::string>, MessageCallBack> callbacks_; // 订阅到回调的映射
|
||||||
|
|
||||||
// 静态消息处理回调
|
/*// 静态消息处理回调
|
||||||
static int messageHandler(CPushConsumer* consumer, CMessageExt* msg);
|
static int messageHandler(CPushConsumer* consumer, CMessageExt* msg);
|
||||||
|
|
||||||
// 实例消息处理函数
|
// 实例消息处理函数
|
||||||
int handleMessage(CMessageExt* msg);
|
int handleMessage(CMessageExt* msg);*/
|
||||||
};
|
|
||||||
|
|
||||||
// 构造函数实现
|
};
|
||||||
RocketMQConsumer::RocketMQConsumer(const std::string& consumerName, const std::string& nameServer, const std::string& groupId)
|
class InternalListener : public rocketmq::MessageListenerConcurrently {
|
||||||
|
public:
|
||||||
|
explicit InternalListener(RocketMQConsumer* owner)
|
||||||
|
: owner_(owner) {}
|
||||||
|
|
||||||
|
rocketmq::ConsumeStatus consumeMessage(
|
||||||
|
const std::vector<rocketmq::MQMessageExt>& msgs) override
|
||||||
|
{
|
||||||
|
for (size_t i = 0; i < msgs.size(); ++i) {
|
||||||
|
rocketmq::ConsumeStatus ret = owner_->handleMessage(msgs[i]);
|
||||||
|
if (ret != rocketmq::CONSUME_SUCCESS) {
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return rocketmq::CONSUME_SUCCESS;
|
||||||
|
}
|
||||||
|
|
||||||
|
private:
|
||||||
|
RocketMQConsumer* owner_;
|
||||||
|
};
|
||||||
|
// 构造函数实现C
|
||||||
|
/*RocketMQConsumer::RocketMQConsumer(const std::string& consumerName, const std::string& nameServer, const std::string& groupId)
|
||||||
: consumer_(NULL)//, messageCallback_(NULL)
|
: consumer_(NULL)//, messageCallback_(NULL)
|
||||||
{
|
{
|
||||||
// 创建消费者
|
// 创建消费者
|
||||||
@@ -157,35 +217,58 @@ RocketMQConsumer::RocketMQConsumer(const std::string& consumerName, const std::s
|
|||||||
pthread_mutex_unlock(&g_consumerMapMutex);
|
pthread_mutex_unlock(&g_consumerMapMutex);
|
||||||
|
|
||||||
std::cout << "RocketMQ Consumer initialized and started." << std::endl;
|
std::cout << "RocketMQ Consumer initialized and started." << std::endl;
|
||||||
|
}*/
|
||||||
|
|
||||||
|
//构造函数实现C++
|
||||||
|
RocketMQConsumer::RocketMQConsumer(const std::string& consumerGroup,
|
||||||
|
const std::string& nameServer)
|
||||||
|
: consumer_(consumerGroup),
|
||||||
|
listener_(NULL)
|
||||||
|
{
|
||||||
|
consumer_.setNamesrvAddr(nameServer);
|
||||||
|
|
||||||
|
consumer_.setSessionCredentials(
|
||||||
|
G_MQCONSUMER_ACCESSKEY,
|
||||||
|
G_MQCONSUMER_SECRETKEY,
|
||||||
|
G_MQCONSUMER_CHANNEL
|
||||||
|
);
|
||||||
|
|
||||||
|
// 限制消费线程池,防止 ConsumeTP 爆炸
|
||||||
|
consumer_.setConsumeThreadCount(4);
|
||||||
|
|
||||||
|
listener_ = new InternalListener(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
// 启动消费者
|
// 启动消费者
|
||||||
void RocketMQConsumer::start()
|
void RocketMQConsumer::start()
|
||||||
{
|
{
|
||||||
if (StartPushConsumer(consumer_) != 0) {
|
static bool started = false;
|
||||||
pthread_mutex_lock(&g_consumerMapMutex);
|
if (started) {
|
||||||
g_consumerMap.erase(consumer_);
|
std::cout << "Consumer already started" << std::endl;
|
||||||
pthread_mutex_unlock(&g_consumerMapMutex);
|
return;
|
||||||
DestroyPushConsumer(consumer_);
|
|
||||||
throw std::runtime_error("Failed to start push consumer.");
|
|
||||||
}
|
|
||||||
else{
|
|
||||||
std::cout << "RocketMQ Consumer started." << std::endl;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
consumer_.registerMessageListener(listener_);
|
||||||
|
consumer_.start();
|
||||||
|
|
||||||
|
started = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void RocketMQConsumer::subscribe(const std::string& topic, const std::string& tag, MessageCallBack callback)
|
void RocketMQConsumer::subscribe(const std::string& topic, const std::string& tag, MessageCallBack callback)
|
||||||
{
|
{
|
||||||
if (Subscribe(consumer_, topic.c_str(), tag.c_str()) != 0) {
|
/*if (Subscribe(consumer_, topic.c_str(), tag.c_str()) != 0) {
|
||||||
throw std::runtime_error("Failed to subscribe to topic/tag.");
|
throw std::runtime_error("Failed to subscribe to topic/tag.");
|
||||||
}
|
}*/
|
||||||
|
consumer_.subscribe(topic, tag);
|
||||||
|
|
||||||
|
//调试用
|
||||||
std::cout << "Subscribed to topic: " << topic << ", tag: " << tag << std::endl;
|
std::cout << "Subscribed to topic: " << topic << ", tag: " << tag << std::endl;
|
||||||
|
|
||||||
// 使用 std::pair 作为键
|
// 使用 std::pair 作为键
|
||||||
std::pair<std::string, std::string> key(topic, tag);
|
std::pair<std::string, std::string> mapKey(topic, tag);
|
||||||
callbacks_[key] = callback;
|
callbacks_[mapKey] = callback;
|
||||||
}
|
}
|
||||||
|
/*
|
||||||
// 静态消息处理回调实现
|
// 静态消息处理回调实现
|
||||||
int RocketMQConsumer::messageHandler(CPushConsumer* consumer, CMessageExt* msg)
|
int RocketMQConsumer::messageHandler(CPushConsumer* consumer, CMessageExt* msg)
|
||||||
{
|
{
|
||||||
@@ -206,60 +289,58 @@ int RocketMQConsumer::messageHandler(CPushConsumer* consumer, CMessageExt* msg)
|
|||||||
return instance->handleMessage(msg);
|
return instance->handleMessage(msg);
|
||||||
} else {
|
} else {
|
||||||
std::cerr << "Consumer instance not found for callback." << std::endl;
|
std::cerr << "Consumer instance not found for callback." << std::endl;
|
||||||
return E_RECONSUME_LATER; // 默认返回重试状态
|
//return E_RECONSUME_LATER; // 默认返回重试状态
|
||||||
|
return rocketmq::RECONSUME_LATER;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
int RocketMQConsumer::handleMessage(CMessageExt* msg)
|
/*int RocketMQConsumer::handleMessage(CMessageExt* msg)
|
||||||
{
|
{
|
||||||
// 检查 msg 和 consumer_ 是否为 NULL
|
// 检查 msg 和 consumer_ 是否为 NULL
|
||||||
if (!msg || !consumer_) {
|
if (!msg || !consumer_) {
|
||||||
std::cerr << "Received null message or consumer." << std::endl;
|
std::cerr << "Received null message or consumer." << std::endl;
|
||||||
return E_RECONSUME_LATER;
|
//return E_RECONSUME_LATER;
|
||||||
}
|
return rocketmq::RECONSUME_LATER;
|
||||||
|
}*/
|
||||||
|
|
||||||
// 获取消息的主题和标签
|
// 获取消息的主题和标签
|
||||||
std::string topic = GetMessageTopic(msg); // 假设存在此函数
|
//std::string topic = GetMessageTopic(msg); // 假设存在此函数
|
||||||
std::string tag = GetMessageTags(msg); // 假设存在此函数
|
//std::string tag = GetMessageTags(msg); // 假设存在此函数
|
||||||
|
|
||||||
|
rocketmq::ConsumeStatus RocketMQConsumer::handleMessage( const rocketmq::MQMessageExt& msg) {
|
||||||
|
std::string tag = msg.getTags();
|
||||||
|
std::string topic = msg.getTopic();
|
||||||
// 打印调试信息
|
// 打印调试信息
|
||||||
std::cout << "Handling message for topic: " << topic << ", tag: " << tag << std::endl;
|
std::cout << "Handling message for topic: " << topic << ", tag: " << tag << std::endl;
|
||||||
|
|
||||||
// 使用 std::pair 作为键
|
// 使用 std::pair 作为键
|
||||||
std::pair<std::string, std::string> key(topic, tag);
|
std::pair<std::string, std::string> key(topic, tag);
|
||||||
|
|
||||||
// 查找对应的回调函数
|
// 查找对应的回调函数
|
||||||
std::map<std::pair<std::string, std::string>, MessageCallBack>::iterator it = callbacks_.find(key);
|
std::map<std::pair<std::string, std::string>, MessageCallBack>::iterator it = callbacks_.find(key);
|
||||||
if (it != callbacks_.end()) {
|
if (it != callbacks_.end())
|
||||||
// 调用对应的回调函数
|
{ // 调用对应的回调函数
|
||||||
|
|
||||||
//调试
|
//调试
|
||||||
std::cout << "callback Handling message " <<std::endl;
|
std::cout << "callback Handling message " <<std::endl;
|
||||||
|
//return it->second(consumer_, msg);
|
||||||
return it->second(consumer_, msg);
|
return it->second(msg);
|
||||||
|
}
|
||||||
} else {
|
else {
|
||||||
|
|
||||||
//调试
|
//调试
|
||||||
std::cout << "there is no callback " <<std::endl;
|
std::cout << "there is no callback " <<std::endl;
|
||||||
|
|
||||||
// 如果没有找到对应的回调,执行默认处理
|
// 如果没有找到对应的回调,执行默认处理
|
||||||
const char* body = GetMessageBody(msg);
|
//const char* body = GetMessageBody(msg);
|
||||||
const char* msgKey = GetMessageKeys(msg);
|
//const char* msgKey = GetMessageKeys(msg);
|
||||||
|
std::string body = msg.getBody();
|
||||||
if (body) {
|
std::string msgKey = msg.getKeys();
|
||||||
|
if (!body.empty()) {
|
||||||
std::cout << "Received message body: " << body << std::endl;
|
std::cout << "Received message body: " << body << std::endl;
|
||||||
} else {
|
} else {
|
||||||
std::cout << "Received message with empty body." << std::endl;
|
std::cout << "Received message with empty body." << std::endl;
|
||||||
}
|
} if (!msgKey.empty()) {
|
||||||
|
|
||||||
if (msgKey) {
|
|
||||||
std::cout << "Message Key: " << msgKey << std::endl;
|
std::cout << "Message Key: " << msgKey << std::endl;
|
||||||
} else {
|
} else {
|
||||||
std::cout << "Message Key: N/A" << std::endl;
|
std::cout << "Message Key: N/A" << std::endl;
|
||||||
}
|
} //return E_CONSUME_SUCCESS;
|
||||||
|
return rocketmq::CONSUME_SUCCESS;
|
||||||
return E_CONSUME_SUCCESS;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -267,7 +348,7 @@ int RocketMQConsumer::handleMessage(CMessageExt* msg)
|
|||||||
// 析构函数实现
|
// 析构函数实现
|
||||||
RocketMQConsumer::~RocketMQConsumer()
|
RocketMQConsumer::~RocketMQConsumer()
|
||||||
{
|
{
|
||||||
if (consumer_) {
|
/*if (consumer_) {
|
||||||
// 关闭消费者
|
// 关闭消费者
|
||||||
ShutdownPushConsumer(consumer_);
|
ShutdownPushConsumer(consumer_);
|
||||||
|
|
||||||
@@ -281,7 +362,18 @@ RocketMQConsumer::~RocketMQConsumer()
|
|||||||
consumer_ = NULL;
|
consumer_ = NULL;
|
||||||
|
|
||||||
std::cout << "RocketMQ Consumer shutdown and destroyed." << std::endl;
|
std::cout << "RocketMQ Consumer shutdown and destroyed." << std::endl;
|
||||||
|
}*/
|
||||||
|
try {
|
||||||
|
consumer_.shutdown();
|
||||||
|
} catch (...) {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
sleep(1); // 等内部线程退出
|
||||||
|
|
||||||
|
delete listener_;
|
||||||
|
listener_ = NULL;
|
||||||
|
|
||||||
|
std::cout << "RocketMQ Consumer shutdown and destroyed." << std::endl;
|
||||||
}
|
}
|
||||||
|
|
||||||
// 在 RocketMQConsumer 类中新增函数用来设置消费模式
|
// 在 RocketMQConsumer 类中新增函数用来设置消费模式
|
||||||
@@ -296,11 +388,13 @@ void RocketMQConsumer::setConsumerMessageModel(const std::string& topic)
|
|||||||
}
|
}
|
||||||
} else*/ {
|
} else*/ {
|
||||||
// 默认设置为广播消费模式
|
// 默认设置为广播消费模式
|
||||||
if (SetPushConsumerMessageModel(consumer_, BROADCASTING) != 0) {
|
/*if (SetPushConsumerMessageModel(consumer_, BROADCASTING) != 0) {
|
||||||
std::cout << "Error setting message model to BROADCASTING for topic: " << topic << std::endl;
|
std::cout << "Error setting message model to BROADCASTING for topic: " << topic << std::endl;
|
||||||
} else {
|
} else {
|
||||||
std::cout << "Set consumer to BROADCASTING for topic: " << topic << std::endl;
|
std::cout << "Set consumer to BROADCASTING for topic: " << topic << std::endl;
|
||||||
}
|
}*/
|
||||||
|
consumer_.setMessageModel(rocketmq::BROADCASTING);
|
||||||
|
std::cout << "Set consumer to BROADCASTING for topic: " << topic << std::endl;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -316,11 +410,12 @@ void InitializeConsumer(
|
|||||||
if (g_consumer == NULL) {
|
if (g_consumer == NULL) {
|
||||||
std::cout << "create new consumer!" << std::endl;
|
std::cout << "create new consumer!" << std::endl;
|
||||||
try {
|
try {
|
||||||
g_consumer = new RocketMQConsumer(consumerName, nameServer,consumerName);//用消费名作为消费组,不同进程(不同的消费者)同时消费topic的同一条消息
|
//g_consumer = new RocketMQConsumer(consumerName, nameServer,consumerName);//用消费名作为消费组,不同进程(不同的消费者)同时消费topic的同一条消息
|
||||||
|
g_consumer = new RocketMQConsumer(consumerName, nameServer);
|
||||||
|
|
||||||
for (size_t i = 0; i < subscriptions.size(); ++i) {
|
for (size_t i = 0; i < subscriptions.size(); ++i) {
|
||||||
g_consumer->setConsumerMessageModel(subscriptions[i].topic);//初始化时根据topic设置消费模式
|
g_consumer->setConsumerMessageModel(subscriptions[i].topic);//初始化时根据topic设置消费模式
|
||||||
g_consumer->subscribe(subscriptions[i].topic, subscriptions[i].tag, subscriptions[i].callback);
|
g_consumer->subscribe(subscriptions[i].topic, subscriptions[i].tag,subscriptions[i].callback);
|
||||||
}
|
}
|
||||||
|
|
||||||
g_consumer->start();
|
g_consumer->start();
|
||||||
@@ -348,16 +443,13 @@ void rocketmq_consumer_receive(
|
|||||||
const std::string& nameServer,
|
const std::string& nameServer,
|
||||||
const std::vector<Subscription>& subscriptions) // 接收多个订阅
|
const std::vector<Subscription>& subscriptions) // 接收多个订阅
|
||||||
{
|
{
|
||||||
if (g_consumer == NULL) {
|
std::call_once(g_consumer_once, [&](){
|
||||||
try {
|
try {
|
||||||
//InitializeConsumer(consumerName, nameServer, topic, tag, callback);//初始化后,mq库内部来完成消息的获取
|
InitializeConsumer(consumerName, nameServer, subscriptions);
|
||||||
InitializeConsumer(consumerName, nameServer, subscriptions); // 初始化后,MQ库内部开始获取消息
|
} catch (...) {
|
||||||
}
|
|
||||||
catch (...) {
|
|
||||||
std::cerr << "Cannot consume message because consumer initialization failed." << std::endl;
|
std::cerr << "Cannot consume message because consumer initialization failed." << std::endl;
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
}
|
});
|
||||||
|
|
||||||
}
|
}
|
||||||
/////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
@@ -367,7 +459,7 @@ void rocketmq_consumer_receive(
|
|||||||
static int currentQueueId = 0;
|
static int currentQueueId = 0;
|
||||||
|
|
||||||
// 队列选择器回调函数:轮询选择队列 ID
|
// 队列选择器回调函数:轮询选择队列 ID
|
||||||
int RoundRobinSelector(int queueNum, CMessage* msg, void* arg) {
|
/*int RoundRobinSelector(int queueNum, CMessage* msg, void* arg) {
|
||||||
if (queueNum == 0) {
|
if (queueNum == 0) {
|
||||||
throw std::runtime_error("No available queues");
|
throw std::runtime_error("No available queues");
|
||||||
}
|
}
|
||||||
@@ -377,27 +469,60 @@ int RoundRobinSelector(int queueNum, CMessage* msg, void* arg) {
|
|||||||
currentQueueId = 0;
|
currentQueueId = 0;
|
||||||
}
|
}
|
||||||
return queueId;
|
return queueId;
|
||||||
|
}*/
|
||||||
|
int RoundRobinSelector(int queueNum, CMessage* msg, void* arg) {
|
||||||
|
static std::atomic<int> currentQueueId(0);
|
||||||
|
|
||||||
|
if (queueNum <= 0) {
|
||||||
|
std::cout << "[MQ][SELECTOR_FAIL] queueNum=" << queueNum << std::endl;
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
int id = currentQueueId.fetch_add(1, std::memory_order_relaxed);
|
||||||
|
int queueId = id % queueNum;
|
||||||
|
|
||||||
|
std::cout << "[MQ][SELECTOR] queueNum=" << queueNum
|
||||||
|
<< ", current=" << id
|
||||||
|
<< ", selected=" << queueId
|
||||||
|
<< std::endl;
|
||||||
|
|
||||||
|
return queueId;
|
||||||
}
|
}
|
||||||
|
|
||||||
// 封装生产者的类
|
// 封装生产者的类
|
||||||
class RocketMQProducer {
|
class RocketMQProducer {
|
||||||
public:
|
public:
|
||||||
RocketMQProducer(const std::string& producerName, const std::string& nameServer)
|
RocketMQProducer(const std::string& producerName, const std::string& nameServer)
|
||||||
: producer_(NULL)
|
: producer_(producerName)
|
||||||
{
|
{
|
||||||
// 创建生产者
|
// 创建生产者
|
||||||
producer_ = CreateProducer(producerName.c_str());
|
/*producer_ = CreateProducer(producerName.c_str());
|
||||||
if (producer_ == NULL) {
|
if (producer_ == NULL) {
|
||||||
throw std::runtime_error("Failed to create producer.");
|
throw std::runtime_error("Failed to create producer.");
|
||||||
}
|
}*/
|
||||||
|
|
||||||
|
// 设置日志
|
||||||
|
producer_.setLogLevel(rocketmq::eLOG_LEVEL_ERROR);
|
||||||
|
producer_.setLogFileSizeAndNum(5, 50);
|
||||||
|
|
||||||
// 设置 nameserver 地址
|
// 设置 nameserver 地址
|
||||||
SetProducerNameServerAddress(producer_, nameServer.c_str());
|
//SetProducerNameServerAddress(producer_, nameServer.c_str());
|
||||||
|
producer_.setNamesrvAddr(nameServer);
|
||||||
|
|
||||||
SetProducerSessionCredentials(producer_, G_MQCONSUMER_ACCESSKEY.c_str(),G_MQCONSUMER_SECRETKEY.c_str(), "");
|
//lnk20260417设置数据上送消息体最大值,默认4M,调整为1M,避免过大消息导致发送失败
|
||||||
|
//SetProducerMaxMessageSize(producer_, 1024 * 1024); // 1MB
|
||||||
|
producer_.setMaxMessageSize(1024 * 1024);
|
||||||
|
|
||||||
|
//SetProducerSessionCredentials(producer_, G_MQCONSUMER_ACCESSKEY.c_str(),G_MQCONSUMER_SECRETKEY.c_str(), "");
|
||||||
|
producer_.setSessionCredentials(
|
||||||
|
G_MQCONSUMER_ACCESSKEY,
|
||||||
|
G_MQCONSUMER_SECRETKEY,
|
||||||
|
""
|
||||||
|
);
|
||||||
|
|
||||||
// 启动生产者
|
// 启动生产者
|
||||||
StartProducer(producer_);
|
//StartProducer(producer_);
|
||||||
|
producer_.start();
|
||||||
|
|
||||||
std::cout << "rocketmq_Producer initialized and started." << std::endl;
|
std::cout << "rocketmq_Producer initialized and started." << std::endl;
|
||||||
}
|
}
|
||||||
@@ -406,7 +531,7 @@ public:
|
|||||||
RocketMQProducer(const RocketMQProducer&) = delete;
|
RocketMQProducer(const RocketMQProducer&) = delete;
|
||||||
RocketMQProducer& operator=(const RocketMQProducer&) = delete;
|
RocketMQProducer& operator=(const RocketMQProducer&) = delete;
|
||||||
|
|
||||||
void printSendResult(const CSendResult& result) {
|
/*void printSendResult(const CSendResult& result) {
|
||||||
std::cout << "SendResult:" << std::endl;
|
std::cout << "SendResult:" << std::endl;
|
||||||
std::cout << " Status: ";
|
std::cout << " Status: ";
|
||||||
switch (result.sendStatus) {
|
switch (result.sendStatus) {
|
||||||
@@ -430,10 +555,68 @@ public:
|
|||||||
|
|
||||||
std::cout << " MsgID : " << result.msgId << std::endl;
|
std::cout << " MsgID : " << result.msgId << std::endl;
|
||||||
std::cout << " Offset: " << result.offset << std::endl;
|
std::cout << " Offset: " << result.offset << std::endl;
|
||||||
}
|
}*/
|
||||||
|
|
||||||
// 发送消息
|
// 发送消息
|
||||||
void sendMessage(const char* strbody, const char* topic, const std::string& tags, const std::string& keys) {
|
/* void sendMessage(const char* strbody, const char* topic, const std::string& tags, const std::string& keys) {
|
||||||
|
|
||||||
|
if (DEBUGOPEN) {
|
||||||
|
std::cout << "sendMessage called with topic: " << (topic ? topic : "NULL")
|
||||||
|
<< ", tags: " << tags
|
||||||
|
<< ", keys: " << keys
|
||||||
|
<< std::endl;
|
||||||
|
|
||||||
|
if (strbody) {
|
||||||
|
// ===== 1️⃣ 真实长度 vs strlen =====
|
||||||
|
std::string body_str(strbody);
|
||||||
|
|
||||||
|
std::cout << "[MQ][LEN_CHECK]"
|
||||||
|
<< " strlen=" << strlen(strbody)
|
||||||
|
<< ", std::string.size=" << body_str.size()
|
||||||
|
<< std::endl;
|
||||||
|
|
||||||
|
// ===== 2️⃣ 检测是否包含 \0 =====
|
||||||
|
bool has_null = false;
|
||||||
|
for (size_t i = 0; i < body_str.size(); i++) {
|
||||||
|
if (body_str[i] == '\0') {
|
||||||
|
has_null = true;
|
||||||
|
std::cout << "[MQ][FOUND_NULL] index=" << i << std::endl;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
std::cout << "[MQ][HAS_NULL] " << (has_null ? "YES" : "NO") << std::endl;
|
||||||
|
|
||||||
|
// ===== 3️⃣ 打印头部(可读)=====
|
||||||
|
size_t len = strlen(strbody);
|
||||||
|
size_t n = std::min((size_t)200, len);
|
||||||
|
|
||||||
|
std::cout << "[MQ][BODY_HEAD] "
|
||||||
|
<< std::string(strbody, n)
|
||||||
|
<< std::endl;
|
||||||
|
|
||||||
|
std::cout << "[MQ][BODY_TAIL] "
|
||||||
|
<< std::string(strbody + (len - n), n)
|
||||||
|
<< std::endl;
|
||||||
|
|
||||||
|
// ===== 4️⃣ 十六进制打印前100字节 =====
|
||||||
|
std::cout << "[MQ][HEX_HEAD] ";
|
||||||
|
for (size_t i = 0; i < std::min((size_t)100, body_str.size()); i++) {
|
||||||
|
printf("%02X ", (unsigned char)body_str[i]);
|
||||||
|
}
|
||||||
|
printf("\n");
|
||||||
|
|
||||||
|
// ===== 5️⃣ 十六进制打印尾部100字节 =====
|
||||||
|
std::cout << "[MQ][HEX_TAIL] ";
|
||||||
|
size_t start = (body_str.size() > 100) ? body_str.size() - 100 : 0;
|
||||||
|
for (size_t i = start; i < body_str.size(); i++) {
|
||||||
|
printf("%02X ", (unsigned char)body_str[i]);
|
||||||
|
}
|
||||||
|
printf("\n");
|
||||||
|
} else {
|
||||||
|
std::cout << "[MQ][ERROR] strbody is NULL" << std::endl;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
CSendResult result;
|
CSendResult result;
|
||||||
CMessage* msg = NULL;
|
CMessage* msg = NULL;
|
||||||
|
|
||||||
@@ -458,11 +641,67 @@ public:
|
|||||||
RoundRobinSelector, // 队列选择器回调函数
|
RoundRobinSelector, // 队列选择器回调函数
|
||||||
&queueNum // 传递给选择器的额外参数(队列数量)
|
&queueNum // 传递给选择器的额外参数(队列数量)
|
||||||
);
|
);
|
||||||
|
/////////////////////////////////替换接口,性能较低但不影响
|
||||||
|
/*CSendResult result;
|
||||||
|
memset(&result, 0, sizeof(result));
|
||||||
|
|
||||||
if (sendResult == 0) { // 假设返回 0 表示成功
|
int sendResult = SendMessageOrderly(
|
||||||
std::cout << "Message sent successfully.topic:" << topic <<std::endl;
|
producer_,
|
||||||
|
msg,
|
||||||
|
RoundRobinSelector,
|
||||||
|
&queueNum,
|
||||||
|
0, // autoRetryTimes
|
||||||
|
&result
|
||||||
|
);
|
||||||
|
|
||||||
|
std::cout << "[MQ][ORDERLY_RESULT]"
|
||||||
|
<< " ret=" << sendResult
|
||||||
|
<< ", sendStatus=" << (int)result.sendStatus
|
||||||
|
<< ", msgId=" << result.msgId
|
||||||
|
<< ", offset=" << result.offset
|
||||||
|
<< ", topic=" << (topic ? topic : "")
|
||||||
|
<< ", body_len=" << (strbody ? strlen(strbody) : 0)
|
||||||
|
<< std::endl;*/
|
||||||
|
/////////////////////////////////替换接口,性能较低但不影响
|
||||||
|
// 发送消息:临时改成同步发送,绕过 orderly / selector,便于定位问题
|
||||||
|
/*CSendResult result;
|
||||||
|
memset(&result, 0, sizeof(result));
|
||||||
|
|
||||||
|
int sendResult = SendMessageSync(
|
||||||
|
producer_,
|
||||||
|
msg,
|
||||||
|
&result
|
||||||
|
);
|
||||||
|
|
||||||
|
std::cout << "[MQ][SYNC_RESULT]"
|
||||||
|
<< " ret=" << sendResult
|
||||||
|
<< ", sendStatus=" << (int)result.sendStatus
|
||||||
|
<< ", msgId=" << result.msgId
|
||||||
|
<< ", offset=" << result.offset
|
||||||
|
<< ", topic=" << (topic ? topic : "")
|
||||||
|
<< ", body_len=" << (strbody ? strlen(strbody) : 0)
|
||||||
|
<< std::endl;*/
|
||||||
|
// 发送消息:临时改成同步发送,绕过 orderly / selector,便于定位问题
|
||||||
|
|
||||||
|
/*if (sendResult == 0) { // 假设返回 0 表示成功
|
||||||
|
std::cout << "[MQ][SEND_OK]"
|
||||||
|
<< " topic=" << (topic ? topic : "")
|
||||||
|
<< ", tags=" << tags
|
||||||
|
<< ", keys=" << keys
|
||||||
|
<< ", body_len=" << (strbody ? strlen(strbody) : 0)
|
||||||
|
<< std::endl;
|
||||||
} else {
|
} else {
|
||||||
std::cout << "Failed to send message." << std::endl;
|
|
||||||
|
std::cout << "[MQ][SEND_FAIL]"
|
||||||
|
<< " ret=" << sendResult
|
||||||
|
<< ", topic=" << (topic ? topic : "")
|
||||||
|
<< ", tags=" << tags
|
||||||
|
<< ", keys=" << keys
|
||||||
|
<< ", body_len=" << (strbody ? strlen(strbody) : 0)
|
||||||
|
<< std::endl;
|
||||||
|
std::cout << "[MQ][BODY_HEAD] " << std::string(strbody, std::min((size_t)200, strlen(strbody))) << std::endl;
|
||||||
|
std::cout << "[MQ][BODY_TAIL] " << std::string(strbody + std::max((size_t)0, strlen(strbody) - std::min((size_t)200, strlen(strbody)))) << std::endl;
|
||||||
|
DIY_ERRORLOG_CODE("process",0,LOG_CODE_MQ,"【ERROR】前置的%s%d号进程 mq发送失败,请检查mq配置", get_front_msg_from_subdir(), g_front_seg_index);
|
||||||
}
|
}
|
||||||
|
|
||||||
// 销毁消息
|
// 销毁消息
|
||||||
@@ -489,20 +728,97 @@ public:
|
|||||||
DestroyMessage(msg);
|
DestroyMessage(msg);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}*/
|
||||||
|
void sendMessage(const std::string& body,
|
||||||
|
const std::string& topic,
|
||||||
|
const std::string& tags,
|
||||||
|
const std::string& keys)
|
||||||
|
{
|
||||||
|
try {
|
||||||
|
if (DEBUGOPEN) {
|
||||||
|
std::cout << "sendMessage called with topic: " << topic
|
||||||
|
<< ", tags: " << tags
|
||||||
|
<< ", keys: " << keys
|
||||||
|
<< ", body_len=" << body.size()
|
||||||
|
<< std::endl;
|
||||||
|
|
||||||
|
size_t n = std::min((size_t)200, body.size());
|
||||||
|
|
||||||
|
std::cout << "[MQ][BODY_HEAD] "
|
||||||
|
<< body.substr(0, n)
|
||||||
|
<< std::endl;
|
||||||
|
|
||||||
|
if (body.size() > n) {
|
||||||
|
std::cout << "[MQ][BODY_TAIL] "
|
||||||
|
<< body.substr(body.size() - n, n)
|
||||||
|
<< std::endl;
|
||||||
|
}
|
||||||
|
|
||||||
|
std::cout << "[MQ][HEX_HEAD] ";
|
||||||
|
for (size_t i = 0; i < std::min((size_t)100, body.size()); ++i) {
|
||||||
|
printf("%02X ", (unsigned char)body[i]);
|
||||||
|
}
|
||||||
|
printf("\n");
|
||||||
|
}
|
||||||
|
|
||||||
|
rocketmq::MQMessage msg(topic, tags, keys, body);
|
||||||
|
|
||||||
|
rocketmq::SendResult result = producer_.send(msg);
|
||||||
|
|
||||||
|
std::cout << "[MQ][SEND_OK]"
|
||||||
|
<< " topic=" << topic
|
||||||
|
<< ", tags=" << tags
|
||||||
|
<< ", keys=" << keys
|
||||||
|
<< ", msgId=" << result.getMsgId()
|
||||||
|
<< ", status=" << result.getSendStatus()
|
||||||
|
<< ", body_len=" << body.size()
|
||||||
|
<< std::endl;
|
||||||
|
}
|
||||||
|
catch (const rocketmq::MQClientException& e) {
|
||||||
|
std::cerr << "[MQ][SEND_FAIL] MQClientException: "
|
||||||
|
<< e.what() << std::endl;
|
||||||
|
|
||||||
|
DIY_ERRORLOG_CODE("process",0,LOG_CODE_MQ,
|
||||||
|
"【ERROR】前置的%s%d号进程 mq发送失败,mq客户端错误,请检查mq配置",
|
||||||
|
get_front_msg_from_subdir(), g_front_seg_index);
|
||||||
|
}
|
||||||
|
catch (const std::exception& e) {
|
||||||
|
std::cerr << "[MQ][SEND_FAIL] exception: "
|
||||||
|
<< e.what() << std::endl;
|
||||||
|
|
||||||
|
DIY_ERRORLOG_CODE("process",0,LOG_CODE_MQ,
|
||||||
|
"【ERROR】前置的%s%d号进程 mq发送失败,mq发送错误,发送请检查mq配置",
|
||||||
|
get_front_msg_from_subdir(), g_front_seg_index);
|
||||||
|
}
|
||||||
|
catch (...) {
|
||||||
|
std::cerr << "[MQ][SEND_FAIL] unknown exception" << std::endl;
|
||||||
|
|
||||||
|
DIY_ERRORLOG_CODE("process",0,LOG_CODE_MQ,
|
||||||
|
"【ERROR】前置的%s%d号进程 mq发送失败,未知错误,请检查mq配置",
|
||||||
|
get_front_msg_from_subdir(), g_front_seg_index);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// 析构函数中关闭并销毁生产者
|
// 析构函数中关闭并销毁生产者
|
||||||
~RocketMQProducer() {
|
~RocketMQProducer() {
|
||||||
if (producer_) {
|
/*if (producer_) {
|
||||||
ShutdownProducer(producer_);
|
ShutdownProducer(producer_);
|
||||||
DestroyProducer(producer_);
|
DestroyProducer(producer_);
|
||||||
std::cout << "rocketmq_Producer shutdown and destroyed." << std::endl;
|
std::cout << "rocketmq_Producer shutdown and destroyed." << std::endl;
|
||||||
|
}*/
|
||||||
|
try {
|
||||||
|
producer_.shutdown();
|
||||||
}
|
}
|
||||||
|
catch (...) {
|
||||||
|
}
|
||||||
|
|
||||||
|
std::cout << "rocketmq_Producer shutdown and destroyed." << std::endl;
|
||||||
}
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
CProducer* producer_;
|
//CProducer* producer_;
|
||||||
|
rocketmq::DefaultMQProducer producer_;
|
||||||
};
|
};
|
||||||
|
|
||||||
// 全局生产者实例
|
// 全局生产者实例
|
||||||
@@ -513,7 +829,7 @@ void InitializeProducer()
|
|||||||
{
|
{
|
||||||
if (g_producer == NULL) {
|
if (g_producer == NULL) {
|
||||||
try {
|
try {
|
||||||
g_producer = new RocketMQProducer(G_ROCKETMQ_PRODUCER, G_ROCKETMQ_IPPORT);
|
g_producer = new RocketMQProducer(G_ROCKETMQ_PRODUCER, G_ROCKETMQ_IPPORT);//生产者名称和NameServer地址
|
||||||
}
|
}
|
||||||
catch (const std::exception& e) {
|
catch (const std::exception& e) {
|
||||||
std::cerr << "Failed to initialize producer: " << e.what() << std::endl;
|
std::cerr << "Failed to initialize producer: " << e.what() << std::endl;
|
||||||
@@ -533,43 +849,37 @@ void ShutdownAndDestroyProducer()
|
|||||||
}
|
}
|
||||||
|
|
||||||
// 发送消息的接口函数
|
// 发送消息的接口函数
|
||||||
void rocketmq_producer_send(const char* strbody, const char* topic)
|
void rocketmq_producer_send(const std::string& body,
|
||||||
|
const std::string& topic,
|
||||||
|
const std::string& tags,
|
||||||
|
const std::string& keys)
|
||||||
{
|
{
|
||||||
if (g_producer == NULL) {
|
std::call_once(g_producer_once, [&](){
|
||||||
try {
|
InitializeProducer();
|
||||||
InitializeProducer();
|
});
|
||||||
}
|
|
||||||
catch (...) {
|
|
||||||
std::cerr << "Cannot send message because producer initialization failed." << std::endl;
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// 假设 tags 和 keys 是固定的,可以根据需要修改
|
|
||||||
std::string tags = G_ROCKETMQ_TAG;
|
|
||||||
std::string keys = G_ROCKETMQ_KEY;
|
|
||||||
|
|
||||||
try {
|
try {
|
||||||
g_producer->sendMessage(strbody, topic, tags, keys);
|
g_producer->sendMessage(body, topic, tags, keys);
|
||||||
}
|
} catch (const std::exception& e) {
|
||||||
catch (const std::exception& e) {
|
|
||||||
std::cerr << "Failed to send message: " << e.what() << std::endl;
|
std::cerr << "Failed to send message: " << e.what() << std::endl;
|
||||||
// 处理发送失败的情况,例如记录日志或重试
|
DIY_ERRORLOG_CODE("process",0,LOG_CODE_MQ,
|
||||||
DIY_ERRORLOG_CODE("process",LOG_CODE_MQ,"【ERROR】前置的%s%d号进程 mq发送失败,请检查mq配置", get_front_msg_from_subdir(), g_front_seg_index);
|
"【ERROR】前置的%s%d号进程 mq发送失败,请检查mq配置",
|
||||||
|
get_front_msg_from_subdir(), g_front_seg_index);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
//////////////////////////////////////////////////////////////////////////////////////////////////////////
|
//////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
|
/*
|
||||||
// producer_send0测试用
|
// producer_send0测试用
|
||||||
void StartSendMessage(CProducer* producer)
|
void StartSendMessage(CProducer* producer)
|
||||||
{
|
{
|
||||||
CSendResult result;
|
CSendResult result;
|
||||||
|
|
||||||
// create message and set some values for it
|
// create message and set some values for it
|
||||||
CMessage* msg = CreateMessage(G_ROCKETMQ_TOPIC.c_str());
|
CMessage* msg = CreateMessage(G_ROCKETMQ_TOPIC_TEST.c_str());
|
||||||
SetMessageTags(msg, G_ROCKETMQ_TAG.c_str());
|
SetMessageTags(msg, G_ROCKETMQ_TAG_TEST.c_str());
|
||||||
SetMessageKeys(msg, G_ROCKETMQ_KEY.c_str());
|
SetMessageKeys(msg, G_ROCKETMQ_KEY_TEST.c_str());
|
||||||
|
|
||||||
for (int i = 0; i < 10; i++)
|
for (int i = 0; i < 10; i++)
|
||||||
{
|
{
|
||||||
@@ -593,9 +903,9 @@ void StartSendMessage(CProducer* producer,const char* strbody)
|
|||||||
CSendResult result;
|
CSendResult result;
|
||||||
|
|
||||||
// create message and set some values for it
|
// create message and set some values for it
|
||||||
CMessage* msg = CreateMessage(G_ROCKETMQ_TOPIC.c_str());
|
CMessage* msg = CreateMessage(G_ROCKETMQ_TOPIC_TEST.c_str());
|
||||||
SetMessageTags(msg, G_ROCKETMQ_TAG.c_str());
|
SetMessageTags(msg, G_ROCKETMQ_TAG_TEST.c_str());
|
||||||
SetMessageKeys(msg, G_ROCKETMQ_KEY.c_str());
|
SetMessageKeys(msg, G_ROCKETMQ_KEY_TEST.c_str());
|
||||||
|
|
||||||
SetMessageBody(msg, strbody);
|
SetMessageBody(msg, strbody);
|
||||||
// send message
|
// send message
|
||||||
@@ -645,36 +955,36 @@ void producer_send(const char* strbody)
|
|||||||
DestroyProducer(producer);
|
DestroyProducer(producer);
|
||||||
cout << "Producer Shutdown!" << endl;
|
cout << "Producer Shutdown!" << endl;
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
///////////////////////////////////////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
extern "C" {
|
extern "C" {
|
||||||
extern std::string G_MQCONSUMER_TOPIC_RT;
|
//extern std::string G_MQCONSUMER_TOPIC_RT;
|
||||||
void rocketmq_test_rt()
|
void rocketmq_test_rt()
|
||||||
{
|
{
|
||||||
Ckafka_data_t data;
|
Ckafka_data_t data;
|
||||||
data.monitor_id = 123123;
|
data.monitor_id = 123123;
|
||||||
data.strTopic = QString::fromStdString(std::string(FRONT_INST) + "_" + G_MQCONSUMER_TOPIC_RT);
|
data.strTopic = QString::fromStdString(G_MQCONSUMER_TOPIC_RT);
|
||||||
std::ifstream file("rt.txt"); // 文件中存储长字符串
|
std::ifstream file("rt.txt"); // 文件中存储长字符串
|
||||||
std::stringstream buffer;
|
std::stringstream buffer;
|
||||||
buffer << file.rdbuf(); // 读取整个文件内容
|
buffer << file.rdbuf(); // 读取整个文件内容
|
||||||
|
|
||||||
data.strText = QString::fromStdString(buffer.str());
|
data.strText = QString::fromStdString(buffer.str());
|
||||||
data.mp_id = 123123;
|
data.mp_id = QString::number(123456);
|
||||||
my_rocketmq_send(data);
|
my_rocketmq_send(data);
|
||||||
}
|
}
|
||||||
extern std::string G_MQCONSUMER_TOPIC_UD;
|
//extern std::string G_MQCONSUMER_TOPIC_UD;
|
||||||
void rocketmq_test_ud()//用来测试台账更新
|
void rocketmq_test_ud()//用来测试台账更新
|
||||||
{
|
{
|
||||||
Ckafka_data_t data;
|
Ckafka_data_t data;
|
||||||
data.monitor_id = 123123;
|
data.monitor_id = 123123;
|
||||||
data.strTopic = QString::fromStdString(std::string(FRONT_INST) + "_" + G_MQCONSUMER_TOPIC_UD);
|
data.strTopic = QString::fromStdString(G_MQCONSUMER_TOPIC_UD);
|
||||||
std::ifstream file("ud.txt"); // 文件中存储长字符串
|
std::ifstream file("ud.txt"); // 文件中存储长字符串
|
||||||
std::stringstream buffer;
|
std::stringstream buffer;
|
||||||
buffer << file.rdbuf(); // 读取整个文件内容
|
buffer << file.rdbuf(); // 读取整个文件内容
|
||||||
|
|
||||||
data.strText = QString::fromStdString(buffer.str());
|
data.strText = QString::fromStdString(buffer.str());
|
||||||
data.mp_id = 123123;
|
data.mp_id = QString::number(123456);
|
||||||
my_rocketmq_send(data);
|
my_rocketmq_send(data);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -682,13 +992,13 @@ void rocketmq_test_set()//用来测试进程控制脚本
|
|||||||
{
|
{
|
||||||
Ckafka_data_t data;
|
Ckafka_data_t data;
|
||||||
data.monitor_id = 123123;
|
data.monitor_id = 123123;
|
||||||
data.strTopic = QString::fromStdString(std::string(FRONT_INST) + "_" + G_MQCONSUMER_TOPIC_SET);
|
data.strTopic = QString::fromStdString(G_MQCONSUMER_TOPIC_SET);
|
||||||
std::ifstream file("set.txt"); // 文件中存储长字符串
|
std::ifstream file("set.txt"); // 文件中存储长字符串
|
||||||
std::stringstream buffer;
|
std::stringstream buffer;
|
||||||
buffer << file.rdbuf(); // 读取整个文件内容
|
buffer << file.rdbuf(); // 读取整个文件内容
|
||||||
|
|
||||||
data.strText = QString::fromStdString(buffer.str());
|
data.strText = QString::fromStdString(buffer.str());
|
||||||
data.mp_id = 123123;
|
data.mp_id = QString::number(123456);
|
||||||
my_rocketmq_send(data);
|
my_rocketmq_send(data);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -696,43 +1006,43 @@ void rocketmq_test_only()//用来测试进程控制脚本
|
|||||||
{
|
{
|
||||||
Ckafka_data_t data;
|
Ckafka_data_t data;
|
||||||
data.monitor_id = 123123;
|
data.monitor_id = 123123;
|
||||||
data.strTopic = QString::fromStdString(std::string(FRONT_INST) + "_" + G_MQCONSUMER_TOPIC_SET);
|
data.strTopic = QString::fromStdString(G_MQCONSUMER_TOPIC_TEST);
|
||||||
std::ifstream file("set_debug.txt"); // 文件中存储长字符串
|
std::ifstream file("test.txt"); // 文件中存储长字符串
|
||||||
std::stringstream buffer;
|
std::stringstream buffer;
|
||||||
buffer << file.rdbuf(); // 读取整个文件内容
|
buffer << file.rdbuf(); // 读取整个文件内容
|
||||||
|
|
||||||
data.strText = QString::fromStdString(buffer.str());
|
data.strText = QString::fromStdString(buffer.str());
|
||||||
data.mp_id = 123123;
|
data.mp_id = QString::number(123456);
|
||||||
my_rocketmq_send(data);
|
my_rocketmq_send(data);
|
||||||
}
|
}
|
||||||
|
|
||||||
extern std::string G_MQCONSUMER_TOPIC_RC;
|
//extern std::string G_MQCONSUMER_TOPIC_RC;
|
||||||
void rocketmq_test_rc()
|
void rocketmq_test_rc()
|
||||||
{
|
{
|
||||||
Ckafka_data_t data;
|
Ckafka_data_t data;
|
||||||
data.monitor_id = 123123;
|
data.monitor_id = 123123;
|
||||||
data.strTopic = QString::fromStdString(std::string(FRONT_INST) + "_" + G_MQCONSUMER_TOPIC_RC);
|
data.strTopic = QString::fromStdString(G_MQCONSUMER_TOPIC_RC);
|
||||||
std::ifstream file("rc.txt"); // 文件中存储长字符串
|
std::ifstream file("rc.txt"); // 文件中存储长字符串
|
||||||
std::stringstream buffer;
|
std::stringstream buffer;
|
||||||
buffer << file.rdbuf(); // 读取整个文件内容
|
buffer << file.rdbuf(); // 读取整个文件内容
|
||||||
|
|
||||||
data.strText = QString::fromStdString(buffer.str());
|
data.strText = QString::fromStdString(buffer.str());
|
||||||
data.mp_id = 123123;
|
data.mp_id = QString::number(123456);
|
||||||
my_rocketmq_send(data);
|
my_rocketmq_send(data);
|
||||||
}
|
}
|
||||||
|
|
||||||
extern std::string G_MQCONSUMER_TOPIC_LOG;
|
//extern std::string G_MQCONSUMER_TOPIC_LOG;
|
||||||
void rocketmq_test_log()
|
void rocketmq_test_log()
|
||||||
{
|
{
|
||||||
Ckafka_data_t data;
|
Ckafka_data_t data;
|
||||||
data.monitor_id = 123123;
|
data.monitor_id = 123123;
|
||||||
data.strTopic = QString::fromStdString(std::string(FRONT_INST) + "_" + G_MQCONSUMER_TOPIC_LOG);
|
data.strTopic = QString::fromStdString(G_MQCONSUMER_TOPIC_LOG);
|
||||||
std::ifstream file("log_test.txt"); // 文件中存储长字符串
|
std::ifstream file("log_test.txt"); // 文件中存储长字符串
|
||||||
std::stringstream buffer;
|
std::stringstream buffer;
|
||||||
buffer << file.rdbuf(); // 读取整个文件内容
|
buffer << file.rdbuf(); // 读取整个文件内容
|
||||||
|
|
||||||
data.strText = QString::fromStdString(buffer.str());
|
data.strText = QString::fromStdString(buffer.str());
|
||||||
data.mp_id = 123123;
|
data.mp_id = QString::number(123456);
|
||||||
my_rocketmq_send(data);
|
my_rocketmq_send(data);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -280,9 +280,9 @@ extern int g_front_seg_num;
|
|||||||
//生产者
|
//生产者
|
||||||
std::string G_ROCKETMQ_PRODUCER = "";//rocketmq producer
|
std::string G_ROCKETMQ_PRODUCER = "";//rocketmq producer
|
||||||
std::string G_ROCKETMQ_IPPORT = "";//rocketmq ip+port
|
std::string G_ROCKETMQ_IPPORT = "";//rocketmq ip+port
|
||||||
std::string G_ROCKETMQ_TOPIC = "";//topie
|
std::string G_ROCKETMQ_TOPIC_TEST = "";//topie
|
||||||
std::string G_ROCKETMQ_TAG = "";//tag
|
std::string G_ROCKETMQ_TAG_TEST = "";//tag
|
||||||
std::string G_ROCKETMQ_KEY = "";//key
|
std::string G_ROCKETMQ_KEY_TEST = "";//key
|
||||||
int QUEUENUM = 0;
|
int QUEUENUM = 0;
|
||||||
std::string BROKERNAME = "";
|
std::string BROKERNAME = "";
|
||||||
//消费者
|
//消费者
|
||||||
@@ -327,6 +327,12 @@ std::string G_MQCONSUMER_TOPIC_FILE = "";//consumer topie
|
|||||||
std::string G_MQCONSUMER_TAG_FILE = "";//consumer tag
|
std::string G_MQCONSUMER_TAG_FILE = "";//consumer tag
|
||||||
std::string G_MQCONSUMER_KEY_FILE = "";//consumer key
|
std::string G_MQCONSUMER_KEY_FILE = "";//consumer key
|
||||||
|
|
||||||
|
std::string G_REPLY_TOPIC_FILE = "";//consumer topie
|
||||||
|
std::string G_REPLY_TAG_FILE = "";//consumer tag
|
||||||
|
std::string G_REPLY_KEY_FILE = "";//consumer key
|
||||||
|
|
||||||
|
std::string G_MQCONSUMER_TOPIC_TEST = "";
|
||||||
|
|
||||||
int G_TEST_FLAG = 0;
|
int G_TEST_FLAG = 0;
|
||||||
int G_TEST_NUM = 0;
|
int G_TEST_NUM = 0;
|
||||||
int G_TEST_TYPE = 0;
|
int G_TEST_TYPE = 0;
|
||||||
@@ -358,6 +364,14 @@ std::string WEB_EVENT = "";
|
|||||||
std::string WEB_FILEUPLOAD = "";
|
std::string WEB_FILEUPLOAD = "";
|
||||||
std::string WEB_FILEDOWNLOAD = "";
|
std::string WEB_FILEDOWNLOAD = "";
|
||||||
|
|
||||||
|
// 日志限流配置
|
||||||
|
int G_LOG_RATE_RESET_SEC = 3600; // 1小时重置
|
||||||
|
int G_LOG_RATE_LIMIT_SEC = 60; // 进入限流后:60秒1条
|
||||||
|
int G_LOG_RATE_KEEP_ALL_MS = 60000; // 间隔 >= 60000ms,全部保留
|
||||||
|
int G_LOG_RATE_KEEP_BURST_MS = 1000; // 间隔 >= 1000ms,按二级策略
|
||||||
|
int G_LOG_RATE_KEEP_BURST_COUNT = 60; // 二级保留前60条
|
||||||
|
int G_LOG_RATE_KEEP_HIGHFREQ_COUNT = 10; // 高频保留前10条
|
||||||
|
|
||||||
//lnk20250115添加台账锁
|
//lnk20250115添加台账锁
|
||||||
extern pthread_mutex_t mtx;
|
extern pthread_mutex_t mtx;
|
||||||
|
|
||||||
@@ -540,7 +554,7 @@ void init_config() {
|
|||||||
qDebug() << "Read POSTGRES_DNSNAME:" << POSTGRES_DNSNAME << endl;
|
qDebug() << "Read POSTGRES_DNSNAME:" << POSTGRES_DNSNAME << endl;
|
||||||
qDebug() << "Read POSTGRES_TABLEPREFIX:" << POSTGRES_TABLEPREFIX << endl;
|
qDebug() << "Read POSTGRES_TABLEPREFIX:" << POSTGRES_TABLEPREFIX << endl;
|
||||||
|
|
||||||
|
/*
|
||||||
ba = settings.value("Oss/OssEndpoint", "").toString().toLatin1();
|
ba = settings.value("Oss/OssEndpoint", "").toString().toLatin1();
|
||||||
OSS_ENDPOINT = strdup(ba.data());
|
OSS_ENDPOINT = strdup(ba.data());
|
||||||
ba = settings.value("Oss/AccessKeyID", "").toString().toLatin1();
|
ba = settings.value("Oss/AccessKeyID", "").toString().toLatin1();
|
||||||
@@ -549,11 +563,11 @@ void init_config() {
|
|||||||
ACCESS_KEY_SECRET = strdup(ba.data());
|
ACCESS_KEY_SECRET = strdup(ba.data());
|
||||||
ba = settings.value("Oss/BucketName", "").toString().toLatin1();
|
ba = settings.value("Oss/BucketName", "").toString().toLatin1();
|
||||||
BUCKET_NAME = strdup(ba.data());
|
BUCKET_NAME = strdup(ba.data());
|
||||||
|
|
||||||
qDebug() << "Read OSS_ENDPOINT:" << OSS_ENDPOINT << endl;
|
qDebug() << "Read OSS_ENDPOINT:" << OSS_ENDPOINT << endl;
|
||||||
qDebug() << "Read ACCESS_KEY_ID:" << ACCESS_KEY_ID << endl;
|
qDebug() << "Read ACCESS_KEY_ID:" << ACCESS_KEY_ID << endl;
|
||||||
qDebug() << "Read ACCESS_KEY_SECRET:" << ACCESS_KEY_SECRET << endl;
|
qDebug() << "Read ACCESS_KEY_SECRET:" << ACCESS_KEY_SECRET << endl;
|
||||||
qDebug() << "Read BUCKET_NAME:" << BUCKET_NAME << endl;
|
qDebug() << "Read BUCKET_NAME:" << BUCKET_NAME << endl;
|
||||||
|
*/
|
||||||
|
|
||||||
ba = settings.value("Kafka/brokerlist", "").toString().toLatin1();
|
ba = settings.value("Kafka/brokerlist", "").toString().toLatin1();
|
||||||
BROKER_LIST = strdup(ba.data());
|
BROKER_LIST = strdup(ba.data());
|
||||||
@@ -636,12 +650,12 @@ void init_config() {
|
|||||||
G_ROCKETMQ_PRODUCER = strdup(ba.data());
|
G_ROCKETMQ_PRODUCER = strdup(ba.data());
|
||||||
ba = settings.value("RocketMq/Ipport", "").toString().toLatin1();
|
ba = settings.value("RocketMq/Ipport", "").toString().toLatin1();
|
||||||
G_ROCKETMQ_IPPORT = strdup(ba.data());
|
G_ROCKETMQ_IPPORT = strdup(ba.data());
|
||||||
ba = settings.value("RocketMq/Topic", "").toString().toLatin1();
|
ba = settings.value("RocketMq/TESTTopic", "").toString().toLatin1();
|
||||||
G_ROCKETMQ_TOPIC = strdup(ba.data());
|
G_ROCKETMQ_TOPIC_TEST = strdup(ba.data());
|
||||||
ba = settings.value("RocketMq/Tag", "").toString().toLatin1();
|
ba = settings.value("RocketMq/TESTTag", "").toString().toLatin1();
|
||||||
G_ROCKETMQ_TAG = strdup(ba.data());
|
G_ROCKETMQ_TAG_TEST = strdup(ba.data());
|
||||||
ba = settings.value("RocketMq/Key", "").toString().toLatin1();
|
ba = settings.value("RocketMq/TESTKey", "").toString().toLatin1();
|
||||||
G_ROCKETMQ_KEY = strdup(ba.data());
|
G_ROCKETMQ_KEY_TEST = strdup(ba.data());
|
||||||
QUEUENUM = settings.value("RocketMq/Queuenum", 0).toInt();
|
QUEUENUM = settings.value("RocketMq/Queuenum", 0).toInt();
|
||||||
|
|
||||||
//心跳
|
//心跳
|
||||||
@@ -716,12 +730,21 @@ void init_config() {
|
|||||||
G_CONNECT_KEY = strdup(ba.data());
|
G_CONNECT_KEY = strdup(ba.data());
|
||||||
|
|
||||||
//lnk20260310添加文件管理的topic和tag
|
//lnk20260310添加文件管理的topic和tag
|
||||||
ba = settings.value("RocketMq/ConsumerTopicFile", "").toString().toLatin1();
|
ba = settings.value("RocketMq/ConsumerTopicFILE", "").toString().toLatin1();
|
||||||
G_MQCONSUMER_TOPIC_FILE = strdup(ba.data());
|
G_MQCONSUMER_TOPIC_FILE = strdup(ba.data());
|
||||||
ba = settings.value("RocketMq/ConsumerTagFile", "").toString().toLatin1();
|
ba = settings.value("RocketMq/ConsumerTagFILE", "").toString().toLatin1();
|
||||||
G_MQCONSUMER_TAG_FILE = strdup(ba.data());
|
G_MQCONSUMER_TAG_FILE = strdup(ba.data());
|
||||||
ba = settings.value("RocketMq/ConsumerKeyFile", "").toString().toLatin1();
|
ba = settings.value("RocketMq/ConsumerKeyFILE", "").toString().toLatin1();
|
||||||
G_MQCONSUMER_KEY_FILE = strdup(ba.data());
|
G_MQCONSUMER_KEY_FILE = strdup(ba.data());
|
||||||
|
ba = settings.value("RocketMq/ReplyTopicFILE", "").toString().toLatin1();
|
||||||
|
G_REPLY_TOPIC_FILE = strdup(ba.data());
|
||||||
|
ba = settings.value("RocketMq/ReplyTagFILE", "").toString().toLatin1();
|
||||||
|
G_REPLY_TAG_FILE = strdup(ba.data());
|
||||||
|
ba = settings.value("RocketMq/ReplyKeyFILE", "").toString().toLatin1();
|
||||||
|
G_REPLY_KEY_FILE = strdup(ba.data());
|
||||||
|
|
||||||
|
ba = settings.value("RocketMq/ConsumerTopicTEST", "").toString().toLatin1();
|
||||||
|
G_MQCONSUMER_TOPIC_TEST = strdup(ba.data());
|
||||||
|
|
||||||
|
|
||||||
//MQ测试
|
//MQ测试
|
||||||
@@ -739,9 +762,9 @@ void init_config() {
|
|||||||
//生产者相关打印
|
//生产者相关打印
|
||||||
std::cout << "Read G_ROCKETMQ_PRODUCER:" << G_ROCKETMQ_PRODUCER << std::endl;
|
std::cout << "Read G_ROCKETMQ_PRODUCER:" << G_ROCKETMQ_PRODUCER << std::endl;
|
||||||
std::cout << "Read G_ROCKETMQ_IPPORT:" << G_ROCKETMQ_IPPORT << std::endl;
|
std::cout << "Read G_ROCKETMQ_IPPORT:" << G_ROCKETMQ_IPPORT << std::endl;
|
||||||
std::cout << "Read G_ROCKETMQ_TOPIC:" << G_ROCKETMQ_TOPIC << std::endl;
|
std::cout << "Read G_ROCKETMQ_TOPIC_TEST:" << G_ROCKETMQ_TOPIC_TEST << std::endl;
|
||||||
std::cout << "Read G_ROCKETMQ_TAG:" << G_ROCKETMQ_TAG << std::endl;
|
std::cout << "Read G_ROCKETMQ_TAG_TEST:" << G_ROCKETMQ_TAG_TEST << std::endl;
|
||||||
std::cout << "Read G_ROCKETMQ_KEY:" << G_ROCKETMQ_KEY << std::endl;
|
std::cout << "Read G_ROCKETMQ_KEY_TEST:" << G_ROCKETMQ_KEY_TEST << std::endl;
|
||||||
std::cout << "Read QUEUENUM:" << QUEUENUM << std::endl;
|
std::cout << "Read QUEUENUM:" << QUEUENUM << std::endl;
|
||||||
std::cout << "Read G_LOG_TOPIC:" << G_LOG_TOPIC << std::endl;
|
std::cout << "Read G_LOG_TOPIC:" << G_LOG_TOPIC << std::endl;
|
||||||
std::cout << "Read G_LOG_TAG:" << G_LOG_TAG << std::endl;
|
std::cout << "Read G_LOG_TAG:" << G_LOG_TAG << std::endl;
|
||||||
@@ -781,6 +804,29 @@ void init_config() {
|
|||||||
std::cout << "Read G_TEST_NUM:" << G_TEST_NUM << std::endl;
|
std::cout << "Read G_TEST_NUM:" << G_TEST_NUM << std::endl;
|
||||||
std::cout << "Read G_TEST_TYPE:" << G_TEST_TYPE << std::endl;
|
std::cout << "Read G_TEST_TYPE:" << G_TEST_TYPE << std::endl;
|
||||||
|
|
||||||
|
|
||||||
|
// 日志限流配置
|
||||||
|
G_LOG_RATE_RESET_SEC = settings.value("LogRate/ResetSec", 3600).toInt();
|
||||||
|
G_LOG_RATE_LIMIT_SEC = settings.value("LogRate/LimitSec", 60).toInt();
|
||||||
|
G_LOG_RATE_KEEP_ALL_MS = settings.value("LogRate/KeepAllMs", 60000).toInt();
|
||||||
|
G_LOG_RATE_KEEP_BURST_MS = settings.value("LogRate/KeepBurstMs", 1000).toInt();
|
||||||
|
G_LOG_RATE_KEEP_BURST_COUNT = settings.value("LogRate/KeepBurstCount", 60).toInt();
|
||||||
|
G_LOG_RATE_KEEP_HIGHFREQ_COUNT = settings.value("LogRate/KeepHighFreqCount", 10).toInt();
|
||||||
|
|
||||||
|
std::cout << "Read G_LOG_RATE_RESET_SEC:" << G_LOG_RATE_RESET_SEC << std::endl;
|
||||||
|
std::cout << "Read G_LOG_RATE_LIMIT_SEC:" << G_LOG_RATE_LIMIT_SEC << std::endl;
|
||||||
|
std::cout << "Read G_LOG_RATE_KEEP_ALL_MS:" << G_LOG_RATE_KEEP_ALL_MS << std::endl;
|
||||||
|
std::cout << "Read G_LOG_RATE_KEEP_BURST_MS:" << G_LOG_RATE_KEEP_BURST_MS << std::endl;
|
||||||
|
std::cout << "Read G_LOG_RATE_KEEP_BURST_COUNT:" << G_LOG_RATE_KEEP_BURST_COUNT << std::endl;
|
||||||
|
std::cout << "Read G_LOG_RATE_KEEP_HIGHFREQ_COUNT:" << G_LOG_RATE_KEEP_HIGHFREQ_COUNT << std::endl;
|
||||||
|
|
||||||
|
if (G_LOG_RATE_RESET_SEC <= 0) G_LOG_RATE_RESET_SEC = 3600;
|
||||||
|
if (G_LOG_RATE_LIMIT_SEC <= 0) G_LOG_RATE_LIMIT_SEC = 60;
|
||||||
|
if (G_LOG_RATE_KEEP_ALL_MS <= 0) G_LOG_RATE_KEEP_ALL_MS = 60000;
|
||||||
|
if (G_LOG_RATE_KEEP_BURST_MS <= 0) G_LOG_RATE_KEEP_BURST_MS = 1000;
|
||||||
|
if (G_LOG_RATE_KEEP_BURST_COUNT < 0) G_LOG_RATE_KEEP_BURST_COUNT = 60;
|
||||||
|
if (G_LOG_RATE_KEEP_HIGHFREQ_COUNT < 0) G_LOG_RATE_KEEP_HIGHFREQ_COUNT = 10;
|
||||||
|
|
||||||
//20241212lnk添加多前置
|
//20241212lnk添加多前置
|
||||||
if (g_front_seg_index != 0 && g_front_seg_num != 0) {
|
if (g_front_seg_index != 0 && g_front_seg_num != 0) {
|
||||||
MULTIPLE_NODE_FLAG = 1;
|
MULTIPLE_NODE_FLAG = 1;
|
||||||
@@ -1499,7 +1545,7 @@ int parse_rpt_log_ini()
|
|||||||
//添加判断,有的监测点没有cpuno为2,直接申请了LD_info[1],没申请LD_info[0]
|
//添加判断,有的监测点没有cpuno为2,直接申请了LD_info[1],没申请LD_info[0]
|
||||||
if(ied_usr->LD_info[cpuno].LD_name == NULL){
|
if(ied_usr->LD_info[cpuno].LD_name == NULL){
|
||||||
printf("this ld_info didn't palloc space ,maybe this ledger has problem!");
|
printf("this ld_info didn't palloc space ,maybe this ledger has problem!");
|
||||||
DIY_ERRORLOG_CODE("process",LOG_CODE_RPTINIT,"【ERROR】终端%s的监测点序号为%d的监测点无法初始化报告,这个装置的台账存在缺失,请检查装置台账的监测点总数和各监测点的序号",ied_usr->terminal_id,cpuno + 1);
|
DIY_ERRORLOG_CODE("process",0,LOG_CODE_RPTINIT,"【ERROR】终端%s的监测点序号为%d的监测点无法初始化报告,这个装置的台账存在缺失,请检查装置台账的监测点总数和各监测点的序号",ied_usr->terminal_id,cpuno + 1);
|
||||||
continue;//跳过防止崩溃
|
continue;//跳过防止崩溃
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1878,18 +1924,18 @@ int parse_ledger_update_xml(trigger_update_xml_t* trigger_update_xml)
|
|||||||
//加载一个文件的内容到数据结构
|
//加载一个文件的内容到数据结构
|
||||||
if (!load_ledger_update_from_xml(trigger_update_xml, filename)) {
|
if (!load_ledger_update_from_xml(trigger_update_xml, filename)) {
|
||||||
std::cout << "read /etc/ledgerupdate/" << filename << " success..." << std::endl;
|
std::cout << "read /etc/ledgerupdate/" << filename << " success..." << std::endl;
|
||||||
DIY_WARNLOG_CODE("process",LOG_CODE_LEDGER_UPDATE,"【WARN】前置的%s%d号进程 读取台账更新文件成功,开始更新台账", get_front_msg_from_subdir(), g_front_seg_index);
|
DIY_WARNLOG_CODE("process",0,LOG_CODE_LEDGER_UPDATE,"【WARN】前置的%s%d号进程 读取台账更新文件成功,开始更新台账", get_front_msg_from_subdir(), g_front_seg_index);
|
||||||
}
|
}
|
||||||
//处理过的文件删除掉
|
//处理过的文件删除掉
|
||||||
|
|
||||||
if (std::remove(filename.c_str()) != 0) {
|
if (std::remove(filename.c_str()) != 0) {
|
||||||
std::cerr << "Failed to remove file: " << filename << " Error: " << strerror(errno) << std::endl;
|
std::cerr << "Failed to remove file: " << filename << " Error: " << strerror(errno) << std::endl;
|
||||||
DIY_ERRORLOG_CODE("process",LOG_CODE_LEDGER_UPDATE,"【ERROR】前置的%s%d号进程 删除已读取的台账更新文件失败!请检查台账更新文件是否残留在/FeProject/etc/ledgerupdate", get_front_msg_from_subdir(), g_front_seg_index);
|
DIY_ERRORLOG_CODE("process",0,LOG_CODE_LEDGER_UPDATE,"【ERROR】前置的%s%d号进程 删除已读取的台账更新文件失败!请检查台账更新文件是否残留在/FeProject/etc/ledgerupdate", get_front_msg_from_subdir(), g_front_seg_index);
|
||||||
return APR_EGENERAL;
|
return APR_EGENERAL;
|
||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
std::cout << "remove file: " << filename << " success..." << std::endl;
|
std::cout << "remove file: " << filename << " success..." << std::endl;
|
||||||
DIY_INFOLOG("process","【NORMAL】前置的%s%d号进程 删除已读取的台账更新文件成功", get_front_msg_from_subdir(), g_front_seg_index);
|
DIY_INFOLOG_CODE("process",0,LOG_CODE_LEDGER_UPDATE,"【NORMAL】前置的%s%d号进程 删除已读取的台账更新文件成功", get_front_msg_from_subdir(), g_front_seg_index);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -2069,7 +2115,7 @@ int parse_3s_xml(trigger_3s_xml_t* trigger_3s_xml)
|
|||||||
|
|
||||||
printf("/etc/trigger3s/*.xml success...\n");
|
printf("/etc/trigger3s/*.xml success...\n");
|
||||||
|
|
||||||
DIY_INFOLOG("process","【WARN】前置读取实时数据触发文件成功,即将注册实时数据报告");
|
DIY_INFOLOG_CODE("process",0,LOG_CODE_RT_DATA,"【WARN】前置读取实时数据触发文件成功,即将注册实时数据报告");
|
||||||
|
|
||||||
return APR_SUCCESS;
|
return APR_SUCCESS;
|
||||||
}
|
}
|
||||||
@@ -2382,7 +2428,7 @@ int parse_recall_xml(recall_xml_t* recall_xml, char* id)
|
|||||||
QDir dir(cfg_dir);
|
QDir dir(cfg_dir);
|
||||||
if (!dir.exists()) {
|
if (!dir.exists()) {
|
||||||
qDebug() << "folder does not exist!";
|
qDebug() << "folder does not exist!";
|
||||||
DIY_ERRORLOG_CODE("process",LOG_CODE_RECALL,"【ERROR】前置的%s%d号进程 无法解析补招文件,补招文件路径/FeProject/etc/recall/不存在", get_front_msg_from_subdir(), g_front_seg_index);
|
DIY_ERRORLOG_CODE("process",0,LOG_CODE_RECALL,"【ERROR】前置的%s%d号进程 无法解析补招文件,补招文件路径/FeProject/etc/recall/不存在", get_front_msg_from_subdir(), g_front_seg_index);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
//指定文件后缀名,可指定多种类型
|
//指定文件后缀名,可指定多种类型
|
||||||
@@ -2398,7 +2444,7 @@ int parse_recall_xml(recall_xml_t* recall_xml, char* id)
|
|||||||
if (!file.open(QIODevice::ReadOnly))
|
if (!file.open(QIODevice::ReadOnly))
|
||||||
{
|
{
|
||||||
qDebug() << "file.open error";
|
qDebug() << "file.open error";
|
||||||
DIY_ERRORLOG_CODE("process",LOG_CODE_RECALL,"【ERROR】前置的%s%d号进程 无法打开补招文件%s", get_front_msg_from_subdir(), g_front_seg_index,qstrRecallPath.toStdString().c_str());
|
DIY_ERRORLOG_CODE("process",0,LOG_CODE_RECALL,"【ERROR】前置的%s%d号进程 无法打开补招文件%s", get_front_msg_from_subdir(), g_front_seg_index,qstrRecallPath.toStdString().c_str());
|
||||||
continue; //以只读方式打开
|
continue; //以只读方式打开
|
||||||
}
|
}
|
||||||
bool ret = doc.setContent(&file);
|
bool ret = doc.setContent(&file);
|
||||||
@@ -2406,7 +2452,7 @@ int parse_recall_xml(recall_xml_t* recall_xml, char* id)
|
|||||||
if (!ret)
|
if (!ret)
|
||||||
{
|
{
|
||||||
qDebug() << "doc.setContent error";
|
qDebug() << "doc.setContent error";
|
||||||
DIY_ERRORLOG_CODE("process",LOG_CODE_RECALL,"【ERROR】前置的%s%d号进程 无法解析补招文件%s,补招内容无效", get_front_msg_from_subdir(), g_front_seg_index,qstrRecallPath.toStdString().c_str());
|
DIY_ERRORLOG_CODE("process",0,LOG_CODE_RECALL,"【ERROR】前置的%s%d号进程 无法解析补招文件%s,补招内容无效", get_front_msg_from_subdir(), g_front_seg_index,qstrRecallPath.toStdString().c_str());
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
//将文件内容读到doc中
|
//将文件内容读到doc中
|
||||||
@@ -2984,7 +3030,7 @@ void DeletcRecallXml() {
|
|||||||
QDir dir(cfg_dir);
|
QDir dir(cfg_dir);
|
||||||
if (!dir.exists()) {
|
if (!dir.exists()) {
|
||||||
qDebug() << "folder does not exist!";
|
qDebug() << "folder does not exist!";
|
||||||
DIY_ERRORLOG_CODE("process",LOG_CODE_RECALL,"【ERROR】前置的%s%d号进程 删除旧的补招文件失败,补招文件路径/FeProject/etc/recall/不存在", get_front_msg_from_subdir(), g_front_seg_index);
|
DIY_ERRORLOG_CODE("process",0,LOG_CODE_RECALL,"【ERROR】前置的%s%d号进程 删除旧的补招文件失败,补招文件路径/FeProject/etc/recall/不存在", get_front_msg_from_subdir(), g_front_seg_index);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
QStringList filter(file_name);
|
QStringList filter(file_name);
|
||||||
@@ -2999,7 +3045,7 @@ void DeletcRecallXml() {
|
|||||||
if (fileInfo.lastModified() < saveDaysAgo) {
|
if (fileInfo.lastModified() < saveDaysAgo) {
|
||||||
QFile::remove(fileInfo.absoluteFilePath());
|
QFile::remove(fileInfo.absoluteFilePath());
|
||||||
|
|
||||||
DIY_INFOLOG("process","【NORMAL】前置的%s%d号进程 删除超过两天的补招文件", get_front_msg_from_subdir(), g_front_seg_index);
|
DIY_INFOLOG_CODE("process",0,LOG_CODE_RECALL,"【NORMAL】前置的%s%d号进程 删除超过两天的补招文件", get_front_msg_from_subdir(), g_front_seg_index);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -3016,7 +3062,7 @@ void CreateRecallXml()
|
|||||||
{
|
{
|
||||||
printf("insert ID_CJournalRecall_Map!\n");
|
printf("insert ID_CJournalRecall_Map!\n");
|
||||||
|
|
||||||
DIY_INFOLOG("process","【NORMAL】前置的%s%d号进程 开始写入补招文件", get_front_msg_from_subdir(), g_front_seg_index);
|
DIY_INFOLOG_CODE("process",0,LOG_CODE_RECALL,"【NORMAL】前置的%s%d号进程 开始写入补招文件", get_front_msg_from_subdir(), g_front_seg_index);
|
||||||
|
|
||||||
QMap<QString, QList<CJournalRecall> > ID_CJournalRecall_Map;
|
QMap<QString, QList<CJournalRecall> > ID_CJournalRecall_Map;
|
||||||
|
|
||||||
@@ -3049,7 +3095,7 @@ void CreateRecallXml()
|
|||||||
if (!file.open(QIODevice::WriteOnly | QIODevice::Truncate)) {
|
if (!file.open(QIODevice::WriteOnly | QIODevice::Truncate)) {
|
||||||
printf("补招查询完成,打开%s失败,无法写入线路补招配置!\n", qstrRecallPath.toAscii().data());
|
printf("补招查询完成,打开%s失败,无法写入线路补招配置!\n", qstrRecallPath.toAscii().data());
|
||||||
|
|
||||||
DIY_ERRORLOG_CODE("process",LOG_CODE_RECALL,"【ERROR】前置的%s%d号进程 无法将补招文件写入补招文件路径/FeProject/etc/recall/", get_front_msg_from_subdir(), g_front_seg_index);
|
DIY_ERRORLOG_CODE("process",0,LOG_CODE_RECALL,"【ERROR】前置的%s%d号进程 无法将补招文件写入补招文件路径/FeProject/etc/recall/", get_front_msg_from_subdir(), g_front_seg_index);
|
||||||
|
|
||||||
QMap<QString, QList<CJournalRecall> >().swap(ID_CJournalRecall_Map);
|
QMap<QString, QList<CJournalRecall> >().swap(ID_CJournalRecall_Map);
|
||||||
return;
|
return;
|
||||||
@@ -3766,14 +3812,14 @@ int terminal_ledger_web(QMap<QString, terminal_dev*>* terminal_dev_map,
|
|||||||
// 参数验证
|
// 参数验证
|
||||||
if (num <= 0) {
|
if (num <= 0) {
|
||||||
std::cerr << "Error: 'num' must be greater than 0." << std::endl;
|
std::cerr << "Error: 'num' must be greater than 0." << std::endl;
|
||||||
DIY_ERRORLOG_CODE("process",LOG_CODE_LEDGER,"【ERROR】前置的多进程最大进程号为:%d,应该为大于0的整数",num);
|
DIY_ERRORLOG_CODE("process",0,LOG_CODE_LEDGER,"【ERROR】前置的多进程最大进程号为:%d,应该为大于0的整数",num);
|
||||||
return 1; // 返回适当的错误码
|
return 1; // 返回适当的错误码
|
||||||
}
|
}
|
||||||
|
|
||||||
index = index - 1;
|
index = index - 1;
|
||||||
if (index < 0 || index >= num) {
|
if (index < 0 || index >= num) {
|
||||||
std::cerr << "Error: 'index' must be in the range [0, num]." << std::endl;
|
std::cerr << "Error: 'index' must be in the range [0, num]." << std::endl;
|
||||||
DIY_ERRORLOG_CODE("process",LOG_CODE_LEDGER,"【ERROR】前置当前进程的进程号为:%d,应该为0到最大进程号范围内的整数",index);
|
DIY_ERRORLOG_CODE("process",0,LOG_CODE_LEDGER,"【ERROR】前置当前进程的进程号为:%d,应该为0到最大进程号范围内的整数",index);
|
||||||
return 1; // 返回适当的错误码
|
return 1; // 返回适当的错误码
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -3781,7 +3827,7 @@ int terminal_ledger_web(QMap<QString, terminal_dev*>* terminal_dev_map,
|
|||||||
// 获取参数
|
// 获取参数
|
||||||
if (codes.empty()) {
|
if (codes.empty()) {
|
||||||
std::cerr << "Error: 'codes' vector is empty." << std::endl;
|
std::cerr << "Error: 'codes' vector is empty." << std::endl;
|
||||||
DIY_ERRORLOG_CODE("process",LOG_CODE_LEDGER,"【ERROR】前置的%s%d号进程调用web台账接口的入参为空",get_front_msg_from_subdir(), g_front_seg_index);
|
DIY_ERRORLOG_CODE("process",0,LOG_CODE_LEDGER,"【ERROR】前置的%s%d号进程调用web台账接口的入参为空",get_front_msg_from_subdir(), g_front_seg_index);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -3834,7 +3880,7 @@ int terminal_ledger_web(QMap<QString, terminal_dev*>* terminal_dev_map,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
std::cerr << "data 无效或为空数组,重试" << std::endl;
|
std::cerr << "data 无效或为空数组,重试" << std::endl;
|
||||||
DIY_ERRORLOG_CODE("process",LOG_CODE_LEDGER,"【ERROR】前置从web接口中获取的台账信息为空或者无效信息无法解析,请核对前置使用的入参信息:%s",parm.c_str());
|
DIY_ERRORLOG_CODE("process",0,LOG_CODE_LEDGER,"【ERROR】前置从web接口中获取的台账信息为空或者无效信息无法解析,请核对前置使用的入参信息:%s",parm.c_str());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -3881,7 +3927,7 @@ int terminal_ledger_web(QMap<QString, terminal_dev*>* terminal_dev_map,
|
|||||||
break; // 本地台账解析成功且数组非空
|
break; // 本地台账解析成功且数组非空
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
DIY_ERRORLOG_CODE("process",LOG_CODE_LEDGER,"【ERROR】前置从本地台账中获取的台账信息为空或者无效信息无法解析,请核对前置使用的入参信息:%s",parm.c_str());
|
DIY_ERRORLOG_CODE("process",0,LOG_CODE_LEDGER,"【ERROR】前置从本地台账中获取的台账信息为空或者无效信息无法解析,请核对前置使用的入参信息:%s",parm.c_str());
|
||||||
}
|
}
|
||||||
|
|
||||||
free(ledger); // root==null释放内容
|
free(ledger); // root==null释放内容
|
||||||
@@ -4158,6 +4204,18 @@ int terminal_ledger_web(QMap<QString, terminal_dev*>* terminal_dev_map,
|
|||||||
return 0; // 确保函数有返回值
|
return 0; // 确保函数有返回值
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void init_oper_type_cache(ied_usr_t *ied_usr)
|
||||||
|
{
|
||||||
|
if (ied_usr == NULL)
|
||||||
|
return;
|
||||||
|
|
||||||
|
ied_usr->oper_type_cache.inited = SD_FALSE;
|
||||||
|
|
||||||
|
ied_usr->oper_type_cache.ledrs_oper_type_id = -1;
|
||||||
|
ied_usr->oper_type_cache.reboot_oper_type_id = -1;
|
||||||
|
ied_usr->oper_type_cache.reset_oper_type_id = -1;
|
||||||
|
}
|
||||||
|
|
||||||
int parse_device_cfg_web()
|
int parse_device_cfg_web()
|
||||||
{
|
{
|
||||||
std::cout << "parse_device_cfg_web" << endl;
|
std::cout << "parse_device_cfg_web" << endl;
|
||||||
@@ -4181,7 +4239,7 @@ int parse_device_cfg_web()
|
|||||||
|
|
||||||
std::cout << "input_jstr: " << input_jstr << std::endl; // 输出结果
|
std::cout << "input_jstr: " << input_jstr << std::endl; // 输出结果
|
||||||
|
|
||||||
DIY_DEBUGLOG("process","【DEBUG】前置的%s%d号进程调用web接口获取台账使用的请求输入为:%s",get_front_msg_from_subdir(), g_front_seg_index,input_jstr);
|
DIY_DEBUGLOG_CODE("process",0,LOG_CODE_LEDGER,"【DEBUG】前置的%s%d号进程调用web接口获取台账使用的请求输入为:%s",get_front_msg_from_subdir(), g_front_seg_index,input_jstr);
|
||||||
|
|
||||||
codes.push_back(input_jstr); //是否需要筛选状态直接在配置文件控制
|
codes.push_back(input_jstr); //是否需要筛选状态直接在配置文件控制
|
||||||
|
|
||||||
@@ -4216,13 +4274,13 @@ int parse_device_cfg_web()
|
|||||||
//判断是否相等
|
//判断是否相等
|
||||||
if(max_process_num != max_index){
|
if(max_process_num != max_index){
|
||||||
if(max_process_num > 0 && max_process_num < 10){
|
if(max_process_num > 0 && max_process_num < 10){
|
||||||
DIY_WARNLOG_CODE("process",LOG_CODE_LEDGER,"【WARN】前置比对台账获取的进程数:%d和本地配置的进程数:%d,不匹配,按照台账进程数重置前置的进程数量",max_process_num,max_index);
|
DIY_WARNLOG_CODE("process",0,LOG_CODE_LEDGER,"【WARN】前置比对台账获取的进程数:%d和本地配置的进程数:%d,不匹配,按照台账进程数重置前置的进程数量",max_process_num,max_index);
|
||||||
// 调用执行脚本函数
|
// 调用执行脚本函数
|
||||||
close_listening_socket();
|
close_listening_socket();
|
||||||
execute_bash("reset", max_process_num, "all");
|
execute_bash("reset", max_process_num, "all");
|
||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
DIY_ERRORLOG_CODE("process",LOG_CODE_LEDGER,"【ERROR】前置从台账获取的进程数:%d不符合范围1~9,按照本地配置进程数启动进程",max_process_num);
|
DIY_ERRORLOG_CODE("process",0,LOG_CODE_LEDGER,"【ERROR】前置从台账获取的进程数:%d不符合范围1~9,按照本地配置进程数启动进程",max_process_num);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -4231,7 +4289,7 @@ int parse_device_cfg_web()
|
|||||||
|
|
||||||
std::cout << "terminal_ledger_num:" << count_cfg << std::endl;
|
std::cout << "terminal_ledger_num:" << count_cfg << std::endl;
|
||||||
|
|
||||||
DIY_DEBUGLOG("process","【DEBUG】前置的%s%d号进程调用获取到的台账的数量为:%d",get_front_msg_from_subdir(), g_front_seg_index,count_cfg);
|
DIY_DEBUGLOG_CODE("process",0,LOG_CODE_LEDGER,"【DEBUG】前置的%s%d号进程调用获取到的台账的数量为:%d",get_front_msg_from_subdir(), g_front_seg_index,count_cfg);
|
||||||
|
|
||||||
//如果当前进程获取的台账为0,按照配置数量申请空间,台账内容为空
|
//如果当前进程获取的台账为0,按照配置数量申请空间,台账内容为空
|
||||||
g_node->n_clients = count_cfg;
|
g_node->n_clients = count_cfg;
|
||||||
@@ -4246,11 +4304,11 @@ int parse_device_cfg_web()
|
|||||||
//添加提示
|
//添加提示
|
||||||
std::cout << "!!!!!!!!!!single process can not add any ledger unless reboot!!!!!!!"<< std::endl;
|
std::cout << "!!!!!!!!!!single process can not add any ledger unless reboot!!!!!!!"<< std::endl;
|
||||||
|
|
||||||
DIY_WARNLOG_CODE("process",LOG_CODE_LEDGER,"【WARN】前置的%s%d号进程获取到的台账的数量大于配置文件中给单个进程配置的台账数量:%d,这个进程将按照获取到的台账的数量来创建台账空间,这个进程不能直接通过台账添加来新增台账,只能通过重启进程或者先删除已有台账再添加台账的方式来添加新台账",get_front_msg_from_subdir(), g_front_seg_index,IED_COUNT);
|
DIY_WARNLOG_CODE("process",0,LOG_CODE_LEDGER,"【WARN】前置的%s%d号进程获取到的台账的数量大于配置文件中给单个进程配置的台账数量:%d,这个进程将按照获取到的台账的数量来创建台账空间,这个进程不能直接通过台账添加来新增台账,只能通过重启进程或者先删除已有台账再添加台账的方式来添加新台账",get_front_msg_from_subdir(), g_front_seg_index,IED_COUNT);
|
||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
g_node->clients = (ied_t**)apr_pcalloc(g_cfg_pool, IED_COUNT * sizeof(ied_t*));//g_node->clients 这块大内存空间存储了 count_cfg 个 ied_t* 类型的指针(即一个指针数组)这是(指向内存块的指针)的指针数组
|
g_node->clients = (ied_t**)apr_pcalloc(g_cfg_pool, IED_COUNT * sizeof(ied_t*));//g_node->clients 这块大内存空间存储了 count_cfg 个 ied_t* 类型的指针(即一个指针数组)这是(指向内存块的指针)的指针数组
|
||||||
DIY_INFOLOG("process","【NORMAL】前置的%s%d号进程根据配置文件中给单个进程配置的台账数量:%d来创建台账空间",get_front_msg_from_subdir(), g_front_seg_index,IED_COUNT);
|
DIY_INFOLOG_CODE("process",0,LOG_CODE_LEDGER,"【NORMAL】前置的%s%d号进程根据配置文件中给单个进程配置的台账数量:%d来创建台账空间",get_front_msg_from_subdir(), g_front_seg_index,IED_COUNT);
|
||||||
}
|
}
|
||||||
|
|
||||||
//把ied放入数组
|
//把ied放入数组
|
||||||
@@ -4391,6 +4449,10 @@ int parse_device_cfg_web()
|
|||||||
apr_snprintf(ied_usr->dev_key, sizeof(ied_usr->dev_key), "%s", "");//DEV_Key
|
apr_snprintf(ied_usr->dev_key, sizeof(ied_usr->dev_key), "%s", "");//DEV_Key
|
||||||
cout << "defalut dev_key:" << ied_usr->dev_key << endl;
|
cout << "defalut dev_key:" << ied_usr->dev_key << endl;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//lnk20260512
|
||||||
|
init_oper_type_cache(ied_usr);
|
||||||
|
|
||||||
//lnk20260304
|
//lnk20260304
|
||||||
ied_usr->log_level = log_level;//日志等级
|
ied_usr->log_level = log_level;//日志等级
|
||||||
cout << "ied_usr->log_level:" << ied_usr->log_level << endl;
|
cout << "ied_usr->log_level:" << ied_usr->log_level << endl;
|
||||||
@@ -4512,7 +4574,7 @@ int parse_device_cfg_web()
|
|||||||
{
|
{
|
||||||
isdelta_flag = 1; //存在一个监测点为角型接线则这个前置就要启动第二个配置列表
|
isdelta_flag = 1; //存在一个监测点为角型接线则这个前置就要启动第二个配置列表
|
||||||
cout << "monitor_id" << monitor_id << "v_wiring_type:" << line_info.v_wiring_type << "is delta wiring:" << isdelta_flag << endl;
|
cout << "monitor_id" << monitor_id << "v_wiring_type:" << line_info.v_wiring_type << "is delta wiring:" << isdelta_flag << endl;
|
||||||
DIY_WARNLOG_CODE("process",LOG_CODE_LEDGER,"【WARN】前置连接的监测点 %s 是角形接线,对应终端为%s 终端类型是%s",line_info.mp_id,ied_usr->terminal_id,ied_usr->dev_type);
|
DIY_WARNLOG_CODE("process",0,LOG_CODE_LEDGER,"【WARN】前置连接的监测点 %s 是角形接线,对应终端为%s 终端类型是%s",line_info.mp_id,ied_usr->terminal_id,ied_usr->dev_type);
|
||||||
}
|
}
|
||||||
strcpy(line_info.monitor_status, monitor_status);
|
strcpy(line_info.monitor_status, monitor_status);
|
||||||
cout << "monitor_status:" << line_info.monitor_status << endl;
|
cout << "monitor_status:" << line_info.monitor_status << endl;
|
||||||
@@ -4786,7 +4848,7 @@ int parse_model_cfg_web()
|
|||||||
|
|
||||||
/////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////
|
||||||
if(parse_model_web(&icd_model_map,codes)){
|
if(parse_model_web(&icd_model_map,codes)){
|
||||||
DIY_ERRORLOG_CODE("process",LOG_CODE_ICD_AND_DOWNLOAD,"【ERROR】前置的%s%d号进程 icd模型接口异常,将使用默认的icd模型,请检查接口配置", get_front_msg_from_subdir(), g_front_seg_index);
|
DIY_ERRORLOG_CODE("process",0,LOG_CODE_ICD_AND_DOWNLOAD,"【ERROR】前置的%s%d号进程 icd模型接口异常,将使用默认的icd模型,请检查接口配置", get_front_msg_from_subdir(), g_front_seg_index);
|
||||||
return APR_SUCCESS; //可以使用默认的映射文件所以返回正常
|
return APR_SUCCESS; //可以使用默认的映射文件所以返回正常
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -5053,7 +5115,7 @@ int recall_json_handle(const char* jstr)
|
|||||||
|
|
||||||
if(strcmp(ied_usr->LD_info[m].mp_id,monitorId.toStdString().c_str()) == 0){//匹配上了
|
if(strcmp(ied_usr->LD_info[m].mp_id,monitorId.toStdString().c_str()) == 0){//匹配上了
|
||||||
|
|
||||||
DIY_INFOLOG("process","【NORMAL】前置的%s%d号进程处理监测点%s -id:%s 的数据补招",get_front_msg_from_subdir(), g_front_seg_index,ied_usr->LD_info[m].name,ied_usr->LD_info[m].mp_id);
|
DIY_INFOLOG_CODE("process",0,LOG_CODE_RECALL,"【NORMAL】前置的%s%d号进程处理监测点%s -id:%s 的数据补招",get_front_msg_from_subdir(), g_front_seg_index,ied_usr->LD_info[m].name,ied_usr->LD_info[m].mp_id);
|
||||||
mppair = 1;
|
mppair = 1;
|
||||||
break;//找到就退出监测点循环
|
break;//找到就退出监测点循环
|
||||||
}
|
}
|
||||||
@@ -5270,13 +5332,13 @@ std::string base64_encode(const std::string& in) {
|
|||||||
return out; // 返回编码后的字符串
|
return out; // 返回编码后的字符串
|
||||||
}
|
}
|
||||||
|
|
||||||
void handleUploadResponse(const std::string& response, char* wavepath) {
|
void handleUploadResponse(const std::string& response,const std::string& localPath, char* wavepath, int type) {
|
||||||
|
|
||||||
// 解析 JSON 响应
|
// 解析 JSON 响应
|
||||||
cJSON* json_data = cJSON_Parse(response.c_str());
|
cJSON* json_data = cJSON_Parse(response.c_str());
|
||||||
if (json_data == nullptr) {
|
if (json_data == nullptr) {
|
||||||
std::cerr << "Error parsing response: " << cJSON_GetErrorPtr() << std::endl;
|
std::cerr << "Error parsing response: " << cJSON_GetErrorPtr() << std::endl;
|
||||||
DIY_ERRORLOG_CODE("process",LOG_CODE_TRANSIENT_COMM,"【ERROR】前置上传文件失败,web返回的消息错误,无法解析");
|
DIY_ERRORLOG_CODE("process",0,LOG_CODE_TRANSIENT_COMM,"【ERROR】前置上传文件失败,web返回的消息错误,无法解析");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -5318,15 +5380,47 @@ void handleUploadResponse(const std::string& response, char* wavepath) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// 拷贝到 wavepath
|
// 拷贝到 wavepath
|
||||||
strcpy(wavepath, nameWithoutExt.c_str());
|
if (type == 1) {
|
||||||
|
strcpy(wavepath, nameWithoutExt.c_str());
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
strcpy(wavepath, name.c_str());
|
||||||
|
}
|
||||||
|
|
||||||
std::cout << "wavepath: " << wavepath << std::endl;
|
std::cout << "wavepath: " << wavepath << std::endl;
|
||||||
|
|
||||||
DIY_INFOLOG("process","【NORMAL】前置上传文件成功,远端文件名:%s",wavepath);
|
DIY_INFOLOG_CODE("process",0,LOG_CODE_TRANSIENT_COMM,"【NORMAL】前置上传文件成功,远端文件名:%s",wavepath);
|
||||||
|
|
||||||
|
// =========================
|
||||||
|
// 上传成功后删除本地文件
|
||||||
|
// =========================
|
||||||
|
if (remove(localPath.c_str()) == 0)
|
||||||
|
{
|
||||||
|
std::cout << "Delete local file success: "
|
||||||
|
<< localPath << std::endl;
|
||||||
|
DIY_INFOLOG_CODE("process",0,
|
||||||
|
LOG_CODE_TRANSIENT_COMM,
|
||||||
|
"【NORMAL】删除本地文件成功:%s",
|
||||||
|
localPath.c_str());
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
std::cout << "Delete local file failed: "
|
||||||
|
<< localPath
|
||||||
|
<< " errno=" << errno
|
||||||
|
<< " err=" << strerror(errno)
|
||||||
|
<< std::endl;
|
||||||
|
DIY_ERRORLOG_CODE("process",0,
|
||||||
|
LOG_CODE_TRANSIENT_COMM,
|
||||||
|
"【ERROR】删除本地文件失败:%s errno=%d err=%s",
|
||||||
|
localPath.c_str(),
|
||||||
|
errno,
|
||||||
|
strerror(errno));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
std::cerr << "Error: Missing expected fields in JSON response." << std::endl;
|
std::cerr << "Error: Missing expected fields in JSON response." << std::endl;
|
||||||
DIY_ERRORLOG_CODE("process",LOG_CODE_TRANSIENT_COMM,"【ERROR】前置上传文件失败,web返回的消息没有远端文件名");
|
DIY_ERRORLOG_CODE("process",0,LOG_CODE_TRANSIENT_COMM,"【ERROR】前置上传文件失败,web返回的消息没有远端文件名");
|
||||||
}
|
}
|
||||||
|
|
||||||
// 释放 JSON 对象
|
// 释放 JSON 对象
|
||||||
@@ -5392,7 +5486,7 @@ void handleUploadResponse(const std::string& response, char* wavepath) {
|
|||||||
}*/
|
}*/
|
||||||
|
|
||||||
//这是dataform发送方式
|
//这是dataform发送方式
|
||||||
void SendFileWeb(const std::string& strUrl, const char* localpath, const char* cloudpath, char* wavepath) {
|
void SendFileWeb(const std::string& strUrl, const char* localpath, const char* cloudpath, char* wavepath,int type) {
|
||||||
// 初始化 curl
|
// 初始化 curl
|
||||||
CURL* curl = curl_easy_init();
|
CURL* curl = curl_easy_init();
|
||||||
if (curl) {
|
if (curl) {
|
||||||
@@ -5443,10 +5537,10 @@ void SendFileWeb(const std::string& strUrl, const char* localpath, const char* c
|
|||||||
CURLcode res = curl_easy_perform(curl);
|
CURLcode res = curl_easy_perform(curl);
|
||||||
if (res != CURLE_OK) {
|
if (res != CURLE_OK) {
|
||||||
std::cerr << "http web failed: " << curl_easy_strerror(res) << std::endl;
|
std::cerr << "http web failed: " << curl_easy_strerror(res) << std::endl;
|
||||||
DIY_ERRORLOG_CODE("process",LOG_CODE_TRANSIENT_COMM,"【ERROR】前置上传暂态录波文件 %s 失败,请检查文件上传接口配置",localpath);
|
DIY_ERRORLOG_CODE("process",0,LOG_CODE_TRANSIENT_COMM,"【ERROR】前置上传暂态录波文件 %s 失败,请检查文件上传接口配置",localpath);
|
||||||
} else {
|
} else {
|
||||||
std::cout << "http web success, response: " << resPost0 << std::endl;
|
std::cout << "http web success, response: " << resPost0 << std::endl;
|
||||||
handleUploadResponse(resPost0, wavepath); // 处理响应
|
handleUploadResponse(resPost0, localpath, wavepath, type); // 处理响应
|
||||||
}
|
}
|
||||||
|
|
||||||
// 清理
|
// 清理
|
||||||
@@ -5461,7 +5555,7 @@ void SendFileWeb(const std::string& strUrl, const char* localpath, const char* c
|
|||||||
void SOEFileWeb(char* localpath,char* cloudpath, char* wavepath)
|
void SOEFileWeb(char* localpath,char* cloudpath, char* wavepath)
|
||||||
{
|
{
|
||||||
//示例ip,更换为实际ip即可
|
//示例ip,更换为实际ip即可
|
||||||
SendFileWeb(WEB_FILEUPLOAD,localpath,cloudpath,wavepath);
|
SendFileWeb(WEB_FILEUPLOAD,localpath,cloudpath,wavepath,1);
|
||||||
}
|
}
|
||||||
|
|
||||||
void SOEFileWeb_test()
|
void SOEFileWeb_test()
|
||||||
@@ -5514,9 +5608,9 @@ int DownloadFileWeb(const std::string& strUrl,
|
|||||||
|
|
||||||
std::string fullUrl = strUrl;
|
std::string fullUrl = strUrl;
|
||||||
if (fullUrl.find('?') == std::string::npos)
|
if (fullUrl.find('?') == std::string::npos)
|
||||||
fullUrl += "?path=";
|
fullUrl += "?filePath=";
|
||||||
else
|
else
|
||||||
fullUrl += "&path=";
|
fullUrl += "&filePath=";
|
||||||
fullUrl += encodedPath;
|
fullUrl += encodedPath;
|
||||||
|
|
||||||
curl_easy_setopt(curl, CURLOPT_URL, fullUrl.c_str());
|
curl_easy_setopt(curl, CURLOPT_URL, fullUrl.c_str());
|
||||||
@@ -5538,15 +5632,26 @@ int DownloadFileWeb(const std::string& strUrl,
|
|||||||
if (res != CURLE_OK)
|
if (res != CURLE_OK)
|
||||||
{
|
{
|
||||||
std::cerr << "DownloadFileWeb failed: " << curl_easy_strerror(res) << std::endl;
|
std::cerr << "DownloadFileWeb failed: " << curl_easy_strerror(res) << std::endl;
|
||||||
|
remove(localpath);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (http_code != 200)
|
if (http_code != 200)
|
||||||
{
|
{
|
||||||
std::cerr << "DownloadFileWeb http code: " << http_code << std::endl;
|
std::cerr << "DownloadFileWeb http code: " << http_code << std::endl;
|
||||||
|
remove(localpath);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (chmod(localpath, 0777) != 0)
|
||||||
|
{
|
||||||
|
std::cerr << "chmod 777 failed: " << localpath << std::endl;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
std::cout << "chmod 777 success: " << localpath << std::endl;
|
||||||
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -5680,6 +5785,9 @@ int update_one_terminal_ledger(terminal* update, int i,ied_t* ied,int terminal_i
|
|||||||
chnl_usr->m_state = CHANNEL_DISCONNECTED;
|
chnl_usr->m_state = CHANNEL_DISCONNECTED;
|
||||||
chnl_usr->m_ClosedMsTime = NEXT_CONNECT_TIME * (-1);
|
chnl_usr->m_ClosedMsTime = NEXT_CONNECT_TIME * (-1);
|
||||||
|
|
||||||
|
//lnk20260512
|
||||||
|
init_oper_type_cache(ied_usr);
|
||||||
|
|
||||||
// 将 monitorData 中的数据写入到 LD_info 中
|
// 将 monitorData 中的数据写入到 LD_info 中
|
||||||
int count_real_monitor = 0; //遍历监测点台账的计数器
|
int count_real_monitor = 0; //遍历监测点台账的计数器
|
||||||
int j;
|
int j;
|
||||||
@@ -6064,7 +6172,7 @@ int parse_rpt_log_ini_one(ied_t* ied)
|
|||||||
//添加判断,有的监测点没有cpuno为2,直接申请了LD_info[2-1],没申请LD_info[0]
|
//添加判断,有的监测点没有cpuno为2,直接申请了LD_info[2-1],没申请LD_info[0]
|
||||||
if(ied_usr->LD_info[cpuno].LD_name == NULL){
|
if(ied_usr->LD_info[cpuno].LD_name == NULL){
|
||||||
printf("this ld_info didn't palloc space ,maybe this ledger has problem!");
|
printf("this ld_info didn't palloc space ,maybe this ledger has problem!");
|
||||||
DIY_ERRORLOG_CODE("process",LOG_CODE_RPTINIT,"【ERROR】终端%s的监测点序号为%d的监测点无法初始化报告,这个装置的台账存在缺失,请检查装置台账的监测点总数和各监测点的序号",ied_usr->terminal_id,cpuno + 1);
|
DIY_ERRORLOG_CODE("process",0,LOG_CODE_RPTINIT,"【ERROR】终端%s的监测点序号为%d的监测点无法初始化报告,这个装置的台账存在缺失,请检查装置台账的监测点总数和各监测点的序号",ied_usr->terminal_id,cpuno + 1);
|
||||||
continue;//跳过防止崩溃
|
continue;//跳过防止崩溃
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -6497,7 +6605,7 @@ bool shouldSkipTerminal(const char* terminal_id) {
|
|||||||
|
|
||||||
void rocketmq_test_300(int mpnum,int front_index,int type) {
|
void rocketmq_test_300(int mpnum,int front_index,int type) {
|
||||||
Ckafka_data_t data;
|
Ckafka_data_t data;
|
||||||
data.strTopic = QString::fromStdString(G_ROCKETMQ_TOPIC);
|
data.strTopic = QString::fromStdString(G_ROCKETMQ_TOPIC_TEST);
|
||||||
data.mp_id = "0";
|
data.mp_id = "0";
|
||||||
|
|
||||||
// 读取文件内容
|
// 读取文件内容
|
||||||
@@ -6542,6 +6650,9 @@ void rocketmq_test_300(int mpnum,int front_index,int type) {
|
|||||||
// 循环发送 300 条消息
|
// 循环发送 300 条消息
|
||||||
if(type == 0){
|
if(type == 0){
|
||||||
std::cout << " use ledger send msg " << std::endl;
|
std::cout << " use ledger send msg " << std::endl;
|
||||||
|
|
||||||
|
pthread_mutex_lock(&mtx);
|
||||||
|
|
||||||
for (int i = 0; (total_messages > 0 && g_node_id == 100) && i < g_node->n_clients; ++i) {//台账模拟不限制进程号
|
for (int i = 0; (total_messages > 0 && g_node_id == 100) && i < g_node->n_clients; ++i) {//台账模拟不限制进程号
|
||||||
|
|
||||||
ied = (ied_t*)g_node->clients[i];
|
ied = (ied_t*)g_node->clients[i];
|
||||||
@@ -6611,6 +6722,13 @@ void rocketmq_test_300(int mpnum,int front_index,int type) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
std::cout << "Finished sending " << g_node->n_clients << " messages." << std::endl;
|
||||||
|
|
||||||
|
pthread_mutex_unlock(&mtx);
|
||||||
|
|
||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
std::cout << " use monitor + number send msg " << std::endl;
|
std::cout << " use monitor + number send msg " << std::endl;
|
||||||
@@ -6663,9 +6781,10 @@ void rocketmq_test_300(int mpnum,int front_index,int type) {
|
|||||||
apr_sleep(apr_time_from_msec(60000/total_messages)); // 添加毫秒延时
|
apr_sleep(apr_time_from_msec(60000/total_messages)); // 添加毫秒延时
|
||||||
}*/
|
}*/
|
||||||
}
|
}
|
||||||
|
|
||||||
|
std::cout << "Finished sending " << total_messages << " messages." << std::endl;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::cout << "Finished sending " << total_messages << " messages." << std::endl;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -7125,6 +7244,7 @@ void send_reply_to_kafka(const std::string& guid, const std::string& step, const
|
|||||||
// 封装 Kafka 消息
|
// 封装 Kafka 消息
|
||||||
Ckafka_data_t connect_info;
|
Ckafka_data_t connect_info;
|
||||||
connect_info.strTopic = QString::fromStdString(Topic_Reply_Topic);
|
connect_info.strTopic = QString::fromStdString(Topic_Reply_Topic);
|
||||||
|
connect_info.mp_id = QString::fromStdString(guid);//guid作为key
|
||||||
connect_info.strText = QString::fromStdString(jsonString);
|
connect_info.strText = QString::fromStdString(jsonString);
|
||||||
|
|
||||||
// 加入发送队列(带互斥锁保护)
|
// 加入发送队列(带互斥锁保护)
|
||||||
@@ -7153,6 +7273,7 @@ void send_reply_to_kafka_recall(const std::string& guid, const std::string& step
|
|||||||
// 封装 Kafka 消息
|
// 封装 Kafka 消息
|
||||||
Ckafka_data_t connect_info;
|
Ckafka_data_t connect_info;
|
||||||
connect_info.strTopic = QString::fromStdString(Topic_Reply_Topic);
|
connect_info.strTopic = QString::fromStdString(Topic_Reply_Topic);
|
||||||
|
connect_info.mp_id = QString::fromStdString(guid);//guid作为key
|
||||||
connect_info.strText = QString::fromStdString(jsonString);
|
connect_info.strText = QString::fromStdString(jsonString);
|
||||||
|
|
||||||
// 加入发送队列(带互斥锁保护)
|
// 加入发送队列(带互斥锁保护)
|
||||||
@@ -7162,20 +7283,25 @@ void send_reply_to_kafka_recall(const std::string& guid, const std::string& step
|
|||||||
}
|
}
|
||||||
|
|
||||||
void send_heartbeat_to_kafka(const std::string& status) {
|
void send_heartbeat_to_kafka(const std::string& status) {
|
||||||
|
|
||||||
|
std::string front_type = get_front_type_from_subdir();
|
||||||
// 构造 JSON 字符串
|
// 构造 JSON 字符串
|
||||||
std::ostringstream oss;
|
std::ostringstream oss;
|
||||||
oss << "{"
|
oss << "{"
|
||||||
<< "\"nodeId\":\"" << FRONT_INST << "\","
|
<< "\"nodeId\":\"" << FRONT_INST << "\","
|
||||||
<< "\"frontType\":\"" << get_front_type_from_subdir() << "\","
|
<< "\"frontType\":\"" << front_type << "\","
|
||||||
<< "\"processNo\":\"" << g_front_seg_index << "\","
|
<< "\"processNo\":\"" << g_front_seg_index << "\","
|
||||||
<< "\"status\":\"" << status << "\""
|
<< "\"status\":\"" << status << "\""
|
||||||
<< "}";
|
<< "}";
|
||||||
|
|
||||||
std::string jsonString = oss.str();
|
std::string jsonString = oss.str();
|
||||||
|
|
||||||
|
std::string mpid_str = std::to_string(g_node_id) + "_" + std::to_string(g_front_seg_index);
|
||||||
|
|
||||||
// 封装 Kafka 消息
|
// 封装 Kafka 消息
|
||||||
Ckafka_data_t connect_info;
|
Ckafka_data_t connect_info;
|
||||||
connect_info.strTopic = QString::fromStdString(Heart_Beat_Topic);
|
connect_info.strTopic = QString::fromStdString(Heart_Beat_Topic);
|
||||||
|
connect_info.mp_id = QString::fromStdString(mpid_str);
|
||||||
connect_info.strText = QString::fromStdString(jsonString);
|
connect_info.strText = QString::fromStdString(jsonString);
|
||||||
|
|
||||||
// 加入发送队列(带互斥锁保护)
|
// 加入发送队列(带互斥锁保护)
|
||||||
|
|||||||
@@ -45,8 +45,8 @@ struct LOGEntry {
|
|||||||
std::string id;
|
std::string id;
|
||||||
std::string level; // terminal / measurepoint
|
std::string level; // terminal / measurepoint
|
||||||
int code; //code
|
int code; //code
|
||||||
int min_grade;
|
int min_grade; //允许上送的最低日志等级
|
||||||
int countdown;
|
int countdown; //自动关闭的倒计时,单位秒
|
||||||
};
|
};
|
||||||
|
|
||||||
//日志上送map管理
|
//日志上送map管理
|
||||||
@@ -68,6 +68,15 @@ extern std::string intToString(int number);
|
|||||||
|
|
||||||
//日志主题
|
//日志主题
|
||||||
extern std::string G_LOG_TOPIC;
|
extern std::string G_LOG_TOPIC;
|
||||||
|
|
||||||
|
// 日志限流配置
|
||||||
|
extern int G_LOG_RATE_RESET_SEC;
|
||||||
|
extern int G_LOG_RATE_LIMIT_SEC;
|
||||||
|
extern int G_LOG_RATE_KEEP_ALL_MS;
|
||||||
|
extern int G_LOG_RATE_KEEP_BURST_MS;
|
||||||
|
extern int G_LOG_RATE_KEEP_BURST_COUNT;
|
||||||
|
extern int G_LOG_RATE_KEEP_HIGHFREQ_COUNT;
|
||||||
|
|
||||||
/////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////
|
||||||
//log4命名空间
|
//log4命名空间
|
||||||
using namespace log4cplus;
|
using namespace log4cplus;
|
||||||
@@ -337,22 +346,38 @@ protected:
|
|||||||
|
|
||||||
// ③ 限频:同一条日志
|
// ③ 限频:同一条日志
|
||||||
const std::string rkey = make_key(logger_name, level, code, msg);
|
const std::string rkey = make_key(logger_name, level, code, msg);
|
||||||
if (!should_emit(rkey)) return;
|
|
||||||
|
uint64_t suppressed_before_emit = 0;
|
||||||
|
if (!should_emit(rkey, suppressed_before_emit)) return;
|
||||||
|
|
||||||
|
// 如果本次输出前压掉过日志,则在 log 文本后追加统计
|
||||||
|
std::string final_msg = msg;
|
||||||
|
if (suppressed_before_emit > 0) {
|
||||||
|
std::ostringstream suppressed_oss;
|
||||||
|
suppressed_oss << msg << " 【已过滤重复同类日志 "
|
||||||
|
<< suppressed_before_emit
|
||||||
|
<< " 条】";
|
||||||
|
final_msg = suppressed_oss.str();
|
||||||
|
}
|
||||||
|
|
||||||
|
std::string business_id = extract_logger_id(logger_name);
|
||||||
|
std::string front_type = get_front_type_from_subdir();
|
||||||
|
|
||||||
std::ostringstream oss;
|
std::ostringstream oss;
|
||||||
oss << "{\"processNo\":\"" << intToString(g_front_seg_index)
|
oss << "{\"processNo\":\"" << intToString(g_front_seg_index)
|
||||||
<< "\",\"nodeId\":\"" << FRONT_INST
|
<< "\",\"nodeId\":\"" << escape_json(FRONT_INST)
|
||||||
<< "\",\"businessId\":\"" << extract_logger_id(logger_name)
|
<< "\",\"businessId\":\"" << escape_json(business_id)
|
||||||
<< "\",\"level\":\"" << level_str
|
<< "\",\"level\":\"" << escape_json(level_str)
|
||||||
<< "\",\"grade\":\"" << get_level_str(level)
|
<< "\",\"grade\":\"" << escape_json(get_level_str(level))
|
||||||
<< "\",\"logtype\":\"" << safe_logtype
|
<< "\",\"logtype\":\"" << safe_logtype
|
||||||
<< "\",\"frontType\":\"" << get_front_type_from_subdir()
|
<< "\",\"frontType\":\"" << escape_json(front_type)
|
||||||
<< "\",\"code\":" << code
|
<< "\",\"code\":" << code
|
||||||
<< ",\"log\":\"" << escape_json(msg) << "\"}";
|
<< ",\"log\":\"" << escape_json(final_msg) << "\"}";
|
||||||
|
|
||||||
Ckafka_data_t connect_info;
|
Ckafka_data_t connect_info;
|
||||||
connect_info.strTopic = QString::fromStdString(G_LOG_TOPIC);
|
connect_info.strTopic = QString::fromStdString(G_LOG_TOPIC);
|
||||||
connect_info.strText = QString::fromStdString(oss.str());
|
connect_info.mp_id = QString::fromStdString(business_id);
|
||||||
|
connect_info.strText = QString::fromStdString(oss.str());
|
||||||
|
|
||||||
kafka_data_list_mutex.lock();
|
kafka_data_list_mutex.lock();
|
||||||
kafka_data_list.append(connect_info);
|
kafka_data_list.append(connect_info);
|
||||||
@@ -386,11 +411,20 @@ public:
|
|||||||
//////////////////////////////////////////////////////////////////20260303添加日志上送控制 - 频率限制实现
|
//////////////////////////////////////////////////////////////////20260303添加日志上送控制 - 频率限制实现
|
||||||
private:
|
private:
|
||||||
struct RateState {
|
struct RateState {
|
||||||
uint64_t hit_count;
|
uint64_t pass_count; // 当前周期内已放行条数
|
||||||
|
uint64_t suppressed_count; // 当前被抑制条数
|
||||||
std::chrono::steady_clock::time_point last_emit;
|
std::chrono::steady_clock::time_point last_emit;
|
||||||
|
std::chrono::steady_clock::time_point last_seen;
|
||||||
|
std::chrono::steady_clock::time_point last_reset;
|
||||||
bool has_emit;
|
bool has_emit;
|
||||||
|
|
||||||
RateState() : hit_count(0), last_emit(), has_emit(false) {}
|
RateState()
|
||||||
|
: pass_count(0),
|
||||||
|
suppressed_count(0),
|
||||||
|
last_emit(),
|
||||||
|
last_seen(),
|
||||||
|
last_reset(),
|
||||||
|
has_emit(false) {}
|
||||||
};
|
};
|
||||||
|
|
||||||
static std::unordered_map<std::string, RateState> s_rate_map;
|
static std::unordered_map<std::string, RateState> s_rate_map;
|
||||||
@@ -398,37 +432,98 @@ private:
|
|||||||
|
|
||||||
static std::string make_key(const std::string& logger_name, int level, int code, const std::string& msg) {
|
static std::string make_key(const std::string& logger_name, int level, int code, const std::string& msg) {
|
||||||
std::ostringstream oss;
|
std::ostringstream oss;
|
||||||
oss << logger_name << "|" << level << "|" << code << "|" << msg;
|
oss << logger_name << "|" << level << "|" << code ; //<< "|" << msg;
|
||||||
return oss.str();
|
return oss.str();
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool should_emit(const std::string& key) {
|
static bool should_emit(const std::string& key, uint64_t& suppressed_before_emit) {
|
||||||
using namespace std::chrono;
|
using namespace std::chrono;
|
||||||
|
|
||||||
const auto now = steady_clock::now();
|
const auto now = steady_clock::now();
|
||||||
|
suppressed_before_emit = 0;
|
||||||
|
|
||||||
std::lock_guard<std::mutex> lk(s_rate_mutex);
|
std::lock_guard<std::mutex> lk(s_rate_mutex);
|
||||||
RateState& st = s_rate_map[key];
|
RateState& st = s_rate_map[key];
|
||||||
|
|
||||||
const int RESET_SEC = 3600;
|
const int RESET_SEC = G_LOG_RATE_RESET_SEC ; // 1小时重置
|
||||||
if (st.has_emit) {
|
const int LIMIT_SEC = G_LOG_RATE_LIMIT_SEC ; // 进入限流后:多久发1条 主要控制中频和高频那些,低频的都直接放行了
|
||||||
auto idle = duration_cast<seconds>(now - st.last_emit).count();
|
|
||||||
if (idle >= RESET_SEC) st.hit_count = 0;
|
// 初始化 / 强制每小时重置
|
||||||
|
if (st.last_reset.time_since_epoch().count() == 0) {
|
||||||
|
st.last_reset = now;
|
||||||
|
} else {
|
||||||
|
auto since_reset = duration_cast<seconds>(now - st.last_reset).count();
|
||||||
|
if (since_reset >= RESET_SEC) { //重置周期
|
||||||
|
st = RateState();
|
||||||
|
st.last_reset = now;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
st.hit_count++;
|
// 计算当前频率档位(按“本次与上次看到该key的间隔”判断)
|
||||||
const int period_sec = (st.hit_count > 3) ? 300 : 1;
|
// >=60秒/条:全部保留
|
||||||
|
// [1秒, 60秒):保留前60条,然后1分钟1条
|
||||||
|
// <1秒:保留前10条,然后1分钟1条
|
||||||
|
int allow_burst = 0;
|
||||||
|
|
||||||
if (!st.has_emit) {
|
if (st.last_seen.time_since_epoch().count() == 0) {
|
||||||
|
// 第一次看到,先按“全部保留”处理
|
||||||
|
allow_burst = -1;
|
||||||
|
} else {
|
||||||
|
auto gap_ms = duration_cast<milliseconds>(now - st.last_seen).count();
|
||||||
|
|
||||||
|
if (gap_ms >= G_LOG_RATE_KEEP_ALL_MS) { //什么时候不需要限流 //低频 //如果这里设置的很低,就不会限流
|
||||||
|
allow_burst = -1; // 全部保留
|
||||||
|
} else if (gap_ms >= G_LOG_RATE_KEEP_BURST_MS) {
|
||||||
|
allow_burst = G_LOG_RATE_KEEP_BURST_COUNT; // 前60条 //中频 //如果这里设置的比低频低,也不会生效
|
||||||
|
} else {
|
||||||
|
allow_burst = G_LOG_RATE_KEEP_HIGHFREQ_COUNT; // 前10条 //高频
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
st.last_seen = now;
|
||||||
|
|
||||||
|
// 档位1:全部保留
|
||||||
|
if (allow_burst == -1) {
|
||||||
|
suppressed_before_emit = st.suppressed_count;
|
||||||
|
st.suppressed_count = 0;
|
||||||
|
st.pass_count++;
|
||||||
st.last_emit = now;
|
st.last_emit = now;
|
||||||
st.has_emit = true;
|
st.has_emit = true;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
const auto elapsed = duration_cast<seconds>(now - st.last_emit).count();
|
// 档位2/3:先放前N条
|
||||||
if (elapsed >= period_sec) {
|
if (st.pass_count < (uint64_t)allow_burst) {
|
||||||
|
suppressed_before_emit = st.suppressed_count;
|
||||||
|
st.suppressed_count = 0;
|
||||||
|
st.pass_count++;
|
||||||
st.last_emit = now;
|
st.last_emit = now;
|
||||||
|
st.has_emit = true;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 超过前N条后:进入 1分钟1条
|
||||||
|
if (!st.has_emit) {
|
||||||
|
suppressed_before_emit = st.suppressed_count;
|
||||||
|
st.suppressed_count = 0;
|
||||||
|
st.pass_count++;
|
||||||
|
st.last_emit = now;
|
||||||
|
st.has_emit = true;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
auto elapsed = duration_cast<seconds>(now - st.last_emit).count();
|
||||||
|
if (elapsed >= LIMIT_SEC) {
|
||||||
|
suppressed_before_emit = st.suppressed_count;
|
||||||
|
st.suppressed_count = 0;
|
||||||
|
st.pass_count++;
|
||||||
|
st.last_emit = now;
|
||||||
|
st.has_emit = true;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 本条被抑制
|
||||||
|
st.suppressed_count++;
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
@@ -554,7 +649,7 @@ void init_loggers_bydevid(const char* dev_id)
|
|||||||
Logger device_logger = init_logger(device_key, device_dir, dev_id, device_appender); //用终端id作为日志文件名
|
Logger device_logger = init_logger(device_key, device_dir, dev_id, device_appender); //用终端id作为日志文件名
|
||||||
logger_map[device_key] = TypedLogger(device_logger, LOGTYPE_DEFAULT);
|
logger_map[device_key] = TypedLogger(device_logger, LOGTYPE_DEFAULT);
|
||||||
|
|
||||||
DIY_INFOLOG(device_key.c_str(),"【NORMAL】终端id:%s终端级日志初始化完毕", ied_usr->terminal_id);
|
DIY_INFOLOG_CODE(device_key.c_str(),1,LOG_CODE_OTHER,"【NORMAL】终端id:%s终端级日志初始化完毕", ied_usr->terminal_id);
|
||||||
}
|
}
|
||||||
|
|
||||||
// 初始化监测点
|
// 初始化监测点
|
||||||
@@ -579,7 +674,7 @@ void init_loggers_bydevid(const char* dev_id)
|
|||||||
Logger mon_logger = init_logger(mon_key.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.str()] = TypedLogger(mon_logger, LOGTYPE_DEFAULT);
|
logger_map[mon_key.str()] = TypedLogger(mon_logger, LOGTYPE_DEFAULT);
|
||||||
|
|
||||||
DIY_INFOLOG(mon_key.str().c_str(),"【NORMAL】监测点:%s - id:%s监测点级日志初始化完毕", ied_usr->LD_info[i].name,ied_usr->LD_info[i].mp_id);
|
DIY_INFOLOG_CODE(mon_key.str().c_str(),2,LOG_CODE_OTHER,"【NORMAL】监测点:%s - id:%s监测点级日志初始化完毕", ied_usr->LD_info[i].name,ied_usr->LD_info[i].mp_id);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -628,7 +723,7 @@ void init_loggers() {
|
|||||||
|
|
||||||
logger_map[device_key] = TypedLogger(device_logger, LOGTYPE_DEFAULT);
|
logger_map[device_key] = TypedLogger(device_logger, LOGTYPE_DEFAULT);
|
||||||
|
|
||||||
DIY_INFOLOG(device_key.c_str(),"【NORMAL】终端id:%s终端级日志初始化完毕", ied_usr->terminal_id);
|
DIY_INFOLOG_CODE(device_key.c_str(),1,LOG_CODE_OTHER,"【NORMAL】终端id:%s终端级日志初始化完毕", ied_usr->terminal_id);
|
||||||
|
|
||||||
// 初始化监测点
|
// 初始化监测点
|
||||||
// 监测点 logger 名称格式:monitor.<mp_id>
|
// 监测点 logger 名称格式:monitor.<mp_id>
|
||||||
@@ -650,7 +745,7 @@ void init_loggers() {
|
|||||||
|
|
||||||
logger_map[mon_key.str()] = TypedLogger(mon_logger, LOGTYPE_DEFAULT);
|
logger_map[mon_key.str()] = TypedLogger(mon_logger, LOGTYPE_DEFAULT);
|
||||||
|
|
||||||
DIY_INFOLOG(mon_key.str().c_str(),"【NORMAL】监测点:%s - id:%s监测点级日志初始化完毕", ied_usr->LD_info[i].name,ied_usr->LD_info[i].mp_id);
|
DIY_INFOLOG_CODE(mon_key.str().c_str(),2,LOG_CODE_OTHER,"【NORMAL】监测点:%s - id:%s监测点级日志初始化完毕", ied_usr->LD_info[i].name,ied_usr->LD_info[i].mp_id);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
338
include/ied.h
338
include/ied.h
@@ -1,6 +1,6 @@
|
|||||||
/**
|
/**
|
||||||
* @file: $RCSfile: ied.h,v $
|
* @file: $RCSfile: ied.h,v $
|
||||||
* @brief: $<EFBFBD>豸<EFBFBD><EFBFBD><EFBFBD>ݽṹ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
* @brief: $设备数据结构定义
|
||||||
*
|
*
|
||||||
* @version: $Revision: 1.1 $
|
* @version: $Revision: 1.1 $
|
||||||
* @date: $Date: 2018/11/24 06:54:49 $
|
* @date: $Date: 2018/11/24 06:54:49 $
|
||||||
@@ -24,35 +24,35 @@ typedef byte_t channel_size_type;
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
#define PRV_ANA_EXTENSION (1) //ģ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>û<EFBFBD><EFBFBD><EFBFBD>չ<EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD>
|
#define PRV_ANA_EXTENSION (1) //模拟量用户扩展属性 总数
|
||||||
#define PRV_DIGIT_EXTENSION (3) //ң<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>û<EFBFBD><EFBFBD><EFBFBD>չ<EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD>
|
#define PRV_DIGIT_EXTENSION (3) //遥信量用户扩展属性 总数
|
||||||
#define PRV_EVENT_EXTENSION (3) //<EFBFBD>¼<EFBFBD><EFBFBD><EFBFBD><EFBFBD>û<EFBFBD><EFBFBD><EFBFBD>չ<EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD>
|
#define PRV_EVENT_EXTENSION (3) //事件量用户扩展属性 总数
|
||||||
#define PRV_PULSE_EXTENSION (2) //ң<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>û<EFBFBD><EFBFBD><EFBFBD>չ<EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD>
|
#define PRV_PULSE_EXTENSION (2) //遥测量用户扩展属性 总数
|
||||||
//-----ģ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>û<EFBFBD><EFBFBD><EFBFBD>չ---------------//
|
//-----模拟量用户扩展---------------//
|
||||||
#define ANA_EXTENSION_ALARM (0) //<EFBFBD>澯:<3A>澯<EFBFBD>ȼ<EFBFBD>;<3B>澯<EFBFBD><E6BEAF><EFBFBD><EFBFBD><EFBFBD>ļ<EFBFBD><C4BC><EFBFBD>
|
#define ANA_EXTENSION_ALARM (0) //告警:告警等级;告警声音文件名
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
typedef struct analog_t analog_t;
|
typedef struct analog_t analog_t;
|
||||||
struct analog_t {
|
struct analog_t {
|
||||||
byte_t type; /**< <EFBFBD><EFBFBD>ѹ/<2F><><EFBFBD><EFBFBD>/<2F>й<EFBFBD><D0B9><EFBFBD><EFBFBD><EFBFBD>/<2F><EFBFBD><DEB9><EFBFBD><EFBFBD><EFBFBD>/Ƶ<><C6B5>/<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>/<2F><><EFBFBD><EFBFBD> */
|
byte_t type; /**< 电压/电流/有功功率/无功功率/频率/功率因素/其它 */
|
||||||
float initval; /**< ȱʡֵ */
|
float initval; /**< 缺省值 */
|
||||||
float minimum; /**< ȡֵ<EFBFBD><EFBFBD><EFBFBD><EFBFBD> */
|
float minimum; /**< 取值下限 */
|
||||||
float maximum; /**< ȡֵ<EFBFBD><EFBFBD><EFBFBD><EFBFBD> */
|
float maximum; /**< 取值上限 */
|
||||||
float step; /**< <EFBFBD><EFBFBD><EFBFBD><EFBFBD> */
|
float step; /**< 步长 */
|
||||||
byte_t integral; /**< precision ( n , m ) - n */
|
byte_t integral; /**< precision ( n , m ) - n */
|
||||||
byte_t decimal; /**< precision ( n , m ) - m */
|
byte_t decimal; /**< precision ( n , m ) - m */
|
||||||
float offset; /**< ʵ<EFBFBD><EFBFBD>ֵת<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> */
|
float offset; /**< 实际值转换基数 */
|
||||||
float factor; /**< ʵ<EFBFBD><EFBFBD>ֵת<EFBFBD><EFBFBD>ϵ<EFBFBD><EFBFBD> */
|
float factor; /**< 实际值转换系数 */
|
||||||
float threshold; /**< <EFBFBD><EFBFBD><EFBFBD><EFBFBD>ֵ */
|
float threshold; /**< 门限值 */
|
||||||
float smooth; /**< ƽ<EFBFBD><EFBFBD>ϵ<EFBFBD><EFBFBD> */
|
float smooth; /**< 平滑系数 */
|
||||||
float lower; /**< <EFBFBD>澯<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ֵ */
|
float lower; /**< 告警下限值 */
|
||||||
float higher; /**< <EFBFBD>澯<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ֵ */
|
float higher; /**< 告警上限值 */
|
||||||
float lowest; /**< <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>澯ֵ */
|
float lowest; /**< 下下限告警值 */
|
||||||
float highest; /**< <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>澯ֵ */
|
float highest; /**< 上上限告警值 */
|
||||||
float blur; /**< <EFBFBD><EFBFBD>ֵģ<EFBFBD><EFBFBD>ϵ<EFBFBD><EFBFBD> */
|
float blur; /**< 阀值模糊系数 */
|
||||||
char dimension[SHORTNAME]; /**< <EFBFBD><EFBFBD><EFBFBD><EFBFBD>ASCII<EFBFBD><EFBFBD>ʽ(A/V/kV/kvar/kW/MW etc.) */
|
char dimension[SHORTNAME]; /**< 量纲ASCII格式(A/V/kV/kvar/kW/MW etc.) */
|
||||||
void *ext[PRV_ANA_EXTENSION]; /**< <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>չ */
|
void *ext[PRV_ANA_EXTENSION]; /**< 保护管理机扩展 */
|
||||||
}ALIGNPACKED;
|
}ALIGNPACKED;
|
||||||
|
|
||||||
|
|
||||||
@@ -66,27 +66,27 @@ struct ana_extention_t{
|
|||||||
};
|
};
|
||||||
|
|
||||||
typedef struct digit_t digit_t;
|
typedef struct digit_t digit_t;
|
||||||
#define DGT_TYP_UNDEF 0x00 /**< δ<EFBFBD><EFBFBD><EFBFBD><EFBFBD> */
|
#define DGT_TYP_UNDEF 0x00 /**< 未定义 */
|
||||||
#define DGT_TYP_SAMPLING 0x01 /**< <EFBFBD><EFBFBD><EFBFBD><EFBFBD> */
|
#define DGT_TYP_SAMPLING 0x01 /**< 采样 */
|
||||||
#define DGT_TYP_EVENT 0x02 /**< <EFBFBD>¼<EFBFBD> */
|
#define DGT_TYP_EVENT 0x02 /**< 事件 */
|
||||||
#define DGT_TYP_ALARM 0x03 /**< <EFBFBD>澯 */
|
#define DGT_TYP_ALARM 0x03 /**< 告警 */
|
||||||
#define DGT_TYP_OPERATE 0x04 /**< <EFBFBD><EFBFBD><EFBFBD><EFBFBD> */
|
#define DGT_TYP_OPERATE 0x04 /**< 操作 */
|
||||||
#define DGT_TYP_SYSTEM 0x05 /**< ϵͳ */
|
#define DGT_TYP_SYSTEM 0x05 /**< 系统 */
|
||||||
/** <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>˽<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> */
|
/** 数字量私有属性 */
|
||||||
struct digit_t {
|
struct digit_t {
|
||||||
byte_t type; /**< <EFBFBD><EFBFBD><EFBFBD><EFBFBD>/<2F>¼<EFBFBD>/<2F>澯/<2F><><EFBFBD><EFBFBD>/ϵͳ */
|
byte_t type; /**< 采样/事件/告警/操作/系统 */
|
||||||
byte_t initval; /**< default zero value(0 or 1) */
|
byte_t initval; /**< default zero value(0 or 1) */
|
||||||
byte_t level; /**< level */
|
byte_t level; /**< level */
|
||||||
byte_t snd_timer; /**< sound play timer (s) */
|
byte_t snd_timer; /**< sound play timer (s) */
|
||||||
byte_t rst_timer; /**< auto restore timer (s) */
|
byte_t rst_timer; /**< auto restore timer (s) */
|
||||||
uint16_t act_lim; /**< (0 ==> 1)<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>澯<EFBFBD><EFBFBD><EFBFBD><EFBFBD> */
|
uint16_t act_lim; /**< (0 ==> 1)动作告警上限 */
|
||||||
uint16_t rst_lim; /**< (1 ==> 0)<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>澯<EFBFBD><EFBFBD><EFBFBD><EFBFBD> */
|
uint16_t rst_lim; /**< (1 ==> 0)动作告警上限 */
|
||||||
uint16_t act_num; /**< (0 ==> 1)<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>(<28><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>¼<EFBFBD><C2BC>) */
|
uint16_t act_num; /**< (0 ==> 1)动作上限(不需界面录入) */
|
||||||
uint16_t rst_num; /**< (1 ==> 0)<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>(<28><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>¼<EFBFBD><C2BC>) */
|
uint16_t rst_num; /**< (1 ==> 0)动作上限(不需界面录入) */
|
||||||
//<EFBFBD>ڶ<EFBFBD><EFBFBD><EFBFBD>ȥ<EFBFBD><EFBFBD>
|
//第二版去掉
|
||||||
//char on[SHORTNAME]; /**< 0==>1<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>(ASCII<EFBFBD><EFBFBD>ʽ) */
|
//char on[SHORTNAME]; /**< 0==>1动作名称(ASCII格式) */
|
||||||
//char off[SHORTNAME]; /**< 1==>0<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>(ASCII<EFBFBD><EFBFBD>ʽ) */
|
//char off[SHORTNAME]; /**< 1==>0动作名称(ASCII格式) */
|
||||||
void *ext[PRV_DIGIT_EXTENSION]; /**< <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>չ */
|
void *ext[PRV_DIGIT_EXTENSION]; /**< 保护管理机扩展 */
|
||||||
}ALIGNPACKED;
|
}ALIGNPACKED;
|
||||||
|
|
||||||
|
|
||||||
@@ -102,12 +102,12 @@ struct digit_t {
|
|||||||
|
|
||||||
typedef struct state_describe_extention_t state_describe_extention_t;
|
typedef struct state_describe_extention_t state_describe_extention_t;
|
||||||
struct state_describe_extention_t{
|
struct state_describe_extention_t{
|
||||||
char *state_describe[4]; /**< ״̬0<EFBFBD><EFBFBD>1<EFBFBD><EFBFBD>2<EFBFBD><EFBFBD>3<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> */
|
char *state_describe[4]; /**< 状态0,1,2,3的描述 */
|
||||||
};
|
};
|
||||||
typedef struct sound_file_name_extention_t sound_file_name_extention_t;
|
typedef struct sound_file_name_extention_t sound_file_name_extention_t;
|
||||||
|
|
||||||
struct sound_file_name_extention_t{
|
struct sound_file_name_extention_t{
|
||||||
char *sound_file_name[3]; /**< <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ϱ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>¹ʱ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> */
|
char *sound_file_name[3]; /**< 开报警声、合报警声、事故报警声 */
|
||||||
};
|
};
|
||||||
|
|
||||||
typedef struct epfi_addt_extension_t epfi_addt_extension_t;
|
typedef struct epfi_addt_extension_t epfi_addt_extension_t;
|
||||||
@@ -120,48 +120,48 @@ struct epfi_addt_extension_t {
|
|||||||
|
|
||||||
typedef struct pulse_t pulse_t;
|
typedef struct pulse_t pulse_t;
|
||||||
/** Integrated totals private attr */
|
/** Integrated totals private attr */
|
||||||
#define PLS_TYP_UNDEF 0x00 /**< δ<EFBFBD><EFBFBD><EFBFBD><EFBFBD> */
|
#define PLS_TYP_UNDEF 0x00 /**< 未定义 */
|
||||||
#define PLS_TYP_PLUS_POWER_HV 0x01 /**< <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>й<EFBFBD> */
|
#define PLS_TYP_PLUS_POWER_HV 0x01 /**< 正向有功 */
|
||||||
#define PLS_TYP_PLUS_POWER_NO 0x02 /**< <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> */
|
#define PLS_TYP_PLUS_POWER_NO 0x02 /**< 正向无功 */
|
||||||
#define PLS_TYP_NEGATIVE_POWER_HV 0x03 /**< <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>й<EFBFBD> */
|
#define PLS_TYP_NEGATIVE_POWER_HV 0x03 /**< 反向有功 */
|
||||||
#define PLS_TYP_NEGATIVE_POWER_NO 0x04 /**< <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> */
|
#define PLS_TYP_NEGATIVE_POWER_NO 0x04 /**< 反向无功 */
|
||||||
struct pulse_t {
|
struct pulse_t {
|
||||||
byte_t type; /**< <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>й<EFBFBD>/<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>/<2F><><EFBFBD><EFBFBD><EFBFBD>й<EFBFBD>/<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> */
|
byte_t type; /**< 正向有功/正向无功/反向有功/反向无功 */
|
||||||
uint32_t save_flag; /**< <EFBFBD>洢<EFBFBD><EFBFBD><EFBFBD><EFBFBD> */
|
uint32_t save_flag; /**< 存储标记 */
|
||||||
uint32_t initval; /**< default value */
|
uint32_t initval; /**< default value */
|
||||||
uint32_t minimum; /**< minimum value */
|
uint32_t minimum; /**< minimum value */
|
||||||
uint32_t maximum; /**< maximum value */
|
uint32_t maximum; /**< maximum value */
|
||||||
uint32_t step; /**< <EFBFBD><EFBFBD><EFBFBD><EFBFBD> */
|
uint32_t step; /**< 步长 */
|
||||||
//changed by zhancg 2017-04-05 <EFBFBD><EFBFBD>ϵ<EFBFBD><EFBFBD>
|
//changed by zhancg 2017-04-05 配系数
|
||||||
// uint32_t offset; /**< ʵ<EFBFBD><EFBFBD>ֵת<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> */
|
// uint32_t offset; /**< 实际值转换基数 */
|
||||||
// uint32_t factor; /**< ʵ<EFBFBD><EFBFBD>ֵת<EFBFBD><EFBFBD>ϵ<EFBFBD><EFBFBD> */
|
// uint32_t factor; /**< 实际值转换系数 */
|
||||||
// uint32_t threshold; /**< <EFBFBD><EFBFBD><EFBFBD><EFBFBD>ֵ */
|
// uint32_t threshold; /**< 门限值 */
|
||||||
// uint32_t smooth; /**< ƽ<EFBFBD><EFBFBD>ϵ<EFBFBD><EFBFBD> */
|
// uint32_t smooth; /**< 平滑系数 */
|
||||||
float offset; /**< ʵ<EFBFBD><EFBFBD>ֵת<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> */
|
float offset; /**< 实际值转换基数 */
|
||||||
float factor; /**< ʵ<EFBFBD><EFBFBD>ֵת<EFBFBD><EFBFBD>ϵ<EFBFBD><EFBFBD> */
|
float factor; /**< 实际值转换系数 */
|
||||||
float threshold; /**< <EFBFBD><EFBFBD><EFBFBD><EFBFBD>ֵ */
|
float threshold; /**< 门限值 */
|
||||||
float smooth; /**< ƽ<EFBFBD><EFBFBD>ϵ<EFBFBD><EFBFBD> */
|
float smooth; /**< 平滑系数 */
|
||||||
char dimension[SHORTNAME]; /**< <EFBFBD><EFBFBD><EFBFBD><EFBFBD>ASCII<EFBFBD><EFBFBD>ʽ(kvar/kW/MW etc.) */
|
char dimension[SHORTNAME]; /**< 量纲ASCII格式(kvar/kW/MW etc.) */
|
||||||
void *ext[PRV_PULSE_EXTENSION];
|
void *ext[PRV_PULSE_EXTENSION];
|
||||||
}ALIGNPACKED;
|
}ALIGNPACKED;
|
||||||
typedef struct pluse_stage_limits_extention_t pluse_stage_limits_extention_t;
|
typedef struct pluse_stage_limits_extention_t pluse_stage_limits_extention_t;
|
||||||
struct pluse_stage_limits_extention_t{
|
struct pluse_stage_limits_extention_t{
|
||||||
uint32_t limits[3]; /**< <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ֵ,<2C>յ<EFBFBD><D5B5><EFBFBD><EFBFBD><EFBFBD>ֵ,<2C>µ<EFBFBD><C2B5><EFBFBD><EFBFBD><EFBFBD>ֵ */
|
uint32_t limits[3]; /**< 峰电度限值,日电度限值,月电度限值 */
|
||||||
};
|
};
|
||||||
typedef struct pluse_stage_const_extention_t pluse_stage_const_extention_t;
|
typedef struct pluse_stage_const_extention_t pluse_stage_const_extention_t;
|
||||||
struct pluse_stage_const_extention_t{
|
struct pluse_stage_const_extention_t{
|
||||||
char* stage[8]; /**< <EFBFBD><EFBFBD>ʱ<EFBFBD><EFBFBD>1,<2C><>ʱ<EFBFBD><CAB1>2,<2C><>ʱ<EFBFBD><CAB1>3,<2C><>ʱ<EFBFBD><CAB1>4,<2C><>ʱ<EFBFBD><CAB1>1,<2C><>ʱ<EFBFBD><CAB1>2,<2C><>ʱ<EFBFBD><CAB1>3,<2C><>ʱ<EFBFBD><CAB1>4 */
|
char* stage[8]; /**< 峰时段1,峰时段2,峰时段3,峰时段4,谷时段1,谷时段2,谷时段3,谷时段4 */
|
||||||
};
|
};
|
||||||
|
|
||||||
//
|
//
|
||||||
typedef struct command_t command_t;
|
typedef struct command_t command_t;
|
||||||
/** <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϣ<EFBFBD>ṹ */
|
/** 命令消息结构 */
|
||||||
struct command_t {
|
struct command_t {
|
||||||
ticks_t ticks; /**< Ticks when command generated */
|
ticks_t ticks; /**< Ticks when command generated */
|
||||||
apr_time_t tmlimit; /**< <EFBFBD><EFBFBD><EFBFBD><EFBFBD>ִ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ɵ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʱ<EFBFBD><EFBFBD> */
|
apr_time_t tmlimit; /**< 命令执行完成的限制时间 */
|
||||||
byte_t state; /**< ACTIVE<EFBFBD><EFBFBD>FINISH or TIMEOUT */
|
byte_t state; /**< ACTIVE、FINISH or TIMEOUT */
|
||||||
byte_t channel; /**< command channel no */
|
byte_t channel; /**< command channel no */
|
||||||
byte_t flag; /**< General<EFBFBD><EFBFBD>System or Special */
|
byte_t flag; /**< General、System or Special */
|
||||||
byte_t typ; /**< Command TYPE(IEC60870-5-101) */
|
byte_t typ; /**< Command TYPE(IEC60870-5-101) */
|
||||||
uint32_t ied; /**< Controlled IED id */
|
uint32_t ied; /**< Controlled IED id */
|
||||||
uint32_t group; /**< Controlled group id */
|
uint32_t group; /**< Controlled group id */
|
||||||
@@ -173,65 +173,65 @@ struct command_t {
|
|||||||
|
|
||||||
|
|
||||||
/** status_t code definiens */
|
/** status_t code definiens */
|
||||||
#define STATUS_NORMAL 0 /**< <EFBFBD><EFBFBD><EFBFBD><EFBFBD> */
|
#define STATUS_NORMAL 0 /**< 正常 */
|
||||||
#define STATUS_NOINIT 1 /**< δ<EFBFBD><EFBFBD>ʼ<EFBFBD><EFBFBD> */
|
#define STATUS_NOINIT 1 /**< 未初始化 */
|
||||||
#define STATUS_OVERTIME 2 /**< ͨ<EFBFBD>ų<EFBFBD>ʱ */
|
#define STATUS_OVERTIME 2 /**< 通信超时 */
|
||||||
#define STATUS_BREAKOFF 3 /**< ͨ<EFBFBD><EFBFBD><EFBFBD>ж<EFBFBD> */
|
#define STATUS_BREAKOFF 3 /**< 通信中断 */
|
||||||
#define STATUS_BLOCKED 4 /**< <EFBFBD><EFBFBD><EFBFBD><EFBFBD> */
|
#define STATUS_BLOCKED 4 /**< 封锁 */
|
||||||
#define STATUS_TESTING 5 /**< <EFBFBD><EFBFBD><EFBFBD><EFBFBD> */
|
#define STATUS_TESTING 5 /**< 测试 */
|
||||||
#define STATUS_NOTDEF 6 /**< δ<EFBFBD><EFBFBD><EFBFBD>ã<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>״̬û<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>) */
|
#define STATUS_NOTDEF 6 /**< 未配置(本运行状态没有配置) */
|
||||||
|
|
||||||
typedef uint16_t status_t; /**< <EFBFBD>豸<EFBFBD><EFBFBD>ͨ<EFBFBD>Žڵ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>״̬ */
|
typedef uint16_t status_t; /**< 设备或通信节点的运行状态 */
|
||||||
|
|
||||||
typedef struct alias_t alias_t;
|
typedef struct alias_t alias_t;
|
||||||
/** <EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ԫ<EFBFBD>صı<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ṹ */
|
/** 数据元素的别名结构 */
|
||||||
struct alias_t { /**< <EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ԫ<EFBFBD>صı<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ṹ */
|
struct alias_t { /**< 数据元素的别名结构 */
|
||||||
uint32_t id; /**< <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϣ<EFBFBD><EFBFBD>ַ */
|
uint32_t id; /**< 别名信息地址 */
|
||||||
uint32_t parent; /**< <EFBFBD><EFBFBD>ָ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>IED */
|
uint32_t parent; /**< 所指代的IED */
|
||||||
uint32_t group; /**< <EFBFBD><EFBFBD>ָ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>IED<EFBFBD>ڵ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> */
|
uint32_t group; /**< 所指代的IED内的组号 */
|
||||||
uint32_t dot; /**< <EFBFBD><EFBFBD>ָ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>IED<EFBFBD>ڵ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> */
|
uint32_t dot; /**< 所指代的IED内的序号 */
|
||||||
value_t* value; /**< <EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʱ<EFBFBD><EFBFBD>ʵʱ<EFBFBD><EFBFBD><EFBFBD><EFBFBD> */
|
value_t* value; /**< 运行时刻实时数据 */
|
||||||
};
|
};
|
||||||
|
|
||||||
typedef struct ied_t ied_t;
|
typedef struct ied_t ied_t;
|
||||||
typedef struct group_t group_t;
|
typedef struct group_t group_t;
|
||||||
typedef struct element_t element_t;
|
typedef struct element_t element_t;
|
||||||
|
|
||||||
/** <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ϢԪ<EFBFBD>صĽṹ */
|
/** 数据信息元素的结构 */
|
||||||
struct element_t {
|
struct element_t {
|
||||||
uint32_t id; /**< Identification, Information Address */
|
uint32_t id; /**< Identification, Information Address */
|
||||||
uint32_t flags; /**< flags define */
|
uint32_t flags; /**< flags define */
|
||||||
byte_t type; /**< IEC60870-5-101 TYP.(IEC60870DEF.h) */
|
byte_t type; /**< IEC60870-5-101 TYP.(IEC60870DEF.h) */
|
||||||
byte_t code; /**< Data code type.(BIN/ASCII/BCD/etc.) */
|
byte_t code; /**< Data code type.(BIN/ASCII/BCD/etc.) */
|
||||||
uint32_t parent; /**< <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>豸 */
|
uint32_t parent; /**< 隶属设备 */
|
||||||
uint32_t group; /**< <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> */
|
uint32_t group; /**< 数据组号 */
|
||||||
uint32_t dot; /**< <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> */
|
uint32_t dot; /**< 数据序号 */
|
||||||
uint16_t size; /**< <EFBFBD><EFBFBD><EFBFBD>ݿ<EFBFBD><EFBFBD><EFBFBD>(<28><><EFBFBD>ֽ<EFBFBD>Ϊ<EFBFBD><CEAA>λ) */
|
uint16_t size; /**< 数据宽度(以字节为单位) */
|
||||||
char name[LONGNAME]; /**< <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> */
|
char name[LONGNAME]; /**< 数据名称 */
|
||||||
|
|
||||||
char *aliasname; /**< <EFBFBD><EFBFBD><EFBFBD>ݵ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ƶ<EFBFBD>Ӧ<EFBFBD><EFBFBD>Ӣ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> ++EPFI++ */
|
char *aliasname; /**< 数据点别名,如用于中文名称对应的英文名称 ++EPFI++ */
|
||||||
|
|
||||||
void *owner; /**< ˽<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Խṹ(analog_t/digit_t/..../etc.) */
|
void *owner; /**< 私有属性结构(analog_t/digit_t/..../etc.) */
|
||||||
void *script; /**< <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ļ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʽ */
|
void *script; /**< 关联的计算表达式 */
|
||||||
|
|
||||||
/** Runtime generate */
|
/** Runtime generate */
|
||||||
value_t value; /**< <EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʱ<EFBFBD><EFBFBD>ʵʱ<EFBFBD><EFBFBD><EFBFBD>ݻ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> */
|
value_t value; /**< 运行时刻实时数据缓冲区 */
|
||||||
ticks_t last; /**< <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>仯ʱ<EFBFBD><EFBFBD> */
|
ticks_t last; /**< 最后变化时间 */
|
||||||
uint32_t state; /**< <EFBFBD><EFBFBD><EFBFBD><EFBFBD>״̬ */
|
uint32_t state; /**< 数据状态 */
|
||||||
byte_t funtype; /**< <EFBFBD>̳<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ͣ<EFBFBD><EFBFBD><EFBFBD>ʾ<EFBFBD><EFBFBD><EFBFBD>ݹ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> */
|
byte_t funtype; /**< 继承自所属组的类型,表示数据功能类型 */
|
||||||
uint16_t index; /**< <EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ԫ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> */
|
uint16_t index; /**< 数据元素索引 */
|
||||||
uint16_t n_alias_add_1; /**< <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ݱ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ĵ<EFBFBD>С<EFBFBD><EFBFBD>Ԥ<EFBFBD><EFBFBD>1<EFBFBD><EFBFBD><EFBFBD><EFBFBD>̬<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ã<EFBFBD> */
|
uint16_t n_alias_add_1; /**< 分配的数据别名缓冲区的大小(预留1,动态定订购用) */
|
||||||
uint16_t n_alias; /**< <EFBFBD><EFBFBD><EFBFBD>ݱ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ԫ<EFBFBD>ظ<EFBFBD><EFBFBD><EFBFBD> */
|
uint16_t n_alias; /**< 数据别名数组元素个数 */
|
||||||
alias_t* alias; /**< <EFBFBD><EFBFBD><EFBFBD>ݱ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> */
|
alias_t* alias; /**< 数据别名索引数组 */
|
||||||
uint16_t alias_pos; /**< <EFBFBD><EFBFBD><EFBFBD>ݱ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ǰλ<EFBFBD><EFBFBD> */
|
uint16_t alias_pos; /**< 数据别名当前位置 */
|
||||||
uint32_t offset; /**< <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>豸<EFBFBD><EFBFBD><EFBFBD>ݻ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ڵ<EFBFBD>ƫ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> */
|
uint32_t offset; /**< 数据在设备数据缓冲区内的偏移索引 */
|
||||||
group_t *grp; /**< <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> */
|
group_t *grp; /**< 所属数据组句柄 */
|
||||||
ied_t *ied; /**< <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>豸<EFBFBD><EFBFBD><EFBFBD><EFBFBD> */
|
ied_t *ied; /**< 所属设备句柄 */
|
||||||
|
|
||||||
/* Extend property */
|
/* Extend property */
|
||||||
void *sys_ext; /**< <EFBFBD><EFBFBD><EFBFBD>ݵ<EFBFBD><EFBFBD><EFBFBD>ϵͳ<EFBFBD><EFBFBD>չ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>,<2C>ɻ<EFBFBD><C9BB><EFBFBD><EFBFBD><EFBFBD>ʵ<EFBFBD><CAB5> */
|
void *sys_ext; /**< 数据点的系统扩展属性,由基本库实现 */
|
||||||
void *app_ext; /**< <EFBFBD><EFBFBD><EFBFBD>ݵ<EFBFBD><EFBFBD><EFBFBD>Ӧ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>չ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>,<2C><>Ӧ<EFBFBD>ÿ<EFBFBD>ʵ<EFBFBD><CAB5> */
|
void *app_ext; /**< 数据点的应用扩展属性,由应用库实现 */
|
||||||
void *usr_ext; /**< <EFBFBD><EFBFBD><EFBFBD>ݵ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>û<EFBFBD><EFBFBD><EFBFBD>չ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>,<2C><>Ӧ<EFBFBD>ó<EFBFBD><C3B3><EFBFBD>ʵ<EFBFBD><CAB5> */
|
void *usr_ext; /**< 数据点的用户扩展属性,由应用程序实现 */
|
||||||
};
|
};
|
||||||
|
|
||||||
/** group_t->type definiens */
|
/** group_t->type definiens */
|
||||||
@@ -245,36 +245,36 @@ struct element_t {
|
|||||||
#define GRP_ALARM 7 /**< Alarm type */
|
#define GRP_ALARM 7 /**< Alarm type */
|
||||||
#define GRP_SETTING 8 /**< Fixed value type */
|
#define GRP_SETTING 8 /**< Fixed value type */
|
||||||
#define GRP_STATUS 9 /**< State of device */
|
#define GRP_STATUS 9 /**< State of device */
|
||||||
#define GRP_VDI 10 /**< <EFBFBD><EFBFBD>ѹ<EFBFBD><EFBFBD> type */
|
#define GRP_VDI 10 /**< 软压板 type */
|
||||||
#define GRP_STEPPOS 11 /**< Step position type */
|
#define GRP_STEPPOS 11 /**< Step position type */
|
||||||
#define GRP_COMBO 12 /**< combo/compute type */
|
#define GRP_COMBO 12 /**< combo/compute type */
|
||||||
#define GRP_SIMANA 13 /**< ģ<EFBFBD><EFBFBD><EFBFBD><EFBFBD> */
|
#define GRP_SIMANA 13 /**< 模拟量 */
|
||||||
#define GRP_SETAREA 14 /**< <EFBFBD><EFBFBD>ֵ<EFBFBD><EFBFBD> */
|
#define GRP_SETAREA 14 /**< 定值区 */
|
||||||
#define GRP_ACCANA 15 /**< ¼<EFBFBD><EFBFBD>ģ<EFBFBD><EFBFBD><EFBFBD><EFBFBD> */
|
#define GRP_ACCANA 15 /**< 录波模拟量 */
|
||||||
#define GRP_ACCDGT 16 /**< ¼<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> */
|
#define GRP_ACCDGT 16 /**< 录波开关量 */
|
||||||
#define GRP_SETPOINT 18 /**< Set point type for 101,104 protocol used only */
|
#define GRP_SETPOINT 18 /**< Set point type for 101,104 protocol used only */
|
||||||
#define GRP_STEPCONTROL 19 /**< <EFBFBD><EFBFBD>λ<EFBFBD>õ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> */
|
#define GRP_STEPCONTROL 19 /**< 步位置调节组 */
|
||||||
|
|
||||||
/** <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ṹ */
|
/** 数据组结构 */
|
||||||
struct group_t {
|
struct group_t {
|
||||||
uint32_t id; /**< Identification, Commond Address of Set */
|
uint32_t id; /**< Identification, Commond Address of Set */
|
||||||
uint32_t flags; /**< Flags definiens */
|
uint32_t flags; /**< Flags definiens */
|
||||||
byte_t type; /**< Analogue/Digit/Control/Event/etc. */
|
byte_t type; /**< Analogue/Digit/Control/Event/etc. */
|
||||||
char name[LONGNAME]; /**< <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> */
|
char name[LONGNAME]; /**< 数据组的名称 */
|
||||||
uint16_t maxelems; /**< <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>elements<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ŀ */
|
uint16_t maxelems; /**< 允许包含elements的最大数目 */
|
||||||
element_t *elements; /**< <EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ԫ<EFBFBD>ض<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> */
|
element_t *elements; /**< 数据元素定义数组 */
|
||||||
|
|
||||||
// runtime generate
|
// runtime generate
|
||||||
uint16_t count; /**< ʵ<EFBFBD>ʰ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ԫ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ŀ */
|
uint16_t count; /**< 实际包含的数据元素数目 */
|
||||||
uint16_t index; /**< <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>IED->groups<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>±<EFBFBD> */
|
uint16_t index; /**< 数据组索引IED->groups的数组下标 */
|
||||||
value_t value; /**< <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>黺<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>˳<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>elements<EFBFBD><EFBFBD>ʵʱֵ */
|
value_t value; /**< 数据组缓冲区,顺序存放elements的实时值 */
|
||||||
ied_t *ied; /**< <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>豸<EFBFBD><EFBFBD><EFBFBD><EFBFBD> */
|
ied_t *ied; /**< 所属设备句柄 */
|
||||||
apr_hash_t *htdots; /**< <EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ԫ<EFBFBD>ض<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ϣ<EFBFBD><EFBFBD> */
|
apr_hash_t *htdots; /**< 数据元素定义哈希表 */
|
||||||
|
|
||||||
/* Extend property */
|
/* Extend property */
|
||||||
void *sys_ext; /**< <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ϵͳ<EFBFBD><EFBFBD>չ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>,<2C>ɻ<EFBFBD><C9BB><EFBFBD><EFBFBD><EFBFBD>ʵ<EFBFBD><CAB5> */
|
void *sys_ext; /**< 数据组的系统扩展属性,由基本库实现 */
|
||||||
void *app_ext; /**< <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ӧ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>չ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>,<2C><>Ӧ<EFBFBD>ÿ<EFBFBD>ʵ<EFBFBD><CAB5> */
|
void *app_ext; /**< 数据组的应用扩展属性,由应用库实现 */
|
||||||
void *usr_ext; /**< <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>û<EFBFBD><EFBFBD><EFBFBD>չ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>,<2C><>Ӧ<EFBFBD>ó<EFBFBD><C3B3><EFBFBD>ʵ<EFBFBD><CAB5> */
|
void *usr_ext; /**< 数据组的用户扩展属性,由应用程序实现 */
|
||||||
};
|
};
|
||||||
|
|
||||||
//<!-- IEDConfig id,name,flags,type,chncount,cpucount,addrsinfo,cpusinfo,station,frequency,delay,count
|
//<!-- IEDConfig id,name,flags,type,chncount,cpucount,addrsinfo,cpusinfo,station,frequency,delay,count
|
||||||
@@ -284,83 +284,83 @@ struct group_t {
|
|||||||
#define IED_TYPE_REMOTE (1)
|
#define IED_TYPE_REMOTE (1)
|
||||||
#define IED_TYPE_SYSTEM (2)
|
#define IED_TYPE_SYSTEM (2)
|
||||||
#define IED_TYPE_VIRTUAL (3)
|
#define IED_TYPE_VIRTUAL (3)
|
||||||
#define IED_TYPE_EPFI (4) /**< <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> */
|
#define IED_TYPE_EPFI (4) /**< 保护管理机 */
|
||||||
|
|
||||||
|
|
||||||
#define IED_FLAG_BLOCKED 0x00000004 /**< <EFBFBD>Ƿ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ȱʡ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> */
|
#define IED_FLAG_BLOCKED 0x00000004 /**< 是否封锁,缺省不封锁 */
|
||||||
|
|
||||||
|
|
||||||
#define CHANBEL_TYPE_UNKNOWN (0)
|
#define CHANBEL_TYPE_UNKNOWN (0)
|
||||||
#define CHANNEL_TYPE_IPV4 (1)
|
#define CHANNEL_TYPE_IPV4 (1)
|
||||||
#define CHANNEL_TYPE_IPV6 (2) /**< δ<EFBFBD><EFBFBD> */
|
#define CHANNEL_TYPE_IPV6 (2) /**< 未用 */
|
||||||
#define CHANNEL_TYPE_SERIAL (3) /**< <EFBFBD><EFBFBD><EFBFBD>ں<EFBFBD> */
|
#define CHANNEL_TYPE_SERIAL (3) /**< 串口号 */
|
||||||
|
|
||||||
#define CHANNEL_TYPE_USER_DEFINED (254) /**< <EFBFBD>û<EFBFBD><EFBFBD>Զ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> */
|
#define CHANNEL_TYPE_USER_DEFINED (254) /**< 用户自定义类型 */
|
||||||
|
|
||||||
|
|
||||||
typedef struct channel_t channel_t;
|
typedef struct channel_t channel_t;
|
||||||
struct channel_t {
|
struct channel_t {
|
||||||
uint32_t master; /**< <EFBFBD><EFBFBD><EFBFBD><EFBFBD>ͨ<EFBFBD><EFBFBD>ͨ<EFBFBD><EFBFBD>(Node ID) */
|
uint32_t master; /**< 所属通信通道(Node ID) */
|
||||||
|
|
||||||
//<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϊ2008-08-16<EFBFBD><EFBFBD><EFBFBD><EFBFBD>,֧<><D6A7>
|
//以下两个属性域为2008-08-16增加,支持
|
||||||
int channel_type; /**< ͨ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ַ<EFBFBD><EFBFBD><EFBFBD><EFBFBD> */
|
int channel_type; /**< 通道地址类型 */
|
||||||
char addr_str[LONGNAME]; /**< ͨ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ַ<EFBFBD><EFBFBD><EFBFBD>ַ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʾ */
|
char addr_str[LONGNAME]; /**< 通道地址的字符串表示 */
|
||||||
|
|
||||||
uint32_t addr; /**< ͨ<EFBFBD>Ŷ˿ڵ<EFBFBD>ַ */
|
uint32_t addr; /**< 通信端口地址 */
|
||||||
uint16_t port; /**< ip<EFBFBD><EFBFBD>ַ<EFBFBD>Ķ˿<EFBFBD> */
|
uint16_t port; /**< ip地址的端口 */
|
||||||
|
|
||||||
uint32_t status; /**< ͨ<EFBFBD>Ŷ˿<EFBFBD>״̬ */
|
uint32_t status; /**< 通信端口状态 */
|
||||||
ticks_t last_ticks; /**< <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʱ<EFBFBD><EFBFBD> */
|
ticks_t last_ticks; /**< 最近访问时间 */
|
||||||
ticks_t last_send_ticks; /**< <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ѯʱ<EFBFBD><EFBFBD> */
|
ticks_t last_send_ticks; /**< 最近查询时间 */
|
||||||
void *connect; /**< ͨ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ӿ<EFBFBD><EFBFBD><EFBFBD> */
|
void *connect; /**< 通道连接句柄 */
|
||||||
ied_t *ied; /**< <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>豸<EFBFBD><EFBFBD><EFBFBD><EFBFBD> */
|
ied_t *ied; /**< 所属设备句柄 */
|
||||||
int ied_id; /**< <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>豸id */
|
int ied_id; /**< 所属设备id */
|
||||||
};
|
};
|
||||||
|
|
||||||
typedef struct cpuinfo_t cpuinfo_t;
|
typedef struct cpuinfo_t cpuinfo_t;
|
||||||
struct cpuinfo_t {
|
struct cpuinfo_t {
|
||||||
byte_t addr; /**< CPU<EFBFBD><EFBFBD>ַ */
|
byte_t addr; /**< CPU地址 */
|
||||||
byte_t status; /**< CPU״̬ */
|
byte_t status; /**< CPU状态 */
|
||||||
byte_t templ; /**< CPUģ<EFBFBD><EFBFBD> */
|
byte_t templ; /**< CPU模板 */
|
||||||
char name[LONGNAME]; /**< CPU<EFBFBD><EFBFBD><EFBFBD><EFBFBD> */
|
char name[LONGNAME]; /**< CPU名称 */
|
||||||
ticks_t last_gi; /**< <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ܲ<EFBFBD>ѯʱ<EFBFBD><EFBFBD> */
|
ticks_t last_gi; /**< 最近总查询时间 */
|
||||||
ticks_t last_gi_send; /**< <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ܲ<EFBFBD>ѯ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʱ<EFBFBD><EFBFBD> */
|
ticks_t last_gi_send; /**< 最近总查询发送时间 */
|
||||||
ticks_t next_gi_send; /**< <EFBFBD>´<EFBFBD><EFBFBD>ܲ<EFBFBD>ѯ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʱ<EFBFBD><EFBFBD> */
|
ticks_t next_gi_send; /**< 下次总查询发送时间 */
|
||||||
ticks_t last_ticks; /**< <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʱ<EFBFBD><EFBFBD> */
|
ticks_t last_ticks; /**< 最近访问时间 */
|
||||||
ticks_t last_send_ticks; /**< <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ѯʱ<EFBFBD><EFBFBD> */
|
ticks_t last_send_ticks; /**< 最近查询时间 */
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/** IED struct definiens */
|
/** IED struct definiens */
|
||||||
struct ied_t {
|
struct ied_t {
|
||||||
uint32_t id; /**< Primy key ( = 0 ϵͳ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>IED ) */
|
uint32_t id; /**< Primy key ( = 0 系统保留IED ) */
|
||||||
uint32_t flags; /**< Flags define */
|
uint32_t flags; /**< Flags define */
|
||||||
byte_t type; /**< Type define */
|
byte_t type; /**< Type define */
|
||||||
byte_t chncount; /**< <EFBFBD>豸ͨ<EFBFBD>Ŷ˿<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ȱʡ=1<><31> */
|
byte_t chncount; /**< 设备通信端口总数(缺省=1) */
|
||||||
channel_t *channel; /**< <EFBFBD>豸ͨ<EFBFBD>Ŷ˿<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> */
|
channel_t *channel; /**< 设备通信端口数组 */
|
||||||
byte_t cpucount; /**< CPU<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ȱʡ=1<><31> */
|
byte_t cpucount; /**< CPU总数(缺省=1) */
|
||||||
cpuinfo_t *cpuinfo; /**< CPU<EFBFBD><EFBFBD>ַ<EFBFBD><EFBFBD><EFBFBD><EFBFBD> */
|
cpuinfo_t *cpuinfo; /**< CPU地址数组 */
|
||||||
char name[LONGNAME]; /**< <EFBFBD>豸<EFBFBD><EFBFBD><EFBFBD><EFBFBD> */
|
char name[LONGNAME]; /**< 设备名称 */
|
||||||
uint32_t station; /**< <EFBFBD><EFBFBD><EFBFBD><EFBFBD>վ<EFBFBD><EFBFBD><ֱ<><D6B1>Ŀ¼ID> */
|
uint32_t station; /**< 所属站号<直属目录ID> */
|
||||||
uint32_t node; /**< <EFBFBD><EFBFBD><EFBFBD><EFBFBD>ͨ<EFBFBD>Žڵ<EFBFBD><EFBFBD><EFBFBD> */
|
uint32_t node; /**< 所属通信节点号 */
|
||||||
uint16_t frequency; /**< ͨ<EFBFBD><EFBFBD>ɨ<EFBFBD><EFBFBD>Ƶ<EFBFBD><EFBFBD> */
|
uint16_t frequency; /**< 通信扫描频率 */
|
||||||
uint32_t delay; /**< ͨ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ӧ<EFBFBD><EFBFBD>ʱ(ms) */
|
uint32_t delay; /**< 通信响应延时(ms) */
|
||||||
uint16_t count; /**< <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ŀ */
|
uint16_t count; /**< 包含的数据组数目 */
|
||||||
group_t *groups; /**< <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>鶨<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> */
|
group_t *groups; /**< 数据组定义数组 */
|
||||||
apr_hash_t *htgroups; /**< <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>鶨<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ϣ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> */
|
apr_hash_t *htgroups; /**< 数据组定义哈希表句柄 */
|
||||||
uint32_t systoken_st; /**< ϵͳ<EFBFBD><EFBFBD><EFBFBD>Ƶ<EFBFBD>״̬ */
|
uint32_t systoken_st; /**< 系统令牌的状态 */
|
||||||
|
|
||||||
/* Runtime generate */
|
/* Runtime generate */
|
||||||
uint16_t index; /**< <EFBFBD>豸<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>±<EFBFBD> */
|
uint16_t index; /**< 设备数组下标 */
|
||||||
status_t status; /**< <EFBFBD>豸<EFBFBD><EFBFBD><EFBFBD><EFBFBD>״̬ */
|
status_t status; /**< 设备运行状态 */
|
||||||
ticks_t last_ticks; /**< <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʱ<EFBFBD><EFBFBD> */
|
ticks_t last_ticks; /**< 最近访问时间 */
|
||||||
ticks_t last_gi; /**< <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ܲ<EFBFBD>ѯʱ<EFBFBD><EFBFBD> */
|
ticks_t last_gi; /**< 最近总查询时间 */
|
||||||
|
|
||||||
/* Extend property */
|
/* Extend property */
|
||||||
void *sys_ext; /**< <EFBFBD>豸<EFBFBD><EFBFBD>ϵͳ<EFBFBD><EFBFBD>չ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>,<2C><><EFBFBD><EFBFBD><EFBFBD>ⶨ<EFBFBD><E2B6A8> */
|
void *sys_ext; /**< 设备的系统扩展属性,基本库定义 */
|
||||||
void *app_ext; /**< <EFBFBD>豸<EFBFBD><EFBFBD>Ӧ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>չ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>,Ӧ<>ÿⶨ<C3BF><E2B6A8> */
|
void *app_ext; /**< 设备的应用扩展属性,应用库定义 */
|
||||||
void *usr_ext; /**< <EFBFBD>豸<EFBFBD><EFBFBD><EFBFBD>û<EFBFBD><EFBFBD><EFBFBD>չ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>,Ӧ<>ó<EFBFBD><C3B3><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> */
|
void *usr_ext; /**< 设备的用户扩展属性,应用程序定义 */
|
||||||
};
|
};
|
||||||
|
|
||||||
#ifdef _OS_WIN32_
|
#ifdef _OS_WIN32_
|
||||||
|
|||||||
@@ -224,8 +224,19 @@ extern "C" {
|
|||||||
#include <sys/time.h>
|
#include <sys/time.h>
|
||||||
#include <sys/resource.h>
|
#include <sys/resource.h>
|
||||||
#endif
|
#endif
|
||||||
|
/*
|
||||||
#define max(a,b) (((a) > (b)) ? (a) : (b))
|
#define max(a,b) (((a) > (b)) ? (a) : (b))
|
||||||
#define min(a,b) (((a) < (b)) ? (a) : (b))
|
#define min(a,b) (((a) < (b)) ? (a) : (b))
|
||||||
|
*/
|
||||||
|
#ifndef __cplusplus
|
||||||
|
#ifndef max
|
||||||
|
#define max(a,b) (((a) > (b)) ? (a) : (b))
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef min
|
||||||
|
#define min(a,b) (((a) < (b)) ? (a) : (b))
|
||||||
|
#endif
|
||||||
|
#endif
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
|
|||||||
@@ -1,21 +1,34 @@
|
|||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
#include "../json/mms_json_inter.h"
|
#include "../json/mms_json_inter.h"
|
||||||
#include "../rocketmq/CProducer.h"
|
//#include "../rocketmq/CProducer.h"
|
||||||
#include "../rocketmq/CMessage.h"
|
//#include "../rocketmq/CMessage.h"
|
||||||
#include "../rocketmq/CSendResult.h"
|
//#include "../rocketmq/CSendResult.h"
|
||||||
|
//#include "../rocketmq/CPushConsumer.h"
|
||||||
#include "../rocketmq/CPushConsumer.h"
|
#include "../rocketmq/DefaultMQProducer.h"
|
||||||
|
#include "../rocketmq/MQMessage.h"
|
||||||
|
#include "../rocketmq/SendResult.h"
|
||||||
|
#include "../rocketmq/SessionCredentials.h"
|
||||||
|
#include "../rocketmq/MQMessageExt.h"
|
||||||
|
#include "../rocketmq/ConsumeType.h"
|
||||||
|
#include "../rocketmq/MQMessageListener.h"
|
||||||
|
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
#include <iostream>
|
||||||
|
#include <string>
|
||||||
|
|
||||||
|
using namespace rocketmq;
|
||||||
|
|
||||||
/*添加测试函数lnk10-10*/
|
/*添加测试函数lnk10-10*/
|
||||||
void producer_send0();
|
//void producer_send0();
|
||||||
void StartSendMessage(CProducer* producer,const char* strbody);
|
//void StartSendMessage(CProducer* producer,const char* strbody);
|
||||||
void producer_send(const char* strbody);
|
//void producer_send(const char* strbody);
|
||||||
void rocketmq_producer_send(const char* strbody,const char* topic);
|
//void rocketmq_producer_send(const char* strbody,const char* topic);
|
||||||
void rocketmq_StartSendMessage(CProducer* producer,const char* strbody,const char* topic);
|
//void rocketmq_StartSendMessage(CProducer* producer,const char* strbody,const char* topic);
|
||||||
|
void rocketmq_producer_send(const std::string& body,
|
||||||
|
const std::string& topic,
|
||||||
|
const std::string& tags,
|
||||||
|
const std::string& keys);
|
||||||
extern "C" {
|
extern "C" {
|
||||||
void rocketmq_test_rt();
|
void rocketmq_test_rt();
|
||||||
void rocketmq_test_ud();
|
void rocketmq_test_ud();
|
||||||
@@ -32,24 +45,29 @@ extern void my_rocketmq_send(Ckafka_data_t& data);
|
|||||||
void InitializeProducer();
|
void InitializeProducer();
|
||||||
void ShutdownAndDestroyProducer();
|
void ShutdownAndDestroyProducer();
|
||||||
//////////////////////////////////////////////////////消费者
|
//////////////////////////////////////////////////////消费者
|
||||||
void InitializeConsumer(const std::string& consumerName, const std::string& nameServer, const char* topic, const char* tag, const std::string& key);
|
typedef ConsumeStatus (*MessageCallBack)(
|
||||||
void ShutdownAndDestroyConsumer();
|
const MQMessageExt& msg
|
||||||
|
);
|
||||||
|
|
||||||
struct Subscription {
|
struct Subscription {
|
||||||
std::string topic;
|
std::string topic;
|
||||||
std::string tag;
|
std::string tag;
|
||||||
MessageCallBack callback;
|
MessageCallBack callback;
|
||||||
|
|
||||||
Subscription(const std::string& t, const std::string& tg, MessageCallBack cb)
|
Subscription(const std::string& t,
|
||||||
|
const std::string& tg,
|
||||||
|
MessageCallBack cb)
|
||||||
: topic(t), tag(tg), callback(cb) {}
|
: topic(t), tag(tg), callback(cb) {}
|
||||||
};
|
};
|
||||||
|
//void InitializeConsumer(const std::string& consumerName, const std::string& nameServer, const char* topic, const char* tag, const std::string& key);
|
||||||
|
void InitializeConsumer(const std::string& consumerName,
|
||||||
|
const std::string& nameServer,
|
||||||
|
const std::vector<Subscription>& subscriptions);
|
||||||
|
void ShutdownAndDestroyConsumer();
|
||||||
|
|
||||||
void rocketmq_consumer_receive(
|
void rocketmq_consumer_receive(
|
||||||
const std::string& consumerName,
|
const std::string& consumerName,
|
||||||
const std::string& nameServer,
|
const std::string& nameServer,
|
||||||
//const std::string& topic,
|
|
||||||
//const std::string& tag,
|
|
||||||
//MessageCallBack callback);
|
|
||||||
const std::vector<Subscription>& subscriptions);
|
const std::vector<Subscription>& subscriptions);
|
||||||
|
|
||||||
//////////////////////////////////////////////////////
|
//////////////////////////////////////////////////////
|
||||||
|
|||||||
@@ -49,7 +49,7 @@
|
|||||||
#ifndef HIBYTE
|
#ifndef HIBYTE
|
||||||
#define HIBYTE(w) ((byte_t)((uint16_t)(w) >> 8))
|
#define HIBYTE(w) ((byte_t)((uint16_t)(w) >> 8))
|
||||||
#endif
|
#endif
|
||||||
|
/*
|
||||||
#ifndef max
|
#ifndef max
|
||||||
#define max(a,b) (((a) > (b)) ? (a) : (b))
|
#define max(a,b) (((a) > (b)) ? (a) : (b))
|
||||||
#endif
|
#endif
|
||||||
@@ -57,7 +57,18 @@
|
|||||||
#ifndef min
|
#ifndef min
|
||||||
#define min(a,b) (((a) < (b)) ? (a) : (b))
|
#define min(a,b) (((a) < (b)) ? (a) : (b))
|
||||||
#endif
|
#endif
|
||||||
|
*/
|
||||||
|
#ifndef __cplusplus
|
||||||
|
|
||||||
|
#ifndef max
|
||||||
|
#define max(a,b) (((a) > (b)) ? (a) : (b))
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef min
|
||||||
|
#define min(a,b) (((a) < (b)) ? (a) : (b))
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#endif
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
extern "C" {
|
extern "C" {
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
1297
json/PQSMsg.cpp
Normal file
1297
json/PQSMsg.cpp
Normal file
File diff suppressed because it is too large
Load Diff
2548
json/PQSMsg.h
Normal file
2548
json/PQSMsg.h
Normal file
File diff suppressed because it is too large
Load Diff
@@ -45,6 +45,8 @@ extern std::string WEB_EVENT;
|
|||||||
extern std::string WEB_FILEDOWNLOAD;
|
extern std::string WEB_FILEDOWNLOAD;
|
||||||
extern std::string G_CONNECT_TOPIC;
|
extern std::string G_CONNECT_TOPIC;
|
||||||
|
|
||||||
|
extern int RECALL_ONLY_FLAG;
|
||||||
|
|
||||||
//lnk20250115添加台账锁
|
//lnk20250115添加台账锁
|
||||||
extern pthread_mutex_t mtx;
|
extern pthread_mutex_t mtx;
|
||||||
|
|
||||||
@@ -164,6 +166,7 @@ public:
|
|||||||
QString WavePhasicB;
|
QString WavePhasicB;
|
||||||
QString WavePhasicC;
|
QString WavePhasicC;
|
||||||
QString TypeOfData; //闪变和统计是否合并 0-分开 1-合并
|
QString TypeOfData; //闪变和统计是否合并 0-分开 1-合并
|
||||||
|
QString IEDControl; //例:LD0 lnk2026-5-13
|
||||||
QString UnitOfTimeUnit; //暂态事件持续事件单位:0 - 毫秒 1 - 秒 lnk20260127
|
QString UnitOfTimeUnit; //暂态事件持续事件单位:0 - 毫秒 1 - 秒 lnk20260127
|
||||||
QString ValueOfTimeUnit; //上送值的时间:UTC-UTC时间 beijing-北京时间
|
QString ValueOfTimeUnit; //上送值的时间:UTC-UTC时间 beijing-北京时间
|
||||||
QString WaveTimeFlag; //录波文件的时间:UTC-UTC时间 beijing-北京时间
|
QString WaveTimeFlag; //录波文件的时间:UTC-UTC时间 beijing-北京时间
|
||||||
@@ -382,6 +385,7 @@ bool get_xml_config_by_dev_type(const char* dev_type, XmlConfigC* out_cfg) {
|
|||||||
strncpy(out_cfg->TypeOfData, cfg.TypeOfData.toUtf8().constData(), sizeof(out_cfg->TypeOfData) - 1); out_cfg->TypeOfData[sizeof(out_cfg->TypeOfData) - 1] = '\0';//lnk20260127
|
strncpy(out_cfg->TypeOfData, cfg.TypeOfData.toUtf8().constData(), sizeof(out_cfg->TypeOfData) - 1); out_cfg->TypeOfData[sizeof(out_cfg->TypeOfData) - 1] = '\0';//lnk20260127
|
||||||
strncpy(out_cfg->ValueOfTimeUnit, cfg.ValueOfTimeUnit.toUtf8().constData(),sizeof(out_cfg->ValueOfTimeUnit) - 1);
|
strncpy(out_cfg->ValueOfTimeUnit, cfg.ValueOfTimeUnit.toUtf8().constData(),sizeof(out_cfg->ValueOfTimeUnit) - 1);
|
||||||
strncpy(out_cfg->WaveTimeFlag, cfg.WaveTimeFlag.toUtf8().constData(), sizeof(out_cfg->WaveTimeFlag) - 1);
|
strncpy(out_cfg->WaveTimeFlag, cfg.WaveTimeFlag.toUtf8().constData(), sizeof(out_cfg->WaveTimeFlag) - 1);
|
||||||
|
strncpy(out_cfg->IEDControl, cfg.IEDControl.toUtf8().constData(), sizeof(out_cfg->IEDControl) - 1);//lnk2026-5-13
|
||||||
strncpy(out_cfg->IEDname, cfg.IEDname.toUtf8().constData(), sizeof(out_cfg->IEDname) - 1);
|
strncpy(out_cfg->IEDname, cfg.IEDname.toUtf8().constData(), sizeof(out_cfg->IEDname) - 1);
|
||||||
strncpy(out_cfg->LDevicePrefix, cfg.LDevicePrefix.toUtf8().constData(), sizeof(out_cfg->LDevicePrefix) - 1);
|
strncpy(out_cfg->LDevicePrefix, cfg.LDevicePrefix.toUtf8().constData(), sizeof(out_cfg->LDevicePrefix) - 1);
|
||||||
|
|
||||||
@@ -1034,6 +1038,10 @@ bool ParseXMLConfig2(int xml_flag, XmlConfig *cfg, list<CTopic*> *ctopiclist,QSt
|
|||||||
cfg->WaveTimeFlag.append(e.attribute("WaveTimeFlag"));
|
cfg->WaveTimeFlag.append(e.attribute("WaveTimeFlag"));
|
||||||
|
|
||||||
}
|
}
|
||||||
|
if ("IEDControl" == strTag)
|
||||||
|
{
|
||||||
|
cfg->IEDControl.append(e.attribute("name"));
|
||||||
|
}
|
||||||
if ("IED" == strTag)
|
if ("IED" == strTag)
|
||||||
{
|
{
|
||||||
cfg->IEDname.append(e.attribute("name"));
|
cfg->IEDname.append(e.attribute("name"));
|
||||||
@@ -1253,6 +1261,7 @@ int transfer_json_block_data(char v_wiring_type[], json_block_data *data) //json
|
|||||||
printf("TypeOfData = '%s'\n", cfg1.TypeOfData);
|
printf("TypeOfData = '%s'\n", cfg1.TypeOfData);
|
||||||
printf("ValueOfTimeUnit = '%s'\n", cfg1.ValueOfTimeUnit);
|
printf("ValueOfTimeUnit = '%s'\n", cfg1.ValueOfTimeUnit);
|
||||||
printf("WaveTimeFlag = '%s'\n", cfg1.WaveTimeFlag);
|
printf("WaveTimeFlag = '%s'\n", cfg1.WaveTimeFlag);
|
||||||
|
printf("IEDControl = '%s'\n", cfg1.IEDControl);
|
||||||
printf("IEDname = '%s'\n", cfg1.IEDname);
|
printf("IEDname = '%s'\n", cfg1.IEDname);
|
||||||
printf("LDevicePrefix = '%s'\n", cfg1.LDevicePrefix);
|
printf("LDevicePrefix = '%s'\n", cfg1.LDevicePrefix);
|
||||||
printf("=====================================\n");
|
printf("=====================================\n");
|
||||||
@@ -2791,13 +2800,6 @@ static void format_time_ms(long long ms, char* buf, size_t buf_len)
|
|||||||
void processGGIO_start_data_end(char* mp_id,char* fullname,double v,long long time,char* devtype,int monitor_id)
|
void processGGIO_start_data_end(char* mp_id,char* fullname,double v,long long time,char* devtype,int monitor_id)
|
||||||
{
|
{
|
||||||
|
|
||||||
//监测点日志的key,lnk20250526
|
|
||||||
char full_key_m_c[256]; // 分配足够空间
|
|
||||||
char full_key_m_d[256]; // 分配足够空间
|
|
||||||
snprintf(full_key_m_c, sizeof(full_key_m_c), "monitor.%s.COM", mp_id);
|
|
||||||
snprintf(full_key_m_d, sizeof(full_key_m_d), "monitor.%s.DATA", mp_id);
|
|
||||||
//监测点日志的key,lnk20250526
|
|
||||||
|
|
||||||
XmlConfig c_xmlcfg;
|
XmlConfig c_xmlcfg;
|
||||||
if (xmlinfo_list.contains(devtype)) {
|
if (xmlinfo_list.contains(devtype)) {
|
||||||
c_xmlcfg = xmlinfo_list[devtype]->xmlcfg;
|
c_xmlcfg = xmlinfo_list[devtype]->xmlcfg;
|
||||||
@@ -2847,7 +2849,7 @@ void processGGIO_start_data_end(char* mp_id,char* fullname,double v,long long ti
|
|||||||
snprintf(mp_name, sizeof(mp_name), "unknown");
|
snprintf(mp_name, sizeof(mp_name), "unknown");
|
||||||
}
|
}
|
||||||
|
|
||||||
DIY_WARNLOG_CODE(full_key_m_d, LOG_CODE_REPORT,
|
DIY_WARNLOG_CODE(mp_id,2 ,LOG_CODE_GGIO_LPHD,
|
||||||
"监测点:%s(%s),在%s发生事件:%s,事件值:%.2f",
|
"监测点:%s(%s),在%s发生事件:%s,事件值:%.2f",
|
||||||
mp_name, mp_id, time_str, descBa.constData(), v);
|
mp_name, mp_id, time_str, descBa.constData(), v);
|
||||||
|
|
||||||
@@ -2964,7 +2966,7 @@ void Set_xml_databaseinfo(char* MODEL_ID, char* TMNL_TYPE, char* FILE_PATH, char
|
|||||||
cout << file_name << "!!!!!!!!!!!!!!!!!!!!!!!!!!" << save_name << endl;
|
cout << file_name << "!!!!!!!!!!!!!!!!!!!!!!!!!!" << save_name << endl;
|
||||||
|
|
||||||
//mq日志
|
//mq日志
|
||||||
DIY_WARNLOG_CODE("process",LOG_CODE_ICD_AND_DOWNLOAD,"【WARN】前置获取到终端类型%s,该终端类型对应的映射文件为%s,映射文件将下载并保存在本地为%s",TMNL_TYPE,FILE_PATH,save_name);
|
DIY_WARNLOG_CODE("process",0,LOG_CODE_ICD_AND_DOWNLOAD,"【WARN】前置获取到终端类型%s,该终端类型对应的映射文件为%s,映射文件将下载并保存在本地为%s",TMNL_TYPE,FILE_PATH,save_name);
|
||||||
|
|
||||||
|
|
||||||
// 调用web获取文件内容
|
// 调用web获取文件内容
|
||||||
@@ -2990,7 +2992,7 @@ void Set_xml_databaseinfo(char* MODEL_ID, char* TMNL_TYPE, char* FILE_PATH, char
|
|||||||
(dataItem == NULL || (dataItem->type == cJSON_NULL))) {
|
(dataItem == NULL || (dataItem->type == cJSON_NULL))) {
|
||||||
isErrorJson = true;
|
isErrorJson = true;
|
||||||
std::cerr << "Error: Server returned empty file stream, code=A00555." << std::endl;
|
std::cerr << "Error: Server returned empty file stream, code=A00555." << std::endl;
|
||||||
DIY_ERRORLOG_CODE("process", LOG_CODE_ICD_AND_DOWNLOAD,
|
DIY_ERRORLOG_CODE("process",0, LOG_CODE_ICD_AND_DOWNLOAD,
|
||||||
"【ERROR】前置下载文件失败,服务端返回A00555(文件流为空),文件=%s",
|
"【ERROR】前置下载文件失败,服务端返回A00555(文件流为空),文件=%s",
|
||||||
save_name);
|
save_name);
|
||||||
}
|
}
|
||||||
@@ -3007,17 +3009,17 @@ void Set_xml_databaseinfo(char* MODEL_ID, char* TMNL_TYPE, char* FILE_PATH, char
|
|||||||
outFile.close();
|
outFile.close();
|
||||||
std::cout << "File saved successfully!" << std::endl;
|
std::cout << "File saved successfully!" << std::endl;
|
||||||
//mq日志
|
//mq日志
|
||||||
DIY_INFOLOG("process","【NORMAL】前置下载映射文件%s成功",save_name);
|
DIY_INFOLOG_CODE("process",0,LOG_CODE_ICD_AND_DOWNLOAD,"【NORMAL】前置下载映射文件%s成功",save_name);
|
||||||
} else {
|
} else {
|
||||||
std::cerr << "Error: Unable to open file for writing." << std::endl;
|
std::cerr << "Error: Unable to open file for writing." << std::endl;
|
||||||
DIY_ERRORLOG_CODE("process",LOG_CODE_ICD_AND_DOWNLOAD,"【ERROR】前置写入本地映射文件%s失败",save_name);
|
DIY_ERRORLOG_CODE("process",0,LOG_CODE_ICD_AND_DOWNLOAD,"【ERROR】前置写入本地映射文件%s失败",save_name);
|
||||||
}
|
}
|
||||||
|
|
||||||
// 释放分配的内存
|
// 释放分配的内存
|
||||||
free(fileContent);
|
free(fileContent);
|
||||||
} else {
|
} else {
|
||||||
std::cerr << "Error: Unable to download file." << std::endl;
|
std::cerr << "Error: Unable to download file." << std::endl;
|
||||||
DIY_ERRORLOG_CODE("process",LOG_CODE_ICD_AND_DOWNLOAD,"【ERROR】前置调用文件下载接口下载远端文件文件%s失败",FILE_PATH);
|
DIY_ERRORLOG_CODE("process",0,LOG_CODE_ICD_AND_DOWNLOAD,"【ERROR】前置调用文件下载接口下载远端文件文件%s失败",FILE_PATH);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -3278,14 +3280,13 @@ void connectlog_pgsql(char* id,char* datetime,int status)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
//使用mq
|
//使用mq
|
||||||
Ckafka_data_t connect_info;
|
Ckafka_data_t connect_info;
|
||||||
connect_info.strTopic = QString::fromStdString(G_CONNECT_TOPIC);
|
connect_info.strTopic = QString::fromStdString(G_CONNECT_TOPIC);
|
||||||
|
connect_info.mp_id = QString::fromLocal8Bit(id);//这里填装置id,后续作为key
|
||||||
connect_info.strText = QString::fromStdString(std::string(jsonString));
|
connect_info.strText = QString::fromStdString(std::string(jsonString));
|
||||||
|
|
||||||
if(g_node_id == STAT_DATA_BASE_NODE_ID){//稳态才上传
|
if((g_node_id == STAT_DATA_BASE_NODE_ID && RECALL_ONLY_FLAG == 0) || (g_node_id == RECALL_HIS_DATA_BASE_NODE_ID && RECALL_ONLY_FLAG == 1)){//稳态或者补招才上传
|
||||||
kafka_data_list_mutex.lock(); //加锁
|
kafka_data_list_mutex.lock(); //加锁
|
||||||
kafka_data_list.append(connect_info); //添加 kafka发送链表
|
kafka_data_list.append(connect_info); //添加 kafka发送链表
|
||||||
kafka_data_list_mutex.unlock(); //解锁
|
kafka_data_list_mutex.unlock(); //解锁
|
||||||
@@ -3348,7 +3349,7 @@ static bool writeJsonToFile(const char* filePath, const char* jsonString)
|
|||||||
{
|
{
|
||||||
FILE* fp = fopen(filePath, "w");
|
FILE* fp = fopen(filePath, "w");
|
||||||
if (!fp) {
|
if (!fp) {
|
||||||
//DIY_ERRORLOG_CODE("process",LOG_CODE_TRANSIENT_COMM,"【ERROR】无法将暂态事件写入本地缓存");
|
//DIY_ERRORLOG_CODE("process",0,LOG_CODE_TRANSIENT_COMM,"【ERROR】无法将暂态事件写入本地缓存");
|
||||||
std::cerr << "Failed to write in file : " << filePath << std::endl;
|
std::cerr << "Failed to write in file : " << filePath << std::endl;
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@@ -3435,7 +3436,7 @@ static void scanAndResendOfflineFiles(const std::string &dirPath)
|
|||||||
// 读取文件内容(即之前存的 JSON)
|
// 读取文件内容(即之前存的 JSON)
|
||||||
FILE* fp = fopen(fileList[i].fileName.c_str(), "r");
|
FILE* fp = fopen(fileList[i].fileName.c_str(), "r");
|
||||||
if (!fp) {
|
if (!fp) {
|
||||||
DIY_ERRORLOG_CODE("process",LOG_CODE_TRANSIENT_COMM,"【ERROR】无法打开本地缓存的暂态事件");
|
DIY_ERRORLOG_CODE("process",0,LOG_CODE_TRANSIENT_COMM,"【ERROR】无法打开本地缓存的暂态事件");
|
||||||
std::cerr << " fail to open exsist file " << fileList[i].fileName << std::endl;
|
std::cerr << " fail to open exsist file " << fileList[i].fileName << std::endl;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
@@ -3462,14 +3463,14 @@ static void scanAndResendOfflineFiles(const std::string &dirPath)
|
|||||||
std::cout << "old file send fail" << std::endl;
|
std::cout << "old file send fail" << std::endl;
|
||||||
|
|
||||||
|
|
||||||
DIY_WARNLOG_CODE("process",LOG_CODE_TRANSIENT_COMM,"【WARN】前置重发暂态事件失败");
|
DIY_WARNLOG_CODE("process",0,LOG_CODE_TRANSIENT_COMM,"【WARN】前置重发暂态事件失败");
|
||||||
|
|
||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
// 表示有响应,则可视为成功;根据项目需要可加更精细的判断
|
// 表示有响应,则可视为成功;根据项目需要可加更精细的判断
|
||||||
handleCommentResponse(std::string(ptr));
|
handleCommentResponse(std::string(ptr));
|
||||||
|
|
||||||
DIY_WARNLOG_CODE("process",LOG_CODE_TRANSIENT_COMM,"【WARN】前置重发暂态事件成功");
|
DIY_WARNLOG_CODE("process",0,LOG_CODE_TRANSIENT_COMM,"【WARN】前置重发暂态事件成功");
|
||||||
|
|
||||||
std::cout << "old file send success,remove it" << std::endl;
|
std::cout << "old file send success,remove it" << std::endl;
|
||||||
// 删除文件
|
// 删除文件
|
||||||
@@ -3504,13 +3505,6 @@ char* uuid_cfg,char* uuid_dat,
|
|||||||
char* mp_id,char* Qvvr_rptname,char* devtype)
|
char* mp_id,char* Qvvr_rptname,char* devtype)
|
||||||
{
|
{
|
||||||
|
|
||||||
//监测点日志的key,lnk20250526
|
|
||||||
char full_key_m_c[256]; // 分配足够空间
|
|
||||||
char full_key_m_d[256]; // 分配足够空间
|
|
||||||
snprintf(full_key_m_c, sizeof(full_key_m_c), "monitor.%s.COM", mp_id);
|
|
||||||
snprintf(full_key_m_d, sizeof(full_key_m_d), "monitor.%s.DATA", mp_id);
|
|
||||||
//监测点日志的key,lnk20250526
|
|
||||||
|
|
||||||
// 原本的逻辑,不做任何改动
|
// 原本的逻辑,不做任何改动
|
||||||
// ---------------------------------------------------------------
|
// ---------------------------------------------------------------
|
||||||
XmlConfig c_xmlcfg;
|
XmlConfig c_xmlcfg;
|
||||||
@@ -3565,7 +3559,7 @@ char* mp_id,char* Qvvr_rptname,char* devtype)
|
|||||||
|
|
||||||
char* json_string = cJSON_Print(root);
|
char* json_string = cJSON_Print(root);
|
||||||
if (json_string == NULL) {
|
if (json_string == NULL) {
|
||||||
DIY_ERRORLOG_CODE(full_key_m_d,LOG_CODE_TRANSIENT_COMM,"【ERROR】监测点:%s暂态事件生成JSON字符串失败",mp_id);
|
DIY_ERRORLOG_CODE(mp_id,2,LOG_CODE_TRANSIENT_COMM,"【ERROR】监测点:%s暂态事件生成JSON字符串失败",mp_id);
|
||||||
std::cerr << "Failed to print JSON object." << std::endl;
|
std::cerr << "Failed to print JSON object." << std::endl;
|
||||||
cJSON_Delete(root);
|
cJSON_Delete(root);
|
||||||
return 0;
|
return 0;
|
||||||
@@ -3585,7 +3579,7 @@ char* mp_id,char* Qvvr_rptname,char* devtype)
|
|||||||
if (j_r == NULL) {
|
if (j_r == NULL) {
|
||||||
|
|
||||||
//mq日志
|
//mq日志
|
||||||
DIY_ERRORLOG_CODE(full_key_m_d,LOG_CODE_TRANSIENT_COMM,"【ERROR】暂态接口响应异常,无法上送监测点%s的暂态事件",mp_id);
|
DIY_ERRORLOG_CODE(mp_id,2,LOG_CODE_TRANSIENT_COMM,"【ERROR】暂态接口响应异常,无法上送监测点%s的暂态事件",mp_id);
|
||||||
|
|
||||||
std::cout << "qvvr send fail ,store in local" << std::endl;
|
std::cout << "qvvr send fail ,store in local" << std::endl;
|
||||||
// 1) 先检查/FeProject/dat/qvvr/目录文件大小是否超过 10M,若超过则删除最老的一个文件
|
// 1) 先检查/FeProject/dat/qvvr/目录文件大小是否超过 10M,若超过则删除最老的一个文件
|
||||||
@@ -3607,7 +3601,7 @@ char* mp_id,char* Qvvr_rptname,char* devtype)
|
|||||||
|
|
||||||
// 把 json_string 写入文件
|
// 把 json_string 写入文件
|
||||||
if(!writeJsonToFile(fileName.c_str(), json_string)){
|
if(!writeJsonToFile(fileName.c_str(), json_string)){
|
||||||
DIY_ERRORLOG_CODE(full_key_m_d,LOG_CODE_TRANSIENT_COMM,"【ERROR】监测点:%s无法将暂态时间为%lld的暂态事件写入本地缓存",mp_id,start_tm);
|
DIY_ERRORLOG_CODE(mp_id,2,LOG_CODE_TRANSIENT_COMM,"【ERROR】监测点:%s无法将暂态时间为%lld的暂态事件写入本地缓存",mp_id,start_tm);
|
||||||
}
|
}
|
||||||
|
|
||||||
checkAndRemoveOldestIfNeeded(qvvrDir, 10LL * 1024 * 1024);
|
checkAndRemoveOldestIfNeeded(qvvrDir, 10LL * 1024 * 1024);
|
||||||
@@ -3636,7 +3630,7 @@ char* mp_id,char* Qvvr_rptname,char* devtype)
|
|||||||
std::cout << "Error: Received NULL response" << std::endl;
|
std::cout << "Error: Received NULL response" << std::endl;
|
||||||
|
|
||||||
//mq日志
|
//mq日志
|
||||||
DIY_ERRORLOG_CODE(full_key_m_d,LOG_CODE_TRANSIENT_COMM,"【ERROR】暂态接口无响应,无法上送监测点%s的暂态事件",mp_id);
|
DIY_ERRORLOG_CODE(mp_id,2,LOG_CODE_TRANSIENT_COMM,"【ERROR】暂态接口无响应,无法上送监测点%s的暂态事件",mp_id);
|
||||||
|
|
||||||
std::cout << "qvvr send fail ,store in local" << std::endl;
|
std::cout << "qvvr send fail ,store in local" << std::endl;
|
||||||
// 1) 先检查/FeProject/dat/qvvr/目录文件大小是否超过 10M,若超过则删除最老的一个文件
|
// 1) 先检查/FeProject/dat/qvvr/目录文件大小是否超过 10M,若超过则删除最老的一个文件
|
||||||
@@ -3656,7 +3650,7 @@ char* mp_id,char* Qvvr_rptname,char* devtype)
|
|||||||
fileName += ".txt";
|
fileName += ".txt";
|
||||||
// 把 json_string 写入文件
|
// 把 json_string 写入文件
|
||||||
if(!writeJsonToFile(fileName.c_str(), json_string)){
|
if(!writeJsonToFile(fileName.c_str(), json_string)){
|
||||||
DIY_ERRORLOG_CODE(full_key_m_d,LOG_CODE_TRANSIENT_COMM,"【ERROR】监测点:%s无法将暂态时间为%lld的暂态事件写入本地缓存",mp_id,start_tm);
|
DIY_ERRORLOG_CODE(mp_id,2,LOG_CODE_TRANSIENT_COMM,"【ERROR】监测点:%s无法将暂态时间为%lld的暂态事件写入本地缓存",mp_id,start_tm);
|
||||||
}
|
}
|
||||||
|
|
||||||
checkAndRemoveOldestIfNeeded(qvvrDir, 10LL * 1024 * 1024);
|
checkAndRemoveOldestIfNeeded(qvvrDir, 10LL * 1024 * 1024);
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
BIN
librocketmq.a
BIN
librocketmq.a
Binary file not shown.
BIN
librocketmq.so
BIN
librocketmq.so
Binary file not shown.
248
log4cplus/config/defines.hxx
Normal file
248
log4cplus/config/defines.hxx
Normal file
@@ -0,0 +1,248 @@
|
|||||||
|
/* include/log4cplus/config/defines.hxx. Generated from defines.hxx.in by configure. */
|
||||||
|
#ifndef LOG4CPLUS_CONFIG_DEFINES_HXX
|
||||||
|
#define LOG4CPLUS_CONFIG_DEFINES_HXX
|
||||||
|
|
||||||
|
/* */
|
||||||
|
#define LOG4CPLUS_HAVE_SYSLOG_H 1
|
||||||
|
|
||||||
|
/* */
|
||||||
|
#define LOG4CPLUS_HAVE_ARPA_INET_H 1
|
||||||
|
|
||||||
|
/* */
|
||||||
|
#define LOG4CPLUS_HAVE_NETINET_IN_H 1
|
||||||
|
|
||||||
|
/* */
|
||||||
|
#define LOG4CPLUS_HAVE_NETINET_TCP_H 1
|
||||||
|
|
||||||
|
/* */
|
||||||
|
#define LOG4CPLUS_HAVE_SYS_TIMEB_H 1
|
||||||
|
|
||||||
|
/* */
|
||||||
|
#define LOG4CPLUS_HAVE_SYS_TIME_H 1
|
||||||
|
|
||||||
|
/* */
|
||||||
|
#define LOG4CPLUS_HAVE_SYS_TYPES_H 1
|
||||||
|
|
||||||
|
/* */
|
||||||
|
#define LOG4CPLUS_HAVE_SYS_STAT_H 1
|
||||||
|
|
||||||
|
/* */
|
||||||
|
#define LOG4CPLUS_HAVE_SYS_SYSCALL_H 1
|
||||||
|
|
||||||
|
/* */
|
||||||
|
#define LOG4CPLUS_HAVE_SYS_FILE_H 1
|
||||||
|
|
||||||
|
/* */
|
||||||
|
#define LOG4CPLUS_HAVE_TIME_H 1
|
||||||
|
|
||||||
|
/* */
|
||||||
|
#define LOG4CPLUS_HAVE_SYS_SOCKET_H 1
|
||||||
|
|
||||||
|
/* */
|
||||||
|
#define LOG4CPLUS_HAVE_NETDB_H 1
|
||||||
|
|
||||||
|
/* */
|
||||||
|
#define LOG4CPLUS_HAVE_UNISTD_H 1
|
||||||
|
|
||||||
|
/* */
|
||||||
|
#define LOG4CPLUS_HAVE_FCNTL_H 1
|
||||||
|
|
||||||
|
/* */
|
||||||
|
#define LOG4CPLUS_HAVE_STDARG_H 1
|
||||||
|
|
||||||
|
/* */
|
||||||
|
#define LOG4CPLUS_HAVE_STDIO_H 1
|
||||||
|
|
||||||
|
/* */
|
||||||
|
#define LOG4CPLUS_HAVE_STDLIB_H 1
|
||||||
|
|
||||||
|
/* */
|
||||||
|
#define LOG4CPLUS_HAVE_ERRNO_H 1
|
||||||
|
|
||||||
|
/* */
|
||||||
|
#define LOG4CPLUS_HAVE_WCHAR_H 1
|
||||||
|
|
||||||
|
/* */
|
||||||
|
/* #undef LOG4CPLUS_HAVE_ICONV_H */
|
||||||
|
|
||||||
|
/* */
|
||||||
|
#define LOG4CPLUS_HAVE_LIMITS_H 1
|
||||||
|
|
||||||
|
/* */
|
||||||
|
#define LOG4CPLUS_HAVE_FTIME 1
|
||||||
|
|
||||||
|
/* */
|
||||||
|
#define LOG4CPLUS_HAVE_GETADDRINFO 1
|
||||||
|
|
||||||
|
/* */
|
||||||
|
#define LOG4CPLUS_HAVE_GETHOSTBYNAME_R 1
|
||||||
|
|
||||||
|
/* */
|
||||||
|
#define LOG4CPLUS_HAVE_GETPID 1
|
||||||
|
|
||||||
|
/* */
|
||||||
|
#define LOG4CPLUS_HAVE_GMTIME_R 1
|
||||||
|
|
||||||
|
/* */
|
||||||
|
#define LOG4CPLUS_HAVE_HTONL 1
|
||||||
|
|
||||||
|
/* */
|
||||||
|
#define LOG4CPLUS_HAVE_HTONS 1
|
||||||
|
|
||||||
|
/* */
|
||||||
|
#define LOG4CPLUS_HAVE_LOCALTIME_R 1
|
||||||
|
|
||||||
|
/* */
|
||||||
|
#define LOG4CPLUS_HAVE_LSTAT 1
|
||||||
|
|
||||||
|
/* */
|
||||||
|
#define LOG4CPLUS_HAVE_FCNTL 1
|
||||||
|
|
||||||
|
/* */
|
||||||
|
#define LOG4CPLUS_HAVE_LOCKF 1
|
||||||
|
|
||||||
|
/* */
|
||||||
|
#define LOG4CPLUS_HAVE_FLOCK 1
|
||||||
|
|
||||||
|
/* */
|
||||||
|
#define LOG4CPLUS_HAVE_NTOHL 1
|
||||||
|
|
||||||
|
/* */
|
||||||
|
#define LOG4CPLUS_HAVE_NTOHS 1
|
||||||
|
|
||||||
|
/* Define to 1 if you have the `shutdown' function. */
|
||||||
|
#define LOG4CPLUS_HAVE_SHUTDOWN 1
|
||||||
|
|
||||||
|
/* */
|
||||||
|
#define LOG4CPLUS_HAVE_PIPE 1
|
||||||
|
|
||||||
|
/* */
|
||||||
|
#define LOG4CPLUS_HAVE_PIPE2 1
|
||||||
|
|
||||||
|
/* */
|
||||||
|
#define LOG4CPLUS_HAVE_POLL 1
|
||||||
|
|
||||||
|
/* */
|
||||||
|
#define LOG4CPLUS_HAVE_POLL_H 1
|
||||||
|
|
||||||
|
/* */
|
||||||
|
#define LOG4CPLUS_HAVE_STAT 1
|
||||||
|
|
||||||
|
/* Define if this is a single-threaded library. */
|
||||||
|
/* #undef LOG4CPLUS_SINGLE_THREADED */
|
||||||
|
|
||||||
|
/* */
|
||||||
|
/* #undef LOG4CPLUS_USE_PTHREADS */
|
||||||
|
|
||||||
|
/* Define for compilers/standard libraries that support more than just the "C"
|
||||||
|
locale. */
|
||||||
|
/* #undef LOG4CPLUS_WORKING_LOCALE */
|
||||||
|
|
||||||
|
/* Define for C99 compilers/standard libraries that support more than just the
|
||||||
|
"C" locale. */
|
||||||
|
/* #undef LOG4CPLUS_WORKING_C_LOCALE */
|
||||||
|
|
||||||
|
/* Define to int if undefined. */
|
||||||
|
/* #undef socklen_t */
|
||||||
|
|
||||||
|
/* Defined for --enable-debugging builds. */
|
||||||
|
/* #undef LOG4CPLUS_DEBUGGING */
|
||||||
|
|
||||||
|
/* Defined if the compiler understands __declspec(dllexport) or
|
||||||
|
__attribute__((visibility("default"))) construct. */
|
||||||
|
#define LOG4CPLUS_DECLSPEC_EXPORT __attribute__ ((visibility("default")))
|
||||||
|
|
||||||
|
/* Defined if the compiler understands __declspec(dllimport) or
|
||||||
|
__attribute__((visibility("default"))) construct. */
|
||||||
|
#define LOG4CPLUS_DECLSPEC_IMPORT __attribute__ ((visibility("default")))
|
||||||
|
|
||||||
|
/* Defined if the compiler understands
|
||||||
|
__attribute__((visibility("hidden"))) construct. */
|
||||||
|
#define LOG4CPLUS_DECLSPEC_PRIVATE __attribute__ ((visibility("hidden")))
|
||||||
|
|
||||||
|
/* */
|
||||||
|
#define LOG4CPLUS_HAVE_TLS_SUPPORT 1
|
||||||
|
|
||||||
|
/* */
|
||||||
|
#define LOG4CPLUS_THREAD_LOCAL_VAR thread_local
|
||||||
|
|
||||||
|
/* Defined if the host OS provides ENAMETOOLONG errno value. */
|
||||||
|
#define LOG4CPLUS_HAVE_ENAMETOOLONG 1
|
||||||
|
|
||||||
|
/* */
|
||||||
|
#define LOG4CPLUS_HAVE_VSNPRINTF 1
|
||||||
|
|
||||||
|
/* Define to 1 if you have the `vsnwprintf' function. */
|
||||||
|
/* #undef LOG4CPLUS_HAVE_VSNWPRINTF */
|
||||||
|
|
||||||
|
/* Define to 1 if you have the `_vsnwprintf' function. */
|
||||||
|
/* #undef LOG4CPLUS_HAVE__VSNWPRINTF */
|
||||||
|
|
||||||
|
/* */
|
||||||
|
/* #undef LOG4CPLUS_HAVE__VSNPRINTF */
|
||||||
|
|
||||||
|
/* Define to 1 if you have the `vfprintf_s' function. */
|
||||||
|
/* #undef LOG4CPLUS_HAVE_VFPRINTF_S */
|
||||||
|
|
||||||
|
/* Define to 1 if you have the `vfwprintf_s' function. */
|
||||||
|
/* #undef LOG4CPLUS_HAVE_VFWPRINTF_S */
|
||||||
|
|
||||||
|
/* Define to 1 if you have the `vsprintf_s' function. */
|
||||||
|
/* #undef LOG4CPLUS_HAVE_VSPRINTF_S */
|
||||||
|
|
||||||
|
/* Define to 1 if you have the `vswprintf_s' function. */
|
||||||
|
/* #undef LOG4CPLUS_HAVE_VSWPRINTF_S */
|
||||||
|
|
||||||
|
/* Define to 1 if you have the `_vsnprintf_s' function. */
|
||||||
|
/* #undef LOG4CPLUS_HAVE__VSNPRINTF_S */
|
||||||
|
|
||||||
|
/* Define to 1 if you have the `_vsnwprintf_s' function. */
|
||||||
|
/* #undef LOG4CPLUS_HAVE__VSNWPRINTF_S */
|
||||||
|
|
||||||
|
/* Defined if the compiler supports __FUNCTION__ macro. */
|
||||||
|
#define LOG4CPLUS_HAVE_FUNCTION_MACRO 1
|
||||||
|
|
||||||
|
/* Defined if the compiler supports __PRETTY_FUNCTION__ macro. */
|
||||||
|
#define LOG4CPLUS_HAVE_PRETTY_FUNCTION_MACRO 1
|
||||||
|
|
||||||
|
/* Defined if the compiler supports __func__ symbol. */
|
||||||
|
#define LOG4CPLUS_HAVE_FUNC_SYMBOL 1
|
||||||
|
|
||||||
|
/* Define to 1 if you have the `mbstowcs' function. */
|
||||||
|
#define LOG4CPLUS_HAVE_MBSTOWCS 1
|
||||||
|
|
||||||
|
/* Define to 1 if you have the `wcstombs' function. */
|
||||||
|
#define LOG4CPLUS_HAVE_WCSTOMBS 1
|
||||||
|
|
||||||
|
/* Define to 1 if you have Linux style syscall(SYS_gettid). */
|
||||||
|
#define LOG4CPLUS_HAVE_GETTID 1
|
||||||
|
|
||||||
|
/* Define when iconv() is available. */
|
||||||
|
/* #undef LOG4CPLUS_WITH_ICONV */
|
||||||
|
|
||||||
|
/* Define to 1 if you have the `iconv' function. */
|
||||||
|
/* #undef LOG4CPLUS_HAVE_ICONV */
|
||||||
|
|
||||||
|
/* Define to 1 if you have the `iconv_close' function. */
|
||||||
|
/* #undef LOG4CPLUS_HAVE_ICONV_CLOSE */
|
||||||
|
|
||||||
|
/* Define to 1 if you have the `iconv_open' function. */
|
||||||
|
/* #undef LOG4CPLUS_HAVE_ICONV_OPEN */
|
||||||
|
|
||||||
|
/* Define to 1 if you have the `OutputDebugString' function. */
|
||||||
|
/* #undef LOG4CPLUS_HAVE_OUTPUTDEBUGSTRING */
|
||||||
|
|
||||||
|
/* Define to 1 if the system has the `constructor' function attribute
|
||||||
|
with priority */
|
||||||
|
#define LOG4CPLUS_HAVE_FUNC_ATTRIBUTE_CONSTRUCTOR_PRIORITY 1
|
||||||
|
|
||||||
|
/* Define to 1 if the system has the `constructor' function attribute */
|
||||||
|
#define LOG4CPLUS_HAVE_FUNC_ATTRIBUTE_CONSTRUCTOR 1
|
||||||
|
|
||||||
|
/* Define to 1 if the system has the `init_priority' variable attribute */
|
||||||
|
#define LOG4CPLUS_HAVE_VAR_ATTRIBUTE_INIT_PRIORITY 1
|
||||||
|
|
||||||
|
/* Defined to enable unit tests. */
|
||||||
|
/* #undef LOG4CPLUS_WITH_UNIT_TESTS */
|
||||||
|
|
||||||
|
#endif // LOG4CPLUS_CONFIG_DEFINES_HXX
|
||||||
@@ -107,43 +107,62 @@ extern LOG_TLS int g_log_code_tls; // 声明为 TLS 变量,定义见 log4.cpp
|
|||||||
|
|
||||||
|
|
||||||
// ====================== 日志宏区域 ======================
|
// ====================== 日志宏区域 ======================
|
||||||
// 原始不带 code 的实现(兼容/复用)
|
|
||||||
#define DIY_LOG(LEVEL_FUNC, KEY, ...) \
|
|
||||||
do { \
|
|
||||||
char buf[256]; \
|
|
||||||
format_log_msg(buf, sizeof(buf), __VA_ARGS__); \
|
|
||||||
LEVEL_FUNC(KEY, buf); \
|
|
||||||
} while (0)
|
|
||||||
|
|
||||||
// ★新增:带 code 的实现(C/C++ 通用,使用 TLS 保存/恢复)
|
#define DIY_LOG_CODE(LEVEL_FUNC, KEY, KEY_TYPE, CODE_INT, ...) \
|
||||||
#define DIY_LOG_CODE(LEVEL_FUNC, KEY, CODE_INT, ...) \
|
do { \
|
||||||
do { \
|
int __old_code__ = g_log_code_tls; \
|
||||||
int __old_code__ = g_log_code_tls; /* 备份旧值 */ \
|
g_log_code_tls = (int)(CODE_INT); \
|
||||||
g_log_code_tls = (int)(CODE_INT); /* 设置本次日志 code */ \
|
\
|
||||||
char buf[256]; \
|
char __msg_buf__[512]; \
|
||||||
format_log_msg(buf, sizeof(buf), __VA_ARGS__); \
|
format_log_msg(__msg_buf__, sizeof(__msg_buf__), __VA_ARGS__); \
|
||||||
LEVEL_FUNC(KEY, buf); /* 输出日志 */ \
|
\
|
||||||
g_log_code_tls = __old_code__; /* 恢复旧值 */ \
|
const char* __key_raw__ = (KEY); \
|
||||||
|
\
|
||||||
|
char __key_buf__[512]; \
|
||||||
|
switch ((int)(KEY_TYPE)) { \
|
||||||
|
case 0: \
|
||||||
|
snprintf(__key_buf__, sizeof(__key_buf__), "process"); \
|
||||||
|
break; \
|
||||||
|
case 1: \
|
||||||
|
snprintf(__key_buf__, sizeof(__key_buf__), \
|
||||||
|
"terminal.%s", __key_raw__); \
|
||||||
|
break; \
|
||||||
|
case 2: \
|
||||||
|
snprintf(__key_buf__, sizeof(__key_buf__), \
|
||||||
|
"monitor.%s", __key_raw__); \
|
||||||
|
break; \
|
||||||
|
default: \
|
||||||
|
snprintf(__key_buf__, sizeof(__key_buf__), "%s", \
|
||||||
|
__key_raw__); \
|
||||||
|
break; \
|
||||||
|
} \
|
||||||
|
\
|
||||||
|
LEVEL_FUNC(__key_buf__, __msg_buf__); \
|
||||||
|
g_log_code_tls = __old_code__; \
|
||||||
} while (0)
|
} while (0)
|
||||||
|
|
||||||
// ★修改:默认宏改为 code=0(兼容原有用法)
|
// ★修改:默认宏改为 code=0(兼容原有用法)
|
||||||
#define DIY_ERRORLOG(KEY, ...) DIY_LOG_CODE(log_error, KEY, 0, __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, __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, __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, __VA_ARGS__) // ★修改:默认 code=0
|
#define DIY_DEBUGLOG(KEY, ...) DIY_LOG_CODE(log_debug, KEY, 0, LOG_CODE_OTHER,__VA_ARGS__) // ★修改:默认 code=0
|
||||||
|
|
||||||
// ★新增:显式传入 code 的便捷宏
|
// ★新增:显式传入 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_ERRORLOG_CODE(KEY, CODE_INT, ...) DIY_LOG_CODE(log_error, KEY, 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_WARNLOG_CODE(KEY, CODE_INT, ...) DIY_LOG_CODE(log_warn, KEY, 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_INFOLOG_CODE(KEY, CODE_INT, ...) DIY_LOG_CODE(log_info, KEY, 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__) // ★新增
|
||||||
#define DIY_DEBUGLOG_CODE(KEY, CODE_INT, ...) DIY_LOG_CODE(log_debug, KEY, CODE_INT, __VA_ARGS__) // ★新增
|
|
||||||
|
|
||||||
|
|
||||||
// ====================== 日志宏区域 ======================
|
// ====================== 日志宏区域 ======================
|
||||||
|
|
||||||
|
|
||||||
typedef enum LogCode {
|
typedef enum LogCode {
|
||||||
|
LOG_CODE_MENU_CONTROL = 94, /* 目录控制类型 */
|
||||||
|
LOG_CODE_FILE_CONTROL = 95, /* 文件控制类型 */
|
||||||
|
LOG_CODE_WIRETYPE = 96, /* 接线类型 */
|
||||||
|
LOG_CODE_CONFIG = 97, /* 配置相关 */
|
||||||
|
LOG_CODE_JSON = 98, /* JSON结构 */
|
||||||
LOG_CODE_OTHER = 99, /* 其他类型 */
|
LOG_CODE_OTHER = 99, /* 其他类型 */
|
||||||
LOG_CODE_LEDGER = 100, /* 台账类型 */
|
LOG_CODE_LEDGER = 100, /* 台账类型 */
|
||||||
LOG_CODE_RPTINIT = 101, /* 报告初始化 */
|
LOG_CODE_RPTINIT = 101, /* 报告初始化 */
|
||||||
@@ -151,6 +170,7 @@ typedef enum LogCode {
|
|||||||
LOG_CODE_TRANSIENT = 300, /* 暂态发生 */
|
LOG_CODE_TRANSIENT = 300, /* 暂态发生 */
|
||||||
LOG_CODE_TRANSIENT_COMM = 301, /* 暂态接口 */
|
LOG_CODE_TRANSIENT_COMM = 301, /* 暂态接口 */
|
||||||
LOG_CODE_COMTRADE_FILE = 302, /* 录波文件(Comtrade) */
|
LOG_CODE_COMTRADE_FILE = 302, /* 录波文件(Comtrade) */
|
||||||
|
LOG_CODE_GGIO_LPHD = 304, /* GGIO事件 */
|
||||||
LOG_CODE_MQ = 400, /* MQ发送 */
|
LOG_CODE_MQ = 400, /* MQ发送 */
|
||||||
LOG_CODE_RT_DATA = 401, /* 实时数据 */
|
LOG_CODE_RT_DATA = 401, /* 实时数据 */
|
||||||
LOG_CODE_LEDGER_UPDATE = 402, /* 台账更新 */
|
LOG_CODE_LEDGER_UPDATE = 402, /* 台账更新 */
|
||||||
|
|||||||
@@ -45,10 +45,10 @@
|
|||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
extern "C" {
|
extern "C" {
|
||||||
#endif /* __cplusplus */
|
#endif /* __cplusplus */
|
||||||
extern char* OSS_ENDPOINT;
|
//extern char* OSS_ENDPOINT;
|
||||||
extern char* ACCESS_KEY_ID;
|
//extern char* ACCESS_KEY_ID;
|
||||||
extern char* ACCESS_KEY_SECRET;
|
//extern char* ACCESS_KEY_SECRET;
|
||||||
extern char* BUCKET_NAME;
|
//extern char* BUCKET_NAME;
|
||||||
|
|
||||||
extern char* POSTGRES_SCHEMA;
|
extern char* POSTGRES_SCHEMA;
|
||||||
extern char* POSTGRES_TABLEPREFIX;
|
extern char* POSTGRES_TABLEPREFIX;
|
||||||
@@ -105,16 +105,16 @@ void TestToken();
|
|||||||
void TestBodyPost();//WW 测试qt post
|
void TestBodyPost();//WW 测试qt post
|
||||||
void TestSMSPost();//WW 测试qt post
|
void TestSMSPost();//WW 测试qt post
|
||||||
void TestJson(char* szJson);
|
void TestJson(char* szJson);
|
||||||
void TestOSS();//WW 测试
|
//void TestOSS();//WW 测试
|
||||||
void PutOSS(char* File_Name, char* data); //zw修改 2023-9-7 上送oss文件
|
//void PutOSS(char* File_Name, char* data); //zw修改 2023-9-7 上送oss文件
|
||||||
void GetOSS(char* File_Name, char* savepath); //zw修改 2023-9-7 获取oss文件
|
//void GetOSS(char* File_Name, char* savepath); //zw修改 2023-9-7 获取oss文件
|
||||||
void DelOSS(char* File_Name);
|
//void DelOSS(char* File_Name);
|
||||||
void delete_object_new(char* File_Name);
|
void delete_object_new(char* File_Name);
|
||||||
void coutTest();//CZY 2023-09-11 test
|
void coutTest();//CZY 2023-09-11 test
|
||||||
void TestOBS();//WW 20230921 测试华为云服务器
|
//void TestOBS();//WW 20230921 测试华为云服务器
|
||||||
void OBSFile(char* localpath, char* cloudpath,const char* code);
|
//void OBSFile(char* localpath, char* cloudpath,const char* code);
|
||||||
void OBSFile_del(char* cloudpath, const char* code);
|
//void OBSFile_del(char* cloudpath, const char* code);
|
||||||
void DataHub_Send_Datahub(char* topic, char* data);//datahub通讯
|
//void DataHub_Send_Datahub(char* topic, char* data);//datahub通讯
|
||||||
void Nacos_GetParam(char* postgres_uid, char* postgres_pwd, char* web_clientid, char* web_clientsecret);//nacos
|
void Nacos_GetParam(char* postgres_uid, char* postgres_pwd, char* web_clientid, char* web_clientsecret);//nacos
|
||||||
void Nacos_GetParam_Ptr(const char* code, char** ptr);
|
void Nacos_GetParam_Ptr(const char* code, char** ptr);
|
||||||
void Read_Nacos_Param_Postgres(char** database_ip, char** database_port, char** postgres_database, char** postgres_username, char** postgres_password, char** postgres_schema, char** postgres_dnsname, char** postgres_tableprefix);
|
void Read_Nacos_Param_Postgres(char** database_ip, char** database_port, char** postgres_database, char** postgres_username, char** postgres_password, char** postgres_schema, char** postgres_dnsname, char** postgres_tableprefix);
|
||||||
@@ -165,6 +165,7 @@ typedef struct {
|
|||||||
char TypeOfData[64];
|
char TypeOfData[64];
|
||||||
char ValueOfTimeUnit[64];
|
char ValueOfTimeUnit[64];
|
||||||
char WaveTimeFlag[64];
|
char WaveTimeFlag[64];
|
||||||
|
char IEDControl[64];
|
||||||
char IEDname[64];
|
char IEDname[64];
|
||||||
char LDevicePrefix[64];
|
char LDevicePrefix[64];
|
||||||
} XmlConfigC;
|
} XmlConfigC;
|
||||||
@@ -183,6 +184,8 @@ typedef struct file_dir_req_t
|
|||||||
char devid[128];
|
char devid[128];
|
||||||
int type;
|
int type;
|
||||||
char path[256];
|
char path[256];
|
||||||
|
char remote_path[256];
|
||||||
|
|
||||||
time_t create_time;
|
time_t create_time;
|
||||||
} file_dir_req_t;
|
} file_dir_req_t;
|
||||||
|
|
||||||
|
|||||||
@@ -232,7 +232,7 @@ int main(int argc, const char **argv)
|
|||||||
//char buf[256];
|
//char buf[256];
|
||||||
//format_log_msg(buf,sizeof(buf),"前置的%s%d号进程 进程级日志初始化完毕", get_front_msg_from_subdir(), g_front_seg_index);
|
//format_log_msg(buf,sizeof(buf),"前置的%s%d号进程 进程级日志初始化完毕", get_front_msg_from_subdir(), g_front_seg_index);
|
||||||
//log_debug("process", buf);
|
//log_debug("process", buf);
|
||||||
DIY_INFOLOG("process","【NORMAL】前置的%s%d号进程 进程级日志初始化完毕", get_front_msg_from_subdir(), g_front_seg_index);
|
DIY_INFOLOG_CODE("process",0,LOG_CODE_OTHER,"【NORMAL】前置的%s%d号进程 进程级日志初始化完毕", get_front_msg_from_subdir(), g_front_seg_index);
|
||||||
|
|
||||||
#ifdef _OS_UNIX_
|
#ifdef _OS_UNIX_
|
||||||
#ifdef QT_NO_DEBUG
|
#ifdef QT_NO_DEBUG
|
||||||
@@ -268,7 +268,7 @@ int main(int argc, const char **argv)
|
|||||||
//char buf[256];
|
//char buf[256];
|
||||||
//format_log_msg(buf,sizeof(buf),"前置的%s%d号进程 台账初始化失败", get_front_msg_from_subdir(), g_front_seg_index);
|
//format_log_msg(buf,sizeof(buf),"前置的%s%d号进程 台账初始化失败", get_front_msg_from_subdir(), g_front_seg_index);
|
||||||
//log_error("process", buf);
|
//log_error("process", buf);
|
||||||
DIY_ERRORLOG_CODE("process",LOG_CODE_LEDGER,"【ERROR】前置的%s%d号进程 台账初始化失败", get_front_msg_from_subdir(), g_front_seg_index);
|
DIY_ERRORLOG_CODE("process",0,LOG_CODE_LEDGER,"【ERROR】前置的%s%d号进程 台账初始化失败", get_front_msg_from_subdir(), g_front_seg_index);
|
||||||
return rv;
|
return rv;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -277,7 +277,7 @@ int main(int argc, const char **argv)
|
|||||||
//char buf[256];
|
//char buf[256];
|
||||||
//format_log_msg(buf,sizeof(buf),"前置的%s%d号进程 线程初始化失败", get_front_msg_from_subdir(), g_front_seg_index);
|
//format_log_msg(buf,sizeof(buf),"前置的%s%d号进程 线程初始化失败", get_front_msg_from_subdir(), g_front_seg_index);
|
||||||
//log_error("process", buf);
|
//log_error("process", buf);
|
||||||
DIY_ERRORLOG_CODE("process",LOG_CODE_OTHER,"【ERROR】前置的%s%d号进程 线程初始化失败", get_front_msg_from_subdir(), g_front_seg_index);
|
DIY_ERRORLOG_CODE("process",0,LOG_CODE_OTHER,"【ERROR】前置的%s%d号进程 线程初始化失败", get_front_msg_from_subdir(), g_front_seg_index);
|
||||||
return rv;
|
return rv;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -324,7 +324,7 @@ int main(int argc, const char **argv)
|
|||||||
//char buf[256];
|
//char buf[256];
|
||||||
//format_log_msg(buf,sizeof(buf),"前置的业务线程死锁,退出进程");
|
//format_log_msg(buf,sizeof(buf),"前置的业务线程死锁,退出进程");
|
||||||
//log_error("process", buf);
|
//log_error("process", buf);
|
||||||
DIY_ERRORLOG_CODE("process",LOG_CODE_OTHER,"【ERROR】前置的%s%d号进程 业务线程死锁,退出进程", get_front_msg_from_subdir(), g_front_seg_index);
|
DIY_ERRORLOG_CODE("process",0,LOG_CODE_OTHER,"【ERROR】前置的%s%d号进程 业务线程死锁,退出进程", get_front_msg_from_subdir(), g_front_seg_index);
|
||||||
|
|
||||||
apr_sleep(apr_time_from_sec(10));
|
apr_sleep(apr_time_from_sec(10));
|
||||||
exit(-1039);
|
exit(-1039);
|
||||||
|
|||||||
@@ -32,7 +32,7 @@ extern apr_pool_t* g_cfg_pool;
|
|||||||
extern apr_pool_t* g_init_pool;
|
extern apr_pool_t* g_init_pool;
|
||||||
|
|
||||||
extern int g_DevFlag; //日志配置中读取的参数,暂无特定使用lnk20250121
|
extern int g_DevFlag; //日志配置中读取的参数,暂无特定使用lnk20250121
|
||||||
|
extern bool DEBUGOPEN;//调试开关,控制是否输出调试日志,默认关闭
|
||||||
extern int IED_COUNT;
|
extern int IED_COUNT;
|
||||||
extern int RECALL_ONLY_FLAG; //lnk20260309添加一个全局变量,标志是否只运行补招程序
|
extern int RECALL_ONLY_FLAG; //lnk20260309添加一个全局变量,标志是否只运行补招程序
|
||||||
|
|
||||||
@@ -151,13 +151,6 @@ void CloseIECReports(chnl_usr_t *chnl_usr)
|
|||||||
void closeChannel(chnl_usr_t *chnl_usr)
|
void closeChannel(chnl_usr_t *chnl_usr)
|
||||||
{
|
{
|
||||||
|
|
||||||
//终端日志的key,lnk20250526
|
|
||||||
char full_key_t_c[256]; // 分配足够空间
|
|
||||||
char full_key_t_d[256]; // 分配足够空间
|
|
||||||
snprintf(full_key_t_c, sizeof(full_key_t_c), "terminal.%s.COM", ((ied_usr_t*)(chnl_usr->chnl->ied->usr_ext))->terminal_id);
|
|
||||||
snprintf(full_key_t_d, sizeof(full_key_t_d), "terminal.%s.DATA", ((ied_usr_t*)(chnl_usr->chnl->ied->usr_ext))->terminal_id);
|
|
||||||
//终端日志的key,lnk20250526
|
|
||||||
|
|
||||||
char comm_str[256];
|
char comm_str[256];
|
||||||
memset(comm_str,0,256);
|
memset(comm_str,0,256);
|
||||||
apr_snprintf(comm_str,sizeof(comm_str),"%16s:%d\t\tdisconnected !!!",chnl_usr->ip_str,chnl_usr->chnl->port);
|
apr_snprintf(comm_str,sizeof(comm_str),"%16s:%d\t\tdisconnected !!!",chnl_usr->ip_str,chnl_usr->chnl->port);
|
||||||
@@ -185,7 +178,7 @@ void closeChannel(chnl_usr_t *chnl_usr)
|
|||||||
ret = mms_disconnectFromServer(chnl_usr->net_info,&chnl_usr->m_reqCtrl);
|
ret = mms_disconnectFromServer(chnl_usr->net_info,&chnl_usr->m_reqCtrl);
|
||||||
echo_warn("---------end disconnectFromServer!\n");
|
echo_warn("---------end disconnectFromServer!\n");
|
||||||
|
|
||||||
DIY_WARNLOG_CODE(full_key_t_c,LOG_CODE_COMM,"【WARN】前置与终端%s - ip端口%s:%d 断开连接", ((ied_usr_t*)(chnl_usr->chnl->ied->usr_ext))->terminal_id,chnl_usr->ip_str,chnl_usr->chnl->port);
|
DIY_WARNLOG_CODE(((ied_usr_t*)(chnl_usr->chnl->ied->usr_ext))->terminal_id,1,LOG_CODE_COMM,"【WARN】前置与终端%s - ip端口%s:%d 断开连接", ((ied_usr_t*)(chnl_usr->chnl->ied->usr_ext))->terminal_id,chnl_usr->ip_str,chnl_usr->chnl->port);
|
||||||
|
|
||||||
if (ret != SD_SUCCESS){
|
if (ret != SD_SUCCESS){
|
||||||
echo_warn("---------disconnectFromServer success!\n");
|
echo_warn("---------disconnectFromServer success!\n");
|
||||||
@@ -309,26 +302,19 @@ void ChannelCheckIECReports(chnl_usr_t *chnl_usr)
|
|||||||
{
|
{
|
||||||
LD_info = &(ied_usr->LD_info[cpuno]); //遍历监测点
|
LD_info = &(ied_usr->LD_info[cpuno]); //遍历监测点
|
||||||
|
|
||||||
//监测点日志的key,lnk20250526
|
|
||||||
char full_key_m_c[256]; // 分配足够空间
|
|
||||||
char full_key_m_d[256]; // 分配足够空间
|
|
||||||
snprintf(full_key_m_c, sizeof(full_key_m_c), "monitor.%s.COM", LD_info->mp_id);
|
|
||||||
snprintf(full_key_m_d, sizeof(full_key_m_d), "monitor.%s.DATA", LD_info->mp_id);
|
|
||||||
//监测点日志的key,lnk20250526
|
|
||||||
|
|
||||||
if (LD_info->cpuno==0){
|
if (LD_info->cpuno==0){
|
||||||
// 仅在还没达到5次上限时打印
|
// 仅在还没达到5次上限时打印
|
||||||
if (!LD_info->has_logged_regist) {
|
if (!LD_info->has_logged_regist) {
|
||||||
LD_info->registcount++;
|
LD_info->registcount++;
|
||||||
|
|
||||||
if (LD_info->registcount <= 5) {
|
if (LD_info->registcount <= 5) {
|
||||||
DIY_ERRORLOG_CODE(full_key_m_c,LOG_CODE_REPORT,"【ERROR】监测点:%s - id:%s报告触发失败,监测点逻辑标识号为0,请检查装置对应的台账信息是否正确", LD_info->name,LD_info->mp_id);
|
DIY_ERRORLOG_CODE(LD_info->mp_id,2,LOG_CODE_REPORT,"【ERROR】监测点:%s - id:%s报告触发失败,监测点逻辑标识号为0,请检查装置对应的台账信息是否正确", LD_info->name,LD_info->mp_id);
|
||||||
}
|
}
|
||||||
|
|
||||||
// 到5次就不再打印,并标记
|
// 到5次就不再打印,并标记
|
||||||
if (LD_info->registcount > 5) {
|
if (LD_info->registcount > 5) {
|
||||||
LD_info->has_logged_regist = true;
|
LD_info->has_logged_regist = true;
|
||||||
DIY_WARNLOG_CODE(full_key_m_c,LOG_CODE_REPORT,"【WARN】监测点:%s - id:%s监测点逻辑标识号错误日志已达本次记录上限,不再输出,请检查装置对应的台账信息是否正确",
|
DIY_WARNLOG_CODE(LD_info->mp_id,2,LOG_CODE_REPORT,"【WARN】监测点:%s - id:%s监测点逻辑标识号错误日志已达本次记录上限,不再输出,请检查装置对应的台账信息是否正确",
|
||||||
LD_info->name, LD_info->mp_id);
|
LD_info->name, LD_info->mp_id);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -342,7 +328,7 @@ void ChannelCheckIECReports(chnl_usr_t *chnl_usr)
|
|||||||
|
|
||||||
if (judge_rpt_next_should_do(rptinfo)==SHOULD_DO_NOTHING)//检查是否触发
|
if (judge_rpt_next_should_do(rptinfo)==SHOULD_DO_NOTHING)//检查是否触发
|
||||||
{
|
{
|
||||||
//DIY_DEBUGLOG(full_key_m_c,"【DEBUG】监测点:%s - id:%s不注册报告", LD_info->name,LD_info->mp_id);
|
//DIY_DEBUGLOG_CODE(LD_info->mp_id,2,LOG_CODE_REPORT,"【DEBUG】监测点:%s - id:%s不注册报告", LD_info->name,LD_info->mp_id);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -358,7 +344,7 @@ void ChannelCheckIECReports(chnl_usr_t *chnl_usr)
|
|||||||
printf("start mms_register_iec_rpt................................\n");
|
printf("start mms_register_iec_rpt................................\n");
|
||||||
|
|
||||||
//mq日志
|
//mq日志
|
||||||
DIY_INFOLOG(full_key_m_c,"【NORMAL】监测点:%s - id:%s开始注册报告,报告名:%s", LD_info->name,LD_info->mp_id,rpt_inst_name);
|
DIY_INFOLOG_CODE(LD_info->mp_id,2,LOG_CODE_REPORT,"【NORMAL】监测点:%s - id:%s开始注册报告,报告名:%s", LD_info->name,LD_info->mp_id,rpt_inst_name);
|
||||||
|
|
||||||
if ( strstr(rptinfo->rptID,"LLN0$BR$brcbFlickerData") )
|
if ( strstr(rptinfo->rptID,"LLN0$BR$brcbFlickerData") )
|
||||||
rptinfo->IntgPd = 600; //10分钟
|
rptinfo->IntgPd = 600; //10分钟
|
||||||
@@ -386,14 +372,14 @@ void ChannelCheckIECReports(chnl_usr_t *chnl_usr)
|
|||||||
LD_info->registcount++;
|
LD_info->registcount++;
|
||||||
|
|
||||||
if (LD_info->registcount <= 5) {
|
if (LD_info->registcount <= 5) {
|
||||||
DIY_WARNLOG_CODE(full_key_m_c,LOG_CODE_REPORT, "【WARN】监测点:%s - id:%s注册报告失败,报告名:%s",
|
DIY_WARNLOG_CODE(LD_info->mp_id,2,LOG_CODE_REPORT, "【WARN】监测点:%s - id:%s注册报告失败,报告名:%s",
|
||||||
LD_info->name, LD_info->mp_id, rpt_inst_name);
|
LD_info->name, LD_info->mp_id, rpt_inst_name);
|
||||||
}
|
}
|
||||||
|
|
||||||
// 到5次就不再打印,并标记
|
// 到5次就不再打印,并标记
|
||||||
if (LD_info->registcount > 5) {
|
if (LD_info->registcount > 5) {
|
||||||
LD_info->has_logged_regist = true;
|
LD_info->has_logged_regist = true;
|
||||||
DIY_WARNLOG_CODE(full_key_m_c,LOG_CODE_REPORT,"【WARN】监测点:%s - id:%s注册报告失败日志已达本次注册上限,不再输出,请检查装置icd和映射文件是否匹配或者装置存在过多连接",
|
DIY_WARNLOG_CODE(LD_info->mp_id,2,LOG_CODE_REPORT,"【WARN】监测点:%s - id:%s注册报告失败日志已达本次注册上限,不再输出,请检查装置icd和映射文件是否匹配或者装置存在过多连接",
|
||||||
LD_info->name, LD_info->mp_id);
|
LD_info->name, LD_info->mp_id);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -416,7 +402,7 @@ void ChannelCheckIECReports(chnl_usr_t *chnl_usr)
|
|||||||
//mq日志
|
//mq日志
|
||||||
LD_info->has_logged_regist = FALSE;
|
LD_info->has_logged_regist = FALSE;
|
||||||
LD_info->registcount = 0;
|
LD_info->registcount = 0;
|
||||||
DIY_WARNLOG_CODE(full_key_m_c,LOG_CODE_REPORT,"【WARN】监测点:%s - id:%s注册报告成功,报告名:%s", LD_info->name,LD_info->mp_id,rpt_inst_name);
|
DIY_WARNLOG_CODE(LD_info->mp_id,2,LOG_CODE_REPORT,"【WARN】监测点:%s - id:%s注册报告成功,报告名:%s", LD_info->name,LD_info->mp_id,rpt_inst_name);
|
||||||
|
|
||||||
// add here to GI not the same time
|
// add here to GI not the same time
|
||||||
GIoffset = 0.5 * g_pt61850app->giTime;
|
GIoffset = 0.5 * g_pt61850app->giTime;
|
||||||
@@ -424,7 +410,7 @@ void ChannelCheckIECReports(chnl_usr_t *chnl_usr)
|
|||||||
}
|
}
|
||||||
printf("end mms_register_iec_rpt................................\n");
|
printf("end mms_register_iec_rpt................................\n");
|
||||||
//mq日志
|
//mq日志
|
||||||
DIY_INFOLOG(full_key_m_c,"【NORMAL】监测点:%s - id:%s注册报告结束,报告名:%s", LD_info->name,LD_info->mp_id,rpt_inst_name);
|
DIY_INFOLOG_CODE(LD_info->mp_id,2,LOG_CODE_REPORT,"【NORMAL】监测点:%s - id:%s注册报告结束,报告名:%s", LD_info->name,LD_info->mp_id,rpt_inst_name);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else { //rpt_registered ==TRUE
|
else { //rpt_registered ==TRUE
|
||||||
@@ -433,7 +419,7 @@ void ChannelCheckIECReports(chnl_usr_t *chnl_usr)
|
|||||||
printf("start mms_unregister_iec_rpt................................\n");
|
printf("start mms_unregister_iec_rpt................................\n");
|
||||||
|
|
||||||
//mq日志
|
//mq日志
|
||||||
DIY_INFOLOG(full_key_m_c,"【NORMAL】监测点:%s - id:%s开始注销报告,报告名:%s", LD_info->name,LD_info->mp_id,rpt_inst_name);
|
DIY_INFOLOG_CODE(LD_info->mp_id,2,LOG_CODE_REPORT,"【NORMAL】监测点:%s - id:%s开始注销报告,报告名:%s", LD_info->name,LD_info->mp_id,rpt_inst_name);
|
||||||
|
|
||||||
ret = mms_unregister_iec_rpt (chnl_usr->net_info, &g_rpt_typeids,
|
ret = mms_unregister_iec_rpt (chnl_usr->net_info, &g_rpt_typeids,
|
||||||
LD_info->LD_name,rpt_inst_name,g_pt61850app->mmsOpTimeout);
|
LD_info->LD_name,rpt_inst_name,g_pt61850app->mmsOpTimeout);
|
||||||
@@ -444,7 +430,7 @@ void ChannelCheckIECReports(chnl_usr_t *chnl_usr)
|
|||||||
APR_EGENERAL, LD_info->ied->id,LD_info->cpuno,LD_info->LD_name,rpt_inst_name,chnl_usr->ip_str,chnl_usr->chnl_id);
|
APR_EGENERAL, LD_info->ied->id,LD_info->cpuno,LD_info->LD_name,rpt_inst_name,chnl_usr->ip_str,chnl_usr->chnl_id);
|
||||||
|
|
||||||
//mq日志
|
//mq日志
|
||||||
DIY_WARNLOG_CODE(full_key_m_c,LOG_CODE_REPORT,"【WARN】监测点:%s - id:%s注销报告失败,报告名:%s", LD_info->name,LD_info->mp_id,rpt_inst_name);
|
DIY_WARNLOG_CODE(LD_info->mp_id,2,LOG_CODE_REPORT,"【WARN】监测点:%s - id:%s注销报告失败,报告名:%s", LD_info->name,LD_info->mp_id,rpt_inst_name);
|
||||||
|
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
@@ -453,11 +439,11 @@ void ChannelCheckIECReports(chnl_usr_t *chnl_usr)
|
|||||||
LD_info->ied->id,LD_info->cpuno,LD_info->LD_name,rpt_inst_name,chnl_usr->ip_str,chnl_usr->chnl->port,chnl_usr->chnl_id );
|
LD_info->ied->id,LD_info->cpuno,LD_info->LD_name,rpt_inst_name,chnl_usr->ip_str,chnl_usr->chnl->port,chnl_usr->chnl_id );
|
||||||
|
|
||||||
//mq日志
|
//mq日志
|
||||||
DIY_INFOLOG(full_key_m_c,"【NORMAL】监测点:%s - id:%s注销报告成功,报告名:%s", LD_info->name,LD_info->mp_id,rpt_inst_name);
|
DIY_INFOLOG_CODE(LD_info->mp_id,2,LOG_CODE_REPORT,"【NORMAL】监测点:%s - id:%s注销报告成功,报告名:%s", LD_info->name,LD_info->mp_id,rpt_inst_name);
|
||||||
}
|
}
|
||||||
printf("end mms_unregister_iec_rpt................................\n");
|
printf("end mms_unregister_iec_rpt................................\n");
|
||||||
//mq日志
|
//mq日志
|
||||||
DIY_INFOLOG(full_key_m_c,"【NORMAL】监测点:%s - id:%s注销报告结束,报告名:%s", LD_info->name,LD_info->mp_id,rpt_inst_name);
|
DIY_INFOLOG_CODE(LD_info->mp_id,2,LOG_CODE_REPORT,"【NORMAL】监测点:%s - id:%s注销报告结束,报告名:%s", LD_info->name,LD_info->mp_id,rpt_inst_name);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -510,13 +496,6 @@ void ChannelCheckIECLogs(chnl_usr_t *chnl_usr)
|
|||||||
for(cpuno=0 ; cpuno<ied->cpucount; cpuno++) {
|
for(cpuno=0 ; cpuno<ied->cpucount; cpuno++) {
|
||||||
LD_info = &(ied_usr->LD_info[cpuno]);
|
LD_info = &(ied_usr->LD_info[cpuno]);
|
||||||
|
|
||||||
//监测点日志的key,lnk20250526
|
|
||||||
char full_key_m_c[256]; // 分配足够空间
|
|
||||||
char full_key_m_d[256]; // 分配足够空间
|
|
||||||
snprintf(full_key_m_c, sizeof(full_key_m_c), "monitor.%s.COM", LD_info->mp_id);
|
|
||||||
snprintf(full_key_m_d, sizeof(full_key_m_d), "monitor.%s.DATA", LD_info->mp_id);
|
|
||||||
//监测点日志的key,lnk20250526
|
|
||||||
|
|
||||||
//日志控制块缺失
|
//日志控制块缺失
|
||||||
if (LD_info->logcount<=0){
|
if (LD_info->logcount<=0){
|
||||||
// 仅在还没达到5次上限时打印
|
// 仅在还没达到5次上限时打印
|
||||||
@@ -524,13 +503,13 @@ void ChannelCheckIECLogs(chnl_usr_t *chnl_usr)
|
|||||||
LD_info->registcount++;
|
LD_info->registcount++;
|
||||||
|
|
||||||
if (LD_info->registcount <= 5) {
|
if (LD_info->registcount <= 5) {
|
||||||
DIY_ERRORLOG_CODE(full_key_m_c,LOG_CODE_RECALL,"【ERROR】监测点:%s - id:%s补招数据失败,监测点缺少日志控制块,请检查装置对应的装置类型是否有配对的icd模型", LD_info->name,LD_info->mp_id);
|
DIY_ERRORLOG_CODE(LD_info->mp_id,2,LOG_CODE_RECALL,"【ERROR】监测点:%s - id:%s补招数据失败,监测点缺少日志控制块,请检查装置对应的装置类型是否有配对的icd模型", LD_info->name,LD_info->mp_id);
|
||||||
}
|
}
|
||||||
|
|
||||||
// 到5次就不再打印,并标记
|
// 到5次就不再打印,并标记
|
||||||
if (LD_info->registcount > 5) {
|
if (LD_info->registcount > 5) {
|
||||||
LD_info->has_logged_regist = true;
|
LD_info->has_logged_regist = true;
|
||||||
DIY_WARNLOG_CODE(full_key_m_c,LOG_CODE_RECALL,"【WARN】监测点:%s - id:%s缺少日志控制块日志已达本次记录上限,不再输出,请检查装置对应的装置类型是否有配对的icd模型",
|
DIY_WARNLOG_CODE(LD_info->mp_id,2,LOG_CODE_RECALL,"【WARN】监测点:%s - id:%s缺少日志控制块日志已达本次记录上限,不再输出,请检查装置对应的装置类型是否有配对的icd模型",
|
||||||
LD_info->name, LD_info->mp_id);
|
LD_info->name, LD_info->mp_id);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -561,11 +540,11 @@ void ChannelCheckIECLogs(chnl_usr_t *chnl_usr)
|
|||||||
|
|
||||||
if(strcmp(cfg1.ValueOfTimeUnit, "utc") == 0){//装置时间是utc还是北京
|
if(strcmp(cfg1.ValueOfTimeUnit, "utc") == 0){//装置时间是utc还是北京
|
||||||
utc_or_beijing = 28800;//秒
|
utc_or_beijing = 28800;//秒
|
||||||
DIY_WARNLOG_CODE(full_key_m_c,LOG_CODE_RECALL,"【WARN】监测点:%s - id:%s开始补招数据,下发补招时间为utc时间,监测点对应装置型号:%s", LD_info->name,LD_info->mp_id,ied_usr->dev_type);
|
DIY_WARNLOG_CODE(LD_info->mp_id,2,LOG_CODE_RECALL,"【WARN】监测点:%s - id:%s开始补招数据,下发补招时间为utc时间,监测点对应装置型号:%s", LD_info->name,LD_info->mp_id,ied_usr->dev_type);
|
||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
utc_or_beijing = 0;
|
utc_or_beijing = 0;
|
||||||
DIY_WARNLOG_CODE(full_key_m_c,LOG_CODE_RECALL,"【WARN】监测点:%s - id:%s开始补招数据,下发补招时间为beijing时间,监测点对应装置型号:%s", LD_info->name,LD_info->mp_id,ied_usr->dev_type);
|
DIY_WARNLOG_CODE(LD_info->mp_id,2,LOG_CODE_RECALL,"【WARN】监测点:%s - id:%s开始补招数据,下发补招时间为beijing时间,监测点对应装置型号:%s", LD_info->name,LD_info->mp_id,ied_usr->dev_type);
|
||||||
}
|
}
|
||||||
|
|
||||||
//////////////////////////////////////////////////////////////
|
//////////////////////////////////////////////////////////////
|
||||||
@@ -609,7 +588,7 @@ void ChannelCheckIECLogs(chnl_usr_t *chnl_usr)
|
|||||||
LD_info->ied->id, LD_info->cpuno, LD_info->LD_name, loginfo->logName, chnl_usr->ip_str, chnl_usr->chnl_id);
|
LD_info->ied->id, LD_info->cpuno, LD_info->LD_name, loginfo->logName, chnl_usr->ip_str, chnl_usr->chnl_id);
|
||||||
|
|
||||||
//mq日志
|
//mq日志
|
||||||
//DIY_WARNLOG(full_key_m_c,"【WARN】监测点:%s - id:%s开始补招数据", LD_info->name,LD_info->mp_id);
|
//DIY_WARNLOG_CODE(LD_info->mp_id,2,LOG_CODE_RECALL,"【WARN】监测点:%s - id:%s开始补招数据", LD_info->name,LD_info->mp_id);
|
||||||
|
|
||||||
ret = mms_jread(loginfo, chnl_usr->net_info, loginfo->LD_info->LD_name, loginfo->logName,
|
ret = mms_jread(loginfo, chnl_usr->net_info, loginfo->LD_info->LD_name, loginfo->logName,
|
||||||
loginfo->start_time, loginfo->end_time, g_pt61850app->mmsOpTimeout, chnl_usr->ip_str);
|
loginfo->start_time, loginfo->end_time, g_pt61850app->mmsOpTimeout, chnl_usr->ip_str);
|
||||||
@@ -618,7 +597,7 @@ void ChannelCheckIECLogs(chnl_usr_t *chnl_usr)
|
|||||||
LD_info->ied->id, LD_info->cpuno, LD_info->LD_name, loginfo->logName, chnl_usr->ip_str, chnl_usr->chnl_id);
|
LD_info->ied->id, LD_info->cpuno, LD_info->LD_name, loginfo->logName, chnl_usr->ip_str, chnl_usr->chnl_id);
|
||||||
|
|
||||||
//mq日志
|
//mq日志
|
||||||
DIY_ERRORLOG_CODE(full_key_m_c,LOG_CODE_RECALL,"【ERROR】监测点:%s - id:%s补招数据失败 - 失败时间点:%lld 至 %lld", LD_info->name,LD_info->mp_id,loginfo->start_time,loginfo->end_time);
|
DIY_ERRORLOG_CODE(LD_info->mp_id,2,LOG_CODE_RECALL,"【ERROR】监测点:%s - id:%s补招数据失败 - 失败时间点:%lld 至 %lld", LD_info->name,LD_info->mp_id,loginfo->start_time,loginfo->end_time);
|
||||||
|
|
||||||
failed_count++;
|
failed_count++;
|
||||||
}
|
}
|
||||||
@@ -671,7 +650,7 @@ void ChannelCheckIECLogs(chnl_usr_t *chnl_usr)
|
|||||||
|
|
||||||
// ===== [新增结束] =====
|
// ===== [新增结束] =====
|
||||||
|
|
||||||
DIY_WARNLOG_CODE(full_key_m_c,LOG_CODE_RECALL,"【WARN】监测点:%s - id:%s结束补招数据", LD_info->name,LD_info->mp_id);
|
DIY_WARNLOG_CODE(LD_info->mp_id,2,LOG_CODE_RECALL,"【WARN】监测点:%s - id:%s结束补招数据", LD_info->name,LD_info->mp_id);
|
||||||
//}
|
//}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1119,9 +1098,9 @@ void process_ledger_update(trigger_update_xml_t *ledger_update_xml)
|
|||||||
//关闭这个终端的所有连接//////////////////////////////////////////////////////////////////////
|
//关闭这个终端的所有连接//////////////////////////////////////////////////////////////////////
|
||||||
for(chnl_no=0 ; chnl_no<ied->chncount; chnl_no++) {
|
for(chnl_no=0 ; chnl_no<ied->chncount; chnl_no++) {
|
||||||
chnl_usr = (chnl_usr_t*)ied->channel[chnl_no].connect;
|
chnl_usr = (chnl_usr_t*)ied->channel[chnl_no].connect;
|
||||||
if (chnl_usr->m_state!=CHANNEL_CONNECTED){//跳过未连接的通道
|
/*if (chnl_usr->m_state!=CHANNEL_CONNECTED){//跳过未连接的通道
|
||||||
continue;
|
continue;
|
||||||
}
|
}*///20260416任何状态都关闭连接
|
||||||
closeChannel(chnl_usr);//关闭更新台账后,任务会自动连接
|
closeChannel(chnl_usr);//关闭更新台账后,任务会自动连接
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1232,9 +1211,9 @@ void process_ledger_update(trigger_update_xml_t *ledger_update_xml)
|
|||||||
//关闭这个终端的所有连接//////////////////////////////////////////////////////////////////////
|
//关闭这个终端的所有连接//////////////////////////////////////////////////////////////////////
|
||||||
for(chnl_no=0 ; chnl_no<ied->chncount; chnl_no++) {
|
for(chnl_no=0 ; chnl_no<ied->chncount; chnl_no++) {
|
||||||
chnl_usr = (chnl_usr_t*)ied->channel[chnl_no].connect;
|
chnl_usr = (chnl_usr_t*)ied->channel[chnl_no].connect;
|
||||||
if (chnl_usr->m_state!=CHANNEL_CONNECTED){ //跳过没连接的通道,一般一个终端只有一个
|
/*if (chnl_usr->m_state!=CHANNEL_CONNECTED){ //跳过没连接的通道,一般一个终端只有一个
|
||||||
continue;
|
continue;
|
||||||
}
|
}*///20260416任何状态都关闭连接
|
||||||
closeChannel(chnl_usr);//关闭更新台账后,如果是删除则不会再连接,关闭连接时这个ied的报告会被清除,报告控制会被注销
|
closeChannel(chnl_usr);//关闭更新台账后,如果是删除则不会再连接,关闭连接时这个ied的报告会被清除,报告控制会被注销
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1425,7 +1404,7 @@ void check_ledger_update()//lnk20250113
|
|||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
printf("only process recall config, skip ledger update\n");
|
printf("only process recall config, skip ledger update\n");
|
||||||
DIY_WARNLOG_CODE("process",LOG_CODE_SPACE_ALARM,"【WARN】当前配置为仅日志模式,统计数据进程跳过台账更新");
|
DIY_WARNLOG_CODE("process",0,LOG_CODE_SPACE_ALARM,"【WARN】当前配置为仅日志模式,统计数据进程跳过台账更新");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1481,13 +1460,13 @@ void check_disk_quota()
|
|||||||
//printf("Current user disk free size: %dMB ,total size: %dMB \n",freeSizeMB,totalSizeMB);
|
//printf("Current user disk free size: %dMB ,total size: %dMB \n",freeSizeMB,totalSizeMB);
|
||||||
if (freeSizeMB<g_min_free_size){
|
if (freeSizeMB<g_min_free_size){
|
||||||
echo_warn2("Current user disk free size: %dMB < %dMB, please check!\n",freeSizeMB,g_min_free_size);
|
echo_warn2("Current user disk free size: %dMB < %dMB, please check!\n",freeSizeMB,g_min_free_size);
|
||||||
DIY_WARNLOG_CODE("process",LOG_CODE_SPACE_ALARM,"【WARN】前置磁盘检测: 当前磁盘的可用空间为%dMB,小于最小可用空间%dMB,请检查磁盘",freeSizeMB,g_min_free_size);
|
DIY_WARNLOG_CODE("process",0,LOG_CODE_SPACE_ALARM,"【WARN】前置磁盘检测: 当前磁盘的可用空间为%dMB,小于最小可用空间%dMB,请检查磁盘",freeSizeMB,g_min_free_size);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((freeSizeMB/(totalSizeMB/100+1) )<10){
|
if ((freeSizeMB/(totalSizeMB/100+1) )<10){
|
||||||
echo_warn2("Current user disk free size percent < 10%%, free size: %dMB ,total size: %dMB ,please check!\n",
|
echo_warn2("Current user disk free size percent < 10%%, free size: %dMB ,total size: %dMB ,please check!\n",
|
||||||
freeSizeMB,totalSizeMB);
|
freeSizeMB,totalSizeMB);
|
||||||
DIY_WARNLOG_CODE("process",LOG_CODE_SPACE_ALARM,"【WARN】前置磁盘检测: 当前磁盘的可用空间的百分比小于10%%,可用空间为%dMB,总空间为%dMB,请检查磁盘",freeSizeMB,totalSizeMB);
|
DIY_WARNLOG_CODE("process",0,LOG_CODE_SPACE_ALARM,"【WARN】前置磁盘检测: 当前磁盘的可用空间的百分比小于10%%,可用空间为%dMB,总空间为%dMB,请检查磁盘",freeSizeMB,totalSizeMB);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -1552,6 +1531,8 @@ void CheckAllConnectedChannel()
|
|||||||
if(chnl_usr->m_state == CHANNEL_CONNECTED)
|
if(chnl_usr->m_state == CHANNEL_CONNECTED)
|
||||||
{
|
{
|
||||||
if(g_node_id == THREE_SECS_DATA_BASE_NODE_ID) {
|
if(g_node_id == THREE_SECS_DATA_BASE_NODE_ID) {
|
||||||
|
InitLedrsOperTypeForChannel(chnl_usr);//写特殊控制的初始化
|
||||||
|
if(DEBUGOPEN)printf("[FILEDIR] enter HandleFileDirReqForChannel");
|
||||||
HandleFileDirReqForChannel(chnl_usr);//文件目录请求
|
HandleFileDirReqForChannel(chnl_usr);//文件目录请求
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1609,13 +1590,6 @@ void CheckNextNotConnectedChannel()
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
//终端日志的key,lnk20250526
|
|
||||||
char full_key_t_c[256]; // 分配足够空间
|
|
||||||
char full_key_t_d[256]; // 分配足够空间
|
|
||||||
snprintf(full_key_t_c, sizeof(full_key_t_c), "terminal.%s.COM", ((ied_usr_t*)(chnl_usr->chnl->ied->usr_ext))->terminal_id);
|
|
||||||
snprintf(full_key_t_d, sizeof(full_key_t_d), "terminal.%s.DATA", ((ied_usr_t*)(chnl_usr->chnl->ied->usr_ext))->terminal_id);
|
|
||||||
//终端日志的key,lnk20250526
|
|
||||||
|
|
||||||
//10-11-01 22:03 beijing
|
//10-11-01 22:03 beijing
|
||||||
if( ( (chnl_total_no+1)==g_pt61850app->chnl_counts) || (g_onlyIP[0]!=0) ){
|
if( ( (chnl_total_no+1)==g_pt61850app->chnl_counts) || (g_onlyIP[0]!=0) ){
|
||||||
if(g_pt61850app->initNum<255)
|
if(g_pt61850app->initNum<255)
|
||||||
@@ -1641,7 +1615,7 @@ void CheckNextNotConnectedChannel()
|
|||||||
//mq日志
|
//mq日志
|
||||||
((ied_usr_t*)(chnl_usr->chnl->ied->usr_ext))->lastconnectstat = true;
|
((ied_usr_t*)(chnl_usr->chnl->ied->usr_ext))->lastconnectstat = true;
|
||||||
((ied_usr_t*)(chnl_usr->chnl->ied->usr_ext))->has_logged_disconnect = false;
|
((ied_usr_t*)(chnl_usr->chnl->ied->usr_ext))->has_logged_disconnect = false;
|
||||||
DIY_WARNLOG_CODE(full_key_t_c,LOG_CODE_COMM,"【WARN】终端%s - ip端口:%s:%d连接成功", ((ied_usr_t*)(chnl_usr->chnl->ied->usr_ext))->terminal_id,chnl_usr->ip_str,chnl_usr->chnl->port);
|
DIY_WARNLOG_CODE(((ied_usr_t*)(chnl_usr->chnl->ied->usr_ext))->terminal_id,1,LOG_CODE_COMM,"【WARN】终端%s - ip端口:%s:%d连接成功", ((ied_usr_t*)(chnl_usr->chnl->ied->usr_ext))->terminal_id,chnl_usr->ip_str,chnl_usr->chnl->port);
|
||||||
|
|
||||||
mvl_free_req_ctrl(chnl_usr->m_reqCtrl);
|
mvl_free_req_ctrl(chnl_usr->m_reqCtrl);
|
||||||
chnl_usr->m_reqCtrl = NULL;
|
chnl_usr->m_reqCtrl = NULL;
|
||||||
@@ -1688,11 +1662,11 @@ void CheckNextNotConnectedChannel()
|
|||||||
if(true == ((ied_usr_t*)(chnl_usr->chnl->ied->usr_ext))->lastconnectstat){
|
if(true == ((ied_usr_t*)(chnl_usr->chnl->ied->usr_ext))->lastconnectstat){
|
||||||
((ied_usr_t*)(chnl_usr->chnl->ied->usr_ext))->lastconnectstat = false;
|
((ied_usr_t*)(chnl_usr->chnl->ied->usr_ext))->lastconnectstat = false;
|
||||||
((ied_usr_t*)(chnl_usr->chnl->ied->usr_ext))->has_logged_disconnect = true;
|
((ied_usr_t*)(chnl_usr->chnl->ied->usr_ext))->has_logged_disconnect = true;
|
||||||
DIY_WARNLOG_CODE(full_key_t_c,LOG_CODE_COMM,"【WARN】终端%s - ip/端口:%s:%d,从开始连接到目前已经%i秒,连接失败,断开连接!", ((ied_usr_t*)(chnl_usr->chnl->ied->usr_ext))->terminal_id,chnl_usr->ip_str,chnl_usr->chnl->port,secsSince);
|
DIY_WARNLOG_CODE(((ied_usr_t*)(chnl_usr->chnl->ied->usr_ext))->terminal_id,1,LOG_CODE_COMM,"【WARN】终端%s - ip/端口:%s:%d,从开始连接到目前已经%i秒,连接失败,断开连接!", ((ied_usr_t*)(chnl_usr->chnl->ied->usr_ext))->terminal_id,chnl_usr->ip_str,chnl_usr->chnl->port,secsSince);
|
||||||
}
|
}
|
||||||
else if(false == ((ied_usr_t*)(chnl_usr->chnl->ied->usr_ext))->lastconnectstat && false == ((ied_usr_t*)(chnl_usr->chnl->ied->usr_ext))->has_logged_disconnect){
|
else if(false == ((ied_usr_t*)(chnl_usr->chnl->ied->usr_ext))->lastconnectstat && false == ((ied_usr_t*)(chnl_usr->chnl->ied->usr_ext))->has_logged_disconnect){
|
||||||
((ied_usr_t*)(chnl_usr->chnl->ied->usr_ext))->has_logged_disconnect = true;
|
((ied_usr_t*)(chnl_usr->chnl->ied->usr_ext))->has_logged_disconnect = true;
|
||||||
DIY_WARNLOG_CODE(full_key_t_c,LOG_CODE_COMM,"【WARN】终端%s - ip/端口:%s:%d,从开始连接到目前已经%i秒,连接失败,断开连接!", ((ied_usr_t*)(chnl_usr->chnl->ied->usr_ext))->terminal_id,chnl_usr->ip_str,chnl_usr->chnl->port,secsSince);
|
DIY_WARNLOG_CODE(((ied_usr_t*)(chnl_usr->chnl->ied->usr_ext))->terminal_id,1,LOG_CODE_COMM,"【WARN】终端%s - ip/端口:%s:%d,从开始连接到目前已经%i秒,连接失败,断开连接!", ((ied_usr_t*)(chnl_usr->chnl->ied->usr_ext))->terminal_id,chnl_usr->ip_str,chnl_usr->chnl->port,secsSince);
|
||||||
}
|
}
|
||||||
|
|
||||||
mvl_free_req_ctrl(chnl_usr->m_reqCtrl);
|
mvl_free_req_ctrl(chnl_usr->m_reqCtrl);
|
||||||
@@ -1723,11 +1697,11 @@ void CheckNextNotConnectedChannel()
|
|||||||
if(true == ((ied_usr_t*)(chnl_usr->chnl->ied->usr_ext))->lastconnectstat){
|
if(true == ((ied_usr_t*)(chnl_usr->chnl->ied->usr_ext))->lastconnectstat){
|
||||||
((ied_usr_t*)(chnl_usr->chnl->ied->usr_ext))->lastconnectstat = false;
|
((ied_usr_t*)(chnl_usr->chnl->ied->usr_ext))->lastconnectstat = false;
|
||||||
((ied_usr_t*)(chnl_usr->chnl->ied->usr_ext))->has_logged_disconnect = true;
|
((ied_usr_t*)(chnl_usr->chnl->ied->usr_ext))->has_logged_disconnect = true;
|
||||||
DIY_WARNLOG_CODE(full_key_t_c,LOG_CODE_COMM,"【WARN】终端%s - ip端口:%s:%d,从开始连接到目前已经300秒,未能获取连接响应,断开连接!", ((ied_usr_t*)(chnl_usr->chnl->ied->usr_ext))->terminal_id,chnl_usr->ip_str,chnl_usr->chnl->port);
|
DIY_WARNLOG_CODE(((ied_usr_t*)(chnl_usr->chnl->ied->usr_ext))->terminal_id,1,LOG_CODE_COMM,"【WARN】终端%s - ip端口:%s:%d,从开始连接到目前已经300秒,未能获取连接响应,断开连接!", ((ied_usr_t*)(chnl_usr->chnl->ied->usr_ext))->terminal_id,chnl_usr->ip_str,chnl_usr->chnl->port);
|
||||||
}
|
}
|
||||||
else if(false == ((ied_usr_t*)(chnl_usr->chnl->ied->usr_ext))->lastconnectstat && false == ((ied_usr_t*)(chnl_usr->chnl->ied->usr_ext))->has_logged_disconnect){
|
else if(false == ((ied_usr_t*)(chnl_usr->chnl->ied->usr_ext))->lastconnectstat && false == ((ied_usr_t*)(chnl_usr->chnl->ied->usr_ext))->has_logged_disconnect){
|
||||||
((ied_usr_t*)(chnl_usr->chnl->ied->usr_ext))->has_logged_disconnect = true;
|
((ied_usr_t*)(chnl_usr->chnl->ied->usr_ext))->has_logged_disconnect = true;
|
||||||
DIY_WARNLOG_CODE(full_key_t_c,LOG_CODE_COMM,"【WARN】终端%s - ip端口:%s:%d,从开始连接到目前已经300秒,未能获取连接响应,断开连接!", ((ied_usr_t*)(chnl_usr->chnl->ied->usr_ext))->terminal_id,chnl_usr->ip_str,chnl_usr->chnl->port);
|
DIY_WARNLOG_CODE(((ied_usr_t*)(chnl_usr->chnl->ied->usr_ext))->terminal_id,1,LOG_CODE_COMM,"【WARN】终端%s - ip端口:%s:%d,从开始连接到目前已经300秒,未能获取连接响应,断开连接!", ((ied_usr_t*)(chnl_usr->chnl->ied->usr_ext))->terminal_id,chnl_usr->ip_str,chnl_usr->chnl->port);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -1767,7 +1741,7 @@ void CheckNextNotConnectedChannel()
|
|||||||
if (chnl_usr->chnl->ied->cpucount != NULL && chnl_usr->chnl->ied->cpucount > 0 && ied_usr->dev_flag == ENABLE) {//2023-09-26 czy 如果line count<0 不需要连接//lnk20250121如果终端无效则不连接
|
if (chnl_usr->chnl->ied->cpucount != NULL && chnl_usr->chnl->ied->cpucount > 0 && ied_usr->dev_flag == ENABLE) {//2023-09-26 czy 如果line count<0 不需要连接//lnk20250121如果终端无效则不连接
|
||||||
|
|
||||||
//mq日志
|
//mq日志
|
||||||
//DIY_WARNLOG(full_key_t_c,"【WARN】重新连接终端%s - ip端口:%s:%d", ((ied_usr_t*)(chnl_usr->chnl->ied->usr_ext))->terminal_id,chnl_usr->ip_str,chnl_usr->chnl->port);
|
//DIY_WARNLOG_CODE(((ied_usr_t*)(chnl_usr->chnl->ied->usr_ext))->terminal_id,1,LOG_CODE_COMM,"【WARN】重新连接终端%s - ip端口:%s:%d", ((ied_usr_t*)(chnl_usr->chnl->ied->usr_ext))->terminal_id,chnl_usr->ip_str,chnl_usr->chnl->port);
|
||||||
|
|
||||||
ret = mms_connectToServer(ied_usr->dev_key, ied_usr->dev_series, serverARName, &(chnl_usr->net_info), &(chnl_usr->m_reqCtrl));
|
ret = mms_connectToServer(ied_usr->dev_key, ied_usr->dev_series, serverARName, &(chnl_usr->net_info), &(chnl_usr->m_reqCtrl));
|
||||||
|
|
||||||
@@ -1779,7 +1753,7 @@ void CheckNextNotConnectedChannel()
|
|||||||
chnl_usr->m_StartConnectingTime = sGetMsTime();
|
chnl_usr->m_StartConnectingTime = sGetMsTime();
|
||||||
|
|
||||||
//mq日志
|
//mq日志
|
||||||
//DIY_WARNLOG(full_key_t_c,"【WARN】正在重新连接终端%s - ip端口:%s:%d - 识别码/秘钥:%s/%s", ((ied_usr_t*)(chnl_usr->chnl->ied->usr_ext))->terminal_id,chnl_usr->ip_str,chnl_usr->chnl->port,((ied_usr_t*)(chnl_usr->chnl->ied->usr_ext))->dev_series,((ied_usr_t*)(chnl_usr->chnl->ied->usr_ext))->dev_key);
|
//DIY_WARNLOG_CODE(((ied_usr_t*)(chnl_usr->chnl->ied->usr_ext))->terminal_id,1,LOG_CODE_COMM,"【WARN】正在重新连接终端%s - ip端口:%s:%d - 识别码/秘钥:%s/%s", ((ied_usr_t*)(chnl_usr->chnl->ied->usr_ext))->terminal_id,chnl_usr->ip_str,chnl_usr->chnl->port,((ied_usr_t*)(chnl_usr->chnl->ied->usr_ext))->dev_series,((ied_usr_t*)(chnl_usr->chnl->ied->usr_ext))->dev_key);
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -1791,7 +1765,7 @@ void CheckNextNotConnectedChannel()
|
|||||||
echo_warn3("FAILED: mms_connectToServer IP %s:%d ,NetInfo= %x \n", chnl_usr->ip_str, chnl_usr->chnl->port, chnl_usr->net_info);
|
echo_warn3("FAILED: mms_connectToServer IP %s:%d ,NetInfo= %x \n", chnl_usr->ip_str, chnl_usr->chnl->port, chnl_usr->net_info);
|
||||||
|
|
||||||
//mq日志
|
//mq日志
|
||||||
//DIY_WARNLOG(full_key_t_c,"【WARN】重新连接终端%s - ip端口:%s:%d 失败!", ((ied_usr_t*)(chnl_usr->chnl->ied->usr_ext))->terminal_id,chnl_usr->ip_str,chnl_usr->chnl->port);
|
//DIY_WARNLOG_CODE(((ied_usr_t*)(chnl_usr->chnl->ied->usr_ext))->terminal_id,1,LOG_CODE_COMM,"【WARN】重新连接终端%s - ip端口:%s:%d 失败!", ((ied_usr_t*)(chnl_usr->chnl->ied->usr_ext))->terminal_id,chnl_usr->ip_str,chnl_usr->chnl->port);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1822,7 +1796,7 @@ void CheckNextNotConnectedChannel()
|
|||||||
chnl_usr->chnl->status = STATUS_BREAKOFF;
|
chnl_usr->chnl->status = STATUS_BREAKOFF;
|
||||||
|
|
||||||
//mq日志
|
//mq日志
|
||||||
DIY_WARNLOG_CODE(full_key_t_c,LOG_CODE_COMM,"【WARN】终端%s - ip端口:%s:%d 断连完成,关闭连接通道", ((ied_usr_t*)(chnl_usr->chnl->ied->usr_ext))->terminal_id,chnl_usr->ip_str,chnl_usr->chnl->port);
|
DIY_WARNLOG_CODE(((ied_usr_t*)(chnl_usr->chnl->ied->usr_ext))->terminal_id,1,LOG_CODE_COMM,"【WARN】终端%s - ip端口:%s:%d 断连完成,关闭连接通道", ((ied_usr_t*)(chnl_usr->chnl->ied->usr_ext))->terminal_id,chnl_usr->ip_str,chnl_usr->chnl->port);
|
||||||
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@@ -1852,7 +1826,7 @@ void CheckNextNotConnectedChannel()
|
|||||||
chnl_usr->chnl->status = STATUS_BREAKOFF;
|
chnl_usr->chnl->status = STATUS_BREAKOFF;
|
||||||
|
|
||||||
//mq日志
|
//mq日志
|
||||||
DIY_WARNLOG_CODE(full_key_t_c,LOG_CODE_COMM,"【WARN】终端%s - ip端口:%s:%d 断连未完成,但是已经超时180秒,关闭连接通道", ((ied_usr_t*)(chnl_usr->chnl->ied->usr_ext))->terminal_id,chnl_usr->ip_str,chnl_usr->chnl->port);
|
DIY_WARNLOG_CODE(((ied_usr_t*)(chnl_usr->chnl->ied->usr_ext))->terminal_id,1,LOG_CODE_COMM,"【WARN】终端%s - ip端口:%s:%d 断连未完成,但是已经超时180秒,关闭连接通道", ((ied_usr_t*)(chnl_usr->chnl->ied->usr_ext))->terminal_id,chnl_usr->ip_str,chnl_usr->chnl->port);
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -2004,13 +1978,6 @@ apr_status_t call_cn_wavelist(LD_info_t *LD_info )
|
|||||||
ied_usr_t *ied_usr = GET_IEDEXT_ADDR(ied);
|
ied_usr_t *ied_usr = GET_IEDEXT_ADDR(ied);
|
||||||
int have_new_files = FALSE;
|
int have_new_files = FALSE;
|
||||||
|
|
||||||
//监测点日志的key,lnk20250526
|
|
||||||
char full_key_m_c[256]; // 分配足够空间
|
|
||||||
char full_key_m_d[256]; // 分配足够空间
|
|
||||||
snprintf(full_key_m_c, sizeof(full_key_m_c), "monitor.%s.COM", LD_info->mp_id);
|
|
||||||
snprintf(full_key_m_d, sizeof(full_key_m_d), "monitor.%s.DATA", LD_info->mp_id);
|
|
||||||
//监测点日志的key,lnk20250526
|
|
||||||
|
|
||||||
for (i=0;i<256;i++) {
|
for (i=0;i<256;i++) {
|
||||||
if (LD_info->FltNum[i]<=0)
|
if (LD_info->FltNum[i]<=0)
|
||||||
continue;
|
continue;
|
||||||
@@ -2022,7 +1989,7 @@ apr_status_t call_cn_wavelist(LD_info_t *LD_info )
|
|||||||
printf(">>>>>>>> IED [%d]: %s is calling cn wavefile, !!!!!!!! file_match_str=%s \n",ied->id,ied->name,file_match_str);
|
printf(">>>>>>>> IED [%d]: %s is calling cn wavefile, !!!!!!!! file_match_str=%s \n",ied->id,ied->name,file_match_str);
|
||||||
|
|
||||||
//mq日志
|
//mq日志
|
||||||
DIY_INFOLOG(full_key_m_c,"【NORMAL】监测点:%s - id:%s开始召唤录波文件", LD_info->name,LD_info->mp_id);
|
DIY_INFOLOG_CODE(LD_info->mp_id,2,LOG_CODE_COMTRADE_FILE,"【NORMAL】监测点:%s - id:%s开始召唤录波文件", LD_info->name,LD_info->mp_id);
|
||||||
|
|
||||||
ret = SD_FAILURE;
|
ret = SD_FAILURE;
|
||||||
filenum = 0;
|
filenum = 0;
|
||||||
@@ -2044,14 +2011,14 @@ apr_status_t call_cn_wavelist(LD_info_t *LD_info )
|
|||||||
int ret2,ret3;
|
int ret2,ret3;
|
||||||
|
|
||||||
//mq日志
|
//mq日志
|
||||||
DIY_INFOLOG(full_key_m_c,"【NORMAL】监测点:%s - id:%s获取录波文件列表成功,开始匹配录波文件", LD_info->name,LD_info->mp_id);
|
DIY_INFOLOG_CODE(LD_info->mp_id,2,LOG_CODE_COMTRADE_FILE,"【NORMAL】监测点:%s - id:%s获取录波文件列表成功,开始匹配录波文件", LD_info->name,LD_info->mp_id);
|
||||||
|
|
||||||
//WW 2023-11-01将录波段号由字符串匹配修改为int的fltnum匹配
|
//WW 2023-11-01将录波段号由字符串匹配修改为int的fltnum匹配
|
||||||
ret2 = parse_file_names_by_fltnum(LD_info->FltNum[i], ldstr, filenames, filenum, &cfg_idx, &dat_idx, file_base_name, file_yyyymm);
|
ret2 = parse_file_names_by_fltnum(LD_info->FltNum[i], ldstr, filenames, filenum, &cfg_idx, &dat_idx, file_base_name, file_yyyymm);
|
||||||
//WW 2023-11-01 end
|
//WW 2023-11-01 end
|
||||||
if (ret2 !=APR_SUCCESS){
|
if (ret2 !=APR_SUCCESS){
|
||||||
//mq日志
|
//mq日志
|
||||||
//DIY_WARNLOG_CODE(full_key_m_c,LOG_CODE_COMTRADE_FILE,"【WARN】监测点:%s - id:%s前置记录的录波事件上传的录波号段%d与从装置获取的录波文件列表匹配失败,装置没有对应的号段的录波文件,清除该记录", LD_info->name,LD_info->mp_id,LD_info->FltNum[i]);
|
//DIY_WARNLOG_CODE(LD_info->mp_id,2,LOG_CODE_COMTRADE_FILE,"【WARN】监测点:%s - id:%s前置记录的录波事件上传的录波号段%d与从装置获取的录波文件列表匹配失败,装置没有对应的号段的录波文件,清除该记录", LD_info->name,LD_info->mp_id,LD_info->FltNum[i]);
|
||||||
//lnk20250819装置没有对应的文件时清除录波号段
|
//lnk20250819装置没有对应的文件时清除录波号段
|
||||||
printf("监测点:%s - id:%s前置记录的录波事件上传的录波号段%d与从装置获取的录波文件列表匹配失败,装置没有对应的号段的录波文件,清除该记录", LD_info->name,LD_info->mp_id,LD_info->FltNum[i]);
|
printf("监测点:%s - id:%s前置记录的录波事件上传的录波号段%d与从装置获取的录波文件列表匹配失败,装置没有对应的号段的录波文件,清除该记录", LD_info->name,LD_info->mp_id,LD_info->FltNum[i]);
|
||||||
LD_info->FltNum[i] = -1;
|
LD_info->FltNum[i] = -1;
|
||||||
@@ -2067,15 +2034,35 @@ apr_status_t call_cn_wavelist(LD_info_t *LD_info )
|
|||||||
if (ret2==SD_SUCCESS && ret3==SD_SUCCESS ) { //两个文件都写好了
|
if (ret2==SD_SUCCESS && ret3==SD_SUCCESS ) { //两个文件都写好了
|
||||||
|
|
||||||
//mq日志
|
//mq日志
|
||||||
DIY_INFOLOG(full_key_m_c,"【NORMAL】监测点:%s - id:%s从终端获取录波文件成功", LD_info->name,LD_info->mp_id);
|
DIY_INFOLOG_CODE(LD_info->mp_id,2,LOG_CODE_COMTRADE_FILE,"【NORMAL】监测点:%s - id:%s从终端获取录波文件成功", LD_info->name,LD_info->mp_id);
|
||||||
|
|
||||||
QVVR_t *qvvr; //暂态事件
|
QVVR_t *qvvr; //暂态事件
|
||||||
long long start_tm,trig_tm,end_tm;
|
long long start_tm,trig_tm,end_tm;//北京时间
|
||||||
|
|
||||||
ret2 = extract_timestamp_from_cfg_file(filenames[cfg_idx],&start_tm,&trig_tm);//提取文件的开始时间和触发时间
|
ret2 = extract_timestamp_from_cfg_file(filenames[cfg_idx],&start_tm,&trig_tm);//提取文件的开始时间和触发时间
|
||||||
|
|
||||||
|
//添加录波文件时间戳校准20260409
|
||||||
|
{
|
||||||
|
XmlConfigC cfg;
|
||||||
|
long long utc_or_beijing = 0;
|
||||||
|
if (get_xml_config_by_dev_type(ied_usr->dev_type, &cfg)) {
|
||||||
|
if(strcmp(cfg.WaveTimeFlag, "utc") == 0){//装置时间是utc还是北京
|
||||||
|
utc_or_beijing = 28800000;//八小时相差毫秒数
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
utc_or_beijing = 0;
|
||||||
|
}
|
||||||
|
trig_tm = trig_tm + utc_or_beijing;//如果是utc时间则转换为北京时间
|
||||||
|
start_tm = start_tm + utc_or_beijing;//接口上送没用到
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
printf("读取失败,未找到 dev_type\n");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
printf(">>>>>>>> extract_timestamp_from_cfg_file end \n");
|
printf(">>>>>>>> extract_timestamp_from_cfg_file end \n");
|
||||||
if (ret2 ==APR_SUCCESS) {
|
if (ret2 ==APR_SUCCESS) {
|
||||||
DIY_INFOLOG(full_key_m_c,"【NORMAL】监测点:%s - id:%s提取录波文件时间成功", LD_info->name,LD_info->mp_id);
|
DIY_INFOLOG_CODE(LD_info->mp_id,2,LOG_CODE_COMTRADE_FILE,"【NORMAL】监测点:%s - id:%s提取录波文件时间成功", LD_info->name,LD_info->mp_id);
|
||||||
//to find the paired qvvr by the time of trig_tm
|
//to find the paired qvvr by the time of trig_tm
|
||||||
printf(">>>>>>>> extract_timestamp_from_cfg_file success \n");
|
printf(">>>>>>>> extract_timestamp_from_cfg_file success \n");
|
||||||
qvvr = find_qvvr_by_trig_tm(LD_info,trig_tm); //根据文件的触发时间查找检测点记录的匹配上的暂态事件
|
qvvr = find_qvvr_by_trig_tm(LD_info,trig_tm); //根据文件的触发时间查找检测点记录的匹配上的暂态事件
|
||||||
@@ -2095,18 +2082,18 @@ apr_status_t call_cn_wavelist(LD_info_t *LD_info )
|
|||||||
|
|
||||||
char loc_file_fullname_cfg[256];//本地文件名
|
char loc_file_fullname_cfg[256];//本地文件名
|
||||||
memset(loc_file_fullname_cfg, 0, sizeof(loc_file_fullname_cfg));
|
memset(loc_file_fullname_cfg, 0, sizeof(loc_file_fullname_cfg));
|
||||||
apr_snprintf(loc_file_fullname_cfg, sizeof(loc_file_fullname_cfg), "/home/pq/FeProject/comtrade/%s", cfg_only_filename_ret);
|
apr_snprintf(loc_file_fullname_cfg, sizeof(loc_file_fullname_cfg), "/FeProject/comtrade/%s", cfg_only_filename_ret);
|
||||||
char oss_file_fullname_cfg[256];//远端文件名
|
char oss_file_fullname_cfg[256];//远端文件名
|
||||||
memset(oss_file_fullname_cfg, 0, sizeof(oss_file_fullname_cfg));
|
memset(oss_file_fullname_cfg, 0, sizeof(oss_file_fullname_cfg));
|
||||||
apr_snprintf(oss_file_fullname_cfg, sizeof(oss_file_fullname_cfg), "comtrade/wave/%s/%s", LD_info->mp_id, cfg_only_filename_ret);
|
apr_snprintf(oss_file_fullname_cfg, sizeof(oss_file_fullname_cfg), "comtrade/wave/%s/%s", LD_info->mp_id, cfg_only_filename_ret);
|
||||||
if (FILE_FLAG == 1) {
|
if (FILE_FLAG == 1) {
|
||||||
PutOSS(oss_file_fullname_cfg, loc_file_fullname_cfg);//使用buffer推送文件
|
//PutOSS(oss_file_fullname_cfg, loc_file_fullname_cfg);//使用buffer推送文件
|
||||||
}
|
}
|
||||||
else if (FILE_FLAG == 2) {
|
else if (FILE_FLAG == 2) {
|
||||||
OBSFile(loc_file_fullname_cfg, oss_file_fullname_cfg, "putObject");//这里并没有上传文件流
|
//OBSFile(loc_file_fullname_cfg, oss_file_fullname_cfg, "putObject");//这里并没有上传文件流
|
||||||
}
|
}
|
||||||
else if(FILE_FLAG==3){
|
else if(FILE_FLAG==3){
|
||||||
WebAPI_Uds_Upload(UDS_UPLOAD_URL, loc_file_fullname_cfg, uuid_cfg, filename_cfg);//通过form-data上传文件
|
//WebAPI_Uds_Upload(UDS_UPLOAD_URL, loc_file_fullname_cfg, uuid_cfg, filename_cfg);//通过form-data上传文件
|
||||||
}
|
}
|
||||||
//LNK20241031使用JSON编码文件上传-具体的远端路径可以用原本代码的硬编码或者在配置文件中获取
|
//LNK20241031使用JSON编码文件上传-具体的远端路径可以用原本代码的硬编码或者在配置文件中获取
|
||||||
else if (FILE_FLAG == 4) {
|
else if (FILE_FLAG == 4) {
|
||||||
@@ -2133,18 +2120,18 @@ apr_status_t call_cn_wavelist(LD_info_t *LD_info )
|
|||||||
|
|
||||||
char loc_file_fullname_dat[256];
|
char loc_file_fullname_dat[256];
|
||||||
memset(loc_file_fullname_dat, 0, sizeof(loc_file_fullname_dat));
|
memset(loc_file_fullname_dat, 0, sizeof(loc_file_fullname_dat));
|
||||||
apr_snprintf(loc_file_fullname_dat, sizeof(loc_file_fullname_dat), "/home/pq/FeProject/comtrade/%s", dat_only_filename_ret);
|
apr_snprintf(loc_file_fullname_dat, sizeof(loc_file_fullname_dat), "/FeProject/comtrade/%s", dat_only_filename_ret);
|
||||||
char oss_file_fullname_dat[256];
|
char oss_file_fullname_dat[256];
|
||||||
memset(oss_file_fullname_dat, 0, sizeof(oss_file_fullname_dat));
|
memset(oss_file_fullname_dat, 0, sizeof(oss_file_fullname_dat));
|
||||||
apr_snprintf(oss_file_fullname_dat, sizeof(oss_file_fullname_dat), "comtrade/wave/%s/%s", LD_info->mp_id, dat_only_filename_ret);
|
apr_snprintf(oss_file_fullname_dat, sizeof(oss_file_fullname_dat), "comtrade/wave/%s/%s", LD_info->mp_id, dat_only_filename_ret);
|
||||||
if (FILE_FLAG == 1) {
|
if (FILE_FLAG == 1) {
|
||||||
PutOSS(oss_file_fullname_dat, loc_file_fullname_dat);//使用buffer推送文件
|
//PutOSS(oss_file_fullname_dat, loc_file_fullname_dat);//使用buffer推送文件
|
||||||
}
|
}
|
||||||
else if (FILE_FLAG == 2) {
|
else if (FILE_FLAG == 2) {
|
||||||
OBSFile(loc_file_fullname_dat, oss_file_fullname_dat, "putObject");//这里并没有上传文件流
|
//OBSFile(loc_file_fullname_dat, oss_file_fullname_dat, "putObject");//这里并没有上传文件流
|
||||||
}
|
}
|
||||||
else if(FILE_FLAG==3){
|
else if(FILE_FLAG==3){
|
||||||
WebAPI_Uds_Upload(UDS_UPLOAD_URL, loc_file_fullname_dat, uuid_dat, filename_dat);//通过form-data上传文件
|
//WebAPI_Uds_Upload(UDS_UPLOAD_URL, loc_file_fullname_dat, uuid_dat, filename_dat);//通过form-data上传文件
|
||||||
}
|
}
|
||||||
//LNK20241031使用JSON编码文件上传-具体的远端路径可以用原本代码的硬编码或者在配置文件中获取
|
//LNK20241031使用JSON编码文件上传-具体的远端路径可以用原本代码的硬编码或者在配置文件中获取
|
||||||
else if (FILE_FLAG == 4) {
|
else if (FILE_FLAG == 4) {
|
||||||
@@ -2292,14 +2279,16 @@ apr_status_t call_cn_wavelist(LD_info_t *LD_info )
|
|||||||
//获取时间类型lnk20250520
|
//获取时间类型lnk20250520
|
||||||
XmlConfigC cfg;
|
XmlConfigC cfg;
|
||||||
if (get_xml_config_by_dev_type(ied_usr->dev_type, &cfg)) {
|
if (get_xml_config_by_dev_type(ied_usr->dev_type, &cfg)) {
|
||||||
} else {
|
if(strcmp(cfg.UnitOfTimeUnit, "1") == 0){//持续时间上送的是秒1还是毫秒0
|
||||||
|
DIY_ERRORLOG_CODE(LD_info->mp_id,2,LOG_CODE_COMTRADE_FILE,"【ERROR】监测点:%s - id:%s 匹配录波文件失败,录波号段:%d,录波文件的开始时间:%lld,触发时间:%lld,映射配置的暂态持续时间单位是s", LD_info->name,LD_info->mp_id,LD_info->FltNum[i],start_tm,trig_tm);
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
DIY_ERRORLOG_CODE(LD_info->mp_id,2,LOG_CODE_COMTRADE_FILE,"【ERROR】监测点:%s - id:%s 匹配录波文件失败,录波号段:%d,录波文件的开始时间:%lld,触发时间:%lld,映射配置的暂态持续时间单位是ms", LD_info->name,LD_info->mp_id,LD_info->FltNum[i],start_tm,trig_tm);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else {
|
||||||
printf("读取失败,未找到 dev_type\n");
|
printf("读取失败,未找到 dev_type\n");
|
||||||
}
|
DIY_ERRORLOG_CODE(LD_info->mp_id,2,LOG_CODE_COMTRADE_FILE,"【ERROR】监测点:%s - id:%s 匹配录波文件失败,录波号段:%d,录波文件的开始时间:%lld,触发时间:%lld,映射配置的暂态持续时间单位未配置", LD_info->name,LD_info->mp_id,LD_info->FltNum[i],start_tm,trig_tm);
|
||||||
if(strcmp(cfg.UnitOfTimeUnit, "1") == 0){//持续时间上送的是秒1还是毫秒0
|
|
||||||
DIY_ERRORLOG_CODE(full_key_m_c,LOG_CODE_COMTRADE_FILE,"【ERROR】监测点:%s - id:%s 匹配录波文件失败,录波号段:%d,录波文件的开始时间:%lld,触发时间:%lld,映射配置的暂态持续时间单位是秒", LD_info->name,LD_info->mp_id,LD_info->FltNum[i],start_tm,trig_tm);
|
|
||||||
}
|
|
||||||
else{
|
|
||||||
DIY_ERRORLOG_CODE(full_key_m_c,LOG_CODE_COMTRADE_FILE,"【ERROR】监测点:%s - id:%s 匹配录波文件失败,录波号段:%d,录波文件的开始时间:%lld,触发时间:%lld,映射配置的暂态持续时间单位是毫秒", LD_info->name,LD_info->mp_id,LD_info->FltNum[i],start_tm,trig_tm);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -2307,7 +2296,7 @@ apr_status_t call_cn_wavelist(LD_info_t *LD_info )
|
|||||||
|
|
||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
DIY_ERRORLOG_CODE(full_key_m_c,LOG_CODE_COMTRADE_FILE,"【ERROR】监测点:%s - id:%s 下载录波文件%s和%s失败,录波号段:%d", LD_info->name,LD_info->mp_id,filenames[cfg_idx],filenames[dat_idx],LD_info->FltNum[i]);
|
DIY_ERRORLOG_CODE(LD_info->mp_id,2,LOG_CODE_COMTRADE_FILE,"【ERROR】监测点:%s - id:%s 下载录波文件%s和%s失败,录波号段:%d", LD_info->name,LD_info->mp_id,filenames[cfg_idx],filenames[dat_idx],LD_info->FltNum[i]);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -2315,7 +2304,7 @@ apr_status_t call_cn_wavelist(LD_info_t *LD_info )
|
|||||||
if (ied && chnl_usr){
|
if (ied && chnl_usr){
|
||||||
echo_warn2("mms_mvla_fdir Failed: IED [%d] %s \n", ied->id , chnl_usr->ip_str) ;
|
echo_warn2("mms_mvla_fdir Failed: IED [%d] %s \n", ied->id , chnl_usr->ip_str) ;
|
||||||
//mq日志
|
//mq日志
|
||||||
DIY_WARNLOG_CODE(full_key_m_c,LOG_CODE_COMTRADE_FILE,"【WARN】监测点:%s - id:%s召唤录波文件列表失败,放弃这个号段", LD_info->name,LD_info->mp_id);
|
DIY_WARNLOG_CODE(LD_info->mp_id,2,LOG_CODE_COMTRADE_FILE,"【WARN】监测点:%s - id:%s召唤录波文件列表失败,放弃这个号段", LD_info->name,LD_info->mp_id);
|
||||||
LD_info->FltNum[i] = -1;
|
LD_info->FltNum[i] = -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -854,15 +854,8 @@ ST_VOID u_iec_rpt_ind_data_by_devtype(MVL_VAR_ASSOC** info_va,
|
|||||||
printf("[BEGIND Process] Received Report From %s:%d %s %s ,va_total = %i ,【count = %i】 \n",
|
printf("[BEGIND Process] Received Report From %s:%d %s %s ,va_total = %i ,【count = %i】 \n",
|
||||||
chnl_usr->ip_str, chnl_usr->chnl->port, LD_info->LD_name, rcb_info->RptID, va_total, rptinfo->count);
|
chnl_usr->ip_str, chnl_usr->chnl->port, LD_info->LD_name, rcb_info->RptID, va_total, rptinfo->count);
|
||||||
|
|
||||||
//监测点日志的key,lnk20250526
|
|
||||||
char full_key_m_c[256]; // 分配足够空间
|
|
||||||
char full_key_m_d[256]; // 分配足够空间
|
|
||||||
snprintf(full_key_m_c, sizeof(full_key_m_c), "monitor.%s.COM", LD_info->mp_id);
|
|
||||||
snprintf(full_key_m_d, sizeof(full_key_m_d), "monitor.%s.DATA", LD_info->mp_id);
|
|
||||||
//监测点日志的key,lnk20250526
|
|
||||||
|
|
||||||
//mq日志
|
//mq日志
|
||||||
DIY_INFOLOG(full_key_m_d,"【NORMAL】前置收到监测点:%s - id:%s的报告,报告名称:%s,监测点对应终端的ip和端口是: %s:%d,报告总数:%i,当前报告数:%i", LD_info->name,LD_info->mp_id,rcb_info->RptID,chnl_usr->ip_str,chnl_usr->chnl->port,va_total, rptinfo->count);
|
DIY_INFOLOG_CODE(LD_info->mp_id,2,LOG_CODE_REPORT,"【NORMAL】前置收到监测点:%s - id:%s的报告,报告名称:%s,监测点对应终端的ip和端口是: %s:%d,报告总数:%i,当前报告数:%i", LD_info->name,LD_info->mp_id,rcb_info->RptID,chnl_usr->ip_str,chnl_usr->chnl->port,va_total, rptinfo->count);
|
||||||
|
|
||||||
//apr_time_t previousTime = apr_time_now();//
|
//apr_time_t previousTime = apr_time_now();//
|
||||||
//apr_time_exp_t localTime;
|
//apr_time_exp_t localTime;
|
||||||
@@ -1162,14 +1155,14 @@ ST_VOID u_iec_rpt_ind_data_by_devtype(MVL_VAR_ASSOC** info_va,
|
|||||||
echo_err3("Ignore this report due to line_id invalid , Report From %s %s %s !!!",
|
echo_err3("Ignore this report due to line_id invalid , Report From %s %s %s !!!",
|
||||||
APR_EGENERAL, chnl_usr->ip_str, LD_info->LD_name, rcb_info->RptID);
|
APR_EGENERAL, chnl_usr->ip_str, LD_info->LD_name, rcb_info->RptID);
|
||||||
//mq日志
|
//mq日志
|
||||||
DIY_ERRORLOG_CODE(full_key_m_d,LOG_CODE_REPORT,"【ERROR】前置不处理这个监测点:%s - id:%s的报告,报告名称:%s,原因是监测点的序号非法", LD_info->name,LD_info->mp_id,rcb_info->RptID);
|
DIY_ERRORLOG_CODE(LD_info->mp_id,2,LOG_CODE_REPORT,"【ERROR】前置不处理这个监测点:%s - id:%s的报告,报告名称:%s,原因是监测点的序号非法", LD_info->name,LD_info->mp_id,rcb_info->RptID);
|
||||||
|
|
||||||
}
|
}
|
||||||
printf("[END Process] Report From %s:%d %s %s ,va_total = %i ,【count = %i】 \n",
|
printf("[END Process] Report From %s:%d %s %s ,va_total = %i ,【count = %i】 \n",
|
||||||
chnl_usr->ip_str, chnl_usr->chnl->port, LD_info->LD_name, rcb_info->RptID, va_total, rptinfo->count);
|
chnl_usr->ip_str, chnl_usr->chnl->port, LD_info->LD_name, rcb_info->RptID, va_total, rptinfo->count);
|
||||||
|
|
||||||
//mq日志
|
//mq日志
|
||||||
DIY_INFOLOG(full_key_m_d,"【NORMAL】前置处理监测点:%s - id:%s的报告结束,报告名称:%s,监测点对应终端的ip和端口是: %s:%d,报告总数:%i,当前报告数:%i", LD_info->name,LD_info->mp_id,rcb_info->RptID,chnl_usr->ip_str,chnl_usr->chnl->port,va_total, rptinfo->count);
|
DIY_INFOLOG_CODE(LD_info->mp_id,2,LOG_CODE_REPORT,"【NORMAL】前置处理监测点:%s - id:%s的报告结束,报告名称:%s,监测点对应终端的ip和端口是: %s:%d,报告总数:%i,当前报告数:%i", LD_info->name,LD_info->mp_id,rcb_info->RptID,chnl_usr->ip_str,chnl_usr->chnl->port,va_total, rptinfo->count);
|
||||||
|
|
||||||
//apr_time_t previousTimeend = apr_time_now();//
|
//apr_time_t previousTimeend = apr_time_now();//
|
||||||
//apr_time_exp_t localTimeend;
|
//apr_time_exp_t localTimeend;
|
||||||
@@ -1462,7 +1455,7 @@ ST_VOID u_iec_rpt_ind_data(MVL_VAR_ASSOC** info_va,
|
|||||||
//need do nothing!
|
//need do nothing!
|
||||||
not_set_rpt_q_this = FALSE;
|
not_set_rpt_q_this = FALSE;
|
||||||
}
|
}
|
||||||
else if (strstr(FULL_FCDA_Name, "GGIO"))
|
else if (strstr(FULL_FCDA_Name, "GGIO") || strstr(FULL_FCDA_Name, "LPHD"))
|
||||||
{
|
{
|
||||||
not_set_rpt_q_this = FALSE;
|
not_set_rpt_q_this = FALSE;
|
||||||
}
|
}
|
||||||
@@ -1485,7 +1478,7 @@ ST_VOID u_iec_rpt_ind_data(MVL_VAR_ASSOC** info_va,
|
|||||||
//need do nothing!
|
//need do nothing!
|
||||||
not_set_rpt_TimeID_this = FALSE;
|
not_set_rpt_TimeID_this = FALSE;
|
||||||
}
|
}
|
||||||
else if (strstr(FULL_FCDA_Name, "GGIO")) {//CZY 2023-08-17 WW 2022-11-14修改判断 LLN0$BR$brcbRDRE
|
else if (strstr(FULL_FCDA_Name, "GGIO") || strstr(FULL_FCDA_Name, "LPHD")) {//CZY 2023-08-17 WW 2022-11-14修改判断 LLN0$BR$brcbRDRE
|
||||||
//need do nothing!
|
//need do nothing!
|
||||||
not_set_rpt_TimeID_this = FALSE;
|
not_set_rpt_TimeID_this = FALSE;
|
||||||
}
|
}
|
||||||
|
|||||||
495
mms/mmsclient.c
495
mms/mmsclient.c
@@ -80,6 +80,9 @@
|
|||||||
|
|
||||||
#include <ctype.h> //lnk20241119
|
#include <ctype.h> //lnk20241119
|
||||||
#include "../cfg_parse/custom_printf.h"//lnk20250225
|
#include "../cfg_parse/custom_printf.h"//lnk20250225
|
||||||
|
|
||||||
|
#include "../log4cplus/log4.h"
|
||||||
|
|
||||||
extern uint32_t g_node_id;
|
extern uint32_t g_node_id;
|
||||||
extern char subdir[128];
|
extern char subdir[128];
|
||||||
unsigned int g_no_auth = 0;
|
unsigned int g_no_auth = 0;
|
||||||
@@ -132,6 +135,8 @@ IDENT_RESP_INFO identify_response_info =
|
|||||||
|
|
||||||
/************************************************************************/
|
/************************************************************************/
|
||||||
|
|
||||||
|
extern pt61850app_t *g_pt61850app;
|
||||||
|
|
||||||
extern TP0_CONN *tp0_conn_arr; /* ptr to array of "max_num_conns" structs */
|
extern TP0_CONN *tp0_conn_arr; /* ptr to array of "max_num_conns" structs */
|
||||||
|
|
||||||
static ST_VOID disc_ind_fun (MVL_NET_INFO *cc, ST_INT discType);
|
static ST_VOID disc_ind_fun (MVL_NET_INFO *cc, ST_INT discType);
|
||||||
@@ -269,12 +274,25 @@ MY_CONTROL_INFO my_control_info;
|
|||||||
ST_INT mms_var_type_id_create (MVL_NET_INFO *clientNetInfo, ST_INT scope,
|
ST_INT mms_var_type_id_create (MVL_NET_INFO *clientNetInfo, ST_INT scope,
|
||||||
ST_CHAR *dom_name, ST_CHAR *var_name, int iTimeOut)
|
ST_CHAR *dom_name, ST_CHAR *var_name, int iTimeOut)
|
||||||
{
|
{
|
||||||
MVL_REQ_PEND *reqCtrl;
|
//MVL_REQ_PEND *reqCtrl;
|
||||||
|
//reqCtrl 必须初始化为 NULL,防止 mvla_getvar 失败后释放野指针
|
||||||
|
MVL_REQ_PEND *reqCtrl = NULL;
|
||||||
|
|
||||||
GETVAR_REQ_INFO getvar_req;
|
GETVAR_REQ_INFO getvar_req;
|
||||||
ST_INT type_id = -1; /* start with invalid type id */
|
ST_INT type_id = -1; /* start with invalid type id */
|
||||||
ST_RET ret;
|
ST_RET ret;
|
||||||
|
|
||||||
|
//参数合法性检查
|
||||||
|
if (clientNetInfo == NULL || dom_name == NULL || var_name == NULL)
|
||||||
|
{
|
||||||
|
printf("[GETVAR] invalid arg netInfo=%p dom=%p var=%p\n",
|
||||||
|
clientNetInfo, dom_name, var_name);
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
//结构体清零,避免未初始化字段导致异常
|
||||||
|
memset(&getvar_req, 0, sizeof(getvar_req));
|
||||||
|
|
||||||
/* Get the type of this "Oper" attribute & create type. */
|
/* Get the type of this "Oper" attribute & create type. */
|
||||||
/* Would be more efficient to do this just once before this function.*/
|
/* Would be more efficient to do this just once before this function.*/
|
||||||
getvar_req.req_tag = GETVAR_NAME;
|
getvar_req.req_tag = GETVAR_NAME;
|
||||||
@@ -284,18 +302,52 @@ ST_RET ret;
|
|||||||
getvar_req.name.domain_id= dom_name;
|
getvar_req.name.domain_id= dom_name;
|
||||||
getvar_req.name.obj_name.vmd_spec = var_name;
|
getvar_req.name.obj_name.vmd_spec = var_name;
|
||||||
|
|
||||||
|
//增加调试打印,确认崩溃点
|
||||||
|
printf("[GETVAR] start dom=%s var=%s\n", dom_name, var_name);
|
||||||
|
|
||||||
ret = mvla_getvar (clientNetInfo, &getvar_req, &reqCtrl);
|
ret = mvla_getvar (clientNetInfo, &getvar_req, &reqCtrl);
|
||||||
if (ret == SD_SUCCESS)
|
|
||||||
|
//打印 mvla_getvar 返回值和 reqCtrl
|
||||||
|
printf("[GETVAR] mvla_getvar ret=0x%X reqCtrl=%p\n", ret, reqCtrl);
|
||||||
|
|
||||||
|
if (ret == SD_SUCCESS){
|
||||||
ret = waitReqDone (reqCtrl, iTimeOut);
|
ret = waitReqDone (reqCtrl, iTimeOut);
|
||||||
if (ret != SD_SUCCESS)
|
//打印 waitReqDone 返回值
|
||||||
|
printf("[GETVAR] wait ret=0x%X\n", ret);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (ret != SD_SUCCESS){
|
||||||
echo_warn2 ("Error getting type of variable '%s' in domain '%s'\n", var_name, dom_name);
|
echo_warn2 ("Error getting type of variable '%s' in domain '%s'\n", var_name, dom_name);
|
||||||
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
/* Don't care about name so pass NULL. */
|
/* Don't care about name so pass NULL. */
|
||||||
type_id = mvl_type_id_create (NULL, reqCtrl->u.getvar.resp_info->type_spec.data,
|
//type_id = mvl_type_id_create (NULL, reqCtrl->u.getvar.resp_info->type_spec.data,
|
||||||
reqCtrl->u.getvar.resp_info->type_spec.len);
|
// reqCtrl->u.getvar.resp_info->type_spec.len);
|
||||||
|
//严格检查 resp_info/type_spec,避免空指针崩溃
|
||||||
|
if (ret == SD_SUCCESS &&
|
||||||
|
reqCtrl != NULL &&
|
||||||
|
reqCtrl->u.getvar.resp_info != NULL &&
|
||||||
|
reqCtrl->u.getvar.resp_info->type_spec.data != NULL &&
|
||||||
|
reqCtrl->u.getvar.resp_info->type_spec.len > 0)
|
||||||
|
{
|
||||||
|
type_id = mvl_type_id_create(
|
||||||
|
NULL,
|
||||||
|
reqCtrl->u.getvar.resp_info->type_spec.data,
|
||||||
|
reqCtrl->u.getvar.resp_info->type_spec.len);
|
||||||
|
|
||||||
|
printf("[GETVAR] create type_id=%d len=%d\n",
|
||||||
|
type_id,
|
||||||
|
reqCtrl->u.getvar.resp_info->type_spec.len);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
printf("[GETVAR] failed dom=%s var=%s ret=0x%X\n",
|
||||||
|
dom_name, var_name, ret);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
mvl_free_req_ctrl (reqCtrl); /* Done with request struct */
|
//只有 reqCtrl 非空才释放
|
||||||
|
if (reqCtrl != NULL)mvl_free_req_ctrl (reqCtrl); /* Done with request struct */
|
||||||
return (type_id);
|
return (type_id);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1683,20 +1735,20 @@ static ST_VOID *my_realloc_err (ST_VOID *old, ST_UINT size)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////
|
||||||
//#define MAX_FILE_HANDLE_NUM (256)
|
#define MAX_FILE_HANDLE_NUM (256)
|
||||||
//static FILE *fp_arr[MAX_FILE_HANDLE_NUM];
|
static FILE *fp_arr[MAX_FILE_HANDLE_NUM];
|
||||||
//static ST_INT32 cur_handle = 0;
|
static ST_INT32 cur_handle = 0;
|
||||||
//ST_INT32 set_file_pointer( FILE *fp)
|
ST_INT32 set_file_pointer( FILE *fp)
|
||||||
//{
|
{
|
||||||
// ST_INT32 the_handle = cur_handle;
|
ST_INT32 the_handle = cur_handle;
|
||||||
// fp_arr[cur_handle++] = fp;
|
fp_arr[cur_handle++] = fp;
|
||||||
// cur_handle %= MAX_FILE_HANDLE_NUM;
|
cur_handle %= MAX_FILE_HANDLE_NUM;
|
||||||
// return the_handle;
|
return the_handle;
|
||||||
//}
|
}
|
||||||
//FILE* get_file_pointer(ST_INT32 handle)
|
FILE* get_file_pointer(ST_INT32 handle)
|
||||||
//{
|
{
|
||||||
// return fp_arr[handle];
|
return fp_arr[handle];
|
||||||
//}
|
}
|
||||||
///////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
#if (MMS_FOPEN_EN & RESP_EN)
|
#if (MMS_FOPEN_EN & RESP_EN)
|
||||||
@@ -1705,39 +1757,39 @@ static ST_VOID *my_realloc_err (ST_VOID *old, ST_UINT size)
|
|||||||
/************************************************************************/
|
/************************************************************************/
|
||||||
ST_VOID u_mvl_fopen_ind (MVL_IND_PEND *indCtrl)
|
ST_VOID u_mvl_fopen_ind (MVL_IND_PEND *indCtrl)
|
||||||
{
|
{
|
||||||
//FILE *fp;
|
FILE *fp;
|
||||||
//FOPEN_RESP_INFO resp_info;
|
FOPEN_RESP_INFO resp_info;
|
||||||
//struct stat stat_buf;
|
struct stat stat_buf;
|
||||||
|
|
||||||
//fp = fopen (indCtrl->u.fopen.filename, "rb"); /* CRITICAL: use "b" flag for binary transfer*/
|
fp = fopen (indCtrl->u.fopen.filename, "rb"); /* CRITICAL: use "b" flag for binary transfer*/
|
||||||
//if (fp == NULL)
|
if (fp == NULL)
|
||||||
// {
|
{
|
||||||
// _mplas_err_resp (indCtrl,11,6); /* File-access denied */
|
_mplas_err_resp (indCtrl,11,6); /* File-access denied */
|
||||||
// return;
|
return;
|
||||||
// }
|
}
|
||||||
//if (fseek (fp, indCtrl->u.fopen.init_pos, SEEK_SET))
|
if (fseek (fp, indCtrl->u.fopen.init_pos, SEEK_SET))
|
||||||
// {
|
{
|
||||||
// _mplas_err_resp (indCtrl,11,5); /* Position invalid */
|
_mplas_err_resp (indCtrl,11,5); /* Position invalid */
|
||||||
// return;
|
return;
|
||||||
// }
|
}
|
||||||
|
|
||||||
///* WARNING: this only works if (FILE *) is a 32-bit pointer. */
|
/* WARNING: this only works if (FILE *) is a 32-bit pointer. */
|
||||||
//resp_info.frsmid = set_file_pointer(fp); //(ST_INT32) fp;
|
resp_info.frsmid = set_file_pointer(fp); //(ST_INT32) fp;
|
||||||
|
|
||||||
//if (fstat (fileno (fp), &stat_buf))
|
if (fstat (fileno (fp), &stat_buf))
|
||||||
// { /* Can't get file size or time */
|
{ /* Can't get file size or time */
|
||||||
// _mplas_err_resp (indCtrl,11,0); /* File Problem, Other */
|
_mplas_err_resp (indCtrl,11,0); /* File Problem, Other */
|
||||||
// return;
|
return;
|
||||||
// }
|
}
|
||||||
//else
|
else
|
||||||
// {
|
{
|
||||||
// resp_info.ent.fsize = stat_buf.st_size;
|
resp_info.ent.fsize = stat_buf.st_size;
|
||||||
// resp_info.ent.mtimpres = SD_TRUE;
|
resp_info.ent.mtimpres = SD_TRUE;
|
||||||
// resp_info.ent.mtime = stat_buf.st_mtime;
|
resp_info.ent.mtime = stat_buf.st_mtime;
|
||||||
// }
|
}
|
||||||
|
|
||||||
//indCtrl->u.fopen.resp_info = &resp_info;
|
indCtrl->u.fopen.resp_info = &resp_info;
|
||||||
//mplas_fopen_resp (indCtrl);
|
mplas_fopen_resp (indCtrl);
|
||||||
}
|
}
|
||||||
#endif /* MMS_FOPEN_EN & RESP_EN */
|
#endif /* MMS_FOPEN_EN & RESP_EN */
|
||||||
|
|
||||||
@@ -1748,31 +1800,31 @@ ST_VOID u_mvl_fopen_ind (MVL_IND_PEND *indCtrl)
|
|||||||
/************************************************************************/
|
/************************************************************************/
|
||||||
ST_VOID u_mvl_fread_ind (MVL_IND_PEND *indCtrl)
|
ST_VOID u_mvl_fread_ind (MVL_IND_PEND *indCtrl)
|
||||||
{
|
{
|
||||||
//FILE *fp;
|
FILE *fp;
|
||||||
//ST_UCHAR *tmp_buf;
|
ST_UCHAR *tmp_buf;
|
||||||
//MVLAS_FREAD_CTRL *fread_ctrl = &indCtrl->u.fread;
|
MVLAS_FREAD_CTRL *fread_ctrl = &indCtrl->u.fread;
|
||||||
//FREAD_RESP_INFO resp_info;
|
FREAD_RESP_INFO resp_info;
|
||||||
|
|
||||||
//fp = get_file_pointer(fread_ctrl->req_info->frsmid);// (FILE *) fread_ctrl->req_info->frsmid;
|
fp = get_file_pointer(fread_ctrl->req_info->frsmid);// (FILE *) fread_ctrl->req_info->frsmid;
|
||||||
///* Do NOT read more than "max_size". */
|
/* Do NOT read more than "max_size". */
|
||||||
//tmp_buf = (ST_UCHAR *) chk_malloc (fread_ctrl->max_size);
|
tmp_buf = (ST_UCHAR *) chk_malloc (fread_ctrl->max_size);
|
||||||
|
|
||||||
//resp_info.fd_len = fread (tmp_buf, 1, fread_ctrl->max_size, fp);
|
resp_info.fd_len = fread (tmp_buf, 1, fread_ctrl->max_size, fp);
|
||||||
//if (resp_info.fd_len == 0 && ferror (fp))
|
if (resp_info.fd_len == 0 && ferror (fp))
|
||||||
// {
|
{
|
||||||
// _mplas_err_resp (indCtrl, 3, 0);
|
_mplas_err_resp (indCtrl, 3, 0);
|
||||||
// return;
|
return;
|
||||||
// }
|
}
|
||||||
|
|
||||||
//resp_info.filedata = tmp_buf;
|
resp_info.filedata = tmp_buf;
|
||||||
//if (resp_info.fd_len == fread_ctrl->max_size)
|
if (resp_info.fd_len == fread_ctrl->max_size)
|
||||||
// resp_info.more_follows = SD_TRUE;
|
resp_info.more_follows = SD_TRUE;
|
||||||
//else
|
else
|
||||||
// resp_info.more_follows = SD_FALSE;
|
resp_info.more_follows = SD_FALSE;
|
||||||
|
|
||||||
//fread_ctrl->resp_info = &resp_info;
|
fread_ctrl->resp_info = &resp_info;
|
||||||
//mplas_fread_resp (indCtrl);
|
mplas_fread_resp (indCtrl);
|
||||||
//chk_free (tmp_buf); /* Temporary buffer */
|
chk_free (tmp_buf); /* Temporary buffer */
|
||||||
}
|
}
|
||||||
#endif /* #if (MMS_FREAD_EN & RESP_EN) */
|
#endif /* #if (MMS_FREAD_EN & RESP_EN) */
|
||||||
|
|
||||||
@@ -1782,15 +1834,15 @@ ST_VOID u_mvl_fread_ind (MVL_IND_PEND *indCtrl)
|
|||||||
/************************************************************************/
|
/************************************************************************/
|
||||||
ST_VOID u_mvl_fclose_ind (MVL_IND_PEND *indCtrl)
|
ST_VOID u_mvl_fclose_ind (MVL_IND_PEND *indCtrl)
|
||||||
{
|
{
|
||||||
//FILE *fp;
|
FILE *fp;
|
||||||
//MVLAS_FCLOSE_CTRL *fclose_ctrl = &indCtrl->u.fclose;
|
MVLAS_FCLOSE_CTRL *fclose_ctrl = &indCtrl->u.fclose;
|
||||||
|
|
||||||
//fp = get_file_pointer(fclose_ctrl->req_info->frsmid);//(FILE *) fclose_ctrl->req_info->frsmid;
|
fp = get_file_pointer(fclose_ctrl->req_info->frsmid);//(FILE *) fclose_ctrl->req_info->frsmid;
|
||||||
|
|
||||||
//if (fclose (fp))
|
if (fclose (fp))
|
||||||
// _mplas_err_resp (indCtrl, 11, 0); /* File problem, other */
|
_mplas_err_resp (indCtrl, 11, 0); /* File problem, other */
|
||||||
//else
|
else
|
||||||
// mplas_fclose_resp (indCtrl);
|
mplas_fclose_resp (indCtrl);
|
||||||
}
|
}
|
||||||
#endif /* #if (MMS_FCLOSE_EN & RESP_EN) */
|
#endif /* #if (MMS_FCLOSE_EN & RESP_EN) */
|
||||||
|
|
||||||
@@ -1945,6 +1997,295 @@ MVL_REQ_PEND *reqCtrl;
|
|||||||
return (ret);
|
return (ret);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//lnk20260508添加重启装置函数
|
||||||
|
int BuildResetDomName(ied_usr_t *ied_usr, char *domName, size_t domNameSize)
|
||||||
|
{
|
||||||
|
if (ied_usr == NULL || domName == NULL || domNameSize == 0)
|
||||||
|
return -1;
|
||||||
|
|
||||||
|
domName[0] = '\0';
|
||||||
|
|
||||||
|
XmlConfigC cfg1;
|
||||||
|
memset(&cfg1, 0, sizeof(cfg1));
|
||||||
|
|
||||||
|
if (get_xml_config_by_dev_type(ied_usr->dev_type, &cfg1))
|
||||||
|
{
|
||||||
|
printf("========== XmlConfigC dump ==========\n");
|
||||||
|
printf("IEDControl = '%s'\n", cfg1.IEDControl);
|
||||||
|
printf("IEDname = '%s'\n", cfg1.IEDname);
|
||||||
|
printf("LDevicePrefix = '%s'\n", cfg1.LDevicePrefix);
|
||||||
|
printf("=====================================\n");
|
||||||
|
|
||||||
|
if (cfg1.IEDControl[0] != '\0')
|
||||||
|
{
|
||||||
|
snprintf(domName, domNameSize, "%s", cfg1.IEDControl);
|
||||||
|
printf("[RESET] use cfg1.IEDControl=%s\n", domName);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (ied_usr->LD_info && ied_usr->LD_info[0].LD_name)
|
||||||
|
{
|
||||||
|
snprintf(domName, domNameSize, "%s", ied_usr->LD_info[0].LD_name);
|
||||||
|
|
||||||
|
int len = strlen(domName);
|
||||||
|
if (len > 0 && isdigit(domName[len - 1]))
|
||||||
|
domName[len - 1] = '0';
|
||||||
|
|
||||||
|
printf("[RESET] use LD_name domName=%s\n", domName);
|
||||||
|
|
||||||
|
DIY_WARNLOG_CODE(ied_usr->terminal_id, 1, LOG_CODE_FILE_CONTROL,
|
||||||
|
"【WARN】未取到 IEDControl 信息,使用 LD_name=%s terminal_id=%s",
|
||||||
|
domName, ied_usr->terminal_id);
|
||||||
|
|
||||||
|
return -2;
|
||||||
|
}
|
||||||
|
|
||||||
|
snprintf(domName, domNameSize, "%s", "PQMonitorPQM0");
|
||||||
|
printf("[RESET] use default domName=%s\n", domName);
|
||||||
|
DIY_ERRORLOG_CODE(ied_usr->terminal_id, 1, LOG_CODE_FILE_CONTROL,
|
||||||
|
"【ERROR】未取到 LD 信息,使用默认 domName=%s terminal_id=%s",
|
||||||
|
domName, ied_usr->terminal_id);
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
static ST_INT ledrs_var_type_create(MVL_NET_INFO* net_info,
|
||||||
|
OBJECT_NAME* varObj,
|
||||||
|
ST_INT timeOut)
|
||||||
|
{
|
||||||
|
MVL_REQ_PEND* reqCtrl;
|
||||||
|
GETVAR_REQ_INFO getvar_req;
|
||||||
|
VAR_ACC_TSPEC* type_spec;
|
||||||
|
ST_INT type_id = -1;
|
||||||
|
ST_RET ret;
|
||||||
|
|
||||||
|
memset(&getvar_req, 0, sizeof(getvar_req));
|
||||||
|
|
||||||
|
getvar_req.req_tag = GETVAR_NAME;
|
||||||
|
getvar_req.name = *varObj;
|
||||||
|
|
||||||
|
ret = mvla_getvar(net_info, &getvar_req, &reqCtrl);
|
||||||
|
|
||||||
|
if (ret == SD_SUCCESS)
|
||||||
|
ret = waitReqDone(reqCtrl, timeOut);
|
||||||
|
|
||||||
|
if (ret == SD_SUCCESS)
|
||||||
|
{
|
||||||
|
type_spec = &reqCtrl->u.getvar.resp_info->type_spec;
|
||||||
|
|
||||||
|
type_id = mvl_type_id_create(NULL,
|
||||||
|
type_spec->data,
|
||||||
|
type_spec->len);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (reqCtrl)
|
||||||
|
mvl_free_req_ctrl(reqCtrl);
|
||||||
|
|
||||||
|
return type_id;
|
||||||
|
}
|
||||||
|
static ST_INT create_oper_type_id(MVL_NET_INFO *net_info,
|
||||||
|
ST_CHAR *domName,
|
||||||
|
const char *ctlName,
|
||||||
|
ST_INT timeOut)
|
||||||
|
{
|
||||||
|
OBJECT_NAME obj;
|
||||||
|
ST_CHAR varName[MAX_IDENT_LEN + 1];
|
||||||
|
|
||||||
|
if (net_info == NULL || domName == NULL || ctlName == NULL)
|
||||||
|
return -1;
|
||||||
|
|
||||||
|
memset(&obj, 0, sizeof(obj));
|
||||||
|
|
||||||
|
apr_snprintf(varName,
|
||||||
|
sizeof(varName),
|
||||||
|
"LLN0$%s",
|
||||||
|
ctlName);
|
||||||
|
|
||||||
|
obj.object_tag = DOM_SPEC;
|
||||||
|
obj.domain_id = domName;
|
||||||
|
obj.obj_name.vmd_spec = varName;
|
||||||
|
|
||||||
|
printf("[CTRL_INIT] create type dom=%s var=%s\n",
|
||||||
|
domName, varName);
|
||||||
|
|
||||||
|
return ledrs_var_type_create(net_info, &obj, timeOut);
|
||||||
|
}
|
||||||
|
void InitLedrsOperTypeForChannel(chnl_usr_t *chnl_usr)
|
||||||
|
{
|
||||||
|
printf("[CTRL_INIT] enter\n");
|
||||||
|
|
||||||
|
if (chnl_usr == NULL || chnl_usr->chnl == NULL ||
|
||||||
|
chnl_usr->chnl->ied == NULL || chnl_usr->net_info == NULL)
|
||||||
|
{
|
||||||
|
printf("[CTRL_INIT] invalid chnl_usr\n");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
ied_t *ied = chnl_usr->chnl->ied;
|
||||||
|
ied_usr_t *ied_usr = GET_IEDEXT_ADDR(ied);
|
||||||
|
|
||||||
|
if (ied_usr == NULL || ied_usr->LD_info == NULL)
|
||||||
|
{
|
||||||
|
printf("[CTRL_INIT] invalid ied_usr or LD_info\n");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
printf("[CTRL_INIT] current inited=%d ledrs=%d reboot=%d reset=%d\n",
|
||||||
|
(int)ied_usr->oper_type_cache.inited,
|
||||||
|
ied_usr->oper_type_cache.ledrs_oper_type_id,
|
||||||
|
ied_usr->oper_type_cache.reboot_oper_type_id,
|
||||||
|
ied_usr->oper_type_cache.reset_oper_type_id);
|
||||||
|
|
||||||
|
if (ied_usr->oper_type_cache.inited == SD_TRUE)
|
||||||
|
{
|
||||||
|
printf("[CTRL_INIT] already inited\n");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
char domName[256] = {0};
|
||||||
|
|
||||||
|
BuildResetDomName(ied_usr,
|
||||||
|
domName,
|
||||||
|
sizeof(domName));
|
||||||
|
|
||||||
|
printf("[CTRL_INIT] final dom=%s\n", domName);
|
||||||
|
|
||||||
|
ied_usr->oper_type_cache.ledrs_oper_type_id =
|
||||||
|
create_oper_type_id(chnl_usr->net_info,
|
||||||
|
domName,
|
||||||
|
"CO$LEDRs$Oper",
|
||||||
|
g_pt61850app->mmsOpTimeout);
|
||||||
|
|
||||||
|
printf("[CTRL_INIT] LEDRs type_id=%d\n",
|
||||||
|
ied_usr->oper_type_cache.ledrs_oper_type_id);
|
||||||
|
|
||||||
|
ied_usr->oper_type_cache.reboot_oper_type_id =
|
||||||
|
create_oper_type_id(chnl_usr->net_info,
|
||||||
|
domName,
|
||||||
|
"CO$Reboot$Oper",
|
||||||
|
g_pt61850app->mmsOpTimeout);
|
||||||
|
|
||||||
|
printf("[CTRL_INIT] Reboot type_id=%d\n",
|
||||||
|
ied_usr->oper_type_cache.reboot_oper_type_id);
|
||||||
|
|
||||||
|
ied_usr->oper_type_cache.reset_oper_type_id =
|
||||||
|
create_oper_type_id(chnl_usr->net_info,
|
||||||
|
domName,
|
||||||
|
"ST$Mod$stVal",
|
||||||
|
g_pt61850app->mmsOpTimeout);
|
||||||
|
|
||||||
|
printf("[CTRL_INIT] Reset type_id=%d\n",
|
||||||
|
ied_usr->oper_type_cache.reset_oper_type_id);
|
||||||
|
|
||||||
|
/* 无论成功失败,都不再重复初始化 */
|
||||||
|
ied_usr->oper_type_cache.inited = SD_TRUE;
|
||||||
|
|
||||||
|
printf("[CTRL_INIT] finish inited=%d\n",
|
||||||
|
(int)ied_usr->oper_type_cache.inited);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
ST_RET write_common_oper(chnl_usr_t *chnl_usr,
|
||||||
|
ST_CHAR *domName,
|
||||||
|
const char *ctlName,
|
||||||
|
ST_INT oper_type_id,
|
||||||
|
ST_INT timeOut)
|
||||||
|
{
|
||||||
|
if (chnl_usr == NULL ||
|
||||||
|
chnl_usr->net_info == NULL ||
|
||||||
|
domName == NULL ||
|
||||||
|
ctlName == NULL ||
|
||||||
|
oper_type_id < 0)
|
||||||
|
{
|
||||||
|
printf("[OPER_WRITE] invalid param\n");
|
||||||
|
return SD_FAILURE;
|
||||||
|
}
|
||||||
|
|
||||||
|
ST_CHAR varName[MAX_IDENT_LEN + 1];
|
||||||
|
apr_snprintf(varName,
|
||||||
|
sizeof(varName),
|
||||||
|
"LLN0$%s",
|
||||||
|
ctlName);
|
||||||
|
|
||||||
|
Control_Oper_t oper;
|
||||||
|
memset(&oper, 0, sizeof(oper));
|
||||||
|
|
||||||
|
oper.ctlVal = SD_TRUE;
|
||||||
|
oper.origin.orCat = 3;
|
||||||
|
oper.origin.orIdent.len = 0;
|
||||||
|
oper.ctlNum = 1;
|
||||||
|
u_get_current_utc_time(&oper.T);
|
||||||
|
oper.Test = SD_FALSE;
|
||||||
|
oper.Check[0] = 0x00;
|
||||||
|
oper.Check[1] = 0x00;
|
||||||
|
|
||||||
|
if ((int)sizeof(Control_Oper_t) !=
|
||||||
|
mvl_type_ctrl[oper_type_id].data_size)
|
||||||
|
{
|
||||||
|
printf("[OPER_WRITE] SIZE MISMATCH ctl=%s local=%d runtime=%d\n",
|
||||||
|
ctlName,
|
||||||
|
(int)sizeof(Control_Oper_t),
|
||||||
|
mvl_type_ctrl[oper_type_id].data_size);
|
||||||
|
return SD_FAILURE;
|
||||||
|
}
|
||||||
|
|
||||||
|
printf("[OPER_WRITE] dom=%s var=%s type_id=%d\n",
|
||||||
|
domName, varName, oper_type_id);
|
||||||
|
|
||||||
|
return mms_named_var_write(chnl_usr->net_info,
|
||||||
|
varName,
|
||||||
|
DOM_SPEC,
|
||||||
|
domName,
|
||||||
|
oper_type_id,
|
||||||
|
(ST_CHAR *)&oper,
|
||||||
|
timeOut);
|
||||||
|
}
|
||||||
|
|
||||||
|
ST_RET mms_conclude_disconnect(MVL_NET_INFO *net_info, ST_INT timeOut)
|
||||||
|
{
|
||||||
|
MVL_REQ_PEND *reqCtrl = NULL;
|
||||||
|
ST_RET ret;
|
||||||
|
|
||||||
|
if (net_info == NULL)
|
||||||
|
return SD_FAILURE;
|
||||||
|
|
||||||
|
printf("[RESET] before mvl_concl\n");
|
||||||
|
|
||||||
|
ret = mvl_concl(net_info, &reqCtrl);
|
||||||
|
|
||||||
|
printf("[RESET] after mvl_concl ret=0x%X reqCtrl=%p\n",
|
||||||
|
ret, reqCtrl);
|
||||||
|
|
||||||
|
if (ret == SD_SUCCESS && reqCtrl != NULL)
|
||||||
|
{
|
||||||
|
ret = waitReqDone(reqCtrl, timeOut);
|
||||||
|
|
||||||
|
printf("[RESET] conclude wait ret=0x%X\n", ret);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (reqCtrl != NULL)
|
||||||
|
mvl_free_req_ctrl(reqCtrl);
|
||||||
|
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
|
ST_RET write_mod_stval(chnl_usr_t *chnl_usr,
|
||||||
|
ST_CHAR *domName,
|
||||||
|
ST_INT timeOut)
|
||||||
|
{
|
||||||
|
ST_CHAR varName[MAX_IDENT_LEN + 1];
|
||||||
|
ST_INT16 value = 88;
|
||||||
|
|
||||||
|
apr_snprintf(varName, sizeof(varName), "LLN0$ST$Mod$stVal");
|
||||||
|
|
||||||
|
return mms_named_var_write(chnl_usr->net_info,
|
||||||
|
varName,
|
||||||
|
DOM_SPEC,
|
||||||
|
domName,
|
||||||
|
14, //int
|
||||||
|
(ST_CHAR *)&value,
|
||||||
|
timeOut);
|
||||||
|
}
|
||||||
|
|
||||||
/************************************************************************/
|
/************************************************************************/
|
||||||
/* init_log_cfg */
|
/* init_log_cfg */
|
||||||
|
|||||||
@@ -197,7 +197,7 @@ apr_status_t init_rdb()
|
|||||||
//char buf[256];
|
//char buf[256];
|
||||||
//format_log_msg(buf,sizeof(buf),"前置的%s%d号进程调用web台账接口失败", get_front_msg_from_subdir(), g_front_seg_index);
|
//format_log_msg(buf,sizeof(buf),"前置的%s%d号进程调用web台账接口失败", get_front_msg_from_subdir(), g_front_seg_index);
|
||||||
//log_error("process", buf);
|
//log_error("process", buf);
|
||||||
DIY_ERRORLOG_CODE("process",LOG_CODE_LEDGER,"【ERROR】前置的%s%d号进程调用web台账接口失败", get_front_msg_from_subdir(), g_front_seg_index);
|
DIY_ERRORLOG_CODE("process",0,LOG_CODE_LEDGER,"【ERROR】前置的%s%d号进程调用web台账接口失败", get_front_msg_from_subdir(), g_front_seg_index);
|
||||||
|
|
||||||
return rv;
|
return rv;
|
||||||
}
|
}
|
||||||
@@ -212,7 +212,7 @@ apr_status_t init_rdb()
|
|||||||
//char buf[256];
|
//char buf[256];
|
||||||
//format_log_msg(buf,sizeof(buf),"前置的%s%d号进程调用web模型接口失败", get_front_msg_from_subdir(), g_front_seg_index);
|
//format_log_msg(buf,sizeof(buf),"前置的%s%d号进程调用web模型接口失败", get_front_msg_from_subdir(), g_front_seg_index);
|
||||||
//log_error("process", buf);
|
//log_error("process", buf);
|
||||||
DIY_ERRORLOG_CODE("process",LOG_CODE_ICD_AND_DOWNLOAD,"【ERROR】前置的%s%d号进程调用web模型接口失败", get_front_msg_from_subdir(), g_front_seg_index);
|
DIY_ERRORLOG_CODE("process",0,LOG_CODE_ICD_AND_DOWNLOAD,"【ERROR】前置的%s%d号进程调用web模型接口失败", get_front_msg_from_subdir(), g_front_seg_index);
|
||||||
|
|
||||||
return rv;
|
return rv;
|
||||||
}
|
}
|
||||||
@@ -223,7 +223,7 @@ apr_status_t init_rdb()
|
|||||||
if (rv != APR_SUCCESS) {
|
if (rv != APR_SUCCESS) {
|
||||||
echo_errg("Failed to parse report log define ini file! \n");
|
echo_errg("Failed to parse report log define ini file! \n");
|
||||||
|
|
||||||
DIY_ERRORLOG_CODE("process",LOG_CODE_RPTINIT,"【ERROR】前置的%s%d号进程报告初始化失败", get_front_msg_from_subdir(), g_front_seg_index);
|
DIY_ERRORLOG_CODE("process",0,LOG_CODE_RPTINIT,"【ERROR】前置的%s%d号进程报告初始化失败", get_front_msg_from_subdir(), g_front_seg_index);
|
||||||
|
|
||||||
return rv;
|
return rv;
|
||||||
}
|
}
|
||||||
@@ -232,7 +232,7 @@ apr_status_t init_rdb()
|
|||||||
if (app_get_private_config(g_my_conf_fname) != APR_SUCCESS) {
|
if (app_get_private_config(g_my_conf_fname) != APR_SUCCESS) {
|
||||||
echo_errg("Failed when processing private configuration\n");
|
echo_errg("Failed when processing private configuration\n");
|
||||||
|
|
||||||
DIY_ERRORLOG_CODE("process",LOG_CODE_OTHER,"【ERROR】前置的%s%d号进程读取mms配置失败", get_front_msg_from_subdir(), g_front_seg_index);
|
DIY_ERRORLOG_CODE("process",0,LOG_CODE_OTHER,"【ERROR】前置的%s%d号进程读取mms配置失败", get_front_msg_from_subdir(), g_front_seg_index);
|
||||||
|
|
||||||
return APR_EGENERAL;
|
return APR_EGENERAL;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -320,6 +320,17 @@ struct LD_info_t{
|
|||||||
//录波
|
//录波
|
||||||
};
|
};
|
||||||
|
|
||||||
|
//装置控制初始化
|
||||||
|
typedef struct
|
||||||
|
{
|
||||||
|
ST_BOOLEAN inited;
|
||||||
|
|
||||||
|
ST_INT ledrs_oper_type_id;
|
||||||
|
ST_INT reboot_oper_type_id;
|
||||||
|
ST_INT reset_oper_type_id;
|
||||||
|
|
||||||
|
} MMS_OPER_TYPE_CACHE;
|
||||||
|
|
||||||
struct ied_usr_t{
|
struct ied_usr_t{
|
||||||
LD_info_t *LD_info; /**< LD数组 */
|
LD_info_t *LD_info; /**< LD数组 */
|
||||||
int dev_idx; /**< 设备序号 */
|
int dev_idx; /**< 设备序号 */
|
||||||
@@ -346,6 +357,8 @@ struct ied_usr_t{
|
|||||||
|
|
||||||
bool lastconnectstat;//lnk20250704
|
bool lastconnectstat;//lnk20250704
|
||||||
bool has_logged_disconnect;//lnk20250704
|
bool has_logged_disconnect;//lnk20250704
|
||||||
|
|
||||||
|
MMS_OPER_TYPE_CACHE oper_type_cache;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
@@ -533,6 +546,35 @@ int parse_file_names_by_fltnum(int fltnum, char* domname, char** filenames, int
|
|||||||
QVVR_t* find_qvvr_by_trig_tm(LD_info_t* LD_info,long long trig_tm);
|
QVVR_t* find_qvvr_by_trig_tm(LD_info_t* LD_info,long long trig_tm);
|
||||||
|
|
||||||
void HandleFileDirReqForChannel(chnl_usr_t *chnl_usr);
|
void HandleFileDirReqForChannel(chnl_usr_t *chnl_usr);
|
||||||
|
void InitLedrsOperTypeForChannel(chnl_usr_t *chnl_usr);
|
||||||
|
|
||||||
|
//lnk20250508添加重启装置函数
|
||||||
|
//根据抓包显示oper的data结构有6个item
|
||||||
|
typedef struct
|
||||||
|
{
|
||||||
|
ST_BOOLEAN ctlVal;
|
||||||
|
|
||||||
|
struct
|
||||||
|
{
|
||||||
|
ST_INT16 orCat;
|
||||||
|
|
||||||
|
struct
|
||||||
|
{
|
||||||
|
ST_INT16 len;
|
||||||
|
ST_UINT8 data[64];
|
||||||
|
} orIdent;
|
||||||
|
|
||||||
|
} origin;
|
||||||
|
|
||||||
|
ST_UINT32 ctlNum;
|
||||||
|
|
||||||
|
MMS_UTC_TIME T;
|
||||||
|
|
||||||
|
ST_BOOLEAN Test;
|
||||||
|
|
||||||
|
ST_UCHAR Check[2];
|
||||||
|
|
||||||
|
} Control_Oper_t;
|
||||||
|
|
||||||
//////////////////////////////////////////////////////////////////
|
//////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
|||||||
@@ -535,13 +535,6 @@ void processQVVR_end(LD_info_t* LD_info)
|
|||||||
ied_usr_t *ied_usr = GET_IEDEXT_ADDR(ied);
|
ied_usr_t *ied_usr = GET_IEDEXT_ADDR(ied);
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
//监测点日志的key,lnk20250526
|
|
||||||
char full_key_m_c[256]; // 分配足够空间
|
|
||||||
char full_key_m_d[256]; // 分配足够空间
|
|
||||||
snprintf(full_key_m_c, sizeof(full_key_m_c), "monitor.%s.COM", LD_info->mp_id);
|
|
||||||
snprintf(full_key_m_d, sizeof(full_key_m_d), "monitor.%s.DATA", LD_info->mp_id);
|
|
||||||
//监测点日志的key,lnk20250526
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
int find_paired = FALSE;
|
int find_paired = FALSE;
|
||||||
int i;
|
int i;
|
||||||
@@ -562,11 +555,11 @@ void processQVVR_end(LD_info_t* LD_info)
|
|||||||
long long utc_or_beijing;
|
long long utc_or_beijing;
|
||||||
if(strcmp(cfg.UnitOfTimeUnit, "1") == 0){//持续时间上送的是秒1还是毫秒0
|
if(strcmp(cfg.UnitOfTimeUnit, "1") == 0){//持续时间上送的是秒1还是毫秒0
|
||||||
s_or_ms = 0.001;
|
s_or_ms = 0.001;
|
||||||
//DIY_WARNLOG_CODE(full_key_m_c,LOG_CODE_TRANSIENT,"【WARN】监测点:%s - id:%s上送的暂态持续时间单位是秒,监测点对应装置型号:%s",LD_info->name,LD_info->mp_id,ied_usr->dev_type);
|
//DIY_WARNLOG_CODE(LD_info->mp_id,2,LOG_CODE_TRANSIENT,"【WARN】监测点:%s - id:%s上送的暂态持续时间单位是秒,监测点对应装置型号:%s",LD_info->name,LD_info->mp_id,ied_usr->dev_type);
|
||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
s_or_ms = 1.0;
|
s_or_ms = 1.0;
|
||||||
//DIY_WARNLOG_CODE(full_key_m_c,LOG_CODE_TRANSIENT,"【WARN】监测点:%s - id:%s上送的暂态持续时间单位是毫秒,监测点对应装置型号:%s",LD_info->name,LD_info->mp_id,ied_usr->dev_type);
|
//DIY_WARNLOG_CODE(LD_info->mp_id,2,LOG_CODE_TRANSIENT,"【WARN】监测点:%s - id:%s上送的暂态持续时间单位是毫秒,监测点对应装置型号:%s",LD_info->name,LD_info->mp_id,ied_usr->dev_type);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(strcmp(cfg.ValueOfTimeUnit, "utc") == 0){//上送的是utc还是北京
|
if(strcmp(cfg.ValueOfTimeUnit, "utc") == 0){//上送的是utc还是北京
|
||||||
@@ -635,7 +628,7 @@ void processQVVR_end(LD_info_t* LD_info)
|
|||||||
|
|
||||||
//匹配后再发qvvr,起始时间要填暂态触发的时间,就是第一次事件上送时只有时间没有值的那个时间
|
//匹配后再发qvvr,起始时间要填暂态触发的时间,就是第一次事件上送时只有时间没有值的那个时间
|
||||||
//mq日志
|
//mq日志
|
||||||
DIY_WARNLOG_CODE(full_key_m_d,LOG_CODE_TRANSIENT,"【WARN】监测点%s - id:%s 发生暂态事件,暂态时间:%lld,暂态持续时间:%f,暂态幅值:%f,暂态类型:%d",LD_info->name,LD_info->mp_id,
|
DIY_WARNLOG_CODE(LD_info->mp_id,2,LOG_CODE_TRANSIENT,"【WARN】监测点%s - id:%s 发生暂态事件,暂态时间:%lld,暂态持续时间:%f,暂态幅值:%f,暂态类型:%d",LD_info->name,LD_info->mp_id,
|
||||||
LD_info->qvvr[LD_info->qvvr_idx].QVVR_time,
|
LD_info->qvvr[LD_info->qvvr_idx].QVVR_time,
|
||||||
LD_info->qvvr[LD_info->qvvr_idx].QVVR_PerTime,
|
LD_info->qvvr[LD_info->qvvr_idx].QVVR_PerTime,
|
||||||
LD_info->qvvr[LD_info->qvvr_idx].QVVR_Amg,
|
LD_info->qvvr[LD_info->qvvr_idx].QVVR_Amg,
|
||||||
@@ -669,10 +662,10 @@ void processQVVR_end(LD_info_t* LD_info)
|
|||||||
|
|
||||||
//mq日志
|
//mq日志
|
||||||
if(strcmp(cfg.UnitOfTimeUnit, "1") == 0){//持续时间上送的是秒1还是毫秒0
|
if(strcmp(cfg.UnitOfTimeUnit, "1") == 0){//持续时间上送的是秒1还是毫秒0
|
||||||
DIY_WARNLOG_CODE(full_key_m_c,LOG_CODE_TRANSIENT,"【WARN】监测点:%s - id:%s记录了一个暂态事件但是没有匹配到事件的发生时间,装置型号:%s 配置的暂态持续时间单位是秒",LD_info->name,LD_info->mp_id,ied_usr->dev_type);
|
DIY_WARNLOG_CODE(LD_info->mp_id,2,LOG_CODE_TRANSIENT,"【WARN】监测点:%s - id:%s记录了一个暂态事件但是没有匹配到事件的发生时间,装置型号:%s 配置的暂态持续时间单位是秒",LD_info->name,LD_info->mp_id,ied_usr->dev_type);
|
||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
DIY_WARNLOG_CODE(full_key_m_c,LOG_CODE_TRANSIENT,"【WARN】监测点:%s - id:%s记录了一个暂态事件但是没有匹配到事件的发生时间,装置型号:%s 配置的暂态持续时间单位是毫秒",LD_info->name,LD_info->mp_id,ied_usr->dev_type);
|
DIY_WARNLOG_CODE(LD_info->mp_id,2,LOG_CODE_TRANSIENT,"【WARN】监测点:%s - id:%s记录了一个暂态事件但是没有匹配到事件的发生时间,装置型号:%s 配置的暂态持续时间单位是毫秒",LD_info->name,LD_info->mp_id,ied_usr->dev_type);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
176
mykafka.ini
Normal file
176
mykafka.ini
Normal file
@@ -0,0 +1,176 @@
|
|||||||
|
[Kafka]
|
||||||
|
BrokerList=
|
||||||
|
EventTopic=
|
||||||
|
KafkaFlag=
|
||||||
|
KafkaListSize=
|
||||||
|
|
||||||
|
RTDataTopic=Real_Time_Data_Topic
|
||||||
|
HisTopic=LN_Topic
|
||||||
|
PSTTopic=LN_Topic
|
||||||
|
PLTTopic=LN_Topic
|
||||||
|
AlmTopic=AlmTopic
|
||||||
|
SngTopic=SngTopic
|
||||||
|
|
||||||
|
[Oracle]
|
||||||
|
OtlType=
|
||||||
|
OtlConnect=
|
||||||
|
OtlFlag=
|
||||||
|
OtlConnectLimit=
|
||||||
|
SqlListSize=
|
||||||
|
|
||||||
|
[Comtrade]
|
||||||
|
NEWESTFlag=
|
||||||
|
|
||||||
|
[SFTP]
|
||||||
|
SFtpFlag=
|
||||||
|
|
||||||
|
[SagSource]
|
||||||
|
UpdateFlag=
|
||||||
|
|
||||||
|
[Unit]
|
||||||
|
UnitOfTime=
|
||||||
|
|
||||||
|
[Recall]
|
||||||
|
JournalTime=
|
||||||
|
recall_lenth=
|
||||||
|
recall_start=
|
||||||
|
recall_dailytime=
|
||||||
|
select_day=
|
||||||
|
|
||||||
|
[screen]
|
||||||
|
ScreenFlag=
|
||||||
|
WebHost=
|
||||||
|
WebPort=
|
||||||
|
ScreenUrl=
|
||||||
|
|
||||||
|
[AccountUpdate]
|
||||||
|
Interval=
|
||||||
|
LastUpdateTime=
|
||||||
|
|
||||||
|
[MultiNode]
|
||||||
|
Interval=
|
||||||
|
|
||||||
|
[CommunicationLog]
|
||||||
|
StatusRecordDuration=
|
||||||
|
AbnormalRecordDuration=
|
||||||
|
|
||||||
|
[Postgres]
|
||||||
|
Database=
|
||||||
|
Username=
|
||||||
|
Password=
|
||||||
|
Schema=
|
||||||
|
Dnsname=
|
||||||
|
TablePrefix=
|
||||||
|
|
||||||
|
[Web]
|
||||||
|
ClientId=
|
||||||
|
ClientSecret=
|
||||||
|
TokenUrl=
|
||||||
|
DeviceUrl=
|
||||||
|
GrantType=
|
||||||
|
|
||||||
|
[Flag]
|
||||||
|
FileFlag=4
|
||||||
|
FrontInst=884d132ac3a01225fcacc8c10da07d09
|
||||||
|
FrontIP=192.168.1.167
|
||||||
|
SendFlag=3
|
||||||
|
RecallOnlyFlag=0
|
||||||
|
|
||||||
|
[Ledger]
|
||||||
|
TerminalStatus="[0]"
|
||||||
|
MonitorStatus="[1,2]"
|
||||||
|
IcdFlag=0
|
||||||
|
IedCount=300
|
||||||
|
|
||||||
|
[Socket]
|
||||||
|
SocketEnable=0
|
||||||
|
SocketPort=13000
|
||||||
|
|
||||||
|
[Http]
|
||||||
|
HttpEnable=0
|
||||||
|
HttpIp=0.0.0.0
|
||||||
|
HttpPort=12000
|
||||||
|
WebDevice=http://192.168.1.68:10202/nodeDevice/nodeDeviceList
|
||||||
|
WebIcd=http://192.168.1.68:10202/icd/icdPathList
|
||||||
|
WebIntegrity=http://192.168.1.68:10202/LineIntegrityData/saveOrUpdateData
|
||||||
|
WebComflag=http://192.168.1.68:10202/dev/updateDevComFlag
|
||||||
|
WebEvent=http://192.168.1.68:10203/event/addEventDetail
|
||||||
|
WebFileupload=http://192.168.1.68:10207/file/upload
|
||||||
|
WebFiledownload=http://192.168.1.68:10207/file/download
|
||||||
|
|
||||||
|
[Oss]
|
||||||
|
OssEndpoint=
|
||||||
|
AccessKeyID=
|
||||||
|
AccessKeySecret=
|
||||||
|
BucketName=
|
||||||
|
|
||||||
|
[FrontNode]
|
||||||
|
Node=
|
||||||
|
|
||||||
|
[MySql]
|
||||||
|
ConStr=
|
||||||
|
|
||||||
|
[InfluxDb]
|
||||||
|
SelectUrl=
|
||||||
|
WriteUrl=
|
||||||
|
|
||||||
|
[RocketMq]
|
||||||
|
producer=Group_producer
|
||||||
|
Ipport=192.168.1.68:9876
|
||||||
|
TESTTopic=TEST_Topic
|
||||||
|
TESTTag=884d132ac3a01225fcacc8c10da07d09
|
||||||
|
TESTKey=Test_Keys
|
||||||
|
Queuenum=4
|
||||||
|
|
||||||
|
Testflag=1
|
||||||
|
Testnum=0
|
||||||
|
Testtype=0
|
||||||
|
TestPort=11000
|
||||||
|
TestList=
|
||||||
|
|
||||||
|
consumer=Group_consumer
|
||||||
|
ConsumerIpport=192.168.1.68:9876
|
||||||
|
ConsumerTopicRT=ask_real_data_topic
|
||||||
|
ConsumerTagRT=884d132ac3a01225fcacc8c10da07d09
|
||||||
|
ConsumerKeyRT=Test_Keys
|
||||||
|
ConsumerAccessKey=rmqroot
|
||||||
|
ConsumerSecretKey=001@#njcnmq
|
||||||
|
ConsumerChannel=
|
||||||
|
ConsumerTopicUD=control_Topic
|
||||||
|
ConsumerTagUD=884d132ac3a01225fcacc8c10da07d09
|
||||||
|
ConsumerKeyUD=Test_Keys
|
||||||
|
ConsumerTopicRC=recall_Topic
|
||||||
|
ConsumerTagRC=884d132ac3a01225fcacc8c10da07d09
|
||||||
|
ConsumerKeyRC=Test_Keys
|
||||||
|
ConsumerTopicSET=process_Topic
|
||||||
|
ConsumerTagSET=884d132ac3a01225fcacc8c10da07d09
|
||||||
|
ConsumerKeySET=Test_Keys
|
||||||
|
ConsumerTopicLOG=ask_log_Topic
|
||||||
|
ConsumerTagLOG=884d132ac3a01225fcacc8c10da07d09
|
||||||
|
ConsumerKeyLOG=Test_Keys
|
||||||
|
ConsumerTopicFILE=File_Topic
|
||||||
|
ConsumerTagFILE=884d132ac3a01225fcacc8c10da07d09
|
||||||
|
ConsumerKeyFILE=Test_Keys
|
||||||
|
|
||||||
|
ConsumerTopicTEST=File_Topic
|
||||||
|
|
||||||
|
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
|
||||||
|
|
||||||
|
[LogRate]
|
||||||
|
ResetSec=3600
|
||||||
|
LimitSec=60
|
||||||
|
KeepAllMs=60000
|
||||||
|
KeepBurstMs=1000
|
||||||
|
KeepBurstCount=60
|
||||||
|
KeepHighFreqCount=10
|
||||||
@@ -1,21 +1,34 @@
|
|||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
#include "../json/mms_json_inter.h"
|
#include "../json/mms_json_inter.h"
|
||||||
#include "../rocketmq/CProducer.h"
|
//#include "../rocketmq/CProducer.h"
|
||||||
#include "../rocketmq/CMessage.h"
|
//#include "../rocketmq/CMessage.h"
|
||||||
#include "../rocketmq/CSendResult.h"
|
//#include "../rocketmq/CSendResult.h"
|
||||||
|
//#include "../rocketmq/CPushConsumer.h"
|
||||||
#include "../rocketmq/CPushConsumer.h"
|
#include "../rocketmq/DefaultMQProducer.h"
|
||||||
|
#include "../rocketmq/MQMessage.h"
|
||||||
|
#include "../rocketmq/SendResult.h"
|
||||||
|
#include "../rocketmq/SessionCredentials.h"
|
||||||
|
#include "../rocketmq/MQMessageExt.h"
|
||||||
|
#include "../rocketmq/ConsumeType.h"
|
||||||
|
#include "../rocketmq/MQMessageListener.h"
|
||||||
|
|
||||||
#include <vector>
|
#include <vector>
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
|
#include <string>
|
||||||
|
|
||||||
|
using namespace rocketmq;
|
||||||
|
|
||||||
/*添加测试函数lnk10-10*/
|
/*添加测试函数lnk10-10*/
|
||||||
void producer_send0();
|
//void producer_send0();
|
||||||
void StartSendMessage(CProducer* producer,const char* strbody);
|
//void StartSendMessage(CProducer* producer,const char* strbody);
|
||||||
void producer_send(const char* strbody);
|
//void producer_send(const char* strbody);
|
||||||
void rocketmq_producer_send(const char* strbody,const char* topic);
|
//void rocketmq_producer_send(const char* strbody,const char* topic);
|
||||||
void rocketmq_StartSendMessage(CProducer* producer,const char* strbody,const char* topic);
|
//void rocketmq_StartSendMessage(CProducer* producer,const char* strbody,const char* topic);
|
||||||
|
void rocketmq_producer_send(const std::string& body,
|
||||||
|
const std::string& topic,
|
||||||
|
const std::string& tags,
|
||||||
|
const std::string& keys);
|
||||||
extern "C" {
|
extern "C" {
|
||||||
void rocketmq_test_rt();
|
void rocketmq_test_rt();
|
||||||
void rocketmq_test_ud();
|
void rocketmq_test_ud();
|
||||||
@@ -32,17 +45,25 @@ extern void my_rocketmq_send(Ckafka_data_t& data);
|
|||||||
void InitializeProducer();
|
void InitializeProducer();
|
||||||
void ShutdownAndDestroyProducer();
|
void ShutdownAndDestroyProducer();
|
||||||
//////////////////////////////////////////////////////消费者
|
//////////////////////////////////////////////////////消费者
|
||||||
void InitializeConsumer(const std::string& consumerName, const std::string& nameServer, const char* topic, const char* tag, const std::string& key);
|
typedef ConsumeStatus (*MessageCallBack)(
|
||||||
void ShutdownAndDestroyConsumer();
|
const MQMessageExt& msg
|
||||||
|
);
|
||||||
|
|
||||||
struct Subscription {
|
struct Subscription {
|
||||||
std::string topic;
|
std::string topic;
|
||||||
std::string tag;
|
std::string tag;
|
||||||
MessageCallBack callback;
|
MessageCallBack callback;
|
||||||
|
|
||||||
Subscription(const std::string& t, const std::string& tg, MessageCallBack cb)
|
Subscription(const std::string& t,
|
||||||
: topic(t), tag(tg), callback(cb) {std::cout << "Subscription topic: " << topic << std::endl;}
|
const std::string& tg,
|
||||||
|
MessageCallBack cb)
|
||||||
|
: topic(t), tag(tg), callback(cb) {}
|
||||||
};
|
};
|
||||||
|
//void InitializeConsumer(const std::string& consumerName, const std::string& nameServer, const char* topic, const char* tag, const std::string& key);
|
||||||
|
void InitializeConsumer(const std::string& consumerName,
|
||||||
|
const std::string& nameServer,
|
||||||
|
const std::vector<Subscription>& subscriptions);
|
||||||
|
void ShutdownAndDestroyConsumer();
|
||||||
|
|
||||||
void rocketmq_consumer_receive(
|
void rocketmq_consumer_receive(
|
||||||
const std::string& consumerName,
|
const std::string& consumerName,
|
||||||
|
|||||||
@@ -24,7 +24,7 @@ for fd_path in /proc/$$/fd/*; do
|
|||||||
done
|
done
|
||||||
|
|
||||||
# 设置日志文件路径
|
# 设置日志文件路径
|
||||||
LOGFILE="$FEP_ENV/dat/log/start_fe.log"
|
LOGFILE="/FeProject/dat/log/start_fe.log"
|
||||||
|
|
||||||
INI_FILE="/FeProject/etc/config/mykafka.ini"
|
INI_FILE="/FeProject/etc/config/mykafka.ini"
|
||||||
|
|
||||||
@@ -315,7 +315,7 @@ handle_reset() {
|
|||||||
# 关闭旧的 comtrade 进程
|
# 关闭旧的 comtrade 进程
|
||||||
#kill_process_by_name "/FeProject/bin/pt61850netd_pqfe -d cfg_soe_comtrade"
|
#kill_process_by_name "/FeProject/bin/pt61850netd_pqfe -d cfg_soe_comtrade"
|
||||||
|
|
||||||
/home/pq/FeProject/boot/stop_fe.sh
|
/FeProject/boot/stop_fe.sh
|
||||||
|
|
||||||
wait_all_exit || exit 1
|
wait_all_exit || exit 1
|
||||||
|
|
||||||
@@ -325,34 +325,34 @@ handle_reset() {
|
|||||||
sleep 5
|
sleep 5
|
||||||
|
|
||||||
# 清空 runtime.cf 中的所有进程配置
|
# 清空 runtime.cf 中的所有进程配置
|
||||||
sed -i '/cfg_stat_data/d' /home/pq/FeProject/etc/runtime.cf
|
sed -i '/cfg_stat_data/d' /FeProject/etc/runtime.cf
|
||||||
sed -i '/cfg_recallhis_data/d' /home/pq/FeProject/etc/runtime.cf
|
sed -i '/cfg_recallhis_data/d' /FeProject/etc/runtime.cf
|
||||||
sed -i '/cfg_3s_data/d' /home/pq/FeProject/etc/runtime.cf
|
sed -i '/cfg_3s_data/d' /FeProject/etc/runtime.cf
|
||||||
sed -i '/cfg_soe_comtrade/d' /home/pq/FeProject/etc/runtime.cf
|
sed -i '/cfg_soe_comtrade/d' /FeProject/etc/runtime.cf
|
||||||
sed -i '/fe_watchdog/d' /home/pq/FeProject/etc/runtime.cf
|
sed -i '/fe_watchdog/d' /FeProject/etc/runtime.cf
|
||||||
|
|
||||||
# 根据进程号添加对应进程配置
|
# 根据进程号添加对应进程配置
|
||||||
if [ "$1" -eq 1 ]; then
|
if [ "$1" -eq 1 ]; then
|
||||||
#看门狗固定放在第一个,防止stop时会把要杀死的进程重启
|
#看门狗固定放在第一个,防止stop时会把要杀死的进程重启
|
||||||
sed -i "2a\\$(printf '/FeProject/bin/ ^ fe_watchdog -m 18192 ^ ^ ^ 1 ^ IGNORE_RESTART ^\n')" /home/pq/FeProject/etc/runtime.cf
|
sed -i "2a\\$(printf '/FeProject/bin/ ^ fe_watchdog -m 18192 ^ ^ ^ 1 ^ IGNORE_RESTART ^\n')" /FeProject/etc/runtime.cf
|
||||||
# 进程号为 1,按固定格式添加
|
# 进程号为 1,按固定格式添加
|
||||||
sed -i "2a\\$(printf '/FeProject/bin/ ^ pt61850netd_pqfe -d cfg_stat_data -s 1_1^ ^ ^ 1 ^ ^\n')" /home/pq/FeProject/etc/runtime.cf
|
sed -i "2a\\$(printf '/FeProject/bin/ ^ pt61850netd_pqfe -d cfg_stat_data -s 1_1^ ^ ^ 1 ^ ^\n')" /FeProject/etc/runtime.cf
|
||||||
sed -i "2a\\$(printf '/FeProject/bin/ ^ pt61850netd_pqfe -d cfg_recallhis_data -s 1_1^ ^ ^ 1 ^ ^\n')" /home/pq/FeProject/etc/runtime.cf
|
sed -i "2a\\$(printf '/FeProject/bin/ ^ pt61850netd_pqfe -d cfg_recallhis_data -s 1_1^ ^ ^ 1 ^ ^\n')" /FeProject/etc/runtime.cf
|
||||||
sed -i "2a\\$(printf '/FeProject/bin/ ^ pt61850netd_pqfe -d cfg_3s_data^ ^ ^ 1 ^ ^\n')" /home/pq/FeProject/etc/runtime.cf
|
sed -i "2a\\$(printf '/FeProject/bin/ ^ pt61850netd_pqfe -d cfg_3s_data^ ^ ^ 1 ^ ^\n')" /FeProject/etc/runtime.cf
|
||||||
sed -i "2a\\$(printf '/FeProject/bin/ ^ pt61850netd_pqfe -d cfg_soe_comtrade^ ^ ^ 1 ^ ^\n')" /home/pq/FeProject/etc/runtime.cf
|
sed -i "2a\\$(printf '/FeProject/bin/ ^ pt61850netd_pqfe -d cfg_soe_comtrade^ ^ ^ 1 ^ ^\n')" /FeProject/etc/runtime.cf
|
||||||
|
|
||||||
else
|
else
|
||||||
#看门狗固定放在第一个,防止stop时会把要杀死的进程重启
|
#看门狗固定放在第一个,防止stop时会把要杀死的进程重启
|
||||||
sed -i "2a\\$(printf '/FeProject/bin/ ^ fe_watchdog -m 18192 ^ ^ ^ 1 ^ IGNORE_RESTART ^\n')" /home/pq/FeProject/etc/runtime.cf
|
sed -i "2a\\$(printf '/FeProject/bin/ ^ fe_watchdog -m 18192 ^ ^ ^ 1 ^ IGNORE_RESTART ^\n')" /FeProject/etc/runtime.cf
|
||||||
# 进程号大于 1,按 -s ${i}_ 格式添加
|
# 进程号大于 1,按 -s ${i}_ 格式添加
|
||||||
for i in $(seq 1 $1); do
|
for i in $(seq 1 $1); do
|
||||||
# 在 runtime.cf 中插入对应的配置行,直接插入变量替换结果
|
# 在 runtime.cf 中插入对应的配置行,直接插入变量替换结果
|
||||||
sed -i "2a/FeProject/bin/ ^ pt61850netd_pqfe -d cfg_stat_data -s ${i}_${1}^ ^ ^ 1 ^ ^" /home/pq/FeProject/etc/runtime.cf
|
sed -i "2a/FeProject/bin/ ^ pt61850netd_pqfe -d cfg_stat_data -s ${i}_${1}^ ^ ^ 1 ^ ^" /FeProject/etc/runtime.cf
|
||||||
sed -i "2a/FeProject/bin/ ^ pt61850netd_pqfe -d cfg_recallhis_data -s ${i}_${1}^ ^ ^ 1 ^ ^" /home/pq/FeProject/etc/runtime.cf
|
sed -i "2a/FeProject/bin/ ^ pt61850netd_pqfe -d cfg_recallhis_data -s ${i}_${1}^ ^ ^ 1 ^ ^" /FeProject/etc/runtime.cf
|
||||||
done
|
done
|
||||||
#以下部分没有多进程
|
#以下部分没有多进程
|
||||||
sed -i "2a\\$(printf '/FeProject/bin/ ^ pt61850netd_pqfe -d cfg_3s_data^ ^ ^ 1 ^ ^\n')" /home/pq/FeProject/etc/runtime.cf
|
sed -i "2a\\$(printf '/FeProject/bin/ ^ pt61850netd_pqfe -d cfg_3s_data^ ^ ^ 1 ^ ^\n')" /FeProject/etc/runtime.cf
|
||||||
sed -i "2a\\$(printf '/FeProject/bin/ ^ pt61850netd_pqfe -d cfg_soe_comtrade^ ^ ^ 1 ^ ^\n')" /home/pq/FeProject/etc/runtime.cf
|
sed -i "2a\\$(printf '/FeProject/bin/ ^ pt61850netd_pqfe -d cfg_soe_comtrade^ ^ ^ 1 ^ ^\n')" /FeProject/etc/runtime.cf
|
||||||
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
@@ -364,16 +364,16 @@ handle_reset() {
|
|||||||
|
|
||||||
# 重新启动服务
|
# 重新启动服务
|
||||||
|
|
||||||
/home/pq/FeProject/boot/start_fe.sh
|
/FeProject/boot/start_fe.sh
|
||||||
|
|
||||||
echo "****** reset all in $1******" >>"$LOGFILE"
|
echo "****** reset all in $1******" >>"$LOGFILE"
|
||||||
elif [ "$2" == "stat" ]; then
|
elif [ "$2" == "stat" ]; then
|
||||||
# 清空 runtime.cf 中包含 cfg_stat_data 的行
|
# 清空 runtime.cf 中包含 cfg_stat_data 的行
|
||||||
sed -i '/cfg_stat_data/d' /home/pq/FeProject/etc/runtime.cf
|
sed -i '/cfg_stat_data/d' /FeProject/etc/runtime.cf
|
||||||
|
|
||||||
# 根据进程号来添加新的进程配置
|
# 根据进程号来添加新的进程配置
|
||||||
for i in $(seq 1 $1); do
|
for i in $(seq 1 $1); do
|
||||||
sed -i "2a/FeProject/bin/ ^ pt61850netd_pqfe -d cfg_stat_data -s ${i}_${1}^ ^ ^ 1 ^ ^" /home/pq/FeProject/etc/runtime.cf
|
sed -i "2a/FeProject/bin/ ^ pt61850netd_pqfe -d cfg_stat_data -s ${i}_${1}^ ^ ^ 1 ^ ^" /FeProject/etc/runtime.cf
|
||||||
done
|
done
|
||||||
|
|
||||||
# 关闭旧的看门狗进程
|
# 关闭旧的看门狗进程
|
||||||
@@ -385,16 +385,16 @@ handle_reset() {
|
|||||||
#sleep 5
|
#sleep 5
|
||||||
|
|
||||||
# 启动服务不影响其他功能的进程
|
# 启动服务不影响其他功能的进程
|
||||||
/home/pq/FeProject/boot/start_fe.sh
|
/FeProject/boot/start_fe.sh
|
||||||
|
|
||||||
echo "****** reset stat in $1******" >>"$LOGFILE"
|
echo "****** reset stat in $1******" >>"$LOGFILE"
|
||||||
elif [ "$2" == "recall" ]; then
|
elif [ "$2" == "recall" ]; then
|
||||||
# 清空 runtime.cf 中包含 cfg_recallhis_data 的行
|
# 清空 runtime.cf 中包含 cfg_recallhis_data 的行
|
||||||
sed -i '/cfg_recallhis_data/d' /home/pq/FeProject/etc/runtime.cf
|
sed -i '/cfg_recallhis_data/d' /FeProject/etc/runtime.cf
|
||||||
|
|
||||||
# 根据进程号来添加新的进程配置
|
# 根据进程号来添加新的进程配置
|
||||||
for i in $(seq 1 $1); do
|
for i in $(seq 1 $1); do
|
||||||
sed -i "2a/FeProject/bin/ ^ pt61850netd_pqfe -d cfg_recallhis_data -s ${i}_${1}^ ^ ^ 1 ^ ^" /home/pq/FeProject/etc/runtime.cf
|
sed -i "2a/FeProject/bin/ ^ pt61850netd_pqfe -d cfg_recallhis_data -s ${i}_${1}^ ^ ^ 1 ^ ^" /FeProject/etc/runtime.cf
|
||||||
done
|
done
|
||||||
|
|
||||||
# 关闭旧的看门狗进程
|
# 关闭旧的看门狗进程
|
||||||
@@ -405,7 +405,7 @@ handle_reset() {
|
|||||||
#sleep 5
|
#sleep 5
|
||||||
|
|
||||||
# 启动服务不影响其他功能的进程
|
# 启动服务不影响其他功能的进程
|
||||||
/home/pq/FeProject/boot/start_fe.sh
|
/FeProject/boot/start_fe.sh
|
||||||
|
|
||||||
echo "****** reset recall in $1******" >>"$LOGFILE"
|
echo "****** reset recall in $1******" >>"$LOGFILE"
|
||||||
else
|
else
|
||||||
@@ -429,22 +429,22 @@ handle_add() {
|
|||||||
# 如果 $1 在 1 和 10 之间,进入处理逻辑
|
# 如果 $1 在 1 和 10 之间,进入处理逻辑
|
||||||
if [ "$2" == "all" ]; then
|
if [ "$2" == "all" ]; then
|
||||||
# 检查是否已存在该条目,避免重复添加
|
# 检查是否已存在该条目,避免重复添加
|
||||||
if ! grep -q "/FeProject/bin/ ^ pt61850netd_pqfe -d cfg_stat_data -s ${1}_${1}^" /home/pq/FeProject/etc/runtime.cf; then
|
if ! grep -q "/FeProject/bin/ ^ pt61850netd_pqfe -d cfg_stat_data -s ${1}_${1}^" /FeProject/etc/runtime.cf; then
|
||||||
sed -i "2a/FeProject/bin/ ^ pt61850netd_pqfe -d cfg_stat_data -s ${1}_${1}^ ^ ^ 1 ^ ^" /home/pq/FeProject/etc/runtime.cf
|
sed -i "2a/FeProject/bin/ ^ pt61850netd_pqfe -d cfg_stat_data -s ${1}_${1}^ ^ ^ 1 ^ ^" /FeProject/etc/runtime.cf
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if ! grep -q "/FeProject/bin/ ^ pt61850netd_pqfe -d cfg_recallhis_data -s ${1}_${1}^" /home/pq/FeProject/etc/runtime.cf; then
|
if ! grep -q "/FeProject/bin/ ^ pt61850netd_pqfe -d cfg_recallhis_data -s ${1}_${1}^" /FeProject/etc/runtime.cf; then
|
||||||
sed -i "2a/FeProject/bin/ ^ pt61850netd_pqfe -d cfg_recallhis_data -s ${1}_${1}^ ^ ^ 1 ^ ^" /home/pq/FeProject/etc/runtime.cf
|
sed -i "2a/FeProject/bin/ ^ pt61850netd_pqfe -d cfg_recallhis_data -s ${1}_${1}^ ^ ^ 1 ^ ^" /FeProject/etc/runtime.cf
|
||||||
fi
|
fi
|
||||||
elif [ "$2" == "stat" ]; then
|
elif [ "$2" == "stat" ]; then
|
||||||
# 检查是否已存在该条目,避免重复添加
|
# 检查是否已存在该条目,避免重复添加
|
||||||
if ! grep -q "/FeProject/bin/ ^ pt61850netd_pqfe -d cfg_stat_data -s ${1}_${1}^" /home/pq/FeProject/etc/runtime.cf; then
|
if ! grep -q "/FeProject/bin/ ^ pt61850netd_pqfe -d cfg_stat_data -s ${1}_${1}^" /FeProject/etc/runtime.cf; then
|
||||||
sed -i "2a/FeProject/bin/ ^ pt61850netd_pqfe -d cfg_stat_data -s ${1}_${1}^ ^ ^ 1 ^ ^" /home/pq/FeProject/etc/runtime.cf
|
sed -i "2a/FeProject/bin/ ^ pt61850netd_pqfe -d cfg_stat_data -s ${1}_${1}^ ^ ^ 1 ^ ^" /FeProject/etc/runtime.cf
|
||||||
fi
|
fi
|
||||||
elif [ "$2" == "recall" ]; then
|
elif [ "$2" == "recall" ]; then
|
||||||
# 检查是否已存在该条目,避免重复添加
|
# 检查是否已存在该条目,避免重复添加
|
||||||
if ! grep -q "/FeProject/bin/ ^ pt61850netd_pqfe -d cfg_recallhis_data -s ${1}_${1}^" /home/pq/FeProject/etc/runtime.cf; then
|
if ! grep -q "/FeProject/bin/ ^ pt61850netd_pqfe -d cfg_recallhis_data -s ${1}_${1}^" /FeProject/etc/runtime.cf; then
|
||||||
sed -i "2a/FeProject/bin/ ^ pt61850netd_pqfe -d cfg_recallhis_data -s ${1}_${1}^ ^ ^ 1 ^ ^" /home/pq/FeProject/etc/runtime.cf
|
sed -i "2a/FeProject/bin/ ^ pt61850netd_pqfe -d cfg_recallhis_data -s ${1}_${1}^ ^ ^ 1 ^ ^" /FeProject/etc/runtime.cf
|
||||||
fi
|
fi
|
||||||
else
|
else
|
||||||
echo "****** process add type null ******"
|
echo "****** process add type null ******"
|
||||||
@@ -457,7 +457,7 @@ handle_add() {
|
|||||||
#sleep 5
|
#sleep 5
|
||||||
|
|
||||||
# 启动服务,不影响正在运行的进程
|
# 启动服务,不影响正在运行的进程
|
||||||
/home/pq/FeProject/boot/start_fe.sh
|
/FeProject/boot/start_fe.sh
|
||||||
|
|
||||||
else
|
else
|
||||||
# 如果 $1 不在 1 到 10 之间,记录错误日志
|
# 如果 $1 不在 1 到 10 之间,记录错误日志
|
||||||
|
|||||||
Reference in New Issue
Block a user