# samirsalman/wiguana architecture

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

- Interactive diagram: https://gitdiagram.com/samirsalman/wiguana
- Repository: https://github.com/samirsalman/wiguana

## Overview

##### Project type and purpose
- This is a multi-module native Android application (no backend server), created as a university project.
- Two APK modules (“app” for data logging, “mapmonitor” for map visualization) plus a shared utility library (“testlib”).
- Purpose:
- “app” captures radio-signal strength and USB-serial messages from a Wiguana router device, logs the measurements.
- “mapmonitor” reads a JSON data asset and renders navigation UI.
- “testlib” supplies common utilities (e.g. ByteUtil).

##### File structure
- Top-level Gradle settings define three subprojects:
- app/ – the main WIGUANADataLogger Android app
- mapmonitor/ – a second Android app for map monitoring
- testlib/ – Android library module with shared code
- Each Android module follows the standard Android Studio layout:
src/main/java → Activities, Fragments, Services, Model classes
src/main/res → layouts, drawables, values
src/androidTest & src/test → instrumentation and unit tests
- Configuration files: build.gradle in each module, proguard rules, AndroidManifest.xml, gradle wrapper.

##### Key architecture insights from README
- No backend; the “system” is the phone + hardware device.
- USB/serial communication through UsbService.
- Radio-signal transmission to/from a router device, measuring range via received signal strength.
- Data is logged (CSVLine, ByteUtil) and stored locally.

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% App Module
    subgraph "App Module"
        subgraph "UI Layer"
            MainActivity["MainActivity"]:::ui
            LogFragment["LogFragment"]:::ui
            MapFragment["MapFragment"]:::ui
            MainFragment["MainFragment"]:::ui
            WiguanaTestActivity["WiguanaTestActivity"]:::ui
        end
        subgraph "Service Layer"
            UsbService["UsbService"]:::service
        end
        subgraph "Domain/Data Layer"
            Rilevazione["Rilevazione"]:::data
            CSVLine["CSVLine"]:::data
            ByteUtilApp["ByteUtil"]:::data
            MapClass["Map"]:::data
        end
        subgraph "Configuration"
            buildApp["build.gradle"]:::module
            AndroidManifestApp["AndroidManifest.xml"]:::module
            ProguardApp["proguard-rules.pro"]:::module
        end
        StorageCSV[("Local CSV / DB")]:::storage
    end

    %% MapMonitor Module
    subgraph "MapMonitor Module"
        subgraph "UI Layer"
            NavigationActivity["NavigationActivity"]:::ui
            WiguanaApplication["WiguanaApplication"]:::ui
        end
        Assets["data.json"]:::data
        subgraph "Configuration"
            buildMap["build.gradle"]:::module
            AndroidManifestMap["AndroidManifest.xml"]:::module
            ProguardMap["proguard-rules.pro"]:::module
        end
        StorageMap[("Assets / JSON")]:::storage
    end

    %% TestLib Module
    subgraph "TestLib Module"
        ByteUtilLib["ByteUtil"]:::data
        MyClass["MyClass"]:::data
        buildLib["build.gradle"]:::module
    end

    %% External Hardware
    Router[/"Wiguana Router Device"/]:::external

    %% Dependencies and Data Flow
    MainActivity -->|"uses"| UsbService
    UsbService -->|"USB-Serial"| Router
    MapClass -->|"Radio"| Router
    UsbService -->|"produces"| Rilevazione
    Rilevazione -->|"formats"| CSVLine
    CSVLine -->|"stores"| StorageCSV

    NavigationActivity -->|"loads"| Assets
    Assets -->|"renders"| StorageMap

    ByteUtilApp -->|"shared util"| ByteUtilLib
    NavigationActivity -->|"shared util"| ByteUtilLib
    AppModule_Dependency[/App Module/] -->|depends on| TestLibModule[/TestLib Module/]
    MapMonitor_Dependency[/MapMonitor Module/] -->|depends on| TestLibModule[/TestLib Module/]

    %% Click Events
    click MainActivity "https://github.com/samirsalman/wiguana/blob/master/app/src/main/java/ppl/wiguana/wiguanadatalogger/MainActivity.java"
    click LogFragment "https://github.com/samirsalman/wiguana/blob/master/app/src/main/java/ppl/wiguana/wiguanadatalogger/LogFragment.java"
    click MapFragment "https://github.com/samirsalman/wiguana/blob/master/app/src/main/java/ppl/wiguana/wiguanadatalogger/MapFragment.java"
    click MainFragment "https://github.com/samirsalman/wiguana/blob/master/app/src/main/java/ppl/wiguana/wiguanadatalogger/MainFragment.java"
    click WiguanaTestActivity "https://github.com/samirsalman/wiguana/blob/master/app/src/main/java/ppl/wiguana/wiguanadatalogger/WiguanaTestActivity.java"
    click UsbService "https://github.com/samirsalman/wiguana/blob/master/app/src/main/java/ppl/wiguana/wiguanadatalogger/UsbService.java"
    click Rilevazione "https://github.com/samirsalman/wiguana/blob/master/app/src/main/java/ppl/wiguana/wiguanadatalogger/Rilevazione.java"
    click CSVLine "https://github.com/samirsalman/wiguana/blob/master/app/src/main/java/ppl/wiguana/wiguanadatalogger/CSVLine.java"
    click ByteUtilApp "https://github.com/samirsalman/wiguana/blob/master/app/src/main/java/ppl/wiguana/wiguanadatalogger/ByteUtil.java"
    click MapClass "https://github.com/samirsalman/wiguana/blob/master/app/src/main/java/ppl/wiguana/wiguanadatalogger/Map.java"
    click buildApp "https://github.com/samirsalman/wiguana/blob/master/app/build.gradle"
    click AndroidManifestApp "https://github.com/samirsalman/wiguana/blob/master/app/src/main/AndroidManifest.xml"
    click ProguardApp "https://github.com/samirsalman/wiguana/blob/master/app/proguard-rules.pro"
    click NavigationActivity "https://github.com/samirsalman/wiguana/blob/master/mapmonitor/src/main/java/app/ppl/wiguana/NavigationActivity.java"
    click WiguanaApplication "https://github.com/samirsalman/wiguana/blob/master/mapmonitor/src/main/java/app/ppl/wiguana/WiguanaApplication.java"
    click Assets "https://github.com/samirsalman/wiguana/blob/master/mapmonitor/src/main/assets/data.json"
    click buildMap "https://github.com/samirsalman/wiguana/blob/master/mapmonitor/build.gradle"
    click AndroidManifestMap "https://github.com/samirsalman/wiguana/blob/master/mapmonitor/src/main/AndroidManifest.xml"
    click ProguardMap "https://github.com/samirsalman/wiguana/blob/master/mapmonitor/proguard-rules.pro"
    click ByteUtilLib "https://github.com/samirsalman/wiguana/blob/master/testlib/src/main/java/app/ppl/tv/testlib/ByteUtil.java"
    click MyClass "https://github.com/samirsalman/wiguana/blob/master/testlib/src/main/java/app/ppl/tv/testlib/MyClass.java"
    click buildLib "https://github.com/samirsalman/wiguana/blob/master/testlib/build.gradle"

    %% Styles
    classDef ui fill:#AED6F1,stroke:#333,stroke-width:1px
    classDef service fill:#A9DFBF,stroke:#333,stroke-width:1px
    classDef data fill:#D7BDE2,stroke:#333,stroke-width:1px
    classDef storage fill:#F9E79F,stroke:#333,stroke-width:1px
    classDef module fill:#D0ECE7,stroke:#333,stroke-width:1px
    classDef external fill:#E8DAEF,stroke:#333,stroke-width:1px
```
