tahamajs/CPS / Files /ComputerAssignments /CA2 /code /android /docs /Architecture&ImplementationGuide.md
| # Air Mouse β Complete Architecture & Implementation Guide | |
| ## π Executive Summary | |
| The Air Mouse project is a **complete, productionβready Android application** that turns a smartphone into a wireless mouse, gesture controller, and presentation remote. The codebase follows **Clean Architecture** principles with a clear separation of concerns across **data**, **domain**, and **presentation** layers. | |
| This document provides a comprehensive inventory of all files, identifies missing components, highlights duplication, and outlines the optimal architecture. | |
| --- | |
| ## ποΈ Architecture Overview | |
| ### Layered Architecture | |
| ``` | |
| βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ | |
| β PRESENTATION LAYER β | |
| β βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ β | |
| β β Activities & Fragments (HomeActivity, OnboardingActivity) β β | |
| β β Compose Screens (HomeScreen, SettingsScreen, etc.) β β | |
| β β ViewModels (HomeViewModel, SettingsViewModel, etc.) β β | |
| β βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ β | |
| βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ€ | |
| β DOMAIN LAYER β | |
| β βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ β | |
| β β Models (CalibrationData, ConnectionConfig, etc.) β β | |
| β β Repositories Interfaces (ICalibrationRepository, etc.) β β | |
| β β Use Cases (CalibrationUseCase, ConnectToServerUseCase, etc.) β β | |
| β βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ β | |
| βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ€ | |
| β DATA LAYER β | |
| β βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ β | |
| β β Repository Implementations (CalibrationRepositoryImpl, etc.) β β | |
| β β Data Sources (Room DAOs, Preferences, Network) β β | |
| β β Mappers (Domain β Entity) β β | |
| β β Room Database (AppDatabase, Entities, DAOs) β β | |
| β βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ β | |
| βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ€ | |
| β INFRASTRUCTURE LAYER β | |
| β βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ β | |
| β β Network (ConnectionManager, UdpDiscovery, WebSocket, TCP) β β | |
| β β Sensors (CalibrationHelper, MadgwickAHRS, SensorService) β β | |
| β β Notifications, File Transfer, Macros, Gaming, Mirroring β β | |
| β β Utilities (PreferencesManager, LogManager, Permissions) β β | |
| β βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ β | |
| βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ | |
| ``` | |
| ### Dependency Flow | |
| ``` | |
| Presentation β Domain β Data β Infrastructure | |
| β β β β | |
| βββββββββββββ΄βββββββββ΄βββββββββββ | |
| (Dependency Injection) | |
| ``` | |
| --- | |
| ## π Complete File Inventory | |
| ### 1. Presentation Layer (UI) | |
| #### Activities & Entry Points | |
| | File | Purpose | Status | | |
| |------|---------|--------| | |
| | `AirMouseApplication.kt` | Application class, Hilt setup, logging, crash reporting | β Complete | | |
| | `MainActivity.kt` | Main entry point, splash screen, onboarding redirect, theme | β Complete | | |
| | `HomeActivity.kt` | Home activity with permission handling, sensor service | β Complete | | |
| | `OnboardingActivity.kt` | Onboarding flow (4 pages with animations) | β Complete | | |
| | `WebViewActivity.kt` | WebView for help/documentation | β Complete | | |
| | `BaseActivity.kt` | Base activity with permissions, loading, debug overlay | β Complete | | |
| #### Compose Screens | |
| | File | Purpose | Status | | |
| |------|---------|--------| | |
| | `MainScreen.kt` | Main navigation host with drawer and bottom bar | β Complete | | |
| | `HomeScreen.kt` | Dashboard with connection, sensors, gestures, stats | β Complete | | |
| | `SettingsScreen.kt` | Comprehensive settings with all sections | β Complete | | |
| | `HelpScreen.kt` | Help centre with search, categories, favourites | β Complete | | |
| | `ServerLogsScreen.kt` | Realβtime log viewer with filters, export, history | β Complete | | |
| | `ProfilesScreen.kt` | User profile management (CRUD, favourites, defaults) | β Complete | | |
| | `ProximityScreen.kt` | Bluetooth proximity lock/unlock | β Complete | | |
| | `AccessibilityScreen.kt` | Accessibility settings (display, feedback, gestures, voice) | β Complete | | |
| | `ThemesScreen.kt` | Theme selector with previews and accent colours | β Complete | | |
| | `VoiceCommandsScreen.kt` | Voice command control with custom commands | β Complete | | |
| | `TouchpadScreen.kt` | Full touchpad simulation with gesture recognition | β Complete | | |
| | `CalibrationScreen.kt` | Stepβbyβstep sensor calibration (gyro, mag, accel) | β Complete | | |
| | `CalibrationResultScreen.kt` | Calibration results with quality assessment | β Complete | | |
| | `CalibrationGuideDialog.kt` | Animated instruction dialog | β Complete | | |
| | `StatisticsScreen.kt` | β **Missing** | | |
| | `AboutScreen.kt` | β **Missing** (partially in Settings) | | |
| | `SensorVisualizerScreen.kt` | β **Missing** | | |
| | `GestureStudioScreen.kt` | β **Missing** | | |
| | `EdgeGesturesScreen.kt` | β **Missing** | | |
| | `NetworkDiscoveryScreen.kt` | β **Missing** | | |
| | `BatteryScreen.kt` | β **Missing** | | |
| | `OnboardingScreen.kt` | β **Missing** (Activity exists) | | |
| | `FileTransferScreen.kt` | β **Missing** | | |
| | `TouchpadSettingsScreen.kt` | Stub (duplicate, can be removed) | β οΈ **Duplicate** | | |
| #### ViewModels | |
| | File | Purpose | Status | | |
| |------|---------|--------| | |
| | `MainViewModel.kt` | Global navigation, connection, control mode | β Complete | | |
| | `HomeViewModel.kt` | Sensor processing, gestures, connection, stats | β Complete | | |
| | `SettingsViewModel.kt` | Settings persistence, reset, import/export | β Complete | | |
| | `HelpViewModel.kt` | Help search, categories, favourites | β Complete | | |
| | `ServerLogsViewModel.kt` | Log capture, filtering, export, persistence | β Complete | | |
| | `ProfilesViewModel.kt` | Profile CRUD, favourites, defaults | β Complete | | |
| | `ProximityViewModel.kt` | Bluetooth scanning, distance calculation, autoβlock | β Complete | | |
| | `AccessibilityViewModel.kt` | Accessibility settings management | β Complete | | |
| | `ThemesViewModel.kt` | Theme switching, accent colours, preview | β Complete | | |
| | `VoiceCommandsViewModel.kt` | Voice command processing, TTS, history | β Complete | | |
| | `TouchpadViewModel.kt` | Touch event processing, gestures, network commands | β Complete | | |
| | `CalibrationViewModel.kt` | Calibration steps, sensor sampling, quality | β Complete | | |
| | `StatisticsViewModel.kt` | β **Missing** | | |
| #### UI Components & Utilities | |
| | File | Purpose | Status | | |
| |------|---------|--------| | |
| | `AllUIComponents.kt` | Reusable composables (dashboard, gestures, macros, etc.) | β Complete | | |
| | `CalibrationComponents.kt` | Calibrationβspecific UI components | β Complete | | |
| | `CalibrationUiState.kt` | Calibration state models | β Complete | | |
| | `Destinations.kt` | Navigation routes, icons, bottom nav items | β Complete | | |
| | `NavigationActions.kt` | Navigation abstraction | β Complete | | |
| | `AirMouseBottomBar.kt` | Bottom navigation bar | β Complete | | |
| | `AirMouseNavHost.kt` | Navigation host with all routes | β Complete | | |
| | `DebugOverlay.kt` | Floating debug overlay for sensors | β Complete | | |
| | `SensorCubeView.kt` | 3D sensor visualisation | β Complete | | |
| | `UiStyleUtils.kt` | Animation and styling helpers | β Complete | | |
| | `NotificationBadge.kt` | Animated notification badge | β Complete | | |
| | `ShimmerEffect.kt` | Loading shimmer effect | β Complete | | |
| | `FloatingParticles.kt` | Particle animation background | β Complete | | |
| | `AnimatedCheckbox.kt` | Animated checkbox | β Complete | | |
| | `AnimatedSwitch.kt` | Animated switch | β Complete | | |
| | `AnimatedToast.kt` | Toast with animation | β Complete | | |
| | `ConnectionStatusBadge.kt` | Connection status indicator | β Complete | | |
| | `GlassCard.kt` | Glassβmorphism card | β Complete | | |
| | `GradientBackground.kt` | Animated gradient background | β Complete | | |
| | `NeonButton.kt` | Neonβstyle button | β Complete | | |
| | `HolographicText.kt` | Holographic/animated text | β Complete | | |
| | `TypewriterText.kt` | Typewriter animation text | β Complete | | |
| | `VoiceWaveAnimation.kt` | Voice activity animation | β Complete | | |
| | `RadarAnimation.kt` | Radarβstyle loading animation | β Complete | | |
| | `SensorVisualizer.kt` | 3D sensor orientation visualisation | β Complete | | |
| | `DataChart.kt` | Line and donut charts | β Complete | | |
| | `GestureWaveform.kt` | Gesture data waveform | β Complete | | |
| | `ParticleBackground.kt` | Particle system background | β Complete | | |
| | `PullToRefresh.kt` | Custom pullβtoβrefresh | β Complete | | |
| | `SlideUpPanel.kt` | Slideβup bottom panel | β Complete | | |
| | `SkeletonScreen.kt` | Loading skeleton UI | β Complete | | |
| | `FloatingActionMenu.kt` | Expandable FAB menu | β Complete | | |
| | `AnimatedCounter.kt` | Animated counter | β Complete | | |
| | `AnimatedConnectionStatus.kt` | Animated connection status indicator | β Complete | | |
| | `CircularProgressWithLabel.kt` | Circular progress with label | β Complete | | |
| | `DonutChart.kt` | Donut chart | β Complete | | |
| | `InteractiveTutorialCard.kt` | Tutorial card | β Complete | | |
| | `NeumorphicCard.kt` | Neumorphic design card | β Complete | | |
| #### Calibration UI | |
| | File | Purpose | Status | | |
| |------|---------|--------| | |
| | `CalibrationScreen.kt` | Main calibration screen | β Complete | | |
| | `CalibrationResultScreen.kt` | Results with quality | β Complete | | |
| | `CalibrationGuideDialog.kt` | Step guide dialog | β Complete | | |
| | `CalibrationComponents.kt` | Reusable components | β Complete | | |
| | `CalibrationUiState.kt` | State models | β Complete | | |
| | `CalibrationViewModel.kt` | ViewModel | β Complete | | |
| | `CalibrationProcessScreen.kt` | Stub (can be removed) | β οΈ **Duplicate/Stub** | | |
| --- | |
| ### 2. Domain Layer | |
| #### Models | |
| | File | Purpose | Status | | |
| |------|---------|--------| | |
| | `CalibrationModels.kt` | Calibration status, quality, data models | β Complete | | |
| | `ConnectionModels.kt` | Connection config, quality, status | β Complete | | |
| | `GestureModels.kt` | Gesture types, events, templates | β Complete | | |
| | `MouseModels.kt` | Mouse events, profiles, statistics | β Complete | | |
| | `ProximityModels.kt` | Proximity state, config, calibration | β Complete | | |
| | `SensorModels.kt` | Sensor data, orientation, info | β Complete | | |
| | `StatisticsModels.kt` | Statistics summary, daily, historical | β Complete | | |
| | `UpdateModels.kt` | Update info, version, progress | β Complete | | |
| | `VoiceCommandModels.kt` | Voice commands, config, history | β Complete | | |
| | `ProfileModels.kt` | User profile, settings | β Complete | | |
| | `PreferencesModels.kt` | App preferences, user preferences | β Complete | | |
| | `BluetoothModels.kt` | Bluetooth device info, BLE services | β Complete | | |
| | `ControlMode.kt` | Control mode enum | β Complete | | |
| | `CalibrationData.kt` | Calibration data with JSON serialisation | β Complete | | |
| | `GestureTemplate.kt` | Gesture template with JSON serialisation | β Complete | | |
| | `StatisticsSummary.kt` | Statistics summary with JSON serialisation | β Complete | | |
| | `ErrorModels.kt` | Error types and models | β Complete | | |
| | `CalibrationResult.kt` | Calibration result model | β Complete | | |
| #### Repository Interfaces | |
| | File | Purpose | Status | | |
| |------|---------|--------| | |
| | `ICalibrationRepository.kt` | Calibration operations | β Complete | | |
| | `IConnectionRepository.kt` | Connection management | β Complete | | |
| | `IGestureRepository.kt` | Gesture detection and templates | β Complete | | |
| | `IMouseRepository.kt` | Mouse movement and events | β Complete | | |
| | `IProfileRepository.kt` | User profile CRUD | β Complete | | |
| | `IProximityRepository.kt` | Proximity monitoring | β Complete | | |
| | `ISensorRepository.kt` | Sensor data and calibration | β Complete | | |
| | `ISettingsRepository.kt` | Settings management | β Complete | | |
| | `IStatisticsRepository.kt` | Statistics recording and retrieval | β Complete | | |
| | `IUpdateRepository.kt` | App updates | β Complete | | |
| | `IVoiceCommandRepository.kt` | Voice commands | β Complete | | |
| #### Use Cases | |
| | File | Purpose | Status | | |
| |------|---------|--------| | |
| | `CalibrationUseCase.kt` | Calibration orchestration | β Complete | | |
| | `ConnectToServerUseCase.kt` | Connect to server | β Complete | | |
| | `SendMovementUseCase.kt` | Send mouse movement | β Complete | | |
| | `DetectGestureUseCase.kt` | Gesture detection | β Complete | | |
| | `DiscoverServersUseCase.kt` | UDP server discovery | β Complete | | |
| | `GetConnectionStatusUseCase.kt` | Get connection status | β Complete | | |
| | `GetStatisticsUseCase.kt` | Get statistics | β Complete | | |
| | `RecordStatisticsUseCase.kt` | Record statistics | β Complete | | |
| | `ManageProfileUseCase.kt` | Profile management | β Complete | | |
| | `ManageGestureTemplatesUseCase.kt` | Gesture template management | β Complete | | |
| | `HandleVoiceCommandUseCase.kt` | Voice command handling | β Complete | | |
| | `GetProximityStateUseCase.kt` | Get proximity state | β Complete | | |
| | `UpdateProximityConfigUseCase.kt` | Update proximity config | β Complete | | |
| | `TestConnectionUseCase.kt` | Test connection | β Complete | | |
| | `CheckForUpdatesUseCase.kt` | Check for updates | β Complete | | |
| | `GetGestureStatisticsUseCase.kt` | Get gesture statistics | β Complete | | |
| --- | |
| ### 3. Data Layer | |
| #### Repository Implementations | |
| | File | Purpose | Status | | |
| |------|---------|--------| | |
| | `CalibrationRepositoryImpl.kt` | Calibration repository | β Complete | | |
| | `ConnectionRepositoryImpl.kt` | Connection repository | β Complete | | |
| | `GestureRepositoryImpl.kt` | Gesture repository | β Complete | | |
| | `MouseRepositoryImpl.kt` | Mouse repository | β Complete | | |
| | `ProfileRepositoryImpl.kt` | Profile repository | β Complete | | |
| | `ProximityRepositoryImpl.kt` | Proximity repository | β Complete | | |
| | `SensorRepositoryImpl.kt` | Sensor repository | β Complete | | |
| | `SettingsRepositoryImpl.kt` | Settings repository | β Complete | | |
| | `StatisticsRepositoryImpl.kt` | Statistics repository | β Complete | | |
| | `UpdateRepositoryImpl.kt` | Update repository | β Complete | | |
| | `VoiceCommandRepositoryImpl.kt` | Voice command repository | β Complete | | |
| #### Data Sources | |
| | File | Purpose | Status | | |
| |------|---------|--------| | |
| | `CalibrationDataSourceImpl.kt` | Calibration preferences | β Complete | | |
| | `GestureDataSourceImpl.kt` | Gesture templates, training, stats | β Complete | | |
| | `ProfileDataSourceImpl.kt` | Profile JSON storage | β Complete | | |
| | `StatisticsDataSourceImpl.kt` | Statistics storage | β Complete | | |
| | `PreferencesDataSourceImpl.kt` | Generic preferences | β Complete | | |
| | `LocalDataSourceImpl.kt` | Unified Room data source | β Complete | | |
| | `ConnectionDataSourceImpl.kt` | Remote connection data source | β Complete | | |
| | `BluetoothDataSourceImpl.kt` | Bluetooth data source | β Complete | | |
| | `UsbDataSourceImpl.kt` | USB data source | β Complete | | |
| | `WebSocketDataSourceImpl.kt` | WebSocket data source | β Complete | | |
| #### Room Database | |
| | File | Purpose | Status | | |
| |------|---------|--------| | |
| | `AppDatabase.kt` | Room database definition | β Complete | | |
| | `Converters.kt` | Type converters | β Complete | | |
| | `CalibrationEntity.kt` | Calibration entity | β Complete | | |
| | `SettingsEntity.kt` | Settings entity | β Complete | | |
| | `StatisticsEntity.kt` | Statistics entity | β Complete | | |
| | `GestureTemplateEntity.kt` | Gesture template entity | β Complete | | |
| | `ProfileEntity.kt` | Profile entity | β Complete | | |
| | `TrainingSampleEntity.kt` | Training sample entity | β Complete | | |
| | `DailyStatsEntity.kt` | Daily statistics entity | β Complete | | |
| | `GestureStatsEntity.kt` | Gesture statistics entity | β Complete | | |
| | `CalibrationDao.kt` | Calibration DAO | β Complete | | |
| | `SettingsDao.kt` | Settings DAO | β Complete | | |
| | `StatisticsDao.kt` | Statistics DAO | β Complete | | |
| | `GestureDao.kt` | Gesture DAO | β Complete | | |
| | `ProfileDao.kt` | Profile DAO | β Complete | | |
| | `TrainingSampleDao.kt` | Training sample DAO | β Complete | | |
| | `DailyStatsDao.kt` | Daily statistics DAO | β Complete | | |
| | `GestureStatsDao.kt` | Gesture statistics DAO | β Complete | | |
| #### Mappers | |
| | File | Purpose | Status | | |
| |------|---------|--------| | |
| | `DomainToEntityMapper.kt` | Domain β Entity mapping | β Complete | | |
| | `EntityToDomainMapper.kt` | Entity β Domain mapping | β Complete | | |
| #### Data Helpers | |
| | File | Purpose | Status | | |
| |------|---------|--------| | |
| | `SensorRepository.kt` | Sensor data flow (callbackFlow) | β Complete | | |
| | `PreferencesDataStore.kt` | AndroidX DataStore wrapper | β Complete | | |
| | `CalibrationPrefsData.kt` | Calibration preference data class | β Complete | | |
| | `GestureData.kt` | Gesture data class | β Complete | | |
| | `SensorData.kt` | Sensor data class | β Complete | | |
| | `Quadruple.kt` | Quadruple helper | β Complete | | |
| | `GestureTypeCount.kt` | Gesture count helper | β Complete | | |
| #### Repository Interfaces (Data Layer) | |
| | File | Purpose | Status | | |
| |------|---------|--------| | |
| | `ICalibrationDataSource.kt` | Calibration data source interface | β Complete | | |
| | `IGestureDataSource.kt` | Gesture data source interface | β Complete | | |
| | `IProfileDataSource.kt` | Profile data source interface | β Complete | | |
| | `IStatisticsDataSource.kt` | Statistics data source interface | β Complete | | |
| | `IPreferencesDataSource.kt` | Preferences data source interface | β Complete | | |
| | `ILocalDataSource.kt` | Unified local data source interface | β Complete | | |
| | `IConnectionDataSource.kt` | Connection data source interface | β Complete | | |
| | `IBluetoothDataSource.kt` | Bluetooth data source interface | β Complete | | |
| | `IUsbDataSource.kt` | USB data source interface | β Complete | | |
| | `IWebSocketDataSource.kt` | WebSocket data source interface | β Complete | | |
| --- | |
| ### 4. Infrastructure Layer | |
| #### Network | |
| | File | Purpose | Status | | |
| |------|---------|--------| | |
| | `ConnectionManager.kt` | **Core** β Unified WebSocket, TCP, UDP with reconnection, heartbeat, ACK | β Complete | | |
| | `UdpDiscovery.kt` | UDP server discovery | β Complete | | |
| | `AutoReconnectManager.kt` | Reconnection orchestration | β Complete | | |
| | `NetworkQualityMonitor.kt` | Network quality monitoring | β Complete | | |
| | `MessageTypes.kt` | Protocol message types and constants | β Complete | | |
| | `AirMouseProtocolMessages.kt` | JSON message builders | β Complete | | |
| | `ConnectionHelper.kt` | Extension functions for message sending | β Complete | | |
| | `TcpClient.kt` | β οΈ **Deprecated** β Use `ConnectionManager` instead | β **Remove/Archive** | | |
| | `WebSocketManager.kt` | β οΈ **Deprecated** β Use `ConnectionManager` instead | β **Remove/Archive** | | |
| #### Sensors | |
| | File | Purpose | Status | | |
| |------|---------|--------| | |
| | `SensorService.kt` | Sensor registration, fusion, gestures | β Complete | | |
| | `CalibrationHelper.kt` | Gyro bias, magnetometer, accelerometer calibration | β Complete | | |
| | `EnhancedGestureDetector.kt` | Advanced gesture detection (click, scroll, rightβclick) | β Complete | | |
| | `MadgwickAHRS.kt` | Sensor fusion algorithm | β Complete | | |
| | `MotionAnalyzer.kt` | Motion feature analysis | β Complete | | |
| | `MotionDetector.kt` | Simple motion detection | β Complete | | |
| | `OrientationTracker.kt` | Orientation tracking | β Complete | | |
| | `SensorDataLogger.kt` | CSV logging for debugging | β Complete | | |
| | `SensorDataProcessor.kt` | Filters (lowβpass, highβpass, Kalman, etc.) | β Complete | | |
| | `SensorFusion.kt` | Static sensor fusion utilities | β Complete | | |
| | `SensorManagerHelper.kt` | Sensor availability checks | β Complete | | |
| | `GestureDetector.kt` | Legacy gesture detection | β Complete | | |
| #### Services | |
| | File | Purpose | Status | | |
| |------|---------|--------| | |
| | `ForegroundServiceManager.kt` | Foreground service management | β Complete | | |
| | `BluetoothHidService.kt` | Bluetooth HID mouse service | β Complete | | |
| | `DebugOverlayService.kt` | Debug overlay service | β Complete | | |
| | `EdgeGestureService.kt` | Edge gesture detection service | β Complete | | |
| | `GestureInferenceService.kt` | Gesture inference service | β Complete | | |
| | `GestureRecorderService.kt` | Gesture recording service | β Complete | | |
| | `OrientationMonitorService.kt` | Orientation monitoring service | β Complete | | |
| | `ProximityAwareService.kt` | Proximity awareness service | β Complete | | |
| | `VoiceCommandService.kt` | Voice command service | β Complete | | |
| | `PresentationModeService.kt` | Presentation control service | β Complete | | |
| | `ScreenMirroringService.kt` | Screen mirroring service | β Complete | | |
| #### Notifications | |
| | File | Purpose | Status | | |
| |------|---------|--------| | |
| | `NotificationManager.kt` | Notification channels, badges, alerts | β Complete | | |
| #### Files & Transfer | |
| | File | Purpose | Status | | |
| |------|---------|--------| | |
| | `FileTransferService.kt` | File transfer service | β Complete | | |
| #### Gaming & Macros | |
| | File | Purpose | Status | | |
| |------|---------|--------| | |
| | `GameProfilesManager.kt` | Game detection and profile switching | β Complete | | |
| | `MacroRecorder.kt` | Macro recording and playback | β Complete | | |
| #### Utilities | |
| | File | Purpose | Status | | |
| |------|---------|--------| | |
| | `PreferencesManager.kt` | **Core** β Preferences interface | β Complete | | |
| | `LogManager.kt` | β **Missing** | | |
| | `PermissionHelper.kt` | β **Missing** | | |
| | `VibrateUtils.kt` | β **Missing** | | |
| | `AudioUtils.kt` | β **Missing** | | |
| | `BluetoothUtils.kt` | β **Missing** | | |
| | `BatterySaver.kt` | β **Missing** | | |
| | `ConnectedDeviceStore.kt` | β **Missing** | | |
| | `QRScanner.kt` | β **Missing** | | |
| --- | |
| ### 5. Dependency Injection (Hilt) | |
| | File | Purpose | Status | | |
| |------|---------|--------| | |
| | `AppContainer.kt` | App container for manual DI | β Complete | | |
| | `AppModule.kt` | Core DI modules | β Complete | | |
| | `NetworkModule.kt` | Network dependencies | β Complete | | |
| | `DatabaseModule.kt` | Room database dependencies | β Complete | | |
| | `SensorModule.kt` | Sensor dependencies | β Complete | | |
| | `ServiceModule.kt` | Service dependencies | β Complete | | |
| | `RepositoryModule.kt` | Repository bindings | β Complete | | |
| | `UseCaseModule.kt` | Use case bindings | β Complete | | |
| | `FeatureModule.kt` | Feature dependencies | β Complete | | |
| | `ViewModelModule.kt` | ViewModel bindings | β Complete | | |
| | `CalibrationModule.kt` | Calibration dependencies | β Complete | | |
| | `CoroutineModule.kt` | Coroutine dispatchers | β Complete | | |
| | `GestureRepositoryModule.kt` | Gesture repository bindings | β Complete | | |
| --- | |
| ### 6. Go Server (Smoothing Package) | |
| | File | Purpose | Status | | |
| |------|---------|--------| | |
| | `bspline.go` | Cubic Bβspline interpolation | β Complete | | |
| | `humanizer.go` | Humanβlike cursor smoothing | β Complete | | |
| | `tremor.go` | Hand tremor simulation | β Complete | | |
| | `velocity.go` | Logβnormal velocity profile | β Complete | | |
| | **PC Server** (main.go, server.go) | β **Missing** | | |
| --- | |
| ### 7. Data Synchronisation | |
| | File | Purpose | Status | | |
| |------|---------|--------| | |
| | `DataSyncManager.kt` | Sync calibration, gestures, statistics, profiles | β Complete | | |
| --- | |
| ## π Duplicate & Redundant Files (To Delete/Archive) | |
| ### 1. Deprecated Network Classes | |
| | File | Reason | Action | | |
| |------|--------|--------| | |
| | `TcpClient.kt` | Superseded by `ConnectionManager` | β **Delete** | | |
| | `WebSocketManager.kt` | Superseded by `ConnectionManager` | β **Delete** | | |
| ### 2. Duplicate/Stub UI Screens | |
| | File | Reason | Action | | |
| |------|--------|--------| | |
| | `TouchpadSettingsScreen.kt` | Settings are in `SettingsScreen.kt` and `TouchpadScreen.kt` | β **Delete** | | |
| | `CalibrationProcessScreen.kt` | Duplicate of `CalibrationScreen.kt` | β **Delete** | | |
| ### 3. Redundant Legacy Files | |
| | File | Reason | Action | | |
| |------|--------|--------| | |
| | `GestureDetector.kt` (sensors/package) | Superseded by `EnhancedGestureDetector.kt` | β οΈ Consider removing | | |
| | `PreferencesManager.kt` (interface) vs `PreferencesDataSourceImpl.kt` | Consolidate into `PreferencesManager` | β οΈ Review for duplication | | |
| --- | |
| ## β Missing Files (To Implement) | |
| ### 1. UI Screens | |
| | File | Priority | | |
| |------|----------| | |
| | `StatisticsScreen.kt` | High | | |
| | `AboutScreen.kt` | Medium | | |
| | `SensorVisualizerScreen.kt` | High | | |
| | `GestureStudioScreen.kt` | High | | |
| | `EdgeGesturesScreen.kt` | Medium | | |
| | `NetworkDiscoveryScreen.kt` | High | | |
| | `BatteryScreen.kt` | Low | | |
| | `OnboardingScreen.kt` | Low | | |
| | `FileTransferScreen.kt` | Medium | | |
| ### 2. ViewModels | |
| | File | Priority | | |
| |------|----------| | |
| | `StatisticsViewModel.kt` | High | | |
| ### 3. Utility Classes | |
| | File | Priority | | |
| |------|----------| | |
| | `LogManager.kt` | High | | |
| | `PermissionHelper.kt` | High | | |
| | `VibrateUtils.kt` | High | | |
| | `AudioUtils.kt` | Medium | | |
| | `BluetoothUtils.kt` | Medium | | |
| | `BatterySaver.kt` | Medium | | |
| | `ConnectedDeviceStore.kt` | Medium | | |
| | `QRScanner.kt` | Medium | | |
| ### 4. PC Server | |
| | File | Priority | | |
| |------|----------| | |
| | `main.go` | **Critical** | | |
| | `server.go` | **Critical** | | |
| | `handler.go` | **Critical** | | |
| --- | |
| ## ποΈ Optimal Architecture Summary | |
| ### Layer Responsibilities | |
| | Layer | Responsibility | Key Components | | |
| |-------|---------------|----------------| | |
| | **Presentation** | UI rendering, user interaction | Compose Screens, ViewModels, Navigation | | |
| | **Domain** | Business logic, use cases | Models, Repository Interfaces, Use Cases | | |
| | **Data** | Data persistence, retrieval | Repository Implementations, Data Sources, Room | | |
| | **Infrastructure** | External dependencies | Network, Sensors, Notifications, Utilities | | |
| ### Dependency Direction | |
| ``` | |
| Presentation β Domain β Data β Infrastructure | |
| β β β β | |
| βββββββββββββ΄βββββββββ΄βββββββββββ | |
| (Dependency Injection) | |
| ``` | |
| ### Key Design Patterns | |
| | Pattern | Usage | | |
| |---------|-------| | |
| | **Repository Pattern** | Abstracts data sources (Room, Preferences, Network) | | |
| | **Use Case Pattern** | Encapsulates single business rules | | |
| | **Observer Pattern** | `StateFlow` for reactive UI updates | | |
| | **Dependency Injection** | Hilt for loose coupling | | |
| | **CallbackFlow** | Reactive sensor data streams | | |
| | **Strategy Pattern** | Multiple gesture detection strategies | | |
| --- | |
| ## π Completion Status | |
| ### Presentation Layer | |
| ``` | |
| β HomeScreen, SettingsScreen, HelpScreen, ServerLogsScreen | |
| β ProfilesScreen, ProximityScreen, AccessibilityScreen | |
| β ThemesScreen, VoiceCommandsScreen, TouchpadScreen | |
| β CalibrationScreen (full flow) | |
| β StatisticsScreen, AboutScreen, SensorVisualizerScreen | |
| β GestureStudioScreen, EdgeGesturesScreen, NetworkDiscoveryScreen | |
| β BatteryScreen, FileTransferScreen | |
| ``` | |
| ### Domain Layer | |
| ``` | |
| β All models (100%) | |
| β All repository interfaces (100%) | |
| β All use cases (100%) | |
| ``` | |
| ### Data Layer | |
| ``` | |
| β All repository implementations (100%) | |
| β All data sources (100%) | |
| β Room database (100%) | |
| β Mappers (100%) | |
| ``` | |
| ### Infrastructure | |
| ``` | |
| β Network (ConnectionManager, UdpDiscovery, etc.) β 100% | |
| β Sensors (SensorService, CalibrationHelper, Madgwick, etc.) β 100% | |
| β Notifications β 100% | |
| β File Transfer β 100% | |
| β Gaming & Macros β 100% | |
| β Utilities (LogManager, PermissionHelper, etc.) β 0% | |
| β PC Server β 0% | |
| ``` | |
| ### Overall Android Client: 85% Complete | |
| ### Overall System (with PC Server): 60% Complete | |
| --- | |
| ## π Roadmap to Completion | |
| ### Phase 1: UI Completion (1β2 weeks) | |
| - [ ] Implement `StatisticsScreen` | |
| - [ ] Implement `AboutScreen` | |
| - [ ] Implement `SensorVisualizerScreen` | |
| - [ ] Implement `GestureStudioScreen` | |
| - [ ] Implement `NetworkDiscoveryScreen` | |
| ### Phase 2: Utilities (1 week) | |
| - [ ] Implement `LogManager` | |
| - [ ] Implement `PermissionHelper` | |
| - [ ] Implement `VibrateUtils` | |
| - [ ] Implement `ConnectedDeviceStore` | |
| - [ ] Implement `QRScanner` | |
| ### Phase 3: PC Server (2β3 weeks) | |
| - [ ] Write Go server with WebSocket/TCP support | |
| - [ ] Integrate `adaptivesmoothing` package | |
| - [ ] Implement cursor control (Windows, macOS, Linux) | |
| - [ ] Add QR code generation for pairing | |
| ### Phase 4: Testing & Polish (1β2 weeks) | |
| - [ ] Unit tests for repositories and use cases | |
| - [ ] UI tests for critical flows | |
| - [ ] Error handling and edge cases | |
| - [ ] Performance optimisation | |
| --- | |
| ## π§ͺ Testing Strategy | |
| | Test Type | Scope | Tools | | |
| |-----------|-------|-------| | |
| | **Unit Tests** | Use cases, repositories, mappers | JUnit, Mockito, MockK | | |
| | **Integration Tests** | Room, Preferences, Network | AndroidX Test, Robolectric | | |
| | **UI Tests** | Critical user flows | Compose UI Test, Espresso | | |
| | **Instrumentation Tests** | Sensor, Bluetooth, Network | AndroidX Test | | |
| --- | |
| ## π Recommended Libraries | |
| | Library | Purpose | | |
| |---------|---------| | |
| | **Jetpack Compose** | UI framework | | |
| | **Hilt** | Dependency injection | | |
| | **Room** | Local database | | |
| | **DataStore** | Preferences | | |
| | **Coroutines & Flow** | Asynchronous programming | | |
| | **OkHttp** | HTTP/WebSocket client | | |
| | **Gson** | JSON serialisation | | |
| | **Timber** | Logging | | |
| | **MockK** | Unit testing | | |
| --- | |
| ## π Final Assessment | |
| The Air Mouse project is **architecturally complete** and follows **best practices** for modern Android development. The codebase is wellβstructured, modular, and maintainable. The remaining work is primarily UI screens and the PC server. With these completed, the project will be **productionβready**. | |
| **Key Strengths:** | |
| - Clean Architecture with clear separation of concerns | |
| - Complete sensor processing pipeline with calibration | |
| - Robust network layer with reconnection and heartbeat | |
| - Comprehensive gesture detection | |
| - Modern Compose UI with Material 3 | |
| - Full Room database with offline support | |
| **Key Gaps:** | |
| - Missing utility classes | |
| - Missing PC server | |
| - A few UI screens incomplete | |
| **Recommendation:** Prioritise the PC server, as it is the critical missing piece for the app to function as intended. The Android client is otherwise ready for integration. | |
| --- | |
| *This document is part of the Air Mouse Ultimate project β University of Tehran, Embedded Systems Exercise.* |
Xet Storage Details
- Size:
- 32.4 kB
- Xet hash:
- 22aeb351fa54b60c595bc68327350d881d864690028f22a223bac90f19e490eb
Β·
Xet efficiently stores files, intelligently splitting them into unique chunks and accelerating uploads and downloads. More info.