Subversion Repositories HomeAutomation

Rev

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

Rev 1326 Rev 1328
Line 26... Line 26...
26
}
26
}
27
 
27
 
28
Header::Header(unsigned long moduleId, string moduleType, string messageType)
28
Header::Header(unsigned long moduleId, string moduleType, string messageType)
29
{
29
{
30
    LOG.setName("Header");
30
    LOG.setName("Header");
31
 
-
 
32
    LOG.debug("Start of constructor...");
-
 
33
 
31
 
34
    this->loadVariables();
32
    this->loadVariables();
35
 
-
 
36
    LOG.debug("Done loading variables...");
-
 
37
 
33
 
38
    if (types::UnsignedInteger *moduleIdDatatype = dynamic_cast<types::UnsignedInteger *>(this->myVariables["moduleId"].getDatatype().get()))
34
    if (types::UnsignedInteger *moduleIdDatatype = dynamic_cast<types::UnsignedInteger *>(this->myVariables["moduleId"].getDatatype().get()))
39
    {
35
    {
40
        moduleIdDatatype->setValue(moduleId);
36
        moduleIdDatatype->setValue(moduleId);
41
    }
37
    }
42
    else
38
    else
43
    {
39
    {
44
        throw new Exception("moduleId is not of the type \"unsigned integer\", this is a fatal error, correct the protocol specification");
40
        throw new Exception("moduleId is not of the type \"unsigned integer\", this is a fatal error, correct the protocol specification");
45
    }
41
    }
46
 
-
 
47
    LOG.debug("checkpoint 1...");
-
 
48
 
42
 
49
    if (types::UnsignedInteger *moduleTypeDatatype = dynamic_cast<types::UnsignedInteger *>(this->myVariables["moduleType"].getDatatype().get()))
43
    if (types::UnsignedInteger *moduleTypeDatatype = dynamic_cast<types::UnsignedInteger *>(this->myVariables["moduleType"].getDatatype().get()))
50
    {
44
    {
51
        unsigned long moduleTypeId = convert::string2uint(Protocol::getInstance()->getRootCacheNode().selectFirst("module", xml::Node::attributePair("name", moduleType))["id"]);
45
        unsigned long moduleTypeId = convert::string2uint(Protocol::getInstance()->getRootCacheNode().selectFirst("module", xml::Node::attributePair("name", moduleType))["id"]);
52
 
46
 
Line 54... Line 48...
54
    }
48
    }
55
    else
49
    else
56
    {
50
    {
57
        throw new Exception("moduletype is not of the type \"unsigned integer\", this is a fatal error, correct the protocol specification");
51
        throw new Exception("moduletype is not of the type \"unsigned integer\", this is a fatal error, correct the protocol specification");
58
    }
52
    }
59
 
-
 
60
    LOG.debug("checkpoint 2...");
-
 
61
 
53
 
62
    if (types::UnsignedInteger *messageTypeDatatype = dynamic_cast<types::UnsignedInteger *>(this->myVariables["messageType"].getDatatype().get()))
54
    if (types::UnsignedInteger *messageTypeDatatype = dynamic_cast<types::UnsignedInteger *>(this->myVariables["messageType"].getDatatype().get()))
63
    {
55
    {
64
        unsigned long messageTypeId = convert::string2uint(Protocol::getInstance()->getRootCacheNode().selectFirst("messagetype", xml::Node::attributePair("name", messageType))["id"]);
56
        unsigned long messageTypeId = convert::string2uint(Protocol::getInstance()->getRootCacheNode().selectFirst("messagetype", xml::Node::attributePair("name", messageType))["id"]);
65
 
57
 
66
        messageTypeDatatype->setValue(messageTypeId);
58
        messageTypeDatatype->setValue(messageTypeId);
67
    }
59
    }
68
    else
60
    else
69
    {
61
    {
70
        throw new Exception("messageType is not of the type \"unsigned integer\", this is a fatal error, correct the protocol specification");
62
        throw new Exception("messageType is not of the type \"unsigned integer\", this is a fatal error, correct the protocol specification");
71
    }
63
    }
72
 
-
 
73
    LOG.debug("End of contructor...");
-
 
74
}
64
}
75
 
65
 
76
Header::~Header()
66
Header::~Header()
77
{
67
{
78
}
68
}