mirror of
https://github.com/cjcliffe/CubicSDR.git
synced 2024-11-29 15:18:38 -05:00
SDRDeviceInfo cleanup
This commit is contained in:
parent
1f6276d090
commit
0d66c92f30
@ -229,6 +229,7 @@ SET (cubicsdr_sources
|
||||
src/AppConfig.cpp
|
||||
src/FrequencyDialog.cpp
|
||||
src/IOThread.cpp
|
||||
src/sdr/SDRDeviceInfo.cpp
|
||||
src/sdr/SDRThread.cpp
|
||||
src/sdr/SDRPostThread.cpp
|
||||
src/demod/DemodulatorPreThread.cpp
|
||||
@ -279,6 +280,7 @@ SET (cubicsdr_headers
|
||||
src/AppConfig.h
|
||||
src/FrequencyDialog.h
|
||||
src/IOThread.h
|
||||
src/sdr/SDRDeviceInfo.h
|
||||
src/sdr/SDRThread.h
|
||||
src/sdr/SDRPostThread.h
|
||||
src/demod/DemodulatorPreThread.h
|
||||
|
65
src/sdr/SDRDeviceInfo.cpp
Normal file
65
src/sdr/SDRDeviceInfo.cpp
Normal file
@ -0,0 +1,65 @@
|
||||
#include "SDRDeviceInfo.h"
|
||||
|
||||
|
||||
SDRDeviceInfo::SDRDeviceInfo() : name(""), serial(""), available(false) {
|
||||
|
||||
}
|
||||
|
||||
std::string SDRDeviceInfo::getDeviceId() {
|
||||
std::string deviceId;
|
||||
|
||||
deviceId.append(getName());
|
||||
deviceId.append(" :: ");
|
||||
deviceId.append(getSerial());
|
||||
|
||||
return deviceId;
|
||||
}
|
||||
|
||||
bool SDRDeviceInfo::isAvailable() const {
|
||||
return available;
|
||||
}
|
||||
|
||||
void SDRDeviceInfo::setAvailable(bool available) {
|
||||
this->available = available;
|
||||
}
|
||||
|
||||
const std::string& SDRDeviceInfo::getName() const {
|
||||
return name;
|
||||
}
|
||||
|
||||
void SDRDeviceInfo::setName(const std::string& name) {
|
||||
this->name = name;
|
||||
}
|
||||
|
||||
const std::string& SDRDeviceInfo::getSerial() const {
|
||||
return serial;
|
||||
}
|
||||
|
||||
void SDRDeviceInfo::setSerial(const std::string& serial) {
|
||||
this->serial = serial;
|
||||
}
|
||||
|
||||
const std::string& SDRDeviceInfo::getTuner() const {
|
||||
return tuner;
|
||||
}
|
||||
|
||||
void SDRDeviceInfo::setTuner(const std::string& tuner) {
|
||||
this->tuner = tuner;
|
||||
}
|
||||
|
||||
const std::string& SDRDeviceInfo::getManufacturer() const {
|
||||
return manufacturer;
|
||||
}
|
||||
|
||||
void SDRDeviceInfo::setManufacturer(const std::string& manufacturer) {
|
||||
this->manufacturer = manufacturer;
|
||||
}
|
||||
|
||||
const std::string& SDRDeviceInfo::getProduct() const {
|
||||
return product;
|
||||
}
|
||||
|
||||
void SDRDeviceInfo::setProduct(const std::string& product) {
|
||||
this->product = product;
|
||||
}
|
||||
|
36
src/sdr/SDRDeviceInfo.h
Normal file
36
src/sdr/SDRDeviceInfo.h
Normal file
@ -0,0 +1,36 @@
|
||||
#pragma once
|
||||
|
||||
#include <string>
|
||||
|
||||
class SDRDeviceInfo {
|
||||
public:
|
||||
SDRDeviceInfo();
|
||||
|
||||
std::string getDeviceId();
|
||||
|
||||
bool isAvailable() const;
|
||||
void setAvailable(bool available);
|
||||
|
||||
const std::string& getName() const;
|
||||
void setName(const std::string& name);
|
||||
|
||||
const std::string& getSerial() const;
|
||||
void setSerial(const std::string& serial);
|
||||
|
||||
const std::string& getTuner() const;
|
||||
void setTuner(const std::string& tuner);
|
||||
|
||||
const std::string& getManufacturer() const;
|
||||
void setManufacturer(const std::string& manufacturer);
|
||||
|
||||
const std::string& getProduct() const;
|
||||
void setProduct(const std::string& product);
|
||||
|
||||
private:
|
||||
std::string name;
|
||||
std::string serial;
|
||||
std::string product;
|
||||
std::string manufacturer;
|
||||
std::string tuner;
|
||||
bool available;
|
||||
};
|
@ -300,3 +300,11 @@ void SDRThread::run() {
|
||||
std::cout << "SDR thread done." << std::endl;
|
||||
}
|
||||
|
||||
|
||||
int SDRThread::getDeviceId() const {
|
||||
return deviceId.load();
|
||||
}
|
||||
|
||||
void SDRThread::setDeviceId(int deviceId) {
|
||||
this->deviceId.store(deviceId);
|
||||
}
|
||||
|
@ -6,77 +6,7 @@
|
||||
|
||||
#include "ThreadQueue.h"
|
||||
#include "DemodulatorMgr.h"
|
||||
|
||||
class SDRDeviceInfo {
|
||||
public:
|
||||
SDRDeviceInfo() : name(""), serial(""), available(false) { }
|
||||
|
||||
std::string getDeviceId() {
|
||||
std::string deviceId;
|
||||
|
||||
deviceId.append(getName());
|
||||
deviceId.append(" :: ");
|
||||
deviceId.append(getSerial());
|
||||
|
||||
return deviceId;
|
||||
}
|
||||
|
||||
bool isAvailable() const {
|
||||
return available;
|
||||
}
|
||||
|
||||
void setAvailable(bool available) {
|
||||
this->available = available;
|
||||
}
|
||||
|
||||
const std::string& getName() const {
|
||||
return name;
|
||||
}
|
||||
|
||||
void setName(const std::string& name) {
|
||||
this->name = name;
|
||||
}
|
||||
|
||||
const std::string& getSerial() const {
|
||||
return serial;
|
||||
}
|
||||
|
||||
void setSerial(const std::string& serial) {
|
||||
this->serial = serial;
|
||||
}
|
||||
|
||||
const std::string& getTuner() const {
|
||||
return tuner;
|
||||
}
|
||||
|
||||
void setTuner(const std::string& tuner) {
|
||||
this->tuner = tuner;
|
||||
}
|
||||
|
||||
const std::string& getManufacturer() const {
|
||||
return manufacturer;
|
||||
}
|
||||
|
||||
void setManufacturer(const std::string& manufacturer) {
|
||||
this->manufacturer = manufacturer;
|
||||
}
|
||||
|
||||
const std::string& getProduct() const {
|
||||
return product;
|
||||
}
|
||||
|
||||
void setProduct(const std::string& product) {
|
||||
this->product = product;
|
||||
}
|
||||
|
||||
private:
|
||||
std::string name;
|
||||
std::string serial;
|
||||
std::string product;
|
||||
std::string manufacturer;
|
||||
std::string tuner;
|
||||
bool available;
|
||||
};
|
||||
#include "SDRDeviceInfo.h"
|
||||
|
||||
class SDRThreadCommand {
|
||||
public:
|
||||
@ -133,13 +63,8 @@ public:
|
||||
|
||||
void run();
|
||||
|
||||
int getDeviceId() const {
|
||||
return deviceId.load();
|
||||
}
|
||||
|
||||
void setDeviceId(int deviceId) {
|
||||
this->deviceId.store(deviceId);
|
||||
}
|
||||
int getDeviceId() const;
|
||||
void setDeviceId(int deviceId);
|
||||
|
||||
protected:
|
||||
std::atomic<uint32_t> sampleRate;
|
||||
|
Loading…
Reference in New Issue
Block a user