📄 rplystrm.cls
字号:
VERSION 1.0 CLASS
BEGIN
MultiUse = -1 'True
END
Attribute VB_Name = "CReplayStream"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = False
Attribute VB_Exposed = False
'相关类包括:CReplayFile、CGpsDataServer、MdiMainForm
'要求支持的Interface
'CGpsDataServer Interface
'ReceiveData
'Reset
'CReplayFile Interface
'SetFileName
'ROpen
'CloseFile
'GetRecord
'GotoFirst
'GotoNext
'GotoPrevious
'GotoLast
Private m_bStartWorking As Boolean
Private m_oRPFile As CReplayFile
'Private m_oGpsDataServer As CGpsDataServer
Private m_oTimer As Object
Private m_strFileName As String
Private m_bContinuous As Boolean
Private m_bPause As Boolean
Private m_bReverse As Boolean
Private Const PLAYSPEED = 300 '300毫秒读一条记录
Private m_lPlaySpeed As Long
'值域[-16..16]
'[-16..-2]: abs(m_lPlaySpeed)*PLAYSPEED毫秒读一条记录
'[-1..1]: PLAYSPEED毫秒读一条记录
'[2..16]: PLAYSPEED/m_lPlaySpeed毫秒读一条记录
'-------interface for gpsdataserver---------
Public Sub SetFileName(ByVal strFileName As String)
m_strFileName = strFileName
End Sub
Public Function StartWorking() As Boolean
Set m_oRPFile = New CReplayFile
m_oRPFile.SetFileName (m_strFileName)
If Not m_oRPFile.ROpen Then
MsgBox ("打开重放文件失败!")
StartWorking = False
Exit Function
End If
StartWorking = True
SaveSetting "Gps", "Option", "DefaultReplayFileName", strFileName
m_bStartWorking = True
End Function
Public Sub StopWorking()
If m_bStartWorking Then
m_oRPFile.CloseFile
m_oTimer.Enabled = False
Set m_oRPFile = Nothing
m_bStartWorking = False
End If
End Sub
Public Function GetReplayFile() As CReplayFile
Set GetReplayFile = m_oRPFile
End Function
Public Sub SetTimer(ByRef oTimer As Object)
Set m_oTimer = oTimer
End Sub
Private Function GetInterval() As Long
If m_lPlaySpeed < -1 Then
GetInterval = Abs(m_lPlaySpeed) * PLAYSPEED
End If
If m_lPlaySpeed >= -1 And m_lPlaySpeed <= 1 Then
GetInterval = PLAYSPEED
End If
If m_lPlaySpeed > 1 Then
GetInterval = PLAYSPEED / m_lPlaySpeed
End If
End Function
Public Function GetPlaySpeed() As Long
GetPlaySpeed = m_lPlaySpeed
End Function
Public Sub SetPlaySpeed(ByVal lPlaySpeed As Long)
m_lPlaySpeed = lPlaySpeed
m_oTimer.Interval = GetInterval
End Sub
Public Function GetContinuous() As Boolean
GetContinuous = m_bContinuous
End Function
Public Sub SetContinuous(ByVal bContinuous As Boolean)
m_bContinuous = bContinuous
If m_bContinuous Then
m_oTimer.Enabled = True
End If
End Sub
Public Function GetPause() As Boolean
GetPause = m_bPause
End Function
Public Sub SetPause(ByVal bPause As Boolean)
m_bPause = bPause
If Not m_bPause Then
m_oTimer.Enabled = True
Else
m_oTimer.Enabled = False
End If
End Sub
Public Function GetReverse() As Boolean
GetReverse = m_bReverse
End Function
Public Sub SetReverse(ByVal bReverse As Boolean)
m_bReverse = bReverse
End Sub
Public Sub SendData()
Dim oRecord As New CRecord
If Cfone = True Then
m_oRPFile.wz
End If
If m_oRPFile.GetRecord(oRecord) = RT_SUCCESS Then
'goto next CRecord begin
If GetReverse Then
If m_oRPFile.GotoPrevious = RT_FOF Then
If GetContinuous Then
m_oRPFile.GotoLast
Else
MDIMainForm.oWorkMode.OndutyInit True
MsgBox "重放完毕!"
Exit Sub
End If
End If
Else
If m_oRPFile.GotoNext = RT_LOF Then
If GetContinuous Then
m_oRPFile.GotoFirst
Else
MDIMainForm.oWorkMode.OndutyInit True
MsgBox "重放完毕!"
Exit Sub
End If
End If
End If
'goto next CRecord end
End If
If Cfflag = False Then
If Qren = True Then
MDIMainForm.oWorkMode.ReceiveReplayRecord oRecord
Set oRecord = Nothing
End If
Else
MDIMainForm.oWorkMode.ReceiveReplayRecord oRecord
End If
End Sub
Private Sub Class_Initialize()
m_lPlaySpeed = 1
m_bContinuous = True
m_bPause = True
m_bReverse = False
End Sub
Private Sub Class_Terminate()
StopWorking
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -