Skip to content

Component Class

Path: src/modbus/Component.h

Revision History: Initial documentation

The Component class represents a generic component for industrial applications. It provides a foundation for creating various types of components with consistent behavior and interface. These components can be integrated into a modbus-based industrial control system.

  • ESP-32 platform
  • No specific hardware pins required as this is a base class
  • Component class - A base class for creating components in an industrial application
  • Constants:
    • COMPONENT_DEFAULT - Default run flags for a component
    • COMPONENT_NO_ID - Default ID for a component
  • Name-based component identification
  • ID-based component identification
  • Configurable run flags
  • Support for owner-child relationship between components
  • Type identification through enumeration
  • Integration with Modbus communication

Component

WString

ArduinoLog

Vector

enums

constants

error_codes

macros

xtypes

ModbusBlockView

ModbusTCP

RS485

Bridge

The Component class operates as a base class that defines common behavior for various industrial components.

Run Flags

End of loop

Initialize Component

Setup Component

Run Loop

Cleanup

  • Consider implementing lazy initialization for components with high initialization costs
  • Evaluate the memory footprint of components in resource-constrained environments
  • Implement access control mechanisms for sensitive components
  • Ensure proper validation of component IDs and types to prevent misuse
  • Review compliance with industrial standards for component interfaces
  • Ensure compatibility with Modbus protocol specifications
  • Extend this base class for specific component types rather than modifying the base class
  • Use meaningful names and IDs for components to improve system maintainability
  • Set appropriate run flags based on the component’s intended behavior
  • Organize components in a logical hierarchy using the owner-child relationship