I am implementing a FIFO buffer using the Application.Storage module. My code involves deleting the first-in value when the storage is full by catch the Lang.StorageFullException. I wanted to test if this exception is properly caught and the code is executed properly, but I am not sure if CIQ simulator has the same storage capacity as the device (128 KB). I wanted to test it through running my program until the storage was full and observing its behavior. This is the snippet of my code that implements the buffer:
function storeUnsentData(location, timestamp){ //Try storing unsent data with unique keys try { Application.Storage.setValue("t"+head, timestamp); Application.Storage.setValue("l"+head, location); head = head + 1; System.println("Storing values" + head); //Catch storage full error and pop the tail then retry storing } catch (ex instanceof Lang.StorageFullException) { System.println("Storage full"); if (tail < head){ Application.Storage.deleteValue("t"+tail); Application.Storage.deleteValue("l"+tail); tail = tail + 1; storeUnsentData(location, timestamp); } else{ System.println("Error: no values to clear"); } } }