Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
P
pg_gps
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
1
Merge Requests
1
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
957dd
pg_gps
Commits
d1e6008f
Commit
d1e6008f
authored
Sep 15, 2025
by
957dd
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
将第三方库改变了utf-8格式能提交,和加入了远程重启
parent
3856a8a5
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
23 additions
and
3 deletions
+23
-3
.gitignore
.gitignore
+6
-0
main.cc.o
build/CMakeFiles/main.dir/src/main.cc.o
+0
-0
main
build/main
+0
-0
main.cc
src/main.cc
+17
-3
No files found.
.gitignore
View file @
d1e6008f
Deviceld.txt
build/CMakeFiles/
build/cmake_install.cmake
build/CMakeCache.txt
build/CTestTestfile.cmake
\ No newline at end of file
build/CMakeFiles/main.dir/src/main.cc.o
View file @
d1e6008f
No preview for this file type
build/main
View file @
d1e6008f
No preview for this file type
src/main.cc
View file @
d1e6008f
...
...
@@ -6,6 +6,7 @@
#include <chrono>
#include <iomanip>
#include <string>
#include <cstdlib>
#include "device_tag_bind.hpp"
#include "serial_port.hpp"
#include "positioning_data.hpp"
...
...
@@ -70,11 +71,17 @@ void onSerialMessageReceived(const std::vector<uint8_t>& message) {
x_local
[
i
]
=
(
static_cast
<
uint16_t
>
(
message
[
13
])
<<
8
)
|
message
[
14
];
y_local
[
i
]
=
(
static_cast
<
uint16_t
>
(
message
[
15
])
<<
8
)
|
message
[
16
];
std
::
cout
<<
"串口数据更新 -> 标签ID: "
<<
tag_id
[
i
]
static
auto
last_print
=
std
::
chrono
::
steady_clock
::
now
();
if
((
std
::
chrono
::
steady_clock
::
now
()
-
last_print
)
>
std
::
chrono
::
milliseconds
(
200
))
{
std
::
cout
<<
"串口数据更新 -> 标签ID: "
<<
tag_id
[
i
]
<<
", X: "
<<
x_local
[
i
]
<<
", Y: "
<<
y_local
[
i
]
<<
std
::
endl
;
last_print
=
std
::
chrono
::
steady_clock
::
now
();
}
}
}
// std::this_thread::sleep_for(std::chrono::milliseconds(200));
}
std
::
string
file_open_read
(){
...
...
@@ -140,7 +147,14 @@ std::shared_ptr<MqttTopicsHandler> mqtt_init_and_connect() {
sub_json
[
"head"
].
is_object
()
&&
sub_json
[
"head"
].
contains
(
"message_type"
)
&&
sub_json
[
"head"
][
"message_type"
].
is_number_integer
()
&&
sub_json
[
"head"
][
"message_type"
].
get
<
int
>
()
==
3
){
sub_json
[
"head"
][
"message_type"
].
get
<
int
>
()
==
2011
){
system
(
"sudo reboot"
);
}
if
(
sub_json
.
contains
(
"head"
)
&&
sub_json
[
"head"
].
is_object
()
&&
sub_json
[
"head"
].
contains
(
"message_type"
)
&&
sub_json
[
"head"
][
"message_type"
].
is_number_integer
()
&&
sub_json
[
"head"
][
"message_type"
].
get
<
int
>
()
==
3
){
std
::
string
device_local_label_id
=
g_device_tag_t
.
find
(
sub_topic
);
int
tag_id_num_int
=
std
::
stoi
(
device_local_label_id
);
...
...
@@ -155,7 +169,7 @@ std::shared_ptr<MqttTopicsHandler> mqtt_init_and_connect() {
};
g_positioning_data_t
=
bind_tag_send_data_t
;
std
::
cout
<<
"发送成功"
<<
std
::
endl
;
g_mqtt_handler
->
publish
(
final_publish_topic
,
transfor_json
(
g_positioning_data_t
));
g_mqtt_handler
->
publish
(
final_publish_topic
,
transfor_json
(
g_positioning_data_t
));
//使用全局的 g_mqtt_handler 来发布
//mqtt_handler->PublishJson(final_publish_topic, root_json);
}
...
...
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