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
1893e60d
Commit
1893e60d
authored
Oct 10, 2024
by
郭峰
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'feature-1007488' into 'release'
修改ping命令-03 See merge request
!43
parents
e14f599a
225f0db7
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
10 additions
and
16 deletions
+10
-16
VidesData.h
+10
-16
No files found.
VidesData.h
View file @
1893e60d
...
@@ -454,26 +454,21 @@ inline bool GetNetworkInfoByQNetworkInterface(QString &mac, QString &subnetMask,
...
@@ -454,26 +454,21 @@ inline bool GetNetworkInfoByQNetworkInterface(QString &mac, QString &subnetMask,
subnetMask
=
entry
.
netmask
().
toString
();
subnetMask
=
entry
.
netmask
().
toString
();
// 获取网关地址
// 获取网关地址
QProcess
process
;
QFile
file
(
"/proc/net/route"
);
process
.
start
(
"sudo"
,
QStringList
()
<<
"/sbin/ip"
<<
"route"
);
if
(
!
file
.
open
(
QIODevice
::
ReadOnly
|
QIODevice
::
Text
))
{
if
(
!
process
.
waitForStarted
())
{
qInfo
()
<<
"Failed to open /proc/net/route file."
;
qInfo
()
<<
"Failed to start 'ip route' process."
;
continue
;
}
if
(
!
process
.
waitForFinished
())
{
process
.
kill
();
qInfo
()
<<
"Process 'ip route' timed out."
;
continue
;
continue
;
}
}
QString
output
=
process
.
readAllStandardOutput
();
QTextStream
in
(
&
file
);
QStringList
lines
=
output
.
split
(
'\n'
);
while
(
!
in
.
atEnd
())
{
foreach
(
QString
line
,
lines
)
{
QString
line
=
in
.
readLine
();
if
(
line
.
startsWith
(
"default via"
))
{
QStringList
parts
=
line
.
split
(
QRegExp
(
"
\\
s+"
));
QStringList
parts
=
line
.
split
(
QRegExp
(
"
\\
s+"
));
if
(
parts
.
size
()
>=
3
)
{
if
(
parts
.
size
()
>=
3
&&
parts
[
1
]
==
"00000000"
)
{
gateway
=
parts
[
2
];
gateway
=
parts
[
2
];
gateway
=
gateway
.
mid
(
6
,
2
)
+
":"
+
gateway
.
mid
(
4
,
2
)
+
":"
+
gateway
.
mid
(
2
,
2
)
+
":"
+
gateway
.
mid
(
0
,
2
);
gateway
=
gateway
.
replace
(
":"
,
"."
);
gateway
=
QHostAddress
(
gateway
).
toString
();
return
true
;
return
true
;
}
}
}
}
...
@@ -481,7 +476,6 @@ inline bool GetNetworkInfoByQNetworkInterface(QString &mac, QString &subnetMask,
...
@@ -481,7 +476,6 @@ inline bool GetNetworkInfoByQNetworkInterface(QString &mac, QString &subnetMask,
}
}
}
}
}
}
}
return
false
;
// Return false if no suitable interface is found or gateway not found
return
false
;
// Return false if no suitable interface is found or gateway not found
}
}
...
...
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