WEB开发网
开发学院手机开发Windows Mobile 开发 Windows Mobile 获取基站信息(LAC,CellID) 阅读

Windows Mobile 获取基站信息(LAC,CellID)

 2010-06-01 15:56:00 来源:WEB开发网   
核心提示:sizeof(comdevcmd),0,0,0,0)){return "-9";}bufpos = 0;strcpy(outbuf,"AT+creg=2");if (!WriteFile(hCom, outbuf, 10, &nWritten, NULL)){return &qu
sizeof(comdevcmd),0,0,0,0))

{

return "-9";

}

bufpos = 0;

strcpy(outbuf,"AT+creg=2");

if (!WriteFile(hCom, outbuf, 10, &nWritten, NULL))

{

return "-10";

}

if (nWritten != 10)

{

return "-11";

}

if (!WaitCommEvent(hCom, &event, NULL))

{

return "-12";

}

while(1)

{

if (!ReadFile(hCom, buf+bufpos, 256 - bufpos, &nRead, NULL))

{

return "-13";

}

if (nRead == 0)

break;

bufpos += nRead;

if (bufpos >= 256)

break;

}

strcpy(outbuf,"AT+creg?");

if (!WriteFile(hCom, outbuf, 9, &nWritten, NULL))

{

return "-14";

}

if (nWritten != 9)

{

return "-15";

}

if (!WaitCommEvent(hCom, &event, NULL))

{

return "-16";

}

while(1)

{

if (!ReadFile(hCom, buf+bufpos, 256 - bufpos, &nRead, NULL))

{

return "-17";

}

if (nRead == 0)

break;

bufpos += nRead;

if (bufpos >= 256)

break;

}

puts(buf);

rildevresult = 0;

if (!EscapeCommFunction(hCom, CLRDTR))

{

return "-4";

}

if (hCom!=NULL)

{

CloseHandle(hCom);

hCom= NULL;

}

char* cregResponse = strpbrk( buf, "CREG" );

return cregResponse;

}

总结:

通过获取基站信息,手机可以实现定位,这对于没有GPS设备的手机来说是一个不错的想法。

上一页  1 2 3 

Tags:Windows Mobile 获取

编辑录入:coldstar [复制链接] [打 印]
赞助商链接