#ifndef GPS_SEDLAK_H
#define GPS_SEDLAK_H

#include <stdio.h>
#include <stdlib.h>
#include <conio.h>
#include <string.h>
#include <string>
#include <iostream>
#include <sstream>
#include <fstream>
#include <math.h>
#include "LatLong-UTMconversion.h"
#include "constants.h"
#include "tserial.h"
#include <vector>

#define NAVIREMOTEGPS "COM3"
#define NAVIREFERGPS "COM5"
#define MAGELLANREMOTEGPS "COM4"
#define LENGTHNMEAPOS 115
 
#define I_KOREKCE 2
#define I_POCETSAT 3
#define D_CAS 4
#define D_SIRKA 5
#define S_SIRKASEKTOR 6
#define D_DELKA 7
#define S_DELKASEKTOR 8
#define D_VYSKA 9
#define S_ID 10
#define D_UHEL 11
#define D_RYCHLOST 12
#define D_UTMX 13
#define D_UTMY 14

#define D_NCAS 1
#define D_NSIRKA 2
#define S_NSIRKASEKTOR 3
#define D_NDELKA 4
#define S_NDELKASEKTOR 5
#define I_NKVALITA 6
#define I_NPOCETSAT 7
#define D_NUTMX 8
#define D_NUTMY 9

using namespace std;

struct GPSSTRUCT{
	double d_cas, d_sirka, d_delka, d_vyska, d_uhel, d_rychlost, d_utmx, d_utmy;
	int i_korekce, i_pocetsat, i_kvalita;
	string s_sirkasektor, s_delkasektor;
};

int NacteniSoubor(void);
double Vzdalenost(string Sbod1, string Sbod2);
void PrevedStrToLL(string Sbod, double &Lat, double &Longi);
void PrevedStrToUTM(string Sbod, double &N, double &E);
void PrevedStrToUTMaLL(string Sbod, double &N, double &E, double &Lat, double &Longi);
string GetSentence(Tserial *Target, string identificator, string &data);
string GetSentence(Tserial *Target, string identificator);
int Magellan_Init_Remote(string COM);
int Magellan_Init_Base(string COM);
void Magellan_NacteniGPS(GPSSTRUCT &gpsData, string data);
int Magellan(GPSSTRUCT &gpsData);
void Navi_NacteniGPS(GPSSTRUCT &gpsData, string data);
int Navi(GPSSTRUCT &gpsData, string s_ReferGps);

#endif GPS_SEDLAK_H