# xdsopl/robot36 architecture

> Architecture diagram of the GitHub repository xdsopl/robot36, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-03-31). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/xdsopl/robot36
- Repository: https://github.com/xdsopl/robot36

## Overview

##### Main Components
- User Interface (UI) & Presentation Layer:
- This is visible in the Android-specific files: MainActivity.java, XML layout files (activity_main.xml, activity_main_land.xml, text_page.xml) and various resource files (drawables, menus, mipmaps).
- It represents what the end user sees and interacts with.

- Application / Business Logic Layer:
- Located primarily in the Java package under xdsopl/robot36.
- This layer includes components for signal processing and data transformations. Key classes include:
▪ DSP algorithms: FastFourierTransform, ShortTimeFourierTransform, Complex, ComplexConvolution – hinting at frequency analysis and related computations.
▪ Filters and transformations: Filter, ExponentialMovingAverage, SimpleMovingAverage, SimpleMovingSum.
▪ Modulation/Demodulation and decoding: Demodulator, Decoder, FrequencyModulation, RGBDecoder, RawDecoder.
▪ Utility and conversion: ColorConverter, Phasor, and others that likely help process or transform the raw data for display.

- Test Components:

- Build and Configuration:
- There are build files (build.gradle, settings.gradle, and gradle configuration) showing how the project is assembled. Although not running-time modules, these indicate the dependency management and build pipeline.

##### Relationships and Interactions
- The UI layer (MainActivity and related XML layouts) interacts with the application logic. For example, user actions in the app would trigger calls to the DSP components.
- The build configuration is external to the runtime logic but is important for understanding how the system is constructed and deployed.

##### Architectural Patterns or Design Principles
- Layered Architecture: Clearly differentiate the presentation (UI) from the business/processing logic.
- Modularization: The separation in packages (e.g., different algorithms grouped under the same package) can be shown as modules that perform distinct signal processing tasks.
- (Potential) Model-View-Controller (MVC) principles where the MainActivity (controller/view) interacts with underlying models (the DSP processing classes) to update the view after data processing.

##### Relevant Technologies, Frameworks, and Libraries
- Android Framework: Since resources such as AndroidManifest.xml, XML layout files, and activity classes are central.
- Java: The whole application logic is built in Java.
- Gradle: As the build and dependency management tool.
- DSP Libraries: While it appears the DSP implementations are native, any external libraries for signal processing might be referenced if seen in build files.

##### Essential Elements
- Clear Labels for each Component:
- Interaction Lines:
- Dependencies, for example, the relationship between the signal processing components and any utility classes (like the ColorConverter).

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% User Interface Layer
    subgraph "User Interface Layer"
        MA["MainActivity"]:::ui
        L1["activity_main.xml"]:::ui
        L2["activity_main_land.xml"]:::ui
        L3["text_page.xml"]:::ui
        RES["Resources"]:::ui
    end

    %% DSP Processing Layer
    subgraph "DSP Processing Layer"
        subgraph "Fourier Transforms"
            FFT["FastFourierTransform"]:::dsp
            STFT["ShortTimeFourierTransform"]:::dsp
            CMP["Complex"]:::dsp
            CCP["ComplexConvolution"]:::dsp
        end
        subgraph "Filters"
            FIL["Filter"]:::dsp
            EMA["ExponentialMovingAverage"]:::dsp
            SMA["SimpleMovingAverage"]:::dsp
            SMS["SimpleMovingSum"]:::dsp
        end
        subgraph "Decoding & Modulation"
            DEM["Demodulator"]:::dsp
            DEC["Decoder"]:::dsp
            FMOD["FrequencyModulation"]:::dsp
            RGB["RGBDecoder"]:::dsp
            RAW["RawDecoder"]:::dsp
        end
        subgraph "Utilities"
            CC["ColorConverter"]:::dsp
            PHS["Phasor"]:::dsp
        end
    end

    %% Testing Components
    subgraph "Testing"
        UT["Unit Tests"]:::test
        IT["Instrumented Tests"]:::test
    end

    %% Build and Configuration
    subgraph "Build & Configuration"
        BG["app/build.gradle"]:::build
        PG["build.gradle"]:::build
        SG["settings.gradle"]:::build
        GP["gradle.properties"]:::build
        GD["gradle (dir)"]:::build
    end

    %% Connections between Layers
    L1 -->|"loaded_by"| MA
    L2 -->|"loaded_by"| MA
    L3 -->|"loaded_by"| MA
    RES -->|"assets"| MA
    MA -->|"process_data"| FFT
    FFT --> FIL
    FIL --> DEM
    DEM --> RGB
    RGB -->|"update_UI"| MA

    %% Click Events for UI Layer
    click MA "https://github.com/xdsopl/robot36/blob/v2/app/src/main/java/xdsopl/robot36/MainActivity.java"
    click L1 "https://github.com/xdsopl/robot36/blob/v2/app/src/main/res/layout/activity_main.xml"
    click L2 "https://github.com/xdsopl/robot36/blob/v2/app/src/main/res/layout/activity_main_land.xml"
    click L3 "https://github.com/xdsopl/robot36/blob/v2/app/src/main/res/layout/text_page.xml"
    click RES "https://github.com/xdsopl/robot36/tree/v2/app/src/main/res/drawable"

    %% Click Events for DSP Algorithms & Business Logic Layer
    click FFT "https://github.com/xdsopl/robot36/blob/v2/app/src/main/java/xdsopl/robot36/FastFourierTransform.java"
    click STFT "https://github.com/xdsopl/robot36/blob/v2/app/src/main/java/xdsopl/robot36/ShortTimeFourierTransform.java"
    click CMP "https://github.com/xdsopl/robot36/blob/v2/app/src/main/java/xdsopl/robot36/Complex.java"
    click CCP "https://github.com/xdsopl/robot36/blob/v2/app/src/main/java/xdsopl/robot36/ComplexConvolution.java"
    click FIL "https://github.com/xdsopl/robot36/blob/v2/app/src/main/java/xdsopl/robot36/Filter.java"
    click EMA "https://github.com/xdsopl/robot36/blob/v2/app/src/main/java/xdsopl/robot36/ExponentialMovingAverage.java"
    click SMA "https://github.com/xdsopl/robot36/blob/v2/app/src/main/java/xdsopl/robot36/SimpleMovingAverage.java"
    click SMS "https://github.com/xdsopl/robot36/blob/v2/app/src/main/java/xdsopl/robot36/SimpleMovingSum.java"
    click DEM "https://github.com/xdsopl/robot36/blob/v2/app/src/main/java/xdsopl/robot36/Demodulator.java"
    click DEC "https://github.com/xdsopl/robot36/blob/v2/app/src/main/java/xdsopl/robot36/Decoder.java"
    click FMOD "https://github.com/xdsopl/robot36/blob/v2/app/src/main/java/xdsopl/robot36/FrequencyModulation.java"
    click RGB "https://github.com/xdsopl/robot36/blob/v2/app/src/main/java/xdsopl/robot36/RGBDecoder.java"
    click RAW "https://github.com/xdsopl/robot36/blob/v2/app/src/main/java/xdsopl/robot36/RawDecoder.java"
    click CC "https://github.com/xdsopl/robot36/blob/v2/app/src/main/java/xdsopl/robot36/ColorConverter.java"
    click PHS "https://github.com/xdsopl/robot36/blob/v2/app/src/main/java/xdsopl/robot36/Phasor.java"

    %% Click Events for Test Components
    click UT "https://github.com/xdsopl/robot36/blob/v2/app/src/test/java/xdsopl/robot36/ExampleUnitTest.java"
    click IT "https://github.com/xdsopl/robot36/blob/v2/app/src/androidTest/java/xdsopl/robot36/ExampleInstrumentedTest.java"

    %% Click Events for Build and Configuration
    click BG "https://github.com/xdsopl/robot36/blob/v2/app/build.gradle"
    click PG "https://github.com/xdsopl/robot36/blob/v2/build.gradle"
    click SG "https://github.com/xdsopl/robot36/blob/v2/settings.gradle"
    click GP "https://github.com/xdsopl/robot36/blob/v2/gradle.properties"
    click GD "https://github.com/xdsopl/robot36/tree/v2/gradle"

    %% Styles
    classDef ui fill:#E3F2FD,stroke:#1E88E5,stroke-width:2px;
    classDef dsp fill:#F1F8E9,stroke:#66BB6A,stroke-width:2px;
    classDef test fill:#FFF9C4,stroke:#FBC02D,stroke-width:2px;
    classDef build fill:#FCE4EC,stroke:#EC407A,stroke-width:2px;
```
