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
c7c7206a
Commit
c7c7206a
authored
Sep 19, 2025
by
957dd
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
加入了拉取mqtt服务器,还需等后端完成后再修改
parent
060cf3b1
Hide whitespace changes
Inline
Side-by-side
Showing
20 changed files
with
234 additions
and
49 deletions
+234
-49
device_fileopen.c
app/device_identity/device_fileopen.c
+1
-1
main.c
app/main/main.c
+6
-1
main.h
app/main/main.h
+4
-0
pthread_open.c
app/main/pthread_open.c
+1
-3
Makefile
build/Makefile
+27
-0
version.h
build/include/version.h
+1
-1
main
build/main
+0
-0
progress.make
...osquitto_ctrl/CMakeFiles/mosquitto_ctrl.dir/progress.make
+2
-2
progress.make
...squitto/client/CMakeFiles/mosquitto_pub.dir/progress.make
+2
-2
progress.make
...y/mosquitto/lib/CMakeFiles/libmosquitto.dir/progress.make
+4
-4
progress.make
...itto/lib/CMakeFiles/libmosquitto_static.dir/progress.make
+8
-8
progress.make
...y/CMakeFiles/mosquitto_dynamic_security.dir/progress.make
+2
-2
progress.make
...arty/mosquitto/src/CMakeFiles/mosquitto.dir/progress.make
+16
-16
device_init.c
drivers/gpio/device_init.c
+3
-5
browser_open.c
modules/browser/browser_open.c
+1
-0
http_config_mqtt.c
modules/http/http_config_mqtt.c
+128
-0
http_config_mqtt.h
modules/http/http_config_mqtt.h
+18
-0
http_request.c
modules/http/http_request.c
+2
-2
http_request.h
modules/http/http_request.h
+3
-0
mqtt_init.c
modules/mqtt/mqtt_init.c
+5
-2
No files found.
app/device_identity/device_fileopen.c
View file @
c7c7206a
...
...
@@ -7,7 +7,7 @@
#define FILE_VERSION "/home/orangepi/car/master/version.conf"
char
*
g_device_id
=
NULL
;
char
*
g_device_id
=
NULL
;
//设备的类型的id
/*读出文件函数,读取设备号函数,获得设备号id*/
char
*
device_inspect
()
{
...
...
app/main/main.c
View file @
c7c7206a
...
...
@@ -25,9 +25,14 @@ int main(){
return
-
5
;
}
if
(
http_mqtt_video_init
()
!=
0
){
my_zlog_error
(
"请求mqtt服务器和video数据失败"
);
return
-
6
;
}
if
(
softiic_init
()
!=
0
){
my_zlog_error
(
"软件iic初始化失败"
);
return
-
6
;
return
-
7
;
}
if
(
ina225_init
()
!=
0
){
...
...
app/main/main.h
View file @
c7c7206a
...
...
@@ -10,6 +10,7 @@
#include "INA226.h"
#include "devcontrol_common.h"
#include "gpio_init.h"
#include "http_config_mqtt.h"
/*设备id读取初始化*/
int
device_id_file_init
();
...
...
@@ -41,6 +42,9 @@ int thread_start_init(ThreadFunc thread_exit_time, ThreadFunc thread_mqtt_beat,
/*像服务器请求*/
int
request_date
();
/*mqtt服务器和视频流地址初始化*/
int
http_mqtt_video_init
();
/*线程关闭函数*/
void
thread_end_close
()
;
...
...
app/main/pthread_open.c
View file @
c7c7206a
...
...
@@ -18,7 +18,7 @@ pthread_t g_thread[PTHREAD_MAX]; // 全局线程句柄数组(或传参)
int
g_webrtc_index
=
0
;
//判断游览器是否打开
int
g_mqtt_grc
=
0
;
int
g_mqtt_grc
=
0
;
//mqtt连接状态机
void
*
g_args
[
PTHREAD_MAX
]
=
{
NULL
};
...
...
@@ -83,8 +83,6 @@ void *thread_mqtt_beat(void *arg) {
}
while
(
1
)
{
// if( g_device_type >= 200 && g_device_type<=205) delay_ms(45);
// if( g_device_type != 202)delay_ms(100);
delay_ms
(
100
);
g_heartbeat_count
++
;
...
...
build/Makefile
View file @
c7c7206a
...
...
@@ -1158,6 +1158,30 @@ modules/delay/delay.c.s:
$(MAKE)
$(MAKESILENT)
-f
CMakeFiles/main.dir/build.make CMakeFiles/main.dir/modules/delay/delay.c.s
.PHONY
:
modules/delay/delay.c.s
modules/http/http_config_mqtt.o
:
modules/http/http_config_mqtt.c.o
.PHONY
:
modules/http/http_config_mqtt.o
# target to build an object file
modules/http/http_config_mqtt.c.o
:
$(MAKE)
$(MAKESILENT)
-f
CMakeFiles/main.dir/build.make CMakeFiles/main.dir/modules/http/http_config_mqtt.c.o
.PHONY
:
modules/http/http_config_mqtt.c.o
modules/http/http_config_mqtt.i
:
modules/http/http_config_mqtt.c.i
.PHONY
:
modules/http/http_config_mqtt.i
# target to preprocess a source file
modules/http/http_config_mqtt.c.i
:
$(MAKE)
$(MAKESILENT)
-f
CMakeFiles/main.dir/build.make CMakeFiles/main.dir/modules/http/http_config_mqtt.c.i
.PHONY
:
modules/http/http_config_mqtt.c.i
modules/http/http_config_mqtt.s
:
modules/http/http_config_mqtt.c.s
.PHONY
:
modules/http/http_config_mqtt.s
# target to generate assembly for a file
modules/http/http_config_mqtt.c.s
:
$(MAKE)
$(MAKESILENT)
-f
CMakeFiles/main.dir/build.make CMakeFiles/main.dir/modules/http/http_config_mqtt.c.s
.PHONY
:
modules/http/http_config_mqtt.c.s
modules/http/http_consolepush.o
:
modules/http/http_consolepush.c.o
.PHONY
:
modules/http/http_consolepush.o
...
...
@@ -1981,6 +2005,9 @@ help:
@
echo
"... modules/delay/delay.o"
@
echo
"... modules/delay/delay.i"
@
echo
"... modules/delay/delay.s"
@
echo
"... modules/http/http_config_mqtt.o"
@
echo
"... modules/http/http_config_mqtt.i"
@
echo
"... modules/http/http_config_mqtt.s"
@
echo
"... modules/http/http_consolepush.o"
@
echo
"... modules/http/http_consolepush.i"
@
echo
"... modules/http/http_consolepush.s"
...
...
build/include/version.h
View file @
c7c7206a
#define PROJECT_VERSION_MAJOR 1
#define PROJECT_VERSION_MINOR 2
#define PROJECT_VERSION_PATCH 1
2
#define PROJECT_VERSION_PATCH 1
3
#define GIT_HASH ""
#define BUILD_TIMESTAMP ""
#define BUILD_USER ""
build/main
View file @
c7c7206a
No preview for this file type
build/third_party/mosquitto/apps/mosquitto_ctrl/CMakeFiles/mosquitto_ctrl.dir/progress.make
View file @
c7c7206a
...
...
@@ -2,8 +2,8 @@ CMAKE_PROGRESS_1 =
CMAKE_PROGRESS_2
=
CMAKE_PROGRESS_3
=
81
CMAKE_PROGRESS_4
=
CMAKE_PROGRESS_5
=
CMAKE_PROGRESS_6
=
82
CMAKE_PROGRESS_5
=
82
CMAKE_PROGRESS_6
=
CMAKE_PROGRESS_7
=
CMAKE_PROGRESS_8
=
83
CMAKE_PROGRESS_9
=
...
...
build/third_party/mosquitto/client/CMakeFiles/mosquitto_pub.dir/progress.make
View file @
c7c7206a
CMAKE_PROGRESS_1
=
93
CMAKE_PROGRESS_2
=
CMAKE_PROGRESS_3
=
CMAKE_PROGRESS_4
=
94
CMAKE_PROGRESS_3
=
94
CMAKE_PROGRESS_4
=
CMAKE_PROGRESS_5
=
build/third_party/mosquitto/lib/CMakeFiles/libmosquitto.dir/progress.make
View file @
c7c7206a
...
...
@@ -12,8 +12,8 @@ CMAKE_PROGRESS_11 =
CMAKE_PROGRESS_12
=
CMAKE_PROGRESS_13
=
5
CMAKE_PROGRESS_14
=
CMAKE_PROGRESS_15
=
6
CMAKE_PROGRESS_16
=
CMAKE_PROGRESS_15
=
CMAKE_PROGRESS_16
=
6
CMAKE_PROGRESS_17
=
CMAKE_PROGRESS_18
=
7
CMAKE_PROGRESS_19
=
...
...
@@ -29,8 +29,8 @@ CMAKE_PROGRESS_28 =
CMAKE_PROGRESS_29
=
CMAKE_PROGRESS_30
=
11
CMAKE_PROGRESS_31
=
CMAKE_PROGRESS_32
=
12
CMAKE_PROGRESS_33
=
CMAKE_PROGRESS_32
=
CMAKE_PROGRESS_33
=
12
CMAKE_PROGRESS_34
=
CMAKE_PROGRESS_35
=
13
CMAKE_PROGRESS_36
=
...
...
build/third_party/mosquitto/lib/CMakeFiles/libmosquitto_static.dir/progress.make
View file @
c7c7206a
...
...
@@ -2,8 +2,8 @@ CMAKE_PROGRESS_1 =
CMAKE_PROGRESS_2
=
CMAKE_PROGRESS_3
=
17
CMAKE_PROGRESS_4
=
CMAKE_PROGRESS_5
=
18
CMAKE_PROGRESS_6
=
CMAKE_PROGRESS_5
=
CMAKE_PROGRESS_6
=
18
CMAKE_PROGRESS_7
=
CMAKE_PROGRESS_8
=
19
CMAKE_PROGRESS_9
=
...
...
@@ -19,8 +19,8 @@ CMAKE_PROGRESS_18 =
CMAKE_PROGRESS_19
=
CMAKE_PROGRESS_20
=
23
CMAKE_PROGRESS_21
=
CMAKE_PROGRESS_22
=
24
CMAKE_PROGRESS_23
=
CMAKE_PROGRESS_22
=
CMAKE_PROGRESS_23
=
24
CMAKE_PROGRESS_24
=
CMAKE_PROGRESS_25
=
25
CMAKE_PROGRESS_26
=
...
...
@@ -36,10 +36,10 @@ CMAKE_PROGRESS_35 =
CMAKE_PROGRESS_36
=
CMAKE_PROGRESS_37
=
29
CMAKE_PROGRESS_38
=
CMAKE_PROGRESS_39
=
30
CMAKE_PROGRESS_40
=
CMAKE_PROGRESS_39
=
CMAKE_PROGRESS_40
=
30
CMAKE_PROGRESS_41
=
CMAKE_PROGRESS_42
=
31
CMAKE_PROGRESS_43
=
CMAKE_PROGRESS_42
=
CMAKE_PROGRESS_43
=
31
CMAKE_PROGRESS_44
=
build/third_party/mosquitto/plugins/dynamic-security/CMakeFiles/mosquitto_dynamic_security.dir/progress.make
View file @
c7c7206a
...
...
@@ -6,8 +6,8 @@ CMAKE_PROGRESS_5 =
CMAKE_PROGRESS_6
=
CMAKE_PROGRESS_7
=
87
CMAKE_PROGRESS_8
=
CMAKE_PROGRESS_9
=
CMAKE_PROGRESS_10
=
88
CMAKE_PROGRESS_9
=
88
CMAKE_PROGRESS_10
=
CMAKE_PROGRESS_11
=
CMAKE_PROGRESS_12
=
89
build/third_party/mosquitto/src/CMakeFiles/mosquitto.dir/progress.make
View file @
c7c7206a
...
...
@@ -6,11 +6,11 @@ CMAKE_PROGRESS_5 =
CMAKE_PROGRESS_6
=
CMAKE_PROGRESS_7
=
56
CMAKE_PROGRESS_8
=
CMAKE_PROGRESS_9
=
CMAKE_PROGRESS_10
=
57
CMAKE_PROGRESS_9
=
57
CMAKE_PROGRESS_10
=
CMAKE_PROGRESS_11
=
CMAKE_PROGRESS_12
=
CMAKE_PROGRESS_13
=
58
CMAKE_PROGRESS_12
=
58
CMAKE_PROGRESS_13
=
CMAKE_PROGRESS_14
=
CMAKE_PROGRESS_15
=
59
CMAKE_PROGRESS_16
=
...
...
@@ -23,11 +23,11 @@ CMAKE_PROGRESS_22 =
CMAKE_PROGRESS_23
=
CMAKE_PROGRESS_24
=
62
CMAKE_PROGRESS_25
=
CMAKE_PROGRESS_26
=
CMAKE_PROGRESS_27
=
63
CMAKE_PROGRESS_26
=
63
CMAKE_PROGRESS_27
=
CMAKE_PROGRESS_28
=
CMAKE_PROGRESS_29
=
CMAKE_PROGRESS_30
=
64
CMAKE_PROGRESS_29
=
64
CMAKE_PROGRESS_30
=
CMAKE_PROGRESS_31
=
CMAKE_PROGRESS_32
=
65
CMAKE_PROGRESS_33
=
...
...
@@ -40,11 +40,11 @@ CMAKE_PROGRESS_39 =
CMAKE_PROGRESS_40
=
CMAKE_PROGRESS_41
=
68
CMAKE_PROGRESS_42
=
CMAKE_PROGRESS_43
=
CMAKE_PROGRESS_44
=
69
CMAKE_PROGRESS_43
=
69
CMAKE_PROGRESS_44
=
CMAKE_PROGRESS_45
=
CMAKE_PROGRESS_46
=
CMAKE_PROGRESS_47
=
70
CMAKE_PROGRESS_46
=
70
CMAKE_PROGRESS_47
=
CMAKE_PROGRESS_48
=
CMAKE_PROGRESS_49
=
71
CMAKE_PROGRESS_50
=
...
...
@@ -57,11 +57,11 @@ CMAKE_PROGRESS_56 =
CMAKE_PROGRESS_57
=
CMAKE_PROGRESS_58
=
74
CMAKE_PROGRESS_59
=
CMAKE_PROGRESS_60
=
CMAKE_PROGRESS_61
=
75
CMAKE_PROGRESS_60
=
75
CMAKE_PROGRESS_61
=
CMAKE_PROGRESS_62
=
CMAKE_PROGRESS_63
=
CMAKE_PROGRESS_64
=
76
CMAKE_PROGRESS_63
=
76
CMAKE_PROGRESS_64
=
CMAKE_PROGRESS_65
=
CMAKE_PROGRESS_66
=
77
CMAKE_PROGRESS_67
=
...
...
drivers/gpio/device_init.c
View file @
c7c7206a
...
...
@@ -5,9 +5,7 @@
int
g_device_delay_back_count
=
0
;
//设备计时,比如坦克打击倒退逻辑
int
abnormal_pin_pwm_stop
=
0
;
int
g_device_type
=
0
;
//设备详细类型,比如tank0202、car0101
int
g_device_type
=
0
;
//设备详细类型,让其他地方判断,比如tank0202、car0101
const
deviceconfig_t
device_configs
[]
=
{
// car0101配置
...
...
@@ -90,8 +88,8 @@ const deviceconfig_t device_configs[] = {
{
.
device_id
=
DEVICE_SHIP0301
,
.
device_name
=
"ship0301"
,
.
gpio_pins
=
{
5
,
6
,
7
,
10
,
16
,
20
,
22
,
23
,
24
,
25
,
26
,
-
1
},
/* 补充GPIO引脚 */
.
gpio_pwms
=
{
27
,
-
1
},
.
gpio_pins
=
{
6
,
16
,
20
,
22
,
23
,
-
1
},
/* 补充GPIO引脚 */
.
gpio_pwms
=
{
5
,
7
,
24
,
26
,
27
,
-
1
},
.
device_pwm_init
=
physics_pwm_init
,
.
device_control_stop
=
ship0301_stop
,
/* 补充速度控制函数 */
.
emergency_code
=
301
...
...
modules/browser/browser_open.c
View file @
c7c7206a
...
...
@@ -2,6 +2,7 @@
#include "browser_open.h"
#include "device_fileopen.h"
#include "device_identity.h"
#include "http_config_mqtt.h"
char
gwebcam
[
2048
];
//存放启动火狐网站命令
...
...
modules/http/http_config_mqtt.c
0 → 100644
View file @
c7c7206a
#include "device_identity.h"
#include "http_config_mqtt.h"
#include<curl/curl.h>
#include "cjson/cJSON.h"
#include "http_request.h"
DEVICE_MQTTCONFIG
g_mqtt_cam_config
;
DEVICE_MQTTCONFIG
*
g_mqtt_cam_config_t
=
&
g_mqtt_cam_config
;
int
parse_device_config
(
const
char
*
json_str
)
{
// 解析 JSON
cJSON
*
root
=
cJSON_Parse
(
json_str
);
if
(
!
root
)
{
fprintf
(
stderr
,
"JSON 解析失败: %s
\n
"
,
cJSON_GetErrorPtr
());
return
-
1
;
}
// 1. 提取顶层字段
cJSON
*
message
=
cJSON_GetObjectItemCaseSensitive
(
root
,
"message"
);
cJSON
*
code
=
cJSON_GetObjectItemCaseSensitive
(
root
,
"code"
);
if
(
cJSON_IsString
(
message
)
&&
cJSON_IsNumber
(
code
))
{
my_zlog_debug
(
"状态: %s"
,
message
->
valuestring
);
my_zlog_debug
(
"状态码: %d"
,
code
->
valueint
);
if
(
code
->
valueint
!=
200
){
my_zlog_error
(
"code error"
);
return
-
1
;
}
}
// 2. 提取 data 对象
cJSON
*
data
=
cJSON_GetObjectItemCaseSensitive
(
root
,
"data"
);
if
(
data
)
{
// 3. 提取 mqtt 服务器列表
cJSON
*
mqtt
=
cJSON_GetObjectItemCaseSensitive
(
data
,
"mqtt"
);
if
(
cJSON_IsArray
(
mqtt
))
{
my_zlog_info
(
"MQTT 服务器:"
);
cJSON
*
item
;
int
i
=
0
;
cJSON_ArrayForEach
(
item
,
mqtt
)
{
if
(
cJSON_IsString
(
item
))
{
my_zlog_debug
(
" [%d] %s"
,
i
++
,
item
->
valuestring
);
strncpy
(
g_mqtt_cam_config_t
->
mqtt_servers
[
i
],
item
->
valuestring
,
sizeof
(
g_mqtt_cam_config_t
->
mqtt_servers
[
i
])
-
1
);
g_mqtt_cam_config_t
->
mqtt_servers
[
i
][
sizeof
(
g_mqtt_cam_config_t
->
mqtt_servers
[
i
])
-
1
]
=
'\0'
;
}
g_mqtt_cam_config_t
->
mqtt_count
=
i
;
}
}
// 4. 提取 api 和 videoUrl
cJSON
*
videoUrl
=
cJSON_GetObjectItemCaseSensitive
(
data
,
"videoUrl"
);
if
(
cJSON_IsString
(
videoUrl
))
{
my_zlog_debug
(
"视频地址: %s"
,
videoUrl
->
valuestring
);
strncpy
(
g_mqtt_cam_config_t
->
videourl
,
videoUrl
->
valuestring
,
sizeof
(
g_mqtt_cam_config_t
->
videourl
)
-
1
);
g_mqtt_cam_config_t
->
videourl
[
sizeof
(
g_mqtt_cam_config_t
->
videourl
)
-
1
]
=
'\0'
;
}
}
// 释放内存
cJSON_Delete
(
root
);
}
// 拉取并解析 JSON 数据的函数
int
deviceconfig_mqtt_video_init
()
{
CURL
*
curl
;
CURLcode
res
;
struct
MemoryStruct
chunk
=
{
NULL
,
0
};
curl_global_init
(
CURL_GLOBAL_DEFAULT
);
curl
=
curl_easy_init
();
if
(
!
curl
)
{
fprintf
(
stderr
,
"Failed to initialize CURL
\n
"
);
my_zlog_error
(
"Failed to initialize CURL"
);
return
-
1
;
}
// 构造请求 URL
char
url
[
512
];
snprintf
(
url
,
sizeof
(
url
),
"http://192.168.0.112:8111/device/getConfig?deviceNo=%s"
,
mqtt_topic_pure_number
());
my_zlog_info
(
"url:%s"
,
url
);
// 设置 CURL 选项
curl_easy_setopt
(
curl
,
CURLOPT_URL
,
url
);
curl_easy_setopt
(
curl
,
CURLOPT_WRITEFUNCTION
,
writememorycallback
);
curl_easy_setopt
(
curl
,
CURLOPT_WRITEDATA
,
(
void
*
)
&
chunk
);
curl_easy_setopt
(
curl
,
CURLOPT_USERAGENT
,
"libcurl-agent/1.0"
);
// 执行 HTTP 请求
res
=
curl_easy_perform
(
curl
);
if
(
res
!=
CURLE_OK
)
{
fprintf
(
stderr
,
"curl_easy_perform() failed: %s
\n
"
,
curl_easy_strerror
(
res
));
my_zlog_error
(
"curl_easy_perform() failed"
);
return
-
1
;
}
else
{
// 解析返回的 JSON 数据
cJSON
*
root
=
cJSON_Parse
(
chunk
.
memory
);
if
(
!
root
)
{
fprintf
(
stderr
,
"JSON parse error: %s
\n
"
,
cJSON_GetErrorPtr
());
my_zlog_error
(
"JSON parse error"
);
}
else
{
parse_device_config
(
chunk
.
memory
);
}
}
// 清理资源
free
(
chunk
.
memory
);
curl_easy_cleanup
(
curl
);
curl_global_cleanup
();
return
0
;
}
/*mqtt服务器和视频流地址初始化*/
int
http_mqtt_video_init
(){
for
(
int
i
=
0
;
i
<
3
;
i
++
){
if
(
deviceconfig_mqtt_video_init
()
==
0
){
my_zlog_info
(
"http_mqtt_video_init success"
);
return
0
;
}
else
{
my_zlog_info
(
"http_mqtt_video_init reconnect"
);
}
}
my_zlog_error
(
"http_mqtt_video_init failure"
);
return
-
1
;
}
\ No newline at end of file
modules/http/http_config_mqtt.h
0 → 100644
View file @
c7c7206a
#ifndef _HTTP_CONFIG_MQTT_H
#define _HTTP_CONFIG_MQTT_H
#include "common.h"
typedef
struct
{
char
videourl
[
512
];
char
mqtt_servers
[
10
][
256
];
int
mqtt_count
;
}
DEVICE_MQTTCONFIG
;
extern
DEVICE_MQTTCONFIG
*
g_mqtt_cam_config_t
;
/*mqtt服务器和视频流地址初始化*/
int
http_mqtt_video_init
();
#endif
\ No newline at end of file
modules/http/http_request.c
View file @
c7c7206a
...
...
@@ -15,7 +15,7 @@ double g_err_voltage_value=9.7;
double
g_shot_speed_value
=
0
.
5
;
// 回调函数,用于处理接收到的数据
s
tatic
size_t
WriteMemoryC
allback
(
void
*
contents
,
size_t
size
,
size_t
nmemb
,
void
*
userp
)
{
s
ize_t
writememoryc
allback
(
void
*
contents
,
size_t
size
,
size_t
nmemb
,
void
*
userp
)
{
size_t
realsize
=
size
*
nmemb
;
struct
MemoryStruct
*
mem
=
(
struct
MemoryStruct
*
)
userp
;
...
...
@@ -145,7 +145,7 @@ int request_date_open() {//请求数据
curl_easy_setopt
(
curl
,
CURLOPT_HTTPHEADER
,
headers
);
// 设置接收数据的回调函数
curl_easy_setopt
(
curl
,
CURLOPT_WRITEFUNCTION
,
WriteMemoryC
allback
);
curl_easy_setopt
(
curl
,
CURLOPT_WRITEFUNCTION
,
writememoryc
allback
);
curl_easy_setopt
(
curl
,
CURLOPT_WRITEDATA
,
(
void
*
)
&
chunk
);
// 执行请求
...
...
modules/http/http_request.h
View file @
c7c7206a
...
...
@@ -18,4 +18,7 @@ extern double g_warn_voltage_value;//警告电压
extern
double
g_err_voltage_value
;
//错误电压
int
request_date
();
//请求数据
size_t
writememorycallback
(
void
*
contents
,
size_t
size
,
size_t
nmemb
,
void
*
userp
);
#endif
modules/mqtt/mqtt_init.c
View file @
c7c7206a
...
...
@@ -4,11 +4,12 @@
#include "device_identity.h"
#include "mqtt_infor_handle.h"
#include "mylog.h"
#include "http_config_mqtt.h"
struct
mosquitto
*
mosq
;
uint16_t
AppExit_pin_pwm
=
0
;
//判断坦克或者车的退出
//struct mosquitto *mosq1;
//struct mosquitto *mosq2;
//mqtt初始化
int
mqtt_init
()
{
...
...
@@ -21,6 +22,8 @@ int mqtt_init() {
return
-
1
;
}
mosquitto_int_option
(
mosq
,
MOSQ_OPT_PROTOCOL_VERSION
,
MQTT_PROTOCOL_V5
);
//mosquitto_int_option(mosq1, MOSQ_OPT_PROTOCOL_VERSION, MQTT_PROTOCOL_V5);
//mosquitto_int_option(mosq2, MOSQ_OPT_PROTOCOL_VERSION, MQTT_PROTOCOL_V5);
return
0
;
}
...
...
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