Closed elcojacobs closed 6 years ago
Done and merged into feature/brewblox
Type IDs are now defined in a central place and resolved at compile time using templates and overloading: https://github.com/BrewPi/firmware/blob/feature/brewblox/app/cbox/AppResolveType.cpp
The object factory contains the typeIDs and searches the factory container instead of indexing it directly: https://github.com/BrewPi/firmware/blob/feature/brewblox/app/cbox/CboxApp.cpp#L63
The current implementation of object type is a uint8 with a value of 0-127 to define the application object type. This is a small range that could be exhausted quickly. While it is unlikely that we will have more than 127 concurrent object types on the firmware, it leaves no room for deprecating objects.
If we change the implementation to use 2 bytes instead of one, we have a much bigger pool so we can do version management of objects:
The object creation command now uses an array of factories that is directly indexed by the object type ID. Instead of using the object ID directly as the index, we should search the array for the matching factory.