⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 cworkmode.cls

📁 gps 源码 vb+access 其他地方很难找到 很详细的说明
💻 CLS
📖 第 1 页 / 共 2 页
字号:
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 + -