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

Diff of /smsdaemon/SmsPdu.cpp

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

revision 77 by torben, Fri Jun 13 21:15:00 2008 UTC revision 142 by torben, Sun Dec 7 15:51:02 2008 UTC
# Line 144  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 191  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 277  namespace SmsPdu Line 276  namespace SmsPdu
276    
277          SMS ParseSmsPdu(std::string pdu_str)          SMS ParseSmsPdu(std::string pdu_str)
278          {          {
                 SMS result;  
279    
280                  vector<unsigned char> pdu = HexDecodeString(pdu_str);                  vector<unsigned char> pdu = HexDecodeString(pdu_str);
281    
# Line 295  namespace SmsPdu Line 293  namespace SmsPdu
293    
294                  ++it; //ignore Type-Of-Address                  ++it; //ignore Type-Of-Address
295    
296                  result.sender = DecodeRawPhonenr( it, it+(sender_len/2) );                  string sender = DecodeRawPhonenr( it, it+(sender_len/2) );
297    
298                  it += (sender_len/2);                  it += (sender_len/2);
299                  ++it; //protocol identifier                  ++it; //protocol identifier
300                  ++it; //Data encoding                  ++it; //Data encoding
301    
302                  result.timestamp = DecodeTimestamp(it, it+7);                  string timestamp = DecodeTimestamp(it, it+7);
303                  it += 7;                  it += 7;
304    
305    
# Line 321  namespace SmsPdu Line 319  namespace SmsPdu
319                  vector<unsigned char> user_data;                  vector<unsigned char> user_data;
320                  user_data.insert(user_data.end(), it, it+data_len);                  user_data.insert(user_data.end(), it, it+data_len);
321                                    
322                  result.message = Decode8to7bit(user_data, shift_start).substr(0,data_len);                  string message = Decode8to7bit(user_data, shift_start).substr(0,data_len);
323    
324                    message = Util::str_trim(message);
325                                    
326                    SMS result;
327                    result.SetMessage(message);
328                    result.SetSender(sender);
329    
330                  return result;                  return result;
331          }          }

Legend:
Removed from v.77  
changed lines
  Added in v.142

  ViewVC Help
Powered by ViewVC 1.1.20