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

Annotation of /smsdaemon/tester.cpp

Parent Directory Parent Directory | Revision Log Revision Log


Revision 54 - (hide 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 torben 26 /* using http://sourceforge.net/projects/libserial/
2     */
3    
4    
5     #include <string>
6     #include <iostream>
7 torben 38 #include <vector>
8     /*#include "SerialPort.h"
9 torben 49 */
10 torben 26 #include "GsmModem.h"
11 torben 49 #include "Sms.h"
12     #include "TogPlugin.h"
13 torben 54 #include "TrainInfo.h"
14 torben 49 #include "util.h"
15 torben 26
16 torben 49
17 torben 26 using namespace std;
18    
19    
20     int main()
21     {
22 torben 54
23 torben 49 SMS sms;
24     sms.sender = "12345678";
25 torben 54 sms.message = "Tog list";
26 torben 49 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 torben 38 vector<TrainInfo> trains = GetTrainInfo("BJ","Bjerringbro");
39 torben 26
40 torben 38 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 torben 49 */
54 torben 38 /*
55 torben 26 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 torben 38 */
89 torben 26 return 0;
90     }

  ViewVC Help
Powered by ViewVC 1.1.20