/[projects]/smsdaemon/tester.cpp
ViewVC logotype

Contents of /smsdaemon/tester.cpp

Parent Directory Parent Directory | Revision Log Revision Log


Revision 54 - (show annotations) (download)
Wed Jun 11 12:57:26 2008 UTC (15 years, 11 months ago) by torben
File size: 2005 byte(s)
Moving Plugin and PluginManager back to the main library because ... because I can !!!


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

  ViewVC Help
Powered by ViewVC 1.1.20