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

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

 2010-06-22 03:15:00 来源:WEB开发网   
核心提示:}break;///case NMEAState.NP_STATE_CHECKSUM_1:if( (btData - '0') <= 9){receivedChecksum = (byte)((btData - '0') << 4);}else{receivedChec

}

break;

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

case NMEAState.NP_STATE_CHECKSUM_1:

if( (btData - '0') <= 9)

{

receivedChecksum = (byte)((btData - '0') << 4);

}

else

{

receivedChecksum = (byte)((btData - 'A' + 10) << 4);

}

nState = NMEAState.NP_STATE_CHECKSUM_2;

break;

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

case NMEAState.NP_STATE_CHECKSUM_2:

if( (btData - '0') <= 9)

{

receivedChecksum |= (byte)((btData - (byte)'0'));

}

else

{

receivedChecksum |= (byte)((btData - (byte)'A' + 10));

}

if(checksum == receivedChecksum)

{

ProcessCommand(EncodeToString(command), data);

}

nState = NMEAState.NP_STATE_SOM;

break;

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

default :

nState = NMEAState.NP_STATE_SOM;

break;

}

}

#region INMEAProtocol Members

public void ProcessGPRMB(GPRMBData gprmc)

{

// TODO: Add NMEAProtocol.ProcessGPRMB implementation

}

public void ProcessGPZDA(GPZDAData gpzda)

{

// TODO: Add NMEAProtocol.ProcessGPZDA implementation

}

public void ProcessGPRMC(string data)

{

string[] fields = Regex.Split(data, ",");

//Time: Hour, Minute, Second

//Time is Zulu

GPRMC.Hour = Convert.ToInt32(fields[0].Substring(0, 2));

GPRMC.Minute = Convert.ToInt32(fields[0].Substring(2, 2));

GPRMC.Second = Convert.ToInt32(fields[0].Substring(4, 2));

GPRMC.Day = Convert.ToInt32(fields[8].Substring(0, 2));

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

Tags:Windows mobile gps

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