/* * Common.h * * Created on: 2021年8月7日 * Author: Wendell */ #ifndef COMMON_H_ #define COMMON_H_ #include #define ARRAY_SIZE(A) (sizeof(A) / sizeof(A[0])) #define PASS 1 #define FAIL -1 #define YES 1 #define NO 0 #define ON 1 #define OFF 0 #define true 1 #define false 0 #define NORMAL 0 #define ABNORMAL 1 #define EQUAL 0 #define MODELNAME_LENGTH 14 #define LOG_INFO(format, args...) StoreSysLogMsg("[%s:%4d][%s][Info] "format, (strrchr(__FILE__, '/') ? strrchr(__FILE__, '/') + 1 : __FILE__), __LINE__, __FUNCTION__, ##args) #define LOG_WARN(format, args...) StoreSysLogMsg("[%s:%4d][%s][Warn] "format, (strrchr(__FILE__, '/') ? strrchr(__FILE__, '/') + 1 : __FILE__), __LINE__, __FUNCTION__, ##args) #define LOG_ERROR(format, args...) StoreSysLogMsg("[%s:%4d][%s][Erro] "format, (strrchr(__FILE__, '/') ? strrchr(__FILE__, '/') + 1 : __FILE__), __LINE__, __FUNCTION__, ##args) #define LOG_DBG(format, args...) StoreSysLogMsg("[%s:%4d][%s][Debg] "format, (strrchr(__FILE__, '/') ? strrchr(__FILE__, '/') + 1 : __FILE__), __LINE__, __FUNCTION__, ##args) #define PSU_LOG(format, args...) StorePsuLogMsg("[%s:%4d][%s][Info] "format, (strrchr(__FILE__, '/') ? strrchr(__FILE__, '/') + 1 : __FILE__), __LINE__, __FUNCTION__, ##args) #define LOG_EVENT(format, args...) StoreEventLogMsg("[%s:%4d][%s][Info] "format, (strrchr(__FILE__, '/') ? strrchr(__FILE__, '/') + 1 : __FILE__), __LINE__, __FUNCTION__, ##args) #define AUTH_INFO(format, args...) StoreAuthLogMsg("[%s:%4d][%s][Info] "format, (strrchr(__FILE__, '/') ? strrchr(__FILE__, '/') + 1 : __FILE__), __LINE__, __FUNCTION__, ##args) #define DB_FILE "/Storage/ChargeLog/localCgargingRecord.db" #define NETWORK_DB_FILE "/Storage/EventLog/Eventlog.db" int StoreSysLogMsg(const char *fmt, ...); int StorePsuLogMsg(const char *fmt, ...); int StoreEventLogMsg(const char *fmt, ...); int StoreAuthLogMsg(const char *fmt, ...); void GetClockTime(struct timespec *_now_time); unsigned long GetTimeoutValue(struct timespec _start_time); unsigned long GetSecTimeoutValue(struct timespec _start_time); int StatusCodeCompose(char *oriCode, char *newCode); void getNowDatetime(unsigned char *data); int IsModelNameMatch_ForUpdate(char *model_1, char *model_2); #endif /* COMMON_H_ */