Revision 44 logic/trunk/src/init/scenariolist.c

View differences:

scenariolist.c
3 3
#include "../logics/conditions.h"
4 4
#include <mxml.h>
5 5

  
6

  
6 7
//extern device *hDevice;   //device list
7 8

  
8 9
short NUMBER_OF_SCENARIOS = 0;
......
76 77
    return cl;
77 78
}
78 79

  
79
scenario *setNewScenarioList() // ony called on startup
80
scenario *setNewScenarioList(device *dev) // ony called on startup
80 81
{
81 82
    //TODO vedno preverjaj, ce so vse naprave, ki jih uporabljas, prisotne! npr. termometer mora biti v device list-u
82 83
    scenario *curr, *head;
......
124 125
        curr->inDevice_id = (char *)malloc(sizeof(mxml_scenarioNode->value.element.attrs->value)*strlen(mxmlElementGetAttr(mxml_scenarioNode, "id")));
125 126
        curr->inDevice_id = mxmlElementGetAttr(mxml_scenarioNode, "id");
126 127
            mxml_scenarioNode = mxml_scenarioNode->next;
127
        //printf("inDevice_id:\t %s\n", curr->inDevice_id );
128 128

  
129
        curr->inDev = getDevice(dev, curr->inDevice_id);
130
        //printf("inDev:\t %s\n", curr->inDev->name );
131

  
129 132
        /// char    *outDevice_id;
130 133
        curr->outDevice_id = (char *)malloc(sizeof(mxml_scenarioNode->value.element.attrs->value)*strlen(mxmlElementGetAttr(mxml_scenarioNode, "id")));
131 134
        curr->outDevice_id = mxmlElementGetAttr(mxml_scenarioNode, "id");
132 135
            mxml_scenarioNode = mxml_scenarioNode->next;
133 136
        //printf("outDevice_id:\t %s\n", curr->outDevice_id );
134 137

  
135
        /// char    *func;
136
        curr->func = (char *)malloc(sizeof(mxml_scenarioNode->value.element.attrs->value)*strlen(mxmlElementGetAttr(mxml_scenarioNode, "func")));
137
        curr->func = mxmlElementGetAttr(mxml_scenarioNode, "func");
138
        /// int     func;
139

  
140
        if(0==strcmp("static",mxmlElementGetAttr(mxml_scenarioNode, "func")))
141
            curr->func = FUNCTION_STATIC;
142
        else if(0==strcmp("linear",mxmlElementGetAttr(mxml_scenarioNode, "func")))
143
            curr->func = FUNCTION_LINEAR;
144
        else if(0==strcmp("logarithmic",mxmlElementGetAttr(mxml_scenarioNode, "func")))
145
            curr->func = FUNCTION_LOGARITHMIC;
146
        else if(0==strcmp("quadratic",mxmlElementGetAttr(mxml_scenarioNode, "func")))
147
            curr->func = FUNCTION_QUADRATIC;
148
        else
149
            curr->func = FUNCTION_UNKNOWN;
150

  
138 151
            mxml_scenarioNode = mxml_scenarioNode->next;
139 152
        //printf("func:\t %s\n", curr->func );
140 153

  

Also available in: Unified diff