VERSION 4.00 Begin VB.Form MainWnd Caption = "TEXA Disk Array Monitor v.1.01" ClientHeight = 2295 ClientLeft = 1350 ClientTop = 1695 ClientWidth = 3960 ForeColor = &H80000008& Height = 2700 Icon = "RSTTerm.frx":0000 KeyPreview = -1 'True Left = 1290 LinkTopic = "Form1" MaxButton = 0 'False ScaleHeight = 2295 ScaleWidth = 3960 Top = 1350 Width = 4080 Begin VB.CommandButton Command1 Caption = "Monitor" Height = 375 Left = 2880 TabIndex = 11 Top = 120 Width = 975 End Begin VB.CommandButton Command3 Caption = "Pause" Height = 375 Left = 2880 TabIndex = 0 Top = 600 Width = 975 End Begin VB.Frame Frame3 Caption = "Port Number" Height = 615 Left = 120 TabIndex = 7 Top = 1560 Width = 3735 Begin VB.OptionButton Option3 Caption = "COM3" Height = 270 Left = 2640 TabIndex = 10 Top = 240 Width = 855 End Begin VB.OptionButton Option2 Caption = "COM2" Height = 270 Left = 1440 TabIndex = 9 Top = 240 Width = 855 End Begin VB.OptionButton Option1 Caption = "COM1" Height = 270 Left = 240 TabIndex = 8 Top = 240 Value = -1 'True Width = 855 End End Begin VB.Frame Frame2 Caption = "Status" Height = 735 Left = 120 TabIndex = 5 Top = 720 Width = 2655 Begin VB.Label lblTerm2 Caption = "Label2" BeginProperty Font name = "­l­r ­o°S°V°b°N" charset = 128 weight = 700 size = 9 underline = 0 'False italic = 0 'False strikethrough = 0 'False EndProperty ForeColor = &H00000080& Height = 375 Left = 240 TabIndex = 6 Top = 240 Width = 2295 End End Begin VB.Frame Frame1 Caption = "RAID Mode" ClipControls = 0 'False Height = 615 Left = 120 TabIndex = 2 Top = 0 Width = 2655 Begin VB.Label lblTerm Caption = "Label5" BeginProperty Font name = "­l­r ­o°S°V°b°N" charset = 128 weight = 700 size = 9 underline = 0 'False italic = 0 'False strikethrough = 0 'False EndProperty Height = 255 Left = 960 TabIndex = 4 Top = 240 Width = 735 End Begin VB.Label Label1 Caption = "RAID -" BeginProperty Font name = "­l­r ­o°S°V°b°N" charset = 128 weight = 700 size = 9 underline = 0 'False italic = 0 'False strikethrough = 0 'False EndProperty Height = 255 Left = 240 TabIndex = 3 Top = 240 Width = 975 End End Begin VB.CommandButton Command2 Cancel = -1 'True Caption = "Cancel" Height = 375 Left = 2880 TabIndex = 1 Top = 1080 Width = 975 End Begin MCI.MMControl MMControl1 Height = 495 Left = 120 TabIndex = 12 Top = 1440 Visible = 0 'False Width = 3540 _Version = 65536 _ExtentX = 6244 _ExtentY = 873 _StockProps = 32 BorderStyle = 1 End Begin MSCommLib.MSComm MSComm1 Left = 2520 Top = 600 _Version = 65536 _ExtentX = 847 _ExtentY = 847 _StockProps = 0 CDTimeout = 0 CommPort = 1 CTSTimeout = 0 DSRTimeout = 0 DTREnable = -1 'True Handshaking = 0 InBufferSize = 1024 InputLen = 0 Interval = 1000 NullDiscard = 0 'False OutBufferSize = 512 ParityReplace = "?" RThreshold = 0 RTSEnable = 0 'False Settings = "9600,n,8,1" SThreshold = 0 End End Attribute VB_Name = "MainWnd" Attribute VB_Creatable = False Attribute VB_Exposed = False '===================================================================' ' ' ' TDA-Term TEXA Disk Array Monitor ' ' (c) Copyright 1996 Nippon TEXA Co.,Ltd. ' ' ' '===================================================================' ' Usage. ' 1.Connect the RS-232C cable(cross). ' 2.9600bps, 8bit, Non parity, 2 stop bit , non flow ' ' EI ;Echo on ' EO ;Echo off ' ST ;Status ' SC ;Status(Monitor) ' ;5 0 ' ;First column is number of RAID.(0,3,5) ' ;Second column represents status. ' ;0 :"NORMAL" ' ;1ª`5:Drive number of "ONE DOWN" ' ;9 :"SYSTEM DOWN" '===================================================================' ' History 1996.02.23 Ver.1.00 yam ;Original ' ' 1996.04.24 Ver.1.01 yam ; ' Option Explicit Const MB_OK = 0 ' MsgBoxªD Const MB_OKCANCEL = 1 Const MB_YESNO = 4 Const IDOK = 1 Const IDYES = 6 Const Echo = True Dim idComDev As Long 'Dvice ID. Dim WBuff As String 'Write buffer. Dim RBuff As String 'Read buffer. Dim R2Buff As String 'Read buffer. Dim DspBuff As String 'Check buffer. Dim DspOneB As Byte 'Check & Display buffer(Byte). Dim DspOneB2 As Byte 'Check & Display buffer(Byte). (Check Recovering) Dim Chname 'Port number Dim ParamString As String 'Parameter buffer Dim ret As Long Dim port_flag '0:close, 1:open Dim watch_flag 'Loop control 0:stop, 1:watch Dim BottonFlag 'Push flag 0:Monitor, 1:Pause, 2:Cancel Dim lop As Byte 'Input flag 0:Nothing ,1:Input Dim msg As String 'Message buffer Dim cnt As Byte 'Input length counter Dim starttime As Long 'Starting time Dim StatusFlag As Byte 'Status flag 0:Normal, 1:System Down, 2:One Down, 3:Recover Public CRLF As String Dim n As Byte 'RST monitor command Const OutEI As String = "EI" 'Echo in Const OutEO As String = "EO" 'Echo out Const OutSC As String = "SC" 'Status(Monitor) Const OutST As String = "ST" 'Status Dim OutBuff As String Const conInterval = 50 Function Cancel_Proc() Command1.Enabled = True: Command3.Enabled = False frame3.Enabled = True Command1.SetFocus 'Move focus. lblterm.Caption = "": lblterm2.Caption = "" 'Clear the display column. MainWnd.Show MainWnd.Show MainWnd.WindowState = 0 'Form size = Normal. If (port_flag = 1) Then 'Close a port. MSComm1.PortOpen = False port_flag = 0 End If End Function Function OutWait_5sec() If (Timer > starttime + 5) Then 'Over 5sec ? msg = "Please check connect." MainWnd.Show ret = sound_error() ret = MsgBox(msg, 16) 'Display. MSComm1.Output = OutBuff 'Output. MainWnd.Show MainWnd.WindowState = 0 'Form size = Normal starttime = Timer 'Set the starting time. End If End Function Function sound_error() 'Setting property of "MCI" device. MainWnd.MMControl1.Notify = False MMControl1.Command = "close" MainWnd.MMControl1.Wait = True MainWnd.MMControl1.Shareable = False MainWnd.MMControl1.DeviceType = "WaveAudio" MainWnd.MMControl1.filename = "ding.WAV " ' Open device "WaveAudio". MainWnd.MMControl1.Command = "Open" MainWnd.MMControl1.Command = "sound" MMControl1.Command = "close" End Function Function sound_onedown() 'Setting property of "MCI" device. MainWnd.MMControl1.Notify = False MMControl1.Command = "close" MainWnd.MMControl1.Wait = True MainWnd.MMControl1.Shareable = False MainWnd.MMControl1.DeviceType = "WaveAudio" MainWnd.MMControl1.filename = "ding.WAV " ' Open device "WaveAudio". MainWnd.MMControl1.Command = "Open" MainWnd.MMControl1.Command = "sound" MMControl1.Command = "close" End Function Function sound_sysdown() 'Setting property of "MCI" device. MainWnd.MMControl1.Notify = False MMControl1.Command = "close" MainWnd.MMControl1.Wait = True MainWnd.MMControl1.Shareable = False MainWnd.MMControl1.DeviceType = "WaveAudio" MainWnd.MMControl1.filename = "ding.WAV " ' Open device "WaveAudio". MainWnd.MMControl1.Command = "Open" MainWnd.MMControl1.Command = "sound" MMControl1.Command = "close" End Function ' Display "STATUS" ' Function Disp_Status() Select Case DspOneB 'Display "Normal" Case &H30 lblterm2.Caption = "" 'Clear the Display column. lblterm2.ForeColor = QBColor(0) 'Black color. lblterm2.Caption = "NORMAL" 'Display "NORMAL". If StatusFlag <> 0 Then MainWnd.Show MainWnd.WindowState = 0 'Form size = Normal StatusFlag = 0 End If 'Display "SYSTEM DOWN". Case &H39 lblterm2.Caption = "" 'Clear the Display column. lblterm2.ForeColor = QBColor(12) 'Red color. lblterm2.Caption = "SYSTEM DOWN" 'Display "SYSTEM DOWN". If StatusFlag <> 1 Then MainWnd.Show MainWnd.WindowState = 0 'Form size = Normal StatusFlag = 1 ret = sound_sysdown() End If 'Display "ONE DOWN" or "RECOVER". Case Else OutBuff = OutST + CRLF MSComm1.Output = OutBuff 'Output "ST". 'Wait. starttime = Timer 'Set startting time. While (MSComm1.InBufferCount = 0) 'InputªH If (BottonFlag <> 0) Then 'ret = Cancel_Proc 'Exit Sub End If ret = OutWait_5sec() ret = DoEvents() Wend 'wait.. starttime = Timer While (Timer < starttime + 1) ret = DoEvents() Wend 'Check input. While (MSComm1.InBufferCount) 'Wait. R2Buff = "" R2Buff = MSComm1.Input 'Input. ret = DoEvents() Wend n = 1 DspOneB2 = Asc(Mid(R2Buff, n, 1)) While DspOneB2 <> &HA If DspOneB2 = &H25 Then '"%" ? If StatusFlag <> 3 Then MainWnd.Show MainWnd.WindowState = 0 'Form size = Normal StatusFlag = 3 End If End If n = n + 1 DspOneB2 = Asc(Mid(R2Buff, n, 1)) ret = DoEvents() Wend lblterm2.ForeColor = QBColor(12) 'Red color. lblterm2.Caption = "" 'Clear the display column. Select Case StatusFlag Case 3 lblterm2.Caption = R2Buff Case Else lblterm2.Caption = "ONE DOWN (Drive No." + Chr$(DspOneB) + ")" If StatusFlag <> 2 Then MainWnd.Show MainWnd.WindowState = 0 'Form size = Nomal StatusFlag = 2 ret = sound_onedown() End If End Select OutBuff = OutSC + CRLF MSComm1.Output = OutBuff 'Output "SC". 'wait. starttime = Timer 'Set the starting time. While (MSComm1.InBufferCount = 0) 'InputªH If (BottonFlag <> 0) Then 'ret = Cancel_Proc 'Exit Sub End If ret = OutWait_5sec ret = DoEvents() Wend 'wait. starttime = Timer While (Timer < starttime + 1) ret = DoEvents() Wend 'Throw. While (MSComm1.InBufferCount) 'Wait. R2Buff = "" R2Buff = MSComm1.Input 'Input. ret = DoEvents() Wend DspOneB = &HA End Select End Function Private Sub MMControl1_PlayClick(cancel As Integer) 'Set interval of "StatusUpdate" event. MMControl1.UpdateInterval = conInterval End Sub ' ' ' Private Static Sub MSComm1_OnComm() Dim EVMsg As String Dim ERMsg As String Dim a As String MainWnd.Show Select Case MSComm1.CommEvent 'Event message Case vbMSCommEvSend Case vbMSCommEvReceive 'ShowData Term, MSComm1.Input Case vbMSCommEvCTS 'EVMsg = "Change status of CTS line." Case vbMSCommEvDSR 'EVMsg = "Change status of DSR line." Case vbMSCommEvCD 'EVMsg = "Change status of CD line." + CRLF Case vbMSCommEvRing 'EVMsg = "Detected Ring Signal." Case vbMSCommEvEOF 'EVMsg = "Input EOF" 'Error message Case vbMSCommErBreak 'EVMsg = "Detected Bread Signal." Case vbMSCommErCTSTO 'ERMsg = "Detected Time Out Error of CTS." Case vbMSCommErDSRTO 'ERMsg = "Detected Time Out Error of DSR." Case vbMSCommErFrame EVMsg = "Framing error." Case vbMSCommErOverrun ERMsg = "Over run error." Case vbMSCommErCDTO 'ERMsg = "Detected Time Out Error of Carrier Detection." Case vbMSCommErRxOver ERMsg = "Over flow error" Case vbMSCommErRxParity 'EVMsg = "Prity error" Case vbMSCommErTxFull 'ERMsg = "Full buffer error." Case Else 'ERMsg = "Somehow error." End Select If Len(EVMsg) Then ret = MsgBox(EVMsg, 16) ', "ªmCancelªn , ªmOKªn") EVMsg = "" ElseIf Len(ERMsg) Then ret = MsgBox(ERMsg, 5, "RSTTerm") ERMsg = "" 'if clicked cancel button,when close port and quit. If ret = 2 Then watch_flag = 0 Command1.Enabled = True: Command3.Enabled = False frame3.Enabled = True lblterm.Caption = "": lblterm2.Caption = "" 'Clear the display column. MainWnd.WindowState = 0 'Form size = Normal WBuff = Chr$(13) MSComm1.Output = WBuff End If End If End Sub ' Close serial port. ' Private Sub CloseSerialPort() If port_flag = 1 Then MSComm1.PortOpen = False port_flag = 0 End If watch_flag = 0 End End Sub ' Monitor button ' Private Sub Command1_Click() 'Initialize MSComm1.CommPort = Chname 'Setting COM port number MSComm1.Settings = ParamString$ 'Setting parameter MSComm1.RTSEnable = True 'Hard flow MSComm1.InputLen = 0 'Setting number of charactor MSComm1.PortOpen = True 'Open port port_flag = 1 BottonFlag = 0: lop = 1 lblterm.Caption = "" 'Clear the display column RBuff = "" WBuff = "" Command1.Enabled = False: Command3.Enabled = True Command2.Enabled = True: frame3.Enabled = False Command3.SetFocus StatusFlag = 0 'âæÆMÉJÚn OutBuff = OutEI + CRLF 'Output "EI" MSComm1.Output = OutBuff MSComm1.Output = OutBuff 'Wait starttime = Timer 'Set startting time While (MSComm1.InBufferCount = 0) 'RecevedªH If (BottonFlag <> 0) Then ret = Cancel_Proc Exit Sub End If If (Timer > starttime + 5) Then 'Over 5 secondsªH msg = "Please check connect." MainWnd.Show ret = sound_error() ret = MsgBox(msg, 16) 'Display MSComm1.Output = OutBuff 'Output MSComm1.Output = OutBuff 'Output MainWnd.Show MainWnd.WindowState = 0 'Form size = Normal starttime = Timer 'Set startting time End If ret = DoEvents() Wend 'Check the receves. While (MSComm1.InBufferCount) 'Wait RBuff = "" RBuff = MSComm1.Input 'Receve ret = DoEvents() Wend RBuff = Mid(RBuff, 1, 2) 'Get two character from top. If RBuff <> "EI" Then 'Check "EI". msg = "Somehow error." + CRLF msg = msg + "Abord is monitor." ret = sound_error() ret = MsgBox(msg, 16) BottonFlag = 1 ret = Cancel_Proc() Exit Sub End If 'Echo off OutBuff = OutEO + CRLF MSComm1.Output = OutBuff 'Output "EO" 'Wait starttime = Timer 'Set startting time While (MSComm1.InBufferCount = 0) 'ReceveªH If (BottonFlag <> 0) Then ret = Cancel_Proc() End If ret = OutWait_5sec() Wend While (MSComm1.InBufferCount) RBuff = MSComm1.Input 'Receve ret = DoEvents() Wend 'Output command RBuff = "" MSComm1.Output = OutSC + CRLF 'Monitorª@ª@ª`Go to Loop starttime = Timer 'Set startting time While (BottonFlag = 0) 'Check the time out of receve. If (Timer > starttime + 120) Then 'Over 120 secondsªH msg = "Cann't get status." + CRLF msg = msg + "Abort is monitor." ret = sound_error() ret = MsgBox(msg, 16) 'Display BottonFlag = 1 ret = Cancel_Proc() Exit Sub End If 'Check the receve. If MSComm1.InBufferCount Then 'Wait RBuff$ = MSComm1.Input 'Receve lop = 1 starttime = Timer Else lop = 0 End If While (lop = 1) 'New dataªH 'Receve of new data cnt = 0 'Pointer of buffer lblterm.Caption = "" 'Clear the display column cnt = cnt + 1 DspBuff = Mid(RBuff, cnt, 1) 'Get a character DspOneB = Asc(DspBuff) 'Change ASCII codes. lblterm.Caption = lblterm.Caption + Chr$(DspOneB) 'Display While (DspOneB <> &HA) 'Loop till "LF". cnt = cnt + 1 DspBuff = Mid(RBuff, cnt, 1) 'Get a character DspOneB = Asc(DspBuff) 'Change ASCII codes. If (DspOneB <> &HA) Then 'Except "LF" ? If (DspOneB <> &H20) Then 'Except " " ? If (DspOneB <> &HD) Then 'Except "CR" ? If ret > 0 Then ret = Disp_Status() Else If (ret < 0) Then MsgBox "ReadFile Error" End If End If End If End If ret = DoEvents() Wend lop = 0 ret = DoEvents() Wend ret = DoEvents() Wend ret = Cancel_Proc() Select Case BottonFlag Case 1 Exit Sub Case 2 End End Select End Sub ' Cancel button ' Private Sub Command2_Click() Command1.Enabled = True: Command3.Enabled = False frame3.Enabled = True lblterm.Caption = "": lblterm2.Caption = "" 'Clear the display column. MainWnd.Show MainWnd.WindowState = 0 'Form size = Normal If (port_flag = 1) Then 'Close a Port. MSComm1.PortOpen = False port_flag = 0 End If End End Sub ' Pause button ' Private Sub Command3_Click() BottonFlag = 1 End Sub ' Initialize ' Private Sub Form_Load() ParamString$ = "9600,N,8,2" CRLF = Chr$(13) + Chr$(10) Chname = 1 lblterm.Caption = "" lblterm2.Caption = "" RBuff = " " 'Secure the buffer space. WBuff = " " R2Buff = " " OutBuff = " " Command3.Enabled = False MainWnd.Show Command1.SetFocus End Sub ' ' Private Sub Form_QueryUnload(cancel As Integer, UnloadMode As Integer) CloseSerialPort End Sub ' COM1 ' Private Sub Option1_Click() Chname = 1 lblterm.Caption = "": lblterm2.Caption = "" End Sub ' COM2 ' Private Sub Option2_Click() Chname = 2 lblterm.Caption = "": lblterm2.Caption = "" End Sub ' COM3 ' Private Sub Option3_Click() Chname = 3 lblterm.Caption = "": lblterm2.Caption = "" End Sub