//void ReadNewMsg(out string msgCenter, out string phone, out string msg, out string time) //{ // Char[] temp = null; // sp.Read(temp, 0, 2); //} /// <summary> /// 按序号读取短信 /// </summary> /// <param name="index">序号</param> /// <param name="msgCenter">短信中心</param> /// <param name="phone">发送方手机号码</param> /// <param name="msg">短信内容</param> /// <param name="time">时间字符串</param> public void ReadMsgByIndex(int index, out string msgCenter, out string phone, out string msg, out string time) { string temp = string.Empty; PDUEncoding pe = new PDUEncoding(); try { temp = SendAT("AT+CMGR=" + index.ToString() + "\r"); } catch (Exception ex) { throw ex; } if (temp.Trim() == "ERROR") { throw new Exception("没有此短信"); } temp = temp.Split((char)(13))[2]; //取出PDU串(char)(13)为0x0a即\r 按\r分为多个字符串 第3个是PDU串 pe.PDUDecoder(temp, out msgCenter, out phone, out msg, out time); }