How augmentos-community/smartglassesmanager works
Main Components
• Mobile Platforms:
– Android SmartGlassesManager (SGM_android): This is a full Android app that includes native C++ audio processing (via ogg/opus encoder libraries, JNI bridges, etc.), Android services (SmartGlassesAndroidService), event bus handlers, and multiple packages for communications, speech recognition (Google, Azure, Deepgram, Vosk), and device-specific adaptations.
– iOS SGM Module (SGM_iOS): A Swift-based implementation that provides similar functionality for the iOS platform.
– Android Frontend (android_smart_glasses_frontend) and Example App (example_smart_glasses_app): These projects appear to be front-facing applications and sample implementations that use the SmartGlassesManager middleware.
• Connectivity & Communication Layer:
– WebSocket Servers/Clients (e.g., AspWebsocketServer on the phone side, AsgWebSocketClient in the frontend) used for data streaming between devices.
– Underlying communication channels: WiFi (the phone’s hotspot), Bluetooth, and MCU/glasses-specific networking.
• Audio and Sensor Data Processing:
– Native C++ modules (found under src/main/cpp) for audio encoding with ogg/opus and related third-party libraries.
– JNI bridges allowing Java components (or Swift for iOS) to call into these native libraries.
• Speech Recognition Subsystem:
– Multiple integration modules for Google Cloud Speech, Azure, Deepgram, Vosk, etc., including dedicated packages and helper classes.
• UI and User Interaction:
– Android UI components containing activities, fragments, and layouts (such as MainActivity, various UI package classes, and layout XML resources).
– Smart glasses’ minimal UI or “heads-up display” components abstracted by the middleware.
• Utility and Support Modules:
– Utility classes (AES encryption, bitmap manipulation, network utils, etc.), event bus message definitions, and configuration files.
• Third-Party Libraries:
– Bundled and compiled native libraries (libogg, libopus, opus_tools) and included build scripts (CMakeLists, gradle files).
Relationships and Data Flows
• From the UI layer to the Communication layer representing user actions (e.g., “Connect Smart Glasses”, “Start Hotspot”).
• From the Communication layer to the Native Audio Processing and Speech Recognition subsystems, illustrating the flow of audio and sensor data.
• Between the mobile device and smart glasses hardware – label connections such as “WiFi Hotspot”, “Bluetooth”, or “Direct IP”.
• Integration with external services (Google Cloud, Azure, etc.) from the Speech Recognition subsystem.
Architectural Patterns and Design Principles
– Modular design: Separate modules for connectivity, audio processing, and speech recognition.
– Abstraction: The middleware “abstracts” hardware differences from different smart glasses models.
– Cross-platform support: Parallel implementations for Android and iOS.
– Use of native libraries: Integration via JNI for performance-critical C++ code (ogg/opus encoder and related tools).
– Event-driven architecture: Presence of event bus messages to communicate among different components (e.g., audio events, connection status events).
Details About Key Technologies
– Android SDK and Gradle for Android builds; Xcode/Swift Package Manager for iOS.
– C/C++ for native audio encoding and processing (with CMake build scripts).
– WebSocket and network communication components.
– Third-party libraries: libogg, libopus, opus_tools.
– Integration with cloud-based speech-to-text APIs.
– Standard UI components and layouts (XML) for Android presentation.