This article shows you how to connect as a client to schema services at different levels of the cell hierarchy using the API.

You should know the information in the following article:
Before you start, remember:
Add the Ubisense references to your application
This guide shows you how to connect to example schema services as a client. The example includes services that serve each level of the cell hierarchy.
In this example, we will connect 3 example schemas at different levels of the cell hierarchy:
Ubisense.ULocation.CellData schema at the location cell level
Ubisense.USpatial.Monitor schema at the geometry cell level
Ubisense.UBuilding.Contents schema at the site level
|
We need to get the cell IDs from the
Ubisense.UCell.Config schema. These are required when connecting to any cell-level schema. We
need a caching client so we can iterate over the cell names in the database:
|
You can quickly find location cells by using this
example. Create a
Ubisense.ULocation.Cell instance and call its
Narrow(IObject other) method with the
Ubisense.UCell.Cell instance as
the argument. In this case we use the row from the
Ubisense.UCell.Config.Names relation. The operation will only succeed if the cell in question can be
downcast to a
ULocation::Cell:
|
Now,
location_cell is non-nil for your location cells, and nil for your spatial cells and
site.
Spatial cells are found in the same way as location
cells, but we use a
Ubisense.USpatial.Cell instead:
|
Now,
spatial_cell is non-nil for your geometry cells, and nil for your location cells and
site.
We now use the
Nil() method on the cell instances to test whether we can connect as a client.
The cell ID string is used as the argument to
ConnectAsClient() as follows:
|