/[projects]/smsdaemon/plugins/TogPlugin.cpp
ViewVC logotype

Diff of /smsdaemon/plugins/TogPlugin.cpp

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

revision 63 by torben, Thu Jun 12 12:43:29 2008 UTC revision 114 by torben, Sun Nov 2 20:14:20 2008 UTC
# Line 1  Line 1 
1  #include "TogPlugin.h"  #include "TogPlugin.h"
2  #include "GsmModem.h"  #include "IGsmModem.h"
3    #include "Sms.h"
4    
5  #include "TrainInfo.h"  #include "TrainInfo.h"
6  #include "util.h"  #include "util.h"
# Line 7  Line 8 
8  #include <iostream>  #include <iostream>
9  #include <sstream>  #include <sstream>
10    
11    #include "common.h"
12    
13  using namespace std;  using namespace std;
14    
15    
16  TogPlugin::TogPlugin()  TogPlugin::TogPlugin()
17    : Plugin("tog", "Henter tog info fra bane.dk")    : Plugin("tog", "Henter tog info fra bane.dk")
18  {  {
19            _stationInfo["ar"] = StationInfo("AR","Århus");
20          _stationInfo["la"] = StationInfo("LG","Langå");          _stationInfo["la"] = StationInfo("LG","Langå");
21          _stationInfo["ul"] = StationInfo("UP","Ulstrup");          _stationInfo["ul"] = StationInfo("UP","Ulstrup");
22          _stationInfo["bj"] = StationInfo("BJ","Bjerringbro");          _stationInfo["bj"] = StationInfo("BJ","Bjerringbro");
23          _stationInfo["vi"] = StationInfo("VG","Viborg");          _stationInfo["vi"] = StationInfo("VG","Viborg");
24          _stationInfo["hø"] = StationInfo("HØ","Højslev");          _stationInfo["ho"] = StationInfo("HØ","Højslev");
25          _stationInfo["sk"] = StationInfo("SK","Skive");          _stationInfo["sk"] = StationInfo("SK","Skive");
26  }  }
27    
# Line 57  void TogPlugin::Execute(IGsmModem& modem Line 61  void TogPlugin::Execute(IGsmModem& modem
61          data = Util::str_gsm2latin(data);;          data = Util::str_gsm2latin(data);;
62          data = Util::str_tolower(data);          data = Util::str_tolower(data);
63    
64            
65          if (data == "")          if (data == "")
66          {          {
67                  modem.SendSms(sms.sender, "Usage: tog <stationskode>\ntog list - liste over stationer", false);                  modem.SendSms(sms.sender, "Usage: tog <stationskode>\ntog list - liste over stationer", false);
# Line 84  void TogPlugin::Execute(IGsmModem& modem Line 88  void TogPlugin::Execute(IGsmModem& modem
88          {          {
89                  infos = GetTrainInfo( code , "" );                  infos = GetTrainInfo( code , "" );
90          }          }
91          catch(...)          catch(std::exception& e)
92          {          {
93                  modem.SendSms(sms.sender, "Connection timeout", false );                  modem.SendSms(sms.sender, e.what(), false );
94                  return;                  return;
95          }          }
96    

Legend:
Removed from v.63  
changed lines
  Added in v.114

  ViewVC Help
Powered by ViewVC 1.1.20