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

Request/RemoteATCommandRequest.cpp

Committer:
yangcq88517
Date:
2015-10-22
Revision:
0:837e6c48e90d
Child:
6:5f31ddc17239

File content as of revision 0:837e6c48e90d:

#include "RemoteATCommandRequest.h"

RemoteATCommandRequest::RemoteATCommandRequest(char frameID, Address * remoteAddress, const char * command, OptionsBase * transmitOptions, const char * parameter, int parameterOffset, int parameterLength)
    : TxBase(13 + (parameter == NULL ? 0 : parameterLength), APIFrame::Remote_Command_Request, frameID)
{
    sets(remoteAddress->getAddressValue(), 0, 10);
    set(transmitOptions->getValue());
    sets(command, 0, 2);

    if (parameter != NULL)
        sets(parameter, parameterOffset, parameterLength);
}

void RemoteATCommandRequest::setTransmitOptions(OptionsBase * transmitOptions)
{
    data[12] = transmitOptions->getValue();
}

void RemoteATCommandRequest::setAppleChanges(bool appleChanges)
{
    if (appleChanges)
       data[12] |= 0x02;
    else data[12] &= 0xFD;
}

void RemoteATCommandRequest::setCommand(const char * command)
{
    sets(13, command, 0, 2);
}

void RemoteATCommandRequest::setParameter(const char * parameter, int offset, int length)
{
    setPosition(15);
    sets(parameter, offset, length);
}

void RemoteATCommandRequest::setRemoteAddress(Address * remoteAddress)
{
    sets(2, remoteAddress->getAddressValue(), 0, 10);
}