From a4ffe5fc748bd542015be5c5a0f5b243e17f71ed Mon Sep 17 00:00:00 2001 From: Nicholas Corgan Date: Sat, 18 Jun 2022 12:07:41 -0500 Subject: [PATCH] Implemented 0.8 getSettingInfo overloads --- client/Settings.cpp | 31 +++++++++++++++++++++++++++++++ client/SoapyClient.hpp | 5 +++++ common/SoapyRemoteDefs.hpp | 15 +++++++++------ server/ClientHandler.cpp | 33 +++++++++++++++++++++++++++++++++ 4 files changed, 78 insertions(+), 6 deletions(-) diff --git a/client/Settings.cpp b/client/Settings.cpp index 7690c72..a05039e 100644 --- a/client/Settings.cpp +++ b/client/Settings.cpp @@ -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" @@ -1273,6 +1274,20 @@ SoapySDR::ArgInfoList SoapyRemoteDevice::getSettingInfo(void) const return result; } +SoapySDR::ArgInfo SoapyRemoteDevice::getSettingInfo(const std::string &key) const +{ + std::lock_guard 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 lock(_mutex); @@ -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 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 lock(_mutex); diff --git a/client/SoapyClient.hpp b/client/SoapyClient.hpp index 34462ce..3d39ae8 100644 --- a/client/SoapyClient.hpp +++ b/client/SoapyClient.hpp @@ -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 @@ -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; diff --git a/common/SoapyRemoteDefs.hpp b/common/SoapyRemoteDefs.hpp index 93e9f43..baf3161 100644 --- a/common/SoapyRemoteDefs.hpp +++ b/common/SoapyRemoteDefs.hpp @@ -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 @@ -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, diff --git a/server/ClientHandler.cpp b/server/ClientHandler.cpp index 5d418de..e5059dd 100644 --- a/server/ClientHandler.cpp +++ b/server/ClientHandler.cpp @@ -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" @@ -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: ////////////////////////////////////////////////////////////////////