Skip to content

Commit

Permalink
Add support for setting center frequency on Tx devices.
Browse files Browse the repository at this point in the history
  • Loading branch information
srcejon committed Dec 5, 2023
1 parent b162060 commit 8d37579
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions sdrbase/channel/channelwebapiutils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -333,10 +333,11 @@ bool ChannelWebAPIUtils::getCenterFrequency(unsigned int deviceIndex, double &fr
}

// Set device center frequency
// Doesn't support MIMO devices. We'd need stream index parameter
bool ChannelWebAPIUtils::setCenterFrequency(unsigned int deviceIndex, double frequencyInHz)
{
SWGSDRangel::SWGDeviceSettings deviceSettingsResponse;
int httpRC;
int httpRC = 404;
DeviceSet *deviceSet;

if (getDeviceSettings(deviceIndex, deviceSettingsResponse, deviceSet))
Expand All @@ -354,8 +355,13 @@ bool ChannelWebAPIUtils::setCenterFrequency(unsigned int deviceIndex, double fre
SWGSDRangel::SWGErrorResponse errorResponse2;

DeviceSampleSource *source = deviceSet->m_deviceAPI->getSampleSource();

httpRC = source->webapiSettingsPutPatch(false, deviceSettingsKeys, deviceSettingsResponse, *errorResponse2.getMessage());
if (source) {
httpRC = source->webapiSettingsPutPatch(false, deviceSettingsKeys, deviceSettingsResponse, *errorResponse2.getMessage());
}
DeviceSampleSink *sink = deviceSet->m_deviceAPI->getSampleSink();
if (sink) {
httpRC = sink->webapiSettingsPutPatch(false, deviceSettingsKeys, deviceSettingsResponse, *errorResponse2.getMessage());
}

if (httpRC/100 == 2)
{
Expand Down

0 comments on commit 8d37579

Please sign in to comment.