Skip to content

Commit a4ffe5f

Browse files
committed
Implemented 0.8 getSettingInfo overloads
1 parent f7dca6e commit a4ffe5f

File tree

4 files changed

+78
-6
lines changed

4 files changed

+78
-6
lines changed

client/Settings.cpp

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
// Copyright (c) 2015-2020 Josh Blum
22
// Copyright (c) 2016-2016 Bastille Networks
3+
// Copyright (c) 2022 Nicholas Corgan
34
// SPDX-License-Identifier: BSL-1.0
45

56
#include "SoapyClient.hpp"
@@ -1273,6 +1274,20 @@ SoapySDR::ArgInfoList SoapyRemoteDevice::getSettingInfo(void) const
12731274
return result;
12741275
}
12751276

1277+
SoapySDR::ArgInfo SoapyRemoteDevice::getSettingInfo(const std::string &key) const
1278+
{
1279+
std::lock_guard<std::mutex> lock(_mutex);
1280+
SoapyRPCPacker packer(_sock);
1281+
packer & SOAPY_REMOTE_GET_SPECIFIC_SETTING_INFO;
1282+
packer & key;
1283+
packer();
1284+
1285+
SoapyRPCUnpacker unpacker(_sock);
1286+
SoapySDR::ArgInfo result;
1287+
unpacker & result;
1288+
return result;
1289+
}
1290+
12761291
void SoapyRemoteDevice::writeSetting(const std::string &key, const std::string &value)
12771292
{
12781293
std::lock_guard<std::mutex> lock(_mutex);
@@ -1314,6 +1329,22 @@ SoapySDR::ArgInfoList SoapyRemoteDevice::getSettingInfo(const int direction, con
13141329
return result;
13151330
}
13161331

1332+
SoapySDR::ArgInfo SoapyRemoteDevice::getSettingInfo(const int direction, const size_t channel, const std::string &key) const
1333+
{
1334+
std::lock_guard<std::mutex> lock(_mutex);
1335+
SoapyRPCPacker packer(_sock);
1336+
packer & SOAPY_REMOTE_GET_SPECIFIC_CHANNEL_SETTING_INFO;
1337+
packer & char(direction);
1338+
packer & int(channel);
1339+
packer & key;
1340+
packer();
1341+
1342+
SoapyRPCUnpacker unpacker(_sock);
1343+
SoapySDR::ArgInfo result;
1344+
unpacker & result;
1345+
return result;
1346+
}
1347+
13171348
void SoapyRemoteDevice::writeSetting(const int direction, const size_t channel, const std::string &key, const std::string &value)
13181349
{
13191350
std::lock_guard<std::mutex> lock(_mutex);

client/SoapyClient.hpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
// Copyright (c) 2015-2020 Josh Blum
22
// Copyright (c) 2016-2016 Bastille Networks
3+
// Copyright (c) 2022 Nicholas Corgan
34
// SPDX-License-Identifier: BSL-1.0
45

56
#pragma once
@@ -324,12 +325,16 @@ class SoapyRemoteDevice : public SoapySDR::Device
324325

325326
SoapySDR::ArgInfoList getSettingInfo(void) const;
326327

328+
SoapySDR::ArgInfo getSettingInfo(const std::string &key) const;
329+
327330
void writeSetting(const std::string &key, const std::string &value);
328331

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

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

336+
SoapySDR::ArgInfo getSettingInfo(const int direction, const size_t channel, const std::string &key) const;
337+
333338
void writeSetting(const int direction, const size_t channel, const std::string &key, const std::string &value);
334339

335340
std::string readSetting(const int direction, const size_t channel, const std::string &key) const;

common/SoapyRemoteDefs.hpp

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
// Copyright (c) 2015-2020 Josh Blum
22
// Copyright (c) 2016-2016 Bastille Networks
3+
// 2022 Nicholas Corgan
34
// SPDX-License-Identifier: BSL-1.0
45

56
#pragma once
@@ -256,12 +257,14 @@ enum SoapyRemoteCalls
256257
SOAPY_REMOTE_READ_REGISTERS = 1306,
257258

258259
//settings
259-
SOAPY_REMOTE_WRITE_SETTING = 1400,
260-
SOAPY_REMOTE_READ_SETTING = 1401,
261-
SOAPY_REMOTE_GET_SETTING_INFO = 1402,
262-
SOAPY_REMOTE_WRITE_CHANNEL_SETTING = 1403,
263-
SOAPY_REMOTE_READ_CHANNEL_SETTING = 1404,
264-
SOAPY_REMOTE_GET_CHANNEL_SETTING_INFO = 1405,
260+
SOAPY_REMOTE_WRITE_SETTING = 1400,
261+
SOAPY_REMOTE_READ_SETTING = 1401,
262+
SOAPY_REMOTE_GET_SETTING_INFO = 1402,
263+
SOAPY_REMOTE_WRITE_CHANNEL_SETTING = 1403,
264+
SOAPY_REMOTE_READ_CHANNEL_SETTING = 1404,
265+
SOAPY_REMOTE_GET_CHANNEL_SETTING_INFO = 1405,
266+
SOAPY_REMOTE_GET_SPECIFIC_SETTING_INFO = 1406,
267+
SOAPY_REMOTE_GET_SPECIFIC_CHANNEL_SETTING_INFO = 1407,
265268

266269
//gpio
267270
SOAPY_REMOTE_LIST_GPIO_BANKS = 1500,

server/ClientHandler.cpp

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
// Copyright (c) 2015-2020 Josh Blum
22
// Copyright (c) 2016-2016 Bastille Networks
3+
// Copyright (c) 2022 Nicholas Corgan
34
// SPDX-License-Identifier: BSL-1.0
45

56
#include "ClientHandler.hpp"
@@ -1466,6 +1467,38 @@ bool SoapyClientHandler::handleOnce(SoapyRPCUnpacker &unpacker, SoapyRPCPacker &
14661467
#endif
14671468
} break;
14681469

1470+
////////////////////////////////////////////////////////////////////
1471+
case SOAPY_REMOTE_GET_SPECIFIC_SETTING_INFO:
1472+
////////////////////////////////////////////////////////////////////
1473+
{
1474+
std::string key;
1475+
unpacker & key;
1476+
#ifdef SOAPY_SDR_API_HAS_GET_SPECIFIC_SETTING_INFO
1477+
packer & _dev->getSettingInfo(key);
1478+
#else
1479+
SoapySDR::ArgInfo value;
1480+
packer & value;
1481+
#endif
1482+
} break;
1483+
1484+
////////////////////////////////////////////////////////////////////
1485+
case SOAPY_REMOTE_GET_SPECIFIC_CHANNEL_SETTING_INFO:
1486+
////////////////////////////////////////////////////////////////////
1487+
{
1488+
char direction = 0;
1489+
int channel = 0;
1490+
std::string key;
1491+
unpacker & direction;
1492+
unpacker & channel;
1493+
unpacker & key;
1494+
#ifdef SOAPY_SDR_API_HAS_GET_SPECIFIC_SETTING_INFO
1495+
packer & _dev->getSettingInfo(direction, channel, key);
1496+
#else
1497+
SoapySDR::ArgInfo value;
1498+
packer & value;
1499+
#endif
1500+
} break;
1501+
14691502
////////////////////////////////////////////////////////////////////
14701503
case SOAPY_REMOTE_LIST_GPIO_BANKS:
14711504
////////////////////////////////////////////////////////////////////

0 commit comments

Comments
 (0)