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.
+