From de995b1dd835fdaab4c7dba4399c0c45e64c7abd 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 | 188 ++++++++++++++++++ .../api/swagger/include/GLSpectrum.yaml | 3 - swagger/sdrangel/api/swagger/swagger.yaml | 188 ++++++++++++++++++ 4 files changed, 376 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 f2e7bfa43..ba754bfbc 100644 --- a/sdrbase/resources/webapi/doc/swagger/swagger.yaml +++ b/sdrbase/resources/webapi/doc/swagger/swagger.yaml @@ -999,6 +999,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: @@ -2355,6 +2527,22 @@ definitions: type: array items: $ref: "#/definitions/FeatureSet" + 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" 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 510a1ee0e..0faa601d6 100644 --- a/swagger/sdrangel/api/swagger/swagger.yaml +++ b/swagger/sdrangel/api/swagger/swagger.yaml @@ -999,6 +999,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: @@ -2355,6 +2527,22 @@ definitions: type: array items: $ref: "#/definitions/FeatureSet" + 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"