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" |
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 |
|
|
63 |
|
|
64 |
if (data == "") |
if (data == "") |
65 |
{ |
{ |
66 |
modem.SendSms(sms.sender, "Usage: tog <stationskode>\ntog list - liste over stationer"); |
modem.SendSms(sms.sender, "Usage: tog <stationskode>\ntog list - liste over stationer", false); |
67 |
return; |
return; |
68 |
} |
} |
69 |
|
|
70 |
if (data == "list") |
if (data == "list") |
71 |
{ |
{ |
72 |
modem.SendSms(sms.sender, CreateStationList()); |
modem.SendSms(sms.sender, CreateStationList(), true); |
73 |
return; |
return; |
74 |
} |
} |
75 |
|
|
78 |
|
|
79 |
if (code == "") |
if (code == "") |
80 |
{ |
{ |
81 |
modem.SendSms(sms.sender, "Unknown station"); |
modem.SendSms(sms.sender, "Unknown station", false); |
82 |
return; |
return; |
83 |
} |
} |
84 |
|
|
87 |
{ |
{ |
88 |
infos = GetTrainInfo( code , "" ); |
infos = GetTrainInfo( code , "" ); |
89 |
} |
} |
90 |
catch(...) |
catch(std::exception& e) |
91 |
{ |
{ |
92 |
modem.SendSms(sms.sender, "Connection timeout"); |
modem.SendSms(sms.sender, e.what(), false ); |
93 |
return; |
return; |
94 |
} |
} |
95 |
|
|
105 |
os << train.note << "\n"; |
os << train.note << "\n"; |
106 |
} |
} |
107 |
|
|
108 |
modem.SendSms(sms.sender, Util::str_latin2gsm(os.str())); |
modem.SendSms(sms.sender, Util::str_latin2gsm(os.str()), true); |
109 |
|
|
110 |
|
|
111 |
|
|