crosfarms.blogg.se

Send sms from pc to mobile online
Send sms from pc to mobile online












send sms from pc to mobile online

String recievedData = ExecCommand(port, "AT", 300, "No phone connected") Public bool sendMsg(SerialPort port, string PhoneNo, string Message) Static AutoResetEvent readNow = new AutoResetEvent(false) ShortMessageCollection messages = new ShortMessageCollection() Public ShortMessageCollection ParseMessages(string input) String input = ExecCommand(port, p_strCommand, 5000, "Failed to read the messages.") Set up the phone and read the messagesĮxecCommand(port, "AT", 300, "No phone connected") ĮxecCommand(port, "AT+CMGF=1", 300, "Failed to set message format.") ĮxecCommand(port, "AT+CSCS=\"PCCP437\"", 300, "Failed to set character set.") ĮxecCommand(port, "AT+CPMS=\"SM\"", 300, "Failed to select message storage.") Public ShortMessageCollection ReadSMS(SerialPort port, string p_strCommand) RecievedData = "Following error occured while counting the message" + recievedError #region Error in Counting total number of SMS #region If command is not executed successfully String strMessageExist1 = strSplit //Msgs exist in SMĬountTotalMessages = Convert.ToInt32(strMessageExist1) String strMessageStorageArea1 = strSplit //SM String strSplit = recievedData.Split(',') If ((recievedData.Length >= 45) & (recievedData.StartsWith("AT+CPMS?"))) #region If command is executed successfully Int uReceivedDataLength = recievedData.Length RecievedData = ExecCommand(port, command, 1000, "Failed to count SMS message") RecievedData = ExecCommand(port, "AT+CMGF=1", 300, "Failed to set message format.") String recievedData = ExecCommand(port, "AT", 300, "No phone connected at ") Public int CountSMSmessages(SerialPort port) Throw new ApplicationException("No data received from phone.") Throw new ApplicationException("Response received is incomplete.") Public string ReadResponse(SerialPort port, int timeout) Public void port_DataReceived(object sender, SerialDataReceivedEventArgs e) Throw new ApplicationException("No success message was received.")

send sms from pc to mobile online

String input = ReadResponse(port, responseTimeout) Public string ExecCommand(SerialPort port, string command, int responseTimeout, string errorMessage) Port.DataReceived -= new SerialDataReceivedEventHandler(port_DataReceived) Port.DataReceived += new SerialDataReceivedEventHandler(port_DataReceived) Port.Encoding = Encoding.GetEncoding("iso-8859-1") Port.WriteTimeout = p_uWriteTimeout //300 Public SerialPort OpenPort(string p_strPortName, int p_uBaudRate, int p_uDataBits, int p_uReadTimeout, int p_uWriteTimeout) This is the class for Sending SMS using System MessageBox.Show("Failed to send message") MessageBox.Show("Message has sent successfully")

send sms from pc to mobile online

Private void sendsms_Click(object sender, EventArgs e) Sw = new StreamWriter(sPathName + sErrorTime + ".txt", true) String sErrorTime = sDay + "-" + sMonth + "-" + sYear string sPathName = sPathName = sYear = () String sLogFormat = ().ToString() + " " + ().ToString() + " => " Private void btnDisconnect_Click(object sender, EventArgs e) String ports = SerialPort.GetPortNames() Private void SmsForm_Load(object sender, EventArgs e) MessageBox.Show("Invalid port settings") MessageBox.Show("Modem is connected at PORT " + ) This.port = objclsSMS.OpenPort(, Convert.ToInt32(), Convert.ToInt32(), Convert.ToInt32(), Convert.ToInt32()) Private void btnOK_Click(object sender, EventArgs e) Private void WriteStatusBar(string status) ShortMessageCollection objShortMessageCollection = new ShortMessageCollection() If any additional questions you want to ask me then do let me know please.

send sms from pc to mobile online

Send sms from pc to mobile online code#

This code is running successfully, i am sending message through AT Commands, i have searched google and even in stackoverflow, the information given is not matching with my requirements, so i am writing the code below, if you can give me some suggestions, please tell me. I am able to send an sms from computer to mobile, but i am not able to send multiple sms from pc.














Send sms from pc to mobile online