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: a3b46a789aaa
Choose a base ref
...
head repository: ngscopeclient/scopehal
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: a2da1791f4e6
Choose a head ref
  • 1 commit
  • 4 files changed
  • 1 contributor

Commits on Jun 1, 2019

  1. Copy the full SHA
    a2da179 View commit details
Showing with 45 additions and 42 deletions.
  1. +1 −33 scopehal/RigolOscilloscope.cpp
  2. +0 −8 scopehal/RigolOscilloscope.h
  3. +34 −1 scopehal/SCPIOscilloscope.cpp
  4. +10 −0 scopehal/SCPIOscilloscope.h
34 changes: 1 addition & 33 deletions scopehal/RigolOscilloscope.cpp
Original file line number Diff line number Diff line change
@@ -40,26 +40,9 @@ RigolOscilloscope::RigolOscilloscope(SCPITransport* transport)
, m_triggerArmed(false)
, m_triggerOneShot(false)
{
//Ask for the ID
m_transport->SendCommand("*IDN?");
string reply = m_transport->ReadReply();
char vendor[128] = "";
char model[128] = "";
char serial[128] = "";
char version[128] = "";
if(4 != sscanf(reply.c_str(), "%127[^,],%127[^,],%127[^,],%127s", vendor, model, serial, version))
{
LogError("Bad IDN response %s\n", reply.c_str());
return;
}
m_vendor = vendor;
m_model = model;
m_serial = serial;
m_fwVersion = version;

//Last digit of the model number is the number of channels
int model_number;
if(1 != sscanf(model, "DS%d", &model_number))
if(1 != sscanf(m_model.c_str(), "DS%d", &model_number))
{
LogError("Bad model number\n");
return;
@@ -128,21 +111,6 @@ RigolOscilloscope::~RigolOscilloscope()
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// Accessors

string RigolOscilloscope::GetName()
{
return m_model;
}

string RigolOscilloscope::GetVendor()
{
return m_vendor;
}

string RigolOscilloscope::GetSerial()
{
return m_serial;
}

unsigned int RigolOscilloscope::GetInstrumentTypes()
{
return Instrument::INST_OSCILLOSCOPE;
8 changes: 0 additions & 8 deletions scopehal/RigolOscilloscope.h
Original file line number Diff line number Diff line change
@@ -38,9 +38,6 @@ class RigolOscilloscope : public SCPIOscilloscope

public:
//Device information
virtual std::string GetName();
virtual std::string GetVendor();
virtual std::string GetSerial();
virtual unsigned int GetInstrumentTypes();

virtual void FlushConfigCache();
@@ -84,11 +81,6 @@ class RigolOscilloscope : public SCPIOscilloscope
virtual std::vector<uint64_t> GetSampleDepthsInterleaved();

protected:
std::string m_vendor;
std::string m_model;
std::string m_serial;
std::string m_fwVersion;

OscilloscopeChannel* m_extTrigChannel;

//Mutexing for thread safety
35 changes: 34 additions & 1 deletion scopehal/SCPIOscilloscope.cpp
Original file line number Diff line number Diff line change
@@ -37,10 +37,43 @@ using namespace std;
SCPIOscilloscope::SCPIOscilloscope(SCPITransport* transport)
: m_transport(transport)
{

//Ask for the ID
m_transport->SendCommand("*IDN?");
string reply = m_transport->ReadReply();
char vendor[128] = "";
char model[128] = "";
char serial[128] = "";
char version[128] = "";
if(4 != sscanf(reply.c_str(), "%127[^,],%127[^,],%127[^,],%127s", vendor, model, serial, version))
{
LogError("Bad IDN response %s\n", reply.c_str());
return;
}
m_vendor = vendor;
m_model = model;
m_serial = serial;
m_fwVersion = version;
}

SCPIOscilloscope::~SCPIOscilloscope()
{
delete m_transport;
}

////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// Accessors

string SCPIOscilloscope::GetName()
{
return m_model;
}

string SCPIOscilloscope::GetVendor()
{
return m_vendor;
}

string SCPIOscilloscope::GetSerial()
{
return m_serial;
}
10 changes: 10 additions & 0 deletions scopehal/SCPIOscilloscope.h
Original file line number Diff line number Diff line change
@@ -39,8 +39,18 @@ class SCPIOscilloscope : public Oscilloscope
SCPIOscilloscope(SCPITransport* transport);
virtual ~SCPIOscilloscope();

virtual std::string GetName();
virtual std::string GetVendor();
virtual std::string GetSerial();

protected:
SCPITransport* m_transport;

//standard *IDN? fields
std::string m_vendor;
std::string m_model;
std::string m_serial;
std::string m_fwVersion;
};

#endif