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

Commits on Mar 15, 2020

  1. Verified

    This commit was signed with the committer’s verified signature.
    NeQuissimus Tim Steinbach
    Copy the full SHA
    faddf97 View commit details
Showing with 55 additions and 34 deletions.
  1. +46 −33 glscopeclient/OscilloscopeWindow.cpp
  2. +9 −1 glscopeclient/ScopeApp.cpp
79 changes: 46 additions & 33 deletions glscopeclient/OscilloscopeWindow.cpp
Original file line number Diff line number Diff line change
@@ -35,6 +35,7 @@

#include "glscopeclient.h"
#include "../scopehal/Instrument.h"
#include "../scopehal/MockOscilloscope.h"
#include "OscilloscopeWindow.h"
#include "TriggerPropertiesDialog.h"
#include <unistd.h>
@@ -95,7 +96,11 @@ void OscilloscopeWindow::SetTitle()
if(i > 0)
title += ", ";
title += tt;

if(dynamic_cast<MockOscilloscope*>(scope) != NULL)
title += "[OFFLINE]";
}

set_title(title);
}

@@ -636,48 +641,56 @@ void OscilloscopeWindow::LoadInstruments(const YAML::Node& node, bool reconnect,
return;
}

if(!reconnect)
{
LogError("Mock scopes for no-reconnect file load not yet implemented\n");
return;
}

//Load each instrument
for(auto it : node)
{
auto inst = it.second;

//Create the scope
auto transport = SCPITransport::CreateTransport(inst["transport"].as<string>(), inst["args"].as<string>());
auto scope = Oscilloscope::CreateOscilloscope(inst["driver"].as<string>(), transport);
Oscilloscope* scope;

//Sanity check make/model/serial. If mismatch, stop
string message;
bool fail = false;
if(inst["name"].as<string>() != scope->GetName())
if(reconnect)
{
message = string("Unable to connect to oscilloscope: instrument has model name \"") +
scope->GetName() + "\", save file has model name \"" + inst["name"].as<string>() + "\"";
fail = true;
}
else if(inst["vendor"].as<string>() != scope->GetVendor())
{
message = string("Unable to connect to oscilloscope: instrument has vendor \"") +
scope->GetVendor() + "\", save file has vendor \"" + inst["vendor"].as<string>() + "\"";
fail = true;
}
else if(inst["serial"].as<string>() != scope->GetSerial())
{
message = string("Unable to connect to oscilloscope: instrument has serial \"") +
scope->GetSerial() + "\", save file has serial \"" + inst["serial"].as<string>() + "\"";
fail = true;
//Create the scope
auto transport = SCPITransport::CreateTransport(inst["transport"].as<string>(), inst["args"].as<string>());
scope = Oscilloscope::CreateOscilloscope(inst["driver"].as<string>(), transport);

//Sanity check make/model/serial. If mismatch, stop
string message;
bool fail = false;
if(inst["name"].as<string>() != scope->GetName())
{
message = string("Unable to connect to oscilloscope: instrument has model name \"") +
scope->GetName() + "\", save file has model name \"" + inst["name"].as<string>() + "\"";
fail = true;
}
else if(inst["vendor"].as<string>() != scope->GetVendor())
{
message = string("Unable to connect to oscilloscope: instrument has vendor \"") +
scope->GetVendor() + "\", save file has vendor \"" + inst["vendor"].as<string>() + "\"";
fail = true;
}
else if(inst["serial"].as<string>() != scope->GetSerial())
{
message = string("Unable to connect to oscilloscope: instrument has serial \"") +
scope->GetSerial() + "\", save file has serial \"" + inst["serial"].as<string>() + "\"";
fail = true;
}
if(fail)
{
Gtk::MessageDialog dlg(*this, message, false, Gtk::MESSAGE_ERROR, Gtk::BUTTONS_OK, true);
dlg.run();
delete scope;
continue;
}
}
if(fail)

else
{
Gtk::MessageDialog dlg(*this, message, false, Gtk::MESSAGE_ERROR, Gtk::BUTTONS_OK, true);
dlg.run();
delete scope;
continue;
//Create the mock scope
scope = new MockOscilloscope(
inst["name"].as<string>(),
inst["vendor"].as<string>(),
inst["serial"].as<string>());
}

//All good. Add to our list of scopes etc
10 changes: 9 additions & 1 deletion glscopeclient/ScopeApp.cpp
Original file line number Diff line number Diff line change
@@ -34,6 +34,7 @@
*/

#include "glscopeclient.h"
#include "../scopehal/MockOscilloscope.h"

using namespace std;

@@ -49,8 +50,9 @@ void ScopeApp::run(string fileToLoad)
m_window = new OscilloscopeWindow(m_scopes);
add_window(*m_window);

//If loading a file on the command line, do not reconnect to the scope
if(!fileToLoad.empty())
m_window->DoFileOpen(fileToLoad);
m_window->DoFileOpen(fileToLoad, true, true, false);

m_window->present();

@@ -107,5 +109,11 @@ void ScopeApp::StartScopeThreads()
{
//Start the scope threads
for(auto scope : m_scopes)
{
//Mock scopes can't trigger, so don't waste time polling them
if(dynamic_cast<MockOscilloscope*>(scope) != NULL)
continue;

m_threads.push_back(new thread(ScopeThread, scope));
}
}