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: b4afb2a0a907
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: ec09bc1fcdc2
Choose a head ref
  • 1 commit
  • 1 file changed
  • 1 contributor

Commits on Mar 11, 2020

  1. Copy the full SHA
    ec09bc1 View commit details
Showing with 47 additions and 55 deletions.
  1. +47 −55 glscopeclient/main.cpp
102 changes: 47 additions & 55 deletions glscopeclient/main.cpp
Original file line number Diff line number Diff line change
@@ -236,74 +236,66 @@ int main(int argc, char* argv[])
}
}

string sapi(api);

//Connect to the scope
if(sapi == "lecroy_vicp")
//API is formatted as driver_transport
char driver[128];
char trans[128];
if(2 != sscanf(api, "%127[^_]_%127s", driver, trans))
{
//default port if not specified
if(port == 0)
port = 1861;

auto scope = new LeCroyOscilloscope(new VICPSocketTransport(host, port));
scope->m_nickname = nick;
app->m_scopes.push_back(scope);
LogError("Invalid API %s\n", api);
continue;
}
else if(sapi == "rigol_lan")
{
//default port if not specified
if(port == 0)
port = 5555;

auto scope = new RigolOscilloscope(new SCPISocketTransport(host, port));
scope->m_nickname = nick;
app->m_scopes.push_back(scope);
}
else if(sapi == "rs_lan")
//Special case default ports depending on protocol
string sdriver = driver;
string strans = trans;
if(port == 0)
{
//default port if not specified
if(port == 0)
if(strans == "vicp") //IANA port for SCPI over VICP
port = 1861;
else if(strans == "lan") //IANA port for SCPI over TCP
{
port = 5025;

auto scope = new RohdeSchwarzOscilloscope(new SCPISocketTransport(host, port));
scope->m_nickname = nick;
app->m_scopes.push_back(scope);
if(sdriver == "rigol") //Rigol is weird and uses a nonstandard port
port = 5555;
}
}
else if(sapi == "akila_lan")
{
//default port if not specified
if(port == 0)
port = 5555;

auto scope = new AntikernelLogicAnalyzer(new SCPISocketTransport(host, port));
scope->m_nickname = nick;
app->m_scopes.push_back(scope);
}
else if(sapi == "agilent_lan")
//Create the transport
SCPITransport* transport = NULL;
if(strans == "vicp")
transport = new VICPSocketTransport(host, port);
else if(strans == "lan")
transport = new SCPISocketTransport(host, port);
else
{
//default port if not specified
if(port == 0)
port = 5025;

auto scope = new AgilentOscilloscope(new SCPISocketTransport(host, port));
scope->m_nickname = nick;
app->m_scopes.push_back(scope);
LogError("Invalid transport %s\n", trans);
continue;
}
else if(sapi == "siglent_lan" || sapi == "lecroy_lan")
{
//default port if not specified
if(port == 0)
port = 5025;

auto scope = new SiglentSCPIOscilloscope(new SCPISocketTransport(host, port));
scope->m_nickname = nick;
app->m_scopes.push_back(scope);
}
//Create the scope
Oscilloscope* scope = NULL;
if(sdriver == "akila")
scope = new AntikernelLogicAnalyzer(transport);
else if(sdriver == "agilent")
scope = new AgilentOscilloscope(transport);
else if(sdriver == "lecroy")
scope = new LeCroyOscilloscope(transport);
else if(sdriver == "rigol")
scope = new RigolOscilloscope(transport);
else if(sdriver == "rs")
scope = new RohdeSchwarzOscilloscope(transport);
else if(sdriver == "siglent")
scope = new SiglentSCPIOscilloscope(transport);
else
{
LogError("Unrecognized API \"%s\", use --help\n", api);
return 1;
LogError("Unrecognized driver \"%s\"\n", driver);
delete transport;
continue;
}

//All good, hook it up
scope->m_nickname = nick;
app->m_scopes.push_back(scope);
}

app->run();