diff --git a/sdrbase/resources/webapi/doc/html2/index.html b/sdrbase/resources/webapi/doc/html2/index.html index 3cb284e88..ad92d4307 100644 --- a/sdrbase/resources/webapi/doc/html2/index.html +++ b/sdrbase/resources/webapi/doc/html2/index.html @@ -12631,6 +12631,15 @@ margin-bottom: 20px;
  • featuresetGet
  • +
  • + featuresetPresetPatch +
  • +
  • + featuresetPresetPost +
  • +
  • + featuresetPresetPut +
  • instanceFeatureSetDelete
  • @@ -32671,6 +32680,1588 @@ except ApiException as e:
    +
    +
    +
    +

    featuresetPresetPatch

    +

    +
    +
    +
    +

    +

    Load a preset in a feature set

    +

    +
    +
    /sdrangel/featureset/{featureSetIndex}/preset
    +

    +

    Usage and SDK Samples

    +

    + + +
    +
    +
    curl -X PATCH "http://localhost/sdrangel/featureset/{featureSetIndex}/preset"
    +
    +
    +
    import SWGSDRangel.*;
    +import SWGSDRangel.auth.*;
    +import SWGSDRangel.model.*;
    +import SWGSDRangel.api.FeatureSetApi;
    +
    +import java.io.File;
    +import java.util.*;
    +
    +public class FeatureSetApiExample {
    +
    +    public static void main(String[] args) {
    +        
    +        FeatureSetApi apiInstance = new FeatureSetApi();
    +        Integer featureSetIndex = 56; // Integer | Index of feature set in the feature set list
    +        FeaturePresetIdentifier body = ; // FeaturePresetIdentifier | Load preset settings to the feature set
    +        try {
    +            FeaturePresetIdentifier result = apiInstance.featuresetPresetPatch(featureSetIndex, body);
    +            System.out.println(result);
    +        } catch (ApiException e) {
    +            System.err.println("Exception when calling FeatureSetApi#featuresetPresetPatch");
    +            e.printStackTrace();
    +        }
    +    }
    +}
    +
    + +
    +
    import SWGSDRangel.api.FeatureSetApi;
    +
    +public class FeatureSetApiExample {
    +
    +    public static void main(String[] args) {
    +        FeatureSetApi apiInstance = new FeatureSetApi();
    +        Integer featureSetIndex = 56; // Integer | Index of feature set in the feature set list
    +        FeaturePresetIdentifier body = ; // FeaturePresetIdentifier | Load preset settings to the feature set
    +        try {
    +            FeaturePresetIdentifier result = apiInstance.featuresetPresetPatch(featureSetIndex, body);
    +            System.out.println(result);
    +        } catch (ApiException e) {
    +            System.err.println("Exception when calling FeatureSetApi#featuresetPresetPatch");
    +            e.printStackTrace();
    +        }
    +    }
    +}
    +
    + +
    +
    Integer *featureSetIndex = 56; // Index of feature set in the feature set list
    +FeaturePresetIdentifier *body = ; // Load preset settings to the feature set
    +
    +FeatureSetApi *apiInstance = [[FeatureSetApi alloc] init];
    +
    +[apiInstance featuresetPresetPatchWith:featureSetIndex
    +    body:body
    +              completionHandler: ^(FeaturePresetIdentifier output, NSError* error) {
    +                            if (output) {
    +                                NSLog(@"%@", output);
    +                            }
    +                            if (error) {
    +                                NSLog(@"Error: %@", error);
    +                            }
    +                        }];
    +
    +
    + +
    +
    var SdRangel = require('sd_rangel');
    +
    +var api = new SdRangel.FeatureSetApi()
    +
    +var featureSetIndex = 56; // {Integer} Index of feature set in the feature set list
    +
    +var body = ; // {FeaturePresetIdentifier} Load preset settings to the feature set
    +
    +
    +var callback = function(error, data, response) {
    +  if (error) {
    +    console.error(error);
    +  } else {
    +    console.log('API called successfully. Returned data: ' + data);
    +  }
    +};
    +api.featuresetPresetPatch(featureSetIndex, body, callback);
    +
    +
    + + +
    +
    using System;
    +using System.Diagnostics;
    +using SWGSDRangel.Api;
    +using SWGSDRangel.Client;
    +using SWGSDRangel.Model;
    +
    +namespace Example
    +{
    +    public class featuresetPresetPatchExample
    +    {
    +        public void main()
    +        {
    +            
    +            var apiInstance = new FeatureSetApi();
    +            var featureSetIndex = 56;  // Integer | Index of feature set in the feature set list
    +            var body = new FeaturePresetIdentifier(); // FeaturePresetIdentifier | Load preset settings to the feature set
    +
    +            try
    +            {
    +                FeaturePresetIdentifier result = apiInstance.featuresetPresetPatch(featureSetIndex, body);
    +                Debug.WriteLine(result);
    +            }
    +            catch (Exception e)
    +            {
    +                Debug.Print("Exception when calling FeatureSetApi.featuresetPresetPatch: " + e.Message );
    +            }
    +        }
    +    }
    +}
    +
    +
    + +
    +
    <?php
    +require_once(__DIR__ . '/vendor/autoload.php');
    +
    +$api_instance = new Swagger\Client\Api\FeatureSetApi();
    +$featureSetIndex = 56; // Integer | Index of feature set in the feature set list
    +$body = ; // FeaturePresetIdentifier | Load preset settings to the feature set
    +
    +try {
    +    $result = $api_instance->featuresetPresetPatch($featureSetIndex, $body);
    +    print_r($result);
    +} catch (Exception $e) {
    +    echo 'Exception when calling FeatureSetApi->featuresetPresetPatch: ', $e->getMessage(), PHP_EOL;
    +}
    +?>
    +
    + +
    +
    use Data::Dumper;
    +use SWGSDRangel::Configuration;
    +use SWGSDRangel::FeatureSetApi;
    +
    +my $api_instance = SWGSDRangel::FeatureSetApi->new();
    +my $featureSetIndex = 56; # Integer | Index of feature set in the feature set list
    +my $body = SWGSDRangel::Object::FeaturePresetIdentifier->new(); # FeaturePresetIdentifier | Load preset settings to the feature set
    +
    +eval { 
    +    my $result = $api_instance->featuresetPresetPatch(featureSetIndex => $featureSetIndex, body => $body);
    +    print Dumper($result);
    +};
    +if ($@) {
    +    warn "Exception when calling FeatureSetApi->featuresetPresetPatch: $@\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.FeatureSetApi()
    +featureSetIndex = 56 # Integer | Index of feature set in the feature set list
    +body =  # FeaturePresetIdentifier | Load preset settings to the feature set
    +
    +try: 
    +    api_response = api_instance.featureset_preset_patch(featureSetIndex, body)
    +    pprint(api_response)
    +except ApiException as e:
    +    print("Exception when calling FeatureSetApi->featuresetPresetPatch: %s\n" % e)
    +
    +
    + +

    Parameters

    + +
    Path parameters
    + + + + + + + + + +
    NameDescription
    featureSetIndex* + + +
    +
    +
    + + Integer + + +
    + Index of feature set in the feature set list +
    +
    +
    + Required +
    +
    +
    +
    + + +
    Body parameters
    + + + + + + + + + +
    NameDescription
    body * + + + +
    +
    + + + +

    Responses

    +

    Status: 202 - On successful sending of the message the selected preset identification is returned

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

    Status: 400 - Invalid JSON request

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

    Status: 404 - No preset or feature set found

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

    Status: 500 - Error

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

    Status: 501 - Function not implemented

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

    featuresetPresetPost

    +

    +
    +
    +
    +

    +

    Create a new preset from a feature set settings.

    +

    +
    +
    /sdrangel/featureset/{featureSetIndex}/preset
    +

    +

    Usage and SDK Samples

    +

    + + +
    +
    +
    curl -X POST "http://localhost/sdrangel/featureset/{featureSetIndex}/preset"
    +
    +
    +
    import SWGSDRangel.*;
    +import SWGSDRangel.auth.*;
    +import SWGSDRangel.model.*;
    +import SWGSDRangel.api.FeatureSetApi;
    +
    +import java.io.File;
    +import java.util.*;
    +
    +public class FeatureSetApiExample {
    +
    +    public static void main(String[] args) {
    +        
    +        FeatureSetApi apiInstance = new FeatureSetApi();
    +        Integer featureSetIndex = 56; // Integer | Index of feature set in the feature set list
    +        FeaturePresetIdentifier body = ; // FeaturePresetIdentifier | save feature set settings on a new preset
    +        try {
    +            PresetIdentifier result = apiInstance.featuresetPresetPost(featureSetIndex, body);
    +            System.out.println(result);
    +        } catch (ApiException e) {
    +            System.err.println("Exception when calling FeatureSetApi#featuresetPresetPost");
    +            e.printStackTrace();
    +        }
    +    }
    +}
    +
    + +
    +
    import SWGSDRangel.api.FeatureSetApi;
    +
    +public class FeatureSetApiExample {
    +
    +    public static void main(String[] args) {
    +        FeatureSetApi apiInstance = new FeatureSetApi();
    +        Integer featureSetIndex = 56; // Integer | Index of feature set in the feature set list
    +        FeaturePresetIdentifier body = ; // FeaturePresetIdentifier | save feature set settings on a new preset
    +        try {
    +            PresetIdentifier result = apiInstance.featuresetPresetPost(featureSetIndex, body);
    +            System.out.println(result);
    +        } catch (ApiException e) {
    +            System.err.println("Exception when calling FeatureSetApi#featuresetPresetPost");
    +            e.printStackTrace();
    +        }
    +    }
    +}
    +
    + +
    +
    Integer *featureSetIndex = 56; // Index of feature set in the feature set list
    +FeaturePresetIdentifier *body = ; // save feature set settings on a new preset
    +
    +FeatureSetApi *apiInstance = [[FeatureSetApi alloc] init];
    +
    +[apiInstance featuresetPresetPostWith:featureSetIndex
    +    body:body
    +              completionHandler: ^(PresetIdentifier output, NSError* error) {
    +                            if (output) {
    +                                NSLog(@"%@", output);
    +                            }
    +                            if (error) {
    +                                NSLog(@"Error: %@", error);
    +                            }
    +                        }];
    +
    +
    + +
    +
    var SdRangel = require('sd_rangel');
    +
    +var api = new SdRangel.FeatureSetApi()
    +
    +var featureSetIndex = 56; // {Integer} Index of feature set in the feature set list
    +
    +var body = ; // {FeaturePresetIdentifier} save feature set settings on a new preset
    +
    +
    +var callback = function(error, data, response) {
    +  if (error) {
    +    console.error(error);
    +  } else {
    +    console.log('API called successfully. Returned data: ' + data);
    +  }
    +};
    +api.featuresetPresetPost(featureSetIndex, body, callback);
    +
    +
    + + +
    +
    using System;
    +using System.Diagnostics;
    +using SWGSDRangel.Api;
    +using SWGSDRangel.Client;
    +using SWGSDRangel.Model;
    +
    +namespace Example
    +{
    +    public class featuresetPresetPostExample
    +    {
    +        public void main()
    +        {
    +            
    +            var apiInstance = new FeatureSetApi();
    +            var featureSetIndex = 56;  // Integer | Index of feature set in the feature set list
    +            var body = new FeaturePresetIdentifier(); // FeaturePresetIdentifier | save feature set settings on a new preset
    +
    +            try
    +            {
    +                PresetIdentifier result = apiInstance.featuresetPresetPost(featureSetIndex, body);
    +                Debug.WriteLine(result);
    +            }
    +            catch (Exception e)
    +            {
    +                Debug.Print("Exception when calling FeatureSetApi.featuresetPresetPost: " + e.Message );
    +            }
    +        }
    +    }
    +}
    +
    +
    + +
    +
    <?php
    +require_once(__DIR__ . '/vendor/autoload.php');
    +
    +$api_instance = new Swagger\Client\Api\FeatureSetApi();
    +$featureSetIndex = 56; // Integer | Index of feature set in the feature set list
    +$body = ; // FeaturePresetIdentifier | save feature set settings on a new preset
    +
    +try {
    +    $result = $api_instance->featuresetPresetPost($featureSetIndex, $body);
    +    print_r($result);
    +} catch (Exception $e) {
    +    echo 'Exception when calling FeatureSetApi->featuresetPresetPost: ', $e->getMessage(), PHP_EOL;
    +}
    +?>
    +
    + +
    +
    use Data::Dumper;
    +use SWGSDRangel::Configuration;
    +use SWGSDRangel::FeatureSetApi;
    +
    +my $api_instance = SWGSDRangel::FeatureSetApi->new();
    +my $featureSetIndex = 56; # Integer | Index of feature set in the feature set list
    +my $body = SWGSDRangel::Object::FeaturePresetIdentifier->new(); # FeaturePresetIdentifier | save feature set settings on a new preset
    +
    +eval { 
    +    my $result = $api_instance->featuresetPresetPost(featureSetIndex => $featureSetIndex, body => $body);
    +    print Dumper($result);
    +};
    +if ($@) {
    +    warn "Exception when calling FeatureSetApi->featuresetPresetPost: $@\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.FeatureSetApi()
    +featureSetIndex = 56 # Integer | Index of feature set in the feature set list
    +body =  # FeaturePresetIdentifier | save feature set settings on a new preset
    +
    +try: 
    +    api_response = api_instance.featureset_preset_post(featureSetIndex, body)
    +    pprint(api_response)
    +except ApiException as e:
    +    print("Exception when calling FeatureSetApi->featuresetPresetPost: %s\n" % e)
    +
    +
    + +

    Parameters

    + +
    Path parameters
    + + + + + + + + + +
    NameDescription
    featureSetIndex* + + +
    +
    +
    + + Integer + + +
    + Index of feature set in the feature set list +
    +
    +
    + Required +
    +
    +
    +
    + + +
    Body parameters
    + + + + + + + + + +
    NameDescription
    body * + + + +
    +
    + + + +

    Responses

    +

    Status: 202 - On successful sending of the message the created preset identification is returned

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

    Status: 400 - Invalid JSON request

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

    Status: 404 - Feature set not found

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

    Status: 409 - Preset already exists

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

    Status: 500 - Error

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

    Status: 501 - Function not implemented

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

    featuresetPresetPut

    +

    +
    +
    +
    +

    +

    Update an existing preset with feature set settings.

    +

    +
    +
    /sdrangel/featureset/{featureSetIndex}/preset
    +

    +

    Usage and SDK Samples

    +

    + + +
    +
    +
    curl -X PUT "http://localhost/sdrangel/featureset/{featureSetIndex}/preset"
    +
    +
    +
    import SWGSDRangel.*;
    +import SWGSDRangel.auth.*;
    +import SWGSDRangel.model.*;
    +import SWGSDRangel.api.FeatureSetApi;
    +
    +import java.io.File;
    +import java.util.*;
    +
    +public class FeatureSetApiExample {
    +
    +    public static void main(String[] args) {
    +        
    +        FeatureSetApi apiInstance = new FeatureSetApi();
    +        Integer featureSetIndex = 56; // Integer | Index of feature set in the feature set list
    +        FeaturePresetIdentifier body = ; // FeaturePresetIdentifier | save feature set settings to the preset
    +        try {
    +            FeaturePresetIdentifier result = apiInstance.featuresetPresetPut(featureSetIndex, body);
    +            System.out.println(result);
    +        } catch (ApiException e) {
    +            System.err.println("Exception when calling FeatureSetApi#featuresetPresetPut");
    +            e.printStackTrace();
    +        }
    +    }
    +}
    +
    + +
    +
    import SWGSDRangel.api.FeatureSetApi;
    +
    +public class FeatureSetApiExample {
    +
    +    public static void main(String[] args) {
    +        FeatureSetApi apiInstance = new FeatureSetApi();
    +        Integer featureSetIndex = 56; // Integer | Index of feature set in the feature set list
    +        FeaturePresetIdentifier body = ; // FeaturePresetIdentifier | save feature set settings to the preset
    +        try {
    +            FeaturePresetIdentifier result = apiInstance.featuresetPresetPut(featureSetIndex, body);
    +            System.out.println(result);
    +        } catch (ApiException e) {
    +            System.err.println("Exception when calling FeatureSetApi#featuresetPresetPut");
    +            e.printStackTrace();
    +        }
    +    }
    +}
    +
    + +
    +
    Integer *featureSetIndex = 56; // Index of feature set in the feature set list
    +FeaturePresetIdentifier *body = ; // save feature set settings to the preset
    +
    +FeatureSetApi *apiInstance = [[FeatureSetApi alloc] init];
    +
    +[apiInstance featuresetPresetPutWith:featureSetIndex
    +    body:body
    +              completionHandler: ^(FeaturePresetIdentifier output, NSError* error) {
    +                            if (output) {
    +                                NSLog(@"%@", output);
    +                            }
    +                            if (error) {
    +                                NSLog(@"Error: %@", error);
    +                            }
    +                        }];
    +
    +
    + +
    +
    var SdRangel = require('sd_rangel');
    +
    +var api = new SdRangel.FeatureSetApi()
    +
    +var featureSetIndex = 56; // {Integer} Index of feature set in the feature set list
    +
    +var body = ; // {FeaturePresetIdentifier} save feature set settings to the preset
    +
    +
    +var callback = function(error, data, response) {
    +  if (error) {
    +    console.error(error);
    +  } else {
    +    console.log('API called successfully. Returned data: ' + data);
    +  }
    +};
    +api.featuresetPresetPut(featureSetIndex, body, callback);
    +
    +
    + + +
    +
    using System;
    +using System.Diagnostics;
    +using SWGSDRangel.Api;
    +using SWGSDRangel.Client;
    +using SWGSDRangel.Model;
    +
    +namespace Example
    +{
    +    public class featuresetPresetPutExample
    +    {
    +        public void main()
    +        {
    +            
    +            var apiInstance = new FeatureSetApi();
    +            var featureSetIndex = 56;  // Integer | Index of feature set in the feature set list
    +            var body = new FeaturePresetIdentifier(); // FeaturePresetIdentifier | save feature set settings to the preset
    +
    +            try
    +            {
    +                FeaturePresetIdentifier result = apiInstance.featuresetPresetPut(featureSetIndex, body);
    +                Debug.WriteLine(result);
    +            }
    +            catch (Exception e)
    +            {
    +                Debug.Print("Exception when calling FeatureSetApi.featuresetPresetPut: " + e.Message );
    +            }
    +        }
    +    }
    +}
    +
    +
    + +
    +
    <?php
    +require_once(__DIR__ . '/vendor/autoload.php');
    +
    +$api_instance = new Swagger\Client\Api\FeatureSetApi();
    +$featureSetIndex = 56; // Integer | Index of feature set in the feature set list
    +$body = ; // FeaturePresetIdentifier | save feature set settings to the preset
    +
    +try {
    +    $result = $api_instance->featuresetPresetPut($featureSetIndex, $body);
    +    print_r($result);
    +} catch (Exception $e) {
    +    echo 'Exception when calling FeatureSetApi->featuresetPresetPut: ', $e->getMessage(), PHP_EOL;
    +}
    +?>
    +
    + +
    +
    use Data::Dumper;
    +use SWGSDRangel::Configuration;
    +use SWGSDRangel::FeatureSetApi;
    +
    +my $api_instance = SWGSDRangel::FeatureSetApi->new();
    +my $featureSetIndex = 56; # Integer | Index of feature set in the feature set list
    +my $body = SWGSDRangel::Object::FeaturePresetIdentifier->new(); # FeaturePresetIdentifier | save feature set settings to the preset
    +
    +eval { 
    +    my $result = $api_instance->featuresetPresetPut(featureSetIndex => $featureSetIndex, body => $body);
    +    print Dumper($result);
    +};
    +if ($@) {
    +    warn "Exception when calling FeatureSetApi->featuresetPresetPut: $@\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.FeatureSetApi()
    +featureSetIndex = 56 # Integer | Index of feature set in the feature set list
    +body =  # FeaturePresetIdentifier | save feature set settings to the preset
    +
    +try: 
    +    api_response = api_instance.featureset_preset_put(featureSetIndex, body)
    +    pprint(api_response)
    +except ApiException as e:
    +    print("Exception when calling FeatureSetApi->featuresetPresetPut: %s\n" % e)
    +
    +
    + +

    Parameters

    + +
    Path parameters
    + + + + + + + + + +
    NameDescription
    featureSetIndex* + + +
    +
    +
    + + Integer + + +
    + Index of feature set in the feature set list +
    +
    +
    + Required +
    +
    +
    +
    + + +
    Body parameters
    + + + + + + + + + +
    NameDescription
    body * + + + +
    +
    + + + +

    Responses

    +

    Status: 202 - On successful sending of the message the selected preset identification is returned

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

    Status: 400 - Invalid JSON request

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

    Status: 404 - No preset or feature set found

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

    Status: 500 - Error

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

    Status: 501 - Function not implemented

    + + + +
    +
    +
    + +
    + +
    +
    + +
    +
    +
    @@ -48985,7 +50576,7 @@ except ApiException as e:
    - Generated 2021-09-03T22:11:29.377+02:00 + Generated 2021-09-05T21:54:27.642+02:00
    diff --git a/sdrbase/resources/webapi/doc/swagger/swagger.yaml b/sdrbase/resources/webapi/doc/swagger/swagger.yaml index d6130d173..383200ea9 100644 --- a/sdrbase/resources/webapi/doc/swagger/swagger.yaml +++ b/sdrbase/resources/webapi/doc/swagger/swagger.yaml @@ -2040,6 +2040,121 @@ paths: "501": $ref: "#/responses/Response_501" + /sdrangel/featureset/{featureSetIndex}/preset: + x-swagger-router-controller: featureset + patch: + description: Load a preset in a feature set + operationId: featuresetPresetPatch + tags: + - FeatureSet + consumes: + - application/json + parameters: + - in: path + name: featureSetIndex + type: integer + required: true + description: Index of feature set in the feature set list + - name: body + in: body + description: Load preset settings to the feature set + required: true + schema: + $ref: "#/definitions/FeaturePresetIdentifier" + responses: + "202": + description: On successful sending of the message the selected preset identification is returned + schema: + $ref: "#/definitions/FeaturePresetIdentifier" + "400": + description: Invalid JSON request + schema: + $ref: "#/definitions/ErrorResponse" + "404": + description: No preset or feature set found + schema: + $ref: "#/definitions/ErrorResponse" + "500": + $ref: "#/responses/Response_500" + "501": + $ref: "#/responses/Response_501" + put: + description: Update an existing preset with feature set settings. + operationId: featuresetPresetPut + tags: + - FeatureSet + consumes: + - application/json + parameters: + - in: path + name: featureSetIndex + type: integer + required: true + description: Index of feature set in the feature set list + - name: body + in: body + description: save feature set settings to the preset + required: true + schema: + $ref: "#/definitions/FeaturePresetIdentifier" + responses: + "202": + description: On successful sending of the message the selected preset identification is returned + schema: + $ref: "#/definitions/FeaturePresetIdentifier" + "400": + description: Invalid JSON request + schema: + $ref: "#/definitions/ErrorResponse" + "404": + description: No preset or feature set found + schema: + $ref: "#/definitions/ErrorResponse" + "500": + $ref: "#/responses/Response_500" + "501": + $ref: "#/responses/Response_501" + post: + description: Create a new preset from a feature set settings. + operationId: featuresetPresetPost + tags: + - FeatureSet + consumes: + - application/json + parameters: + - in: path + name: featureSetIndex + type: integer + required: true + description: Index of feature set in the feature set list + - name: body + in: body + description: save feature set settings on a new preset + required: true + schema: + $ref: "#/definitions/FeaturePresetIdentifier" + responses: + "202": + description: On successful sending of the message the created preset identification is returned + schema: + $ref: "#/definitions/PresetIdentifier" + "400": + description: Invalid JSON request + schema: + $ref: "#/definitions/ErrorResponse" + "404": + description: Feature set not found + schema: + $ref: "#/definitions/ErrorResponse" + "409": + description: Preset already exists + schema: + $ref: "#/definitions/ErrorResponse" + "500": + $ref: "#/responses/Response_500" + "501": + $ref: "#/responses/Response_501" + /sdrangel/featureset/{featureSetIndex}/feature/{featureIndex}: x-swagger-router-controller: featureset delete: diff --git a/sdrbase/webapi/webapiadapter.cpp b/sdrbase/webapi/webapiadapter.cpp index 964499396..9201ae0f3 100644 --- a/sdrbase/webapi/webapiadapter.cpp +++ b/sdrbase/webapi/webapiadapter.cpp @@ -75,6 +75,7 @@ #include "SWGFeaturePresetGroup.h" #include "SWGFeaturePresetItem.h" #include "SWGFeaturePresetIdentifier.h" +#include "SWGFeaturePresetTransfer.h" #include "SWGFeatureSetList.h" #include "SWGFeatureSettings.h" #include "SWGFeatureReport.h" @@ -3165,6 +3166,109 @@ int WebAPIAdapter::featuresetFeatureRunDelete( } } +int WebAPIAdapter::featuresetPresetPatch( + int featureSetIndex, + SWGSDRangel::SWGFeaturePresetIdentifier& query, + SWGSDRangel::SWGErrorResponse& error) +{ + int nbFeatureSets = m_mainCore->m_featureSets.size(); + + if (featureSetIndex >= nbFeatureSets) + { + error.init(); + *error.getMessage() = QString("There is no feature set at index %1. Number of device sets is %2").arg(featureSetIndex).arg(nbFeatureSets); + return 404; + } + + const FeatureSetPreset *selectedPreset = m_mainCore->m_settings.getFeatureSetPreset( + *query.getGroupName(), + *query.getDescription()); + + if (selectedPreset == 0) + { + error.init(); + *error.getMessage() = QString("There is no preset [%1, %2]") + .arg(*query.getGroupName()) + .arg(*query.getDescription()); + return 404; + } + + MainCore::MsgLoadFeatureSetPreset *msg = MainCore::MsgLoadFeatureSetPreset::create(selectedPreset, featureSetIndex); + m_mainCore->m_mainMessageQueue->push(msg); + + return 202; +} + +int WebAPIAdapter::featuresetPresetPut( + int featureSetIndex, + SWGSDRangel::SWGFeaturePresetIdentifier& query, + SWGSDRangel::SWGErrorResponse& error) +{ + int nbFeatureSets = m_mainCore->m_featureSets.size(); + + if (featureSetIndex >= nbFeatureSets) + { + error.init(); + *error.getMessage() = QString("There is no feature set at index %1. Number of feature sets is %2").arg(featureSetIndex).arg(nbFeatureSets); + return 404; + } + + const FeatureSetPreset *selectedPreset = m_mainCore->m_settings.getFeatureSetPreset( + *query.getGroupName(), + *query.getDescription()); + + if (selectedPreset == 0) + { + error.init(); + *error.getMessage() = QString("There is no preset [%1, %2]") + .arg(*query.getGroupName()) + .arg(*query.getDescription()); + return 404; + } + + MainCore::MsgSaveFeatureSetPreset *msg = MainCore::MsgSaveFeatureSetPreset::create(const_cast(selectedPreset), featureSetIndex, false); + m_mainCore->m_mainMessageQueue->push(msg); + + return 202; +} + +int WebAPIAdapter::featuresetPresetPost( + int featureSetIndex, + SWGSDRangel::SWGFeaturePresetIdentifier& query, + SWGSDRangel::SWGErrorResponse& error) +{ + int nbFeatureSets = m_mainCore->m_featureSets.size(); + + if (featureSetIndex >= nbFeatureSets) + { + error.init(); + *error.getMessage() = QString("There is no feature set at index %1. Number of feature sets is %2").arg(featureSetIndex).arg(nbFeatureSets); + return 404; + } + + const FeatureSetPreset *selectedPreset = m_mainCore->m_settings.getFeatureSetPreset( + *query.getGroupName(), + *query.getDescription()); + + if (selectedPreset == 0) // save on a new preset + { + selectedPreset = m_mainCore->m_settings.newFeatureSetPreset(*query.getGroupName(), *query.getDescription()); + } + else + { + error.init(); + *error.getMessage() = QString("Preset already exists [%1, %2]") + .arg(*query.getGroupName()) + .arg(*query.getDescription()); + return 409; + } + + MainCore::MsgSaveFeatureSetPreset *msg = MainCore::MsgSaveFeatureSetPreset::create(const_cast(selectedPreset), featureSetIndex, true); + m_mainCore->m_mainMessageQueue->push(msg); + + return 202; +} + int WebAPIAdapter::featuresetFeatureSettingsGet( int featureSetIndex, int featureIndex, diff --git a/sdrbase/webapi/webapiadapter.h b/sdrbase/webapi/webapiadapter.h index 4969345db..0a80e437f 100644 --- a/sdrbase/webapi/webapiadapter.h +++ b/sdrbase/webapi/webapiadapter.h @@ -408,6 +408,21 @@ public: SWGSDRangel::SWGDeviceState& response, SWGSDRangel::SWGErrorResponse& error); + virtual int featuresetPresetPatch( + int featureSetIndex, + SWGSDRangel::SWGFeaturePresetIdentifier& query, + SWGSDRangel::SWGErrorResponse& error); + + virtual int featuresetPresetPut( + int featureSetIndex, + SWGSDRangel::SWGFeaturePresetIdentifier& query, + SWGSDRangel::SWGErrorResponse& error); + + virtual int featuresetPresetPost( + int featureSetIndex, + SWGSDRangel::SWGFeaturePresetIdentifier& query, + SWGSDRangel::SWGErrorResponse& error); + virtual int featuresetFeatureSettingsGet( int featureSetIndex, int featureIndex, diff --git a/sdrbase/webapi/webapiadapterinterface.cpp b/sdrbase/webapi/webapiadapterinterface.cpp index 3633a99d4..2b6d30743 100644 --- a/sdrbase/webapi/webapiadapterinterface.cpp +++ b/sdrbase/webapi/webapiadapterinterface.cpp @@ -66,6 +66,7 @@ std::regex WebAPIAdapterInterface::devicesetChannelActionsURLRe("^/sdrangel/devi std::regex WebAPIAdapterInterface::featuresetURLRe("^/sdrangel/featureset/([0-9]{1,2})$"); std::regex WebAPIAdapterInterface::featuresetFeatureURLRe("^/sdrangel/featureset/([0-9]{1,2})/feature$"); +std::regex WebAPIAdapterInterface::featuresetPresetURLRe("^/sdrangel/featureset/([0-9]{1,2})/preset"); std::regex WebAPIAdapterInterface::featuresetFeatureIndexURLRe("^/sdrangel/featureset/([0-9]{1,2})/feature/([0-9]{1,2})$"); std::regex WebAPIAdapterInterface::featuresetFeatureRunURLRe("^/sdrangel/featureset/([0-9]{1,2})/feature/([0-9]{1,2})/run$"); std::regex WebAPIAdapterInterface::featuresetFeatureSettingsURLRe("^/sdrangel/featureset/([0-9]{1,2})/feature/([0-9]{1,2})/settings$"); diff --git a/sdrbase/webapi/webapiadapterinterface.h b/sdrbase/webapi/webapiadapterinterface.h index ebf1ab8c1..88cd9d121 100644 --- a/sdrbase/webapi/webapiadapterinterface.h +++ b/sdrbase/webapi/webapiadapterinterface.h @@ -65,6 +65,7 @@ namespace SWGSDRangel class SWGSuccessResponse; class SWGFeaturePresets; class SWGFeaturePresetIdentifier; + class SWGFeaturePresetTransfer; class SWGFeatureSetList; class SWGFeatureSet; class SWGFeatureSettings; @@ -1318,6 +1319,54 @@ public: return 501; } + /** + * Handler of /sdrangel/featureset/{featuresetIndex}/preset (PATCH) swagger/sdrangel/code/html2/index.html#api-Default-instanceChannels + * returns the Http status code (default 501: not implemented) + */ + virtual int featuresetPresetPatch( + int featureSetIndex, + SWGSDRangel::SWGFeaturePresetIdentifier& query, + SWGSDRangel::SWGErrorResponse& error) + { + (void) featureSetIndex; + (void) query; + error.init(); + *error.getMessage() = QString("Function not implemented"); + return 501; + } + + /** + * Handler of /sdrangel/featureset/{featuresetIndex}/preset (PUT) swagger/sdrangel/code/html2/index.html#api-Default-instanceChannels + * returns the Http status code (default 501: not implemented) + */ + virtual int featuresetPresetPut( + int featureSetIndex, + SWGSDRangel::SWGFeaturePresetIdentifier& query, + SWGSDRangel::SWGErrorResponse& error) + { + (void) featureSetIndex; + (void) query; + error.init(); + *error.getMessage() = QString("Function not implemented"); + return 501; + } + + /** + * Handler of /sdrangel/featureset/{featuresetIndex}/preset (POST) swagger/sdrangel/code/html2/index.html#api-Default-instanceChannels + * returns the Http status code (default 501: not implemented) + */ + virtual int featuresetPresetPost( + int featureSetIndex, + SWGSDRangel::SWGFeaturePresetIdentifier& query, + SWGSDRangel::SWGErrorResponse& error) + { + (void) featureSetIndex; + (void) query; + error.init(); + *error.getMessage() = QString("Function not implemented"); + return 501; + } + /** * Handler of /sdrangel/featureset/{featuresetIndex}/feature/{featureIndex}/settings (GET) * returns the Http status code (default 501: not implemented) @@ -1443,6 +1492,7 @@ public: static std::regex devicesetChannelsReportURLRe; static std::regex featuresetURLRe; static std::regex featuresetFeatureURLRe; + static std::regex featuresetPresetURLRe; static std::regex featuresetFeatureIndexURLRe; static std::regex featuresetFeatureRunURLRe; static std::regex featuresetFeatureSettingsURLRe; diff --git a/sdrbase/webapi/webapirequestmapper.cpp b/sdrbase/webapi/webapirequestmapper.cpp index c8df6a498..5bd9274eb 100644 --- a/sdrbase/webapi/webapirequestmapper.cpp +++ b/sdrbase/webapi/webapirequestmapper.cpp @@ -55,6 +55,7 @@ #include "SWGErrorResponse.h" #include "SWGFeaturePresets.h" #include "SWGFeaturePresetIdentifier.h" +#include "SWGFeaturePresetTransfer.h" #include "SWGFeatureSetList.h" #include "SWGFeatureSettings.h" #include "SWGFeatureReport.h" @@ -206,6 +207,8 @@ void WebAPIRequestMapper::service(qtwebapp::HttpRequest& request, qtwebapp::Http featuresetService(std::string(desc_match[1]), request, response); } else if (std::regex_match(pathStr, desc_match, WebAPIAdapterInterface::featuresetFeatureURLRe)) { featuresetFeatureService(std::string(desc_match[1]), request, response); + } else if (std::regex_match(pathStr, desc_match, WebAPIAdapterInterface::featuresetPresetURLRe)) { + featuresetPresetService(std::string(desc_match[1]), request, response); } else if (std::regex_match(pathStr, desc_match, WebAPIAdapterInterface::featuresetFeatureIndexURLRe)) { featuresetFeatureIndexService(std::string(desc_match[1]), std::string(desc_match[2]), request, response); } else if (std::regex_match(pathStr, desc_match, WebAPIAdapterInterface::featuresetFeatureRunURLRe)) { @@ -2687,6 +2690,147 @@ void WebAPIRequestMapper::featuresetFeatureService( } } +void WebAPIRequestMapper::featuresetPresetService( + const std::string& featureSetIndexStr, + qtwebapp::HttpRequest& request, + qtwebapp::HttpResponse& response) +{ + SWGSDRangel::SWGErrorResponse errorResponse; + response.setHeader("Content-Type", "application/json"); + response.setHeader("Access-Control-Allow-Origin", "*"); + + try + { + int featureSetIndex = boost::lexical_cast(featureSetIndexStr); + + if (request.getMethod() == "PATCH") + { + SWGSDRangel::SWGFeaturePresetIdentifier query; + QString jsonStr = request.getBody(); + QJsonObject jsonObject; + + if (parseJsonBody(jsonStr, jsonObject, response)) + { + query.fromJson(jsonStr); + + if (validateFeaturePresetIdentifer(query)) + { + int status = m_adapter->featuresetPresetPatch(featureSetIndex, query, errorResponse); + response.setStatus(status); + + if (status/100 == 2) { + response.write(query.asJson().toUtf8()); + } else { + response.write(errorResponse.asJson().toUtf8()); + } + } + else + { + response.setStatus(400,"Invalid JSON request"); + errorResponse.init(); + *errorResponse.getMessage() = "Invalid JSON request"; + response.write(errorResponse.asJson().toUtf8()); + } + } + else + { + response.setStatus(400,"Invalid JSON format"); + errorResponse.init(); + *errorResponse.getMessage() = "Invalid JSON format"; + response.write(errorResponse.asJson().toUtf8()); + } + } + else if (request.getMethod() == "PUT") + { + SWGSDRangel::SWGFeaturePresetIdentifier query; + QString jsonStr = request.getBody(); + QJsonObject jsonObject; + + if (parseJsonBody(jsonStr, jsonObject, response)) + { + query.fromJson(jsonStr); + + if (validateFeaturePresetIdentifer(query)) + { + int status = m_adapter->featuresetPresetPut(featureSetIndex, query, errorResponse); + response.setStatus(status); + + if (status/100 == 2) { + response.write(query.asJson().toUtf8()); + } else { + response.write(errorResponse.asJson().toUtf8()); + } + } + else + { + response.setStatus(400,"Invalid JSON request"); + errorResponse.init(); + *errorResponse.getMessage() = "Invalid JSON request"; + response.write(errorResponse.asJson().toUtf8()); + } + } + else + { + response.setStatus(400,"Invalid JSON format"); + errorResponse.init(); + *errorResponse.getMessage() = "Invalid JSON format"; + response.write(errorResponse.asJson().toUtf8()); + } + } + else if (request.getMethod() == "POST") + { + SWGSDRangel::SWGFeaturePresetIdentifier query; + QString jsonStr = request.getBody(); + QJsonObject jsonObject; + + if (parseJsonBody(jsonStr, jsonObject, response)) + { + query.fromJson(jsonStr); + + if (validateFeaturePresetIdentifer(query)) + { + int status = m_adapter->featuresetPresetPost(featureSetIndex, query, errorResponse); + response.setStatus(status); + + if (status/100 == 2) { + response.write(query.asJson().toUtf8()); + } else { + response.write(errorResponse.asJson().toUtf8()); + } + } + else + { + response.setStatus(400,"Invalid JSON request"); + errorResponse.init(); + *errorResponse.getMessage() = "Invalid JSON request"; + response.write(errorResponse.asJson().toUtf8()); + } + } + else + { + response.setStatus(400,"Invalid JSON format"); + errorResponse.init(); + *errorResponse.getMessage() = "Invalid JSON format"; + response.write(errorResponse.asJson().toUtf8()); + } + } + else + { + response.setStatus(405,"Invalid HTTP method"); + errorResponse.init(); + *errorResponse.getMessage() = "Invalid HTTP method"; + response.write(errorResponse.asJson().toUtf8()); + } + } + catch (const boost::bad_lexical_cast &e) + { + errorResponse.init(); + *errorResponse.getMessage() = "Wrong integer conversion on index"; + response.setStatus(400,"Invalid data"); + response.write(errorResponse.asJson().toUtf8()); + } +} + void WebAPIRequestMapper::featuresetFeatureIndexService( const std::string& featureSetIndexStr, const std::string& featureIndexStr, @@ -3068,6 +3212,17 @@ bool WebAPIRequestMapper::validatePresetIdentifer(SWGSDRangel::SWGPresetIdentifi return (presetIdentifier.getGroupName() && presetIdentifier.getName() && presetIdentifier.getType()); } +bool WebAPIRequestMapper::validateFeaturePresetTransfer(SWGSDRangel::SWGFeaturePresetTransfer& presetTransfer) +{ + SWGSDRangel::SWGFeaturePresetIdentifier *presetIdentifier = presetTransfer.getPreset(); + + if (presetIdentifier == 0) { + return false; + } + + return validateFeaturePresetIdentifer(*presetIdentifier); +} + bool WebAPIRequestMapper::validateFeaturePresetIdentifer(SWGSDRangel::SWGFeaturePresetIdentifier& presetIdentifier) { return (presetIdentifier.getGroupName() && presetIdentifier.getDescription()); diff --git a/sdrbase/webapi/webapirequestmapper.h b/sdrbase/webapi/webapirequestmapper.h index 0eb282e52..e75bf39d0 100644 --- a/sdrbase/webapi/webapirequestmapper.h +++ b/sdrbase/webapi/webapirequestmapper.h @@ -102,6 +102,7 @@ private: void featuresetService(const std::string& indexStr, qtwebapp::HttpRequest& request, qtwebapp::HttpResponse& response); void featuresetFeatureService(const std::string& indexStr, qtwebapp::HttpRequest& request, qtwebapp::HttpResponse& response); + void featuresetPresetService(const std::string& indexStr, qtwebapp::HttpRequest& request, qtwebapp::HttpResponse& response); void featuresetFeatureIndexService(const std::string& featureSetIndexStr, const std::string& featureIndexStr, qtwebapp::HttpRequest& request, qtwebapp::HttpResponse& response); void featuresetFeatureRunService(const std::string& featureSetIndexStr, const std::string& featureIndexStr, qtwebapp::HttpRequest& request, qtwebapp::HttpResponse& response); void featuresetFeatureSettingsService(const std::string& featureSetIndexStr, const std::string& featureIndexStr, qtwebapp::HttpRequest& request, qtwebapp::HttpResponse& response); @@ -117,6 +118,7 @@ private: bool validateDeviceActions(SWGSDRangel::SWGDeviceActions& deviceActions, QJsonObject& jsonObject, QStringList& deviceActionsKeys); bool validateChannelSettings(SWGSDRangel::SWGChannelSettings& channelSettings, QJsonObject& jsonObject, QStringList& channelSettingsKeys); bool validateChannelActions(SWGSDRangel::SWGChannelActions& channelActions, QJsonObject& jsonObject, QStringList& channelActionsKeys); + bool validateFeaturePresetTransfer(SWGSDRangel::SWGFeaturePresetTransfer& presetTransfer); bool validateFeaturePresetIdentifer(SWGSDRangel::SWGFeaturePresetIdentifier& presetIdentifier); bool validateFeatureSettings(SWGSDRangel::SWGFeatureSettings& featureSettings, QJsonObject& jsonObject, QStringList& featureSettingsKeys); bool validateFeatureActions(SWGSDRangel::SWGFeatureActions& featureActions, QJsonObject& jsonObject, QStringList& featureActionsKeys); diff --git a/swagger/sdrangel/api/swagger/swagger.yaml b/swagger/sdrangel/api/swagger/swagger.yaml index abefcea7d..a840800a3 100644 --- a/swagger/sdrangel/api/swagger/swagger.yaml +++ b/swagger/sdrangel/api/swagger/swagger.yaml @@ -2040,6 +2040,121 @@ paths: "501": $ref: "#/responses/Response_501" + /sdrangel/featureset/{featureSetIndex}/preset: + x-swagger-router-controller: featureset + patch: + description: Load a preset in a feature set + operationId: featuresetPresetPatch + tags: + - FeatureSet + consumes: + - application/json + parameters: + - in: path + name: featureSetIndex + type: integer + required: true + description: Index of feature set in the feature set list + - name: body + in: body + description: Load preset settings to the feature set + required: true + schema: + $ref: "#/definitions/FeaturePresetIdentifier" + responses: + "202": + description: On successful sending of the message the selected preset identification is returned + schema: + $ref: "#/definitions/FeaturePresetIdentifier" + "400": + description: Invalid JSON request + schema: + $ref: "#/definitions/ErrorResponse" + "404": + description: No preset or feature set found + schema: + $ref: "#/definitions/ErrorResponse" + "500": + $ref: "#/responses/Response_500" + "501": + $ref: "#/responses/Response_501" + put: + description: Update an existing preset with feature set settings. + operationId: featuresetPresetPut + tags: + - FeatureSet + consumes: + - application/json + parameters: + - in: path + name: featureSetIndex + type: integer + required: true + description: Index of feature set in the feature set list + - name: body + in: body + description: save feature set settings to the preset + required: true + schema: + $ref: "#/definitions/FeaturePresetIdentifier" + responses: + "202": + description: On successful sending of the message the selected preset identification is returned + schema: + $ref: "#/definitions/FeaturePresetIdentifier" + "400": + description: Invalid JSON request + schema: + $ref: "#/definitions/ErrorResponse" + "404": + description: No preset or feature set found + schema: + $ref: "#/definitions/ErrorResponse" + "500": + $ref: "#/responses/Response_500" + "501": + $ref: "#/responses/Response_501" + post: + description: Create a new preset from a feature set settings. + operationId: featuresetPresetPost + tags: + - FeatureSet + consumes: + - application/json + parameters: + - in: path + name: featureSetIndex + type: integer + required: true + description: Index of feature set in the feature set list + - name: body + in: body + description: save feature set settings on a new preset + required: true + schema: + $ref: "#/definitions/FeaturePresetIdentifier" + responses: + "202": + description: On successful sending of the message the created preset identification is returned + schema: + $ref: "#/definitions/PresetIdentifier" + "400": + description: Invalid JSON request + schema: + $ref: "#/definitions/ErrorResponse" + "404": + description: Feature set not found + schema: + $ref: "#/definitions/ErrorResponse" + "409": + description: Preset already exists + schema: + $ref: "#/definitions/ErrorResponse" + "500": + $ref: "#/responses/Response_500" + "501": + $ref: "#/responses/Response_501" + /sdrangel/featureset/{featureSetIndex}/feature/{featureIndex}: x-swagger-router-controller: featureset delete: diff --git a/swagger/sdrangel/code/html2/index.html b/swagger/sdrangel/code/html2/index.html index 3cb284e88..ad92d4307 100644 --- a/swagger/sdrangel/code/html2/index.html +++ b/swagger/sdrangel/code/html2/index.html @@ -12631,6 +12631,15 @@ margin-bottom: 20px;
  • featuresetGet
  • +
  • + featuresetPresetPatch +
  • +
  • + featuresetPresetPost +
  • +
  • + featuresetPresetPut +
  • instanceFeatureSetDelete
  • @@ -32671,6 +32680,1588 @@ except ApiException as e:
    +
    +
    +
    +

    featuresetPresetPatch

    +

    +
    +
    +
    +

    +

    Load a preset in a feature set

    +

    +
    +
    /sdrangel/featureset/{featureSetIndex}/preset
    +

    +

    Usage and SDK Samples

    +

    + + +
    +
    +
    curl -X PATCH "http://localhost/sdrangel/featureset/{featureSetIndex}/preset"
    +
    +
    +
    import SWGSDRangel.*;
    +import SWGSDRangel.auth.*;
    +import SWGSDRangel.model.*;
    +import SWGSDRangel.api.FeatureSetApi;
    +
    +import java.io.File;
    +import java.util.*;
    +
    +public class FeatureSetApiExample {
    +
    +    public static void main(String[] args) {
    +        
    +        FeatureSetApi apiInstance = new FeatureSetApi();
    +        Integer featureSetIndex = 56; // Integer | Index of feature set in the feature set list
    +        FeaturePresetIdentifier body = ; // FeaturePresetIdentifier | Load preset settings to the feature set
    +        try {
    +            FeaturePresetIdentifier result = apiInstance.featuresetPresetPatch(featureSetIndex, body);
    +            System.out.println(result);
    +        } catch (ApiException e) {
    +            System.err.println("Exception when calling FeatureSetApi#featuresetPresetPatch");
    +            e.printStackTrace();
    +        }
    +    }
    +}
    +
    + +
    +
    import SWGSDRangel.api.FeatureSetApi;
    +
    +public class FeatureSetApiExample {
    +
    +    public static void main(String[] args) {
    +        FeatureSetApi apiInstance = new FeatureSetApi();
    +        Integer featureSetIndex = 56; // Integer | Index of feature set in the feature set list
    +        FeaturePresetIdentifier body = ; // FeaturePresetIdentifier | Load preset settings to the feature set
    +        try {
    +            FeaturePresetIdentifier result = apiInstance.featuresetPresetPatch(featureSetIndex, body);
    +            System.out.println(result);
    +        } catch (ApiException e) {
    +            System.err.println("Exception when calling FeatureSetApi#featuresetPresetPatch");
    +            e.printStackTrace();
    +        }
    +    }
    +}
    +
    + +
    +
    Integer *featureSetIndex = 56; // Index of feature set in the feature set list
    +FeaturePresetIdentifier *body = ; // Load preset settings to the feature set
    +
    +FeatureSetApi *apiInstance = [[FeatureSetApi alloc] init];
    +
    +[apiInstance featuresetPresetPatchWith:featureSetIndex
    +    body:body
    +              completionHandler: ^(FeaturePresetIdentifier output, NSError* error) {
    +                            if (output) {
    +                                NSLog(@"%@", output);
    +                            }
    +                            if (error) {
    +                                NSLog(@"Error: %@", error);
    +                            }
    +                        }];
    +
    +
    + +
    +
    var SdRangel = require('sd_rangel');
    +
    +var api = new SdRangel.FeatureSetApi()
    +
    +var featureSetIndex = 56; // {Integer} Index of feature set in the feature set list
    +
    +var body = ; // {FeaturePresetIdentifier} Load preset settings to the feature set
    +
    +
    +var callback = function(error, data, response) {
    +  if (error) {
    +    console.error(error);
    +  } else {
    +    console.log('API called successfully. Returned data: ' + data);
    +  }
    +};
    +api.featuresetPresetPatch(featureSetIndex, body, callback);
    +
    +
    + + +
    +
    using System;
    +using System.Diagnostics;
    +using SWGSDRangel.Api;
    +using SWGSDRangel.Client;
    +using SWGSDRangel.Model;
    +
    +namespace Example
    +{
    +    public class featuresetPresetPatchExample
    +    {
    +        public void main()
    +        {
    +            
    +            var apiInstance = new FeatureSetApi();
    +            var featureSetIndex = 56;  // Integer | Index of feature set in the feature set list
    +            var body = new FeaturePresetIdentifier(); // FeaturePresetIdentifier | Load preset settings to the feature set
    +
    +            try
    +            {
    +                FeaturePresetIdentifier result = apiInstance.featuresetPresetPatch(featureSetIndex, body);
    +                Debug.WriteLine(result);
    +            }
    +            catch (Exception e)
    +            {
    +                Debug.Print("Exception when calling FeatureSetApi.featuresetPresetPatch: " + e.Message );
    +            }
    +        }
    +    }
    +}
    +
    +
    + +
    +
    <?php
    +require_once(__DIR__ . '/vendor/autoload.php');
    +
    +$api_instance = new Swagger\Client\Api\FeatureSetApi();
    +$featureSetIndex = 56; // Integer | Index of feature set in the feature set list
    +$body = ; // FeaturePresetIdentifier | Load preset settings to the feature set
    +
    +try {
    +    $result = $api_instance->featuresetPresetPatch($featureSetIndex, $body);
    +    print_r($result);
    +} catch (Exception $e) {
    +    echo 'Exception when calling FeatureSetApi->featuresetPresetPatch: ', $e->getMessage(), PHP_EOL;
    +}
    +?>
    +
    + +
    +
    use Data::Dumper;
    +use SWGSDRangel::Configuration;
    +use SWGSDRangel::FeatureSetApi;
    +
    +my $api_instance = SWGSDRangel::FeatureSetApi->new();
    +my $featureSetIndex = 56; # Integer | Index of feature set in the feature set list
    +my $body = SWGSDRangel::Object::FeaturePresetIdentifier->new(); # FeaturePresetIdentifier | Load preset settings to the feature set
    +
    +eval { 
    +    my $result = $api_instance->featuresetPresetPatch(featureSetIndex => $featureSetIndex, body => $body);
    +    print Dumper($result);
    +};
    +if ($@) {
    +    warn "Exception when calling FeatureSetApi->featuresetPresetPatch: $@\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.FeatureSetApi()
    +featureSetIndex = 56 # Integer | Index of feature set in the feature set list
    +body =  # FeaturePresetIdentifier | Load preset settings to the feature set
    +
    +try: 
    +    api_response = api_instance.featureset_preset_patch(featureSetIndex, body)
    +    pprint(api_response)
    +except ApiException as e:
    +    print("Exception when calling FeatureSetApi->featuresetPresetPatch: %s\n" % e)
    +
    +
    + +

    Parameters

    + +
    Path parameters
    + + + + + + + + + +
    NameDescription
    featureSetIndex* + + +
    +
    +
    + + Integer + + +
    + Index of feature set in the feature set list +
    +
    +
    + Required +
    +
    +
    +
    + + +
    Body parameters
    + + + + + + + + + +
    NameDescription
    body * + + + +
    +
    + + + +

    Responses

    +

    Status: 202 - On successful sending of the message the selected preset identification is returned

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

    Status: 400 - Invalid JSON request

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

    Status: 404 - No preset or feature set found

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

    Status: 500 - Error

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

    Status: 501 - Function not implemented

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

    featuresetPresetPost

    +

    +
    +
    +
    +

    +

    Create a new preset from a feature set settings.

    +

    +
    +
    /sdrangel/featureset/{featureSetIndex}/preset
    +

    +

    Usage and SDK Samples

    +

    + + +
    +
    +
    curl -X POST "http://localhost/sdrangel/featureset/{featureSetIndex}/preset"
    +
    +
    +
    import SWGSDRangel.*;
    +import SWGSDRangel.auth.*;
    +import SWGSDRangel.model.*;
    +import SWGSDRangel.api.FeatureSetApi;
    +
    +import java.io.File;
    +import java.util.*;
    +
    +public class FeatureSetApiExample {
    +
    +    public static void main(String[] args) {
    +        
    +        FeatureSetApi apiInstance = new FeatureSetApi();
    +        Integer featureSetIndex = 56; // Integer | Index of feature set in the feature set list
    +        FeaturePresetIdentifier body = ; // FeaturePresetIdentifier | save feature set settings on a new preset
    +        try {
    +            PresetIdentifier result = apiInstance.featuresetPresetPost(featureSetIndex, body);
    +            System.out.println(result);
    +        } catch (ApiException e) {
    +            System.err.println("Exception when calling FeatureSetApi#featuresetPresetPost");
    +            e.printStackTrace();
    +        }
    +    }
    +}
    +
    + +
    +
    import SWGSDRangel.api.FeatureSetApi;
    +
    +public class FeatureSetApiExample {
    +
    +    public static void main(String[] args) {
    +        FeatureSetApi apiInstance = new FeatureSetApi();
    +        Integer featureSetIndex = 56; // Integer | Index of feature set in the feature set list
    +        FeaturePresetIdentifier body = ; // FeaturePresetIdentifier | save feature set settings on a new preset
    +        try {
    +            PresetIdentifier result = apiInstance.featuresetPresetPost(featureSetIndex, body);
    +            System.out.println(result);
    +        } catch (ApiException e) {
    +            System.err.println("Exception when calling FeatureSetApi#featuresetPresetPost");
    +            e.printStackTrace();
    +        }
    +    }
    +}
    +
    + +
    +
    Integer *featureSetIndex = 56; // Index of feature set in the feature set list
    +FeaturePresetIdentifier *body = ; // save feature set settings on a new preset
    +
    +FeatureSetApi *apiInstance = [[FeatureSetApi alloc] init];
    +
    +[apiInstance featuresetPresetPostWith:featureSetIndex
    +    body:body
    +              completionHandler: ^(PresetIdentifier output, NSError* error) {
    +                            if (output) {
    +                                NSLog(@"%@", output);
    +                            }
    +                            if (error) {
    +                                NSLog(@"Error: %@", error);
    +                            }
    +                        }];
    +
    +
    + +
    +
    var SdRangel = require('sd_rangel');
    +
    +var api = new SdRangel.FeatureSetApi()
    +
    +var featureSetIndex = 56; // {Integer} Index of feature set in the feature set list
    +
    +var body = ; // {FeaturePresetIdentifier} save feature set settings on a new preset
    +
    +
    +var callback = function(error, data, response) {
    +  if (error) {
    +    console.error(error);
    +  } else {
    +    console.log('API called successfully. Returned data: ' + data);
    +  }
    +};
    +api.featuresetPresetPost(featureSetIndex, body, callback);
    +
    +
    + + +
    +
    using System;
    +using System.Diagnostics;
    +using SWGSDRangel.Api;
    +using SWGSDRangel.Client;
    +using SWGSDRangel.Model;
    +
    +namespace Example
    +{
    +    public class featuresetPresetPostExample
    +    {
    +        public void main()
    +        {
    +            
    +            var apiInstance = new FeatureSetApi();
    +            var featureSetIndex = 56;  // Integer | Index of feature set in the feature set list
    +            var body = new FeaturePresetIdentifier(); // FeaturePresetIdentifier | save feature set settings on a new preset
    +
    +            try
    +            {
    +                PresetIdentifier result = apiInstance.featuresetPresetPost(featureSetIndex, body);
    +                Debug.WriteLine(result);
    +            }
    +            catch (Exception e)
    +            {
    +                Debug.Print("Exception when calling FeatureSetApi.featuresetPresetPost: " + e.Message );
    +            }
    +        }
    +    }
    +}
    +
    +
    + +
    +
    <?php
    +require_once(__DIR__ . '/vendor/autoload.php');
    +
    +$api_instance = new Swagger\Client\Api\FeatureSetApi();
    +$featureSetIndex = 56; // Integer | Index of feature set in the feature set list
    +$body = ; // FeaturePresetIdentifier | save feature set settings on a new preset
    +
    +try {
    +    $result = $api_instance->featuresetPresetPost($featureSetIndex, $body);
    +    print_r($result);
    +} catch (Exception $e) {
    +    echo 'Exception when calling FeatureSetApi->featuresetPresetPost: ', $e->getMessage(), PHP_EOL;
    +}
    +?>
    +
    + +
    +
    use Data::Dumper;
    +use SWGSDRangel::Configuration;
    +use SWGSDRangel::FeatureSetApi;
    +
    +my $api_instance = SWGSDRangel::FeatureSetApi->new();
    +my $featureSetIndex = 56; # Integer | Index of feature set in the feature set list
    +my $body = SWGSDRangel::Object::FeaturePresetIdentifier->new(); # FeaturePresetIdentifier | save feature set settings on a new preset
    +
    +eval { 
    +    my $result = $api_instance->featuresetPresetPost(featureSetIndex => $featureSetIndex, body => $body);
    +    print Dumper($result);
    +};
    +if ($@) {
    +    warn "Exception when calling FeatureSetApi->featuresetPresetPost: $@\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.FeatureSetApi()
    +featureSetIndex = 56 # Integer | Index of feature set in the feature set list
    +body =  # FeaturePresetIdentifier | save feature set settings on a new preset
    +
    +try: 
    +    api_response = api_instance.featureset_preset_post(featureSetIndex, body)
    +    pprint(api_response)
    +except ApiException as e:
    +    print("Exception when calling FeatureSetApi->featuresetPresetPost: %s\n" % e)
    +
    +
    + +

    Parameters

    + +
    Path parameters
    + + + + + + + + + +
    NameDescription
    featureSetIndex* + + +
    +
    +
    + + Integer + + +
    + Index of feature set in the feature set list +
    +
    +
    + Required +
    +
    +
    +
    + + +
    Body parameters
    + + + + + + + + + +
    NameDescription
    body * + + + +
    +
    + + + +

    Responses

    +

    Status: 202 - On successful sending of the message the created preset identification is returned

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

    Status: 400 - Invalid JSON request

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

    Status: 404 - Feature set not found

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

    Status: 409 - Preset already exists

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

    Status: 500 - Error

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

    Status: 501 - Function not implemented

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

    featuresetPresetPut

    +

    +
    +
    +
    +

    +

    Update an existing preset with feature set settings.

    +

    +
    +
    /sdrangel/featureset/{featureSetIndex}/preset
    +

    +

    Usage and SDK Samples

    +

    + + +
    +
    +
    curl -X PUT "http://localhost/sdrangel/featureset/{featureSetIndex}/preset"
    +
    +
    +
    import SWGSDRangel.*;
    +import SWGSDRangel.auth.*;
    +import SWGSDRangel.model.*;
    +import SWGSDRangel.api.FeatureSetApi;
    +
    +import java.io.File;
    +import java.util.*;
    +
    +public class FeatureSetApiExample {
    +
    +    public static void main(String[] args) {
    +        
    +        FeatureSetApi apiInstance = new FeatureSetApi();
    +        Integer featureSetIndex = 56; // Integer | Index of feature set in the feature set list
    +        FeaturePresetIdentifier body = ; // FeaturePresetIdentifier | save feature set settings to the preset
    +        try {
    +            FeaturePresetIdentifier result = apiInstance.featuresetPresetPut(featureSetIndex, body);
    +            System.out.println(result);
    +        } catch (ApiException e) {
    +            System.err.println("Exception when calling FeatureSetApi#featuresetPresetPut");
    +            e.printStackTrace();
    +        }
    +    }
    +}
    +
    + +
    +
    import SWGSDRangel.api.FeatureSetApi;
    +
    +public class FeatureSetApiExample {
    +
    +    public static void main(String[] args) {
    +        FeatureSetApi apiInstance = new FeatureSetApi();
    +        Integer featureSetIndex = 56; // Integer | Index of feature set in the feature set list
    +        FeaturePresetIdentifier body = ; // FeaturePresetIdentifier | save feature set settings to the preset
    +        try {
    +            FeaturePresetIdentifier result = apiInstance.featuresetPresetPut(featureSetIndex, body);
    +            System.out.println(result);
    +        } catch (ApiException e) {
    +            System.err.println("Exception when calling FeatureSetApi#featuresetPresetPut");
    +            e.printStackTrace();
    +        }
    +    }
    +}
    +
    + +
    +
    Integer *featureSetIndex = 56; // Index of feature set in the feature set list
    +FeaturePresetIdentifier *body = ; // save feature set settings to the preset
    +
    +FeatureSetApi *apiInstance = [[FeatureSetApi alloc] init];
    +
    +[apiInstance featuresetPresetPutWith:featureSetIndex
    +    body:body
    +              completionHandler: ^(FeaturePresetIdentifier output, NSError* error) {
    +                            if (output) {
    +                                NSLog(@"%@", output);
    +                            }
    +                            if (error) {
    +                                NSLog(@"Error: %@", error);
    +                            }
    +                        }];
    +
    +
    + +
    +
    var SdRangel = require('sd_rangel');
    +
    +var api = new SdRangel.FeatureSetApi()
    +
    +var featureSetIndex = 56; // {Integer} Index of feature set in the feature set list
    +
    +var body = ; // {FeaturePresetIdentifier} save feature set settings to the preset
    +
    +
    +var callback = function(error, data, response) {
    +  if (error) {
    +    console.error(error);
    +  } else {
    +    console.log('API called successfully. Returned data: ' + data);
    +  }
    +};
    +api.featuresetPresetPut(featureSetIndex, body, callback);
    +
    +
    + + +
    +
    using System;
    +using System.Diagnostics;
    +using SWGSDRangel.Api;
    +using SWGSDRangel.Client;
    +using SWGSDRangel.Model;
    +
    +namespace Example
    +{
    +    public class featuresetPresetPutExample
    +    {
    +        public void main()
    +        {
    +            
    +            var apiInstance = new FeatureSetApi();
    +            var featureSetIndex = 56;  // Integer | Index of feature set in the feature set list
    +            var body = new FeaturePresetIdentifier(); // FeaturePresetIdentifier | save feature set settings to the preset
    +
    +            try
    +            {
    +                FeaturePresetIdentifier result = apiInstance.featuresetPresetPut(featureSetIndex, body);
    +                Debug.WriteLine(result);
    +            }
    +            catch (Exception e)
    +            {
    +                Debug.Print("Exception when calling FeatureSetApi.featuresetPresetPut: " + e.Message );
    +            }
    +        }
    +    }
    +}
    +
    +
    + +
    +
    <?php
    +require_once(__DIR__ . '/vendor/autoload.php');
    +
    +$api_instance = new Swagger\Client\Api\FeatureSetApi();
    +$featureSetIndex = 56; // Integer | Index of feature set in the feature set list
    +$body = ; // FeaturePresetIdentifier | save feature set settings to the preset
    +
    +try {
    +    $result = $api_instance->featuresetPresetPut($featureSetIndex, $body);
    +    print_r($result);
    +} catch (Exception $e) {
    +    echo 'Exception when calling FeatureSetApi->featuresetPresetPut: ', $e->getMessage(), PHP_EOL;
    +}
    +?>
    +
    + +
    +
    use Data::Dumper;
    +use SWGSDRangel::Configuration;
    +use SWGSDRangel::FeatureSetApi;
    +
    +my $api_instance = SWGSDRangel::FeatureSetApi->new();
    +my $featureSetIndex = 56; # Integer | Index of feature set in the feature set list
    +my $body = SWGSDRangel::Object::FeaturePresetIdentifier->new(); # FeaturePresetIdentifier | save feature set settings to the preset
    +
    +eval { 
    +    my $result = $api_instance->featuresetPresetPut(featureSetIndex => $featureSetIndex, body => $body);
    +    print Dumper($result);
    +};
    +if ($@) {
    +    warn "Exception when calling FeatureSetApi->featuresetPresetPut: $@\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.FeatureSetApi()
    +featureSetIndex = 56 # Integer | Index of feature set in the feature set list
    +body =  # FeaturePresetIdentifier | save feature set settings to the preset
    +
    +try: 
    +    api_response = api_instance.featureset_preset_put(featureSetIndex, body)
    +    pprint(api_response)
    +except ApiException as e:
    +    print("Exception when calling FeatureSetApi->featuresetPresetPut: %s\n" % e)
    +
    +
    + +

    Parameters

    + +
    Path parameters
    + + + + + + + + + +
    NameDescription
    featureSetIndex* + + +
    +
    +
    + + Integer + + +
    + Index of feature set in the feature set list +
    +
    +
    + Required +
    +
    +
    +
    + + +
    Body parameters
    + + + + + + + + + +
    NameDescription
    body * + + + +
    +
    + + + +

    Responses

    +

    Status: 202 - On successful sending of the message the selected preset identification is returned

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

    Status: 400 - Invalid JSON request

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

    Status: 404 - No preset or feature set found

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

    Status: 500 - Error

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

    Status: 501 - Function not implemented

    + + + +
    +
    +
    + +
    + +
    +
    + +
    +
    +
    @@ -48985,7 +50576,7 @@ except ApiException as e:
    - Generated 2021-09-03T22:11:29.377+02:00 + Generated 2021-09-05T21:54:27.642+02:00
    diff --git a/swagger/sdrangel/code/qt5/client/SWGFeaturePresetTransfer.cpp b/swagger/sdrangel/code/qt5/client/SWGFeaturePresetTransfer.cpp new file mode 100644 index 000000000..c08d58840 --- /dev/null +++ b/swagger/sdrangel/code/qt5/client/SWGFeaturePresetTransfer.cpp @@ -0,0 +1,133 @@ +/** + * SDRangel + * This is the web REST/JSON API of SDRangel SDR software. SDRangel is an Open Source Qt5/OpenGL 3.0+ (4.3+ in Windows) GUI and server Software Defined Radio and signal analyzer in software. It supports Airspy, BladeRF, HackRF, LimeSDR, PlutoSDR, RTL-SDR, SDRplay RSP1 and FunCube --- Limitations and specifcities: * In SDRangel GUI the first Rx device set cannot be deleted. Conversely the server starts with no device sets and its number of device sets can be reduced to zero by as many calls as necessary to /sdrangel/deviceset with DELETE method. * Preset import and export from/to file is a server only feature. * Device set focus is a GUI only feature. * The following channels are not implemented (status 501 is returned): ATV and DATV demodulators, Channel Analyzer NG, LoRa demodulator * The device settings and report structures contains only the sub-structure corresponding to the device type. The DeviceSettings and DeviceReport structures documented here shows all of them but only one will be or should be present at a time * The channel settings and report structures contains only the sub-structure corresponding to the channel type. The ChannelSettings and ChannelReport structures documented here shows all of them but only one will be or should be present at a time --- + * + * OpenAPI spec version: 6.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 "SWGFeaturePresetTransfer.h" + +#include "SWGHelpers.h" + +#include +#include +#include +#include + +namespace SWGSDRangel { + +SWGFeaturePresetTransfer::SWGFeaturePresetTransfer(QString* json) { + init(); + this->fromJson(*json); +} + +SWGFeaturePresetTransfer::SWGFeaturePresetTransfer() { + feature_set_index = 0; + m_feature_set_index_isSet = false; + preset = nullptr; + m_preset_isSet = false; +} + +SWGFeaturePresetTransfer::~SWGFeaturePresetTransfer() { + this->cleanup(); +} + +void +SWGFeaturePresetTransfer::init() { + feature_set_index = 0; + m_feature_set_index_isSet = false; + preset = new SWGFeaturePresetIdentifier(); + m_preset_isSet = false; +} + +void +SWGFeaturePresetTransfer::cleanup() { + + if(preset != nullptr) { + delete preset; + } +} + +SWGFeaturePresetTransfer* +SWGFeaturePresetTransfer::fromJson(QString &json) { + QByteArray array (json.toStdString().c_str()); + QJsonDocument doc = QJsonDocument::fromJson(array); + QJsonObject jsonObject = doc.object(); + this->fromJsonObject(jsonObject); + return this; +} + +void +SWGFeaturePresetTransfer::fromJsonObject(QJsonObject &pJson) { + ::SWGSDRangel::setValue(&feature_set_index, pJson["featureSetIndex"], "qint32", ""); + + ::SWGSDRangel::setValue(&preset, pJson["preset"], "SWGFeaturePresetIdentifier", "SWGFeaturePresetIdentifier"); + +} + +QString +SWGFeaturePresetTransfer::asJson () +{ + QJsonObject* obj = this->asJsonObject(); + + QJsonDocument doc(*obj); + QByteArray bytes = doc.toJson(); + delete obj; + return QString(bytes); +} + +QJsonObject* +SWGFeaturePresetTransfer::asJsonObject() { + QJsonObject* obj = new QJsonObject(); + if(m_feature_set_index_isSet){ + obj->insert("featureSetIndex", QJsonValue(feature_set_index)); + } + if((preset != nullptr) && (preset->isSet())){ + toJsonValue(QString("preset"), preset, obj, QString("SWGFeaturePresetIdentifier")); + } + + return obj; +} + +qint32 +SWGFeaturePresetTransfer::getFeatureSetIndex() { + return feature_set_index; +} +void +SWGFeaturePresetTransfer::setFeatureSetIndex(qint32 feature_set_index) { + this->feature_set_index = feature_set_index; + this->m_feature_set_index_isSet = true; +} + +SWGFeaturePresetIdentifier* +SWGFeaturePresetTransfer::getPreset() { + return preset; +} +void +SWGFeaturePresetTransfer::setPreset(SWGFeaturePresetIdentifier* preset) { + this->preset = preset; + this->m_preset_isSet = true; +} + + +bool +SWGFeaturePresetTransfer::isSet(){ + bool isObjectUpdated = false; + do{ + if(m_feature_set_index_isSet){ + isObjectUpdated = true; break; + } + if(preset && preset->isSet()){ + isObjectUpdated = true; break; + } + }while(false); + return isObjectUpdated; +} +} + diff --git a/swagger/sdrangel/code/qt5/client/SWGFeaturePresetTransfer.h b/swagger/sdrangel/code/qt5/client/SWGFeaturePresetTransfer.h new file mode 100644 index 000000000..f2cc014c0 --- /dev/null +++ b/swagger/sdrangel/code/qt5/client/SWGFeaturePresetTransfer.h @@ -0,0 +1,65 @@ +/** + * SDRangel + * This is the web REST/JSON API of SDRangel SDR software. SDRangel is an Open Source Qt5/OpenGL 3.0+ (4.3+ in Windows) GUI and server Software Defined Radio and signal analyzer in software. It supports Airspy, BladeRF, HackRF, LimeSDR, PlutoSDR, RTL-SDR, SDRplay RSP1 and FunCube --- Limitations and specifcities: * In SDRangel GUI the first Rx device set cannot be deleted. Conversely the server starts with no device sets and its number of device sets can be reduced to zero by as many calls as necessary to /sdrangel/deviceset with DELETE method. * Preset import and export from/to file is a server only feature. * Device set focus is a GUI only feature. * The following channels are not implemented (status 501 is returned): ATV and DATV demodulators, Channel Analyzer NG, LoRa demodulator * The device settings and report structures contains only the sub-structure corresponding to the device type. The DeviceSettings and DeviceReport structures documented here shows all of them but only one will be or should be present at a time * The channel settings and report structures contains only the sub-structure corresponding to the channel type. The ChannelSettings and ChannelReport structures documented here shows all of them but only one will be or should be present at a time --- + * + * OpenAPI spec version: 6.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. + */ + +/* + * SWGFeaturePresetTransfer.h + * + * Preset transfer to or from a feature set + */ + +#ifndef SWGFeaturePresetTransfer_H_ +#define SWGFeaturePresetTransfer_H_ + +#include + + +#include "SWGFeaturePresetIdentifier.h" + +#include "SWGObject.h" +#include "export.h" + +namespace SWGSDRangel { + +class SWG_API SWGFeaturePresetTransfer: public SWGObject { +public: + SWGFeaturePresetTransfer(); + SWGFeaturePresetTransfer(QString* json); + virtual ~SWGFeaturePresetTransfer(); + void init(); + void cleanup(); + + virtual QString asJson () override; + virtual QJsonObject* asJsonObject() override; + virtual void fromJsonObject(QJsonObject &json) override; + virtual SWGFeaturePresetTransfer* fromJson(QString &jsonString) override; + + qint32 getFeatureSetIndex(); + void setFeatureSetIndex(qint32 feature_set_index); + + SWGFeaturePresetIdentifier* getPreset(); + void setPreset(SWGFeaturePresetIdentifier* preset); + + + virtual bool isSet() override; + +private: + qint32 feature_set_index; + bool m_feature_set_index_isSet; + + SWGFeaturePresetIdentifier* preset; + bool m_preset_isSet; + +}; + +} + +#endif /* SWGFeaturePresetTransfer_H_ */ diff --git a/swagger/sdrangel/code/qt5/client/SWGFeatureSetApi.cpp b/swagger/sdrangel/code/qt5/client/SWGFeatureSetApi.cpp index 8219feb84..7bbf5ce73 100644 --- a/swagger/sdrangel/code/qt5/client/SWGFeatureSetApi.cpp +++ b/swagger/sdrangel/code/qt5/client/SWGFeatureSetApi.cpp @@ -652,6 +652,177 @@ SWGFeatureSetApi::featuresetGetCallback(SWGHttpRequestWorker * worker) { } } +void +SWGFeatureSetApi::featuresetPresetPatch(qint32 feature_set_index, SWGFeaturePresetIdentifier& body) { + QString fullPath; + fullPath.append(this->host).append(this->basePath).append("/sdrangel/featureset/{featureSetIndex}/preset"); + + QString feature_set_indexPathParam("{"); feature_set_indexPathParam.append("featureSetIndex").append("}"); + fullPath.replace(feature_set_indexPathParam, stringValue(feature_set_index)); + + + SWGHttpRequestWorker *worker = new SWGHttpRequestWorker(); + SWGHttpRequestInput 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, + &SWGHttpRequestWorker::on_execution_finished, + this, + &SWGFeatureSetApi::featuresetPresetPatchCallback); + + worker->execute(&input); +} + +void +SWGFeatureSetApi::featuresetPresetPatchCallback(SWGHttpRequestWorker * 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); + SWGFeaturePresetIdentifier* output = static_cast(create(json, QString("SWGFeaturePresetIdentifier"))); + worker->deleteLater(); + + if (worker->error_type == QNetworkReply::NoError) { + emit featuresetPresetPatchSignal(output); + } else { + emit featuresetPresetPatchSignalE(output, error_type, error_str); + emit featuresetPresetPatchSignalEFull(worker, error_type, error_str); + } +} + +void +SWGFeatureSetApi::featuresetPresetPost(qint32 feature_set_index, SWGFeaturePresetIdentifier& body) { + QString fullPath; + fullPath.append(this->host).append(this->basePath).append("/sdrangel/featureset/{featureSetIndex}/preset"); + + QString feature_set_indexPathParam("{"); feature_set_indexPathParam.append("featureSetIndex").append("}"); + fullPath.replace(feature_set_indexPathParam, stringValue(feature_set_index)); + + + SWGHttpRequestWorker *worker = new SWGHttpRequestWorker(); + SWGHttpRequestInput input(fullPath, "POST"); + + + + 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, + &SWGHttpRequestWorker::on_execution_finished, + this, + &SWGFeatureSetApi::featuresetPresetPostCallback); + + worker->execute(&input); +} + +void +SWGFeatureSetApi::featuresetPresetPostCallback(SWGHttpRequestWorker * 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); + SWGPresetIdentifier* output = static_cast(create(json, QString("SWGPresetIdentifier"))); + worker->deleteLater(); + + if (worker->error_type == QNetworkReply::NoError) { + emit featuresetPresetPostSignal(output); + } else { + emit featuresetPresetPostSignalE(output, error_type, error_str); + emit featuresetPresetPostSignalEFull(worker, error_type, error_str); + } +} + +void +SWGFeatureSetApi::featuresetPresetPut(qint32 feature_set_index, SWGFeaturePresetIdentifier& body) { + QString fullPath; + fullPath.append(this->host).append(this->basePath).append("/sdrangel/featureset/{featureSetIndex}/preset"); + + QString feature_set_indexPathParam("{"); feature_set_indexPathParam.append("featureSetIndex").append("}"); + fullPath.replace(feature_set_indexPathParam, stringValue(feature_set_index)); + + + SWGHttpRequestWorker *worker = new SWGHttpRequestWorker(); + SWGHttpRequestInput 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, + &SWGHttpRequestWorker::on_execution_finished, + this, + &SWGFeatureSetApi::featuresetPresetPutCallback); + + worker->execute(&input); +} + +void +SWGFeatureSetApi::featuresetPresetPutCallback(SWGHttpRequestWorker * 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); + SWGFeaturePresetIdentifier* output = static_cast(create(json, QString("SWGFeaturePresetIdentifier"))); + worker->deleteLater(); + + if (worker->error_type == QNetworkReply::NoError) { + emit featuresetPresetPutSignal(output); + } else { + emit featuresetPresetPutSignalE(output, error_type, error_str); + emit featuresetPresetPutSignalEFull(worker, error_type, error_str); + } +} + void SWGFeatureSetApi::instanceFeatureSetDelete() { QString fullPath; diff --git a/swagger/sdrangel/code/qt5/client/SWGFeatureSetApi.h b/swagger/sdrangel/code/qt5/client/SWGFeatureSetApi.h index 74cdf482b..4aaf9f60f 100644 --- a/swagger/sdrangel/code/qt5/client/SWGFeatureSetApi.h +++ b/swagger/sdrangel/code/qt5/client/SWGFeatureSetApi.h @@ -18,9 +18,11 @@ #include "SWGDeviceState.h" #include "SWGErrorResponse.h" #include "SWGFeatureActions.h" +#include "SWGFeaturePresetIdentifier.h" #include "SWGFeatureReport.h" #include "SWGFeatureSet.h" #include "SWGFeatureSettings.h" +#include "SWGPresetIdentifier.h" #include "SWGSuccessResponse.h" #include @@ -50,6 +52,9 @@ public: void featuresetFeatureSettingsGet(qint32 feature_set_index, qint32 feature_index); void featuresetFeatureSettingsPatch(qint32 feature_set_index, qint32 feature_index, SWGFeatureSettings& body); void featuresetGet(qint32 feature_set_index); + void featuresetPresetPatch(qint32 feature_set_index, SWGFeaturePresetIdentifier& body); + void featuresetPresetPost(qint32 feature_set_index, SWGFeaturePresetIdentifier& body); + void featuresetPresetPut(qint32 feature_set_index, SWGFeaturePresetIdentifier& body); void instanceFeatureSetDelete(); void instanceFeatureSetPost(); @@ -65,6 +70,9 @@ private: void featuresetFeatureSettingsGetCallback (SWGHttpRequestWorker * worker); void featuresetFeatureSettingsPatchCallback (SWGHttpRequestWorker * worker); void featuresetGetCallback (SWGHttpRequestWorker * worker); + void featuresetPresetPatchCallback (SWGHttpRequestWorker * worker); + void featuresetPresetPostCallback (SWGHttpRequestWorker * worker); + void featuresetPresetPutCallback (SWGHttpRequestWorker * worker); void instanceFeatureSetDeleteCallback (SWGHttpRequestWorker * worker); void instanceFeatureSetPostCallback (SWGHttpRequestWorker * worker); @@ -80,6 +88,9 @@ signals: void featuresetFeatureSettingsGetSignal(SWGFeatureSettings* summary); void featuresetFeatureSettingsPatchSignal(SWGFeatureSettings* summary); void featuresetGetSignal(SWGFeatureSet* summary); + void featuresetPresetPatchSignal(SWGFeaturePresetIdentifier* summary); + void featuresetPresetPostSignal(SWGPresetIdentifier* summary); + void featuresetPresetPutSignal(SWGFeaturePresetIdentifier* summary); void instanceFeatureSetDeleteSignal(SWGSuccessResponse* summary); void instanceFeatureSetPostSignal(SWGSuccessResponse* summary); @@ -94,6 +105,9 @@ signals: void featuresetFeatureSettingsGetSignalE(SWGFeatureSettings* summary, QNetworkReply::NetworkError error_type, QString& error_str); void featuresetFeatureSettingsPatchSignalE(SWGFeatureSettings* summary, QNetworkReply::NetworkError error_type, QString& error_str); void featuresetGetSignalE(SWGFeatureSet* summary, QNetworkReply::NetworkError error_type, QString& error_str); + void featuresetPresetPatchSignalE(SWGFeaturePresetIdentifier* summary, QNetworkReply::NetworkError error_type, QString& error_str); + void featuresetPresetPostSignalE(SWGPresetIdentifier* summary, QNetworkReply::NetworkError error_type, QString& error_str); + void featuresetPresetPutSignalE(SWGFeaturePresetIdentifier* summary, QNetworkReply::NetworkError error_type, QString& error_str); void instanceFeatureSetDeleteSignalE(SWGSuccessResponse* summary, QNetworkReply::NetworkError error_type, QString& error_str); void instanceFeatureSetPostSignalE(SWGSuccessResponse* summary, QNetworkReply::NetworkError error_type, QString& error_str); @@ -108,6 +122,9 @@ signals: void featuresetFeatureSettingsGetSignalEFull(SWGHttpRequestWorker* worker, QNetworkReply::NetworkError error_type, QString& error_str); void featuresetFeatureSettingsPatchSignalEFull(SWGHttpRequestWorker* worker, QNetworkReply::NetworkError error_type, QString& error_str); void featuresetGetSignalEFull(SWGHttpRequestWorker* worker, QNetworkReply::NetworkError error_type, QString& error_str); + void featuresetPresetPatchSignalEFull(SWGHttpRequestWorker* worker, QNetworkReply::NetworkError error_type, QString& error_str); + void featuresetPresetPostSignalEFull(SWGHttpRequestWorker* worker, QNetworkReply::NetworkError error_type, QString& error_str); + void featuresetPresetPutSignalEFull(SWGHttpRequestWorker* worker, QNetworkReply::NetworkError error_type, QString& error_str); void instanceFeatureSetDeleteSignalEFull(SWGHttpRequestWorker* worker, QNetworkReply::NetworkError error_type, QString& error_str); void instanceFeatureSetPostSignalEFull(SWGHttpRequestWorker* worker, QNetworkReply::NetworkError error_type, QString& error_str);