1 |
/* using http://sourceforge.net/projects/libserial/ |
2 |
*/ |
3 |
|
4 |
|
5 |
#include <string> |
6 |
#include <iostream> |
7 |
#include <vector> |
8 |
/*#include "SerialPort.h" |
9 |
#include "GsmModem.h" |
10 |
#include "Sms.h"*/ |
11 |
#include "plugins/TrainInfo.h" |
12 |
|
13 |
using namespace std; |
14 |
|
15 |
|
16 |
int main() |
17 |
{ |
18 |
vector<TrainInfo> trains = GetTrainInfo("BJ","Bjerringbro"); |
19 |
|
20 |
for (unsigned i=0; i<trains.size(); ++i) |
21 |
{ |
22 |
TrainInfo& train = trains[i]; |
23 |
cout << "-------------------------------------" << endl; |
24 |
cout << "Time: {" << train.time << "}" << endl; |
25 |
cout << "Update: {" << train.update << "}" << endl; |
26 |
cout << "Type: {" << train.type << "}" << endl; |
27 |
cout << "Destination:{" << train.destination << "}" << endl; |
28 |
cout << "Origin: {" << train.origin << "}" << endl; |
29 |
cout << "Current: {" << train.current << "}" << endl; |
30 |
cout << "Status: {" << train.status << "}" << endl; |
31 |
cout << "Note: {" << train.note << "}" << endl; |
32 |
} |
33 |
|
34 |
/* |
35 |
SMS sms; |
36 |
|
37 |
sms.message = "Test test2 teste3 test4"; |
38 |
|
39 |
cout << "|" << GetSmsCommand(sms) << "|" << GetSmsData(sms) << "|" << endl; |
40 |
|
41 |
return 0; |
42 |
|
43 |
|
44 |
SerialPort port("/dev/ttyS1" ); |
45 |
port.Open(); |
46 |
GsmModem modem(port); |
47 |
|
48 |
//modem.SendSms("22337617", "Hello, sir!"); |
49 |
// |
50 |
vector<SMS> res = modem.ReadSms(); |
51 |
|
52 |
|
53 |
for (unsigned i=0; i<res.size(); ++i) |
54 |
{ |
55 |
cout << "--- SMS Recieved ---" << endl; |
56 |
cout << "Index: " << res[i].sms_index << endl; |
57 |
cout << "From: " << res[i].sender << endl; |
58 |
cout << "Time: " << res[i].timestamp << endl; |
59 |
cout << "Message:>" << res[i].message << "<" << endl; |
60 |
cout << endl; |
61 |
modem.DeleteSms(res[i].sms_index); |
62 |
} |
63 |
|
64 |
for (int j=0; j<5; j++) |
65 |
{ |
66 |
modem.SendSms("22337617","Test"); |
67 |
} |
68 |
*/ |
69 |
return 0; |
70 |
} |