Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
M
mirrorSimulator
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
李远洪
mirrorSimulator
Commits
87d867d9
Commit
87d867d9
authored
Jan 15, 2021
by
liyuanhong
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
优化
parent
c85a8ca2
Changes
6
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
102 additions
and
64 deletions
+102
-64
config/config.yaml
config/config.yaml
+2
-1
lib/service/StreamH264Flv.py
lib/service/StreamH264Flv.py
+11
-6
lib/socket/ClientWebSocket.py
lib/socket/ClientWebSocket.py
+1
-2
ui/EventAndOtherArea.py
ui/EventAndOtherArea.py
+9
-0
ui/HomeArea.py
ui/HomeArea.py
+78
-54
ui/MainWindow.py
ui/MainWindow.py
+1
-1
No files found.
config/config.yaml
View file @
87d867d9
...
@@ -3,3 +3,4 @@ globalCon:
...
@@ -3,3 +3,4 @@ globalCon:
cameraParam
:
cameraParam
:
host
:
10.100.11.125
host
:
10.100.11.125
port
:
1078
port
:
1078
devCode
:
868142043390091
\ No newline at end of file
lib/service/StreamH264Flv.py
View file @
87d867d9
...
@@ -189,12 +189,17 @@ class StreamH264Flv():
...
@@ -189,12 +189,17 @@ class StreamH264Flv():
# 获取视频播放地址
# 获取视频播放地址
####################################################
####################################################
def
getPlayUrl
(
self
,
mobile
,
channel
):
def
getPlayUrl
(
self
,
mobile
,
channel
):
try
:
res
=
requests
.
post
(
self
.
getGetPlayUrl
,
data
=
json
.
dumps
({
'devId'
:
mobile
,
'chan'
:
str
(
channel
)}))
.
text
res
=
requests
.
post
(
self
.
getGetPlayUrl
,
data
=
json
.
dumps
({
'devId'
:
mobile
,
'chan'
:
str
(
channel
)}))
.
text
res
=
json
.
loads
(
res
)
res
=
json
.
loads
(
res
)
url
=
res
[
"data"
][
"url"
]
url
=
res
[
"data"
][
"url"
]
# url = self.replaceHost(res["data"]["url"],"video-test.vandyo.com:")
# url = self.replaceHost(res["data"]["url"],"video-test.vandyo.com:")
wx
.
CallAfter
(
pub
.
sendMessage
,
"showLog"
+
str
(
self
.
channel
),
msg
=
"播放地址:"
+
url
+
"
\n
"
)
wx
.
CallAfter
(
pub
.
sendMessage
,
"showLog"
+
str
(
self
.
channel
),
msg
=
"播放地址:"
+
url
+
"
\n
"
)
# print("播放地址:" + url)
# print("播放地址:" + url)
except
:
traceback
.
print_exc
()
curTime
=
self
.
getCurTime
()
print
(
curTime
+
"获取播放地址失败!!!"
)
####################################################
####################################################
# 替换url的host
# 替换url的host
...
...
lib/socket/ClientWebSocket.py
View file @
87d867d9
...
@@ -34,8 +34,7 @@ class ClientWebSocket():
...
@@ -34,8 +34,7 @@ class ClientWebSocket():
def
on_message
(
self
,
message
):
def
on_message
(
self
,
message
):
# print("收到消息:" + message)
# print("收到消息:" + message)
curTime
=
self
.
getCurTime
()
wx
.
CallAfter
(
pub
.
sendMessage
,
"msgRev"
,
msg
=
message
)
wx
.
CallAfter
(
pub
.
sendMessage
,
"msgRev"
,
msg
=
curTime
+
message
)
def
on_error
(
self
,
error
):
def
on_error
(
self
,
error
):
print
(
error
)
print
(
error
)
...
...
ui/EventAndOtherArea.py
View file @
87d867d9
...
@@ -13,10 +13,19 @@ class EventAndOtherArea():
...
@@ -13,10 +13,19 @@ class EventAndOtherArea():
def
create
(
self
):
def
create
(
self
):
self
.
mainPanel
=
wx
.
Panel
(
self
.
frame
)
self
.
mainPanel
=
wx
.
Panel
(
self
.
frame
)
boxSizer
=
wx
.
BoxSizer
(
wx
.
VERTICAL
)
boxSizer
=
wx
.
BoxSizer
(
wx
.
VERTICAL
)
gpsPannel
=
wx
.
Panel
(
self
.
mainPanel
)
gpsPannelSizer
=
wx
.
BoxSizer
(
wx
.
VERTICAL
)
gpsPannel
.
SetBackgroundColour
(
"RED"
)
aaa
=
wx
.
StaticBox
(
gpsPannel
,
-
1
,
"gps数据"
)
gpsPannelSizer
.
Add
(
aaa
,
1
,
flag
=
wx
.
EXPAND
|
wx
.
ALL
)
wx
.
Button
(
aaa
,
label
=
"设置设备号"
,
pos
=
(
610
,
5
))
topPanel
=
wx
.
Panel
(
self
.
mainPanel
)
topPanel
=
wx
.
Panel
(
self
.
mainPanel
)
topPanel
.
SetBackgroundColour
(
"GREEN"
)
topPanel
.
SetBackgroundColour
(
"GREEN"
)
bottomPanel
=
wx
.
Panel
(
self
.
mainPanel
)
bottomPanel
=
wx
.
Panel
(
self
.
mainPanel
)
boxSizer
.
Add
(
gpsPannel
,
1
,
flag
=
wx
.
EXPAND
|
wx
.
ALL
)
boxSizer
.
Add
(
topPanel
,
1
,
flag
=
wx
.
EXPAND
|
wx
.
ALL
)
boxSizer
.
Add
(
topPanel
,
1
,
flag
=
wx
.
EXPAND
|
wx
.
ALL
)
boxSizer
.
Add
(
bottomPanel
,
2
,
flag
=
wx
.
EXPAND
|
wx
.
TOP
,
border
=
5
)
boxSizer
.
Add
(
bottomPanel
,
2
,
flag
=
wx
.
EXPAND
|
wx
.
TOP
,
border
=
5
)
self
.
mainPanel
.
SetSizer
(
boxSizer
)
self
.
mainPanel
.
SetSizer
(
boxSizer
)
return
self
.
mainPanel
return
self
.
mainPanel
\ No newline at end of file
ui/HomeArea.py
View file @
87d867d9
...
@@ -6,6 +6,7 @@ import threading
...
@@ -6,6 +6,7 @@ import threading
import
time
import
time
import
wx
import
wx
import
yaml
from
pubsub
import
pub
from
pubsub
import
pub
from
lib.socket.ClientWebSocket
import
ClientWebSocket
from
lib.socket.ClientWebSocket
import
ClientWebSocket
...
@@ -19,8 +20,9 @@ class HomeArea():
...
@@ -19,8 +20,9 @@ class HomeArea():
self
.
devCode
=
"868142043390091"
# 设备id
self
.
devCode
=
"868142043390091"
# 设备id
self
.
ws
=
None
self
.
ws
=
None
self
.
mainPanel
=
None
self
.
mainPanel
=
None
self
.
heartBeatTime
=
6
0
# 心跳时间
self
.
heartBeatTime
=
3
0
# 心跳时间
self
.
isHeartBeat
=
1
# 是否开启心跳 0:不开启 1:开启
self
.
isHeartBeat
=
1
# 是否开启心跳 0:不开启 1:开启
self
.
ignt
=
1
# 点熄火状态 0:熄火 1:点火
self
.
wsUrlText
=
None
# webSocket 连接地址文本框
self
.
wsUrlText
=
None
# webSocket 连接地址文本框
self
.
devCodeText
=
None
# 设备号文本框
self
.
devCodeText
=
None
# 设备号文本框
...
@@ -29,6 +31,11 @@ class HomeArea():
...
@@ -29,6 +31,11 @@ class HomeArea():
self
.
logTextCtr
=
None
# 日志显示框
self
.
logTextCtr
=
None
# 日志显示框
with
open
(
"config/config.yaml"
,
'r'
,
encoding
=
"utf-8"
)
as
fi
:
fi_data
=
fi
.
read
()
data
=
yaml
.
load
(
fi_data
,
Loader
=
yaml
.
FullLoader
)
self
.
devCode
=
str
(
data
[
"cameraParam"
][
"devCode"
])
def
setWsUrl
(
self
,
data
):
def
setWsUrl
(
self
,
data
):
...
@@ -184,6 +191,7 @@ class HomeArea():
...
@@ -184,6 +191,7 @@ class HomeArea():
skey
=
m
.
hexdigest
()
skey
=
m
.
hexdigest
()
msg
=
{}
msg
=
{}
msg
[
"data"
]
=
{}
msg
[
"data"
]
=
{}
msg
[
"data"
][
"ignt"
]
=
self
.
ignt
msg
[
"skey"
]
=
skey
msg
[
"skey"
]
=
skey
msg
[
"type"
]
=
"9"
# 心跳指令上报
msg
[
"type"
]
=
"9"
# 心跳指令上报
msg
=
json
.
dumps
(
msg
)
msg
=
json
.
dumps
(
msg
)
...
@@ -216,15 +224,30 @@ class HomeArea():
...
@@ -216,15 +224,30 @@ class HomeArea():
####################################################
####################################################
def
processRevCmd
(
self
,
msg
):
def
processRevCmd
(
self
,
msg
):
self
.
setLogRedirect
()
self
.
setLogRedirect
()
curTime
=
self
.
getCurTime
()
self
.
logTextCtr
.
WriteText
(
curTime
+
"收到消息:"
+
msg
+
"
\n
"
)
msgJson
=
json
.
loads
(
msg
)
msgJson
=
json
.
loads
(
msg
)
msgType
=
msgJson
[
"type"
]
msgType
=
msgJson
[
"type"
]
rSkey
=
msgJson
[
"skey"
]
rSkey
=
msgJson
[
"skey"
]
replyMsg
=
{}
replyMsg
=
{}
replyMsg
[
"skey"
]
=
rSkey
replyMsg
[
"skey"
]
=
rSkey
if
msgType
==
"1"
:
if
msgType
==
"1"
:
# 请求直播
self
.
processStream
(
msgJson
,
replyMsg
)
elif
msgType
==
"3"
:
# 视频抓拍
pass
elif
msgType
==
"4"
:
# 图片抓拍
pass
elif
msgType
==
"5"
:
# 视频回看
pass
elif
msgType
==
"7"
:
# 紧急救援
pass
####################################################
# 处理直播请求
####################################################
def
processStream
(
self
,
msgJson
,
replyMsg
):
cam
=
msgJson
[
"data"
][
"cam"
]
cam
=
msgJson
[
"data"
][
"cam"
]
if
cam
==
1
:
if
cam
==
1
:
if
globalParams
.
camera_1
.
getPushObj
()
==
None
:
if
globalParams
.
camera_1
.
getPushObj
()
==
None
:
globalParams
.
camera_1
.
doConnect
()
globalParams
.
camera_1
.
doConnect
()
globalParams
.
camera_1
.
startPush
(
None
)
globalParams
.
camera_1
.
startPush
(
None
)
replyMsg
[
"type"
]
=
"0"
replyMsg
[
"type"
]
=
"0"
...
@@ -275,6 +298,7 @@ class HomeArea():
...
@@ -275,6 +298,7 @@ class HomeArea():
curTime
=
self
.
getCurTime
()
curTime
=
self
.
getCurTime
()
self
.
logTextCtr
.
WriteText
(
curTime
+
"回复消息:"
+
replyMsg
+
"
\n
"
)
self
.
logTextCtr
.
WriteText
(
curTime
+
"回复消息:"
+
replyMsg
+
"
\n
"
)
####################################################
####################################################
# 日志重定向到日志框
# 日志重定向到日志框
####################################################
####################################################
...
...
ui/MainWindow.py
View file @
87d867d9
...
@@ -68,7 +68,7 @@ class MainWindow():
...
@@ -68,7 +68,7 @@ class MainWindow():
page5
=
eventAndOtherArea
.
create
()
page5
=
eventAndOtherArea
.
create
()
nodeBook
.
AddPage
(
page5
,
"告警与其他功能"
)
nodeBook
.
AddPage
(
page5
,
"告警与其他功能"
)
boxSizer
.
Add
(
nodeBook
,
1
,
flag
=
wx
.
EXPAND
|
wx
.
ALL
)
boxSizer
.
Add
(
nodeBook
,
1
,
flag
=
wx
.
EXPAND
|
wx
.
ALL
)
nodeBook
.
SetSelection
(
1
)
nodeBook
.
SetSelection
(
0
)
# 设置当前选中的标签页面
mainPanel
.
SetSizer
(
boxSizer
)
mainPanel
.
SetSizer
(
boxSizer
)
...
...
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