Example #1
0
        public static SMSSubmit DeactivateVoicemailIndication()
        {
            SMSSubmit sms = new SMSSubmit(new TextMessage());

            sms.Indication.Operation = MessageIndicationOperation.Discard;
            sms.Indication.Type = IndicationType.Voicemail;
            sms.Indication.IsActive = false;

            return sms;
        }
Example #2
0
        public static SMSSubmit ReplacebleMessage(string text)
        {
            TextMessage textMessage = new TextMessage();
            textMessage.Text = text;

            SMSSubmit sms = new SMSSubmit();
            sms.MessageToSend = textMessage;

            sms.ProtocolIdentifier = new ProtocoldentifierBuilder(ShortMessageType.ReplaceMessageType1).ToByte();

            return sms;
        }
Example #3
0
        public static SMSSubmit FlashMessage()
        {
            TextMessage textMessage = new TextMessage();
            textMessage.DataEncoding = DataEncoding.Default7bit;
            textMessage.Text = "Flash message from SharpSMS!";

            SMSSubmit sms = new SMSSubmit();
            sms.MessageToSend = textMessage;
            sms.Indication.Class = MessageClass.ImmediateDisplay;

            return sms;
        }
Example #4
0
        public static SMSSubmit PlainText()
        {
            TextMessage textMessage = new TextMessage();
            textMessage.DataEncoding = DataEncoding.Default7bit;
            textMessage.Text = "Hello World from SharpSMS!";

            SMSSubmit sms = new SMSSubmit();
            sms.MessageToSend = textMessage;

            // SMS center will retry the delivery for 5 days
            sms.ValidityPeriod = new TimeSpan(5, 0, 0, 0);

            return sms;
        }
Example #5
0
        public static SMSSubmit ActivateVoicemailIndication()
        {
            TextMessage textMessage = new TextMessage();
            textMessage.Text = "You have a voicemail.";

            SMSSubmit sms = new SMSSubmit();
            sms.MessageToSend = textMessage;

            sms.Indication.Operation = MessageIndicationOperation.Discard;
            sms.Indication.Type = IndicationType.Voicemail;
            sms.Indication.IsActive = true;

            return sms;
        }
Example #6
0
        static void Main(string[] args)
        {
            Modem modem = new Modem("COM3", 115200);

            while (true)
            {
                PrintMenu();
                ConsoleKeyInfo key = Console.ReadKey(true);
                SMSSubmit sms = new SMSSubmit();

                switch (key.KeyChar)
                {
                    case '1':
                    sms = SampleMessage.PlainText();
                    break;
                    case '2':
                    sms = SampleMessage.FlashMessage();
                    break;
                    case '3':
                    sms = SampleMessage.ReplacebleMessage("This message will be replaced: FOO");
                    break;
                    case '4':
                    sms = SampleMessage.ReplacebleMessage("This is replacement message: BAR");
                    break;
                    case '5':
                    sms = SampleMessage.ActivateVoicemailIndication();
                    break;
                    case '6':
                    sms = SampleMessage.DeactivateVoicemailIndication();
                    break;
                    case '7':
                    sms = SampleMessage.ServiceIndicationMessage();
                    break;
                    case '8':
                    sms = SampleMessage.ServiceLoadingMessage();
                    break;
                    case '9':
                    sms = SampleMessage.WapPushConfiguration();
                    break;
                    case '0':
                    return;
                }

                Console.Write("\nEnter phone number: ");
                sms.PhoneNumber = Console.ReadLine();

                modem.SendSMS(sms);
            }
        }