Created Notes, Edited websocket_test.html
This commit is contained in:
parent
a6d557d1c6
commit
0b97079cfd
17
run.py
17
run.py
@ -113,7 +113,7 @@ def start_server_socket():
|
|||||||
case "log":
|
case "log":
|
||||||
fprint("log message")
|
fprint("log message")
|
||||||
if call == "send":
|
if call == "send":
|
||||||
fprint("webapp: " + data)
|
fprint("webapp: " + str(data), sendqueue=to_server_queue)
|
||||||
elif call == "request":
|
elif call == "request":
|
||||||
fprint("")
|
fprint("")
|
||||||
|
|
||||||
@ -124,6 +124,15 @@ def start_server_socket():
|
|||||||
elif call == "request":
|
elif call == "request":
|
||||||
fprint("")
|
fprint("")
|
||||||
|
|
||||||
|
# Lucas' notes
|
||||||
|
# Add a ping pong :) response/handler
|
||||||
|
# Add a get cable response/handler
|
||||||
|
# this will tell the robot arm to move
|
||||||
|
# Call for turning off everything
|
||||||
|
|
||||||
|
# TODO Helper for converting Python Dictionaries to JSON
|
||||||
|
# make function: pythonData --> { { "type": "...", "call": "...", "data": pythonData } }
|
||||||
|
|
||||||
case "cable_details":
|
case "cable_details":
|
||||||
fprint("cable_details message")
|
fprint("cable_details message")
|
||||||
if call == "send":
|
if call == "send":
|
||||||
@ -235,7 +244,7 @@ def setup_server(pool):
|
|||||||
|
|
||||||
if camera_ready is False:
|
if camera_ready is False:
|
||||||
fprint("waiting for " + "Camera initilization" + " to complete...", sendqueue=to_server_queue)
|
fprint("waiting for " + "Camera initilization" + " to complete...", sendqueue=to_server_queue)
|
||||||
camera = process_video.qr_reader(config["cameras"]["banner"]["ip"], config["cameras"]["banner"]["port"])
|
# camera = process_video.qr_reader(config["cameras"]["banner"]["ip"], config["cameras"]["banner"]["port"])
|
||||||
|
|
||||||
fprint("Camera initialized.", sendqueue=to_server_queue)
|
fprint("Camera initialized.", sendqueue=to_server_queue)
|
||||||
|
|
||||||
@ -262,8 +271,8 @@ def mainloop_server(pool):
|
|||||||
killall()
|
killall()
|
||||||
counter = counter + 1
|
counter = counter + 1
|
||||||
|
|
||||||
fprint("Looking for QR code...")
|
# fprint("Looking for QR code...")
|
||||||
print(camera.read_qr(30))
|
# print(camera.read_qr(30))
|
||||||
|
|
||||||
def run_loading_app():
|
def run_loading_app():
|
||||||
|
|
||||||
|
@ -1,9 +1,10 @@
|
|||||||
<!DOCTYPE html>
|
<!DOCTYPE html>
|
||||||
<html>
|
<html>
|
||||||
|
|
||||||
<head>
|
<head>
|
||||||
<title>WebSocket Test</title>
|
<title>WebSocket Test</title>
|
||||||
<script>
|
<script>
|
||||||
document.addEventListener("DOMContentLoaded", function() {
|
document.addEventListener("DOMContentLoaded", function () {
|
||||||
// Create WebSocket connection.
|
// Create WebSocket connection.
|
||||||
const socket = new WebSocket('ws://localhost:9000');
|
const socket = new WebSocket('ws://localhost:9000');
|
||||||
|
|
||||||
@ -33,10 +34,15 @@
|
|||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
</head>
|
</head>
|
||||||
|
|
||||||
<body>
|
<body>
|
||||||
<h2>WebSocket Test</h2>
|
<h2>WebSocket Test</h2>
|
||||||
<input type="text" id="messageInput" placeholder="Type a message...">
|
<textarea rows="4" cols="50" id="messageInput" placeholder="Type a message..."> </textarea>
|
||||||
<button id="sendMessage">Send Message</button>
|
<button id="sendMessage">Send Message</button>
|
||||||
|
<p>Example JSON</p>
|
||||||
|
<p>{ "type": "cable_map", "call": "request", "data": { } }</p>
|
||||||
|
<p>Messages/Logs</p>
|
||||||
<ul id="messages"></ul>
|
<ul id="messages"></ul>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
|
||||||
|
</html>
|
Loading…
x
Reference in New Issue
Block a user