6 |
#include <string> |
#include <string> |
7 |
#include <iostream> |
#include <iostream> |
8 |
#include <vector> |
#include <vector> |
9 |
#include "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 "TogPlugin.h" |
#include "plugins/TogPlugin.h" |
16 |
#include "TrainInfo.h" |
#include "plugins/TrainInfo.h" |
17 |
#include "util.h" |
#include "Util.h" |
18 |
|
#include "plugins/StatusPlugin.h" |
19 |
#include "SmsPdu.h" |
#include "SmsPdu.h" |
20 |
|
|
21 |
using namespace std; |
using namespace std; |
22 |
|
using namespace Util; |
23 |
|
|
24 |
|
void test_sms(ISmsTransceiver& modem, int len) |
|
void test_sms(GsmModem& modem, int len) |
|
25 |
{ |
{ |
26 |
cout << "----- test_sms( " << len << " ) ------- " << endl; |
cout << "----- test_sms( " << len << " ) ------- " << endl; |
27 |
|
|
37 |
cout << "Len: " << pdu[i].len << endl; |
cout << "Len: " << pdu[i].len << endl; |
38 |
cout << "Pdu: " << pdu[i].pdu << endl; |
cout << "Pdu: " << pdu[i].pdu << endl; |
39 |
|
|
40 |
modem.SendSmsPdu(pdu[i].pdu, pdu[i].len); |
// modem.SendSmsPdu(pdu[i].pdu, pdu[i].len); |
41 |
} |
} |
42 |
} |
} |
43 |
|
|
54 |
return 0; |
return 0; |
55 |
*/ |
*/ |
56 |
|
|
57 |
|
|
58 |
|
DebugTransceiver trans(true); |
59 |
|
HostStatusPlugin pl; |
60 |
|
|
61 |
|
SMS sms; |
62 |
|
|
63 |
|
pl.Execute(trans,sms); |
64 |
|
|
65 |
|
|
66 |
|
|
67 |
|
return 0; |
68 |
|
string start = "hej ������"; |
69 |
|
string mid = str_latin2gsm(start); |
70 |
|
string final = str_gsm2latin(mid); |
71 |
|
|
72 |
|
str_dump (start); |
73 |
|
str_dump(mid); |
74 |
|
str_dump(final); |
75 |
|
|
76 |
|
|
77 |
|
return 0; |
78 |
|
|
79 |
|
/* |
80 |
SerialPort port("/dev/ttyS1" ); |
SerialPort port("/dev/ttyS1" ); |
81 |
port.Open( SerialPort::BAUD_9600, |
port.Open( SerialPort::BAUD_9600, |
82 |
SerialPort::CHAR_SIZE_8, |
SerialPort::CHAR_SIZE_8, |
84 |
SerialPort::STOP_BITS_1, |
SerialPort::STOP_BITS_1, |
85 |
SerialPort::FLOW_CONTROL_HARD ); |
SerialPort::FLOW_CONTROL_HARD ); |
86 |
|
|
87 |
GsmModem modem(port); |
ModemTransceiver modem(port); |
88 |
modem.Init(); |
modem.Init(); |
89 |
|
|
90 |
|
|
112 |
|
|
113 |
} |
} |
114 |
|
|
115 |
|
*/ |
116 |
/* |
/* |
117 |
vector<PduInfo> pdu = SmsPdu::CreateSmsPdu("4522337617", "Hej med dig, igen", true); |
vector<PduInfo> pdu = SmsPdu::CreateSmsPdu("4522337617", "Hej med dig, igen", true); |
118 |
cout << "Len: " << pdu[0].len << endl; |
cout << "Len: " << pdu[0].len << endl; |
127 |
SMS sms; |
SMS sms; |
128 |
sms.sender = "12345678"; |
sms.sender = "12345678"; |
129 |
sms.message = "Tog list"; |
sms.message = "Tog list"; |
130 |
DebugGsmModem modem; |
DebugModemTransceiver modem; |
131 |
TogPlugin plugin; |
TogPlugin plugin; |
132 |
|
|
133 |
plugin.Execute(modem, sms); |
plugin.Execute(modem, sms); |
167 |
|
|
168 |
SerialPort port("/dev/ttyS1" ); |
SerialPort port("/dev/ttyS1" ); |
169 |
port.Open(); |
port.Open(); |
170 |
GsmModem modem(port); |
ModemTransceiver modem(port); |
171 |
|
|
172 |
//modem.SendSms("22337617", "Hello, sir!"); |
//modem.SendSms("22337617", "Hello, sir!"); |
173 |
// |
// |