#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>
#include <algorithm>
#include <map>


#define MAGELLANBASE "COM1"
#define LENGTHNMEAPOS 115
#define LENGTHGPGGA 80
#define CEKACIDOBA 119
#define POCETVET 10
 
#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

using namespace std;
extern vector<double> vPoleDelka; 
extern vector<double> vPoleSirka;
extern vector<double> vPoleVyska;
extern map<double, int> counter;
extern double MedianDelka, MedianSirka, MedianVyska;



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;
};

void ConnectAndGetSentence(string identificator, vector<string> &values);
void ConnectAndSetSentence(string Sentence);
string GetSentence(Tserial *Target, string identificator, string &data);
string GetSentence(Tserial *Target, string identificator);
void Magellan_NacteniGPS(GPSSTRUCT &gpsData, string data);
int Poloha(GPSSTRUCT &gpsData);
int Magellan_Init_Base(string COM);
int Magellan_Init_Base(string COM, double delka, double sirka, double vyska);
int Base (GPSSTRUCT gpsData);

#endif GPS_SEDLAK_H