Click here to Skip to main content
Licence CPOL
First Posted 11 Oct 2006
Views 270,166
Downloads 3,874
Bookmarked 93 times

Library for Decode/Encode SMS PDU

By | 10 Apr 2008 | Article
Library for decoding and encoding mobile short messages to/from SMS protocol data unit

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)

About the Author

Eduard Gomolyako

Architect

Russian Federation Russian Federation

Member



Sign Up to vote   Poor Excellent
Add a reason or comment to your vote: x
Votes of 3 or less require a comment

Comments and Discussions

 
You must Sign In to use this message board. (secure sign-in)
 
Search this forum  
 FAQ
    Noise  Layout  Per page   
  Refresh
QuestionWhere is the compose for 7bit and 8bit Pinmemberrixan1:18 13 Jul '11  
AnswerRe: Where is the compose for 7bit and 8bit Pinmemberummarbhutta18:44 5 Jan '12  
GeneralRe: Where is the compose for 7bit and 8bit Pinmemberrixan20:34 8 Jan '12  
Generalspecial char ? ^ {} [] dosnt work Pinmembertenmateusz3:51 9 Feb '11  
GeneralMy vote of 5 Pinmemberfarhood20:29 22 Jan '11  
GeneralMy vote of 4 Pinmemberastri23:14 30 Oct '10  
GeneralCellId.ru have freelibrary for working with SMS and GSM Modem PinmemberSerja Ru4:49 9 Jul '10  
GeneralMy vote of 3 PinmemberSerja Ru4:46 9 Jul '10  
GeneralRecieve Long sms not correctly Pinmemberamna_94717:42 26 May '10  
GeneralRecive sms problem Pinmemberanil_singh201018:17 13 May '10  
Generalsend and recieve sms using pdulib Pinmemberpaks_mundiasd17:20 11 May '10  
Generaluse pdulib Pinmemberzadsdfas0:29 23 Mar '10  
QuestionService Center number missed? Pingroupflexchan6:27 25 Jan '10  
GeneralWanted specification Pinmemberk06a5:22 18 Jan '10  
GeneralRe: Wanted specification PinmemberEduard Gomolyako16:54 21 Jan '10  
GeneralRe: Wanted specification [modified] Pinmemberk06a8:14 22 Jan '10  
GeneralRe: Wanted specification PinmemberEduard Gomolyako23:52 22 Jan '10  
GeneralRe: Wanted specification Pinmemberk06a7:18 23 Jan '10  
GeneralThanks A lot!! Pinmemberadiono4:03 9 Dec '09  
GeneralEncoder/Decoder PinmemberMember 305411523:25 2 Nov '09  
GeneralRe: Encoder/Decoder PinmemberuncleR1:19 18 Nov '09  
GeneralRe: Encoder/Decoder Pinmemberummarbhutta4:49 21 Nov '09  
GeneralRe: Encoder/Decoder PinmemberMember 305411522:44 22 Nov '09  
GeneralRe: Encoder/Decoder PinmemberohinCZ0:02 24 Nov '09  
GeneralRe: Encoder/Decoder PinmemberMember 30541158:17 25 Nov '09  

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.

Permalink | Advertise | Privacy | Mobile
Web02 | 2.5.120528.1 | Last Updated 11 Apr 2008
Article Copyright 2006 by Eduard Gomolyako
Everything else Copyright © CodeProject, 1999-2012
Terms of Use
Layout: fixed | fluid