Tutorial 1 – Connecting to the Base

Requirements:
Getting Started
Ocularis SDK
Visual Studio (this tutorial will be using Visual Studio 2010 SP1) using C#


The first step in this series will be to connect to the Base service.The point of connecting to the Base will be to get the information needed to receive the video.

Create a .NET Console app, and add the following references from the SDK folder :

  • CayugaAdapter.dll
  • InfoDispatcher.dll
  • OCAdapter.dll
  • OcularisInterface.dll
  • OcularisLayoutServer.dll

The next step is to create an instance of OCAdapter:

As the comments note, the OCAdapter is used to adapt one interface, its interface, to other interfaces, including Base’s interface. OCAdapter does a lot of the work for information retrieval for us.

Now we’ll direct this instance of OCAdapter to log in to a Base using our supplied username, and password:

OCAdapter’s Login method takes a host name of the Base we want to connect to, a user that resides on that Base, a password for the user, the authentication scheme (NONE, BASIC, WINDOWS, WINDOWS_CURRENT_USER), and a deprecated timespan that was used to control the login timeout but is now ignored.

A little more about the possible authentication schemes:

BASIC
Requires: That a basic user has been setup with the Base, which includes a username and a password.
OCAdapter.Login(): Will use both supplied username and password.

WINDOWS
Requires: That a valid windows user has been setup with the Base, which includes the name of the windows user.
OCAdapter.Login(): Will use both supplied username and password.

WINDOWS_CURRENT_USER
Requires: That the current windows user has been setup with the Base, which includes the name of the windows user.
OCAdapter.Login(): Will ignore both username and password given, as only the windows username is required and OCAdapter will automatically use the current user.

Now that we have a result (good or bad) from OCAdapter’s Login method, we can now examine the result value. The Login method returns a LoginResult type whose values are being handled like so:

Now that we have successfully connected to the Base, let’s close out the connection and shutdown the OCAdapter instance.

OCAdapter’s Logout method clears out a great deal of its internal state and readies it for another Login attempt. This includes clearing the Base connection, any recorder connections, internal caches, keep alives, and stops event handlers.

Screenshot of the final program:
Series-1-Tutorial-1

That concludes this tutorial.


Next:
Tutorial 2 – Getting Camera Information