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
545cccd2
Commit
545cccd2
authored
Oct 11, 2024
by
“liusq”
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
修改gb28181
parent
74dc3946
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
81 additions
and
5 deletions
+81
-5
CameraHandle.cpp
+74
-2
CameraHandle.h
+6
-1
MqttSubscriber.cpp
+1
-2
No files found.
CameraHandle.cpp
View file @
545cccd2
...
...
@@ -1020,6 +1020,7 @@ void CameraHandle::printWifi(XSDK_HANDLE hDevice,XSDK_CFG::NetWork_Wifi &cfg){
int
CameraHandle
::
resetGb28181
(){
NonConnectedCameraHandle
*
connectedCameraHandle
=
NonConnectedCameraHandle
::
getInstance
();
int
old
=
hDevice
;
MainWindow
::
sp_this
->
setIsResetting
(
true
);
bool
is_wifi
=
false
;
ScopeSemaphoreExit
guard
([]()
{
...
...
@@ -1054,6 +1055,7 @@ int CameraHandle::resetGb28181(){
int
sdk_handle
=
this
->
sdkDevLoginSyn
(
reachableIp
,
loginParam
->
nDevPort
,
loginParam
->
sUserName
,
loginParam
->
sPassword
,
3000
);
if
(
sdk_handle
<
0
){
qInfo
()
<<
QString
(
"SN(%1): WIFI新句柄生成失败"
).
arg
(
sSn
);
this
->
hDevice
=
old
;
return
-
1
;
}
else
{
qInfo
()
<<
QString
(
"SN(%1): WIFI新句柄生成成功"
).
arg
(
sSn
);
...
...
@@ -1074,10 +1076,11 @@ int CameraHandle::resetGb28181(){
int
sdk_handle
=
this
->
sdkDevLoginSyn
(
old_ip
,
loginParam
->
nDevPort
,
loginParam
->
sUserName
,
loginParam
->
sPassword
,
3000
);
if
(
sdk_handle
<
0
){
qInfo
()
<<
QString
(
"SN(%1): WIFI新句柄生成失败"
).
arg
(
sSn
);
this
->
hDevice
=
newHandle
;
return
-
1
;
}
else
{
XSDK_DevLogout
(
newHandle
);
qInfo
()
<<
QString
(
"SN(%1): WIFI新句柄生成成功"
).
arg
(
sSn
);
}
}
else
{
device
.
reachableIp
=
old_ip
;
...
...
@@ -1087,6 +1090,8 @@ int CameraHandle::resetGb28181(){
int
sdk_handle
=
this
->
sdkDevLoginSyn
(
old_ip
,
loginParam
->
nDevPort
,
loginParam
->
sUserName
,
loginParam
->
sPassword
,
3000
);
if
(
sdk_handle
<
0
){
qInfo
()
<<
QString
(
"SN(%1): 有线新句柄生成失败"
).
arg
(
sSn
);
this
->
hDevice
=
old
;
return
-
1
;
}
else
{
XSDK_DevLogout
(
old
);
qInfo
()
<<
QString
(
"SN(%1): 有线新句柄生成成功"
).
arg
(
sSn
);
...
...
@@ -1100,6 +1105,71 @@ int CameraHandle::resetGb28181(){
}
int
CameraHandle
::
forceWriteGb28181
(){
Common
&
instace
=
Common
::
getInstance
();
HttpService
http_gb28181
(
httpUrl
);
vides_data
::
response
*
res
=
http_gb28181
.
httpFindGb28181Config
(
sSn
);
ScopeSemaphoreExit
guard
([
&
instace
,
&
res
]()
{
instace
.
deleteObj
(
res
);
});
if
(
res
->
code
!=
0
){
qInfo
()
<<
"请求摄像头gb28181配置失败"
;
return
-
1
;
}
vides_data
::
responseGb28181
*
gb28181
=
reinterpret_cast
<
vides_data
::
responseGb28181
*>
(
res
->
data
);
XSDK_CFG
::
NetWork_SPVMN
config
;
config
.
Camreaid
.
InitArraySize
(
64
);
for
(
int
i
=
1
;
i
<=
64
;
++
i
)
{
if
(
i
==
1
)
{
QByteArray
b_StrValue
=
gb28181
->
channel_id
.
toUtf8
();
const
char
*
str_Value
=
b_StrValue
.
constData
();
JStrObj
*
newCameraId
=
&
config
.
Camreaid
[
i
-
1
];
newCameraId
->
operator
=
(
str_Value
);
}
else
{
QString
str
(
"3402000000131000001"
+
QString
::
number
(
i
,
10
).
rightJustified
(
2
,
'0'
));
QByteArray
b_Str
=
str
.
toUtf8
();
const
char
*
s_ct
=
b_Str
.
constData
();
JStrObj
*
newCameraId
=
&
config
.
Camreaid
[
i
-
1
];
newCameraId
->
operator
=
(
s_ct
);
}
}
QByteArray
&&
bSip_ip
=
gb28181
->
sip_ip
.
toUtf8
();
char
*
sip_ip
=
bSip_ip
.
data
();
config
.
szCsIP
.
SetValue
(
sip_ip
);
QByteArray
&&
bSzServerNo
=
gb28181
->
serial
.
toUtf8
();
char
*
sz_ServerNo
=
bSzServerNo
.
data
();
config
.
szServerNo
.
SetValue
(
sz_ServerNo
);
config
.
sCsPort
.
SetValue
(
gb28181
->
sip_port
);
config
.
sUdpPort
.
SetValue
(
5060
);
QByteArray
&&
bSzServerDn
=
gb28181
->
realm
.
toUtf8
();
char
*
sz_ServerDn
=
bSzServerDn
.
data
();
config
.
szServerDn
.
SetValue
(
sz_ServerDn
);
config
.
bCsEnable
.
SetValue
(
true
);
config
.
iRsAgedTime
.
SetValue
(
gb28181
->
register_validity
);
config
.
iHsIntervalTime
.
SetValue
(
gb28181
->
heartbeat_interval
);
QByteArray
&&
bSzConnPass
=
gb28181
->
password
.
toUtf8
();
char
*
sz_connPass
=
bSzConnPass
.
data
();
config
.
szConnPass
.
SetValue
(
sz_connPass
);
QByteArray
&&
bDevice_id
=
gb28181
->
device_id
.
toUtf8
();
char
*
cdevice_id
=
bDevice_id
.
data
();
config
.
szDeviceNO
.
SetValue
(
cdevice_id
);
const
char
*
pCfg
=
config
.
ToString
();
sdkDevSpvMn
(
pCfg
);
}
bool
CameraHandle
::
sdkWifi
(
QString
&
pwd
,
QString
&
ssid
){
Common
&
instace
=
Common
::
getInstance
();
XSDK_CFG
::
NetWork_Wifi
wif
;
...
...
@@ -1279,13 +1349,15 @@ void CameraHandle::updateSdkDevSpvMn(vides_data::responseGb28181 *gb28181){
}
void
CameraHandle
::
sdkDevSpvMn
(
const
char
*
spvMn
){
int
CameraHandle
::
sdkDevSpvMn
(
const
char
*
spvMn
){
char
szOutBuffer
[
512
]
=
{
0
};
int
nLen
=
sizeof
(
szOutBuffer
);
int
res
=
XSDK_DevSetSysConfigSyn
(
hDevice
,
JK_NetWork_SPVMN
,
spvMn
,
strlen
(
spvMn
),
szOutBuffer
,
&
nLen
,
3000
,
EXCMD_CONFIG_SET
);
if
(
res
<
0
){
qInfo
()
<<
sSn
<<
":sdkDevSpvMn 28181->修改失败"
<<
res
;
return
-
1
;
}
return
res
;
}
int
CameraHandle
::
deviceReboot
(){
int
nRet
=
0
;
...
...
CameraHandle.h
View file @
545cccd2
...
...
@@ -100,11 +100,13 @@ public:
//配置编码设置
void
sdkEncodeCfg
(
const
char
*
enCode
);
//28181更新
void
sdkDevSpvMn
(
const
char
*
spvMn
);
int
sdkDevSpvMn
(
const
char
*
spvMn
);
//gb218开启
int
updateSdkDevStatus
(
bool
status
);
void
updateSdkDevSpvMn
(
vides_data
::
responseGb28181
*
gb28181
);
//重启设备
int
deviceReboot
();
//设备关机
...
...
@@ -114,6 +116,9 @@ public:
//复位GB28181
int
resetGb28181
();
//强制gb28181配置后写入摄像头
int
forceWriteGb28181
();
//获取ip
void
findIp
(
QString
&
ip
);
...
...
MqttSubscriber.cpp
View file @
545cccd2
...
...
@@ -242,8 +242,7 @@ int MqttSubscriber::messageArrived(char* topicName, int topicLen, MQTTAsync_mess
}
else
{
qInfo
()
<<
"IP address not found in msg_body."
;
}
res
=
connectedCameraHandle
->
distributionNetwork
(
ipAddress
,
response
.
sn
,
hDevice
);
res
=
(
connectedCameraHandle
->
distributionNetwork
(
ipAddress
,
response
.
sn
,
hDevice
)
?
0x01
:-
1
);
}
vides_data
::
requestMqttData
request
;
...
...
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