From 2717a66382185dafabd71c374371fbc49e34b9c4 Mon Sep 17 00:00:00 2001 From: Halcy0nic Date: Tue, 3 Sep 2024 14:13:52 -0600 Subject: [PATCH] Feat: Allowing the selection of the serial port from a list of available ports --- app.py | 6 ++ templates/analysis.html | 211 ++++++++++++++++++++++------------------ templates/index.html | 207 ++++++++++++++++++++++----------------- templates/tracking.html | 207 ++++++++++++++++++++++----------------- 4 files changed, 359 insertions(+), 272 deletions(-) diff --git a/app.py b/app.py index 972f525..8acb3b3 100644 --- a/app.py +++ b/app.py @@ -12,6 +12,7 @@ from bs4 import BeautifulSoup import ipaddress from io import StringIO, BytesIO import csv +import serial.tools.list_ports app = Flask(__name__) socketio = SocketIO(app) @@ -343,6 +344,11 @@ def transmit433(): ser1.write(msg.encode()) return jsonify(result="Ok") +@app.route('/get_serial_ports') +def get_serial_ports(): + ports = [port.device for port in serial.tools.list_ports.comports()] + return jsonify(ports=ports) + @app.route('/transmit868', methods=['POST']) def transmit868(): global ser2 diff --git a/templates/analysis.html b/templates/analysis.html index b4db320..db6e7e1 100644 --- a/templates/analysis.html +++ b/templates/analysis.html @@ -50,8 +50,8 @@

Skinny Research and Development

- Analyze LoRa traffic received at 433, 868, or 915 MHz. Click the desired frequency below to get started. Once you are on the appropriate page, click the 'Connect Serial Port' button to connect to a serial port on your computer. Once connected to your LoRa receiver, traffic will automatically be streamed to the web page for analysis. To disconnect a receiver, click the 'Disconnect Serial Port' button. -

+ Analyze LoRa traffic received at 433, 868, or 915 MHz. Click the desired frequency below to get started. Once you are on the appropriate page, click the 'Select Device' button to connect to a serial port on your computer. Once connected to your LoRa receiver, traffic will automatically be streamed to the web page for analysis. To disconnect a receiver, click the 'Disconnect Device' button. +




@@ -65,8 +65,8 @@
- - + +

@@ -153,34 +153,43 @@ @@ -267,8 +276,8 @@
- - + +

@@ -340,34 +349,43 @@ @@ -455,8 +473,8 @@
- - + +

@@ -527,34 +545,43 @@ diff --git a/templates/index.html b/templates/index.html index 1de12b4..8159183 100644 --- a/templates/index.html +++ b/templates/index.html @@ -86,8 +86,8 @@
- - + +

@@ -174,34 +174,43 @@ @@ -288,8 +297,8 @@
- - + +

@@ -361,34 +370,43 @@ @@ -476,8 +494,8 @@
- - + +

@@ -548,34 +566,43 @@ diff --git a/templates/tracking.html b/templates/tracking.html index 21868a1..e3f652d 100644 --- a/templates/tracking.html +++ b/templates/tracking.html @@ -210,8 +210,8 @@
- - + +

@@ -283,34 +283,43 @@ @@ -458,8 +467,8 @@
- - + +

@@ -528,34 +537,43 @@ @@ -705,8 +723,8 @@
- - + +

@@ -776,34 +794,43 @@