【发布时间】:2012-03-06 16:02:37
【问题描述】:
我在通过 putty 读取短信时遇到问题,因为我输入 AT+CMGL="ALL" 但消息(文本)和数字只是数字,我读到我的 gms 调制解调器 nokia s10 使用 UCS2,但是我不知道在这里做什么?我怎样才能阅读我的信息而不是只看到数字?请帮忙
我也在使用 codeproject 中的这段代码,我改变了这一行,但结果与 putty 相同,只是 ucs2 中的数字
public ShortMessageCollection ReadSMS(SerialPort port, string p_strCommand)
{
// 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=\"UCS2\"", 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, p_strCommand, 5000, "Failed to read the messages.");
#endregion
#region Parse messages
messages = ParseMessages(input);
#endregion
}
catch (Exception ex)
{
throw ex;
}
if (messages != null)
return messages;
else
return null;
}
【问题讨论】:
标签: c# sms nokia at-command