gclib  2.0.8
Communications API for Galil controllers and PLCs
Commands.vb
Go to the documentation of this file.
1 Partial Public Module Examples
2  ''' <summary>
3  ''' Demonstrates various uses of GCommand() And basic controller queries.
4  ''' </summary>
5  ''' <param name="gclib">A gclib object with a valid connection.</param>
6  ''' <returns>The success status Or error code of the function.</returns>
7  ''' <remarks>See commands_example.cs for an example.</remarks>
8  Function Commands(gclib As Gclib) As Integer
9  Console.WriteLine("*****************************************************************************")
10  Console.WriteLine("*********************** GCommand Trimmed example ***********************")
11  Console.WriteLine("*****************************************************************************")
12 
13  Console.WriteLine("GCommand(""PR ?,? "", true) will return a trimmed response of GCommand()")
14  Console.WriteLine("The command 'PR ?,?' will return the relative " +
15  "position of the A and B axes")
16  Console.WriteLine("<<PR ?,? with no trim: " + gclib.GCommand("PR ?,?", False) + ">>")
17  Console.WriteLine("<<PR ?,? with trim: " + gclib.GCommand("PR ?,?", True) + ">>")
18 
19  Console.WriteLine("*****************************************************************************")
20  Console.WriteLine("************************* GCommand Int example *************************")
21  Console.WriteLine("*****************************************************************************")
22 
23  Console.WriteLine("Use GCmdI() to retrieve the value of GCommand as an int.")
24  Console.WriteLine("The command 'MG _LMS' will return the available " +
25  "space in the vector buffer of the S plane.")
26 
27  Console.WriteLine("MG _LMS with GCmdI(): " + gclib.GCmdI("MG _LMS").ToString())
28 
29  Console.WriteLine("*****************************************************************************")
30  Console.WriteLine("*********************** GCommand Double example ************************")
31  Console.WriteLine("*****************************************************************************")
32 
33  Console.WriteLine("Use GCmdD() to retrieve the value of GCommand as a double.")
34  Console.WriteLine("The command 'MG @AN[1]' will return the value of Analog Input 1")
35 
36  Console.WriteLine("MG @AN[1] with GCmdD(): " + gclib.GCmdD("MG @AN[1]").ToString())
37 
38  Return Examples.GALIL_EXAMPLE_OK
39  End Function
40 End Module
Provides a class of shared constants and methods for gclib's example projects.
Definition: commands.cs:16
Provides a class that binds to gclib's unmanaged dll. Wraps each call and provides a more user-friend...
Definition: gclib.cs:68
GCLIB_DLL_EXPORTED GReturn GCALL GCommand(GCon g, GCStringIn command, GBufOut buffer, GSize buffer_len, GSize *bytes_returned)
Performs a command-and-response transaction on the connection.
GCLIB_DLL_EXPORTED GReturn GCALL GCmdI(GCon g, GCStringIn command, int *value)
Wrapper around GCommand that provides the return value of a command parsed into an int.
Definition: gclibo.c:278
GCLIB_DLL_EXPORTED GReturn GCALL GCmdD(GCon g, GCStringIn command, double *value)
Wrapper around GCommand that provides the return value of a command parsed into a double.
Definition: gclibo.c:289
GReturn vector(GCon g, char *file)
Puts controller into Vector Mode and accepts a file defining vector points.
Definition: vector.cpp:36
void error(GCon g, GReturn rc)
An example of error handling and debugging information.
Definition: examples.h:40
int Commands(Gclib gclib)
Demonstrates various uses of GCommand() And basic controller queries.
´╗┐partial Module Examples
Definition: Commands.vb:4