ConnectionManager Library

Great to see a ConnectionManager library being released. In the absence of this, I’ve implemented something very similar for use with our devices.

A word of warning about the use of the log() method though. Squirrel is not the most economical when it comes to object RAM use. I buffer messages and events in the device while the device is offline and available RAM can evaporate preeeetty quickly. I’ve had to put a limit on the number of messages held. I’ve even put a JSON (en/de)coder in the device which allows me to convert tables to JSON strings for storage, which I reconstitute when needed.

This actually brings up a little side-thing I’ve been working on. Since sizeof() deosn’t exist for Squirrel, I’ve been piecing together a routine that traverses objects and calculates (roughly) their RAM use. I have a few structures that are many 10s of kilobytes in size and I’m keen to know which structures work better than others wrt RAM use.

very true. This is one of the reasons why I add a flash SPI EEPROM to every device I make (only .30$:pcs) if available pins permit. All device data that needs to be preserved when offline gets stored in the EEPROM. I use the serialiser class to store/retrieve them (not regular json but works pretty well).