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

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers XBeeRx16Indicator.cpp Source File

XBeeRx16Indicator.cpp

00001 #include "XBeeRx16Indicator.h"
00002 
00003 XBeeRx16Indicator::XBeeRx16Indicator(APIFrame * frame)
00004     : RxBase(frame)
00005 { }
00006 
00007 unsigned  char *  XBeeRx16Indicator::getReceivedData()
00008 {
00009     if (getReceivedDataLength() <= 0)
00010         return NULL;
00011 
00012     return data + 5;
00013 }
00014 
00015 int  XBeeRx16Indicator::getReceivedDataOffset()
00016 {
00017     return 5;
00018 }
00019 
00020 char  XBeeRx16Indicator::getReceivedData(int index)
00021 {
00022     return data[5 + index];
00023 }
00024 
00025 int  XBeeRx16Indicator::getReceivedDataLength()
00026 {
00027     return getPosition() - 5;
00028 }
00029 
00030 int  XBeeRx16Indicator::getRSSI()
00031 {
00032     return data[3] * -1;
00033 }
00034 
00035 int  XBeeRx16Indicator::getReceiveStatus()
00036 {
00037     return data[4];
00038 }
00039 
00040 Address  XBeeRx16Indicator::getRemoteDevice()
00041 {
00042     return Address(NULL, data + 1);
00043 }
00044 
00045 bool  XBeeRx16Indicator::convert(APIFrame * frame)
00046 {
00047     if (frame == NULL)
00048         return false;
00049 
00050     if (frame->getFrameType() != APIFrame::Rx16_Receive_Packet)
00051         return false;
00052 
00053     return APIFrame::convert(frame);
00054 }