Click here to Skip to main content
Click here to Skip to main content

Library for Decode/Encode SMS PDU

, 18 Oct 2012 CPOL
Rate this:
Please Sign up or sign in to vote.
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[^].


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

Classes hierarchy


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
    case SMSType.StatusReport:
        SMSStatusReport statusReport = new SMSStatusReport();
        SMSStatusReport.Fetch(statusReport, ref pduSource);
        //Use instance of SMSStatusReport class here

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 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.


This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


About the Author

Eduard Gomolyako
Chief Technology Officer
Russian Federation Russian Federation
No Biography provided
Follow on   Twitter

Comments and Discussions

QuestionPDU Decoder PinmemberMember 160860718-Sep-14 1:14 
QuestionPlease Help PinmemberMember 859094222-Mar-13 19:03 
QuestionThanks Pinmemberekoos711-Jan-13 11:48 
QuestionI do not download,can you send it to my email,Thanks a lot! Pinmemberyf200919-Oct-12 17:10 
GeneralMy vote of 5 PinmemberAnand Murali M S18-Oct-12 2:01 
QuestionIt Works! Pinmembercarloboi12-Oct-12 2:46 
QuestionHow to Encode 7bit. PinmemberKhương Nguyễn11-Jun-12 23:22 
QuestionWhere is the compose for 7bit and 8bit Pinmemberrixan13-Jul-11 2:18 
AnswerRe: Where is the compose for 7bit and 8bit Pinmemberummarbhutta5-Jan-12 19:44 
GeneralRe: Where is the compose for 7bit and 8bit Pinmemberrixan8-Jan-12 21:34 
GeneralRe: Where is the compose for 7bit and 8bit PinmemberBlueFire233-Oct-12 18:17 
GeneralRe: Where is the compose for 7bit and 8bit PinmemberUlen15151517-Oct-12 23:47 
Generalspecial char ? ^ {} [] dosnt work Pinmembertenmateusz9-Feb-11 4:51 
GeneralMy vote of 5 Pinmemberfarhood22-Jan-11 21:29 
GeneralMy vote of 4 Pinmemberastri31-Oct-10 0:14 have freelibrary for working with SMS and GSM Modem PinmemberSerja Ru9-Jul-10 5:49 
GeneralMy vote of 3 PinmemberSerja Ru9-Jul-10 5:46 
GeneralRecieve Long sms not correctly Pinmemberamna_94726-May-10 18:42 
GeneralRecive sms problem Pinmemberanil_singh201013-May-10 19:17 
Generalsend and recieve sms using pdulib Pinmemberpaks_mundiasd11-May-10 18:20 
Generaluse pdulib Pinmemberzadsdfas23-Mar-10 1:29 
QuestionService Center number missed? Pingroupflexchan25-Jan-10 7:27 
GeneralWanted specification Pinmemberk06a18-Jan-10 6:22 
GeneralRe: Wanted specification PinmemberEduard Gomolyako21-Jan-10 17:54 
GeneralRe: Wanted specification [modified] Pinmemberk06a22-Jan-10 9:14 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.

| Advertise | Privacy | Terms of Use | Mobile
Web04 | 2.8.150129.1 | Last Updated 18 Oct 2012
Article Copyright 2006 by Eduard Gomolyako
Everything else Copyright © CodeProject, 1999-2015
Layout: fixed | fluid