|
|
|
|
@ -21225,7 +21225,11 @@ int reload_dataset_from_jsonfile(void)
|
|
|
|
|
strcpy(SystemSetting.enable_python, enable_python->valuestring); |
|
|
|
|
|
|
|
|
|
enable_python_file = cJSON_GetObjectItem(system_setting, "enable_python_file"); |
|
|
|
|
strcpy(SystemSetting.enable_python_file, enable_python_file->valuestring); |
|
|
|
|
if (enable_python_file) |
|
|
|
|
{ |
|
|
|
|
strcpy(SystemSetting.enable_python_file, enable_python_file->valuestring); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
enable_low_cpu_usage = cJSON_GetObjectItem(system_setting, "enable_low_cpu_usage"); |
|
|
|
|
strcpy(SystemSetting.enable_low_cpu_usage, enable_low_cpu_usage->valuestring); |
|
|
|
|
@ -22345,6 +22349,7 @@ void stop_server()
|
|
|
|
|
pthread_mutex_destroy(&mutex_remotesnap_image); // Ken 2022-09-26
|
|
|
|
|
pthread_mutex_destroy(&mutex_radar_json); |
|
|
|
|
pthread_mutex_destroy(&mutex_tof_json); |
|
|
|
|
pthread_mutex_destroy(&mutex_buffer); |
|
|
|
|
#endif |
|
|
|
|
pthread_mutex_destroy(&mutex_get_image); |
|
|
|
|
pthread_mutex_destroy(&mutex_get_image_HD); |
|
|
|
|
@ -22468,7 +22473,6 @@ void write_to_enable_tracking(char *enable_tracking) {
|
|
|
|
|
|
|
|
|
|
cJSON_ReplaceItemInObject(camera01, "ptz_enable_tracking", cJSON_CreateString(enable_tracking)); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
char* JsonString = cJSON_Print(root); |
|
|
|
|
FILE *fp; |
|
|
|
|
|
|
|
|
|
@ -22643,20 +22647,20 @@ void *start_run_python_thread(void* pythonpath) {
|
|
|
|
|
|
|
|
|
|
while (python_check_webstatus == 0) |
|
|
|
|
{ |
|
|
|
|
// python_check_webstatus = 0 網頁關閉
|
|
|
|
|
// python_check_webstatus = 1 網頁開啟
|
|
|
|
|
// python_check_webstatus = 0 Web close
|
|
|
|
|
// python_check_webstatus = 1 Web open
|
|
|
|
|
printf("[start_run_python_thread] Wait Web server run... %d \n", python_check_webstatus); |
|
|
|
|
continue; |
|
|
|
|
} |
|
|
|
|
// printf("[start_run_python_thread] Wait Web server run... %d \n", python_check_webstatus);
|
|
|
|
|
sleep(15); // 暫停 15 秒,等待 Web thread 開啟
|
|
|
|
|
sleep(15); // sleep 15 sec¡Await Web thread open
|
|
|
|
|
if (value == NULL) { |
|
|
|
|
printf("Failed to retrieve enable_python_file value\n"); |
|
|
|
|
pthread_exit(NULL); |
|
|
|
|
} |
|
|
|
|
// §ì¨ú python ÀÉ®×
|
|
|
|
|
if (strstr(value, ".py") != NULL) { |
|
|
|
|
printf("enable_python_file is a Python file: %s\n", value); |
|
|
|
|
// printf("enable_python_file is a Python file: %s\n", value);
|
|
|
|
|
const char *prefix = "lifile_liname="; |
|
|
|
|
char pythonfile[256];
|
|
|
|
|
snprintf(pythonfile, sizeof(pythonfile), "%s%s", prefix, value); |
|
|
|
|
@ -22911,6 +22915,8 @@ void run_server(int argc, char **argv)
|
|
|
|
|
pthread_mutex_init(&mutex_remotesnap_image, NULL); // Ken 2022-09-26
|
|
|
|
|
pthread_mutex_init(&mutex_radar_json, NULL); |
|
|
|
|
pthread_mutex_init(&mutex_tof_json, NULL); |
|
|
|
|
pthread_mutex_init(&mutex_buffer, NULL); |
|
|
|
|
|
|
|
|
|
#endif |
|
|
|
|
pthread_mutex_init(&mutex_get_image, NULL); |
|
|
|
|
pthread_mutex_init(&mutex_get_image_HD, NULL); |
|
|
|
|
@ -25925,13 +25931,20 @@ void run_server(int argc, char **argv)
|
|
|
|
|
} |
|
|
|
|
if (enable_python_file)
|
|
|
|
|
{ |
|
|
|
|
strcpy(SystemSetting.enable_python_file, enable_python_file->valuestring); |
|
|
|
|
// check python file
|
|
|
|
|
if (strstr(enable_python_file->valuestring, ".py") ==
|
|
|
|
|
enable_python_file->valuestring + strlen(enable_python_file->valuestring) - 3) { |
|
|
|
|
|
|
|
|
|
strcpy(SystemSetting.enable_python_file, enable_python_file->valuestring); |
|
|
|
|
|
|
|
|
|
if (pthread_create(&runpython_thread, NULL, start_run_python_thread, (void*)configPATH) != 0) { |
|
|
|
|
perror("check current runpython thread failed\n"); |
|
|
|
|
exit(EXIT_FAILURE); |
|
|
|
|
if (pthread_create(&runpython_thread, NULL, start_run_python_thread, (void*)configPATH) != 0) { |
|
|
|
|
printf("check current runpython thread failed\n"); |
|
|
|
|
} |
|
|
|
|
} else { |
|
|
|
|
printf("File is not a Python file.\n"); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
else { |
|
|
|
|
strcpy(SystemSetting.enable_python_file, "No python running."); |
|
|
|
|
new_data_write_to_config_file_flag = 1; |
|
|
|
|
|