I am currently working on a C++ project for a range of embedded devices which have several similarities. I am trying to keep the code common as much as possible.
Each device has capabilities and should be assigned with one value from the capabilities and default property. Since the project details are confidential, I am giving similar application as the reference.
For example, assume that we need to write an application for a range of mobile phones and want to have the same firmware. Assume all phones have the same processor and the difference is only in the interfacing devices like sensors, camera resolution, etc.
Assume that I am going to create classes for the proximity sensor, camera, gyroscope.
When booted, the application should get predefined capability based on the model(assuming the application can somehow fetch model). Once the model is known, it should initialize the objects with default values.
I was thinking to do this in the following fashion.