Using both Visual Basic and Visual C++ sample code, the following set of applications will demonstrate the implementation and capabilities of the RFTerminal object and its methods. Both applications will return the values for various settings of an RF device, such as display width and height, and temporarily alter some of these settings.
' RFTerminal Object Demo Application
'
' Import a sleep function from the kernel32 dll
Declare Sub Sleep Lib "kernel32" (ByVal dwMilliseconds As Long)
' Declare an RFIO object for use throughout the demo application.
Public rfConsole As New RFIO
' Declare an RFTerminal object for use throughout the demo application.
Public rfTerm As New RFTERMINAL
' strBuffer is a temp storage buffer
Dim strBuffer As String
Public Sub Main()
' This application demonstrates the use of the various RFTerminal methods.
' The following lines clear the display and output the app title in
' reverse video.
rfConsole.RFPrint 0, 0, " Welcome To The ", _
WLCLEAR + WLREVERSE
rfConsole.RFPrint 0, 1, " RFTerminal Demo! ", WLREVERSE
rfConsole.RFPrint 0, 3, "Hit a key to proceed", WLNORMAL
' Hide the cursor for a cleaner display
rfConsole.RFPrint 0, 9, "", WLNORMAL
'
' Flush the output buffer and await a keystroke/scan
If rfConsole.GetEvent() = "" Then
GoTo ExitApp
End If ' If rfConsole.GetEvent() = ""
' When designing RF applications, it is often not possible to know
' which types of devices are going to be used by the end user. Using
' an RFTerminal object allows you access to accurate information
' about the user's RF device. Simply creating an RFTerminal object
' acquires the terminal's information, but for demonstration
' purposes, we will explicitly request the current setting from
' the RF device.
If rfTerm.ReadTerminalInfo() = False Then
GoTo ExitApp
End If ' If rfTerm.ReadTerminalInfo() = False
rfConsole.RFPrint 0, 0, "Terminal Information", _
WLREVERSE + WLCLEAR
' Display the terminal's screen dimensions
strBuffer = "Screen Size (" + Str(rfTerm.TerminalWidth()) + _
"," + Str(rfTerm.TerminalHeight()) + ")"
rfConsole.RFPrint 0, 1, strBuffer, WLNORMAL
' Display the WaveLink Studio Client version
rfConsole.RFPrint 0, 3, "WaveLink Version:", WLNORMAL
rfConsole.RFPrint 0, 4, rfTerm.WaveLinkVersion(), WLNORMAL
' Display the Terminal's ID
rfConsole.RFPrint 0, 6, "Terminal ID:", WLNORMAL
rfConsole.RFPrint 0, 7, rfTerm.TerminalID(), WLNORMAL
' Hide the cursor for a cleaner display. Here we use the screen
' height method to place our cursor off the viewable area.
rfConsole.RFPrint 0, rfTerm.TerminalHeight() + 1, "", WLNORMAL
' Flush the output buffer and await a keystroke/scan
If rfConsole.GetEvent() = "" Then
GoTo ExitApp
End If ' If rfConsole.GetEvent() = ""
rfConsole.RFPrint 0, 0, " Setting Cursor To ", _
WLCLEAR + WLREVERSE
rfConsole.RFPrint 0, 1, " Software Mode ", WLREVERSE
rfConsole.RFPrint 0, 3, "SW Cursor -> ", WLFLUSHOUTPUT
rfTerm.SetCursorMode SOFTWARECURSOR
If rfTerm.SetTerminalInfo() = False Then
GoTo ExitApp
End If ' If rfTerm.SetTerminalInfo() = False
Sleep (2000)
rfConsole.RFPrint 0, 5, "Resetting Cursor To ", WLREVERSE
rfConsole.RFPrint 0, 6, " Hardware Mode ", _
WLREVERSE + WLFLUSHOUTPUT
rfTerm.SetCursorMode HARDWARECURSOR
If rfTerm.SetTerminalInfo() = False Then
GoTo ExitApp
End If ' If rfTerm.SetTerminalInfo() = False
rfConsole.RFPrint 0, 7, "Done.", WLNORMAL
' Hide the cursor for a cleaner display. Here we use the screen
' height method to place our cursor off the viewable area.
rfConsole.RFPrint 0, rfTerm.TerminalHeight() + 1, "", WLNORMAL
' Flush the output buffer and await a keystroke/scan
If rfConsole.GetEvent() = "" Then
GoTo ExitApp
End If ' If rfConsole.GetEvent() = ""
ExitApp:
End Sub
//////////////////////////////////////////////////////////
// Place RF application's main code here
IRFIO rfConsole; // Declare an RFIO interface object
IRFTerminal rfTerminal; // Declare an RFTerminal interface
// object
Cstring csBuffer; // Storage buffer for data strings
// Create an RFIO object in the automated server for our use
if (rfConsole.CreateDispatch ("WAVELINKOLE.RFIO") == FALSE) ¿
return FALSE;
// Create an RFTerminal object in the automated server for
// our use
if (rfTerminal.CreateDispatch ("WAVELINKOLE.RFTERMINAL") == ¿
FALSE) return FALSE;
// This application demonstrates the use of the various
// RFTerminal methods.
// The following lines clear the display and output the app
// title in reverse video.
rfConsole.RFPrint (0, 0, " Welcome To The ", ¿
WLCLEAR | WLREVERSE);
rfConsole.RFPrint (0, 1, " RFTerminal Demo! ", WLREVERSE);
rfConsole.RFPrint (0, 3, "Hit a key to proceed", WLNORMAL);
// Hide the cursor for a cleaner display
rfConsole.RFPrint (0, 9, "", WLNORMAL);
// Flush the output buffer and await a keystroke/scan
if ((rfConsole.GetEvent ()).IsEmpty () == TRUE) {
// Release the RFIO & RFTerminal objects
rfConsole.ReleaseDispatch ();
rfTerminal.ReleaseDispatch ();
return FALSE;
} // if ((rfConsole.GetEvent ()).IsEmpty () == TRUE)
// When designing RF applications, it is often impossible to
// know which types of devices will be used by the end user.
// Using an RFTerminal object allows you access to accurate
// information about the user's RF device. Simply creating an
// RFTerminal object acquires the terminal's information, but
// for demonstration purposes, we will explicitly request
// the current setting from the RF device.
if (rfTerminal.ReadTerminalInfo () == FALSE) {
// Release the RFIO & RFTerminal objects
rfConsole.ReleaseDispatch ();
rfTerminal.ReleaseDispatch ();
return FALSE;
} // if (rfTerminal.ReadTerminalInfo () == FALSE)
rfConsole.RFPrint (0, 0, "Terminal Information", ¿
WLREVERSE | WLCLEAR);
// Display the terminal's screen dimensions
csBuffer.Format ("Screen Size (%d,%d)", ¿
rfTerminal.TerminalWidth (), ¿
rfTerminal.TerminalHeight ());
rfConsole.RFPrint (0, 1, csBuffer, WLNORMAL);
// Display the WaveLink Studio Client version
rfConsole.RFPrint (0, 3, "WaveLink Version:", WLNORMAL);
rfConsole.RFPrint (0, 4, rfTerminal.WaveLinkVersion (), ¿
WLNORMAL);
// Display the Terminal's ID
rfConsole.RFPrint (0, 6, "Terminal ID:", WLNORMAL);
rfConsole.RFPrint (0, 7, rfTerminal.TerminalID (), WLNORMAL);
// Hide the cursor for a cleaner display. Here we use the
// screen height method to place
// our cursor off the viewable area.
rfConsole.RFPrint (0, rfTerminal.TerminalHeight () + 1, "", ¿
WLNORMAL);
// Flush the output buffer and await a keystroke/scan
if ((rfConsole.GetEvent ()).IsEmpty () == TRUE) {
// Release the RFIO & RFTerminal objects
rfConsole.ReleaseDispatch ();
rfTerminal.ReleaseDispatch ();
return FALSE;
} // if ((rfConsole.GetEvent ()).IsEmpty () == TRUE)
rfConsole.RFPrint (0, 0, " Setting Cursor To ", ¿
WLCLEAR | WLREVERSE);
rfConsole.RFPrint (0, 1, " Software Mode ", WLREVERSE);
rfConsole.RFPrint (0, 3, "SW Cursor -> ", WLFLUSHOUTPUT);
rfTerminal.SetCursorMode (SOFTWARECURSOR);
if (rfTerminal.SetTerminalInfo () == FALSE) {
// Release the RFIO & RFTerminal objects
rfConsole.ReleaseDispatch ();
rfTerminal.ReleaseDispatch ();
return FALSE;
} // if (rfTerminal.SetTerminalInfo () == FALSE)
else Sleep (2000);
rfConsole.RFPrint (0, 5, "Resetting Cursor To ", WLREVERSE);
rfConsole.RFPrint (0, 6, " Hardware Mode ", ¿
WLREVERSE | WLFLUSHOUTPUT);
rfTerminal.SetCursorMode (HARDWARECURSOR);
if (rfTerminal.SetTerminalInfo () == FALSE) {
// Release the RFIO & RFTerminal objects
rfConsole.ReleaseDispatch ();
rfTerminal.ReleaseDispatch ();
return FALSE;
} // if (rfTerminal.SetTerminalInfo () == FALSE)
rfConsole.RFPrint (0, 7, "Done.", WLNORMAL);
// Hide the cursor for a cleaner display. Here we use
// the screen height method to place
// our cursor off the viewable area.
rfConsole.RFPrint (0, rfTerminal.TerminalHeight () + 1, "", ¿
WLNORMAL);
// Flush the output buffer and await a keystroke/scan
if ((rfConsole.GetEvent ()).IsEmpty () == TRUE) {
// Release the RFIO & RFTerminal objects
rfConsole.ReleaseDispatch ();
rfTerminal.ReleaseDispatch ();
return FALSE;
} // if ((rfConsole.GetEvent ()).IsEmpty () == TRUE)
// Release the RFIO & RFTerminal objects
rfConsole.ReleaseDispatch ();
rfTerminal.ReleaseDispatch ();
Was this article useful?
The topic was:
Inaccurate
Incomplete
Not what I expected
Other