Using the Kanzi Connect Server

Kanzi Connect comes with the Kanzi Connect Server which contains the minimum required functionality to serve content to Kanzi Connect applications. This Kanzi Connect Server comes with content stored in the <KanziConnectInstallation>/ContentPack directory, which you can use for demonstration purposes. The content in the ContentPack includes:

  • Default.db SQLite database that declares the ‘Server Local Content’

  • Music tracks and cover art for the playlists in the database

  • Contact photos for the contacts in the database

Kanzi Connect Client applications that want to connect to a Kanzi Connect Server must be on the same Wi-Fi or wired network as the Kanzi Connect Server and a firewall must allow all network traffic.

Using services from multiple servers

Kanzi Connect can maintain multiple connections towards different servers using different connection types. Kanzi Connect also supports running services in a different process or a device while sharing a common server. This is convenient when the server and service run on different operating systems. For example, use multiple servers when you want to use a separate server to instantiate Kanzi Connect services that require more strict control and combine less critical services on a different server.

Kanzi Connect applications define runtime connections to servers in the Application/bin/connection.xml file.

In Kanzi Studio you can select the server from which you want to use a service in the Kanzi Connect Editor where Kanzi Connect uses the server address to group services. When you import a service from a server that runs on a different IP address, Kanzi Connect Editor adds that server to your application.

When you want to use the same service from different servers, in the Kanzi Connect Editor you can select the server that you want to use for each service. When you import the same service from different servers, the version of the service and its data must be the same.

To match a server to a UI component, Kanzi Connect uses the Name property of a server. That enables you to change the server connection details and keep the exported kzb file for the Kanzi Engine. However, when you change the name of a server, in Kanzi Studio you must restart the Preview to take the changes into use.

Running the Kanzi Connect Server on Windows

The Kanzi Connect Server executable for Windows is stored in <KanziConnectInstallation>/SDK/output/Win32/GL_vs2015_Release_DLL/connect_server.exe.

Starting the Kanzi Connect Server

To start the Kanzi Connect Server, open the command line interface and run

connect_server

On Windows this command starts the debug configuration of the Kanzi Connect Server. To start explicitly either release or debug configuration specify the full path to executable. For example, to start the release configuration of the Kanzi Connect Server run

%KANZI_CONNECT_SDK%\output\win32\GL_vs2015_Release_DLL\connect_server.exe

After the server starts, it listens for connections.

Note

For QNX and Linux targets you must configure the library search path with the environment variable LD_LIBRARY_PATH to contain the directory where service plugins (libservice_*.so) reside so that the Kanzi Connect Server can load them.

Note

When you create a service plugin on Windows, make sure you use the correct configuration connect_server.exe to load the plugin. If a release Kanzi Connect Server loads a debug plugin, or the other way around, on Windows the server terminates because of incompatible C-libraries.

Controlling the Kanzi Connect Server

While Kanzi Connect Server is running and you must recover the UI when Kanzi Connect Server restarts, the connection to the server drops, or if you want to check whether a service frees its resources on shutdown, you can initialize and uninitialize the server:

  • To uninitialize the server, press the U key.

  • To initialize the server, press the I key.

To shut down the server, press any other key on the keyboard.

Running the Kanzi Connect Server on an Android device

The Kanzi Connect Server Android package is stored in <KanziConnectInstallation>/output/android/DemoServer-release.apk.

To run the Kanzi Connect Server on an Android device:

  1. Connect an Android device to your computer.

  2. Open the Kanzi Command Prompt and to install the Kanzi Connect Server to the device run

    adb install -r :file:`DemoServer-release.apk`
    
  3. Copy the <KanziConnectInstallation>/ContentPack directory to the Connect directory of the Android device storage. The storage can be located either in the internal or the external memory of the Android device.

  4. Start the Kanzi Connect Server application on the Android device. This application also works as the control panel for the Kanzi Connect Server. When the Kanzi Connect Server is running:

    • The Running toggle button is set to the ON position.

    • The log contains information about the operation of the Kanzi Connect Server

Accessing a Kanzi Connect Server in Kanzi Studio

When you create in Kanzi Studio an application that uses Kanzi Connect services, you must connect to a Kanzi Connect Server and import the services you want to use.

To access a Kanzi Connect Server in Kanzi Studio:

  1. In the Kanzi Studio main menu select Kanzi Connect > Start Kanzi Connect Server.

    Kanzi Studio starts the Kanzi Connect Server that is installed on your computer.

    ../../_images/start-kanzi-connect-server.png
  2. In the Kanzi Studio main menu select Kanzi Connect > Open Kanzi Connect Editor.

    Use the Kanzi Connect Editor to create and manage connections to Kanzi Connect servers and services.

    ../../_images/kanzi-connect-kanzi-connect-editor.png ../../_images/kanzi-connect-editor.png
  3. In the Kanzi Connect Editor click + Add Connection and in the Select Connect Server window click Connect.

    That way you create a connection to a Kanzi Connect Server. You can see the connection in the Kanzi Connect Editor.

    • The Server IPV4 Address property sets the IP address of the Kanzi Connect Server that the Kanzi Studio Preview uses to connect to the server and look for Kanzi Connect services available on that server.

      Here you use the default Kanzi Connect Server running on the local host at the IP address 127.0.0.1.

    • The Server IP Address property sets the address of the Kanzi Connect Server that the client application uses during runtime.

    ../../_images/add-connection.png ../../_images/connect-to-kanzi-connect-server.png ../../_images/kanzi-connect-editor-with-connection.png