Click here to Skip to main content
Click here to Skip to main content
Go to top

Library for Decode/Encode SMS PDU

, 18 Oct 2012
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[^].

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

Classes hierarchy

Enums

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.

License

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

Share

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 0:14 
QuestionPlease Help PinmemberMember 859094222-Mar-13 18:03 
QuestionThanks Pinmemberekoos711-Jan-13 10:48 
QuestionI do not download,can you send it to my email,Thanks a lot! Pinmemberyf200919-Oct-12 16:10 
GeneralMy vote of 5 PinmemberAnand Murali M S18-Oct-12 1:01 
QuestionIt Works! Pinmembercarloboi12-Oct-12 1:46 
QuestionHow to Encode 7bit. PinmemberKhương Nguyễn11-Jun-12 22:22 
QuestionWhere is the compose for 7bit and 8bit Pinmemberrixan13-Jul-11 1:18 
AnswerRe: Where is the compose for 7bit and 8bit Pinmemberummarbhutta5-Jan-12 18:44 
GeneralRe: Where is the compose for 7bit and 8bit Pinmemberrixan8-Jan-12 20:34 
GeneralRe: Where is the compose for 7bit and 8bit PinmemberBlueFire233-Oct-12 17:17 
GeneralRe: Where is the compose for 7bit and 8bit PinmemberUlen15151517-Oct-12 22:47 
Generalspecial char ? ^ {} [] dosnt work Pinmembertenmateusz9-Feb-11 3:51 
GeneralMy vote of 5 Pinmemberfarhood22-Jan-11 20:29 
GeneralMy vote of 4 Pinmemberastri30-Oct-10 23:14 
GeneralCellId.ru have freelibrary for working with SMS and GSM Modem PinmemberSerja Ru9-Jul-10 4:49 
GeneralMy vote of 3 PinmemberSerja Ru9-Jul-10 4:46 
GeneralRecieve Long sms not correctly Pinmemberamna_94726-May-10 17:42 
GeneralRecive sms problem Pinmemberanil_singh201013-May-10 18:17 
Generalsend and recieve sms using pdulib Pinmemberpaks_mundiasd11-May-10 17:20 
Generaluse pdulib Pinmemberzadsdfas23-Mar-10 0:29 
QuestionService Center number missed? Pingroupflexchan25-Jan-10 6:27 
GeneralWanted specification Pinmemberk06a18-Jan-10 5:22 
GeneralRe: Wanted specification PinmemberEduard Gomolyako21-Jan-10 16:54 
GeneralRe: Wanted specification [modified] Pinmemberk06a22-Jan-10 8: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 | Mobile
Web03 | 2.8.140916.1 | Last Updated 18 Oct 2012
Article Copyright 2006 by Eduard Gomolyako
Everything else Copyright © CodeProject, 1999-2014
Terms of Service
Layout: fixed | fluid