Deploying Kanzi Connect applications to embedded devices¶
Deploying to Android from Kanzi Studio¶
To deploy a Kanzi Connect application to Android device from Kanzi Studio:
Connect your Android device to your computer.
In Kanzi Studio open the Kanzi Studio project of the application you want to deploy to your Android device and select File > Export > Build Android Package. Kanzi Studio builds the application source code, creates .apk package, and installs the package to your Android device.
Compiling with Scons from the command line¶
Before you can build a Kanzi application for your target platforms, set up and configure the Kanzi build environment for your target platforms. The build environment includes tools that the Kanzi build system uses to build your application for your target platforms.
To compile Kanzi Connect applications from the command line:
In Kanzi Studio main menu select File > Open Kanzi Command Prompt.
Go to the configuration directory of the platform for which you want to build your Kanzi Connect application (
<ProjectName>/Application/configs/platforms/<PlatformName>).For example, to build your Kanzi Connect application for:
Android. Open the command line in the
<ProjectName>/Application/configs/platforms/androiddirectory.Linux. Open the command line in the
<ProjectName>/Application/configs/platforms/linux_x11_glx_cpp11directory.Windows. Open the command line in the
<ProjectName>/Application/configs/platforms/win32directory.
Run the
sconscommand with the build parameters for your Kanzi Connect application.Syntax
scons <library> <type> <name>Parameters
library(Optional) the graphics library:
ES2builds the application with OpenGL ES 2.0GLbuilds the application with OpenGL
type(Optional) the build type:
Releasebuilds the application with compiler optimizations enabled. The release option builds smaller files than the debug option. Use this option for production purposes. Default value.Debugbuilds the application with disabled compiler optimizations and contains full debug information you can use with a debugger. The debug option builds larger files and debug applications run slower. Use this option for development purposes.Profilebuilds the application with compiler optimizations enabled, but without stripping the debug information that enables you to track the performance in some parts of the Kanzi Engine. Use this option when you want to measure the performance of your application. For example, when you want to find out which parts of the application take a lot of time to run, or which parts are called a large number of times.
name(Optional) the name of the project
Examples
// Builds the application with the default settings as specified // in config.py and SConstruct configuration files. scons
// Builds the release version of the application with the // OpenGL ES 2.0 graphics library. scons es2 release
// Builds the debug version of the application with // the OpenGL graphics library. scons GL debug
// Builds the debug version of the application with the // OpenGL ES 2.0 graphics library from the |ks| // project named MyProject. scons ES2 debug MyProject
Scons builds the Kanzi application source code and binary files in the
<ProjectName>/Application/outputdirectory.
Configuring Kanzi Connect application to connect to a Kanzi Connect Server running on another device¶
Kanzi Connect applications read the connection parameters from a connection.xml file. When you build a Kanzi Connect application, Kanzi Connect includes the connection.xml file in the apk file. However, you can use another connection.xml file on the Android device to change these settings. For other platforms, Kanzi Connect uses the configuration files from the application installation directory.
On Android, Kanzi Connect applies the parameters you set in the connection.xml file in this order:
The
connection.xmlin the apk fileThe
connection.xmlon the device storage in theInternal Storage/ConnectdirectoryThe
connection.xmlon the device SD card in theExternal Storage/Connectdirectory
For example, to configure on Android a Kanzi Connect application to connect to a Kanzi Connect Server which is running on another device:
Create a
connection.xmlfile where you configure the parameters you want your Kanzi Connect application to use.For example, in the
connection.xmlfile set the IP address of the computer which is running Kanzi Connect Server to which you want your application to connect.<root> <connection_adapter> <name.. comment: name by which server recognizes a client>My Kanzi Connect application</name> <server_name>Server.. comment: sets the context</server_name> <bearer.. comment: bearer and server name must be in all such files.>connect.bearer.tcp</bearer> <attribute name="host_ip" value="10.20.30.40"/> <attribute name="host_port" value="2002"/> </connection_adapter> </root>
Connect your Android device to your computer and set the connection type to Transfer Files.
This way you can access the device file system with Windows Explorer.
Copy the
connection.xmlfile to your Android device to theInternal Storage/Connectdirectory.When you run your Kanzi Connect application on your Android device, the application uses the parameters you set in the
connection.xmlfile.
Run the Kanzi Connect application¶
To run the Kanzi Connect application:
Start the Kanzi Connect Server on your computer or another device in the subsystem.
Start your Kanzi Connect application on the device to which you deployed the application. On Android device you can launch the application using the device application launcher or adb. On other embedded targets use either shell or a start-up script.