示例#1
0
 /// <summary>
 /// Based on SIMCOM SIM5320 chipset
 ///
 /// Serial port settings:
 /// 9600 8N1 Handshake.None
 /// </summary>
 public Fona3G(AtChannel channel)
     : base(channel)
 {
 }
示例#2
0
 /// <summary>
 /// Based on some Qualcomm chipset
 ///
 /// Serial port settings:
 /// 9600 8N1 Handshake.RequestToSend
 /// </summary>
 public MA260(AtChannel channel)
     : base(channel)
 {
 }
示例#3
0
 public ModemBase(AtChannel channel)
 {
     this.channel              = channel;
     channel.UnsolicitedEvent += Channel_UnsolicitedEvent;
 }
示例#4
0
        public static async Task Run(string port, string pin, string phoneNumber)
        {
            Console.WriteLine($"Test started ({DateTime.Now})");

            using SerialPort serialPort = new SerialPort(port, 9600, Parity.None, 8, StopBits.One)
                  {
                      Handshake = Handshake.RequestToSend
                  };
            Console.WriteLine("Opening serial port...");
            serialPort.Open();
            Console.WriteLine("Serialport opened");

            using AtChannel atChannel = new AtChannel(serialPort.BaseStream, serialPort.BaseStream);
            using IModem modem        = new DWM222(atChannel);

            modem.IncomingCall += Modem_IncomingCall;
            modem.MissedCall   += Modem_MissedCall;
            modem.SmsReceived  += Modem_SmsReceived;

            await modem.DisableEchoAsync();

            for (int i = 0; i < 1000; i++)
            {
                Console.WriteLine($"######## TEST No. {i} ########");

                var simStatus = await modem.GetSimStatusAsync();

                Console.WriteLine($"SIM Status: {simStatus}");

                if (simStatus == SimStatus.SIM_PIN)
                {
                    var simPinStatus = await modem.EnterSimPinAsync(new PersonalIdentificationNumber(pin));

                    Console.WriteLine($"SIM PIN Status: {simPinStatus}");

                    simStatus = await modem.GetSimStatusAsync();

                    Console.WriteLine($"SIM Status: {simStatus}");
                }

                var signalStrength = await modem.GetSignalStrengthAsync();

                Console.WriteLine($"Signal Strength: {signalStrength}");

                var batteryStatus = await modem.GetBatteryStatusAsync();

                Console.WriteLine($"Battery Status: {batteryStatus}");

                var productInfo = await modem.GetProductIdentificationInformationAsync();

                Console.WriteLine($"Product Information:{Environment.NewLine}{productInfo}");

                var setDateTimeResult = await modem.SetDateTimeAsync(DateTimeOffset.Now);

                Console.WriteLine($"Setting date and time: {setDateTimeResult}");

                var dateTime = await modem.GetDateTimeAsync();

                Console.WriteLine($"Date and time: {dateTime}");

                var smsTextFormatResult = await modem.SetSmsMessageFormatAsync(SmsTextFormat.Text);

                Console.WriteLine($"Setting SMS text format: {smsTextFormatResult}");

                var singleSms = await modem.ReadSmsAsync(5);

                Console.WriteLine($"Single SMS: {singleSms}");

                var smss = await modem.ListSmssAsync(SmsStatus.ALL);

                foreach (var sms in smss)
                {
                    Console.WriteLine($"SMS: {sms}");
                }

                Thread.Sleep(2500);
            }
            Console.WriteLine($"Test complete ({DateTime.Now})");
            Console.ReadKey();
        }
示例#5
0
 public MDM9225(AtChannel channel)
     : base(channel)
 {
 }
示例#6
0
 public SIM5320(AtChannel channel)
     : base(channel)
 {
 }
示例#7
0
 /// <summary>
 /// Based on Qualcomm MDM9225 chipset
 ///
 /// Serial port settings:
 /// 9600 8N1 Handshake.RequestToSend
 /// </summary>
 public DWM222(AtChannel channel)
     : base(channel)
 {
 }