mCore™ .NET SMS Library 1.2

mCore.SMS.NewMessageConcatenate Property

Description:

The NewMessageConcatenate property gets or sets a boolean value that defines whether the NewMessageReceived event is raised for every part of a concatenated message or it is raised only once when the complete (all parts) concatenated message is received.

If NewMessageConcatenate property is set as False then, the part messages should be evaluated/processed by testing the value of the properties ReferenceNumber, SequenceNumber and TotalParts in mCore.NewMessageReceivedEventArgs Class object.

mCore is designed to automatically delete all incomplete message parts of a concatenated message if all parts are not received within 30 minutes of arrival of the first part.

Namespace: mCore
Assembly: mCoreLib (in mCoreLib.dll)

Usage Example:

mCore.GeneralException

Usage Example:

Visual Basic

Public Class MyClass
   Public WithEvents objSMS As New mCore.SMS
  
   Public Sub New()
      Try     
         SetCommParameters()
         objSMS.NewMessageIndication = True
         objSMS.NewMessageConcatenate = True
         objSMS.AutoDeleteNewMessage = True
      Catch ex As mCore.GeneralException
         MsgBox(ex.Message)
      End Try
   End Sub

   'New Message Event Handling
   'A message box will pop-up whenever
   'a new message is received

   Private Sub objSMS_NewMessageReceived(ByVal sender As Object, _
               ByVal e As mCore.NewMessageEventArgs) _
               Handles objSMS.NewMessageReceived

      MsgBox("FROM: " & e.Phone & vbCrLf & vbCrLf & _
         "DATE/TIME: " & e.TimeStampRFC & vbCrLf & vbCrLf & _
         "MESSAGE:" & vbCrLf & e.TextMessage, _
         MsgBoxStyle.Information, "NEW MESSAGE RECEIVED")

   End Sub

   Public Sub SetCommParameters()
      Try
         objSMS.Port = "COM1"
         objSMS.BaudRate = mCore.BaudRate.BaudRate_19200
         objSMS.DataBits = mCore.DataBits.Eight
         objSMS.StopBits = mCore.StopBits.One
         objSMS.Parity = mCore.Parity.None
         objSMS.FlowControl = mCore.FlowControl.RTS_CTS

      Catch ex As mCore.GeneralException
         MsgBox(ex.Message)
      Catch ex As Exception
      End Try
   End Function
End Class

 
C#

class MyClass
{
   public mCore.SMS objSMS = new mCore.SMS();

   public MyClass()

   {
      try
      {
         SetCommParameters();
         objSMS.NewMessageIndication = true;
         objSMS.NewMessageConcatenate = true;
         objSMS.AutoDeleteNewMessage = true
      }
      catch (mCore.GeneralException e)
      {
         MessageBox.Show(e.ToString());
      }

      objSMS.NewMessageReceived +=
         new mCore.SMS.NewMessageReceivedHandler(objSMS_NewMessageReceived);
   }

   //New Message Event Handling
   //A message box will pop-up whenever
   //a new message is received

   private void objSMS_NewMessageReceived
      (object sender, mCore.NewMessageEventArgs e)
   {
      MessageBox.Show("NEW MESSAGE RECEIVED" + "\r\n" +
         "FROM: " + e.Phone + "\r\n" +
         "DATE/TIME: " + e.TimeStampRFC + "\r\n" +
         "MESSAGE:" + "\r\n" + e.TextMessage);
   }

   public static void SetCommParameters()
   {
      try
      {
         objSMS.Port = "COM1";
         objSMS.BaudRate = mCore.BaudRate.BaudRate_19200;
         objSMS.DataBits = mCore.DataBits.Eight;
         objSMS.StopBits = mCore.StopBits.One;
         objSMS.Parity = mCore.Parity.None;
         objSMS.FlowControl = mCore.FlowControl.RTS_CTS;
      }

      catch (mCore.GeneralException e)
      {
         MessageBox.Show(e.ToString());
      }
      catch (Exception e)
      {
      }
   }
}

See Also:

mCore.SMS.NewMessageIndication Property
mCore.SMS.AutoDeleteNewMessage Property
mCore.SMS.NewMessageReceived Event
mCore.NewMessageReceivedEventArgs Class

 

Copyright © IG Logix Softech Pvt Ltd, All Rights Reserved