client-cpp  0.8.1
Kaa client C++ sdk

Copyright 2014-2016 CyberVision, Inc.

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

 http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Table of contents

Quick start

Compiling C++ sdk

Before compiling, ensure that all required libraries are installed.
To compile Kaa client C++ sdk use shell script build.sh distributed within sdk archive.

$ ./avrogen.sh
$ ./build.sh install

Link Kaa library to your project

If you use GNU Compiler add linker flag -lkaacpp to link against dynamic library or -lkaacpp_s to link against static library.

Initializing Kaa library

Kaa client C++ sdk requires kaa::AbstractProfileContainer implementation for successful endpoint registration. See Profile management for details.

Optionally you may set configuration and configuration schema persistent storages by providing instances of kaa::IConfigurationStorage and kaa::ISchemaStorage. See Setting configuration persistent storage and Setting configuration schema persistent storage for the details.

NOTE: These options MUST be set after Kaa::init(); is called.

Use Kaa::start(); when Kaa C++ sdk is tuned to start Kaa client-server communication.

All Kaa functionality MUST be accessed through kaa::IKaaClient interface.

using namespace kaa;
Kaa::init(0);
IKaaClient& client = Kaa::getKaaClient();
// Initializing profile container, persistent storages etc.
Kaa::start();

Collecting C++ sdk debug information

By default Kaa client C++ sdk uses Boost::Log library to collect debug information.

If it is needed to integrate Kaa logs into existing debug info collecting system - provide implementation of kaa::ILogger interface and use kaa::LoggerFactory::initLogger(LoggerPtr logger) to reset default logger.

using namespace kaa;
class MyLogger : public ILogger {
public:
// implement pure virtual functions from interface.
};
...
LoggerFactory::initLogger(LoggerPtr(new MyLogger()));