A modular, multi-threaded camera system designed for embedded applications with real-time audio/video processing and network communication capabilities.
- Multi-threaded Architecture: Efficient task management with thread coordination
- Inter-Task Communication: Thread-safe mailbox system for message passing
- Hardware Abstraction: Modular design for audio, video, and network components
- Real-time Processing: Low-latency audio and video processing
- Network Integration: MQTT support for IoT connectivity
- Graceful Shutdown: Proper resource cleanup and thread management
- Cross-platform: Support for native and ARM cross-compilation
iCamera uses a layered architecture with the following components:
- Task Management Layer: Centralized task coordination via
ManagersTask - Communication Layer: Thread-safe mailbox system for inter-task messaging
- Application Tasks: Specialized tasks for user input, message processing, audio, video, and networking
- Hardware Abstraction Layer: Device managers for audio, video, and network hardware
- CMake 3.10 or higher
- C++17 compatible compiler (GCC 7+, Clang 5+)
- Threading library (pthread)
- SSL/TLS libraries (for MQTT)
- Paho MQTT C library
-
Clone the repository:
git clone <repository-url> cd iCamera
-
Build the project:
# Native build (development) ./scripts/build_project.sh native # Cross-compilation for ARM ./scripts/build_project.sh cross
-
Install (optional):
./scripts/build_project.sh install
# Run the application
./build/bin/iCameraOnce the application is running, you can interact with it using the following commands:
msg <text>- Send a text messagesignal <number>- Send a signal eventevent <name> <payload>- Send a custom eventquit- Shutdown the application gracefully
iCamera starting...
[INFO] ManagersTask: Starting
[INFO] ManagersTask: Started task Sender
[INFO] ManagersTask: Started task Receiver
Enter command (msg <text> | signal <num> | event <name> <payload> | quit): msg Hello World
[Receiver] From: 2 To: 3
[Receiver] String: Hello World
Enter command (msg <text> | signal <num> | event <name> <payload> | quit): signal 5
[Receiver] From: 2 To: 3
[Receiver] SignalEvent: 5
Enter command (msg <text> | signal <num> | event <name> <payload> | quit): event test data
[Receiver] From: 2 To: 3
[Receiver] CustomEvent: test | data
Enter command (msg <text> | signal <num> | event <name> <payload> | quit): quit
[Receiver] From: 2 To: 3
[Receiver] SignalEvent: 0
[Receiver] Shutdown signal received. Exiting...
[INFO] ManagersTask: Stopping
[INFO] ManagersTask: Stopped task Sender
[INFO] ManagersTask: Stopped task Receiver
iCamera stopped
iCamera/
├── docs/ # Documentation
│ ├── ARCHITECTURE.md # System architecture
│ └── API_REFERENCE.md # API documentation
├── include/ # Header files
│ └── paho/ # MQTT library headers
├── lib/ # Library files
├── scripts/ # Build scripts
│ └── build_project.sh # Main build script
├── source/ # Source code
│ ├── app/ # Application tasks
│ │ ├── aiotek_managers_task.cpp
│ │ ├── task_sender.cpp
│ │ └── task_receiver.cpp
│ ├── common/ # Common utilities
│ │ └── aiotek_timer.cpp
│ ├── core/ # Core system
│ │ └── aiotek_mailbox.cpp
│ ├── module/ # Hardware modules
│ │ ├── audio/
│ │ ├── video/
│ │ └── network/
│ ├── utils/ # Utility functions
│ │ ├── aiotek_log.cpp
│ │ └── aiotek_console.cpp
│ └── main.cpp # Main application
├── CMakeLists.txt # CMake configuration
└── README.md # This file
The project supports multiple build configurations:
- Native Build: For development and testing on the host system
- Cross-compilation: For ARM-based embedded targets
- Debug/Release: Different optimization levels
Configuration can be modified through:
- Hardware Settings: Device parameters in respective manager classes
- Network Settings: MQTT broker configuration
- Task Parameters: Task-specific settings in
ManagersTask
-
Define the task function:
void my_new_task() { while (true) { // Task logic here if (AIOTEK::g_shutdown_requested) break; } }
-
Register the task in
ManagersTaskconstructor:tasks.push_back({"MyTask", my_new_task}); -
Add message handling if needed (optional)
-
Extend the MailboxMessage variant:
using MailboxMessage = std::variant< SignalEvent, ErrorEvent, CustomEvent, std::string, int, MyNewEvent // Add new type >;
-
Update message processing in
task_receiver
- Implement device manager following the existing pattern
- Create task wrapper for the hardware module
- Add to task list in
ManagersTask - Configure device parameters as needed
Individual components can be tested in isolation:
# Test mailbox functionality
# Test task management
# Test hardware modulesTest the complete system:
# Test task communication
# Test system startup/shutdown
# Test error handlingMonitor system performance:
# Measure message throughput
# Monitor resource usage
# Test under load-
Build Errors:
- Ensure all dependencies are installed
- Check compiler version compatibility
- Verify CMake configuration
-
Runtime Errors:
- Check hardware device availability
- Verify network connectivity (for MQTT)
- Review log output for error details
-
Thread Issues:
- Ensure proper thread cleanup
- Check for race conditions
- Verify thread safety
Enable debug logging:
AIOTEK::Logger::setLevel(AIOTEK::LogLevel::DEBUG);Review log output for:
- Task startup/shutdown messages
- Error events and codes
- Performance metrics
- System status information
- Fork the repository
- Create a feature branch
- Make your changes
- Add tests for new functionality
- Update documentation
- Submit a pull request
- Follow C++17 standards
- Use RAII for resource management
- Implement proper error handling
- Add comprehensive logging
- Maintain thread safety
[Add your license information here]
For questions, issues, or contributions:
- Issues: Use the GitHub issue tracker
- Documentation: Check the
docs/directory - API Reference: See
docs/API_REFERENCE.md - Architecture: See
docs/ARCHITECTURE.md
- Plugin System: Dynamic task loading
- Web Interface: Configuration and monitoring UI
- Advanced Logging: Structured logging with rotation
- Metrics Collection: Performance monitoring and analytics
- High Availability: Fault tolerance and recovery
- Load Balancing: Task distribution optimization
- Memory Optimization: Reduced memory footprint
- Latency Reduction: Faster message processing
- Scalability: Multi-node support
For detailed technical information, see the Architecture Documentation and API Reference.