mirror of
https://github.com/SatDump/SatDump
synced 2026-08-13 17:47:30 -04:00
39 lines
No EOL
1 KiB
C++
39 lines
No EOL
1 KiB
C++
#include "dev.h"
|
|
#include "core/plugin.h"
|
|
#include "logger.h"
|
|
|
|
namespace satdump
|
|
{
|
|
namespace ndsp
|
|
{
|
|
std::vector<DeviceInfo> getDeviceList()
|
|
{
|
|
std::vector<DeviceInfo> l;
|
|
|
|
eventBus->fire_event<RequestDeviceListEvent>({l});
|
|
|
|
logger->trace("Device list :");
|
|
for (auto &d : l)
|
|
logger->trace(" - " + d.name);
|
|
|
|
return l;
|
|
}
|
|
|
|
std::shared_ptr<DeviceBlock> getDeviceInstanceFromInfo(DeviceInfo i, DeviceBlock::device_mode_t m)
|
|
{
|
|
std::vector<std::shared_ptr<DeviceBlock>> l;
|
|
|
|
eventBus->fire_event<RequestDeviceInstanceEvent>({i, l});
|
|
|
|
if (l.size() == 0)
|
|
throw satdump_exception("Could not get device instance! " + i.name);
|
|
else if (l.size() > 1)
|
|
throw satdump_exception("Got more than one device instance! " + i.name);
|
|
|
|
for (auto &li : l)
|
|
li->setDevInfo(i, m);
|
|
|
|
return l[0];
|
|
}
|
|
} // namespace ndsp
|
|
} // namespace satdump
|