?? cworkmode.cls
字號(hào):
'Exit Sub
End If
SendCommand
Case ALERT
bht = False
If m_I <= 1 Then
If m_Interval < 2000 Then m_Interval = 2000
MDIMainForm.TimerCall.interval = 2000
SendCommand
m_I = m_I + 1
If m_I >= 2 Then
ActivateTimer 1000
End If
Else
bht = True
SendCommand
End If
Case LOCKCAR, UNLOCKCAR
'If m_I < 4 Then
' If m_Interval < 6000 Then m_Interval = 6000
' MDIMainForm.TimerCall.Interval = m_Interval
SendCommand
' m_I = m_I + 1
'End If
'If m_I >= 4 Then
' SetModeNone
OndutyInit True '自動(dòng)切換到值班狀態(tài)
'End If
Case StopCall
SendCommand
OndutyInit True
Case jt
SendCommand
OndutyInit True
End Select
End Sub
Public Sub SendCommand()
Dim ID As Integer
Dim i As Integer
Dim cmd(4) As Byte
Dim j As Integer
Dim PP As String
Dim K As Integer
Dim P(5) As String
SetReceiveFlag False '呼叫之前設(shè)置收到標(biāo)志為False
Dim oTarget As CTarget
Set oTarget = MDIMainForm.oTargetManager.GetTargetByIndex(m_TargetIndex)
Dim strCommID As String
Dim dbs As Database
Dim rst As Recordset
Set dbs = DBEngine.Workspaces(0).OpenDatabase(strPath + PATH_DBDATA)
Set rst = dbs.OpenRecordset("target")
rst.Index = "CommID"
rst.Seek "=", oTarget.GetCommID
Temp_ChuanKou = ""
If Not rst.NoMatch Then
Temp_ChuanKou = rst!tel
End If
strCommID = oTarget.GetCommID + "F"
For j = 1 To 12 Step 2
PP = Mid(strCommID, j, 2)
P(K) = Mid(PP, 2, 1) + Mid(PP, 1, 1)
K = K + 1
Next
strCommID = ""
For j = 0 To 5
strCommID = strCommID + P(j)
Next
Select Case m_Mode
Case QUERY '工作模式
DisplayPicture 2
MDIMainForm.StatusBar1.Panels(2).Text = "呼叫[" & oTarget.GetName & "]車!"
oCommStream.SendCommand "FF", strCommID
'here oCommStream.sendCommand do actural send work
ActivateTimer2 0 'here active timer2 do process2,every 2 sec. check comm is there return data come
ActivateTimer 0
MDIMainForm.TimerCheck.Enabled = True
MDIMainForm.TimerCheck.interval = 2000
Case SINGLECALL
DisplayPicture 2
Select Case DHFLAG
Case 1
MDIMainForm.StatusBar1.Panels(2).Text = "呼叫[" & oTarget.GetName & "]車!"
Case 2
MDIMainForm.StatusBar1.Panels(2).Text = "記錄回報(bào)[" & oTarget.GetName & "]車!"
Case 3
MDIMainForm.StatusBar1.Panels(2).Text = "自動(dòng)回報(bào)[" & oTarget.GetName & "]車!"
Case 4
MDIMainForm.StatusBar1.Panels(2).Text = "復(fù)位[" & oTarget.GetName & "]車!"
Case 5
MDIMainForm.StatusBar1.Panels(2).Text = "通話[" & oTarget.GetName & "]車!"
Case 6
MDIMainForm.StatusBar1.Panels(2).Text = "鎖車門[" & oTarget.GetName & "]車!"
Case 7
MDIMainForm.StatusBar1.Panels(2).Text = "開車門[" & oTarget.GetName & "]車!"
Case 8
MDIMainForm.StatusBar1.Panels(2).Text = "手柄設(shè)號(hào)[" & oTarget.GetName & "]車!"
Case 9
MDIMainForm.StatusBar1.Panels(2).Text = "記錄間隔[" & oTarget.GetName & "]車!"
Case 10
MDIMainForm.StatusBar1.Panels(2).Text = "更改號(hào)碼[" & oTarget.GetName & "]車!"
Case 11
MDIMainForm.StatusBar1.Panels(2).Text = "更改劫警[" & oTarget.GetName & "]車!"
Case 12
MDIMainForm.StatusBar1.Panels(2).Text = "不能接聽[" & oTarget.GetName & "]車!"
Case 13
MDIMainForm.StatusBar1.Panels(2).Text = "不能打出[" & oTarget.GetName & "]車!"
Case 14
MDIMainForm.StatusBar1.Panels(2).Text = "電話無限[" & oTarget.GetName & "]車!"
Case 15
MDIMainForm.StatusBar1.Panels(2).Text = "設(shè)防關(guān)機(jī)[" & oTarget.GetName & "]車!"
Case 16
MDIMainForm.StatusBar1.Panels(2).Text = "設(shè)防不關(guān)機(jī)[" & oTarget.GetName & "]車!"
Case 17
MDIMainForm.StatusBar1.Panels(2).Text = "呼叫[" & NumberCar1 & "]車!"
End Select
oCommStream.SendCommand "FB", strCommID
If DHFLAG = 1 Then
MDIMainForm.TimerCheck.Enabled = True
MDIMainForm.TimerCheck.interval = 2000
Else
MDIMainForm.TimerCheck.Enabled = True
MDIMainForm.TimerCheck.interval = 2000
End If
Case LOCKCAR
DisplayPicture 1
MDIMainForm.StatusBar1.Panels(2).Text = "鎖[" & oTarget.GetName & "]車!"
oCommStream.SendCommand "FA", strCommID
If MDIMainForm.Winsock1.State = 7 Then
MDIMainForm.Winsock1.SendData "鎖車" + oTarget.GetCommID
End If
Case UNLOCKCAR
DisplayPicture 1
MDIMainForm.StatusBar1.Panels(2).Text = "解鎖[" & oTarget.GetName & "]車!"
oCommStream.SendCommand "FE", strCommID
If MDIMainForm.Winsock1.State = 7 Then
MDIMainForm.Winsock1.SendData "解鎖" + oTarget.GetCommID
End If
Case ALERT
If m_I < 2 Then
oCommStream.SendCommand "FC", strCommID
ActivateTimer 1000
Else
If m_bPause Then Exit Sub
DHFLAG = 3
m_Interval = 5000
DisplayPicture 3
MDIMainForm.StatusBar1.Panels(2).Text = "呼叫[" & oTarget.GetName & "]車!"
oCommStream.SendCommand "FB", strCommID
ActivateTimer2 3000
MDIMainForm.TimerCall.Enabled = False
MDIMainForm.TimerCall.interval = 0
End If
Case StopCall
DisplayPicture 1
MDIMainForm.StatusBar1.Panels(2).Text = "巡檢[" & oTarget.GetName & "]車!"
'MDIMainForm.StatusBar1.Panels(2).Text = ""
oCommStream.SendCommand "FC", strCommID
Case jt
DisplayPicture 1
MDIMainForm.StatusBar1.Panels(2).Text = "監(jiān)聽[" & oTarget.GetName & "]車!"
oCommStream.SendCommand "FD", strCommID
If MDIMainForm.Winsock1.State = 7 Then
MDIMainForm.Winsock1.SendData "監(jiān)聽" + oTarget.GetCommID
End If
End Select
End Sub
Public Sub SetPause(ByVal bPause As Boolean)
m_bPause = bPause 'it is called by Pause in Workstatue
End Sub
Public Function SetModeComm()
oCommStream.SetComm MDIMainForm.oComm1 'all work oCommStream do is refer to oComm1
If Not oCommStream.StartWorking Then
SetModeNone 'startWorking用SetCommSetting設(shè)置串口,如設(shè)置成功則表示開始工作
End If
MDIMainForm.mnu_replay.Enabled = False 'commom work ,data is come form GPS
End Function
Public Sub SetModeReplay()
Dim strFileName As String
'得到重播的文件名
strFileName = CfWj
If strFileName = "" Then
Exit Sub
End If
StopWorking
On Error GoTo erorrhandle
oCommStream.StopWorking
'設(shè)置參數(shù)
oReplayStream.SetTimer MDIMainForm.TimerReplay
oReplayStream.SetFileName strFileName
oReplayStream.SetPlaySpeed (1)
oReplayStream.SetContinuous MDIMainForm.mnu_replay_continuous.Checked
oReplayStream.SetPause MDIMainForm.mnu_replay_pause.Checked
oReplayStream.SetReverse MDIMainForm.mnu_replay_pause.Checked
'清除以前的軌跡
MDIMainForm.oTargetManager.ClearTrack
MDIMainForm.mnu_replay.Visible = True
'如果重播失敗,則進(jìn)入停止工作狀態(tài)
If Not oReplayStream.StartWorking Then
SetModeNone
Exit Sub
End If
'主窗口上的重播菜單顯示
MDIMainForm.TimerReplay.Enabled = True
MDIMainForm.mnu_replay.Enabled = True
m_Mode = REPLAY
Display "重播"
Exit Sub
erorrhandle:
MsgBox "錯(cuò)誤!", vbOKOnly, "提示"
End Sub
Public Sub SetModeNone()
Dim ddd As String
m_Mode = NONEWORK
If MDIMainForm.oComm1.PortOpen = True Then
ddd = "AT+CNMA" + Chr(13)
MDIMainForm.oComm1.Output = ddd
End If
MDIMainForm.TimerCall.Enabled = False
MDIMainForm.TimerReplay.Enabled = False
oCommStream.StopWorking '關(guān)閉串口
MDIMainForm.StatusBar1.Panels(1).Text = ""
MDIMainForm.StatusBar1.Panels(2).Text = ""
DisplayPicture 4
MDIMainForm.mnu_replay.Enabled = False
Cfflag = False
MDIMainForm.TimerCheck.Enabled = False
MDIMainForm.TimerCheck.interval = 0
End Sub
Public Sub DisplayPicture(ByVal nType As Integer)
Select Case nType
Case 1 '正常
Set MDIMainForm.StatusBar1.Panels(2).Picture = MDIMainForm.ImgToolBar1.ListImages("Normal").Picture
Case 2 '無應(yīng)答
Set MDIMainForm.StatusBar1.Panels(2).Picture = MDIMainForm.ImgToolBar1.ListImages("NoAnwser").Picture
Case 3 '報(bào)警
Set MDIMainForm.StatusBar1.Panels(2).Picture = MDIMainForm.ImgToolBar1.ListImages("Alert").Picture
Case 4 '值班
Set MDIMainForm.StatusBar1.Panels(2).Picture = MDIMainForm.ImgToolBar1.ListImages("Null").Picture
End Select
End Sub
Public Sub Display(str As String)
MDIMainForm.StatusBar1.Panels(1).Text = str
MDIMainForm.StatusBar1.Panels(2).Text = ""
MDIMainForm.StatusBar1.Panels(3).Text = LoopTimes * 1 & "秒"
End Sub
Private Sub StopWorking()
MDIMainForm.StatusBar1.Panels(1).Text = ""
MDIMainForm.TimerReplay.Enabled = False
MDIMainForm.TimerCall.Enabled = False
m_I = 0
SetReceiveFlag False
End Sub
Public Sub SetInterval(interval As Long)
m_Interval = interval
If m_Interval < 3000 Then
m_Interval = 3000
End If
If m_Interval > 300000 Then
m_Interval = 300000
End If
'ActivateTimer m_Interval
End Sub
Public Function GetInterval() As Double
'GetInterval = m_Interval
GetInterval = LoopTimes * 1 * 1000
End Function
Public Sub SetReceiveFlag(bReceived As Boolean)
m_ReceiveFlag = bReceived
End Sub
Public Function GetReceiveFlag() As Boolean
GetReceiveFlag = m_ReceiveFlag
End Function
Public Function GetMode() As Integer
GetMode = m_Mode
End Function
Private Sub Class_Initialize()
m_Interval = 8000
m_ReceiveFlag = False
End Sub
Private Sub Class_Terminate()
SaveRPFile Date
End Sub
'save track file
Private Sub SaveRecord(oRecord As CRecord)
Static tLastDate As Date
If Not MDIMainForm.mnuOption_SaveTrack Then Exit Sub
If tLastDate <> Date Then
SaveRPFile tLastDate 'another day history file
End If
m_lCount = m_lCount + 1
ReDim Preserve oRecordArray(m_lCount) As New CRecord
oRecordArray(m_lCount).CopyRecord oRecord 'here put data in MM in a array
If m_lCount >= MaxBound Then
SaveRPFile Date 'save into hard disk
End If
tLastDate = Date
End Sub
Private Sub ClearRecord()
Dim i As Long
For i = 1 To m_lCount
Set oRecordArray(i) = Nothing
Next
m_lCount = 0
End Sub
Private Sub SaveRPFile(CurDate As Date)
Dim oRPFile As New CReplayFile 'CReplayFile is class
Dim i As Integer
If Dir(strPath + "tck\", vbDirectory) = "" Then
MkDir strPath + "tck\"
End If
For i = 1 To m_lCount
oRPFile.SetFileName strPath + "tck\" + Mid(CStr(oRecordArray(i).dTime), 1, 10) + ".tck" 'name of history file
oRPFile.RWOpen
oRPFile.AddRecord oRecordArray(i) 'add record one by one
Next
Set oRPFile = Nothing
ClearRecord 'do clear MM array
End Sub
Public Sub TryAgain(ByVal C_Index As String)
Dim Command_Index As String
If Mid(C_Index, Len(C_Index) - 2, 1) = "N" Then
Command_Index = Mid(C_Index, Len(C_Index) - 12, 10)
Select Case Command_Index
Case "0000000001"
DHFLAG = 1
SingleCallInit
Case "0000000002"
DHFLAG = 2
SingleCallInit
Case "0000000003"
DHFLAG = 3
SingleCallInit
Case "0000000004"
JtInI
Case "0000000006"
LockCarInit
Case "0000000007"
UnLockCarInit
Case "0000000008"
DHFLAG = 4
SingleCallInit
Case "0000000012"
StopCallinit
End Select
End If
End Sub
?? 快捷鍵說明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號(hào)
Ctrl + =
減小字號(hào)
Ctrl + -