Horiba.Sdk 1.0.2

There is a newer version of this package available.
See the version list below for details.
dotnet add package Horiba.Sdk --version 1.0.2                
NuGet\Install-Package Horiba.Sdk -Version 1.0.2                
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="Horiba.Sdk" Version="1.0.2" />                
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add Horiba.Sdk --version 1.0.2                
#r "nuget: Horiba.Sdk, 1.0.2"                
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
// Install Horiba.Sdk as a Cake Addin
#addin nuget:?package=Horiba.Sdk&version=1.0.2

// Install Horiba.Sdk as a Cake Tool
#tool nuget:?package=Horiba.Sdk&version=1.0.2                

Introduction

This SDK is created to streamline the configuration and usage of hardware produced by Horiba. This icludes ChargetCoupleDevices and Monochromators. On top of the hardware devices, Horiba develops propriatery communication layer based on WebSocket connection. This layer is encapsulated in a process called ICL. ICL needs to be licensed and installed on a PC which has USB connection to the hardware. Once this is setup and ready, this SDK comes to play.

C# developers can use this SDK to offload the complexity related to establishing and maintaining connection to both the ICL and the hardware devices. This will allow them to focus on building the solution they need from the get go.


⬇️⬇️⬇️⬇️⬇️⬇️⬇️⬇️⬇️⬇️⬇️⬇️⬇️⬇️⬇️⬇️⬇️⬇️⬇️⬇️⬇️⬇️⬇️⬇️⬇️⬇️⬇️⬇️⬇️⬇️⬇️

[!WARNING]
This SDK is under development and not yet released.

[!IMPORTANT]
For this .NET code to work, the SDK from Horiba has to be purchased, installed and licensed. The code in this repo and the SDK are under development and not yet released for public use!

⬆️⬆️⬆️⬆️⬆️⬆️⬆️⬆️⬆️⬆️⬆️⬆️⬆️⬆️⬆️⬆️⬆️⬆️⬆️⬆️⬆️⬆️⬆️⬆️⬆️⬆️⬆️⬆️⬆️⬆️⬆️


📦 Prerequisites

  • .NET Standard or .NET 6+
  • ICL.exe installed as part of the Horiba SDK, licensed and activated

API reference is available at

https://thatstheend.github.io/horiba-dotnet-sdk/docs/api/Horiba.Sdk.html

ICL Commands Status available at

https://thatstheend.github.io/horiba-dotnet-sdk

Getting started

This project is built and deployed to Nuget.org. Installing it in a project can be done by the .NET CLI like so:

dotnet add package Horiba.Sdk

After having the package referenced in the project, you are ready to start using it.

DeviceManager

This is the entry point of the SDK. It is responsible for:

  • starting up the ICL process
  • maintaining the WebSocket connection
  • discoverty process for different device types
using var deviceManager = new DeviceManager();
await deviceManager.StartAsync();

Note the using declaration, this is needed to ensure proper disposal of all resources utilized by the DeviceManager. If the class is not properly disposed, multiple instances of the ICL.exe process might be left running. This can lead to inconsistent communication between available hardware and deviceManager.

After completion of the StartAsync() method, the collections of devices of the DeviceManager will be populated with concreat devices

Access specific device
var ccd = deviceManager.ChargedCoupledDevices.First();
var mono = deviceManager.Monochromators.First();

By keeping reference to the concreate device you can access all functionalities it supports. The first step should be to establish the USB connection to the device. This is done by invoking the OpenConnectionAsync() method

await ccd.OpenConnectionAsync();
await mono.OpenConnectionAsync();

If no CommunicationException is thrown, a connection will be established.

After establishing connection, you can start invoking the rest of the available commands

Interacting with a device
var ccdConfig = await ccd.GetDeviceConfigurationAsync();
var monoConfig = await mono.GetDeviceConfigurationAsync();

Now you are ready to start implementing the functionality that best suites your case.

How To?

Read actual data from CCD
  • Create new ConsoleApplication
dotnet new console --framework net8.0
  • Install the Nuget package
dotnet add package Horiba.Sdk
  • Open the Program.cs file and update the implementation
using Horiba.Sdk.Devices;
using Horiba.Sdk.Enums;

using var deviceManager = new DeviceManager();
await deviceManager.StartAsync();
var ccd = deviceManager.ChargedCoupledDevices.First();
await ccd.OpenConnectionAsync();

await ccd.SetAcquisitionCountAsync(1);
await ccd.SetExposureTimeAsync(1500);
await ccd.SetRegionOfInterestAsync(RegionOfInterest.Default);
await ccd.SetXAxisConversionTypeAsync(ConversionType.None);

Dictionary<string, object> data = [];
if (await ccd.GetAcquisitionReadyAsync())
{
    await ccd.SetAcquisitionStartAsync(true);
    
    // This method will start a polling procedure after 1s initial delay
    // this initial delay is needed to allow the device to start the acquisition.
    // The interval of the polling procedure is set to be 300ms
    // every iteration of the polling procedure will check if the device is busy
    // by sending a request to the device.
    // The method will return when the device is not busy anymore
    await ccd.WaitForDeviceNotBusy(TimeSpan.FromSeconds(1), TimeSpan.FromMilliseconds(300));
    
    data = await ccd.GetAcquisitionDataAsync();
}
        
var acquisitionRawData = data.GetValueOrDefault("acquisition");
var timestamp = data.GetValueOrDefault("timestamp");

The raw data will be in the shape of Dictionary<string, object> you will be able to extract the interesting data as per your needs.

However, if you need to use JSON deserialization functionality to work with typed objects, you can take a look at the Horiba.Sdk.Tests.AcquisitionDescription.cs class and use it to deserialize the data into.

var parsedData = JsonConvert.DeserializeObject<List<AcquisitionDescription>>(acquisitionRawData.ToString());
Product Compatible and additional computed target framework versions.
.NET net5.0 was computed.  net5.0-windows was computed.  net6.0 was computed.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net7.0 is compatible.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  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. 
.NET Core netcoreapp3.0 was computed.  netcoreapp3.1 was computed. 
.NET Standard netstandard2.1 is compatible. 
MonoAndroid monoandroid was computed. 
MonoMac monomac was computed. 
MonoTouch monotouch was computed. 
Tizen tizen60 was computed. 
Xamarin.iOS xamarinios was computed. 
Xamarin.Mac xamarinmac was computed. 
Xamarin.TVOS xamarintvos was computed. 
Xamarin.WatchOS xamarinwatchos was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
1.0.4 91 7/11/2024
1.0.3 107 4/23/2024
1.0.2 105 4/22/2024
1.0.1 108 4/17/2024
1.0.0 108 4/15/2024

Initial pipeline deployment