This is a complete refactor of controlbox. It started small, but ended up being almost a complete rewrite.
A quick summary of the changes. It is not a complete list, because of how much has changed.
No nested IDs. This greatly simplifies the object container. Nested behavior can be implemented by the objects themselves in how they handle streamed data if required. For example, when protobuf is used for encoding and decoding, nested messages are handled by protobuf.
A sorted STL vector is now used to hold the objects.
Instead of having objects per profile, there are now 8 profiles to which objects can be assigned (multiple possible). The collection of objects is global and they are only active if they are in an active profile.
The command protocol has been simplified and made more consistent between different commands. The protocol was simplified by removing the distinction between system and user objects. Now a certain ID range is considered system, but they are in the same container.
Eeprom storage is now abstracted, managed and global (not per profile). Objects can stream as much data as they want and the storage manager will reallocate new space if required. Objects are not aware of their EEPROM size or location.
Incoming connections are managed by a connection pool.
Object types are now uint16_t. The object factory is a lookup array. This removes the requirement of object type IDs to be contiguous and we can use the id to version them.
A box class brings together the object container, factory, persisted storage and connections.
Runtime type checks are possible by object/interface ID.
CboxPtr is a new class that implements a cheap but safe dynamic cast using weak_ptr and runtime type IDs. It allows objects to hold pointers to other objects. On use it is checked that the object exists and is castable to the desired interface.
CRC checks have been added for communication and EEPROM data.
A smart update loop has been implemented where objects can signal when they want to be updated next.
Unit tests have been added, using catch test. Now at 97% coverage. Before this rewrite, there were only python integration tests that stopped working.
The amount of #ifdefs has been brought back a lot! No code inclusion/removal by a confusing network of macros and typedefs anymore, resulting in much more readable code.
This is a complete refactor of controlbox. It started small, but ended up being almost a complete rewrite.
A quick summary of the changes. It is not a complete list, because of how much has changed.
resolves #83, #92, #91, #93, #82, #81, #80