Index: logic/trunk/src/init/scenarios.xml
===================================================================
--- logic/trunk/src/init/scenarios.xml	(revision 29)
+++ logic/trunk/src/init/scenarios.xml	(revision 30)
@@ -1,26 +0,0 @@
-<?xml version="1.0"?>
-<scenariotree>
-    <scenario id="ac_01">
-        <name nam="Air Conditioner"/>
-        <minvalue minval="18"/>
-        <maxvalue maxval="27"/>
-	<optimal_value optVal="23"/>
-	<idle_check_interval ici="600"/>
-	<active_check_interval aci="600"/>
-	<sensors chk_dev1="thermometer_01" chk_dev2="thermometer_01"/>
-	...
-	<reaction_function fr="linear"/>
-        <action act="testAction_1"/>
-        <param par="testParam_1"/>
-    </scenario>
-</scenariotree>
-
-name
-action path
-param
-idle check interval (s)
-active check interval (s)
-influence devices
-reaction values //treba razdelat
-function type //static (on - off), linear, log etc. (kako se spreminja moč na intervalu)
-
Index: logic/trunk/src/init/scenariolist.c
===================================================================
--- logic/trunk/src/init/scenariolist.c	(revision 0)
+++ logic/trunk/src/init/scenariolist.c	(revision 30)
@@ -0,0 +1,164 @@
+#include "scenariolist.h"
+#include "../logics/conditions.h"
+#include <string.h>
+#include <mxml.h>
+
+
+
+scenario *hScenario; //scenario list
+
+//parseScenCondLeaf()
+//parseScenCondNode()
+
+cond_lst *parseScenCond()
+{
+    return NULL;
+}
+
+int setNewScenarioList() // ony called on startup
+{
+    //TODO vedno preverjaj, ce so vse naprave, ki jih uporabljas, prisotne! npr. termometer mora biti v device list-u
+    scenario *curr, *head;
+    head = NULL;
+
+    FILE *fp;
+    mxml_node_t *tree, *node;
+
+	if(fp = fopen("./src/init/scenariotree.xml", "r")) //TODO !hardcoded
+	{
+        printf("File read!\n");
+        //TODO replace with syslog error
+	}
+	else
+        printf("Error!");
+        //TODO replace with syslog error
+
+	tree = mxmlLoadFile(NULL, fp, MXML_IGNORE_CALLBACK);
+	node = tree;
+	fclose(fp);
+
+    /* //structure of XML tree
+    ?xml
+      |
+    devicetree
+      |
+    dev1 - dev2 - ...
+      |      |
+      |      |
+      |     ID - name - minvalue - maxvalue - action - param
+    ID - name - minvalue - maxvalue - action - param
+    /**/
+    //getting to the correct level of the xml tree (descend 2 levels)
+    node=node->child->child;
+    // printf("hDevice %d\n", hDevice);
+
+    // fill the list of known devices
+    //      sorry for the ugly chunk of code, but I had to allocate memory
+    // for each string separately in order to keep it scalable
+    while(node!=NULL)
+    {
+        curr = (scenario *)malloc(sizeof(scenario));
+
+        /// char    *scen_id;
+        curr->scen_id = (char *)malloc(sizeof(node->value.element.attrs->value)*strlen(mxmlElementGetAttr(node, "id")));
+        curr->scen_id = mxmlElementGetAttr(node, "id"); // possible BUG, perhaps use strcpy here!
+        printf("id:\t %s\n", curr->scen_id );
+
+        /// char    *scen_name;
+        curr->scen_name = (char *)malloc(sizeof(node->value.element.attrs->value)*strlen(mxmlElementGetAttr(node, "name")));
+        curr->scen_name = mxmlElementGetAttr(node, "name"); // possible BUG, perhaps use strcpy here!
+        printf("scenario name:\t %s\n", curr->scen_name);
+
+        // getting data for individual scenario
+        mxml_node_t *mxml_scenarioNode;
+        mxml_scenarioNode=node->child;
+
+        /// char    *inDevice_id;
+        curr->inDevice_id = (char *)malloc(sizeof(mxml_scenarioNode->value.element.attrs->value)*strlen(mxmlElementGetAttr(mxml_scenarioNode, "id")));
+        curr->inDevice_id = mxmlElementGetAttr(mxml_scenarioNode, "id");
+            mxml_scenarioNode = mxml_scenarioNode->next;
+        printf("inDevice_id:\t %s\n", curr->inDevice_id );
+
+        /// char    *outDevice_id;
+        curr->outDevice_id = (char *)malloc(sizeof(mxml_scenarioNode->value.element.attrs->value)*strlen(mxmlElementGetAttr(mxml_scenarioNode, "id")));
+        curr->outDevice_id = mxmlElementGetAttr(mxml_scenarioNode, "id");
+            mxml_scenarioNode = mxml_scenarioNode->next;
+        printf("outDevice_id:\t %s\n", curr->outDevice_id );
+
+        /// char    *func;
+        curr->func = (char *)malloc(sizeof(mxml_scenarioNode->value.element.attrs->value)*strlen(mxmlElementGetAttr(mxml_scenarioNode, "func")));
+        curr->func = mxmlElementGetAttr(mxml_scenarioNode, "func");
+            mxml_scenarioNode = mxml_scenarioNode->next;
+        printf("func:\t %s\n", curr->func );
+
+        /// int     idleChkItv;
+        curr->idleChkItv = atoi(mxmlElementGetAttr(mxml_scenarioNode, "val"));
+            mxml_scenarioNode= mxml_scenarioNode->next;
+        printf("idleChkItv:\t %d s\n", curr->idleChkItv );
+
+        /// int     actvChkItv;
+        curr->idleChkItv = atoi(mxmlElementGetAttr(mxml_scenarioNode, "val"));
+            mxml_scenarioNode= mxml_scenarioNode->next;
+        printf("idleChkItv:\t %d s\n", curr->idleChkItv );
+
+        /// char    *params_val;    // TBD kaj je to?
+        curr->params_val = (char *)malloc(sizeof(mxml_scenarioNode->value.element.attrs->value)*strlen(mxmlElementGetAttr(mxml_scenarioNode, "val")));
+        curr->params_val = mxmlElementGetAttr(mxml_scenarioNode, "val");
+            mxml_scenarioNode = mxml_scenarioNode->next;
+        printf("params_val:\t %s\n", curr->params_val );
+
+        /// int     minval;
+        curr->minval = atoi(mxmlElementGetAttr(mxml_scenarioNode, "minval"));
+        printf("minval:\t %d\n", curr->minval );
+
+        /// int     maxval;
+        curr->maxval = atoi(mxmlElementGetAttr(mxml_scenarioNode, "maxval"));
+        printf("maxval:\t %d\n", curr->maxval );
+
+        /// int     optval;
+        curr->optval = atoi(mxmlElementGetAttr(mxml_scenarioNode, "optval"));
+        printf("optval:\t %d\n", curr->optval );
+
+        /// int     tolval;
+        curr->tolval = atoi(mxmlElementGetAttr(mxml_scenarioNode, "tolerance"));
+            mxml_scenarioNode = mxml_scenarioNode->next;
+        printf("tolval:\t %d\n", curr->tolval );
+
+        /// char    *action;
+        curr->action = (char *)malloc(sizeof(mxml_scenarioNode->value.element.attrs->value)*strlen(mxmlElementGetAttr(mxml_scenarioNode, "act")));
+        curr->action = mxmlElementGetAttr(mxml_scenarioNode, "act");
+            mxml_scenarioNode = mxml_scenarioNode->next;
+        printf("action:\t %s\n", curr->action );
+
+        /// char    *param;
+        curr->param = (char *)malloc(sizeof(mxml_scenarioNode->value.element.attrs->value)*strlen(mxmlElementGetAttr(mxml_scenarioNode, "par")));
+        curr->param = mxmlElementGetAttr(mxml_scenarioNode, "par");
+            mxml_scenarioNode = mxml_scenarioNode->next;
+        printf("param:\t %s\n", curr->param );
+
+        // TODO parse struct cond
+
+        printf("----------------------------------------------\n");
+        // done
+        // moving to the next XML node
+        node=node->next;
+
+        /// struct  scenario_s *nxt;
+        curr->nxt = head;
+        head = curr;
+    }
+
+    hScenario=head; // handle to device list
+    //delete obsolete xml tree
+    mxmlDelete(tree);
+    mxmlDelete(node);
+
+    return 1;
+}
+
+/*
+void updateDeviceList(device_d *deviceList)
+{
+
+}
+/**/
Index: logic/trunk/src/init/scenariotree.xml
===================================================================
--- logic/trunk/src/init/scenariotree.xml	(revision 0)
+++ logic/trunk/src/init/scenariotree.xml	(revision 30)
@@ -0,0 +1,45 @@
+<?xml version="1.0"?>
+<scenariotree>
+  <scenario id="scenario_01" name="Klima na stropu, w/e">
+    <inDevice id="thermometer_01" />
+    <outDevice id="air_cond_01" />
+    <reaction func="linear" />
+    <check_idle val="600" />
+    <check_active val="60" />
+    <params val="--lazy=true" />
+    <inDevAalues minval="20" maxval="28" optval="24" tolerance="0.5"/>
+    <action act="testAction_1"/>
+    <param par="testParam_1"/>
+    <conditions>
+      <and>
+        <greater inDeviceId="barometer_01" val="80" />
+        <lower_or_equal inDeviceId="lightSensor" val="50" />
+        <or>
+          <greater inDeviceId="time" val="15:00" />
+          <smaller inDeviceId="time" val="10:00" />
+        </or>
+      </and>
+    </conditions>
+  </scenario>
+    <scenario id="scenario_02" name="Klima v kleti, w/e">
+    <inDevice id="thermometer_01" />
+    <outDevice id="air_cond_01" />
+    <reaction func="linear" />
+    <check_idle val="600" />
+    <check_active val="60" />
+    <params val="--lazy=true" />
+    <inDevAalues minval="20" maxval="28" optval="24" tolerance="0.5"/>
+    <action act="testAction_1"/>
+    <param par="testParam_1"/>
+    <conditions>
+      <and>
+        <greater inDeviceId="barometer_01" val="80" />
+        <lower_or_equal inDeviceId="lightSensor" val="50" />
+        <or>
+          <greater inDeviceId="time" val="15:00" />
+          <smaller inDeviceId="time" val="10:00" />
+        </or>
+      </and>
+    </conditions>
+  </scenario>
+</scenariotree>
Index: logic/trunk/src/init/scenariolist.h
===================================================================
--- logic/trunk/src/init/scenariolist.h	(revision 0)
+++ logic/trunk/src/init/scenariolist.h	(revision 30)
@@ -0,0 +1,29 @@
+#ifndef SCENARIOLIST_H_INCLUDED
+#define SCENARIOLIST_H_INCLUDED
+
+typedef struct scenario_s
+{
+    char    *scen_id;
+    char    *scen_name;
+    char    *inDevice_id;
+    char    *outDevice_id;
+    char    *func;
+    int     idleChkItv;
+    int     actvChkItv;
+    char    *params_val;    // TBD kaj je to?
+    int     minval;
+    int     maxval;
+    int     optval;
+    int     tolval;
+    char    *action;
+    char    *param;
+    struct  condition_list *cond_l;
+    // struct cond
+    struct  scenario_s *nxt;
+}scenario;
+
+int setNewScenarioList(); // ony called on startup
+// update scenario list
+// get scenario (id)
+// ...
+#endif // SCENARIOLIST_H_INCLUDED
