Compare commits

...

8 Commits

Author SHA1 Message Date
Dejwut
2cdf08fe6b Fixed merge conflict and removed sensitive stuff. 2023-05-17 09:11:10 +02:00
6bbf58d35d Feat: Frontend 2023-05-16 20:37:28 +02:00
e0bf5dc02a Feat: Changes 2023-05-16 18:47:13 +02:00
0a24f2eb52 Feat: File1.py 2023-05-16 10:46:31 +02:00
3742844220 Feat: README.md 2023-05-16 10:40:16 +02:00
d80f2fb07b Feat: readme.txt 2023-05-16 10:37:27 +02:00
cd0b3e5dc0 Feat: Readme 2023-05-16 10:35:36 +02:00
7038e8a90c Feat: First commit 2023-05-16 10:23:20 +02:00
37 changed files with 8248 additions and 4 deletions

13
Frontend/.eslintignore Normal file
View File

@ -0,0 +1,13 @@
.DS_Store
node_modules
/build
/.svelte-kit
/package
.env
.env.*
!.env.example
# Ignore files for PNPM, NPM and YARN
pnpm-lock.yaml
package-lock.json
yarn.lock

30
Frontend/.eslintrc.cjs Normal file
View File

@ -0,0 +1,30 @@
module.exports = {
root: true,
extends: [
'eslint:recommended',
'plugin:@typescript-eslint/recommended',
'plugin:svelte/recommended',
'prettier'
],
parser: '@typescript-eslint/parser',
plugins: ['@typescript-eslint'],
parserOptions: {
sourceType: 'module',
ecmaVersion: 2020,
extraFileExtensions: ['.svelte']
},
env: {
browser: true,
es2017: true,
node: true
},
overrides: [
{
files: ['*.svelte'],
parser: 'svelte-eslint-parser',
parserOptions: {
parser: '@typescript-eslint/parser'
}
}
]
};

10
Frontend/.gitignore vendored Normal file
View File

@ -0,0 +1,10 @@
.DS_Store
node_modules
/build
/.svelte-kit
/package
.env
.env.*
!.env.example
vite.config.js.timestamp-*
vite.config.ts.timestamp-*

2
Frontend/.npmrc Normal file
View File

@ -0,0 +1,2 @@
engine-strict=true
resolution-mode=highest

13
Frontend/.prettierignore Normal file
View File

@ -0,0 +1,13 @@
.DS_Store
node_modules
/build
/.svelte-kit
/package
.env
.env.*
!.env.example
# Ignore files for PNPM, NPM and YARN
pnpm-lock.yaml
package-lock.json
yarn.lock

7
Frontend/.prettierrc Normal file
View File

@ -0,0 +1,7 @@
{
"useTabs": true,
"singleQuote": true,
"trailingComma": "none",
"printWidth": 100,
"svelteSortOrder": "options-scripts-markup-styles"
}

38
Frontend/README.md Normal file
View File

@ -0,0 +1,38 @@
# create-svelte
Everything you need to build a Svelte project, powered by [`create-svelte`](https://github.com/sveltejs/kit/tree/master/packages/create-svelte).
## Creating a project
If you're seeing this, you've probably already done this step. Congrats!
```bash
# create a new project in the current directory
npm create svelte@latest
# create a new project in my-app
npm create svelte@latest my-app
```
## Developing
Once you've created a project and installed dependencies with `npm install` (or `pnpm install` or `yarn`), start a development server:
```bash
npm run dev
# or start the server and open the app in a new browser tab
npm run dev -- --open
```
## Building
To create a production version of your app:
```bash
npm run build
```
You can preview the production build with `npm run preview`.
> To deploy your app, you may need to install an [adapter](https://kit.svelte.dev/docs/adapters) for your target environment.

7478
Frontend/package-lock.json generated Normal file

File diff suppressed because it is too large Load Diff

42
Frontend/package.json Normal file
View File

@ -0,0 +1,42 @@
{
"name": "frontend",
"version": "0.0.1",
"private": true,
"scripts": {
"dev": "vite dev",
"build": "vite build",
"preview": "vite preview",
"test": "playwright test",
"check": "svelte-kit sync && svelte-check --tsconfig ./tsconfig.json",
"check:watch": "svelte-kit sync && svelte-check --tsconfig ./tsconfig.json --watch",
"test:unit": "vitest",
"lint": "prettier --plugin-search-dir . --check . && eslint .",
"format": "prettier --plugin-search-dir . --write ."
},
"devDependencies": {
"@playwright/test": "^1.28.1",
"@sveltejs/adapter-auto": "^2.0.0",
"@sveltejs/kit": "^1.5.0",
"@typescript-eslint/eslint-plugin": "^5.45.0",
"@typescript-eslint/parser": "^5.45.0",
"autoprefixer": "^10.4.14",
"eslint": "^8.28.0",
"eslint-config-prettier": "^8.5.0",
"eslint-plugin-svelte": "^2.26.0",
"postcss": "^8.4.23",
"prettier": "^2.8.0",
"prettier-plugin-svelte": "^2.8.1",
"svelte": "^3.54.0",
"svelte-check": "^3.0.1",
"tailwindcss": "^3.3.2",
"tslib": "^2.4.1",
"typescript": "^5.0.0",
"vite": "^4.3.0",
"vitest": "^0.25.3"
},
"type": "module",
"dependencies": {
"cssnano": "^6.0.1",
"postcss-nesting": "^11.2.2"
}
}

View File

@ -0,0 +1,12 @@
import type { PlaywrightTestConfig } from '@playwright/test';
const config: PlaywrightTestConfig = {
webServer: {
command: 'npm run build && npm run preview',
port: 4173
},
testDir: 'tests',
testMatch: /(.+\.)?(test|spec)\.[jt]s/
};
export default config;

View File

@ -0,0 +1,21 @@
const tailwindcss = require('tailwindcss');
const autoprefixer = require('autoprefixer');
const postcssImport = require('postcss-import');
const postcssNesting = require('postcss-nesting');
const cssnano = require('cssnano');
const mode = process.env.NODE_ENV;
const dev = mode === 'development';
module.exports = {
plugins: [
postcssImport(),
postcssNesting(),
tailwindcss(),
autoprefixer(),
!dev &&
cssnano({
preset: 'default'
})
]
};

12
Frontend/src/app.d.ts vendored Normal file
View File

@ -0,0 +1,12 @@
// See https://kit.svelte.dev/docs/types#app
// for information about these interfaces
declare global {
namespace App {
// interface Error {}
// interface Locals {}
// interface PageData {}
// interface Platform {}
}
}
export {};

12
Frontend/src/app.html Normal file
View File

@ -0,0 +1,12 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<link rel="icon" href="%sveltekit.assets%/favicon.png" />
<meta name="viewport" content="width=device-width" />
%sveltekit.head%
</head>
<body data-sveltekit-preload-data="hover">
<div style="display: contents">%sveltekit.body%</div>
</body>
</html>

View File

@ -0,0 +1,106 @@
<script context="module" lang="ts">
export type IconValues =
| 'analytics'
| 'back'
| 'building'
| 'calendar'
| 'calendarView'
| 'camera'
| 'chart'
| 'chat'
| 'chat-small'
| 'check'
| 'check-big'
| 'checklist'
| 'chevron'
| 'cloud'
| 'company'
| 'cross'
| 'dots-horizontal'
| 'dots-vertical'
| 'edit'
| 'eye'
| 'eye-off'
| 'filter-lines'
| 'hamburger'
| 'hash'
| 'help'
| 'heart-hand'
| 'home'
| 'listView'
| 'lock'
| 'logout'
| 'map'
| 'microphone'
| 'notification-box'
| 'people'
| 'plus'
| 'plus-circle'
| 'profile'
| 'publish'
| 'qrcode'
| 'schedule'
| 'search'
| 'share'
| 'settings'
| 'send'
| 'social'
| 'support'
| 'table'
| 'trash'
| 'upload'
| 'user-circle'
| 'user-default'
| 'user-down'
| 'user-plus'
| 'user-remove'
| 'verified'
| 'socials/Twitter'
| 'socials/LinkedIn';
</script>
<script lang="ts">
export var icon: IconValues;
export var active: boolean = false;
export var inactive: boolean = false;
export var black: boolean = false;
export var white: boolean = false;
export var rotate = 0;
let className = '';
export { className as class };
</script>
<div
class="icon {className}"
class:active
class:inactive
style:mask="url(/images/icons/{icon}.svg) no-repeat center"
style:-webkit-mask="url(/images/icons/{icon}.svg) no-repeat center"
style:transform="rotate({rotate}deg)"
class:black
class:white
on:click
on:dblclick
on:keydown
on:keypress
on:keyup
/>
<style>
.icon {
@apply w-8 h-8 bg-current origin-center rounded-[100%];
}
.icon.active {
@apply bg-primary;
}
.icon.black {
@apply bg-black;
}
.icon.inactive {
@apply bg-gray-700;
}
.icon.white {
@apply bg-white;
}
</style>

View File

@ -0,0 +1,7 @@
import { describe, it, expect } from 'vitest';
describe('sum test', () => {
it('adds 1 + 2 to equal 3', () => {
expect(1 + 2).toBe(3);
});
});

View File

@ -0,0 +1,23 @@
<script lang="ts">
import '$styles/tailwind.css';
const pages = [
{ name: 'Dashboard', path: '/' },
{ name: 'Settings', path: '/settings' },
{ name: 'About', path: '/about' },
{ name: 'Docs', path: '/docs' },
{ name: 'Contact', path: '/contact' }
] as const;
</script>
<div class="bg-[#0B2A37] h-screen w-screen">
<div class="flex flex-row items-center px-20">
<img class="w-40" src="/icons/Logo.svg" alt="Logo" />
<div class="w-full justify-between flex px-5 lg:px-40 text-lg text-white">
{#each pages as link}
<a href={link.path}>{link.name}</a>
{/each}
</div>
</div>
<slot />
</div>

View File

@ -0,0 +1,24 @@
<script lang="ts">
let numberOfAccessPoints = 0;
let numberOfAccessPointsUp = 0;
</script>
<div class="height">
<div class="bg-[#05171E] rounded-lg w-3/4 h-full mx-auto mt-20 py-4 px-20">
<div class="text-white text-center text-3xl">Dashboard</div>
<div class="flex flex-row text-white mt-20 text-xl">
<div class="pr-2">Access point amount :</div>
<div>{numberOfAccessPoints}</div>
</div>
<div class="flex flex-row text-white mt-20 text-xl">
<div class="pr-2">Access points up :</div>
<div>{numberOfAccessPointsUp}</div>
</div>
</div>
</div>
<style>
.height {
height: calc(100vh - 14rem);
}
</style>

View File

@ -0,0 +1,17 @@
<div class="height">
<div class="bg-[#05171E] rounded-lg w-3/4 h-full mx-auto mt-20 py-4 px-20">
<div class="text-white text-center text-3xl">About</div>
<div class="flex flex-row text-white mt-20 text-xl">
This project was made by the Pátek team during the 2023 Junior AT&T Hackathon.
</div>
<div class="flex flex-row text-white mt-20 text-xl">
Its an open-source management tool for access points with
</div>
</div>
</div>
<style>
.height {
height: calc(100vh - 14rem);
}
</style>

View File

@ -0,0 +1,12 @@
<div class="height">
<div class="bg-[#05171E] rounded-lg w-3/4 h-full mx-auto mt-20 py-4 px-20">
<div class="text-white text-center text-3xl">Contact</div>
<div class="flex flex-row text-white mt-20 text-xl">patek@gbl.cz</div>
</div>
</div>
<style>
.height {
height: calc(100vh - 14rem);
}
</style>

View File

@ -0,0 +1,19 @@
<div class="height">
<div class="bg-[#05171E] rounded-lg w-3/4 h-full mx-auto mt-20 py-4 px-20">
<div class="text-white text-center text-3xl">Docs</div>
<div class="flex flex-row text-white mt-20 text-xl">
dummy text dummy text dummy text dummy text dummy text dummy text dummy text dummy text dummy
text dummy text dummy text dummy text dummy text dummy text dummy text dummy text dummy text
dummy text dummy text dummy text dummy text dummy text dummy text dummy text dummy text dummy
text dummy text dummy text dummy text dummy text dummy text dummy text dummy text dummy text
dummy text dummy text dummy text dummy text dummy text dummy text dummy text dummy text dummy
text dummy text
</div>
</div>
</div>
<style>
.height {
height: calc(100vh - 14rem);
}
</style>

View File

@ -0,0 +1,26 @@
<div class="height">
<div class="bg-[#05171E] rounded-lg w-3/4 h-full mx-auto mt-20 py-4 px-20">
<div class="text-white text-center text-3xl">Settings</div>
<table class="text-white border mx-auto mt-10">
<tr>
<th class="title">ID</th>
<th class="title">Name</th>
<th class="title">Type</th>
<th class="title">Location</th>
<th class="title">IP address</th>
</tr>
</table>
<div class="flex justify-center mt-10">
<button class="text-white py-2 px-10 bg-[#1D3920] rounded-xl"> Add access point </button>
</div>
</div>
</div>
<style>
.height {
height: calc(100vh - 14rem);
}
.title {
@apply py-2 px-10 bg-[#5B5B5B] border;
}
</style>

View File

@ -0,0 +1,24 @@
/* Injects Tailwind's base styles & any base styles registered by plugins. */
@tailwind base;
@layer base {
/* custom CSS goes here */
}
/* Injects Tailwind's component classes & any component classes registered by plugins. */
@tailwind components;
@layer components {
/* custom CSS goes here */
}
/* Injects Tailwind's utility classes & any utility classes registered by plugins. */
@tailwind utilities;
@layer utilities {
/* custom CSS goes here */
}
/* Directive controlling where Tailwind injects responsive variations of utilities.
By default Tailwind normally append these at the end of your stylesheet. */
@tailwind screens;

BIN
Frontend/static/favicon.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

View File

@ -0,0 +1,18 @@
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 340 224">
<rect width="340" height="224" x="0" y="0" fill="#0b2a37" rx="0" ry="0"></rect>
<g id="content" transform="translate(-14.675779999999975,32)">
<path id="circle0" fill="#ffffff" d="M162.68928 79.500341c.00001 32.335449 19.43462 62.028599 49.38074 74.430609 29.87414 12.37423 64.31674 5.52319 87.17895-17.34172 22.86505-22.86506 29.71595-57.306944 17.34172-87.178952C304.18797 19.467723 274.53544.016 242.20284.016v14.377329c26.562 0 50.97695 16.042665 61.11362 40.514624 10.16518 24.540368 4.55826 52.727797-14.22412 71.508967-18.78259 18.7826-46.97003 24.3893-71.50897 14.22412-24.46839-10.13524-40.51462-34.5787-40.51462-61.141412z" paint-order="markers fill stroke" style="font-variant-ligatures:normal;font-variant-position:normal;font-variant-caps:normal;font-variant-numeric:normal;font-variant-alternates:normal;font-feature-settings:normal;text-indent:0;text-decoration-line:none;text-decoration-style:solid;text-transform:none;text-orientation:mixed;white-space:normal;shape-padding:0;isolation:auto;mix-blend-mode:normal"></path>
<path id="circle4" fill="#ffffff" d="M215.271 79.543096c-.00001 10.890599 6.57041 20.717294 16.63198 24.885264 10.06114 4.16762 21.66576 1.86914 29.36678-5.831597 7.70102-7.701021 9.99914-19.304928 5.8316-29.366778-4.16762-10.061138-13.99467-16.631982-24.88527-16.631982v4.843441c8.94593 0 16.99398 5.374539 20.41729 13.639793 3.42331 8.265254 1.538 17.766434-4.78779 24.092145-6.32578 6.325788-15.82675 8.211238-24.09214 4.787788-8.26469-3.423452-13.63979-11.471364-13.63979-20.41729z" paint-order="markers fill stroke" style="font-variant-ligatures:normal;font-variant-position:normal;font-variant-caps:normal;font-variant-numeric:normal;font-variant-alternates:normal;font-feature-settings:normal;text-indent:0;text-decoration-line:none;text-decoration-style:solid;text-transform:none;text-orientation:mixed;white-space:normal;shape-padding:0;isolation:auto;mix-blend-mode:normal"></path>
<text x="234.51401" y="68.234459" fill="#ffffff" stroke-width="1.9459722" font-family="sans-serif" font-size="77.83888245" font-weight="400" letter-spacing="0" style="line-height:1.25;text-align:end" text-anchor="end" word-spacing="0">
<tspan id="title" x="234.51402" y="68.234459" font-family="Fira Code" font-weight="700" style="-inkscape-font-specification:'Fira Code Bold';text-align:end">PWC²</tspan>
</text>
<text x="159.64459" y="120.83648" fill="#ffffff" stroke-width="1.17030752" font-family="sans-serif" font-size="46.81230164" font-weight="400" letter-spacing="0" style="line-height:1.25;text-align:end" text-anchor="end" word-spacing="0">
<tspan id="subtitle" x="159.64459" y="120.83648" font-family="Fira Code" font-weight="700" style="-inkscape-font-specification:'Fira Code Bold';text-align:end">Pátek</tspan>
</text>
</g>
</svg>

After

Width:  |  Height:  |  Size: 2.9 KiB

18
Frontend/svelte.config.js Normal file
View File

@ -0,0 +1,18 @@
import preprocess from 'svelte-preprocess';
import adapter from '@sveltejs/adapter-auto';
/** @type {import('@sveltejs/kit').Config} */
const config = {
// Consult https://github.com/sveltejs/svelte-preprocess
// for more information about preprocessors
preprocess: preprocess({
postcss: true
}),
kit: {
// hydrate the <div id="svelte"> element in src/app.html
adapter: adapter()
}
};
export default config;

View File

@ -0,0 +1,12 @@
module.exports = {
mode: 'jit',
content: ['./src/**/*.{html,js,svelte,ts}'],
theme: {
extend: {
},
},
variants: {
extend: {}
},
plugins: []
};

6
Frontend/tests/test.ts Normal file
View File

@ -0,0 +1,6 @@
import { expect, test } from '@playwright/test';
test('index page has expected h1', async ({ page }) => {
await page.goto('/');
await expect(page.getByRole('heading', { name: 'Welcome to SvelteKit' })).toBeVisible();
});

46
Frontend/tsconfig.json Normal file
View File

@ -0,0 +1,46 @@
{
"extends": "./.svelte-kit/tsconfig.json",
"compilerOptions": {
"moduleResolution": "node",
"module": "es2020",
"lib": ["es2020", "DOM"],
"target": "es2020",
/**
svelte-preprocess cannot figure out whether you have a value or a type, so tell TypeScript
to enforce using \`import type\` instead of \`import\` for Types.
*/
"importsNotUsedAsValues": "error",
"isolatedModules": true,
"resolveJsonModule": true,
/**
To have warnings/errors of the Svelte compiler at the correct position,
enable source maps by default.
*/
"sourceMap": true,
"esModuleInterop": true,
"skipLibCheck": true,
"forceConsistentCasingInFileNames": true,
"baseUrl": ".",
"allowJs": true,
"checkJs": true,
"paths": {
"$lib": ["src/lib"],
"$lib/*": ["src/lib/*"],
"$styles": ["src/styles"],
"$styles/*": ["src/styles/*"],
"$stores": ["src/stores"],
"$stores/*": ["src/stores/*"],
"$utils": ["src/utils"],
"$utils/*": ["src/utils/*"],
"$components": ["src/lib/components"],
"$components/*": ["src/lib/components/*"],
"$pages": ["src/lib/pages"],
"$pages/*": ["src/lib/pages/*"],
"$sections": ["src/lib/sections"],
"$sections/*": ["src/lib/sections/*"],
"$icons": ["src/lib/icons"],
"$icons/*": ["src/lib/icons/*"]
}
},
"include": ["src/**/*.d.ts", "src/**/*.js", "src/**/*.ts", "src/**/*.svelte"]
}

21
Frontend/vite.config.ts Normal file
View File

@ -0,0 +1,21 @@
import { sveltekit } from '@sveltejs/kit/vite';
import path from 'path';
/** @type {import('vite').UserConfig} */
const config = {
plugins: [sveltekit()],
resolve: {
alias: {
$stores: path.resolve('./src/stores'),
$styles: path.resolve('./src/styles'),
$utils: path.resolve('./src/utils'),
$components: path.resolve('./src/lib/components'),
$pages: path.resolve('./src/lib/pages'),
$sections: path.resolve('./src/lib/sections'),
$icons: path.resolve('./src/lib/icons')
}
},
clearScreen: false
};
export default config;

View File

@ -1,5 +1,2 @@
# AT&T Hackathon 2023
This repository contains code made by the Pátek team for the 2023 AT&T Hackathon in Brno. :)
FYI all code is currently on Broxon branch
This repository contains code made by the Pátek team for the 2023 AT&T Hackathon in Brno.

5
Wifi Analyzer/.gitignore vendored Normal file
View File

@ -0,0 +1,5 @@
.pio
.vscode/.browse.c_cpp.db*
.vscode/c_cpp_properties.json
.vscode/launch.json
.vscode/ipch

10
Wifi Analyzer/.vscode/extensions.json vendored Normal file
View File

@ -0,0 +1,10 @@
{
// See http://go.microsoft.com/fwlink/?LinkId=827846
// for the documentation about the extensions.json format
"recommendations": [
"platformio.platformio-ide"
],
"unwantedRecommendations": [
"ms-vscode.cpptools-extension-pack"
]
}

View File

@ -0,0 +1,39 @@
This directory is intended for project header files.
A header file is a file containing C declarations and macro definitions
to be shared between several project source files. You request the use of a
header file in your project source file (C, C++, etc) located in `src` folder
by including it, with the C preprocessing directive `#include'.
```src/main.c
#include "header.h"
int main (void)
{
...
}
```
Including a header file produces the same results as copying the header file
into each source file that needs it. Such copying would be time-consuming
and error-prone. With a header file, the related declarations appear
in only one place. If they need to be changed, they can be changed in one
place, and programs that include the header file will automatically use the
new version when next recompiled. The header file eliminates the labor of
finding and changing all the copies as well as the risk that a failure to
find one copy will result in inconsistencies within a program.
In C, the usual convention is to give header files names that end with `.h'.
It is most portable to use only letters, digits, dashes, and underscores in
header file names, and at most one dot.
Read more about using header files in official GCC documentation:
* Include Syntax
* Include Operation
* Once-Only Headers
* Computed Includes
https://gcc.gnu.org/onlinedocs/cpp/Header-Files.html

46
Wifi Analyzer/lib/README Normal file
View File

@ -0,0 +1,46 @@
This directory is intended for project specific (private) libraries.
PlatformIO will compile them to static libraries and link into executable file.
The source code of each library should be placed in a an own separate directory
("lib/your_library_name/[here are source files]").
For example, see a structure of the following two libraries `Foo` and `Bar`:
|--lib
| |
| |--Bar
| | |--docs
| | |--examples
| | |--src
| | |- Bar.c
| | |- Bar.h
| | |- library.json (optional, custom build options, etc) https://docs.platformio.org/page/librarymanager/config.html
| |
| |--Foo
| | |- Foo.c
| | |- Foo.h
| |
| |- README --> THIS FILE
|
|- platformio.ini
|--src
|- main.c
and a contents of `src/main.c`:
```
#include <Foo.h>
#include <Bar.h>
int main (void)
{
...
}
```
PlatformIO Library Dependency Finder will find automatically dependent
libraries scanning project source files.
More information about PlatformIO Library Dependency Finder
- https://docs.platformio.org/page/librarymanager/ldf.html

View File

@ -0,0 +1,19 @@
; PlatformIO Project Configuration File
;
; Build options: build flags, source filter
; Upload options: custom upload port, speed and extra flags
; Library options: dependencies, extra library storages
; Advanced options: extra scripting
;
; Please visit documentation for the other options and examples
; https://docs.platformio.org/page/projectconf.html
[env:esp32doit-devkit-v1]
platform = espressif32
board = esp32doit-devkit-v1
framework = arduino
monitor_speed = 115200
lib_deps =
WiFi
ArduinoJson
WebSocketsClient

View File

@ -0,0 +1,48 @@
#include <Arduino.h>
#include <WiFi.h>
#include <ArduinoJson.h>
const int scanIterations = 5;
const int maxChannel = 14; // Maximum number of Wi-Fi channels in the 2.4 GHz band
int channelUsage[maxChannel] = {0};
void setup() {
Serial.begin(115200);
WiFi.mode(WIFI_STA);
WiFi.disconnect();
delay(100);
Serial.println("Setup complete. Starting Wi-Fi channel analysis.");
}
void loop() {
Serial.println("Scanning...");
for (int iteration = 0; iteration < scanIterations; iteration++) {
int numberOfNetworks = WiFi.scanNetworks();
for (int networkIndex = 0; networkIndex < numberOfNetworks; networkIndex++) {
int channel = WiFi.channel(networkIndex);
if (channel > 0 && channel <= maxChannel) {
channelUsage[channel - 1]++;
}
}
delay(1000);
}
// Create a JSON object to store channel usage data
StaticJsonDocument<256> jsonDocument;
JsonObject channelUsageJson = jsonDocument.to<JsonObject>();
for (int channelIndex = 0; channelIndex < maxChannel; channelIndex++) {
String channel = String(channelIndex + 1);
channelUsageJson[channel] = channelUsage[channelIndex];
channelUsage[channelIndex] = 0; // Reset channel usage counter for the next analysis
}
// Serialize and print the JSON object
Serial.println("Analysis complete. Channel usage:");
serializeJsonPretty(channelUsageJson, Serial);
Serial.println("\nRescanning in 5 seconds...");
delay(5000);
}

11
Wifi Analyzer/test/README Normal file
View File

@ -0,0 +1,11 @@
This directory is intended for PlatformIO Test Runner and project tests.
Unit Testing is a software testing method by which individual units of
source code, sets of one or more MCU program modules together with associated
control data, usage procedures, and operating procedures, are tested to
determine whether they are fit for use. Unit testing finds problems early
in the development cycle.
More information about PlatformIO Unit Testing:
- https://docs.platformio.org/en/latest/advanced/unit-testing/index.html