diff --git a/.github/ISSUE_TEMPLATE/bug_report.md b/.github/ISSUE_TEMPLATE/bug_report.md
new file mode 100644
index 0000000..d05d1c7
--- /dev/null
+++ b/.github/ISSUE_TEMPLATE/bug_report.md
@@ -0,0 +1,38 @@
+---
+name: Bug report
+about: Create a report to help us improve
+title: "[BUG]"
+labels: bug
+assignees: DariuszGarbarz
+
+---
+
+**Describe the bug**
+A clear and concise description of what the bug is. Add a tag of related API i.e. [WLightBox]
+
+**To Reproduce**
+Steps to reproduce the behavior:
+1. Go to '...'
+2. Click on '....'
+3. Scroll down to '....'
+4. See error
+
+**Expected behavior**
+A clear and concise description of what you expected to happen.
+
+**Screenshots**
+If applicable, add screenshots to help explain your problem.
+
+**Desktop (please complete the following information):**
+ - OS: [e.g. iOS]
+ - Browser [e.g. chrome, safari]
+ - Version [e.g. 22]
+
+**Smartphone (please complete the following information):**
+ - Device: [e.g. iPhone6]
+ - OS: [e.g. iOS8.1]
+ - Browser [e.g. stock browser, safari]
+ - Version [e.g. 22]
+
+**Additional context**
+Add any other context about the problem here.
diff --git a/.github/ISSUE_TEMPLATE/custom.md b/.github/ISSUE_TEMPLATE/custom.md
new file mode 100644
index 0000000..be6c22a
--- /dev/null
+++ b/.github/ISSUE_TEMPLATE/custom.md
@@ -0,0 +1,10 @@
+---
+name: Custom issue template
+about: Describe this issue template's purpose here.
+title: "[QUESTION]"
+labels: question
+assignees: DariuszGarbarz
+
+---
+
+
diff --git a/.github/ISSUE_TEMPLATE/feature_request.md b/.github/ISSUE_TEMPLATE/feature_request.md
new file mode 100644
index 0000000..0e6e582
--- /dev/null
+++ b/.github/ISSUE_TEMPLATE/feature_request.md
@@ -0,0 +1,20 @@
+---
+name: Feature request
+about: Suggest an idea for this project
+title: "[REQUEST]"
+labels: enhancement
+assignees: DariuszGarbarz
+
+---
+
+**Is your feature request related to a problem? Please describe.**
+A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]
+
+**Describe the solution you'd like**
+A clear and concise description of what you want to happen.
+
+**Describe alternatives you've considered**
+A clear and concise description of any alternative solutions or features you've considered.
+
+**Additional context**
+Add any other context or screenshots about the feature request here.
diff --git a/.github/workflows/build-dev-stage.yml b/.github/workflows/build-dev-stage.yml
new file mode 100644
index 0000000..72dccf2
--- /dev/null
+++ b/.github/workflows/build-dev-stage.yml
@@ -0,0 +1,9 @@
+name: 'Build dev stage'
+
+on:
+ pull_request:
+
+jobs:
+ call-build-dev:
+ uses: DariuszGarbarz/Tools/blob/master/.github/workflows/reusable-blenug-dev.yml
+ secrets: inherit
\ No newline at end of file
diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml
new file mode 100644
index 0000000..a175caf
--- /dev/null
+++ b/.github/workflows/release.yml
@@ -0,0 +1,13 @@
+name: 'Release'
+
+on:
+ workflow_dispatch:
+ push:
+ branches:
+ - master
+ - release**
+
+jobs:
+ call-release:
+ uses: DariuszGarbarz/Tools/blob/master/.github/workflows/reusable-blenug-release.yml
+ secrets: inherit
\ No newline at end of file
diff --git a/.gitignore b/.gitignore
new file mode 100644
index 0000000..8a30d25
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1,398 @@
+## Ignore Visual Studio temporary files, build results, and
+## files generated by popular Visual Studio add-ons.
+##
+## Get latest from https://github.com/github/gitignore/blob/main/VisualStudio.gitignore
+
+# User-specific files
+*.rsuser
+*.suo
+*.user
+*.userosscache
+*.sln.docstates
+
+# User-specific files (MonoDevelop/Xamarin Studio)
+*.userprefs
+
+# Mono auto generated files
+mono_crash.*
+
+# Build results
+[Dd]ebug/
+[Dd]ebugPublic/
+[Rr]elease/
+[Rr]eleases/
+x64/
+x86/
+[Ww][Ii][Nn]32/
+[Aa][Rr][Mm]/
+[Aa][Rr][Mm]64/
+bld/
+[Bb]in/
+[Oo]bj/
+[Ll]og/
+[Ll]ogs/
+
+# Visual Studio 2015/2017 cache/options directory
+.vs/
+# Uncomment if you have tasks that create the project's static files in wwwroot
+#wwwroot/
+
+# Visual Studio 2017 auto generated files
+Generated\ Files/
+
+# MSTest test Results
+[Tt]est[Rr]esult*/
+[Bb]uild[Ll]og.*
+
+# NUnit
+*.VisualState.xml
+TestResult.xml
+nunit-*.xml
+
+# Build Results of an ATL Project
+[Dd]ebugPS/
+[Rr]eleasePS/
+dlldata.c
+
+# Benchmark Results
+BenchmarkDotNet.Artifacts/
+
+# .NET Core
+project.lock.json
+project.fragment.lock.json
+artifacts/
+
+# ASP.NET Scaffolding
+ScaffoldingReadMe.txt
+
+# StyleCop
+StyleCopReport.xml
+
+# Files built by Visual Studio
+*_i.c
+*_p.c
+*_h.h
+*.ilk
+*.meta
+*.obj
+*.iobj
+*.pch
+*.pdb
+*.ipdb
+*.pgc
+*.pgd
+*.rsp
+*.sbr
+*.tlb
+*.tli
+*.tlh
+*.tmp
+*.tmp_proj
+*_wpftmp.csproj
+*.log
+*.tlog
+*.vspscc
+*.vssscc
+.builds
+*.pidb
+*.svclog
+*.scc
+
+# Chutzpah Test files
+_Chutzpah*
+
+# Visual C++ cache files
+ipch/
+*.aps
+*.ncb
+*.opendb
+*.opensdf
+*.sdf
+*.cachefile
+*.VC.db
+*.VC.VC.opendb
+
+# Visual Studio profiler
+*.psess
+*.vsp
+*.vspx
+*.sap
+
+# Visual Studio Trace Files
+*.e2e
+
+# TFS 2012 Local Workspace
+$tf/
+
+# Guidance Automation Toolkit
+*.gpState
+
+# ReSharper is a .NET coding add-in
+_ReSharper*/
+*.[Rr]e[Ss]harper
+*.DotSettings.user
+
+# TeamCity is a build add-in
+_TeamCity*
+
+# DotCover is a Code Coverage Tool
+*.dotCover
+
+# AxoCover is a Code Coverage Tool
+.axoCover/*
+!.axoCover/settings.json
+
+# Coverlet is a free, cross platform Code Coverage Tool
+coverage*.json
+coverage*.xml
+coverage*.info
+
+# Visual Studio code coverage results
+*.coverage
+*.coveragexml
+
+# NCrunch
+_NCrunch_*
+.*crunch*.local.xml
+nCrunchTemp_*
+
+# MightyMoose
+*.mm.*
+AutoTest.Net/
+
+# Web workbench (sass)
+.sass-cache/
+
+# Installshield output folder
+[Ee]xpress/
+
+# DocProject is a documentation generator add-in
+DocProject/buildhelp/
+DocProject/Help/*.HxT
+DocProject/Help/*.HxC
+DocProject/Help/*.hhc
+DocProject/Help/*.hhk
+DocProject/Help/*.hhp
+DocProject/Help/Html2
+DocProject/Help/html
+
+# Click-Once directory
+publish/
+
+# Publish Web Output
+*.[Pp]ublish.xml
+*.azurePubxml
+# Note: Comment the next line if you want to checkin your web deploy settings,
+# but database connection strings (with potential passwords) will be unencrypted
+*.pubxml
+*.publishproj
+
+# Microsoft Azure Web App publish settings. Comment the next line if you want to
+# checkin your Azure Web App publish settings, but sensitive information contained
+# in these scripts will be unencrypted
+PublishScripts/
+
+# NuGet Packages
+*.nupkg
+# NuGet Symbol Packages
+*.snupkg
+# The packages folder can be ignored because of Package Restore
+**/[Pp]ackages/*
+# except build/, which is used as an MSBuild target.
+!**/[Pp]ackages/build/
+# Uncomment if necessary however generally it will be regenerated when needed
+#!**/[Pp]ackages/repositories.config
+# NuGet v3's project.json files produces more ignorable files
+*.nuget.props
+*.nuget.targets
+
+# Microsoft Azure Build Output
+csx/
+*.build.csdef
+
+# Microsoft Azure Emulator
+ecf/
+rcf/
+
+# Windows Store app package directories and files
+AppPackages/
+BundleArtifacts/
+Package.StoreAssociation.xml
+_pkginfo.txt
+*.appx
+*.appxbundle
+*.appxupload
+
+# Visual Studio cache files
+# files ending in .cache can be ignored
+*.[Cc]ache
+# but keep track of directories ending in .cache
+!?*.[Cc]ache/
+
+# Others
+ClientBin/
+~$*
+*~
+*.dbmdl
+*.dbproj.schemaview
+*.jfm
+*.pfx
+*.publishsettings
+orleans.codegen.cs
+
+# Including strong name files can present a security risk
+# (https://github.com/github/gitignore/pull/2483#issue-259490424)
+#*.snk
+
+# Since there are multiple workflows, uncomment next line to ignore bower_components
+# (https://github.com/github/gitignore/pull/1529#issuecomment-104372622)
+#bower_components/
+
+# RIA/Silverlight projects
+Generated_Code/
+
+# Backup & report files from converting an old project file
+# to a newer Visual Studio version. Backup files are not needed,
+# because we have git ;-)
+_UpgradeReport_Files/
+Backup*/
+UpgradeLog*.XML
+UpgradeLog*.htm
+ServiceFabricBackup/
+*.rptproj.bak
+
+# SQL Server files
+*.mdf
+*.ldf
+*.ndf
+
+# Business Intelligence projects
+*.rdl.data
+*.bim.layout
+*.bim_*.settings
+*.rptproj.rsuser
+*- [Bb]ackup.rdl
+*- [Bb]ackup ([0-9]).rdl
+*- [Bb]ackup ([0-9][0-9]).rdl
+
+# Microsoft Fakes
+FakesAssemblies/
+
+# GhostDoc plugin setting file
+*.GhostDoc.xml
+
+# Node.js Tools for Visual Studio
+.ntvs_analysis.dat
+node_modules/
+
+# Visual Studio 6 build log
+*.plg
+
+# Visual Studio 6 workspace options file
+*.opt
+
+# Visual Studio 6 auto-generated workspace file (contains which files were open etc.)
+*.vbw
+
+# Visual Studio 6 auto-generated project file (contains which files were open etc.)
+*.vbp
+
+# Visual Studio 6 workspace and project file (working project files containing files to include in project)
+*.dsw
+*.dsp
+
+# Visual Studio 6 technical files
+*.ncb
+*.aps
+
+# Visual Studio LightSwitch build output
+**/*.HTMLClient/GeneratedArtifacts
+**/*.DesktopClient/GeneratedArtifacts
+**/*.DesktopClient/ModelManifest.xml
+**/*.Server/GeneratedArtifacts
+**/*.Server/ModelManifest.xml
+_Pvt_Extensions
+
+# Paket dependency manager
+.paket/paket.exe
+paket-files/
+
+# FAKE - F# Make
+.fake/
+
+# CodeRush personal settings
+.cr/personal
+
+# Python Tools for Visual Studio (PTVS)
+__pycache__/
+*.pyc
+
+# Cake - Uncomment if you are using it
+# tools/**
+# !tools/packages.config
+
+# Tabs Studio
+*.tss
+
+# Telerik's JustMock configuration file
+*.jmconfig
+
+# BizTalk build output
+*.btp.cs
+*.btm.cs
+*.odx.cs
+*.xsd.cs
+
+# OpenCover UI analysis results
+OpenCover/
+
+# Azure Stream Analytics local run output
+ASALocalRun/
+
+# MSBuild Binary and Structured Log
+*.binlog
+
+# NVidia Nsight GPU debugger configuration file
+*.nvuser
+
+# MFractors (Xamarin productivity tool) working folder
+.mfractor/
+
+# Local History for Visual Studio
+.localhistory/
+
+# Visual Studio History (VSHistory) files
+.vshistory/
+
+# BeatPulse healthcheck temp database
+healthchecksdb
+
+# Backup folder for Package Reference Convert tool in Visual Studio 2017
+MigrationBackup/
+
+# Ionide (cross platform F# VS Code tools) working folder
+.ionide/
+
+# Fody - auto-generated XML schema
+FodyWeavers.xsd
+
+# VS Code files for those working on multiple tools
+.vscode/*
+!.vscode/settings.json
+!.vscode/tasks.json
+!.vscode/launch.json
+!.vscode/extensions.json
+*.code-workspace
+
+# Local History for Visual Studio Code
+.history/
+
+# Windows Installer files from build outputs
+*.cab
+*.msi
+*.msix
+*.msm
+*.msp
+
+# JetBrains Rider
+*.sln.iml
diff --git a/BleBoxCommonSimLib.sln b/BleBoxCommonSimLib.sln
new file mode 100644
index 0000000..e30f922
--- /dev/null
+++ b/BleBoxCommonSimLib.sln
@@ -0,0 +1,25 @@
+
+Microsoft Visual Studio Solution File, Format Version 12.00
+# Visual Studio Version 17
+VisualStudioVersion = 17.10.35201.131
+MinimumVisualStudioVersion = 10.0.40219.1
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "BleBoxCommonSimLib", "BleBoxCommonSimLib\BleBoxCommonSimLib.csproj", "{054D8D92-3047-4F21-8843-2C548873EC0D}"
+EndProject
+Global
+ GlobalSection(SolutionConfigurationPlatforms) = preSolution
+ Debug|Any CPU = Debug|Any CPU
+ Release|Any CPU = Release|Any CPU
+ EndGlobalSection
+ GlobalSection(ProjectConfigurationPlatforms) = postSolution
+ {054D8D92-3047-4F21-8843-2C548873EC0D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {054D8D92-3047-4F21-8843-2C548873EC0D}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {054D8D92-3047-4F21-8843-2C548873EC0D}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {054D8D92-3047-4F21-8843-2C548873EC0D}.Release|Any CPU.Build.0 = Release|Any CPU
+ EndGlobalSection
+ GlobalSection(SolutionProperties) = preSolution
+ HideSolutionNode = FALSE
+ EndGlobalSection
+ GlobalSection(ExtensibilityGlobals) = postSolution
+ SolutionGuid = {1ADCA4C5-DB78-4FAD-8EBC-0646324B31C9}
+ EndGlobalSection
+EndGlobal
diff --git a/BleBoxCommonSimLib/BleBoxCommonSimLib.csproj b/BleBoxCommonSimLib/BleBoxCommonSimLib.csproj
new file mode 100644
index 0000000..20b60cf
--- /dev/null
+++ b/BleBoxCommonSimLib/BleBoxCommonSimLib.csproj
@@ -0,0 +1,14 @@
+
+
+
+ net8.0
+ enable
+ enable
+
+
+
+
+
+
+
+
diff --git a/BleBoxCommonSimLib/Controllers/InformationController.cs b/BleBoxCommonSimLib/Controllers/InformationController.cs
new file mode 100644
index 0000000..626584e
--- /dev/null
+++ b/BleBoxCommonSimLib/Controllers/InformationController.cs
@@ -0,0 +1,55 @@
+using BleBoxCommonSimLib.Services;
+using Microsoft.AspNetCore.Mvc;
+
+namespace BleBoxCommonSimLib.Controllers;
+
+public class InformationController(IDeviceInformationService deviceInformationService) : ControllerBase
+{
+ [HttpGet("info")]
+ public IActionResult DeviceInfoRequested()
+ {
+ try
+ {
+ var deviceInformation = deviceInformationService.ReadDeviceInformation();
+
+ return Ok(new { Device = deviceInformation });
+ }
+ catch
+ {
+ return BadRequest();
+ }
+ }
+
+ [HttpGet("api/device/uptime")]
+ public IActionResult DeviceUptimeRequested()
+ {
+ try
+ {
+ var deviceUptime = deviceInformationService.ReadUptime();
+
+ return Ok(new { UpTimeS = deviceUptime.TotalSeconds.ToString() });
+ }
+ catch
+ {
+ return BadRequest();
+ }
+ }
+
+ [HttpPost("api/ota/update")]
+ public async Task FirmwareUpdateRequested(SettingsBase Settings)
+ {
+ try
+ {
+ if (deviceInformationService.IsUpdating)
+ return StatusCode(409);
+
+ await deviceInformationService.PerformFirmwareUpdate();
+
+ return Ok();
+ }
+ catch
+ {
+ return BadRequest();
+ }
+ }
+}
diff --git a/BleBoxCommonSimLib/Controllers/NetworkController.cs b/BleBoxCommonSimLib/Controllers/NetworkController.cs
new file mode 100644
index 0000000..390ce82
--- /dev/null
+++ b/BleBoxCommonSimLib/Controllers/NetworkController.cs
@@ -0,0 +1,88 @@
+using BleBoxCommonSimLib.Models;
+using BleBoxCommonSimLib.Services;
+using Microsoft.AspNetCore.Mvc;
+
+namespace BleBoxCommonSimLib.Controllers;
+
+public class NetworkController(INetworkService networkService, IDeviceInformationService deviceService) : ControllerBase
+{
+ [HttpGet("api/device/network")]
+ public IActionResult NetworkInfoRequested()
+ {
+ try
+ {
+ var networkInformation = networkService.ReadNetworkInformation();
+ return Ok(networkInformation);
+ }
+ catch
+ {
+ return BadRequest();
+ }
+ }
+
+ [HttpPost("api/device/set")]
+ public IActionResult SetAccessPointRequested(NetworkSetRequest request)
+ {
+ try
+ {
+ if (request.Network == null)
+ return BadRequest();
+
+ networkService.SetAccessPoint(request.Network);
+ return Ok(new { Device = deviceService.ReadDeviceInformation(), Network = networkService.ReadNetworkInformation() });
+ }
+ catch
+ {
+ return BadRequest();
+ }
+ }
+
+ [HttpGet("api/wifi/scan")]
+ public async Task PerformWifiScan()
+ {
+ try
+ {
+ if (networkService.IsScanning)
+ return StatusCode(409);
+
+ return Ok(new { Ap = await networkService.WifiScan() });
+ }
+ catch
+ {
+ return BadRequest();
+ }
+ }
+
+ [HttpPost("api/wifi/connect")]
+ public IActionResult PerformWifiConnect(WifiConnectRequest request)
+ {
+ try
+ {
+ if (request.Ssid == null)
+ return BadRequest();
+
+ var wifiConnect = networkService.WifiConnect(request.Ssid, request.Pwd);
+
+ return Ok(new { Ssid = wifiConnect.Item1, station_status = wifiConnect.Item2 });
+ }
+ catch
+ {
+ return BadRequest();
+ }
+ }
+
+ [HttpPost("api/wifi/disconnect")]
+ public IActionResult PerformWifiDisconnect()
+ {
+ try
+ {
+ var wifiDisconnect = networkService.WifiDisconnect();
+
+ return Ok(new { Ssid = wifiDisconnect.Item1, station_status = wifiDisconnect.Item2 });
+ }
+ catch
+ {
+ return BadRequest();
+ }
+ }
+}
diff --git a/BleBoxCommonSimLib/Controllers/SettingsController.cs b/BleBoxCommonSimLib/Controllers/SettingsController.cs
new file mode 100644
index 0000000..c0f3fb7
--- /dev/null
+++ b/BleBoxCommonSimLib/Controllers/SettingsController.cs
@@ -0,0 +1,34 @@
+using BleBoxCommonSimLib.Services;
+using Microsoft.AspNetCore.Mvc;
+
+namespace BleBoxCommonSimLib.Controllers;
+
+public class SettingsController(ISettingsService settings) : ControllerBase
+{
+ [HttpGet("api/settings/state")]
+ public IActionResult SettingsRequested()
+ {
+ try
+ {
+ return Ok(new { Settings = settings.ReadSettings() });
+ }
+ catch
+ {
+ return BadRequest();
+ }
+ }
+
+ [HttpPost("api/settings/set")]
+ public IActionResult SettingsSetRequested(object request)
+ {
+ try
+ {
+ settings.UpdateSettings(request);
+ return Ok(new { Settings = settings.ReadSettings() });
+ }
+ catch
+ {
+ return BadRequest();
+ }
+ }
+}
diff --git a/BleBoxCommonSimLib/Enums/ApiType.cs b/BleBoxCommonSimLib/Enums/ApiType.cs
new file mode 100644
index 0000000..3dbe2c8
--- /dev/null
+++ b/BleBoxCommonSimLib/Enums/ApiType.cs
@@ -0,0 +1,18 @@
+namespace BleBoxCommonSimLib.Enums;
+
+public enum ApiType
+{
+ Unknown,
+ AirSensor,
+ ButtonBox,
+ GateBox,
+ MultiSensor,
+ ShutterBox,
+ SmartWindowBox,
+ SwitchBoxD,
+ SwitchBox,
+ TempSensor,
+ ThermoBox,
+ TvLiftBox,
+ WLightBox
+}
diff --git a/BleBoxCommonSimLib/Enums/EncryptionMode.cs b/BleBoxCommonSimLib/Enums/EncryptionMode.cs
new file mode 100644
index 0000000..da328f3
--- /dev/null
+++ b/BleBoxCommonSimLib/Enums/EncryptionMode.cs
@@ -0,0 +1,10 @@
+namespace BleBoxCommonSimLib.Enums;
+
+public enum EncryptionMode
+{
+ OpenNetwork,
+ WEP,
+ WPA,
+ WPA2,
+ WPA_WPA2
+}
diff --git a/BleBoxCommonSimLib/Enums/StationStatus.cs b/BleBoxCommonSimLib/Enums/StationStatus.cs
new file mode 100644
index 0000000..2c9f12c
--- /dev/null
+++ b/BleBoxCommonSimLib/Enums/StationStatus.cs
@@ -0,0 +1,11 @@
+namespace BleBoxCommonSimLib.Enums;
+
+public enum StationStatus
+{
+ NotConfigured,
+ Connecting,
+ WrongPassword,
+ WiFiNotFound,
+ WiFiFailed,
+ Connected
+}
diff --git a/BleBoxCommonSimLib/Enums/Toggle.cs b/BleBoxCommonSimLib/Enums/Toggle.cs
new file mode 100644
index 0000000..7848b1e
--- /dev/null
+++ b/BleBoxCommonSimLib/Enums/Toggle.cs
@@ -0,0 +1,7 @@
+namespace BleBoxCommonSimLib.Enums;
+
+public enum Toggle
+{
+ Disabled,
+ Enabled
+}
diff --git a/BleBoxCommonSimLib/Enums/TunnelStatus.cs b/BleBoxCommonSimLib/Enums/TunnelStatus.cs
new file mode 100644
index 0000000..2fe69e5
--- /dev/null
+++ b/BleBoxCommonSimLib/Enums/TunnelStatus.cs
@@ -0,0 +1,12 @@
+namespace BleBoxCommonSimLib.Enums;
+
+public enum TunnelStatus
+{
+ WaitingForWiFi,
+ Connecting,
+ DnsFailed,
+ ServerNotFound,
+ ConnectionBroken,
+ Connected,
+ DisabledByUser
+}
diff --git a/BleBoxCommonSimLib/Models/AccessPoint.cs b/BleBoxCommonSimLib/Models/AccessPoint.cs
new file mode 100644
index 0000000..402ae05
--- /dev/null
+++ b/BleBoxCommonSimLib/Models/AccessPoint.cs
@@ -0,0 +1,11 @@
+using BleBoxCommonSimLib.Enums;
+
+namespace BleBoxCommonSimLib.Models;
+
+public record AccessPoint
+{
+ public string? Ssid { get; set; }
+ public int Rssi { get; set; }
+ public EncryptionMode Enc { get; set; }
+}
+
diff --git a/BleBoxCommonSimLib/Models/Device.cs b/BleBoxCommonSimLib/Models/Device.cs
new file mode 100644
index 0000000..bbc83ec
--- /dev/null
+++ b/BleBoxCommonSimLib/Models/Device.cs
@@ -0,0 +1,13 @@
+namespace BleBoxCommonSimLib.Models;
+
+public record Device
+{
+ public string? DeviceName { get; set; }
+ public string? Product { get; set; }
+ public string? Type { get; set; }
+ public string? ApiLevel { get; set; }
+ public string? Hv { get; set; }
+ public string? Fv { get; set; }
+ public string? Id { get; set; }
+ public string? Ip { get; set; }
+}
diff --git a/BleBoxCommonSimLib/Models/Network.cs b/BleBoxCommonSimLib/Models/Network.cs
new file mode 100644
index 0000000..7667806
--- /dev/null
+++ b/BleBoxCommonSimLib/Models/Network.cs
@@ -0,0 +1,23 @@
+using BleBoxCommonSimLib.Enums;
+using System.Text.Json.Serialization;
+
+namespace BleBoxCommonSimLib.Models;
+
+public record Network
+{
+ public string? Ssid { get; set; }
+ public string? Bssid { get; set; }
+ public string? Ip { get; set; }
+ public string? Mac { get; set; }
+
+ [JsonPropertyName("station_status")]
+ public StationStatus StationStatus { get; set; }
+
+ [JsonPropertyName("tunnel_status")]
+ public TunnelStatus TunnelStatus { get; set; }
+
+ public bool ApEnable { get; set; }
+ public string? ApSSID { get; set; }
+ public string? ApPasswd { get; set; }
+ public int Channel { get; set; }
+}
diff --git a/BleBoxCommonSimLib/Models/NetworkSet.cs b/BleBoxCommonSimLib/Models/NetworkSet.cs
new file mode 100644
index 0000000..40ee808
--- /dev/null
+++ b/BleBoxCommonSimLib/Models/NetworkSet.cs
@@ -0,0 +1,8 @@
+namespace BleBoxCommonSimLib.Models;
+
+public record NetworkSet
+{
+ public bool ApEnable { get; set; }
+ public string? ApSSID { get; set; }
+ public string? ApPasswd { get; set; }
+}
diff --git a/BleBoxCommonSimLib/Models/NetworkSetRequest.cs b/BleBoxCommonSimLib/Models/NetworkSetRequest.cs
new file mode 100644
index 0000000..2d1342d
--- /dev/null
+++ b/BleBoxCommonSimLib/Models/NetworkSetRequest.cs
@@ -0,0 +1,6 @@
+namespace BleBoxCommonSimLib.Models;
+
+public record NetworkSetRequest
+{
+ public NetworkSet? Network { get; set; }
+}
diff --git a/BleBoxCommonSimLib/Models/SettingsBase.cs b/BleBoxCommonSimLib/Models/SettingsBase.cs
new file mode 100644
index 0000000..7ef63c3
--- /dev/null
+++ b/BleBoxCommonSimLib/Models/SettingsBase.cs
@@ -0,0 +1,21 @@
+using BleBoxCommonSimLib.Enums;
+
+namespace BleBoxCommonSimLib.Models;
+
+public record SettingsBase
+{
+ public string? DeviceName { get; set; }
+ public Tunnel? Tunnel { get; set; }
+ public StatusLed? StatusLed { get; set; }
+}
+
+public record StatusLed
+{
+ public Toggle Enabled { get; set; }
+}
+
+public record Tunnel
+{
+ public Toggle Enabled { get; set; }
+ public Toggle? LogEnabled { get; set; }
+}
diff --git a/BleBoxCommonSimLib/Models/SettingsRequest.cs b/BleBoxCommonSimLib/Models/SettingsRequest.cs
new file mode 100644
index 0000000..da70abd
--- /dev/null
+++ b/BleBoxCommonSimLib/Models/SettingsRequest.cs
@@ -0,0 +1,6 @@
+namespace BleBoxCommonSimLib.Models;
+
+public class SettingsRequest
+{
+ public SettingsBase? Settings { get; set; }
+}
diff --git a/BleBoxCommonSimLib/Models/WifiConnectRequest.cs b/BleBoxCommonSimLib/Models/WifiConnectRequest.cs
new file mode 100644
index 0000000..ba0e13c
--- /dev/null
+++ b/BleBoxCommonSimLib/Models/WifiConnectRequest.cs
@@ -0,0 +1,7 @@
+namespace BleBoxCommonSimLib.Models;
+
+public record WifiConnectRequest
+{
+ public string? Ssid { get; set; }
+ public string? Pwd { get; set; }
+}
diff --git a/BleBoxCommonSimLib/ServiceExtensions.cs b/BleBoxCommonSimLib/ServiceExtensions.cs
new file mode 100644
index 0000000..4309188
--- /dev/null
+++ b/BleBoxCommonSimLib/ServiceExtensions.cs
@@ -0,0 +1,17 @@
+using BleBoxCommonSimLib.Services;
+using Microsoft.Extensions.DependencyInjection;
+
+namespace BleBoxCommonSimLib;
+
+public static class ServiceExtensions
+{
+ public static IServiceCollection AddCommonSim(this IServiceCollection services)
+ {
+ services
+ .AddSingleton()
+ .AddSingleton()
+ .AddSingleton();
+
+ return services;
+ }
+}
diff --git a/BleBoxCommonSimLib/Services/DeviceInformationService.cs b/BleBoxCommonSimLib/Services/DeviceInformationService.cs
new file mode 100644
index 0000000..48afdd0
--- /dev/null
+++ b/BleBoxCommonSimLib/Services/DeviceInformationService.cs
@@ -0,0 +1,70 @@
+using BleBoxCommonSimLib.Models;
+using System.Net;
+
+namespace BleBoxCommonSimLib.Services;
+
+public interface IDeviceInformationService
+{
+ bool IsUpdating { get; }
+ string DeviceName { get; set; }
+
+ void InitializeDevice(string deviceName, string type, string apiLevel, string product = "commonBox");
+ Device ReadDeviceInformation();
+ TimeSpan ReadUptime();
+ Task PerformFirmwareUpdate();
+}
+
+public class DeviceInformationService : IDeviceInformationService
+{
+ private string _product = "commonBox";
+ private string _type = "commonBox";
+ private string _apiLevel = "20230606";
+ private string _hv = "9.1d";
+ private double _fv = 0.987;
+ private string _id = Guid.NewGuid().ToString();
+ private string _ip = Dns.GetHostEntry(Dns.GetHostName()).AddressList[0].ToString();
+ private DateTime _createdDateTime = DateTime.Now;
+
+ public bool IsUpdating { get; private set; } = false;
+ public string DeviceName { get; set; } = "My BleBox device name";
+
+ public void InitializeDevice(string deviceName, string type, string apiLevel, string product = "commonBox")
+ {
+ DeviceName = deviceName;
+ _product = product;
+ _type = type;
+ _apiLevel = apiLevel;
+ }
+
+ public Device ReadDeviceInformation()
+ {
+ var device = new Device
+ {
+ DeviceName = DeviceName,
+ Product = _product,
+ Type = _type,
+ ApiLevel = _apiLevel,
+ Hv = _hv,
+ Fv = _fv.ToString(),
+ Id = _id,
+ Ip = _ip
+ };
+
+ return device;
+ }
+
+ public TimeSpan ReadUptime()
+ {
+ return _createdDateTime - DateTime.Now;
+ }
+
+ public async Task PerformFirmwareUpdate()
+ {
+ IsUpdating = true;
+ _fv += 0.001;
+
+ await Task.Delay(TimeSpan.FromSeconds(20));
+
+ IsUpdating = false;
+ }
+}
diff --git a/BleBoxCommonSimLib/Services/NetworkService.cs b/BleBoxCommonSimLib/Services/NetworkService.cs
new file mode 100644
index 0000000..2fda110
--- /dev/null
+++ b/BleBoxCommonSimLib/Services/NetworkService.cs
@@ -0,0 +1,91 @@
+using BleBoxCommonSimLib.Enums;
+using BleBoxCommonSimLib.Models;
+using System.Net;
+
+namespace BleBoxCommonSimLib.Services;
+
+public interface INetworkService
+{
+ bool IsScanning { get; }
+
+ Network ReadNetworkInformation();
+ void SetAccessPoint(NetworkSet settings);
+ (string, StationStatus) WifiConnect(string ssid, string? password);
+ (string, StationStatus) WifiDisconnect();
+ Task WifiScan();
+}
+
+public class NetworkService : INetworkService
+{
+ private string _ssid = "Wifi_name";
+ private string _bssid = "70:4f:25:24:11:ae";
+ private string _ip = Dns.GetHostEntry(Dns.GetHostName()).AddressList[0].ToString();
+ private string _mac = "bb:50:ec:2d:22:17";
+ private StationStatus _stationStatus = StationStatus.Connected;
+ private TunnelStatus _tunnelStatus = TunnelStatus.Connected;
+ private bool _apEnable = true;
+ private string _apSSID = "commonBox-g650e32d2217";
+ private string _apPasswd = "my_secret_password";
+ private int _channel = 7;
+ private Random _rnd = new();
+
+ public bool IsScanning { get; private set; } = false;
+
+ public Network ReadNetworkInformation()
+ {
+ return new Network
+ {
+ Ssid = _ssid,
+ Bssid = _bssid,
+ Ip = _ip,
+ Mac = _mac,
+ StationStatus = _stationStatus,
+ TunnelStatus = _tunnelStatus,
+ ApEnable = _apEnable,
+ ApSSID = _apSSID,
+ ApPasswd = _apPasswd,
+ Channel = _channel
+ };
+ }
+
+ public void SetAccessPoint(NetworkSet settings)
+ {
+ _apEnable = settings.ApEnable;
+ _apSSID = settings.ApSSID ?? string.Empty;
+ _apPasswd = settings.ApPasswd ?? string.Empty;
+ }
+
+ public async Task WifiScan()
+ {
+ IsScanning = true;
+
+ await Task.Delay(TimeSpan.FromSeconds(10));
+
+ IsScanning = false;
+
+ return
+ [
+ new AccessPoint
+ { Ssid = "Funny_WiFi_Name", Rssi = _rnd.Next(-90, 0), Enc = EncryptionMode.WPA2 },
+ new AccessPoint
+ { Ssid = "Less_Funny_WiFi_Name", Rssi = _rnd.Next(-90, 0), Enc = EncryptionMode.WPA_WPA2 },
+ new AccessPoint
+ { Ssid = "Not_Funny_WiFi_Name", Rssi = _rnd.Next(-90, 0), Enc = EncryptionMode.OpenNetwork }
+ ];
+ }
+
+ public (string, StationStatus) WifiConnect(string ssid, string? password)
+ {
+ _ssid = ssid;
+ _stationStatus = StationStatus.Connected;
+
+ return (_ssid, _stationStatus);
+ }
+
+ public (string, StationStatus) WifiDisconnect()
+ {
+ _stationStatus = StationStatus.NotConfigured;
+
+ return (_ssid, _stationStatus);
+ }
+}
diff --git a/BleBoxCommonSimLib/Services/SettingsService.cs b/BleBoxCommonSimLib/Services/SettingsService.cs
new file mode 100644
index 0000000..b5b9bb2
--- /dev/null
+++ b/BleBoxCommonSimLib/Services/SettingsService.cs
@@ -0,0 +1,59 @@
+using BleBoxCommonSimLib.Enums;
+using BleBoxCommonSimLib.Models;
+
+namespace BleBoxCommonSimLib.Services;
+
+public interface ISettingsService
+{
+ Func? ObtainFullSettings { get; set; }
+ Func