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

Annotation of /smsdaemon/tester.cpp

Parent Directory Parent Directory | Revision Log Revision Log


Revision 38 - (hide annotations) (download)
Tue Jun 10 20:25:15 2008 UTC (15 years, 11 months ago) by torben
File size: 1696 byte(s)
Added some extra string functions to Util::

Made Util::str_clean into Util::str_replace

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 26 #include "GsmModem.h"
10 torben 38 #include "Sms.h"*/
11     #include "plugins/TrainInfo.h"
12 torben 26
13     using namespace std;
14    
15    
16     int main()
17     {
18 torben 38 vector<TrainInfo> trains = GetTrainInfo("BJ","Bjerringbro");
19 torben 26
20 torben 38 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 torben 26 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 torben 38 */
69 torben 26 return 0;
70     }

  ViewVC Help
Powered by ViewVC 1.1.20