RAK4270 How to read configuration

I am trying to read the configuration from the RAK4270’s config AT command.
The problem is that it returns multiple lines that all seem to have a \r\n at the end.
Here is an example from the docs:

OK Work Mode: LoRaWAN
Region: EU868
Send_interval: 600s
Auto send status: false.
MulticastEnable: true.
Multi_Dev_Addr: 260111FD
Multi_Apps_Key: F13DDFA2619B10411F02F042E1C0F356
Multi_Nwks_Key: 1D1991F5377C675879C39B6908D437A6
Join_mode: OTAA
DevEui: 0000000000000888
AppEui: 0000000000000888
AppKey: 00000000000008880000000000000888
Class: C
Joined Network:false
IsConfirm: unconfirm
AdrEnable: true
EnableRepeaterSupport: false
Current Datarate: 4
Primeval Datarate: 4
ChannelsTxPower: 0
UpLinkCounter: 0
DownLinkCounter: 0

That complicates things as I need to have some sort of stop character to look for like with this code:

bool SerialCommand(String command, String expected_response)
    String response = "";

      response = _serial.readStringUntil('\n');
      Serial.println("Command: " + command + ", Response: " + response);
      if (response.indexOf(expected_response) >= 0)
        return true;
      else if (response.indexOf("ERROR") >= 0)
        lastError = response;
        return false;
    return false;

This… this doesn’t work. If each of the lines had a simple \r at the end, and an \r\n to signal the end of the transmission, that would make things great, however, that does not seem to be the case (unless I am missing something)

SO! My question is how would you guys recommend reading from this settings list?
I don’t want to be setting my settings up every wake cycle, and at the same time, I don’t want to have to manually set each device up every time I want to deploy a new device.

Thanks for the help!

You can check each parameter returned value and wait until the last parameter DownLinkCounter: . The lora:status is fixed in format so a parsing code should be possible.

Regarding setting up the device before deployment, once the LoRaWAN parameters are set, it will not be changed so you only have to do it once. Even if you update the FW, the parameters you set will not be change.

I’m having the same problem, since this behavior prevents reading the Serial Port in a generic way and everything would break when the API changes.
Typically, a serial API has some means to signal the end of a transmission, either by telling how long the transmission will be (e.g. in bytes) or a special character.
I think the typical AT commands use an “OK” at the end to signal this.

Welcome to RAK forum @avathar ,

I agree with you that the current AT command design is not pretty much the standard way how we usually see AT commands. RAK4270 is based on RUI2. And currently, we are launching RUI3 on our newer modules. There are plans for RAK4270 to be updated to support RUI3 but probably in few more months.

Btw if you are working on a new product, I will suggest you look at the RAK3172 module which is based on RUI3 and has better AT command structure.