Skip to content

feat: add --diagnostics command exercising IDeviceDiagnostics#32

Draft
tylerkron wants to merge 1 commit into
mainfrom
feature/diagnostics-cli
Draft

feat: add --diagnostics command exercising IDeviceDiagnostics#32
tylerkron wants to merge 1 commit into
mainfrom
feature/diagnostics-cli

Conversation

@tylerkron

Copy link
Copy Markdown
Contributor

Summary

Adds a --diagnostics CLI command that exercises the full IDeviceDiagnostics surface added in daqifi-core#266. Useful as a one-shot bench check of the firmware's logging & performance-counter queries.

It connects + initializes, then runs each query and prints results:

  • SYSTem:ERRor:COUNt? — error-queue depth
  • SYSTem:MEMory:FREE? — heap / sample-pool diagnostics
  • SYSTem:STReam:STATS? — streaming performance counters
  • SYSTem:LOG:TESTSYSTem:LOG? — inject then read the system log
  • SYSTem:LOG:CMDHistory? — recent SCPI command history
  • SYSTem:LOG:LEVel STREAM,2 — set a runtime log level (echoes applied level + ceiling)
  • SYSTem:LOG:CLEar — clear the log buffer

Each step is isolated (one failed/unsupported query is reported but doesn't abort the rest); the process exits non-zero if any step fails. All operations are non-destructive (the only state touched — log buffer, runtime log level — is volatile and resets on reboot).

⚠️ Dependency — draft

This depends on the IDeviceDiagnostics API from daqifi-core#266, which is newer than the published Daqifi.Core 0.24.0 package this app references by default. Until a release with diagnostics ships:

  • The default build fails (Daqifi.Core.Device.Diagnostics not found in 0.24.0).
  • Build/run against a local core checkout:
    dotnet build Daqifi.Core.Cli.csproj -c Release -p:DaqifiCoreProjectPath=<path-to>/Daqifi.Core.csproj
    

Before merging: wait for core #266 to merge + a new Daqifi.Core package to publish, then bump the PackageReference version in Daqifi.Core.Cli.csproj and undraft.

Bench-tested

Built against the core #266 branch and run against a real device (NQ over USB serial, /dev/cu.usbmodem101) — exit code 0, all eight queries succeeded:

== Memory diagnostics (SYSTem:MEMory:FREE?) ==
  HeapFree=13712 / HeapTotal=75000 (HeapUsed=61288, MinEverFree=13712)
  SamplePool: count=1100 inUse=0 maxUsed=0
  (14 fields total)

== Stream stats (SYSTem:STReam:STATS?) ==
  ... (43 counters total)

== Read system log (SYSTem:LOG?) ==
  1 entries:
    Test error message            # only ERROR-level survives the default log level

== Command history (SYSTem:LOG:CMDHistory?) ==
  10 commands: ...

== Set log level (SYSTem:LOG:LEVel STREAM,2) ==
  STREAM: level=2 (ceiling 3)

🤖 Generated with Claude Code

Add a --diagnostics CLI command that runs every IDeviceDiagnostics query
against a connected device and prints the results: error-queue depth,
memory diagnostics, stream stats, log read/clear/test, command history,
and runtime log-level set. Each step is isolated so one unsupported query
is reported without aborting the rest; exit code is non-zero if any step
fails.

Requires Daqifi.Core with the IDeviceDiagnostics API (daqifi-core#266),
which is newer than the published 0.24.0 package — build against a local
core checkout via -p:DaqifiCoreProjectPath=<path> until a release ships.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant