diff --git a/user/config/config.c b/user/config/config.c index 56594c5..557e626 100644 --- a/user/config/config.c +++ b/user/config/config.c @@ -55,13 +55,18 @@ int rov_config_write_json_to_file(cJSON *params) fp = fopen(CONFIG_FILE_PATH, "wt+"); if(fp == NULL) { - log_e("error in open config file"); + log_e("error in creating config file"); free(temp); return -1; } } if (fputs(temp, fp) < 0) //写入文件 + { log_e("error in fputs config file"); + fclose(fp); + free(temp); + return -1; + } fclose(fp); free(temp); diff --git a/user/main.c b/user/main.c index 27d977f..e1b8c88 100644 --- a/user/main.c +++ b/user/main.c @@ -4,14 +4,14 @@ #include #include -extern void rov_init(int debug_mode); -extern void rov_deinit(void); -extern void rov_loop(void); +extern void uvm_init(int debug_mode); +extern void uvm_deinit(void); +extern void uvm_loop(void); -static void exit_rov(int sig) +static void exit_uvm(int sig) { printf("info: closing uv-master app...\n"); - rov_deinit(); + uvm_deinit(); exit(0); } @@ -23,7 +23,7 @@ int main(int argc, char **argv) exit(0); } - signal(SIGINT, exit_rov); + signal(SIGINT, exit_uvm); char * debug_env = getenv("UV_DEBUG"); if (debug_env == NULL) { @@ -37,9 +37,9 @@ int main(int argc, char **argv) close(STDOUT_FILENO); close(STDERR_FILENO);; - rov_init(0); + uvm_init(0); for (;;) { - rov_loop(); + uvm_loop(); } } } else { @@ -50,9 +50,9 @@ int main(int argc, char **argv) " \\___/ \\_/ \\/ \\/\\__,_|___/\\__\\___|_| \n" " \n"); printf("info: starting uv-master app...\n"); - rov_init(1); + uvm_init(1); for (;;) { - rov_loop(); + uvm_loop(); } } diff --git a/user/main_app.c b/user/main_app.c index 4ed873a..6149d9b 100644 --- a/user/main_app.c +++ b/user/main_app.c @@ -2,7 +2,7 @@ // Created by fxf on 23-9-2. // -#define LOG_TAG "rov.main" +#define LOG_TAG "uvm.main" #include #include @@ -12,22 +12,22 @@ #include "config/config.h" #include "control/control.h" -rov_info_t rovInfo; +rov_info_t uvmInfo; /** - * @brief 停止rov服务 + * @brief 停止uvm服务 */ -void rov_deinit() +void uvm_deinit() { jsonrpc_server_stop(); - rov_device_stop(&rovInfo); + rov_device_stop(&uvmInfo); } /** - * @brief rov初始化 + * @brief uvm初始化 * @param debug_mode 调试模式 */ -void rov_init(bool debug_mode) +void uvm_init(bool debug_mode) { if (debug_mode == true) { @@ -44,26 +44,26 @@ void rov_init(bool debug_mode) elog_start(); } - if (rov_config_init(&rovInfo) < 0) + if (rov_config_init(&uvmInfo) < 0) exit(-1); - if (jsonrpc_server_run(&rovInfo) < 0) + if (jsonrpc_server_run(&uvmInfo) < 0) exit(-1); - if (rov_device_run(&rovInfo) < 0) + if (rov_device_run(&uvmInfo) < 0) { jsonrpc_server_stop(); exit(-1); } - if (rov_control_run(&rovInfo) < 0) + if (rov_control_run(&uvmInfo) < 0) { - rov_deinit(); + uvm_deinit(); exit(-1); } } -void rov_loop() +void uvm_loop() { sleep(1); }