/[projects]/smsdaemon/SmsPdu.cpp
ViewVC logotype

Diff of /smsdaemon/SmsPdu.cpp

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 73 by torben, Fri Jun 13 09:09:36 2008 UTC revision 136 by torben, Sun Dec 7 10:15:44 2008 UTC
# Line 13  Line 13 
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    
# Line 146  namespace SmsPdu Line 144  namespace SmsPdu
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;
# Line 193  namespace SmsPdu Line 190  namespace SmsPdu
190                          if (multipart)                          if (multipart)
191                          {                          {
192                                  message_part = message.substr(0, PDU_LEN);                                  message_part = message.substr(0, PDU_LEN);
193                                  message.erase(0, PDU_LEN);                                  message.erase(0, PDU_LEN-1);
194    
195                                  pdu.push_back( message_part.length()+ 7 );  //UserDataLength                                  pdu.push_back( message_part.length()+ 7 );  //UserDataLength
196                                  pdu.push_back( 0x06 ); // UDH Len                                  pdu.push_back( 0x06 ); // UDH Len
# Line 313  namespace SmsPdu Line 310  namespace SmsPdu
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;

Legend:
Removed from v.73  
changed lines
  Added in v.136

  ViewVC Help
Powered by ViewVC 1.1.20