7 years ago.

Xdot unable to capture Downlink message

Hi all,

I am having an issue where I am able to receive the data from gateway, but I am unable to capture the data. Please look at the following code snippet and suggest what I might do in order to rectify the issue.

....

std::vector<uint8_t> tx_data,rx_data;

send_data(tx_data);

recv_data(rx_data);

debug.printf("vector size %d\n\r",rx_data.size());

vector<uint8_t>::const_iterator p1;

for (p1 = rx_data.begin(); p1 != rx_data.end(); p1++) {

debug.printf("debug char %c\n\r",*p1);

}

....

The output for rx_data.size is always 0 and for loop doesn't even loop because it sees an empty vector even though I see the string the gateway sent while calling recv_data function. See following


[INFO] Preparing frame

[INFO] Configure radio for TX

[INFO] Configure radio for TX

[INFO] Rx Window 1

[INFO] Rx Window 2

[INFO] RxDone 34 bytes RSSI: -101 dB SNR: 12 cB

[INFO] Packet for 12006d1a

[INFO] Packet Received : Port: 1 FCnt: 00000001 Size: 11 ACK: 0 DUP: 0

Rx data: ������"3DU [aabbccddeeff1122334455]

[INFO] Packet RSSI: -101 dB SNR: 12 cB

[INFO] successfully sent data to gateway

[INFO] successfully received data to gateway

vector size 0


recv_data looks like the following:

void recv_data(std::vector<uint8_t> data) {

uint32_t ret;

ret = dot->recv(data);

if (ret != mDot::MDOT_OK) {

logError("failed to receive data from %s [%d][%s]", dot->getJoinMode() == mDot::PEER_TO_PEER ? "peer" : "gateway", ret, mDot::getReturnCodeString(ret).c_str());

} else {

logInfo("successfully received data to %s", dot->getJoinMode() == mDot::PEER_TO_PEER ? "peer" : "gateway");

}

}


The string aabbccddeeff1122334455 is what I had sent and was assuming it would be captured in rx_data.

Any help would be appreciated.

Thank you

2 Answers

7 years ago.

Do you receive the data in RadioEvent.h MacEvent function? I'd just handle it there. Function fires with the right flags whenever there's data, so no need to call recv() yourself.

Accepted Answer
7 years ago.

I believe your problem is in the declaration of your receive function: void recv_data(std::vector<uint8_t> data)

The correct format is void recv_data(std::vector<uint8_t>& data)

When you pass your recv_data function the variable rx_data you want to pass-by-reference.