Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
G
gamera_videos_no_ui
Overview
Overview
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
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
liusq
gamera_videos_no_ui
Commits
6c388318
Commit
6c388318
authored
Sep 03, 2024
by
“liusq”
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
修复ping命令进程生命周期问题
parent
402424fb
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
17 additions
and
10 deletions
+17
-10
CameraHandle.cpp
+5
-2
MqttSubscriber.cpp
+10
-6
gamera_videos.pro
+2
-2
No files found.
CameraHandle.cpp
View file @
6c388318
...
@@ -436,7 +436,9 @@ void CameraHandle::sdkDevSnapSyn(XSDK_HANDLE hDevice, int nChannel){
...
@@ -436,7 +436,9 @@ void CameraHandle::sdkDevSnapSyn(XSDK_HANDLE hDevice, int nChannel){
QString
ip
=
QString
::
fromUtf8
(
loginParam
->
sDevId
);
QString
ip
=
QString
::
fromUtf8
(
loginParam
->
sDevId
);
bool
is_ping
=
vides_data
::
pingAddress
(
ip
);
bool
is_ping
=
vides_data
::
pingAddress
(
ip
);
if
(
!
is_ping
){
qInfo
()
<<
"ping 的结果"
<<
is_ping
;
if
(
is_ping
){
deviceReboot
();
deviceReboot
();
}
else
{
}
else
{
QString
ip
=
QString
::
fromUtf8
(
loginParam
->
sDevId
);
QString
ip
=
QString
::
fromUtf8
(
loginParam
->
sDevId
);
...
@@ -932,9 +934,10 @@ void CameraHandle::licensePlateRecognitionResults(vides_data::requestLicensePlat
...
@@ -932,9 +934,10 @@ void CameraHandle::licensePlateRecognitionResults(vides_data::requestLicensePlat
for
(
auto
&
plate
:
location
.
plates
)
{
for
(
auto
&
plate
:
location
.
plates
)
{
plate
.
img
.
clear
();
plate
.
img
.
clear
();
}
}
httpService
.
setHttpUrl
(
httpUrl
);
vides_data
::
response
*
img_resp
=
httpService
.
httpLicensePlateRecognition
(
location
,
result
);
vides_data
::
response
*
img_resp
=
httpService
.
httpLicensePlateRecognition
(
location
,
result
);
if
(
img_resp
->
code
!=
0
)
{
if
(
img_resp
->
code
!=
0
)
{
qInfo
()
<<
"
不加图片上次
失败"
;
qInfo
()
<<
"
车牌不加图片上传
失败"
;
}
}
instace
.
deleteObj
(
img_resp
);
instace
.
deleteObj
(
img_resp
);
}
else
{
}
else
{
...
...
MqttSubscriber.cpp
View file @
6c388318
...
@@ -114,7 +114,7 @@ int MqttSubscriber::messageArrived(char* topicName, int topicLen, MQTTAsync_mess
...
@@ -114,7 +114,7 @@ int MqttSubscriber::messageArrived(char* topicName, int topicLen, MQTTAsync_mess
qInfo
()
<<
"Failed to parse JSON payload"
;
qInfo
()
<<
"Failed to parse JSON payload"
;
}
}
int
res
=-
2
;
int
res
=-
2
;
//1开 2关 3 重启
//1开 2关 3 重启
4 GB28181开 5 GB28181关
CameraHandle
*
cameraHandle
=
MainWindow
::
sp_this
->
findHandle
(
response
.
sn
);
CameraHandle
*
cameraHandle
=
MainWindow
::
sp_this
->
findHandle
(
response
.
sn
);
if
(
cameraHandle
==
nullptr
){
if
(
cameraHandle
==
nullptr
){
qInfo
()
<<
"不存在该相机"
;
qInfo
()
<<
"不存在该相机"
;
...
@@ -126,10 +126,14 @@ int MqttSubscriber::messageArrived(char* topicName, int topicLen, MQTTAsync_mess
...
@@ -126,10 +126,14 @@ int MqttSubscriber::messageArrived(char* topicName, int topicLen, MQTTAsync_mess
if
(
response
.
msg_type
==
3
){
if
(
response
.
msg_type
==
3
){
res
=
cameraHandle
->
deviceReboot
();
res
=
cameraHandle
->
deviceReboot
();
}
}
if
(
response
.
msg_type
==
4
){
res
=
cameraHandle
->
updateSdkDevStatus
(
true
);
}
if
(
response
.
msg_type
==
5
){
res
=
cameraHandle
->
updateSdkDevStatus
(
false
);
}
}
}
vides_data
::
requestMqttData
request
;
vides_data
::
requestMqttData
request
;
qInfo
()
<<
"res"
<<
res
;
request
.
code
=
res
>=
0
?
0
:
0x01
;
request
.
code
=
res
>=
0
?
0
:
0x01
;
request
.
uniq
=
response
.
uniq
;
request
.
uniq
=
response
.
uniq
;
request
.
sn
=
response
.
sn
;
request
.
sn
=
response
.
sn
;
...
@@ -146,7 +150,7 @@ void MqttSubscriber::sendSubscriptionConfirmation(const vides_data::requestMqttD
...
@@ -146,7 +150,7 @@ void MqttSubscriber::sendSubscriptionConfirmation(const vides_data::requestMqttD
QByteArray
bResponseTopic
=
responseTopic
.
toUtf8
();
QByteArray
bResponseTopic
=
responseTopic
.
toUtf8
();
char
*
cResponseTopic
=
bResponseTopic
.
data
();
char
*
cResponseTopic
=
bResponseTopic
.
data
();
qInfo
()
<<
"sendSubscriptionConfirmation"
<<
cResponseTopic
;
qInfo
()
<<
"sendSubscriptionConfirmation"
<<
cResponseTopic
;
// 将 struct 转换成 JSON 格式
// 将 struct 转换成 JSON 格式
QJsonObject
json
;
QJsonObject
json
;
json
[
"code"
]
=
response
.
code
;
json
[
"code"
]
=
response
.
code
;
...
@@ -154,7 +158,7 @@ void MqttSubscriber::sendSubscriptionConfirmation(const vides_data::requestMqttD
...
@@ -154,7 +158,7 @@ void MqttSubscriber::sendSubscriptionConfirmation(const vides_data::requestMqttD
QJsonDocument
jsonDoc
(
json
);
QJsonDocument
jsonDoc
(
json
);
QByteArray
payload
=
jsonDoc
.
toJson
(
QJsonDocument
::
Compact
);
QByteArray
payload
=
jsonDoc
.
toJson
(
QJsonDocument
::
Compact
);
MQTTAsync_message
pubmsg
=
MQTTAsync_message_initializer
;
MQTTAsync_message
pubmsg
=
MQTTAsync_message_initializer
;
pubmsg
.
payload
=
const_cast
<
char
*>
(
payload
.
data
());
pubmsg
.
payload
=
const_cast
<
char
*>
(
payload
.
data
());
pubmsg
.
payloadlen
=
payload
.
size
();
pubmsg
.
payloadlen
=
payload
.
size
();
pubmsg
.
qos
=
config
.
qos
;
pubmsg
.
qos
=
config
.
qos
;
...
...
gamera_videos.pro
View file @
6c388318
...
@@ -134,5 +134,5 @@ qnx: target.path = /tmp/$${TARGET}/bin
...
@@ -134,5 +134,5 @@ qnx: target.path = /tmp/$${TARGET}/bin
else
:
unix
:
!
android
:
target
.
path
=
/
opt
/
$$
{
TARGET
}
/
bin
else
:
unix
:
!
android
:
target
.
path
=
/
opt
/
$$
{
TARGET
}
/
bin
!
isEmpty
(
target
.
path
)
:
INSTALLS
+=
target
!
isEmpty
(
target
.
path
)
:
INSTALLS
+=
target
RESOURCES
+=
\
#
RESOURCES += \
BG
.
qrc
#
BG.qrc
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