This is a lightweight CLI that demonstrates how to use Daqifi.Core to discover devices, connect, configure channels, stream data, and stop streaming. It is intended both as a reference for third-party developers and as a validation tool for hardware-in-the-loop testing.
- .NET 8 SDK
- A DAQiFi device reachable via WiFi or USB/Serial
- SD card operations require a USB/Serial connection (not available over WiFi)
Discover devices:
dotnet run -- --discoverConnect and stream:
dotnet run -- \
--ip 192.168.1.44 \
--port 9760 \
--rate 10 \
--channels 0000000011 \
--duration 10--discoverdiscover devices over UDP--ip <address>device IP address--port <number>TCP port (default 9760)--rate <hz>sampling rate in Hz (default 100)--duration <seconds>streaming duration (default 10)--channels <mask>ADC channel enable mask (0/1 string)--limit <count>stop after N stream messages--min-samples <count>require at least N stream messages (exit code 2 on failure)--format <text|csv|jsonl>output format for samples--output <path>write samples to file instead of stdout--connect-timeout <seconds>TCP connect timeout (default 5)--connect-attempts <n>total connect attempts (default 1)--keep-connectedkeep connection open after streaming stops--show-statusprint protobuf status messages--discover-timeout <seconds>discovery timeout (default 5)--sd-listlist files on the SD card (USB/Serial only)--sd-log-startstart SD card logging (USB/Serial only)--sd-log-stopstop SD card logging (USB/Serial only)--sd-download <filename>download a file from the SD card and parse it (USB/Serial only)--sd-delete <filename>delete a file from the SD card (USB/Serial only)--sd-formatformat the SD card (USB/Serial only)--fw-download-latest <dir>download latest PIC32 firmware HEX into<dir>--fw-download-tag <tag> <dir>download PIC32 firmware HEX for<tag>into<dir>--fw-update-hex <path>run PIC32 firmware update from a local Intel HEX file (USB/Serial only)--fw-update-latest <dir>download latest PIC32 firmware HEX to<dir>, then run update (USB/Serial only)--lan-chip-infoquery the WiFi module chip ID, firmware version, and build date (USB/Serial only)
List files:
dotnet run -- --serial /dev/cu.usbmodem2101 --sd-listStart logging (auto-stop after 5 seconds):
dotnet run -- --serial /dev/cu.usbmodem2101 --sd-log-start --duration 5Stop logging:
dotnet run -- --serial /dev/cu.usbmodem2101 --sd-log-stopDownload and parse a file:
dotnet run -- --serial /dev/cu.usbmodem2101 --sd-download log_20260206_101851.binDelete a file:
dotnet run -- --serial /dev/cu.usbmodem2101 --sd-delete log_20260206_101851.binFormat the SD card:
dotnet run -- --serial /dev/cu.usbmodem2101 --sd-formatDownload latest PIC32 firmware HEX:
dotnet run -- --fw-download-latest /tmp/daqifi-firmwareDownload PIC32 firmware HEX for a specific tag:
dotnet run -- --fw-download-tag v3.2.0 /tmp/daqifi-firmwareRun a PIC32 firmware update from a local HEX file:
dotnet run -p:DaqifiCoreProjectPath=/path/to/daqifi-core/src/Daqifi.Core/Daqifi.Core.csproj -- \
--serial /dev/cu.usbmodem101 \
--baud 9600 \
--fw-update-hex /path/to/DAQiFi_Nyquist.hexDownload latest PIC32 firmware and update in one command:
dotnet run -p:DaqifiCoreProjectPath=/path/to/daqifi-core/src/Daqifi.Core/Daqifi.Core.csproj -- \
--serial /dev/cu.usbmodem101 \
--baud 9600 \
--fw-update-latest /tmp/daqifi-firmwareThe command logs firmware update state transitions and progress to stdout.
Query the WiFi module chip ID, firmware version, and build date:
dotnet run -p:DaqifiCoreProjectPath=/path/to/daqifi-core/src/Daqifi.Core/Daqifi.Core.csproj -- \
--serial /dev/cu.usbmodem101 \
--lan-chip-infoExample output:
Connected to /dev/cu.usbmodem101 @ 115200 baud
Querying LAN chip info...
ChipId: 1377184
FwVersion: 19.7.7
BuildDate: Mar 30 2022
text(default): human-readable line per samplecsv:timestamp,analog_values,digital_hexjsonl: one JSON object per line
0success1error during connect/stream2validation failed (--min-samplesnot met)
This app is designed to validate daqifi-core changes against real hardware. AI agents can run this CLI as a hardware-in-the-loop check after modifying daqifi-core.
By default the app references the published NuGet package. To validate local changes, point the build to a local Daqifi.Core.csproj using the MSBuild property below.
dotnet run -p:DaqifiCoreProjectPath=/path/to/daqifi-core/src/Daqifi.Core/Daqifi.Core.csproj -- \
--ip 192.168.1.44 \
--port 9760 \
--rate 10 \
--channels 0000000011 \
--duration 10 \
--min-samples 5dotnet run -p:DaqifiCoreProjectPath=/path/to/daqifi-core/src/Daqifi.Core/Daqifi.Core.csproj -- \
--ip 192.168.1.44 \
--port 9760 \
--rate 10 \
--channels 0000000011 \
--duration 10 \
--min-samples 5 \
--format jsonl \
--output /tmp/daqifi-samples.jsonlThe command exits non-zero if it fails to connect/stream or if --min-samples is not met.
- If connect times out, confirm the device IP/port and that LAN is enabled.
- If no samples appear, verify channel mask and sampling rate.