namespace gps {

//	----------------------------------------------------------------------------
//	Serial Functions
//	----------------------------------------------------------------------------

	int closePort();
	int openPort(char *portNamePar, int baudRatePar);
	int getBaudRate();
	int getPortState();
	char *getPortName();
	char *getPortMessage();
	void writePort(unsigned char *bufferPtr, int len);
	int readPort(unsigned char *buffer, int maxLen, int *errorCode);
	void startGpsThread();
	void readGps();
	void readGps2();

	//	----------------------------------------------------------------------------
	//	Serial Constants
	//	----------------------------------------------------------------------------

	enum {
		SER_ERR_NO_DATA,
		SER_ERR_CRC,
		SER_ERR_MAX_LEN,
		SER_ERR_NO_PORT
	};
}
__pragma(pack(push, 1))

//	---------------------
//  msgHeader_t
//	---------------------

typedef struct {

	uint8_t h_xB5;		// header 1
	uint8_t h_x62;		// header 2
	uint8_t c_x01;		// command 1		UBX-NAV-PVT (0x01 0x07)
	uint8_t c_x07;		// command 2		UBX-NAV-PVT (0x01 0x07)
	uint16_t len;		// len = 92
	uint32_t iTOW;		// ms GPS time of week of the navigation epoch.
	uint16_t year;		// y Year(UTC)
	uint8_t month;		// month Month, range 1..12 (UTC)
	uint8_t day;		// d Day of month, range 1..31 (UTC)
	uint8_t hour;		// h Hour of day, range 0..23 (UTC)
	uint8_t min;		// min Minute of hour, range 0..59 (UTC)
	uint8_t sec;		// s Seconds of minute, range 0..60 (UTC)
	uint8_t valid;		// Validity flags(see graphic below)
	uint32_t tAcc;		// ns Time accuracy estimate(UTC)
	int32_t nano;		// ns Fraction of second, range 1e9 .. 1e9 (UTC)
	uint8_t fixType;	// GNSSfix Type :
						//		0 : no fix
						//		1 : dead reckoning only
						//		2 : 2D fix
						//		3 : 3D fix
						//		4 : GNSS + dead reckoning combined
						//		5 : time only fix
	uint8_t flags;		// Fix status flags(see graphic below)
	uint8_t flags2;		// Additional flags(see graphic below)
	uint8_t numSV;		// Number of satellites used in Nav Solution
	int32_t lon;		// 1e-7 deg Longitude
	int32_t lat;		// 1e-7 deg Latitude
	int32_t height;		// mm Height above ellipsoid
	int32_t hMSL;		// mm Height above mean sea level
	uint32_t hAcc;		// mm Horizontal accuracy estimate
	uint32_t vAcc;		// mm Vertical accuracy estimate
	int32_t velN;		// mm / s NED north velocity
	int32_t velE;		// mm / s NED east velocity
	int32_t velD;		// mm / s NED down velocity
	int32_t gSpeed;		// mm / s Ground Speed(2 D)
	int32_t headMot;	// 1e-5  deg Heading of motion(2 D)
	uint32_t sAcc;		// mm / s Speed accuracy estimate
	uint32_t headAcc;	// 1e-5  deg Heading accuracy estimate(both motion and vehicle)
	uint16_t pDOP;		// 0.01  Position DOP
	uint8_t reserv[6];	// Reserved
	int32_t headVeh;	// 1e-5  deg Heading of vehicle(2 D)
	int16_t magDec;		// 1e-2  deg Magnetic declination
	uint16_t magAcc;	// 1e-2  deg Magnetic declination accuracy
	uint8_t ck_A;		//
	uint8_t ck_B;		//
} pvtMessage_t;

__pragma(pack(pop))