Sub Class_Globals
Dim objSerial As Serial
Dim mPort As String
Dim mEventName As String
Dim objCaller As Object
...
End Sub
Public Sub Initialize(Port As String,EventName As String,Caller As Object)
objSerial.Initialize("objSerial")
mPort = Port
mEventName = EventName
objCaller = Caller
End Sub
public Sub Connect()
Dim exc As ExceptionEx
Try
objSerial.Open(mPort)
objSerial.SetParams(9600,8,1,0)
objAsyncStream.Initialize(objSerial.GetInputStream,objSerial.GetOutputStream,"objAsyncStream")
If SubExists(objCaller,mEventName & "_Connected") Then
CallSubDelayed(objCaller,mEventName & "_Connected")
End If
Catch
exc = LastException
exc.Throw
End Try
End Sub