返回首页

错误1找不到类型或命名空间名称#39#39; ShortMessageCollection;(是否缺少using指令或程序集引用)C:\用户\ prashant \文档\ Visual Studio中... |

public ShortMessageCollection ReadSMS(SerialPort port)

       {

           // Set up the phone and read the messages

           ShortMessageCollection messages = null;

           try

           {

               #region Execute Command

               // Check connection

               ExecCommand(port, "AT", 300, "No phone connected");

               // Use message format "Text mode"

               ExecCommand(port, "AT+CMGF=1", 300, "Failed to set message format.");

               // Use character set "PCCP437"

               ExecCommand(port, "AT+CSCS=\"PCCP437\"", 300,

               "Failed to set character set.");

               // Select SIM storage

               ExecCommand(port, "AT+CPMS=\"SM\"", 300,

               "Failed to select message storage.");

               // Read the messages

               string input = ExecCommand(port, "AT+CMGL=\"ALL\"", 5000,

                   "Failed to read the messages.");

               #endregion

 

               #region Parse messages

               messages = ParseMessages(input);

               #endregion

           }

           catch (Exception ex)

           {

               throw new Exception(ex.Message);

           }

 

           if (messages != null)

               return messages;

           else

               return null;

       }

回答