Addon
Path: src/modbus/Addon.h
Revision History: Initial documentation
Addon is a base class that extends the Component class, providing a foundation for creating modular extensions within the modbus system. It serves as a backward compatibility layer while ensuring consistent behavior across different types of add-ons.
REQUIREMENTS
Section titled “REQUIREMENTS”- ESP-32 microcontroller
- Platform.io development environment
PROVIDES
Section titled “PROVIDES”Addon
class: Base class for creating modular componentsAddons
type: A Vector container for storing Addon pointersAddonFnPtr
type: Function pointer type for addon methodsbyId()
utility function: Find an addon by its ID in a collection
FEATURES
Section titled “FEATURES”- Inheritance from Component class for consistent behavior
- Default run flags for standard execution modes
- Support for identifying addons through unique IDs
- Vector-based storage and retrieval of addons
DEPENDENCIES
Section titled “DEPENDENCIES”BEHAVIOUR
Section titled “BEHAVIOUR”The Addon class extends Component, inheriting its lifecycle methods and adding specific functionality for modular components.
PERFORMANCE
Section titled “PERFORMANCE”- Consider optimizing the
byId()
function for large collections using more efficient data structures or search algorithms - Evaluate memory usage when multiple addons are instantiated
SECURITY
Section titled “SECURITY”- Add validation for addon IDs to prevent duplication
- Consider implementing access control mechanisms for sensitive addons
COMPLIANCE
Section titled “COMPLIANCE”- Ensure compatibility with industrial Modbus-485 specifications
- Maintain backward compatibility with existing addon implementations
RECOMMENDATIONS
Section titled “RECOMMENDATIONS”- Use meaningful, unique IDs for each addon to simplify management
- Consider implementing a registration system to avoid manual management of addon collections
- Document specific addon implementations with clear usage examples