Commit 0e9402eb authored by Léo-Paul Géneau's avatar Léo-Paul Géneau 👾

software/js-drone: handle first websocket message

parent d94ee240
......@@ -42,4 +42,4 @@ md5sum = dfa140d70d8a9cadc6cee865be4e8c26
[worker]
_update_hash_filename_ = drone-scripts/worker.js.jinja2
md5sum = a12788ec0d9972fc30c19c1f6db12da3
md5sum = 5e642dc35d86b7d7636532ffc9cc2bdb
......@@ -150,9 +150,6 @@ import { evalScript, fdopen, loadFile, open } from "std";
handleWebSocketMessage = function () {
var message = readMessage(gwsocket_r_pipe_fd).data;
if (message.includes(configuration.websocketIp)) {
return;
}
onMessage(message);
};
user_me.writeWebsocketMessage = function (message) {
......
......@@ -282,7 +282,7 @@ class SubscriberTestCase(SlapOSInstanceTestCase):
# Check if first message is 'Unknown instruction IP' where IP is client IPv6 address
self.assertIn(
b'Unknown instruction %s' % ws.sock.getsockname()[0].encode(),
ws.recv_frame().data
ws.recv_frame().data,
)
self.assertIn(
b'\\u001b[32minfo/userland\\u001b[0m\\tfieldsSize 3\\n"}',
......@@ -295,7 +295,7 @@ class SubscriberTestCase(SlapOSInstanceTestCase):
b'"%.6f","longitude":"%.6f","altitude":"%.2f",' % (0, 0, 0),
b'"yaw":"%.2f","speed":"%.2f","climbRate":"%.2f",' % (0, 0, 0),
b'"timestamp":%d}}}' % 0,
))
)),
)
self.assertIn(
b'\\u001b[32minfo/client\\u001b[0m\\tReceived position of drone 0: %.6f ? %.6f ? %.2f m %.2f m\\n"}' % (0, 0 , 0, 0),
......@@ -308,7 +308,7 @@ class SubscriberTestCase(SlapOSInstanceTestCase):
b'"%.6f","longitude":"%.6f","altitude":"%.2f",' % (0, 0, 0),
b'"yaw":"%.2f","speed":"%.2f","climbRate":"%.2f",' % (0, 0, 0),
b'"timestamp":%d}}}' % 0,
))
)),
)
self.assertIn(
b'\\u001b[32minfo/client\\u001b[0m\\tReceived speed of drone 0: %.2f ? %.2f m/s %.2f m/s\\n"}' % (0, 0 , 0),
......@@ -321,7 +321,7 @@ class SubscriberTestCase(SlapOSInstanceTestCase):
b'"%.6f","longitude":"%.6f","altitude":"%.2f",' % (0, 0, 0),
b'"yaw":"%.2f","speed":"%.2f","climbRate":"%.2f",' % (0, 0, 0),
b'"timestamp":%d}}}' % 0,
))
)),
)
self.assertIn(
b'\\u001b[32minfo/userland\\u001b[0m\\tfieldsSize 1\\n"}',
......@@ -334,7 +334,7 @@ class SubscriberTestCase(SlapOSInstanceTestCase):
b'"%.6f","longitude":"%.6f","altitude":"%.2f",' % (0, 0, 0),
b'"yaw":"%.2f","speed":"%.2f","climbRate":"%.2f",' % (0, 0, 0),
b'"timestamp":%d}}}' % 0,
))
)),
)
self.send_ua_networkMessage()
time.sleep(0.1)
......@@ -350,7 +350,7 @@ class SubscriberTestCase(SlapOSInstanceTestCase):
b'"%.6f","longitude":"%.6f","altitude":"%.2f",' % POSITION_ARRAY_OUTPUT_VALUES[:-1],
b'"yaw":"%.2f","speed":"%.2f","climbRate":"%.2f",' % SPEED_ARRAY_VALUES,
b'"timestamp":%d}}}' % POSITION_ARRAY_INPUT_VALUES[-1],
))
)),
)
self.assertIn(
b'\\u001b[32minfo/client\\u001b[0m\\tReceived speed of drone 0: %.2f ? %.2f m/s %.2f m/s\\n"}' % SPEED_ARRAY_VALUES,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment