class advancedrelay.laygo.Laygo
All of the LayGO API related classes are contained in the
advancedrelay.laygo
package. The only class your application must
use in this package is class advancedrelay.laygo.Laygo
. This class provides the interface for
dynamically loading a LayGO API shared object and calling the exported
LayGO API functions from Java. This is the only way to access
the LayGO API from Java using LayGO for Java.
class advancedrelay.laygo.Laygo
throws an
UnsatisfiedLinkError
during class initialization if laygojni.dll (or
laygojni.so) cannot be loaded. The application must then call one
of the following Laygo
class methods to load the actual version of
the LayGO API that will be used:
Each of these functions also throws an UnsatisfiedLinkError
if it cannot
load the requested shared object. This error can be caught, but the application
must not call any other Laygo
class method unless one of these methods
completes successfully.
Each LayGO API function has a corresponding Laygo
class method
with the same name (including capitalization) but without the lgo_
prefix.
(The class name becomes the prefix.) For instance, the C language prototype:
extern LAYGOAPI LResult lgo_ConnectRequest(LCid, LCtlBuffer, LBufferSize);
becomes the class method:
public static native int ConnectRequest(int cid, byte [] ctlBuffer, int bufferSize);
So the C language function call:
LResult result = lgo_ConnectRequest(cid, ctlBuffer, bufferSize);
becomes the class method invocation:
int result = Laygo.ConnectRequest(cid, ctlBuffer, bufferSize);
Notice that the method returns an integer, not a laygo.Result
object.
The Java class laygo.Result
is defined specifically for those cases in which
a value is returned through a method parameter, for instance:
public static native int Poll(int cid, Result result);
The Laygo
class also exports defined constants corresponding to the
C language definitions in laygodef.h. As Java lacks enumerated types,
these take the form of public static final
integers.
The Laygo
class is documented in Java Class Documentation.
The semantics of each class method is exactly the same as that
stated for the corresponding API function in the
LayGO API Manual,
which remains the primary source for this information.
advancedrelay.laygo
Classes
Your application may call Laygo
class methods directly. However,
each of the other classes in the laygo
package encapsulates
an element of the LayGO API so that it can be more naturally incorporated
into Java programs. These classes make all the Laygo
class method
calls required.
Class | Encapsulates |
---|---|
Laygo | LayGO API functions. |
ProtocolStack | Supervisory access to the LayGO protocol stack. |
ProtocolStackException | Error condition detected while initializing a ProtocolStack object. |
ProtocolStackServer | Access to the LayGO RPC server. |
ProtocolService | LayGO Connection Identifiers (CIDs). |
ProtocolEvent | State changing events. |
DataEvent | Data events received on a CID. |
ProtocolEventException | State changing events encountered while reading data. |
StatusReport | LStatusReport structure. |
StatisticsTable | LStatisticsTable structure. |
These classes are documented in Java Class Documentation and their use demonstrated in the Jtdrv and Stdrv test programs.
Finally, the laygo
package contains a class which exports the defined
constants of each protocol layer:
These classes are also documented in Java Class Documentation,
and class X21bis
is used in the test programs.