Library for Decode/Encode SMS PDU






4.74/5 (44 votes)
Library for decoding and encoding mobile short messages to/from SMS protocol data unit
Last Updates
You can find some community fixes mentioned on comments section on Project Home at Google Code[^].Introduction
The smspdulib
library is intended for more transparent interaction with SMS PDU. This thought over hierarchy of classes will allow you to create new classes for other types of short messages using the realized base functionality.
At present, the following types of short messages are supported: status report, SMS (with long (large) SMS parts support).
Hierarchy of Classes

Sample Code
This example shows you how to decode PDU.
SMSType smsType = SMSBase.GetSMSType(pduSource);
switch (smsType) {
case SMSType.SMS:
SMS sms = new SMS();
SMS.Fetch(sms, ref pduSource);
//Use instance of SMS class here
break;
case SMSType.StatusReport:
SMSStatusReport statusReport = new SMSStatusReport();
SMSStatusReport.Fetch(statusReport, ref pduSource);
//Use instance of SMSStatusReport class here
break;
}
This example show you how to encode SMS to PDU.
SMS sms = new SMS();
sms.Direction = SMSDirection.Submited;
sms.PhoneNumber = "+74951234567";
sms.ValidityPeriod = new TimeSpan(4, 0, 0, 0);
sms.Message = "Me message here!";
string pduSource = sms.Compose(SMS.SMSEncoding.UCS2);
Useful Links
Updated
- Updated
Decode7bit
method: Fixed some bugs (see comments) PopDate
method now doesn't recognize time zone because some phones send strange stuff
Please help me find more detailed specification of PDU format and TP-SCTS format.