Esempio n. 1
0
void RESTCallBack::getDescription(Dumais::JSON::JSON& json)
{
    json.addValue(mDescription,"description");
    Dumais::JSON::JSON& params = json.addList("params");
    for (ParamMap::const_iterator it = mParamList.begin(); it!=mParamList.end(); it++)
    {
        Dumais::JSON::JSON& j = params.addObject("param");
        j.addValue(it->first,"name");
        j.addValue(it->second.mDescription, "description");
    }
}
Esempio n. 2
0
void Thermostat::getProgramPoints(Dumais::JSON::JSON& json)
{
    json.addList("points");

    for (unsigned char i=0;i<(24*7);i++)
    {
        ProgramPoint point = mThermostatProgram.getPoint(i);
        if (point.mode > 0)
        {
            Dumais::JSON::JSON& obj = json["points"].addObject("ProgramPoint");
            obj.addValue(point.temp,"temperature");
            obj.addValue(point.mode,"mode");      
            obj.addValue(i,"hour");
        }
    }
}
Esempio n. 3
0
void RESTEngine::documentInterface(Dumais::JSON::JSON& json)
{
    json.addList("api");
    for (CallbackMap::iterator it = mCallbacks.begin(); it != mCallbacks.end(); it++)
    {
        std::string method = it->first;
        std::transform(method.begin(),method.end(),method.begin(),::toupper);
        for (auto it2 = it->second.begin(); it2 != it->second.end(); ++it2)
        {
            Dumais::JSON::JSON& j = json["api"].addObject();
            it2->mpCallback->getDescription(j);
            j.addValue(it2->uri,"path");
            j.addValue(method,"method");
        }
    }

    return;
}