mCore™ .NET SMS Library 1.2

mCore.SMS.DelayAfterPIN Property

Description:

The DelayAfterPIN property gets or sets a value in milliseconds (integer value) for which mCore will wait for the modem to get ready to respond to commands after sending the PIN (if the SIM is PIN protected). The value should be between 1 and 60000 (default value is 15000).

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

Remarks:

Exceptions:

mCore.GeneralException

Usage Example:

Visual Basic

Public Class MyClass
   Public WithEvents objSMS As New mCore.SMS
   Public Sub SendMessage()

      Dim strMsg As String
      strMsg = "This is a very long text message and it has more than one _
               hundred sixty characters in it. This is to test how the _
               long message will be sent using mCore .NET SMS Library."
      Try
         SetCommParameters()
         objSMS.PIN = "1234"
         objSMS.DelayAfterPIN = 30000
         objSMS.Encoding = mCore.Encoding.GSM_Default_7Bit
         objSMS.LongMessage = mCore.LongMessage.Concatenate
         Try
            objSMS.SendSMS("+919873094767", strMsg)
            MsgBox("Message Sent!")
         Catch ex As mCore.SMSSendException
            MsgBox("Message Failed!" & vbCrLf & ex.Message)
         End Try

      Catch ex As mCore.GeneralException
         MsgBox(ex.Message, MsgBoxStyle.Critical, "mCore Demo")
      Catch ex As Exception
      End Try
   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 static void NetworkInformation()
   {
      string strMsg = "This is a very long text message and";
      strMsg = strMsg + " it has more than one hundred sixty";
      strMsg = strMsg + " characters in it. This is to test how";
      strMsg = strMsg + " the long message will be sent using";
      strMsg = strMsg + " mCore .NET SMS Library.";
      try
      {

         SetCommParameters();
         objSMS.PIN = "1234";
         objSMS.DelayAfterPIN = 30000;
         objSMS.Encoding = mCore.Encoding.GSM_Default_7Bit;
         objSMS.LongMessage = mCore.LongMessage.Concatenate;
         try
         {
            objSMS.SendSMS("+919873094767", "This is a test message");
            MessageBox.Show("Message Sent!");
         }
         catch (mCore.SMSSendException e)
         {
            MessageBox.Show("Message Failed!" + "\r\n" + e.ToString());
         }
      }

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

   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.Network Property
mCore.SMS.DisableCheckPIN Property
mCore.SMS.PIN Property

 

Copyright © IG Logix Softech Pvt Ltd, All Rights Reserved