mirror of
https://github.com/jankae/LibreVNA.git
synced 2026-04-06 15:04:11 +00:00
WIP: device driver abstraction
This commit is contained in:
parent
59e30e93c5
commit
db6d823e0f
42 changed files with 1631 additions and 576 deletions
22
Software/PC_Application/LibreVNA-GUI/Device/devicedriver.cpp
Normal file
22
Software/PC_Application/LibreVNA-GUI/Device/devicedriver.cpp
Normal file
|
|
@ -0,0 +1,22 @@
|
|||
#include "devicedriver.h"
|
||||
|
||||
DeviceDriver *DeviceDriver::activeDriver = nullptr;
|
||||
|
||||
bool DeviceDriver::connectDevice(QString serial)
|
||||
{
|
||||
if(activeDriver && activeDriver != this) {
|
||||
activeDriver->disconnect();
|
||||
}
|
||||
if(connectTo(serial)) {
|
||||
activeDriver = this;
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
void DeviceDriver::disconnectDevice()
|
||||
{
|
||||
disconnect();
|
||||
activeDriver = nullptr;
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue