日期:2014-05-17 浏览次数:21278 次
private bool SmsToModem(string userMsg, string phoneNumber)
{
bool isSuccess = false;
try
{
System.Diagnostics.Stopwatch sw = new System.Diagnostics.Stopwatch();
while (!InitModem())
{
Thread.Sleep(1000);
}
string msgCoded = SmsSerial.GetSendMsg(null, phoneNumber, userMsg); //pdu码
string back_AtCmgs = string.Empty;
string back_Pdu = string.Empty;
string back_Final = string.Empty;//写1a后的反馈
string test = string.Empty;
Byte[] bytesAtBreak;
//写AT命令-长度
sp.DiscardInBuffer();
sw.Restart();
sp.WriteLine("AT+CMGS=" + (msgCoded.Length / 2 - 1).ToString() + "\r\n");