Revision 40 logic/trunk/src/init/scenariolist.c
scenariolist.c | ||
---|---|---|
1 | 1 |
#include "scenariolist.h" |
2 |
#include "devicelist.h" |
|
2 | 3 |
#include "../logics/conditions.h" |
3 |
#include <string.h> |
|
4 | 4 |
#include <mxml.h> |
5 | 5 |
|
6 |
//extern device *hDevice; //device list |
|
7 |
|
|
6 | 8 |
short NUMBER_OF_SCENARIOS = 0; |
7 | 9 |
|
8 | 10 |
int getOperatorType(char *val) |
... | ... | |
35 | 37 |
{ |
36 | 38 |
cond_lst *cl, *head; |
37 | 39 |
head = NULL; |
38 |
//cl->OPERATOR_TYPE = |
|
40 |
|
|
39 | 41 |
while(node_t) // same level |
40 | 42 |
{ |
41 | 43 |
//printf("operator name: %s\n", node_t->value.opaque); |
42 | 44 |
//* |
43 | 45 |
cl = (cond_lst *)malloc(sizeof(cond_lst)); |
44 | 46 |
|
45 |
/** possible BUG, random pointer values (uncomment this block)
|
|
47 |
//** //possible BUG, random pointer values (uncomment this block)
|
|
46 | 48 |
cl->OPERATOR_TYPE = NULL; |
47 | 49 |
cl->dev = NULL; |
48 | 50 |
cl->nxt_lst = NULL; |
... | ... | |
59 | 61 |
} |
60 | 62 |
else |
61 | 63 |
{ |
62 |
//printf("create leaf\n"); |
|
63 |
cl->dev = (char *)malloc(sizeof(node_t->value.element.attrs->value)*strlen(mxmlElementGetAttr(node_t, "inDeviceId"))); |
|
64 |
cl->dev = mxmlElementGetAttr(node_t, "inDeviceId"); |
|
65 |
//printf("cl->dev %s\n", cl->dev); |
|
66 |
|
|
67 |
(*cl).value = atoi(mxmlElementGetAttr(node_t, "val")); |
|
68 |
//printf("cl->value %d\n", (*cl).value); |
|
64 |
if(mxmlElementGetAttr(node_t, "inDeviceId")) |
|
65 |
{ |
|
66 |
cl->dev = (char *)malloc(sizeof(node_t->value.element.attrs->value)*strlen(mxmlElementGetAttr(node_t, "inDeviceId"))); |
|
67 |
cl->dev = mxmlElementGetAttr(node_t, "inDeviceId"); |
|
68 |
(*cl).value = atoi(mxmlElementGetAttr(node_t, "val")); |
|
69 |
} |
|
69 | 70 |
} |
70 |
|
|
71 | 71 |
node_t=node_t->next; |
72 | 72 |
|
73 | 73 |
cl->nxt_lst = head; |
... | ... | |
144 | 144 |
//printf("idleChkItv:\t %d s\n", curr->idleChkItv ); |
145 | 145 |
|
146 | 146 |
/// int actvChkItv; |
147 |
curr->idleChkItv = atoi(mxmlElementGetAttr(mxml_scenarioNode, "val"));
|
|
147 |
curr->actvChkItv = atoi(mxmlElementGetAttr(mxml_scenarioNode, "val"));
|
|
148 | 148 |
mxml_scenarioNode= mxml_scenarioNode->next; |
149 |
//printf("idleChkItv:\t %d s\n", curr->idleChkItv );
|
|
149 |
//printf("actvChkItv:\t %d s\n", curr->actvChkItv );
|
|
150 | 150 |
|
151 |
/// float alpha; |
|
152 |
curr->alpha = atof(mxmlElementGetAttr(mxml_scenarioNode, "val")); |
|
153 |
mxml_scenarioNode= mxml_scenarioNode->next; |
|
154 |
//printf("actvChkItv:\t %f s\n", curr->alpha ); |
|
155 |
|
|
151 | 156 |
/// char *params_val; // TBD kaj je to? |
152 | 157 |
curr->params_val = (char *)malloc(sizeof(mxml_scenarioNode->value.element.attrs->value)*strlen(mxmlElementGetAttr(mxml_scenarioNode, "val"))); |
153 | 158 |
curr->params_val = mxmlElementGetAttr(mxml_scenarioNode, "val"); |
... | ... | |
187 | 192 |
curr->cond_l = getScenCond(mxml_scenarioNode); |
188 | 193 |
//printf("----------------------------------------------\n"); |
189 | 194 |
|
190 |
//** TEST conditions |
|
191 |
getConditionsResult(curr->cond_l); |
|
192 |
/**/ |
|
193 |
|
|
194 | 195 |
curr->running = 0; |
195 | 196 |
// done |
196 | 197 |
// moving to the next XML node |
Also available in: Unified diff