Hello,
I was communicating with two RAK3172 modules in P2P mode without encryption. Then I wanted to do encryption and I encrypted the payload with commands. I wrote the same codes in the receiver and transmitter part. But after uploading the new codes, I decode the received data and verify that I solved it. The data I decode comes in HEX format correctly. After applying the HEX to ASCII process on an online site, I can read the data correctly. But the code below fails to translate correctly when converting to ASCII for me. Can you help?
Note: This issue arose when I started using AES128 encryption. Oddly enough, the decrypting is successful so I can read the decrypted HEX data properly.
Code:
void recv_cb(rui_lora_p2p_recv_t data) {
rx_done = true;
if (data.BufferSize == 0) {
Serial.println("Empty buffer.");
return;
}
char donusturulmus[data.BufferSize + 1];
for (uint16_t i = 0; i < data.BufferSize; i++) {
donusturulmus[i] = (char)data.Buffer[i];
}
donusturulmus[data.BufferSize] = '\0';
Serial.print("Incoming message: ");
Serial.println(donusturulmus);
Output Sample:
+EVT:RXP2P:-18:7:312C31312C37
Incoming message: Çxµ)?
The data sample should look like:
+EVT:RXP2P:-18:7:312C31312C37
Incoming message: 1,11,7
It also seems same in P2P Example ASCII Table:
Can you help with this?
@Kongduino @carlrowan I believe that you can handle this :))