?? cworkmode.cls
字號:
VERSION 1.0 CLASS
BEGIN
MultiUse = -1 'True
Persistable = 0 'NotPersistable
DataBindingBehavior = 0 'vbNone
DataSourceBehavior = 0 'vbNone
MTSTransactionMode = 0 'NotAnMTSObject
END
Attribute VB_Name = "CWorkMode"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = True
Attribute VB_PredeclaredId = False
Attribute VB_Exposed = False
Option Explicit
'Private m_Mode As Integer '工作模式
Private m_ReceiveFlag As Boolean '標識收到應答與否
'呼叫車輛的索引號
Private m_I As Integer '用來計數
Private m_bPause As Boolean '標志是否暫停呼叫,只在單呼、查詢、報警后單呼時有效
Private Const MaxBound = 1000 '用來存儲記錄
Private oRecordArray() As New CRecord
Private m_lCount As Long
Private oCommStream As New CCommStream
Public oReplayStream As New CReplayStream
'Private odelay As New delay
Public Sub playsound(filename As String)
'If MDIMainForm.MMControl1.mode = 526 Then
MDIMainForm.MMControl1.Command = "stop"
MDIMainForm.MMControl1.Command = "CLOSE"
'End If
MDIMainForm.MMControl1.Wait = True
MDIMainForm.MMControl1.Shareable = False
MDIMainForm.MMControl1.DeviceType = "waveaudio"
MDIMainForm.MMControl1.filename = filename
MDIMainForm.MMControl1.Command = "open"
MDIMainForm.MMControl1.Command = "play"
End Sub
Public Sub SeekCommData(ByVal Chuan As Integer)
oCommStream.GetInputBuff Chuan
End Sub
Public Sub ReplaySendData()
oReplayStream.SendData
End Sub
Public Sub ReceiveReplayRecord(oRecord As CRecord) '收到從串口傳入的數據
MDIMainForm.oTargetManager.ReceiveData oRecord
MDIMainForm.ReceiveData oRecord
End Sub
Public Sub DisplayCallResult(ByVal CarName As String)
Select Case m_Mode
Case ALERT
MDIMainForm.StatusBar1.Panels(2).Text = "[" + CarName + "]OK!"
If CarName = BjCl Then
DisplayPicture 3
Else
DisplayPicture 1
End If
Case QUERY
If WhetherOK = True Then
MDIMainForm.StatusBar1.Panels(2).Text = " 呼叫[" + CarName + "]車OK!"
DisplayPicture 1
ActivateTimer 0
ActivateTimer2 0
Else
MDIMainForm.StatusBar1.Panels(2).Text = "該車無應答!"
DisplayPicture 1
ActivateTimer 0
ActivateTimer2 0
End If
Case SINGLECALL
If WhetherOK = True Then
MDIMainForm.StatusBar1.Panels(2).Text = " 呼叫[" + CarName + "車OK!"
DisplayPicture 1
ActivateTimer 0
ActivateTimer2 0
Else
MDIMainForm.StatusBar1.Panels(2).Text = "該車無應答!"
DisplayPicture 1
ActivateTimer 0
ActivateTimer2 0
End If
End Select
End Sub
Public Sub ReceiveData(oRecord As CRecord) '收到從串口傳入的數據
'保存數據
SaveRecord oRecord
MDIMainForm.oTargetManager.ReceiveData oRecord
MDIMainForm.ReceiveData oRecord '把記錄傳入mdimainform
SetReceiveFlag True
End Sub
Public Sub QueryInit()
StopWorking
If MDIMainForm.oTargetManager.GetCount = 0 Then 'it is car number of be poll query
Exit Sub
End If
'設置參數,it will be used in process case
m_Mode = QUERY
If m_bPause Then
MDIMainForm.mnumode_pause_Click
End If
DHFLAG = 1
'激活查詢呼叫的計時器,timer do work process
m_TargetIndex = 1
m_Interval = Temp_HjTime
ActivateTimer 0
Display "查詢" '顯示工作狀態
OpenComm
MonitorForm.SetLockedID 0 '不鎖定車輛
End Sub
Public Sub SingleCallInit()
Dim Index As Long
Index = MDIMainForm.oTargetManager.GetIndexByName(Val(Trim(CarNum)))
If Index = 0 Then
MsgBox "您輸入的車輛名稱無效!", 48, "提示"
Exit Sub
End If
StopWorking 'just change panel note and change timer status
m_TargetIndex = Index
m_Mode = SINGLECALL 'used in process ,case
If m_bPause Then
MDIMainForm.mnumode_pause_Click
End If
If AlertFlag = True Then
ActivateTimer 1000
m_Interval = 5000
Else
'ActivateTimer 1000 'm_Interval 'active timer1 do work process then
End If
'sendcommand then oCommStream.SendCommad do actural send work and active timer2 check
If AlertFlag = True Then
Display "報警跟蹤"
Else
Select Case DHFLAG
Case 1
Display "單呼" 'just .text changed
Case 2
Display "記錄回報"
Case 3
Display "單呼自動"
Case 4
Display "車載復位"
End Select
End If
'OpenComm 'though active timercall it isn't run immediately,it will run display
'openComm and so on sentences ,when system is not busy timer will do its work,it is
'charged by system .In fact runtime of procedure is very short
Dim oTarget As New CTarget
Set oTarget = MDIMainForm.oTargetManager.GetTargetByIndex(Index)
MonitorForm.SetLockedID oTarget.GetID 'GetID is 監控目標碼,here singlecall lock object
End Sub
Public Sub JtInI()
Dim Index As Long
Index = MDIMainForm.oTargetManager.GetIndexByName(Val(Trim(CarNum)))
If Index = 0 Then
MsgBox "您輸入的車輛名稱無效!", 48, "提示"
Exit Sub
End If
StopWorking 'just change panel note and change timer status
m_TargetIndex = Index
m_Mode = jt 'used in process ,case
If m_bPause Then
MDIMainForm.mnumode_pause_Click
End If
ActivateTimer 1000 'm_Interval 'active timer1 do work process then
Display "監聽"
'though active timercall it isn't run immediately,it will run display
End Sub
Public Sub StopCallinit()
Dim Index As Long
Index = MDIMainForm.oTargetManager.GetIndexByName(Val(Trim(CarNum)))
If Index = 0 Then
MsgBox "您輸入的車輛名稱無效!", 48, "提示"
Exit Sub
End If
StopWorking 'just change panel note and change timer status
m_TargetIndex = Index
m_Mode = StopCall 'used in process ,case
'If m_bPause Then
' MDIMainForm.mnumode_pause_Click
'End If
m_I = 0
ActivateTimer 1000
Display "停止"
End Sub
Public Sub LockCarInit()
'Dim InputString As String
'InputString = InputBox("請輸入鎖車車輛名稱", "鎖車")
Dim Index As Long
Index = MDIMainForm.oTargetManager.GetIndexByName(Val(Trim(CarNum)))
If Index = 0 Then
MsgBox "您輸入的車輛名稱無效!", 48, "提示"
Exit Sub
End If
StopWorking
m_TargetIndex = Index
m_Mode = LOCKCAR
m_I = 0 'it is counter,means sendcommand time maybe
ActivateTimer 1000 'it is modify here,not like singlecall or querycall
Display "鎖車"
End Sub
Public Sub UnLockCarInit()
'Dim InputString As String
'InputString = InputBox("請輸入解鎖的車輛名稱", "解鎖")
Dim Index As Long
Index = MDIMainForm.oTargetManager.GetIndexByName(Val(Trim(CarNum)))
If Index = 0 Then
MsgBox "您輸入的車輛名稱無效!", 48, "提示"
Exit Sub
End If
StopWorking
m_TargetIndex = Index
m_Mode = UNLOCKCAR 'set mode ,it will be use in sendcommand case
m_I = 0
ActivateTimer 1000
Display "解鎖"
DisplayPicture 4
End Sub
Private Sub AlertInit()
Dim w
StopWorking
'If MDIMainForm.mnuOption_SoundAlert.Checked Then
' playsound (soundname$) '警笛
'End If
'If MDIMainForm.printinfo.Checked Then
' printinfo (ch) '打印
'End If
m_Mode = ALERT
m_I = 0
If m_bPause Then
MDIMainForm.mnumode_pause_Click
End If
ActivateTimer 1000 'm_Interval 'just like another four sendcommand ,active timercall and modify interval by procedure
Display "報警"
End Sub
Public Sub OndutyInit(IfInit As Boolean)
StopWorking
Display "值班"
DisplayPicture 4
If m_Mode = REPLAY Then
oCommStream.StartWorking
End If
MDIMainForm.TimerCheck.Enabled = False
MDIMainForm.TimerCheck.interval = 0
m_Mode = ONDUTY
MDIMainForm.mnu_replay.Enabled = False
AlertFlag = False
MDIMainForm.Label7.Caption = ""
BjCl = ""
''MDIMainForm.Caption = ""
End Sub
Public Sub ReplayInit()
SetModeReplay
End Sub
Private Sub OpenComm()
If Not g_bOpenComm Then '???
SetModeComm
End If
End Sub
Private Sub ActivateTimer2(interval As Long)
With MDIMainForm.TimerCheck
If interval = 0 Then
.Enabled = False
.interval = 0
Else
.Enabled = True
.interval = interval
End If
End With
End Sub
Private Sub ActivateTimer(interval As Long) 'pollcall and single call an so on all use this timer
With MDIMainForm.TimerCall 'it do process procedure
If interval = 0 Then
.Enabled = False
.interval = 0
Else
.Enabled = True
.interval = interval
End If
End With
End Sub
Public Sub Process2() 'it is runed by timercheck
End Sub
Public Sub Process() 'it is ran by timercall
Dim i As Integer
Select Case m_Mode
Case QUERY
If ArrDl(c) <> "" Then
m_TargetIndex = MDIMainForm.oTargetManager.GetIndexByName(Val(Trim(ArrDl(c))))
CarNum = Trim(ArrDl(c))
c = c + 1
Else
c = 0
m_TargetIndex = MDIMainForm.oTargetManager.GetIndexByName(Val(Trim(ArrDl(c))))
c = c + 1
End If
If m_bPause Then
Display "暫停"
Exit Sub
Else
Display "輪詢"
End If
If m_TargetIndex > MDIMainForm.oTargetManager.GetCount Then
m_TargetIndex = 1
End If
SendCommand
Case SINGLECALL
If m_bPause Then
Display "暫停工作"
DisplayPicture 4
Exit Sub
Else
If AlertFlag = True Then
Display "報警跟蹤"
Else
Select Case DHFLAG
Case 1
Display "單呼" 'just .text changed
Case 2
Display "記錄回報"
Case 3
Display "單呼自動"
Case 4
Display "車載復位"
Case 5
Display "通話"
Case 6
Display "鎖車門"
Case 7
Display "開車門"
Case 8
Display "手柄設號"
Case 9
Display "設歷史間隔"
Case 10
Display "更改服務申請"
Case 11
Display "更改劫警撥叫"
Case 12
Display "只允許電話打出"
Case 13
Display "只允許接聽電話"
Case 14
Display "電話無限制打出"
Case 15
Display "設防關機"
Case 16
Display "設防不關機"
End Select
End If
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -