Sub Process_Globals
Dim CommBuffer As String
End Sub
Sub AStreams_NewData (Buffer() As Byte)
Dim msg As String
msg = BytesToString(Buffer, 0, Buffer.Length, "UTF8")
CommBuffer = CommBuffer & msg
If tmrSerialPoll.Enabled=True Then tmrSerialPoll_Tick
End Sub
Sub tmrSerialPoll_Tick
Dim f As Boolean
Dim p As Int
Dim Command As String
If CommBuffer.Length > 0 Then
p=CommBuffer.IndexOf(Chr(13))
If p > -1 Then
Command = CommBuffer.SubString2(0,p)
CommBuffer=CommBuffer.SubString(p+1)
End If
End If
If Command.Length>0 Then
Command=Command.Replace(Chr(10)," ")
Command=Command.Replace(Chr(13)," ")
Command=Command.Trim
If Command.Length>2 Then
f=ProcessCommand(Command)
End If
End If
End Sub