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

Annotation of /smsdaemon/tester.cpp

Parent Directory Parent Directory | Revision Log Revision Log


Revision 26 - (hide annotations) (download)
Mon Jun 9 18:15:53 2008 UTC (15 years, 11 months ago) by torben
File size: 932 byte(s)
Added first basic edition of smsdaemon.

So far sending & receiving sms works and a basic sample plugin is implemented.

1 torben 26 /* using http://sourceforge.net/projects/libserial/
2     */
3    
4    
5     #include <string>
6     #include <iostream>
7     #include "SerialPort.h"
8     #include "GsmModem.h"
9     #include "Sms.h"
10    
11     using namespace std;
12    
13    
14     int main()
15     {
16    
17     SMS sms;
18    
19     sms.message = "Test test2 teste3 test4";
20    
21     cout << "|" << GetSmsCommand(sms) << "|" << GetSmsData(sms) << "|" << endl;
22    
23     return 0;
24    
25    
26     SerialPort port("/dev/ttyS1" );
27     port.Open();
28     GsmModem modem(port);
29    
30     //modem.SendSms("22337617", "Hello, sir!");
31     //
32     vector<SMS> res = modem.ReadSms();
33    
34    
35     for (unsigned i=0; i<res.size(); ++i)
36     {
37     cout << "--- SMS Recieved ---" << endl;
38     cout << "Index: " << res[i].sms_index << endl;
39     cout << "From: " << res[i].sender << endl;
40     cout << "Time: " << res[i].timestamp << endl;
41     cout << "Message:>" << res[i].message << "<" << endl;
42     cout << endl;
43     modem.DeleteSms(res[i].sms_index);
44     }
45    
46     for (int j=0; j<5; j++)
47     {
48     modem.SendSms("22337617","Test");
49     }
50    
51     return 0;
52     }

  ViewVC Help
Powered by ViewVC 1.1.20