Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implemented 0.8 getSettingInfo overloads #95

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 31 additions & 0 deletions client/Settings.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
// Copyright (c) 2015-2020 Josh Blum
// Copyright (c) 2016-2016 Bastille Networks
// Copyright (c) 2022 Nicholas Corgan
// SPDX-License-Identifier: BSL-1.0

#include "SoapyClient.hpp"
Expand Down Expand Up @@ -1273,6 +1274,20 @@ SoapySDR::ArgInfoList SoapyRemoteDevice::getSettingInfo(void) const
return result;
}

SoapySDR::ArgInfo SoapyRemoteDevice::getSettingInfo(const std::string &key) const
{
std::lock_guard<std::mutex> lock(_mutex);
SoapyRPCPacker packer(_sock);
packer & SOAPY_REMOTE_GET_SPECIFIC_SETTING_INFO;
packer & key;
packer();

SoapyRPCUnpacker unpacker(_sock);
SoapySDR::ArgInfo result;
unpacker & result;
return result;
}

void SoapyRemoteDevice::writeSetting(const std::string &key, const std::string &value)
{
std::lock_guard<std::mutex> lock(_mutex);
Expand Down Expand Up @@ -1314,6 +1329,22 @@ SoapySDR::ArgInfoList SoapyRemoteDevice::getSettingInfo(const int direction, con
return result;
}

SoapySDR::ArgInfo SoapyRemoteDevice::getSettingInfo(const int direction, const size_t channel, const std::string &key) const
{
std::lock_guard<std::mutex> lock(_mutex);
SoapyRPCPacker packer(_sock);
packer & SOAPY_REMOTE_GET_SPECIFIC_CHANNEL_SETTING_INFO;
packer & char(direction);
packer & int(channel);
packer & key;
packer();

SoapyRPCUnpacker unpacker(_sock);
SoapySDR::ArgInfo result;
unpacker & result;
return result;
}

void SoapyRemoteDevice::writeSetting(const int direction, const size_t channel, const std::string &key, const std::string &value)
{
std::lock_guard<std::mutex> lock(_mutex);
Expand Down
5 changes: 5 additions & 0 deletions client/SoapyClient.hpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
// Copyright (c) 2015-2020 Josh Blum
// Copyright (c) 2016-2016 Bastille Networks
// Copyright (c) 2022 Nicholas Corgan
// SPDX-License-Identifier: BSL-1.0

#pragma once
Expand Down Expand Up @@ -324,12 +325,16 @@ class SoapyRemoteDevice : public SoapySDR::Device

SoapySDR::ArgInfoList getSettingInfo(void) const;

SoapySDR::ArgInfo getSettingInfo(const std::string &key) const;

void writeSetting(const std::string &key, const std::string &value);

std::string readSetting(const std::string &key) const;

SoapySDR::ArgInfoList getSettingInfo(const int direction, const size_t channel) const;

SoapySDR::ArgInfo getSettingInfo(const int direction, const size_t channel, const std::string &key) const;

void writeSetting(const int direction, const size_t channel, const std::string &key, const std::string &value);

std::string readSetting(const int direction, const size_t channel, const std::string &key) const;
Expand Down
15 changes: 9 additions & 6 deletions common/SoapyRemoteDefs.hpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
// Copyright (c) 2015-2020 Josh Blum
// Copyright (c) 2016-2016 Bastille Networks
// 2022 Nicholas Corgan
// SPDX-License-Identifier: BSL-1.0

#pragma once
Expand Down Expand Up @@ -256,12 +257,14 @@ enum SoapyRemoteCalls
SOAPY_REMOTE_READ_REGISTERS = 1306,

//settings
SOAPY_REMOTE_WRITE_SETTING = 1400,
SOAPY_REMOTE_READ_SETTING = 1401,
SOAPY_REMOTE_GET_SETTING_INFO = 1402,
SOAPY_REMOTE_WRITE_CHANNEL_SETTING = 1403,
SOAPY_REMOTE_READ_CHANNEL_SETTING = 1404,
SOAPY_REMOTE_GET_CHANNEL_SETTING_INFO = 1405,
SOAPY_REMOTE_WRITE_SETTING = 1400,
SOAPY_REMOTE_READ_SETTING = 1401,
SOAPY_REMOTE_GET_SETTING_INFO = 1402,
SOAPY_REMOTE_WRITE_CHANNEL_SETTING = 1403,
SOAPY_REMOTE_READ_CHANNEL_SETTING = 1404,
SOAPY_REMOTE_GET_CHANNEL_SETTING_INFO = 1405,
SOAPY_REMOTE_GET_SPECIFIC_SETTING_INFO = 1406,
SOAPY_REMOTE_GET_SPECIFIC_CHANNEL_SETTING_INFO = 1407,

//gpio
SOAPY_REMOTE_LIST_GPIO_BANKS = 1500,
Expand Down
33 changes: 33 additions & 0 deletions server/ClientHandler.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
// Copyright (c) 2015-2020 Josh Blum
// Copyright (c) 2016-2016 Bastille Networks
// Copyright (c) 2022 Nicholas Corgan
// SPDX-License-Identifier: BSL-1.0

#include "ClientHandler.hpp"
Expand Down Expand Up @@ -1466,6 +1467,38 @@ bool SoapyClientHandler::handleOnce(SoapyRPCUnpacker &unpacker, SoapyRPCPacker &
#endif
} break;

////////////////////////////////////////////////////////////////////
case SOAPY_REMOTE_GET_SPECIFIC_SETTING_INFO:
////////////////////////////////////////////////////////////////////
{
std::string key;
unpacker & key;
#ifdef SOAPY_SDR_API_HAS_GET_SPECIFIC_SETTING_INFO
packer & _dev->getSettingInfo(key);
#else
SoapySDR::ArgInfo value;
packer & value;
#endif
} break;

////////////////////////////////////////////////////////////////////
case SOAPY_REMOTE_GET_SPECIFIC_CHANNEL_SETTING_INFO:
////////////////////////////////////////////////////////////////////
{
char direction = 0;
int channel = 0;
std::string key;
unpacker & direction;
unpacker & channel;
unpacker & key;
#ifdef SOAPY_SDR_API_HAS_GET_SPECIFIC_SETTING_INFO
packer & _dev->getSettingInfo(direction, channel, key);
#else
SoapySDR::ArgInfo value;
packer & value;
#endif
} break;

////////////////////////////////////////////////////////////////////
case SOAPY_REMOTE_LIST_GPIO_BANKS:
////////////////////////////////////////////////////////////////////
Expand Down