SlugsMAV.cc 1001 Bytes
Newer Older
1 2
#include "SlugsMAV.h"

3 4
#include <QDebug>

5 6 7 8 9 10
SlugsMAV::SlugsMAV(MAVLinkProtocol* mavlink, int id) :
        UAS(mavlink, id)//,
        // Place other initializers here
{
}

11 12 13 14 15 16 17 18
/**
 * This function is called by MAVLink once a complete, uncorrupted (CRC check valid)
 * mavlink packet is received.
 *
 * @param link Hardware link the message came from (e.g. /dev/ttyUSB0 or UDP port).
 *             messages can be sent back to the system via this link
 * @param message MAVLink message, as received from the MAVLink protocol stack
 */
19 20
void SlugsMAV::receiveMessage(LinkInterface* link, mavlink_message_t message)
{
21 22 23 24
    // Let UAS handle the default message set
    UAS::receiveMessage(link, message);

    // Handle your special messages
25 26 27 28
    switch (message.msgid)
    {
    case MAVLINK_MSG_ID_HEARTBEAT:
        {
29
            qDebug() << "SLUGS RECEIVED HEARTBEAT";
30 31 32
            break;
        }
    default:
33
        qDebug() << "\nSLUGS RECEIVED MESSAGE WITH ID" << message.msgid;
34 35 36
        break;
    }
}