aboutsummaryrefslogtreecommitdiffstats
path: root/gui/static/js/odr-modulator.js
diff options
context:
space:
mode:
authorMatthias P. Braendli <matthias.braendli@mpb.li>2018-09-24 19:42:01 +0200
committerMatthias P. Braendli <matthias.braendli@mpb.li>2018-09-24 20:47:08 +0200
commit5ad01f6415710521173e7a612b32c982847eada4 (patch)
tree4d4c8ca0a7ce0ff0f81702ee7bfad0b57c899929 /gui/static/js/odr-modulator.js
parent5bb71419937a4d8919ef33df088f73e6c705b028 (diff)
downloaddabmod-5ad01f6415710521173e7a612b32c982847eada4.tar.gz
dabmod-5ad01f6415710521173e7a612b32c982847eada4.tar.bz2
dabmod-5ad01f6415710521173e7a612b32c982847eada4.zip
gui: use json for all API answers
Diffstat (limited to 'gui/static/js/odr-modulator.js')
-rw-r--r--gui/static/js/odr-modulator.js52
1 files changed, 5 insertions, 47 deletions
diff --git a/gui/static/js/odr-modulator.js b/gui/static/js/odr-modulator.js
index 273d9f7..8538645 100644
--- a/gui/static/js/odr-modulator.js
+++ b/gui/static/js/odr-modulator.js
@@ -18,48 +18,6 @@
// You should have received a copy of the GNU General Public License
// along with ODR-DabMod. If not, see <http://www.gnu.org/licenses/>.
-function set_rc(controllable, param, value, callback) {
- $.ajax({
- type: "POST",
- url: "/api/parameter",
- contentType: 'application/json',
- dataType: 'json',
- data: JSON.stringify({
- controllable: controllable,
- param: param,
- value: value
- }),
-
- error: function(data) {
- $.gritter.add({
- title: 'RC set',
- text: "ERROR",
- image: '/fonts/warning.png',
- sticky: true,
- });
- },
- success: callback
- });
-}
-
-function getRc(callback) {
- $.ajax({
- type: "GET",
- url: "/api/rc_parameters",
- contentType: 'application/json',
- dataType: 'json',
-
- error: function(data) {
- $.gritter.add({
- title: 'RC info',
- text: "ERROR: ",
- image: '/fonts/warning.png',
- sticky: true,
- });
- },
- success: callback
- });
-}
function requestAllParams(callback) {
getRc(function(data) {
@@ -86,21 +44,21 @@ $(function(){
requestAllParams();
$('#setdigitalgain').click(function() {
- set_rc("gain", "digital", $('#digitalgain').val(),
+ setRc("gain", "digital", $('#digitalgain').val(),
requestAllParams);
});
$('#setwindowlength').click(function() {
- set_rc("guardinterval", "windowlen", $('#windowlength').val(),
+ setRc("guardinterval", "windowlen", $('#windowlength').val(),
requestAllParams);
});
$('#setclip').click(function() {
- set_rc("ofdm", "clip", $('#cfrclip').val(),
+ setRc("ofdm", "clip", $('#cfrclip').val(),
requestAllParams);
- set_rc("ofdm", "errorclip", $('#cfrerrorclip').val(),
+ setRc("ofdm", "errorclip", $('#cfrerrorclip').val(),
requestAllParams);
- set_rc("ofdm", "cfr",
+ setRc("ofdm", "cfr",
($('#cfrenable').prop("checked") ? "1" : "0"),
requestAllParams);
});