- added adjustable KML update interval - prepared for .kmz git-svn-id: http://moon:8086/svn/software/trunk/projects/FsTrack@125 b431acfa-c32f-4a4a-93f1-934dc6c82436
77 lines
1.5 KiB
C++
77 lines
1.5 KiB
C++
/*
|
|
* File: FsLink.hpp
|
|
* Author: jens
|
|
*
|
|
* Created on 9. Januar 2015, 20:14
|
|
*/
|
|
|
|
#include "../JuceLibraryCode/JuceHeader.h"
|
|
|
|
#include <windows.h>
|
|
#include <FSUIPC_User.h>
|
|
#include "IKml.hpp"
|
|
#include "IFsLink.hpp"
|
|
|
|
#ifndef FSLINK_HPP
|
|
#define FSLINK_HPP
|
|
|
|
class FsLink : public IFsLink, public juce::Timer
|
|
{
|
|
public:
|
|
enum LinkState
|
|
{
|
|
ls_init = 0,
|
|
ls_disconnected,
|
|
ls_connected,
|
|
ls_paused,
|
|
ls_recording,
|
|
};
|
|
|
|
enum FlightState
|
|
{
|
|
fs_init = 0,
|
|
fs_suspend,
|
|
fs_ground,
|
|
fs_takeoff,
|
|
fs_enroute,
|
|
fs_touchdown,
|
|
};
|
|
|
|
FsLink(const char *pDocRoot);
|
|
FsLink(const FsLink& orig);
|
|
virtual ~FsLink();
|
|
void addListener(IFsLinkListener *pListener);
|
|
void setKml(IKml *pKml);
|
|
void setUpdateInterval(double seconds);
|
|
|
|
private:
|
|
ListenerList <IFsLinkListener> m_listeners;
|
|
const char *m_docRoot;
|
|
IKml *m_pKml;
|
|
const char *m_pCurrStateStr;
|
|
LinkState m_linkState;
|
|
LinkState m_linkStateNext;
|
|
FlightState m_flightState;
|
|
FlightState m_flightStateNext;
|
|
int m_kmlUpdateInterval;
|
|
int m_kmlUpdateCount;
|
|
char m_idStr[256];
|
|
char m_fsInstallPath[256];
|
|
FlightData m_flightData;
|
|
|
|
static const char *linkStateString[];
|
|
static const char *flightStateString[];
|
|
|
|
bool open();
|
|
void close();
|
|
int gatherData();
|
|
|
|
const char* getLinkState();
|
|
const char* getFlightState();
|
|
FlightData getFlightData();
|
|
void timerCallback();
|
|
};
|
|
|
|
#endif /* FSLINK_HPP */
|
|
|