SerialCloud.xx() and AT+CGED


I’m trying to get at least 5-6 Cell Tower details (1 hosting and 5 neighbours) to be used in Cell Site Triangulation API in OpenCellID. But I’m getting trouble with AT+CGED.

I’m using the following code snippet (from AT Command pass through) to get response from AT+CGED command via Arduino Serial Monitor.

while (SerialCloud.available()) {
    currChar = (char);
    downlinkDataDetected = true;
    ledNextFlickerMillis = millis() + LED_DATA_INDICATOR_FLICKER_ON_DURATION;

+CGED: (0-4,128-132),(0-1)

MCC:515, MNC: 2, LAC:7618, RAC: 9c


AT+CGED=0 (or any)
No data

It seems that the response of the Periodic Refresh Dump (AT+CGED=1) is not yet complete when the SerialCloud.available() loop terminates. And the succeeding AT commands (like AT+CGED) collides with the pending result of AT+CGED=1.

Also notice that the response of the AT+CGED=0 is missing the CI or CID data.

I suspect that the SerialCloud.available() ended up after receiving /r/n or carriage return and is not waiting long enough for the other data after receiving the OK data. Is there a possibility to pass a wait state inside SerialCloud so that unsolicited data like +URC are still waited for their response?