# vremsoftwaredevelopment/wifianalyzer architecture

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

- Interactive diagram: https://gitdiagram.com/vremsoftwaredevelopment/wifianalyzer
- Repository: https://github.com/vremsoftwaredevelopment/wifianalyzer

## Overview

##### Project Type and Purpose
- This is an Android mobile application that performs WiFi network analysis. Its primary objectives include scanning for nearby WiFi access points, analyzing channel signal strengths, graphing signal data over time, and applying various filters and exports.
- The README emphasizes core features (e.g., access point identification, graphing of channels, export functionality, filtering by WiFi band/signal strength) and clearly indicates that the application is not meant for WiFi cracking but for network analysis.

##### Key Components from the File Structure
- The “src/main” folder includes many packages organized by functionality. For instance:
‒ UI and Navigation: Packages like com/vrem/wifianalyzer/navigation (handling NavigationMenu, DrawerNavigation, etc.), and fragment packages like “about” and settings.
‒ WiFi-Related Domains: Multiple subpackages under com/vrem/wifianalyzer/wifi that are further segregated into modules for access point handling, scanning, filtering, graphing (graphutils), and managing WiFi functionalities.
‒ Utility Classes: Located under util, which include helper classes for string manipulation, file and build utilities.
‒ External libraries: There is inclusion of a “jjoe64/graphview” package indicating use of graphing libraries.
- The “src/test” and “src/androidTest” directories contain comprehensive test suites (both unit and instrumented tests), indicating a strong emphasis on code quality.
- Other build files (build.gradle, settings.gradle) and CI/CD configurations (GitHub workflows, fastlane metadata) show that the project is setup with modern Android development practices.

##### Interpreting the Architecture and Components
- UI/Presentation Layer:
- MainActivity along with various fragments (e.g., AboutFragment, SettingsFragment) make up the user interface.
- Layout resources and menus structured under “res/layout”, “res/menu”, etc., are used to define the views.
- Domain and Business Logic Layer:
- Packages under “wifi/model” define data models like WiFiData, WiFiDetail, and related models.
- The “wifi/filter” and “wifi/navigation” packages implement logic for filtering and navigating between different views and functionalities.
- The “wifi/scanner” package contains classes such as Scanner, ScannerCallback, and services that interface with the Android WiFi system.
- Data/Integration Layer:
- The “wifi/manager” package encapsulates interactions with Android's WiFiManager.
- Utility classes (for file handling, build utilities, etc.) provide reusable functionality across features.
- External Libraries and Frameworks:
- Use of third-party libraries such as GraphView (com/jjoe64/graphview) for rendering analytics and charts.
- Gradle and fastlane support for building and deployment.

##### Relationships and Interactions
- The UI layer (activities/fragments) triggers scanning and data collection by invoking services in the WiFi scanner and manager packages.
- Scanning services, upon receiving data from the device’s WiFi hardware, pass network details to filtering modules which can then be used for graphing.
- The graphutils module is responsible for translating raw data into visual representations, using GraphView.
- Navigation components (drawer, bottom navigation) enable switching between different presentations of data (e.g., detailed views vs. compact views) and settings.
- Utility and helper classes support various layers by abstracting common functionalities.

##### Architectural Patterns and Design Principles
- While the project does not explicitly state a design pattern, the clear separation between UI (activities/fragments), domain (models, business logic in filtering and scanning), and integration (WiFi managers) suggests a layered architecture.
- There’s a modular organization where each major feature (e.g., graphing, filtering, exporting) has its own dedicated package. This modularity supports ease of testing as revealed by the extensive test directories.

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% UI/Presentation Layer
    subgraph "UI/Presentation Layer"
        MA("Main Activity"):::android
        AF("About Fragment"):::android
        SF("Settings Fragment"):::android
        DN("Drawer Navigation"):::android
    end

    %% Domain/Business Logic Layer
    subgraph "Domain/Business Logic Layer"
        SC("WiFi Scanning Service"):::domain
        WF("WiFi Filtering Module"):::domain
        GU("Graph Utilities Module"):::domain
        EX("Export Functionality"):::domain
    end

    %% Integration/Service Layer
    subgraph "Integration/Service Layer"
        WM("WiFi Manager Wrapper"):::integration
    end

    %% Utility & External Modules
    subgraph "Utility & External Modules"
        BU("Build Utilities"):::utility
        GV("GraphView Library"):::external
    end

    %% Connections
    %% UI to Domain/Business Logic
    MA -->|"startScan"| SC
    DN -->|"navigateTo"| AF
    DN -->|"navigateTo"| SF
    MA -->|"triggerExport"| EX

    %% Domain interactions
    SC -->|"getWifiData"| WM
    SC -->|"filterData"| WF
    WF -->|"toGraph"| GU
    GU -->|"renderGraph"| GV

    %% Utility usage
    SC -->|"utilize"| BU
    GU -->|"utilize"| BU

    %% Click Events
    click MA "https://github.com/vremsoftwaredevelopment/wifianalyzer/blob/main/app/src/main/kotlin/com/vrem/wifianalyzer/MainActivity.kt"
    click AF "https://github.com/vremsoftwaredevelopment/wifianalyzer/blob/main/app/src/main/kotlin/com/vrem/wifianalyzer/about/AboutFragment.kt"
    click SF "https://github.com/vremsoftwaredevelopment/wifianalyzer/blob/main/app/src/main/kotlin/com/vrem/wifianalyzer/settings/SettingsFragment.kt"
    click DN "https://github.com/vremsoftwaredevelopment/wifianalyzer/blob/main/app/src/main/kotlin/com/vrem/wifianalyzer/DrawerNavigation.kt"
    click SC "https://github.com/vremsoftwaredevelopment/wifianalyzer/blob/main/app/src/main/kotlin/com/vrem/wifianalyzer/wifi/scanner/ScannerService.kt"
    click WM "https://github.com/vremsoftwaredevelopment/wifianalyzer/blob/main/app/src/main/kotlin/com/vrem/wifianalyzer/wifi/manager/WiFiManagerWrapper.kt"
    click WF "https://github.com/vremsoftwaredevelopment/wifianalyzer/blob/main/app/src/main/kotlin/com/vrem/wifianalyzer/wifi/filter/Filter.kt"
    click GU "https://github.com/vremsoftwaredevelopment/wifianalyzer/blob/main/app/src/main/kotlin/com/vrem/wifianalyzer/wifi/graphutils/GraphViewBuilder.kt"
    click EX "https://github.com/vremsoftwaredevelopment/wifianalyzer/blob/main/app/src/main/kotlin/com/vrem/wifianalyzer/export/Export.kt"
    click BU "https://github.com/vremsoftwaredevelopment/wifianalyzer/blob/main/app/src/main/kotlin/com/vrem/util/BuildUtils.kt"
    click GV "https://github.com/vremsoftwaredevelopment/wifianalyzer/tree/main/app/src/main/java/com/jjoe64/graphview"

    %% Styles
    classDef android fill:#AED6F1,stroke:#1B4F72,stroke-width:2px;
    classDef domain fill:#F9E79F,stroke:#B7950B,stroke-width:2px;
    classDef integration fill:#F5B7B1,stroke:#922B21,stroke-width:2px;
    classDef utility fill:#D5F5E3,stroke:#117864,stroke-width:2px;
    classDef external fill:#E8DAEF,stroke:#6C3483,stroke-width:2px;
```
