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/gen/ProfileGen.hpp"
using namespace kaa;
public:
BasicProfileContainer(const Profile &profile) : profile_(profile) { }
virtual Profile getProfile() {
return profile_;
}
virtual void changeProfile(const Profile &profile) {
profile_ = profile;
updateProfile();
}
private:
Profile profile_;
};
void init(){
Profile profile;
profile.data = "some useful data";
}