class SmsClass { SerialPort serialPort; public SmsClass(string comPort) { this.serialPort = new SerialPort(); this.serialPort.PortName = comPort; this.serialPort.BaudRate = 9600; //what is BaudRate and why we use 9600 not other? this.serialPort.Parity = Parity.None;//if parity is for error checking then why we set Parity.None? this.serialPort.DataBits = 8;// what is Databits? this.serialPort.StopBits = StopBits.One; this.serialPort.Handshake = Handshake.RequestToSend;// what is Handshake do? this.serialPort.DtrEnable = true; this.serialPort.RtsEnable = true; this.serialPort.NewLine = System.Environment.NewLine; } public bool sendSms(string cellNo, string sms) { string messages = null; messages = sms; if (this.serialPort.IsOpen == true) { try { this.serialPort.WriteLine("AT" + (char)(13));// why we set char 13? Thread.Sleep(4); this.serialPort.WriteLine("AT+CMGF=1" + (char)(13));//also here char 13? Thread.Sleep(5); this.serialPort.WriteLine("AT+CMGS=\"" + cellNo + "\""); Thread.Sleep(10); this.serialPort.WriteLine(">" + messages + (char)(26));//why we set char 26 here? } catch (Exception ex) { MessageBox.Show(ex.Source); } return true; } else return false; }
this.serialPort.WriteLine("AT" + (char)(13));// why we set char 13?
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)