mirror of
https://github.com/jankae/LibreVNA.git
synced 2025-12-06 07:12:10 +01:00
move to dedicated driver
Some checks failed
Build / PC_Application_Ubuntu (push) Has been cancelled
Build / PC_Application_RPi5 (push) Has been cancelled
Build / PC_Application_Windows (push) Has been cancelled
Build / PC_Application_OSX (push) Has been cancelled
Build / PC_Application_OSX_13 (push) Has been cancelled
Build / Embedded_Firmware (push) Has been cancelled
HIL_Tests / Get_Repository (push) Has been cancelled
Unit_Tests / Tests (push) Has been cancelled
HIL_Tests / PC_Application_RPi5 (push) Has been cancelled
HIL_Tests / Embedded_Firmware (push) Has been cancelled
HIL_Tests / HIL (push) Has been cancelled
Some checks failed
Build / PC_Application_Ubuntu (push) Has been cancelled
Build / PC_Application_RPi5 (push) Has been cancelled
Build / PC_Application_Windows (push) Has been cancelled
Build / PC_Application_OSX (push) Has been cancelled
Build / PC_Application_OSX_13 (push) Has been cancelled
Build / Embedded_Firmware (push) Has been cancelled
HIL_Tests / Get_Repository (push) Has been cancelled
Unit_Tests / Tests (push) Has been cancelled
HIL_Tests / PC_Application_RPi5 (push) Has been cancelled
HIL_Tests / Embedded_Firmware (push) Has been cancelled
HIL_Tests / HIL (push) Has been cancelled
This commit is contained in:
parent
64791e6d4e
commit
d853571aea
|
|
@ -0,0 +1,16 @@
|
|||
#include "harogicb60.h"
|
||||
|
||||
HarogicB60::HarogicB60()
|
||||
{
|
||||
validUSBIDs.clear();
|
||||
validUSBIDs.append({0x367F, 0x0200, "B60"});
|
||||
|
||||
for(auto &s : specificSettings) {
|
||||
s.name.replace("LibreVNAUSBDriver", "HarogicB60Driver");
|
||||
}
|
||||
}
|
||||
|
||||
QString HarogicB60::getDriverName()
|
||||
{
|
||||
return "Harogic B60";
|
||||
}
|
||||
|
|
@ -0,0 +1,19 @@
|
|||
#ifndef HAROGICB60_H
|
||||
#define HAROGICB60_H
|
||||
|
||||
#include "../LibreVNA/librevnausbdriver.h"
|
||||
|
||||
class HarogicB60 : public LibreVNAUSBDriver
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
HarogicB60();
|
||||
|
||||
/**
|
||||
* @brief Returns the driver name. It must be unique across all implemented drivers and is used to identify the driver
|
||||
* @return driver name
|
||||
*/
|
||||
virtual QString getDriverName() override;
|
||||
};
|
||||
|
||||
#endif // HAROGICB60_H
|
||||
|
|
@ -8,16 +8,6 @@
|
|||
|
||||
using namespace std;
|
||||
|
||||
using USBID = struct {
|
||||
int VID;
|
||||
int PID;
|
||||
};
|
||||
static constexpr USBID IDs[] = {
|
||||
{0x0483, 0x564e},
|
||||
{0x0483, 0x4121},
|
||||
{0x1209, 0x4121},
|
||||
};
|
||||
|
||||
LibreVNAUSBDriver::LibreVNAUSBDriver()
|
||||
: LibreVNADriver()
|
||||
{
|
||||
|
|
@ -30,6 +20,10 @@ LibreVNAUSBDriver::LibreVNAUSBDriver()
|
|||
lastTimestamp = QDateTime::currentDateTime();
|
||||
byteCnt = 0;
|
||||
|
||||
validUSBIDs.append({0x0483, 0x564e, "VNA"});
|
||||
validUSBIDs.append({0x0483, 0x4121, "VNA"});
|
||||
validUSBIDs.append({0x1209, 0x4121, "VNA"});
|
||||
|
||||
specificSettings.push_back(Savable::SettingDescription(&captureRawReceiverValues, "LibreVNAUSBDriver.captureRawReceiverValues", false));
|
||||
specificSettings.push_back(Savable::SettingDescription(&harmonicMixing, "LibreVNAUSBDriver.harmonicMixing", false));
|
||||
specificSettings.push_back(Savable::SettingDescription(&SASignalID, "LibreVNAUSBDriver.signalID", true));
|
||||
|
|
@ -309,15 +303,15 @@ void LibreVNAUSBDriver::SearchDevices(std::function<bool (libusb_device_handle *
|
|||
continue;
|
||||
}
|
||||
|
||||
bool correctID = false;
|
||||
int numIDs = sizeof(IDs)/sizeof(IDs[0]);
|
||||
for(int i=0;i<numIDs;i++) {
|
||||
if(desc.idVendor == IDs[i].VID && desc.idProduct == IDs[i].PID) {
|
||||
correctID = true;
|
||||
int IDindex = -1;
|
||||
for(int i=0;i<validUSBIDs.size();i++) {
|
||||
if(desc.idVendor == validUSBIDs[i].VID && desc.idProduct == validUSBIDs[i].PID) {
|
||||
IDindex = i;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if(!correctID) {
|
||||
if(IDindex == -1) {
|
||||
// invalid VID/PID
|
||||
continue;
|
||||
}
|
||||
|
||||
|
|
@ -348,7 +342,7 @@ void LibreVNAUSBDriver::SearchDevices(std::function<bool (libusb_device_handle *
|
|||
if (ret > 0) {
|
||||
/* managed to read the product string */
|
||||
QString product(c_product);
|
||||
if (product == "VNA") {
|
||||
if (product == validUSBIDs[IDindex].deviceName) {
|
||||
// this is a match
|
||||
if(!foundCallback(handle, QString(c_serial))) {
|
||||
// abort search
|
||||
|
|
|
|||
|
|
@ -54,7 +54,7 @@ private:
|
|||
void USBHandleThread();
|
||||
// foundCallback is called for every device that is found. If it returns true the search continues, otherwise it is aborted.
|
||||
// When the search is aborted the last found device is still opened
|
||||
static void SearchDevices(std::function<bool(libusb_device_handle *handle, QString getSerial)> foundCallback, libusb_context *context, bool ignoreOpenError);
|
||||
void SearchDevices(std::function<bool(libusb_device_handle *handle, QString getSerial)> foundCallback, libusb_context *context, bool ignoreOpenError);
|
||||
|
||||
libusb_device_handle *m_handle;
|
||||
libusb_context *m_context;
|
||||
|
|
@ -82,6 +82,13 @@ private:
|
|||
QDateTime lastTimestamp;
|
||||
unsigned long byteCnt;
|
||||
|
||||
using USBID = struct {
|
||||
int VID;
|
||||
int PID;
|
||||
QString deviceName;
|
||||
};
|
||||
protected:
|
||||
QList<USBID> validUSBIDs;
|
||||
};
|
||||
|
||||
#endif // LIBREVNAUSBDRIVER_H
|
||||
|
|
|
|||
|
|
@ -5,6 +5,7 @@
|
|||
#include "LibreVNA/Compound/compounddriver.h"
|
||||
#include "SSA3000X/ssa3000xdriver.h"
|
||||
#include "SNA5000A/sna5000adriver.h"
|
||||
#include "Harogic/harogicb60.h"
|
||||
|
||||
DeviceDriver *DeviceDriver::activeDriver = nullptr;
|
||||
|
||||
|
|
@ -25,6 +26,7 @@ std::vector<DeviceDriver *> DeviceDriver::getDrivers()
|
|||
ret.push_back(new CompoundDriver);
|
||||
ret.push_back(new SSA3000XDriver);
|
||||
ret.push_back(new SNA5000ADriver);
|
||||
ret.push_back(new HarogicB60);
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -20,6 +20,7 @@ HEADERS += \
|
|||
CustomWidgets/toggleswitch.h \
|
||||
CustomWidgets/touchstoneimport.h \
|
||||
CustomWidgets/tracesetselector.h \
|
||||
Device/Harogic/harogicb60.h \
|
||||
Device/LibreVNA/Compound/compounddevice.h \
|
||||
Device/LibreVNA/Compound/compounddeviceeditdialog.h \
|
||||
Device/LibreVNA/Compound/compounddriver.h \
|
||||
|
|
@ -191,6 +192,7 @@ SOURCES += \
|
|||
CustomWidgets/toggleswitch.cpp \
|
||||
CustomWidgets/touchstoneimport.cpp \
|
||||
CustomWidgets/tracesetselector.cpp \
|
||||
Device/Harogic/harogicb60.cpp \
|
||||
Device/LibreVNA/Compound/compounddevice.cpp \
|
||||
Device/LibreVNA/Compound/compounddeviceeditdialog.cpp \
|
||||
Device/LibreVNA/Compound/compounddriver.cpp \
|
||||
|
|
|
|||
|
|
@ -162,7 +162,7 @@ PreferencesDialog::PreferencesDialog(Preferences *pref, QWidget *parent) :
|
|||
if(!w) {
|
||||
continue;
|
||||
}
|
||||
w->setObjectName(driver->getDriverName());
|
||||
w->setObjectName(driver->getDriverName().replace(" ", ""));
|
||||
ui->pageWidget->addWidget(w);
|
||||
auto driverItem = new QTreeWidgetItem();
|
||||
driverItem->setText(0, driver->getDriverName());
|
||||
|
|
|
|||
|
|
@ -26,6 +26,7 @@ SOURCES += \
|
|||
../LibreVNA-GUI/CustomWidgets/toggleswitch.cpp \
|
||||
../LibreVNA-GUI/CustomWidgets/touchstoneimport.cpp \
|
||||
../LibreVNA-GUI/CustomWidgets/tracesetselector.cpp \
|
||||
../LibreVNA-GUI/Device/Harogic/harogicb60.cpp \
|
||||
../LibreVNA-GUI/Device/LibreVNA/amplitudecaldialog.cpp \
|
||||
../LibreVNA-GUI/Device/LibreVNA/deviceconfigurationdialogv1.cpp \
|
||||
../LibreVNA-GUI/Device/LibreVNA/deviceconfigurationdialogvd0.cpp \
|
||||
|
|
@ -219,6 +220,7 @@ HEADERS += \
|
|||
../LibreVNA-GUI/CustomWidgets/toggleswitch.h \
|
||||
../LibreVNA-GUI/CustomWidgets/touchstoneimport.h \
|
||||
../LibreVNA-GUI/CustomWidgets/tracesetselector.h \
|
||||
../LibreVNA-GUI/Device/Harogic/harogicb60.h \
|
||||
../LibreVNA-GUI/Device/LibreVNA/amplitudecaldialog.h \
|
||||
../LibreVNA-GUI/Device/LibreVNA/deviceconfigurationdialogv1.h \
|
||||
../LibreVNA-GUI/Device/LibreVNA/deviceconfigurationdialogvd0.h \
|
||||
|
|
|
|||
Loading…
Reference in a new issue