v7: removed feature set index from API. Implements #1231

pull/1500/head
f4exb 2022-05-04 13:27:13 +02:00
rodzic 233c3f961d
commit 4eba3bb871
14 zmienionych plików z 751 dodań i 2382 usunięć

Wyświetl plik

@ -1924,34 +1924,24 @@ paths:
"501":
$ref: "#/responses/Response_501"
/sdrangel/featureset/{featureSetIndex}:
/sdrangel/featureset:
x-swagger-router-controller: featureset
get:
description: Get feature set information
description: Get features information
operationId: featuresetGet
tags:
- FeatureSet
parameters:
- in: path
name: featureSetIndex
type: integer
required: true
description: Index of feature set in the device set list
responses:
"200":
description: On success return details on the feature set
description: On success return details on the features present in the system
schema:
$ref: "#/definitions/FeatureSet"
"404":
description: Invalid index
schema:
$ref: "#/definitions/ErrorResponse"
"500":
$ref: "#/responses/Response_500"
"501":
$ref: "#/responses/Response_501"
/sdrangel/featureset/{featureSetIndex}/feature:
/sdrangel/featureset/feature:
x-swagger-router-controller: featureset
post:
description: add a feature
@ -1959,11 +1949,6 @@ paths:
tags:
- FeatureSet
parameters:
- in: path
name: featureSetIndex
type: integer
required: true
description: Index of feature set in the feature set list
- name: body
in: body
description: Feature identification (no settings data)
@ -1975,10 +1960,6 @@ paths:
description: Message to add a feature was sent successfully
schema:
$ref: "#/definitions/SuccessResponse"
"400":
description: Invalid feature set index
schema:
$ref: "#/definitions/ErrorResponse"
"404":
description: Feature not found
schema:
@ -1988,24 +1969,19 @@ paths:
"501":
$ref: "#/responses/Response_501"
/sdrangel/featureset/{featureSetIndex}/preset:
/sdrangel/featureset/preset:
x-swagger-router-controller: featureset
patch:
description: Load a preset in a feature set
description: Load a preset in features
operationId: featuresetPresetPatch
tags:
- FeatureSet
consumes:
- application/json
parameters:
- in: path
name: featureSetIndex
type: integer
required: true
description: Index of feature set in the feature set list
- name: body
in: body
description: Load preset settings to the feature set
description: Load preset settings to the features
required: true
schema:
$ref: "#/definitions/FeaturePresetIdentifier"
@ -2019,7 +1995,7 @@ paths:
schema:
$ref: "#/definitions/ErrorResponse"
"404":
description: No preset or feature set found
description: No preset found
schema:
$ref: "#/definitions/ErrorResponse"
"500":
@ -2027,21 +2003,16 @@ paths:
"501":
$ref: "#/responses/Response_501"
put:
description: Update an existing preset with feature set settings.
description: Update an existing preset with features settings.
operationId: featuresetPresetPut
tags:
- FeatureSet
consumes:
- application/json
parameters:
- in: path
name: featureSetIndex
type: integer
required: true
description: Index of feature set in the feature set list
- name: body
in: body
description: save feature set settings to the preset
description: save features settings to the preset
required: true
schema:
$ref: "#/definitions/FeaturePresetIdentifier"
@ -2055,7 +2026,7 @@ paths:
schema:
$ref: "#/definitions/ErrorResponse"
"404":
description: No preset or feature set found
description: No preset found
schema:
$ref: "#/definitions/ErrorResponse"
"500":
@ -2063,21 +2034,16 @@ paths:
"501":
$ref: "#/responses/Response_501"
post:
description: Create a new preset from a feature set settings.
description: Create a new preset from features settings.
operationId: featuresetPresetPost
tags:
- FeatureSet
consumes:
- application/json
parameters:
- in: path
name: featureSetIndex
type: integer
required: true
description: Index of feature set in the feature set list
- name: body
in: body
description: save feature set settings on a new preset
description: save features settings on a new preset
required: true
schema:
$ref: "#/definitions/FeaturePresetIdentifier"
@ -2103,7 +2069,7 @@ paths:
"501":
$ref: "#/responses/Response_501"
/sdrangel/featureset/{featureSetIndex}/feature/{featureIndex}:
/sdrangel/featureset/feature/{featureIndex}:
x-swagger-router-controller: featureset
delete:
description: delete a feature
@ -2111,11 +2077,6 @@ paths:
tags:
- FeatureSet
parameters:
- in: path
name: featureSetIndex
type: integer
required: true
description: Index of feature set in the feature set list
- in: path
name: featureIndex
type: integer
@ -2127,7 +2088,7 @@ paths:
schema:
$ref: "/doc/swagger/include/FeatureSettings.yaml#/FeatureSettings"
"400":
description: Invalid feature set or feature index
description: Invalid feature index
schema:
$ref: "#/definitions/ErrorResponse"
"404":
@ -2139,7 +2100,7 @@ paths:
"501":
$ref: "#/responses/Response_501"
/sdrangel/featureset/{featureSetIndex}/feature/{featureIndex}/run:
/sdrangel/featureset/feature/{featureIndex}/run:
x-swagger-router-controller: featureset
get:
description: get feature run status
@ -2147,11 +2108,6 @@ paths:
tags:
- FeatureSet
parameters:
- in: path
name: featureSetIndex
type: integer
required: true
description: Index of feature set in the feature set list
- in: path
name: featureIndex
type: integer
@ -2162,10 +2118,6 @@ paths:
description: On success return current feature run state
schema:
$ref: "#/definitions/DeviceState"
"400":
description: Invalid feature set index
schema:
$ref: "#/definitions/ErrorResponse"
"404":
description: Feature not found
schema:
@ -2180,11 +2132,6 @@ paths:
tags:
- FeatureSet
parameters:
- in: path
name: featureSetIndex
type: integer
required: true
description: Index of feature set in the feature set list
- in: path
name: featureIndex
type: integer
@ -2195,10 +2142,6 @@ paths:
description: On success return state before change
schema:
$ref: "#/definitions/DeviceState"
"400":
description: Invalid feature set index
schema:
$ref: "#/definitions/ErrorResponse"
"404":
description: Feature not found
schema:
@ -2213,11 +2156,6 @@ paths:
tags:
- FeatureSet
parameters:
- in: path
name: featureSetIndex
type: integer
required: true
description: Index of feature set in the feature set list
- in: path
name: featureIndex
type: integer
@ -2241,7 +2179,7 @@ paths:
"501":
$ref: "#/responses/Response_501"
/sdrangel/featureset/{featureSetIndex}/feature/{featureIndex}/settings:
/sdrangel/featureset/feature/{featureIndex}/settings:
x-swagger-router-controller: featureset
get:
description: get a feature settings
@ -2249,23 +2187,18 @@ paths:
tags:
- FeatureSet
parameters:
- in: path
name: featureSetIndex
type: integer
required: true
description: Index of feature set in the feature set list
- in: path
name: featureIndex
type: integer
required: true
description: Index of the feature in the features list for this feature set
description: Index of the feature in the features list
responses:
"200":
description: On success return feature settings
schema:
$ref: "/doc/swagger/include/FeatureSettings.yaml#/FeatureSettings"
"400":
description: Invalid feature set or feature index
description: Invalid feature index
schema:
$ref: "#/definitions/ErrorResponse"
"404":
@ -2282,16 +2215,11 @@ paths:
tags:
- FeatureSet
parameters:
- in: path
name: featureSetIndex
type: integer
required: true
description: Index of feature set in the feature set list
- in: path
name: featureIndex
type: integer
required: true
description: Index of the feature in the features list for this feature set
description: Index of the feature in the features list
- name: body
in: body
description: Feature settings to apply
@ -2304,7 +2232,7 @@ paths:
schema:
$ref: "/doc/swagger/include/FeatureSettings.yaml#/FeatureSettings"
"400":
description: Invalid feature set or feature index
description: Invalid feature index
schema:
$ref: "#/definitions/ErrorResponse"
"404":
@ -2321,16 +2249,11 @@ paths:
tags:
- FeatureSet
parameters:
- in: path
name: featureSetIndex
type: integer
required: true
description: Index of feature set in the feature set list
- in: path
name: featureIndex
type: integer
required: true
description: Index of the feature in the features list for this feature set
description: Index of the feature in the features list
- name: body
in: body
description: Feature settings to apply
@ -2343,7 +2266,7 @@ paths:
schema:
$ref: "/doc/swagger/include/FeatureSettings.yaml#/FeatureSettings"
"400":
description: Invalid feature set or feature index
description: Invalid feature index
schema:
$ref: "#/definitions/ErrorResponse"
"404":
@ -2355,7 +2278,7 @@ paths:
"501":
$ref: "#/responses/Response_501"
/sdrangel/featureset/{featureSetIndex}/feature/{featureIndex}/report:
/sdrangel/featureset/feature/{featureIndex}/report:
x-swagger-router-controller: featureset
get:
description: get a feature report
@ -2363,23 +2286,18 @@ paths:
tags:
- FeatureSet
parameters:
- in: path
name: featureSetIndex
type: integer
required: true
description: Index of feature set in the feature set list
- in: path
name: featureIndex
type: integer
required: true
description: Index of the feature in the features list for this feature set
description: Index of the feature in the features list
responses:
"200":
description: On success return feature report
schema:
$ref: "/doc/swagger/include/FeatureReport.yaml#/FeatureReport"
"400":
description: Invalid feature set or feature index
description: Invalid feature index
schema:
$ref: "#/definitions/ErrorResponse"
"404":
@ -2391,7 +2309,7 @@ paths:
"501":
$ref: "#/responses/Response_501"
/sdrangel/featureset/{featureSetIndex}/feature/{featureIndex}/actions:
/sdrangel/featureset/feature/{featureIndex}/actions:
x-swagger-router-controller: featureset
post:
description: post an action or actions on a channel
@ -2399,16 +2317,11 @@ paths:
tags:
- FeatureSet
parameters:
- in: path
name: featureSetIndex
type: integer
required: true
description: Index of feature set in the feature set list
- in: path
name: featureIndex
type: integer
required: true
description: Index of the feature in the features list for this feature set
description: Index of the feature in the features list
- name: body
in: body
description: Action(s) to apply to the feature
@ -2421,7 +2334,7 @@ paths:
schema:
$ref: "#/definitions/SuccessResponse"
"400":
description: Invalid feature set or feature index
description: Invalid feature index
schema:
$ref: "#/definitions/ErrorResponse"
"404":
@ -2710,9 +2623,6 @@ definitions:
- index
- featurecount
properties:
index:
description: "Index in the list of feature sets opened in this instance"
type: integer
featurecount:
description: "Number of features in the set"
type: integer

Wyświetl plik

@ -126,7 +126,7 @@ int WebAPIAdapter::instanceSummary(
getDeviceSetList(deviceSetList);
SWGSDRangel::SWGFeatureSet *featureSet = response.getFeatureset();
getFeatureSet(featureSet, m_mainCore->m_featureSets.back(), 0);
getFeatureSet(featureSet, m_mainCore->m_featureSets.back());
return 200;
}
@ -3683,7 +3683,7 @@ int WebAPIAdapter::featuresetGet(
if ((featureSetIndex >= 0) && (featureSetIndex < (int) m_mainCore->m_featureSets.size()))
{
const FeatureSet *featureSet = m_mainCore->m_featureSets[featureSetIndex];
getFeatureSet(&response, featureSet, featureSetIndex);
getFeatureSet(&response, featureSet);
return 200;
}
@ -3696,11 +3696,10 @@ int WebAPIAdapter::featuresetGet(
}
}
void WebAPIAdapter::getFeatureSet(SWGSDRangel::SWGFeatureSet *swgFeatureSet, const FeatureSet* featureSet, int featureSetIndex)
void WebAPIAdapter::getFeatureSet(SWGSDRangel::SWGFeatureSet *swgFeatureSet, const FeatureSet* featureSet)
{
swgFeatureSet->init();
swgFeatureSet->setFeaturecount(featureSet->getNumberOfFeatures());
swgFeatureSet->setIndex(featureSetIndex);
QList<SWGSDRangel::SWGFeature*> *features = swgFeatureSet->getFeatures();
for (int i = 0; i < featureSet->getNumberOfFeatures(); i++)

Wyświetl plik

@ -445,7 +445,7 @@ private:
void getDeviceSetList(SWGSDRangel::SWGDeviceSetList* deviceSetList);
void getDeviceSet(SWGSDRangel::SWGDeviceSet *swgDeviceSet, const DeviceSet* deviceSet, int deviceSetIndex);
void getChannelsDetail(SWGSDRangel::SWGChannelsDetail *channelsDetail, const DeviceSet* deviceSet);
void getFeatureSet(SWGSDRangel::SWGFeatureSet *swgFeatureSet, const FeatureSet* featureSet, int featureSetIndex);
void getFeatureSet(SWGSDRangel::SWGFeatureSet *swgFeatureSet, const FeatureSet* featureSet);
static QtMsgType getMsgTypeFromString(const QString& msgTypeString);
static void getMsgTypeString(const QtMsgType& msgType, QString& level);
};

Wyświetl plik

@ -44,6 +44,9 @@ QString WebAPIAdapterInterface::instanceFeaturePresetsURL = "/sdrangel/featurepr
QString WebAPIAdapterInterface::instanceFeaturePresetURL = "/sdrangel/featurepreset";
QString WebAPIAdapterInterface::instanceDeviceSetsURL = "/sdrangel/devicesets";
QString WebAPIAdapterInterface::instanceDeviceSetURL = "/sdrangel/deviceset";
QString WebAPIAdapterInterface::featuresetURL("/sdrangel/featureset");
QString WebAPIAdapterInterface::featuresetFeatureURL("/sdrangel/featureset/feature");
QString WebAPIAdapterInterface::featuresetPresetURL("/sdrangel/featureset/preset");
std::regex WebAPIAdapterInterface::devicesetURLRe("^/sdrangel/deviceset/([0-9]{1,2})$");
std::regex WebAPIAdapterInterface::devicesetFocusURLRe("^/sdrangel/deviceset/([0-9]{1,2})/focus$");
@ -62,14 +65,11 @@ std::regex WebAPIAdapterInterface::devicesetChannelSettingsURLRe("^/sdrangel/dev
std::regex WebAPIAdapterInterface::devicesetChannelReportURLRe("^/sdrangel/deviceset/([0-9]{1,2})/channel/([0-9]{1,2})/report");
std::regex WebAPIAdapterInterface::devicesetChannelActionsURLRe("^/sdrangel/deviceset/([0-9]{1,2})/channel/([0-9]{1,2})/actions");
std::regex WebAPIAdapterInterface::featuresetURLRe("^/sdrangel/featureset/([0-9]{1,2})$");
std::regex WebAPIAdapterInterface::featuresetFeatureURLRe("^/sdrangel/featureset/([0-9]{1,2})/feature$");
std::regex WebAPIAdapterInterface::featuresetPresetURLRe("^/sdrangel/featureset/([0-9]{1,2})/preset");
std::regex WebAPIAdapterInterface::featuresetFeatureIndexURLRe("^/sdrangel/featureset/([0-9]{1,2})/feature/([0-9]{1,2})$");
std::regex WebAPIAdapterInterface::featuresetFeatureRunURLRe("^/sdrangel/featureset/([0-9]{1,2})/feature/([0-9]{1,2})/run$");
std::regex WebAPIAdapterInterface::featuresetFeatureSettingsURLRe("^/sdrangel/featureset/([0-9]{1,2})/feature/([0-9]{1,2})/settings$");
std::regex WebAPIAdapterInterface::featuresetFeatureReportURLRe("^/sdrangel/featureset/([0-9]{1,2})/feature/([0-9]{1,2})/report");
std::regex WebAPIAdapterInterface::featuresetFeatureActionsURLRe("^/sdrangel/featureset/([0-9]{1,2})/feature/([0-9]{1,2})/actions");
std::regex WebAPIAdapterInterface::featuresetFeatureIndexURLRe("^/sdrangel/featureset/feature/([0-9]{1,2})$");
std::regex WebAPIAdapterInterface::featuresetFeatureRunURLRe("^/sdrangel/featureset/feature/([0-9]{1,2})/run$");
std::regex WebAPIAdapterInterface::featuresetFeatureSettingsURLRe("^/sdrangel/featureset/feature/([0-9]{1,2})/settings$");
std::regex WebAPIAdapterInterface::featuresetFeatureReportURLRe("^/sdrangel/featureset/feature/([0-9]{1,2})/report$");
std::regex WebAPIAdapterInterface::featuresetFeatureActionsURLRe("^/sdrangel/featureset/feature/([0-9]{1,2})/actions$");
void WebAPIAdapterInterface::ConfigKeys::debug() const
{

Wyświetl plik

@ -1214,11 +1214,11 @@ public:
* returns the Http status code (default 501: not implemented)
*/
virtual int featuresetGet(
int deviceSetIndex,
int featureSetIndex,
SWGSDRangel::SWGFeatureSet& response,
SWGSDRangel::SWGErrorResponse& error)
{
(void) deviceSetIndex;
(void) featureSetIndex;
(void) response;
error.init();
*error.getMessage() = QString("Function not implemented");
@ -1472,6 +1472,9 @@ public:
static QString instanceFeaturePresetURL;
static QString instanceDeviceSetsURL;
static QString instanceDeviceSetURL;
static QString featuresetURL;
static QString featuresetFeatureURL;
static QString featuresetPresetURL;
static std::regex devicesetURLRe;
static std::regex devicesetFocusURLRe;
static std::regex devicesetSpectrumSettingsURLRe;
@ -1488,9 +1491,6 @@ public:
static std::regex devicesetChannelReportURLRe;
static std::regex devicesetChannelActionsURLRe;
static std::regex devicesetChannelsReportURLRe;
static std::regex featuresetURLRe;
static std::regex featuresetFeatureURLRe;
static std::regex featuresetPresetURLRe;
static std::regex featuresetFeatureIndexURLRe;
static std::regex featuresetFeatureRunURLRe;
static std::regex featuresetFeatureSettingsURLRe;

Wyświetl plik

@ -159,6 +159,12 @@ void WebAPIRequestMapper::service(qtwebapp::HttpRequest& request, qtwebapp::Http
instanceDeviceSetsService(request, response);
} else if (path == WebAPIAdapterInterface::instanceDeviceSetURL) {
instanceDeviceSetService(request, response);
} else if (path == WebAPIAdapterInterface::featuresetURL) {
featuresetService(request, response);
} else if (path == WebAPIAdapterInterface::featuresetFeatureURL) {
featuresetFeatureService(request, response);
} else if (path == WebAPIAdapterInterface::featuresetPresetURL) {
featuresetPresetService(request, response);
}
else
{
@ -197,22 +203,16 @@ void WebAPIRequestMapper::service(qtwebapp::HttpRequest& request, qtwebapp::Http
devicesetChannelReportService(std::string(desc_match[1]), std::string(desc_match[2]), request, response);
} else if (std::regex_match(pathStr, desc_match, WebAPIAdapterInterface::devicesetChannelActionsURLRe)) {
devicesetChannelActionsService(std::string(desc_match[1]), std::string(desc_match[2]), request, response);
} else if (std::regex_match(pathStr, desc_match, WebAPIAdapterInterface::featuresetURLRe)) {
featuresetService(std::string(desc_match[1]), request, response);
} else if (std::regex_match(pathStr, desc_match, WebAPIAdapterInterface::featuresetFeatureURLRe)) {
featuresetFeatureService(std::string(desc_match[1]), request, response);
} else if (std::regex_match(pathStr, desc_match, WebAPIAdapterInterface::featuresetPresetURLRe)) {
featuresetPresetService(std::string(desc_match[1]), request, response);
} else if (std::regex_match(pathStr, desc_match, WebAPIAdapterInterface::featuresetFeatureIndexURLRe)) {
featuresetFeatureIndexService(std::string(desc_match[1]), std::string(desc_match[2]), request, response);
featuresetFeatureIndexService(std::string(desc_match[1]), request, response);
} else if (std::regex_match(pathStr, desc_match, WebAPIAdapterInterface::featuresetFeatureRunURLRe)) {
featuresetFeatureRunService(std::string(desc_match[1]), std::string(desc_match[2]), request, response);
featuresetFeatureRunService(std::string(desc_match[1]), request, response);
} else if (std::regex_match(pathStr, desc_match, WebAPIAdapterInterface::featuresetFeatureSettingsURLRe)) {
featuresetFeatureSettingsService(std::string(desc_match[1]), std::string(desc_match[2]), request, response);
featuresetFeatureSettingsService(std::string(desc_match[1]), request, response);
} else if (std::regex_match(pathStr, desc_match, WebAPIAdapterInterface::featuresetFeatureReportURLRe)) {
featuresetFeatureReportService(std::string(desc_match[1]), std::string(desc_match[2]), request, response);
featuresetFeatureReportService(std::string(desc_match[1]), request, response);
} else if (std::regex_match(pathStr, desc_match, WebAPIAdapterInterface::featuresetFeatureActionsURLRe)) {
featuresetFeatureActionsService(std::string(desc_match[1]), std::string(desc_match[2]), request, response);
featuresetFeatureActionsService(std::string(desc_match[1]), request, response);
}
else // serve static documentation pages
{
@ -2512,7 +2512,7 @@ void WebAPIRequestMapper::devicesetChannelActionsService(
}
}
void WebAPIRequestMapper::featuresetService(const std::string& indexStr, qtwebapp::HttpRequest& request, qtwebapp::HttpResponse& response)
void WebAPIRequestMapper::featuresetService(qtwebapp::HttpRequest& request, qtwebapp::HttpResponse& response)
{
SWGSDRangel::SWGErrorResponse errorResponse;
response.setHeader("Content-Type", "application/json");
@ -2520,24 +2520,13 @@ void WebAPIRequestMapper::featuresetService(const std::string& indexStr, qtwebap
if (request.getMethod() == "GET")
{
try
{
SWGSDRangel::SWGFeatureSet normalResponse;
int deviceSetIndex = boost::lexical_cast<int>(indexStr);
int status = m_adapter->featuresetGet(deviceSetIndex, normalResponse, errorResponse);
response.setStatus(status);
SWGSDRangel::SWGFeatureSet normalResponse;
int status = m_adapter->featuresetGet(0, normalResponse, errorResponse);
response.setStatus(status);
if (status/100 == 2) {
response.write(normalResponse.asJson().toUtf8());
} else {
response.write(errorResponse.asJson().toUtf8());
}
}
catch (const boost::bad_lexical_cast &e)
{
errorResponse.init();
*errorResponse.getMessage() = "Wrong integer conversion on device set index";
response.setStatus(400,"Invalid data");
if (status/100 == 2) {
response.write(normalResponse.asJson().toUtf8());
} else {
response.write(errorResponse.asJson().toUtf8());
}
}
@ -2551,7 +2540,6 @@ void WebAPIRequestMapper::featuresetService(const std::string& indexStr, qtwebap
}
void WebAPIRequestMapper::featuresetFeatureService(
const std::string& featureSetIndexStr,
qtwebapp::HttpRequest& request,
qtwebapp::HttpResponse& response)
{
@ -2559,70 +2547,57 @@ void WebAPIRequestMapper::featuresetFeatureService(
response.setHeader("Content-Type", "application/json");
response.setHeader("Access-Control-Allow-Origin", "*");
try
if (request.getMethod() == "POST")
{
int featureSetIndex = boost::lexical_cast<int>(featureSetIndexStr);
QString jsonStr = request.getBody();
QJsonObject jsonObject;
if (request.getMethod() == "POST")
if (parseJsonBody(jsonStr, jsonObject, response))
{
QString jsonStr = request.getBody();
QJsonObject jsonObject;
SWGSDRangel::SWGFeatureSettings query;
SWGSDRangel::SWGSuccessResponse normalResponse;
resetFeatureSettings(query);
if (parseJsonBody(jsonStr, jsonObject, response))
if (jsonObject.contains("featureType") && jsonObject["featureType"].isString())
{
SWGSDRangel::SWGFeatureSettings query;
SWGSDRangel::SWGSuccessResponse normalResponse;
resetFeatureSettings(query);
query.setFeatureType(new QString(jsonObject["featureType"].toString()));
if (jsonObject.contains("featureType") && jsonObject["featureType"].isString())
{
query.setFeatureType(new QString(jsonObject["featureType"].toString()));
int status = m_adapter->featuresetFeaturePost(0, query, normalResponse, errorResponse);
int status = m_adapter->featuresetFeaturePost(featureSetIndex, query, normalResponse, errorResponse);
response.setStatus(status);
response.setStatus(status);
if (status/100 == 2) {
response.write(normalResponse.asJson().toUtf8());
} else {
response.write(errorResponse.asJson().toUtf8());
}
}
else
{
response.setStatus(400,"Invalid JSON request");
errorResponse.init();
*errorResponse.getMessage() = "Invalid JSON request";
if (status/100 == 2) {
response.write(normalResponse.asJson().toUtf8());
} else {
response.write(errorResponse.asJson().toUtf8());
}
}
else
{
response.setStatus(400,"Invalid JSON format");
response.setStatus(400,"Invalid JSON request");
errorResponse.init();
*errorResponse.getMessage() = "Invalid JSON format";
*errorResponse.getMessage() = "Invalid JSON request";
response.write(errorResponse.asJson().toUtf8());
}
}
else
{
response.setStatus(405,"Invalid HTTP method");
response.setStatus(400,"Invalid JSON format");
errorResponse.init();
*errorResponse.getMessage() = "Invalid HTTP method";
*errorResponse.getMessage() = "Invalid JSON format";
response.write(errorResponse.asJson().toUtf8());
}
}
catch (const boost::bad_lexical_cast &e)
else
{
response.setStatus(405,"Invalid HTTP method");
errorResponse.init();
*errorResponse.getMessage() = "Wrong integer conversion on index";
response.setStatus(400,"Invalid data");
*errorResponse.getMessage() = "Invalid HTTP method";
response.write(errorResponse.asJson().toUtf8());
}
}
void WebAPIRequestMapper::featuresetPresetService(
const std::string& featureSetIndexStr,
qtwebapp::HttpRequest& request,
qtwebapp::HttpResponse& response)
{
@ -2630,140 +2605,127 @@ void WebAPIRequestMapper::featuresetPresetService(
response.setHeader("Content-Type", "application/json");
response.setHeader("Access-Control-Allow-Origin", "*");
try
if (request.getMethod() == "PATCH")
{
int featureSetIndex = boost::lexical_cast<int>(featureSetIndexStr);
SWGSDRangel::SWGFeaturePresetIdentifier query;
QString jsonStr = request.getBody();
QJsonObject jsonObject;
if (request.getMethod() == "PATCH")
if (parseJsonBody(jsonStr, jsonObject, response))
{
SWGSDRangel::SWGFeaturePresetIdentifier query;
QString jsonStr = request.getBody();
QJsonObject jsonObject;
query.fromJson(jsonStr);
if (parseJsonBody(jsonStr, jsonObject, response))
if (validateFeaturePresetIdentifer(query))
{
query.fromJson(jsonStr);
int status = m_adapter->featuresetPresetPatch(0, query, errorResponse);
response.setStatus(status);
if (validateFeaturePresetIdentifer(query))
{
int status = m_adapter->featuresetPresetPatch(featureSetIndex, query, errorResponse);
response.setStatus(status);
if (status/100 == 2) {
response.write(query.asJson().toUtf8());
} else {
response.write(errorResponse.asJson().toUtf8());
}
}
else
{
response.setStatus(400,"Invalid JSON request");
errorResponse.init();
*errorResponse.getMessage() = "Invalid JSON request";
if (status/100 == 2) {
response.write(query.asJson().toUtf8());
} else {
response.write(errorResponse.asJson().toUtf8());
}
}
else
{
response.setStatus(400,"Invalid JSON format");
response.setStatus(400,"Invalid JSON request");
errorResponse.init();
*errorResponse.getMessage() = "Invalid JSON format";
response.write(errorResponse.asJson().toUtf8());
}
}
else if (request.getMethod() == "PUT")
{
SWGSDRangel::SWGFeaturePresetIdentifier query;
QString jsonStr = request.getBody();
QJsonObject jsonObject;
if (parseJsonBody(jsonStr, jsonObject, response))
{
query.fromJson(jsonStr);
if (validateFeaturePresetIdentifer(query))
{
int status = m_adapter->featuresetPresetPut(featureSetIndex, query, errorResponse);
response.setStatus(status);
if (status/100 == 2) {
response.write(query.asJson().toUtf8());
} else {
response.write(errorResponse.asJson().toUtf8());
}
}
else
{
response.setStatus(400,"Invalid JSON request");
errorResponse.init();
*errorResponse.getMessage() = "Invalid JSON request";
response.write(errorResponse.asJson().toUtf8());
}
}
else
{
response.setStatus(400,"Invalid JSON format");
errorResponse.init();
*errorResponse.getMessage() = "Invalid JSON format";
response.write(errorResponse.asJson().toUtf8());
}
}
else if (request.getMethod() == "POST")
{
SWGSDRangel::SWGFeaturePresetIdentifier query;
QString jsonStr = request.getBody();
QJsonObject jsonObject;
if (parseJsonBody(jsonStr, jsonObject, response))
{
query.fromJson(jsonStr);
if (validateFeaturePresetIdentifer(query))
{
int status = m_adapter->featuresetPresetPost(featureSetIndex, query, errorResponse);
response.setStatus(status);
if (status/100 == 2) {
response.write(query.asJson().toUtf8());
} else {
response.write(errorResponse.asJson().toUtf8());
}
}
else
{
response.setStatus(400,"Invalid JSON request");
errorResponse.init();
*errorResponse.getMessage() = "Invalid JSON request";
response.write(errorResponse.asJson().toUtf8());
}
}
else
{
response.setStatus(400,"Invalid JSON format");
errorResponse.init();
*errorResponse.getMessage() = "Invalid JSON format";
*errorResponse.getMessage() = "Invalid JSON request";
response.write(errorResponse.asJson().toUtf8());
}
}
else
{
response.setStatus(405,"Invalid HTTP method");
response.setStatus(400,"Invalid JSON format");
errorResponse.init();
*errorResponse.getMessage() = "Invalid HTTP method";
*errorResponse.getMessage() = "Invalid JSON format";
response.write(errorResponse.asJson().toUtf8());
}
}
catch (const boost::bad_lexical_cast &e)
else if (request.getMethod() == "PUT")
{
SWGSDRangel::SWGFeaturePresetIdentifier query;
QString jsonStr = request.getBody();
QJsonObject jsonObject;
if (parseJsonBody(jsonStr, jsonObject, response))
{
query.fromJson(jsonStr);
if (validateFeaturePresetIdentifer(query))
{
int status = m_adapter->featuresetPresetPut(0, query, errorResponse);
response.setStatus(status);
if (status/100 == 2) {
response.write(query.asJson().toUtf8());
} else {
response.write(errorResponse.asJson().toUtf8());
}
}
else
{
response.setStatus(400,"Invalid JSON request");
errorResponse.init();
*errorResponse.getMessage() = "Invalid JSON request";
response.write(errorResponse.asJson().toUtf8());
}
}
else
{
response.setStatus(400,"Invalid JSON format");
errorResponse.init();
*errorResponse.getMessage() = "Invalid JSON format";
response.write(errorResponse.asJson().toUtf8());
}
}
else if (request.getMethod() == "POST")
{
SWGSDRangel::SWGFeaturePresetIdentifier query;
QString jsonStr = request.getBody();
QJsonObject jsonObject;
if (parseJsonBody(jsonStr, jsonObject, response))
{
query.fromJson(jsonStr);
if (validateFeaturePresetIdentifer(query))
{
int status = m_adapter->featuresetPresetPost(0, query, errorResponse);
response.setStatus(status);
if (status/100 == 2) {
response.write(query.asJson().toUtf8());
} else {
response.write(errorResponse.asJson().toUtf8());
}
}
else
{
response.setStatus(400,"Invalid JSON request");
errorResponse.init();
*errorResponse.getMessage() = "Invalid JSON request";
response.write(errorResponse.asJson().toUtf8());
}
}
else
{
response.setStatus(400,"Invalid JSON format");
errorResponse.init();
*errorResponse.getMessage() = "Invalid JSON format";
response.write(errorResponse.asJson().toUtf8());
}
}
else
{
response.setStatus(405,"Invalid HTTP method");
errorResponse.init();
*errorResponse.getMessage() = "Wrong integer conversion on index";
response.setStatus(400,"Invalid data");
*errorResponse.getMessage() = "Invalid HTTP method";
response.write(errorResponse.asJson().toUtf8());
}
}
void WebAPIRequestMapper::featuresetFeatureIndexService(
const std::string& featureSetIndexStr,
const std::string& featureIndexStr,
qtwebapp::HttpRequest& request,
qtwebapp::HttpResponse& response)
@ -2774,13 +2736,12 @@ void WebAPIRequestMapper::featuresetFeatureIndexService(
try
{
int featureSetIndex = boost::lexical_cast<int>(featureSetIndexStr);
int featureIndex = boost::lexical_cast<int>(featureIndexStr);
if (request.getMethod() == "DELETE")
{
SWGSDRangel::SWGSuccessResponse normalResponse;
int status = m_adapter->featuresetFeatureDelete(featureSetIndex, featureIndex, normalResponse, errorResponse);
int status = m_adapter->featuresetFeatureDelete(0, featureIndex, normalResponse, errorResponse);
response.setStatus(status);
@ -2808,7 +2769,6 @@ void WebAPIRequestMapper::featuresetFeatureIndexService(
}
void WebAPIRequestMapper::featuresetFeatureRunService(
const std::string& featureSetIndexStr,
const std::string& featureIndexStr,
qtwebapp::HttpRequest& request,
qtwebapp::HttpResponse& response)
@ -2819,13 +2779,12 @@ void WebAPIRequestMapper::featuresetFeatureRunService(
try
{
int featureSetIndex = boost::lexical_cast<int>(featureSetIndexStr);
int featureIndex = boost::lexical_cast<int>(featureIndexStr);
if (request.getMethod() == "GET")
{
SWGSDRangel::SWGDeviceState normalResponse;
int status = m_adapter->featuresetFeatureRunGet(featureSetIndex, featureIndex, normalResponse, errorResponse);
int status = m_adapter->featuresetFeatureRunGet(0, featureIndex, normalResponse, errorResponse);
response.setStatus(status);
@ -2838,7 +2797,7 @@ void WebAPIRequestMapper::featuresetFeatureRunService(
else if (request.getMethod() == "POST")
{
SWGSDRangel::SWGDeviceState normalResponse;
int status = m_adapter->featuresetFeatureRunPost(featureSetIndex, featureIndex, normalResponse, errorResponse);
int status = m_adapter->featuresetFeatureRunPost(0, featureIndex, normalResponse, errorResponse);
response.setStatus(status);
@ -2852,7 +2811,7 @@ void WebAPIRequestMapper::featuresetFeatureRunService(
else if (request.getMethod() == "DELETE")
{
SWGSDRangel::SWGDeviceState normalResponse;
int status = m_adapter->featuresetFeatureRunDelete(featureSetIndex, featureIndex, normalResponse, errorResponse);
int status = m_adapter->featuresetFeatureRunDelete(0, featureIndex, normalResponse, errorResponse);
response.setStatus(status);
@ -2880,7 +2839,6 @@ void WebAPIRequestMapper::featuresetFeatureRunService(
}
void WebAPIRequestMapper::featuresetFeatureSettingsService(
const std::string& featureSetIndexStr,
const std::string& featureIndexStr,
qtwebapp::HttpRequest& request,
qtwebapp::HttpResponse& response)
@ -2891,14 +2849,13 @@ void WebAPIRequestMapper::featuresetFeatureSettingsService(
try
{
int featureSetIndex = boost::lexical_cast<int>(featureSetIndexStr);
int featureIndex = boost::lexical_cast<int>(featureIndexStr);
if (request.getMethod() == "GET")
{
SWGSDRangel::SWGFeatureSettings normalResponse;
resetFeatureSettings(normalResponse);
int status = m_adapter->featuresetFeatureSettingsGet(featureSetIndex, featureIndex, normalResponse, errorResponse);
int status = m_adapter->featuresetFeatureSettingsGet(0, featureIndex, normalResponse, errorResponse);
response.setStatus(status);
if (status/100 == 2) {
@ -2921,7 +2878,7 @@ void WebAPIRequestMapper::featuresetFeatureSettingsService(
if (validateFeatureSettings(normalResponse, jsonObject, featureSettingsKeys))
{
int status = m_adapter->featuresetFeatureSettingsPutPatch(
featureSetIndex,
0,
featureIndex,
(request.getMethod() == "PUT"), // force settings on PUT
featureSettingsKeys,
@ -2969,7 +2926,6 @@ void WebAPIRequestMapper::featuresetFeatureSettingsService(
}
void WebAPIRequestMapper::featuresetFeatureReportService(
const std::string& featureSetIndexStr,
const std::string& featureIndexStr,
qtwebapp::HttpRequest& request,
qtwebapp::HttpResponse& response)
@ -2980,14 +2936,13 @@ void WebAPIRequestMapper::featuresetFeatureReportService(
try
{
int featureSetIndex = boost::lexical_cast<int>(featureSetIndexStr);
int featureIndex = boost::lexical_cast<int>(featureIndexStr);
if (request.getMethod() == "GET")
{
SWGSDRangel::SWGFeatureReport normalResponse;
resetFeatureReport(normalResponse);
int status = m_adapter->featuresetFeatureReportGet(featureSetIndex, featureIndex, normalResponse, errorResponse);
int status = m_adapter->featuresetFeatureReportGet(0, featureIndex, normalResponse, errorResponse);
response.setStatus(status);
if (status/100 == 2) {
@ -3014,7 +2969,6 @@ void WebAPIRequestMapper::featuresetFeatureReportService(
}
void WebAPIRequestMapper::featuresetFeatureActionsService(
const std::string& featureSetIndexStr,
const std::string& featureIndexStr,
qtwebapp::HttpRequest& request,
qtwebapp::HttpResponse& response)
@ -3025,7 +2979,6 @@ void WebAPIRequestMapper::featuresetFeatureActionsService(
try
{
int featureSetIndex = boost::lexical_cast<int>(featureSetIndexStr);
int featureIndex = boost::lexical_cast<int>(featureIndexStr);
if (request.getMethod() == "POST")
@ -3043,7 +2996,7 @@ void WebAPIRequestMapper::featuresetFeatureActionsService(
if (validateFeatureActions(query, jsonObject, featureActionsKeys))
{
int status = m_adapter->featuresetFeatureActionsPost(
featureSetIndex,
0,
featureIndex,
featureActionsKeys,
query,

Wyświetl plik

@ -98,14 +98,14 @@ private:
void devicesetChannelReportService(const std::string& deviceSetIndexStr, const std::string& channelIndexStr, qtwebapp::HttpRequest& request, qtwebapp::HttpResponse& response);
void devicesetChannelActionsService(const std::string& deviceSetIndexStr, const std::string& channelIndexStr, qtwebapp::HttpRequest& request, qtwebapp::HttpResponse& response);
void featuresetService(const std::string& indexStr, qtwebapp::HttpRequest& request, qtwebapp::HttpResponse& response);
void featuresetFeatureService(const std::string& indexStr, qtwebapp::HttpRequest& request, qtwebapp::HttpResponse& response);
void featuresetPresetService(const std::string& indexStr, qtwebapp::HttpRequest& request, qtwebapp::HttpResponse& response);
void featuresetFeatureIndexService(const std::string& featureSetIndexStr, const std::string& featureIndexStr, qtwebapp::HttpRequest& request, qtwebapp::HttpResponse& response);
void featuresetFeatureRunService(const std::string& featureSetIndexStr, const std::string& featureIndexStr, qtwebapp::HttpRequest& request, qtwebapp::HttpResponse& response);
void featuresetFeatureSettingsService(const std::string& featureSetIndexStr, const std::string& featureIndexStr, qtwebapp::HttpRequest& request, qtwebapp::HttpResponse& response);
void featuresetFeatureReportService(const std::string& featureSetIndexStr, const std::string& featureIndexStr, qtwebapp::HttpRequest& request, qtwebapp::HttpResponse& response);
void featuresetFeatureActionsService(const std::string& featureSetIndexStr, const std::string& featureIndexStr, qtwebapp::HttpRequest& request, qtwebapp::HttpResponse& response);
void featuresetService(qtwebapp::HttpRequest& request, qtwebapp::HttpResponse& response);
void featuresetFeatureService(qtwebapp::HttpRequest& request, qtwebapp::HttpResponse& response);
void featuresetPresetService(qtwebapp::HttpRequest& request, qtwebapp::HttpResponse& response);
void featuresetFeatureIndexService(const std::string& featureIndexStr, qtwebapp::HttpRequest& request, qtwebapp::HttpResponse& response);
void featuresetFeatureRunService(const std::string& featureIndexStr, qtwebapp::HttpRequest& request, qtwebapp::HttpResponse& response);
void featuresetFeatureSettingsService(const std::string& featureIndexStr, qtwebapp::HttpRequest& request, qtwebapp::HttpResponse& response);
void featuresetFeatureReportService(const std::string& featureIndexStr, qtwebapp::HttpRequest& request, qtwebapp::HttpResponse& response);
void featuresetFeatureActionsService(const std::string& featureIndexStr, qtwebapp::HttpRequest& request, qtwebapp::HttpResponse& response);
bool validatePresetTransfer(SWGSDRangel::SWGPresetTransfer& presetTransfer);
bool validatePresetIdentifer(SWGSDRangel::SWGPresetIdentifier& presetIdentifier);

Wyświetl plik

@ -1924,34 +1924,24 @@ paths:
"501":
$ref: "#/responses/Response_501"
/sdrangel/featureset/{featureSetIndex}:
/sdrangel/featureset:
x-swagger-router-controller: featureset
get:
description: Get feature set information
description: Get features information
operationId: featuresetGet
tags:
- FeatureSet
parameters:
- in: path
name: featureSetIndex
type: integer
required: true
description: Index of feature set in the device set list
responses:
"200":
description: On success return details on the feature set
description: On success return details on the features present in the system
schema:
$ref: "#/definitions/FeatureSet"
"404":
description: Invalid index
schema:
$ref: "#/definitions/ErrorResponse"
"500":
$ref: "#/responses/Response_500"
"501":
$ref: "#/responses/Response_501"
/sdrangel/featureset/{featureSetIndex}/feature:
/sdrangel/featureset/feature:
x-swagger-router-controller: featureset
post:
description: add a feature
@ -1959,11 +1949,6 @@ paths:
tags:
- FeatureSet
parameters:
- in: path
name: featureSetIndex
type: integer
required: true
description: Index of feature set in the feature set list
- name: body
in: body
description: Feature identification (no settings data)
@ -1975,10 +1960,6 @@ paths:
description: Message to add a feature was sent successfully
schema:
$ref: "#/definitions/SuccessResponse"
"400":
description: Invalid feature set index
schema:
$ref: "#/definitions/ErrorResponse"
"404":
description: Feature not found
schema:
@ -1988,24 +1969,19 @@ paths:
"501":
$ref: "#/responses/Response_501"
/sdrangel/featureset/{featureSetIndex}/preset:
/sdrangel/featureset/preset:
x-swagger-router-controller: featureset
patch:
description: Load a preset in a feature set
description: Load a preset in features
operationId: featuresetPresetPatch
tags:
- FeatureSet
consumes:
- application/json
parameters:
- in: path
name: featureSetIndex
type: integer
required: true
description: Index of feature set in the feature set list
- name: body
in: body
description: Load preset settings to the feature set
description: Load preset settings to the features
required: true
schema:
$ref: "#/definitions/FeaturePresetIdentifier"
@ -2019,7 +1995,7 @@ paths:
schema:
$ref: "#/definitions/ErrorResponse"
"404":
description: No preset or feature set found
description: No preset found
schema:
$ref: "#/definitions/ErrorResponse"
"500":
@ -2027,21 +2003,16 @@ paths:
"501":
$ref: "#/responses/Response_501"
put:
description: Update an existing preset with feature set settings.
description: Update an existing preset with features settings.
operationId: featuresetPresetPut
tags:
- FeatureSet
consumes:
- application/json
parameters:
- in: path
name: featureSetIndex
type: integer
required: true
description: Index of feature set in the feature set list
- name: body
in: body
description: save feature set settings to the preset
description: save features settings to the preset
required: true
schema:
$ref: "#/definitions/FeaturePresetIdentifier"
@ -2055,7 +2026,7 @@ paths:
schema:
$ref: "#/definitions/ErrorResponse"
"404":
description: No preset or feature set found
description: No preset found
schema:
$ref: "#/definitions/ErrorResponse"
"500":
@ -2063,21 +2034,16 @@ paths:
"501":
$ref: "#/responses/Response_501"
post:
description: Create a new preset from a feature set settings.
description: Create a new preset from features settings.
operationId: featuresetPresetPost
tags:
- FeatureSet
consumes:
- application/json
parameters:
- in: path
name: featureSetIndex
type: integer
required: true
description: Index of feature set in the feature set list
- name: body
in: body
description: save feature set settings on a new preset
description: save features settings on a new preset
required: true
schema:
$ref: "#/definitions/FeaturePresetIdentifier"
@ -2103,7 +2069,7 @@ paths:
"501":
$ref: "#/responses/Response_501"
/sdrangel/featureset/{featureSetIndex}/feature/{featureIndex}:
/sdrangel/featureset/feature/{featureIndex}:
x-swagger-router-controller: featureset
delete:
description: delete a feature
@ -2111,11 +2077,6 @@ paths:
tags:
- FeatureSet
parameters:
- in: path
name: featureSetIndex
type: integer
required: true
description: Index of feature set in the feature set list
- in: path
name: featureIndex
type: integer
@ -2127,7 +2088,7 @@ paths:
schema:
$ref: "http://swgserver:8081/api/swagger/include/FeatureSettings.yaml#/FeatureSettings"
"400":
description: Invalid feature set or feature index
description: Invalid feature index
schema:
$ref: "#/definitions/ErrorResponse"
"404":
@ -2139,7 +2100,7 @@ paths:
"501":
$ref: "#/responses/Response_501"
/sdrangel/featureset/{featureSetIndex}/feature/{featureIndex}/run:
/sdrangel/featureset/feature/{featureIndex}/run:
x-swagger-router-controller: featureset
get:
description: get feature run status
@ -2147,11 +2108,6 @@ paths:
tags:
- FeatureSet
parameters:
- in: path
name: featureSetIndex
type: integer
required: true
description: Index of feature set in the feature set list
- in: path
name: featureIndex
type: integer
@ -2162,10 +2118,6 @@ paths:
description: On success return current feature run state
schema:
$ref: "#/definitions/DeviceState"
"400":
description: Invalid feature set index
schema:
$ref: "#/definitions/ErrorResponse"
"404":
description: Feature not found
schema:
@ -2180,11 +2132,6 @@ paths:
tags:
- FeatureSet
parameters:
- in: path
name: featureSetIndex
type: integer
required: true
description: Index of feature set in the feature set list
- in: path
name: featureIndex
type: integer
@ -2195,10 +2142,6 @@ paths:
description: On success return state before change
schema:
$ref: "#/definitions/DeviceState"
"400":
description: Invalid feature set index
schema:
$ref: "#/definitions/ErrorResponse"
"404":
description: Feature not found
schema:
@ -2213,11 +2156,6 @@ paths:
tags:
- FeatureSet
parameters:
- in: path
name: featureSetIndex
type: integer
required: true
description: Index of feature set in the feature set list
- in: path
name: featureIndex
type: integer
@ -2241,7 +2179,7 @@ paths:
"501":
$ref: "#/responses/Response_501"
/sdrangel/featureset/{featureSetIndex}/feature/{featureIndex}/settings:
/sdrangel/featureset/feature/{featureIndex}/settings:
x-swagger-router-controller: featureset
get:
description: get a feature settings
@ -2249,23 +2187,18 @@ paths:
tags:
- FeatureSet
parameters:
- in: path
name: featureSetIndex
type: integer
required: true
description: Index of feature set in the feature set list
- in: path
name: featureIndex
type: integer
required: true
description: Index of the feature in the features list for this feature set
description: Index of the feature in the features list
responses:
"200":
description: On success return feature settings
schema:
$ref: "http://swgserver:8081/api/swagger/include/FeatureSettings.yaml#/FeatureSettings"
"400":
description: Invalid feature set or feature index
description: Invalid feature index
schema:
$ref: "#/definitions/ErrorResponse"
"404":
@ -2282,16 +2215,11 @@ paths:
tags:
- FeatureSet
parameters:
- in: path
name: featureSetIndex
type: integer
required: true
description: Index of feature set in the feature set list
- in: path
name: featureIndex
type: integer
required: true
description: Index of the feature in the features list for this feature set
description: Index of the feature in the features list
- name: body
in: body
description: Feature settings to apply
@ -2304,7 +2232,7 @@ paths:
schema:
$ref: "http://swgserver:8081/api/swagger/include/FeatureSettings.yaml#/FeatureSettings"
"400":
description: Invalid feature set or feature index
description: Invalid feature index
schema:
$ref: "#/definitions/ErrorResponse"
"404":
@ -2321,16 +2249,11 @@ paths:
tags:
- FeatureSet
parameters:
- in: path
name: featureSetIndex
type: integer
required: true
description: Index of feature set in the feature set list
- in: path
name: featureIndex
type: integer
required: true
description: Index of the feature in the features list for this feature set
description: Index of the feature in the features list
- name: body
in: body
description: Feature settings to apply
@ -2343,7 +2266,7 @@ paths:
schema:
$ref: "http://swgserver:8081/api/swagger/include/FeatureSettings.yaml#/FeatureSettings"
"400":
description: Invalid feature set or feature index
description: Invalid feature index
schema:
$ref: "#/definitions/ErrorResponse"
"404":
@ -2355,7 +2278,7 @@ paths:
"501":
$ref: "#/responses/Response_501"
/sdrangel/featureset/{featureSetIndex}/feature/{featureIndex}/report:
/sdrangel/featureset/feature/{featureIndex}/report:
x-swagger-router-controller: featureset
get:
description: get a feature report
@ -2363,23 +2286,18 @@ paths:
tags:
- FeatureSet
parameters:
- in: path
name: featureSetIndex
type: integer
required: true
description: Index of feature set in the feature set list
- in: path
name: featureIndex
type: integer
required: true
description: Index of the feature in the features list for this feature set
description: Index of the feature in the features list
responses:
"200":
description: On success return feature report
schema:
$ref: "http://swgserver:8081/api/swagger/include/FeatureReport.yaml#/FeatureReport"
"400":
description: Invalid feature set or feature index
description: Invalid feature index
schema:
$ref: "#/definitions/ErrorResponse"
"404":
@ -2391,7 +2309,7 @@ paths:
"501":
$ref: "#/responses/Response_501"
/sdrangel/featureset/{featureSetIndex}/feature/{featureIndex}/actions:
/sdrangel/featureset/feature/{featureIndex}/actions:
x-swagger-router-controller: featureset
post:
description: post an action or actions on a channel
@ -2399,16 +2317,11 @@ paths:
tags:
- FeatureSet
parameters:
- in: path
name: featureSetIndex
type: integer
required: true
description: Index of feature set in the feature set list
- in: path
name: featureIndex
type: integer
required: true
description: Index of the feature in the features list for this feature set
description: Index of the feature in the features list
- name: body
in: body
description: Action(s) to apply to the feature
@ -2421,7 +2334,7 @@ paths:
schema:
$ref: "#/definitions/SuccessResponse"
"400":
description: Invalid feature set or feature index
description: Invalid feature index
schema:
$ref: "#/definitions/ErrorResponse"
"404":
@ -2710,9 +2623,6 @@ definitions:
- index
- featurecount
properties:
index:
description: "Index in the list of feature sets opened in this instance"
type: integer
featurecount:
description: "Number of features in the set"
type: integer

Wyświetl plik

@ -28,8 +28,6 @@ SWGFeatureSet::SWGFeatureSet(QString* json) {
}
SWGFeatureSet::SWGFeatureSet() {
index = 0;
m_index_isSet = false;
featurecount = 0;
m_featurecount_isSet = false;
features = nullptr;
@ -42,8 +40,6 @@ SWGFeatureSet::~SWGFeatureSet() {
void
SWGFeatureSet::init() {
index = 0;
m_index_isSet = false;
featurecount = 0;
m_featurecount_isSet = false;
features = new QList<SWGFeature*>();
@ -53,7 +49,6 @@ SWGFeatureSet::init() {
void
SWGFeatureSet::cleanup() {
if(features != nullptr) {
auto arr = features;
for(auto o: *arr) {
@ -74,8 +69,6 @@ SWGFeatureSet::fromJson(QString &json) {
void
SWGFeatureSet::fromJsonObject(QJsonObject &pJson) {
::SWGSDRangel::setValue(&index, pJson["index"], "qint32", "");
::SWGSDRangel::setValue(&featurecount, pJson["featurecount"], "qint32", "");
@ -96,9 +89,6 @@ SWGFeatureSet::asJson ()
QJsonObject*
SWGFeatureSet::asJsonObject() {
QJsonObject* obj = new QJsonObject();
if(m_index_isSet){
obj->insert("index", QJsonValue(index));
}
if(m_featurecount_isSet){
obj->insert("featurecount", QJsonValue(featurecount));
}
@ -109,16 +99,6 @@ SWGFeatureSet::asJsonObject() {
return obj;
}
qint32
SWGFeatureSet::getIndex() {
return index;
}
void
SWGFeatureSet::setIndex(qint32 index) {
this->index = index;
this->m_index_isSet = true;
}
qint32
SWGFeatureSet::getFeaturecount() {
return featurecount;
@ -144,9 +124,6 @@ bool
SWGFeatureSet::isSet(){
bool isObjectUpdated = false;
do{
if(m_index_isSet){
isObjectUpdated = true; break;
}
if(m_featurecount_isSet){
isObjectUpdated = true; break;
}

Wyświetl plik

@ -43,9 +43,6 @@ public:
virtual void fromJsonObject(QJsonObject &json) override;
virtual SWGFeatureSet* fromJson(QString &jsonString) override;
qint32 getIndex();
void setIndex(qint32 index);
qint32 getFeaturecount();
void setFeaturecount(qint32 featurecount);
@ -56,9 +53,6 @@ public:
virtual bool isSet() override;
private:
qint32 index;
bool m_index_isSet;
qint32 featurecount;
bool m_featurecount_isSet;

Wyświetl plik

@ -29,12 +29,10 @@ SWGFeatureSetApi::SWGFeatureSetApi(QString host, QString basePath) {
}
void
SWGFeatureSetApi::featuresetFEatureSettingsPut(qint32 feature_set_index, qint32 feature_index, SWGFeatureSettings& body) {
SWGFeatureSetApi::featuresetFEatureSettingsPut(qint32 feature_index, SWGFeatureSettings& body) {
QString fullPath;
fullPath.append(this->host).append(this->basePath).append("/sdrangel/featureset/{featureSetIndex}/feature/{featureIndex}/settings");
fullPath.append(this->host).append(this->basePath).append("/sdrangel/featureset/feature/{featureIndex}/settings");
QString feature_set_indexPathParam("{"); feature_set_indexPathParam.append("featureSetIndex").append("}");
fullPath.replace(feature_set_indexPathParam, stringValue(feature_set_index));
QString feature_indexPathParam("{"); feature_indexPathParam.append("featureIndex").append("}");
fullPath.replace(feature_indexPathParam, stringValue(feature_index));
@ -88,12 +86,10 @@ SWGFeatureSetApi::featuresetFEatureSettingsPutCallback(SWGHttpRequestWorker * wo
}
void
SWGFeatureSetApi::featuresetFeatureActionsPost(qint32 feature_set_index, qint32 feature_index, SWGFeatureActions& body) {
SWGFeatureSetApi::featuresetFeatureActionsPost(qint32 feature_index, SWGFeatureActions& body) {
QString fullPath;
fullPath.append(this->host).append(this->basePath).append("/sdrangel/featureset/{featureSetIndex}/feature/{featureIndex}/actions");
fullPath.append(this->host).append(this->basePath).append("/sdrangel/featureset/feature/{featureIndex}/actions");
QString feature_set_indexPathParam("{"); feature_set_indexPathParam.append("featureSetIndex").append("}");
fullPath.replace(feature_set_indexPathParam, stringValue(feature_set_index));
QString feature_indexPathParam("{"); feature_indexPathParam.append("featureIndex").append("}");
fullPath.replace(feature_indexPathParam, stringValue(feature_index));
@ -147,12 +143,10 @@ SWGFeatureSetApi::featuresetFeatureActionsPostCallback(SWGHttpRequestWorker * wo
}
void
SWGFeatureSetApi::featuresetFeatureDelete(qint32 feature_set_index, qint32 feature_index) {
SWGFeatureSetApi::featuresetFeatureDelete(qint32 feature_index) {
QString fullPath;
fullPath.append(this->host).append(this->basePath).append("/sdrangel/featureset/{featureSetIndex}/feature/{featureIndex}");
fullPath.append(this->host).append(this->basePath).append("/sdrangel/featureset/feature/{featureIndex}");
QString feature_set_indexPathParam("{"); feature_set_indexPathParam.append("featureSetIndex").append("}");
fullPath.replace(feature_set_indexPathParam, stringValue(feature_set_index));
QString feature_indexPathParam("{"); feature_indexPathParam.append("featureIndex").append("}");
fullPath.replace(feature_indexPathParam, stringValue(feature_index));
@ -203,12 +197,10 @@ SWGFeatureSetApi::featuresetFeatureDeleteCallback(SWGHttpRequestWorker * worker)
}
void
SWGFeatureSetApi::featuresetFeaturePost(qint32 feature_set_index, SWGFeatureSettings& body) {
SWGFeatureSetApi::featuresetFeaturePost(SWGFeatureSettings& body) {
QString fullPath;
fullPath.append(this->host).append(this->basePath).append("/sdrangel/featureset/{featureSetIndex}/feature");
fullPath.append(this->host).append(this->basePath).append("/sdrangel/featureset/feature");
QString feature_set_indexPathParam("{"); feature_set_indexPathParam.append("featureSetIndex").append("}");
fullPath.replace(feature_set_indexPathParam, stringValue(feature_set_index));
SWGHttpRequestWorker *worker = new SWGHttpRequestWorker();
@ -260,12 +252,10 @@ SWGFeatureSetApi::featuresetFeaturePostCallback(SWGHttpRequestWorker * worker) {
}
void
SWGFeatureSetApi::featuresetFeatureReportGet(qint32 feature_set_index, qint32 feature_index) {
SWGFeatureSetApi::featuresetFeatureReportGet(qint32 feature_index) {
QString fullPath;
fullPath.append(this->host).append(this->basePath).append("/sdrangel/featureset/{featureSetIndex}/feature/{featureIndex}/report");
fullPath.append(this->host).append(this->basePath).append("/sdrangel/featureset/feature/{featureIndex}/report");
QString feature_set_indexPathParam("{"); feature_set_indexPathParam.append("featureSetIndex").append("}");
fullPath.replace(feature_set_indexPathParam, stringValue(feature_set_index));
QString feature_indexPathParam("{"); feature_indexPathParam.append("featureIndex").append("}");
fullPath.replace(feature_indexPathParam, stringValue(feature_index));
@ -316,12 +306,10 @@ SWGFeatureSetApi::featuresetFeatureReportGetCallback(SWGHttpRequestWorker * work
}
void
SWGFeatureSetApi::featuresetFeatureRunDelete(qint32 feature_set_index, qint32 feature_index) {
SWGFeatureSetApi::featuresetFeatureRunDelete(qint32 feature_index) {
QString fullPath;
fullPath.append(this->host).append(this->basePath).append("/sdrangel/featureset/{featureSetIndex}/feature/{featureIndex}/run");
fullPath.append(this->host).append(this->basePath).append("/sdrangel/featureset/feature/{featureIndex}/run");
QString feature_set_indexPathParam("{"); feature_set_indexPathParam.append("featureSetIndex").append("}");
fullPath.replace(feature_set_indexPathParam, stringValue(feature_set_index));
QString feature_indexPathParam("{"); feature_indexPathParam.append("featureIndex").append("}");
fullPath.replace(feature_indexPathParam, stringValue(feature_index));
@ -372,12 +360,10 @@ SWGFeatureSetApi::featuresetFeatureRunDeleteCallback(SWGHttpRequestWorker * work
}
void
SWGFeatureSetApi::featuresetFeatureRunGet(qint32 feature_set_index, qint32 feature_index) {
SWGFeatureSetApi::featuresetFeatureRunGet(qint32 feature_index) {
QString fullPath;
fullPath.append(this->host).append(this->basePath).append("/sdrangel/featureset/{featureSetIndex}/feature/{featureIndex}/run");
fullPath.append(this->host).append(this->basePath).append("/sdrangel/featureset/feature/{featureIndex}/run");
QString feature_set_indexPathParam("{"); feature_set_indexPathParam.append("featureSetIndex").append("}");
fullPath.replace(feature_set_indexPathParam, stringValue(feature_set_index));
QString feature_indexPathParam("{"); feature_indexPathParam.append("featureIndex").append("}");
fullPath.replace(feature_indexPathParam, stringValue(feature_index));
@ -428,12 +414,10 @@ SWGFeatureSetApi::featuresetFeatureRunGetCallback(SWGHttpRequestWorker * worker)
}
void
SWGFeatureSetApi::featuresetFeatureRunPost(qint32 feature_set_index, qint32 feature_index) {
SWGFeatureSetApi::featuresetFeatureRunPost(qint32 feature_index) {
QString fullPath;
fullPath.append(this->host).append(this->basePath).append("/sdrangel/featureset/{featureSetIndex}/feature/{featureIndex}/run");
fullPath.append(this->host).append(this->basePath).append("/sdrangel/featureset/feature/{featureIndex}/run");
QString feature_set_indexPathParam("{"); feature_set_indexPathParam.append("featureSetIndex").append("}");
fullPath.replace(feature_set_indexPathParam, stringValue(feature_set_index));
QString feature_indexPathParam("{"); feature_indexPathParam.append("featureIndex").append("}");
fullPath.replace(feature_indexPathParam, stringValue(feature_index));
@ -484,12 +468,10 @@ SWGFeatureSetApi::featuresetFeatureRunPostCallback(SWGHttpRequestWorker * worker
}
void
SWGFeatureSetApi::featuresetFeatureSettingsGet(qint32 feature_set_index, qint32 feature_index) {
SWGFeatureSetApi::featuresetFeatureSettingsGet(qint32 feature_index) {
QString fullPath;
fullPath.append(this->host).append(this->basePath).append("/sdrangel/featureset/{featureSetIndex}/feature/{featureIndex}/settings");
fullPath.append(this->host).append(this->basePath).append("/sdrangel/featureset/feature/{featureIndex}/settings");
QString feature_set_indexPathParam("{"); feature_set_indexPathParam.append("featureSetIndex").append("}");
fullPath.replace(feature_set_indexPathParam, stringValue(feature_set_index));
QString feature_indexPathParam("{"); feature_indexPathParam.append("featureIndex").append("}");
fullPath.replace(feature_indexPathParam, stringValue(feature_index));
@ -540,12 +522,10 @@ SWGFeatureSetApi::featuresetFeatureSettingsGetCallback(SWGHttpRequestWorker * wo
}
void
SWGFeatureSetApi::featuresetFeatureSettingsPatch(qint32 feature_set_index, qint32 feature_index, SWGFeatureSettings& body) {
SWGFeatureSetApi::featuresetFeatureSettingsPatch(qint32 feature_index, SWGFeatureSettings& body) {
QString fullPath;
fullPath.append(this->host).append(this->basePath).append("/sdrangel/featureset/{featureSetIndex}/feature/{featureIndex}/settings");
fullPath.append(this->host).append(this->basePath).append("/sdrangel/featureset/feature/{featureIndex}/settings");
QString feature_set_indexPathParam("{"); feature_set_indexPathParam.append("featureSetIndex").append("}");
fullPath.replace(feature_set_indexPathParam, stringValue(feature_set_index));
QString feature_indexPathParam("{"); feature_indexPathParam.append("featureIndex").append("}");
fullPath.replace(feature_indexPathParam, stringValue(feature_index));
@ -599,12 +579,10 @@ SWGFeatureSetApi::featuresetFeatureSettingsPatchCallback(SWGHttpRequestWorker *
}
void
SWGFeatureSetApi::featuresetGet(qint32 feature_set_index) {
SWGFeatureSetApi::featuresetGet() {
QString fullPath;
fullPath.append(this->host).append(this->basePath).append("/sdrangel/featureset/{featureSetIndex}");
fullPath.append(this->host).append(this->basePath).append("/sdrangel/featureset");
QString feature_set_indexPathParam("{"); feature_set_indexPathParam.append("featureSetIndex").append("}");
fullPath.replace(feature_set_indexPathParam, stringValue(feature_set_index));
SWGHttpRequestWorker *worker = new SWGHttpRequestWorker();
@ -653,12 +631,10 @@ SWGFeatureSetApi::featuresetGetCallback(SWGHttpRequestWorker * worker) {
}
void
SWGFeatureSetApi::featuresetPresetPatch(qint32 feature_set_index, SWGFeaturePresetIdentifier& body) {
SWGFeatureSetApi::featuresetPresetPatch(SWGFeaturePresetIdentifier& body) {
QString fullPath;
fullPath.append(this->host).append(this->basePath).append("/sdrangel/featureset/{featureSetIndex}/preset");
fullPath.append(this->host).append(this->basePath).append("/sdrangel/featureset/preset");
QString feature_set_indexPathParam("{"); feature_set_indexPathParam.append("featureSetIndex").append("}");
fullPath.replace(feature_set_indexPathParam, stringValue(feature_set_index));
SWGHttpRequestWorker *worker = new SWGHttpRequestWorker();
@ -710,12 +686,10 @@ SWGFeatureSetApi::featuresetPresetPatchCallback(SWGHttpRequestWorker * worker) {
}
void
SWGFeatureSetApi::featuresetPresetPost(qint32 feature_set_index, SWGFeaturePresetIdentifier& body) {
SWGFeatureSetApi::featuresetPresetPost(SWGFeaturePresetIdentifier& body) {
QString fullPath;
fullPath.append(this->host).append(this->basePath).append("/sdrangel/featureset/{featureSetIndex}/preset");
fullPath.append(this->host).append(this->basePath).append("/sdrangel/featureset/preset");
QString feature_set_indexPathParam("{"); feature_set_indexPathParam.append("featureSetIndex").append("}");
fullPath.replace(feature_set_indexPathParam, stringValue(feature_set_index));
SWGHttpRequestWorker *worker = new SWGHttpRequestWorker();
@ -767,12 +741,10 @@ SWGFeatureSetApi::featuresetPresetPostCallback(SWGHttpRequestWorker * worker) {
}
void
SWGFeatureSetApi::featuresetPresetPut(qint32 feature_set_index, SWGFeaturePresetIdentifier& body) {
SWGFeatureSetApi::featuresetPresetPut(SWGFeaturePresetIdentifier& body) {
QString fullPath;
fullPath.append(this->host).append(this->basePath).append("/sdrangel/featureset/{featureSetIndex}/preset");
fullPath.append(this->host).append(this->basePath).append("/sdrangel/featureset/preset");
QString feature_set_indexPathParam("{"); feature_set_indexPathParam.append("featureSetIndex").append("}");
fullPath.replace(feature_set_indexPathParam, stringValue(feature_set_index));
SWGHttpRequestWorker *worker = new SWGHttpRequestWorker();

Wyświetl plik

@ -41,20 +41,20 @@ public:
QString basePath;
QMap<QString, QString> defaultHeaders;
void featuresetFEatureSettingsPut(qint32 feature_set_index, qint32 feature_index, SWGFeatureSettings& body);
void featuresetFeatureActionsPost(qint32 feature_set_index, qint32 feature_index, SWGFeatureActions& body);
void featuresetFeatureDelete(qint32 feature_set_index, qint32 feature_index);
void featuresetFeaturePost(qint32 feature_set_index, SWGFeatureSettings& body);
void featuresetFeatureReportGet(qint32 feature_set_index, qint32 feature_index);
void featuresetFeatureRunDelete(qint32 feature_set_index, qint32 feature_index);
void featuresetFeatureRunGet(qint32 feature_set_index, qint32 feature_index);
void featuresetFeatureRunPost(qint32 feature_set_index, qint32 feature_index);
void featuresetFeatureSettingsGet(qint32 feature_set_index, qint32 feature_index);
void featuresetFeatureSettingsPatch(qint32 feature_set_index, qint32 feature_index, SWGFeatureSettings& body);
void featuresetGet(qint32 feature_set_index);
void featuresetPresetPatch(qint32 feature_set_index, SWGFeaturePresetIdentifier& body);
void featuresetPresetPost(qint32 feature_set_index, SWGFeaturePresetIdentifier& body);
void featuresetPresetPut(qint32 feature_set_index, SWGFeaturePresetIdentifier& body);
void featuresetFEatureSettingsPut(qint32 feature_index, SWGFeatureSettings& body);
void featuresetFeatureActionsPost(qint32 feature_index, SWGFeatureActions& body);
void featuresetFeatureDelete(qint32 feature_index);
void featuresetFeaturePost(SWGFeatureSettings& body);
void featuresetFeatureReportGet(qint32 feature_index);
void featuresetFeatureRunDelete(qint32 feature_index);
void featuresetFeatureRunGet(qint32 feature_index);
void featuresetFeatureRunPost(qint32 feature_index);
void featuresetFeatureSettingsGet(qint32 feature_index);
void featuresetFeatureSettingsPatch(qint32 feature_index, SWGFeatureSettings& body);
void featuresetGet();
void featuresetPresetPatch(SWGFeaturePresetIdentifier& body);
void featuresetPresetPost(SWGFeaturePresetIdentifier& body);
void featuresetPresetPut(SWGFeaturePresetIdentifier& body);
private:
void featuresetFEatureSettingsPutCallback (SWGHttpRequestWorker * worker);