This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

How to know the short address of the node in the code?

Please let me know how to get the short address of the node

Thanks

  • 1) If the node is in the association list, you can use

    extern associated_devices_t *AssocGetWithExt( byte *extAddr );

    2) if the node is not in the association list, you can use

    afStatus_t ZDP_NwkAddrReq( uint8 *IEEEAddress, byte ReqType,
                               byte StartIndex, byte SecurityEnable )

     

  • Will I get the short address only?

  • 1) It will return

    typedef struct
    {
      UINT16 shortAddr;                 // Short address of associated device
      uint16 addrIdx;                   // Index from the address manager
      byte nodeRelation;
      byte devStatus;                   // bitmap of various status values
      byte assocCnt;
      byte age;
      linkInfo_t linkInfo;
    } associated_devices_t;

    2)You will get the nwk addr response , you can find

     the callback function

    void ZDApp_ProcessMsgCBs( zdoIncomingMsg_t *inMsg )

  • Actually I am asking how to get the destination address of coordinator to send the light on/off status to Coordinator.

    see the following code for reference...

    afAddrType_t DstAddr

    static void zclSampleLight_SendReport( void )
    {
    volatile ZStatus_t status;
    afAddrType_t DstAddr;

    //DstAddr.addr.extAddr = 0;
    //DstAddr.addr.shortAddr = 0;
    pzclSampleLight_ReportCmd->attrList[0].attrData = (uint8*)&zclSampleLight_OnOff;
    zcl_SendReportCmd(SAMPLELIGHT_ENDPOINT,
    &DstAddr,
    ZCL_CLUSTER_ID_GEN_ON_OFF,
    (zclReportCmd_t *)pzclSampleLight_ReportCmd,
    1,0,1);

    HalLcdWriteValue((uint32)(status), 10, 2);
    }

    Thanks 

  • the address of coordinator is always 0x0000

    Why you need to get the coordinator address.