mirror of
https://github.com/f4exb/sdrangel.git
synced 2024-11-25 17:28:50 -05:00
MainCore: methods to get channel API and feature
This commit is contained in:
parent
8ba95addc0
commit
48ed11331a
@ -58,6 +58,24 @@ void DeviceSet::freeChannels()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const ChannelAPI *DeviceSet::getChannelAt(int channelIndex) const
|
||||||
|
{
|
||||||
|
if ((channelIndex >= 0) && (channelIndex < m_channelInstanceRegistrations.size())) {
|
||||||
|
return m_channelInstanceRegistrations[channelIndex].m_channelAPI;
|
||||||
|
} else {
|
||||||
|
return nullptr;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
ChannelAPI *DeviceSet::getChannelAt(int channelIndex)
|
||||||
|
{
|
||||||
|
if ((channelIndex >= 0) && (channelIndex < m_channelInstanceRegistrations.size())) {
|
||||||
|
return m_channelInstanceRegistrations[channelIndex].m_channelAPI;
|
||||||
|
} else {
|
||||||
|
return nullptr;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void DeviceSet::deleteChannel(int channelIndex)
|
void DeviceSet::deleteChannel(int channelIndex)
|
||||||
{
|
{
|
||||||
if (channelIndex < m_channelInstanceRegistrations.count())
|
if (channelIndex < m_channelInstanceRegistrations.count())
|
||||||
|
@ -43,6 +43,8 @@ public:
|
|||||||
|
|
||||||
int getNumberOfChannels() const { return m_channelInstanceRegistrations.size(); }
|
int getNumberOfChannels() const { return m_channelInstanceRegistrations.size(); }
|
||||||
void freeChannels();
|
void freeChannels();
|
||||||
|
const ChannelAPI *getChannelAt(int channelIndex) const;
|
||||||
|
ChannelAPI *getChannelAt(int channelIndex);
|
||||||
void deleteChannel(int channelIndex);
|
void deleteChannel(int channelIndex);
|
||||||
void loadRxChannelSettings(const Preset* preset, PluginAPI *pluginAPI);
|
void loadRxChannelSettings(const Preset* preset, PluginAPI *pluginAPI);
|
||||||
void saveRxChannelSettings(Preset* preset);
|
void saveRxChannelSettings(Preset* preset);
|
||||||
@ -72,6 +74,11 @@ private:
|
|||||||
|
|
||||||
ChannelInstanceRegistration(const QString& channelName, ChannelAPI* channelAPI);
|
ChannelInstanceRegistration(const QString& channelName, ChannelAPI* channelAPI);
|
||||||
|
|
||||||
|
ChannelInstanceRegistration(const ChannelInstanceRegistration& other) :
|
||||||
|
m_channelName(other.m_channelName),
|
||||||
|
m_channelAPI(other.m_channelAPI)
|
||||||
|
{ }
|
||||||
|
|
||||||
bool operator<(const ChannelInstanceRegistration& other) const;
|
bool operator<(const ChannelInstanceRegistration& other) const;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -108,6 +108,24 @@ void MainCore::setLoggingOptions()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ChannelAPI *MainCore::getChannel(int deviceSetIndex, int channelIndex)
|
||||||
|
{
|
||||||
|
if ((deviceSetIndex >= 0) && (deviceSetIndex < m_deviceSets.size())) {
|
||||||
|
return m_deviceSets[deviceSetIndex]->getChannelAt(channelIndex);
|
||||||
|
} else {
|
||||||
|
return nullptr;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Feature *MainCore::getFeature(int featureSetIndex, int featureIndex)
|
||||||
|
{
|
||||||
|
if ((featureSetIndex >= 0) && (featureSetIndex < m_featureSets.size())) {
|
||||||
|
return m_featureSets[featureSetIndex]->getFeatureAt(featureIndex);
|
||||||
|
} else {
|
||||||
|
return nullptr;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void MainCore::appendFeatureSet()
|
void MainCore::appendFeatureSet()
|
||||||
{
|
{
|
||||||
int newIndex = m_featureSets.size();
|
int newIndex = m_featureSets.size();
|
||||||
|
@ -28,6 +28,8 @@
|
|||||||
|
|
||||||
class DeviceSet;
|
class DeviceSet;
|
||||||
class FeatureSet;
|
class FeatureSet;
|
||||||
|
class ChannelAPI;
|
||||||
|
class Feature;
|
||||||
class PluginManager;
|
class PluginManager;
|
||||||
class MessageQueue;
|
class MessageQueue;
|
||||||
|
|
||||||
@ -410,6 +412,8 @@ public:
|
|||||||
std::vector<DeviceSet*>& getDeviceSets() { return m_deviceSets; }
|
std::vector<DeviceSet*>& getDeviceSets() { return m_deviceSets; }
|
||||||
std::vector<FeatureSet*>& getFeatureeSets() { return m_featureSets; }
|
std::vector<FeatureSet*>& getFeatureeSets() { return m_featureSets; }
|
||||||
void setLoggingOptions();
|
void setLoggingOptions();
|
||||||
|
ChannelAPI *getChannel(int deviceSetIndex, int channelIndex);
|
||||||
|
Feature *getFeature(int featureSetIndex, int featureIndex);
|
||||||
// slave mode
|
// slave mode
|
||||||
void appendFeatureSet();
|
void appendFeatureSet();
|
||||||
void removeFeatureSet(int index);
|
void removeFeatureSet(int index);
|
||||||
|
@ -278,24 +278,24 @@ void MainServer::addSinkDevice()
|
|||||||
// create a file sink by default
|
// create a file sink by default
|
||||||
int fileSinkDeviceIndex = DeviceEnumerator::instance()->getFileOutputDeviceIndex();
|
int fileSinkDeviceIndex = DeviceEnumerator::instance()->getFileOutputDeviceIndex();
|
||||||
const PluginInterface::SamplingDevice *samplingDevice = DeviceEnumerator::instance()->getTxSamplingDevice(fileSinkDeviceIndex);
|
const PluginInterface::SamplingDevice *samplingDevice = DeviceEnumerator::instance()->getTxSamplingDevice(fileSinkDeviceIndex);
|
||||||
m_mainCore->m_deviceSets.back()->m_deviceAPI->setSamplingDeviceSequence(samplingDevice->sequence);
|
deviceAPI->setSamplingDeviceSequence(samplingDevice->sequence);
|
||||||
m_mainCore->m_deviceSets.back()->m_deviceAPI->setDeviceNbItems(samplingDevice->deviceNbItems);
|
deviceAPI->setDeviceNbItems(samplingDevice->deviceNbItems);
|
||||||
m_mainCore->m_deviceSets.back()->m_deviceAPI->setDeviceItemIndex(samplingDevice->deviceItemIndex);
|
deviceAPI->setDeviceItemIndex(samplingDevice->deviceItemIndex);
|
||||||
m_mainCore->m_deviceSets.back()->m_deviceAPI->setHardwareId(samplingDevice->hardwareId);
|
deviceAPI->setHardwareId(samplingDevice->hardwareId);
|
||||||
m_mainCore->m_deviceSets.back()->m_deviceAPI->setSamplingDeviceId(samplingDevice->id);
|
deviceAPI->setSamplingDeviceId(samplingDevice->id);
|
||||||
m_mainCore->m_deviceSets.back()->m_deviceAPI->setSamplingDeviceSerial(samplingDevice->serial);
|
deviceAPI->setSamplingDeviceSerial(samplingDevice->serial);
|
||||||
m_mainCore->m_deviceSets.back()->m_deviceAPI->setSamplingDeviceDisplayName(samplingDevice->displayedName);
|
deviceAPI->setSamplingDeviceDisplayName(samplingDevice->displayedName);
|
||||||
m_mainCore->m_deviceSets.back()->m_deviceAPI->setSamplingDevicePluginInterface(DeviceEnumerator::instance()->getTxPluginInterface(fileSinkDeviceIndex));
|
deviceAPI->setSamplingDevicePluginInterface(DeviceEnumerator::instance()->getTxPluginInterface(fileSinkDeviceIndex));
|
||||||
|
|
||||||
QString userArgs = m_mainCore->m_settings.getDeviceUserArgs().findUserArgs(samplingDevice->hardwareId, samplingDevice->sequence);
|
QString userArgs = m_mainCore->m_settings.getDeviceUserArgs().findUserArgs(samplingDevice->hardwareId, samplingDevice->sequence);
|
||||||
|
|
||||||
if (userArgs.size() > 0) {
|
if (userArgs.size() > 0) {
|
||||||
m_mainCore->m_deviceSets.back()->m_deviceAPI->setHardwareUserArguments(userArgs);
|
deviceAPI->setHardwareUserArguments(userArgs);
|
||||||
}
|
}
|
||||||
|
|
||||||
DeviceSampleSink *sink = m_mainCore->m_deviceSets.back()->m_deviceAPI->getPluginInterface()->createSampleSinkPluginInstance(
|
DeviceSampleSink *sink = deviceAPI->getPluginInterface()->createSampleSinkPluginInstance(
|
||||||
m_mainCore->m_deviceSets.back()->m_deviceAPI->getSamplingDeviceId(), m_mainCore->m_deviceSets.back()->m_deviceAPI);
|
deviceAPI->getSamplingDeviceId(), deviceAPI);
|
||||||
m_mainCore->m_deviceSets.back()->m_deviceAPI->setSampleSink(sink);
|
deviceAPI->setSampleSink(sink);
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainServer::addSourceDevice()
|
void MainServer::addSourceDevice()
|
||||||
@ -323,24 +323,24 @@ void MainServer::addSourceDevice()
|
|||||||
// Create a file source instance by default
|
// Create a file source instance by default
|
||||||
int fileSourceDeviceIndex = DeviceEnumerator::instance()->getFileInputDeviceIndex();
|
int fileSourceDeviceIndex = DeviceEnumerator::instance()->getFileInputDeviceIndex();
|
||||||
const PluginInterface::SamplingDevice *samplingDevice = DeviceEnumerator::instance()->getRxSamplingDevice(fileSourceDeviceIndex);
|
const PluginInterface::SamplingDevice *samplingDevice = DeviceEnumerator::instance()->getRxSamplingDevice(fileSourceDeviceIndex);
|
||||||
m_mainCore->m_deviceSets.back()->m_deviceAPI->setSamplingDeviceSequence(samplingDevice->sequence);
|
deviceAPI->setSamplingDeviceSequence(samplingDevice->sequence);
|
||||||
m_mainCore->m_deviceSets.back()->m_deviceAPI->setDeviceNbItems(samplingDevice->deviceNbItems);
|
deviceAPI->setDeviceNbItems(samplingDevice->deviceNbItems);
|
||||||
m_mainCore->m_deviceSets.back()->m_deviceAPI->setDeviceItemIndex(samplingDevice->deviceItemIndex);
|
deviceAPI->setDeviceItemIndex(samplingDevice->deviceItemIndex);
|
||||||
m_mainCore->m_deviceSets.back()->m_deviceAPI->setHardwareId(samplingDevice->hardwareId);
|
deviceAPI->setHardwareId(samplingDevice->hardwareId);
|
||||||
m_mainCore->m_deviceSets.back()->m_deviceAPI->setSamplingDeviceId(samplingDevice->id);
|
deviceAPI->setSamplingDeviceId(samplingDevice->id);
|
||||||
m_mainCore->m_deviceSets.back()->m_deviceAPI->setSamplingDeviceSerial(samplingDevice->serial);
|
deviceAPI->setSamplingDeviceSerial(samplingDevice->serial);
|
||||||
m_mainCore->m_deviceSets.back()->m_deviceAPI->setSamplingDeviceDisplayName(samplingDevice->displayedName);
|
deviceAPI->setSamplingDeviceDisplayName(samplingDevice->displayedName);
|
||||||
m_mainCore->m_deviceSets.back()->m_deviceAPI->setSamplingDevicePluginInterface(DeviceEnumerator::instance()->getRxPluginInterface(fileSourceDeviceIndex));
|
deviceAPI->setSamplingDevicePluginInterface(DeviceEnumerator::instance()->getRxPluginInterface(fileSourceDeviceIndex));
|
||||||
|
|
||||||
QString userArgs = m_mainCore->m_settings.getDeviceUserArgs().findUserArgs(samplingDevice->hardwareId, samplingDevice->sequence);
|
QString userArgs = m_mainCore->m_settings.getDeviceUserArgs().findUserArgs(samplingDevice->hardwareId, samplingDevice->sequence);
|
||||||
|
|
||||||
if (userArgs.size() > 0) {
|
if (userArgs.size() > 0) {
|
||||||
m_mainCore->m_deviceSets.back()->m_deviceAPI->setHardwareUserArguments(userArgs);
|
deviceAPI->setHardwareUserArguments(userArgs);
|
||||||
}
|
}
|
||||||
|
|
||||||
DeviceSampleSource *source = m_mainCore->m_deviceSets.back()->m_deviceAPI->getPluginInterface()->createSampleSourcePluginInstance(
|
DeviceSampleSource *source = deviceAPI->getPluginInterface()->createSampleSourcePluginInstance(
|
||||||
m_mainCore->m_deviceSets.back()->m_deviceAPI->getSamplingDeviceId(), m_mainCore->m_deviceSets.back()->m_deviceAPI);
|
deviceAPI->getSamplingDeviceId(), deviceAPI);
|
||||||
m_mainCore->m_deviceSets.back()->m_deviceAPI->setSampleSource(source);
|
deviceAPI->setSampleSource(source);
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainServer::removeLastDevice()
|
void MainServer::removeLastDevice()
|
||||||
|
Loading…
Reference in New Issue
Block a user