Index: vtcross/trunk/src/service_management_layer/ServiceManagementLayer.cpp
===================================================================
--- vtcross/trunk/src/service_management_layer/ServiceManagementLayer.cpp	(revision 287)
+++ vtcross/trunk/src/service_management_layer/ServiceManagementLayer.cpp	(revision 288)
@@ -909,4 +909,7 @@
     std::string check;
     char buffer[256];
+    char buffer1[256];
+    int rc;
+    char *errorMsg;
     char* cols[] = {(char *)"Tag", (char *)"Data"};
     //Get the inputs
@@ -914,22 +917,11 @@
     ReadMessage(shellSocketFD, buffer);
     LOG("ServiceManagementLayer:: Received PerformActiveMission command.\n");
-        data_obsv.append(buffer);
-        data_obsv.append("@");
 
     int t = atoi(buffer);
    // printf("****%d****\n", t);
     for(int k = 0; k < t; k++) {
-        memset(buffer, 0, 256);
-        ReadMessage(shellSocketFD, buffer);
-        data_obsv.append(buffer);
-        data_obsv.append("@");
-   
-        memset(buffer, 0, 256);
-        ReadMessage(shellSocketFD, buffer);
-        data_obsv.append(buffer);
-        data_obsv.append("@");
 	//printf("data=%s\n", data_obsv.c_str());
-    }
-
+        memset(buffer1, 0, 256);
+        ReadMessage(shellSocketFD, buffer1);
 	strcpy(_data_DB->command, "insert into ");
     	strcat(_data_DB->command, _data_DB->tablename); 
@@ -939,31 +931,37 @@
 	strcat(_data_DB->command, cols[1]);
 	strcat(_data_DB->command, ") ");
-	strcat(_data_DB->command, " values('observables', '");
-	strcat(_data_DB->command, data_obsv.c_str());
+        memset(buffer, 0, 256);
+        ReadMessage(shellSocketFD, buffer);
+	sprintf(_data_DB->command, "%s values('%s', '1@%s@%s", _data_DB->command, buffer1, buffer1, buffer);
 	strcat(_data_DB->command, "');");
-    	char *errorMsg;
-   	int rc = sqlite3_exec(_data_DB->db, _data_DB->command, callback, 0, &errorMsg);
+   	rc = sqlite3_exec(_data_DB->db, _data_DB->command, callback, 0, &errorMsg);
    	if( rc!=SQLITE_OK && rc!=101 )
    	    fprintf(stderr, "SQL error: %s\n", errorMsg);
+    }
+
+
+    /*printf("\n\n\n");
+    // generate commandi
+    strcpy(_data_DB->command, "select ");
+    strcat(_data_DB->command, _data_DB->tablename);
+    strcat(_data_DB->command, ".* from ");
+    strcat(_data_DB->command, _data_DB->tablename);
+    strcat(_data_DB->command, ";");
+
+    // execute print (select all)  command  
+    rc = sqlite3_exec(_data_DB->db, _data_DB->command, callback, 0, &errorMsg);
+    if( rc!=SQLITE_OK && rc!=101 )
+        fprintf(stderr, "SQL error: %s\n", errorMsg);
+    printf("database %s, table %s:\n", _data_DB->filename, _data_DB->tablename);
+    printf("\n\n\n");*/
 
     /* Receive Set of Parameters */
     memset(buffer, 0, 256);
     ReadMessage(shellSocketFD, buffer);
-        data_param.append(buffer);
-        data_param.append("@");
     t=atoi(buffer);
     for(int k = 0; k < t; k++) {
-        memset(buffer, 0, 256);
-        ReadMessage(shellSocketFD, buffer);
-        data_param.append(buffer);
-        data_param.append("@");
-   
-        memset(buffer, 0, 256);
-        ReadMessage(shellSocketFD, buffer);
-        data_param.append(buffer);
-        data_param.append("@");
-    }
-	//printf("data=%s\n", data_param.c_str());
-
+	//printf("data=%s\n", data_obsv.c_str());
+        memset(buffer1, 0, 256);
+        ReadMessage(shellSocketFD, buffer1);
 	strcpy(_data_DB->command, "insert into ");
     	strcat(_data_DB->command, _data_DB->tablename); 
@@ -973,10 +971,12 @@
 	strcat(_data_DB->command, cols[1]);
 	strcat(_data_DB->command, ") ");
-	strcat(_data_DB->command, " values('paramaters', '");
-	strcat(_data_DB->command, data_param.c_str());
-	strcat(_data_DB->command, "');"); 
+        memset(buffer, 0, 256);
+        ReadMessage(shellSocketFD, buffer);
+	sprintf(_data_DB->command, "%s values('%s', '1@%s@%s", _data_DB->command, buffer1, buffer1, buffer);
+	strcat(_data_DB->command, "');");
    	rc = sqlite3_exec(_data_DB->db, _data_DB->command, callback, 0, &errorMsg);
    	if( rc!=SQLITE_OK && rc!=101 )
    	    fprintf(stderr, "SQL error: %s\n", errorMsg);
+    }
 
 
@@ -1848,143 +1848,2 @@
     return;
 }
-
-
-
-
-    /*TiXmlElement *pMission;
-    TiXmlElement *pService;
-    TiXmlElement *pChild0, *pChild1, *pChild2, *pChild3;
-    TiXmlHandle hRoot(0);
-    //printf("ServiceManagementLayer:: Loading Configuration.\n");
-    TiXmlDocument doc(".");
-    doc.LoadFile(SML_Config);
-    bool loadOkay = doc.LoadFile();
-    if(!loadOkay)
-        printf("Loading SML configuration failed: %s\n", SML_Config);
-
-    TiXmlHandle hDoc(&doc);
-    
-    pMission = hDoc.FirstChildElement().Element();
-
-    if(!pMission) 
-        printf("No valid root!");
-
-    hRoot = TiXmlHandle(pMission);
-    pService = pMission->FirstChildElement();
-    int32_t mission_num = 0;
-    //Iterate through the missions
-    for(pChild0 = pMission->FirstChildElement(); pChild0 ; \
-        pChild0 = pChild0->NextSiblingElement()) 
-    {
-	int32_t service_num = 0;
-	uint16_t cond_array[] = {0, 0};
-	//printf("mission_num = %d\n", mission_num);
-	memset(cond_array, 0, 2);
-	
-    	for(pChild1  = pChild0->FirstChildElement(); pChild1; \
-      	    pChild1  = pChild1->NextSiblingElement()) 
-    	{
-	    int32_t conditional_0 = service_num;
-	    for(pChild2 = pChild1->FirstChildElement(); \
-		pChild2; pChild2 = pChild2->NextSiblingElement())
-	    {
-		service_num++;
-		int32_t conditional_1 = service_num;
-		for(pChild3 = pChild2->FirstChildElement(); \
-		    pChild3; pChild3 = pChild3 ->NextSiblingElement())
-		{
-		    service_num++;
-		    mList[mission_num].services[service_num].name = pChild3->Attribute("name");
-                    if(pChild3->Attribute("input1"))
-			mList[mission_num].services[service_num].input[0] = pChild3->Attribute("input1");
-                    if(pChild3->Attribute("input2"))
-			mList[mission_num].services[service_num].input[1] = pChild3->Attribute("input2");
-                    if(pChild3->Attribute("input3"))
-			mList[mission_num].services[service_num].input[2] = pChild3->Attribute("input3");
-                    if(pChild3->Attribute("output1"))
-			mList[mission_num].services[service_num].output[0] = pChild3->Attribute("output1");
-                    if(pChild3->Attribute("output2"))
-			mList[mission_num].services[service_num].output[1] = pChild3->Attribute("output2");
-                    if(pChild3->Attribute("output3"))
-			mList[mission_num].services[service_num].output[2] = pChild3->Attribute("output3");
-		    cond_array[1]++;
-		}
-
-		if(conditional_1 != service_num){
-		    mList[mission_num].services[conditional_1].name = pChild2->Value();
-                    if(pChild2->Attribute("input_t"))
-			mList[mission_num].services[conditional_1].input[0] = pChild2->Attribute("input_t");
-                    if(pChild2->Attribute("input_f"))
-			mList[mission_num].services[conditional_1].input[1] = pChild2->Attribute("input_f");
-		}
-		else{
-		    mList[mission_num].services[service_num].name = pChild2->Attribute("name");
-                    if(pChild2->Attribute("input1"))
-			mList[mission_num].services[service_num].input[0] = pChild2->Attribute("input1");
-                    if(pChild2->Attribute("input2"))
-			mList[mission_num].services[service_num].input[1] = pChild2->Attribute("input2");
-                    if(pChild2->Attribute("input3"))
-			mList[mission_num].services[service_num].input[2] = pChild2->Attribute("input3");
-                    if(pChild2->Attribute("output1"))
-			mList[mission_num].services[service_num].output[0] = pChild2->Attribute("output1");
-                    if(pChild2->Attribute("output2"))
-			mList[mission_num].services[service_num].output[1] = pChild2->Attribute("output2");
-                    if(pChild2->Attribute("output3"))
-			mList[mission_num].services[service_num].output[2] = pChild2->Attribute("output3");
-		}
-
-		mList[mission_num].services[conditional_1].num_conds = cond_array[1];
-		cond_array[1] = 0;
-		cond_array[0]++;
-	    }
-	    if(conditional_0 != service_num){
-		mList[mission_num].services[conditional_0].name = pChild1->Value();
-                if(pChild1->Attribute("input_t"))
-		    mList[mission_num].services[conditional_0].input[0] = pChild1->Attribute("input_t");
-                if(pChild1->Attribute("input_f"))
-		    mList[mission_num].services[conditional_0].input[1] = pChild1->Attribute("input_f");
-		printf("if detected %s, %s\n", pChild1->Attribute("input_f"), pChild1->Attribute("input_t"));
-	    }
-	    else{
-		mList[mission_num].services[service_num].name = pChild1->Attribute("name");
-                if(pChild1->Attribute("input1"))
-	            mList[mission_num].services[service_num].input[0] = pChild1->Attribute("input1");
-                if(pChild1->Attribute("input2"))
-		    mList[mission_num].services[service_num].input[1] = pChild1->Attribute("input2");
-                if(pChild1->Attribute("input3"))
-		    mList[mission_num].services[service_num].input[2] = pChild1->Attribute("input3");
-                if(pChild1->Attribute("output1"))
-		    mList[mission_num].services[service_num].output[0] = pChild1->Attribute("output1");
-                if(pChild1->Attribute("output2"))
-		    mList[mission_num].services[service_num].output[1] = pChild1->Attribute("output2");
-                if(pChild1->Attribute("output3"))
-		    mList[mission_num].services[service_num].output[2] = pChild1->Attribute("output3");
-	    }
-
-	    mList[mission_num].services[conditional_0].num_conds = cond_array[0];
-	    //printf("hello\n");
-	    
-            cond_array[0] = 0;
-	    service_num++;
-	}
-	for(int i = 0; i < service_num; i++)
-		printf("input1=%s, output1=%s\n", mList[mission_num].services[i].input[0].c_str(), mList[mission_num].services[service_num].output[0].c_str());
-
-	mList[mission_num].numServices = service_num;
-	mList[mission_num].name = pChild0->Attribute("name");
-	mList[mission_num].missionID = atoi(pChild0->Attribute("id"));
-        if(pChild0->Attribute("input1"))
-	    mList[mission_num].input[0] = pChild0->Attribute("input1");
-        if(pChild0->Attribute("input2"))
-	    mList[mission_num].input[1] = pChild0->Attribute("input2");
-        if(pChild0->Attribute("input3"))
-	    mList[mission_num].input[2] = pChild0->Attribute("input3");
-        if(pChild0->Attribute("output1"))
-	    mList[mission_num].output[0] = pChild0->Attribute("output1");
-        if(pChild0->Attribute("output2"))
-	    mList[mission_num].output[1] = pChild0->Attribute("output2");
-        if(pChild0->Attribute("output3"))
-	    mList[mission_num].output[2] = pChild0->Attribute("output3");
-	printf("input1=%s, outpu1=%s\n", mList[mission_num].input[0].c_str(), mList[mission_num].output[0].c_str());
-	mission_num++;
-    }*/
