Live demo — data resets daily at 03:00 UTC. Nothing you enter is saved. Server UI →

.NET Client API

Source: submodules/webapiclient/docs/ This file is a navigable summary. All detailed documentation lives in the source location above.


Package

dotnet add package AccordionQ2.WebApiClient

NuGet: AccordionQ2.WebApiClient Target: .NET Standard 2.0 (.NET 5+, .NET Framework 4.6.1+)


Quick Start

using AccordionQ2.WebApiClient;
using AccordionQ2.WebApiClient.Models;

using var client = new AccordionQ2Client("http://agent64.local:5000");

var status = await client.Connection.GetStatusAsync();
string temp = await client.Resources.GetValueAsync("TempRegulator.CPU_TEMP");

Constructor Overloads

// Managed HttpClient (default)
new AccordionQ2Client("http://agent64.local:5000")

// Externally managed HttpClient (e.g. from IHttpClientFactory)
new AccordionQ2Client("http://agent64.local:5000", httpClient)

AccordionQ2Client implements IDisposable. Use using var when managing its own HttpClient.


API Groups

Group Property Description
Connection client.Connection Check hardware manager connectivity
Resources client.Resources Read/write hardware values
Channels client.Channels Configure multi-purpose I/O channels
Modules client.Modules Load/unload modules, hardware topology
Application client.Application Lifecycle, configuration files
Media client.Media Upload/download media files
Calibration client.Calibration Read/write calibration tables
Comm client.Comm Raw bus transactions (I2C, UART, SPI, Socket)
NumericResults client.NumericResults High-speed sampling & statistics

Method Summary

Connection

ConnectionStatusDto status = await client.Connection.GetStatusAsync();
// status.IsConnected, status.LastError

Resources

string[]                     names  = await client.Resources.GetNamesAsync();
string                       value  = await client.Resources.GetValueAsync("Voltage.VDD");
await client.Resources.SetValueAsync("Output1", "2.5");
Dictionary<string, string>   values = await client.Resources.GetValuesAsync(new[] { "A", "B" });
await client.Resources.SetValuesAsync(new Dictionary<string,string> { ["A"]="1", ["B"]="2" });
string                       resp   = await client.Resources.TransactAsync("Eeprom.Read", "0x0010");

Channels

List<ChannelDto>  all = await client.Channels.GetAllAsync();
ChannelDto        ch  = await client.Channels.GetChannelAsync(alias: "MON_3V3");
await client.Channels.ConfigureAsync(new ChannelConfigRequest { Alias="MON_3V3", Unit="V" });
await client.Channels.ConfigureManyAsync(configs);

Modules

List<ModuleSettingsDto>  all     = await client.Modules.GetAllAsync();
List<ModuleSettingsDto>  loaded  = await client.Modules.GetLoadedAsync();
await client.Modules.LoadAsync(module);
await client.Modules.UnloadAsync(module);
PhysicalSystemDto        system  = await client.Modules.GetPhysicalSystemAsync();
List<AppLicenseDto>      apps    = await client.Modules.GetLicensedAppsAsync();

Application

string        name    = await client.Application.GetNameAsync();
ModuleStatus  status  = await client.Application.GetStatusAsync();
await client.Application.ResetAsync();
string[]      files   = await client.Application.ListConfigFilesAsync();
await client.Application.LoadConfigFileAsync("factory.cfg");
await client.Application.SaveConfigFileAsync("snapshot.cfg");
byte[]        data    = await client.Application.DownloadConfigFileAsync("factory.cfg");
await client.Application.UploadConfigFileAsync("factory.cfg", data);
await client.Application.DeleteConfigFileAsync("old.cfg");

Media

string[]  files = await client.Media.ListFilesAsync();
byte[]    data  = await client.Media.DownloadFileAsync("waveform.bin");
await client.Media.UploadFileAsync("waveform.bin", data);
await client.Media.DeleteFileAsync("old.bin");

Comm (Bus Transactions)

// I2C — all byte data is hex-encoded strings (e.g. "AABB")
var resp = await client.Comm.I2cAsync(new I2cTransactionRequest
{
    DeviceName = "0.ESH10000597.I2C00", Address = "50",
    Action = BusActions.SendReceive,
    DataToSend = "00", NumberOfBytesToReceive = 2,
});

// UART
var resp = await client.Comm.UartAsync(new UartTransactionRequest { ... });

// SPI
var resp = await client.Comm.SpiAsync(new SpiTransactionRequest { ... });

// Socket (TCP/IP)
var resp = await client.Comm.SocketAsync(new SocketTransactionRequest
{
    HostName = "192.168.1.10", Port = 5025, ...
});

Calibration

var channels = await client.Calibration.GetChannelsAsync();
var table    = await client.Calibration.GetTableAsync(channels[0].NetName);
await client.Calibration.SetTableAsync(channels[0].NetName, updated);

Numeric Results

var channels = await client.NumericResults.GetChannelsAsync();
string[] targets = await client.NumericResults.GetTargetsAsync(channels[0].NetName);
var meta = await client.NumericResults.MeasureAsync(new NumericMeasureRequest
{
    ChannelNetName = channels[0].NetName,
    TargetNetName  = targets[0],
    Samples = 1000, ReducedSet = true,
});
double mean  = await client.NumericResults.GetMeanAsync(channels[0].NetName);
double stdev = await client.NumericResults.GetStdDevAsync(channels[0].NetName);
double[] raw = await client.NumericResults.GetSamplesAsync(channels[0].NetName); // ReducedSet must be false

Error Handling

try { ... }
catch (AccordionQ2ApiException ex)
{
    Console.WriteLine($"HTTP {ex.StatusCode}: {ex.Message}");
}
// Network errors: HttpRequestException
HTTP Cause
400 Invalid params; or GetSamples called after ReducedSet=true
404 Channel / resource / file not found
500 Hardware manager error

Full Documentation

An unhandled error has occurred. Reload 🗙

Rejoining the server...

Rejoin failed... trying again in seconds.

Failed to rejoin.
Please retry or reload the page.

The session has been paused by the server.

Failed to resume the session.
Please retry or reload the page.