Click here to Skip to main content
11,488,877 members (73,994 online)
Click here to Skip to main content

Library for Decode/Encode SMS PDU

, 18 Oct 2012 CPOL 431.8K 13.7K 119
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 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
Serja Ru9-Jul-10 5:49
memberSerja Ru9-Jul-10 5:49 
GeneralMy vote of 3 Pin
Serja Ru9-Jul-10 5:46
memberSerja Ru9-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 
Generaluse pdulib Pin
zadsdfas23-Mar-10 1:29
memberzadsdfas23-Mar-10 1:29 
QuestionService Center number missed? Pin
flexchan25-Jan-10 7:27
groupflexchan25-Jan-10 7:27 
GeneralWanted specification Pin
k06a18-Jan-10 6:22
memberk06a18-Jan-10 6:22 
GeneralRe: Wanted specification Pin
Eduard Gomolyako21-Jan-10 17:54
memberEduard Gomolyako21-Jan-10 17:54 
GeneralRe: Wanted specification [modified] Pin
k06a22-Jan-10 9:14
memberk06a22-Jan-10 9:14 
GeneralRe: Wanted specification Pin
Eduard Gomolyako23-Jan-10 0:52
memberEduard Gomolyako23-Jan-10 0:52 
GeneralRe: Wanted specification Pin
k06a23-Jan-10 8:18
memberk06a23-Jan-10 8:18 
GeneralThanks A lot!! Pin
adiono9-Dec-09 5:03
memberadiono9-Dec-09 5:03 
GeneralEncoder/Decoder Pin
Member 30541153-Nov-09 0:25
memberMember 30541153-Nov-09 0:25 
GeneralRe: Encoder/Decoder Pin
uncleR18-Nov-09 2:19
memberuncleR18-Nov-09 2:19 
GeneralRe: Encoder/Decoder Pin
ummarbhutta21-Nov-09 5:49
memberummarbhutta21-Nov-09 5:49 
GeneralRe: Encoder/Decoder Pin
Member 305411522-Nov-09 23:44
memberMember 305411522-Nov-09 23:44 
GeneralRe: Encoder/Decoder Pin
ohinCZ24-Nov-09 1:02
memberohinCZ24-Nov-09 1:02 
GeneralRe: Encoder/Decoder Pin
Member 305411525-Nov-09 9:17
memberMember 305411525-Nov-09 9:17 
GeneralUpdated version of this library Pin
ummarbhutta18-Oct-09 9:03
memberummarbhutta18-Oct-09 9:03 
GeneralSuggestion/Doubts about receiving long SMS Pin
cardigait17-Oct-09 1:17
membercardigait17-Oct-09 1:17 
Generalhi Pin
Member 108861211-Oct-09 20:58
memberMember 108861211-Oct-09 20:58 
GeneralRe: hi Pin
Eduard Gomolyako12-Oct-09 0:30
memberEduard Gomolyako12-Oct-09 0:30 
QuestionOpen Source Project Pin
KillerTiger20-May-09 11:37
memberKillerTiger20-May-09 11:37 
AnswerRe: Open Source Project Pin
Eduard Gomolyako20-May-09 20:33
memberEduard Gomolyako20-May-09 20:33 
GeneralSending sms [modified] Pin
tprimus8-Feb-09 22:31
membertprimus8-Feb-09 22:31 
GeneralRe: Sending sms Pin
Member 47650628-Feb-09 23:37
memberMember 47650628-Feb-09 23:37 
GeneralRe: Sending sms [modified] Pin
Member 47650629-Feb-09 0:08
memberMember 47650629-Feb-09 0:08 
GeneralRe: Sending sms [modified] Pin
tprimus9-Feb-09 7:48
membertprimus9-Feb-09 7:48 
GeneralRe: Sending sms [modified] Pin
tprimus9-Feb-09 9:54
membertprimus9-Feb-09 9:54 
GeneralRe: Sending sms Pin
nkachanov9-Feb-09 20:33
membernkachanov9-Feb-09 20:33 
GeneralRe: Sending sms [modified] Pin
tprimus9-Feb-09 22:04
membertprimus9-Feb-09 22:04 
AnswerRe: Sending sms Pin
nkachanov10-Feb-09 19:45
membernkachanov10-Feb-09 19:45 
GeneralRe: Sending sms Pin
tprimus10-Feb-09 22:19
membertprimus10-Feb-09 22:19 
Generalbug, I guess Pin
nkachanov@yandex.ru5-Feb-09 3:01
membernkachanov@yandex.ru5-Feb-09 3:01 

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
Web02 | 2.8.150520.1 | Last Updated 18 Oct 2012
Article Copyright 2006 by Eduard Gomolyako
Everything else Copyright © CodeProject, 1999-2015
Layout: fixed | fluid