Client Call Sequence:
Client application AppService call sequence
Client applications interact with the K2 via "proxy" objects. These are objects in the client application that represent the real objects in the K2. The proxy object's job is to simplify calls and to encapsulate house-keeping tasks so that the client application does not need to worry about it.
Here are the basic steps for a client application to connect to a K2 and do work:
1. Connect to a K2's AppService:
1a. Create an AppServerMgrProxy object in the client application.
1b. Tell it which K2 you want to connect to by calling the "SetHost" function.
1c. Pass in user credentials by calling the "SetUserCredentials" function.
1d. Call "Connect()". It returns true or false.
2. Create an AppServer:
Once connected, create an AppServer on the K2 by calling "CreateAppServer". This will create an AppServer on the K2 and return an AppServerProxy object back to the client application.
3. Create subsystem objects:
Now that you have an AppServer for your client, create the subsystem object(s) that you need by calling "Create<Object>" (i.e. CreateController, CreateLog, etc.). This will create the object on the K2 and return an <Object>Proxy object to the client.
4. Make K2 calls:
Make calls on subsystem proxy objects to control or retrieve information from the K2.
When finished, cleanup and delete the AppServer and subsystem objects by calling CloseConnection on the AppServerProxy.