Alessandro Dionisi

Problems while passing a pointer

Discussion created by Alessandro Dionisi on Nov 20, 2007
Latest reply on Nov 21, 2007 by Alessandro Dionisi
I'm writing a simple app that upon receiving a packet from a zigbee device, sends a response packet containing a value (Link Quality Indicator from incoming data indication, a uint8_t). Here it is the code taken from BeeApp.c:

void BeeAppDataIndication
  apsdeToAfMessage_t *pMsg;
  zbApsdeDataIndication_t *pIndication;

    /* Get a message from a queue */
    pMsg = MSG_DeQueue( &gAppDataIndicationQueue );

    /* ask ZCL to handle the frame */
    pIndication = &(pMsg->msgData.dataIndication);

      Note: if multiple endpoints are supported by this app, insert
      endpoint filtering here...

      This app assumes only 1 active endpoint. APS layer has already
      filtered by endpoint and profile.

      Note: all multi-byte over-the-air fields are little endian.
      That is 0x1101 would come in byte order 0x01 0x11.

    /* handle the command */
    if(pIndication->aClusterId[0] == appDataCluster[0]) {
    /* Free memory allocated by data indication */

void SendLQI
  zbApsdeDataIndication_t *indication  // Contains requestor info (address)
  afAddrInfo_t addrInfo;
  /* set up address information */
  addrInfo.dstAddrMode = gZbAddrMode16Bit_c;
  addrInfo.dstEndPoint = dstEndPoint;
  addrInfo.srcEndPoint = srcEndPoint;
  addrInfo.txOptions = gApsTxOptionNone_c;
  addrInfo.radiusCounter = afDefaultRadius_c;
  /* set up cluster */
  Copy2Bytes(addrInfo.aClusterId, appDataCluster);
  /* send the data request */


 The problem is that into the function, the values pointed by indication are wrong. This is due to indication value variation when the function is invoked. I used debugger and the value of the pointer is different before and after SendLQI() invocation. Why? Maybe isn't the correct modality to pass that pointer?