Changeset 308

Show
Ignore:
Timestamp:
07/07/09 16:35:40 (15 years ago)
Author:
wrodgers
Message:

slight modification to SML

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • vtcross/trunk/src/service_management_layer/ServiceManagementLayer.cpp

    r295 r308  
    178178    char* cols[] = {(char *)"ID_Num", (char *)"Service_Name"}; 
    179179 
    180     // create table 
    181180 
    182181    // copy tablename 
    183182    strcpy(_services_DB->tablename, "Services"); 
     183 
     184    //If program execution ends in anything other than a ordered shutdown, DB's will still be there for next run 
     185    //Need to get rid of it so that old data isn't inadvertantly used in the next execution cycle 
    184186    sprintf(_services_DB->command, "DROP TABLE IF EXISTS Services;");      
    185187 
     
    482484        FD_SET(shellSocketFD, &sockSet); 
    483485        selTimeout.tv_sec = 0; 
    484         selTimeout.tv_usec = 50000; 
     486        selTimeout.tv_usec = 5000; 
    485487        //Check if there is a message on the shell ready to be processed 
    486488        rc=select(shellSocketFD + 1, &sockSet, NULL, NULL, &selTimeout); 
     
    521523        FD_SET(shellSocketFD, &sockSet); 
    522524        selTimeout.tv_sec = 0; 
    523         selTimeout.tv_usec = 50000; 
     525        selTimeout.tv_usec = 5000; 
    524526        //Check if there is a message on the shell ready to be processed 
    525527        rc=select(shellSocketFD + 1, &sockSet, NULL, NULL, &selTimeout); 
     
    672674                    data.append((const char*) sqlite3_column_text(pStatement, 1));  
    673675                else { 
    674                     //TODO could do shell output here if not in DB 
    675676                data.append("1@output1@"); 
    676677                data.append(miss[activeMission].services[sourceID].output[0]); 
     
    832833ServiceManagementLayer::PerformActiveMission() 
    833834{ 
    834     printf("start PAM\n"); 
     835    //printf("start PAM\n"); 
    835836    uint16_t i = 0; 
    836837    std::string data_param, data_obsv, data; 
     
    897898 
    898899    //Receive any other defined inputs 
    899     while(i < 10 && !miss[activeMission].input[i].empty()){ 
     900    /*while(i < 10 && !miss[activeMission].input[i].empty()){ 
    900901            //New data being added to DB 
    901902        //printf("inserting data from shell\n"); 
     
    932933        i++; 
    933934        data.clear(); 
    934     } 
     935    }*/ 
    935936 
    936937 
     
    998999            } 
    9991000            //printf("L0:--- %s  %s---\n", miss[activeMission].services[i].output[t].c_str(), token); 
    1000             //TODO change to strstr 
    1001  
    10021001            bool doit = false; 
    10031002            if(miss[activeMission].services[i].output[t].find(">") != string::npos){ 
     
    13481347                    } 
    13491348                    data.clear(); 
    1350                     //printf("L0:while detected %d, %d\n", k, miss[activeMission].services[i].num_conds); 
    13511349                    input.clear(); 
    13521350                    check.clear(); 
     
    13751373                            } 
    13761374                            sqlite3_finalize(pStatement); 
    1377                             //printf("data=%s\n", data.c_str()); 
    13781375                            token = strtok((char *)data.c_str(), "@"); 
    13791376                            token = strtok(NULL, "@"); 
    13801377                            token = strtok(NULL, "@"); 
    1381                             //printf("data=%s\n", token); 
    13821378                            break; 
    13831379                        } 
     
    13991395            TransactData(i);} 
    14001396        i++; 
    1401         //printf("i=%d\n", i); 
    14021397    } 
    14031398    i=0; 
     
    14421437        data.clear(); 
    14431438    } 
     1439 
     1440 
     1441    LOG("ServiceManagementLayer:: Done performing active mission.\n"); 
    14441442    /*LOG("ServiceManagementLayer:: Done sending output data to shell from PerformActiveMission.\n"); 
    14451443    strcpy(_data_DB->command, "select ");