From 0d26936e618febaaf3220594df3784a058105f75 Mon Sep 17 00:00:00 2001 From: f4exb Date: Sun, 21 Jul 2019 09:47:11 +0200 Subject: [PATCH] AMBE support: removed code of former /sdrangel/dvserial endpoint. Fixed typo in DVSerial --- sdrbase/resources/webapi/doc/html2/index.html | 746 +----------------- .../resources/webapi/doc/swagger/swagger.yaml | 49 +- sdrbase/webapi/webapiadapterinterface.cpp | 1 - sdrbase/webapi/webapiadapterinterface.h | 35 +- sdrbase/webapi/webapirequestmapper.cpp | 54 +- sdrgui/webapi/webapiadaptergui.cpp | 8 +- sdrgui/webapi/webapiadaptergui.h | 6 +- sdrsrv/webapi/webapiadaptersrv.cpp | 8 +- sdrsrv/webapi/webapiadaptersrv.h | 6 +- swagger/sdrangel/api/swagger/swagger.yaml | 41 +- swagger/sdrangel/code/html2/index.html | 746 +----------------- ...eralDevices.cpp => SWGDVSerialDevices.cpp} | 32 +- ...GDVSeralDevices.h => SWGDVSerialDevices.h} | 18 +- .../code/qt5/client/SWGInstanceApi.cpp | 114 +-- .../sdrangel/code/qt5/client/SWGInstanceApi.h | 16 +- .../code/qt5/client/SWGModelFactory.h | 8 +- 16 files changed, 91 insertions(+), 1797 deletions(-) rename swagger/sdrangel/code/qt5/client/{SWGDVSeralDevices.cpp => SWGDVSerialDevices.cpp} (84%) rename swagger/sdrangel/code/qt5/client/{SWGDVSeralDevices.h => SWGDVSerialDevices.h} (87%) diff --git a/sdrbase/resources/webapi/doc/html2/index.html b/sdrbase/resources/webapi/doc/html2/index.html index f0241dcff..c4b3748b7 100644 --- a/sdrbase/resources/webapi/doc/html2/index.html +++ b/sdrbase/resources/webapi/doc/html2/index.html @@ -2102,7 +2102,16 @@ margin-bottom: 20px; }, "description" : "DSDDemod" }; - defs.DVSeralDevices = { + defs.DVSerialDevice = { + "properties" : { + "deviceName" : { + "type" : "string", + "description" : "Name of the serial device in the system" + } + }, + "description" : "DV serial device details" +}; + defs.DVSerialDevices = { "required" : [ "nbDevices" ], "properties" : { "nbDevices" : { @@ -2118,15 +2127,6 @@ margin-bottom: 20px; } }, "description" : "List of DV serial devices available in the system" -}; - defs.DVSerialDevice = { - "properties" : { - "deviceName" : { - "type" : "string", - "description" : "Name of the serial device in the system" - } - }, - "description" : "DV serial device details" }; defs.DeviceListItem = { "properties" : { @@ -6229,12 +6229,6 @@ margin-bottom: 20px;
  • instanceChannels
  • -
  • - instanceDVSerialGet -
  • -
  • - instanceDVSerialPatch -
  • instanceDelete
  • @@ -16808,7 +16802,7 @@ public class InstanceApiExample { InstanceApi apiInstance = new InstanceApi(); try { - DVSeralDevices result = apiInstance.instanceAMBESerialGet(); + DVSerialDevices result = apiInstance.instanceAMBESerialGet(); System.out.println(result); } catch (ApiException e) { System.err.println("Exception when calling InstanceApi#instanceAMBESerialGet"); @@ -16826,7 +16820,7 @@ public class InstanceApiExample { public static void main(String[] args) { InstanceApi apiInstance = new InstanceApi(); try { - DVSeralDevices result = apiInstance.instanceAMBESerialGet(); + DVSerialDevices result = apiInstance.instanceAMBESerialGet(); System.out.println(result); } catch (ApiException e) { System.err.println("Exception when calling InstanceApi#instanceAMBESerialGet"); @@ -16844,7 +16838,7 @@ public class InstanceApiExample { InstanceApi *apiInstance = [[InstanceApi alloc] init]; [apiInstance instanceAMBESerialGetWithCompletionHandler: - ^(DVSeralDevices output, NSError* error) { + ^(DVSerialDevices output, NSError* error) { if (output) { NSLog(@"%@", output); } @@ -16892,7 +16886,7 @@ namespace Example try { - DVSeralDevices result = apiInstance.instanceAMBESerialGet(); + DVSerialDevices result = apiInstance.instanceAMBESerialGet(); Debug.WriteLine(result); } catch (Exception e) @@ -16979,7 +16973,7 @@ except ApiException as e: var schemaWrapper = { "description" : "On success return list of device paths possibly empty", "schema" : { - "$ref" : "#/definitions/DVSeralDevices" + "$ref" : "#/definitions/DVSerialDevices" } }; var schema = schemaWrapper.schema; @@ -20192,714 +20186,6 @@ except ApiException as e:
    -
    -
    -
    -

    instanceDVSerialGet

    -

    -
    -
    -
    -

    -

    Get DV serial processing parameters for AMBE frames decoding in digital voice modes

    -

    -
    -
    /sdrangel/dvserial
    -

    -

    Usage and SDK Samples

    -

    - - -
    -
    -
    curl -X GET "http://localhost/sdrangel/dvserial"
    -
    -
    -
    import SWGSDRangel.*;
    -import SWGSDRangel.auth.*;
    -import SWGSDRangel.model.*;
    -import SWGSDRangel.api.InstanceApi;
    -
    -import java.io.File;
    -import java.util.*;
    -
    -public class InstanceApiExample {
    -
    -    public static void main(String[] args) {
    -        
    -        InstanceApi apiInstance = new InstanceApi();
    -        try {
    -            DVSeralDevices result = apiInstance.instanceDVSerialGet();
    -            System.out.println(result);
    -        } catch (ApiException e) {
    -            System.err.println("Exception when calling InstanceApi#instanceDVSerialGet");
    -            e.printStackTrace();
    -        }
    -    }
    -}
    -
    - -
    -
    import SWGSDRangel.api.InstanceApi;
    -
    -public class InstanceApiExample {
    -
    -    public static void main(String[] args) {
    -        InstanceApi apiInstance = new InstanceApi();
    -        try {
    -            DVSeralDevices result = apiInstance.instanceDVSerialGet();
    -            System.out.println(result);
    -        } catch (ApiException e) {
    -            System.err.println("Exception when calling InstanceApi#instanceDVSerialGet");
    -            e.printStackTrace();
    -        }
    -    }
    -}
    -
    - -
    -
    
    -InstanceApi *apiInstance = [[InstanceApi alloc] init];
    -
    -[apiInstance instanceDVSerialGetWithCompletionHandler: 
    -              ^(DVSeralDevices output, NSError* error) {
    -                            if (output) {
    -                                NSLog(@"%@", output);
    -                            }
    -                            if (error) {
    -                                NSLog(@"Error: %@", error);
    -                            }
    -                        }];
    -
    -
    - -
    -
    var SdRangel = require('sd_rangel');
    -
    -var api = new SdRangel.InstanceApi()
    -
    -var callback = function(error, data, response) {
    -  if (error) {
    -    console.error(error);
    -  } else {
    -    console.log('API called successfully. Returned data: ' + data);
    -  }
    -};
    -api.instanceDVSerialGet(callback);
    -
    -
    - - -
    -
    using System;
    -using System.Diagnostics;
    -using SWGSDRangel.Api;
    -using SWGSDRangel.Client;
    -using SWGSDRangel.Model;
    -
    -namespace Example
    -{
    -    public class instanceDVSerialGetExample
    -    {
    -        public void main()
    -        {
    -            
    -            var apiInstance = new InstanceApi();
    -
    -            try
    -            {
    -                DVSeralDevices result = apiInstance.instanceDVSerialGet();
    -                Debug.WriteLine(result);
    -            }
    -            catch (Exception e)
    -            {
    -                Debug.Print("Exception when calling InstanceApi.instanceDVSerialGet: " + e.Message );
    -            }
    -        }
    -    }
    -}
    -
    -
    - -
    -
    <?php
    -require_once(__DIR__ . '/vendor/autoload.php');
    -
    -$api_instance = new Swagger\Client\Api\InstanceApi();
    -
    -try {
    -    $result = $api_instance->instanceDVSerialGet();
    -    print_r($result);
    -} catch (Exception $e) {
    -    echo 'Exception when calling InstanceApi->instanceDVSerialGet: ', $e->getMessage(), PHP_EOL;
    -}
    -?>
    -
    - -
    -
    use Data::Dumper;
    -use SWGSDRangel::Configuration;
    -use SWGSDRangel::InstanceApi;
    -
    -my $api_instance = SWGSDRangel::InstanceApi->new();
    -
    -eval { 
    -    my $result = $api_instance->instanceDVSerialGet();
    -    print Dumper($result);
    -};
    -if ($@) {
    -    warn "Exception when calling InstanceApi->instanceDVSerialGet: $@\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.InstanceApi()
    -
    -try: 
    -    api_response = api_instance.instance_dv_serial_get()
    -    pprint(api_response)
    -except ApiException as e:
    -    print("Exception when calling InstanceApi->instanceDVSerialGet: %s\n" % e)
    -
    -
    - -

    Parameters

    - - - - - - -

    Responses

    -

    Status: 200 - On success return list of devices or empty list if unset

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

    Status: 500 - Error

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

    Status: 501 - Function not implemented

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

    instanceDVSerialPatch

    -

    -
    -
    -
    -

    -

    Set or reset DV serial processing for AMBE frames decoding in digital voice modes

    -

    -
    -
    /sdrangel/dvserial
    -

    -

    Usage and SDK Samples

    -

    - - -
    -
    -
    curl -X PATCH "http://localhost/sdrangel/dvserial?dvserial="
    -
    -
    -
    import SWGSDRangel.*;
    -import SWGSDRangel.auth.*;
    -import SWGSDRangel.model.*;
    -import SWGSDRangel.api.InstanceApi;
    -
    -import java.io.File;
    -import java.util.*;
    -
    -public class InstanceApiExample {
    -
    -    public static void main(String[] args) {
    -        
    -        InstanceApi apiInstance = new InstanceApi();
    -        Integer dvserial = 56; // Integer | Set to non zero (true) to set DV serial processing
    -        try {
    -            DVSeralDevices result = apiInstance.instanceDVSerialPatch(dvserial);
    -            System.out.println(result);
    -        } catch (ApiException e) {
    -            System.err.println("Exception when calling InstanceApi#instanceDVSerialPatch");
    -            e.printStackTrace();
    -        }
    -    }
    -}
    -
    - -
    -
    import SWGSDRangel.api.InstanceApi;
    -
    -public class InstanceApiExample {
    -
    -    public static void main(String[] args) {
    -        InstanceApi apiInstance = new InstanceApi();
    -        Integer dvserial = 56; // Integer | Set to non zero (true) to set DV serial processing
    -        try {
    -            DVSeralDevices result = apiInstance.instanceDVSerialPatch(dvserial);
    -            System.out.println(result);
    -        } catch (ApiException e) {
    -            System.err.println("Exception when calling InstanceApi#instanceDVSerialPatch");
    -            e.printStackTrace();
    -        }
    -    }
    -}
    -
    - -
    -
    Integer *dvserial = 56; // Set to non zero (true) to set DV serial processing (optional)
    -
    -InstanceApi *apiInstance = [[InstanceApi alloc] init];
    -
    -[apiInstance instanceDVSerialPatchWith:dvserial
    -              completionHandler: ^(DVSeralDevices output, NSError* error) {
    -                            if (output) {
    -                                NSLog(@"%@", output);
    -                            }
    -                            if (error) {
    -                                NSLog(@"Error: %@", error);
    -                            }
    -                        }];
    -
    -
    - -
    -
    var SdRangel = require('sd_rangel');
    -
    -var api = new SdRangel.InstanceApi()
    -
    -var opts = { 
    -  'dvserial': 56 // {Integer} Set to non zero (true) to set DV serial processing
    -};
    -
    -var callback = function(error, data, response) {
    -  if (error) {
    -    console.error(error);
    -  } else {
    -    console.log('API called successfully. Returned data: ' + data);
    -  }
    -};
    -api.instanceDVSerialPatch(opts, callback);
    -
    -
    - - -
    -
    using System;
    -using System.Diagnostics;
    -using SWGSDRangel.Api;
    -using SWGSDRangel.Client;
    -using SWGSDRangel.Model;
    -
    -namespace Example
    -{
    -    public class instanceDVSerialPatchExample
    -    {
    -        public void main()
    -        {
    -            
    -            var apiInstance = new InstanceApi();
    -            var dvserial = 56;  // Integer | Set to non zero (true) to set DV serial processing (optional) 
    -
    -            try
    -            {
    -                DVSeralDevices result = apiInstance.instanceDVSerialPatch(dvserial);
    -                Debug.WriteLine(result);
    -            }
    -            catch (Exception e)
    -            {
    -                Debug.Print("Exception when calling InstanceApi.instanceDVSerialPatch: " + e.Message );
    -            }
    -        }
    -    }
    -}
    -
    -
    - -
    -
    <?php
    -require_once(__DIR__ . '/vendor/autoload.php');
    -
    -$api_instance = new Swagger\Client\Api\InstanceApi();
    -$dvserial = 56; // Integer | Set to non zero (true) to set DV serial processing
    -
    -try {
    -    $result = $api_instance->instanceDVSerialPatch($dvserial);
    -    print_r($result);
    -} catch (Exception $e) {
    -    echo 'Exception when calling InstanceApi->instanceDVSerialPatch: ', $e->getMessage(), PHP_EOL;
    -}
    -?>
    -
    - -
    -
    use Data::Dumper;
    -use SWGSDRangel::Configuration;
    -use SWGSDRangel::InstanceApi;
    -
    -my $api_instance = SWGSDRangel::InstanceApi->new();
    -my $dvserial = 56; # Integer | Set to non zero (true) to set DV serial processing
    -
    -eval { 
    -    my $result = $api_instance->instanceDVSerialPatch(dvserial => $dvserial);
    -    print Dumper($result);
    -};
    -if ($@) {
    -    warn "Exception when calling InstanceApi->instanceDVSerialPatch: $@\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.InstanceApi()
    -dvserial = 56 # Integer | Set to non zero (true) to set DV serial processing (optional)
    -
    -try: 
    -    api_response = api_instance.instance_dv_serial_patch(dvserial=dvserial)
    -    pprint(api_response)
    -except ApiException as e:
    -    print("Exception when calling InstanceApi->instanceDVSerialPatch: %s\n" % e)
    -
    -
    - -

    Parameters

    - - - - - -
    Query parameters
    - - - - - - - - - -
    NameDescription
    dvserial - - -
    -
    -
    - - Integer - - -
    - Set to non zero (true) to set DV serial processing -
    -
    -
    -
    -
    - -

    Responses

    -

    Status: 200 - On success return list of devices or empty list if unset

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

    Status: 500 - Error

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

    Status: 501 - Function not implemented

    - - - -
    -
    -
    - -
    - -
    -
    - -
    -
    -
    @@ -27046,7 +26332,7 @@ except ApiException as e:
    - Generated 2019-07-20T20:43:22.760+02:00 + Generated 2019-07-21T09:34:48.176+02:00
    diff --git a/sdrbase/resources/webapi/doc/swagger/swagger.yaml b/sdrbase/resources/webapi/doc/swagger/swagger.yaml index 8081e3af0..358761278 100644 --- a/sdrbase/resources/webapi/doc/swagger/swagger.yaml +++ b/sdrbase/resources/webapi/doc/swagger/swagger.yaml @@ -373,43 +373,6 @@ paths: "501": $ref: "#/responses/Response_501" - /sdrangel/dvserial: - x-swagger-router-controller: instance - get: - description: Get DV serial processing parameters for AMBE frames decoding in digital voice modes - operationId: instanceDVSerialGet - tags: - - Instance - responses: - "200": - description: On success return list of devices or empty list if unset - schema: - $ref: "#/definitions/DVSeralDevices" - "500": - $ref: "#/responses/Response_500" - "501": - $ref: "#/responses/Response_501" - patch: - description: Set or reset DV serial processing for AMBE frames decoding in digital voice modes - operationId: instanceDVSerialPatch - tags: - - Instance - parameters: - - name: dvserial - in: query - description: Set to non zero (true) to set DV serial processing - required: false - type: integer - responses: - "200": - description: On success return list of devices or empty list if unset - schema: - $ref: "#/definitions/DVSeralDevices" - "500": - $ref: "#/responses/Response_500" - "501": - $ref: "#/responses/Response_501" - /sdrangel/ambe/serial: x-swagger-router-controller: instance get: @@ -421,7 +384,7 @@ paths: "200": description: On success return list of device paths possibly empty schema: - $ref: "#/definitions/DVSeralDevices" + $ref: "#/definitions/DVSerialDevices" "500": $ref: "#/responses/Response_500" "501": @@ -431,7 +394,7 @@ paths: x-swagger-router-controller: instance get: description: get the list of AMBE devices (serial or address) used for AMBE frames decoding in digital voice modes - operationId: instanceAMBEDevicesGet + operationId: InstanceAMBEDevicesGet tags: - Instance responses: @@ -445,7 +408,7 @@ paths: $ref: "#/responses/Response_501" put: description: Replace the list of active devices - operationId: instanceAMBEDevicesPut + operationId: InstanceAMBEDevicesPut tags: - Instance consumes: @@ -468,7 +431,7 @@ paths: $ref: "#/responses/Response_501" delete: description: Emtpy the active devices thus effectively closing down AMBE devices support - operationId: instanceAMBEDevicesDelete + operationId: InstanceAMBEDevicesDelete tags: - Instance responses: @@ -482,7 +445,7 @@ paths: $ref: "#/responses/Response_501" patch: description: Add and/or delete devices to/from the active list - operationId: instanceAMBEDevicesPatch + operationId: InstanceAMBEDevicesPatch tags: - Instance consumes: @@ -1731,7 +1694,7 @@ definitions: type: number format: float - DVSeralDevices: + DVSerialDevices: description: "List of DV serial devices available in the system" required: - nbDevices diff --git a/sdrbase/webapi/webapiadapterinterface.cpp b/sdrbase/webapi/webapiadapterinterface.cpp index f56aa29e4..c0e28a3ce 100644 --- a/sdrbase/webapi/webapiadapterinterface.cpp +++ b/sdrbase/webapi/webapiadapterinterface.cpp @@ -29,7 +29,6 @@ QString WebAPIAdapterInterface::instanceAudioOutputParametersURL = "/sdrangel/au QString WebAPIAdapterInterface::instanceAudioInputCleanupURL = "/sdrangel/audio/input/cleanup"; QString WebAPIAdapterInterface::instanceAudioOutputCleanupURL = "/sdrangel/audio/output/cleanup"; QString WebAPIAdapterInterface::instanceLocationURL = "/sdrangel/location"; -QString WebAPIAdapterInterface::instanceDVSerialURL = "/sdrangel/dvserial"; QString WebAPIAdapterInterface::instanceAMBESerialURL = "/sdrangel/ambe/serial"; QString WebAPIAdapterInterface::instanceAMBEDevicesURL = "/sdrangel/ambe/devices"; QString WebAPIAdapterInterface::instancePresetsURL = "/sdrangel/presets"; diff --git a/sdrbase/webapi/webapiadapterinterface.h b/sdrbase/webapi/webapiadapterinterface.h index 6b6fd855f..dce8b0712 100644 --- a/sdrbase/webapi/webapiadapterinterface.h +++ b/sdrbase/webapi/webapiadapterinterface.h @@ -37,7 +37,7 @@ namespace SWGSDRangel class SWGAudioInputDevice; class SWGAudioOutputDevice; class SWGLocationInformation; - class SWGDVSeralDevices; + class SWGDVSerialDevices; class SWGAMBEDevices; class SWGPresets; class SWGPresetTransfer; @@ -281,42 +281,12 @@ public: return 501; } - /** - * Handler of /sdrangel/dvserial (GET) swagger/sdrangel/code/html2/index.html#api-Default-instanceChannels - * returns the Http status code (default 501: not implemented) - */ - virtual int instanceDVSerialGet( - SWGSDRangel::SWGDVSeralDevices& response, - SWGSDRangel::SWGErrorResponse& error) - { - (void) response; - error.init(); - *error.getMessage() = QString("Function not implemented"); - return 501; - } - - /** - * Handler of /sdrangel/dvserial (PUT) swagger/sdrangel/code/html2/index.html#api-Default-instanceChannels - * returns the Http status code (default 501: not implemented) - */ - virtual int instanceDVSerialPatch( - bool dvserial, - SWGSDRangel::SWGDVSeralDevices& response, - SWGSDRangel::SWGErrorResponse& error) - { - (void) dvserial; - (void) response; - error.init(); - *error.getMessage() = QString("Function not implemented"); - return 501; - } - /** * Handler of /sdrangel/ambe/serial (GET) swagger/sdrangel/code/html2/index.html#api-Default-instanceChannels * returns the Http status code (default 501: not implemented) */ virtual int instanceAMBESerialGet( - SWGSDRangel::SWGDVSeralDevices& response, + SWGSDRangel::SWGDVSerialDevices& response, SWGSDRangel::SWGErrorResponse& error) { (void) response; @@ -809,7 +779,6 @@ public: static QString instanceAudioInputCleanupURL; static QString instanceAudioOutputCleanupURL; static QString instanceLocationURL; - static QString instanceDVSerialURL; static QString instanceAMBESerialURL; static QString instanceAMBEDevicesURL; static QString instancePresetsURL; diff --git a/sdrbase/webapi/webapirequestmapper.cpp b/sdrbase/webapi/webapirequestmapper.cpp index 74b781163..eb8f08bab 100644 --- a/sdrbase/webapi/webapirequestmapper.cpp +++ b/sdrbase/webapi/webapirequestmapper.cpp @@ -30,7 +30,7 @@ #include "SWGInstanceChannelsResponse.h" #include "SWGAudioDevices.h" #include "SWGLocationInformation.h" -#include "SWGDVSeralDevices.h" +#include "SWGDVSerialDevices.h" #include "SWGAMBEDevices.h" #include "SWGPresets.h" #include "SWGPresetTransfer.h" @@ -114,8 +114,6 @@ void WebAPIRequestMapper::service(qtwebapp::HttpRequest& request, qtwebapp::Http instanceAudioOutputCleanupService(request, response); } else if (path == WebAPIAdapterInterface::instanceLocationURL) { instanceLocationService(request, response); - } else if (path == WebAPIAdapterInterface::instanceDVSerialURL) { - instanceDVSerialService(request, response); } else if (path == WebAPIAdapterInterface::instanceAMBESerialURL) { instanceAMBESerialService(request, response); } else if (path == WebAPIAdapterInterface::instanceAMBEDevicesURL) { @@ -621,54 +619,6 @@ void WebAPIRequestMapper::instanceLocationService(qtwebapp::HttpRequest& request } } -void WebAPIRequestMapper::instanceDVSerialService(qtwebapp::HttpRequest& request, qtwebapp::HttpResponse& response) -{ - SWGSDRangel::SWGErrorResponse errorResponse; - response.setHeader("Content-Type", "application/json"); - response.setHeader("Access-Control-Allow-Origin", "*"); - - if (request.getMethod() == "GET") - { - SWGSDRangel::SWGDVSeralDevices normalResponse; - - int status = m_adapter->instanceDVSerialGet(normalResponse, errorResponse); - response.setStatus(status); - - if (status/100 == 2) { - response.write(normalResponse.asJson().toUtf8()); - } else { - response.write(errorResponse.asJson().toUtf8()); - } - } - else if (request.getMethod() == "PATCH") - { - QByteArray dvserialStr = request.getParameter("dvserial"); - bool dvserial = false; - - if (dvserialStr.length() != 0) { - dvserial = !(dvserialStr == "0"); - } - - SWGSDRangel::SWGDVSeralDevices normalResponse; - - int status = m_adapter->instanceDVSerialPatch(dvserial, normalResponse, errorResponse); - response.setStatus(status); - - if (status/100 == 2) { - response.write(normalResponse.asJson().toUtf8()); - } else { - response.write(errorResponse.asJson().toUtf8()); - } - } - else - { - response.setStatus(405,"Invalid HTTP method"); - errorResponse.init(); - *errorResponse.getMessage() = "Invalid HTTP method"; - response.write(errorResponse.asJson().toUtf8()); - } -} - void WebAPIRequestMapper::instanceAMBESerialService(qtwebapp::HttpRequest& request, qtwebapp::HttpResponse& response) { SWGSDRangel::SWGErrorResponse errorResponse; @@ -677,7 +627,7 @@ void WebAPIRequestMapper::instanceAMBESerialService(qtwebapp::HttpRequest& reque if (request.getMethod() == "GET") { - SWGSDRangel::SWGDVSeralDevices normalResponse; + SWGSDRangel::SWGDVSerialDevices normalResponse; int status = m_adapter->instanceAMBESerialGet(normalResponse, errorResponse); response.setStatus(status); diff --git a/sdrgui/webapi/webapiadaptergui.cpp b/sdrgui/webapi/webapiadaptergui.cpp index fea7e2464..c066eff78 100644 --- a/sdrgui/webapi/webapiadaptergui.cpp +++ b/sdrgui/webapi/webapiadaptergui.cpp @@ -42,7 +42,7 @@ #include "SWGDeviceListItem.h" #include "SWGAudioDevices.h" #include "SWGLocationInformation.h" -#include "SWGDVSeralDevices.h" +#include "SWGDVSerialDevices.h" #include "SWGDVSerialDevice.h" #include "SWGAMBEDevices.h" #include "SWGPresets.h" @@ -568,7 +568,7 @@ int WebAPIAdapterGUI::instanceLocationPut( } int WebAPIAdapterGUI::instanceDVSerialGet( - SWGSDRangel::SWGDVSeralDevices& response, + SWGSDRangel::SWGDVSerialDevices& response, SWGSDRangel::SWGErrorResponse& error) { (void) error; @@ -594,7 +594,7 @@ int WebAPIAdapterGUI::instanceDVSerialGet( int WebAPIAdapterGUI::instanceDVSerialPatch( bool dvserial, - SWGSDRangel::SWGDVSeralDevices& response, + SWGSDRangel::SWGDVSerialDevices& response, SWGSDRangel::SWGErrorResponse& error) { (void) error; @@ -628,7 +628,7 @@ int WebAPIAdapterGUI::instanceDVSerialPatch( } int WebAPIAdapterGUI::instanceAMBESerialGet( - SWGSDRangel::SWGDVSeralDevices& response, + SWGSDRangel::SWGDVSerialDevices& response, SWGSDRangel::SWGErrorResponse& error) { (void) error; diff --git a/sdrgui/webapi/webapiadaptergui.h b/sdrgui/webapi/webapiadaptergui.h index 54a6c9744..4446541b7 100644 --- a/sdrgui/webapi/webapiadaptergui.h +++ b/sdrgui/webapi/webapiadaptergui.h @@ -99,16 +99,16 @@ public: SWGSDRangel::SWGErrorResponse& error); virtual int instanceDVSerialGet( - SWGSDRangel::SWGDVSeralDevices& response, + SWGSDRangel::SWGDVSerialDevices& response, SWGSDRangel::SWGErrorResponse& error); virtual int instanceDVSerialPatch( bool dvserial, - SWGSDRangel::SWGDVSeralDevices& response, + SWGSDRangel::SWGDVSerialDevices& response, SWGSDRangel::SWGErrorResponse& error); virtual int instanceAMBESerialGet( - SWGSDRangel::SWGDVSeralDevices& response, + SWGSDRangel::SWGDVSerialDevices& response, SWGSDRangel::SWGErrorResponse& error); virtual int instanceAMBEDevicesGet( diff --git a/sdrsrv/webapi/webapiadaptersrv.cpp b/sdrsrv/webapi/webapiadaptersrv.cpp index ed5586855..22869ba21 100644 --- a/sdrsrv/webapi/webapiadaptersrv.cpp +++ b/sdrsrv/webapi/webapiadaptersrv.cpp @@ -28,7 +28,7 @@ #include "SWGLoggingInfo.h" #include "SWGAudioDevices.h" #include "SWGLocationInformation.h" -#include "SWGDVSeralDevices.h" +#include "SWGDVSerialDevices.h" #include "SWGAMBEDevices.h" #include "SWGPresetImport.h" #include "SWGPresetExport.h" @@ -553,7 +553,7 @@ int WebAPIAdapterSrv::instanceLocationPut( } int WebAPIAdapterSrv::instanceDVSerialGet( - SWGSDRangel::SWGDVSeralDevices& response, + SWGSDRangel::SWGDVSerialDevices& response, SWGSDRangel::SWGErrorResponse& error) { response.init(); @@ -578,7 +578,7 @@ int WebAPIAdapterSrv::instanceDVSerialGet( int WebAPIAdapterSrv::instanceDVSerialPatch( bool dvserial, - SWGSDRangel::SWGDVSeralDevices& response, + SWGSDRangel::SWGDVSerialDevices& response, SWGSDRangel::SWGErrorResponse& error) { m_mainCore.m_dspEngine->setDVSerialSupport(dvserial); @@ -611,7 +611,7 @@ int WebAPIAdapterSrv::instanceDVSerialPatch( } int WebAPIAdapterSrv::instanceAMBESerialGet( - SWGSDRangel::SWGDVSeralDevices& response, + SWGSDRangel::SWGDVSerialDevices& response, SWGSDRangel::SWGErrorResponse& error) { (void) error; diff --git a/sdrsrv/webapi/webapiadaptersrv.h b/sdrsrv/webapi/webapiadaptersrv.h index 5988c707c..1ceea4590 100644 --- a/sdrsrv/webapi/webapiadaptersrv.h +++ b/sdrsrv/webapi/webapiadaptersrv.h @@ -99,16 +99,16 @@ public: SWGSDRangel::SWGErrorResponse& error); virtual int instanceDVSerialGet( - SWGSDRangel::SWGDVSeralDevices& response, + SWGSDRangel::SWGDVSerialDevices& response, SWGSDRangel::SWGErrorResponse& error); virtual int instanceDVSerialPatch( bool dvserial, - SWGSDRangel::SWGDVSeralDevices& response, + SWGSDRangel::SWGDVSerialDevices& response, SWGSDRangel::SWGErrorResponse& error); virtual int instanceAMBESerialGet( - SWGSDRangel::SWGDVSeralDevices& response, + SWGSDRangel::SWGDVSerialDevices& response, SWGSDRangel::SWGErrorResponse& error); virtual int instanceAMBEDevicesGet( diff --git a/swagger/sdrangel/api/swagger/swagger.yaml b/swagger/sdrangel/api/swagger/swagger.yaml index e0d0f221d..1ff059598 100644 --- a/swagger/sdrangel/api/swagger/swagger.yaml +++ b/swagger/sdrangel/api/swagger/swagger.yaml @@ -373,43 +373,6 @@ paths: "501": $ref: "#/responses/Response_501" - /sdrangel/dvserial: - x-swagger-router-controller: instance - get: - description: Get DV serial processing parameters for AMBE frames decoding in digital voice modes - operationId: instanceDVSerialGet - tags: - - Instance - responses: - "200": - description: On success return list of devices or empty list if unset - schema: - $ref: "#/definitions/DVSeralDevices" - "500": - $ref: "#/responses/Response_500" - "501": - $ref: "#/responses/Response_501" - patch: - description: Set or reset DV serial processing for AMBE frames decoding in digital voice modes - operationId: instanceDVSerialPatch - tags: - - Instance - parameters: - - name: dvserial - in: query - description: Set to non zero (true) to set DV serial processing - required: false - type: integer - responses: - "200": - description: On success return list of devices or empty list if unset - schema: - $ref: "#/definitions/DVSeralDevices" - "500": - $ref: "#/responses/Response_500" - "501": - $ref: "#/responses/Response_501" - /sdrangel/ambe/serial: x-swagger-router-controller: instance get: @@ -421,7 +384,7 @@ paths: "200": description: On success return list of device paths possibly empty schema: - $ref: "#/definitions/DVSeralDevices" + $ref: "#/definitions/DVSerialDevices" "500": $ref: "#/responses/Response_500" "501": @@ -1731,7 +1694,7 @@ definitions: type: number format: float - DVSeralDevices: + DVSerialDevices: description: "List of DV serial devices available in the system" required: - nbDevices diff --git a/swagger/sdrangel/code/html2/index.html b/swagger/sdrangel/code/html2/index.html index f0241dcff..c4b3748b7 100644 --- a/swagger/sdrangel/code/html2/index.html +++ b/swagger/sdrangel/code/html2/index.html @@ -2102,7 +2102,16 @@ margin-bottom: 20px; }, "description" : "DSDDemod" }; - defs.DVSeralDevices = { + defs.DVSerialDevice = { + "properties" : { + "deviceName" : { + "type" : "string", + "description" : "Name of the serial device in the system" + } + }, + "description" : "DV serial device details" +}; + defs.DVSerialDevices = { "required" : [ "nbDevices" ], "properties" : { "nbDevices" : { @@ -2118,15 +2127,6 @@ margin-bottom: 20px; } }, "description" : "List of DV serial devices available in the system" -}; - defs.DVSerialDevice = { - "properties" : { - "deviceName" : { - "type" : "string", - "description" : "Name of the serial device in the system" - } - }, - "description" : "DV serial device details" }; defs.DeviceListItem = { "properties" : { @@ -6229,12 +6229,6 @@ margin-bottom: 20px;
  • instanceChannels
  • -
  • - instanceDVSerialGet -
  • -
  • - instanceDVSerialPatch -
  • instanceDelete
  • @@ -16808,7 +16802,7 @@ public class InstanceApiExample { InstanceApi apiInstance = new InstanceApi(); try { - DVSeralDevices result = apiInstance.instanceAMBESerialGet(); + DVSerialDevices result = apiInstance.instanceAMBESerialGet(); System.out.println(result); } catch (ApiException e) { System.err.println("Exception when calling InstanceApi#instanceAMBESerialGet"); @@ -16826,7 +16820,7 @@ public class InstanceApiExample { public static void main(String[] args) { InstanceApi apiInstance = new InstanceApi(); try { - DVSeralDevices result = apiInstance.instanceAMBESerialGet(); + DVSerialDevices result = apiInstance.instanceAMBESerialGet(); System.out.println(result); } catch (ApiException e) { System.err.println("Exception when calling InstanceApi#instanceAMBESerialGet"); @@ -16844,7 +16838,7 @@ public class InstanceApiExample { InstanceApi *apiInstance = [[InstanceApi alloc] init]; [apiInstance instanceAMBESerialGetWithCompletionHandler: - ^(DVSeralDevices output, NSError* error) { + ^(DVSerialDevices output, NSError* error) { if (output) { NSLog(@"%@", output); } @@ -16892,7 +16886,7 @@ namespace Example try { - DVSeralDevices result = apiInstance.instanceAMBESerialGet(); + DVSerialDevices result = apiInstance.instanceAMBESerialGet(); Debug.WriteLine(result); } catch (Exception e) @@ -16979,7 +16973,7 @@ except ApiException as e: var schemaWrapper = { "description" : "On success return list of device paths possibly empty", "schema" : { - "$ref" : "#/definitions/DVSeralDevices" + "$ref" : "#/definitions/DVSerialDevices" } }; var schema = schemaWrapper.schema; @@ -20192,714 +20186,6 @@ except ApiException as e:
    -
    -
    -
    -

    instanceDVSerialGet

    -

    -
    -
    -
    -

    -

    Get DV serial processing parameters for AMBE frames decoding in digital voice modes

    -

    -
    -
    /sdrangel/dvserial
    -

    -

    Usage and SDK Samples

    -

    - - -
    -
    -
    curl -X GET "http://localhost/sdrangel/dvserial"
    -
    -
    -
    import SWGSDRangel.*;
    -import SWGSDRangel.auth.*;
    -import SWGSDRangel.model.*;
    -import SWGSDRangel.api.InstanceApi;
    -
    -import java.io.File;
    -import java.util.*;
    -
    -public class InstanceApiExample {
    -
    -    public static void main(String[] args) {
    -        
    -        InstanceApi apiInstance = new InstanceApi();
    -        try {
    -            DVSeralDevices result = apiInstance.instanceDVSerialGet();
    -            System.out.println(result);
    -        } catch (ApiException e) {
    -            System.err.println("Exception when calling InstanceApi#instanceDVSerialGet");
    -            e.printStackTrace();
    -        }
    -    }
    -}
    -
    - -
    -
    import SWGSDRangel.api.InstanceApi;
    -
    -public class InstanceApiExample {
    -
    -    public static void main(String[] args) {
    -        InstanceApi apiInstance = new InstanceApi();
    -        try {
    -            DVSeralDevices result = apiInstance.instanceDVSerialGet();
    -            System.out.println(result);
    -        } catch (ApiException e) {
    -            System.err.println("Exception when calling InstanceApi#instanceDVSerialGet");
    -            e.printStackTrace();
    -        }
    -    }
    -}
    -
    - -
    -
    
    -InstanceApi *apiInstance = [[InstanceApi alloc] init];
    -
    -[apiInstance instanceDVSerialGetWithCompletionHandler: 
    -              ^(DVSeralDevices output, NSError* error) {
    -                            if (output) {
    -                                NSLog(@"%@", output);
    -                            }
    -                            if (error) {
    -                                NSLog(@"Error: %@", error);
    -                            }
    -                        }];
    -
    -
    - -
    -
    var SdRangel = require('sd_rangel');
    -
    -var api = new SdRangel.InstanceApi()
    -
    -var callback = function(error, data, response) {
    -  if (error) {
    -    console.error(error);
    -  } else {
    -    console.log('API called successfully. Returned data: ' + data);
    -  }
    -};
    -api.instanceDVSerialGet(callback);
    -
    -
    - - -
    -
    using System;
    -using System.Diagnostics;
    -using SWGSDRangel.Api;
    -using SWGSDRangel.Client;
    -using SWGSDRangel.Model;
    -
    -namespace Example
    -{
    -    public class instanceDVSerialGetExample
    -    {
    -        public void main()
    -        {
    -            
    -            var apiInstance = new InstanceApi();
    -
    -            try
    -            {
    -                DVSeralDevices result = apiInstance.instanceDVSerialGet();
    -                Debug.WriteLine(result);
    -            }
    -            catch (Exception e)
    -            {
    -                Debug.Print("Exception when calling InstanceApi.instanceDVSerialGet: " + e.Message );
    -            }
    -        }
    -    }
    -}
    -
    -
    - -
    -
    <?php
    -require_once(__DIR__ . '/vendor/autoload.php');
    -
    -$api_instance = new Swagger\Client\Api\InstanceApi();
    -
    -try {
    -    $result = $api_instance->instanceDVSerialGet();
    -    print_r($result);
    -} catch (Exception $e) {
    -    echo 'Exception when calling InstanceApi->instanceDVSerialGet: ', $e->getMessage(), PHP_EOL;
    -}
    -?>
    -
    - -
    -
    use Data::Dumper;
    -use SWGSDRangel::Configuration;
    -use SWGSDRangel::InstanceApi;
    -
    -my $api_instance = SWGSDRangel::InstanceApi->new();
    -
    -eval { 
    -    my $result = $api_instance->instanceDVSerialGet();
    -    print Dumper($result);
    -};
    -if ($@) {
    -    warn "Exception when calling InstanceApi->instanceDVSerialGet: $@\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.InstanceApi()
    -
    -try: 
    -    api_response = api_instance.instance_dv_serial_get()
    -    pprint(api_response)
    -except ApiException as e:
    -    print("Exception when calling InstanceApi->instanceDVSerialGet: %s\n" % e)
    -
    -
    - -

    Parameters

    - - - - - - -

    Responses

    -

    Status: 200 - On success return list of devices or empty list if unset

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

    Status: 500 - Error

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

    Status: 501 - Function not implemented

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

    instanceDVSerialPatch

    -

    -
    -
    -
    -

    -

    Set or reset DV serial processing for AMBE frames decoding in digital voice modes

    -

    -
    -
    /sdrangel/dvserial
    -

    -

    Usage and SDK Samples

    -

    - - -
    -
    -
    curl -X PATCH "http://localhost/sdrangel/dvserial?dvserial="
    -
    -
    -
    import SWGSDRangel.*;
    -import SWGSDRangel.auth.*;
    -import SWGSDRangel.model.*;
    -import SWGSDRangel.api.InstanceApi;
    -
    -import java.io.File;
    -import java.util.*;
    -
    -public class InstanceApiExample {
    -
    -    public static void main(String[] args) {
    -        
    -        InstanceApi apiInstance = new InstanceApi();
    -        Integer dvserial = 56; // Integer | Set to non zero (true) to set DV serial processing
    -        try {
    -            DVSeralDevices result = apiInstance.instanceDVSerialPatch(dvserial);
    -            System.out.println(result);
    -        } catch (ApiException e) {
    -            System.err.println("Exception when calling InstanceApi#instanceDVSerialPatch");
    -            e.printStackTrace();
    -        }
    -    }
    -}
    -
    - -
    -
    import SWGSDRangel.api.InstanceApi;
    -
    -public class InstanceApiExample {
    -
    -    public static void main(String[] args) {
    -        InstanceApi apiInstance = new InstanceApi();
    -        Integer dvserial = 56; // Integer | Set to non zero (true) to set DV serial processing
    -        try {
    -            DVSeralDevices result = apiInstance.instanceDVSerialPatch(dvserial);
    -            System.out.println(result);
    -        } catch (ApiException e) {
    -            System.err.println("Exception when calling InstanceApi#instanceDVSerialPatch");
    -            e.printStackTrace();
    -        }
    -    }
    -}
    -
    - -
    -
    Integer *dvserial = 56; // Set to non zero (true) to set DV serial processing (optional)
    -
    -InstanceApi *apiInstance = [[InstanceApi alloc] init];
    -
    -[apiInstance instanceDVSerialPatchWith:dvserial
    -              completionHandler: ^(DVSeralDevices output, NSError* error) {
    -                            if (output) {
    -                                NSLog(@"%@", output);
    -                            }
    -                            if (error) {
    -                                NSLog(@"Error: %@", error);
    -                            }
    -                        }];
    -
    -
    - -
    -
    var SdRangel = require('sd_rangel');
    -
    -var api = new SdRangel.InstanceApi()
    -
    -var opts = { 
    -  'dvserial': 56 // {Integer} Set to non zero (true) to set DV serial processing
    -};
    -
    -var callback = function(error, data, response) {
    -  if (error) {
    -    console.error(error);
    -  } else {
    -    console.log('API called successfully. Returned data: ' + data);
    -  }
    -};
    -api.instanceDVSerialPatch(opts, callback);
    -
    -
    - - -
    -
    using System;
    -using System.Diagnostics;
    -using SWGSDRangel.Api;
    -using SWGSDRangel.Client;
    -using SWGSDRangel.Model;
    -
    -namespace Example
    -{
    -    public class instanceDVSerialPatchExample
    -    {
    -        public void main()
    -        {
    -            
    -            var apiInstance = new InstanceApi();
    -            var dvserial = 56;  // Integer | Set to non zero (true) to set DV serial processing (optional) 
    -
    -            try
    -            {
    -                DVSeralDevices result = apiInstance.instanceDVSerialPatch(dvserial);
    -                Debug.WriteLine(result);
    -            }
    -            catch (Exception e)
    -            {
    -                Debug.Print("Exception when calling InstanceApi.instanceDVSerialPatch: " + e.Message );
    -            }
    -        }
    -    }
    -}
    -
    -
    - -
    -
    <?php
    -require_once(__DIR__ . '/vendor/autoload.php');
    -
    -$api_instance = new Swagger\Client\Api\InstanceApi();
    -$dvserial = 56; // Integer | Set to non zero (true) to set DV serial processing
    -
    -try {
    -    $result = $api_instance->instanceDVSerialPatch($dvserial);
    -    print_r($result);
    -} catch (Exception $e) {
    -    echo 'Exception when calling InstanceApi->instanceDVSerialPatch: ', $e->getMessage(), PHP_EOL;
    -}
    -?>
    -
    - -
    -
    use Data::Dumper;
    -use SWGSDRangel::Configuration;
    -use SWGSDRangel::InstanceApi;
    -
    -my $api_instance = SWGSDRangel::InstanceApi->new();
    -my $dvserial = 56; # Integer | Set to non zero (true) to set DV serial processing
    -
    -eval { 
    -    my $result = $api_instance->instanceDVSerialPatch(dvserial => $dvserial);
    -    print Dumper($result);
    -};
    -if ($@) {
    -    warn "Exception when calling InstanceApi->instanceDVSerialPatch: $@\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.InstanceApi()
    -dvserial = 56 # Integer | Set to non zero (true) to set DV serial processing (optional)
    -
    -try: 
    -    api_response = api_instance.instance_dv_serial_patch(dvserial=dvserial)
    -    pprint(api_response)
    -except ApiException as e:
    -    print("Exception when calling InstanceApi->instanceDVSerialPatch: %s\n" % e)
    -
    -
    - -

    Parameters

    - - - - - -
    Query parameters
    - - - - - - - - - -
    NameDescription
    dvserial - - -
    -
    -
    - - Integer - - -
    - Set to non zero (true) to set DV serial processing -
    -
    -
    -
    -
    - -

    Responses

    -

    Status: 200 - On success return list of devices or empty list if unset

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

    Status: 500 - Error

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

    Status: 501 - Function not implemented

    - - - -
    -
    -
    - -
    - -
    -
    - -
    -
    -
    @@ -27046,7 +26332,7 @@ except ApiException as e:
    - Generated 2019-07-20T20:43:22.760+02:00 + Generated 2019-07-21T09:34:48.176+02:00
    diff --git a/swagger/sdrangel/code/qt5/client/SWGDVSeralDevices.cpp b/swagger/sdrangel/code/qt5/client/SWGDVSerialDevices.cpp similarity index 84% rename from swagger/sdrangel/code/qt5/client/SWGDVSeralDevices.cpp rename to swagger/sdrangel/code/qt5/client/SWGDVSerialDevices.cpp index beae37d4a..2f7b2ba9a 100644 --- a/swagger/sdrangel/code/qt5/client/SWGDVSeralDevices.cpp +++ b/swagger/sdrangel/code/qt5/client/SWGDVSerialDevices.cpp @@ -11,7 +11,7 @@ */ -#include "SWGDVSeralDevices.h" +#include "SWGDVSerialDevices.h" #include "SWGHelpers.h" @@ -22,24 +22,24 @@ namespace SWGSDRangel { -SWGDVSeralDevices::SWGDVSeralDevices(QString* json) { +SWGDVSerialDevices::SWGDVSerialDevices(QString* json) { init(); this->fromJson(*json); } -SWGDVSeralDevices::SWGDVSeralDevices() { +SWGDVSerialDevices::SWGDVSerialDevices() { nb_devices = 0; m_nb_devices_isSet = false; dv_serial_devices = nullptr; m_dv_serial_devices_isSet = false; } -SWGDVSeralDevices::~SWGDVSeralDevices() { +SWGDVSerialDevices::~SWGDVSerialDevices() { this->cleanup(); } void -SWGDVSeralDevices::init() { +SWGDVSerialDevices::init() { nb_devices = 0; m_nb_devices_isSet = false; dv_serial_devices = new QList(); @@ -47,7 +47,7 @@ SWGDVSeralDevices::init() { } void -SWGDVSeralDevices::cleanup() { +SWGDVSerialDevices::cleanup() { if(dv_serial_devices != nullptr) { auto arr = dv_serial_devices; @@ -58,8 +58,8 @@ SWGDVSeralDevices::cleanup() { } } -SWGDVSeralDevices* -SWGDVSeralDevices::fromJson(QString &json) { +SWGDVSerialDevices* +SWGDVSerialDevices::fromJson(QString &json) { QByteArray array (json.toStdString().c_str()); QJsonDocument doc = QJsonDocument::fromJson(array); QJsonObject jsonObject = doc.object(); @@ -68,7 +68,7 @@ SWGDVSeralDevices::fromJson(QString &json) { } void -SWGDVSeralDevices::fromJsonObject(QJsonObject &pJson) { +SWGDVSerialDevices::fromJsonObject(QJsonObject &pJson) { ::SWGSDRangel::setValue(&nb_devices, pJson["nbDevices"], "qint32", ""); @@ -76,7 +76,7 @@ SWGDVSeralDevices::fromJsonObject(QJsonObject &pJson) { } QString -SWGDVSeralDevices::asJson () +SWGDVSerialDevices::asJson () { QJsonObject* obj = this->asJsonObject(); @@ -87,7 +87,7 @@ SWGDVSeralDevices::asJson () } QJsonObject* -SWGDVSeralDevices::asJsonObject() { +SWGDVSerialDevices::asJsonObject() { QJsonObject* obj = new QJsonObject(); if(m_nb_devices_isSet){ obj->insert("nbDevices", QJsonValue(nb_devices)); @@ -100,28 +100,28 @@ SWGDVSeralDevices::asJsonObject() { } qint32 -SWGDVSeralDevices::getNbDevices() { +SWGDVSerialDevices::getNbDevices() { return nb_devices; } void -SWGDVSeralDevices::setNbDevices(qint32 nb_devices) { +SWGDVSerialDevices::setNbDevices(qint32 nb_devices) { this->nb_devices = nb_devices; this->m_nb_devices_isSet = true; } QList* -SWGDVSeralDevices::getDvSerialDevices() { +SWGDVSerialDevices::getDvSerialDevices() { return dv_serial_devices; } void -SWGDVSeralDevices::setDvSerialDevices(QList* dv_serial_devices) { +SWGDVSerialDevices::setDvSerialDevices(QList* dv_serial_devices) { this->dv_serial_devices = dv_serial_devices; this->m_dv_serial_devices_isSet = true; } bool -SWGDVSeralDevices::isSet(){ +SWGDVSerialDevices::isSet(){ bool isObjectUpdated = false; do{ if(m_nb_devices_isSet){ isObjectUpdated = true; break;} diff --git a/swagger/sdrangel/code/qt5/client/SWGDVSeralDevices.h b/swagger/sdrangel/code/qt5/client/SWGDVSerialDevices.h similarity index 87% rename from swagger/sdrangel/code/qt5/client/SWGDVSeralDevices.h rename to swagger/sdrangel/code/qt5/client/SWGDVSerialDevices.h index 62d37c741..727e29f8e 100644 --- a/swagger/sdrangel/code/qt5/client/SWGDVSeralDevices.h +++ b/swagger/sdrangel/code/qt5/client/SWGDVSerialDevices.h @@ -11,13 +11,13 @@ */ /* - * SWGDVSeralDevices.h + * SWGDVSerialDevices.h * * List of DV serial devices available in the system */ -#ifndef SWGDVSeralDevices_H_ -#define SWGDVSeralDevices_H_ +#ifndef SWGDVSerialDevices_H_ +#define SWGDVSerialDevices_H_ #include @@ -30,18 +30,18 @@ namespace SWGSDRangel { -class SWG_API SWGDVSeralDevices: public SWGObject { +class SWG_API SWGDVSerialDevices: public SWGObject { public: - SWGDVSeralDevices(); - SWGDVSeralDevices(QString* json); - virtual ~SWGDVSeralDevices(); + SWGDVSerialDevices(); + SWGDVSerialDevices(QString* json); + virtual ~SWGDVSerialDevices(); void init(); void cleanup(); virtual QString asJson () override; virtual QJsonObject* asJsonObject() override; virtual void fromJsonObject(QJsonObject &json) override; - virtual SWGDVSeralDevices* fromJson(QString &jsonString) override; + virtual SWGDVSerialDevices* fromJson(QString &jsonString) override; qint32 getNbDevices(); void setNbDevices(qint32 nb_devices); @@ -63,4 +63,4 @@ private: } -#endif /* SWGDVSeralDevices_H_ */ +#endif /* SWGDVSerialDevices_H_ */ diff --git a/swagger/sdrangel/code/qt5/client/SWGInstanceApi.cpp b/swagger/sdrangel/code/qt5/client/SWGInstanceApi.cpp index e9879d95b..6ced3c87f 100644 --- a/swagger/sdrangel/code/qt5/client/SWGInstanceApi.cpp +++ b/swagger/sdrangel/code/qt5/client/SWGInstanceApi.cpp @@ -283,7 +283,7 @@ SWGInstanceApi::instanceAMBESerialGetCallback(SWGHttpRequestWorker * worker) { QString json(worker->response); - SWGDVSeralDevices* output = static_cast(create(json, QString("SWGDVSeralDevices"))); + SWGDVSerialDevices* output = static_cast(create(json, QString("SWGDVSerialDevices"))); worker->deleteLater(); if (worker->error_type == QNetworkReply::NoError) { @@ -730,118 +730,6 @@ SWGInstanceApi::instanceChannelsCallback(SWGHttpRequestWorker * worker) { } } -void -SWGInstanceApi::instanceDVSerialGet() { - QString fullPath; - fullPath.append(this->host).append(this->basePath).append("/sdrangel/dvserial"); - - - - SWGHttpRequestWorker *worker = new SWGHttpRequestWorker(); - SWGHttpRequestInput input(fullPath, "GET"); - - - - - - foreach(QString key, this->defaultHeaders.keys()) { - input.headers.insert(key, this->defaultHeaders.value(key)); - } - - connect(worker, - &SWGHttpRequestWorker::on_execution_finished, - this, - &SWGInstanceApi::instanceDVSerialGetCallback); - - worker->execute(&input); -} - -void -SWGInstanceApi::instanceDVSerialGetCallback(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); - SWGDVSeralDevices* output = static_cast(create(json, QString("SWGDVSeralDevices"))); - worker->deleteLater(); - - if (worker->error_type == QNetworkReply::NoError) { - emit instanceDVSerialGetSignal(output); - } else { - emit instanceDVSerialGetSignalE(output, error_type, error_str); - emit instanceDVSerialGetSignalEFull(worker, error_type, error_str); - } -} - -void -SWGInstanceApi::instanceDVSerialPatch(qint32 dvserial) { - QString fullPath; - fullPath.append(this->host).append(this->basePath).append("/sdrangel/dvserial"); - - - if (fullPath.indexOf("?") > 0) - fullPath.append("&"); - else - fullPath.append("?"); - fullPath.append(QUrl::toPercentEncoding("dvserial")) - .append("=") - .append(QUrl::toPercentEncoding(stringValue(dvserial))); - - - SWGHttpRequestWorker *worker = new SWGHttpRequestWorker(); - SWGHttpRequestInput input(fullPath, "PATCH"); - - - - - - foreach(QString key, this->defaultHeaders.keys()) { - input.headers.insert(key, this->defaultHeaders.value(key)); - } - - connect(worker, - &SWGHttpRequestWorker::on_execution_finished, - this, - &SWGInstanceApi::instanceDVSerialPatchCallback); - - worker->execute(&input); -} - -void -SWGInstanceApi::instanceDVSerialPatchCallback(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); - SWGDVSeralDevices* output = static_cast(create(json, QString("SWGDVSeralDevices"))); - worker->deleteLater(); - - if (worker->error_type == QNetworkReply::NoError) { - emit instanceDVSerialPatchSignal(output); - } else { - emit instanceDVSerialPatchSignalE(output, error_type, error_str); - emit instanceDVSerialPatchSignalEFull(worker, error_type, error_str); - } -} - void SWGInstanceApi::instanceDelete() { QString fullPath; diff --git a/swagger/sdrangel/code/qt5/client/SWGInstanceApi.h b/swagger/sdrangel/code/qt5/client/SWGInstanceApi.h index 6c7a95001..2aced6c3c 100644 --- a/swagger/sdrangel/code/qt5/client/SWGInstanceApi.h +++ b/swagger/sdrangel/code/qt5/client/SWGInstanceApi.h @@ -19,7 +19,7 @@ #include "SWGAudioDevices.h" #include "SWGAudioInputDevice.h" #include "SWGAudioOutputDevice.h" -#include "SWGDVSeralDevices.h" +#include "SWGDVSerialDevices.h" #include "SWGDeviceSetList.h" #include "SWGErrorResponse.h" #include "SWGInstanceChannelsResponse.h" @@ -63,8 +63,6 @@ public: void instanceAudioOutputDelete(SWGAudioOutputDevice& body); void instanceAudioOutputPatch(SWGAudioOutputDevice& body); void instanceChannels(qint32 direction); - void instanceDVSerialGet(); - void instanceDVSerialPatch(qint32 dvserial); void instanceDelete(); void instanceDeviceSetsGet(); void instanceDevices(qint32 direction); @@ -95,8 +93,6 @@ private: void instanceAudioOutputDeleteCallback (SWGHttpRequestWorker * worker); void instanceAudioOutputPatchCallback (SWGHttpRequestWorker * worker); void instanceChannelsCallback (SWGHttpRequestWorker * worker); - void instanceDVSerialGetCallback (SWGHttpRequestWorker * worker); - void instanceDVSerialPatchCallback (SWGHttpRequestWorker * worker); void instanceDeleteCallback (SWGHttpRequestWorker * worker); void instanceDeviceSetsGetCallback (SWGHttpRequestWorker * worker); void instanceDevicesCallback (SWGHttpRequestWorker * worker); @@ -118,7 +114,7 @@ signals: void instanceAMBEDevicesGetSignal(SWGAMBEDevices* summary); void instanceAMBEDevicesPatchSignal(SWGAMBEDevices* summary); void instanceAMBEDevicesPutSignal(SWGAMBEDevices* summary); - void instanceAMBESerialGetSignal(SWGDVSeralDevices* summary); + void instanceAMBESerialGetSignal(SWGDVSerialDevices* summary); void instanceAudioGetSignal(SWGAudioDevices* summary); void instanceAudioInputCleanupPatchSignal(SWGSuccessResponse* summary); void instanceAudioInputDeleteSignal(SWGAudioInputDevice* summary); @@ -127,8 +123,6 @@ signals: void instanceAudioOutputDeleteSignal(SWGAudioOutputDevice* summary); void instanceAudioOutputPatchSignal(SWGAudioOutputDevice* summary); void instanceChannelsSignal(SWGInstanceChannelsResponse* summary); - void instanceDVSerialGetSignal(SWGDVSeralDevices* summary); - void instanceDVSerialPatchSignal(SWGDVSeralDevices* summary); void instanceDeleteSignal(SWGInstanceSummaryResponse* summary); void instanceDeviceSetsGetSignal(SWGDeviceSetList* summary); void instanceDevicesSignal(SWGInstanceDevicesResponse* summary); @@ -149,7 +143,7 @@ signals: void instanceAMBEDevicesGetSignalE(SWGAMBEDevices* summary, QNetworkReply::NetworkError error_type, QString& error_str); void instanceAMBEDevicesPatchSignalE(SWGAMBEDevices* summary, QNetworkReply::NetworkError error_type, QString& error_str); void instanceAMBEDevicesPutSignalE(SWGAMBEDevices* summary, QNetworkReply::NetworkError error_type, QString& error_str); - void instanceAMBESerialGetSignalE(SWGDVSeralDevices* summary, QNetworkReply::NetworkError error_type, QString& error_str); + void instanceAMBESerialGetSignalE(SWGDVSerialDevices* summary, QNetworkReply::NetworkError error_type, QString& error_str); void instanceAudioGetSignalE(SWGAudioDevices* summary, QNetworkReply::NetworkError error_type, QString& error_str); void instanceAudioInputCleanupPatchSignalE(SWGSuccessResponse* summary, QNetworkReply::NetworkError error_type, QString& error_str); void instanceAudioInputDeleteSignalE(SWGAudioInputDevice* summary, QNetworkReply::NetworkError error_type, QString& error_str); @@ -158,8 +152,6 @@ signals: void instanceAudioOutputDeleteSignalE(SWGAudioOutputDevice* summary, QNetworkReply::NetworkError error_type, QString& error_str); void instanceAudioOutputPatchSignalE(SWGAudioOutputDevice* summary, QNetworkReply::NetworkError error_type, QString& error_str); void instanceChannelsSignalE(SWGInstanceChannelsResponse* summary, QNetworkReply::NetworkError error_type, QString& error_str); - void instanceDVSerialGetSignalE(SWGDVSeralDevices* summary, QNetworkReply::NetworkError error_type, QString& error_str); - void instanceDVSerialPatchSignalE(SWGDVSeralDevices* summary, QNetworkReply::NetworkError error_type, QString& error_str); void instanceDeleteSignalE(SWGInstanceSummaryResponse* summary, QNetworkReply::NetworkError error_type, QString& error_str); void instanceDeviceSetsGetSignalE(SWGDeviceSetList* summary, QNetworkReply::NetworkError error_type, QString& error_str); void instanceDevicesSignalE(SWGInstanceDevicesResponse* summary, QNetworkReply::NetworkError error_type, QString& error_str); @@ -189,8 +181,6 @@ signals: void instanceAudioOutputDeleteSignalEFull(SWGHttpRequestWorker* worker, QNetworkReply::NetworkError error_type, QString& error_str); void instanceAudioOutputPatchSignalEFull(SWGHttpRequestWorker* worker, QNetworkReply::NetworkError error_type, QString& error_str); void instanceChannelsSignalEFull(SWGHttpRequestWorker* worker, QNetworkReply::NetworkError error_type, QString& error_str); - void instanceDVSerialGetSignalEFull(SWGHttpRequestWorker* worker, QNetworkReply::NetworkError error_type, QString& error_str); - void instanceDVSerialPatchSignalEFull(SWGHttpRequestWorker* worker, QNetworkReply::NetworkError error_type, QString& error_str); void instanceDeleteSignalEFull(SWGHttpRequestWorker* worker, QNetworkReply::NetworkError error_type, QString& error_str); void instanceDeviceSetsGetSignalEFull(SWGHttpRequestWorker* worker, QNetworkReply::NetworkError error_type, QString& error_str); void instanceDevicesSignalEFull(SWGHttpRequestWorker* worker, QNetworkReply::NetworkError error_type, QString& error_str); diff --git a/swagger/sdrangel/code/qt5/client/SWGModelFactory.h b/swagger/sdrangel/code/qt5/client/SWGModelFactory.h index f5e315451..6bc041422 100644 --- a/swagger/sdrangel/code/qt5/client/SWGModelFactory.h +++ b/swagger/sdrangel/code/qt5/client/SWGModelFactory.h @@ -49,8 +49,8 @@ #include "SWGComplex.h" #include "SWGDSDDemodReport.h" #include "SWGDSDDemodSettings.h" -#include "SWGDVSeralDevices.h" #include "SWGDVSerialDevice.h" +#include "SWGDVSerialDevices.h" #include "SWGDeviceListItem.h" #include "SWGDeviceReport.h" #include "SWGDeviceSet.h" @@ -262,12 +262,12 @@ namespace SWGSDRangel { if(QString("SWGDSDDemodSettings").compare(type) == 0) { return new SWGDSDDemodSettings(); } - if(QString("SWGDVSeralDevices").compare(type) == 0) { - return new SWGDVSeralDevices(); - } if(QString("SWGDVSerialDevice").compare(type) == 0) { return new SWGDVSerialDevice(); } + if(QString("SWGDVSerialDevices").compare(type) == 0) { + return new SWGDVSerialDevices(); + } if(QString("SWGDeviceListItem").compare(type) == 0) { return new SWGDeviceListItem(); }