Click here to Skip to main content
14,357,676 members

Library for Decode/Encode SMS PDU

Rate this:
4.74 (48 votes)
Please Sign up or sign in to vote.
4.74 (48 votes)
18 Oct 2012CPOL
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

Comments and Discussions

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

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.

Article
Posted 11 Oct 2006

Stats

622.7K views
24.3K downloads
126 bookmarked