示例#1
0
        /// <summary>
        /// http://www.developershome.com/sms/cpmsCommand.asp
        /// </summary>
        public void Cpms(CpmsStorageArea readAndDelete, CpmsStorageArea?sendAndWrite, CpmsStorageArea?receivedMessages)
        {
            //AT+CPMS="ME","SM","MT"
            var commands = new List <string> {
                string.Format("\"{0}\"", readAndDelete)
            };

            if (sendAndWrite.HasValue)
            {
                commands.Add(string.Format("\"{0}\"", sendAndWrite));
            }
            if (receivedMessages.HasValue)
            {
                commands.Add(string.Format("\"{0}\"", receivedMessages));
            }
            GetATCommandResponse(string.Format("AT+CPMS={0}\r", string.Join(",", commands.ToArray())));
        }
示例#2
0
        public void CpmsQuery(out CpmsStorageArea[] readAndDelete, out CpmsStorageArea[] sendAndWrite, out CpmsStorageArea[] receivedMessages)
        {
            //+CPMS: ("ME","SM"),("ME","SM"),("MT")
            var response = GetATCommandResponse("AT+CPMS=?\r");
            var m = Regex.Match(response,
                        @"\+CPMS: \((?<1>('[A-Z]+',?)+)\),\((?<2>('[A-Z]+',?)+)\),\((?<3>('[A-Z]+',?)+)\)".Replace("'", "\""));
            if (!m.Success ||
                !m.Groups["1"].Success ||
                !m.Groups["2"].Success ||
                !m.Groups["3"].Success)
            {
                throw new IOException("Didn't get success response from device.");
            }

            readAndDelete = EnumerableHelper.ToArray(ParseCpmsGroup(m.Groups["1"].Value));
            sendAndWrite = EnumerableHelper.ToArray(ParseCpmsGroup(m.Groups["2"].Value));
            receivedMessages = EnumerableHelper.ToArray(ParseCpmsGroup(m.Groups["3"].Value));
        }
示例#3
0
 /// <summary>
 /// http://www.developershome.com/sms/cpmsCommand.asp
 /// </summary>
 public void Cpms(CpmsStorageArea readAndDelete, CpmsStorageArea? sendAndWrite, CpmsStorageArea? receivedMessages)
 {
     //AT+CPMS="ME","SM","MT"
     var commands = new List<string> {string.Format("\"{0}\"", readAndDelete)};
     if (sendAndWrite.HasValue)
         commands.Add(string.Format("\"{0}\"", sendAndWrite));
     if (receivedMessages.HasValue)
         commands.Add(string.Format("\"{0}\"", receivedMessages));
     GetATCommandResponse(string.Format("AT+CPMS={0}\r", string.Join(",", commands.ToArray())));
 }