Digi International Inc XBEEPRO2 Manual Do Utilizador

Página de 155
XBee®/XBee‐PRO® ZB RF Modules 
© 2011 Digi International, Inc.
     103
Source Routing
The following image shows the API frame exchanges that take place at the UART when sending a source routed 
transmission.
Supporting the API
Applications that support the API should make provisions to deal with new API frames that may be introduced in 
future releases. For example, a section of code on a host microprocessor that handles received serial API frames 
(sent out the module's DOUT pin) might look like this: 
API Frames
The following sections illustrate the types of frames encountered while using the API.
AT Command
Frame Type: 0x08
Used to query or set module parameters on the local device. This API command applies changes after executing 
the command. (Changes made to module parameters take effect once changes are applied.) The API example 
below illustrates an API frame when modifying the NJ parameter value of the module 
void XBee_HandleRxAPIFrame(_apiFrameUnion *papiFrame){
    switch(papiFrame->api_id){
        case RX_RF_DATA_FRAME:
            //process received RF data frame
            break;
        case RX_IO_SAMPLE_FRAME:
            //process IO sample frame
            break;
        case NODE_IDENTIFICATION_FRAME:
            //process node identification frame
            break;
        default:
            //Discard any other API frame types that are not being used
            break;
     } 
}