mirror of
https://github.com/f4exb/sdrangel.git
synced 2024-11-25 09:18:54 -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)
|
||||
{
|
||||
if (channelIndex < m_channelInstanceRegistrations.count())
|
||||
|
@ -43,6 +43,8 @@ public:
|
||||
|
||||
int getNumberOfChannels() const { return m_channelInstanceRegistrations.size(); }
|
||||
void freeChannels();
|
||||
const ChannelAPI *getChannelAt(int channelIndex) const;
|
||||
ChannelAPI *getChannelAt(int channelIndex);
|
||||
void deleteChannel(int channelIndex);
|
||||
void loadRxChannelSettings(const Preset* preset, PluginAPI *pluginAPI);
|
||||
void saveRxChannelSettings(Preset* preset);
|
||||
@ -72,6 +74,11 @@ private:
|
||||
|
||||
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;
|
||||
};
|
||||
|
||||
|
@ -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()
|
||||
{
|
||||
int newIndex = m_featureSets.size();
|
||||
|
@ -28,6 +28,8 @@
|
||||
|
||||
class DeviceSet;
|
||||
class FeatureSet;
|
||||
class ChannelAPI;
|
||||
class Feature;
|
||||
class PluginManager;
|
||||
class MessageQueue;
|
||||
|
||||
@ -410,6 +412,8 @@ public:
|
||||
std::vector<DeviceSet*>& getDeviceSets() { return m_deviceSets; }
|
||||
std::vector<FeatureSet*>& getFeatureeSets() { return m_featureSets; }
|
||||
void setLoggingOptions();
|
||||
ChannelAPI *getChannel(int deviceSetIndex, int channelIndex);
|
||||
Feature *getFeature(int featureSetIndex, int featureIndex);
|
||||
// slave mode
|
||||
void appendFeatureSet();
|
||||
void removeFeatureSet(int index);
|
||||
|
@ -278,24 +278,24 @@ void MainServer::addSinkDevice()
|
||||
// create a file sink by default
|
||||
int fileSinkDeviceIndex = DeviceEnumerator::instance()->getFileOutputDeviceIndex();
|
||||
const PluginInterface::SamplingDevice *samplingDevice = DeviceEnumerator::instance()->getTxSamplingDevice(fileSinkDeviceIndex);
|
||||
m_mainCore->m_deviceSets.back()->m_deviceAPI->setSamplingDeviceSequence(samplingDevice->sequence);
|
||||
m_mainCore->m_deviceSets.back()->m_deviceAPI->setDeviceNbItems(samplingDevice->deviceNbItems);
|
||||
m_mainCore->m_deviceSets.back()->m_deviceAPI->setDeviceItemIndex(samplingDevice->deviceItemIndex);
|
||||
m_mainCore->m_deviceSets.back()->m_deviceAPI->setHardwareId(samplingDevice->hardwareId);
|
||||
m_mainCore->m_deviceSets.back()->m_deviceAPI->setSamplingDeviceId(samplingDevice->id);
|
||||
m_mainCore->m_deviceSets.back()->m_deviceAPI->setSamplingDeviceSerial(samplingDevice->serial);
|
||||
m_mainCore->m_deviceSets.back()->m_deviceAPI->setSamplingDeviceDisplayName(samplingDevice->displayedName);
|
||||
m_mainCore->m_deviceSets.back()->m_deviceAPI->setSamplingDevicePluginInterface(DeviceEnumerator::instance()->getTxPluginInterface(fileSinkDeviceIndex));
|
||||
deviceAPI->setSamplingDeviceSequence(samplingDevice->sequence);
|
||||
deviceAPI->setDeviceNbItems(samplingDevice->deviceNbItems);
|
||||
deviceAPI->setDeviceItemIndex(samplingDevice->deviceItemIndex);
|
||||
deviceAPI->setHardwareId(samplingDevice->hardwareId);
|
||||
deviceAPI->setSamplingDeviceId(samplingDevice->id);
|
||||
deviceAPI->setSamplingDeviceSerial(samplingDevice->serial);
|
||||
deviceAPI->setSamplingDeviceDisplayName(samplingDevice->displayedName);
|
||||
deviceAPI->setSamplingDevicePluginInterface(DeviceEnumerator::instance()->getTxPluginInterface(fileSinkDeviceIndex));
|
||||
|
||||
QString userArgs = m_mainCore->m_settings.getDeviceUserArgs().findUserArgs(samplingDevice->hardwareId, samplingDevice->sequence);
|
||||
|
||||
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(
|
||||
m_mainCore->m_deviceSets.back()->m_deviceAPI->getSamplingDeviceId(), m_mainCore->m_deviceSets.back()->m_deviceAPI);
|
||||
m_mainCore->m_deviceSets.back()->m_deviceAPI->setSampleSink(sink);
|
||||
DeviceSampleSink *sink = deviceAPI->getPluginInterface()->createSampleSinkPluginInstance(
|
||||
deviceAPI->getSamplingDeviceId(), deviceAPI);
|
||||
deviceAPI->setSampleSink(sink);
|
||||
}
|
||||
|
||||
void MainServer::addSourceDevice()
|
||||
@ -323,24 +323,24 @@ void MainServer::addSourceDevice()
|
||||
// Create a file source instance by default
|
||||
int fileSourceDeviceIndex = DeviceEnumerator::instance()->getFileInputDeviceIndex();
|
||||
const PluginInterface::SamplingDevice *samplingDevice = DeviceEnumerator::instance()->getRxSamplingDevice(fileSourceDeviceIndex);
|
||||
m_mainCore->m_deviceSets.back()->m_deviceAPI->setSamplingDeviceSequence(samplingDevice->sequence);
|
||||
m_mainCore->m_deviceSets.back()->m_deviceAPI->setDeviceNbItems(samplingDevice->deviceNbItems);
|
||||
m_mainCore->m_deviceSets.back()->m_deviceAPI->setDeviceItemIndex(samplingDevice->deviceItemIndex);
|
||||
m_mainCore->m_deviceSets.back()->m_deviceAPI->setHardwareId(samplingDevice->hardwareId);
|
||||
m_mainCore->m_deviceSets.back()->m_deviceAPI->setSamplingDeviceId(samplingDevice->id);
|
||||
m_mainCore->m_deviceSets.back()->m_deviceAPI->setSamplingDeviceSerial(samplingDevice->serial);
|
||||
m_mainCore->m_deviceSets.back()->m_deviceAPI->setSamplingDeviceDisplayName(samplingDevice->displayedName);
|
||||
m_mainCore->m_deviceSets.back()->m_deviceAPI->setSamplingDevicePluginInterface(DeviceEnumerator::instance()->getRxPluginInterface(fileSourceDeviceIndex));
|
||||
deviceAPI->setSamplingDeviceSequence(samplingDevice->sequence);
|
||||
deviceAPI->setDeviceNbItems(samplingDevice->deviceNbItems);
|
||||
deviceAPI->setDeviceItemIndex(samplingDevice->deviceItemIndex);
|
||||
deviceAPI->setHardwareId(samplingDevice->hardwareId);
|
||||
deviceAPI->setSamplingDeviceId(samplingDevice->id);
|
||||
deviceAPI->setSamplingDeviceSerial(samplingDevice->serial);
|
||||
deviceAPI->setSamplingDeviceDisplayName(samplingDevice->displayedName);
|
||||
deviceAPI->setSamplingDevicePluginInterface(DeviceEnumerator::instance()->getRxPluginInterface(fileSourceDeviceIndex));
|
||||
|
||||
QString userArgs = m_mainCore->m_settings.getDeviceUserArgs().findUserArgs(samplingDevice->hardwareId, samplingDevice->sequence);
|
||||
|
||||
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(
|
||||
m_mainCore->m_deviceSets.back()->m_deviceAPI->getSamplingDeviceId(), m_mainCore->m_deviceSets.back()->m_deviceAPI);
|
||||
m_mainCore->m_deviceSets.back()->m_deviceAPI->setSampleSource(source);
|
||||
DeviceSampleSource *source = deviceAPI->getPluginInterface()->createSampleSourcePluginInstance(
|
||||
deviceAPI->getSamplingDeviceId(), deviceAPI);
|
||||
deviceAPI->setSampleSource(source);
|
||||
}
|
||||
|
||||
void MainServer::removeLastDevice()
|
||||
|
Loading…
Reference in New Issue
Block a user