string recievedData = ExecCommand(port, "AT", 300, "No phone connected at "); recievedData = ExecCommand(port, "AT+CMGF=1", 300, "Failed to set message format."); String command = "AT+CPMS?"; recievedData = ExecCommand(port, command, 1000, "Failed to count SMS message"); int uReceivedDataLength = recievedData.Length; #endregion //We received uReceivedDataLength 34 that false the condition #region If command is executed successfully if ((recievedData.Length >= 45) && (recievedData.StartsWith("AT+CPMS?"))) { #region Parsing SMS string[] strSplit = recievedData.Split(','); string strMessageStorageArea1 = strSplit[0]; //SM string strMessageExist1 = strSplit[1]; //Msgs exist in SM #endregion #region Count Total Number of SMS In SIM CountTotalMessages = Convert.ToInt32(strMessageExist1); #endregion }
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)