BenHW 0.9.0
dotnet add package BenHW --version 0.9.0
NuGet\Install-Package BenHW -Version 0.9.0
<PackageReference Include="BenHW" Version="0.9.0" />
<PackageVersion Include="BenHW" Version="0.9.0" />
<PackageReference Include="BenHW" />
paket add BenHW --version 0.9.0
#r "nuget: BenHW, 0.9.0"
#:package BenHW@0.9.0
#addin nuget:?package=BenHW&version=0.9.0
#tool nuget:?package=BenHW&version=0.9.0
BenHW .NET SDK
C# SDK for controlling Bentham spectroradiometer hardware.
Overview
The BenHW .NET SDK provides a modern, type-safe C# interface to the BenHW DLL for controlling Bentham Instruments hardware including monochromators, detectors, amplifiers, and other optical components.
Features
- Multi-targeting: Supports .NET Framework 4.8 and .NET 8
- Type-safe: Strong typing with structs for multi-value returns
- Exception-based error handling: Automatic error detection and meaningful exceptions
- Automatic DLL loading: Finds and loads the appropriate 32-bit or 64-bit DLL
- IDisposable: Proper resource management with automatic DLL unloading
Installation
Via NuGet
dotnet add package BenHW
Or via Package Manager Console:
Install-Package BenHW
Manual Installation
- Download the SDK package
- Reference
BenHW.dllin your project - Ensure the BenHW DLLs (
benhw32_cdecl.dllorbenhw64.dll) are in thedllssubdirectory
Quick Start
using BenHW;
// Create instance (automatically loads DLL)
using (var hw = new BenHW.BenHW())
{
// Build system model from configuration file
string errorMsg = hw.BuildSystemModel("system.cfg");
// Load setup attributes
hw.LoadSetup("system.atr");
// Initialize hardware
hw.Initialise();
// Select wavelength
int settleDelay = hw.SelectWavelength(500.0);
// Take a measurement
double reading = hw.Automeasure();
Console.WriteLine($"Reading: {reading}");
// Get/Set operations
hw.Set("mono", Tokens.MonochromatorCurrentWL, 0, 550.0);
double wavelength = hw.Get("mono", Tokens.MonochromatorCurrentWL, 0);
// Close (automatically called by Dispose)
hw.Close();
}
Error Handling
The SDK uses exceptions for error handling. All BenHW errors throw specific exception types:
try
{
hw.SelectWavelength(1000000.0); // Invalid wavelength
}
catch (BI_invalid_WL_Exception ex)
{
Console.WriteLine($"Invalid wavelength: {ex.Message}");
}
catch (SdkException ex)
{
Console.WriteLine($"SDK error: {ex.Message} (code: {ex.ErrorCode})");
}
License
Copyright (c) Bentham Instruments Ltd. All Rights Reserved.
Support
For support, contact Bentham Instruments Ltd or visit our website.
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net8.0 is compatible. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. net9.0 was computed. net9.0-android was computed. net9.0-browser was computed. net9.0-ios was computed. net9.0-maccatalyst was computed. net9.0-macos was computed. net9.0-tvos was computed. net9.0-windows was computed. net10.0 was computed. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. |
| .NET Framework | net48 is compatible. net481 was computed. |
-
.NETFramework 4.8
- No dependencies.
-
net8.0
- No dependencies.
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.