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
a6ba9a6e
Commit
a6ba9a6e
authored
Dec 24, 2024
by
957dd
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
update mqtt
parent
b8278eba
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
17 additions
and
17 deletions
+17
-17
log.txt
log/log.txt
+0
-0
main
main
+0
-0
mqtt.c
mqtt.c
+13
-14
mqtt.h
mqtt.h
+3
-2
opensh.c
opensh.c
+1
-1
No files found.
log/log.txt
View file @
a6ba9a6e
This diff is collapsed.
Click to expand it.
main
View file @
a6ba9a6e
No preview for this file type
mqtt.c
View file @
a6ba9a6e
...
...
@@ -16,6 +16,18 @@ unsigned char gpinTemp=0;
unsigned
char
gvalTemp
=
0
;
unsigned
char
gvalt
[
4
];
int
mqtt_init
()
{
// 初始化 mosquitto 库
mosquitto_lib_init
();
mosq
=
mosquitto_new
(
NULL
,
true
,
NULL
);
if
(
!
mosq
)
{
fprintf
(
stderr
,
"Failed to create Mosquitto client
\n
"
);
return
-
1
;
}
mosquitto_int_option
(
mosq
,
MOSQ_OPT_PROTOCOL_VERSION
,
MQTT_PROTOCOL_V5
);
}
void
on_connect
(
struct
mosquitto
*
mosq
,
void
*
obj
,
int
rc
)
//回调函数
{
...
...
@@ -32,19 +44,6 @@ void on_connect(struct mosquitto *mosq, void *obj, int rc) //回调函数
}
int
mqtt_init
()
{
// 初始化 mosquitto 库
mosquitto_lib_init
();
mosq
=
mosquitto_new
(
NULL
,
true
,
NULL
);
if
(
!
mosq
)
{
fprintf
(
stderr
,
"Failed to create Mosquitto client
\n
"
);
return
-
1
;
}
mosquitto_int_option
(
mosq
,
MOSQ_OPT_PROTOCOL_VERSION
,
MQTT_PROTOCOL_V5
);
}
//int init_mqtt(struct mosquitto *mosq)
/*
void mqtt_MAC_wirte()
...
...
@@ -84,7 +83,7 @@ void mqtt_wirte()
printf
(
"%s
\n
"
,
payload
);
mosquitto_publish
(
mosq
,
NULL
,
TOPIC2
,
strlen
(
payload
),
payload
,
0
,
false
);
mosquitto_publish
(
mosq
,
NULL
,
TOPIC3
,
strlen
(
payload
),
payload
,
0
,
false
);
}
...
...
mqtt.h
View file @
a6ba9a6e
...
...
@@ -13,8 +13,9 @@
#define BROKER_ADDRESS "119.45.167.177"
#define BROKER_PORT 1883
#define TOPIC "IEP/controlcar0001"
#define TOPIC2 "IEQ/controlcar0001"
#define TOPIC "dev2app/controlcar0002"
#define TOPIC2 "app2dev/controlcar0002"
#define TOPIC3 "ser2dev"
#define USERNAME "admin" // 替换为你的用户名
#define PASSWORD "admin" // 替换为你的密码
...
...
opensh.c
View file @
a6ba9a6e
...
...
@@ -10,7 +10,7 @@ int opencamsh()
setenv
(
"DISPLAY"
,
":0"
,
1
);
//设置环境变量https://jywy.yd-ss.com?dev=controcar0004 --new-window sudo
//sprintf(gwebcam,"sudo firefox --new-window https://jywy.yd-ss.com?dev=%s &",gsite);
system
(
"sudo firefox https://jywy.yd-ss.com?dev=controlcar000
1
"
);
system
(
"sudo firefox https://jywy.yd-ss.com?dev=controlcar000
2
"
);
printf
(
"%s
\n
"
,
gwebcam
);
printf
(
"close cam
\n
"
);
...
...
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