2017-01-02 21:07:43 -05:00
|
|
|
// Copyright (c) Charles J. Cliffe
|
|
|
|
// SPDX-License-Identifier: GPL-2.0+
|
|
|
|
|
2015-10-04 16:07:14 -04:00
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include <atomic>
|
2015-10-05 02:21:08 -04:00
|
|
|
#include <map>
|
|
|
|
#include <string>
|
2015-10-04 16:07:14 -04:00
|
|
|
#include "IOThread.h"
|
|
|
|
#include "SDRDeviceInfo.h"
|
|
|
|
#include "AppConfig.h"
|
|
|
|
|
|
|
|
#include <SoapySDR/Version.hpp>
|
|
|
|
#include <SoapySDR/Modules.hpp>
|
|
|
|
#include <SoapySDR/Registry.hpp>
|
|
|
|
#include <SoapySDR/Device.hpp>
|
|
|
|
|
|
|
|
|
|
|
|
class SDREnumerator: public IOThread {
|
|
|
|
private:
|
|
|
|
|
|
|
|
public:
|
|
|
|
SDREnumerator();
|
|
|
|
~SDREnumerator();
|
2015-10-05 02:21:08 -04:00
|
|
|
enum SDREnumState { SDR_ENUM_DEVICES_READY, SDR_ENUM_MESSAGE, SDR_ENUM_TERMINATED, SDR_ENUM_FAILED };
|
2015-10-04 16:07:14 -04:00
|
|
|
|
2015-10-05 02:21:08 -04:00
|
|
|
static std::vector<SDRDeviceInfo *> *enumerate_devices(std::string remoteAddr = "", bool noInit=false);
|
2015-10-04 16:07:14 -04:00
|
|
|
|
2016-06-28 15:04:52 -04:00
|
|
|
virtual void run();
|
2015-10-04 16:07:14 -04:00
|
|
|
|
2016-01-20 00:43:31 -05:00
|
|
|
static SoapySDR::Kwargs argsStrToKwargs(const std::string &args);
|
2015-10-05 02:21:08 -04:00
|
|
|
static void addRemote(std::string remoteAddr);
|
|
|
|
static void removeRemote(std::string remoteAddr);
|
|
|
|
static std::vector<std::string> &getRemotes();
|
|
|
|
static bool hasRemoteModule();
|
2016-01-20 00:43:31 -05:00
|
|
|
static void addManual(std::string factory, std::string params);
|
2016-01-22 00:40:00 -05:00
|
|
|
static void removeManual(std::string factory, std::string params);
|
|
|
|
static std::vector<SDRManualDef> &getManuals();
|
|
|
|
static void setManuals(std::vector<SDRManualDef> manuals);
|
2016-01-17 21:54:22 -05:00
|
|
|
static void reset();
|
2016-01-20 00:43:31 -05:00
|
|
|
static std::vector<std::string> &getFactories();
|
2015-10-05 02:21:08 -04:00
|
|
|
|
2015-10-04 16:07:14 -04:00
|
|
|
protected:
|
2015-10-05 02:21:08 -04:00
|
|
|
static bool soapy_initialized, has_remote;
|
2015-10-04 16:07:14 -04:00
|
|
|
static std::vector<std::string> factories;
|
|
|
|
static std::vector<std::string> modules;
|
2015-10-05 02:21:08 -04:00
|
|
|
static std::vector<std::string> remotes;
|
|
|
|
static std::map< std::string, std::vector<SDRDeviceInfo *> > devs;
|
2016-01-20 00:43:31 -05:00
|
|
|
static std::vector<SDRManualDef> manuals;
|
2016-01-22 00:40:00 -05:00
|
|
|
static std::mutex devs_busy;
|
2015-10-04 16:07:14 -04:00
|
|
|
};
|