Aquino, Richard F. Daitan, R B. Rodriguez, Joshua Benjamin B. Sarong, Christopher B.
BSCpE 5-4
Submitted to:
Engr. Allan B. Verzo Instructor
Date Submitted: Schedule: July 14, 2014 M/M 7:30-10:30AM/10:30-1:30PM
Republic of the Philippines POLYTECHNIC UNIVERSITY OF THE PHILIPPINES COLLEGE OF ENGINEERING DEPARTMENT OF COMPUTER ENGINEERING
OBJECTIVES:
To launch an external application once the GSM Modem receives a message.
MATERIALS:
Computer x1 Broadband Stick x1 Cellphone
PROCEDURE:
1. Study AT Commands. 2. Connect Broadband Stick to PC. 3. Verify that its working using AT Commands. 4. Start Coding 5. Verify that the program is working.
CONCLUSION: AT Commands are an important part in IO projects because it allows communication to devices that enable wireless connectivity like SMS.
SCREENSHOTS:
SOURCE CODE:
using System; using System.IO.Ports; using System.Threading;
namespace Kippenberger {
public class GsmComm { public SerialPort GsmPort;
private const int BAUDRATE = 9600; private const int DATABITS = 8; private const int SLEEPTIME = 5;
using System; using System.IO.Ports; using System.Text.RegularExpressions; using System.Threading; using Gtk; using IO_SMS_GUI;
public partial class MainWindow: Gtk.Window {
public MainWindow () : base (Gtk.WindowType.Toplevel) { Project.Sms = new Kippenberger.GsmComm (); Project.Sms.GsmPort.DataReceived += new SerialDataReceivedEventHandler (OnMessageReceived);
protected void OnMessageReceived (object sender, SerialDataReceivedEventArgs e) { // Sleep thread to delay execution of Read() when AT+CGML="ALL" is executed // Sleep time must be greater than sleep time in AT+CGML="ALL" Thread.Sleep (1500); //Console.WriteLine (Project.Sms.Read()); string receivedData = Project.Sms.Read ();
if (Regex.IsMatch (receivedData, Regex.Escape ("+CMTI:"))) { Project.ExecFromMessage (receivedData); } }