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

Diff of /smsdaemon/SmsPdu.cpp

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

revision 62 by torben, Thu Jun 12 12:04:32 2008 UTC revision 66 by torben, Thu Jun 12 15:16:12 2008 UTC
# Line 10  Line 10 
10  #include <time.h>  #include <time.h>
11  #include <stdlib.h>  #include <stdlib.h>
12    
13    #include "common.h"
14  #include "util.h"  #include "util.h"
15    
16    
# Line 116  vector<PduInfo> CreateSmsPdu(string to, Line 116  vector<PduInfo> CreateSmsPdu(string to,
116    
117          if (multipart)          if (multipart)
118          {          {
119                    if (message.length() > 800)
120                    {
121                            Common::instance()->logMessage("Trying to send multipart sms > 800 bytes !!!");
122                            message = message.substr(0,800);
123                    }
124    
125                  part_count = message.length() / PDU_LEN;                  part_count = message.length() / PDU_LEN;
126                  if (message.length() % PDU_LEN)                  if (message.length() % PDU_LEN)
127                          part_count++;                          part_count++;
# Line 134  vector<PduInfo> CreateSmsPdu(string to, Line 140  vector<PduInfo> CreateSmsPdu(string to,
140                  pdu.push_back( 0x01|UDHI ); // first octet -- no timeout                  pdu.push_back( 0x01|UDHI ); // first octet -- no timeout
141                  pdu.push_back(0x00); // TP-MR message reference                  pdu.push_back(0x00); // TP-MR message reference
142                  pdu.push_back(to.length() ); //length of phone nr                  pdu.push_back(to.length() ); //length of phone nr
143                  pdu.push_back(0x91); // type of address (international nr  + ISDN/telephone range) - else try 0x81                  pdu.push_back(0x81); // type of address (international nr  + ISDN/telephone range) - else try 0x81
144    
145                  vector<unsigned char> phone = BcdEncode(to);                  vector<unsigned char> phone = BcdEncode(to);
146                  pdu.insert( pdu.end(), phone.begin(), phone.end());                  pdu.insert( pdu.end(), phone.begin(), phone.end());
# Line 160  vector<PduInfo> CreateSmsPdu(string to, Line 166  vector<PduInfo> CreateSmsPdu(string to,
166                  }                  }
167                  else                  else
168                  {                  {
169                          message_part = message.substr(0,160); //truncate to 160                          if (message.length() > 160)
170                            {
171                                    message_part = message.substr(0,160); //truncate to 160
172                                    Common::instance()->logMessage("Truncated message");
173                            }
174                            else
175                            {
176                                    message_part = message;
177                            }
178    
179                          pdu.push_back( message_part.length() ); //UserDataLength                          pdu.push_back( message_part.length() ); //UserDataLength
180                  }                  }

Legend:
Removed from v.62  
changed lines
  Added in v.66

  ViewVC Help
Powered by ViewVC 1.1.20