Example #1
0
        /*private void DoWait()
         * {
         *      while(m_keepwaiting)
         *      {
         *              //wait on
         *              OpenNETCF.Win32.Core.WaitForSingleObject(m_eventhandle, 0xffffffff);
         *
         *              if(MessageReceived!=null)
         *              {
         *                      MessageReceived(this, new EventArgs());
         *              }
         *      }
         *
         * }
         * public event EventHandler MessageReceived;*/

        /// <summary>
        /// Sends a binary SMS message to the specified address.
        /// </summary>
        /// <param name="destination">Address of recipient.</param>
        /// <param name="message">Binary representation of message contents.</param>
        /// <returns>An identifier for the message which can be used to check the status.</returns>
        public int SendMessage(SmsAddress destination, byte[] message)
        {
            TextProviderSpecificData tpsd = new TextProviderSpecificData();

            tpsd.MessageClass = MessageClass.Class1;

            return(SendMessage(destination, message, tpsd));
        }
Example #2
0
        /// <summary>
        /// Sends a binary SMS message to the specified address with the specified provider specific options.
        /// </summary>
        /// <param name="destination">Address of recipient.</param>
        /// <param name="message">Binary representation of message contents.</param>
        /// <param name="providerData"></param>
        /// <returns>An identifier for the message which can be used to check the status.</returns>
        public int SendMessage(SmsAddress destination, byte[] message, ProviderSpecificData providerData)
        {
            int messageid = 0;

            int result = SmsSendMessage(m_handle, null, destination.ToByteArray(), null, message, message.Length, providerData, TextProviderSpecificData.Length, DataEncoding.Optimal, 0, ref messageid);


            if (result != 0)
            {
                throw new ExternalException("Error sending message");
            }

            /*string headerbytes = "";
             * int headerlen = ((TextProviderSpecificData)providerData).HeaderDataSize;
             *
             * byte[] header = ((TextProviderSpecificData)providerData).HeaderData;
             * for(int ibyte = 0; ibyte < headerlen; ibyte++)
             * {
             *      headerbytes += header[ibyte].ToString("X") + "|";
             * }
             * System.Windows.Forms.MessageBox.Show(headerbytes);*/

            return(messageid);
        }
Example #3
0
 /// <summary>
 /// Sends a text SMS message to the specified address.
 /// </summary>
 /// <param name="destination">Address of recipient.</param>
 /// <param name="message">Message body as a string.</param>
 /// <returns>An identifier for the message which can be used to check the status.</returns>
 public int SendMessage(SmsAddress destination, string message)
 {
     return(SendMessage(destination, System.Text.Encoding.Unicode.GetBytes(message)));
 }
Example #4
0
 /// <summary>
 /// Sends a text SMS message to the specified address with the specified provider specific options.
 /// </summary>
 /// <param name="destination">Address of recipient.</param>
 /// <param name="message">Message body as a string.</param>
 /// <param name="providerData">Provider specific options.</param>
 /// <returns>An identifier for the message which can be used to check the status.</returns>
 public int SendMessage(SmsAddress destination, string message, ProviderSpecificData providerData)
 {
     return(SendMessage(destination, System.Text.Encoding.Unicode.GetBytes(message), providerData));
 }