XBee and XBee-PRO ZigBee RF modules provide cost-effective wireless connectivity to electronic devices. They are interoperable with other ZigBee PRO feature set devices, including devices from other vendors.

Dependencies:   BufferedArray

Dependents:   MBEDminiproject

Options/Tx64TransmitOptions.cpp

Committer:
yangcq88517
Date:
2015-11-14
Revision:
6:5f31ddc17239
Parent:
4:a0f1fba6c2fb

File content as of revision 6:5f31ddc17239:

#include "Tx64TransmitOptions.h"

Tx64TransmitOptions::Tx64TransmitOptions() { }

Tx64TransmitOptions::Tx64TransmitOptions(unsigned char value)
    : OptionsBase(value)
{ }

Tx64TransmitOptions::Tx64TransmitOptions(bool disable_retries_and_route_repair, bool donot_repeat_packet, bool send_packet_with_broadcast_PanID, bool invoke_traceroute, bool purge_packet_if_delayed_due_to_duty_cycle)
{
    value = 0x00;
    if (disable_retries_and_route_repair)
        value |= 0x01;
    if (donot_repeat_packet)
        value |= 0x02;
    if (send_packet_with_broadcast_PanID)
        value |= 0x04;
    if (invoke_traceroute)
        value |= 0x08;
    if (purge_packet_if_delayed_due_to_duty_cycle)
        value |= 0x10;
}

Tx64TransmitOptions * Tx64TransmitOptions::DonotRepeatPacket = new Tx64TransmitOptions(0x02);

Tx64TransmitOptions * Tx64TransmitOptions::SendPacketWithBroadcastPanID = new Tx64TransmitOptions(0x04);

Tx64TransmitOptions * Tx64TransmitOptions::InvokeTraceroute = new Tx64TransmitOptions(0x08);

Tx64TransmitOptions * Tx64TransmitOptions::PurgePacketWhenDelayed = new Tx64TransmitOptions(0x10);

bool Tx64TransmitOptions::getDonotRepeatPacket()
{
    if ((value & 0x02) == 0x02)
        return true;
    else return false;
}

void Tx64TransmitOptions::setDonotRepeatPacket(bool status)
{
    if (status)
        value |= 0x02;
    else
        value &= 0xFD;
}

bool Tx64TransmitOptions::getSendPacketWithBroadcastPanID()
{
    if ((value & 0x04) == 0x04)
        return true;
    else return false;
}

void Tx64TransmitOptions::setSendPacketWithBroadcastPanID(bool status)
{
    if (status)
        value |= 0x04;
    else
        value &= 0xFB;
}

bool Tx64TransmitOptions::getInvokeTraceroute()
{
    if ((value & 0x08) == 0x08)
        return true;
    else return false;
}

void Tx64TransmitOptions::setInvokeTraceroute(bool status)
{
    if (status)
        value |= 0x08;
    else
        value &= 0xF7;
}

bool Tx64TransmitOptions::getPurgePacketWhenDelayed()
{
    if ((value & 0x10) == 0x10)
        return true;
    else return false;
}

void Tx64TransmitOptions::setPurgePacketWhenDelayed(bool status)
{
    if (status)
        value |= 0x10;
    else
        value &= 0xEF;
}