Example #1
0
IOBase *ListeRoom::get_chauffage_var(std::string &chauff_id, ChauffType type)
{
    for (uint j = 0;j < rooms.size();j++)
    {
        for (int m = 0;m < rooms[j]->get_size();m++)
        {
            IOBase *io = rooms[j]->get_io(m);
            if (io->get_param("chauffage_id") == chauff_id)
            {
                switch (type)
                {
                case PLAGE_HORAIRE: if (io->get_param("gui_type") == "time_range") return io; break;
                case CONSIGNE: if (io->get_param("gui_type") == "var_int") return io; break;
                case ACTIVE: if (io->get_param("gui_type") == "var_bool") return io; break;
                }
            }
        }
    }

    return nullptr;
}
bool ActionStd::SaveToXml(TiXmlElement *node)
{
    TiXmlElement *action_node = new TiXmlElement("calaos:action");
    action_node->SetAttribute("type", "standard");
    node->LinkEndChild(action_node);

    for (uint i = 0;i < outputs.size();i++)
    {
        IOBase *out = outputs[i];

        TiXmlElement *cnode = new TiXmlElement("calaos:output");

        cnode->SetAttribute("id", out->get_param("id"));
        cnode->SetAttribute("val", params[out->get_param("id")]);
        if (params_var[out->get_param("id")] != "")
            cnode->SetAttribute("val_var", params_var[out->get_param("id")]);

        action_node->LinkEndChild(cnode);
    }

    return true;
}
Example #3
0
bool ConditionScript::SaveToXml(TiXmlElement *node)
{
    TiXmlElement *cond_node = new TiXmlElement("calaos:condition");
    cond_node->SetAttribute("type", "script");
    node->LinkEndChild(cond_node);

    for (auto it: in_event)
    {
        IOBase *io = it.first;
        TiXmlElement *in_node = new TiXmlElement("calaos:input");
        in_node->SetAttribute("id", io->get_param("id"));
        cond_node->LinkEndChild(in_node);
    }

    TiXmlElement *sc_node = new TiXmlElement("calaos:script");
    sc_node->SetAttribute("type", "lua");
    cond_node->LinkEndChild(sc_node);

    TiXmlText *txt_node = new TiXmlText(script);
    txt_node->SetCDATA(true);
    sc_node->LinkEndChild(txt_node);

    return true;
}