Browse Source

Sync

master
ming.hong 1 year ago
parent
commit
b0499e1904
  1. BIN
      gynet
  2. BIN
      libdarknet.a
  3. BIN
      obj/detector.o
  4. BIN
      obj/nweb.o
  5. 37
      src/detector.c
  6. 32092
      src/detector_Ming.c
  7. 17
      src/detector_Ming.h
  8. 5
      src/nweb.c
  9. 25843
      src/nweb_Ming.c
  10. 1123
      src/nweb_Ming.h

BIN
gynet

Binary file not shown.

BIN
libdarknet.a

Binary file not shown.

BIN
obj/detector.o

Binary file not shown.

BIN
obj/nweb.o

Binary file not shown.

37
src/detector.c

@ -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);
@ -25923,15 +25929,22 @@ void run_server(int argc, char **argv)
strcpy(SystemSetting.enable_python, "No");
new_data_write_to_config_file_flag = 1;
}
if (enable_python_file)
if (enable_python_file)
{
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);
// 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) {
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;

32092
src/detector_Ming.c

File diff suppressed because it is too large Load Diff

17
src/detector_Ming.h

@ -1,17 +0,0 @@
#pragma once
#ifndef DETECTOR_H
#define DETECTOR_H
#include "define_inc.h"
#include <tchar.h>
#include "setting.h"
#ifdef __cplusplus
extern "C" {
#endif
#ifdef __cplusplus
}
#endif
#endif

5
src/nweb.c

@ -7944,6 +7944,9 @@ void web_process(SOCKET* client_socket, char* recvBuffer, int recv_buff_size, ch
(strcmp(urlBuffer, "/Aida/snmptoken.html") == 0) ||
(strcmp(urlBuffer, "/Aida/osdtoken.html") == 0) ||
(strcmp(urlBuffer, "/Aida/jquery.easyui.min.js") == 0) ||
(strcmp(urlBuffer, "/Aida/codemirror.min.css") == 0) || // for python codemirror
(strcmp(urlBuffer, "/Aida/codemirror.min.js") == 0) || // for python codemirror
(strcmp(urlBuffer, "/Aida/python.min.js") == 0) || // for python codemirror
(strcmp(urlBuffer, "/Aida/jquery.slider.js") == 0) ||
(strcmp(urlBuffer, "/Aida/aes.js") == 0) ||
(strcmp(urlBuffer, "/Aida/easyui.css") == 0) ||
@ -16529,12 +16532,14 @@ void web_process(SOCKET* client_socket, char* recvBuffer, int recv_buff_size, ch
// 不讀正在寫的行數
// printf("!!! [/pythongetbuffer] reach writing index, g_uiWebPythonLastBufferIndex:%d == g_uiWebPythonCurrentBufferIndex:%u\n", g_uiWebPythonLastBufferIndex, g_uiWebPythonCurrentBufferIndex);
pthread_mutex_lock(&mutex_buffer);
// 拿 python 輸出
printf("[pythongetbuffer] get %d data \n",g_uiWebPythonLastBufferIndex);
strcat(sPythonBufferTemp, g_aWebPythonBuffer2D[g_uiWebPythonLastBufferIndex]);
// 清空拿過的 row
memset(g_aWebPythonBuffer2D[g_uiWebPythonLastBufferIndex], 0, WEBPYTHONBUFFER_ROWSIZE);
pthread_mutex_unlock(&mutex_buffer); // 解鎖
// 更新讀取位置
g_uiWebPythonLastBufferIndex++;
}

25843
src/nweb_Ming.c

File diff suppressed because it is too large Load Diff

1123
src/nweb_Ming.h

File diff suppressed because it is too large Load Diff
Loading…
Cancel
Save