/*
 * SmartHome server: Plug-in xbee
 *
 * Copyright (C) 2010 Daniel Pisi <dan.pisi@gmail.com>
 *
 * This program is free software; you can redistribute it and/or modify it
 * under the terms of version 2 of the GNU General Public License
 * as published by the Free Software Foundation.
 *
 */

/**
 * @file xbpacket.h
 * @brief XBee2 API frame template class
 * @author Daniel Pisi
 */

#ifndef XBPACKET_H
#define XBPACKET_H

#include <QtCore/QCoreApplication>
#include <QDataStream>
#include "xbitems.h"

// -----------------------------------------------------------------------------

/**
 * \class XbPacket
 * \brief XBee2 API frame base class
 */
class XbPacket
{
public:
    XbPacket(quint8 frameType = 0);
    ~XbPacket();

    quint8 frameType();

    QByteArray frameData();
    bool parseFrameData(QByteArray &data);

    static quint8 checksum(QByteArray data);
    static bool valid(QByteArray data);

protected:
    quint8 mFrameType;
    QList<XbStreamItem*> mItems;
};
// -----------------------------------------------------------------------------

#endif // XBPACKET_H
