UASWaypointManager.h 1.29 KB
Newer Older
1 2 3 4 5
#ifndef UASWAYPOINTMANAGER_H
#define UASWAYPOINTMANAGER_H

#include <QObject>
#include "Waypoint.h"
pixhawk's avatar
pixhawk committed
6
#include <mavlink.h>
7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24
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);
pixhawk's avatar
pixhawk committed
25
    void handleWaypoint(quint8 systemId, quint8 compId, mavlink_waypoint_t *wp);
pixhawk's avatar
pixhawk committed
26
    void handleWaypointRequest(quint8 systemId, quint8 compId, mavlink_waypoint_request_t *wpr);
27 28 29 30 31

private:
    void getWaypoint(quint16 seq);

public slots:
pixhawk's avatar
pixhawk committed
32
    void clearWaypointList();
33 34 35
    void currentWaypointChanged(int);
    void removeWaypointId(int);
    void requestWaypoints();
pixhawk's avatar
pixhawk committed
36 37
    void sendWaypoints(void);
    void waypointChanged(Waypoint*);
38

pixhawk's avatar
pixhawk committed
39 40 41
signals:
    void waypointUpdated(int,int,double,double,double,double,bool,bool);

42 43 44 45 46 47 48 49 50 51
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