13 |
#include "common.h" |
#include "common.h" |
14 |
#include "util.h" |
#include "util.h" |
15 |
|
|
|
#include <iostream> |
|
16 |
|
|
17 |
using namespace std; |
using namespace std; |
18 |
|
|
|
|
|
19 |
namespace SmsPdu |
namespace SmsPdu |
20 |
{ |
{ |
21 |
|
|
144 |
|
|
145 |
const unsigned char UDHI = multipart ? 0x40 : 0; |
const unsigned char UDHI = multipart ? 0x40 : 0; |
146 |
|
|
|
srand(time(0)); |
|
147 |
unsigned char csms_ref = rand() % 128; |
unsigned char csms_ref = rand() % 128; |
148 |
|
|
149 |
int part_count; |
int part_count; |
310 |
if (UDHI) |
if (UDHI) |
311 |
{ |
{ |
312 |
int udh_len = (*it++); |
int udh_len = (*it++); |
|
cout << "UDH_LEN:" << udh_len << endl; |
|
313 |
it += udh_len; //just ignore the User Data Header |
it += udh_len; //just ignore the User Data Header |
314 |
data_len -= udh_len; |
data_len -= udh_len; |
315 |
|
|
316 |
shift_start = udh_len+1; //make the 8to7bit decode start with the right shift level |
shift_start = udh_len+1; //make the 8to7bit decode start with the right shift level |
317 |
} |
} |
|
cout << hex<< (int)(*it) << endl;; |
|
318 |
|
|
319 |
|
|
320 |
vector<unsigned char> user_data; |
vector<unsigned char> user_data; |
321 |
user_data.insert(user_data.end(), it, it+data_len); |
user_data.insert(user_data.end(), it, it+data_len); |
322 |
|
|
323 |
result.message = Decode8to7bit(user_data, shift_start); |
result.message = Decode8to7bit(user_data, shift_start).substr(0,data_len); |
324 |
|
|
325 |
|
result.message = Util::str_trim(result.message); |
326 |
|
|
327 |
|
|
328 |
return result; |
return result; |