예제 #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;
        }
예제 #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;
        }
예제 #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;
        }
예제 #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;
        }
예제 #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;
        }
예제 #6
0
파일: Program.cs 프로젝트: 0x7678/SharpSMS
        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);
            }
        }