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
eb684c5f
Commit
eb684c5f
authored
Feb 20, 2025
by
“liusq”
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
修改实时更新远程配置
parent
c16961f4
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
27 additions
and
16 deletions
+27
-16
mainwindow.cpp
+25
-16
mainwindow.h
+2
-0
No files found.
mainwindow.cpp
View file @
eb684c5f
...
...
@@ -30,23 +30,9 @@ MainWindow::MainWindow():isResetting(false)
}
else
{
httpurl
=
qSetting
->
value
(
"cloudservice/pro_http"
).
toString
();
}
Common
&
instace
=
Common
::
getInstance
();
QString
serialNumber
;
findLocalSerialNumber
(
serialNumber
);
bool
configFetched
=
false
;
while
(
!
configFetched
)
{
HttpService
httpService
(
httpurl
);
vides_data
::
response
*
res
=
httpService
.
httpDeviceConfig
(
serialNumber
,
config
);
if
(
res
->
code
!=
0
)
{
qInfo
()
<<
"请求远程商户配置失败,重试中..."
;
instace
.
deleteObj
(
res
);
QThread
::
sleep
(
5
);
// 等待5秒后重试
}
else
{
instace
.
deleteObj
(
res
);
configFetched
=
true
;
}
}
realTimeUpdateDivConfig
(
httpurl
,
serialNumber
);
initCommon
();
...
...
@@ -143,6 +129,26 @@ MainWindow::MainWindow():isResetting(false)
this
->
mqttConfig
=
config
.
mqttConfig
;
runOrRebootMqtt
(
mqttConfig
,
httpurl
,
serialNumber
);
}
void
MainWindow
::
realTimeUpdateDivConfig
(
QString
&
httpurl
,
QString
&
serialNumber
){
Common
&
instace
=
Common
::
getInstance
();
findLocalSerialNumber
(
serialNumber
);
bool
configFetched
=
false
;
while
(
!
configFetched
)
{
HttpService
httpService
(
httpurl
);
vides_data
::
response
*
res
=
httpService
.
httpDeviceConfig
(
serialNumber
,
config
);
if
(
res
->
code
!=
0
)
{
qInfo
()
<<
"请求远程商户配置失败,重试中..."
;
instace
.
deleteObj
(
res
);
QThread
::
sleep
(
5
);
// 等待5秒后重试
}
else
{
instace
.
deleteObj
(
res
);
configFetched
=
true
;
}
}
}
void
MainWindow
::
runOrRebootMqtt
(
vides_data
::
MqttConfig
&
mqtt_config
,
QString
&
httpUrl
,
QString
&
serialNumber
){
MqttSubscriber
*
subscriber
=
MqttSubscriber
::
getInstance
(
this
);
subscriber
->
init
(
mqtt_config
,
httpUrl
,
serialNumber
);
...
...
@@ -579,6 +585,9 @@ void MainWindow::startCamera(const QString &httpurl){
qInfo
()
<<
"盒子获取mac失败"
;
}
reStatus
.
mac
=
std
::
move
(
is_mac
);
realTimeUpdateDivConfig
(
nonConstHttpUrl
,
serialNumber
);
HttpService
httpService
(
httpurl
);
vides_data
::
response
*
re
=
httpService
.
httpFindCameras
(
serialNumber
,
devices
);
...
...
mainwindow.h
View file @
eb684c5f
...
...
@@ -53,6 +53,8 @@ public:
CameraHandle
*
findHandle
(
QString
sn
);
void
realTimeUpdateDivConfig
(
QString
&
httpurl
,
QString
&
serialNumber
);
bool
getDeviceStatus
(
int
UserId
);
void
modifySnMapIp
(
QString
&
sn
,
QString
&
ip
);
...
...
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