Skip to content

Commit bd8e630

Browse files
committed
Add check for existing wi-fi connection on connect
1 parent 86d51b5 commit bd8e630

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

src/resources/wifi_routes.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,10 @@ class wifi_connect(Resource):
1212
def post(self):
1313
content = request.get_json()
1414

15+
# If the device is already connected to a wifi network
16+
if check_wifi_status():
17+
return {'message': 'Device is already connected.'}, 409
18+
1519
# Check for any missing strings
1620
if "conn_type" not in content or "ssid" not in content:
1721
return {'message': 'Type or SSID not specified'}, 400
@@ -40,7 +44,7 @@ def get(self):
4044

4145
class wifi_forget(Resource):
4246
def get(self):
43-
# If the device is already connected to a wifi network
47+
# If the device is not connected to a wifi network
4448
if not check_wifi_status():
4549
return {'message': 'Device is already disconnected.'}, 409
4650

0 commit comments

Comments
 (0)