mirror of
https://github.com/intrepidcs/libicsneo.git
synced 2026-08-05 09:28:40 +02:00
Device component initialization done more intelligently
This commit is contained in:
@@ -10,20 +10,20 @@ namespace icsneo {
|
||||
class NeoVIFIRE2USB : public NeoVIFIRE2 {
|
||||
public:
|
||||
static constexpr const uint16_t PRODUCT_ID = 0x1000;
|
||||
NeoVIFIRE2USB(neodevice_t neodevice) : NeoVIFIRE2(neodevice) {
|
||||
com = MakeCommunication(std::unique_ptr<ICommunication>(new FTDI(getWritableNeoDevice())));
|
||||
settings = std::unique_ptr<IDeviceSettings>(new NeoVIFIRE2Settings(com));
|
||||
productId = PRODUCT_ID;
|
||||
}
|
||||
|
||||
static std::vector<std::shared_ptr<Device>> Find() {
|
||||
std::vector<std::shared_ptr<Device>> found;
|
||||
|
||||
for(auto neodevice : FTDI::FindByProduct(PRODUCT_ID))
|
||||
found.push_back(std::make_shared<NeoVIFIRE2USB>(neodevice));
|
||||
found.emplace_back(new NeoVIFIRE2USB(neodevice)); // Creation of the shared_ptr
|
||||
|
||||
return found;
|
||||
}
|
||||
|
||||
private:
|
||||
NeoVIFIRE2USB(neodevice_t neodevice) : NeoVIFIRE2(neodevice) {
|
||||
initialize<FTDI, NeoVIFIRE2Settings>();
|
||||
productId = PRODUCT_ID;
|
||||
}
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user