You will want to accept the received packets in the event handler
examples/inc/RadioEvent.h
Add your code to the MacEvent function.
RadioEvent::MacEvent(LoRaMacEventFlags* flags, LoRaMacEventInfo* info);
if (flags->Bits.Rx) {
logDebug("Rx %d bytes", info->RxBufferSize);
if (info->RxBufferSize > 0) {
// print RX data as hexadecimal
//printf("Rx data: %s\r\n", mts::Text::bin2hexString(info->RxBuffer, info->RxBufferSize).c_str());
// print RX data as string
std::string rx((const char*)info->RxBuffer, info->RxBufferSize);
printf("Rx data: %s\r\n", rx.c_str());
// TODO: output to UART
}
}