From 6771c6de5b0eda21012e2ce6b50c364d866df79a Mon Sep 17 00:00:00 2001 From: f4exb Date: Tue, 7 May 2019 15:25:20 +0200 Subject: [PATCH] REST API server updates and fixes --- sdrbase/resources/webapi/doc/html2/index.html | 34 ++--- .../resources/webapi/doc/swagger/swagger.yaml | 14 +-- sdrbase/webapi/webapirequestmapper.cpp | 6 +- sdrgui/webapi/webapiadaptergui.cpp | 25 ++-- sdrsrv/webapi/webapiadaptersrv.cpp | 116 +++++++++++------- swagger/sdrangel/api/swagger/swagger.yaml | 14 +-- swagger/sdrangel/code/html2/index.html | 34 ++--- .../code/qt5/client/SWGDeviceListItem.cpp | 52 ++++---- .../code/qt5/client/SWGDeviceListItem.h | 16 +-- .../code/qt5/client/SWGSamplingDevice.cpp | 52 ++++---- .../code/qt5/client/SWGSamplingDevice.h | 16 +-- 11 files changed, 201 insertions(+), 178 deletions(-) diff --git a/sdrbase/resources/webapi/doc/html2/index.html b/sdrbase/resources/webapi/doc/html2/index.html index d4a586c38..b340fb0cd 100644 --- a/sdrbase/resources/webapi/doc/html2/index.html +++ b/sdrbase/resources/webapi/doc/html2/index.html @@ -2107,13 +2107,13 @@ margin-bottom: 20px; "type" : "integer", "description" : "0 for Rx only, 1 for Tx only or 2 for any number and direction (default 0)" }, - "nbStreams" : { + "deviceNbStreams" : { "type" : "integer", "description" : "Number of channels or streams in the device" }, - "streamIndex" : { + "deviceStreamIndex" : { "type" : "integer", - "description" : "Index of the channel in the device" + "description" : "Index of the channel in the device. Applies to single stream directions (Rx or Tx)" }, "deviceSetIndex" : { "type" : "integer", @@ -4779,7 +4779,7 @@ margin-bottom: 20px; "description" : "A sample rate expressed in samples per second (S/s)" }; defs.SamplingDevice = { - "required" : [ "bandwidth", "centerFrequency", "hwType", "index", "sequence", "serial", "state", "streamIndex" ], + "required" : [ "bandwidth", "centerFrequency", "hwType", "index", "sequence", "serial", "state" ], "properties" : { "index" : { "type" : "integer", @@ -4793,13 +4793,13 @@ margin-bottom: 20px; "type" : "integer", "description" : "0 for Rx only, 1 for Tx only or 2 for any number and direction (default 0)" }, - "nbStreams" : { + "deviceNbStreams" : { "type" : "integer", "description" : "Number of channels or streams in the device" }, - "streamIndex" : { + "deviceStreamIndex" : { "type" : "integer", - "description" : "Index of the channel in the device" + "description" : "Index of the channel in the device. Applies to single stream directions (Rx or Tx)" }, "sequence" : { "type" : "integer", @@ -9567,7 +9567,7 @@ public class DeviceSetApiExample { DeviceSetApi apiInstance = new DeviceSetApi(); Integer deviceSetIndex = 56; // Integer | Index of device set in the device set list - DeviceListItem body = ; // DeviceListItem | Device item to look for. Specify only the fields you want to search for. You must at least specify one among displayedName, hwType or serial. index and nbStreams are ignored. Rx is assumed if Tx is not specified. + DeviceListItem body = ; // DeviceListItem | Device item to look for. Specify only the fields you want to search for. You must at least specify one among displayedName, hwType or serial. index and deviceŃbStreams are ignored. Rx is assumed by default. try { DeviceListItem result = apiInstance.devicesetDevicePut(deviceSetIndex, body); System.out.println(result); @@ -9587,7 +9587,7 @@ public class DeviceSetApiExample { public static void main(String[] args) { DeviceSetApi apiInstance = new DeviceSetApi(); Integer deviceSetIndex = 56; // Integer | Index of device set in the device set list - DeviceListItem body = ; // DeviceListItem | Device item to look for. Specify only the fields you want to search for. You must at least specify one among displayedName, hwType or serial. index and nbStreams are ignored. Rx is assumed if Tx is not specified. + DeviceListItem body = ; // DeviceListItem | Device item to look for. Specify only the fields you want to search for. You must at least specify one among displayedName, hwType or serial. index and deviceŃbStreams are ignored. Rx is assumed by default. try { DeviceListItem result = apiInstance.devicesetDevicePut(deviceSetIndex, body); System.out.println(result); @@ -9604,7 +9604,7 @@ public class DeviceSetApiExample { -->
Integer *deviceSetIndex = 56; // Index of device set in the device set list
-DeviceListItem *body = ; // Device item to look for. Specify only the fields you want to search for. You must at least specify one among displayedName, hwType or serial. index and nbStreams are ignored. Rx is assumed if Tx is not specified.
+DeviceListItem *body = ; // Device item to look for. Specify only the fields you want to search for. You must at least specify one among displayedName, hwType or serial. index and deviceŃbStreams are ignored. Rx is assumed by default.
 
 DeviceSetApi *apiInstance = [[DeviceSetApi alloc] init];
 
@@ -9628,7 +9628,7 @@ var api = new SdRangel.DeviceSetApi()
 
 var deviceSetIndex = 56; // {Integer} Index of device set in the device set list
 
-var body = ; // {DeviceListItem} Device item to look for. Specify only the fields you want to search for. You must at least specify one among displayedName, hwType or serial. index and nbStreams are ignored. Rx is assumed if Tx is not specified.
+var body = ; // {DeviceListItem} Device item to look for. Specify only the fields you want to search for. You must at least specify one among displayedName, hwType or serial. index and deviceŃbStreams are ignored. Rx is assumed by default.
 
 
 var callback = function(error, data, response) {
@@ -9661,7 +9661,7 @@ namespace Example
             
             var apiInstance = new DeviceSetApi();
             var deviceSetIndex = 56;  // Integer | Index of device set in the device set list
-            var body = new DeviceListItem(); // DeviceListItem | Device item to look for. Specify only the fields you want to search for. You must at least specify one among displayedName, hwType or serial. index and nbStreams are ignored. Rx is assumed if Tx is not specified.
+            var body = new DeviceListItem(); // DeviceListItem | Device item to look for. Specify only the fields you want to search for. You must at least specify one among displayedName, hwType or serial. index and deviceŃbStreams are ignored. Rx is assumed by default.
 
             try
             {
@@ -9684,7 +9684,7 @@ require_once(__DIR__ . '/vendor/autoload.php');
 
 $api_instance = new Swagger\Client\Api\DeviceSetApi();
 $deviceSetIndex = 56; // Integer | Index of device set in the device set list
-$body = ; // DeviceListItem | Device item to look for. Specify only the fields you want to search for. You must at least specify one among displayedName, hwType or serial. index and nbStreams are ignored. Rx is assumed if Tx is not specified.
+$body = ; // DeviceListItem | Device item to look for. Specify only the fields you want to search for. You must at least specify one among displayedName, hwType or serial. index and deviceŃbStreams are ignored. Rx is assumed by default.
 
 try {
     $result = $api_instance->devicesetDevicePut($deviceSetIndex, $body);
@@ -9702,7 +9702,7 @@ use SWGSDRangel::DeviceSetApi;
 
 my $api_instance = SWGSDRangel::DeviceSetApi->new();
 my $deviceSetIndex = 56; # Integer | Index of device set in the device set list
-my $body = SWGSDRangel::Object::DeviceListItem->new(); # DeviceListItem | Device item to look for. Specify only the fields you want to search for. You must at least specify one among displayedName, hwType or serial. index and nbStreams are ignored. Rx is assumed if Tx is not specified.
+my $body = SWGSDRangel::Object::DeviceListItem->new(); # DeviceListItem | Device item to look for. Specify only the fields you want to search for. You must at least specify one among displayedName, hwType or serial. index and deviceŃbStreams are ignored. Rx is assumed by default.
 
 eval { 
     my $result = $api_instance->devicesetDevicePut(deviceSetIndex => $deviceSetIndex, body => $body);
@@ -9723,7 +9723,7 @@ from pprint import pprint
 # create an instance of the API class
 api_instance = swagger_sdrangel.DeviceSetApi()
 deviceSetIndex = 56 # Integer | Index of device set in the device set list
-body =  # DeviceListItem | Device item to look for. Specify only the fields you want to search for. You must at least specify one among displayedName, hwType or serial. index and nbStreams are ignored. Rx is assumed if Tx is not specified.
+body =  # DeviceListItem | Device item to look for. Specify only the fields you want to search for. You must at least specify one among displayedName, hwType or serial. index and deviceŃbStreams are ignored. Rx is assumed by default.
 
 try: 
     api_response = api_instance.deviceset_device_put(deviceSetIndex, body)
@@ -9782,7 +9782,7 @@ $(document).ready(function() {
   var schemaWrapper = {
   "in" : "body",
   "name" : "body",
-  "description" : "Device item to look for. Specify only the fields you want to search for. You must at least specify one among displayedName, hwType or serial. index and nbStreams are ignored. Rx is assumed if Tx is not specified.",
+  "description" : "Device item to look for. Specify only the fields you want to search for. You must at least specify one among displayedName, hwType or serial. index and deviceŃbStreams are ignored. Rx is assumed by default.",
   "required" : true,
   "schema" : {
     "$ref" : "#/definitions/DeviceListItem"
@@ -24924,7 +24924,7 @@ except ApiException as e:
           
- Generated 2019-05-07T11:40:05.130+02:00 + Generated 2019-05-07T14:58:09.366+02:00
diff --git a/sdrbase/resources/webapi/doc/swagger/swagger.yaml b/sdrbase/resources/webapi/doc/swagger/swagger.yaml index 81aa35302..1fe38dbb3 100644 --- a/sdrbase/resources/webapi/doc/swagger/swagger.yaml +++ b/sdrbase/resources/webapi/doc/swagger/swagger.yaml @@ -754,7 +754,7 @@ paths: description: Index of device set in the device set list - name: body in: body - description: Device item to look for. Specify only the fields you want to search for. You must at least specify one among displayedName, hwType or serial. index and nbStreams are ignored. Rx is assumed if Tx is not specified. + description: Device item to look for. Specify only the fields you want to search for. You must at least specify one among displayedName, hwType or serial. index and deviceŃbStreams are ignored. Rx is assumed by default. required: true schema: $ref: "#/definitions/DeviceListItem" @@ -1371,11 +1371,11 @@ definitions: direction: description: "0 for Rx only, 1 for Tx only or 2 for any number and direction (default 0)" type: integer - nbStreams: + deviceNbStreams: description: "Number of channels or streams in the device" type: integer - streamIndex: - description: "Index of the channel in the device" + deviceStreamIndex: + description: "Index of the channel in the device. Applies to single stream directions (Rx or Tx)" type: integer deviceSetIndex: description: "Index of the device set that claimed this device (-1 if not claimed)" @@ -1470,11 +1470,11 @@ definitions: direction: description: "0 for Rx only, 1 for Tx only or 2 for any number and direction (default 0)" type: integer - nbStreams: + deviceNbStreams: description: "Number of channels or streams in the device" type: integer - streamIndex: - description: "Index of the channel in the device" + deviceStreamIndex: + description: "Index of the channel in the device. Applies to single stream directions (Rx or Tx)" type: integer sequence: description: "Sequence in the enumeration of same device types" diff --git a/sdrbase/webapi/webapirequestmapper.cpp b/sdrbase/webapi/webapirequestmapper.cpp index f55fc37d4..a50578539 100644 --- a/sdrbase/webapi/webapirequestmapper.cpp +++ b/sdrbase/webapi/webapirequestmapper.cpp @@ -1731,10 +1731,10 @@ bool WebAPIRequestMapper::validateDeviceListItem(SWGSDRangel::SWGDeviceListItem& deviceListItem.setSequence(-1); } - if (jsonObject.contains("streamIndex")) { - deviceListItem.setStreamIndex(jsonObject["streamIndex"].toInt(-1)); + if (jsonObject.contains("deviceStreamIndex")) { + deviceListItem.setDeviceStreamIndex(jsonObject["deviceStreamIndex"].toInt(-1)); } else { - deviceListItem.setStreamIndex(-1); + deviceListItem.setDeviceStreamIndex(-1); } return identified; diff --git a/sdrgui/webapi/webapiadaptergui.cpp b/sdrgui/webapi/webapiadaptergui.cpp index fef9de02c..ede39045d 100644 --- a/sdrgui/webapi/webapiadaptergui.cpp +++ b/sdrgui/webapi/webapiadaptergui.cpp @@ -133,8 +133,8 @@ int WebAPIAdapterGUI::instanceDevices( *devices->back()->getHwType() = samplingDevice.hardwareId; *devices->back()->getSerial() = samplingDevice.serial; devices->back()->setSequence(samplingDevice.sequence); - devices->back()->setDirection(!samplingDevice.rxElseTx ? 0 : 1); - devices->back()->setNbStreams(samplingDevice.deviceNbItems); + devices->back()->setDirection(samplingDevice.rxElseTx ? 0 : 1); + devices->back()->setDeviceNbStreams(samplingDevice.deviceNbItems); devices->back()->setDeviceSetIndex(samplingDevice.claimed); devices->back()->setIndex(i); } @@ -946,14 +946,14 @@ int WebAPIAdapterGUI::devicesetDevicePut( if ((query.getDirection() != 1) && (deviceSet->m_deviceSinkEngine)) { error.init(); - *error.getMessage() = QString("Device type (Rx) and device set type (Tx) mismatch"); + *error.getMessage() = QString("Device type and device set type (Tx) mismatch"); return 404; } if ((query.getDirection() != 0) && (deviceSet->m_deviceSourceEngine)) { error.init(); - *error.getMessage() = QString("Device type (Tx) and device set type (Rx) mismatch"); + *error.getMessage() = QString("Device type and device set type (Rx) mismatch"); return 404; } @@ -998,7 +998,7 @@ int WebAPIAdapterGUI::devicesetDevicePut( continue; } - if ((query.getStreamIndex() >= 0) && (query.getStreamIndex() != samplingDevice.deviceItemIndex)) { + if ((query.getDeviceStreamIndex() >= 0) && (query.getDeviceStreamIndex() != samplingDevice.deviceItemIndex)) { continue; } @@ -1011,8 +1011,8 @@ int WebAPIAdapterGUI::devicesetDevicePut( *response.getSerial() = samplingDevice.serial; response.setSequence(samplingDevice.sequence); response.setDirection(tx); - response.setNbStreams(samplingDevice.deviceNbItems); - response.setStreamIndex(samplingDevice.deviceItemIndex); + response.setDeviceNbStreams(samplingDevice.deviceNbItems); + response.setDeviceStreamIndex(samplingDevice.deviceItemIndex); response.setDeviceSetIndex(deviceSetIndex); response.setIndex(i); @@ -1102,7 +1102,7 @@ int WebAPIAdapterGUI::devicesetDeviceSettingsPutPatch( } else if (deviceSet->m_deviceSinkEngine) // Single Tx { - if (response.getDirection() != 0) + if (response.getDirection() != 1) { *error.getMessage() = QString("Single Tx device found but other type of device requested"); return 400; @@ -1387,7 +1387,6 @@ int WebAPIAdapterGUI::devicesetChannelPost( *error.getMessage() = QString("This type of device is not implemented yet"); return 400; } - } else { @@ -1700,8 +1699,8 @@ void WebAPIAdapterGUI::getDeviceSet(SWGSDRangel::SWGDeviceSet *deviceSet, const *samplingDevice->getHwType() = deviceUISet->m_deviceSinkAPI->getHardwareId(); *samplingDevice->getSerial() = deviceUISet->m_deviceSinkAPI->getSampleSinkSerial(); samplingDevice->setSequence(deviceUISet->m_deviceSinkAPI->getSampleSinkSequence()); - samplingDevice->setNbStreams(deviceUISet->m_deviceSinkAPI->getNbItems()); - samplingDevice->setStreamIndex(deviceUISet->m_deviceSinkAPI->getItemIndex()); + samplingDevice->setDeviceNbStreams(deviceUISet->m_deviceSinkAPI->getNbItems()); + samplingDevice->setDeviceStreamIndex(deviceUISet->m_deviceSinkAPI->getItemIndex()); deviceUISet->m_deviceSinkAPI->getDeviceEngineStateStr(*samplingDevice->getState()); DeviceSampleSink *sampleSink = deviceUISet->m_deviceSinkEngine->getSink(); @@ -1732,8 +1731,8 @@ void WebAPIAdapterGUI::getDeviceSet(SWGSDRangel::SWGDeviceSet *deviceSet, const *samplingDevice->getHwType() = deviceUISet->m_deviceSourceAPI->getHardwareId(); *samplingDevice->getSerial() = deviceUISet->m_deviceSourceAPI->getSampleSourceSerial(); samplingDevice->setSequence(deviceUISet->m_deviceSourceAPI->getSampleSourceSequence()); - samplingDevice->setNbStreams(deviceUISet->m_deviceSourceAPI->getNbItems()); - samplingDevice->setStreamIndex(deviceUISet->m_deviceSourceAPI->getItemIndex()); + samplingDevice->setDeviceNbStreams(deviceUISet->m_deviceSourceAPI->getNbItems()); + samplingDevice->setDeviceStreamIndex(deviceUISet->m_deviceSourceAPI->getItemIndex()); deviceUISet->m_deviceSourceAPI->getDeviceEngineStateStr(*samplingDevice->getState()); DeviceSampleSource *sampleSource = deviceUISet->m_deviceSourceEngine->getSource(); diff --git a/sdrsrv/webapi/webapiadaptersrv.cpp b/sdrsrv/webapi/webapiadaptersrv.cpp index 4c6ad4dfe..51c5cef74 100644 --- a/sdrsrv/webapi/webapiadaptersrv.cpp +++ b/sdrsrv/webapi/webapiadaptersrv.cpp @@ -133,8 +133,8 @@ int WebAPIAdapterSrv::instanceDevices( *devices->back()->getHwType() = samplingDevice.hardwareId; *devices->back()->getSerial() = samplingDevice.serial; devices->back()->setSequence(samplingDevice.sequence); - devices->back()->setTx(!samplingDevice.rxElseTx); - devices->back()->setNbStreams(samplingDevice.deviceNbItems); + devices->back()->setDirection(samplingDevice.rxElseTx ? 0 : 1); + devices->back()->setDeviceNbStreams(samplingDevice.deviceNbItems); devices->back()->setDeviceSetIndex(samplingDevice.claimed); devices->back()->setIndex(i); } @@ -161,7 +161,7 @@ int WebAPIAdapterSrv::instanceChannels( const PluginDescriptor& pluginDescriptor = channelInterface->getPluginDescriptor(); *channels->back()->getVersion() = pluginDescriptor.version; *channels->back()->getName() = pluginDescriptor.displayedName; - channels->back()->setTx(tx); + channels->back()->setDirection(tx ? 1 : 0); *channels->back()->getIdUri() = channelRegistrations->at(i).m_channelIdURI; *channels->back()->getId() = channelRegistrations->at(i).m_channelId; channels->back()->setIndex(i); @@ -1028,26 +1028,43 @@ int WebAPIAdapterSrv::devicesetDevicePut( { DeviceSet *deviceSet = m_mainCore.m_deviceSets[deviceSetIndex]; - if ((query.getTx() == 0) && (deviceSet->m_deviceSinkEngine)) + if ((query.getDirection() != 1) && (deviceSet->m_deviceSinkEngine)) { error.init(); - *error.getMessage() = QString("Device type (Rx) and device set type (Tx) mismatch"); + *error.getMessage() = QString("Device type and device set type (Tx) mismatch"); return 404; } - if ((query.getTx() != 0) && (deviceSet->m_deviceSourceEngine)) + if ((query.getDirection() != 0) && (deviceSet->m_deviceSourceEngine)) { error.init(); - *error.getMessage() = QString("Device type (Tx) and device set type (Rx) mismatch"); + *error.getMessage() = QString("Device type and device set type (Rx) mismatch"); return 404; } - int nbSamplingDevices = query.getTx() != 0 ? DeviceEnumerator::instance()->getNbTxSamplingDevices() : DeviceEnumerator::instance()->getNbRxSamplingDevices(); - int tx = query.getTx(); + int nbSamplingDevices; + + if (query.getDirection() == 0) { + nbSamplingDevices = DeviceEnumerator::instance()->getNbRxSamplingDevices(); + } else if (query.getDirection() == 1) { + nbSamplingDevices = DeviceEnumerator::instance()->getNbTxSamplingDevices(); + } else { + nbSamplingDevices = 0; // TODO: not implemented yet + } for (int i = 0; i < nbSamplingDevices; i++) { - PluginInterface::SamplingDevice samplingDevice = query.getTx() ? DeviceEnumerator::instance()->getTxSamplingDevice(i) : DeviceEnumerator::instance()->getRxSamplingDevice(i); + int tx; + + if (query.getDirection() == 0) { + tx = 0; + } else if (query.getDirection() == 1) { + tx = 1; + } else { + continue; // TODO: any device (2) not supported yet + } + + PluginInterface::SamplingDevice samplingDevice = query.getDirection() == 0 ? DeviceEnumerator::instance()->getRxSamplingDevice(i) : DeviceEnumerator::instance()->getTxSamplingDevice(i); if (query.getDisplayedName() && (*query.getDisplayedName() != samplingDevice.displayedName)) { continue; @@ -1065,11 +1082,11 @@ int WebAPIAdapterSrv::devicesetDevicePut( continue; } - if ((query.getStreamIndex() >= 0) && (query.getStreamIndex() != samplingDevice.deviceItemIndex)) { + if ((query.getDeviceStreamIndex() >= 0) && (query.getDeviceStreamIndex() != samplingDevice.deviceItemIndex)) { continue; } - MainCore::MsgSetDevice *msg = MainCore::MsgSetDevice::create(deviceSetIndex, i, query.getTx() != 0); + MainCore::MsgSetDevice *msg = MainCore::MsgSetDevice::create(deviceSetIndex, i, query.getDirection() == 1); m_mainCore.m_inputMessageQueue.push(msg); response.init(); @@ -1077,9 +1094,9 @@ int WebAPIAdapterSrv::devicesetDevicePut( *response.getHwType() = samplingDevice.hardwareId; *response.getSerial() = samplingDevice.serial; response.setSequence(samplingDevice.sequence); - response.setTx(tx); - response.setNbStreams(samplingDevice.deviceNbItems); - response.setStreamIndex(samplingDevice.deviceItemIndex); + response.setDirection(tx); + response.setDeviceNbStreams(samplingDevice.deviceNbItems); + response.setDeviceStreamIndex(samplingDevice.deviceItemIndex); response.setDeviceSetIndex(deviceSetIndex); response.setIndex(i); @@ -1110,17 +1127,17 @@ int WebAPIAdapterSrv::devicesetDeviceSettingsGet( { DeviceSet *deviceSet = m_mainCore.m_deviceSets[deviceSetIndex]; - if (deviceSet->m_deviceSourceEngine) // Rx + if (deviceSet->m_deviceSourceEngine) // Single Rx { response.setDeviceHwType(new QString(deviceSet->m_deviceSourceAPI->getHardwareId())); - response.setTx(0); + response.setDirection(0); DeviceSampleSource *source = deviceSet->m_deviceSourceAPI->getSampleSource(); return source->webapiSettingsGet(response, *error.getMessage()); } - else if (deviceSet->m_deviceSinkEngine) // Tx + else if (deviceSet->m_deviceSinkEngine) // Single Tx { response.setDeviceHwType(new QString(deviceSet->m_deviceSinkAPI->getHardwareId())); - response.setTx(1); + response.setDirection(1); DeviceSampleSink *sink = deviceSet->m_deviceSinkAPI->getSampleSink(); return sink->webapiSettingsGet(response, *error.getMessage()); } @@ -1150,11 +1167,11 @@ int WebAPIAdapterSrv::devicesetDeviceSettingsPutPatch( { DeviceSet *deviceSet = m_mainCore.m_deviceSets[deviceSetIndex]; - if (deviceSet->m_deviceSourceEngine) // Rx + if (deviceSet->m_deviceSourceEngine) // Single Rx { - if (response.getTx() != 0) + if (response.getDirection() != 0) { - *error.getMessage() = QString("Rx device found but Tx device requested"); + *error.getMessage() = QString("Single Rx device found but other type of device requested"); return 400; } if (deviceSet->m_deviceSourceAPI->getHardwareId() != *response.getDeviceHwType()) @@ -1168,11 +1185,11 @@ int WebAPIAdapterSrv::devicesetDeviceSettingsPutPatch( return source->webapiSettingsPutPatch(force, deviceSettingsKeys, response, *error.getMessage()); } } - else if (deviceSet->m_deviceSinkEngine) // Tx + else if (deviceSet->m_deviceSinkEngine) // Single Tx { - if (response.getTx() == 0) + if (response.getDirection() != 1) { - *error.getMessage() = QString("Tx device found but Rx device requested"); + *error.getMessage() = QString("Single Tx device found but other type of device requested"); return 400; } else if (deviceSet->m_deviceSinkAPI->getHardwareId() != *response.getDeviceHwType()) @@ -1318,17 +1335,17 @@ int WebAPIAdapterSrv::devicesetDeviceReportGet( { DeviceSet *deviceSet = m_mainCore.m_deviceSets[deviceSetIndex]; - if (deviceSet->m_deviceSourceEngine) // Rx + if (deviceSet->m_deviceSourceEngine) // Single Rx { response.setDeviceHwType(new QString(deviceSet->m_deviceSourceAPI->getHardwareId())); - response.setTx(0); + response.setDirection(0); DeviceSampleSource *source = deviceSet->m_deviceSourceAPI->getSampleSource(); return source->webapiReportGet(response, *error.getMessage()); } - else if (deviceSet->m_deviceSinkEngine) // Tx + else if (deviceSet->m_deviceSinkEngine) // Single Tx { response.setDeviceHwType(new QString(deviceSet->m_deviceSinkAPI->getHardwareId())); - response.setTx(1); + response.setDirection(1); DeviceSampleSink *sink = deviceSet->m_deviceSinkAPI->getSampleSink(); return sink->webapiReportGet(response, *error.getMessage()); } @@ -1376,7 +1393,7 @@ int WebAPIAdapterSrv::devicesetChannelPost( { DeviceSet *deviceSet = m_mainCore.m_deviceSets[deviceSetIndex]; - if (query.getTx() == 0) // Rx + if (query.getDirection() == 0) // Single Rx { if (deviceSet->m_deviceSourceEngine == 0) { @@ -1412,7 +1429,7 @@ int WebAPIAdapterSrv::devicesetChannelPost( return 404; } } - else // Tx + else if (query.getDirection() == 1) // single Tx { if (deviceSet->m_deviceSinkEngine == 0) { @@ -1448,6 +1465,12 @@ int WebAPIAdapterSrv::devicesetChannelPost( return 404; } } + else + { + error.init(); + *error.getMessage() = QString("This type of device is not implemented yet"); + return 400; + } } else { @@ -1536,7 +1559,7 @@ int WebAPIAdapterSrv::devicesetChannelSettingsGet( { DeviceSet *deviceSet = m_mainCore.m_deviceSets[deviceSetIndex]; - if (deviceSet->m_deviceSourceEngine) // Rx + if (deviceSet->m_deviceSourceEngine) // Single Rx { ChannelSinkAPI *channelAPI = deviceSet->m_deviceSourceAPI->getChanelAPIAt(channelIndex); @@ -1549,11 +1572,11 @@ int WebAPIAdapterSrv::devicesetChannelSettingsGet( { response.setChannelType(new QString()); channelAPI->getIdentifier(*response.getChannelType()); - response.setTx(0); + response.setDirection(0); return channelAPI->webapiSettingsGet(response, *error.getMessage()); } } - else if (deviceSet->m_deviceSinkEngine) // Tx + else if (deviceSet->m_deviceSinkEngine) // Single Tx { ChannelSourceAPI *channelAPI = deviceSet->m_deviceSinkAPI->getChanelAPIAt(channelIndex); @@ -1566,7 +1589,7 @@ int WebAPIAdapterSrv::devicesetChannelSettingsGet( { response.setChannelType(new QString()); channelAPI->getIdentifier(*response.getChannelType()); - response.setTx(1); + response.setDirection(1); return channelAPI->webapiSettingsGet(response, *error.getMessage()); } } @@ -1595,7 +1618,7 @@ int WebAPIAdapterSrv::devicesetChannelReportGet( { DeviceSet *deviceSet = m_mainCore.m_deviceSets[deviceSetIndex]; - if (deviceSet->m_deviceSourceEngine) // Rx + if (deviceSet->m_deviceSourceEngine) // Single Rx { ChannelSinkAPI *channelAPI = deviceSet->m_deviceSourceAPI->getChanelAPIAt(channelIndex); @@ -1608,11 +1631,11 @@ int WebAPIAdapterSrv::devicesetChannelReportGet( { response.setChannelType(new QString()); channelAPI->getIdentifier(*response.getChannelType()); - response.setTx(0); + response.setDirection(0); return channelAPI->webapiReportGet(response, *error.getMessage()); } } - else if (deviceSet->m_deviceSinkEngine) // Tx + else if (deviceSet->m_deviceSinkEngine) // Single Tx { ChannelSourceAPI *channelAPI = deviceSet->m_deviceSinkAPI->getChanelAPIAt(channelIndex); @@ -1625,7 +1648,7 @@ int WebAPIAdapterSrv::devicesetChannelReportGet( { response.setChannelType(new QString()); channelAPI->getIdentifier(*response.getChannelType()); - response.setTx(1); + response.setDirection(1); return channelAPI->webapiReportGet(response, *error.getMessage()); } } @@ -1747,15 +1770,15 @@ void WebAPIAdapterSrv::getDeviceSet(SWGSDRangel::SWGDeviceSet *swgDeviceSet, con SWGSDRangel::SWGSamplingDevice *samplingDevice = swgDeviceSet->getSamplingDevice(); samplingDevice->init(); samplingDevice->setIndex(deviceUISetIndex); - samplingDevice->setTx(deviceSet->m_deviceSinkEngine != 0); - if (deviceSet->m_deviceSinkEngine) // Tx data + if (deviceSet->m_deviceSinkEngine) // Single Tx data { + samplingDevice->setDirection(1); *samplingDevice->getHwType() = deviceSet->m_deviceSinkAPI->getHardwareId(); *samplingDevice->getSerial() = deviceSet->m_deviceSinkAPI->getSampleSinkSerial(); samplingDevice->setSequence(deviceSet->m_deviceSinkAPI->getSampleSinkSequence()); - samplingDevice->setNbStreams(deviceSet->m_deviceSinkAPI->getNbItems()); - samplingDevice->setStreamIndex(deviceSet->m_deviceSinkAPI->getItemIndex()); + samplingDevice->setDeviceNbStreams(deviceSet->m_deviceSinkAPI->getNbItems()); + samplingDevice->setDeviceStreamIndex(deviceSet->m_deviceSinkAPI->getItemIndex()); deviceSet->m_deviceSinkAPI->getDeviceEngineStateStr(*samplingDevice->getState()); DeviceSampleSink *sampleSink = deviceSet->m_deviceSinkEngine->getSink(); @@ -1780,13 +1803,14 @@ void WebAPIAdapterSrv::getDeviceSet(SWGSDRangel::SWGDeviceSet *swgDeviceSet, con } } - if (deviceSet->m_deviceSourceEngine) // Rx data + if (deviceSet->m_deviceSourceEngine) // Single Rx data { + samplingDevice->setDirection(1); *samplingDevice->getHwType() = deviceSet->m_deviceSourceAPI->getHardwareId(); *samplingDevice->getSerial() = deviceSet->m_deviceSourceAPI->getSampleSourceSerial(); samplingDevice->setSequence(deviceSet->m_deviceSourceAPI->getSampleSourceSequence()); - samplingDevice->setNbStreams(deviceSet->m_deviceSourceAPI->getNbItems()); - samplingDevice->setStreamIndex(deviceSet->m_deviceSourceAPI->getItemIndex()); + samplingDevice->setDeviceNbStreams(deviceSet->m_deviceSourceAPI->getNbItems()); + samplingDevice->setDeviceStreamIndex(deviceSet->m_deviceSourceAPI->getItemIndex()); deviceSet->m_deviceSourceAPI->getDeviceEngineStateStr(*samplingDevice->getState()); DeviceSampleSource *sampleSource = deviceSet->m_deviceSourceEngine->getSource(); diff --git a/swagger/sdrangel/api/swagger/swagger.yaml b/swagger/sdrangel/api/swagger/swagger.yaml index e99e88142..d4e63a815 100644 --- a/swagger/sdrangel/api/swagger/swagger.yaml +++ b/swagger/sdrangel/api/swagger/swagger.yaml @@ -754,7 +754,7 @@ paths: description: Index of device set in the device set list - name: body in: body - description: Device item to look for. Specify only the fields you want to search for. You must at least specify one among displayedName, hwType or serial. index and nbStreams are ignored. Rx is assumed if Tx is not specified. + description: Device item to look for. Specify only the fields you want to search for. You must at least specify one among displayedName, hwType or serial. index and deviceŃbStreams are ignored. Rx is assumed by default. required: true schema: $ref: "#/definitions/DeviceListItem" @@ -1371,11 +1371,11 @@ definitions: direction: description: "0 for Rx only, 1 for Tx only or 2 for any number and direction (default 0)" type: integer - nbStreams: + deviceNbStreams: description: "Number of channels or streams in the device" type: integer - streamIndex: - description: "Index of the channel in the device" + deviceStreamIndex: + description: "Index of the channel in the device. Applies to single stream directions (Rx or Tx)" type: integer deviceSetIndex: description: "Index of the device set that claimed this device (-1 if not claimed)" @@ -1470,11 +1470,11 @@ definitions: direction: description: "0 for Rx only, 1 for Tx only or 2 for any number and direction (default 0)" type: integer - nbStreams: + deviceNbStreams: description: "Number of channels or streams in the device" type: integer - streamIndex: - description: "Index of the channel in the device" + deviceStreamIndex: + description: "Index of the channel in the device. Applies to single stream directions (Rx or Tx)" type: integer sequence: description: "Sequence in the enumeration of same device types" diff --git a/swagger/sdrangel/code/html2/index.html b/swagger/sdrangel/code/html2/index.html index d4a586c38..b340fb0cd 100644 --- a/swagger/sdrangel/code/html2/index.html +++ b/swagger/sdrangel/code/html2/index.html @@ -2107,13 +2107,13 @@ margin-bottom: 20px; "type" : "integer", "description" : "0 for Rx only, 1 for Tx only or 2 for any number and direction (default 0)" }, - "nbStreams" : { + "deviceNbStreams" : { "type" : "integer", "description" : "Number of channels or streams in the device" }, - "streamIndex" : { + "deviceStreamIndex" : { "type" : "integer", - "description" : "Index of the channel in the device" + "description" : "Index of the channel in the device. Applies to single stream directions (Rx or Tx)" }, "deviceSetIndex" : { "type" : "integer", @@ -4779,7 +4779,7 @@ margin-bottom: 20px; "description" : "A sample rate expressed in samples per second (S/s)" }; defs.SamplingDevice = { - "required" : [ "bandwidth", "centerFrequency", "hwType", "index", "sequence", "serial", "state", "streamIndex" ], + "required" : [ "bandwidth", "centerFrequency", "hwType", "index", "sequence", "serial", "state" ], "properties" : { "index" : { "type" : "integer", @@ -4793,13 +4793,13 @@ margin-bottom: 20px; "type" : "integer", "description" : "0 for Rx only, 1 for Tx only or 2 for any number and direction (default 0)" }, - "nbStreams" : { + "deviceNbStreams" : { "type" : "integer", "description" : "Number of channels or streams in the device" }, - "streamIndex" : { + "deviceStreamIndex" : { "type" : "integer", - "description" : "Index of the channel in the device" + "description" : "Index of the channel in the device. Applies to single stream directions (Rx or Tx)" }, "sequence" : { "type" : "integer", @@ -9567,7 +9567,7 @@ public class DeviceSetApiExample { DeviceSetApi apiInstance = new DeviceSetApi(); Integer deviceSetIndex = 56; // Integer | Index of device set in the device set list - DeviceListItem body = ; // DeviceListItem | Device item to look for. Specify only the fields you want to search for. You must at least specify one among displayedName, hwType or serial. index and nbStreams are ignored. Rx is assumed if Tx is not specified. + DeviceListItem body = ; // DeviceListItem | Device item to look for. Specify only the fields you want to search for. You must at least specify one among displayedName, hwType or serial. index and deviceŃbStreams are ignored. Rx is assumed by default. try { DeviceListItem result = apiInstance.devicesetDevicePut(deviceSetIndex, body); System.out.println(result); @@ -9587,7 +9587,7 @@ public class DeviceSetApiExample { public static void main(String[] args) { DeviceSetApi apiInstance = new DeviceSetApi(); Integer deviceSetIndex = 56; // Integer | Index of device set in the device set list - DeviceListItem body = ; // DeviceListItem | Device item to look for. Specify only the fields you want to search for. You must at least specify one among displayedName, hwType or serial. index and nbStreams are ignored. Rx is assumed if Tx is not specified. + DeviceListItem body = ; // DeviceListItem | Device item to look for. Specify only the fields you want to search for. You must at least specify one among displayedName, hwType or serial. index and deviceŃbStreams are ignored. Rx is assumed by default. try { DeviceListItem result = apiInstance.devicesetDevicePut(deviceSetIndex, body); System.out.println(result); @@ -9604,7 +9604,7 @@ public class DeviceSetApiExample { -->
Integer *deviceSetIndex = 56; // Index of device set in the device set list
-DeviceListItem *body = ; // Device item to look for. Specify only the fields you want to search for. You must at least specify one among displayedName, hwType or serial. index and nbStreams are ignored. Rx is assumed if Tx is not specified.
+DeviceListItem *body = ; // Device item to look for. Specify only the fields you want to search for. You must at least specify one among displayedName, hwType or serial. index and deviceŃbStreams are ignored. Rx is assumed by default.
 
 DeviceSetApi *apiInstance = [[DeviceSetApi alloc] init];
 
@@ -9628,7 +9628,7 @@ var api = new SdRangel.DeviceSetApi()
 
 var deviceSetIndex = 56; // {Integer} Index of device set in the device set list
 
-var body = ; // {DeviceListItem} Device item to look for. Specify only the fields you want to search for. You must at least specify one among displayedName, hwType or serial. index and nbStreams are ignored. Rx is assumed if Tx is not specified.
+var body = ; // {DeviceListItem} Device item to look for. Specify only the fields you want to search for. You must at least specify one among displayedName, hwType or serial. index and deviceŃbStreams are ignored. Rx is assumed by default.
 
 
 var callback = function(error, data, response) {
@@ -9661,7 +9661,7 @@ namespace Example
             
             var apiInstance = new DeviceSetApi();
             var deviceSetIndex = 56;  // Integer | Index of device set in the device set list
-            var body = new DeviceListItem(); // DeviceListItem | Device item to look for. Specify only the fields you want to search for. You must at least specify one among displayedName, hwType or serial. index and nbStreams are ignored. Rx is assumed if Tx is not specified.
+            var body = new DeviceListItem(); // DeviceListItem | Device item to look for. Specify only the fields you want to search for. You must at least specify one among displayedName, hwType or serial. index and deviceŃbStreams are ignored. Rx is assumed by default.
 
             try
             {
@@ -9684,7 +9684,7 @@ require_once(__DIR__ . '/vendor/autoload.php');
 
 $api_instance = new Swagger\Client\Api\DeviceSetApi();
 $deviceSetIndex = 56; // Integer | Index of device set in the device set list
-$body = ; // DeviceListItem | Device item to look for. Specify only the fields you want to search for. You must at least specify one among displayedName, hwType or serial. index and nbStreams are ignored. Rx is assumed if Tx is not specified.
+$body = ; // DeviceListItem | Device item to look for. Specify only the fields you want to search for. You must at least specify one among displayedName, hwType or serial. index and deviceŃbStreams are ignored. Rx is assumed by default.
 
 try {
     $result = $api_instance->devicesetDevicePut($deviceSetIndex, $body);
@@ -9702,7 +9702,7 @@ use SWGSDRangel::DeviceSetApi;
 
 my $api_instance = SWGSDRangel::DeviceSetApi->new();
 my $deviceSetIndex = 56; # Integer | Index of device set in the device set list
-my $body = SWGSDRangel::Object::DeviceListItem->new(); # DeviceListItem | Device item to look for. Specify only the fields you want to search for. You must at least specify one among displayedName, hwType or serial. index and nbStreams are ignored. Rx is assumed if Tx is not specified.
+my $body = SWGSDRangel::Object::DeviceListItem->new(); # DeviceListItem | Device item to look for. Specify only the fields you want to search for. You must at least specify one among displayedName, hwType or serial. index and deviceŃbStreams are ignored. Rx is assumed by default.
 
 eval { 
     my $result = $api_instance->devicesetDevicePut(deviceSetIndex => $deviceSetIndex, body => $body);
@@ -9723,7 +9723,7 @@ from pprint import pprint
 # create an instance of the API class
 api_instance = swagger_sdrangel.DeviceSetApi()
 deviceSetIndex = 56 # Integer | Index of device set in the device set list
-body =  # DeviceListItem | Device item to look for. Specify only the fields you want to search for. You must at least specify one among displayedName, hwType or serial. index and nbStreams are ignored. Rx is assumed if Tx is not specified.
+body =  # DeviceListItem | Device item to look for. Specify only the fields you want to search for. You must at least specify one among displayedName, hwType or serial. index and deviceŃbStreams are ignored. Rx is assumed by default.
 
 try: 
     api_response = api_instance.deviceset_device_put(deviceSetIndex, body)
@@ -9782,7 +9782,7 @@ $(document).ready(function() {
   var schemaWrapper = {
   "in" : "body",
   "name" : "body",
-  "description" : "Device item to look for. Specify only the fields you want to search for. You must at least specify one among displayedName, hwType or serial. index and nbStreams are ignored. Rx is assumed if Tx is not specified.",
+  "description" : "Device item to look for. Specify only the fields you want to search for. You must at least specify one among displayedName, hwType or serial. index and deviceŃbStreams are ignored. Rx is assumed by default.",
   "required" : true,
   "schema" : {
     "$ref" : "#/definitions/DeviceListItem"
@@ -24924,7 +24924,7 @@ except ApiException as e:
           
- Generated 2019-05-07T11:40:05.130+02:00 + Generated 2019-05-07T14:58:09.366+02:00
diff --git a/swagger/sdrangel/code/qt5/client/SWGDeviceListItem.cpp b/swagger/sdrangel/code/qt5/client/SWGDeviceListItem.cpp index a5880d493..04b4f5f41 100644 --- a/swagger/sdrangel/code/qt5/client/SWGDeviceListItem.cpp +++ b/swagger/sdrangel/code/qt5/client/SWGDeviceListItem.cpp @@ -38,10 +38,10 @@ SWGDeviceListItem::SWGDeviceListItem() { m_sequence_isSet = false; direction = 0; m_direction_isSet = false; - nb_streams = 0; - m_nb_streams_isSet = false; - stream_index = 0; - m_stream_index_isSet = false; + device_nb_streams = 0; + m_device_nb_streams_isSet = false; + device_stream_index = 0; + m_device_stream_index_isSet = false; device_set_index = 0; m_device_set_index_isSet = false; index = 0; @@ -64,10 +64,10 @@ SWGDeviceListItem::init() { m_sequence_isSet = false; direction = 0; m_direction_isSet = false; - nb_streams = 0; - m_nb_streams_isSet = false; - stream_index = 0; - m_stream_index_isSet = false; + device_nb_streams = 0; + m_device_nb_streams_isSet = false; + device_stream_index = 0; + m_device_stream_index_isSet = false; device_set_index = 0; m_device_set_index_isSet = false; index = 0; @@ -114,9 +114,9 @@ SWGDeviceListItem::fromJsonObject(QJsonObject &pJson) { ::SWGSDRangel::setValue(&direction, pJson["direction"], "qint32", ""); - ::SWGSDRangel::setValue(&nb_streams, pJson["nbStreams"], "qint32", ""); + ::SWGSDRangel::setValue(&device_nb_streams, pJson["deviceNbStreams"], "qint32", ""); - ::SWGSDRangel::setValue(&stream_index, pJson["streamIndex"], "qint32", ""); + ::SWGSDRangel::setValue(&device_stream_index, pJson["deviceStreamIndex"], "qint32", ""); ::SWGSDRangel::setValue(&device_set_index, pJson["deviceSetIndex"], "qint32", ""); @@ -153,11 +153,11 @@ SWGDeviceListItem::asJsonObject() { if(m_direction_isSet){ obj->insert("direction", QJsonValue(direction)); } - if(m_nb_streams_isSet){ - obj->insert("nbStreams", QJsonValue(nb_streams)); + if(m_device_nb_streams_isSet){ + obj->insert("deviceNbStreams", QJsonValue(device_nb_streams)); } - if(m_stream_index_isSet){ - obj->insert("streamIndex", QJsonValue(stream_index)); + if(m_device_stream_index_isSet){ + obj->insert("deviceStreamIndex", QJsonValue(device_stream_index)); } if(m_device_set_index_isSet){ obj->insert("deviceSetIndex", QJsonValue(device_set_index)); @@ -220,23 +220,23 @@ SWGDeviceListItem::setDirection(qint32 direction) { } qint32 -SWGDeviceListItem::getNbStreams() { - return nb_streams; +SWGDeviceListItem::getDeviceNbStreams() { + return device_nb_streams; } void -SWGDeviceListItem::setNbStreams(qint32 nb_streams) { - this->nb_streams = nb_streams; - this->m_nb_streams_isSet = true; +SWGDeviceListItem::setDeviceNbStreams(qint32 device_nb_streams) { + this->device_nb_streams = device_nb_streams; + this->m_device_nb_streams_isSet = true; } qint32 -SWGDeviceListItem::getStreamIndex() { - return stream_index; +SWGDeviceListItem::getDeviceStreamIndex() { + return device_stream_index; } void -SWGDeviceListItem::setStreamIndex(qint32 stream_index) { - this->stream_index = stream_index; - this->m_stream_index_isSet = true; +SWGDeviceListItem::setDeviceStreamIndex(qint32 device_stream_index) { + this->device_stream_index = device_stream_index; + this->m_device_stream_index_isSet = true; } qint32 @@ -269,8 +269,8 @@ SWGDeviceListItem::isSet(){ if(serial != nullptr && *serial != QString("")){ isObjectUpdated = true; break;} if(m_sequence_isSet){ isObjectUpdated = true; break;} if(m_direction_isSet){ isObjectUpdated = true; break;} - if(m_nb_streams_isSet){ isObjectUpdated = true; break;} - if(m_stream_index_isSet){ isObjectUpdated = true; break;} + if(m_device_nb_streams_isSet){ isObjectUpdated = true; break;} + if(m_device_stream_index_isSet){ isObjectUpdated = true; break;} if(m_device_set_index_isSet){ isObjectUpdated = true; break;} if(m_index_isSet){ isObjectUpdated = true; break;} }while(false); diff --git a/swagger/sdrangel/code/qt5/client/SWGDeviceListItem.h b/swagger/sdrangel/code/qt5/client/SWGDeviceListItem.h index 204c3f18b..992a5f92f 100644 --- a/swagger/sdrangel/code/qt5/client/SWGDeviceListItem.h +++ b/swagger/sdrangel/code/qt5/client/SWGDeviceListItem.h @@ -57,11 +57,11 @@ public: qint32 getDirection(); void setDirection(qint32 direction); - qint32 getNbStreams(); - void setNbStreams(qint32 nb_streams); + qint32 getDeviceNbStreams(); + void setDeviceNbStreams(qint32 device_nb_streams); - qint32 getStreamIndex(); - void setStreamIndex(qint32 stream_index); + qint32 getDeviceStreamIndex(); + void setDeviceStreamIndex(qint32 device_stream_index); qint32 getDeviceSetIndex(); void setDeviceSetIndex(qint32 device_set_index); @@ -88,11 +88,11 @@ private: qint32 direction; bool m_direction_isSet; - qint32 nb_streams; - bool m_nb_streams_isSet; + qint32 device_nb_streams; + bool m_device_nb_streams_isSet; - qint32 stream_index; - bool m_stream_index_isSet; + qint32 device_stream_index; + bool m_device_stream_index_isSet; qint32 device_set_index; bool m_device_set_index_isSet; diff --git a/swagger/sdrangel/code/qt5/client/SWGSamplingDevice.cpp b/swagger/sdrangel/code/qt5/client/SWGSamplingDevice.cpp index 39ba3c6b5..1f3561796 100644 --- a/swagger/sdrangel/code/qt5/client/SWGSamplingDevice.cpp +++ b/swagger/sdrangel/code/qt5/client/SWGSamplingDevice.cpp @@ -34,10 +34,10 @@ SWGSamplingDevice::SWGSamplingDevice() { m_hw_type_isSet = false; direction = 0; m_direction_isSet = false; - nb_streams = 0; - m_nb_streams_isSet = false; - stream_index = 0; - m_stream_index_isSet = false; + device_nb_streams = 0; + m_device_nb_streams_isSet = false; + device_stream_index = 0; + m_device_stream_index_isSet = false; sequence = 0; m_sequence_isSet = false; serial = nullptr; @@ -62,10 +62,10 @@ SWGSamplingDevice::init() { m_hw_type_isSet = false; direction = 0; m_direction_isSet = false; - nb_streams = 0; - m_nb_streams_isSet = false; - stream_index = 0; - m_stream_index_isSet = false; + device_nb_streams = 0; + m_device_nb_streams_isSet = false; + device_stream_index = 0; + m_device_stream_index_isSet = false; sequence = 0; m_sequence_isSet = false; serial = new QString(""); @@ -115,9 +115,9 @@ SWGSamplingDevice::fromJsonObject(QJsonObject &pJson) { ::SWGSDRangel::setValue(&direction, pJson["direction"], "qint32", ""); - ::SWGSDRangel::setValue(&nb_streams, pJson["nbStreams"], "qint32", ""); + ::SWGSDRangel::setValue(&device_nb_streams, pJson["deviceNbStreams"], "qint32", ""); - ::SWGSDRangel::setValue(&stream_index, pJson["streamIndex"], "qint32", ""); + ::SWGSDRangel::setValue(&device_stream_index, pJson["deviceStreamIndex"], "qint32", ""); ::SWGSDRangel::setValue(&sequence, pJson["sequence"], "qint32", ""); @@ -154,11 +154,11 @@ SWGSamplingDevice::asJsonObject() { if(m_direction_isSet){ obj->insert("direction", QJsonValue(direction)); } - if(m_nb_streams_isSet){ - obj->insert("nbStreams", QJsonValue(nb_streams)); + if(m_device_nb_streams_isSet){ + obj->insert("deviceNbStreams", QJsonValue(device_nb_streams)); } - if(m_stream_index_isSet){ - obj->insert("streamIndex", QJsonValue(stream_index)); + if(m_device_stream_index_isSet){ + obj->insert("deviceStreamIndex", QJsonValue(device_stream_index)); } if(m_sequence_isSet){ obj->insert("sequence", QJsonValue(sequence)); @@ -210,23 +210,23 @@ SWGSamplingDevice::setDirection(qint32 direction) { } qint32 -SWGSamplingDevice::getNbStreams() { - return nb_streams; +SWGSamplingDevice::getDeviceNbStreams() { + return device_nb_streams; } void -SWGSamplingDevice::setNbStreams(qint32 nb_streams) { - this->nb_streams = nb_streams; - this->m_nb_streams_isSet = true; +SWGSamplingDevice::setDeviceNbStreams(qint32 device_nb_streams) { + this->device_nb_streams = device_nb_streams; + this->m_device_nb_streams_isSet = true; } qint32 -SWGSamplingDevice::getStreamIndex() { - return stream_index; +SWGSamplingDevice::getDeviceStreamIndex() { + return device_stream_index; } void -SWGSamplingDevice::setStreamIndex(qint32 stream_index) { - this->stream_index = stream_index; - this->m_stream_index_isSet = true; +SWGSamplingDevice::setDeviceStreamIndex(qint32 device_stream_index) { + this->device_stream_index = device_stream_index; + this->m_device_stream_index_isSet = true; } qint32 @@ -287,8 +287,8 @@ SWGSamplingDevice::isSet(){ if(m_index_isSet){ isObjectUpdated = true; break;} if(hw_type != nullptr && *hw_type != QString("")){ isObjectUpdated = true; break;} if(m_direction_isSet){ isObjectUpdated = true; break;} - if(m_nb_streams_isSet){ isObjectUpdated = true; break;} - if(m_stream_index_isSet){ isObjectUpdated = true; break;} + if(m_device_nb_streams_isSet){ isObjectUpdated = true; break;} + if(m_device_stream_index_isSet){ isObjectUpdated = true; break;} if(m_sequence_isSet){ isObjectUpdated = true; break;} if(serial != nullptr && *serial != QString("")){ isObjectUpdated = true; break;} if(m_center_frequency_isSet){ isObjectUpdated = true; break;} diff --git a/swagger/sdrangel/code/qt5/client/SWGSamplingDevice.h b/swagger/sdrangel/code/qt5/client/SWGSamplingDevice.h index 895ec497e..70f0b031d 100644 --- a/swagger/sdrangel/code/qt5/client/SWGSamplingDevice.h +++ b/swagger/sdrangel/code/qt5/client/SWGSamplingDevice.h @@ -51,11 +51,11 @@ public: qint32 getDirection(); void setDirection(qint32 direction); - qint32 getNbStreams(); - void setNbStreams(qint32 nb_streams); + qint32 getDeviceNbStreams(); + void setDeviceNbStreams(qint32 device_nb_streams); - qint32 getStreamIndex(); - void setStreamIndex(qint32 stream_index); + qint32 getDeviceStreamIndex(); + void setDeviceStreamIndex(qint32 device_stream_index); qint32 getSequence(); void setSequence(qint32 sequence); @@ -85,11 +85,11 @@ private: qint32 direction; bool m_direction_isSet; - qint32 nb_streams; - bool m_nb_streams_isSet; + qint32 device_nb_streams; + bool m_device_nb_streams_isSet; - qint32 stream_index; - bool m_stream_index_isSet; + qint32 device_stream_index; + bool m_device_stream_index_isSet; qint32 sequence; bool m_sequence_isSet;