Skip to content

Modbus Enums and Constants

Path: /src/modbus/enums.h

Revision History: Initial documentation

This file defines the core enumerations and constants used throughout the industrial control application, particularly for Modbus communications, component management, and error handling.

  • No direct hardware requirements
  • Consistent implementation across the codebase
  • COMPONENT_KEY_BASE - Base key identifiers for system components
  • COMPONENT_TYPE - Component type classification
  • Error Code Constants - System-wide error definitions
  • OBJECT_RUN_FLAGS - Runtime behavior flags for components
  • OBJECT_NET_CAPS - Network capability flags
  • MB_REGISTER_MODE - Modbus register access modes
  • E_CALLS - Call type definitions
  • E_MessageFlags - Message processing flags
  • MB_FC - Modbus function codes
  • MODBUS_ERRORS - Standard Modbus error codes
  • E_ModbusType - Modbus data type definitions
  • E_ModbusAccess - Modbus access permissions
  • Comprehensive error code system with reserved ranges for subsystems
  • Modbus protocol constants aligned with industry standards
  • Component type classification for system organization
  • Runtime behavior flags for component lifecycle management
  • Message handling flags for inter-component communication
  • No direct dependencies on other components

Modbus Enumerations and Constants

Other System Components

The enumerations and constants in this file define the protocol and behavior parameters used by other components in the system.

Constants Definition

Used by Components

Component Interaction

Error Handling

Modbus Protocol Execution

  • Consider using more compact types for memory-constrained applications
  • Evaluate if any enumerations could be consolidated to reduce memory usage
  • Ensure error codes don’t leak sensitive information in production environments
  • Consider adding authentication/authorization related constants for secure Modbus implementations
  • Maintain alignment with Modbus specification for all Modbus-related constants
  • Consider adding comments with references to specific sections of the Modbus specification
  • When extending error codes, maintain the hierarchical structure
  • When adding new component types, ensure they follow the established naming convention
  • Consider adding range validation macros alongside the constants