当前位置:网站首页>C alarm design
C alarm design
2022-07-05 12:27:00 【yang881221】
1 Alarm log module design
1.1 function analysis
The function of this module is to output the generated alarm to the serial port or log file
1.2 The basic principle
The alarm level output to the serial port defaults to info Level ; The alarm level output to the file defaults to alert Level , take alert And higher level information saved to file .
When other modules have alarms , call sysLogMsg(MODULEIDmodule, LEVELID level,const char * format, ...) Function to send an alarm message to the module , The incoming parameters have alarm module 、 Alarm level and message body . The module outputs the message to the serial port or saves it to a file according to the alarm module and alarm level .
If the message queue is full or the message length is greater than 256 byte , The message is discarded . For messages to be output to the serial port , direct printf Printout ; For messages to be saved to a file , For a while Buf in , And put the sign at 1, Each time will be Buf Before writing to the file , Use tick Count the interval between the last save time , When the interval is greater than the specified value , And the sign bit is 1 when , hold Buf Content in write to file .
1.3 Data structure design
typedef struct tagSysLogGlobalConfig {
int iCurrLofServer;
int iSendRate;
LOGHOST plServerList[SYSLOG_MAX_HOST];
LIST *plMsgBufList;
int iBufListSize;
BUFLISTELEMENT *ptBufInsertPos;
BUFLISTELEMENT *ptBufShowFirstPos;
int iConsoleSwitch;
int iConsoleServity;
ulong_t ulConsolMessages;
int iMonitorSwitch;
int iMonitorServity;
ulong_t ulMonitorMessages;
int iFileSwitch;
int iFileServity;
char * logFileName;
MSG_Q_ID logMsgQ;
int iLogSocket;
int iAppendTime;
int iGlobalSwitch;
ulong_t ulDropMessage;
SEM_ID semMemCpy;
} SYSLOGCONF;
typedef struct tagLogHost{
ulong_t ulIpAddr; /* Log host's IP Address */
ulong_t ulLevel; /* The output level of the log host */
ulong_t ulFacility; /*Unix System defined equipment number ,local0~local7(16~23);*/
ulong_t ulSwitch; /* Indicates whether the switch of the current log host is on ,0 To open */
ulong_t ulMsgSent; /* The number of discarded logs sent to this host */
ulong_t ulMsgdrop; /* Number of dropped messages */
ulong_t ulPort;
} LOGHOST;
typedef struct tagBufListElement{
NODE link;
ulong_t ulGetTick;
ulong_t ulSec;
char* buf;
ulong_t ulInUse;
int iModule; /*module */
int iLevel; /*message level*/
}BUFLISTELEMENT;
typedef struct tSYSLOGMODULE{
char *pcModuleName; /* Module name */
char *pcFacility; /**/
int iModuleDebugSwitch;
} SYSLOGMODULE;
边栏推荐
- Resnet18 actual battle Baoke dream spirit
- Tabbar configuration at the bottom of wechat applet
- MySQL basic operation -dql
- Introduction to GNN
- ACID事务理论
- Learn JVM garbage collection 02 - a brief introduction to the reference and recycling method area
- July Huaqing learning-1
- How to clear floating?
- 信息服务器怎么恢复,服务器数据恢复怎么弄[通俗易懂]
- MySQL index - extended data
猜你喜欢
- [email protected] (using password"/>
Solve the error 1045 of Navicat creating local connection -access denied for user [email protected] (using password
Take you two minutes to quickly master the route and navigation of flutter
Course design of compilation principle --- formula calculator (a simple calculator with interface developed based on QT)
Redis highly available sentinel mechanism
Redis clean cache
MySQL transaction
报错ModuleNotFoundError: No module named ‘cv2.aruco‘
强化学习-学习笔记3 | 策略学习
Get the variable address of structure member in C language
Hexadecimal conversion summary
随机推荐
Flutter2 heavy release supports web and desktop applications
【ijkplayer】when i compile file “compile-ffmpeg.sh“ ,it show error “No such file or directory“.
Swift - enables textview to be highly adaptive
Understand kotlin from the perspective of an architect
MySQL installation, Windows version
语义分割实验:Unet网络/MSRC2数据集
Constructing expression binary tree with prefix expression
MySQL constraints
嵌入式软件架构设计-消息交互
Just a coincidence? The mysterious technology of apple ios16 is actually the same as that of Chinese enterprises five years ago!
Cypher syntax of neo4j graph database
ZABBIX agent2 installation
MySQL storage engine
Design of music box based on assembly language
MySQL index - extended data
Redis clean cache
ABAP table lookup program
Learn JVM garbage collection 05 - root node enumeration, security points, and security zones (hotspot)
图像超分实验:SRCNN/FSRCNN
MySQL multi table operation