FreeDATA/gui/src/js/api.js

22 lines
615 B
JavaScript
Raw Normal View History

2023-11-09 18:46:29 +00:00
import { getModemConfigAsJSON } from "./settingsHandler.ts";
2023-11-09 21:11:53 +00:00
import { getFromServer, postToServer } from "./rest.js";
2023-11-09 18:46:29 +00:00
2023-11-09 21:12:32 +00:00
export function getModemConfig() {
2023-11-09 18:46:29 +00:00
// fetch Settings
getFromServer("localhost", 5000, "config");
getFromServer("localhost", 5000, "devices/audio");
getFromServer("localhost", 5000, "devices/serial");
}
2023-11-09 21:12:32 +00:00
export function saveModemConfig() {
2023-11-09 18:46:29 +00:00
postToServer("localhost", 5000, "config", getModemConfigAsJSON());
}
2023-11-09 21:11:53 +00:00
export function startModem() {
postToServer("localhost", 5000, "modem/start", null);
2023-11-09 18:46:29 +00:00
}
2023-11-09 21:11:53 +00:00
export function stopModem() {
postToServer("localhost", 5000, "modem/stop", null);
2023-11-09 18:46:29 +00:00
}