--- smsdaemon/SmsPdu.cpp 2008/06/13 06:38:43 69 +++ smsdaemon/SmsPdu.cpp 2008/06/13 07:56:57 70 @@ -78,11 +78,11 @@ return vec; } - std::string Decode8to7bit(vector input) + std::string Decode8to7bit(vector input, int shift_start = 0) { string result; - int shift = 0; + int shift = shift_start; for (unsigned int i=0; i 0; + unsigned char sender_len = (*it++); if ( (sender_len % 2) == 1) sender_len++; @@ -299,12 +302,26 @@ result.timestamp = DecodeTimestamp(it, it+7); it += 7; + unsigned char data_len = (*it++); + int shift_start = 0; + if (UDHI) + { + int udh_len = (*it++); + cout << "UDH_LEN:" << udh_len << endl; + it += udh_len; //just ignore the User Data Header + data_len -= udh_len; + + shift_start = udh_len+1; //make the 8to7bit decode start with the right shift level + } + cout << hex<< (int)(*it) << endl;; + + vector user_data; user_data.insert(user_data.end(), it, it+data_len); - result.message = Decode8to7bit(user_data); + result.message = Decode8to7bit(user_data, shift_start); return result;