2 |
#include <string> |
#include <string> |
3 |
#include <vector> |
#include <vector> |
4 |
|
|
|
#include <iostream> |
|
5 |
#include "Sms.h" |
#include "Sms.h" |
6 |
#include "util.h" |
#include "util.h" |
7 |
|
#include "SmsPdu.h" |
8 |
|
|
9 |
|
|
10 |
|
|
11 |
std::string GetSmsCommand(SMS& sms) |
std::string GetSmsCommand(SMS& sms) |
82 |
return newsms; |
return newsms; |
83 |
} |
} |
84 |
|
|
85 |
|
SMS SMS::FromPduString(const std::string& input) |
86 |
|
{ |
87 |
|
std::string smsline = input.substr(7, input.length() -7); //strip "+CMGL: " |
88 |
|
|
89 |
|
std::vector<std::string> lines = Util::str_split(smsline, "\r\n"); |
90 |
|
std::vector<std::string> fields = Util::str_split(lines[0],","); |
91 |
|
|
92 |
|
SMS newsms = SmsPdu::ParseSmsPdu(lines[1]); |
93 |
|
|
94 |
|
newsms.sms_index = fields[0]; |
95 |
|
|
96 |
|
return newsms; |
97 |
|
} |
98 |
|
|
99 |
|
|