diff --git a/scopehal/AlientekPowerSupply.h b/scopehal/AlientekPowerSupply.h index 6cd5e69a..7aa735da 100644 --- a/scopehal/AlientekPowerSupply.h +++ b/scopehal/AlientekPowerSupply.h @@ -2,7 +2,7 @@ * * * libscopehal * * * -* Copyright (c) 2012-2024 Andrew D. Zonenberg and contributors * +* Copyright (c) 2012-2026 Andrew D. Zonenberg and contributors * * All rights reserved. * * * * Redistribution and use in source and binary forms, with or without modification, are permitted provided that the * @@ -153,6 +153,12 @@ class AlientekPowerSupply public: static std::string GetDriverNameInternal(); POWER_INITPROC(AlientekPowerSupply); + static std::vector GetDriverSupportedModels() + { + return { + {"Alientek DP100", {{ SCPITransportType::TRANSPORT_HID, "2e3c:af01" }}} + }; + } }; #endif diff --git a/scopehal/DemoOscilloscope.h b/scopehal/DemoOscilloscope.h index 72c4a034..04c686e3 100644 --- a/scopehal/DemoOscilloscope.h +++ b/scopehal/DemoOscilloscope.h @@ -2,7 +2,7 @@ * * * libscopehal * * * -* Copyright (c) 2012-2024 Andrew D. Zonenberg and contributors * +* Copyright (c) 2012-2026 Andrew D. Zonenberg and contributors * * All rights reserved. * * * * Redistribution and use in source and binary forms, with or without modification, are permitted provided that the * @@ -197,8 +197,15 @@ class DemoOscilloscope : public virtual SCPIOscilloscope public: static std::string GetDriverNameInternal(); - + static std::vector GetDriverSupportedModels() + { + return { + {"Demo Oscilloscope", {{ SCPITransportType::TRANSPORT_NULL, "" }}} + }; + } OSCILLOSCOPE_INITPROC(DemoOscilloscope) + + }; #endif diff --git a/scopehal/DemoPowerSupply.h b/scopehal/DemoPowerSupply.h index 812c5dd7..86c86d78 100644 --- a/scopehal/DemoPowerSupply.h +++ b/scopehal/DemoPowerSupply.h @@ -2,7 +2,7 @@ * * * libscopehal * * * -* Copyright (c) 2012-2024 Andrew D. Zonenberg and contributors * +* Copyright (c) 2012-2026 Andrew D. Zonenberg and contributors * * All rights reserved. * * * * Redistribution and use in source and binary forms, with or without modification, are permitted provided that the * @@ -99,6 +99,12 @@ class DemoPowerSupply public: static std::string GetDriverNameInternal(); + static std::vector GetDriverSupportedModels() + { + return { + {"Demo PSU", {{ SCPITransportType::TRANSPORT_NULL, "" }}} + }; + } POWER_INITPROC(DemoPowerSupply) }; diff --git a/scopehal/KuaiquPowerSupply.h b/scopehal/KuaiquPowerSupply.h index bdf8c9ff..d4568417 100644 --- a/scopehal/KuaiquPowerSupply.h +++ b/scopehal/KuaiquPowerSupply.h @@ -2,7 +2,7 @@ * * * libscopehal * * * -* Copyright (c) 2012-2024 Andrew D. Zonenberg and contributors * +* Copyright (c) 2012-2026 Andrew D. Zonenberg and contributors * * All rights reserved. * * * * Redistribution and use in source and binary forms, with or without modification, are permitted provided that the * @@ -103,6 +103,22 @@ class KuaiquPowerSupply public: static std::string GetDriverNameInternal(); POWER_INITPROC(KuaiquPowerSupply); + static std::vector GetDriverSupportedModels() + { + return { + #ifdef _WIN32 + {"Kuaiqu SPPS-D", {{ SCPITransportType::TRANSPORT_UART, "COM:9600" }}}, + {"Kuaiqu SPPS-S", {{ SCPITransportType::TRANSPORT_UART, "COM:9600" }}}, + {"Kuaiqu SPPS*D", {{ SCPITransportType::TRANSPORT_UART, "COM:9600" }}}, + {"Kuaiqu R-SPPS", {{ SCPITransportType::TRANSPORT_UART, "COM:9600" }}} + #else + {"Kuaiqu SPPS-D", {{ SCPITransportType::TRANSPORT_UART, "/dev/ttyUSB:9600" }}}, + {"Kuaiqu SPPS-S", {{ SCPITransportType::TRANSPORT_UART, "/dev/ttyUSB:9600" }}}, + {"Kuaiqu SPPS*D", {{ SCPITransportType::TRANSPORT_UART, "/dev/ttyUSB:9600" }}}, + {"Kuaiqu R-SPPS", {{ SCPITransportType::TRANSPORT_UART, "/dev/ttyUSB:9600" }}} + #endif + }; + } }; #endif diff --git a/scopehal/MagnovaOscilloscope.cpp b/scopehal/MagnovaOscilloscope.cpp index 16b1e05e..1d3a6a07 100644 --- a/scopehal/MagnovaOscilloscope.cpp +++ b/scopehal/MagnovaOscilloscope.cpp @@ -2,7 +2,7 @@ * * * libscopehal * * * -* Copyright (c) 2012-2024 Andrew D. Zonenberg and contributors * +* Copyright (c) 2012-2026 Andrew D. Zonenberg and contributors * * All rights reserved. * * * * Redistribution and use in source and binary forms, with or without modification, are permitted provided that the * @@ -368,6 +368,16 @@ string MagnovaOscilloscope::GetDriverNameInternal() return "magnova"; } +std::vector MagnovaOscilloscope::GetDriverSupportedModels() +{ + return { + {"Magnova", { + { SCPITransportType::TRANSPORT_LAN, ":5025" }, + { SCPITransportType::TRANSPORT_USBTMC, "/dev/usbtmc" }, + }} + }; +} + OscilloscopeChannel* MagnovaOscilloscope::GetExternalTrigger() { return m_extTrigChannel; @@ -679,7 +689,7 @@ double MagnovaOscilloscope::GetChannelAttenuation(size_t i) { protocolError("invalid channel attenuation value '%s'",reply.c_str()); } - return 1/d; + return d; } void MagnovaOscilloscope::SetChannelAttenuation(size_t i, double atten) diff --git a/scopehal/MagnovaOscilloscope.h b/scopehal/MagnovaOscilloscope.h index d90d9b95..0ec6b768 100644 --- a/scopehal/MagnovaOscilloscope.h +++ b/scopehal/MagnovaOscilloscope.h @@ -2,7 +2,7 @@ * * * libscopehal * * * -* Copyright (c) 2012-2024 Andrew D. Zonenberg and contributors * +* Copyright (c) 2012-2026 Andrew D. Zonenberg and contributors * * All rights reserved. * * * * Redistribution and use in source and binary forms, with or without modification, are permitted provided that the * @@ -493,5 +493,6 @@ class MagnovaOscilloscope : public virtual SCPIOscilloscope, public virtual SCP public: static std::string GetDriverNameInternal(); OSCILLOSCOPE_INITPROC(MagnovaOscilloscope) + static std::vector GetDriverSupportedModels(); }; #endif diff --git a/scopehal/NanoVNA.h b/scopehal/NanoVNA.h index 1c3b8681..def4780d 100644 --- a/scopehal/NanoVNA.h +++ b/scopehal/NanoVNA.h @@ -2,7 +2,7 @@ * * * libscopehal * * * -* Copyright (c) 2012-2024 Andrew D. Zonenberg and contributors * +* Copyright (c) 2012-2026 Andrew D. Zonenberg and contributors * * All rights reserved. * * * * Redistribution and use in source and binary forms, with or without modification, are permitted provided that the * @@ -119,6 +119,16 @@ class NanoVNA : public virtual SCPIVNA, public virtual CommandLineDriver public: static std::string GetDriverNameInternal(); + static std::vector GetDriverSupportedModels() + { + return { + #ifdef _WIN32 + {"NanoVNA", {{ SCPITransportType::TRANSPORT_UART, "COM:115200:DTR" }}} + #else + {"NanoVNA", {{ SCPITransportType::TRANSPORT_UART, "/dev/ttyUSB:115200:DTR" }}} + #endif + }; + } VNA_INITPROC(NanoVNA) }; diff --git a/scopehal/Oscilloscope.h b/scopehal/Oscilloscope.h index 43825bb5..f504f459 100644 --- a/scopehal/Oscilloscope.h +++ b/scopehal/Oscilloscope.h @@ -2,7 +2,7 @@ * * * libscopehal * * * -* Copyright (c) 2012-2025 Andrew D. Zonenberg and contributors * +* Copyright (c) 2012-2026 Andrew D. Zonenberg and contributors * * All rights reserved. * * * * Redistribution and use in source and binary forms, with or without modification, are permitted provided that the * @@ -1018,6 +1018,6 @@ inline Oscilloscope* OscilloscopeChannel::GetScope() virtual std::string GetDriverName() const override \ { return GetDriverNameInternal(); } -#define AddDriverClass(T) Oscilloscope::DoAddDriverClass(T::GetDriverNameInternal(), T::CreateInstance) +#define AddDriverClass(T) Oscilloscope::DoAddDriverClass(T::GetDriverNameInternal(), T::CreateInstance); SCPIInstrument::DoAddDriverClass(T::GetDriverNameInternal(), T::GetDriverSupportedModels) #endif diff --git a/scopehal/OwonXDGFunctionGenerator.h b/scopehal/OwonXDGFunctionGenerator.h index 7bfca3ae..0bb56f72 100644 --- a/scopehal/OwonXDGFunctionGenerator.h +++ b/scopehal/OwonXDGFunctionGenerator.h @@ -2,7 +2,7 @@ * * * libscopehal * * * -* Copyright (c) 2012-2024 Andrew D. Zonenberg and contributors * +* Copyright (c) 2012-2026 Andrew D. Zonenberg and contributors * * All rights reserved. * * * * Redistribution and use in source and binary forms, with or without modification, are permitted provided that the * @@ -81,6 +81,19 @@ class OwonXDGFunctionGenerator : public virtual SCPIFunctionGenerator public: static std::string GetDriverNameInternal(); + static std::vector GetDriverSupportedModels() + { + return { + {"Owon XDG 2000", { + { SCPITransportType::TRANSPORT_LAN, ":3000" }, + { SCPITransportType::TRANSPORT_USBTMC, "/dev/usbtmc" }, + }}, + {"Owon XDG 3000", { + { SCPITransportType::TRANSPORT_LAN, ":3000" }, + { SCPITransportType::TRANSPORT_USBTMC, "/dev/usbtmc" }, + }} + }; + } GENERATOR_INITPROC(OwonXDGFunctionGenerator) protected: diff --git a/scopehal/OwonXDMMultimeter.h b/scopehal/OwonXDMMultimeter.h index 9de79543..92392b1e 100644 --- a/scopehal/OwonXDMMultimeter.h +++ b/scopehal/OwonXDMMultimeter.h @@ -2,7 +2,7 @@ * * * libscopehal * * * -* Copyright (c) 2012-2024 Andrew D. Zonenberg and contributors * +* Copyright (c) 2012-2026 Andrew D. Zonenberg and contributors * * All rights reserved. * * * * Redistribution and use in source and binary forms, with or without modification, are permitted provided that the * @@ -81,6 +81,20 @@ class OwonXDMMultimeter public: static std::string GetDriverNameInternal(); + static std::vector GetDriverSupportedModels() + { + return { + #ifdef _WIN32 + {"Owon XDM1041", {{ SCPITransportType::TRANSPORT_UART, "COM" }}}, + {"Owon XDM1241", {{ SCPITransportType::TRANSPORT_UART, "COM" }}}, + {"Owon XDM2041", {{ SCPITransportType::TRANSPORT_UART, "COM" }}} + #else + {"Owon XDM1041", {{ SCPITransportType::TRANSPORT_UART, "/dev/ttyUSB" }}}, + {"Owon XDM1241", {{ SCPITransportType::TRANSPORT_UART, "/dev/ttyUSB" }}}, + {"Owon XDM2041", {{ SCPITransportType::TRANSPORT_UART, "/dev/ttyUSB" }}} + #endif + }; + } METER_INITPROC(OwonXDMMultimeter) }; diff --git a/scopehal/RidenPowerSupply.cpp b/scopehal/RidenPowerSupply.cpp index fdf74004..02470d50 100644 --- a/scopehal/RidenPowerSupply.cpp +++ b/scopehal/RidenPowerSupply.cpp @@ -55,6 +55,38 @@ RidenPowerSupply::RidenPowerSupply(SCPITransport* transport) // Read model number uint16_t modelNumber = ReadRegister(REGISTER_MODEL); m_model = string("RD") + to_string(modelNumber/10) +"-" + to_string(modelNumber%10); + // Determine current and voltage factor + switch(modelNumber) + { + case 3005: + case 5005: + case 8005: + case 60061: + case 60062: + case 60066: + m_currentFactor = 1000; + m_voltageFactor = 100; + break; + case 60065: + m_currentFactor = 10000; + m_voltageFactor = 100; + break; + case 5015: + case 5020: + case 60121: + case 60181: + case 60241: + m_currentFactor = 100; + m_voltageFactor = 100; + break; + case 60125: + m_currentFactor = 1000; + m_voltageFactor = 1000; + break; + default: + m_currentFactor = 1000; + m_voltageFactor = 100; + } // Read serial number uint16_t serialNumber = ReadRegister(REGISTER_SERIAL); m_serial = to_string(serialNumber); @@ -112,28 +144,28 @@ double RidenPowerSupply::GetPowerVoltageActual(int chan) { if(chan != 0) return 0; - return ((double)ReadRegister(REGISTER_V_OUT))/100; + return ((double)ReadRegister(REGISTER_V_OUT))/m_voltageFactor; } double RidenPowerSupply::GetPowerVoltageNominal(int chan) { if(chan != 0) return 0; - return ((double)ReadRegister(REGISTER_V_SET))/100; + return ((double)ReadRegister(REGISTER_V_SET))/m_voltageFactor; } double RidenPowerSupply::GetPowerCurrentActual(int chan) { if(chan != 0) return 0; - return ((double)ReadRegister(REGISTER_I_OUT))/1000; + return ((double)ReadRegister(REGISTER_I_OUT))/m_currentFactor; } double RidenPowerSupply::GetPowerCurrentNominal(int chan) { if(chan != 0) return 0; - return ((double)ReadRegister(REGISTER_I_SET))/1000; + return ((double)ReadRegister(REGISTER_I_SET))/m_currentFactor; } bool RidenPowerSupply::GetPowerChannelActive(int chan) @@ -147,14 +179,14 @@ void RidenPowerSupply::SetPowerVoltage(int chan, double volts) { if(chan != 0) return; - WriteRegister(REGISTER_V_SET,(uint16_t)(volts*100)); + WriteRegister(REGISTER_V_SET,(uint16_t)(volts*m_voltageFactor)); } void RidenPowerSupply::SetPowerCurrent(int chan, double amps) { if(chan != 0) return; - WriteRegister(REGISTER_I_SET,(uint16_t)(amps*1000)); + WriteRegister(REGISTER_I_SET,(uint16_t)(amps*m_currentFactor)); } void RidenPowerSupply::SetPowerChannelActive(int chan, bool on) diff --git a/scopehal/RidenPowerSupply.h b/scopehal/RidenPowerSupply.h index 2708f54c..3a7d319e 100644 --- a/scopehal/RidenPowerSupply.h +++ b/scopehal/RidenPowerSupply.h @@ -91,8 +91,27 @@ class RidenPowerSupply REGISTER_ON_OFF = 0x12 }; + double m_currentFactor; + double m_voltageFactor; + public: static std::string GetDriverNameInternal(); + static std::vector GetDriverSupportedModels() + { + return { + #ifdef _WIN32 + {"Riden RD60xx", {{ SCPITransportType::TRANSPORT_UART, "COM" }}}, + {"Riden DPS30xx", {{ SCPITransportType::TRANSPORT_UART, "COM" }}}, + {"Riden DPS50xx", {{ SCPITransportType::TRANSPORT_UART, "COM" }}}, + {"Riden DPS80xx", {{ SCPITransportType::TRANSPORT_UART, "COM" }}} + #else + {"Riden RD60xx", {{ SCPITransportType::TRANSPORT_UART, "/dev/ttyUSB" }}}, + {"Riden DPS30xx", {{ SCPITransportType::TRANSPORT_UART, "/dev/ttyUSB" }}}, + {"Riden DPS50xx", {{ SCPITransportType::TRANSPORT_UART, "/dev/ttyUSB" }}}, + {"Riden DPS80xx", {{ SCPITransportType::TRANSPORT_UART, "/dev/ttyUSB" }}} + #endif + }; + } POWER_INITPROC(RidenPowerSupply); }; diff --git a/scopehal/RigolOscilloscope.h b/scopehal/RigolOscilloscope.h index b18d7683..2a137b52 100644 --- a/scopehal/RigolOscilloscope.h +++ b/scopehal/RigolOscilloscope.h @@ -2,7 +2,7 @@ * * * libscopehal * * * -* Copyright (c) 2012-2024 Andrew D. Zonenberg and contributors * +* Copyright (c) 2012-2026 Andrew D. Zonenberg and contributors * * All rights reserved. * * * * Redistribution and use in source and binary forms, with or without modification, are permitted provided that the * @@ -147,6 +147,39 @@ class RigolOscilloscope : public virtual SCPIOscilloscope public: static std::string GetDriverNameInternal(); + static std::vector GetDriverSupportedModels() + { + return { + {"Rigol DHO800", { + { SCPITransportType::TRANSPORT_LAN, ":5555" }, + { SCPITransportType::TRANSPORT_USBTMC, "/dev/usbtmc" }, + }}, + {"Rigol DHO900", { + { SCPITransportType::TRANSPORT_LAN, ":5555" }, + { SCPITransportType::TRANSPORT_USBTMC, "/dev/usbtmc" }, + }}, + {"Rigol DHO1000", { + { SCPITransportType::TRANSPORT_LAN, ":5555" }, + { SCPITransportType::TRANSPORT_USBTMC, "/dev/usbtmc" }, + }}, + {"Rigol DHO4000", { + { SCPITransportType::TRANSPORT_LAN, ":5555" }, + { SCPITransportType::TRANSPORT_USBTMC, "/dev/usbtmc" }, + }}, + {"Rigol DS1100D/E", { + { SCPITransportType::TRANSPORT_LAN, ":5555" }, + { SCPITransportType::TRANSPORT_USBTMC, "/dev/usbtmc" }, + }}, + {"Rigol DS1000Z", { + { SCPITransportType::TRANSPORT_LAN, ":5555" }, + { SCPITransportType::TRANSPORT_USBTMC, "/dev/usbtmc" }, + }}, + {"Rigol MSO5000", { + { SCPITransportType::TRANSPORT_LAN, ":5555" }, + { SCPITransportType::TRANSPORT_USBTMC, "/dev/usbtmc" }, + }}, + }; + } OSCILLOSCOPE_INITPROC(RigolOscilloscope) }; diff --git a/scopehal/SCPIBERT.h b/scopehal/SCPIBERT.h index 90d0c298..591bd79a 100644 --- a/scopehal/SCPIBERT.h +++ b/scopehal/SCPIBERT.h @@ -2,7 +2,7 @@ * * * libscopehal * * * -* Copyright (c) 2012-2024 Andrew D. Zonenberg and contributors * +* Copyright (c) 2012-2026 Andrew D. Zonenberg and contributors * * All rights reserved. * * * * Redistribution and use in source and binary forms, with or without modification, are permitted provided that the * @@ -66,7 +66,7 @@ class SCPIBERT : public virtual BERT virtual std::string GetDriverName() const override \ { return GetDriverNameInternal(); } -#define AddBERTDriverClass(T) SCPIBERT::DoAddDriverClass(T::GetDriverNameInternal(), T::CreateInstance) +#define AddBERTDriverClass(T) SCPIBERT::DoAddDriverClass(T::GetDriverNameInternal(), T::CreateInstance); SCPIInstrument::DoAddDriverClass(T::GetDriverNameInternal(), T::GetDriverSupportedModels) #endif diff --git a/scopehal/SCPIFunctionGenerator.h b/scopehal/SCPIFunctionGenerator.h index 7b050287..94ce01bd 100644 --- a/scopehal/SCPIFunctionGenerator.h +++ b/scopehal/SCPIFunctionGenerator.h @@ -2,7 +2,7 @@ * * * libscopehal * * * -* Copyright (c) 2012-2024 Andrew D. Zonenberg and contributors * +* Copyright (c) 2012-2026 Andrew D. Zonenberg and contributors * * All rights reserved. * * * * Redistribution and use in source and binary forms, with or without modification, are permitted provided that the * @@ -62,7 +62,7 @@ class SCPIFunctionGenerator : public virtual FunctionGenerator virtual std::string GetDriverName() const override \ { return GetDriverNameInternal(); } -#define AddFunctionGeneratorDriverClass(T) SCPIFunctionGenerator::DoAddDriverClass(T::GetDriverNameInternal(), T::CreateInstance) +#define AddFunctionGeneratorDriverClass(T) SCPIFunctionGenerator::DoAddDriverClass(T::GetDriverNameInternal(), T::CreateInstance); SCPIInstrument::DoAddDriverClass(T::GetDriverNameInternal(), T::GetDriverSupportedModels) #endif diff --git a/scopehal/SCPIInstrument.cpp b/scopehal/SCPIInstrument.cpp index e6f7e340..f710adf0 100644 --- a/scopehal/SCPIInstrument.cpp +++ b/scopehal/SCPIInstrument.cpp @@ -31,6 +31,9 @@ using namespace std; +SCPIInstrument::GetTransportMapType SCPIInstrument::m_getTransportProcs; + + //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// // Construction / destruction @@ -81,6 +84,12 @@ string SCPIInstrument::GetSerial() const return m_serial; } +void SCPIInstrument::DoAddDriverClass(string name, GetTrapsportsProcType proc) +{ + m_getTransportProcs[name] = proc; +} + + //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// // Serialization @@ -90,3 +99,22 @@ void SCPIInstrument::DoSerializeConfiguration(YAML::Node& node, IDTable& /*table node["args"] = GetTransportConnectionString(); node["driver"] = GetDriverName(); } + +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +// Static functions + +std::vector SCPIInstrument::GetSupportedModels(std::string driver) +{ + if(m_getTransportProcs.find(driver) != m_getTransportProcs.end()) + return m_getTransportProcs[driver](); + + LogError("Invalid oscilloscope driver name \"%s\"\n", driver.c_str()); + return std::vector(); +} + +// Default implementation returns no transport +std::vector SCPIInstrument::GetDriverSupportedModels() +{ + return std::vector(); +} + diff --git a/scopehal/SCPIInstrument.h b/scopehal/SCPIInstrument.h index 2b13f281..081a0962 100644 --- a/scopehal/SCPIInstrument.h +++ b/scopehal/SCPIInstrument.h @@ -30,6 +30,24 @@ #ifndef SCPIInstrument_h #define SCPIInstrument_h +/** + @brief SCPI transport information (type and connectionString) + */ +struct SCPITransportInfo +{ + SCPITransportType transportType; + std::string connectionString; +}; + +/** + @brief SCPI instrument model (model name and transport information) + */ +struct SCPIInstrumentModel +{ + std::string modelName; + std::vector supportedTransports; +}; + /** @brief An SCPI-based oscilloscope */ @@ -50,6 +68,15 @@ class SCPIInstrument : public virtual Instrument virtual void BackgroundProcessing() override; + typedef std::vector (*GetTrapsportsProcType)(); + static void DoAddDriverClass(std::string name, GetTrapsportsProcType proc); + static std::vector GetSupportedModels(std::string driver); + static std::vector GetDriverSupportedModels(); + +protected: + typedef std::map GetTransportMapType; + static GetTransportMapType m_getTransportProcs; + protected: void DoSerializeConfiguration(YAML::Node& node, IDTable& table); }; diff --git a/scopehal/SCPILoad.h b/scopehal/SCPILoad.h index 2f937573..2e223b54 100644 --- a/scopehal/SCPILoad.h +++ b/scopehal/SCPILoad.h @@ -2,7 +2,7 @@ * * * libscopehal * * * -* Copyright (c) 2012-2024 Andrew D. Zonenberg and contributors * +* Copyright (c) 2012-2026 Andrew D. Zonenberg and contributors * * All rights reserved. * * * * Redistribution and use in source and binary forms, with or without modification, are permitted provided that the * @@ -61,7 +61,7 @@ class SCPILoad : public virtual Load virtual std::string GetDriverName() const override \ { return GetDriverNameInternal(); } -#define AddLoadDriverClass(T) SCPILoad::DoAddDriverClass(T::GetDriverNameInternal(), T::CreateInstance) +#define AddLoadDriverClass(T) SCPILoad::DoAddDriverClass(T::GetDriverNameInternal(), T::CreateInstance); SCPIInstrument::DoAddDriverClass(T::GetDriverNameInternal(), T::GetDriverSupportedModels) #endif diff --git a/scopehal/SCPIMiscInstrument.h b/scopehal/SCPIMiscInstrument.h index aab8775c..6f14de07 100644 --- a/scopehal/SCPIMiscInstrument.h +++ b/scopehal/SCPIMiscInstrument.h @@ -2,7 +2,7 @@ * * * libscopehal * * * -* Copyright (c) 2012-2024 Andrew D. Zonenberg and contributors * +* Copyright (c) 2012-2026 Andrew D. Zonenberg and contributors * * All rights reserved. * * * * Redistribution and use in source and binary forms, with or without modification, are permitted provided that the * @@ -63,7 +63,7 @@ class SCPIMiscInstrument : public virtual SCPIInstrument virtual std::string GetDriverName() const override \ { return GetDriverNameInternal(); } -#define AddMiscInstrumentDriverClass(T) SCPIMiscInstrument::DoAddDriverClass(T::GetDriverNameInternal(), T::CreateInstance) +#define AddMiscInstrumentDriverClass(T) SCPIMiscInstrument::DoAddDriverClass(T::GetDriverNameInternal(), T::CreateInstance); SCPIInstrument::DoAddDriverClass(T::GetDriverNameInternal(), T::GetDriverSupportedModels) #endif diff --git a/scopehal/SCPIMultimeter.h b/scopehal/SCPIMultimeter.h index 7855cf65..02019fbf 100644 --- a/scopehal/SCPIMultimeter.h +++ b/scopehal/SCPIMultimeter.h @@ -2,7 +2,7 @@ * * * libscopehal * * * -* Copyright (c) 2012-2024 Andrew D. Zonenberg and contributors * +* Copyright (c) 2012-2026 Andrew D. Zonenberg and contributors * * All rights reserved. * * * * Redistribution and use in source and binary forms, with or without modification, are permitted provided that the * @@ -65,7 +65,7 @@ class SCPIMultimeter : public virtual Multimeter virtual std::string GetDriverName() const override \ { return GetDriverNameInternal(); } -#define AddMultimeterDriverClass(T) SCPIMultimeter::DoAddDriverClass(T::GetDriverNameInternal(), T::CreateInstance) +#define AddMultimeterDriverClass(T) SCPIMultimeter::DoAddDriverClass(T::GetDriverNameInternal(), T::CreateInstance); SCPIInstrument::DoAddDriverClass(T::GetDriverNameInternal(), T::GetDriverSupportedModels) #endif diff --git a/scopehal/SCPIPowerSupply.h b/scopehal/SCPIPowerSupply.h index 083ecdcb..0ce057c4 100644 --- a/scopehal/SCPIPowerSupply.h +++ b/scopehal/SCPIPowerSupply.h @@ -2,7 +2,7 @@ * * * libscopehal * * * -* Copyright (c) 2012-2024 Andrew D. Zonenberg and contributors * +* Copyright (c) 2012-2026 Andrew D. Zonenberg and contributors * * All rights reserved. * * * * Redistribution and use in source and binary forms, with or without modification, are permitted provided that the * @@ -61,7 +61,7 @@ class SCPIPowerSupply : public virtual PowerSupply virtual std::string GetDriverName() const override \ { return GetDriverNameInternal(); } -#define AddPowerSupplyDriverClass(T) SCPIPowerSupply::DoAddDriverClass(T::GetDriverNameInternal(), T::CreateInstance) +#define AddPowerSupplyDriverClass(T) SCPIPowerSupply::DoAddDriverClass(T::GetDriverNameInternal(), T::CreateInstance); SCPIInstrument::DoAddDriverClass(T::GetDriverNameInternal(), T::GetDriverSupportedModels) #endif diff --git a/scopehal/SCPIRFSignalGenerator.h b/scopehal/SCPIRFSignalGenerator.h index a34267f0..2870dde1 100644 --- a/scopehal/SCPIRFSignalGenerator.h +++ b/scopehal/SCPIRFSignalGenerator.h @@ -2,7 +2,7 @@ * * * libscopehal * * * -* Copyright (c) 2012-2024 Andrew D. Zonenberg and contributors * +* Copyright (c) 2012-2026 Andrew D. Zonenberg and contributors * * All rights reserved. * * * * Redistribution and use in source and binary forms, with or without modification, are permitted provided that the * @@ -61,7 +61,7 @@ class SCPIRFSignalGenerator : public virtual RFSignalGenerator virtual std::string GetDriverName() const override \ { return GetDriverNameInternal(); } -#define AddRFSignalGeneratorDriverClass(T) SCPIRFSignalGenerator::DoAddDriverClass(T::GetDriverNameInternal(), T::CreateInstance) +#define AddRFSignalGeneratorDriverClass(T) SCPIRFSignalGenerator::DoAddDriverClass(T::GetDriverNameInternal(), T::CreateInstance); SCPIInstrument::DoAddDriverClass(T::GetDriverNameInternal(), T::GetDriverSupportedModels) #endif diff --git a/scopehal/SCPISDR.h b/scopehal/SCPISDR.h index ec4d5c9a..885ec979 100644 --- a/scopehal/SCPISDR.h +++ b/scopehal/SCPISDR.h @@ -2,7 +2,7 @@ * * * libscopehal * * * -* Copyright (c) 2012-2024 Andrew D. Zonenberg and contributors * +* Copyright (c) 2012-2026 Andrew D. Zonenberg and contributors * * All rights reserved. * * * * Redistribution and use in source and binary forms, with or without modification, are permitted provided that the * @@ -124,6 +124,6 @@ class SCPISDR : public virtual SCPIOscilloscope virtual std::string GetDriverName() const override \ { return GetDriverNameInternal(); } -#define AddSDRDriverClass(T) SCPISDR::DoAddDriverClass(T::GetDriverNameInternal(), T::CreateInstance) +#define AddSDRDriverClass(T) SCPISDR::DoAddDriverClass(T::GetDriverNameInternal(), T::CreateInstance); SCPIInstrument::DoAddDriverClass(T::GetDriverNameInternal(), T::GetDriverSupportedModels) #endif diff --git a/scopehal/SCPISpectrometer.h b/scopehal/SCPISpectrometer.h index 3afcd136..ce25c8ce 100644 --- a/scopehal/SCPISpectrometer.h +++ b/scopehal/SCPISpectrometer.h @@ -2,7 +2,7 @@ * * * libscopehal * * * -* Copyright (c) 2012-2024 Andrew D. Zonenberg and contributors * +* Copyright (c) 2012-2026 Andrew D. Zonenberg and contributors * * All rights reserved. * * * * Redistribution and use in source and binary forms, with or without modification, are permitted provided that the * @@ -127,6 +127,6 @@ class SCPISpectrometer : public virtual SCPIOscilloscope virtual std::string GetDriverName() const override \ { return GetDriverNameInternal(); } -#define AddSpectrometerDriverClass(T) SCPISpectrometer::DoAddDriverClass(T::GetDriverNameInternal(), T::CreateInstance) +#define AddSpectrometerDriverClass(T) SCPISpectrometer::DoAddDriverClass(T::GetDriverNameInternal(), T::CreateInstance); SCPIInstrument::DoAddDriverClass(T::GetDriverNameInternal(), T::GetDriverSupportedModels) #endif diff --git a/scopehal/SCPITransport.cpp b/scopehal/SCPITransport.cpp index 8df8c927..4fea8be8 100644 --- a/scopehal/SCPITransport.cpp +++ b/scopehal/SCPITransport.cpp @@ -2,7 +2,7 @@ * * * libscopehal * * * -* Copyright (c) 2012-2024 Andrew D. Zonenberg and contributors * +* Copyright (c) 2012-2026 Andrew D. Zonenberg and contributors * * All rights reserved. * * * * Redistribution and use in source and binary forms, with or without modification, are permitted provided that the * @@ -276,3 +276,20 @@ void SCPITransport::FlushRXBuffer(void) { LogError("SCPITransport::FlushRXBuffer is unimplemented\n"); } + +std::string to_string(SCPITransportType transportType) +{ + switch(transportType) + { + case SCPITransportType::TRANSPORT_LAN: return "lan"; + case SCPITransportType::TRANSPORT_USBTMC: return "usbtmc"; + case SCPITransportType::TRANSPORT_UART: return "uart"; + case SCPITransportType::TRANSPORT_HID: return "hid"; + case SCPITransportType::TRANSPORT_NULL: return "null"; + case SCPITransportType::TRANSPORT_VICP: return "vicp"; + case SCPITransportType::TRANSPORT_SOKETCAN: return "socketcan"; + case SCPITransportType::TRANSPORT_LXI: return "lxi"; + } + return "unknown"; +} + diff --git a/scopehal/SCPITransport.h b/scopehal/SCPITransport.h index 4406e071..3c8dbdf0 100644 --- a/scopehal/SCPITransport.h +++ b/scopehal/SCPITransport.h @@ -2,7 +2,7 @@ * * * libscopehal * * * -* Copyright (c) 2012-2024 Andrew D. Zonenberg and contributors * +* Copyright (c) 2012-2026 Andrew D. Zonenberg and contributors * * All rights reserved. * * * * Redistribution and use in source and binary forms, with or without modification, are permitted provided that the * @@ -148,6 +148,21 @@ class SCPITransport std::chrono::milliseconds m_rateLimitingInterval; }; +enum class SCPITransportType +{ + TRANSPORT_LAN, + TRANSPORT_USBTMC, + TRANSPORT_UART, + TRANSPORT_HID, + TRANSPORT_NULL, + TRANSPORT_VICP, + TRANSPORT_SOKETCAN, + TRANSPORT_LXI +}; + +std::string to_string(SCPITransportType transportType); + + #define TRANSPORT_INITPROC(T) \ static SCPITransport* CreateInstance(const std::string& args) \ { \ diff --git a/scopehal/SCPIVNA.h b/scopehal/SCPIVNA.h index 097282d3..792d545e 100644 --- a/scopehal/SCPIVNA.h +++ b/scopehal/SCPIVNA.h @@ -2,7 +2,7 @@ * * * libscopehal * * * -* Copyright (c) 2012-2024 Andrew D. Zonenberg and contributors * +* Copyright (c) 2012-2026 Andrew D. Zonenberg and contributors * * All rights reserved. * * * * Redistribution and use in source and binary forms, with or without modification, are permitted provided that the * @@ -103,6 +103,6 @@ class SCPIVNA : public virtual SCPIOscilloscope virtual std::string GetDriverName() const override \ { return GetDriverNameInternal(); } -#define AddVNADriverClass(T) SCPIVNA::DoAddDriverClass(T::GetDriverNameInternal(), T::CreateInstance) +#define AddVNADriverClass(T) SCPIVNA::DoAddDriverClass(T::GetDriverNameInternal(), T::CreateInstance); SCPIInstrument::DoAddDriverClass(T::GetDriverNameInternal(), T::GetDriverSupportedModels) #endif diff --git a/scopehal/SiglentSCPIOscilloscope.h b/scopehal/SiglentSCPIOscilloscope.h index 1a9b2ef1..a79709f7 100644 --- a/scopehal/SiglentSCPIOscilloscope.h +++ b/scopehal/SiglentSCPIOscilloscope.h @@ -2,7 +2,7 @@ * * * libscopehal * * * -* Copyright (c) 2012-2024 Andrew D. Zonenberg and contributors * +* Copyright (c) 2012-2026 Andrew D. Zonenberg and contributors * * All rights reserved. * * * * Redistribution and use in source and binary forms, with or without modification, are permitted provided that the * @@ -416,6 +416,51 @@ class SiglentSCPIOscilloscope : public virtual SCPIOscilloscope public: static std::string GetDriverNameInternal(); + static std::vector GetDriverSupportedModels() + { + return { + {"SDS800X HD", { + { SCPITransportType::TRANSPORT_LAN, ":5025" }, + { SCPITransportType::TRANSPORT_USBTMC, "/dev/usbtmc" }, + }}, + {"SDS1000X HD", { + { SCPITransportType::TRANSPORT_LAN, ":5025" }, + { SCPITransportType::TRANSPORT_USBTMC, "/dev/usbtmc" }, + }}, + {"SDS2000X HD", { + { SCPITransportType::TRANSPORT_LAN, ":5025" }, + { SCPITransportType::TRANSPORT_USBTMC, "/dev/usbtmc" }, + }}, + {"SDS3000X HD", { + { SCPITransportType::TRANSPORT_LAN, ":5025" }, + { SCPITransportType::TRANSPORT_USBTMC, "/dev/usbtmc" }, + }}, + {"SDS2000X+", { + { SCPITransportType::TRANSPORT_LAN, ":5025" }, + { SCPITransportType::TRANSPORT_USBTMC, "/dev/usbtmc" }, + }}, + {"SDS1000X-E", { + { SCPITransportType::TRANSPORT_LAN, ":5025" }, + { SCPITransportType::TRANSPORT_USBTMC, "/dev/usbtmc" }, + }}, + {"SDS2000X-E", { + { SCPITransportType::TRANSPORT_LAN, ":5025" }, + { SCPITransportType::TRANSPORT_USBTMC, "/dev/usbtmc" }, + }}, + {"SDS5000X", { + { SCPITransportType::TRANSPORT_LAN, ":5025" }, + { SCPITransportType::TRANSPORT_USBTMC, "/dev/usbtmc" }, + }}, + {"SDS6000A/L/Pro", { + { SCPITransportType::TRANSPORT_LAN, ":5025" }, + { SCPITransportType::TRANSPORT_USBTMC, "/dev/usbtmc" }, + }}, + {"SDS7000A", { + { SCPITransportType::TRANSPORT_LAN, ":5025" }, + { SCPITransportType::TRANSPORT_USBTMC, "/dev/usbtmc" }, + }}, + }; + } OSCILLOSCOPE_INITPROC(SiglentSCPIOscilloscope) }; #endif diff --git a/scopehal/TinySA.h b/scopehal/TinySA.h index 167e3627..b94d0586 100644 --- a/scopehal/TinySA.h +++ b/scopehal/TinySA.h @@ -2,7 +2,7 @@ * * * libscopehal * * * -* Copyright (c) 2012-2025 Andrew D. Zonenberg and contributors * +* Copyright (c) 2012-2026 Andrew D. Zonenberg and contributors * * All rights reserved. * * * * Redistribution and use in source and binary forms, with or without modification, are permitted provided that the * @@ -109,6 +109,18 @@ class TinySA public: static std::string GetDriverNameInternal(); + static std::vector GetDriverSupportedModels() + { + return { + #ifdef _WIN32 + {"tinySA", {{ SCPITransportType::TRANSPORT_UART, "COM" }}}, + {"tinySA ULTRA", {{ SCPITransportType::TRANSPORT_UART, "COM" }}} + #else + {"tinySA", {{ SCPITransportType::TRANSPORT_UART, "/dev/ttyUSB" }}}, + {"tinySA ULTRA", {{ SCPITransportType::TRANSPORT_UART, "/dev/ttyUSB" }}} + #endif + }; + } OSCILLOSCOPE_INITPROC(TinySA) };