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
dc686e8c
Commit
dc686e8c
authored
Oct 10, 2024
by
郭峰
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'feature-1007488' into 'release'
修改命令bug See merge request
!38
parents
063dc84f
fa9c2024
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
29 additions
and
29 deletions
+29
-29
NonConnectedCameraHandle.cpp
+1
-1
VidesData.h
+25
-27
gamera_videos.pro
+3
-1
No files found.
NonConnectedCameraHandle.cpp
View file @
dc686e8c
...
@@ -241,7 +241,7 @@ int NonConnectedCameraHandle::sdkDevLoginSyn(QString sDevId, int nDevPort,
...
@@ -241,7 +241,7 @@ int NonConnectedCameraHandle::sdkDevLoginSyn(QString sDevId, int nDevPort,
return
loginResult
;
return
loginResult
;
}
}
bool
NonConnectedCameraHandle
::
distributionNetwork
(
QString
&
ip
,
QString
&
sSn
,
int
hDevice
){
bool
NonConnectedCameraHandle
::
distributionNetwork
(
QString
&
ip
,
QString
&
sSn
,
int
hDevice
){
if
(
vides_data
::
pingAddress
(
ip
)){
if
(
ip
.
length
()
>
0
&&
vides_data
::
pingAddress
(
ip
)){
qInfo
()
<<
QString
(
"SN(%1): 当前ip已被使用%2"
).
arg
(
sSn
).
arg
(
ip
);
qInfo
()
<<
QString
(
"SN(%1): 当前ip已被使用%2"
).
arg
(
sSn
).
arg
(
ip
);
return
false
;
return
false
;
}
}
...
...
VidesData.h
View file @
dc686e8c
...
@@ -442,8 +442,8 @@ inline bool GetNetworkInfoByQNetworkInterface(QString &mac, QString &subnetMask,
...
@@ -442,8 +442,8 @@ inline bool GetNetworkInfoByQNetworkInterface(QString &mac, QString &subnetMask,
QList
<
QNetworkInterface
>
interfaces
=
QNetworkInterface
::
allInterfaces
();
QList
<
QNetworkInterface
>
interfaces
=
QNetworkInterface
::
allInterfaces
();
foreach
(
QNetworkInterface
interface
,
interfaces
)
{
foreach
(
QNetworkInterface
interface
,
interfaces
)
{
if
(
interface
.
flags
().
testFlag
(
QNetworkInterface
::
IsUp
)
&&
if
(
interface
.
flags
().
testFlag
(
QNetworkInterface
::
IsUp
)
&&
interface
.
flags
().
testFlag
(
QNetworkInterface
::
IsRunning
)
&&
interface
.
flags
().
testFlag
(
QNetworkInterface
::
IsRunning
)
&&
!
interface
.
flags
().
testFlag
(
QNetworkInterface
::
IsLoopBack
))
{
!
interface
.
flags
().
testFlag
(
QNetworkInterface
::
IsLoopBack
))
{
mac
=
interface
.
hardwareAddress
();
mac
=
interface
.
hardwareAddress
();
QList
<
QNetworkAddressEntry
>
addressEntries
=
interface
.
addressEntries
();
QList
<
QNetworkAddressEntry
>
addressEntries
=
interface
.
addressEntries
();
...
@@ -484,40 +484,38 @@ inline bool GetNetworkInfoByQNetworkInterface(QString &mac, QString &subnetMask,
...
@@ -484,40 +484,38 @@ inline bool GetNetworkInfoByQNetworkInterface(QString &mac, QString &subnetMask,
}
}
inline
bool
pingAddress
(
const
QString
&
address
)
{
inline
bool
pingAddress
(
const
QString
&
address
)
{
QProcess
process
;
QString
program
=
"ping"
;
QStringList
arguments
;
#ifdef Q_OS_WIN
#ifdef Q_OS_WIN
// Windows 下通常不需要 sudo
// Windows 指令 "ping IP -n 1 -w 超时(ms)"
arguments
<<
"-n"
<<
"1"
<<
address
;
QString
cmdstr
=
QString
(
"ping %1 -n 1 -w %2"
)
.
arg
(
address
).
arg
(
1000
);
#else
#else
// 不使用 sudo
// Linux 指令 "ping -c 1 IP"
arguments
<<
"-c"
<<
"1"
<<
address
;
QString
cmdstr
=
QString
(
"ping -c 1 %1"
)
.
arg
(
address
);
#endif
#endif
process
.
start
(
program
,
arguments
);
QProcess
cmd
;
if
(
!
process
.
waitForStarted
())
{
cmd
.
start
(
cmdstr
);
qWarning
()
<<
"Failed to start 'ping' process for"
<<
address
;
cmd
.
waitForReadyRead
(
1000
);
return
false
;
cmd
.
waitForFinished
(
1000
);
}
// 使用较长的超时值,确保进程有足够时间完成
if
(
!
process
.
waitForFinished
(
3000
))
{
process
.
kill
();
// 如果超时,强制终止进程
qWarning
()
<<
"Ping process timed out for"
<<
address
;
return
false
;
}
QString
output
(
process
.
readAllStandardOutput
());
QString
res
=
QString
::
fromLocal8Bit
(
cmd
.
readAll
());
q
Debug
()
<<
"Ping Output for"
<<
address
<<
":"
<<
output
;
// 调试输出
q
Info
()
<<
res
;
// 简单的 Ping 成功检查逻辑
#ifdef Q_OS_WIN
#ifdef Q_OS_WIN
return
output
.
contains
(
"TTL="
);
if
(
res
.
indexOf
(
"TTL"
)
==
-
1
)
#else
#else
return
output
.
contains
(
"1 packets transmitted, 1 received"
);
if
(
!
res
.
contains
(
"1 packets transmitted, 1 received"
))
#endif
#endif
{
qInfo
()
<<
address
<<
QString
::
fromLocal8Bit
(
"ping不通"
);
return
false
;
}
else
{
qInfo
()
<<
address
<<
QString
::
fromLocal8Bit
(
"ping通"
);
return
true
;
}
}
}
inline
QString
findReachableIp
()
{
inline
QString
findReachableIp
()
{
...
...
gamera_videos.pro
View file @
dc686e8c
...
@@ -130,7 +130,9 @@ HEADERS += \
...
@@ -130,7 +130,9 @@ HEADERS += \
AlgorithmTaskManage
.
h
\
AlgorithmTaskManage
.
h
\
BaseAlgorithm
.
h
\
BaseAlgorithm
.
h
\
MqttSubscriber
.
h
\
MqttSubscriber
.
h
\
NonConnectedCameraHandle
.
h
NonConnectedCameraHandle
.
h
\
RecognizedInfo
.
h
# Default rules for deployment.
# Default rules for deployment.
qnx
:
target
.
path
=
/
tmp
/
$$
{
TARGET
}
/
bin
qnx
:
target
.
path
=
/
tmp
/
$$
{
TARGET
}
/
bin
...
...
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