当前位置:网站首页>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;
边栏推荐
- IPv6与IPv4的区别 网信办等三部推进IPv6规模部署
- JS for循环 循环次数异常
- Anaconda creates a virtual environment and installs pytorch
- Resnet18 actual battle Baoke dream spirit
- About cache exceptions: solutions for cache avalanche, breakdown, and penetration
- Semantic segmentation experiment: UNET network /msrc2 dataset
- Take you two minutes to quickly master the route and navigation of flutter
- Flutter2 heavy release supports web and desktop applications
- Read and understand the rendering mechanism and principle of flutter's three trees
- Array cyclic shift problem
猜你喜欢

Flutter2 heavy release supports web and desktop applications
A guide to threaded and asynchronous UI development in the "quick start fluent Development Series tutorials"

July Huaqing learning-1

Detailed structure and code of inception V3

嵌入式软件架构设计-消息交互

Knowledge representation (KR)

Matlab boundarymask function (find the boundary of the divided area)

Anaconda creates a virtual environment and installs pytorch

Four operations and derivative operations of MATLAB polynomials

MySQL transaction
随机推荐
Design of music box based on assembly language
Linux安装部署LAMP(Apache+MySQL+PHP)
Swift - enables textview to be highly adaptive
Learn garbage collection 01 of JVM -- garbage collection for the first time and life and death judgment
Automated test lifecycle
Redis highly available sentinel mechanism
Hiengine: comparable to the local cloud native memory database engine
Is investment and finance suitable for girls? What financial products can girls buy?
byte2String、string2Byte
Third party payment interface design
一款新型的智能家居WiFi选择方案——SimpleWiFi在无线智能家居中的应用
ZABBIX ODBC database monitoring
Learn JVM garbage collection 02 - a brief introduction to the reference and recycling method area
7月华清学习-1
POJ-2499 Binary Tree
ZABBIX 5.0 - LNMP environment compilation and installation
Cypher syntax of neo4j graph database
Why learn harmonyos and how to get started quickly?
MVVM framework part I lifecycle
MySQL index - extended data