Skip to content
Kii thing interaction framework sdk for embedded devices.
C Shell Makefile Batchfile CMake
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Type Name Latest commit message Commit time
Failed to load latest commit information.
kii @ b3ba2d1

Kii thing-if SDK for Thing

Thing SDK for Kii Thing Interaction Framework (kii thing-if) .

Retrieve submodules.

When you build this SDK for the first time, you need to execute following commands:

# git submodule init
# git submodule update
# cd kii
# git submodule init
# git submodule update
# cd ../

These commands retrieve required modules for this SDK.


$ mkdir build
$ cd build
$ cmake ../
$ make


After the build, you can install SDK libraries by following commands. (Assume current directory is build you've created on build.)

$ make install

Or if you want to change install location:

$ make DESTDIR={path to install} install

By specifying DESTDIR, libraries and headers are installed in {path to install}/usr/local/lib and {path to install}/usr/local/include respectively.

Build Configuration

Debug Build

If you need to enable -g option and debug log output, following command will generate the debug build.

$ mkdir build
$ cd build
$ make

Configure MQTT keep-alive interval

Edit CMakeLists.txt and change following line.


Unit is seconds and by default it is set to 300 seconds. If 0 is specified, turn off the keep alive mechanism defined in MQTT. Setting short period will increase the load of MQTT broker when there is a lot of connected devices. For details, please refer to the MQTT spec.

Configure memory used by JSON parser.

Edit CMakeLists.txt and change following line.


The number indicates amounts of memory used to parse JSON when received it from server. Memory is allocated on stack. By default it is set to 128. Size of memory allocated by this can be calculated as following.

sizeof(kii_json_token_t) * KII_JSON_FIXED_TOKEN_NUM

Dynamic memory allocation for JSON parsing

If you prefer to dynamic allocation than fixed memory allocation, Edit CMakeLists.txt and remove the line specifies KII_JSON_FIXED_TOKEN_NUM.

In this case, you need to implement KII_JSON_RESOURCE_CB function and set the pointer in kii_t struct.

Connect MQTT server using non-secure connection.

By default SDK connect to a MQTT broker using secure connection(tls). If you need to use non-secure connection(tcp), Edit CMakeLists.txt and enable following line. (By removing # in the head.)


How to use


linux-sample shows how to implement the client application works in the Thing.

Environment implementations

SDK requires application to implement callback functions.

Socket callback functions:

To communucate with server, socket API implmementation is required. Please refer to linux-sample/sys_cb_impl.h and linux-sample/sys_cb_linux.c

Actual implementations are in linux-env directory.

Task callback functions:

To handle tasks asynchronusly, task implementation is required. pthread live up to expectation in linux environment and task does in RTOS environments.

List of task name symbols.


    The task of sending onboarded status.


    The task of receiving push messages.


    The task of sending ping request.

In RTOS, You'll specify stack size, depth and priority, etc depending on the environment.

Execute tests

# cd tests/small_tests
# make test
You can’t perform that action at this time.