Modbus Enums and Constants
Modbus Enumerations and Constants
Section titled “Modbus Enumerations 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.
REQUIREMENTS
Section titled “REQUIREMENTS”- No direct hardware requirements
- Consistent implementation across the codebase
PROVIDES
Section titled “PROVIDES”COMPONENT_KEY_BASE
- Base key identifiers for system componentsCOMPONENT_TYPE
- Component type classification- Error Code Constants - System-wide error definitions
OBJECT_RUN_FLAGS
- Runtime behavior flags for componentsOBJECT_NET_CAPS
- Network capability flagsMB_REGISTER_MODE
- Modbus register access modesE_CALLS
- Call type definitionsE_MessageFlags
- Message processing flagsMB_FC
- Modbus function codesMODBUS_ERRORS
- Standard Modbus error codesE_ModbusType
- Modbus data type definitionsE_ModbusAccess
- Modbus access permissions
FEATURES
Section titled “FEATURES”- 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
DEPENDENCIES
Section titled “DEPENDENCIES”- No direct dependencies on other components
BEHAVIOUR
Section titled “BEHAVIOUR”The enumerations and constants in this file define the protocol and behavior parameters used by other components in the system.
PERFORMANCE
Section titled “PERFORMANCE”- Consider using more compact types for memory-constrained applications
- Evaluate if any enumerations could be consolidated to reduce memory usage
SECURITY
Section titled “SECURITY”- Ensure error codes don’t leak sensitive information in production environments
- Consider adding authentication/authorization related constants for secure Modbus implementations
COMPLIANCE
Section titled “COMPLIANCE”- Maintain alignment with Modbus specification for all Modbus-related constants
- Consider adding comments with references to specific sections of the Modbus specification
RECOMMENDATIONS
Section titled “RECOMMENDATIONS”- 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