|
发送部分主程序:
void main ()
{
// parse_arguments (argc, argv);
//char cmd[16]; // 命令串
//char pdu[512]; // PDU串
char ans[218]; // 应答串
/* open comport */
char buf[] = "AT+CMGS=?\r"; //测试手机是否支持相关AT指令
char atbuf[] = "ATE1\r"; //回显
char smscsq[] = "AT+CSQ\r";
char smstype[] = "AT+CMGF=0\r";
char smsend[] = "AT+CMGS=25\r"; //41
char pdu[] =
"0891688106036039F111000D91685198367879F60000000BE8329BFD06DDDF723619\x1a";//发送信息
int i;
int flag; OpenComPort (2, 115200, 8, "1", 'N');
usleep (2000);
WriteComPort (buf, sizeof (buf));
usleep (2000);
WriteComPort (atbuf, sizeof (atbuf));
usleep (2000);
WriteComPort (smscsq, sizeof (smscsq));
usleep (2000);
WriteComPort (smstype, sizeof (smstype));
usleep (2000);
WriteComPort (smsend, sizeof (smsend));
usleep (2000);
printf ("the sms is sending........\n");
usleep (20000);
WriteComPort (pdu, sizeof (pdu)); // 得到肯定回答,继续输出PDU串
usleep (10000);
SetPortSig ();
while (1) {
if (getnumf == 1) {
for (i = 0; i < 32; i++)
numbuf = '\0';
getnumf = 0;
}
}
printf ("err");
CloseComPort ();
exit (0);
}
发送的字符为:E8329BFD06DDDF723619(“Hello World"),但是在输出中没有出现这个,产生了截断,请帮忙分析下原因。
|
|