Subversion Repositories HomeAutomation

Rev

Rev 1318 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | SVN | RSS feed

Rev 1318 Rev 1326
Line 11... Line 11...
11
 
11
 
12
Protocol::pointer Protocol::Instance(new Protocol());
12
Protocol::pointer Protocol::Instance(new Protocol());
13
 
13
 
14
Protocol::Protocol()
14
Protocol::Protocol()
15
{
15
{
-
 
16
    LOG.setName("Protocol");
16
}
17
}
17
 
18
 
18
Protocol::~Protocol()
19
Protocol::~Protocol()
19
{
20
{
20
}
21
}
Line 22... Line 23...
22
Protocol::pointer Protocol::getInstance()
23
Protocol::pointer Protocol::getInstance()
23
{
24
{
24
    return Protocol::Instance;
25
    return Protocol::Instance;
25
}
26
}
26
 
27
 
27
void Protocol::load(string filename)
28
void Protocol::load(string filename, string cachefilename)
28
{
29
{
29
    this->myXmlNode.load(filename);
30
    this->myXmlNode.load(filename);
-
 
31
 
-
 
32
    LOG.info("Loaded protocol from \"" + filename + "\".");
30
 
33
 
31
    // TODO Catch exceptions thrown by load
34
    // TODO Catch exceptions thrown by load
32
 
35
 
33
    // TODO Do validation of XML-data, check if needed sections are defined
36
    // TODO Do validation of XML-data, check if needed sections are defined
-
 
37
 
-
 
38
 
-
 
39
    this->myXmlCacheNode.load(cachefilename);
-
 
40
 
-
 
41
    LOG.info("Loaded protocol cache from \"" + cachefilename + "\".");
-
 
42
 
-
 
43
    // TODO If not found generate one
-
 
44
 
-
 
45
    // TODO Check if versions match, if not update cache
-
 
46
}
-
 
47
 
-
 
48
xml::Node & Protocol::getRootNode()
-
 
49
{
-
 
50
    return this->myXmlNode;
34
}
51
}
35
 
52
 
36
xml::Node & Protocol::getRootNode()
53
xml::Node & Protocol::getRootCacheNode()
37
{
54
{
38
    return this->myXmlNode;
55
    return this->myXmlCacheNode;
39
}
56
}
40
 
57
 
41
}
58
}
42
 
59