Symbian 震动报警系统 源代码
2010-05-24 17:01:00 来源:WEB开发网uint cnt = 0;
while (1)
{
ch = RecvChar();
if (cnt < len-1
&& ‘ ’ != ch)
{
string[cnt++] = ch;
}
else
{
string[cnt] = 0;
break;
}
}
return cnt;
}
//////////////////////////////////////////////////////////
#define MAX_BUFFER_LENGTH 50
#define DEF_PHONE_NOMBER_LENGTH 8
#define DEF_PHONE_NOMBER (“52715299″)
//////////////////////////////////////////////////////////
void main()
{
int i = 0;
int cnt = 0;
uchar buffer[MAX_BUFFER_LENGTH] = {0};
uchar value = 0xff;
uchar cmp1[9] = {“^SYSSTART”};
uchar cmp2[10] = {“NO CARRIER”};
IniUart();
//激发GSM模块
P1 = 0xff;
delay(800);
P1 = 0×00;
delay(800);
P1 = 0xff;
//读取GSM模块启动标志
cnt = RecvString(buffer,MAX_BUFFER_LENGTH);
i=0;
if (9 <= cnt)
{
for (i=0;i
{
if (cmp1[i] != buffer[i])
{
break;
}
}
}
if (i==cnt)
{//正确启动
}
while (1)
{
//等待事件到来
P2 = 0xff;
value = P2;
value &= 0×01;
while (0×01 == value)
{
P2 = 0xff;
value = P2;
value &= 0×01;
}
//拔打电话
SendString(“ath;”,4);
SendChar(‘’);
SendChar(‘ ’);
delay(800);
SendString(“atd “,4);
SendString(DEF_PHONE_NOMBER,DEF_PHONE_NOMBER_LENGTH);
SendChar(‘;’);
更多精彩
赞助商链接