/* 
 * File:   FsLink.hpp
 * Author: jens
 *
 * Created on 9. Januar 2015, 20:14
 */

#ifndef IFSLINK_HPP
#define	IFSLINK_HPP

struct FlightData
{
	enum State
	{
		STATE_INVALID = 0,
		STATE_STOPPED,
		STATE_PAUSED,
		STATE_ACTIVE,
	};
	
	FlightData() {}
	~FlightData() {}
	State state;
	bool isReady, isPaused, isParked, isOnGround;
	unsigned long timeZulu;
	double lat, lon, alt_meter, alt_feet, gl_meter, bank_deg, pitch_deg, hdgTrue_deg, hdgMag_deg, gs_meterPerSec, gs_knots, tas_knots, ias_knots, bpa_knots, vs_feetPerMin, magVar_deg;
	double framerate;
	char aircraftTitle[256];
	char tcasStr[15];
	char tcasStr2[15];
	char flightname[252];
	char atcFlightNumStr[12];
	char atcFlightIDStr[12];
	char atcAirlineStr[24];
	char atcAircraftTypeStr[24];
	
	const FlightData& operator=(const FlightData &rhs)
	{
		state = rhs.state;
		isReady = rhs.isReady;
		isPaused = rhs.isPaused;
		isParked = rhs.isParked;
		isOnGround = rhs.isOnGround;
		lat = rhs.lat;
		lon = rhs.lon;
		alt_meter = rhs.alt_meter;
		alt_feet = rhs.alt_feet;
		gl_meter = rhs.gl_meter;
		bank_deg = rhs.bank_deg;
		pitch_deg = rhs.pitch_deg;
		hdgTrue_deg = rhs.hdgTrue_deg;
		hdgMag_deg = rhs.hdgMag_deg;
		gs_meterPerSec = rhs.gs_meterPerSec;
		gs_knots = rhs.gs_knots;
		tas_knots = rhs.tas_knots;
		ias_knots = rhs.ias_knots;
		bpa_knots = rhs.bpa_knots;
		vs_feetPerMin = rhs.vs_feetPerMin;
		magVar_deg = rhs.magVar_deg;
		framerate = rhs.framerate;

		memcpy(aircraftTitle, rhs.aircraftTitle, sizeof(aircraftTitle));
		memcpy(tcasStr, rhs.tcasStr, sizeof(tcasStr));
		memcpy(tcasStr2, rhs.tcasStr2, sizeof(tcasStr2));
		memcpy(flightname, rhs.flightname, sizeof(flightname));
		memcpy(atcFlightNumStr, rhs.atcFlightNumStr, sizeof(atcFlightNumStr));
		memcpy(atcFlightIDStr, rhs.atcFlightIDStr, sizeof(atcFlightIDStr));
		memcpy(atcAirlineStr, rhs.atcAirlineStr, sizeof(atcAirlineStr));
		memcpy(atcAircraftTypeStr, rhs.atcAircraftTypeStr, sizeof(atcAircraftTypeStr));

		return *this;
	}
};

struct IFsLink
{
    IFsLink() {}
    virtual ~IFsLink() {}
    
    virtual const char* getLinkState() = 0;
    virtual const char* getFlightState() = 0;
	virtual FlightData getFlightData() = 0;
};

struct IFsLinkListener
{
    IFsLinkListener() {}
    virtual ~IFsLinkListener() {}
    
    virtual void onStateChanged(IFsLink &obj) = 0;
    virtual void onDataChanged(IFsLink &obj) = 0;
};

#endif	/* IFSLINK_HPP */

