⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 nmea.h

📁 本书所有案例均需要单独配置
💻 H
字号:
#ifndef __NMEA_H__
#define __NMEA_H__

typedef enum tagNMEA_BOOLEAN
{
  Unknown,
  True,
  False
} NMEA_BOOLEAN;

typedef enum tagNMEA_EASTWEST
{
   EW_Unknown = 0,
   East,
   West
} NMEA_EASTWEST;

typedef enum tagNMEA_NORTHSOUTH
{
   NS_Unknown = 0,
   North,
   South
} NMEA_NORTHSOUTH;

struct NMEA_TIME
{
  WORD wHour;
  WORD wMinute;
  WORD wSecond;
};

struct NMEA_DATE
{
  WORD wYear;
  WORD wMonth;
  WORD wDay;
};

struct NMEA_ANGLE
{
  WORD Degrees;
  WORD Minutes;
  WORD Seconds;
  WORD CentiSeconds;
};

struct NMEA_LATITUDE
{
  NMEA_ANGLE Value;
  NMEA_NORTHSOUTH Northing;
};

struct NMEA_LONGITUDE
{
  NMEA_ANGLE Value;
  NMEA_EASTWEST Easting;
};

class CNmeaSentence
{
public:
//constructors / Destructors
  CNmeaSentence(const CString& sSentence) { m_Sentence = sSentence; };

//methods
  NMEA_BOOLEAN    Boolean(int nField) const;
  double          Double(int nField) const;
  NMEA_EASTWEST   EastOrWest(int nField) const;
  CString         Field(int nDesiredField) const;
  int             Integer(int nField) const;
  NMEA_NORTHSOUTH NorthOrSouth(int nField) const;
  NMEA_TIME       Time(int nField) const;
  NMEA_DATE       Date(int nField) const;
  NMEA_BOOLEAN    IsChecksumBad(int nField) const;
  NMEA_LONGITUDE  Longitude(int nPositionFieldNumber, int nEastingFieldNumber) const;
  NMEA_LATITUDE   Latitude(int nPositionFieldNumber, int nNorthingFieldNumber) const;
  NMEA_ANGLE      Angle(int nField) const;
  BYTE            ComputeChecksum() const;

  static DWORD    NmeaAngleToHundrethsOfSeconds(const NMEA_ANGLE& angle);
  static DWORD    NmeaBearingToHundrethsOfDegrees(const double& value);

protected:
  static DWORD    HexValue(const CString& sHexString);
  static inline int CNmeaSentence::HexDigitToInt(char c);

  CString m_Sentence;
};


class CRMCResponse
{
public:
//constructors / Destructors
  CRMCResponse();
  ~CRMCResponse();

//data variables
  NMEA_TIME      m_Time;
  NMEA_DATE      m_Date;
  BOOL           m_IsDataValid;
  NMEA_LATITUDE  m_Latitude;
  NMEA_LONGITUDE m_Longitude;
  double         m_SpeedOverGroundKnots;
  double         m_Bearing;

//methods
  void Empty(void);
  BOOL Parse(const CNmeaSentence& sentence);
};


class CGGAResponse
{
public:
//constructors / Destructors
  CGGAResponse();
  ~CGGAResponse();

//data variables
  int       m_GPSQuality;
  int       m_nSatellites;
  double    m_AntennaAltitudeMeters;

//methods
#ifdef _DEBUG
  void Dump(CDumpContext& dc) const;
#endif
  void Empty();
  BOOL Parse(const CNmeaSentence& sentence);
};


#endif //__NMEA_H__

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -