SMS ENGINE


Description

Smart phones are vital in our everyday and SMS the most widely used mobile service. SMS text messaging is the perfect way to reach out your customers, suppliers, employees, even to perform administrative tasks in your own system. AE_SMS Library is the result of combining Hayes AT Commands with the power of .NET technologies. The new AE_SMS Library allows you to quickly integrate mobile SMS sending and receiving with your MS Access applications, which makes it the ideal building block for business messaging applications. It can be used with any ETSI 07.05 compliant GSM modem or phone handset connected to the PC serial port using a data cable, Infrared device USB etc.

Features:
  • Get/Set Storage Area: MT, Device, SIM, IM, OM, BM, DM
  • Get/Set Operator’s phone number.
  • Access PIN
  • Send Text Messages.
  • Read, Delete Incoming Messages.
  • Specify serial communication parameters
  • Allows setting of minimum time delay interval between two consecutive messages to avoid delivery failure during a network busy period.
  • Written in 100% managed code. Requires only the .NET Framework 4.x Client Profile or later.
  • Save messages sent.
  • Support for UTF8 Encoding.
  • Use of enumerators to simplify programming.
Before start using our library you should read your device's documention to get to know the basics, such as storage areas, port's speed, capacity and supported commands etc.

Properties

Object Type Category Defaults/Returns
Properties
PortName Read/Write String Commun Default COM3
PIN WriteOnly String Commun Default Nothing
OperatorNumber Read/Write String Send By default from SIM Card
CharSet ENUM WriteOnly Send By default "GSM" Encode
PortBaudRate ENUM WriteOnly Send Default 9600
PortDataBits WriteOnly Integer Send Default 8
portDtrEnabled WriteOnly Boolean Send Default False
portRtsEnabled WriteOnly Boolean Send Default True
PortParityBit WriteOnly Integer Send Default None
StorageArea ENUM WriteOnly Commun Default SIM
Filter ENUM WriteOnly Read Default All
Wait ENUM WriteOnly Send Default 0 Seconds
RecipientPhoneNumber Read/Write String Send N/A
TextMessage Read/Write String Send N/A

Methods

Object Type Category Defaults/Returns
Properties
SaveCopy Boolean Send True To leave a copy. Default False
Send Boolean Send True if success
ReadMessages String. Read Long string separated by VBA.vbNewLine One per message
DeleteMessage Boolean Delete True if success
DeleteAll Boolean Delete True if success

Send Text Message

    Private Sub SendMsgText() 
        Dim sms As New AEEngine 
            With sms 
                .PortName = "COM3" 'This always, must be the first line.
                ' .PIN = "" 
                ' .OperatorNumber = "000 000 000 000 000" 
                ' .PortBaudRate = Bauds_speed9600 
                ' .PortDataBits = 8 
                ' .portDtrEnabled = False 
                ' .portRtsEnabled = True 
                ' .StorageArea = Storage_Device 
                ' .Wait = Waiting_Wait_0Seconds
                ' .SaveCopy = False 
                .RecipientPhoneNumber = "000 000 000 000 000" 
                .TextMessage = "AE Rocks!!!" 
                If Not .Send() Then 
                     VBA.MsgBox .Exception, vbCritical,"Oops!" 
                Else 
                     VBA.MsgBox ("Job Done!") 
                End If 
            End With 
            Set sms = Nothing
    End Sub 

                            

Read Message(s)

      Private Sub ReadMsgText() 
        Dim sms As New AE_SMSEngine 
        Dim strM As String  
        Dim strMs() As String 
        Dim i As Integer 
        Dim j As Integer 
        Dim a As Integer 

        With sms
            .PortName = "COM3" 'This always, must be the first line.
            '.PIN = "" 
            ' .StorageArea = Storage_SIM 
            .Filter = Messages_Unread
            strM = .LoadMessages 
            If .MessagesCount > 0 Then 
                j = .MessagesCount
                strMs() = VBA.Split(strM, VBA.vbNewLine) 
                i = UBound(strMs) 
                For j = 0 To i 
                    If VBA.Len(strMs(j)) > 0 Then 
                       Debug.Print strMs(j) 
                    End If 
                Next j 
            Else 
                 VBA.MsgBox .Exception 
            End If 
        End With 
        Set sms = Nothing
    End Sub
                            

Delete Message

    Private Sub DeleteMessage() 
        Dim sms As New AE_SMSEngine 
                            
        With sms 
            .PortName = "COM3" 'This always, must be the first line. 
            '.PIN = "" 
            If .DeleteItem(20) Then '20 = Message index given by the device
                 VBA.MsgBox "Message Deleted!" 
            Else 
                 VBA.MsgBox .Exception 
            End If 
        End  With 

        Set sms = Nothing 
    End Sub
                            

Delete All Messages

      Private Sub DeleteAll() 
        Dim sms As New AE_SMSEngine 
                       
        With sms 
            .PortName = "COM3" 'This always, must be the first line.
            '.DeleteAll (MarkedAs_AllMessages) 'USE WITH CAUTION: THIS ACTION WILL ERASE ALL MESSAGES FROM ALL STORAGE AREAS 
            '.DeleteAll (MarkedAs_ReadSentAndUnsent) 
            '.DeleteAll (MarkedAs_ReadAndSent)
             
            If .DeleteAll(MarkedAs_Read) Then
                VBA.MsgBox "All messages has been Deleted!" 
            Else 
                VBA.MsgBox .Exception 
            End If
        End With 
        Set sms = Nothing 
    End Sub