ObisLaser.Net 0.2.0

There is a newer version of this package available.
See the version list below for details.
dotnet add package ObisLaser.Net --version 0.2.0
                    
NuGet\Install-Package ObisLaser.Net -Version 0.2.0
                    
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="ObisLaser.Net" Version="0.2.0" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="ObisLaser.Net" Version="0.2.0" />
                    
Directory.Packages.props
<PackageReference Include="ObisLaser.Net" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add ObisLaser.Net --version 0.2.0
                    
#r "nuget: ObisLaser.Net, 0.2.0"
                    
#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.
#:package ObisLaser.Net@0.2.0
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=ObisLaser.Net&version=0.2.0
                    
Install as a Cake Addin
#tool nuget:?package=ObisLaser.Net&version=0.2.0
                    
Install as a Cake Tool

ObisLaser.Net

.NET client for Coherent OBIS LX/LS lasers, over USB or RS-232. It covers the whole host command set from the OBIS LX/LS Operator's Manual: device metadata, emission and power control, operating modes, temperatures, status and fault words, the error queue and persistent settings. Every method has a synchronous and an asynchronous (...Async) version.

Targets net472 and net8.0.

OBIS and Coherent are trademarks of Coherent Corp. This project is not affiliated with or endorsed by Coherent.

Install

dotnet add package ObisLaser.Net

Quick start

using ObisLaser.Net;

using var laser = Laser.Open("COM3");

var info = laser.GetInfo();
Console.WriteLine($"{info.Model} (S/N {info.SerialNumber}), {info.Wavelength} nm");

laser.SetOperatingMode(OperatingMode.Cwp);
laser.SetPower(0.010);                     // watts
laser.SetEmission(true);
Console.WriteLine(await laser.GetStateAsync());
laser.SetEmission(false);

Units are SI as used by the device: power in watts, current in amperes, temperatures in degrees Celsius.

Several lasers behind an OBIS Remote or LaserBox

Channel 0 is the controller; lasers are numbered from 1.

using var connection = ObisConnection.Open("COM3");
var blue = connection.GetLaser(1);
var green = connection.GetLaser(2);
blue.SetPower(0.02);
connection.Broadcast("SOUR:AM:STAT ON");   // every laser at once

Finding lasers

foreach (var device in ObisDiscovery.FindAll(excludedPortNames: new[] { "COM1" }))
{
    Console.WriteLine($"{device.PortName} channel {device.Channel}: {device.Model} ({device.SerialNumber})");
}

OBIS lasers and controllers connected over USB are recognized by Coherent's USB vendor ID (0x0D4D) without opening any port: ObisDiscovery.GetCandidatePortNames() lists them (on Windows only). FindAll probes these ports, or every serial port if there are none, for example when the laser is connected over RS-232 through a USB adapter.

Probing sends *IDN? to each port, so it may disturb other serial devices (it does not change any setting on them). Pass portNames to choose the ports to probe, for example SerialPort.GetPortNames() to probe them all, or excludedPortNames to skip ports.

Anything else

Every command is available as a request in ObisProtocol, and raw commands can be sent:

double wavelength = laser.Execute(ObisProtocol.GetWavelength());
IReadOnlyList<string> reply = laser.Query("SYST:INF:FVER?");

Online control

  • Each call is a single request/reply exchange (a few milliseconds at 115200 baud). GetInfo() and GetState() combine several exchanges; for fast loops, call the specific getters you need, e.g. GetPower() or GetStatus().
  • Connections are thread-safe: exchanges are serialized, and asynchronous requests run in the order they are made. Cancellation applies while a request waits for its turn; once sent, a request always completes so replies stay in sync.
  • Device errors throw ObisDeviceException (with Code and Description), missing replies throw ObisTimeoutException. All exceptions derive from ObisException.
  • On connection, the client enables message handshaking (OK/ERR replies) if it is off. This setting is stored in the laser.

Repository layout

src/ObisLaser.Net/          library (net472; net8.0)
tests/ObisLaser.Net.Tests/  unit tests against a simulated device (no hardware needed)

Development

dotnet build
dotnet test
dotnet pack -c Release    # -> artifacts/package/release/

Requires the .NET 8 SDK or later. Running the net472 tests requires Windows.

Testing with a real laser

The Hardware test category runs against a real device. It is skipped unless OBIS_PORT is set, and always skipped in CI (when CI is set). Only settings that are restored to their original value are written.

$env:OBIS_PORT = "COM3"
$env:OBIS_CHANNEL = "0"           # optional: laser behind an OBIS Remote / LaserBox
$env:OBIS_TEST_EMISSION = "1"     # optional: also turn emission ON (5 % of max power)
dotnet test -f net8.0 --filter TestCategory=Hardware --logger "console;verbosity=detailed"

Block the beam before enabling OBIS_TEST_EMISSION.

License

MIT

Product 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 net472 is compatible.  net48 was computed.  net481 was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages (1)

Showing the top 1 NuGet packages that depend on ObisLaser.Net:

Package Downloads
BFC.ObisLaser

Bonsai operators to control Coherent OBIS LX/LS lasers (unofficial, not affiliated with Coherent).

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
0.2.1 189 11/24/2026
0.2.0 266 11/23/2026
0.1.0 162 11/23/2026