DT5215 firmware emulator
A DT5215 control API on localhost. It answers every endpoint of spec/dt5215-api.yaml with
plausible, consistent data, so the SDKs of all seven languages — and your own program — can be
tested with no instrument in the loop.
pip install dt5215-emulator
dt5215-emulator --port 8080
curl -s -X POST http://127.0.0.1:8080/api-v1.0/login \
-H 'Content-Type: application/json' -d '{"username":"user","password":"user"}'
from dt5215_emulator import Emulator
import dt5215
with Emulator() as emu: # a free port
with dt5215.connect(emu.url, username="user", password="user") as dev:
print(dev.info().hostname) # dt5215-emu
What it reproduces on purpose
Three behaviours of the real firmware that a client has to get right, and that a hand-written mock usually gets wrong:
- a refusal is HTTP 200 with
result: false, not a 4xx; /rebootand/restart_appanswer nothing and drop the connection;- a bearer token is required everywhere except
/loginand/alive, and/alivereports whether the token it was given is valid (so a client can tell "instrument down" from "token expired").
It is also stateful: switching HV off changes what the next /get_hv_status says, disabling
a chain empties it, writing a register reads back, an enumeration walks its phases (in about a
second, not minutes), and a board firmware upgrade progresses board by board.
Driving it from a test
Emulator(state=...) takes a prepared State, and every field of it can be changed while the
emulator runs:
from dt5215_emulator import Emulator, State
state = State()
state.chains[0].los = True # a chain with loss of signal
state.client["control"] = True # Janus attached: a board upgrade must be refused
with Emulator(state=state) as emu:
...
Options
| Option | Meaning |
|---|---|
--port N |
TCP port (default 8080; Emulator(port=0) takes a free one) |
--host H |
interface to bind (default 127.0.0.1) |
--no-auth |
answer everything without a token, like the instrument's /caen/config/nologin |
--hostname NAME |
the hostname the emulator reports |
-v |
log every request |
Default users: user/user and caen/caen.
What it is not
It does not pretend to be the instrument's data path: there is no event streaming, no FPGA, no real timing. It answers the control API, and that is all the SDK needs.
Metadata
Release files for dt5215-emulator 1.0.7
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| dt5215_emulator-1.0.7.tar.gz | 18.4 kB | Without provenance | Details for dt5215_emulator-1.0.7.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| dt5215_emulator-1.0.7-py3-none-any.whl | Python 3 | none | any | Details for dt5215_emulator-1.0.7-py3-none-any.whl |
Total release size: 36.8 kB
Release files / dt5215_emulator-1.0.7.tar.gz
| Download URL | dt5215_emulator-1.0.7.tar.gz |
|---|---|
| Size | 18.4 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
8cd8b6564138abd3a9134f1931b6c259ec486febd781e3e723bed9bbdadf456e
|
|
BLAKE2b-256 checksum How to use checksums |
c5ff1d5f3f09a90d3cdc304cde41c77ec0f831e025677688ee8fa54b136c12af
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.10.12
|
Release files / dt5215_emulator-1.0.7-py3-none-any.whl
| Download URL | dt5215_emulator-1.0.7-py3-none-any.whl |
|---|---|
| Size | 18.4 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
4e079a3f8ddc0db3d443a875a80e6033cc447c87494425fd660a44e6e2e2ce18
|
|
BLAKE2b-256 checksum How to use checksums |
0b23f6568c40120044ae4e37351abf95f00c7ebb8d97175ebd76e4bfa7bd858c
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.10.12
|
Security for dt5215-emulator 1.0.7
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.