/[H9]/trunk/FlisServer/FlisServerDlg.cpp
ViewVC logotype

Diff of /trunk/FlisServer/FlisServerDlg.cpp

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 144 by kevin, Tue Dec 4 13:26:00 2007 UTC revision 158 by kevin, Wed Dec 5 11:54:09 2007 UTC
# Line 471  void CFlisServerDlg::OnBnClickedGsmpin() Line 471  void CFlisServerDlg::OnBnClickedGsmpin()
471                                  AppendText(tekst);                                  AppendText(tekst);
472                          }                          }
473                  }                  }
474                    Sleep(10); //Small delay to avoid busy wait
475          }          }
476          Sleep(100); //Give the modem a chance to send the last data          Sleep(100); //Give the modem a chance to send the last data
477          while(Serial.getComstat().cbInQue > 0)          while(Serial.getComstat().cbInQue > 0)
# Line 740  void CFlisServerDlg::SendConfig(CString Line 741  void CFlisServerDlg::SendConfig(CString
741                  CString SQL, Textwindow;                  CString SQL, Textwindow;
742                  SQL.Format("update command set executed=now() where id=%s",IDnr);                  SQL.Format("update command set executed=now() where id=%s",IDnr);
743                  db.ExecuteSQL(SQL);                  db.ExecuteSQL(SQL);
744                    Sleep(10);
745                  AppendText("Command executed");                  AppendText("Command executed");
746          }          }
747          Sleep(150);          Sleep(150);
# Line 923  vector<keepalive> CFlisServerDlg::keepal Line 925  vector<keepalive> CFlisServerDlg::keepal
925          CString SQL, name, value;          CString SQL, name, value;
926          SQL = "select name, value from config;";          SQL = "select name, value from config;";
927          CRecordset rs(&db);          CRecordset rs(&db);
928          rs.Open(AFX_DB_USE_DEFAULT_TYPE, SQL);          try
         if (rs.GetRecordCount()>0)  
929          {          {
930                  rs.MoveFirst();                  rs.Open(AFX_DB_USE_DEFAULT_TYPE, SQL);
931                    if (rs.GetRecordCount()>0)
932                    {
933                            rs.MoveFirst();
934                                                    
935                  rs.GetFieldValue((short)0, name);                          rs.GetFieldValue((short)0, name);
936                  rs.GetFieldValue(1,value);                          rs.GetFieldValue(1,value);
937                                    
938                  Alive.name = name;                          Alive.name = name;
939                  Alive.value = value;                          Alive.value = value;
940                  Alive.tid = CTime::GetCurrentTime();                          Alive.tid = CTime::GetCurrentTime();
941                  if(Alive.name == "phonenr")                          if(Alive.name == "phonenr")
942                  {                          {
943                          Alive.Phonenr = value;                                  Alive.Phonenr = value;
944                  }                          }
945    
946                  buffer.push_back(Alive);                          buffer.push_back(Alive);
947                  rs.MoveNext();                          rs.MoveNext();
948    
949                    }
950                    rs.Close();
951                    return buffer;
952          }          }
953          rs.Close();          catch (char * str)
954          return buffer;          {
955                    AppendText("Keepalive failed, closing and opening the db connection again");
956                    if(db.IsOpen())
957                    {
958                            db.Close();
959                            AppendText("DB connection closed");
960                    }
961                    if(!db.IsOpen())
962                    {
963                            DBConnect();
964                            AppendText("DB connection started again");
965                    }
966            }
967    
968                    
969  }  }

Legend:
Removed from v.144  
changed lines
  Added in v.158

  ViewVC Help
Powered by ViewVC 1.1.20