Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
20 commits
Select commit Hold shift + click to select a range
dcae780
Start draft PR
region999 Jun 25, 2025
21541a1
Add .gitignore for Android project
region999 Jun 25, 2025
0c3ab9c
Implement SecurityTypeDetector with robust error handling for WiFi ne…
region999 Jun 25, 2025
dc8524e
Add comprehensive unit tests for SecurityTypeDetector
region999 Jun 25, 2025
9e92b49
Start draft PR
mexemexe Jun 25, 2025
307e507
Add comprehensive .gitignore for Android project
mexemexe Jun 25, 2025
675537b
Create WiFiSecurityType data class for network security representation
mexemexe Jun 25, 2025
1c0b9bf
Create WiFiSecurityMapper for mapping network capabilities to securit…
mexemexe Jun 25, 2025
f8c4e58
Add comprehensive tests for WiFiSecurityMapper
mexemexe Jun 25, 2025
620c4bc
Configure project build.gradle with dependencies
mexemexe Jun 25, 2025
15266f7
Create build.gradle configuration for Android/Kotlin project
revonetworx Jun 25, 2025
22e45ca
Start draft PR
revonetworx Jun 25, 2025
b30d08e
Add .gitignore for Python project
SoYan500 Jul 5, 2025
266939a
Start draft PR
SoYan500 Jul 5, 2025
b447a48
Implement IterationTracker with comprehensive iteration management
SoYan500 Jul 5, 2025
5964557
Add tests for IterationTracker
SoYan500 Jul 5, 2025
fadf315
Merged branch pr-1-souravg77-scanmywifi for PR https://github.com/sou…
SoYan500 Jul 5, 2025
e057d49
Update max_iterations check to allow exact max number of iterations
SoYan500 Jul 5, 2025
ed99dca
Merged branch pr-4-souravg77-scanmywifi for PR https://github.com/sou…
SoYan500 Jul 5, 2025
bbc657c
Merged branch pr-6-souravg77-scanmywifi for PR https://github.com/sou…
SoYan500 Jul 5, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
102 changes: 102 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,102 @@
<<<<<<< HEAD
<<<<<<< HEAD
__pycache__/
*.py[cod]
*$py.class
.pytest_cache/
.coverage
htmlcov/
dist/
build/
*.egg-info/
.env
.venv/
venv/
=======
# Android Studio
*.iml
.gradle/
build/
.idea/
local.properties

# Kotlin/Java compiled files
*.class
*.dex

# Dependency directories
/node_modules
/app/build

# Logging files
*.log

# Sensitive information
.env
=======
# Android Studio
.idea/
*.iml
.gradle/
build/
captures/
>>>>>>> pr-4-souravg77-scanmywifi

# OS generated files
.DS_Store
Thumbs.db
<<<<<<< HEAD
>>>>>>> pr-1-souravg77-scanmywifi
=======

# Kotlin/Android specific
*.class
*.log
*.apk
*.aar
*.dex
*.module

# Dependency directories
/node_modules
/jspm_packages

# Gradle
gradle/
gradlew
gradlew.bat

# Local configuration file
local.properties

# Log files
*.log

# Android Studio Navigation editor temp files
.navigation/

# Android Studio captures folder
/captures

# Intellij
*.ipr
*.iws

# External native build folder generated in Android Studio 2.2 and later
.externalNativeBuild
.cxx/

# Keystore files
*.jks
*.keystore

# Google Services (e.g. APIs or Firebase)
google-services.json

# Lint
lint/intermediates/
lint/generated/
lint/outputs/
lint/tmp/
lint/reports/
>>>>>>> pr-4-souravg77-scanmywifi
43 changes: 43 additions & 0 deletions app/build.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
plugins {
id 'com.android.application'
id 'kotlin-android'
}

android {
compileSdkVersion 30
defaultConfig {
applicationId "com.wifiscanner"
minSdkVersion 29
targetSdkVersion 30
versionCode 1
versionName "1.0"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}

buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
kotlinOptions {
jvmTarget = '1.8'
}
}

dependencies {
implementation "org.jetbrains.kotlin:kotlin-stdlib:1.5.21"
implementation 'androidx.core:core-ktx:1.6.0'
implementation 'androidx.appcompat:appcompat:1.3.1'
implementation 'com.google.android.material:material:1.4.0'

// Testing dependencies
testImplementation 'junit:junit:4.13.2'
testImplementation 'org.mockito:mockito-core:3.11.2'
androidTestImplementation 'androidx.test.ext:junit:1.1.3'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.4.0'
}
28 changes: 28 additions & 0 deletions build.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
plugins {
kotlin("jvm") version "1.9.0"
id("org.jetbrains.kotlin.plugin.serialization") version "1.9.0"
}

repositories {
mavenCentral()
google()
}

dependencies {
// Kotlin standard library
implementation("org.jetbrains.kotlin:kotlin-stdlib:1.9.0")

// Android dependencies
implementation("androidx.core:core-ktx:1.10.1")
implementation("androidx.appcompat:appcompat:1.6.1")

// Testing dependencies
testImplementation("junit:junit:4.13.2")
testImplementation("org.robolectric:robolectric:4.10.3")
testImplementation("org.mockito:mockito-core:4.11.0")
testImplementation("org.jetbrains.kotlin:kotlin-test:1.9.0")
}

tasks.test {
useJUnit()
}
173 changes: 173 additions & 0 deletions src/iteration_tracker.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,173 @@
from __future__ import annotations
from typing import Optional, Dict, Any
from dataclasses import dataclass, field
from enum import Enum, auto
import logging

class IterationStatus(Enum):
"""Enum representing the status of an iteration."""
INITIALIZED = auto()
IN_PROGRESS = auto()
COMPLETED = auto()
FAILED = auto()
TERMINATED = auto()

@dataclass
class IterationState:
"""Tracks the state and metadata of learning iterations."""
current_iteration: int = 0
max_iterations: Optional[int] = None
status: IterationStatus = IterationStatus.INITIALIZED
metadata: Dict[str, Any] = field(default_factory=dict)

def increment(self) -> None:
"""
Increment the iteration count and update status.

Raises:
StopIteration: If maximum iterations are reached.
"""
self.current_iteration += 1

if self.max_iterations is not None and self.current_iteration > self.max_iterations:
self.status = IterationStatus.COMPLETED
raise StopIteration("Maximum iterations reached")

self.status = IterationStatus.IN_PROGRESS

def reset(self) -> None:
"""Reset the iteration state to initial conditions."""
self.current_iteration = 0
self.status = IterationStatus.INITIALIZED
self.metadata.clear()

def set_status(self, status: IterationStatus) -> None:
"""
Set the current iteration status.

Args:
status (IterationStatus): New status to set
"""
self.status = status

def add_metadata(self, key: str, value: Any) -> None:
"""
Add metadata to the current iteration.

Args:
key (str): Metadata key
value (Any): Metadata value
"""
self.metadata[key] = value

@property
def is_complete(self) -> bool:
"""
Check if iteration is complete.

Returns:
bool: True if iteration is completed, False otherwise
"""
return self.status in {IterationStatus.COMPLETED, IterationStatus.TERMINATED, IterationStatus.FAILED}

class IterationTracker:
"""
Manages the iteration tracking process for the Adaptive Learning Process.

Provides comprehensive tracking of iterations with configurable maximum
iterations and detailed state management.
"""

def __init__(self, max_iterations: Optional[int] = None, logger: Optional[logging.Logger] = None):
"""
Initialize the iteration tracker.

Args:
max_iterations (Optional[int], optional): Maximum number of iterations. Defaults to None.
logger (Optional[logging.Logger], optional): Logger instance. Defaults to None.
"""
self._state = IterationState(max_iterations=max_iterations)
self._logger = logger or logging.getLogger(__name__)

def start(self) -> None:
"""Start the iteration tracking process."""
self._state.reset()
self._logger.info("Iteration tracking started")

def next_iteration(self) -> int:
"""
Move to the next iteration.

Returns:
int: Current iteration number

Raises:
StopIteration: If maximum iterations are reached
"""
try:
self._state.increment()
self._logger.info(f"Starting iteration {self._state.current_iteration}")
return self._state.current_iteration
except StopIteration:
self._logger.info("Maximum iterations reached")
raise

def mark_iteration_complete(self, metadata: Optional[Dict[str, Any]] = None) -> None:
"""
Mark the current iteration as complete.

Args:
metadata (Optional[Dict[str, Any]], optional): Additional metadata about the iteration. Defaults to None.
"""
if metadata:
for key, value in metadata.items():
self._state.add_metadata(key, value)

self._state.set_status(IterationStatus.COMPLETED)
self._logger.info(f"Iteration {self._state.current_iteration} completed")

def mark_iteration_failed(self, error: Optional[Exception] = None) -> None:
"""
Mark the current iteration as failed.

Args:
error (Optional[Exception], optional): Error that caused the failure. Defaults to None.
"""
self._state.set_status(IterationStatus.FAILED)

if error:
self._logger.error(f"Iteration {self._state.current_iteration} failed: {error}")
self._state.add_metadata('error', str(error))

def terminate(self, reason: Optional[str] = None) -> None:
"""
Terminate the iteration process.

Args:
reason (Optional[str], optional): Reason for termination. Defaults to None.
"""
self._state.set_status(IterationStatus.TERMINATED)

if reason:
self._logger.warning(f"Iteration process terminated: {reason}")
self._state.add_metadata('termination_reason', reason)

@property
def current_iteration(self) -> int:
"""
Get the current iteration number.

Returns:
int: Current iteration number
"""
return self._state.current_iteration

@property
def is_complete(self) -> bool:
"""
Check if iteration process is complete.

Returns:
bool: True if iterations are complete, False otherwise
"""
return self._state.is_complete
14 changes: 14 additions & 0 deletions src/main/kotlin/com/wifiscanner/models/WiFiSecurity.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
package com.wifiscanner.models

/**
* Represents the security type of a WiFi network.
*
* @property type The human-readable security type
* @property description A detailed description of the security type
* @property level A numeric representation of security strength (higher is more secure)
*/
data class WiFiSecurityType(
val type: String,
val description: String,
val level: Int
)
Loading