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

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

 2010-06-01 15:56:00 来源:WEB开发网   
核心提示:int iLac = (int)strtol(szNum1,NULL,16);int iId = (int)strtol(szNum2,NULL,16);if (iLac && iId){sprintf(m_sCell.LAC,"%06d", iLac );sprintf(m_sCell.ID,&q

int iLac = (int)strtol(szNum1,NULL,16);

int iId = (int)strtol(szNum2,NULL,16);

if (iLac && iId)

{

sprintf(m_sCell.LAC,"%06d", iLac );

sprintf(m_sCell.ID,"%06d", iId );

break;

}

}

}

获取串口:

复制到剪贴板 C/C++代码

char* GetCREG( char * comPort )

{

HANDLE hCom;

int bufpos;

DCB dcb;

COMMTIMEOUTS to;

DWORD nWritten;

DWORD event;

DWORD nRead;

static char outbuf[20], buf[256];

BYTE comdevcmd[2]= {0x84, 0x00};

WCHAR m_sCom[12] = {0};

mbstowcs(m_sCom,comPort,strlen(comPort));

hCom= CreateFile( m_sCom ,GENERIC_READ|GENERIC_WRITE,0,0,OPEN_EXISTING,0,0);

if (hCom==NULL || hCom==INVALID_HANDLE_VALUE)

{

hCom= NULL;

return NULL;

}

if (!GetCommState(hCom, &dcb))

{

return "ERROR:GetCommState Failed";

}

dcb.BaudRate= CBR_115200;

dcb.ByteSize= 8;

dcb.fParity= false;

dcb.StopBits= ONESTOPBIT;

if (!SetCommState(hCom, &dcb))

{

return "ERROR:SetCommState Failed";

}

EscapeCommFunction(hCom, SETDTR);

EscapeCommFunction(hCom, SETRTS);

GetCommTimeouts(hCom, &to);

to.ReadIntervalTimeout= 0;

to.ReadTotalTimeoutConstant= 200;

to.ReadTotalTimeoutMultiplier= 0;

to.WriteTotalTimeoutConstant= 20000;

to.WriteTotalTimeoutMultiplier= 0;

SetCommTimeouts(hCom, &to);

if (!SetCommMask(hCom, EV_RXCHAR))

{

return "-8";

}

DWORD rildevresult=0,nReturned=0;

if (!DeviceIoControl (hCom,0xAAAA5679L, comdevcmd,

Tags:Windows Mobile 获取

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