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
987a0177
Commit
987a0177
authored
Oct 21, 2024
by
郭峰
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'release' into 'master'
Release See merge request
!79
parents
23173fdd
da58530e
Hide whitespace changes
Inline
Side-by-side
Showing
16 changed files
with
357 additions
and
174 deletions
+357
-174
AlgorithmTaskManage.cpp
+2
-0
CameraHandle.cpp
+73
-54
CameraHandle.h
+42
-35
Common.cpp
+0
-4
Common.h
+2
-1
FaceReconitionHandle.cpp
+100
-5
FaceReconitionHandle.h
+10
-0
HttpService.cpp
+3
-0
MediaFaceImage.cpp
+1
-0
MqttSubscriber.cpp
+5
-4
NonConnectedCameraHandle.cpp
+8
-8
NonConnectedCameraHandle.h
+0
-1
VidesData.h
+23
-2
gamera_videos.pro
+2
-0
mainwindow.cpp
+85
-59
mainwindow.h
+1
-1
No files found.
AlgorithmTaskManage.cpp
View file @
987a0177
...
...
@@ -60,6 +60,8 @@ void AlgorithmTaskManage::initLicensePlateManage(const QString &modelPaths,bool
}
void
AlgorithmTaskManage
::
initFaceReconitionHandle
(
std
::
map
<
QString
,
QString
>&
maps
,
int
numberFaces
,
float
confidence
){
for
(
int
i
=
0
;
i
<
faceLen
;
++
i
)
{
static
int
i11
=
0
;
qInfo
()
<<
"人脸initSourceImageMap次数"
<<++
i11
;
FaceReconitionHandle
*
faceReconitionHandle
=
new
FaceReconitionHandle
();
faceReconitionHandle
->
initSourceImageMap
(
maps
,
numberFaces
,
confidence
);
...
...
CameraHandle.cpp
View file @
987a0177
...
...
@@ -436,7 +436,7 @@ void CameraHandle::sdkDevSnapSyn(XSDK_HANDLE hDevice, int nChannel){
qInfo
()
<<
QString
(
"SN(%1): 设备离线"
).
arg
(
sSn
);
QString
ip
=
QString
::
fromUtf8
(
loginParam
->
sDevId
);
bool
is_ping
=
instace
.
pingAddress
(
ip
);
q
Debug
()
<<
sSn
<<
":ping 的结果"
<<
is_ping
;
q
Info
()
<<
sSn
<<
":ping 的结果"
<<
is_ping
;
if
(
is_ping
){
deviceReboot
();
...
...
@@ -910,6 +910,9 @@ void CameraHandle::updateImage(const cv::Mat & frame,qint64 currentTime){
void
CameraHandle
::
findIp
(
QString
&
ip
){
ip
=
QString
::
fromStdString
(
loginParam
->
sDevId
);
}
void
CameraHandle
::
findPort
(
int
&
port
){
port
=
loginParam
->
nDevPort
;
}
void
CameraHandle
::
findFirmwareVersion
(
QString
&
firmwareVersion
){
char
szOutBuffer
[
1024
]
=
{
0
};
...
...
@@ -1017,7 +1020,7 @@ void CameraHandle::printWifi(XSDK_HANDLE hDevice,XSDK_CFG::NetWork_Wifi &cfg){
需注意和定时任务对比GB28181配置冲突处理
需确认修改IP后抓图是否正常,如不正常需在命令开始前增加删除句柄,命令完成后增加句柄以保证抓图实时性
*/
int
CameraHandle
::
resetGb28181
(
QString
&
uuiq
){
int
CameraHandle
::
resetGb28181
(){
NonConnectedCameraHandle
*
connectedCameraHandle
=
NonConnectedCameraHandle
::
getInstance
();
int
old
=
this
->
hDevice
;
qInfo
()
<<
QString
(
"SN(%1): resetGb28181老句柄%2"
).
arg
(
sSn
).
arg
(
old
);
...
...
@@ -1106,9 +1109,68 @@ int CameraHandle::resetGb28181(QString &uuiq){
}
}
}
return
forceWriteGb28181
();
}
void
CameraHandle
::
initWorkSpVMn
(
vides_data
::
responseGb28181
*
gb28181
,
QString
&
workSpWMn
){
// 构建 toJsonObject
QJsonObject
toJsonObject
;
toJsonObject
[
"szCsIP"
]
=
gb28181
->
sip_ip
;
toJsonObject
[
"szServerNo"
]
=
gb28181
->
serial
;
toJsonObject
[
"sCsPort"
]
=
gb28181
->
sip_port
;
toJsonObject
[
"szServerDn"
]
=
gb28181
->
realm
;
toJsonObject
[
"iRsAgedTime"
]
=
gb28181
->
register_validity
;
toJsonObject
[
"iHsIntervalTime"
]
=
gb28181
->
heartbeat_interval
;
toJsonObject
[
"szConnPass"
]
=
gb28181
->
password
;
toJsonObject
[
"szDeviceNO"
]
=
gb28181
->
device_id
;
//this->updateSdkDevStatus(true);
return
1
;
// 构建 AlarmLevel 数组
QJsonArray
alarmLevelArray
;
for
(
int
i
=
0
;
i
<
8
;
++
i
)
{
alarmLevelArray
.
append
(
0
);
}
toJsonObject
[
"AlarmLevel"
]
=
alarmLevelArray
;
// 构建 Alarmid 数组
QJsonArray
alarmidArray
;
for
(
int
i
=
1
;
i
<=
8
;
++
i
)
{
alarmidArray
.
append
(
"3402000000134000000"
+
QString
::
number
(
i
,
10
).
rightJustified
(
2
,
'0'
));
}
toJsonObject
[
"Alarmid"
]
=
alarmidArray
;
// 构建 CamreaLevel 数组
QJsonArray
camreaLevelArray
;
for
(
int
i
=
0
;
i
<
8
;
++
i
)
{
camreaLevelArray
.
append
(
0
);
}
toJsonObject
[
"CamreaLevel"
]
=
camreaLevelArray
;
// 构建 Camreaid 数组
QJsonArray
camreaidArray
;
for
(
int
i
=
1
;
i
<=
8
;
++
i
)
{
if
(
i
==
1
)
{
camreaidArray
.
append
(
gb28181
->
channel_id
);
}
else
{
camreaidArray
.
append
(
"3402000000131000001"
+
QString
::
number
(
i
,
10
).
rightJustified
(
2
,
'0'
));
}
}
toJsonObject
[
"Camreaid"
]
=
camreaidArray
;
// 添加其他字段
toJsonObject
[
"HeartBeatCount"
]
=
0
;
toJsonObject
[
"bCsEnable"
]
=
true
;
toJsonObject
[
"uiAlarmStateBlindEnable"
]
=
"0xFFFFFFFF"
;
toJsonObject
[
"uiAlarmStateConnectEnable"
]
=
"0xFFFFFFFF"
;
toJsonObject
[
"uiAlarmStateGpinEnable"
]
=
"0xFFFFFFFF"
;
toJsonObject
[
"uiAlarmStateLoseEnable"
]
=
"0xFFFFFFFF"
;
toJsonObject
[
"uiAlarmStateMotionEnable"
]
=
"0xFFFFFFFF"
;
toJsonObject
[
"uiAlarmStatePerformanceEnable"
]
=
"0xFFFFFFFF"
;
toJsonObject
[
"sUdpPort"
]
=
5060
;
// 生成 workSpWMn
QJsonDocument
doc
(
toJsonObject
);
QByteArray
jsonDataOutput
=
doc
.
toJson
(
QJsonDocument
::
Compact
);
workSpWMn
=
QString
::
fromUtf8
(
jsonDataOutput
);
}
int
CameraHandle
::
forceWriteGb28181
(){
...
...
@@ -1117,63 +1179,19 @@ int CameraHandle::forceWriteGb28181(){
vides_data
::
response
*
res
=
http_gb28181
.
httpFindGb28181Config
(
sSn
);
ScopeSemaphoreExit
guard
([
&
instace
,
&
res
]()
{
instace
.
deleteObj
(
res
);
});
if
(
res
->
code
!=
0
){
qInfo
()
<<
"请求摄像头gb28181配置失败"
;
return
-
1
;
}
QString
stGb281
;
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
);
initWorkSpVMn
(
gb28181
,
stGb281
);
QByteArray
bGb
=
stGb281
.
toUtf8
();
const
char
*
pCfg
=
bGb
.
data
();
qInfo
()
<<
"forceWriteGb28181"
<<
pCfg
;
return
sdkDevSpvMn
(
pCfg
);
}
bool
CameraHandle
::
sdkWifi
(
QString
&
pwd
,
QString
&
ssid
){
...
...
@@ -1376,6 +1394,7 @@ int CameraHandle::deviceReboot(){
qInfo
()
<<
sSn
<<
":重启相机失败"
<<
nRet
;
return
0
;
}
qInfo
()
<<
QString
(
"SN(%1): 重启相机成功"
).
arg
(
sSn
);
QString
ip
=
QString
::
fromUtf8
(
loginParam
->
sDevId
);
MainWindow
::
sp_this
->
clearOfflineCameraHandle
(
ip
,
loginParam
->
nDevPort
);
return
nRet
;
...
...
CameraHandle.h
View file @
987a0177
...
...
@@ -42,7 +42,7 @@ enum CAR_INFORMATION {
class
CameraHandle
:
public
QObject
{
Q_OBJECT
public
:
CameraHandle
(
QString
&
url
,
QString
&
httpUrl
,
QString
&
sSn
,
int
&
channel
,
int
imageSave
,
float
&
heightReference
,
vides_data
::
responseConfig
&
devConfig
);
...
...
@@ -50,7 +50,7 @@ public:
~
CameraHandle
();
int
sdkDevLoginSyn
(
QString
sDevId
,
int
nDevPort
,
QString
sUserName
,
QString
sPassword
,
int
nTimeout
);
//int SdkMediaGetFaceImage(int hDevice, int nSeq, int nTimeout);
int
sdkDevSetAlarmListener
(
XSDK_HANDLE
hDevice
,
int
bListener
);
int
getHdevice
();
...
...
@@ -64,33 +64,33 @@ public:
void
cameraParameterUpdate
(
vides_data
::
responseConfig
&
cloudConfig
);
void
initSdkRealTimeDevSnapSyn
(
int
syn_timer
,
uint64
face_frequency
);
void
notificationUpdateImageMap
(
std
::
map
<
QString
,
QString
>&
maps
,
int
numberFaces
,
float
confidence
);
void
featureRemove
();
void
updateImage
(
const
cv
::
Mat
&
frame
,
qint64
currentTime
);
void
matToBase64
(
const
cv
::
Mat
&
image
,
QByteArray
&
base64Data
);
//把原始图片转换成不同区域的掩码
void
matToAreaMask
(
const
cv
::
Mat
&
source
,
std
::
map
<
int
,
cv
::
Mat
>
&
maskFrame
);
int
callbackFunction
(
XSDK_HANDLE
hObject
,
QString
&
szString
);
void
checkAndUpdateCurrentPlate
(
ParkingSpaceInfo
*
park
,
const
cv
::
Mat
&
frame
,
RecognizedInfo
&
newInfo
,
int
&
result
);
void
licensePlateRecognitionResults
(
vides_data
::
requestLicensePlate
&
location
);
void
sdkDevSnapSyn
(
XSDK_HANDLE
hDevice
,
int
nChannel
);
void
printWifi
(
XSDK_HANDLE
hDevice
,
XSDK_CFG
::
NetWork_Wifi
&
cfg
);
bool
isWifiConnect
(
XSDK_HANDLE
hDevice
,
XSDK_CFG
::
NetWork_Wifi
&
cfg
);
void
setCarConfidenceMaxAndMin
(
float
carConfidenceMax
,
float
carConfidenceMin
);
//设置相机连接的wifi
bool
sdkWifi
(
QString
&
pwd
,
QString
&
ssid
);
//时间设置
...
...
@@ -103,10 +103,10 @@ public:
int
sdkDevSpvMn
(
const
char
*
spvMn
);
//gb218开启
int
updateSdkDevStatus
(
bool
status
);
void
updateSdkDevSpvMn
(
vides_data
::
responseGb28181
*
gb28181
);
//重启设备
int
deviceReboot
();
//设备关机
...
...
@@ -114,34 +114,40 @@ public:
//获取固件版本
void
findFirmwareVersion
(
QString
&
firmwareVersion
);
//复位GB28181
int
resetGb28181
(
QString
&
uuiq
);
int
resetGb28181
();
//强制gb28181配置后写入摄像头
int
forceWriteGb28181
();
void
initWorkSpVMn
(
vides_data
::
responseGb28181
*
gb28181
,
QString
&
workSpWMn
);
//获取ip
void
findIp
(
QString
&
ip
);
void
findPort
(
int
&
port
);
void
sdkDownloadFileByTime
(
XSDK_HANDLE
hDevice
,
int
id
,
QString
startTimer
,
QString
endTime
);
void
batchRegionalPushLicensePlate
(
QByteArray
&
imgs
,
qint64
currentTime
,
vides_data
::
requestLicensePlate
&
newPlate
);
void
faceUniformOverlap
(
std
::
map
<
QString
,
vides_data
::
requestFaceReconition
>&
mapFaces
,
std
::
vector
<
vides_data
::
ParkingArea
>
&
uniforms
,
std
::
list
<
QString
>&
outUniforms
);
bool
isClockwise
(
const
std
::
vector
<
cv
::
Point2f
>&
polygon
);
QString
getSSn
();
int
getMediaHandle
();
void
setMediaHandle
(
int
mediaHandle
);
void
initAlgorithmPermissions
(
__uint8_t
algorithm
);
void
initFaceFrequency
(
uint64
face_frequency
);
void
initParkingSpaceInfo
(
const
std
::
list
<
vides_data
::
responseArea
>&
areas
);
bool
compareLists
(
const
std
::
list
<
vides_data
::
responseArea
>&
newAreas
);
...
...
@@ -160,13 +166,13 @@ public:
// 计算两个多边形的交集面积
double
calculateIntersectionArea
(
const
QPolygonF
&
polygon1
,
const
QPolygonF
&
polygon2
);
double
ccw
(
const
QPointF
&
a
,
const
QPointF
&
b
,
const
QPointF
&
c
);
void
getCurrentFrame
(
std
::
vector
<
uchar
>
&
buffer
);
bool
isAnyOverlap
(
ParkingSpaceInfo
*
parkArea
,
std
::
vector
<
vides_data
::
ParkingArea
>
&
currentPlates
);
int
findPointRegion
(
ParkingSpaceInfo
&
prakArea
);
int
determineArea
(
ParkingSpaceInfo
&
prakArea
);
signals
:
void
callbackFrameReady
(
const
cv
::
Mat
&
frame
,
const
QString
&
url
);
...
...
@@ -181,10 +187,10 @@ private :
int
hDevice
;
int
channel
;
QString
httpUrl
;
SXSDKLoginParam
*
loginParam
;
SXMediaFaceImageReq
*
sxMediaFaceImageReq
;
QString
sSn
;
QString
url
;
std
::
map
<
int
,
vides_data
::
responseRecognitionData
>
videoCurrentData
;
...
...
@@ -204,14 +210,15 @@ private :
QTimer
*
dev_snap_syn_timer
;
int
offlineCount
=
0
;
QSemaphore
semaphore
;
int
image_save
;
std
::
atomic
<
uint64
>
faceCount
;
std
::
atomic
<
bool
>
isOperateGb28181
{
false
};
uint64
face_frequency
;
__uint8_t
algorithmPermissions
;
...
...
@@ -219,11 +226,11 @@ private :
vides_data
::
responseConfig
devConfig
;
float
heightReference
;
float
carConfidenceMax
;
float
carConfidenceMin
;
};
#endif // CAMERAHANDLE_H
Common.cpp
View file @
987a0177
...
...
@@ -201,10 +201,6 @@ bool Common::pingAddress(const QString &address) {
return
true
;
// 成功,返回true
}
//获取本机mask
bool
GetLocalNetMask
(
const
char
*
eth_inf
,
char
*
netmask_addr
)
{
...
...
Common.h
View file @
987a0177
...
...
@@ -33,7 +33,7 @@
#define ICMP_HDRLEN 8
#define PAYLOAD_SIZE 56
#define MAC_SIZE 18
// ICMP 头部结构体
struct
ICMPHeader
{
uint8_t
type
;
// 类型
...
...
@@ -78,6 +78,7 @@ public:
QString
GetLocalGateWay
();
//获取本机gateway
bool
pingAddress
(
const
QString
&
address
)
;
QString
getImages
();
void
setImages
(
QString
images
);
...
...
FaceReconitionHandle.cpp
View file @
987a0177
...
...
@@ -5,8 +5,13 @@
#include <iostream>
#define cimg_display 0
#define STB_IMAGE_IMPLEMENTATION
#define STB_IMAGE_WRITE_IMPLEMENTATION
#include "CImg.h"
#include "stb_image.h"
#include "stb_image_write.h"
using
namespace
cimg_library
;
...
...
@@ -40,15 +45,33 @@ cv::Mat FaceReconitionHandle::loadImage(const QString &path) {
qInfo
()
<<
"图像以OpenCV成功加载。"
;
return
image
;
}
return
loadImageFromByteStream
(
path
);
image
=
loadImageFromByteStream
(
path
);
if
(
!
image
.
empty
())
{
qInfo
()
<<
"图像以CImg成功加载。"
;
return
image
;
}
image
=
loadImageWithSTB
(
path
);
if
(
!
image
.
empty
())
{
qInfo
()
<<
"图像以stb_image成功加载。"
;
return
image
;
}
image
=
loadQImageFromByteStream
(
path
);
if
(
!
image
.
empty
())
{
qInfo
()
<<
"图像以QImage成功加载。"
;
return
image
;
}
qInfo
()
<<
"四种加载方式都不行"
;
return
cv
::
Mat
();
}
void
FaceReconitionHandle
::
initSourceImageMap
(
std
::
map
<
QString
,
QString
>&
maps
,
int
numberFaces
,
float
confidence
){
ScopeSemaphoreExit
streamGuard
([
this
]()
{
isImageChanged
.
store
(
false
,
std
::
memory_order_release
);
});
featureRemove
();
//featureRemove();
featureRemoveMap
(
maps
);
HResult
ret
;
// 初始化context
#if defined(__arm__) || defined(__ARM_ARCH)
...
...
@@ -73,7 +96,7 @@ void FaceReconitionHandle::initSourceImageMap(std::map<QString,QString>&maps,int
return
;
}
}
customIds
.
clear
();
//
customIds.clear();
int
i
=
0
;
qInfo
()
<<
"加载图像size: "
<<
maps
.
size
();
...
...
@@ -124,7 +147,8 @@ void FaceReconitionHandle::initSourceImageMap(std::map<QString,QString>&maps,int
HF_FaceFeatureIdentity
identity
=
{
0
};
identity
.
feature
=
&
feature
;
identity
.
customId
=
i
;
customIds
.
push_back
(
identity
.
customId
);
//customIds.push_back( identity.customId);
mapCustomId
[
key
]
=
i
;
identity
.
tag
=
tagName
;
ret
=
HF_FeaturesGroupInsertFeature
(
ctxHandle
,
identity
);
...
...
@@ -156,8 +180,79 @@ void FaceReconitionHandle::featureRemove(){
setImageChanged
(
false
);
}
}
void
FaceReconitionHandle
::
featureRemoveMap
(
std
::
map
<
QString
,
QString
>
&
maps
){
if
(
mapCustomId
.
size
()
>
0
){
for
(
auto
it
=
mapCustomId
.
begin
();
it
!=
mapCustomId
.
end
();
)
{
// 检查当前键是否存在于 maps 中
if
(
maps
.
find
(
it
->
first
)
==
maps
.
end
())
{
int32_t
&
customId
=
it
->
second
;
// 如果不存在,则从 mapCustomId 中删除该键
it
=
mapCustomId
.
erase
(
it
);
HResult
ret
=
HF_FeaturesGroupFeatureRemove
(
ctxHandle
,
customId
);
if
(
ret
!=
HSUCCEED
)
{
qInfo
()
<<
QString
(
"从特征组中移除一个面部特征失败: %1"
).
arg
(
ret
);
continue
;
}
}
else
{
// 如果存在,则继续下一个元素
++
it
;
}
}
setImageChanged
(
false
);
}
}
cv
::
Mat
FaceReconitionHandle
::
loadImageWithSTB
(
const
QString
&
filename
)
{
int
width
,
height
,
channels
;
QByteArray
&&
b_filename
=
filename
.
toUtf8
();
char
*
c_filename
=
b_filename
.
data
();
// 使用 stb_image 加载图像,stbi_load 会根据图像格式返回数据
unsigned
char
*
data
=
stbi_load
(
c_filename
,
&
width
,
&
height
,
&
channels
,
0
);
if
(
!
data
)
{
qInfo
()
<<
"tb_image无法加载图像 "
<<
filename
;
return
cv
::
Mat
();
}
// 检查图像通道数,创建对应的 cv::Mat
cv
::
Mat
image
;
if
(
channels
==
1
)
{
// 灰度图像
image
=
cv
::
Mat
(
height
,
width
,
CV_8UC1
,
data
);
}
else
if
(
channels
==
3
)
{
// 彩色图像
image
=
cv
::
Mat
(
height
,
width
,
CV_8UC3
,
data
);
// OpenCV 默认使用 BGR,因此需要将 RGB 转换为 BGR
cv
::
cvtColor
(
image
,
image
,
cv
::
COLOR_RGB2BGR
);
}
else
if
(
channels
==
4
)
{
// 带 Alpha 通道的图像
image
=
cv
::
Mat
(
height
,
width
,
CV_8UC4
,
data
);
// RGB -> BGR(包括 Alpha 通道)
cv
::
cvtColor
(
image
,
image
,
cv
::
COLOR_RGBA2BGRA
);
}
// 释放 stb_image 加载的内存
stbi_image_free
(
data
);
return
image
;
}
cv
::
Mat
FaceReconitionHandle
::
loadQImageFromByteStream
(
const
QString
&
filePath
)
{
// 使用 QImage 加载图像
QImage
qimage
(
filePath
);
if
(
qimage
.
isNull
())
{
qInfo
()
<<
"QImage Error: 无法加载图像 "
<<
filePath
;
return
cv
::
Mat
();
}
// 将 QImage 转换为 cv::Mat
cv
::
Mat
mat
(
qimage
.
height
(),
qimage
.
width
(),
CV_8UC4
,
const_cast
<
uchar
*>
(
qimage
.
bits
()),
qimage
.
bytesPerLine
());
// 如果需要 BGR 格式
cv
::
cvtColor
(
mat
,
mat
,
cv
::
COLOR_RGBA2BGR
);
return
mat
;
}
cv
::
Mat
FaceReconitionHandle
::
loadImageFromByteStream
(
const
QString
&
filePath
)
{
try
{
...
...
FaceReconitionHandle.h
View file @
987a0177
...
...
@@ -20,6 +20,8 @@ private:
std
::
vector
<
int32_t
>
customIds
;
std
::
map
<
QString
,
int32_t
>
mapCustomId
;
std
::
atomic
<
bool
>
isImageChanged
{
false
};
public
:
FaceReconitionHandle
();
...
...
@@ -28,6 +30,11 @@ public:
cv
::
Mat
loadImage
(
const
QString
&
path
);
cv
::
Mat
loadImageFromByteStream
(
const
QString
&
filePath
);
cv
::
Mat
loadQImageFromByteStream
(
const
QString
&
filePath
);
cv
::
Mat
loadImageWithSTB
(
const
QString
&
filename
);
bool
getImageChanged
()
const
;
void
setImageChanged
(
bool
imageChanged
);
...
...
@@ -39,5 +46,8 @@ public:
void
featureRemove
();
void
featureRemoveMap
(
std
::
map
<
QString
,
QString
>&
maps
);
};
#endif // FACERECONITIONHANDLE_H
HttpService.cpp
View file @
987a0177
...
...
@@ -20,7 +20,9 @@ vides_data::response* HttpService::httpPostDeviceStatus(vides_data::requestDevic
QJsonObject
json
;
json
.
insert
(
"sn"
,
deviceStatus
.
sSn
);
json
.
insert
(
"type"
,
deviceStatus
.
type
);
json
.
insert
(
"mac"
,
deviceStatus
.
mac
);
json
.
insert
(
"state"
,
deviceStatus
.
status
);
json
.
insert
(
"ip_addr"
,
deviceStatus
.
ip_addr
);
json
.
insert
(
"firmware_version"
,
deviceStatus
.
firmware_version
);
// 将固件版本添加到主 JSON 对象中
...
...
@@ -30,6 +32,7 @@ vides_data::response* HttpService::httpPostDeviceStatus(vides_data::requestDevic
QJsonObject
cameraObject
;
cameraObject
.
insert
(
"sn"
,
cameraInfo
.
sSn
);
cameraObject
.
insert
(
"ip_addr"
,
cameraInfo
.
ip_addr
);
cameraObject
.
insert
(
"mac"
,
cameraInfo
.
mac
);
cameraObject
.
insert
(
"firmware_version"
,
cameraInfo
.
firmware_version
);
cameraArray
.
append
(
cameraObject
);
}
...
...
MediaFaceImage.cpp
View file @
987a0177
...
...
@@ -106,6 +106,7 @@ int MediaFaceImage::SdkSearchDevicesSyn(std::map<QString, vides_data::localDevic
pDevice
->
HttpPort
=
pRet
[
i
].
HttpPort
;
pDevice
->
UserName
=
QString
::
fromUtf8
(
pRet
[
i
].
DefaultUser
,
sizeof
(
pRet
[
i
].
DefaultUser
));
pDevice
->
password
=
QString
::
fromUtf8
(
pRet
[
i
].
DefaultPwd
,
sizeof
(
pRet
[
i
].
DefaultPwd
));
pDevice
->
mac
=
QString
::
fromUtf8
(
pRet
[
i
].
sMac
);
devices
.
insert
(
std
::
make_pair
(
pDevice
->
sSn
,
pDevice
));
}
...
...
MqttSubscriber.cpp
View file @
987a0177
...
...
@@ -80,7 +80,7 @@ void MqttSubscriber::start() {
// 设置连接选项
MQTTAsync_connectOptions
conn_opts
=
MQTTAsync_connectOptions_initializer
;
conn_opts
.
keepAliveInterval
=
20
;
conn_opts
.
keepAliveInterval
=
35
;
conn_opts
.
cleansession
=
1
;
QByteArray
bUsername
=
config
.
username
.
toUtf8
();
...
...
@@ -165,7 +165,7 @@ void MqttSubscriber::onSubscribeFailure(MQTTAsync_failureData* response) {
}
void
MqttSubscriber
::
connectionLost
(
char
*
cause
)
{
qInfo
()
<<
"连接丢失"
;
qInfo
()
<<
"连接丢失"
<<
cause
;
if
(
cause
)
{
qInfo
()
<<
"Cause:"
<<
cause
;
}
...
...
@@ -199,7 +199,7 @@ int MqttSubscriber::messageArrived(char* topicName, int topicLen, MQTTAsync_mess
}
else
{
qInfo
()
<<
"Failed to parse JSON payload"
;
}
//1开 2关 3 重启 4 GB28181开 5 GB28181 关 6 一键配网 7 WIFI配留 8 复位GB28181
//1开 2关 3 重启 4 GB28181开 5 GB28181 关 6 一键配网 7 WIFI配留 8 复位GB28181
9 修改GB28181
int
res
=
-
2
;
CameraHandle
*
cameraHandle
=
MainWindow
::
sp_this
->
findHandle
(
response
.
sn
);
int
hDevice
=
0
;
...
...
@@ -228,7 +228,8 @@ int MqttSubscriber::messageArrived(char* topicName, int topicLen, MQTTAsync_mess
}
break
;
}
case
8
:
res
=
cameraHandle
->
resetGb28181
(
response
.
uniq
);
break
;
case
8
:
res
=
cameraHandle
->
resetGb28181
();
break
;
case
9
:
res
=
cameraHandle
->
forceWriteGb28181
();
break
;
default
:
qInfo
()
<<
"Unknown message type"
;
break
;
}
}
...
...
NonConnectedCameraHandle.cpp
View file @
987a0177
...
...
@@ -24,23 +24,23 @@ NonConnectedCameraHandle* NonConnectedCameraHandle::getInstance()
bool
NonConnectedCameraHandle
::
changeCameraIp
(
vides_data
::
localDevice
&
device
){
Common
&
instace
=
Common
::
getInstance
();
char
interface
[
IFNAMSIZ
];
// 确定当前网络接口
instace
.
determine_interface
(
interface
);
QString
subnetMask
;
bool
sub
=
vides_data
::
GetSubnetMask
(
subnetMask
);
QString
gateway
=
instace
.
GetLocalGateWay
();
if
(
!
sub
&&
gateway
.
length
()
==
0
)
{
qInfo
()
<<
QString
(
"SN(%1): 获取本地MAC失败"
).
arg
(
device
.
sSn
);
return
false
;
}
QByteArray
&&
byJsonIp
=
device
.
reachableIp
.
toUtf8
();
const
char
*
charIp
=
byJsonIp
.
data
();
...
...
@@ -250,7 +250,7 @@ int NonConnectedCameraHandle::sdkDevLoginSyn(QString sDevId, int nDevPort,
}
bool
NonConnectedCameraHandle
::
distributionNetwork
(
QString
&
ip
,
QString
&
sSn
,
int
hDevice
){
Common
&
instace
=
Common
::
getInstance
();
if
(
ip
.
length
()
>
0
&&
instace
.
pingAddress
(
ip
)){
qInfo
()
<<
QString
(
"SN(%1): 当前ip已被使用%2"
).
arg
(
sSn
).
arg
(
ip
);
return
false
;
...
...
NonConnectedCameraHandle.h
View file @
987a0177
...
...
@@ -31,7 +31,6 @@ public:
int
sdkDevLoginSyn
(
QString
sDevId
,
int
nDevPort
,
QString
sUserName
,
QString
sPassword
,
int
nTimeout
)
;
private
:
NonConnectedCameraHandle
();
// 构造函数声明为私有
~
NonConnectedCameraHandle
();
// 析构函数声明为私有
...
...
VidesData.h
View file @
987a0177
...
...
@@ -36,6 +36,7 @@ struct requestCameraInfo{
QString
ip_addr
;
QString
firmware_version
;
QString
sSn
;
QString
mac
;
requestCameraInfo
()
{}
};
...
...
@@ -46,6 +47,7 @@ struct requestDeviceStatus
int8_t
status
;
QString
ip_addr
;
QString
firmware_version
;
QString
mac
;
std
::
list
<
requestCameraInfo
>
camera_info_list
;
requestDeviceStatus
()
{}
};
...
...
@@ -106,6 +108,7 @@ struct localDeviceStatus
int
ChannelNum
;
QString
UserName
;
QString
password
;
QString
mac
;
localDeviceStatus
()
{}
};
struct
localDevice
...
...
@@ -188,6 +191,7 @@ struct cameraParameters
QString
sSn
;
QString
rtspUrl
;
QString
rtmpUrl
;
QString
mac
;
cameraParameters
()
{}
};
struct
NetWorkNetCommon
{
...
...
@@ -441,13 +445,30 @@ inline bool isInSameSubnet(const QString &ip1, const QString &ip2, const QString
return
result1
==
result2
;
}
inline
QString
getHostMacAddress
()
{
QList
<
QNetworkInterface
>
nets
=
QNetworkInterface
::
allInterfaces
();
// 获取所有网络接口列表
int
nCnt
=
nets
.
count
();
QString
strMacAddr
=
""
;
for
(
int
i
=
0
;
i
<
nCnt
;
i
++
)
{
// 如果此网络接口被激活并且正在运行并且不是回环地址,则就是我们需要找的Mac地址
if
(
nets
[
i
].
flags
().
testFlag
(
QNetworkInterface
::
IsUp
)
&&
nets
[
i
].
flags
().
testFlag
(
QNetworkInterface
::
IsRunning
)
&&
!
nets
[
i
].
flags
().
testFlag
(
QNetworkInterface
::
IsLoopBack
))
{
strMacAddr
=
nets
[
i
].
hardwareAddress
();
break
;
}
}
return
strMacAddr
.
toLower
();
}
// 获取子网掩码
inline
bool
GetSubnetMask
(
QString
&
subnetMask
)
{
QList
<
QNetworkInterface
>
interfaces
=
QNetworkInterface
::
allInterfaces
();
foreach
(
QNetworkInterface
interface
,
interfaces
)
{
if
(
interface
.
flags
().
testFlag
(
QNetworkInterface
::
IsUp
)
&&
interface
.
flags
().
testFlag
(
QNetworkInterface
::
IsRunning
)
&&
!
interface
.
flags
().
testFlag
(
QNetworkInterface
::
IsLoopBack
))
{
interface
.
flags
().
testFlag
(
QNetworkInterface
::
IsRunning
)
&&
!
interface
.
flags
().
testFlag
(
QNetworkInterface
::
IsLoopBack
))
{
QList
<
QNetworkAddressEntry
>
addressEntries
=
interface
.
addressEntries
();
foreach
(
QNetworkAddressEntry
entry
,
addressEntries
)
{
...
...
gamera_videos.pro
View file @
987a0177
...
...
@@ -26,6 +26,8 @@ INCLUDEPATH+=/usr/local/include/XNetSDK
INCLUDEPATH
+=/
usr
/
local
/
include
/
human
INCLUDEPATH
+=/
usr
/
local
/
include
/
CImg
INCLUDEPATH
+=/
usr
/
local
/
include
/
mqtt
INCLUDEPATH
+=/
usr
/
local
/
include
/
stb_image
...
...
mainwindow.cpp
View file @
987a0177
...
...
@@ -314,8 +314,7 @@ void MainWindow::handleMatNewConnection(){
}
});
}
void
MainWindow
::
modifyImagesAndNames
(
QString
&
modId
){
void
MainWindow
::
modifyImagesAndNames
(
QString
&
modId
,
std
::
map
<
QString
,
QString
>
&
currentImageMap
){
QString
fullPathName
;
Common
&
instace
=
Common
::
getInstance
();
if
(
cloudImageMap
.
count
(
modId
)
<=
0
){
...
...
@@ -333,6 +332,7 @@ void MainWindow::modifyImagesAndNames(QString &modId){
QString
settingKey
=
QString
(
"%1"
).
arg
(
modId
);
qSetting
->
setValue
(
settingKey
,
fullPathName
);
localImageMap
[
modId
]
=
fullPathName
;
currentImageMap
[
modId
]
=
fullPathName
;
// 更新 currentImageMap
instace
.
deleteObj
(
res
);
}
...
...
@@ -361,9 +361,11 @@ void MainWindow::updateLocalFace(const QString &httpurl) {
instance
.
deleteObj
(
res
);
// 手动释放资源
return
;
}
QSet
<
QString
>
dataIds
;
std
::
map
<
QString
,
QString
>
currentImageMap
;
// 用于存储当前更新或新增的图片信息
bool
isChanged
=
false
;
qInfo
()
<<
"currentImageMap 之前:size"
<<
currentImageMap
.
size
();
for
(
const
auto
&
item
:
datas
)
{
dataIds
.
insert
(
item
->
img
);
...
...
@@ -377,7 +379,7 @@ void MainWindow::updateLocalFace(const QString &httpurl) {
cloudImageMap
[
item
->
id
]
=
item
->
img
;
removeImageFiles
(
item
->
id
);
qSetting
->
beginGroup
(
"localImageMap"
);
this
->
modifyImagesAndNames
(
item
->
id
);
this
->
modifyImagesAndNames
(
item
->
id
,
currentImageMap
);
qSetting
->
endGroup
();
isChanged
=
true
;
}
...
...
@@ -390,12 +392,13 @@ void MainWindow::updateLocalFace(const QString &httpurl) {
cloudImageMap
[
item
->
id
]
=
item
->
img
;
qSetting
->
beginGroup
(
"localImageMap"
);
this
->
modifyImagesAndNames
(
item
->
id
);
this
->
modifyImagesAndNames
(
item
->
id
,
currentImageMap
);
qSetting
->
endGroup
();
isChanged
=
true
;
}
}
qInfo
()
<<
"currentImageMap:size"
<<
currentImageMap
.
size
();
for
(
auto
it
=
cloudImageMap
.
begin
();
it
!=
cloudImageMap
.
end
();)
{
if
(
!
dataIds
.
contains
(
it
->
second
))
{
qSetting
->
beginGroup
(
"cloudImageMap"
);
...
...
@@ -429,18 +432,22 @@ void MainWindow::updateLocalFace(const QString &httpurl) {
int
faceNumbers
=
config
.
faceConfig
.
faceNumbers
;
AlgorithmTaskManage
&
algorithmTaskManage
=
AlgorithmTaskManage
::
getInstance
();
qInfo
()
<<
"currentImageMap isChanged:size"
<<
currentImageMap
.
size
();
if
(
cloudImageMap
.
empty
())
{
// 如果云端映射现在为空,移除所有特征
//faceRecognition.featureRemove();
algorithmTaskManage
.
modifyImageFeature
(
localImageMap
,
faceNumbers
,
confidence
,
true
);
static
int
i11
=
0
;
qInfo
()
<<
"algorithmTaskManage.modifyImageFeature次数"
<<++
i11
;
algorithmTaskManage
.
modifyImageFeature
(
currentImageMap
,
faceNumbers
,
confidence
,
true
);
}
else
{
//float confidence=qSetting->value("devices/confidence").toFloat();
//int faceNumbers=qSetting->value("devices/faceNumbers").toInt();
qInfo
()
<<
"startMap != endMap-->"
;
// faceRecognition.initSourceImageMap(localImageMap,faceNumbers, confidence);
algorithmTaskManage
.
modifyImageFeature
(
local
ImageMap
,
faceNumbers
,
confidence
,
false
);
algorithmTaskManage
.
modifyImageFeature
(
current
ImageMap
,
faceNumbers
,
confidence
,
false
);
}
}
...
...
@@ -506,7 +513,7 @@ void MainWindow::startCamera(const QString &httpurl){
QString
nonConstHttpUrl
=
std
::
remove_const
<
QString
>::
type
(
httpurl
);
vides_data
::
responseDeviceData
devices
;
// QString serialNumber = QSysInfo::
mac
hineUniqueId();
// QString serialNumber = QSysInfo::hineUniqueId();
QString
serialNumber
;
findLocalSerialNumber
(
serialNumber
);
vides_data
::
requestDeviceStatus
reStatus
;
...
...
@@ -515,11 +522,16 @@ void MainWindow::startCamera(const QString &httpurl){
reStatus
.
type
=
1
;
reStatus
.
ip_addr
=
instace
.
GetLocalIp
();
reStatus
.
firmware_version
=
APP_VERSION
;
QString
is_mac
=
vides_data
::
getHostMacAddress
();
if
(
is_mac
.
length
()
<=
0
){
qInfo
()
<<
"盒子获取mac失败"
;
}
reStatus
.
mac
=
std
::
move
(
is_mac
);
HttpService
httpService
(
httpurl
);
vides_data
::
response
*
re
=
httpService
.
httpFindCameras
(
serialNumber
,
devices
);
if
(
re
->
code
==
0
||
re
->
code
==
20004
){
//本次搜索到设备列表
std
::
map
<
QString
,
vides_data
::
localDeviceStatus
*>
localDevices
;
mediaFaceImage
->
SdkSearchDevicesSyn
(
localDevices
);
if
(
localDevices
.
size
()
<=
0
){
...
...
@@ -560,61 +572,69 @@ void MainWindow::startCamera(const QString &httpurl){
continue
;
}
instace
.
deleteObj
(
devRes
);
//未连接的CameraHandle
if
(
faceDetectionParkingPushs
.
count
(
key
)
<=
0
){
vides_data
::
cameraParameters
parameter
;
parameter
.
sDevId
=
ipAddress
;
parameter
.
nDevPort
=
localDevice
->
TCPPort
;
parameter
.
sUserName
=
devConfig
.
camera
.
username
;
parameter
.
sPassword
=
devConfig
.
camera
.
password
;
parameter
.
channel
=
localDevice
->
ChannelNum
;
parameter
.
httpUrl
=
nonConstHttpUrl
;
parameter
.
sSn
=
device
.
sSn
;
//parameter.rtspUrl="rtsp://192.168.10.131:554/user=admin&password=&channel=1&stream=1.sdp?";
//parameter.rtspUrl=std::move(QString("rtsp://admin:@%1/stream1").arg(ipAddress));
this
->
initCameras
(
parameter
,
devConfig
,
device
.
areas
,
reStatus
.
camera_info_list
);
//ip变了 sn一样
auto
old
=
findHandle
(
device
.
sSn
);
if
(
old
!=
nullptr
){
QString
ipAddress
;
int
port
;
old
->
findIp
(
ipAddress
);
old
->
findPort
(
port
);
qInfo
()
<<
QString
(
"SN(%1): 清理掉变动的老ip:%2,port:%3"
).
arg
(
device
.
sSn
)
.
arg
(
ipAddress
).
arg
(
port
);
clearOfflineCameraHandle
(
ipAddress
,
port
);
}
else
{
vides_data
::
cameraParameters
parameter
;
parameter
.
sDevId
=
ipAddress
;
parameter
.
nDevPort
=
localDevice
->
TCPPort
;
parameter
.
sUserName
=
devConfig
.
camera
.
username
;
parameter
.
sPassword
=
devConfig
.
camera
.
password
;
parameter
.
channel
=
localDevice
->
ChannelNum
;
parameter
.
httpUrl
=
nonConstHttpUrl
;
parameter
.
sSn
=
device
.
sSn
;
parameter
.
mac
=
localDevice
->
mac
;
//parameter.rtspUrl="rtsp://192.168.10.131:554/user=admin&password=&channel=1&stream=1.sdp?";
//parameter.rtspUrl=std::move(QString("rtsp://admin:@%1/stream1").arg(ipAddress));
this
->
initCameras
(
parameter
,
devConfig
,
device
.
areas
,
reStatus
.
camera_info_list
);
}
}
else
{
CameraHandle
*
indexHandle
=
findHandle
(
device
.
sSn
);
if
(
indexHandle
!=
nullptr
&&
device
.
is_reboot
){
indexHandle
->
deviceReboot
();
}
else
{
auto
it
=
this
->
faceDetectionParkingPushs
.
find
(
key
);
if
(
it
!=
this
->
faceDetectionParkingPushs
.
end
())
{
CameraHandle
*
offlineCameraHandle
=
it
->
second
;
// 注意使用->second获取值
vides_data
::
requestCameraInfo
camera_info
;
camera_info
.
sSn
=
offlineCameraHandle
->
getSSn
();
offlineCameraHandle
->
findIp
(
camera_info
.
ip_addr
);
offlineCameraHandle
->
findFirmwareVersion
(
camera_info
.
firmware_version
);
reStatus
.
camera_info_list
.
push_front
(
camera_info
);
HttpService
http_gb28181
(
httpurl
);
vides_data
::
response
*
res
=
http_gb28181
.
httpFindGb28181Config
(
camera_info
.
sSn
);
if
(
res
->
code
!=
0
){
qInfo
()
<<
"请求摄像头gb28181配置失败"
;
instace
.
deleteObj
(
res
);
return
;
}
vides_data
::
responseGb28181
*
gb281
=
reinterpret_cast
<
vides_data
::
responseGb28181
*>
(
res
->
data
);
offlineCameraHandle
->
updateSdkDevSpvMn
(
gb281
);
instace
.
deleteObj
(
gb281
);
auto
it
=
this
->
faceDetectionParkingPushs
.
find
(
key
);
if
(
it
!=
this
->
faceDetectionParkingPushs
.
end
())
{
CameraHandle
*
offlineCameraHandle
=
it
->
second
;
// 注意使用->second获取值
vides_data
::
requestCameraInfo
camera_info
;
camera_info
.
sSn
=
offlineCameraHandle
->
getSSn
();
offlineCameraHandle
->
findIp
(
camera_info
.
ip_addr
);
offlineCameraHandle
->
findFirmwareVersion
(
camera_info
.
firmware_version
);
camera_info
.
mac
=
localDevice
->
mac
;
reStatus
.
camera_info_list
.
push_front
(
camera_info
);
HttpService
http_gb28181
(
httpurl
);
vides_data
::
response
*
res
=
http_gb28181
.
httpFindGb28181Config
(
camera_info
.
sSn
);
if
(
res
->
code
!=
0
){
qInfo
()
<<
"请求摄像头gb28181配置失败"
;
instace
.
deleteObj
(
res
);
__uint8_t
new_algorithm
=
intToUint8t
(
devConfig
.
faceConfig
.
isOn
,
devConfig
.
licensePlateConfig
.
isOn
,
devConfig
.
uniformConfig
.
isOn
,
devConfig
.
humanConfig
.
isOn
);
uint64
face_frequency
=
devConfig
.
humanConfig
.
faceFrequency
;
offlineCameraHandle
->
initFaceFrequency
(
face_frequency
);
offlineCameraHandle
->
cameraParameterUpdate
(
devConfig
);
offlineCameraHandle
->
initAlgorithmPermissions
(
new_algorithm
);
if
(
!
offlineCameraHandle
->
compareLists
(
device
.
areas
)){
offlineCameraHandle
->
updateParkMapAndParkingSpaceInfos
(
device
.
areas
);
}
return
;
}
vides_data
::
responseGb28181
*
gb281
=
reinterpret_cast
<
vides_data
::
responseGb28181
*>
(
res
->
data
);
offlineCameraHandle
->
updateSdkDevSpvMn
(
gb281
);
instace
.
deleteObj
(
gb281
);
instace
.
deleteObj
(
res
);
__uint8_t
new_algorithm
=
intToUint8t
(
devConfig
.
faceConfig
.
isOn
,
devConfig
.
licensePlateConfig
.
isOn
,
devConfig
.
uniformConfig
.
isOn
,
devConfig
.
humanConfig
.
isOn
);
uint64
face_frequency
=
devConfig
.
humanConfig
.
faceFrequency
;
offlineCameraHandle
->
initFaceFrequency
(
face_frequency
);
offlineCameraHandle
->
cameraParameterUpdate
(
devConfig
);
offlineCameraHandle
->
initAlgorithmPermissions
(
new_algorithm
);
if
(
!
offlineCameraHandle
->
compareLists
(
device
.
areas
)){
offlineCameraHandle
->
updateParkMapAndParkingSpaceInfos
(
device
.
areas
);
}
}
}
}
}
...
...
@@ -629,6 +649,7 @@ void MainWindow::startCamera(const QString &httpurl){
localDevices
.
clear
();
}
HttpService
http_div
(
httpurl
);
vides_data
::
response
*
res
=
http_div
.
httpPostDeviceStatus
(
reStatus
);
if
(
res
->
code
!=
0
){
qInfo
()
<<
"盒子状态上报失败 code:"
<<
res
->
code
<<
"msg:"
<<
res
->
msg
;
...
...
@@ -648,6 +669,9 @@ bool MainWindow::isDeviceInList(const QString& deviceId, const std::list<vides_d
});
return
it
!=
devices
.
end
();
// 如果迭代器不是end,说明找到了匹配项
}
//从localDevices中过滤出不在devices列表中的设备
void
MainWindow
::
deleteCloudNotCamer
(
const
std
::
map
<
QString
,
vides_data
::
localDeviceStatus
*>&
localDevices
,
const
std
::
list
<
vides_data
::
responseDeviceStatus
>&
devices
)
{
...
...
@@ -1060,6 +1084,8 @@ void MainWindow::initCameras(vides_data::cameraParameters ¶meter,vides_data:
vides_data
::
requestCameraInfo
camera_info
;
camera_info
.
sSn
=
parameter
.
sSn
;
camera_info
.
ip_addr
=
parameter
.
sDevId
;
camera_info
.
mac
=
parameter
.
mac
;
cameraHandle
->
findFirmwareVersion
(
camera_info
.
firmware_version
);
modifySnMapIp
(
parameter
.
sSn
,
parameter
.
sDevId
);
camera_info_list
.
push_front
(
camera_info
);
...
...
mainwindow.h
View file @
987a0177
...
...
@@ -63,7 +63,7 @@ public:
void
removeImageFiles
(
QString
id
);
void
modifyImagesAndNames
(
QString
&
modId
);
void
modifyImagesAndNames
(
QString
&
modId
,
std
::
map
<
QString
,
QString
>
&
currentImageMap
);
void
findLocalSerialNumber
(
QString
&
serialNumber
);
...
...
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