Shortcut Menu

Skip

Main Navigation

Choose your language

You are here:

ActiveXperts.com > SMS and MMS Toolkit > Objects > SmsProtocolGsm

ActiveXperts SMS and MMS Toolkit Add SMS and MMS capabilities to any Windows or .NET application

SMS and MMS Toolkit - SmsProtocolGsm object

Overview

A GSM modem is a wireless modem that works with a GSM wireless network. A wireless modem behaves like an ordinary dial-up modem. The difference between them is that a dial-up modem sends and receives data through a fixed telephone line, while a wireless modem sends and receives data through GSM.

A GSM modem can be an external (USB/COM) device or a PC Card. Like a GSM mobile phone, a GSM modem requires a SIM card from a wireless carrier in order to operate.

SMS and MMS Toolkit supports GSM modems through its SmsProtocolGsm object.

The SmsProtocolGsm object features the following:

  • Send SMS messages through a external/internal GSM modem (or GSM phone) connected to your computer;
  • Send alphanumeric text and binary SMS messages;
  • Send WAP Push messages, WAP Bookmark messages;
  • Verify delivery (so called 'status reports');
  • Receive SMS messages through a external/internal GSM modem (or GSM phone) connected to your computer;
  • Receive alphanumeric text and binary SMS messages;
  • Receive WAP Push messages and WAP Bookmark messages;
  • Support for Unicode, to support foreign languages like Chinese, Turkish, etc.;
  • Support for multi-part messages, to allow messages longer than 160 characters;
  • Support Windows 'Phone and Modem devices' and direct COM ports.

The SmsProtocolGsm object is part of the ActiveXperts SMS and MMS Toolkit component. Overview of all SMS and MMS Toolkit objects:

  • SmsProtocolGsm - Send and receive SMS messages using a GSM modem or a modem-capable GSM phone.
  • SmsProtocolSmpp - Send and receive SMS messages via an SMPP provider.
  • SmsProtocolHttp - Send (bulk) SMS messages through an SMS/HTTP compliant SMS provider over the internet/VPN.
  • SmsProtocolDialup - Send SMS messages using a normal Hayes compatible modem (1200 bps or higher).
  • MmsProtocolMM1 - Send and receive MMS messages via a GPRS modem through WAP (wireless application protocol).
  • MmsProtocolMM4 - Send MMS messages via an SMTP server. The protocol is based on SMTP, messages are MIME encoded.
  • MmsProtocolMM7 - Send and receive MMS messages via SOAP/XML using HTTP as the transport protocol.
  • PagerProtocolSnpp - Send pager messages via an SNPP provider through the internet/VPN.

Sample code

VBScript sample: Send a plain text SMS message (via GSM/GPRS modem or phone)

Set objGsmProtocol           = CreateObject ( "ActiveXperts.SmsProtocolGsm" )
Set objSmsMessage            = CreateObject ( "ActiveXperts.SmsMessage" )
Set objConstants             = CreateObject ( "ActiveXperts.SmsConstants" )

objGsmProtocol.Device        = "MultiTech GSM MultiModem"    ' Use Windows Telephony device 
objGsmProtocol.EnterPin ( "1234" )                           ' SIM card's PIN code

objSmsMessage.Clear
objSmsMessage.Recipient      = "+31624896641"                ' Recipient's mobile number
objSmsMessage.Data           = "Hello, world!"               ' SMS message text

objGsmProtocol.Send( objSmsMessage )	
WScript.Echo "Result: " & objGsmProtocol.LastError

VB .NET sample: Send a plain text SMS message (via GSM Modem / GSM phone)

Imports AXmsCtrl

Module Module1
  Sub Main()

    Dim objGsmProtocol As SmsProtocolGsm = New SmsProtocolGsm
    Dim objSmsMessage As SmsMessage = New SmsMessage

    objGsmProtocol.Device = "COM1"                           ' Device Settings 

    objSmsMessage.Clear()
    objSmsMessage.Recipient = "31647134225"                  ' Message Settings 
    objSmsMessage.Data = "ActiveXperts SMS and MMS Toolkit GSM test message!"

    objGsmProtocol.Send(objSmsMessage)                       ' Send the message 
    Console.WriteLine( "Send message, result: {0} ( {1} )", 
    objGsmProtocol.LastError.ToString, 
    objGsmProtocol.GetErrorDescription( objGsmProtocol.LastError ) )
  End Sub
 End Module
 

VBScript sample: Receive a plain text SMS message (GSM Modem / GSM phone)

Set objGsmProtocol             = CreateObject ( "ActiveXperts.SmsProtocolGsm" )

objGsmProtocol.Device          = "MultiTech GSM MultiModem"
objGsmProtocol.DeleteAfterReceive = FALSE                    ' Don't delete after receive
objGsmProtocol.EnterPin ( "1234" )                           ' SIM card's PIN code

objGsmProtocol.Receive()                                     ' Receive messages from SIM/memory 
If ( objGsmProtocol.LastError <> 0 ) Then 
 WScript.Echo "Failed to receive, error: " & objGsmProtocol.LastError
 WScript.Quit
End If

' Iterate over all received messages
On Error Resume Next
Set objSmsMessage = objGsmProtocol.GetFirstMessage()
On Error Goto 0
If( objGsmProtocol.LastError = 33060 ) Then
 WScript.Echo "No messages received."
ElseIf( objGsmProtocol.LastError <> 0  ) Then 
 WScript.Echo "GetFirstMessage, result: " & objGsmProtocol.LastError
Else
 While( objGsmProtocol.LastError = 0 ) 
   WScript.Echo "Message from: " & objSmsMessage.Sender
   If( objSmsMessage.Format = objConstants.asMESSAGEFORMAT_DATA ) Then
     WScript.Echo "  " & "<DATA>"
   Else
     WScript.Echo "  " & objSmsMessage.Data
   End If
   WScript.Echo
   On Error Resume Next
   Set objSmsMessage = objGsmProtocol.GetNextMessage()
   On Error Goto 0
 Wend
End If

VBScript sample: Send a Unicode SMS message (via GSM Modem / GSM phone)

Set objGsmProtocol           = CreateObject ( "ActiveXperts.SmsProtocolGsm" )
Set objSmsMessage            = CreateObject ( "ActiveXperts.SmsMessage" )
Set objConstants             = CreateObject ( "ActiveXperts.SmsConstants" )

objGsmProtocol.Device        = "MultiTech GSM MultiModem"    ' Use a Windows Telephony device 
objGsmProtocol.EnterPin ( "1234" )                           ' SIM card's PIN code

objSmsMessage.Clear
objSmsMessage.Recipient      = "+31624896641"                ' Recipient's mobile number
objSmsMessage.Format         = objConstants.asMESSAGFORMAT_UNICODE  ' SMS message text
objSmsMessage.Data           = "ملحق خاصملحق خاص"            ' SMS message text

objGsmProtocol.Send( objSmsMessage )	
WScript.Echo "Result: " & objGsmProtocol.LastError

More samples

Samples are available for: Visual Basic, Visual C/C++, VB .NET, VC# .NET, ASP, ASP .NET, Java, Javascript, PHP, HTML and more.

On ftp.activexperts-labs.com, you can find many SMS and MMS Toolkit samples. Samples are also part of the SMS and MMS Toolkit installation.