1 |
/* using http://sourceforge.net/projects/libserial/ |
/* using http://sourceforge.net/projects/libserial/ |
2 |
|
* |
3 |
*/ |
*/ |
4 |
|
|
5 |
|
|
6 |
#include <string> |
#include <string> |
7 |
#include <iostream> |
#include <iostream> |
8 |
#include <vector> |
#include <vector> |
9 |
/*#include "SerialPort.h" |
#include "SerialPort.h" |
10 |
*/ |
|
11 |
#include "GsmModem.h" |
#include "GsmModem.h" |
12 |
#include "Sms.h" |
#include "Sms.h" |
13 |
#include "TogPlugin.h" |
#include "TogPlugin.h" |
14 |
|
#include "TrainInfo.h" |
15 |
#include "util.h" |
#include "util.h" |
16 |
|
|
17 |
|
#include "SmsPdu.h" |
18 |
|
|
19 |
using namespace std; |
using namespace std; |
20 |
|
|
21 |
|
|
22 |
int main() |
int main() |
23 |
{ |
{ |
24 |
|
SerialPort port("/dev/ttyS1" ); |
25 |
|
port.Open( SerialPort::BAUD_9600, |
26 |
|
SerialPort::CHAR_SIZE_8, |
27 |
|
SerialPort::PARITY_NONE, |
28 |
|
SerialPort::STOP_BITS_1, |
29 |
|
SerialPort::FLOW_CONTROL_HARD ); |
30 |
|
|
31 |
|
GsmModem modem(port); |
32 |
|
modem.Init(); |
33 |
|
|
34 |
|
int len; |
35 |
|
std::string pdu = SmsPdu::CreateSmsPdu("4522337617", "Hej med dig", len); |
36 |
|
|
37 |
|
cout << "Len: " << len << endl; |
38 |
|
cout << "Pdu: " << pdu << endl; |
39 |
|
cout << "Pdu2:" << "0011000A9154223367710000AA0BC8B21AD42E9341E4F419" << endl; |
40 |
|
|
41 |
|
|
42 |
|
modem.SendSmsPdu(pdu,len); |
43 |
|
|
44 |
|
|
45 |
|
/* |
46 |
SMS sms; |
SMS sms; |
47 |
sms.sender = "12345678"; |
sms.sender = "12345678"; |
48 |
sms.message = "Tog bj"; |
sms.message = "Tog list"; |
49 |
DebugGsmModem modem; |
DebugGsmModem modem; |
50 |
TogPlugin plugin; |
TogPlugin plugin; |
51 |
|
|
56 |
|
|
57 |
cout << "---- " << msg.length() << " ----" << endl; |
cout << "---- " << msg.length() << " ----" << endl; |
58 |
cout << msg << endl; |
cout << msg << endl; |
59 |
|
*/ |
60 |
/* |
/* |
61 |
vector<TrainInfo> trains = GetTrainInfo("BJ","Bjerringbro"); |
vector<TrainInfo> trains = GetTrainInfo("BJ","Bjerringbro"); |
62 |
|
|