ObisLaser.Net
0.2.0
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
<PackageReference Include="ObisLaser.Net" Version="0.2.0" />
<PackageVersion Include="ObisLaser.Net" Version="0.2.0" />
<PackageReference Include="ObisLaser.Net" />
paket add ObisLaser.Net --version 0.2.0
#r "nuget: ObisLaser.Net, 0.2.0"
#:package ObisLaser.Net@0.2.0
#addin nuget:?package=ObisLaser.Net&version=0.2.0
#tool nuget:?package=ObisLaser.Net&version=0.2.0
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()andGetState()combine several exchanges; for fast loops, call the specific getters you need, e.g.GetPower()orGetStatus(). - 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(withCodeandDescription), missing replies throwObisTimeoutException. All exceptions derive fromObisException. - On connection, the client enables message handshaking (
OK/ERRreplies) 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 | 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 | net472 is compatible. net48 was computed. net481 was computed. |
-
.NETFramework 4.7.2
- No dependencies.
-
net8.0
- System.IO.Ports (>= 8.0.0)
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.