mCore™ .NET SMS Library 1.2

mCore.SMS.IMSI Property

Description:

The IMSI property gets the unique IMSI (International Mobile Subscriber Identity) code for the SIM used in the GSM Modem or Phone as a string. Returns blank string if the modem does not support reading of IMSI information.

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

Exceptions:

mCore.GeneralException

Usage Example:

Visual Basic
Public Class MyClass
   Public WithEvents objSMS As New mCore.SMS
   Public Sub ModemInformation()
      Try
         SetCommParameters()

         ' It is not necessary to execute the 'Connect' method.
         ' Connection state is detected internally by mCore and
         ' the 'Connect' method is executed accordingly.
         objSMS.Connect()

         Console.WriteLine("******************************")
         Console.WriteLine(" MODEM INFORMATION")
         Console.WriteLine("******************************")
         Console.WriteLine(" Manufacturer: " & objSMS.Manufacturer)
         Console.WriteLine(" Model: " & objSMS.Model)
         Console.WriteLine(" Firmare Rev: " & objSMS.Revision)
         Console.WriteLine(" IMEI: " & objSMS.IMEI)
         Console.WriteLine(" IMSI: " & objSMS.IMSI)
         Console.WriteLine(" Battery Level: " & objSMS.BatteryLevel.ToString())
         Console.WriteLine(" Phone No.: " & objSMS.OwnNumber)

      Catch ex As mCore.GeneralException
         Console.WriteLine(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
         Console.WriteLine(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 ModemInformation()
   {
      try
      {

            SetCommParameters();

            // It is not necessary to execute the 'Connect' method.
            // Connection state is detected internally by mCore and
            // the 'Connect' method is executed accordingly.
            objSMS.Connect();

            Console.WriteLine("******************************");
            Console.WriteLine(" MODEM INFORMATION");
            Console.WriteLine("******************************");
            Console.WriteLine(" Manufacturer: " + objSMS.Manufacturer);
            Console.WriteLine(" Model: " + objSMS.Model);
            Console.WriteLine(" Firmare Rev: " + objSMS.Revision);
            Console.WriteLine(" IMEI: " + objSMS.IMEI);
            Console.WriteLine(" IMSI: " + objSMS.IMSI);
            Console.WriteLine(" Battery Level: " + objSMS.BatteryLevel.ToString());
            Console.WriteLine(" Phone No.: " + objSMS.OwnNumber);
      }

      catch (mCore.GeneralException e)
      {
         Console.WriteLine(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)
      {
         Console.WriteLine(e.ToString());
      }
      catch (Exception e)
      {
      }
   }
}

See Also:

mCore.SMS.Manufacturer Property
mCore.SMS.Model Property
mCore.SMS.IMEI Property
mCore.SMS.Revision Property
mCore.SMS.OwnNumber Property
mCore.SMS.BatteryLevel Property

 
 
 

Copyright © IG Logix Softech Pvt Ltd, All Rights Reserved