test_client: support additional notifications

Add support for "notify_klippy_ready" and "notify_power_changed".

SIgned-off-by:  Eric Callahan <arksine.code@gmail.com>
This commit is contained in:
Arksine 2020-11-11 17:52:30 -05:00
parent 3d827d7513
commit 6254586a65
1 changed files with 12 additions and 3 deletions

View File

@ -721,12 +721,21 @@ function handle_klippy_disconnected() {
// be a good place.
klippy_ready = false;
update_term("Klippy Disconnected");
setTimeout(() => {
get_klippy_info();
}, 2000);
}
json_rpc.register_method("notify_klippy_disconnected", handle_klippy_disconnected);
function handle_klippy_ready() {
update_term("Klippy Is READY");
console.log("Klippy Ready Recieved");
get_klippy_info();
}
json_rpc.register_method("notify_klippy_ready", handle_klippy_ready);
function handle_power_changed(power_status) {
console.log(`Power Changed: ${power_status}`);
}
json_rpc.register_method("notify_power_changed", handle_power_changed);
function handle_file_list_changed(file_info) {
// This event fires when a client has either added or removed
// a gcode file.