Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: ngscopeclient/scopehal
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: d09c151a2d39
Choose a base ref
...
head repository: ngscopeclient/scopehal
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: 57be093ed61e
Choose a head ref
  • 1 commit
  • 16 files changed
  • 1 contributor

Commits on Mar 12, 2020

  1. Copy the full SHA
    57be093 View commit details
2 changes: 1 addition & 1 deletion scopehal/AgilentOscilloscope.cpp
Original file line number Diff line number Diff line change
@@ -148,7 +148,7 @@ AgilentOscilloscope::~AgilentOscilloscope()
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// Accessors

string AgilentOscilloscope::GetDriverName()
string AgilentOscilloscope::GetDriverNameInternal()
{
return "agilent";
}
5 changes: 4 additions & 1 deletion scopehal/AgilentOscilloscope.h
Original file line number Diff line number Diff line change
@@ -37,7 +37,6 @@ class AgilentOscilloscope : public SCPIOscilloscope
virtual ~AgilentOscilloscope();

public:
virtual std::string GetDriverName();

//Device information
virtual unsigned int GetInstrumentTypes();
@@ -106,6 +105,10 @@ class AgilentOscilloscope : public SCPIOscilloscope

bool m_triggerArmed;
bool m_triggerOneShot;

public:
static std::string GetDriverNameInternal();
OSCILLOSCOPE_INITPROC(AgilentOscilloscope)
};

#endif
2 changes: 1 addition & 1 deletion scopehal/AntikernelLogicAnalyzer.cpp
Original file line number Diff line number Diff line change
@@ -103,7 +103,7 @@ string AntikernelLogicAnalyzer::GetTransportConnectionString()
return m_transport->GetConnectionString();
}

string AntikernelLogicAnalyzer::GetDriverName()
string AntikernelLogicAnalyzer::GetDriverNameInternal()
{
return "akila";
}
5 changes: 4 additions & 1 deletion scopehal/AntikernelLogicAnalyzer.h
Original file line number Diff line number Diff line change
@@ -46,7 +46,6 @@ class AntikernelLogicAnalyzer

virtual std::string GetTransportConnectionString();
virtual std::string GetTransportName();
virtual std::string GetDriverName();

virtual std::string GetName();
virtual std::string GetVendor();
@@ -116,6 +115,10 @@ class AntikernelLogicAnalyzer
uint32_t m_memoryDepth;
uint32_t m_memoryWidth;
uint32_t m_maxWidth;

public:
static std::string GetDriverNameInternal();
OSCILLOSCOPE_INITPROC(AntikernelLogicAnalyzer);
};

#endif
2 changes: 1 addition & 1 deletion scopehal/LeCroyOscilloscope.cpp
Original file line number Diff line number Diff line change
@@ -320,7 +320,7 @@ LeCroyOscilloscope::~LeCroyOscilloscope()
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// Device information

string LeCroyOscilloscope::GetDriverName()
string LeCroyOscilloscope::GetDriverNameInternal()
{
return "lecroy";
}
6 changes: 4 additions & 2 deletions scopehal/LeCroyOscilloscope.h
Original file line number Diff line number Diff line change
@@ -55,8 +55,6 @@ class LeCroyOscilloscope
void DetectOptions();

public:
virtual std::string GetDriverName();

//Device information
virtual std::string GetName();
virtual std::string GetVendor();
@@ -203,6 +201,10 @@ class LeCroyOscilloscope
//Mutexing for thread safety
std::recursive_mutex m_mutex;
std::recursive_mutex m_cacheMutex;

public:
static std::string GetDriverNameInternal();
OSCILLOSCOPE_INITPROC(LeCroyOscilloscope)
};

#endif
27 changes: 26 additions & 1 deletion scopehal/Oscilloscope.cpp
Original file line number Diff line number Diff line change
@@ -2,7 +2,7 @@
* *
* ANTIKERNEL v0.1 *
* *
* Copyright (c) 2012-2019 Andrew D. Zonenberg *
* Copyright (c) 2012-2020 Andrew D. Zonenberg *
* All rights reserved. *
* *
* Redistribution and use in source and binary forms, with or without modification, are permitted provided that the *
@@ -44,6 +44,8 @@

using namespace std;

Oscilloscope::CreateMapType Oscilloscope::m_createprocs;

////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// Construction / destruction

@@ -59,6 +61,29 @@ Oscilloscope::~Oscilloscope()
m_channels.clear();
}

////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// Enumeration

void Oscilloscope::DoAddDriverClass(string name, CreateProcType proc)
{
m_createprocs[name] = proc;
}

void Oscilloscope::EnumDrivers(vector<string>& names)
{
for(CreateMapType::iterator it=m_createprocs.begin(); it != m_createprocs.end(); ++it)
names.push_back(it->first);
}

Oscilloscope* Oscilloscope::CreateOscilloscope(string driver, SCPITransport* transport)
{
if(m_createprocs.find(driver) != m_createprocs.end())
return m_createprocs[driver](transport);

LogError("Invalid driver name");
return NULL;
}

////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// Device properties

32 changes: 27 additions & 5 deletions scopehal/Oscilloscope.h
Original file line number Diff line number Diff line change
@@ -38,6 +38,8 @@

class Instrument;

#include "SCPITransport.h"

/**
@brief Generic representation of an oscilloscope or logic analyzer.
@@ -357,11 +359,6 @@ class Oscilloscope : public virtual Instrument
*/
virtual std::string GetTransportName() =0;

/**
@brief Gets the registered name of this driver
*/
virtual std::string GetDriverName() =0;

public:
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// Memory depth / sample rate control.
@@ -427,6 +424,31 @@ class Oscilloscope : public virtual Instrument

///The channels
std::vector<OscilloscopeChannel*> m_channels;

public:
typedef Oscilloscope* (*CreateProcType)(SCPITransport*);
static void DoAddDriverClass(std::string name, CreateProcType proc);

static void EnumDrivers(std::vector<std::string>& names);
static Oscilloscope* CreateOscilloscope(std::string driver, SCPITransport* transport);

virtual std::string GetDriverName() =0;
//static std::string GetDriverNameInternal();

protected:
//Class enumeration
typedef std::map< std::string, CreateProcType > CreateMapType;
static CreateMapType m_createprocs;
};

#define OSCILLOSCOPE_INITPROC(T) \
static Oscilloscope* CreateInstance(SCPITransport* transport) \
{ \
return new T(transport); \
} \
virtual std::string GetDriverName() \
{ return GetDriverNameInternal(); }

#define AddDriverClass(T) Oscilloscope::DoAddDriverClass(T::GetDriverNameInternal(), T::CreateInstance)

#endif
2 changes: 1 addition & 1 deletion scopehal/RigolOscilloscope.cpp
Original file line number Diff line number Diff line change
@@ -122,7 +122,7 @@ unsigned int RigolOscilloscope::GetInstrumentTypes()
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// Device interface functions

string RigolOscilloscope::GetDriverName()
string RigolOscilloscope::GetDriverNameInternal()
{
return "rigol";
}
5 changes: 4 additions & 1 deletion scopehal/RigolOscilloscope.h
Original file line number Diff line number Diff line change
@@ -37,7 +37,6 @@ class RigolOscilloscope : public SCPIOscilloscope
virtual ~RigolOscilloscope();

public:
virtual std::string GetDriverName();

//Device information
virtual unsigned int GetInstrumentTypes();
@@ -103,6 +102,10 @@ class RigolOscilloscope : public SCPIOscilloscope

bool m_triggerArmed;
bool m_triggerOneShot;

public:
static std::string GetDriverNameInternal();
OSCILLOSCOPE_INITPROC(RigolOscilloscope)
};

#endif
2 changes: 1 addition & 1 deletion scopehal/RohdeSchwarzOscilloscope.cpp
Original file line number Diff line number Diff line change
@@ -151,7 +151,7 @@ RohdeSchwarzOscilloscope::~RohdeSchwarzOscilloscope()
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// Accessors

string RohdeSchwarzOscilloscope::GetDriverName()
string RohdeSchwarzOscilloscope::GetDriverNameInternal()
{
return "rs";
}
6 changes: 4 additions & 2 deletions scopehal/RohdeSchwarzOscilloscope.h
Original file line number Diff line number Diff line change
@@ -38,8 +38,6 @@ class RohdeSchwarzOscilloscope : public SCPIOscilloscope


public:
virtual std::string GetDriverName();

//Device information
virtual unsigned int GetInstrumentTypes();

@@ -104,6 +102,10 @@ class RohdeSchwarzOscilloscope : public SCPIOscilloscope

bool m_triggerArmed;
bool m_triggerOneShot;

public:
static std::string GetDriverNameInternal();
OSCILLOSCOPE_INITPROC(RohdeSchwarzOscilloscope)
};

#endif
2 changes: 1 addition & 1 deletion scopehal/SiglentSCPIOscilloscope.cpp
Original file line number Diff line number Diff line change
@@ -50,7 +50,7 @@ SiglentSCPIOscilloscope::~SiglentSCPIOscilloscope()
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// SCPI protocol logic

string SiglentSCPIOscilloscope::GetDriverName()
string SiglentSCPIOscilloscope::GetDriverNameInternal()
{
return "siglent";
}
6 changes: 4 additions & 2 deletions scopehal/SiglentSCPIOscilloscope.h
Original file line number Diff line number Diff line change
@@ -50,14 +50,16 @@ class SiglentSCPIOscilloscope
SiglentSCPIOscilloscope(SCPITransport* transport);
virtual ~SiglentSCPIOscilloscope();

virtual std::string GetDriverName();

virtual bool AcquireData(bool toQueue);

protected:

void ReadWaveDescriptorBlock(SiglentWaveformDesc_t *descriptor, unsigned int channel);
uint32_t ReadWaveHeader(char *header);

public:
static std::string GetDriverNameInternal();
OSCILLOSCOPE_INITPROC(SiglentSCPIOscilloscope)
};

#pragma pack(1)
21 changes: 20 additions & 1 deletion scopehal/scopehal.cpp
Original file line number Diff line number Diff line change
@@ -34,18 +34,37 @@
*/
#include "scopehal.h"
#include <gtkmm/drawingarea.h>
#include "AgilentOscilloscope.h"
#include "AntikernelLogicAnalyzer.h"
#include "LeCroyOscilloscope.h"
#include "RigolOscilloscope.h"
#include "RohdeSchwarzOscilloscope.h"
#include "SiglentSCPIOscilloscope.h"

using namespace std;

/**
@brief Static initialization forSCPI transports
@brief Static initialization for SCPI transports
*/
void TransportStaticInit()
{
AddTransportClass(SCPISocketTransport);
AddTransportClass(VICPSocketTransport);
}

/**
@brief Static initialization for oscilloscopes
*/
void DriverStaticInit()
{
AddDriverClass(AgilentOscilloscope);
AddDriverClass(AntikernelLogicAnalyzer);
AddDriverClass(LeCroyOscilloscope);
AddDriverClass(RigolOscilloscope);
AddDriverClass(RohdeSchwarzOscilloscope);
AddDriverClass(SiglentSCPIOscilloscope);
}

string GetDefaultChannelColor(int i)
{
const int NUM_COLORS = 12;
1 change: 1 addition & 0 deletions scopehal/scopehal.h
Original file line number Diff line number Diff line change
@@ -71,5 +71,6 @@ uint64_t ConvertVectorSignalToScalar(std::vector<bool> bits);
std::string GetDefaultChannelColor(int i);

void TransportStaticInit();
void DriverStaticInit();

#endif