I developed and tested the following code in tenScripting. During testing I used a forced callback and the program works. When the program is triggered 60 seconds after startup this message is posted to the HS log:
Error 1 Running script W800RF32.vb :method not found
Did I miss something in the help file, or is something more required? It just sits waiting, in the 'threads'.
Public Sub main(ByRef Param As Object)
Dim ErrorMsg As String = ""
Dim PortConfiguration As String = "4800,N,8,1"
Dim W800RF32Script As String = "W800RF32.vb"
Dim W800RF32callback As String = "callback"
Dim ComPort As Integer = 1
Dim Hail1 As Char = ChrW((15 * 16) + 0) ' xF0 = Hail1
Dim Hail2 As Char = ChrW((2 * 16) + 9) ' x29 = Hail2
ErrorMsg = hs.OpenComPort(ComPort, PortConfiguration, 0, W800RF32Script, W800RF32callback, "")
If ErrorMsg = "" Then
hs.SetComPortRTSDTR(ComPort, True, True) ' Switch to transmit
hs.SendToComPort(ComPort, Hail1) ' Send wake up
hs.WaitEvents()
hs.SendToComPort(ComPort, Hail2) ' send Hail
hs.SetComPortRTSDTR(ComPort, False, True) ' Switch to receive
hs.WaitEvents()
DataBufferIn = hs.GetComPortData(ComPort) ' Get & Discard Echo
Else
Button = MsgBox(ErrorMsg) ' Post port problem
End If
End Sub
Public Sub callback(ByVal Param As String)
Dim DataBufferIn As String = ""
Dim ComPort As Integer = 1
DataBufferIn = hs.GetComPortData(ComPort) ' Get new Data
' Process DataIn
End Sub