void printRawResponseCb(XBeeResponse& response, uintptr_t data) { Print *p = (Print*)data; p->print("Response received: "); // Reconstruct the original packet uint8_t header[] = {START_BYTE, response.getMsbLength(), response.getLsbLength(), response.getApiId()}; printHex(*p, header, sizeof(header), F(" "), NULL); p->write(' '); printHex(*p, response.getFrameData(), response.getFrameDataLength(), F(" "), NULL); p->println(); }
void printResponseCb(XBeeResponse& r, uintptr_t data) { uint8_t id = r.getApiId(); // Figure out the API type and call the corresonding function if (id == ZB_TX_STATUS_RESPONSE) { ZBTxStatusResponse response; r.getZBTxStatusResponse(response); printResponseCb(response, data); } else if (id == ZB_RX_RESPONSE) { ZBRxResponse response; r.getZBRxResponse(response); printResponseCb(response, data); } else if (id == ZB_EXPLICIT_RX_RESPONSE) { ZBExplicitRxResponse response; r.getZBExplicitRxResponse(response); printResponseCb(response, data); } else if (id == ZB_IO_SAMPLE_RESPONSE) { ZBRxIoSampleResponse response; r.getZBRxIoSampleResponse(response); printResponseCb(response, data); } else if (id == TX_STATUS_RESPONSE) { TxStatusResponse response; r.getTxStatusResponse(response); printResponseCb(response, data); } else if (id == RX_16_RESPONSE) { Rx16Response response; r.getRx16Response(response); printResponseCb(response, data); } else if (id == RX_64_RESPONSE) { Rx64Response response; r.getRx64Response(response); printResponseCb(response, data); } else if (id == RX_16_IO_RESPONSE) { Rx16IoSampleResponse response; r.getRx16IoSampleResponse(response); printResponseCb(response, data); } else if (id == RX_64_IO_RESPONSE) { Rx64IoSampleResponse response; r.getRx64IoSampleResponse(response); printResponseCb(response, data); } else if (id == MODEM_STATUS_RESPONSE) { ModemStatusResponse response; r.getModemStatusResponse(response); printResponseCb(response, data); } else if (id == AT_COMMAND_RESPONSE) { AtCommandResponse response; r.getAtCommandResponse(response); printResponseCb(response, data); } else if (id == REMOTE_AT_COMMAND_RESPONSE) { RemoteAtCommandResponse response; r.getRemoteAtCommandResponse(response); printResponseCb(response, data); } }
void printErrorCb(XBeeResponse& r, uintptr_t data) { uint8_t id = r.getApiId(); // Figure out the API type and call the corresonding function if (id == ZB_TX_STATUS_RESPONSE) { ZBTxStatusResponse response; r.getZBTxStatusResponse(response); printErrorCb(response, data); } else if (id == TX_STATUS_RESPONSE) { TxStatusResponse response; r.getTxStatusResponse(response); printErrorCb(response, data); } else if (id == AT_COMMAND_RESPONSE) { AtCommandResponse response; r.getAtCommandResponse(response); printErrorCb(response, data); } else if (id == REMOTE_AT_COMMAND_RESPONSE) { RemoteAtCommandResponse response; r.getRemoteAtCommandResponse(response); printErrorCb(response, data); } }