mCore™ .NET SMS Library 1.2

mCore.SMS.SignalStrength Property

Description:

The SignalStrength property gets a integer value that contains the GSM network field strength in percentage i.e. scale of 0 to 100 where 0 corresponds to signal strength of -113dBm or less and 100 corresponds to signal strength value of -51dBm or more.

Returns a value -1 if the signal strength is not known or not detectable


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 NetworkInformation()
      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(" NETWORK INFORMATION")
         Console.WriteLine("******************************")
         Console.WriteLine(" Network: " & objSMS.Network)
         Console.WriteLine(" Signal Strength: " & objSMS.SignalStrength.ToString() & "%")
         Console.WriteLine(" Signal Strength (dB): " & objSMS.SignalStrengthDB.ToString() & "dB")

      Catch ex As mCore.GeneralException
         Console.WriteLine(ex.Message)
      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)
      Catch ex As Exception
      End Try
   End Function
End Class

 
C#

class MyClass
{
   public mCore.SMS objSMS = new mCore.SMS();
   public static void NetworkInformation()
   {
      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(" NETWORK INFORMATION");
         Console.WriteLine("******************************");
         Console.WriteLine(" Network: " + objSMS.Network);
         Console.WriteLine(" Signal Strength: " + objSMS.SignalStrength.ToString() + "%");
         Console.WriteLine(" Signal Strength (dB): " + objSMS.SignalStrengthDB.ToString() + "dB");
      }

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

 

Copyright © IG Logix Softech Pvt Ltd, All Rights Reserved