Driving ScanaStudio from code
Everything in this manual can be done from a program. The window is a client of the ScanaStudio server, and so is a script you write: same server, same workspaces, same decoders, same results.
There are SDKs for Python, NodeJS, Rust and C, all MIT licensed. This page says what they are for; the SDK manual is the reference.
What it looks like​
from ikalogic_scanastudio import ScanaStudio, Trigger
with ScanaStudio.connect() as server:
workspace = server.create("se254") # a demo device: no hardware needed
workspace.capture.run(
samples=1_000_000,
sample_rate=25_000_000,
trigger=Trigger.rising(channel=0, position=0.1),
)
i2c = workspace.decoders.add("i2c.js", {"scl": 0, "sda": 1})
for packet in workspace.data.packets(i2c):
print(packet.start, packet.title, packet.content)
The sequence is always the same: connect, create or attach to a workspace, capture, decode, read.
When to use the SDK​
A bench test that has to give a verdict. Trigger, capture, decode, check the result against what the board should have done, and exit with a status a build system can read. This is the main use case for the SDK, and why it covers everything the window does.
A capture you leave running. Start an acquisition from a script, let the process exit, and rejoin the same workspace hours later from another script or from the window. The server holds the capture, so nothing has to stay open for it to continue. See How ScanaStudio works.
An instrument somebody else is using. Several clients can attach to one workspace, so a script can read what a colleague has on screen, and the server can live on a bench elsewhere.
Three APIs, and which is which​
The three names are close enough to be confusing, so here is the difference:
| What it is | Where it runs | |
|---|---|---|
| SDK | Python, NodeJS, Rust and C libraries that drive ScanaStudio from outside | your program, talking to the server |
| Scripting | JavaScript that decodes a protocol or builds a pattern | inside the server, as part of a capture |
| IHWAPI | The old C hardware API, which talked to the device directly | superseded by the SDK |
If you want to automate a measurement, you want the SDK. If you want ScanaStudio to understand a bus it does not know yet, you want scripting. The IHWAPI still works for the devices it supported, but it gains no features; the SDK's migration guide maps it call by call.
Getting started​
Install the package for your language, start ScanaStudio or the server, and run the example above against a demo device. The SDK's installation and first capture pages take it from there, and the guides work through the cases above in full.