I’m running into problems with getting cellular data usage for the Boron. I’ve written the following example application:
// Logging
SerialLogHandler logHandler(LOG_LEVEL_ALL);
// Particle system stuff
SYSTEM_THREAD(ENABLED);
void setup()
{
Serial.begin(9600);
}
void loop()
{
uint32_t freeMem = System.freeMemory();
Log.info("Free memory: %ld", freeMem);
if (Cellular.ready())
{
CellularData data;
if (!Cellular.getDataUsage(data))
{
Log.error("Error! Not able to get data.");
}
else
{
Log.info("CID: %d SESSION TX: %d RX: %d TOTAL TX: %d RX: %d",
data.cid,
data.tx_session, data.rx_session,
data.tx_total, data.rx_total);
Serial.println(data); // Printable
}
CellularSignal sig = Cellular.RSSI();
Log.info("Cell quality: %d (%d)\n", sig.qual, sig.rssi);
}
else
{
Log.info("Cell not ready yet...\n");
}
delay(5000);
}
getDataUsage
always returns an error. I get the following output:
0000116280 [app] INFO: Free memory: 64200
0000116281 [app] ERROR: Error! Not able to get data.
0000116428 [app] INFO: Cell quality: 31 (27)
0000121429 [app] INFO: Free memory: 64200
0000121431 [app] ERROR: Error! Not able to get data.
0000121578 [app] INFO: Cell quality: 31 (27)
I haven’t been able to get any data from Cellular.getDataUsage
. Am I missing something?