diff --git a/commander.html b/commander.html
index cf0f16c..3c6a085 100644
--- a/commander.html
+++ b/commander.html
@@ -230,16 +230,19 @@
let lockBtn = document.createElement("div");
lockBtn.className = "btn";
lockBtn.innerHTML = lockIcon;
+ lockBtn.ariaLabel = "lock";
lockBtn.addEventListener('click', lockBoat);
boatCells[3].append(lockBtn);
let freeBtn = document.createElement("div");
freeBtn.className = "btn";
freeBtn.innerHTML = freeIcon;
+ lockBtn.ariaLabel = "free";
freeBtn.addEventListener('click', freeBoat);
boatCells[3].append(freeBtn);
let logBtn = document.createElement("div");
logBtn.className = "btn";
logBtn.innerHTML = logIcon;
+ lockBtn.ariaLabel = "view log";
logBtn.addEventListener('click', getBoatLog);
boatCells[3].append(logBtn);
for (cell in boatCells)
diff --git a/ground-station.py b/ground-station.py
index c510946..bf275d5 100644
--- a/ground-station.py
+++ b/ground-station.py
@@ -78,6 +78,7 @@ async def free_boat(boat):
for client in Clients:
if client["boat"] is not None and client["boat"]['id'] == boat:
client["boat"] = None
+ await client['ws'].send("FAIL")
break
for b in Boats:
if b['id'] == boat and b['state'] != BOAT_STATE_TERMINATED:
@@ -89,6 +90,7 @@ async def lock_boat(boat):
for client in Clients:
if client["boat"] is not None and client["boat"]['id'] == boat:
client["boat"] = None
+ await client['ws'].send("FAIL")
break
for b in Boats:
if b['id'] == boat and b['state'] != BOAT_STATE_TERMINATED:
@@ -116,11 +118,11 @@ async def kick_client(clientId):
"""kick a client"""
for client in Clients:
if client['id'] == client and client['state'] == "terminated":
- if client['state'] is not None:
+ if client['boat'] is not None:
client['boat']['state'] = BOAT_STATE_AVAILABLE
client['boat'] = None
- client['state'] = "kicked"
- await client['ws'].send("FAIL")
+ client['state'] = "kicked"
+ await client['ws'].send("FAIL")
return
@@ -151,6 +153,7 @@ async def on_message(message, client):
elif data[1] == "d":
if client['boat'] is None:
print("WARN: controll cmd (" + client['id'] + ") to None: " + data[2])
+ await client['ws'].send("FAIL")
elif client['boat']['lastMsg'] + BOAT_DATA_INTERVAL_MAX < datetime.timestamp(datetime.now()):
# print("INFO: controll cmd (" + client['id'] + ") to " + client['boat']['name'] + ": " + data[2])
await sendToBoat(client['boat'], "d:" + data[2] + "\n")
diff --git a/index.html b/index.html
index 4702a2f..d9564cb 100644
--- a/index.html
+++ b/index.html
@@ -66,14 +66,23 @@
let el = document.createElement("div");
el.style.textAlign = "center";
el.style.borderRadius = "10px";
- el.style.backgroundColor = "#242495";
el.style.padding = "10px";
el.style.margin = "5px 25%";
- el.style.color = "white";
- el.style.cursor = "pointer";
+ if (boat[2] == 'available')
+ {
+ el.style.backgroundColor = "#242495";
+ el.style.color = "white";
+ el.style.cursor = "pointer";
+ el.addEventListener('click', selectBoat);
+ }
+ else
+ {
+ el.style.backgroundColor = "#CCCCCC";
+ el.style.color = "black";
+ el.style.cursor = "not-allowed";
+ }
el.id = "boat" + boat[0];
el.innerHTML = boat[1];
- el.addEventListener('click', selectBoat);
boatListEl.appendChild(el);
}
}
@@ -88,6 +97,7 @@
{
console.error("ground station send FAIL");
connection.send(clientId + ';boats');
+ state = "connected";
}
else
{