/* * 模块名称:IEC104 模拟器生命周期接口 * 作者:STM32F4-Base 项目组 * 说明:同进程协议适配,不调用 LVGL 或物理硬件输出。 */ #ifndef IEC104_SIM_H #define IEC104_SIM_H #include typedef struct { uint16_t port; uint32_t duration_s; int enabled; int headless; } iec104_sim_options_t; /* Parse only the protocol options, rejecting golden/selftest combinations. * Return 0 on success or 2 for invalid command-line usage. */ int iec104_sim_parse(int argc, char **argv, iec104_sim_options_t *options); /* One main-thread owner, paired start/stop. 0 success, -1 failure. */ int iec104_sim_start(const iec104_sim_options_t *options); int iec104_sim_poll(void); int iec104_sim_stop(void); int iec104_sim_enabled(void); /* Finite service in this executable, without LVGL timers or a second process. */ int iec104_sim_run_headless(const iec104_sim_options_t *options); /* Device wall clock only, shared with the protocol source, never the OS clock. */ uint64_t iec104_sim_clock_ms(void); uint64_t iec104_sim_clock_local_s(void); int iec104_sim_clock_set(uint32_t epoch_s); #endif