Skip to content

Releases: Dimo4ka174/FanucConsole

v1.0.0 — First public release

Choose a tag to compare

@Dimo4ka174 Dimo4ka174 released this 22 Sep 11:52

First stable release.

What this is

A console test harness for FANUC CNC controllers via the FOCAS Ethernet API. Connects to one or more machines, reads a fixed set of status registers, and optionally writes each poll to PostgreSQL.

Published as a reference for anyone wiring the FOCAS C API into .NET — the SDK is barely documented, and clean C# wrappers are rare.

Highlights

  • One IFocasNative interface, two platform implementations (FocasNativeWindows / FocasNativeLinux), picked at runtime.
  • Correct calling convention per platform (stdcall on Windows, cdecl on Linux) — the #1 source of hard-to-debug crashes in FOCAS integrations.
  • Struct marshaling mirrors fwlib32.h exactly, including union fields via [StructLayout(LayoutKind.Explicit)].
  • Twelve status registers per poll.
  • Optional PostgreSQL persistence (five tables).
  • Docker Compose and make targets.

Native libraries

The FANUC FOCAS SDK is not included — it's FANUC's property and can't be redistributed. See NativeLibs/README.md for how to obtain it.

Tested on

  • Windows 10 (x86 process, Fwlib32.dll)
  • Linux (x64 process, libfwlib32.so, inside Docker)

Three FANUC CNCs, all over Ethernet. Observations from that bench are in docs/focas-errors.md — including the EW_HANDLE behaviour and the registers that weren't available on those models.

Known limitations

  • EW_HANDLE (-8) after ~5–6 seconds on the tested machines; the service reconnects once per cycle.
  • No unit tests — behaviour against a real CNC can't be mocked faithfully.