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
ad174f19
Commit
ad174f19
authored
Sep 03, 2024
by
郭峰
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'feature/mqtt-feature' into 'release'
Feature/mqtt feature See merge request
!8
parents
402424fb
22f4b088
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
54 additions
and
40 deletions
+54
-40
CameraHandle.cpp
+13
-10
FaceReconitionHandle.cpp
+10
-10
MqttSubscriber.cpp
+10
-6
VidesData.h
+12
-5
gamera_videos.pro
+2
-2
mainwindow.cpp
+7
-7
No files found.
CameraHandle.cpp
View file @
ad174f19
...
@@ -143,7 +143,7 @@ int XNetSDK_MediaCallBack(XSDK_HANDLE hMedia, int nDataType, int nDataLen, int n
...
@@ -143,7 +143,7 @@ int XNetSDK_MediaCallBack(XSDK_HANDLE hMedia, int nDataType, int nDataLen, int n
if
(
EXCMD_DOWNLOAD_DATA
==
nDataType
)
if
(
EXCMD_DOWNLOAD_DATA
==
nDataType
)
{
{
q
Debug
()
<<
"EXCMD_DOWNLOAD_DATA"
<<
nDataType
;
q
Info
()
<<
"EXCMD_DOWNLOAD_DATA"
<<
nDataType
;
/*if (g_hRecordDownload > 0 && g_hRecordDownload == hMedia)
/*if (g_hRecordDownload > 0 && g_hRecordDownload == hMedia)
{
{
...
@@ -197,9 +197,9 @@ int XNetSDK_MediaCallBack(XSDK_HANDLE hMedia, int nDataType, int nDataLen, int n
...
@@ -197,9 +197,9 @@ int XNetSDK_MediaCallBack(XSDK_HANDLE hMedia, int nDataType, int nDataLen, int n
// 等待 ffmpeg 进程结束
// 等待 ffmpeg 进程结束
if
(
ffmpegProcess
.
waitForFinished
(
20000
))
{
if
(
ffmpegProcess
.
waitForFinished
(
20000
))
{
//QFile::remove(dName);
//QFile::remove(dName);
q
Debug
()
<<
"ffmpeg process finished successfully."
;
q
Info
()
<<
"ffmpeg process finished successfully."
;
}
else
{
}
else
{
q
Debug
()
<<
"Error: ffmpeg process did not finish."
;
q
Info
()
<<
"Error: ffmpeg process did not finish."
;
}
}
// 销毁 QProcess 对象
// 销毁 QProcess 对象
...
@@ -354,7 +354,7 @@ void CameraHandle::sdkDownloadFileByTime(XSDK_HANDLE hDevice,int id,
...
@@ -354,7 +354,7 @@ void CameraHandle::sdkDownloadFileByTime(XSDK_HANDLE hDevice,int id,
//param.result = sdkInitCallback; // 结果回调(必填)
//param.result = sdkInitCallback; // 结果回调(必填)
SMsgReceiver
sms
(
nullptr
,
XNetSDK_MediaCallBack
,
this
);
SMsgReceiver
sms
(
nullptr
,
XNetSDK_MediaCallBack
,
this
);
param
.
result
=
sms
;
param
.
result
=
sms
;
q
Debug
()
<<
"XSDK_MediaRecordDownload hDevice:"
<<
this
->
hDevice
;
q
Info
()
<<
"XSDK_MediaRecordDownload hDevice:"
<<
this
->
hDevice
;
this
->
mediaHandle
=
XSDK_MediaRecordDownload
(
this
->
hDevice
,
&
param
,
0
,
4000
);
this
->
mediaHandle
=
XSDK_MediaRecordDownload
(
this
->
hDevice
,
&
param
,
0
,
4000
);
if
(
this
->
mediaHandle
<
0
)
if
(
this
->
mediaHandle
<
0
)
...
@@ -390,7 +390,7 @@ int CameraHandle::callbackFunction(XSDK_HANDLE hObject, QString &szString) {
...
@@ -390,7 +390,7 @@ int CameraHandle::callbackFunction(XSDK_HANDLE hObject, QString &szString) {
}
}
else
else
{
{
q
Debug
()
<<
"OnDevAlarmCallback[Dev:"
<<
hObject
<<
"][Event:"
<<
szString
<<
"]"
;
q
Info
()
<<
"OnDevAlarmCallback[Dev:"
<<
hObject
<<
"][Event:"
<<
szString
<<
"]"
;
}
}
cv
::
Mat
image
;
cv
::
Mat
image
;
MediaFaceImage
*
mediaFaceImage
=
MediaFaceImage
::
getInstance
();
MediaFaceImage
*
mediaFaceImage
=
MediaFaceImage
::
getInstance
();
...
@@ -429,14 +429,16 @@ void CameraHandle::sdkDevSnapSyn(XSDK_HANDLE hDevice, int nChannel){
...
@@ -429,14 +429,16 @@ void CameraHandle::sdkDevSnapSyn(XSDK_HANDLE hDevice, int nChannel){
int
ret
=
mediaFaceImage
->
FaceImageCallBack
(
hDevice
,
nChannel
,
image
);
int
ret
=
mediaFaceImage
->
FaceImageCallBack
(
hDevice
,
nChannel
,
image
);
if
(
ret
<
0
)
{
if
(
ret
<
0
)
{
offlineCount
++
;
// 累加计数器
offlineCount
++
;
// 累加计数器
q
Debug
()
<<
"offlineCount: "
<<
loginParam
->
sDevId
<<
offlineCount
;
q
Info
()
<<
"offlineCount: "
<<
loginParam
->
sDevId
<<
offlineCount
;
if
(
offlineCount
>=
3
)
{
// 判断是否连续3次返回0
if
(
offlineCount
>=
3
)
{
// 判断是否连续3次返回0
qInfo
()
<<
"设备离线"
;
qInfo
()
<<
"设备离线"
;
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
{
...
@@ -951,7 +954,7 @@ void CameraHandle::printWifi(XSDK_HANDLE hDevice,XSDK_CFG::NetWork_Wifi &cfg){
...
@@ -951,7 +954,7 @@ void CameraHandle::printWifi(XSDK_HANDLE hDevice,XSDK_CFG::NetWork_Wifi &cfg){
// 获取并解析配置
// 获取并解析配置
int
nResult
=
XSDK_DevGetSysConfigSyn
(
hDevice
,
JK_NetWork_Wifi
,
szOutBuffer
,
&
nInOutSize
,
3000
,
EXCMD_CONFIG_GET
);
int
nResult
=
XSDK_DevGetSysConfigSyn
(
hDevice
,
JK_NetWork_Wifi
,
szOutBuffer
,
&
nInOutSize
,
3000
,
EXCMD_CONFIG_GET
);
q
Debug
()
<<
szOutBuffer
;
q
Info
()
<<
szOutBuffer
;
if
(
nResult
>=
0
)
{
if
(
nResult
>=
0
)
{
cfg
.
Parse
(
szOutBuffer
);
cfg
.
Parse
(
szOutBuffer
);
...
@@ -1006,7 +1009,7 @@ void CameraHandle::sdkDevSystemTimeZoneSyn(QString &time){
...
@@ -1006,7 +1009,7 @@ void CameraHandle::sdkDevSystemTimeZoneSyn(QString &time){
//录像设置
//录像设置
void
CameraHandle
::
sdkRecordCfg
(
const
char
*
recordJson
){
void
CameraHandle
::
sdkRecordCfg
(
const
char
*
recordJson
){
q
Debug
()
<<
recordJson
;
q
Info
()
<<
recordJson
;
char
szOutBuffer
[
512
]
=
{
0
};
char
szOutBuffer
[
512
]
=
{
0
};
int
nLen
=
sizeof
(
szOutBuffer
);;
int
nLen
=
sizeof
(
szOutBuffer
);;
int
res
=
XSDK_DevSetSysConfigSyn
(
hDevice
,
JK_Record
,
recordJson
,
strlen
(
recordJson
),
szOutBuffer
,
&
nLen
,
3000
,
EXCMD_CONFIG_SET
);
int
res
=
XSDK_DevSetSysConfigSyn
(
hDevice
,
JK_Record
,
recordJson
,
strlen
(
recordJson
),
szOutBuffer
,
&
nLen
,
3000
,
EXCMD_CONFIG_SET
);
...
...
FaceReconitionHandle.cpp
View file @
ad174f19
...
@@ -37,7 +37,7 @@ cv::Mat FaceReconitionHandle::loadImage(const QString &path) {
...
@@ -37,7 +37,7 @@ cv::Mat FaceReconitionHandle::loadImage(const QString &path) {
std
::
string
stdPath
=
path
.
toStdString
();
std
::
string
stdPath
=
path
.
toStdString
();
cv
::
Mat
image
=
cv
::
imread
(
stdPath
,
cv
::
IMREAD_COLOR
);
cv
::
Mat
image
=
cv
::
imread
(
stdPath
,
cv
::
IMREAD_COLOR
);
if
(
!
image
.
empty
())
{
if
(
!
image
.
empty
())
{
q
Debug
()
<<
"图像以OpenCV成功加载。"
;
q
Info
()
<<
"图像以OpenCV成功加载。"
;
return
image
;
return
image
;
}
}
...
@@ -151,7 +151,7 @@ void FaceReconitionHandle::featureRemove(){
...
@@ -151,7 +151,7 @@ void FaceReconitionHandle::featureRemove(){
if
(
customIds
.
size
()
>
0
){
if
(
customIds
.
size
()
>
0
){
for
(
auto
customId
:
customIds
){
for
(
auto
customId
:
customIds
){
HResult
ret
=
HF_FeaturesGroupFeatureRemove
(
ctxHandle
,
customId
);
HResult
ret
=
HF_FeaturesGroupFeatureRemove
(
ctxHandle
,
customId
);
q
Debug
()
<<
"ret:featureRemove "
<<
ret
;
q
Info
()
<<
"ret:featureRemove "
<<
ret
;
}
}
setImageChanged
(
false
);
setImageChanged
(
false
);
}
}
...
@@ -180,10 +180,10 @@ cv::Mat FaceReconitionHandle::loadImageFromByteStream(const QString& filePath) {
...
@@ -180,10 +180,10 @@ cv::Mat FaceReconitionHandle::loadImageFromByteStream(const QString& filePath) {
}
}
return
mat
;
return
mat
;
}
catch
(
const
CImgException
&
e
)
{
}
catch
(
const
CImgException
&
e
)
{
q
Debug
()
<<
"CImg Error: "
<<
e
.
what
();
q
Info
()
<<
"CImg Error: "
<<
e
.
what
();
return
cv
::
Mat
();;
return
cv
::
Mat
();;
}
catch
(
const
cv
::
Exception
&
e
)
{
}
catch
(
const
cv
::
Exception
&
e
)
{
q
Debug
()
<<
"OpenCV Error: "
<<
e
.
what
();
q
Info
()
<<
"OpenCV Error: "
<<
e
.
what
();
return
cv
::
Mat
();
;
return
cv
::
Mat
();
;
}
}
...
@@ -218,7 +218,7 @@ void FaceReconitionHandle::doesItExistEmployee(const cv::Mat &source,std::list<v
...
@@ -218,7 +218,7 @@ void FaceReconitionHandle::doesItExistEmployee(const cv::Mat &source,std::list<v
HF_FaceContextRunFaceTrack
(
ctxHandle
,
imageSteamHandle
,
&
multipleFaceData
);
HF_FaceContextRunFaceTrack
(
ctxHandle
,
imageSteamHandle
,
&
multipleFaceData
);
if
(
multipleFaceData
.
detectedNum
<=
0
)
{
if
(
multipleFaceData
.
detectedNum
<=
0
)
{
q
Debug
()
<<
QString
(
"search 未检测到人脸"
);
q
Info
()
<<
QString
(
"search 未检测到人脸"
);
return
;
return
;
}
}
...
@@ -227,11 +227,11 @@ void FaceReconitionHandle::doesItExistEmployee(const cv::Mat &source,std::list<v
...
@@ -227,11 +227,11 @@ void FaceReconitionHandle::doesItExistEmployee(const cv::Mat &source,std::list<v
HInt32
featureNum
;
HInt32
featureNum
;
HF_GetFeatureLength
(
ctxHandle
,
&
featureNum
);
HF_GetFeatureLength
(
ctxHandle
,
&
featureNum
);
for
(
int
j
=
0
;
j
<
multipleFaceData
.
detectedNum
;
++
j
){
for
(
int
j
=
0
;
j
<
multipleFaceData
.
detectedNum
;
++
j
){
q
Debug
()
<<
QString
(
"doesItExistEmployee==>面部索引: %1"
).
arg
(
j
);
q
Info
()
<<
QString
(
"doesItExistEmployee==>面部索引: %1"
).
arg
(
j
);
std
::
vector
<
float
>
newfeature
(
featureNum
,
0.0
f
);
std
::
vector
<
float
>
newfeature
(
featureNum
,
0.0
f
);
ret
=
HF_FaceFeatureExtractCpy
(
ctxHandle
,
imageSteamHandle
,
multipleFaceData
.
tokens
[
j
],
newfeature
.
data
());
ret
=
HF_FaceFeatureExtractCpy
(
ctxHandle
,
imageSteamHandle
,
multipleFaceData
.
tokens
[
j
],
newfeature
.
data
());
if
(
ret
!=
HSUCCEED
)
{
if
(
ret
!=
HSUCCEED
)
{
q
Debug
()
<<
QString
(
"特征提取出错: %1"
).
arg
(
ret
);
q
Info
()
<<
QString
(
"特征提取出错: %1"
).
arg
(
ret
);
HF_ReleaseImageStream
(
imageSteamHandle
);
HF_ReleaseImageStream
(
imageSteamHandle
);
return
;
return
;
}
}
...
@@ -252,9 +252,9 @@ void FaceReconitionHandle::doesItExistEmployee(const cv::Mat &source,std::list<v
...
@@ -252,9 +252,9 @@ void FaceReconitionHandle::doesItExistEmployee(const cv::Mat &source,std::list<v
return
;
return
;
}
}
q
Debug
()
<<
QString
(
"搜索置信度: %1"
).
arg
(
confidence
);
q
Info
()
<<
QString
(
"搜索置信度: %1"
).
arg
(
confidence
);
q
Debug
()
<<
QString
(
"匹配到的tag: %1"
).
arg
(
searchIdentity
.
tag
);
q
Info
()
<<
QString
(
"匹配到的tag: %1"
).
arg
(
searchIdentity
.
tag
);
q
Debug
()
<<
QString
(
"匹配到的customId: %1"
).
arg
(
searchIdentity
.
customId
);
q
Info
()
<<
QString
(
"匹配到的customId: %1"
).
arg
(
searchIdentity
.
customId
);
// Face Pipeline
// Face Pipeline
//printf("人脸特征数量: %d", faceNum);
//printf("人脸特征数量: %d", faceNum);
if
(
confidence
>
configConfidence
)
{
if
(
confidence
>
configConfidence
)
{
...
...
MqttSubscriber.cpp
View file @
ad174f19
...
@@ -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
;
...
...
VidesData.h
View file @
ad174f19
...
@@ -391,7 +391,7 @@ inline QString getDefaultGateway() {
...
@@ -391,7 +391,7 @@ inline QString getDefaultGateway() {
return
gateway
;
return
gateway
;
}
}
inline
bool
pingAddress
(
const
QString
&
address
)
{
bool
pingAddress
(
const
QString
&
address
)
{
QProcess
process
;
QProcess
process
;
QString
program
=
"ping"
;
QString
program
=
"ping"
;
QStringList
arguments
;
QStringList
arguments
;
...
@@ -407,21 +407,28 @@ inline bool pingAddress(const QString &address) {
...
@@ -407,21 +407,28 @@ inline bool pingAddress(const QString &address) {
return
false
;
return
false
;
}
}
if
(
!
process
.
waitForFinished
(
1000
))
{
// 使用较长的超时值,确保进程有足够时间完成
if
(
!
process
.
waitForFinished
(
3000
))
{
process
.
kill
();
// 如果超时,强制终止进程
return
false
;
return
false
;
}
}
QString
output
(
process
.
readAllStandardOutput
());
QString
output
(
process
.
readAllStandardOutput
());
// 此处可以使用更复杂的逻辑来解析 Ping 输出
// 简单的 Ping 成功检查逻辑
#ifdef Q_OS_WIN
return
output
.
contains
(
"TTL="
);
#else
return
output
.
contains
(
"1 packets transmitted, 1 received"
);
return
output
.
contains
(
"1 packets transmitted, 1 received"
);
#endif
}
}
inline
int
GetCpuIdByAsm_arm
(
char
*
cpu_id
)
inline
int
GetCpuIdByAsm_arm
(
char
*
cpu_id
)
{
{
FILE
*
fp
=
fopen
(
"/proc/cpuinfo"
,
"r"
);
FILE
*
fp
=
fopen
(
"/proc/cpuinfo"
,
"r"
);
if
(
nullptr
==
fp
)
if
(
nullptr
==
fp
)
{
{
q
Debug
()
<<
"failed to open cpuinfo"
;
q
Info
()
<<
"failed to open cpuinfo"
;
return
-
1
;
return
-
1
;
}
}
...
@@ -457,7 +464,7 @@ inline int GetCpuIdByAsm_arm(char* cpu_id)
...
@@ -457,7 +464,7 @@ inline int GetCpuIdByAsm_arm(char* cpu_id)
inline
QString
getCpuSerialNumber
()
{
inline
QString
getCpuSerialNumber
()
{
QFile
file
(
"/proc/cpuinfo"
);
QFile
file
(
"/proc/cpuinfo"
);
if
(
!
file
.
open
(
QIODevice
::
ReadOnly
|
QIODevice
::
Text
))
{
if
(
!
file
.
open
(
QIODevice
::
ReadOnly
|
QIODevice
::
Text
))
{
q
Debug
()
<<
"无法打开 /proc/cpuinfo 文件"
;
q
Info
()
<<
"无法打开 /proc/cpuinfo 文件"
;
return
QString
();
return
QString
();
}
}
QTextStream
in
(
&
file
);
QTextStream
in
(
&
file
);
...
...
gamera_videos.pro
View file @
ad174f19
...
@@ -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
mainwindow.cpp
View file @
ad174f19
...
@@ -124,7 +124,7 @@ MainWindow::MainWindow()
...
@@ -124,7 +124,7 @@ MainWindow::MainWindow()
if
(
!
server
.
listen
(
QHostAddress
::
Any
,
port
))
{
if
(
!
server
.
listen
(
QHostAddress
::
Any
,
port
))
{
qInfo
()
<<
"Error: Unable to start the server on port 12345"
;
qInfo
()
<<
"Error: Unable to start the server on port 12345"
;
}
else
{
}
else
{
q
Debug
()
<<
"Server started, listening on port 12345"
;
q
Info
()
<<
"Server started, listening on port 12345"
;
}
}
config
.
mqttConfig
.
clientId
=
serialNumber
;
config
.
mqttConfig
.
clientId
=
serialNumber
;
...
@@ -253,7 +253,7 @@ void MainWindow::handleMatNewConnection(){
...
@@ -253,7 +253,7 @@ void MainWindow::handleMatNewConnection(){
QRegExp
urlRegEx
(
"GET /cameras/([^/]+)/current_image HTTP"
);
QRegExp
urlRegEx
(
"GET /cameras/([^/]+)/current_image HTTP"
);
if
(
urlRegEx
.
indexIn
(
request
)
!=
-
1
)
{
if
(
urlRegEx
.
indexIn
(
request
)
!=
-
1
)
{
QString
sn
=
urlRegEx
.
cap
(
1
);
QString
sn
=
urlRegEx
.
cap
(
1
);
q
Debug
()
<<
"Requested Camera SN: "
<<
sn
;
q
Info
()
<<
"Requested Camera SN: "
<<
sn
;
bool
foundCamera
=
false
;
bool
foundCamera
=
false
;
for
(
auto
it
=
faceDetectionParkingPushs
.
begin
();
it
!=
faceDetectionParkingPushs
.
end
();
++
it
)
{
for
(
auto
it
=
faceDetectionParkingPushs
.
begin
();
it
!=
faceDetectionParkingPushs
.
end
();
++
it
)
{
QString
currentSn
=
it
->
second
->
getSSn
();
QString
currentSn
=
it
->
second
->
getSSn
();
...
@@ -307,7 +307,7 @@ void MainWindow::removeImageFiles(QString id){
...
@@ -307,7 +307,7 @@ void MainWindow::removeImageFiles(QString id){
QString
value
=
localIt
->
second
;
QString
value
=
localIt
->
second
;
QFile
file
(
value
);
QFile
file
(
value
);
if
(
!
file
.
open
(
QIODevice
::
WriteOnly
))
{
if
(
!
file
.
open
(
QIODevice
::
WriteOnly
))
{
q
Debug
()
<<
"removeImageFiles open fail"
<<
value
;
q
Info
()
<<
"removeImageFiles open fail"
<<
value
;
}
else
{
}
else
{
file
.
remove
();
file
.
remove
();
}
}
...
@@ -370,7 +370,7 @@ void MainWindow::updateLocalFace(const QString &httpurl) {
...
@@ -370,7 +370,7 @@ void MainWindow::updateLocalFace(const QString &httpurl) {
if
(
localIt
!=
localImageMap
.
end
())
{
if
(
localIt
!=
localImageMap
.
end
())
{
QFile
file
(
localIt
->
second
);
QFile
file
(
localIt
->
second
);
if
(
!
file
.
open
(
QIODevice
::
WriteOnly
))
{
if
(
!
file
.
open
(
QIODevice
::
WriteOnly
))
{
q
Debug
()
<<
"open fail"
<<
localIt
->
second
;
q
Info
()
<<
"open fail"
<<
localIt
->
second
;
}
else
{
}
else
{
file
.
remove
();
file
.
remove
();
qSetting
->
beginGroup
(
"localImageMap"
);
qSetting
->
beginGroup
(
"localImageMap"
);
...
@@ -716,14 +716,14 @@ void MainWindow::initEncodeToString(QString &enCodeJson) {
...
@@ -716,14 +716,14 @@ void MainWindow::initEncodeToString(QString &enCodeJson) {
}
}
bool
MainWindow
::
iniWorkSpVMn
(
vides_data
::
responseGb28181
*
gb28181
,
QString
&
workSpWMn
,
QString
&
sn
){
bool
MainWindow
::
iniWorkSpVMn
(
vides_data
::
responseGb28181
*
gb28181
,
QString
&
workSpWMn
,
QString
&
sn
){
q
Debug
()
<<
"iniWorkSpVMn=="
<<
sn
;
q
Info
()
<<
"iniWorkSpVMn=="
<<
sn
;
QString
jsonfile
=
QCoreApplication
::
applicationDirPath
()
+
"/camera_config.json"
;
QString
jsonfile
=
QCoreApplication
::
applicationDirPath
()
+
"/camera_config.json"
;
bool
isEqual
=
true
;
bool
isEqual
=
true
;
// 读取 JSON 配置文件
// 读取 JSON 配置文件
QFile
file
(
jsonfile
);
QFile
file
(
jsonfile
);
if
(
!
file
.
open
(
QIODevice
::
ReadOnly
))
{
if
(
!
file
.
open
(
QIODevice
::
ReadOnly
))
{
q
Debug
()
<<
"Failed to open the camera_config.json"
;
q
Info
()
<<
"Failed to open the camera_config.json"
;
return
isEqual
;
return
isEqual
;
}
}
QJsonObject
toJsonObject
;
QJsonObject
toJsonObject
;
...
@@ -975,7 +975,7 @@ void MainWindow::initCameras(vides_data::cameraParameters ¶meter,vides_data:
...
@@ -975,7 +975,7 @@ void MainWindow::initCameras(vides_data::cameraParameters ¶meter,vides_data:
CameraHandle
*
cameraHandle
=
new
CameraHandle
(
parameter
.
sDevId
,
parameter
.
httpUrl
,
parameter
.
sSn
,
parameter
.
channel
,
image_save
,
heightReference
,
devConfig
);
CameraHandle
*
cameraHandle
=
new
CameraHandle
(
parameter
.
sDevId
,
parameter
.
httpUrl
,
parameter
.
sSn
,
parameter
.
channel
,
image_save
,
heightReference
,
devConfig
);
int
sdk_handle
=
cameraHandle
->
sdkDevLoginSyn
(
parameter
.
sDevId
,
parameter
.
nDevPort
,
parameter
.
sUserName
,
parameter
.
sPassword
,
3000
);
int
sdk_handle
=
cameraHandle
->
sdkDevLoginSyn
(
parameter
.
sDevId
,
parameter
.
nDevPort
,
parameter
.
sUserName
,
parameter
.
sPassword
,
3000
);
q
Debug
()
<<
"句柄为2:"
<<
sdk_handle
;
q
Info
()
<<
"句柄为2:"
<<
sdk_handle
;
if
(
sdk_handle
<=
0
){
if
(
sdk_handle
<=
0
){
qInfo
()
<<
"登录失败"
;
qInfo
()
<<
"登录失败"
;
return
;
return
;
...
...
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