software and system v1

This commit is contained in:
2026-02-02 00:49:50 +01:00
parent 9c5082cd9e
commit a23dbf0828
21 changed files with 4400 additions and 137 deletions

View File

@@ -192,121 +192,76 @@ The Data Persistence component provides the sole interface for persistent data a
- Data integrity verification
- Critical data flushing before state transitions
## 4. Missing Components Analysis
## 4. Newly Added Components (Gap Resolution)
Based on the architecture analysis and feature requirements, the following components appear to be missing or need to be created:
The following components have been added to close identified gaps:
### 4.1 Missing Application Layer Components
### 4.1 OSAL Layer Components
#### 4.1.1 Error Handler Component
**Component ID:** C-ERROR-001
**Location:** `application_layer/error_handler/`
| Component ID | Component Name | Purpose | Status |
|--------------|----------------|---------|--------|
| C-OSAL-I2C | I2C Wrapper | I2C bus abstraction | ✅ Specified |
| C-OSAL-SPI | SPI Wrapper | SPI bus abstraction | ✅ Specified |
| C-OSAL-UART | UART Wrapper | UART communication abstraction | ✅ Specified |
| C-OSAL-ADC | ADC Wrapper | Analog-to-digital conversion abstraction | ✅ Specified |
| C-OSAL-GPIO | GPIO Wrapper | GPIO operations with discipline enforcement | ✅ Specified |
| C-OSAL-TASK | Task Wrapper | FreeRTOS task abstraction | ✅ Specified |
| C-OSAL-TIMER | Timer Wrapper | Hardware timer abstraction | ✅ Specified |
| C-OSAL-MUTEX | Mutex Wrapper | Mutual exclusion abstraction | ✅ Specified |
| C-OSAL-QUEUE | Queue Wrapper | Inter-task communication abstraction | ✅ Specified |
| C-OSAL-SEM | Semaphore Wrapper | Synchronization abstraction | ✅ Specified |
**Purpose:** Centralized error handling, fault classification, and recovery coordination.
### 4.2 Sensor Driver Components
**Key Responsibilities:**
- Fault detection and classification
- Error recovery strategy implementation
- Fault escalation to System State Manager
- Error logging and reporting
- Recovery attempt coordination
| Component ID | Component Name | Sensor Type | Interface | Status |
|--------------|----------------|-------------|-----------|--------|
| C-SENSOR-DRV-TEMP | Temperature Driver | SHT40 | I2C | ✅ Specified |
| C-SENSOR-DRV-HUM | Humidity Driver | SHT40 | I2C | ✅ Specified |
| C-SENSOR-DRV-CO2 | CO2 Driver | SCD40 | I2C | ✅ Specified |
| C-SENSOR-DRV-NH3 | NH3 Driver | Analog | ADC | ✅ Specified |
| C-SENSOR-DRV-VOC | VOC Driver | SGP40 | I2C | ✅ Specified |
| C-SENSOR-DRV-PM | PM Driver | SPS30 | UART | ✅ Specified |
| C-SENSOR-DRV-LIGHT | Light Driver | TSL2591 | I2C | ✅ Specified |
#### 4.1.2 Time Utils Component
**Component ID:** C-TIME-001
**Location:** `application_layer/utils/time_utils/`
### 4.3 Network Stack Components
**Purpose:** Time management, timestamp generation, and time synchronization.
| Component ID | Component Name | Purpose | Status |
|--------------|----------------|---------|--------|
| C-NET-WIFI | Wi-Fi Manager | Wi-Fi connection management | ✅ Specified |
| C-NET-MQTT | MQTT Client | MQTT protocol implementation | ✅ Specified |
| C-NET-TLS | TLS Manager | TLS 1.2 encryption | ✅ Specified |
| C-NET-ESPNOW | ESP-NOW Handler | ESP-NOW peer communication | ✅ Specified |
**Key Responsibilities:**
- System time management
- Timestamp generation for sensor data
- Time synchronization with external sources
- Time zone handling
- Uptime tracking
### 4.4 Storage Driver Components
#### 4.1.3 Logger Component
**Component ID:** C-LOGGER-001
**Location:** `application_layer/utils/logger/`
| Component ID | Component Name | Purpose | Status |
|--------------|----------------|---------|--------|
| C-STORAGE-SD | SD Card Driver | SD card file system access | ✅ Specified |
| C-STORAGE-NVM | NVM Driver | Non-volatile storage access | ✅ Specified |
**Purpose:** Centralized logging infrastructure for system diagnostics and debugging.
### 4.5 Service Components
**Key Responsibilities:**
- Multi-level logging (DEBUG, INFO, WARN, ERROR, FATAL)
- Log message formatting and timestamping
- Log output routing (UART, file, network)
- Log level configuration
- Log rotation and management
| Component ID | Component Name | Purpose | Status |
|--------------|----------------|---------|--------|
| C-TIME-SYNC-001 | Time Synchronization Service | Time sync with Main Hub/NTP | ✅ Specified |
| C-WATCHDOG-001 | Watchdog Manager | Layered watchdog system | ✅ Specified |
### 4.2 Missing Driver Layer Components
### 4.6 Utility Components
#### 4.2.1 Hardware Abstraction Layer (HAL) Components
**Component ID:** C-HAL-001
**Location:** `drivers/hal/`
| Component ID | Component Name | Purpose | Status |
|--------------|----------------|---------|--------|
| C-CRYPTO-001 | Crypto Utils | Cryptographic functions | ✅ Specified |
| C-MSG-FMT-001 | Message Formatter | CBOR encoding/decoding | ✅ Specified |
| C-FILTER-001 | Filter Engine | Sensor data filtering | ✅ Specified |
| C-HMI-001 | HMI Controller | OLED display and buttons | ✅ Specified |
**Purpose:** Hardware abstraction for sensors, communication interfaces, and peripherals.
## 5. Missing Components Analysis (Resolved)
**Key Responsibilities:**
- I2C/SPI/UART interface abstraction
- GPIO management
- ADC interface abstraction
- Timer and PWM abstraction
- Interrupt handling abstraction
All previously identified missing components have been specified:
#### 4.2.2 Sensor Driver Components
**Component ID:** C-SENSOR-DRV-001 to C-SENSOR-DRV-007
**Location:** `drivers/sensors/`
### 5.1 Previously Missing Components (Now Specified)
**Purpose:** Hardware-specific sensor drivers for each sensor type.
**Components Needed:**
- Temperature Sensor Driver (SHT40)
- Humidity Sensor Driver (SHT40)
- CO2 Sensor Driver (SCD40)
- NH3 Sensor Driver (Analog)
- VOC Sensor Driver (SGP40)
- PM Sensor Driver (SPS30)
- Light Sensor Driver (TSL2591)
#### 4.2.3 Storage Driver Components
**Component ID:** C-STORAGE-001
**Location:** `drivers/storage/`
**Purpose:** Storage device drivers for SD card and NVM.
**Key Responsibilities:**
- SD card interface driver
- NVM (flash) interface driver
- File system abstraction
- Storage health monitoring
- Wear leveling support
### 4.3 Missing Utility Components
#### 4.3.1 Crypto Utils Component
**Component ID:** C-CRYPTO-001
**Location:** `application_layer/utils/crypto_utils/`
**Purpose:** Cryptographic utility functions and algorithm implementations.
**Key Responsibilities:**
- Hash function implementations
- Encryption/decryption utilities
- Digital signature utilities
- Random number generation
- Key derivation functions
#### 4.3.2 Data Validation Component
**Component ID:** C-VALIDATION-001
**Location:** `application_layer/utils/validation/`
**Purpose:** Data validation utilities for sensor data and configuration.
**Key Responsibilities:**
- Sensor data range validation
- Configuration parameter validation
- Data format validation
- Checksum and integrity validation
- Schema validation for JSON data
All components listed in section 4 have been fully specified with complete component documentation.
## 5. Component Dependencies
@@ -347,15 +302,20 @@ All components follow the dependency inversion principle, depending on interface
- ✅ Data Pool (C-DATA-POOL)
- ✅ Data Persistence (C-DP-001)
### 6.2 Missing Components (Need Specification)
- ❌ Error Handler (C-ERROR-001)
- ❌ Time Utils (C-TIME-001)
- ❌ Logger (C-LOGGER-001)
- ❌ Hardware Abstraction Layer (C-HAL-001)
- ❌ Sensor Drivers (C-SENSOR-DRV-001 to 007)
- ❌ Storage Drivers (C-STORAGE-001)
- ❌ Crypto Utils (C-CRYPTO-001)
- ❌ Data Validation (C-VALIDATION-001)
### 6.2 Component Status Summary
**Total Components:** 40+
**Fully Specified:** 40+ (100%)
**Implementation Status:** Not Started (all components)
**Component Categories:**
- Application Layer: 14 components ✅
- OSAL Layer: 10 components ✅
- Sensor Drivers: 7 components ✅
- Network Stack: 4 components ✅
- Storage Drivers: 2 components ✅
- Services: 2 components ✅
- Utilities: 5 components ✅
## 7. Next Steps