Read Xbee Address

Hope this isn't too snipped up. I use X-CTU to set the NI (and also AP=2). The getXBeeNI() function gets called once from setup(). The readXBee() function gets called from loop() continuously to check for incoming traffic, and has a switch statement to check for various incoming packet types, one of which is a response to AT commands.

#include <XBee.h>              //http://code.google.com/p/xbee-arduino/
XBee xbee = XBee();                                       //XBee object

void getXBeeNI(void) {
    union {byte B; char C;} atCmd[3];
    AtCommandRequest atCmdReq;

    strcpy(&atCmd[0].C, "NI");
    atCmdReq = AtCommandRequest(&atCmd[0].B);
    xbee.send(atCmdReq);
}

void readXBee(void) {
    
    AtCommandResponse atResp;
    union {byte B; char C;} xbeeNI[9];                     //XBee node identifier
    byte respLen, *resp;

    xbee.readPacket();
    if (xbee.getResponse().isAvailable()) {                //incoming traffic
    
        switch (xbee.getResponse().getApiId()) {           //what kind of packet did we get?
    
        case ZB_RX_RESPONSE:                               //rx data packet
        ...
        case ZB_TX_STATUS_RESPONSE:						   //tx status
		...        
        case AT_COMMAND_RESPONSE:                          //response to AT commands
            atResp = AtCommandResponse();
            xbee.getResponse().getAtCommandResponse(atResp);
            if (atResp.isOk()) {
                respLen = atResp.getValueLength();
                resp = atResp.getValue();
                for (int i=0; i<respLen; i++) {
                    xbeeNI[i].B = resp[i];
                }
                xbeeNI[respLen].B = '\0';
                Serial.print(millis(), DEC);
                Serial.print(" XBee NI=");
                Serial.println(&xbeeNI[0].C);
            }
            else {
                Serial.println("XBee AT CMD ERROR");
            }
            break;