From 803db3c8dc08c745e62a0be85baa67296237cb57 Mon Sep 17 00:00:00 2001 From: f4exb Date: Tue, 5 May 2020 11:35:36 +0200 Subject: [PATCH] REST API: removed invert field from GLSpectrumSettings and added /sdrangel/deviceset/{deviceSetIndex}/spectrum/settings and /sdrangel/deviceset/{deviceSetIndex}/spectrum/server end points --- .../doc/swagger/include/GLSpectrum.yaml | 3 - .../resources/webapi/doc/swagger/swagger.yaml | 189 ++++++++++++++++++ .../api/swagger/include/GLSpectrum.yaml | 3 - swagger/sdrangel/api/swagger/swagger.yaml | 189 ++++++++++++++++++ 4 files changed, 378 insertions(+), 6 deletions(-) diff --git a/sdrbase/resources/webapi/doc/swagger/include/GLSpectrum.yaml b/sdrbase/resources/webapi/doc/swagger/include/GLSpectrum.yaml index 0da434001..85f4e83d3 100644 --- a/sdrbase/resources/webapi/doc/swagger/include/GLSpectrum.yaml +++ b/sdrbase/resources/webapi/doc/swagger/include/GLSpectrum.yaml @@ -31,9 +31,6 @@ GLSpectrum: displayGrid: description: boolean type: integer - invert: - description: boolean - type: integer displayGridIntensity: type: integer decayDivisor: diff --git a/sdrbase/resources/webapi/doc/swagger/swagger.yaml b/sdrbase/resources/webapi/doc/swagger/swagger.yaml index 0e2b0ff46..02562a9c3 100644 --- a/sdrbase/resources/webapi/doc/swagger/swagger.yaml +++ b/sdrbase/resources/webapi/doc/swagger/swagger.yaml @@ -982,6 +982,178 @@ paths: "501": $ref: "#/responses/Response_501" + /sdrangel/deviceset/{deviceSetIndex}/spectrum/settings: + x-swagger-router-controller: deviceset + get: + description: Get main spectrum settings + operationId: devicesetSpectrumSettingsGet + tags: + - DeviceSet + parameters: + - in: path + name: deviceSetIndex + type: integer + required: true + description: Index of device set in the device set list + responses: + "200": + description: On success return details on the main spectrum + schema: + $ref: "/doc/swagger/include/GLSpectrum.yaml#/GLSpectrum" + "404": + description: Invalid index + schema: + $ref: "#/definitions/ErrorResponse" + "500": + $ref: "#/responses/Response_500" + "501": + $ref: "#/responses/Response_501" + put: + description: Apply main spectrun settings unconditionnaly (force) + operationId: devicesetSpectrumSettingsPut + tags: + - DeviceSet + parameters: + - in: path + name: deviceSetIndex + type: integer + required: true + description: Index of device set in the device set list + - name: body + in: body + description: Spectrum settings to apply + required: true + schema: + $ref: "/doc/swagger/include/GLSpectrum.yaml#/GLSpectrum" + responses: + "200": + description: On success returns new settings values + schema: + $ref: "/doc/swagger/include/GLSpectrum.yaml#/GLSpectrum" + "404": + description: Invalid device set index or device not found + schema: + $ref: "#/definitions/ErrorResponse" + "500": + $ref: "#/responses/Response_500" + "501": + $ref: "#/responses/Response_501" + patch: + description: Apply main spectrun settings differentially (no force) + operationId: devicesetSpectrumSettingsPatch + tags: + - DeviceSet + parameters: + - in: path + name: deviceSetIndex + type: integer + required: true + description: Index of device set in the device set list + - name: body + in: body + description: Spectrum settings to apply + required: true + schema: + $ref: "/doc/swagger/include/GLSpectrum.yaml#/GLSpectrum" + responses: + "200": + description: On success returns new settings values + schema: + $ref: "/doc/swagger/include/GLSpectrum.yaml#/GLSpectrum" + "404": + description: Invalid device set index or device not found + schema: + $ref: "#/definitions/ErrorResponse" + "500": + $ref: "#/responses/Response_500" + "501": + $ref: "#/responses/Response_501" + + /sdrangel/deviceset/{deviceSetIndex}/spectrum/server: + x-swagger-router-controller: deviceset + get: + description: Get main spectrum websocket server status + operationId: devicesetSpectrumServerGet + tags: + - DeviceSet + parameters: + - in: path + name: deviceSetIndex + type: integer + required: true + description: Index of device set in the device set list + responses: + "200": + description: On success return main spectrum server status + schema: + $ref: "#/definitions/SpectrumServer" + "404": + description: Invalid index + schema: + $ref: "#/definitions/ErrorResponse" + "500": + $ref: "#/responses/Response_500" + "501": + $ref: "#/responses/Response_501" + + post: + description: Start main spectrum websocket server + operationId: devicesetSpectrumServerPost + tags: + - DeviceSet + parameters: + - in: path + name: deviceSetIndex + type: integer + required: true + description: Index of device set in the device set list + responses: + "200": + description: Server successfully started + schema: + $ref: "#/definitions/SuccessResponse" + "400": + description: Invalid device set index + schema: + $ref: "#/definitions/ErrorResponse" + "404": + description: Device not found + schema: + $ref: "#/definitions/ErrorResponse" + "500": + $ref: "#/responses/Response_500" + "501": + $ref: "#/responses/Response_501" + + delete: + description: Stop main spectrum websocket server + operationId: devicesetSpectrumServerDelete + tags: + - DeviceSet + parameters: + - in: path + name: deviceSetIndex + type: integer + required: true + description: Index of device set in the device set list + responses: + "200": + description: Server successfully stopped + schema: + $ref: "#/definitions/SuccessResponse" + "400": + description: Invalid device set index + schema: + $ref: "#/definitions/ErrorResponse" + "404": + description: Device not found + schema: + $ref: "#/definitions/ErrorResponse" + "500": + $ref: "#/responses/Response_500" + "501": + $ref: "#/responses/Response_501" + /sdrangel/deviceset/{deviceSetIndex}/device: x-swagger-router-controller: deviceset put: @@ -1891,6 +2063,23 @@ definitions: items: $ref: "#/definitions/DeviceSet" + SpectrumServer: + description: "Spectrum server state" + properties: + run: + description: "Boolean: 1: websocket spectrum server running 0: not running" + type: integer + clients: + description: "List of clients" + type: array + items: + type: object + properties: + address: + type: string + port: + type: integer + DeviceState: description: "Device running state" properties: diff --git a/swagger/sdrangel/api/swagger/include/GLSpectrum.yaml b/swagger/sdrangel/api/swagger/include/GLSpectrum.yaml index 0da434001..85f4e83d3 100644 --- a/swagger/sdrangel/api/swagger/include/GLSpectrum.yaml +++ b/swagger/sdrangel/api/swagger/include/GLSpectrum.yaml @@ -31,9 +31,6 @@ GLSpectrum: displayGrid: description: boolean type: integer - invert: - description: boolean - type: integer displayGridIntensity: type: integer decayDivisor: diff --git a/swagger/sdrangel/api/swagger/swagger.yaml b/swagger/sdrangel/api/swagger/swagger.yaml index b1de704a7..87bbcda3f 100644 --- a/swagger/sdrangel/api/swagger/swagger.yaml +++ b/swagger/sdrangel/api/swagger/swagger.yaml @@ -982,6 +982,178 @@ paths: "501": $ref: "#/responses/Response_501" + /sdrangel/deviceset/{deviceSetIndex}/spectrum/settings: + x-swagger-router-controller: deviceset + get: + description: Get main spectrum settings + operationId: devicesetSpectrumSettingsGet + tags: + - DeviceSet + parameters: + - in: path + name: deviceSetIndex + type: integer + required: true + description: Index of device set in the device set list + responses: + "200": + description: On success return details on the main spectrum + schema: + $ref: "http://localhost:8081/api/swagger/include/GLSpectrum.yaml#/GLSpectrum" + "404": + description: Invalid index + schema: + $ref: "#/definitions/ErrorResponse" + "500": + $ref: "#/responses/Response_500" + "501": + $ref: "#/responses/Response_501" + put: + description: Apply main spectrun settings unconditionnaly (force) + operationId: devicesetSpectrumSettingsPut + tags: + - DeviceSet + parameters: + - in: path + name: deviceSetIndex + type: integer + required: true + description: Index of device set in the device set list + - name: body + in: body + description: Spectrum settings to apply + required: true + schema: + $ref: "http://localhost:8081/api/swagger/include/GLSpectrum.yaml#/GLSpectrum" + responses: + "200": + description: On success returns new settings values + schema: + $ref: "http://localhost:8081/api/swagger/include/GLSpectrum.yaml#/GLSpectrum" + "404": + description: Invalid device set index or device not found + schema: + $ref: "#/definitions/ErrorResponse" + "500": + $ref: "#/responses/Response_500" + "501": + $ref: "#/responses/Response_501" + patch: + description: Apply main spectrun settings differentially (no force) + operationId: devicesetSpectrumSettingsPatch + tags: + - DeviceSet + parameters: + - in: path + name: deviceSetIndex + type: integer + required: true + description: Index of device set in the device set list + - name: body + in: body + description: Spectrum settings to apply + required: true + schema: + $ref: "http://localhost:8081/api/swagger/include/GLSpectrum.yaml#/GLSpectrum" + responses: + "200": + description: On success returns new settings values + schema: + $ref: "http://localhost:8081/api/swagger/include/GLSpectrum.yaml#/GLSpectrum" + "404": + description: Invalid device set index or device not found + schema: + $ref: "#/definitions/ErrorResponse" + "500": + $ref: "#/responses/Response_500" + "501": + $ref: "#/responses/Response_501" + + /sdrangel/deviceset/{deviceSetIndex}/spectrum/server: + x-swagger-router-controller: deviceset + get: + description: Get main spectrum websocket server status + operationId: devicesetSpectrumServerGet + tags: + - DeviceSet + parameters: + - in: path + name: deviceSetIndex + type: integer + required: true + description: Index of device set in the device set list + responses: + "200": + description: On success return main spectrum server status + schema: + $ref: "#/definitions/SpectrumServer" + "404": + description: Invalid index + schema: + $ref: "#/definitions/ErrorResponse" + "500": + $ref: "#/responses/Response_500" + "501": + $ref: "#/responses/Response_501" + + post: + description: Start main spectrum websocket server + operationId: devicesetSpectrumServerPost + tags: + - DeviceSet + parameters: + - in: path + name: deviceSetIndex + type: integer + required: true + description: Index of device set in the device set list + responses: + "200": + description: Server successfully started + schema: + $ref: "#/definitions/SuccessResponse" + "400": + description: Invalid device set index + schema: + $ref: "#/definitions/ErrorResponse" + "404": + description: Device not found + schema: + $ref: "#/definitions/ErrorResponse" + "500": + $ref: "#/responses/Response_500" + "501": + $ref: "#/responses/Response_501" + + delete: + description: Stop main spectrum websocket server + operationId: devicesetSpectrumServerDelete + tags: + - DeviceSet + parameters: + - in: path + name: deviceSetIndex + type: integer + required: true + description: Index of device set in the device set list + responses: + "200": + description: Server successfully stopped + schema: + $ref: "#/definitions/SuccessResponse" + "400": + description: Invalid device set index + schema: + $ref: "#/definitions/ErrorResponse" + "404": + description: Device not found + schema: + $ref: "#/definitions/ErrorResponse" + "500": + $ref: "#/responses/Response_500" + "501": + $ref: "#/responses/Response_501" + /sdrangel/deviceset/{deviceSetIndex}/device: x-swagger-router-controller: deviceset put: @@ -1891,6 +2063,23 @@ definitions: items: $ref: "#/definitions/DeviceSet" + SpectrumServer: + description: "Spectrum server state" + properties: + run: + description: "Boolean: 1: websocket spectrum server running 0: not running" + type: integer + clients: + description: "List of clients" + type: array + items: + type: object + properties: + address: + type: string + port: + type: integer + DeviceState: description: "Device running state" properties: