/*
 * 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 xbpackets.cpp
 * @brief Various XBee2 API frame types
 * @author Daniel Pisi
 */

#include "xbpackets.h"

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

XbLocalCommand::XbLocalCommand() : XbPacket(0x08)
{
    mItems.append(newFrameIdItem());
    mItems.append(newCommandItem());
    mItems.append(newCmdParamItem());
}
// -----------------------------------------------------------------------------

XbLocalCommandResponse::XbLocalCommandResponse() : XbPacket(0x88)
{
    mItems.append(newFrameIdItem());
    mItems.append(newCommandItem());
    mItems.append(newCmdStatusItem());
    mItems.append(newCmdParamItem());
}
// -----------------------------------------------------------------------------

XbTransmitRequest::XbTransmitRequest() : XbPacket(0x10)
{
    mItems.append(newFrameIdItem());
    mItems.append(newAddressItem());
    mItems.append(newBcRadiusItem());
    mItems.append(newOptionsItem());
    mItems.append(newRfDataItem());
}
// -----------------------------------------------------------------------------

XbTransmitStatus::XbTransmitStatus() : XbPacket(0x8B)
{
    mItems.append(newFrameIdItem());
    mItems.append(newAddr16Item());
    mItems.append(newTxRetryCntItem());
    mItems.append(newDeliveryStatusItem());
    mItems.append(newDiscoveryStatusItem());
}
// -----------------------------------------------------------------------------

XbRemoteCommand::XbRemoteCommand() : XbPacket(0x17)
{
    mItems.append(newFrameIdItem());
    mItems.append(newAddressItem());
    mItems.append(newOptionsItem());
    mItems.append(newCommandItem());
    mItems.append(newCmdParamItem());
}
// -----------------------------------------------------------------------------

XbRemoteCommandResponse::XbRemoteCommandResponse() : XbPacket(0x97)
{
    mItems.append(newFrameIdItem());
    mItems.append(newAddressItem());
    mItems.append(newCommandItem());
    mItems.append(newCmdStatusItem());
    mItems.append(newCmdParamItem());
}
// -----------------------------------------------------------------------------

XbReceivedData::XbReceivedData() : XbPacket(0x90)
{
    mItems.append(newAddressItem());
    mItems.append(newOptionsItem());
    mItems.append(newRfDataItem());
}
// -----------------------------------------------------------------------------

XbIoSample::XbIoSample() : XbPacket(0x92)
{
    mItems.append(newAddressItem());
    mItems.append(newOptionsItem());
    mItems.append(newIoSamplesItem());
}
// -----------------------------------------------------------------------------
