gclib  2.0.8
Communications API for Galil controllers and PLCs
Examples.vb
Go to the documentation of this file.
1 ''' <summary>
2 ''' Provides a class of shared constants And methods for gclib's example projects.
3 ''' </summary>
4 Partial Public Module Examples
5  Public Const GALIL_EXAMPLE_OK As Integer = 0
6  Public Const GALIL_EXAMPLE_ERROR = -100
7 
8  ''' <summary>
9  ''' Prints the exception to the console And queries the controller for the most recent
10  ''' error message.
11  ''' </summary>
12  ''' <param name="gclib">The gclib object from where the exception originated.</param>
13  ''' <param name="ex">The exception object caught by the example.</param>
14  ''' <remarks>See commands_example.cs for an example.</remarks>
15  Public Sub PrintError(gclib As Gclib, ex As Exception)
16  Console.WriteLine(ex.Message)
17 
18  'If exception was Not a GOpen() exception, safe to query
19  'the controller for a human readable error string
20  If Not ex.Message.Contains("-1101") Then
21  Console.WriteLine(gclib.GCommand("TC 1"))
22  End If
23  End Sub
24 End Module
string GCommand(string Command, bool Trim=true)
Used for command-and-response transactions.
Definition: gclib.cs:257
Provides a class that binds to gclib's unmanaged dll. Wraps each call and provides a more user-friend...
Definition: gclib.cs:68
GReturn message(GCon g)
Demonstrates how to receive messages from the controller and detect differences in Trace and crashed ...
Definition: message.cpp:14
void error(GCon g, GReturn rc)
An example of error handling and debugging information.
Definition: examples.h:40
partial Module Examples
Definition: Commands.vb:4
void PrintError(Gclib gclib, Exception ex)
Prints the exception to the console And queries the controller for the most recent error message.