Click here to Skip to main content
12,452,344 members (51,314 online)
Click here to Skip to main content
Add your own
alternative version

Stats

465.3K views
16.5K downloads
121 bookmarked
Posted

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[^].

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

You may also be interested in...

Pro
Pro

Comments and Discussions

 
QuestionConcat long SMS unicode (UCS-2) Pin
Ana98711-May-16 1:56
memberAna98711-May-16 1:56 
QuestionSend a long message Pin
Member 106667001-Sep-15 14:11
memberMember 106667001-Sep-15 14:11 
QuestionPDU Decoder Pin
Member 160860718-Sep-14 0:14
memberMember 160860718-Sep-14 0:14 
QuestionPlease Help Pin
Member 859094222-Mar-13 18:03
memberMember 859094222-Mar-13 18:03 
QuestionThanks Pin
ekoos711-Jan-13 10:48
memberekoos711-Jan-13 10:48 
QuestionI do not download,can you send it to my email,Thanks a lot! Pin
yf200919-Oct-12 16:10
memberyf200919-Oct-12 16:10 
GeneralMy vote of 5 Pin
Anand Murali M S18-Oct-12 1:01
memberAnand Murali M S18-Oct-12 1:01 
QuestionIt Works! Pin
carloboi12-Oct-12 1:46
membercarloboi12-Oct-12 1:46 
QuestionHow to Encode 7bit. Pin
Khương Nguyễn11-Jun-12 22:22
memberKhương Nguyễn11-Jun-12 22:22 
QuestionWhere is the compose for 7bit and 8bit Pin
rixan13-Jul-11 1:18
memberrixan13-Jul-11 1:18 
AnswerRe: Where is the compose for 7bit and 8bit Pin
ummarbhutta5-Jan-12 18:44
memberummarbhutta5-Jan-12 18:44 
GeneralRe: Where is the compose for 7bit and 8bit Pin
rixan8-Jan-12 20:34
memberrixan8-Jan-12 20:34 
GeneralRe: Where is the compose for 7bit and 8bit Pin
BlueFire233-Oct-12 17:17
memberBlueFire233-Oct-12 17:17 
GeneralRe: Where is the compose for 7bit and 8bit Pin
Ulen15151517-Oct-12 22:47
memberUlen15151517-Oct-12 22:47 
Generalspecial char ? ^ {} [] dosnt work Pin
tenmateusz9-Feb-11 3:51
membertenmateusz9-Feb-11 3:51 
GeneralMy vote of 5 Pin
farhood22-Jan-11 20:29
memberfarhood22-Jan-11 20:29 
GeneralMy vote of 4 Pin
astri30-Oct-10 23:14
memberastri30-Oct-10 23:14 
GeneralCellId.ru have freelibrary for working with SMS and GSM Modem Pin
Serja Ru9-Jul-10 4:49
memberSerja Ru9-Jul-10 4:49 
GeneralMy vote of 3 Pin
Serja Ru9-Jul-10 4:46
memberSerja Ru9-Jul-10 4:46 
GeneralRecieve Long sms not correctly Pin
amna_94726-May-10 17:42
memberamna_94726-May-10 17:42 
GeneralRecive sms problem Pin
anil_singh201013-May-10 18:17
memberanil_singh201013-May-10 18:17 
Generalsend and recieve sms using pdulib Pin
paks_mundiasd11-May-10 17:20
memberpaks_mundiasd11-May-10 17:20 
Generaluse pdulib Pin
zadsdfas23-Mar-10 0:29
memberzadsdfas23-Mar-10 0:29 
QuestionService Center number missed? Pin
flexchan25-Jan-10 6:27
groupflexchan25-Jan-10 6:27 
GeneralWanted specification Pin
k06a18-Jan-10 5:22
memberk06a18-Jan-10 5:22 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    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
Web02 | 2.8.160826.1 | Last Updated 18 Oct 2012
Article Copyright 2006 by Eduard Gomolyako
Everything else Copyright © CodeProject, 1999-2016
Layout: fixed | fluid