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
97c5d870
Commit
97c5d870
authored
Oct 11, 2024
by
“liusq”
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
修改mqtt断线06
parent
e3cfe167
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
34 additions
and
28 deletions
+34
-28
CameraHandle.cpp
+34
-28
No files found.
CameraHandle.cpp
View file @
97c5d870
...
@@ -1073,43 +1073,49 @@ int CameraHandle::resetGb28181(QString &uuiq){
...
@@ -1073,43 +1073,49 @@ int CameraHandle::resetGb28181(QString &uuiq){
}
}
// 阻塞等待5秒
// 阻塞等待5秒
//QThread::sleep(5);
//QThread::sleep(5);
QTimer
::
singleShot
(
5000
,
this
,
[
this
,
&
is_wifi
,
&
result
,
&
uuiq
,
&
connectedCameraHandle
,
&
newHandle
,
&
device
,
&
old
]()
{
QString
old_ip
;
QTimer
*
timer
=
new
QTimer
(
this
);
int
res
=
1
;
MainWindow
::
sp_this
->
findSnMapIp
(
this
->
sSn
,
old_ip
);
// 连接 QTimer 的超时信号到匿名槽函数
if
(
old_ip
.
length
()
>
0
){
QObject
::
connect
(
timer
,
&
QTimer
::
timeout
,
[
this
,
&
is_wifi
,
&
result
,
&
uuiq
,
&
connectedCameraHandle
,
&
newHandle
,
&
device
,
&
old
,
timer
]()
{
if
(
is_wifi
){
QString
old_ip
;
result
=
connectedCameraHandle
->
wifiChangeIp
(
old_ip
,
newHandle
,
sSn
);
int
res
=
1
;
int
sdk_handle
=
this
->
sdkDevLoginSyn
(
old_ip
,
loginParam
->
nDevPort
,
loginParam
->
sUserName
,
loginParam
->
sPassword
,
3000
);
MainWindow
::
sp_this
->
findSnMapIp
(
this
->
sSn
,
old_ip
);
if
(
sdk_handle
<
0
){
if
(
old_ip
.
length
()
>
0
)
{
qInfo
()
<<
QString
(
"SN(%1): WIFI新句柄生成失败"
).
arg
(
sSn
);
if
(
is_wifi
)
{
this
->
hDevice
=
newHandle
;
result
=
connectedCameraHandle
->
wifiChangeIp
(
old_ip
,
newHandle
,
sSn
);
res
=
-
1
;
int
sdk_handle
=
this
->
sdkDevLoginSyn
(
old_ip
,
loginParam
->
nDevPort
,
loginParam
->
sUserName
,
loginParam
->
sPassword
,
3000
);
}
else
{
if
(
sdk_handle
<
0
)
{
qInfo
()
<<
QString
(
"SN(%1): WIFI新句柄生成失败"
).
arg
(
sSn
);
this
->
hDevice
=
newHandle
;
res
=
-
1
;
}
else
{
XSDK_DevLogout
(
newHandle
);
XSDK_DevLogout
(
newHandle
);
qInfo
()
<<
QString
(
"SN(%1): WIFI新句柄生成成功"
).
arg
(
sSn
);
qInfo
()
<<
QString
(
"SN(%1): WIFI新句柄生成成功"
).
arg
(
sSn
);
}
}
}
else
{
}
else
{
device
.
reachableIp
=
old_ip
;
device
.
reachableIp
=
old_ip
;
device
.
sSn
=
sSn
;
device
.
sSn
=
sSn
;
bool
result
=
connectedCameraHandle
->
changeCameraIp
(
device
);
bool
result
=
connectedCameraHandle
->
changeCameraIp
(
device
);
if
(
result
)
{
if
(
result
)
{
int
sdk_handle
=
this
->
sdkDevLoginSyn
(
old_ip
,
loginParam
->
nDevPort
,
loginParam
->
sUserName
,
loginParam
->
sPassword
,
3000
);
int
sdk_handle
=
this
->
sdkDevLoginSyn
(
old_ip
,
loginParam
->
nDevPort
,
loginParam
->
sUserName
,
loginParam
->
sPassword
,
3000
);
if
(
sdk_handle
<
0
)
{
if
(
sdk_handle
<
0
)
{
qInfo
()
<<
QString
(
"SN(%1): 有线新句柄生成失败"
).
arg
(
sSn
);
qInfo
()
<<
QString
(
"SN(%1): 有线新句柄生成失败"
).
arg
(
sSn
);
this
->
hDevice
=
old
;
this
->
hDevice
=
old
;
res
=
-
1
;
res
=
-
1
;
}
else
{
}
else
{
XSDK_DevLogout
(
old
);
XSDK_DevLogout
(
old
);
qInfo
()
<<
QString
(
"SN(%1): 有线新句柄生成成功"
).
arg
(
sSn
);
qInfo
()
<<
QString
(
"SN(%1): 有线新句柄生成成功"
).
arg
(
sSn
);
}
}
}
}
}
}
}
}
MainWindow
::
sp_this
->
mqttEmitAsynchronous
(
uuiq
,
res
,
device
.
sSn
);
MainWindow
::
sp_this
->
mqttEmitAsynchronous
(
uuiq
,
res
,
device
.
sSn
);
return
res
;
timer
->
deleteLater
();
// 确保在任务完成后删除 QTimer
});
});
// 设置 QTimer 的超时时间为 5 秒
timer
->
setSingleShot
(
true
);
timer
->
start
(
5000
);
//this->updateSdkDevStatus(true);
//this->updateSdkDevStatus(true);
return
1
;
return
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