/** * SDRangel * This is the web API of SDRangel SDR software. SDRangel is an Open Source Qt5/OpenGL 3.0+ GUI and server Software Defined Radio and signal analyzer in software. It supports Airspy, BladeRF, HackRF, LimeSDR, PlutoSDR, RTL-SDR, SDRplay RSP1 and FunCube * * OpenAPI spec version: 4.0.0 * Contact: f4exb06@gmail.com * * NOTE: This class is auto generated by the swagger code generator program. * https://github.com/swagger-api/swagger-codegen.git * Do not edit the class manually. */ #include "SWGDeviceSetApi.h" #include "SWGHelpers.h" #include "SWGModelFactory.h" #include #include namespace SWGSDRangel { SWGDeviceSetApi::SWGDeviceSetApi() {} SWGDeviceSetApi::~SWGDeviceSetApi() {} SWGDeviceSetApi::SWGDeviceSetApi(QString host, QString basePath) { this->host = host; this->basePath = basePath; } void SWGDeviceSetApi::devicesetDeviceGet(qint32 device_set_index) { QString fullPath; fullPath.append(this->host).append(this->basePath).append("/sdrangel/deviceset/{deviceSetIndex}/device/settings"); QString device_set_indexPathParam("{"); device_set_indexPathParam.append("deviceSetIndex").append("}"); fullPath.replace(device_set_indexPathParam, stringValue(device_set_index)); HttpRequestWorker *worker = new HttpRequestWorker(); HttpRequestInput input(fullPath, "GET"); foreach(QString key, this->defaultHeaders.keys()) { input.headers.insert(key, this->defaultHeaders.value(key)); } connect(worker, &HttpRequestWorker::on_execution_finished, this, &SWGDeviceSetApi::devicesetDeviceGetCallback); worker->execute(&input); } void SWGDeviceSetApi::devicesetDeviceGetCallback(HttpRequestWorker * worker) { QString msg; QString error_str = worker->error_str; QNetworkReply::NetworkError error_type = worker->error_type; if (worker->error_type == QNetworkReply::NoError) { msg = QString("Success! %1 bytes").arg(worker->response.length()); } else { msg = "Error: " + worker->error_str; } QString json(worker->response); SWGDeviceSettings* output = static_cast(create(json, QString("SWGDeviceSettings"))); worker->deleteLater(); emit devicesetDeviceGetSignal(output); emit devicesetDeviceGetSignalE(output, error_type, error_str); } void SWGDeviceSetApi::devicesetDevicePut(qint32 device_set_index, SWGDeviceListItem body) { QString fullPath; fullPath.append(this->host).append(this->basePath).append("/sdrangel/deviceset/{deviceSetIndex}/device"); QString device_set_indexPathParam("{"); device_set_indexPathParam.append("deviceSetIndex").append("}"); fullPath.replace(device_set_indexPathParam, stringValue(device_set_index)); HttpRequestWorker *worker = new HttpRequestWorker(); HttpRequestInput input(fullPath, "PUT"); QString output = body.asJson(); input.request_body.append(output); foreach(QString key, this->defaultHeaders.keys()) { input.headers.insert(key, this->defaultHeaders.value(key)); } connect(worker, &HttpRequestWorker::on_execution_finished, this, &SWGDeviceSetApi::devicesetDevicePutCallback); worker->execute(&input); } void SWGDeviceSetApi::devicesetDevicePutCallback(HttpRequestWorker * worker) { QString msg; QString error_str = worker->error_str; QNetworkReply::NetworkError error_type = worker->error_type; if (worker->error_type == QNetworkReply::NoError) { msg = QString("Success! %1 bytes").arg(worker->response.length()); } else { msg = "Error: " + worker->error_str; } QString json(worker->response); SWGDeviceListItem* output = static_cast(create(json, QString("SWGDeviceListItem"))); worker->deleteLater(); emit devicesetDevicePutSignal(output); emit devicesetDevicePutSignalE(output, error_type, error_str); } void SWGDeviceSetApi::devicesetGet(qint32 device_set_index) { QString fullPath; fullPath.append(this->host).append(this->basePath).append("/sdrangel/deviceset/{deviceSetIndex}"); QString device_set_indexPathParam("{"); device_set_indexPathParam.append("deviceSetIndex").append("}"); fullPath.replace(device_set_indexPathParam, stringValue(device_set_index)); HttpRequestWorker *worker = new HttpRequestWorker(); HttpRequestInput input(fullPath, "GET"); foreach(QString key, this->defaultHeaders.keys()) { input.headers.insert(key, this->defaultHeaders.value(key)); } connect(worker, &HttpRequestWorker::on_execution_finished, this, &SWGDeviceSetApi::devicesetGetCallback); worker->execute(&input); } void SWGDeviceSetApi::devicesetGetCallback(HttpRequestWorker * worker) { QString msg; QString error_str = worker->error_str; QNetworkReply::NetworkError error_type = worker->error_type; if (worker->error_type == QNetworkReply::NoError) { msg = QString("Success! %1 bytes").arg(worker->response.length()); } else { msg = "Error: " + worker->error_str; } QString json(worker->response); SWGDeviceSet* output = static_cast(create(json, QString("SWGDeviceSet"))); worker->deleteLater(); emit devicesetGetSignal(output); emit devicesetGetSignalE(output, error_type, error_str); } }