WEB开发网
开发学院手机开发Windows Mobile 开发 Windows mobile gps 串口通信 NMEA命令和数据处理... 阅读

Windows mobile gps 串口通信 NMEA命令和数据处理

 2010-06-22 03:15:00 来源:WEB开发网   
核心提示:case NMEAState.NP_STATE_SOM :if(btData == '$'){checksum = 0; // reset checksumindex = 0; // reset indexnState = NMEAState.NP_STATE_CMD;}break;/ Retrieve

case NMEAState.NP_STATE_SOM :

if(btData == '$')

{

checksum = 0; // reset checksum

index = 0; // reset index

nState = NMEAState.NP_STATE_CMD;

}

break;

///////////////////////////////////////////////////////////////////////

// Retrieve command (NMEA Address)

case NMEAState.NP_STATE_CMD :

if(btData != ',' && btData != '*')

{

command[index++] = btData;

checksum ^= btData;

// Check for command overflow

if(index >= NP_MAX_CMD_LEN)

{

nState = NMEAState.NP_STATE_SOM;

}

}

else

{

command[index] = (byte)''; // terminate command

checksum ^= btData;

index = 0;

nState = NMEAState.NP_STATE_DATA; // goto get data state

}

break;

///////////////////////////////////////////////////////////////////////

// Store data and check for end of sentence or checksum flag

case NMEAState.NP_STATE_DATA:

if(btData == '*') // checksum flag?

{

data[index] = (byte)'';

nState = NMEAState.NP_STATE_CHECKSUM_1;

}

else // no checksum flag, store data

{

//

// Check for end of sentence with no checksum

//

if(btData == '')

{

data[index] = (byte) '';

ProcessCommand(EncodeToString( command), data);

nState = NMEAState.NP_STATE_SOM;

return;

}

//

// Store data and calculate checksum

//

checksum ^= btData;

data[index] = btData;

if(++index >= NP_MAX_DATA_LEN) // Check for buffer overflow

{

nState = NMEAState.NP_STATE_SOM;

}

上一页  1 2 3 4 5 6 7  下一页

Tags:Windows mobile gps

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