8 |
#include <vector> |
#include <vector> |
9 |
#include "serialport/SerialPort.h" |
#include "serialport/SerialPort.h" |
10 |
|
|
11 |
#include "GsmModem.h" |
#include "DebugTransceiver.h" |
12 |
|
#include "SmsToolTransceiver.h" |
13 |
|
#include "plugins/HostStatusPlugin.h" |
14 |
#include "Sms.h" |
#include "Sms.h" |
15 |
#include "plugins/TogPlugin.h" |
#include "plugins/TogPlugin.h" |
16 |
#include "plugins/TrainInfo.h" |
#include "plugins/TrainInfo.h" |
17 |
#include "util.h" |
#include "Util.h" |
18 |
#include "plugins/StatusPlugin.h" |
#include "plugins/StatusPlugin.h" |
19 |
|
#include "plugins/WeatherPlugin.h" |
20 |
#include "SmsPdu.h" |
#include "SmsPdu.h" |
21 |
|
|
22 |
using namespace std; |
using namespace std; |
23 |
|
using namespace Util; |
24 |
|
|
25 |
|
void test_sms(ISmsTransceiver& modem, int len) |
|
void test_sms(GsmModem& modem, int len) |
|
26 |
{ |
{ |
27 |
cout << "----- test_sms( " << len << " ) ------- " << endl; |
cout << "----- test_sms( " << len << " ) ------- " << endl; |
28 |
|
|
38 |
cout << "Len: " << pdu[i].len << endl; |
cout << "Len: " << pdu[i].len << endl; |
39 |
cout << "Pdu: " << pdu[i].pdu << endl; |
cout << "Pdu: " << pdu[i].pdu << endl; |
40 |
|
|
41 |
modem.SendSmsPdu(pdu[i].pdu, pdu[i].len); |
// modem.SendSmsPdu(pdu[i].pdu, pdu[i].len); |
42 |
} |
} |
43 |
} |
} |
44 |
|
|
55 |
return 0; |
return 0; |
56 |
*/ |
*/ |
57 |
|
|
58 |
DebugGsmModem modem(true); |
|
59 |
|
DebugTransceiver trans(true); |
60 |
|
WeatherPlugin pl; |
61 |
|
|
62 |
SMS sms; |
SMS sms; |
63 |
sms.sender="1234"; |
|
64 |
sms.message="status"; |
pl.Execute(trans,sms); |
65 |
StatusPlugin status; |
|
66 |
status.Execute(modem,sms); |
|
67 |
|
|
68 |
return 0; |
return 0; |
69 |
|
string start = "hej ������"; |
70 |
|
string mid = str_latin2gsm(start); |
71 |
|
string final = str_gsm2latin(mid); |
72 |
|
|
73 |
|
str_dump (start); |
74 |
|
str_dump(mid); |
75 |
|
str_dump(final); |
76 |
|
|
77 |
|
|
78 |
|
return 0; |
79 |
|
|
80 |
/* |
/* |
81 |
SerialPort port("/dev/ttyS1" ); |
SerialPort port("/dev/ttyS1" ); |
82 |
port.Open( SerialPort::BAUD_9600, |
port.Open( SerialPort::BAUD_9600, |
85 |
SerialPort::STOP_BITS_1, |
SerialPort::STOP_BITS_1, |
86 |
SerialPort::FLOW_CONTROL_HARD ); |
SerialPort::FLOW_CONTROL_HARD ); |
87 |
|
|
88 |
GsmModem modem(port); |
ModemTransceiver modem(port); |
89 |
modem.Init(); |
modem.Init(); |
90 |
|
|
91 |
|
|
128 |
SMS sms; |
SMS sms; |
129 |
sms.sender = "12345678"; |
sms.sender = "12345678"; |
130 |
sms.message = "Tog list"; |
sms.message = "Tog list"; |
131 |
DebugGsmModem modem; |
DebugModemTransceiver modem; |
132 |
TogPlugin plugin; |
TogPlugin plugin; |
133 |
|
|
134 |
plugin.Execute(modem, sms); |
plugin.Execute(modem, sms); |
168 |
|
|
169 |
SerialPort port("/dev/ttyS1" ); |
SerialPort port("/dev/ttyS1" ); |
170 |
port.Open(); |
port.Open(); |
171 |
GsmModem modem(port); |
ModemTransceiver modem(port); |
172 |
|
|
173 |
//modem.SendSms("22337617", "Hello, sir!"); |
//modem.SendSms("22337617", "Hello, sir!"); |
174 |
// |
// |