Brunovf1 / xbee-arduino

Automatically exported from code.google.com/p/xbee-arduino
GNU General Public License v3.0
0 stars 0 forks source link

txstatus.getDeliveryStatus delivers wrong value for certain payload length #13

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?

Sending a payload of 9-11 bytes always produces strange return value from 
txresponse.getDeliverystatus() (should be SUCCESS), receiving node is online. 
Sending payload length 0 to 8 bytes is ok, more than 11 bytes is also ok.

Here my code:
==============

boolean XbeeSend(uint8_t* payload, int payloadlength)
{
  // **********************************
  // sending xbee packet to coordinator
  XBeeAddress64 addr64;
  ZBTxRequest zbTx;

  ZBRxResponse rx;
  ModemStatusResponse msr;
  ZBTxStatusResponse txStatus;

  // if message is 9 bytes, I get 0x6, 10 bytes=0x1 and 11 bytes no response at all! Should be 0x24.

  char message[] = "123456789";

  // creating address header
  addr64 = XBeeAddress64(config.networkid, config.coordinatorid);
  // creating transmit request
  zbTx = ZBTxRequest(addr64,(uint8_t*)message, strlen(message));

  // sending the xbee packet
  xbee.send(zbTx);

  // ******************************************************
  // awaiting packet recieved confirmation from coordinator

  if (xbee.readPacket(5000))
  {
    // checking for isError() shortened

    else if (xbee.getResponse().getApiId() == ZB_TX_STATUS_RESPONSE)
    { 
      // get xbee send status response
      xbee.getResponse().getZBTxStatusResponse(txStatus);

      if (txStatus.getDeliveryStatus() == SUCCESS)
      {            
        return true;
      } else {

        // an error occurred - reset our timeaccounting request waiting stuff
        awaitingTimeaccountingConfirmation = false;
        awaitingTimeaccountingExpire = 0;

        // DEBUG
        // see XBee.h for error codes
        sprintf(errormsg,"Errorcode: %02x",txStatus.getDeliveryStatus());
        lcdExpiringMessage(NONBLOCK,RED, "ERROR (Send)", errormsg,2000); 

        return false;
      }   
    }

    // checking for modem response shortened
  }
}

What is the expected output? What do you see instead?
Expected outbut is 0x24

What version of the product are you using? On what operating system?
recent version of xbee-arduino library

Please provide any additional information below.

Original issue reported on code.google.com by carsten....@mac.com on 2 May 2011 at 3:48

GoogleCodeExporter commented 9 years ago
Digi has added additional status response codes since I wrote the library. You 
can find them all in the manual:

x00 = Success
0x01 = MAC ACK Failure
0x02 = CCA Failure
0x15 = Invalid destination endpoint
0x21 = Network ACK Failure
0x22 = Not Joined to Network
0x23 = Self-addressed
0x24 = Address Not Found
0x25 = Route Not Found
0x26 = Broadcast source failed to hear a neighbor relay the message
0x2B = Invalid binding table index
0x2C = Resource error lack of free buffers, timers, etc. 0x2D = Attempted 
broadcast with APS transmission 0x2E = Attempted unicast with APS transmission, 
but EE=0
0x32 = Resource error lack of free buffers, timers, etc. 0x74 = Data payload 
too large

These will need to be added to the library

Original comment by andrew.rapp@gmail.com on 2 Feb 2014 at 6:38