Example #1
0
        private void SendPDUSMS(SendPDU sms)
        {
            if (sms == null)
            {
                return;
            }

            manage.SendSMS(sms.CommandPart1, sms.CommandPart2);
        }
Example #2
0
        private void ShowPDU(SendPDU sms)
        {
            if (sms == null)
            {
                return;
            }

            TextBoxShowPDU.Text  = "";
            TextBoxShowPDU.Text += sms.CommandPart1;
            TextBoxShowPDU.Text += sms.CommandPart2;
        }
Example #3
0
        private SendPDU EncodetoPDU()
        {
            try
            {
                MessageFormat mode = new MessageFormat(SMSMode.PDU);

                long number;
                long.TryParse(TextBoxPhoneNumberPDU.Text, out number);

                PDU _pdu = new PDU();
                _pdu._1stOctet = new FirstOctet
                {
                    Message_type_indicator     = TP_MTI.SMSSUBMIT,
                    Reject_duplicates          = false,
                    Reply_path                 = (bool)CheckBoxReplyPathExist.IsChecked,
                    Status_report_request      = (bool)CheckBoxRequestDeliveryReport.IsChecked,
                    User_data_header_indicator = false,
                    Validity_Period_Format     = TP_VPI.Relative
                };

                if (CheckBoxFlashSMS.IsChecked == true)
                {
                    _pdu.DataCodingScheme = TP_DSC._7bitFlashSMS;
                }
                else
                {
                    _pdu.DataCodingScheme = TP_DSC._7bit;
                }

                if (CheckBoxRequestDeliveryReport.IsChecked == false)
                {
                    _pdu.ValidityPeriod = -1;
                }
                else
                {
                    _pdu.ValidityPeriod = ComboBoxValidityPeriodPDU.SelectedIndex;
                }

                _pdu.PhoneNumber = number.ToString();
                _pdu.UserData    = TextBoxSMSContentPDU.Text;


                string  result      = _pdu.EncodedTextInPDU;
                int     lengthOfSMS = (result.Length - 2) / 2;
                SendPDU sms         = new SendPDU(lengthOfSMS, result);

                return(sms);
            }
            catch (Exception ex)
            {
                ShowMSG(ex.Message, 5 * 1000);
                return(null);
            }
        }