mirror of
https://github.com/cjcliffe/CubicSDR.git
synced 2024-11-15 16:41:54 -05:00
Add "Local Net" section for discovered LAN devices
This commit is contained in:
parent
6cd82ea44f
commit
8f18c316de
@ -229,12 +229,17 @@ void SDRDevicesDialog::OnDeviceTimer( wxTimerEvent& event ) {
|
|||||||
|
|
||||||
wxTreeItemId devRoot = devTree->AddRoot("Devices");
|
wxTreeItemId devRoot = devTree->AddRoot("Devices");
|
||||||
wxTreeItemId localBranch = devTree->AppendItem(devRoot, "Local");
|
wxTreeItemId localBranch = devTree->AppendItem(devRoot, "Local");
|
||||||
|
wxTreeItemId dsBranch = devTree->AppendItem(devRoot, "Local Net");
|
||||||
wxTreeItemId remoteBranch = devTree->AppendItem(devRoot, "Remote");
|
wxTreeItemId remoteBranch = devTree->AppendItem(devRoot, "Remote");
|
||||||
|
|
||||||
devs[""] = SDREnumerator::enumerate_devices("",true);
|
devs[""] = SDREnumerator::enumerate_devices("",true);
|
||||||
if (devs[""] != NULL) {
|
if (devs[""] != NULL) {
|
||||||
for (devs_i = devs[""]->begin(); devs_i != devs[""]->end(); devs_i++) {
|
for (devs_i = devs[""]->begin(); devs_i != devs[""]->end(); devs_i++) {
|
||||||
devItems[devTree->AppendItem(localBranch, (*devs_i)->getName())] = (*devs_i);
|
if ((*devs_i)->isRemote()) {
|
||||||
|
devItems[devTree->AppendItem(dsBranch, (*devs_i)->getName())] = (*devs_i);
|
||||||
|
} else {
|
||||||
|
devItems[devTree->AppendItem(localBranch, (*devs_i)->getName())] = (*devs_i);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -160,7 +160,7 @@ std::vector<std::string> SDRDeviceChannel::getStreamArgNames() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
SDRDeviceInfo::SDRDeviceInfo() : name(""), serial(""), available(false) {
|
SDRDeviceInfo::SDRDeviceInfo() : name(""), serial(""), available(false), remote(false) {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -254,6 +254,14 @@ void SDRDeviceInfo::setTimestamps(bool timestamps) {
|
|||||||
this->timestamps = timestamps;
|
this->timestamps = timestamps;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool SDRDeviceInfo::isRemote() const {
|
||||||
|
return remote;
|
||||||
|
}
|
||||||
|
|
||||||
|
void SDRDeviceInfo::setRemote(bool remote) {
|
||||||
|
this->remote = remote;
|
||||||
|
}
|
||||||
|
|
||||||
void SDRDeviceInfo::setDeviceArgs(SoapySDR::Kwargs deviceArgs) {
|
void SDRDeviceInfo::setDeviceArgs(SoapySDR::Kwargs deviceArgs) {
|
||||||
this->deviceArgs = deviceArgs;
|
this->deviceArgs = deviceArgs;
|
||||||
}
|
}
|
||||||
|
@ -137,6 +137,9 @@ public:
|
|||||||
bool hasTimestamps() const;
|
bool hasTimestamps() const;
|
||||||
void setTimestamps(bool timestamps);
|
void setTimestamps(bool timestamps);
|
||||||
|
|
||||||
|
bool isRemote() const;
|
||||||
|
void setRemote(bool remote);
|
||||||
|
|
||||||
void addChannel(SDRDeviceChannel *chan);
|
void addChannel(SDRDeviceChannel *chan);
|
||||||
std::vector<SDRDeviceChannel *> &getChannels();
|
std::vector<SDRDeviceChannel *> &getChannels();
|
||||||
SDRDeviceChannel * getRxChannel();
|
SDRDeviceChannel * getRxChannel();
|
||||||
@ -157,7 +160,7 @@ private:
|
|||||||
int index;
|
int index;
|
||||||
std::string name, serial, product, manufacturer, tuner;
|
std::string name, serial, product, manufacturer, tuner;
|
||||||
std::string driver, hardware;
|
std::string driver, hardware;
|
||||||
bool timestamps, available;
|
bool timestamps, available, remote;
|
||||||
|
|
||||||
SoapySDR::Kwargs deviceArgs, streamArgs;
|
SoapySDR::Kwargs deviceArgs, streamArgs;
|
||||||
SoapySDR::ArgInfoList settingInfo;
|
SoapySDR::ArgInfoList settingInfo;
|
||||||
|
@ -115,7 +115,6 @@ std::vector<SDRDeviceInfo *> *SDREnumerator::enumerate_devices(std::string remot
|
|||||||
wxGetApp().sdrEnumThreadNotify(SDREnumerator::SDR_ENUM_MESSAGE, std::string("Opening remote server ") + remoteAddr + "..");
|
wxGetApp().sdrEnumThreadNotify(SDREnumerator::SDR_ENUM_MESSAGE, std::string("Opening remote server ") + remoteAddr + "..");
|
||||||
}
|
}
|
||||||
for (size_t i = 0; i < results.size(); i++) {
|
for (size_t i = 0; i < results.size(); i++) {
|
||||||
// std::cout << "Found device " << i << std::endl;
|
|
||||||
SDRDeviceInfo *dev = new SDRDeviceInfo();
|
SDRDeviceInfo *dev = new SDRDeviceInfo();
|
||||||
|
|
||||||
SoapySDR::Kwargs deviceArgs = results[i];
|
SoapySDR::Kwargs deviceArgs = results[i];
|
||||||
@ -129,6 +128,14 @@ std::vector<SDRDeviceInfo *> *SDREnumerator::enumerate_devices(std::string remot
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (deviceArgs.count("remote")) {
|
||||||
|
isRemote = true;
|
||||||
|
} else {
|
||||||
|
isRemote = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
dev->setRemote(isRemote);
|
||||||
|
|
||||||
dev->setDeviceArgs(deviceArgs);
|
dev->setDeviceArgs(deviceArgs);
|
||||||
|
|
||||||
std::cout << "Make device " << i << std::endl;
|
std::cout << "Make device " << i << std::endl;
|
||||||
@ -191,25 +198,6 @@ std::vector<SDRDeviceInfo *> *SDREnumerator::enumerate_devices(std::string remot
|
|||||||
dev->addChannel(chan);
|
dev->addChannel(chan);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
SoapySDR::Kwargs streamArgs;
|
|
||||||
|
|
||||||
if (isRemote) {
|
|
||||||
// if (deviceArgs.count("rtl") != 0) {
|
|
||||||
// streamArgs["remote:mtu"] = "8192";
|
|
||||||
// streamArgs["remote:window"] = "16384000";
|
|
||||||
// }
|
|
||||||
double fullScale = 0;
|
|
||||||
std::string nativeFormat = device->getNativeStreamFormat(SOAPY_SDR_RX, dev->getRxChannel()->getChannel(), fullScale);
|
|
||||||
|
|
||||||
if (nativeFormat.length()) {
|
|
||||||
streamArgs["remote:format"] = nativeFormat;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
dev->setStreamArgs(streamArgs);
|
|
||||||
|
|
||||||
|
|
||||||
dev->setSettingsInfo(device->getSettingInfo());
|
dev->setSettingsInfo(device->getSettingInfo());
|
||||||
|
|
||||||
SoapySDR::Device::unmake(device);
|
SoapySDR::Device::unmake(device);
|
||||||
@ -238,10 +226,6 @@ void SDREnumerator::run() {
|
|||||||
std::cout << "SDR enumerator starting." << std::endl;
|
std::cout << "SDR enumerator starting." << std::endl;
|
||||||
terminated.store(false);
|
terminated.store(false);
|
||||||
|
|
||||||
// if (!remotes.size()) {
|
|
||||||
// remotes.push_back("raspberrypi.local");
|
|
||||||
// }
|
|
||||||
|
|
||||||
wxGetApp().sdrEnumThreadNotify(SDREnumerator::SDR_ENUM_MESSAGE, "Scanning local devices, please wait..");
|
wxGetApp().sdrEnumThreadNotify(SDREnumerator::SDR_ENUM_MESSAGE, "Scanning local devices, please wait..");
|
||||||
SDREnumerator::enumerate_devices("");
|
SDREnumerator::enumerate_devices("");
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user