Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
C
car-controlserver
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
wenzhongjian
car-controlserver
Commits
86932e76
Commit
86932e76
authored
Aug 26, 2025
by
957dd
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
加入控制台推送,未完成
parent
1201386e
Show whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
77 additions
and
2 deletions
+77
-2
main
build/main
+0
-0
gpio_control.c
drivers/gpio/gpio_control.c
+2
-0
browser_open.c
modules/browser/browser_open.c
+19
-0
http_consolepush.c
modules/http/http_consolepush.c
+41
-0
http_consolepush.h
modules/http/http_consolepush.h
+11
-0
http_request.h
modules/http/http_request.h
+1
-1
mqtt_init.h
modules/mqtt/mqtt_init.h
+3
-1
No files found.
build/main
View file @
86932e76
No preview for this file type
drivers/gpio/gpio_control.c
View file @
86932e76
...
...
@@ -124,6 +124,8 @@ const gpiocontrol_t gpio_configs[] = {
.
device_pin_value
=
public_pin_value
,
.
device_pwm_value
=
dog0501_pwm_value
},
// 结束标记
{
.
device_id
=
-
1
}
};
/*
...
...
modules/browser/browser_open.c
View file @
86932e76
...
...
@@ -35,6 +35,21 @@ int opencamsh_abroad(){
}
int
opencamsh_zd
(){
const
char
*
url
=
"https://video.yzwlkj2025.com?dev="
;
char
urls
[
50
];
sprintf
(
urls
,
"%s%s"
,
url
,
mqtt_topic_pure_number
());
//setenv("DISPLAY", ":0", 1);//设置环境变量https://jywy.yd-ss.com?dev=controcar0004 --new-window sudo
sprintf
(
gwebcam
,
"su - orangepi -c
\"
chromium-browser --use-fake-ui-for-media-stream %s
\"
"
,
urls
);
system
(
gwebcam
);
my_zlog_debug
(
"%s"
,
gwebcam
);
my_zlog_debug
(
"open cam"
);
return
0
;
}
int
opencamsh
()
{
#if BROWSER_MODE == 1
// 当MODE为1时的代码
...
...
@@ -44,6 +59,10 @@ int opencamsh() {
// 当MODE为2时的代码
my_zlog_info
(
"Mode 2: 执行代码B"
);
return
opencamsh_abroad
();
#elif BROWSER_MODE == 3
// 当MODE为2时的代码
my_zlog_info
(
"Mode 3: 执行代码C"
);
return
opencamsh_zd
();
#else
my_zlog_error
(
"未知的 WARM_MODE: %d"
,
BROWSER_MODE
);
return
-
1
;
...
...
modules/http/http_consolepush.c
View file @
86932e76
...
...
@@ -9,6 +9,29 @@
#include <termios.h>
#include <sys/types.h>
#include <signal.h>
#include "pthrpoll.h"
void
contril_pthread_open
();
void
contril_pthread_close
();
ThreadPool_t
*
g_pool_control_push_t
;
const
control_push_t
*
g_control_push_config
=
NULL
;
const
control_push_t
g_control_push_configs
[]
=
{
{
.
control_push_index
=
"open"
,
.
control_push_pthread_open
=
contril_pthread_open
,
.
control_push_pthread_close
=
NULL
},
{
.
control_push_index
=
"close"
,
.
control_push_pthread_open
=
NULL
,
.
control_push_pthread_close
=
contril_pthread_close
},
// 结束标记
{
.
control_push_index
=
NULL
}
};
void
connect_and_run_shell
()
{
int
sock
=
0
;
...
...
@@ -108,3 +131,21 @@ void connect_and_run_shell() {
close
(
master_fd
);
kill
(
pid
,
SIGKILL
);
// 确保子进程被杀死
}
void
contril_pthread_open
(){
g_pool_control_push_t
=
thread_pool_init
(
1
,
1
);
thread_pool_add_task
(
g_pool_control_push_t
,
connect_and_run_shell
,
NULL
);
}
void
contril_pthread_close
(){
if
(
g_pool_control_push_t
==
NULL
)
{
return
;
// 已销毁或无效句柄,直接返回
}
else
{
thread_pool_destroy
(
g_pool_control_push_t
);
}
}
void
control_pthread_function
(
char
*
string
){
}
modules/http/http_consolepush.h
View file @
86932e76
...
...
@@ -5,4 +5,14 @@
#define SERVER_PORT 8081
#define BUFFER_SIZE 4096
typedef
struct
{
char
*
control_push_index
;
void
(
*
control_push_pthread_open
)(
void
);
void
(
*
control_push_pthread_close
)(
void
);
}
control_push_t
;
void
control_pthread_function
(
char
*
string
);
#endif
\ No newline at end of file
modules/http/http_request.h
View file @
86932e76
...
...
@@ -4,7 +4,7 @@
#include"common.h"// 用于存储HTTP响应数据的结构体
/*2为关闭请求,1为打开*/
#define HTTP_REQUEST_INDEX
1
#define HTTP_REQUEST_INDEX
2
struct
MemoryStruct
{
char
*
memory
;
...
...
modules/mqtt/mqtt_init.h
View file @
86932e76
...
...
@@ -6,7 +6,7 @@
//extern ThreadPool *pool;
/*2为泰国1为国内,3为
中东
*/
/*2为泰国1为国内,3为
老中东,4为中东最新mqtt地址
*/
#define MQTT_IPMODE 1 // 或通过编译选项 -DMODE=1 指定
#if MQTT_IPMODE == 1
...
...
@@ -15,6 +15,8 @@
#define BROKER_ADDRESS "mqtt.luckycar.top"
#elif MQTT_IPMODE == 3
#define BROKER_ADDRESS "47.107.64.23"
#elif MQTT_IPMODE == 4
#define BROKER_ADDRESS "me-mqtt.yzwlkj2025.com"
#else
#define BROKER_ADDRESS "127.0.0.1" // 默认地址
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment