forked from gary/ems
2
0
Fork 0
sun_ems/ems_c/main.c

52 lines
1.7 KiB
C
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

/*****************************************************************************
* @copyright 2024-2024, . POWER SUPPLY CO., LTD.
* @file main.c
* @brief 主进程入口文件
* @author Gary
* @date 2024/08/30
* @remark 初修订
*****************************************************************************/
#include <stdio.h>
#include <stdlib.h>
#include <time.h>
#include <unistd.h>
#include <string.h>
#include <sys/wait.h>
#include "argparse.h"
#include "daemon.h"
#include "app_task_regedit.h"
#include "mw_schedule_handle.h"
/*****************************************************************************
* @brief 主函数入口
* @param[in] argc命令行参数个数
* @param[in] argv命令行参数字符数组
* @return 返回状态码
*****************************************************************************/
int main(int argc, char *argv[])
{
void *arg = NULL; // 初始化参数
int ret = 0; // 返回值
uint16_t sysheart = 0; // 系统心跳
double sysheart_value = 0.0; // 系统心跳值
// EMS初始化
ret = initEmsSystem(arg);
// 注册线程入口
if (ret == 0)
regeditThreadEntry(arg);
// 主循环,保持进程运行
while (1)
{
//设置系统心跳
setRtdbPointValue(rtdbType, kDev_Type_EMS, 0, kEms_RunHeartCount, (double)sysheart++);
sysheart_value = getRtdbPointValue(rtdbType, kDev_Type_EMS, 0, kEms_RunHeartCount);
printf("System Heartbeat: %02f\n", sysheart_value);
sleep(1); // 每1秒检查一次
}
main_end:
return ret; // 返回状态
}