mCore™ .NET SMS Library 1.2

mCore.SMS.Connect Method

Description:

The Connect method opens the serial communication port specified in the Port property, with the serial communication parameter specified in BaudRate, Parity, DataBits, StopBits and FlowControl properties and initializes the GSM modem or phone.

Returns True if connect method is successful and returns False if Connect method fails.

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

Remarks:

It is not mandatory to call Connect method explicitly. The Connect method is called internally by mCore automatically after detecting the port connection state in following cases:

Exceptions:

mCore.GeneralException

Usage Example:

Visual Basic
Public Class MyClass
   Public WithEvents objSMS As New mCore.SMS

   Public Sub ModemConnect()
      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
         objSMS.Connect()

      Catch ex As mCore.GeneralException
         MsgBox(ex.Message, MsgBoxStyle.Critical, "mCore Demo")

      Catch ex As Exception

      End Try
   End Function
End Class
 
C#
class MyClass
{
   public mCore.SMS objSMS = new mCore.SMS();
   public static void ModemConnect()
   {
      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;
         objSMS.Connect();
      }

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

See Also:

mCore.SMS.Port Property
mCore.SMS.BaudRate Property
mCore.SMS.DataBits Property
mCore.SMS.StopBits Property
mCore.SMS.Parity Property
mCore.SMS.FlowControl Property
mCore.SMS.Timeout Property
mCore.SMS.IsConnected Property
mCore.SMS.Disconnect Method

 

Copyright © IG Logix Softech Pvt Ltd, All Rights Reserved