client-cpp  0.10.0
Profile management

Profile subsystem is based on auto-generated class(es) according to the profile schema used during sdk generation.

Assume a profile schema has the following form:

{
"name": "Profile",
"namespace": "org.kaaproject.kaa.client.example",
"type": "record",
"fields": [
{
"name": "data",
"type": "string"
}
]
}

After calling avrogen.sh script Avro C++ compiler will be generated appropriate code and put it into ProfileGen.hpp header. So auto-generated notification class will be like:

struct Profile {
std::string data;
};

Below is an example of a profile container for C++:

#include "kaa/Kaa.hpp"
using namespace kaa;
// Kaa client initialization based on BasicProfileContainer
void init(){
//Create client for Kaa SDK
Kaa::init();
IKaaClient &kaaClient = Kaa::getKaaClient();
//Sample profile
KaaProfile profile;
profile.data = "some useful data";
//Create instance of profile container
ProfileContainerPtr container(new DefaultProfileContainer(profile));
//Set simple profile container.
kaaClient.setProfileContainer(container);
// Update method should be called to notify about changes in the profile.
kaaClient.updateProfile();
//Starts Kaa
Kaa::start();
}