From 3b69d6517b67e505c5b132cdb3626b91f052817b Mon Sep 17 00:00:00 2001 From: f4exb Date: Wed, 6 Dec 2017 23:49:14 +0100 Subject: [PATCH] Web API: Added settings getter for RTLSDR. Added more device URLs --- .../samplesource/filesource/filesourceinput.h | 2 +- plugins/samplesource/rtlsdr/CMakeLists.txt | 6 + plugins/samplesource/rtlsdr/rtlsdrinput.cpp | 27 +- plugins/samplesource/rtlsdr/rtlsdrinput.h | 4 + sdrbase/resources/index.html | 2389 ++++++++++++++--- sdrbase/webapi/webapiadapterinterface.cpp | 1 + sdrbase/webapi/webapiadapterinterface.h | 42 + swagger/sdrangel/api/swagger/swagger.yaml | 131 +- swagger/sdrangel/code/html2/index.html | 2389 ++++++++++++++--- .../code/qt5/client/SWGDeviceSetApi.cpp | 304 ++- .../code/qt5/client/SWGDeviceSetApi.h | 25 +- .../code/qt5/client/SWGDeviceState.cpp | 95 + .../sdrangel/code/qt5/client/SWGDeviceState.h | 55 + .../code/qt5/client/SWGModelFactory.h | 4 + 14 files changed, 4728 insertions(+), 746 deletions(-) create mode 100644 swagger/sdrangel/code/qt5/client/SWGDeviceState.cpp create mode 100644 swagger/sdrangel/code/qt5/client/SWGDeviceState.h diff --git a/plugins/samplesource/filesource/filesourceinput.h b/plugins/samplesource/filesource/filesourceinput.h index 8017d0bbe..20662e585 100644 --- a/plugins/samplesource/filesource/filesourceinput.h +++ b/plugins/samplesource/filesource/filesourceinput.h @@ -225,7 +225,7 @@ public: virtual bool handleMessage(const Message& message); virtual int webapiSettingsGet( - SWGSDRangel::SWGDeviceSettings& response __attribute__((unused)), + SWGSDRangel::SWGDeviceSettings& response, QString& errorMessage); private: diff --git a/plugins/samplesource/rtlsdr/CMakeLists.txt b/plugins/samplesource/rtlsdr/CMakeLists.txt index 2dc991b57..5ce6daa93 100644 --- a/plugins/samplesource/rtlsdr/CMakeLists.txt +++ b/plugins/samplesource/rtlsdr/CMakeLists.txt @@ -1,5 +1,7 @@ project(rtlsdr) +set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11") + set(rtlsdr_SOURCES rtlsdrgui.cpp rtlsdrinput.cpp @@ -24,6 +26,7 @@ if (BUILD_DEBIAN) include_directories( . ${CMAKE_CURRENT_BINARY_DIR} + ${CMAKE_SOURCE_DIR}/swagger/sdrangel/code/qt5/client ${LIBRTLSDRSRC}/include ${LIBRTLSDRSRC}/src ) @@ -31,6 +34,7 @@ else (BUILD_DEBIAN) include_directories( . ${CMAKE_CURRENT_BINARY_DIR} + ${CMAKE_SOURCE_DIR}/swagger/sdrangel/code/qt5/client ${LIBRTLSDR_INCLUDE_DIR} ) endif (BUILD_DEBIAN) @@ -55,6 +59,7 @@ target_link_libraries(inputrtlsdr rtlsdr sdrbase sdrgui + swagger ) else (BUILD_DEBIAN) target_link_libraries(inputrtlsdr @@ -62,6 +67,7 @@ target_link_libraries(inputrtlsdr ${LIBRTLSDR_LIBRARIES} sdrbase sdrgui + swagger ) endif (BUILD_DEBIAN) diff --git a/plugins/samplesource/rtlsdr/rtlsdrinput.cpp b/plugins/samplesource/rtlsdr/rtlsdrinput.cpp index ccc0f2bf6..b100c1aab 100644 --- a/plugins/samplesource/rtlsdr/rtlsdrinput.cpp +++ b/plugins/samplesource/rtlsdr/rtlsdrinput.cpp @@ -18,10 +18,12 @@ #include #include #include + +#include "SWGDeviceSettings.h" +#include "SWGRtlSdrSettings.h" + #include "rtlsdrinput.h" - #include "device/devicesourceapi.h" - #include "rtlsdrthread.h" #include "rtlsdrgui.h" #include "dsp/dspcommands.h" @@ -465,3 +467,24 @@ void RTLSDRInput::set_ds_mode(int on) rtlsdr_set_direct_sampling(m_dev, on); } +int RTLSDRInput::webapiSettingsGet( + SWGSDRangel::SWGDeviceSettings& response, + QString& errorMessage __attribute__((unused))) +{ + response.setRtlSdrSettings(new SWGSDRangel::SWGRtlSdrSettings()); + response.getRtlSdrSettings()->setAgc(m_settings.m_agc ? 1 : 0); + response.getRtlSdrSettings()->setCenterFrequency(m_settings.m_centerFrequency); + response.getRtlSdrSettings()->setDcBlock(m_settings.m_dcBlock ? 1 : 0); + response.getRtlSdrSettings()->setDevSampleRate(m_settings.m_devSampleRate); + response.getRtlSdrSettings()->setFcPos((int) m_settings.m_fcPos); + response.getRtlSdrSettings()->setGain(m_settings.m_gain); + response.getRtlSdrSettings()->setIqImbalance(m_settings.m_iqImbalance ? 1 : 0); + response.getRtlSdrSettings()->setLoPpmCorrection(m_settings.m_loPpmCorrection); + response.getRtlSdrSettings()->setLog2Decim(m_settings.m_log2Decim); + response.getRtlSdrSettings()->setLowSampleRate(m_settings.m_lowSampleRate ? 1 : 0); + response.getRtlSdrSettings()->setNoModMode(m_settings.m_noModMode ? 1 : 0); + response.getRtlSdrSettings()->setTransverterDeltaFrequency(m_settings.m_transverterDeltaFrequency); + response.getRtlSdrSettings()->setTransverterMode(m_settings.m_transverterMode ? 1 : 0); + return 200; +} + diff --git a/plugins/samplesource/rtlsdr/rtlsdrinput.h b/plugins/samplesource/rtlsdr/rtlsdrinput.h index 21f866063..9ef7b3194 100644 --- a/plugins/samplesource/rtlsdr/rtlsdrinput.h +++ b/plugins/samplesource/rtlsdr/rtlsdrinput.h @@ -106,6 +106,10 @@ public: virtual bool handleMessage(const Message& message); virtual void setMessageQueueToGUI(MessageQueue *queue); + virtual int webapiSettingsGet( + SWGSDRangel::SWGDeviceSettings& response, + QString& errorMessage); + const std::vector& getGains() const { return m_gains; } void set_ds_mode(int on); diff --git a/sdrbase/resources/index.html b/sdrbase/resources/index.html index 6f6f7db73..bbc6a5c29 100644 --- a/sdrbase/resources/index.html +++ b/sdrbase/resources/index.html @@ -951,6 +951,16 @@ margin-bottom: 20px; } }, "description" : "Base device settings" +}; + defs.DeviceState = { + "required" : [ "state" ], + "properties" : { + "state" : { + "type" : "string", + "description" : "State: notStarted, idle, ready, running, error" + } + }, + "description" : "Device running state" }; defs.ErrorResponse = { "required" : [ "message" ], @@ -1358,12 +1368,24 @@ margin-bottom: 20px; -
  • - devicesetDeviceGet -
  • devicesetDevicePut
  • +
  • + devicesetDeviceRunDelete +
  • +
  • + devicesetDeviceRunPost +
  • +
  • + devicesetDeviceSettingsGet +
  • +
  • + devicesetDeviceSettingsPatch +
  • +
  • + devicesetDeviceSettingsPut +
  • devicesetGet
  • @@ -1443,346 +1465,6 @@ margin-bottom: 20px;

    DeviceSet

    -
    -
    -
    -

    devicesetDeviceGet

    -

    -
    -
    -
    -

    -

    Get device settings

    -

    -
    -
    /sdrangel/deviceset/{deviceSetIndex}/device/settings
    -

    -

    Usage and SDK Samples

    -

    - - -
    -
    -
    curl -X GET "http://localhost:8091/sdrangel/deviceset/{deviceSetIndex}/device/settings"
    -
    -
    -
    import SWGSDRangel.*;
    -import SWGSDRangel.auth.*;
    -import SWGSDRangel.model.*;
    -import SWGSDRangel.api.DeviceSetApi;
    -
    -import java.io.File;
    -import java.util.*;
    -
    -public class DeviceSetApiExample {
    -
    -    public static void main(String[] args) {
    -        
    -        DeviceSetApi apiInstance = new DeviceSetApi();
    -        Integer deviceSetIndex = 56; // Integer | Index of device set in the device set list
    -        try {
    -            DeviceSettings result = apiInstance.devicesetDeviceGet(deviceSetIndex);
    -            System.out.println(result);
    -        } catch (ApiException e) {
    -            System.err.println("Exception when calling DeviceSetApi#devicesetDeviceGet");
    -            e.printStackTrace();
    -        }
    -    }
    -}
    -
    - -
    -
    import SWGSDRangel.api.DeviceSetApi;
    -
    -public class DeviceSetApiExample {
    -
    -    public static void main(String[] args) {
    -        DeviceSetApi apiInstance = new DeviceSetApi();
    -        Integer deviceSetIndex = 56; // Integer | Index of device set in the device set list
    -        try {
    -            DeviceSettings result = apiInstance.devicesetDeviceGet(deviceSetIndex);
    -            System.out.println(result);
    -        } catch (ApiException e) {
    -            System.err.println("Exception when calling DeviceSetApi#devicesetDeviceGet");
    -            e.printStackTrace();
    -        }
    -    }
    -}
    -
    - -
    -
    Integer *deviceSetIndex = 56; // Index of device set in the device set list
    -
    -DeviceSetApi *apiInstance = [[DeviceSetApi alloc] init];
    -
    -[apiInstance devicesetDeviceGetWith:deviceSetIndex
    -              completionHandler: ^(DeviceSettings output, NSError* error) {
    -                            if (output) {
    -                                NSLog(@"%@", output);
    -                            }
    -                            if (error) {
    -                                NSLog(@"Error: %@", error);
    -                            }
    -                        }];
    -
    -
    - -
    -
    var SdRangel = require('sd_rangel');
    -
    -var api = new SdRangel.DeviceSetApi()
    -
    -var deviceSetIndex = 56; // {Integer} Index of device set in the device set list
    -
    -
    -var callback = function(error, data, response) {
    -  if (error) {
    -    console.error(error);
    -  } else {
    -    console.log('API called successfully. Returned data: ' + data);
    -  }
    -};
    -api.devicesetDeviceGet(deviceSetIndex, callback);
    -
    -
    - - -
    -
    using System;
    -using System.Diagnostics;
    -using SWGSDRangel.Api;
    -using SWGSDRangel.Client;
    -using SWGSDRangel.Model;
    -
    -namespace Example
    -{
    -    public class devicesetDeviceGetExample
    -    {
    -        public void main()
    -        {
    -            
    -            var apiInstance = new DeviceSetApi();
    -            var deviceSetIndex = 56;  // Integer | Index of device set in the device set list
    -
    -            try
    -            {
    -                DeviceSettings result = apiInstance.devicesetDeviceGet(deviceSetIndex);
    -                Debug.WriteLine(result);
    -            }
    -            catch (Exception e)
    -            {
    -                Debug.Print("Exception when calling DeviceSetApi.devicesetDeviceGet: " + e.Message );
    -            }
    -        }
    -    }
    -}
    -
    -
    - -
    -
    <?php
    -require_once(__DIR__ . '/vendor/autoload.php');
    -
    -$api_instance = new Swagger\Client\Api\DeviceSetApi();
    -$deviceSetIndex = 56; // Integer | Index of device set in the device set list
    -
    -try {
    -    $result = $api_instance->devicesetDeviceGet($deviceSetIndex);
    -    print_r($result);
    -} catch (Exception $e) {
    -    echo 'Exception when calling DeviceSetApi->devicesetDeviceGet: ', $e->getMessage(), PHP_EOL;
    -}
    -?>
    -
    - -
    -
    use Data::Dumper;
    -use SWGSDRangel::Configuration;
    -use SWGSDRangel::DeviceSetApi;
    -
    -my $api_instance = SWGSDRangel::DeviceSetApi->new();
    -my $deviceSetIndex = 56; # Integer | Index of device set in the device set list
    -
    -eval { 
    -    my $result = $api_instance->devicesetDeviceGet(deviceSetIndex => $deviceSetIndex);
    -    print Dumper($result);
    -};
    -if ($@) {
    -    warn "Exception when calling DeviceSetApi->devicesetDeviceGet: $@\n";
    -}
    -
    - -
    -
    from __future__ import print_statement
    -import time
    -import swagger_sdrangel
    -from swagger_sdrangel.rest import ApiException
    -from pprint import pprint
    -
    -# create an instance of the API class
    -api_instance = swagger_sdrangel.DeviceSetApi()
    -deviceSetIndex = 56 # Integer | Index of device set in the device set list
    -
    -try: 
    -    api_response = api_instance.deviceset_device_get(deviceSetIndex)
    -    pprint(api_response)
    -except ApiException as e:
    -    print("Exception when calling DeviceSetApi->devicesetDeviceGet: %s\n" % e)
    -
    -
    - -

    Parameters

    - -
    Path parameters
    - - - - - - - - - -
    NameDescription
    deviceSetIndex* - - -
    -
    -
    - - Integer - - -
    - Index of device set in the device set list -
    -
    -
    - Required -
    -
    -
    -
    - - - - - -

    Responses

    -

    Status: 200 - On success returns current settings values

    - - - -
    -
    -
    - -
    - -
    -
    - -

    Status: 500 - Error

    - - - -
    -
    -
    - -
    - -
    -
    - -

    Status: 501 - Function not implemented

    - - - -
    -
    - -
    -
    -
    @@ -2261,6 +1943,2025 @@ $(document).ready(function() {

    +
    +
    +
    +

    devicesetDeviceRunDelete

    +

    +
    +
    +
    +

    +

    stop device

    +

    +
    +
    /sdrangel/deviceset/{deviceSetIndex}/device/run
    +

    +

    Usage and SDK Samples

    +

    + + +
    +
    +
    curl -X DELETE "http://localhost:8091/sdrangel/deviceset/{deviceSetIndex}/device/run"
    +
    +
    +
    import SWGSDRangel.*;
    +import SWGSDRangel.auth.*;
    +import SWGSDRangel.model.*;
    +import SWGSDRangel.api.DeviceSetApi;
    +
    +import java.io.File;
    +import java.util.*;
    +
    +public class DeviceSetApiExample {
    +
    +    public static void main(String[] args) {
    +        
    +        DeviceSetApi apiInstance = new DeviceSetApi();
    +        Integer deviceSetIndex = 56; // Integer | Index of device set in the device set list
    +        try {
    +            DeviceState result = apiInstance.devicesetDeviceRunDelete(deviceSetIndex);
    +            System.out.println(result);
    +        } catch (ApiException e) {
    +            System.err.println("Exception when calling DeviceSetApi#devicesetDeviceRunDelete");
    +            e.printStackTrace();
    +        }
    +    }
    +}
    +
    + +
    +
    import SWGSDRangel.api.DeviceSetApi;
    +
    +public class DeviceSetApiExample {
    +
    +    public static void main(String[] args) {
    +        DeviceSetApi apiInstance = new DeviceSetApi();
    +        Integer deviceSetIndex = 56; // Integer | Index of device set in the device set list
    +        try {
    +            DeviceState result = apiInstance.devicesetDeviceRunDelete(deviceSetIndex);
    +            System.out.println(result);
    +        } catch (ApiException e) {
    +            System.err.println("Exception when calling DeviceSetApi#devicesetDeviceRunDelete");
    +            e.printStackTrace();
    +        }
    +    }
    +}
    +
    + +
    +
    Integer *deviceSetIndex = 56; // Index of device set in the device set list
    +
    +DeviceSetApi *apiInstance = [[DeviceSetApi alloc] init];
    +
    +[apiInstance devicesetDeviceRunDeleteWith:deviceSetIndex
    +              completionHandler: ^(DeviceState output, NSError* error) {
    +                            if (output) {
    +                                NSLog(@"%@", output);
    +                            }
    +                            if (error) {
    +                                NSLog(@"Error: %@", error);
    +                            }
    +                        }];
    +
    +
    + +
    +
    var SdRangel = require('sd_rangel');
    +
    +var api = new SdRangel.DeviceSetApi()
    +
    +var deviceSetIndex = 56; // {Integer} Index of device set in the device set list
    +
    +
    +var callback = function(error, data, response) {
    +  if (error) {
    +    console.error(error);
    +  } else {
    +    console.log('API called successfully. Returned data: ' + data);
    +  }
    +};
    +api.devicesetDeviceRunDelete(deviceSetIndex, callback);
    +
    +
    + + +
    +
    using System;
    +using System.Diagnostics;
    +using SWGSDRangel.Api;
    +using SWGSDRangel.Client;
    +using SWGSDRangel.Model;
    +
    +namespace Example
    +{
    +    public class devicesetDeviceRunDeleteExample
    +    {
    +        public void main()
    +        {
    +            
    +            var apiInstance = new DeviceSetApi();
    +            var deviceSetIndex = 56;  // Integer | Index of device set in the device set list
    +
    +            try
    +            {
    +                DeviceState result = apiInstance.devicesetDeviceRunDelete(deviceSetIndex);
    +                Debug.WriteLine(result);
    +            }
    +            catch (Exception e)
    +            {
    +                Debug.Print("Exception when calling DeviceSetApi.devicesetDeviceRunDelete: " + e.Message );
    +            }
    +        }
    +    }
    +}
    +
    +
    + +
    +
    <?php
    +require_once(__DIR__ . '/vendor/autoload.php');
    +
    +$api_instance = new Swagger\Client\Api\DeviceSetApi();
    +$deviceSetIndex = 56; // Integer | Index of device set in the device set list
    +
    +try {
    +    $result = $api_instance->devicesetDeviceRunDelete($deviceSetIndex);
    +    print_r($result);
    +} catch (Exception $e) {
    +    echo 'Exception when calling DeviceSetApi->devicesetDeviceRunDelete: ', $e->getMessage(), PHP_EOL;
    +}
    +?>
    +
    + +
    +
    use Data::Dumper;
    +use SWGSDRangel::Configuration;
    +use SWGSDRangel::DeviceSetApi;
    +
    +my $api_instance = SWGSDRangel::DeviceSetApi->new();
    +my $deviceSetIndex = 56; # Integer | Index of device set in the device set list
    +
    +eval { 
    +    my $result = $api_instance->devicesetDeviceRunDelete(deviceSetIndex => $deviceSetIndex);
    +    print Dumper($result);
    +};
    +if ($@) {
    +    warn "Exception when calling DeviceSetApi->devicesetDeviceRunDelete: $@\n";
    +}
    +
    + +
    +
    from __future__ import print_statement
    +import time
    +import swagger_sdrangel
    +from swagger_sdrangel.rest import ApiException
    +from pprint import pprint
    +
    +# create an instance of the API class
    +api_instance = swagger_sdrangel.DeviceSetApi()
    +deviceSetIndex = 56 # Integer | Index of device set in the device set list
    +
    +try: 
    +    api_response = api_instance.deviceset_device_run_delete(deviceSetIndex)
    +    pprint(api_response)
    +except ApiException as e:
    +    print("Exception when calling DeviceSetApi->devicesetDeviceRunDelete: %s\n" % e)
    +
    +
    + +

    Parameters

    + +
    Path parameters
    + + + + + + + + + +
    NameDescription
    deviceSetIndex* + + +
    +
    +
    + + Integer + + +
    + Index of device set in the device set list +
    +
    +
    + Required +
    +
    +
    +
    + + + + + +

    Responses

    +

    Status: 200 - On success return current state

    + + + +
    +
    +
    + +
    + +
    +
    + +

    Status: 404 - Invalid device set index or device not found

    + + + +
    +
    +
    + +
    + +
    +
    + +

    Status: 500 - Error

    + + + +
    +
    +
    + +
    + +
    +
    + +

    Status: 501 - Function not implemented

    + + + +
    +
    + +
    +
    +
    +
    +
    +
    +

    devicesetDeviceRunPost

    +

    +
    +
    +
    +

    +

    start device

    +

    +
    +
    /sdrangel/deviceset/{deviceSetIndex}/device/run
    +

    +

    Usage and SDK Samples

    +

    + + +
    +
    +
    curl -X POST "http://localhost:8091/sdrangel/deviceset/{deviceSetIndex}/device/run"
    +
    +
    +
    import SWGSDRangel.*;
    +import SWGSDRangel.auth.*;
    +import SWGSDRangel.model.*;
    +import SWGSDRangel.api.DeviceSetApi;
    +
    +import java.io.File;
    +import java.util.*;
    +
    +public class DeviceSetApiExample {
    +
    +    public static void main(String[] args) {
    +        
    +        DeviceSetApi apiInstance = new DeviceSetApi();
    +        Integer deviceSetIndex = 56; // Integer | Index of device set in the device set list
    +        try {
    +            DeviceState result = apiInstance.devicesetDeviceRunPost(deviceSetIndex);
    +            System.out.println(result);
    +        } catch (ApiException e) {
    +            System.err.println("Exception when calling DeviceSetApi#devicesetDeviceRunPost");
    +            e.printStackTrace();
    +        }
    +    }
    +}
    +
    + +
    +
    import SWGSDRangel.api.DeviceSetApi;
    +
    +public class DeviceSetApiExample {
    +
    +    public static void main(String[] args) {
    +        DeviceSetApi apiInstance = new DeviceSetApi();
    +        Integer deviceSetIndex = 56; // Integer | Index of device set in the device set list
    +        try {
    +            DeviceState result = apiInstance.devicesetDeviceRunPost(deviceSetIndex);
    +            System.out.println(result);
    +        } catch (ApiException e) {
    +            System.err.println("Exception when calling DeviceSetApi#devicesetDeviceRunPost");
    +            e.printStackTrace();
    +        }
    +    }
    +}
    +
    + +
    +
    Integer *deviceSetIndex = 56; // Index of device set in the device set list
    +
    +DeviceSetApi *apiInstance = [[DeviceSetApi alloc] init];
    +
    +[apiInstance devicesetDeviceRunPostWith:deviceSetIndex
    +              completionHandler: ^(DeviceState output, NSError* error) {
    +                            if (output) {
    +                                NSLog(@"%@", output);
    +                            }
    +                            if (error) {
    +                                NSLog(@"Error: %@", error);
    +                            }
    +                        }];
    +
    +
    + +
    +
    var SdRangel = require('sd_rangel');
    +
    +var api = new SdRangel.DeviceSetApi()
    +
    +var deviceSetIndex = 56; // {Integer} Index of device set in the device set list
    +
    +
    +var callback = function(error, data, response) {
    +  if (error) {
    +    console.error(error);
    +  } else {
    +    console.log('API called successfully. Returned data: ' + data);
    +  }
    +};
    +api.devicesetDeviceRunPost(deviceSetIndex, callback);
    +
    +
    + + +
    +
    using System;
    +using System.Diagnostics;
    +using SWGSDRangel.Api;
    +using SWGSDRangel.Client;
    +using SWGSDRangel.Model;
    +
    +namespace Example
    +{
    +    public class devicesetDeviceRunPostExample
    +    {
    +        public void main()
    +        {
    +            
    +            var apiInstance = new DeviceSetApi();
    +            var deviceSetIndex = 56;  // Integer | Index of device set in the device set list
    +
    +            try
    +            {
    +                DeviceState result = apiInstance.devicesetDeviceRunPost(deviceSetIndex);
    +                Debug.WriteLine(result);
    +            }
    +            catch (Exception e)
    +            {
    +                Debug.Print("Exception when calling DeviceSetApi.devicesetDeviceRunPost: " + e.Message );
    +            }
    +        }
    +    }
    +}
    +
    +
    + +
    +
    <?php
    +require_once(__DIR__ . '/vendor/autoload.php');
    +
    +$api_instance = new Swagger\Client\Api\DeviceSetApi();
    +$deviceSetIndex = 56; // Integer | Index of device set in the device set list
    +
    +try {
    +    $result = $api_instance->devicesetDeviceRunPost($deviceSetIndex);
    +    print_r($result);
    +} catch (Exception $e) {
    +    echo 'Exception when calling DeviceSetApi->devicesetDeviceRunPost: ', $e->getMessage(), PHP_EOL;
    +}
    +?>
    +
    + +
    +
    use Data::Dumper;
    +use SWGSDRangel::Configuration;
    +use SWGSDRangel::DeviceSetApi;
    +
    +my $api_instance = SWGSDRangel::DeviceSetApi->new();
    +my $deviceSetIndex = 56; # Integer | Index of device set in the device set list
    +
    +eval { 
    +    my $result = $api_instance->devicesetDeviceRunPost(deviceSetIndex => $deviceSetIndex);
    +    print Dumper($result);
    +};
    +if ($@) {
    +    warn "Exception when calling DeviceSetApi->devicesetDeviceRunPost: $@\n";
    +}
    +
    + +
    +
    from __future__ import print_statement
    +import time
    +import swagger_sdrangel
    +from swagger_sdrangel.rest import ApiException
    +from pprint import pprint
    +
    +# create an instance of the API class
    +api_instance = swagger_sdrangel.DeviceSetApi()
    +deviceSetIndex = 56 # Integer | Index of device set in the device set list
    +
    +try: 
    +    api_response = api_instance.deviceset_device_run_post(deviceSetIndex)
    +    pprint(api_response)
    +except ApiException as e:
    +    print("Exception when calling DeviceSetApi->devicesetDeviceRunPost: %s\n" % e)
    +
    +
    + +

    Parameters

    + +
    Path parameters
    + + + + + + + + + +
    NameDescription
    deviceSetIndex* + + +
    +
    +
    + + Integer + + +
    + Index of device set in the device set list +
    +
    +
    + Required +
    +
    +
    +
    + + + + + +

    Responses

    +

    Status: 200 - On success return current state

    + + + +
    +
    +
    + +
    + +
    +
    + +

    Status: 404 - Invalid device set index or device not found

    + + + +
    +
    +
    + +
    + +
    +
    + +

    Status: 500 - Error

    + + + +
    +
    +
    + +
    + +
    +
    + +

    Status: 501 - Function not implemented

    + + + +
    +
    + +
    +
    +
    +
    +
    +
    +

    devicesetDeviceSettingsGet

    +

    +
    +
    +
    +

    +

    Get device settings

    +

    +
    +
    /sdrangel/deviceset/{deviceSetIndex}/device/settings
    +

    +

    Usage and SDK Samples

    +

    + + +
    +
    +
    curl -X GET "http://localhost:8091/sdrangel/deviceset/{deviceSetIndex}/device/settings"
    +
    +
    +
    import SWGSDRangel.*;
    +import SWGSDRangel.auth.*;
    +import SWGSDRangel.model.*;
    +import SWGSDRangel.api.DeviceSetApi;
    +
    +import java.io.File;
    +import java.util.*;
    +
    +public class DeviceSetApiExample {
    +
    +    public static void main(String[] args) {
    +        
    +        DeviceSetApi apiInstance = new DeviceSetApi();
    +        Integer deviceSetIndex = 56; // Integer | Index of device set in the device set list
    +        try {
    +            DeviceSettings result = apiInstance.devicesetDeviceSettingsGet(deviceSetIndex);
    +            System.out.println(result);
    +        } catch (ApiException e) {
    +            System.err.println("Exception when calling DeviceSetApi#devicesetDeviceSettingsGet");
    +            e.printStackTrace();
    +        }
    +    }
    +}
    +
    + +
    +
    import SWGSDRangel.api.DeviceSetApi;
    +
    +public class DeviceSetApiExample {
    +
    +    public static void main(String[] args) {
    +        DeviceSetApi apiInstance = new DeviceSetApi();
    +        Integer deviceSetIndex = 56; // Integer | Index of device set in the device set list
    +        try {
    +            DeviceSettings result = apiInstance.devicesetDeviceSettingsGet(deviceSetIndex);
    +            System.out.println(result);
    +        } catch (ApiException e) {
    +            System.err.println("Exception when calling DeviceSetApi#devicesetDeviceSettingsGet");
    +            e.printStackTrace();
    +        }
    +    }
    +}
    +
    + +
    +
    Integer *deviceSetIndex = 56; // Index of device set in the device set list
    +
    +DeviceSetApi *apiInstance = [[DeviceSetApi alloc] init];
    +
    +[apiInstance devicesetDeviceSettingsGetWith:deviceSetIndex
    +              completionHandler: ^(DeviceSettings output, NSError* error) {
    +                            if (output) {
    +                                NSLog(@"%@", output);
    +                            }
    +                            if (error) {
    +                                NSLog(@"Error: %@", error);
    +                            }
    +                        }];
    +
    +
    + +
    +
    var SdRangel = require('sd_rangel');
    +
    +var api = new SdRangel.DeviceSetApi()
    +
    +var deviceSetIndex = 56; // {Integer} Index of device set in the device set list
    +
    +
    +var callback = function(error, data, response) {
    +  if (error) {
    +    console.error(error);
    +  } else {
    +    console.log('API called successfully. Returned data: ' + data);
    +  }
    +};
    +api.devicesetDeviceSettingsGet(deviceSetIndex, callback);
    +
    +
    + + +
    +
    using System;
    +using System.Diagnostics;
    +using SWGSDRangel.Api;
    +using SWGSDRangel.Client;
    +using SWGSDRangel.Model;
    +
    +namespace Example
    +{
    +    public class devicesetDeviceSettingsGetExample
    +    {
    +        public void main()
    +        {
    +            
    +            var apiInstance = new DeviceSetApi();
    +            var deviceSetIndex = 56;  // Integer | Index of device set in the device set list
    +
    +            try
    +            {
    +                DeviceSettings result = apiInstance.devicesetDeviceSettingsGet(deviceSetIndex);
    +                Debug.WriteLine(result);
    +            }
    +            catch (Exception e)
    +            {
    +                Debug.Print("Exception when calling DeviceSetApi.devicesetDeviceSettingsGet: " + e.Message );
    +            }
    +        }
    +    }
    +}
    +
    +
    + +
    +
    <?php
    +require_once(__DIR__ . '/vendor/autoload.php');
    +
    +$api_instance = new Swagger\Client\Api\DeviceSetApi();
    +$deviceSetIndex = 56; // Integer | Index of device set in the device set list
    +
    +try {
    +    $result = $api_instance->devicesetDeviceSettingsGet($deviceSetIndex);
    +    print_r($result);
    +} catch (Exception $e) {
    +    echo 'Exception when calling DeviceSetApi->devicesetDeviceSettingsGet: ', $e->getMessage(), PHP_EOL;
    +}
    +?>
    +
    + +
    +
    use Data::Dumper;
    +use SWGSDRangel::Configuration;
    +use SWGSDRangel::DeviceSetApi;
    +
    +my $api_instance = SWGSDRangel::DeviceSetApi->new();
    +my $deviceSetIndex = 56; # Integer | Index of device set in the device set list
    +
    +eval { 
    +    my $result = $api_instance->devicesetDeviceSettingsGet(deviceSetIndex => $deviceSetIndex);
    +    print Dumper($result);
    +};
    +if ($@) {
    +    warn "Exception when calling DeviceSetApi->devicesetDeviceSettingsGet: $@\n";
    +}
    +
    + +
    +
    from __future__ import print_statement
    +import time
    +import swagger_sdrangel
    +from swagger_sdrangel.rest import ApiException
    +from pprint import pprint
    +
    +# create an instance of the API class
    +api_instance = swagger_sdrangel.DeviceSetApi()
    +deviceSetIndex = 56 # Integer | Index of device set in the device set list
    +
    +try: 
    +    api_response = api_instance.deviceset_device_settings_get(deviceSetIndex)
    +    pprint(api_response)
    +except ApiException as e:
    +    print("Exception when calling DeviceSetApi->devicesetDeviceSettingsGet: %s\n" % e)
    +
    +
    + +

    Parameters

    + +
    Path parameters
    + + + + + + + + + +
    NameDescription
    deviceSetIndex* + + +
    +
    +
    + + Integer + + +
    + Index of device set in the device set list +
    +
    +
    + Required +
    +
    +
    +
    + + + + + +

    Responses

    +

    Status: 200 - On success returns current settings values

    + + + +
    +
    +
    + +
    + +
    +
    + +

    Status: 404 - Invalid device set index or device not found

    + + + +
    +
    +
    + +
    + +
    +
    + +

    Status: 500 - Error

    + + + +
    +
    +
    + +
    + +
    +
    + +

    Status: 501 - Function not implemented

    + + + +
    +
    + +
    +
    +
    +
    +
    +
    +

    devicesetDeviceSettingsPatch

    +

    +
    +
    +
    +

    +

    Apply settings differentially (no force)

    +

    +
    +
    /sdrangel/deviceset/{deviceSetIndex}/device/settings
    +

    +

    Usage and SDK Samples

    +

    + + +
    +
    +
    curl -X PATCH "http://localhost:8091/sdrangel/deviceset/{deviceSetIndex}/device/settings"
    +
    +
    +
    import SWGSDRangel.*;
    +import SWGSDRangel.auth.*;
    +import SWGSDRangel.model.*;
    +import SWGSDRangel.api.DeviceSetApi;
    +
    +import java.io.File;
    +import java.util.*;
    +
    +public class DeviceSetApiExample {
    +
    +    public static void main(String[] args) {
    +        
    +        DeviceSetApi apiInstance = new DeviceSetApi();
    +        Integer deviceSetIndex = 56; // Integer | Index of device set in the device set list
    +        DeviceSettings body = ; // DeviceSettings | Device settings to apply
    +        try {
    +            DeviceSettings result = apiInstance.devicesetDeviceSettingsPatch(deviceSetIndex, body);
    +            System.out.println(result);
    +        } catch (ApiException e) {
    +            System.err.println("Exception when calling DeviceSetApi#devicesetDeviceSettingsPatch");
    +            e.printStackTrace();
    +        }
    +    }
    +}
    +
    + +
    +
    import SWGSDRangel.api.DeviceSetApi;
    +
    +public class DeviceSetApiExample {
    +
    +    public static void main(String[] args) {
    +        DeviceSetApi apiInstance = new DeviceSetApi();
    +        Integer deviceSetIndex = 56; // Integer | Index of device set in the device set list
    +        DeviceSettings body = ; // DeviceSettings | Device settings to apply
    +        try {
    +            DeviceSettings result = apiInstance.devicesetDeviceSettingsPatch(deviceSetIndex, body);
    +            System.out.println(result);
    +        } catch (ApiException e) {
    +            System.err.println("Exception when calling DeviceSetApi#devicesetDeviceSettingsPatch");
    +            e.printStackTrace();
    +        }
    +    }
    +}
    +
    + +
    +
    Integer *deviceSetIndex = 56; // Index of device set in the device set list
    +DeviceSettings *body = ; // Device settings to apply
    +
    +DeviceSetApi *apiInstance = [[DeviceSetApi alloc] init];
    +
    +[apiInstance devicesetDeviceSettingsPatchWith:deviceSetIndex
    +    body:body
    +              completionHandler: ^(DeviceSettings output, NSError* error) {
    +                            if (output) {
    +                                NSLog(@"%@", output);
    +                            }
    +                            if (error) {
    +                                NSLog(@"Error: %@", error);
    +                            }
    +                        }];
    +
    +
    + +
    +
    var SdRangel = require('sd_rangel');
    +
    +var api = new SdRangel.DeviceSetApi()
    +
    +var deviceSetIndex = 56; // {Integer} Index of device set in the device set list
    +
    +var body = ; // {DeviceSettings} Device settings to apply
    +
    +
    +var callback = function(error, data, response) {
    +  if (error) {
    +    console.error(error);
    +  } else {
    +    console.log('API called successfully. Returned data: ' + data);
    +  }
    +};
    +api.devicesetDeviceSettingsPatch(deviceSetIndex, body, callback);
    +
    +
    + + +
    +
    using System;
    +using System.Diagnostics;
    +using SWGSDRangel.Api;
    +using SWGSDRangel.Client;
    +using SWGSDRangel.Model;
    +
    +namespace Example
    +{
    +    public class devicesetDeviceSettingsPatchExample
    +    {
    +        public void main()
    +        {
    +            
    +            var apiInstance = new DeviceSetApi();
    +            var deviceSetIndex = 56;  // Integer | Index of device set in the device set list
    +            var body = new DeviceSettings(); // DeviceSettings | Device settings to apply
    +
    +            try
    +            {
    +                DeviceSettings result = apiInstance.devicesetDeviceSettingsPatch(deviceSetIndex, body);
    +                Debug.WriteLine(result);
    +            }
    +            catch (Exception e)
    +            {
    +                Debug.Print("Exception when calling DeviceSetApi.devicesetDeviceSettingsPatch: " + e.Message );
    +            }
    +        }
    +    }
    +}
    +
    +
    + +
    +
    <?php
    +require_once(__DIR__ . '/vendor/autoload.php');
    +
    +$api_instance = new Swagger\Client\Api\DeviceSetApi();
    +$deviceSetIndex = 56; // Integer | Index of device set in the device set list
    +$body = ; // DeviceSettings | Device settings to apply
    +
    +try {
    +    $result = $api_instance->devicesetDeviceSettingsPatch($deviceSetIndex, $body);
    +    print_r($result);
    +} catch (Exception $e) {
    +    echo 'Exception when calling DeviceSetApi->devicesetDeviceSettingsPatch: ', $e->getMessage(), PHP_EOL;
    +}
    +?>
    +
    + +
    +
    use Data::Dumper;
    +use SWGSDRangel::Configuration;
    +use SWGSDRangel::DeviceSetApi;
    +
    +my $api_instance = SWGSDRangel::DeviceSetApi->new();
    +my $deviceSetIndex = 56; # Integer | Index of device set in the device set list
    +my $body = SWGSDRangel::Object::DeviceSettings->new(); # DeviceSettings | Device settings to apply
    +
    +eval { 
    +    my $result = $api_instance->devicesetDeviceSettingsPatch(deviceSetIndex => $deviceSetIndex, body => $body);
    +    print Dumper($result);
    +};
    +if ($@) {
    +    warn "Exception when calling DeviceSetApi->devicesetDeviceSettingsPatch: $@\n";
    +}
    +
    + +
    +
    from __future__ import print_statement
    +import time
    +import swagger_sdrangel
    +from swagger_sdrangel.rest import ApiException
    +from pprint import pprint
    +
    +# create an instance of the API class
    +api_instance = swagger_sdrangel.DeviceSetApi()
    +deviceSetIndex = 56 # Integer | Index of device set in the device set list
    +body =  # DeviceSettings | Device settings to apply
    +
    +try: 
    +    api_response = api_instance.deviceset_device_settings_patch(deviceSetIndex, body)
    +    pprint(api_response)
    +except ApiException as e:
    +    print("Exception when calling DeviceSetApi->devicesetDeviceSettingsPatch: %s\n" % e)
    +
    +
    + +

    Parameters

    + +
    Path parameters
    + + + + + + + + + +
    NameDescription
    deviceSetIndex* + + +
    +
    +
    + + Integer + + +
    + Index of device set in the device set list +
    +
    +
    + Required +
    +
    +
    +
    + + +
    Body parameters
    + + + + + + + + + +
    NameDescription
    body * + + + +
    +
    + + + +

    Responses

    +

    Status: 200 - On success returns new settings values

    + + + +
    +
    +
    + +
    + +
    +
    + +

    Status: 404 - Invalid device set index or device not found

    + + + +
    +
    +
    + +
    + +
    +
    + +

    Status: 500 - Error

    + + + +
    +
    +
    + +
    + +
    +
    + +

    Status: 501 - Function not implemented

    + + + +
    +
    + +
    +
    +
    +
    +
    +
    +

    devicesetDeviceSettingsPut

    +

    +
    +
    +
    +

    +

    Apply all settings unconditionally (force)

    +

    +
    +
    /sdrangel/deviceset/{deviceSetIndex}/device/settings
    +

    +

    Usage and SDK Samples

    +

    + + +
    +
    +
    curl -X PUT "http://localhost:8091/sdrangel/deviceset/{deviceSetIndex}/device/settings"
    +
    +
    +
    import SWGSDRangel.*;
    +import SWGSDRangel.auth.*;
    +import SWGSDRangel.model.*;
    +import SWGSDRangel.api.DeviceSetApi;
    +
    +import java.io.File;
    +import java.util.*;
    +
    +public class DeviceSetApiExample {
    +
    +    public static void main(String[] args) {
    +        
    +        DeviceSetApi apiInstance = new DeviceSetApi();
    +        Integer deviceSetIndex = 56; // Integer | Index of device set in the device set list
    +        DeviceSettings body = ; // DeviceSettings | Device settings to apply
    +        try {
    +            DeviceSettings result = apiInstance.devicesetDeviceSettingsPut(deviceSetIndex, body);
    +            System.out.println(result);
    +        } catch (ApiException e) {
    +            System.err.println("Exception when calling DeviceSetApi#devicesetDeviceSettingsPut");
    +            e.printStackTrace();
    +        }
    +    }
    +}
    +
    + +
    +
    import SWGSDRangel.api.DeviceSetApi;
    +
    +public class DeviceSetApiExample {
    +
    +    public static void main(String[] args) {
    +        DeviceSetApi apiInstance = new DeviceSetApi();
    +        Integer deviceSetIndex = 56; // Integer | Index of device set in the device set list
    +        DeviceSettings body = ; // DeviceSettings | Device settings to apply
    +        try {
    +            DeviceSettings result = apiInstance.devicesetDeviceSettingsPut(deviceSetIndex, body);
    +            System.out.println(result);
    +        } catch (ApiException e) {
    +            System.err.println("Exception when calling DeviceSetApi#devicesetDeviceSettingsPut");
    +            e.printStackTrace();
    +        }
    +    }
    +}
    +
    + +
    +
    Integer *deviceSetIndex = 56; // Index of device set in the device set list
    +DeviceSettings *body = ; // Device settings to apply
    +
    +DeviceSetApi *apiInstance = [[DeviceSetApi alloc] init];
    +
    +[apiInstance devicesetDeviceSettingsPutWith:deviceSetIndex
    +    body:body
    +              completionHandler: ^(DeviceSettings output, NSError* error) {
    +                            if (output) {
    +                                NSLog(@"%@", output);
    +                            }
    +                            if (error) {
    +                                NSLog(@"Error: %@", error);
    +                            }
    +                        }];
    +
    +
    + +
    +
    var SdRangel = require('sd_rangel');
    +
    +var api = new SdRangel.DeviceSetApi()
    +
    +var deviceSetIndex = 56; // {Integer} Index of device set in the device set list
    +
    +var body = ; // {DeviceSettings} Device settings to apply
    +
    +
    +var callback = function(error, data, response) {
    +  if (error) {
    +    console.error(error);
    +  } else {
    +    console.log('API called successfully. Returned data: ' + data);
    +  }
    +};
    +api.devicesetDeviceSettingsPut(deviceSetIndex, body, callback);
    +
    +
    + + +
    +
    using System;
    +using System.Diagnostics;
    +using SWGSDRangel.Api;
    +using SWGSDRangel.Client;
    +using SWGSDRangel.Model;
    +
    +namespace Example
    +{
    +    public class devicesetDeviceSettingsPutExample
    +    {
    +        public void main()
    +        {
    +            
    +            var apiInstance = new DeviceSetApi();
    +            var deviceSetIndex = 56;  // Integer | Index of device set in the device set list
    +            var body = new DeviceSettings(); // DeviceSettings | Device settings to apply
    +
    +            try
    +            {
    +                DeviceSettings result = apiInstance.devicesetDeviceSettingsPut(deviceSetIndex, body);
    +                Debug.WriteLine(result);
    +            }
    +            catch (Exception e)
    +            {
    +                Debug.Print("Exception when calling DeviceSetApi.devicesetDeviceSettingsPut: " + e.Message );
    +            }
    +        }
    +    }
    +}
    +
    +
    + +
    +
    <?php
    +require_once(__DIR__ . '/vendor/autoload.php');
    +
    +$api_instance = new Swagger\Client\Api\DeviceSetApi();
    +$deviceSetIndex = 56; // Integer | Index of device set in the device set list
    +$body = ; // DeviceSettings | Device settings to apply
    +
    +try {
    +    $result = $api_instance->devicesetDeviceSettingsPut($deviceSetIndex, $body);
    +    print_r($result);
    +} catch (Exception $e) {
    +    echo 'Exception when calling DeviceSetApi->devicesetDeviceSettingsPut: ', $e->getMessage(), PHP_EOL;
    +}
    +?>
    +
    + +
    +
    use Data::Dumper;
    +use SWGSDRangel::Configuration;
    +use SWGSDRangel::DeviceSetApi;
    +
    +my $api_instance = SWGSDRangel::DeviceSetApi->new();
    +my $deviceSetIndex = 56; # Integer | Index of device set in the device set list
    +my $body = SWGSDRangel::Object::DeviceSettings->new(); # DeviceSettings | Device settings to apply
    +
    +eval { 
    +    my $result = $api_instance->devicesetDeviceSettingsPut(deviceSetIndex => $deviceSetIndex, body => $body);
    +    print Dumper($result);
    +};
    +if ($@) {
    +    warn "Exception when calling DeviceSetApi->devicesetDeviceSettingsPut: $@\n";
    +}
    +
    + +
    +
    from __future__ import print_statement
    +import time
    +import swagger_sdrangel
    +from swagger_sdrangel.rest import ApiException
    +from pprint import pprint
    +
    +# create an instance of the API class
    +api_instance = swagger_sdrangel.DeviceSetApi()
    +deviceSetIndex = 56 # Integer | Index of device set in the device set list
    +body =  # DeviceSettings | Device settings to apply
    +
    +try: 
    +    api_response = api_instance.deviceset_device_settings_put(deviceSetIndex, body)
    +    pprint(api_response)
    +except ApiException as e:
    +    print("Exception when calling DeviceSetApi->devicesetDeviceSettingsPut: %s\n" % e)
    +
    +
    + +

    Parameters

    + +
    Path parameters
    + + + + + + + + + +
    NameDescription
    deviceSetIndex* + + +
    +
    +
    + + Integer + + +
    + Index of device set in the device set list +
    +
    +
    + Required +
    +
    +
    +
    + + +
    Body parameters
    + + + + + + + + + +
    NameDescription
    body * + + + +
    +
    + + + +

    Responses

    +

    Status: 200 - On success returns new settings values

    + + + +
    +
    +
    + +
    + +
    +
    + +

    Status: 404 - Invalid device set index or device not found

    + + + +
    +
    +
    + +
    + +
    +
    + +

    Status: 500 - Error

    + + + +
    +
    +
    + +
    + +
    +
    + +

    Status: 501 - Function not implemented

    + + + +
    +
    + +
    +
    +
    @@ -9058,7 +10759,7 @@ except ApiException as e:
    - Generated 2017-12-06T21:52:02.995+01:00 + Generated 2017-12-06T23:48:11.127+01:00
    diff --git a/sdrbase/webapi/webapiadapterinterface.cpp b/sdrbase/webapi/webapiadapterinterface.cpp index c1ab9cf97..05e8ef7e2 100644 --- a/sdrbase/webapi/webapiadapterinterface.cpp +++ b/sdrbase/webapi/webapiadapterinterface.cpp @@ -31,3 +31,4 @@ QString WebAPIAdapterInterface::instanceDeviceSetsURL = "/sdrangel/devicesets"; std::regex WebAPIAdapterInterface::devicesetURLRe("^/sdrangel/deviceset/([0-9]{1,2})$"); std::regex WebAPIAdapterInterface::devicesetDeviceURLRe("^/sdrangel/deviceset/([0-9]{1,2})/device$"); std::regex WebAPIAdapterInterface::devicesetDeviceSettingsURLRe("^/sdrangel/deviceset/([0-9]{1,2})/device/settings$"); +std::regex WebAPIAdapterInterface::devicesetDeviceRunURLRe("^/sdrangel/deviceset/([0-9]{1,2})/device/run"); diff --git a/sdrbase/webapi/webapiadapterinterface.h b/sdrbase/webapi/webapiadapterinterface.h index d42e3df41..6212a515c 100644 --- a/sdrbase/webapi/webapiadapterinterface.h +++ b/sdrbase/webapi/webapiadapterinterface.h @@ -39,6 +39,7 @@ namespace SWGSDRangel class SWGDeviceSet; class SWGDeviceListItem; class SWGDeviceSettings; + class SWGDeviceState; class SWGErrorResponse; } @@ -246,6 +247,46 @@ public: SWGSDRangel::SWGErrorResponse& error __attribute__((unused))) { return 501; } + /** + * Handler of /sdrangel/deviceset/{devicesetIndex}/device/settings (PUT) swagger/sdrangel/code/html2/index.html#api-Default-instanceChannels + * returns the Http status code (default 501: not implemented) + */ + virtual int devicesetDeviceSettingsPut( + int deviceSetIndex __attribute__((unused)), + SWGSDRangel::SWGDeviceSettings& response __attribute__((unused)), + SWGSDRangel::SWGErrorResponse& error __attribute__((unused))) + { return 501; } + + /** + * Handler of /sdrangel/deviceset/{devicesetIndex}/device/settings (PATCH) swagger/sdrangel/code/html2/index.html#api-Default-instanceChannels + * returns the Http status code (default 501: not implemented) + */ + virtual int devicesetDeviceSettingsPatch( + int deviceSetIndex __attribute__((unused)), + SWGSDRangel::SWGDeviceSettings& response __attribute__((unused)), + SWGSDRangel::SWGErrorResponse& error __attribute__((unused))) + { return 501; } + + /** + * Handler of /sdrangel/deviceset/{devicesetIndex}/device/run (POST) swagger/sdrangel/code/html2/index.html#api-Default-instanceChannels + * returns the Http status code (default 501: not implemented) + */ + virtual int devicesetDeviceRunPost( + int deviceSetIndex __attribute__((unused)), + SWGSDRangel::SWGDeviceState& response __attribute__((unused)), + SWGSDRangel::SWGErrorResponse& error __attribute__((unused))) + { return 501; } + + /** + * Handler of /sdrangel/deviceset/{devicesetIndex}/device/run (DELETE) swagger/sdrangel/code/html2/index.html#api-Default-instanceChannels + * returns the Http status code (default 501: not implemented) + */ + virtual int devicesetDeviceRunDelete( + int deviceSetIndex __attribute__((unused)), + SWGSDRangel::SWGDeviceState& response __attribute__((unused)), + SWGSDRangel::SWGErrorResponse& error __attribute__((unused))) + { return 501; } + static QString instanceSummaryURL; static QString instanceDevicesURL; static QString instanceChannelsURL; @@ -258,6 +299,7 @@ public: static std::regex devicesetURLRe; static std::regex devicesetDeviceURLRe; static std::regex devicesetDeviceSettingsURLRe; + static std::regex devicesetDeviceRunURLRe; }; diff --git a/swagger/sdrangel/api/swagger/swagger.yaml b/swagger/sdrangel/api/swagger/swagger.yaml index c3e7d9853..58a9ec21b 100644 --- a/swagger/sdrangel/api/swagger/swagger.yaml +++ b/swagger/sdrangel/api/swagger/swagger.yaml @@ -548,6 +548,128 @@ paths: description: On success returns current settings values schema: $ref: "#/definitions/DeviceSettings" + "404": + description: Invalid device set index or device not found + schema: + $ref: "#/definitions/ErrorResponse" + "500": + description: Error + schema: + $ref: "#/definitions/ErrorResponse" + "501": + description: Function not implemented + put: + description: Apply all settings unconditionally (force) + operationId: devicesetDeviceSettingsPut + 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: Device settings to apply + required: true + schema: + $ref: "#/definitions/DeviceSettings" + responses: + "200": + description: On success returns new settings values + schema: + $ref: "#/definitions/DeviceSettings" + "404": + description: Invalid device set index or device not found + schema: + $ref: "#/definitions/ErrorResponse" + "500": + description: Error + schema: + $ref: "#/definitions/ErrorResponse" + "501": + description: Function not implemented + patch: + description: Apply settings differentially (no force) + operationId: devicesetDeviceSettingsPatch + 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: Device settings to apply + required: true + schema: + $ref: "#/definitions/DeviceSettings" + responses: + "200": + description: On success returns new settings values + schema: + $ref: "#/definitions/DeviceSettings" + "404": + description: Invalid device set index or device not found + schema: + $ref: "#/definitions/ErrorResponse" + "500": + description: Error + schema: + $ref: "#/definitions/ErrorResponse" + "501": + description: Function not implemented + /sdrangel/deviceset/{deviceSetIndex}/device/run: + x-swagger-router-controller: deviceset + post: + description: start device + operationId: devicesetDeviceRunPost + 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 current state + schema: + $ref: "#/definitions/DeviceState" + "404": + description: Invalid device set index or device not found + schema: + $ref: "#/definitions/ErrorResponse" + "500": + description: Error + schema: + $ref: "#/definitions/ErrorResponse" + "501": + description: Function not implemented + delete: + description: stop device + operationId: devicesetDeviceRunDelete + 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 current state + schema: + $ref: "#/definitions/DeviceState" + "404": + description: Invalid device set index or device not found + schema: + $ref: "#/definitions/ErrorResponse" "500": description: Error schema: @@ -699,7 +821,14 @@ definitions: type: array items: $ref: "#/definitions/DeviceSet" - + DeviceState: + description: "Device running state" + required: + - state + properties: + state: + description: "State: notStarted, idle, ready, running, error" + type: string SamplingDevice: description: "Information about a logical device available from an attached hardware device that can be used as a sampling device" required: diff --git a/swagger/sdrangel/code/html2/index.html b/swagger/sdrangel/code/html2/index.html index 6f6f7db73..bbc6a5c29 100644 --- a/swagger/sdrangel/code/html2/index.html +++ b/swagger/sdrangel/code/html2/index.html @@ -951,6 +951,16 @@ margin-bottom: 20px; } }, "description" : "Base device settings" +}; + defs.DeviceState = { + "required" : [ "state" ], + "properties" : { + "state" : { + "type" : "string", + "description" : "State: notStarted, idle, ready, running, error" + } + }, + "description" : "Device running state" }; defs.ErrorResponse = { "required" : [ "message" ], @@ -1358,12 +1368,24 @@ margin-bottom: 20px; -
  • - devicesetDeviceGet -
  • devicesetDevicePut
  • +
  • + devicesetDeviceRunDelete +
  • +
  • + devicesetDeviceRunPost +
  • +
  • + devicesetDeviceSettingsGet +
  • +
  • + devicesetDeviceSettingsPatch +
  • +
  • + devicesetDeviceSettingsPut +
  • devicesetGet
  • @@ -1443,346 +1465,6 @@ margin-bottom: 20px;

    DeviceSet

    -
    -
    -
    -

    devicesetDeviceGet

    -

    -
    -
    -
    -

    -

    Get device settings

    -

    -
    -
    /sdrangel/deviceset/{deviceSetIndex}/device/settings
    -

    -

    Usage and SDK Samples

    -

    - - -
    -
    -
    curl -X GET "http://localhost:8091/sdrangel/deviceset/{deviceSetIndex}/device/settings"
    -
    -
    -
    import SWGSDRangel.*;
    -import SWGSDRangel.auth.*;
    -import SWGSDRangel.model.*;
    -import SWGSDRangel.api.DeviceSetApi;
    -
    -import java.io.File;
    -import java.util.*;
    -
    -public class DeviceSetApiExample {
    -
    -    public static void main(String[] args) {
    -        
    -        DeviceSetApi apiInstance = new DeviceSetApi();
    -        Integer deviceSetIndex = 56; // Integer | Index of device set in the device set list
    -        try {
    -            DeviceSettings result = apiInstance.devicesetDeviceGet(deviceSetIndex);
    -            System.out.println(result);
    -        } catch (ApiException e) {
    -            System.err.println("Exception when calling DeviceSetApi#devicesetDeviceGet");
    -            e.printStackTrace();
    -        }
    -    }
    -}
    -
    - -
    -
    import SWGSDRangel.api.DeviceSetApi;
    -
    -public class DeviceSetApiExample {
    -
    -    public static void main(String[] args) {
    -        DeviceSetApi apiInstance = new DeviceSetApi();
    -        Integer deviceSetIndex = 56; // Integer | Index of device set in the device set list
    -        try {
    -            DeviceSettings result = apiInstance.devicesetDeviceGet(deviceSetIndex);
    -            System.out.println(result);
    -        } catch (ApiException e) {
    -            System.err.println("Exception when calling DeviceSetApi#devicesetDeviceGet");
    -            e.printStackTrace();
    -        }
    -    }
    -}
    -
    - -
    -
    Integer *deviceSetIndex = 56; // Index of device set in the device set list
    -
    -DeviceSetApi *apiInstance = [[DeviceSetApi alloc] init];
    -
    -[apiInstance devicesetDeviceGetWith:deviceSetIndex
    -              completionHandler: ^(DeviceSettings output, NSError* error) {
    -                            if (output) {
    -                                NSLog(@"%@", output);
    -                            }
    -                            if (error) {
    -                                NSLog(@"Error: %@", error);
    -                            }
    -                        }];
    -
    -
    - -
    -
    var SdRangel = require('sd_rangel');
    -
    -var api = new SdRangel.DeviceSetApi()
    -
    -var deviceSetIndex = 56; // {Integer} Index of device set in the device set list
    -
    -
    -var callback = function(error, data, response) {
    -  if (error) {
    -    console.error(error);
    -  } else {
    -    console.log('API called successfully. Returned data: ' + data);
    -  }
    -};
    -api.devicesetDeviceGet(deviceSetIndex, callback);
    -
    -
    - - -
    -
    using System;
    -using System.Diagnostics;
    -using SWGSDRangel.Api;
    -using SWGSDRangel.Client;
    -using SWGSDRangel.Model;
    -
    -namespace Example
    -{
    -    public class devicesetDeviceGetExample
    -    {
    -        public void main()
    -        {
    -            
    -            var apiInstance = new DeviceSetApi();
    -            var deviceSetIndex = 56;  // Integer | Index of device set in the device set list
    -
    -            try
    -            {
    -                DeviceSettings result = apiInstance.devicesetDeviceGet(deviceSetIndex);
    -                Debug.WriteLine(result);
    -            }
    -            catch (Exception e)
    -            {
    -                Debug.Print("Exception when calling DeviceSetApi.devicesetDeviceGet: " + e.Message );
    -            }
    -        }
    -    }
    -}
    -
    -
    - -
    -
    <?php
    -require_once(__DIR__ . '/vendor/autoload.php');
    -
    -$api_instance = new Swagger\Client\Api\DeviceSetApi();
    -$deviceSetIndex = 56; // Integer | Index of device set in the device set list
    -
    -try {
    -    $result = $api_instance->devicesetDeviceGet($deviceSetIndex);
    -    print_r($result);
    -} catch (Exception $e) {
    -    echo 'Exception when calling DeviceSetApi->devicesetDeviceGet: ', $e->getMessage(), PHP_EOL;
    -}
    -?>
    -
    - -
    -
    use Data::Dumper;
    -use SWGSDRangel::Configuration;
    -use SWGSDRangel::DeviceSetApi;
    -
    -my $api_instance = SWGSDRangel::DeviceSetApi->new();
    -my $deviceSetIndex = 56; # Integer | Index of device set in the device set list
    -
    -eval { 
    -    my $result = $api_instance->devicesetDeviceGet(deviceSetIndex => $deviceSetIndex);
    -    print Dumper($result);
    -};
    -if ($@) {
    -    warn "Exception when calling DeviceSetApi->devicesetDeviceGet: $@\n";
    -}
    -
    - -
    -
    from __future__ import print_statement
    -import time
    -import swagger_sdrangel
    -from swagger_sdrangel.rest import ApiException
    -from pprint import pprint
    -
    -# create an instance of the API class
    -api_instance = swagger_sdrangel.DeviceSetApi()
    -deviceSetIndex = 56 # Integer | Index of device set in the device set list
    -
    -try: 
    -    api_response = api_instance.deviceset_device_get(deviceSetIndex)
    -    pprint(api_response)
    -except ApiException as e:
    -    print("Exception when calling DeviceSetApi->devicesetDeviceGet: %s\n" % e)
    -
    -
    - -

    Parameters

    - -
    Path parameters
    - - - - - - - - - -
    NameDescription
    deviceSetIndex* - - -
    -
    -
    - - Integer - - -
    - Index of device set in the device set list -
    -
    -
    - Required -
    -
    -
    -
    - - - - - -

    Responses

    -

    Status: 200 - On success returns current settings values

    - - - -
    -
    -
    - -
    - -
    -
    - -

    Status: 500 - Error

    - - - -
    -
    -
    - -
    - -
    -
    - -

    Status: 501 - Function not implemented

    - - - -
    -
    - -
    -
    -
    @@ -2261,6 +1943,2025 @@ $(document).ready(function() {

    +
    +
    +
    +

    devicesetDeviceRunDelete

    +

    +
    +
    +
    +

    +

    stop device

    +

    +
    +
    /sdrangel/deviceset/{deviceSetIndex}/device/run
    +

    +

    Usage and SDK Samples

    +

    + + +
    +
    +
    curl -X DELETE "http://localhost:8091/sdrangel/deviceset/{deviceSetIndex}/device/run"
    +
    +
    +
    import SWGSDRangel.*;
    +import SWGSDRangel.auth.*;
    +import SWGSDRangel.model.*;
    +import SWGSDRangel.api.DeviceSetApi;
    +
    +import java.io.File;
    +import java.util.*;
    +
    +public class DeviceSetApiExample {
    +
    +    public static void main(String[] args) {
    +        
    +        DeviceSetApi apiInstance = new DeviceSetApi();
    +        Integer deviceSetIndex = 56; // Integer | Index of device set in the device set list
    +        try {
    +            DeviceState result = apiInstance.devicesetDeviceRunDelete(deviceSetIndex);
    +            System.out.println(result);
    +        } catch (ApiException e) {
    +            System.err.println("Exception when calling DeviceSetApi#devicesetDeviceRunDelete");
    +            e.printStackTrace();
    +        }
    +    }
    +}
    +
    + +
    +
    import SWGSDRangel.api.DeviceSetApi;
    +
    +public class DeviceSetApiExample {
    +
    +    public static void main(String[] args) {
    +        DeviceSetApi apiInstance = new DeviceSetApi();
    +        Integer deviceSetIndex = 56; // Integer | Index of device set in the device set list
    +        try {
    +            DeviceState result = apiInstance.devicesetDeviceRunDelete(deviceSetIndex);
    +            System.out.println(result);
    +        } catch (ApiException e) {
    +            System.err.println("Exception when calling DeviceSetApi#devicesetDeviceRunDelete");
    +            e.printStackTrace();
    +        }
    +    }
    +}
    +
    + +
    +
    Integer *deviceSetIndex = 56; // Index of device set in the device set list
    +
    +DeviceSetApi *apiInstance = [[DeviceSetApi alloc] init];
    +
    +[apiInstance devicesetDeviceRunDeleteWith:deviceSetIndex
    +              completionHandler: ^(DeviceState output, NSError* error) {
    +                            if (output) {
    +                                NSLog(@"%@", output);
    +                            }
    +                            if (error) {
    +                                NSLog(@"Error: %@", error);
    +                            }
    +                        }];
    +
    +
    + +
    +
    var SdRangel = require('sd_rangel');
    +
    +var api = new SdRangel.DeviceSetApi()
    +
    +var deviceSetIndex = 56; // {Integer} Index of device set in the device set list
    +
    +
    +var callback = function(error, data, response) {
    +  if (error) {
    +    console.error(error);
    +  } else {
    +    console.log('API called successfully. Returned data: ' + data);
    +  }
    +};
    +api.devicesetDeviceRunDelete(deviceSetIndex, callback);
    +
    +
    + + +
    +
    using System;
    +using System.Diagnostics;
    +using SWGSDRangel.Api;
    +using SWGSDRangel.Client;
    +using SWGSDRangel.Model;
    +
    +namespace Example
    +{
    +    public class devicesetDeviceRunDeleteExample
    +    {
    +        public void main()
    +        {
    +            
    +            var apiInstance = new DeviceSetApi();
    +            var deviceSetIndex = 56;  // Integer | Index of device set in the device set list
    +
    +            try
    +            {
    +                DeviceState result = apiInstance.devicesetDeviceRunDelete(deviceSetIndex);
    +                Debug.WriteLine(result);
    +            }
    +            catch (Exception e)
    +            {
    +                Debug.Print("Exception when calling DeviceSetApi.devicesetDeviceRunDelete: " + e.Message );
    +            }
    +        }
    +    }
    +}
    +
    +
    + +
    +
    <?php
    +require_once(__DIR__ . '/vendor/autoload.php');
    +
    +$api_instance = new Swagger\Client\Api\DeviceSetApi();
    +$deviceSetIndex = 56; // Integer | Index of device set in the device set list
    +
    +try {
    +    $result = $api_instance->devicesetDeviceRunDelete($deviceSetIndex);
    +    print_r($result);
    +} catch (Exception $e) {
    +    echo 'Exception when calling DeviceSetApi->devicesetDeviceRunDelete: ', $e->getMessage(), PHP_EOL;
    +}
    +?>
    +
    + +
    +
    use Data::Dumper;
    +use SWGSDRangel::Configuration;
    +use SWGSDRangel::DeviceSetApi;
    +
    +my $api_instance = SWGSDRangel::DeviceSetApi->new();
    +my $deviceSetIndex = 56; # Integer | Index of device set in the device set list
    +
    +eval { 
    +    my $result = $api_instance->devicesetDeviceRunDelete(deviceSetIndex => $deviceSetIndex);
    +    print Dumper($result);
    +};
    +if ($@) {
    +    warn "Exception when calling DeviceSetApi->devicesetDeviceRunDelete: $@\n";
    +}
    +
    + +
    +
    from __future__ import print_statement
    +import time
    +import swagger_sdrangel
    +from swagger_sdrangel.rest import ApiException
    +from pprint import pprint
    +
    +# create an instance of the API class
    +api_instance = swagger_sdrangel.DeviceSetApi()
    +deviceSetIndex = 56 # Integer | Index of device set in the device set list
    +
    +try: 
    +    api_response = api_instance.deviceset_device_run_delete(deviceSetIndex)
    +    pprint(api_response)
    +except ApiException as e:
    +    print("Exception when calling DeviceSetApi->devicesetDeviceRunDelete: %s\n" % e)
    +
    +
    + +

    Parameters

    + +
    Path parameters
    + + + + + + + + + +
    NameDescription
    deviceSetIndex* + + +
    +
    +
    + + Integer + + +
    + Index of device set in the device set list +
    +
    +
    + Required +
    +
    +
    +
    + + + + + +

    Responses

    +

    Status: 200 - On success return current state

    + + + +
    +
    +
    + +
    + +
    +
    + +

    Status: 404 - Invalid device set index or device not found

    + + + +
    +
    +
    + +
    + +
    +
    + +

    Status: 500 - Error

    + + + +
    +
    +
    + +
    + +
    +
    + +

    Status: 501 - Function not implemented

    + + + +
    +
    + +
    +
    +
    +
    +
    +
    +

    devicesetDeviceRunPost

    +

    +
    +
    +
    +

    +

    start device

    +

    +
    +
    /sdrangel/deviceset/{deviceSetIndex}/device/run
    +

    +

    Usage and SDK Samples

    +

    + + +
    +
    +
    curl -X POST "http://localhost:8091/sdrangel/deviceset/{deviceSetIndex}/device/run"
    +
    +
    +
    import SWGSDRangel.*;
    +import SWGSDRangel.auth.*;
    +import SWGSDRangel.model.*;
    +import SWGSDRangel.api.DeviceSetApi;
    +
    +import java.io.File;
    +import java.util.*;
    +
    +public class DeviceSetApiExample {
    +
    +    public static void main(String[] args) {
    +        
    +        DeviceSetApi apiInstance = new DeviceSetApi();
    +        Integer deviceSetIndex = 56; // Integer | Index of device set in the device set list
    +        try {
    +            DeviceState result = apiInstance.devicesetDeviceRunPost(deviceSetIndex);
    +            System.out.println(result);
    +        } catch (ApiException e) {
    +            System.err.println("Exception when calling DeviceSetApi#devicesetDeviceRunPost");
    +            e.printStackTrace();
    +        }
    +    }
    +}
    +
    + +
    +
    import SWGSDRangel.api.DeviceSetApi;
    +
    +public class DeviceSetApiExample {
    +
    +    public static void main(String[] args) {
    +        DeviceSetApi apiInstance = new DeviceSetApi();
    +        Integer deviceSetIndex = 56; // Integer | Index of device set in the device set list
    +        try {
    +            DeviceState result = apiInstance.devicesetDeviceRunPost(deviceSetIndex);
    +            System.out.println(result);
    +        } catch (ApiException e) {
    +            System.err.println("Exception when calling DeviceSetApi#devicesetDeviceRunPost");
    +            e.printStackTrace();
    +        }
    +    }
    +}
    +
    + +
    +
    Integer *deviceSetIndex = 56; // Index of device set in the device set list
    +
    +DeviceSetApi *apiInstance = [[DeviceSetApi alloc] init];
    +
    +[apiInstance devicesetDeviceRunPostWith:deviceSetIndex
    +              completionHandler: ^(DeviceState output, NSError* error) {
    +                            if (output) {
    +                                NSLog(@"%@", output);
    +                            }
    +                            if (error) {
    +                                NSLog(@"Error: %@", error);
    +                            }
    +                        }];
    +
    +
    + +
    +
    var SdRangel = require('sd_rangel');
    +
    +var api = new SdRangel.DeviceSetApi()
    +
    +var deviceSetIndex = 56; // {Integer} Index of device set in the device set list
    +
    +
    +var callback = function(error, data, response) {
    +  if (error) {
    +    console.error(error);
    +  } else {
    +    console.log('API called successfully. Returned data: ' + data);
    +  }
    +};
    +api.devicesetDeviceRunPost(deviceSetIndex, callback);
    +
    +
    + + +
    +
    using System;
    +using System.Diagnostics;
    +using SWGSDRangel.Api;
    +using SWGSDRangel.Client;
    +using SWGSDRangel.Model;
    +
    +namespace Example
    +{
    +    public class devicesetDeviceRunPostExample
    +    {
    +        public void main()
    +        {
    +            
    +            var apiInstance = new DeviceSetApi();
    +            var deviceSetIndex = 56;  // Integer | Index of device set in the device set list
    +
    +            try
    +            {
    +                DeviceState result = apiInstance.devicesetDeviceRunPost(deviceSetIndex);
    +                Debug.WriteLine(result);
    +            }
    +            catch (Exception e)
    +            {
    +                Debug.Print("Exception when calling DeviceSetApi.devicesetDeviceRunPost: " + e.Message );
    +            }
    +        }
    +    }
    +}
    +
    +
    + +
    +
    <?php
    +require_once(__DIR__ . '/vendor/autoload.php');
    +
    +$api_instance = new Swagger\Client\Api\DeviceSetApi();
    +$deviceSetIndex = 56; // Integer | Index of device set in the device set list
    +
    +try {
    +    $result = $api_instance->devicesetDeviceRunPost($deviceSetIndex);
    +    print_r($result);
    +} catch (Exception $e) {
    +    echo 'Exception when calling DeviceSetApi->devicesetDeviceRunPost: ', $e->getMessage(), PHP_EOL;
    +}
    +?>
    +
    + +
    +
    use Data::Dumper;
    +use SWGSDRangel::Configuration;
    +use SWGSDRangel::DeviceSetApi;
    +
    +my $api_instance = SWGSDRangel::DeviceSetApi->new();
    +my $deviceSetIndex = 56; # Integer | Index of device set in the device set list
    +
    +eval { 
    +    my $result = $api_instance->devicesetDeviceRunPost(deviceSetIndex => $deviceSetIndex);
    +    print Dumper($result);
    +};
    +if ($@) {
    +    warn "Exception when calling DeviceSetApi->devicesetDeviceRunPost: $@\n";
    +}
    +
    + +
    +
    from __future__ import print_statement
    +import time
    +import swagger_sdrangel
    +from swagger_sdrangel.rest import ApiException
    +from pprint import pprint
    +
    +# create an instance of the API class
    +api_instance = swagger_sdrangel.DeviceSetApi()
    +deviceSetIndex = 56 # Integer | Index of device set in the device set list
    +
    +try: 
    +    api_response = api_instance.deviceset_device_run_post(deviceSetIndex)
    +    pprint(api_response)
    +except ApiException as e:
    +    print("Exception when calling DeviceSetApi->devicesetDeviceRunPost: %s\n" % e)
    +
    +
    + +

    Parameters

    + +
    Path parameters
    + + + + + + + + + +
    NameDescription
    deviceSetIndex* + + +
    +
    +
    + + Integer + + +
    + Index of device set in the device set list +
    +
    +
    + Required +
    +
    +
    +
    + + + + + +

    Responses

    +

    Status: 200 - On success return current state

    + + + +
    +
    +
    + +
    + +
    +
    + +

    Status: 404 - Invalid device set index or device not found

    + + + +
    +
    +
    + +
    + +
    +
    + +

    Status: 500 - Error

    + + + +
    +
    +
    + +
    + +
    +
    + +

    Status: 501 - Function not implemented

    + + + +
    +
    + +
    +
    +
    +
    +
    +
    +

    devicesetDeviceSettingsGet

    +

    +
    +
    +
    +

    +

    Get device settings

    +

    +
    +
    /sdrangel/deviceset/{deviceSetIndex}/device/settings
    +

    +

    Usage and SDK Samples

    +

    + + +
    +
    +
    curl -X GET "http://localhost:8091/sdrangel/deviceset/{deviceSetIndex}/device/settings"
    +
    +
    +
    import SWGSDRangel.*;
    +import SWGSDRangel.auth.*;
    +import SWGSDRangel.model.*;
    +import SWGSDRangel.api.DeviceSetApi;
    +
    +import java.io.File;
    +import java.util.*;
    +
    +public class DeviceSetApiExample {
    +
    +    public static void main(String[] args) {
    +        
    +        DeviceSetApi apiInstance = new DeviceSetApi();
    +        Integer deviceSetIndex = 56; // Integer | Index of device set in the device set list
    +        try {
    +            DeviceSettings result = apiInstance.devicesetDeviceSettingsGet(deviceSetIndex);
    +            System.out.println(result);
    +        } catch (ApiException e) {
    +            System.err.println("Exception when calling DeviceSetApi#devicesetDeviceSettingsGet");
    +            e.printStackTrace();
    +        }
    +    }
    +}
    +
    + +
    +
    import SWGSDRangel.api.DeviceSetApi;
    +
    +public class DeviceSetApiExample {
    +
    +    public static void main(String[] args) {
    +        DeviceSetApi apiInstance = new DeviceSetApi();
    +        Integer deviceSetIndex = 56; // Integer | Index of device set in the device set list
    +        try {
    +            DeviceSettings result = apiInstance.devicesetDeviceSettingsGet(deviceSetIndex);
    +            System.out.println(result);
    +        } catch (ApiException e) {
    +            System.err.println("Exception when calling DeviceSetApi#devicesetDeviceSettingsGet");
    +            e.printStackTrace();
    +        }
    +    }
    +}
    +
    + +
    +
    Integer *deviceSetIndex = 56; // Index of device set in the device set list
    +
    +DeviceSetApi *apiInstance = [[DeviceSetApi alloc] init];
    +
    +[apiInstance devicesetDeviceSettingsGetWith:deviceSetIndex
    +              completionHandler: ^(DeviceSettings output, NSError* error) {
    +                            if (output) {
    +                                NSLog(@"%@", output);
    +                            }
    +                            if (error) {
    +                                NSLog(@"Error: %@", error);
    +                            }
    +                        }];
    +
    +
    + +
    +
    var SdRangel = require('sd_rangel');
    +
    +var api = new SdRangel.DeviceSetApi()
    +
    +var deviceSetIndex = 56; // {Integer} Index of device set in the device set list
    +
    +
    +var callback = function(error, data, response) {
    +  if (error) {
    +    console.error(error);
    +  } else {
    +    console.log('API called successfully. Returned data: ' + data);
    +  }
    +};
    +api.devicesetDeviceSettingsGet(deviceSetIndex, callback);
    +
    +
    + + +
    +
    using System;
    +using System.Diagnostics;
    +using SWGSDRangel.Api;
    +using SWGSDRangel.Client;
    +using SWGSDRangel.Model;
    +
    +namespace Example
    +{
    +    public class devicesetDeviceSettingsGetExample
    +    {
    +        public void main()
    +        {
    +            
    +            var apiInstance = new DeviceSetApi();
    +            var deviceSetIndex = 56;  // Integer | Index of device set in the device set list
    +
    +            try
    +            {
    +                DeviceSettings result = apiInstance.devicesetDeviceSettingsGet(deviceSetIndex);
    +                Debug.WriteLine(result);
    +            }
    +            catch (Exception e)
    +            {
    +                Debug.Print("Exception when calling DeviceSetApi.devicesetDeviceSettingsGet: " + e.Message );
    +            }
    +        }
    +    }
    +}
    +
    +
    + +
    +
    <?php
    +require_once(__DIR__ . '/vendor/autoload.php');
    +
    +$api_instance = new Swagger\Client\Api\DeviceSetApi();
    +$deviceSetIndex = 56; // Integer | Index of device set in the device set list
    +
    +try {
    +    $result = $api_instance->devicesetDeviceSettingsGet($deviceSetIndex);
    +    print_r($result);
    +} catch (Exception $e) {
    +    echo 'Exception when calling DeviceSetApi->devicesetDeviceSettingsGet: ', $e->getMessage(), PHP_EOL;
    +}
    +?>
    +
    + +
    +
    use Data::Dumper;
    +use SWGSDRangel::Configuration;
    +use SWGSDRangel::DeviceSetApi;
    +
    +my $api_instance = SWGSDRangel::DeviceSetApi->new();
    +my $deviceSetIndex = 56; # Integer | Index of device set in the device set list
    +
    +eval { 
    +    my $result = $api_instance->devicesetDeviceSettingsGet(deviceSetIndex => $deviceSetIndex);
    +    print Dumper($result);
    +};
    +if ($@) {
    +    warn "Exception when calling DeviceSetApi->devicesetDeviceSettingsGet: $@\n";
    +}
    +
    + +
    +
    from __future__ import print_statement
    +import time
    +import swagger_sdrangel
    +from swagger_sdrangel.rest import ApiException
    +from pprint import pprint
    +
    +# create an instance of the API class
    +api_instance = swagger_sdrangel.DeviceSetApi()
    +deviceSetIndex = 56 # Integer | Index of device set in the device set list
    +
    +try: 
    +    api_response = api_instance.deviceset_device_settings_get(deviceSetIndex)
    +    pprint(api_response)
    +except ApiException as e:
    +    print("Exception when calling DeviceSetApi->devicesetDeviceSettingsGet: %s\n" % e)
    +
    +
    + +

    Parameters

    + +
    Path parameters
    + + + + + + + + + +
    NameDescription
    deviceSetIndex* + + +
    +
    +
    + + Integer + + +
    + Index of device set in the device set list +
    +
    +
    + Required +
    +
    +
    +
    + + + + + +

    Responses

    +

    Status: 200 - On success returns current settings values

    + + + +
    +
    +
    + +
    + +
    +
    + +

    Status: 404 - Invalid device set index or device not found

    + + + +
    +
    +
    + +
    + +
    +
    + +

    Status: 500 - Error

    + + + +
    +
    +
    + +
    + +
    +
    + +

    Status: 501 - Function not implemented

    + + + +
    +
    + +
    +
    +
    +
    +
    +
    +

    devicesetDeviceSettingsPatch

    +

    +
    +
    +
    +

    +

    Apply settings differentially (no force)

    +

    +
    +
    /sdrangel/deviceset/{deviceSetIndex}/device/settings
    +

    +

    Usage and SDK Samples

    +

    + + +
    +
    +
    curl -X PATCH "http://localhost:8091/sdrangel/deviceset/{deviceSetIndex}/device/settings"
    +
    +
    +
    import SWGSDRangel.*;
    +import SWGSDRangel.auth.*;
    +import SWGSDRangel.model.*;
    +import SWGSDRangel.api.DeviceSetApi;
    +
    +import java.io.File;
    +import java.util.*;
    +
    +public class DeviceSetApiExample {
    +
    +    public static void main(String[] args) {
    +        
    +        DeviceSetApi apiInstance = new DeviceSetApi();
    +        Integer deviceSetIndex = 56; // Integer | Index of device set in the device set list
    +        DeviceSettings body = ; // DeviceSettings | Device settings to apply
    +        try {
    +            DeviceSettings result = apiInstance.devicesetDeviceSettingsPatch(deviceSetIndex, body);
    +            System.out.println(result);
    +        } catch (ApiException e) {
    +            System.err.println("Exception when calling DeviceSetApi#devicesetDeviceSettingsPatch");
    +            e.printStackTrace();
    +        }
    +    }
    +}
    +
    + +
    +
    import SWGSDRangel.api.DeviceSetApi;
    +
    +public class DeviceSetApiExample {
    +
    +    public static void main(String[] args) {
    +        DeviceSetApi apiInstance = new DeviceSetApi();
    +        Integer deviceSetIndex = 56; // Integer | Index of device set in the device set list
    +        DeviceSettings body = ; // DeviceSettings | Device settings to apply
    +        try {
    +            DeviceSettings result = apiInstance.devicesetDeviceSettingsPatch(deviceSetIndex, body);
    +            System.out.println(result);
    +        } catch (ApiException e) {
    +            System.err.println("Exception when calling DeviceSetApi#devicesetDeviceSettingsPatch");
    +            e.printStackTrace();
    +        }
    +    }
    +}
    +
    + +
    +
    Integer *deviceSetIndex = 56; // Index of device set in the device set list
    +DeviceSettings *body = ; // Device settings to apply
    +
    +DeviceSetApi *apiInstance = [[DeviceSetApi alloc] init];
    +
    +[apiInstance devicesetDeviceSettingsPatchWith:deviceSetIndex
    +    body:body
    +              completionHandler: ^(DeviceSettings output, NSError* error) {
    +                            if (output) {
    +                                NSLog(@"%@", output);
    +                            }
    +                            if (error) {
    +                                NSLog(@"Error: %@", error);
    +                            }
    +                        }];
    +
    +
    + +
    +
    var SdRangel = require('sd_rangel');
    +
    +var api = new SdRangel.DeviceSetApi()
    +
    +var deviceSetIndex = 56; // {Integer} Index of device set in the device set list
    +
    +var body = ; // {DeviceSettings} Device settings to apply
    +
    +
    +var callback = function(error, data, response) {
    +  if (error) {
    +    console.error(error);
    +  } else {
    +    console.log('API called successfully. Returned data: ' + data);
    +  }
    +};
    +api.devicesetDeviceSettingsPatch(deviceSetIndex, body, callback);
    +
    +
    + + +
    +
    using System;
    +using System.Diagnostics;
    +using SWGSDRangel.Api;
    +using SWGSDRangel.Client;
    +using SWGSDRangel.Model;
    +
    +namespace Example
    +{
    +    public class devicesetDeviceSettingsPatchExample
    +    {
    +        public void main()
    +        {
    +            
    +            var apiInstance = new DeviceSetApi();
    +            var deviceSetIndex = 56;  // Integer | Index of device set in the device set list
    +            var body = new DeviceSettings(); // DeviceSettings | Device settings to apply
    +
    +            try
    +            {
    +                DeviceSettings result = apiInstance.devicesetDeviceSettingsPatch(deviceSetIndex, body);
    +                Debug.WriteLine(result);
    +            }
    +            catch (Exception e)
    +            {
    +                Debug.Print("Exception when calling DeviceSetApi.devicesetDeviceSettingsPatch: " + e.Message );
    +            }
    +        }
    +    }
    +}
    +
    +
    + +
    +
    <?php
    +require_once(__DIR__ . '/vendor/autoload.php');
    +
    +$api_instance = new Swagger\Client\Api\DeviceSetApi();
    +$deviceSetIndex = 56; // Integer | Index of device set in the device set list
    +$body = ; // DeviceSettings | Device settings to apply
    +
    +try {
    +    $result = $api_instance->devicesetDeviceSettingsPatch($deviceSetIndex, $body);
    +    print_r($result);
    +} catch (Exception $e) {
    +    echo 'Exception when calling DeviceSetApi->devicesetDeviceSettingsPatch: ', $e->getMessage(), PHP_EOL;
    +}
    +?>
    +
    + +
    +
    use Data::Dumper;
    +use SWGSDRangel::Configuration;
    +use SWGSDRangel::DeviceSetApi;
    +
    +my $api_instance = SWGSDRangel::DeviceSetApi->new();
    +my $deviceSetIndex = 56; # Integer | Index of device set in the device set list
    +my $body = SWGSDRangel::Object::DeviceSettings->new(); # DeviceSettings | Device settings to apply
    +
    +eval { 
    +    my $result = $api_instance->devicesetDeviceSettingsPatch(deviceSetIndex => $deviceSetIndex, body => $body);
    +    print Dumper($result);
    +};
    +if ($@) {
    +    warn "Exception when calling DeviceSetApi->devicesetDeviceSettingsPatch: $@\n";
    +}
    +
    + +
    +
    from __future__ import print_statement
    +import time
    +import swagger_sdrangel
    +from swagger_sdrangel.rest import ApiException
    +from pprint import pprint
    +
    +# create an instance of the API class
    +api_instance = swagger_sdrangel.DeviceSetApi()
    +deviceSetIndex = 56 # Integer | Index of device set in the device set list
    +body =  # DeviceSettings | Device settings to apply
    +
    +try: 
    +    api_response = api_instance.deviceset_device_settings_patch(deviceSetIndex, body)
    +    pprint(api_response)
    +except ApiException as e:
    +    print("Exception when calling DeviceSetApi->devicesetDeviceSettingsPatch: %s\n" % e)
    +
    +
    + +

    Parameters

    + +
    Path parameters
    + + + + + + + + + +
    NameDescription
    deviceSetIndex* + + +
    +
    +
    + + Integer + + +
    + Index of device set in the device set list +
    +
    +
    + Required +
    +
    +
    +
    + + +
    Body parameters
    + + + + + + + + + +
    NameDescription
    body * + + + +
    +
    + + + +

    Responses

    +

    Status: 200 - On success returns new settings values

    + + + +
    +
    +
    + +
    + +
    +
    + +

    Status: 404 - Invalid device set index or device not found

    + + + +
    +
    +
    + +
    + +
    +
    + +

    Status: 500 - Error

    + + + +
    +
    +
    + +
    + +
    +
    + +

    Status: 501 - Function not implemented

    + + + +
    +
    + +
    +
    +
    +
    +
    +
    +

    devicesetDeviceSettingsPut

    +

    +
    +
    +
    +

    +

    Apply all settings unconditionally (force)

    +

    +
    +
    /sdrangel/deviceset/{deviceSetIndex}/device/settings
    +

    +

    Usage and SDK Samples

    +

    + + +
    +
    +
    curl -X PUT "http://localhost:8091/sdrangel/deviceset/{deviceSetIndex}/device/settings"
    +
    +
    +
    import SWGSDRangel.*;
    +import SWGSDRangel.auth.*;
    +import SWGSDRangel.model.*;
    +import SWGSDRangel.api.DeviceSetApi;
    +
    +import java.io.File;
    +import java.util.*;
    +
    +public class DeviceSetApiExample {
    +
    +    public static void main(String[] args) {
    +        
    +        DeviceSetApi apiInstance = new DeviceSetApi();
    +        Integer deviceSetIndex = 56; // Integer | Index of device set in the device set list
    +        DeviceSettings body = ; // DeviceSettings | Device settings to apply
    +        try {
    +            DeviceSettings result = apiInstance.devicesetDeviceSettingsPut(deviceSetIndex, body);
    +            System.out.println(result);
    +        } catch (ApiException e) {
    +            System.err.println("Exception when calling DeviceSetApi#devicesetDeviceSettingsPut");
    +            e.printStackTrace();
    +        }
    +    }
    +}
    +
    + +
    +
    import SWGSDRangel.api.DeviceSetApi;
    +
    +public class DeviceSetApiExample {
    +
    +    public static void main(String[] args) {
    +        DeviceSetApi apiInstance = new DeviceSetApi();
    +        Integer deviceSetIndex = 56; // Integer | Index of device set in the device set list
    +        DeviceSettings body = ; // DeviceSettings | Device settings to apply
    +        try {
    +            DeviceSettings result = apiInstance.devicesetDeviceSettingsPut(deviceSetIndex, body);
    +            System.out.println(result);
    +        } catch (ApiException e) {
    +            System.err.println("Exception when calling DeviceSetApi#devicesetDeviceSettingsPut");
    +            e.printStackTrace();
    +        }
    +    }
    +}
    +
    + +
    +
    Integer *deviceSetIndex = 56; // Index of device set in the device set list
    +DeviceSettings *body = ; // Device settings to apply
    +
    +DeviceSetApi *apiInstance = [[DeviceSetApi alloc] init];
    +
    +[apiInstance devicesetDeviceSettingsPutWith:deviceSetIndex
    +    body:body
    +              completionHandler: ^(DeviceSettings output, NSError* error) {
    +                            if (output) {
    +                                NSLog(@"%@", output);
    +                            }
    +                            if (error) {
    +                                NSLog(@"Error: %@", error);
    +                            }
    +                        }];
    +
    +
    + +
    +
    var SdRangel = require('sd_rangel');
    +
    +var api = new SdRangel.DeviceSetApi()
    +
    +var deviceSetIndex = 56; // {Integer} Index of device set in the device set list
    +
    +var body = ; // {DeviceSettings} Device settings to apply
    +
    +
    +var callback = function(error, data, response) {
    +  if (error) {
    +    console.error(error);
    +  } else {
    +    console.log('API called successfully. Returned data: ' + data);
    +  }
    +};
    +api.devicesetDeviceSettingsPut(deviceSetIndex, body, callback);
    +
    +
    + + +
    +
    using System;
    +using System.Diagnostics;
    +using SWGSDRangel.Api;
    +using SWGSDRangel.Client;
    +using SWGSDRangel.Model;
    +
    +namespace Example
    +{
    +    public class devicesetDeviceSettingsPutExample
    +    {
    +        public void main()
    +        {
    +            
    +            var apiInstance = new DeviceSetApi();
    +            var deviceSetIndex = 56;  // Integer | Index of device set in the device set list
    +            var body = new DeviceSettings(); // DeviceSettings | Device settings to apply
    +
    +            try
    +            {
    +                DeviceSettings result = apiInstance.devicesetDeviceSettingsPut(deviceSetIndex, body);
    +                Debug.WriteLine(result);
    +            }
    +            catch (Exception e)
    +            {
    +                Debug.Print("Exception when calling DeviceSetApi.devicesetDeviceSettingsPut: " + e.Message );
    +            }
    +        }
    +    }
    +}
    +
    +
    + +
    +
    <?php
    +require_once(__DIR__ . '/vendor/autoload.php');
    +
    +$api_instance = new Swagger\Client\Api\DeviceSetApi();
    +$deviceSetIndex = 56; // Integer | Index of device set in the device set list
    +$body = ; // DeviceSettings | Device settings to apply
    +
    +try {
    +    $result = $api_instance->devicesetDeviceSettingsPut($deviceSetIndex, $body);
    +    print_r($result);
    +} catch (Exception $e) {
    +    echo 'Exception when calling DeviceSetApi->devicesetDeviceSettingsPut: ', $e->getMessage(), PHP_EOL;
    +}
    +?>
    +
    + +
    +
    use Data::Dumper;
    +use SWGSDRangel::Configuration;
    +use SWGSDRangel::DeviceSetApi;
    +
    +my $api_instance = SWGSDRangel::DeviceSetApi->new();
    +my $deviceSetIndex = 56; # Integer | Index of device set in the device set list
    +my $body = SWGSDRangel::Object::DeviceSettings->new(); # DeviceSettings | Device settings to apply
    +
    +eval { 
    +    my $result = $api_instance->devicesetDeviceSettingsPut(deviceSetIndex => $deviceSetIndex, body => $body);
    +    print Dumper($result);
    +};
    +if ($@) {
    +    warn "Exception when calling DeviceSetApi->devicesetDeviceSettingsPut: $@\n";
    +}
    +
    + +
    +
    from __future__ import print_statement
    +import time
    +import swagger_sdrangel
    +from swagger_sdrangel.rest import ApiException
    +from pprint import pprint
    +
    +# create an instance of the API class
    +api_instance = swagger_sdrangel.DeviceSetApi()
    +deviceSetIndex = 56 # Integer | Index of device set in the device set list
    +body =  # DeviceSettings | Device settings to apply
    +
    +try: 
    +    api_response = api_instance.deviceset_device_settings_put(deviceSetIndex, body)
    +    pprint(api_response)
    +except ApiException as e:
    +    print("Exception when calling DeviceSetApi->devicesetDeviceSettingsPut: %s\n" % e)
    +
    +
    + +

    Parameters

    + +
    Path parameters
    + + + + + + + + + +
    NameDescription
    deviceSetIndex* + + +
    +
    +
    + + Integer + + +
    + Index of device set in the device set list +
    +
    +
    + Required +
    +
    +
    +
    + + +
    Body parameters
    + + + + + + + + + +
    NameDescription
    body * + + + +
    +
    + + + +

    Responses

    +

    Status: 200 - On success returns new settings values

    + + + +
    +
    +
    + +
    + +
    +
    + +

    Status: 404 - Invalid device set index or device not found

    + + + +
    +
    +
    + +
    + +
    +
    + +

    Status: 500 - Error

    + + + +
    +
    +
    + +
    + +
    +
    + +

    Status: 501 - Function not implemented

    + + + +
    +
    + +
    +
    +
    @@ -9058,7 +10759,7 @@ except ApiException as e:
    - Generated 2017-12-06T21:52:02.995+01:00 + Generated 2017-12-06T23:48:11.127+01:00
    diff --git a/swagger/sdrangel/code/qt5/client/SWGDeviceSetApi.cpp b/swagger/sdrangel/code/qt5/client/SWGDeviceSetApi.cpp index fbe15fa6e..d75364cda 100644 --- a/swagger/sdrangel/code/qt5/client/SWGDeviceSetApi.cpp +++ b/swagger/sdrangel/code/qt5/client/SWGDeviceSetApi.cpp @@ -28,56 +28,6 @@ SWGDeviceSetApi::SWGDeviceSetApi(QString host, QString basePath) { this->basePath = basePath; } -void -SWGDeviceSetApi::devicesetDeviceGet(qint32 device_set_index) { - QString fullPath; - fullPath.append(this->host).append(this->basePath).append("/sdrangel/deviceset/{deviceSetIndex}/device/settings"); - - QString device_set_indexPathParam("{"); device_set_indexPathParam.append("deviceSetIndex").append("}"); - fullPath.replace(device_set_indexPathParam, stringValue(device_set_index)); - - - HttpRequestWorker *worker = new HttpRequestWorker(); - HttpRequestInput input(fullPath, "GET"); - - - - - - foreach(QString key, this->defaultHeaders.keys()) { - input.headers.insert(key, this->defaultHeaders.value(key)); - } - - connect(worker, - &HttpRequestWorker::on_execution_finished, - this, - &SWGDeviceSetApi::devicesetDeviceGetCallback); - - worker->execute(&input); -} - -void -SWGDeviceSetApi::devicesetDeviceGetCallback(HttpRequestWorker * worker) { - QString msg; - QString error_str = worker->error_str; - QNetworkReply::NetworkError error_type = worker->error_type; - - if (worker->error_type == QNetworkReply::NoError) { - msg = QString("Success! %1 bytes").arg(worker->response.length()); - } - else { - msg = "Error: " + worker->error_str; - } - - - QString json(worker->response); - SWGDeviceSettings* output = static_cast(create(json, QString("SWGDeviceSettings"))); - worker->deleteLater(); - - emit devicesetDeviceGetSignal(output); - emit devicesetDeviceGetSignalE(output, error_type, error_str); -} - void SWGDeviceSetApi::devicesetDevicePut(qint32 device_set_index, SWGDeviceListItem body) { QString fullPath; @@ -130,6 +80,260 @@ SWGDeviceSetApi::devicesetDevicePutCallback(HttpRequestWorker * worker) { emit devicesetDevicePutSignalE(output, error_type, error_str); } +void +SWGDeviceSetApi::devicesetDeviceRunDelete(qint32 device_set_index) { + QString fullPath; + fullPath.append(this->host).append(this->basePath).append("/sdrangel/deviceset/{deviceSetIndex}/device/run"); + + QString device_set_indexPathParam("{"); device_set_indexPathParam.append("deviceSetIndex").append("}"); + fullPath.replace(device_set_indexPathParam, stringValue(device_set_index)); + + + HttpRequestWorker *worker = new HttpRequestWorker(); + HttpRequestInput input(fullPath, "DELETE"); + + + + + + foreach(QString key, this->defaultHeaders.keys()) { + input.headers.insert(key, this->defaultHeaders.value(key)); + } + + connect(worker, + &HttpRequestWorker::on_execution_finished, + this, + &SWGDeviceSetApi::devicesetDeviceRunDeleteCallback); + + worker->execute(&input); +} + +void +SWGDeviceSetApi::devicesetDeviceRunDeleteCallback(HttpRequestWorker * worker) { + QString msg; + QString error_str = worker->error_str; + QNetworkReply::NetworkError error_type = worker->error_type; + + if (worker->error_type == QNetworkReply::NoError) { + msg = QString("Success! %1 bytes").arg(worker->response.length()); + } + else { + msg = "Error: " + worker->error_str; + } + + + QString json(worker->response); + SWGDeviceState* output = static_cast(create(json, QString("SWGDeviceState"))); + worker->deleteLater(); + + emit devicesetDeviceRunDeleteSignal(output); + emit devicesetDeviceRunDeleteSignalE(output, error_type, error_str); +} + +void +SWGDeviceSetApi::devicesetDeviceRunPost(qint32 device_set_index) { + QString fullPath; + fullPath.append(this->host).append(this->basePath).append("/sdrangel/deviceset/{deviceSetIndex}/device/run"); + + QString device_set_indexPathParam("{"); device_set_indexPathParam.append("deviceSetIndex").append("}"); + fullPath.replace(device_set_indexPathParam, stringValue(device_set_index)); + + + HttpRequestWorker *worker = new HttpRequestWorker(); + HttpRequestInput input(fullPath, "POST"); + + + + + + foreach(QString key, this->defaultHeaders.keys()) { + input.headers.insert(key, this->defaultHeaders.value(key)); + } + + connect(worker, + &HttpRequestWorker::on_execution_finished, + this, + &SWGDeviceSetApi::devicesetDeviceRunPostCallback); + + worker->execute(&input); +} + +void +SWGDeviceSetApi::devicesetDeviceRunPostCallback(HttpRequestWorker * worker) { + QString msg; + QString error_str = worker->error_str; + QNetworkReply::NetworkError error_type = worker->error_type; + + if (worker->error_type == QNetworkReply::NoError) { + msg = QString("Success! %1 bytes").arg(worker->response.length()); + } + else { + msg = "Error: " + worker->error_str; + } + + + QString json(worker->response); + SWGDeviceState* output = static_cast(create(json, QString("SWGDeviceState"))); + worker->deleteLater(); + + emit devicesetDeviceRunPostSignal(output); + emit devicesetDeviceRunPostSignalE(output, error_type, error_str); +} + +void +SWGDeviceSetApi::devicesetDeviceSettingsGet(qint32 device_set_index) { + QString fullPath; + fullPath.append(this->host).append(this->basePath).append("/sdrangel/deviceset/{deviceSetIndex}/device/settings"); + + QString device_set_indexPathParam("{"); device_set_indexPathParam.append("deviceSetIndex").append("}"); + fullPath.replace(device_set_indexPathParam, stringValue(device_set_index)); + + + HttpRequestWorker *worker = new HttpRequestWorker(); + HttpRequestInput input(fullPath, "GET"); + + + + + + foreach(QString key, this->defaultHeaders.keys()) { + input.headers.insert(key, this->defaultHeaders.value(key)); + } + + connect(worker, + &HttpRequestWorker::on_execution_finished, + this, + &SWGDeviceSetApi::devicesetDeviceSettingsGetCallback); + + worker->execute(&input); +} + +void +SWGDeviceSetApi::devicesetDeviceSettingsGetCallback(HttpRequestWorker * worker) { + QString msg; + QString error_str = worker->error_str; + QNetworkReply::NetworkError error_type = worker->error_type; + + if (worker->error_type == QNetworkReply::NoError) { + msg = QString("Success! %1 bytes").arg(worker->response.length()); + } + else { + msg = "Error: " + worker->error_str; + } + + + QString json(worker->response); + SWGDeviceSettings* output = static_cast(create(json, QString("SWGDeviceSettings"))); + worker->deleteLater(); + + emit devicesetDeviceSettingsGetSignal(output); + emit devicesetDeviceSettingsGetSignalE(output, error_type, error_str); +} + +void +SWGDeviceSetApi::devicesetDeviceSettingsPatch(qint32 device_set_index, SWGDeviceSettings body) { + QString fullPath; + fullPath.append(this->host).append(this->basePath).append("/sdrangel/deviceset/{deviceSetIndex}/device/settings"); + + QString device_set_indexPathParam("{"); device_set_indexPathParam.append("deviceSetIndex").append("}"); + fullPath.replace(device_set_indexPathParam, stringValue(device_set_index)); + + + HttpRequestWorker *worker = new HttpRequestWorker(); + HttpRequestInput input(fullPath, "PATCH"); + + + QString output = body.asJson(); + input.request_body.append(output); + + + + foreach(QString key, this->defaultHeaders.keys()) { + input.headers.insert(key, this->defaultHeaders.value(key)); + } + + connect(worker, + &HttpRequestWorker::on_execution_finished, + this, + &SWGDeviceSetApi::devicesetDeviceSettingsPatchCallback); + + worker->execute(&input); +} + +void +SWGDeviceSetApi::devicesetDeviceSettingsPatchCallback(HttpRequestWorker * worker) { + QString msg; + QString error_str = worker->error_str; + QNetworkReply::NetworkError error_type = worker->error_type; + + if (worker->error_type == QNetworkReply::NoError) { + msg = QString("Success! %1 bytes").arg(worker->response.length()); + } + else { + msg = "Error: " + worker->error_str; + } + + + QString json(worker->response); + SWGDeviceSettings* output = static_cast(create(json, QString("SWGDeviceSettings"))); + worker->deleteLater(); + + emit devicesetDeviceSettingsPatchSignal(output); + emit devicesetDeviceSettingsPatchSignalE(output, error_type, error_str); +} + +void +SWGDeviceSetApi::devicesetDeviceSettingsPut(qint32 device_set_index, SWGDeviceSettings body) { + QString fullPath; + fullPath.append(this->host).append(this->basePath).append("/sdrangel/deviceset/{deviceSetIndex}/device/settings"); + + QString device_set_indexPathParam("{"); device_set_indexPathParam.append("deviceSetIndex").append("}"); + fullPath.replace(device_set_indexPathParam, stringValue(device_set_index)); + + + HttpRequestWorker *worker = new HttpRequestWorker(); + HttpRequestInput input(fullPath, "PUT"); + + + QString output = body.asJson(); + input.request_body.append(output); + + + + foreach(QString key, this->defaultHeaders.keys()) { + input.headers.insert(key, this->defaultHeaders.value(key)); + } + + connect(worker, + &HttpRequestWorker::on_execution_finished, + this, + &SWGDeviceSetApi::devicesetDeviceSettingsPutCallback); + + worker->execute(&input); +} + +void +SWGDeviceSetApi::devicesetDeviceSettingsPutCallback(HttpRequestWorker * worker) { + QString msg; + QString error_str = worker->error_str; + QNetworkReply::NetworkError error_type = worker->error_type; + + if (worker->error_type == QNetworkReply::NoError) { + msg = QString("Success! %1 bytes").arg(worker->response.length()); + } + else { + msg = "Error: " + worker->error_str; + } + + + QString json(worker->response); + SWGDeviceSettings* output = static_cast(create(json, QString("SWGDeviceSettings"))); + worker->deleteLater(); + + emit devicesetDeviceSettingsPutSignal(output); + emit devicesetDeviceSettingsPutSignalE(output, error_type, error_str); +} + void SWGDeviceSetApi::devicesetGet(qint32 device_set_index) { QString fullPath; diff --git a/swagger/sdrangel/code/qt5/client/SWGDeviceSetApi.h b/swagger/sdrangel/code/qt5/client/SWGDeviceSetApi.h index 0d0ff1dee..79e7ea030 100644 --- a/swagger/sdrangel/code/qt5/client/SWGDeviceSetApi.h +++ b/swagger/sdrangel/code/qt5/client/SWGDeviceSetApi.h @@ -18,6 +18,7 @@ #include "SWGDeviceListItem.h" #include "SWGDeviceSet.h" #include "SWGDeviceSettings.h" +#include "SWGDeviceState.h" #include "SWGErrorResponse.h" #include @@ -36,22 +37,38 @@ public: QString basePath; QMap defaultHeaders; - void devicesetDeviceGet(qint32 device_set_index); void devicesetDevicePut(qint32 device_set_index, SWGDeviceListItem body); + void devicesetDeviceRunDelete(qint32 device_set_index); + void devicesetDeviceRunPost(qint32 device_set_index); + void devicesetDeviceSettingsGet(qint32 device_set_index); + void devicesetDeviceSettingsPatch(qint32 device_set_index, SWGDeviceSettings body); + void devicesetDeviceSettingsPut(qint32 device_set_index, SWGDeviceSettings body); void devicesetGet(qint32 device_set_index); private: - void devicesetDeviceGetCallback (HttpRequestWorker * worker); void devicesetDevicePutCallback (HttpRequestWorker * worker); + void devicesetDeviceRunDeleteCallback (HttpRequestWorker * worker); + void devicesetDeviceRunPostCallback (HttpRequestWorker * worker); + void devicesetDeviceSettingsGetCallback (HttpRequestWorker * worker); + void devicesetDeviceSettingsPatchCallback (HttpRequestWorker * worker); + void devicesetDeviceSettingsPutCallback (HttpRequestWorker * worker); void devicesetGetCallback (HttpRequestWorker * worker); signals: - void devicesetDeviceGetSignal(SWGDeviceSettings* summary); void devicesetDevicePutSignal(SWGDeviceListItem* summary); + void devicesetDeviceRunDeleteSignal(SWGDeviceState* summary); + void devicesetDeviceRunPostSignal(SWGDeviceState* summary); + void devicesetDeviceSettingsGetSignal(SWGDeviceSettings* summary); + void devicesetDeviceSettingsPatchSignal(SWGDeviceSettings* summary); + void devicesetDeviceSettingsPutSignal(SWGDeviceSettings* summary); void devicesetGetSignal(SWGDeviceSet* summary); - void devicesetDeviceGetSignalE(SWGDeviceSettings* summary, QNetworkReply::NetworkError error_type, QString& error_str); void devicesetDevicePutSignalE(SWGDeviceListItem* summary, QNetworkReply::NetworkError error_type, QString& error_str); + void devicesetDeviceRunDeleteSignalE(SWGDeviceState* summary, QNetworkReply::NetworkError error_type, QString& error_str); + void devicesetDeviceRunPostSignalE(SWGDeviceState* summary, QNetworkReply::NetworkError error_type, QString& error_str); + void devicesetDeviceSettingsGetSignalE(SWGDeviceSettings* summary, QNetworkReply::NetworkError error_type, QString& error_str); + void devicesetDeviceSettingsPatchSignalE(SWGDeviceSettings* summary, QNetworkReply::NetworkError error_type, QString& error_str); + void devicesetDeviceSettingsPutSignalE(SWGDeviceSettings* summary, QNetworkReply::NetworkError error_type, QString& error_str); void devicesetGetSignalE(SWGDeviceSet* summary, QNetworkReply::NetworkError error_type, QString& error_str); }; diff --git a/swagger/sdrangel/code/qt5/client/SWGDeviceState.cpp b/swagger/sdrangel/code/qt5/client/SWGDeviceState.cpp new file mode 100644 index 000000000..1d8ee2088 --- /dev/null +++ b/swagger/sdrangel/code/qt5/client/SWGDeviceState.cpp @@ -0,0 +1,95 @@ +/** + * SDRangel + * This is the web API of SDRangel SDR software. SDRangel is an Open Source Qt5/OpenGL 3.0+ GUI and server Software Defined Radio and signal analyzer in software. It supports Airspy, BladeRF, HackRF, LimeSDR, PlutoSDR, RTL-SDR, SDRplay RSP1 and FunCube + * + * OpenAPI spec version: 4.0.0 + * Contact: f4exb06@gmail.com + * + * NOTE: This class is auto generated by the swagger code generator program. + * https://github.com/swagger-api/swagger-codegen.git + * Do not edit the class manually. + */ + + +#include "SWGDeviceState.h" + +#include "SWGHelpers.h" + +#include +#include +#include +#include + +namespace SWGSDRangel { + +SWGDeviceState::SWGDeviceState(QString* json) { + init(); + this->fromJson(*json); +} + +SWGDeviceState::SWGDeviceState() { + init(); +} + +SWGDeviceState::~SWGDeviceState() { + this->cleanup(); +} + +void +SWGDeviceState::init() { + state = new QString(""); +} + +void +SWGDeviceState::cleanup() { + + if(state != nullptr) { + delete state; + } +} + +SWGDeviceState* +SWGDeviceState::fromJson(QString &json) { + QByteArray array (json.toStdString().c_str()); + QJsonDocument doc = QJsonDocument::fromJson(array); + QJsonObject jsonObject = doc.object(); + this->fromJsonObject(jsonObject); + return this; +} + +void +SWGDeviceState::fromJsonObject(QJsonObject &pJson) { + ::SWGSDRangel::setValue(&state, pJson["state"], "QString", "QString"); +} + +QString +SWGDeviceState::asJson () +{ + QJsonObject* obj = this->asJsonObject(); + + QJsonDocument doc(*obj); + QByteArray bytes = doc.toJson(); + return QString(bytes); +} + +QJsonObject* +SWGDeviceState::asJsonObject() { + QJsonObject* obj = new QJsonObject(); + + toJsonValue(QString("state"), state, obj, QString("QString")); + + return obj; +} + +QString* +SWGDeviceState::getState() { + return state; +} +void +SWGDeviceState::setState(QString* state) { + this->state = state; +} + + +} + diff --git a/swagger/sdrangel/code/qt5/client/SWGDeviceState.h b/swagger/sdrangel/code/qt5/client/SWGDeviceState.h new file mode 100644 index 000000000..9bbb6a788 --- /dev/null +++ b/swagger/sdrangel/code/qt5/client/SWGDeviceState.h @@ -0,0 +1,55 @@ +/** + * SDRangel + * This is the web API of SDRangel SDR software. SDRangel is an Open Source Qt5/OpenGL 3.0+ GUI and server Software Defined Radio and signal analyzer in software. It supports Airspy, BladeRF, HackRF, LimeSDR, PlutoSDR, RTL-SDR, SDRplay RSP1 and FunCube + * + * OpenAPI spec version: 4.0.0 + * Contact: f4exb06@gmail.com + * + * NOTE: This class is auto generated by the swagger code generator program. + * https://github.com/swagger-api/swagger-codegen.git + * Do not edit the class manually. + */ + +/* + * SWGDeviceState.h + * + * Device running state + */ + +#ifndef SWGDeviceState_H_ +#define SWGDeviceState_H_ + +#include + + +#include + +#include "SWGObject.h" + + +namespace SWGSDRangel { + +class SWGDeviceState: public SWGObject { +public: + SWGDeviceState(); + SWGDeviceState(QString* json); + virtual ~SWGDeviceState(); + void init(); + void cleanup(); + + QString asJson (); + QJsonObject* asJsonObject(); + void fromJsonObject(QJsonObject &json); + SWGDeviceState* fromJson(QString &jsonString); + + QString* getState(); + void setState(QString* state); + + +private: + QString* state; +}; + +} + +#endif /* SWGDeviceState_H_ */ diff --git a/swagger/sdrangel/code/qt5/client/SWGModelFactory.h b/swagger/sdrangel/code/qt5/client/SWGModelFactory.h index e4044fcc6..f6eb5be3e 100644 --- a/swagger/sdrangel/code/qt5/client/SWGModelFactory.h +++ b/swagger/sdrangel/code/qt5/client/SWGModelFactory.h @@ -25,6 +25,7 @@ #include "SWGDeviceSet.h" #include "SWGDeviceSetList.h" #include "SWGDeviceSettings.h" +#include "SWGDeviceState.h" #include "SWGErrorResponse.h" #include "SWGFileSourceSettings.h" #include "SWGInstanceChannelsResponse.h" @@ -78,6 +79,9 @@ namespace SWGSDRangel { if(QString("SWGDeviceSettings").compare(type) == 0) { return new SWGDeviceSettings(); } + if(QString("SWGDeviceState").compare(type) == 0) { + return new SWGDeviceState(); + } if(QString("SWGErrorResponse").compare(type) == 0) { return new SWGErrorResponse(); }