Click here to Skip to main content
65,938 articles
CodeProject is changing. Read more.
Articles
(untagged)

GSM SMS Library

0.00/5 (No votes)
16 Jun 2008 1  
This library is able to handle all the TPDU types but the SMS-DELIVER-REPORT type.

Introduction

The Global System for Mobile communications (ETSI GSM 03.40) Technical Specification (GTS) describes the point-to-point Short Message Service (SMS) of the GSM system. The specification defines the following six transfer protocol data units (TPDU) types:

  • SMS-DELIVER, conveying a short message from the Service Centre (SC) to the Mobile Station (MS)
  • SMS-DELIVER-REPORT, conveying a failure cause (if necessary)
  • SMS-SUBMIT, conveying a short message from the MS to the SC
  • SMS-SUBMIT-REPORT, conveying a failure cause (if necessary)
  • SMS-STATUS-REPORT, conveying a status report from the SC to the MS
  • SMS-COMMAND, conveying a command from the MS to the SC

This version of the SMS Library is able to handle all the TPDU types but the SMS-DELIVER-REPORT type.

The library references the PDU Encoding Library which is included in the dowlnoad above.

Class Hierarchy

sms_hierarchy.jpg

Core classes

sms_library_class_a.jpg

Supporting classes

sms_library_class_b.jpg


Using the Library

Use the SMSSubmit class to handle a TPDU of the SM-SUBMIT type.

Use the SMSDeliver class to handle a TPDU of the SM-DELIVER type.

Use the SMSSubmitReport class to handle a TPDU of the SM-SUBMIT-REPORT type.

Use the SMSStatusReport class to handle a TPDU of the SM-STATUS-REPORT type.

Use the SMSCommand class to handle a TPDU of the SM-COMMAND type.

The supporting classes are used when referencing any of the core classes. You may use them for any other purposes if required.

Class Details

SMSSubmit Class

Namespace Rightrotech.SMS

Properties

Property Description

DataCodingScheme

Public Property DataCodingScheme() As Rightrotech.SMS.SMSDataCodingScheme

Gets or sets the coding scheme within the TP-User-Data i.e. the element TP-Data-Coding-Scheme (TP-DCS) of the SMS-SUBMIT PDU type.

DestinationAddress

Public Property DestinationAddress() As Rightrotech.SMS.SMSAddress

Gets or sets the address of the destination SME i.e. the element The TP-Destination-Address (TP-DA) field of the SMS-SUBMIT PDU type.

MessageReference

Public ReadOnly Property MessageReference() As Integer

Gets an integer representation of a reference number of the SMS-SUBMIT submitted to the SC by the MS. This corresponds to the element TP-Message-Reference (TP-MR) of the SMS-SUBMIT PDU Type.

MessageTypeIndicator

Public ReadOnly Property MessageTypeIndicator() As Integer

Gets an integer describing the message type. For the SMS-SUBMIT PDU type, the returned value is always 1. This corresponds to the element TP-Message-Type-Indicator (TP-MTI) of the SMS-SUBMIT PDU Type.

ProtocolIdentifier

Public ReadOnly Property ProtocolIdentifier() As Integer

Gets an integer identifying the above layer protocol, if any. This corresponds to the element TP-Protocol-Identifier (TP-PID) of the SMS-SUBMIT PDU type. In this version of the SMS Library, the returned value is always 0.

RejectDuplicates

Public Property RejectDuplicates() As Boolean

Gets or sets a parameter indicating whether or not the SC shall accept an SMS-SUBMIT for an SM still held in the Service Centre which has the same TP-Message-Reference and the same TP-Destination-Address as a previously submitted Short Message from the same TP-Originating-Address i.e. the element TP-Reject-Duplicates (TP-RD) of the SMS-SUBMIT PDU type.

ReplyPath

Public Property ReplyPath() As Boolean

Gets or sets a parameter indicating the request for Reply Path i.e. the element TP-Reply-Path (TP-RP) of the SMS-SUBMIT PDU type.

ServiceCentreAddress

Public Property ServiceCentreAddress() As Rightrotech.SMS.SMSCAddress

Gets or sets the Service Centre Address.

StatusReportRequest

Public Property StatusReportRequest() As Boolean

Gets or sets a parameter indicating if the MS is requesting a status report. This corresponds to the element TP-Status-Report-Request (TP-SRR) of the SMS-SUBMIT PDU type.

UserData

Public Property UserData() As Rightrotech.SMS.SMSUserData

Gets or sets user data field may comprise just the short message itself or a Header in addition to the short message depending upon the setting of TP-UDHI. This corresponds to the element TP-User-Data (TP-UD) of the SMS-SUBMIT PDU type. The TP-User-Data field contains up to 140 octets of user data.

UserDataHeaderIndicator

Public Property UserDataHeaderIndicator() As Boolean

Gets or sets a parameter indicating that the TP-UD field contains a Header. This corresponds to the element TP-User-Data-Header-Indicator (TP-UDHI) of the SMS-SUBMIT PDU type.

UserDataLength

Public ReadOnly Property UserDataLength() As Integer

Gets an integer representing the the number of octets that are in this SMS-SUBMIT TPDU.

ValidityPeriod

Public Property ValidityPeriod() As Integer

Gets or sets a parameter identifying the time from where the message is no longer valid when the ValidityPeriodFormats property is set to VPFieldRelative. This corresponds to the element TP-Validity-Period (TP-VP) of the SMS-SUBMIT PDU type.

ValidityPeriodAbsolute

Public Property ValidityPeriodAbsolute() As Rightrotech.SMS.SCTimeStamp

Gets or sets a parameter identifying the time from where the message is no longer valid when the ValidityPeriodFormats property is set to VPFieldAbsolute. This corresponds to the element TP-Validity-Period (TP-VP) of the SMS-SUBMIT PDU type.

ValidityPeriodFormat

Public Property ValidityPeriodFormat() As Rightrotech.SMS.SMSSubmit.ValidityPeriodFormats

Gets or sets the format of the validity period.

Methods

Method Description

New

Public Sub New()

Public Sub New(ByVal SMSText As String, Optional ByVal SMAlphabet As Rightrotech.SMS.SMSDataCodingScheme.SMSAlphabet = DefaultAlphabet, Optional ByVal Concatenated As Boolean = False)

Initializes a new instance of the SMSSubmit class.

Parameters

  1. ByVal SMSText is the short message text.
  2. Optional ByVal SMAlphabet specifies the alphabet to use when encoding the short message.
  3. Optional ByVal Concatenated indicates if the short message is part of a group of concatenated short messages.

Parse

Public Function Parse(ByVal SubmitPDU As String) As Boolean

Parses the given SubmitPDU string and updates fields of the current instance. The function returns TRUE if the parsing is successful, otherwise it returns FALSE.

Parameters

  1. ByVal SubmitPDU is the TPDU string of a SMS-SUBMIT PDU type.

ToString

Public Overloads Function ToString() As String

Returns a TPDU string representing the current instance of the SMSSubmit class. The returned string will represent a TPDU of the SMS-SUBMIT type.

SMSDeliver Class

Namespace Rightrotech.SMS

Properties

Property Description

DataCodingScheme

Public Property DataCodingScheme() As Rightrotech.SMS.SMSDataCodingScheme

Gets or sets the coding scheme within the TP-User-Data i.e. the element TP-Data-Coding-Scheme (TP-DCS) of the SMS-DELIVER PDU type.

MessageTypeIndicator

Public ReadOnly Property MessageTypeIndicator() As Integer

Gets an integer describing the message type. For the SMS-DELIVER PDU type, the returned value is always 0. This corresponds to the element TP-Message-Type-Indicator (TP-MTI) of the SMS-DELIVER PDU Type.

MoreMessagesToSend

Public Property MoreMessagesToSend() As Boolean

Gets or sets a parameter indicating whether or not there are more messages to send i.e. the element TP-More-Messages-to-Send (TP-MMS) of the SMS-DELIVER PDU Type.

OriginatingAddress

Public Property OriginatingAddress() As Rightrotech.SMS.SMSAddress

Gets or sets the address of the originating SME i.e. the element The TP-Originating-Address (TP-OA) field of the SMS-DELIVER PDU type.

ProtocolIdentifier

Public ReadOnly Property ProtocolIdentifier() As Integer

Gets an integer identifying the above layer protocol, if any. This corresponds to the element TP-Protocol-Identifier (TP-PID) of the SMS-DELIVER PDU type. In this version of the SMS Library, the returned value is always 0.

ReplyPath

Public Property ReplyPath() As Boolean

Gets or sets a parameter indicating that Reply Path exists i.e. the element TP-Reply-Path (TP-RP) of the SMS-DELIVER PDU type.

ServiceCentreAddress

Public Property ServiceCentreAddress() As Rightrotech.SMS.SMSCAddress

Gets or sets the Service Centre Address.

ServiceCentreTimeStamp

Public ReadOnly Property ServiceCentreTimeStamp() As Rightrotech.SMS.SCTimeStamp

Gets the time when the SC received the message i.e. the element TP-Service-Centre-Time-Stamp (TP-SCTS) of the SMS-DELIVER PDU type.

StatusReportRequest

Public Property StatusReportRequest() As Boolean

Gets or sets a parameter indicating if the MS is requesting a status report. This corresponds to the element TP-Status-Report-Request (TP-SRR) of the SMS-SUBMIT PDU type.

UserData

Public Property UserData() As Rightrotech.SMS.SMSUserData

Gets or sets user data field may comprise just the short message itself or a Header in addition to the short message depending upon the setting of TP-UDHI. This corresponds to the element TP-User-Data (TP-UD) of the SMS-DELIVER PDU type. The TP-User-Data field contains up to 140 octets of user data.

UserDataHeaderIndicator

Public Property UserDataHeaderIndicator() As Boolean

Gets or sets a parameter indicating that the TP-UD field contains a Header. This corresponds to the element TP-User-Data-Header-Indicator (TP-UDHI) of the SMS-DELIVER PDU type.

TPUserDataLength

Public ReadOnly Property TPUserDataLength() As Integer

Gets or sets a parameter indicating the length of the TP-User-Data field to follow. This corresponds to the element TP-User-Data-Length (TP-UDL) of the SMS-SUBMIT PDU type.

Methods

Method Description

New

Public Sub New()

Public Sub New(ByVal SMDeliverPDU As String)

Initializes a new instance of the SMSDeliver class.

Parameters

  1. ByVal SMSDeliverPDU is a TPDU string of an SMS-DELIVER PDU type.

ToString

Public Overloads Function ToString() As String

Returns a TPDU string representing the current instance of the SMSDeliver class. The returned string will represent a TPDU of the SMS-DELIVER type.

SMSCAddress Class

Namespace Rightrotech.SMS

Properties

Property Description

AddressLength

Public ReadOnly Property AddressLength() As Integer

Gets an integer representation of the number of semi-octets within the AddressValue property (including any fill bits) i.e. the element Address-Length of the SM Address field.

AddressValue

Public Property AddressValue() As String

Gets or sets the Address Value of the Address field. It corresponds to the Address-Value element of an SMS Address field. The maximum length of the string is 10 characters.

NumberingPlanIdentification

Public Property NumberingPlanIdentification() As Rightrotech.SMS.SMSCAddress.SMSAddressNumberingPlanIDTypes

Gets or sets the address' Numbering Plan Identification i.e. the element Numbering-Plan-Identification of the Type-Of-Address field of an SM Address. The default value is Telephone. The property is valid only when the TypeOfNumber has the value Unknown, International or National.

TypeOfNumber

Public Property TypeOfNumber() As Rightrotech.SMS.SMSCAddress.SMSAddressNumberTypes

Gets or sets the type of the number stored in the AddressValue property. This corresponds to the Type-Of-Number element of the Type-Of-Address fieldof an SM Address. The default value is National, but the value may change depending on the value assigned to the AddressValue property.

Methods

Method Description

New

Public Sub New()

Public Sub New(ByVal SMSCAddressPDU As String)

Initializes a new instance of the SMSCAddress class.

Parameters

  1. ByVal SMSCAddressPDU is a TPDU string of representing an SMSC Address. If the number of octets in SMSCAddressPDU is greater than the expected number of octets as read from the first octet of the PDU string, the additional octets will be ignored.

ToString

Public Overloads Function ToString() As String

Returns a TPDU string representing the current instance of the SMSCAddress class.

SMSAddress Class

Namespace Rightrotech.SMS

Properties

Property Description

AddressLength

Public ReadOnly Property AddressLength() As Integer

Gets an integer representation of the number of semi-octets within the AddressValue property (excluding any fill bits) i.e. the element Address-Length of the SM Address field.

AddressValue

Public Property AddressValue() As String

Gets or sets the Address Value of the Address field. It corresponds to the Address-Value element of an SMS Address field. The maximum length of the string is 10 characters.

NumberingPlanIdentification

Public Property NumberingPlanIdentification() As Rightrotech.SMS.SMSAddress.SMSAddressNumberingPlanIDTypes

Gets or sets the address' Numbering Plan Identification i.e. the element Numbering-Plan-Identification of the Type-Of-Address field of an SM Address. The default value is Telephone. The property is valid only when the TypeOfNumber has the value Unknown, International or National.

TypeOfNumber

Public Property TypeOfNumber() As Rightrotech.SMS.SMSAddress.SMSAddressNumberTypes

Gets or sets the type of the number stored in the AddressValue property. This corresponds to the Type-Of-Number element of the Type-Of-Address fieldof an SM Address. The default value is National, but the value may change depending on the value assigned to the AddressValue property.

Methods

Method Description

New

Public Sub New()

Public Sub New(ByVal SMAddressPDU As String)

Initializes a new instance of the SMSAddress class.

Parameters

  1. ByVal SMAddressPDU is a TPDU string of representing an SM Address. If the number of octets in SMAddressPDU is greater than the expected number of octets as read from the first octet of the PDU string, the additional octets will be ignored.

ToString

Public Overloads Function ToString() As String

Returns a TPDU string representing the current instance of the SMSAddress class.

SMSUserData Class

Namespace Rightrotech.SMS

Properties

Property Description

DataCodingScheme

Public Property DataCodingScheme() As Rightrotech.SMS.SMSDataCodingScheme

Gets or sets the coding scheme within the TP-User-Data i.e. the element TP-Data-Coding-Scheme (TP-DCS) of the SMS-SUBMIT or SMS-DELIVER PDU types.

InformationElements

Public ReadOnly Property InformationElements() As System.Collections.ObjectModel.Collection(Of Rightrotech.SMS.UDHInfomationElement)

Gets a collection of User Data Header items of this instance of the User Data class.

ShortMessage

Public Property ShortMessage() As String

Gets or sets the actual short message text. The maximum length of the string is 160 characters (152 for concatenated SM) when using the default 7-bit alphabet, 140 (134 for cancatenated SM) when using 8-bit encoding and 70 (67 for concatenated SM) when using UCS2 (16-bit) encoding.

UserDataLength

Public ReadOnly Property UserDataLength() As Integer

Gets an integer representing the the number of octets that are in the ShortMessage property.

Methods

Method Description

New

Public Sub New()

Public Sub New(ByVal UserDataPDU As String, ByVal DataCodingScheme As Rightrotech.SMS.SMSDataCodingScheme, ByVal HasUDH As Boolean)

Initializes a new instance of the SMSUserData class.

Parameters

  1. ByVal UserDataPDU is a TPDU string of representing an SM User Data.
  2. ByVal DataCodingScheme specifies the data coding scheme of the TPDU represented by the UserDataPDU parameter.
  3. ByVal HasUDH inidcates whether the TPDU represented by the UserDataPDU contains a user data header.

ToString

Public Overloads Function ToString() As String

Returns a TPDU string representing the current instance of the SMSUserData class.

Examples

(Keep watching this area, examples will be added soon...)

License

This article has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.

A list of licenses authors might use can be found here