Subversion Repositories HomeAutomation

Rev

Rev 1002 | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | SVN | RSS feed

Rev 1002 Rev 1021
Line 272... Line 272...
272
    }
272
    }
273
 
273
 
274
    return -1;
274
    return -1;
275
}
275
}
276
 
276
 
277
void CanIdTranslator::makeNMTDataValid(int commandId, map<string, CanVariable> &data)
277
void CanIdTranslator::makeNMTDataValid(string commandName, map<string, CanVariable> &data)
278
{
278
{
279
    vector<XmlNode> commandNodes = xmlNode.findChild("nmt_messages").getChildren();
279
    vector<XmlNode> commandNodes = xmlNode.findChild("nmt_messages").getChildren();
280
 
280
 
281
    for (int n = 0; n < commandNodes.size(); n++)
281
    for (int n = 0; n < commandNodes.size(); n++)
282
    {
282
    {
283
        map<string, string> attributes = commandNodes[n].getAttributes();
283
        map<string, string> attributes = commandNodes[n].getAttributes();
284
 
284
 
285
        if (stoi(attributes["id"]) == commandId)
285
        if (attributes["name"] == commandName)
286
        {
286
        {
287
            XmlNode varablesNode = commandNodes[n].findChild("variables");
287
            XmlNode varablesNode = commandNodes[n].findChild("variables");
288
 
288
 
289
            makeDataValid(varablesNode.getChildren(), data);
289
            makeDataValid(varablesNode.getChildren(), data);
290
 
290
 
Line 403... Line 403...
403
 
403
 
404
    map<string, CanVariable> variables;
404
    map<string, CanVariable> variables;
405
    return variables;
405
    return variables;
406
}
406
}
407
 
407
 
408
string CanIdTranslator::translateNMTDataToHex(int commandId, map<string, CanVariable> &data)
408
string CanIdTranslator::translateNMTDataToHex(string commandName, map<string, CanVariable> &data)
409
{
409
{
410
    makeNMTDataValid(commandId, data);
410
    makeNMTDataValid(commandName, data);
411
 
411
 
412
    return translateValidDataToHex(data);
412
    return translateValidDataToHex(data);
413
}
413
}
414
 
414
 
415
string CanIdTranslator::translateValidDataToHex(map<string, CanVariable> &data)
415
string CanIdTranslator::translateValidDataToHex(map<string, CanVariable> &data)