UASWaypointManager.h 1012 Bytes
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44
#ifndef UASWAYPOINTMANAGER_H
#define UASWAYPOINTMANAGER_H

#include <QObject>
#include "Waypoint.h"
class UAS;

class UASWaypointManager : public QObject
{
Q_OBJECT
private:
    enum WaypointState {
        WP_IDLE = 0,
        WP_SENDLIST,
        WP_SENDLIST_SENDWPS,
        WP_GETLIST,
        WP_GETLIST_GETWPS
    }; ///< The possible states for the waypoint protocol

public:
    UASWaypointManager(UAS&);

    void handleWaypointCount(quint8 systemId, quint8 compId, quint16 count);

private:
    void getWaypoint(quint16 seq);

public slots:
    void waypointChanged(Waypoint*);
    void currentWaypointChanged(int);
    void removeWaypointId(int);
    void requestWaypoints();
    void clearWaypointList();

private:
    UAS &uas;
    quint16 current_wp_id;                 ///< The last used waypoint ID
    quint16 current_count;
    WaypointState current_state;        ///< The current state
    quint8 current_partner_systemid;
    quint8 current_partner_compid;
};

#endif // UASWAYPOINTMANAGER_H