From 4a3901d688eeb90664c4259aca8eaea82754f58a Mon Sep 17 00:00:00 2001 From: f4exb Date: Sat, 25 Nov 2017 18:32:37 +0100 Subject: [PATCH] Web API: /sdrangel/preset (PUT, POST) implementation --- sdrbase/resources/index.html | 142 ++++++++++++++-------- sdrbase/webapi/webapiadapterinterface.h | 10 ++ sdrbase/webapi/webapirequestmapper.cpp | 19 +++ sdrgui/webapi/webapiadaptergui.cpp | 57 ++++++++- sdrgui/webapi/webapiadaptergui.h | 5 + swagger/sdrangel/api/swagger/swagger.yaml | 12 +- swagger/sdrangel/code/html2/index.html | 142 ++++++++++++++-------- 7 files changed, 280 insertions(+), 107 deletions(-) diff --git a/sdrbase/resources/index.html b/sdrbase/resources/index.html index e6fc65d91..95b9c8dce 100644 --- a/sdrbase/resources/index.html +++ b/sdrbase/resources/index.html @@ -1049,9 +1049,9 @@ margin-bottom: 20px; "description" : "Name of the preset group" }, "centerFrequency" : { - "type" : "number", - "format" : "float", - "description" : "Center freqeuency in MHz" + "type" : "integer", + "format" : "int64", + "description" : "Center freqeuency in Hz" }, "type" : { "type" : "string", @@ -1068,9 +1068,9 @@ margin-bottom: 20px; "required" : [ "centerFrequency", "name", "type" ], "properties" : { "centerFrequency" : { - "type" : "number", - "format" : "float", - "description" : "Center freqeuency in MHz" + "type" : "integer", + "format" : "int64", + "description" : "Center freqeuency in Hz" }, "type" : { "type" : "string", @@ -6195,12 +6195,47 @@ $(document).ready(function() { -

Status: 400 - Invalid frequency

+

Status: 400 - Preset type and device set type mismatch

+
+
+ +
+ +

Status: 404 - No preset or device set found

@@ -6309,7 +6344,7 @@ $(document).ready(function() {

-

Create a new preset from a device set settings

+

Create a new preset from a device set settings. Frequency and type is ignored and taken from the the device set values.


/sdrangel/preset
@@ -6598,42 +6633,61 @@ $(document).ready(function() { -

Status: 400 - Invalid frequency

- - - -
-
-

Status: 404 - Device set not found

- - -
-
- -

Status: 409 - Preset already exists

- - - -
-
- -

Status: 500 - Error

-
-
-
+
+
+ +
+ +
+
+ +

Status: 409 - Error

+ + + +
+
+
- +
@@ -6685,7 +6739,7 @@ $(document).ready(function() {

-

Save device set settings on a preset

+

Update device set settings on an existing preset.


/sdrangel/preset
@@ -6974,14 +7028,6 @@ $(document).ready(function() {
-

Status: 400 - Invalid frequency

- - - -
-
-

Status: 404 - No preset or device set found