mCore™ .NET SMS Library 1.2

mCore.SMS.Encoding Property

Description:

The Encoding property gets or sets the type of character encoding to be used for sending text messages. The character encoding can be set to one of the following types:


The Encoding property value is of type mCore.Encoding


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()
      Try
         SetCommParameters()
         objSMS.Encoding = mCore.Encoding.GSM_Default_7Bit
         objSMS.LongMessage = mCore.LongMessage.Concatenate
         Try
            objSMS.SendSMS("+919873094767", "This is a test message")
            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 SendMessage()
   {
      try
      {

            SetCommParameters();
            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.LongMessage Property
mCore.SMS.SendSMS Method

 

Copyright © IG Logix Softech Pvt Ltd, All Rights Reserved