How to write a driver

This section shows how to write drivers for your shop's PLCs, code readers, and specialized devices in x4Trace.
Post Reply
x4Trace
Posts: 58
Joined: Fri Feb 14, 2025 2:24 pm

How to write a driver

Post by x4Trace »

The driver communicates with devices, and the line modules handle the drivers. You can develop a driver for your line, a camera, a PLC, or a unique device.

How to write a driver: You need Visual Studio, and you can develop C# or VB.

Samples are in the installed folder of the x4Trace server (x4Trace.Server.Drivers). To view how to write a driver, open the x4Trace.Server.UserPlugins.sln solution. If you need a new driver, the best way is to create a new file, copy an existing driver code, and modify the copied code.

You have to use this DLL: Ix4Trace.Server.Engine.dll

Create a class that inherits from IDriver.

The documentation of the coding you can find at https://docs.x4trace.com/sw/index.html

After the coding, build the project and copy your DLL with all dependencies to the x4Trace server and Drivers folder.

Important: If you modify an existing driver of x4Trace and your server uses that driver, it may not work. Therefore, if you need a new driver, create a new one from an existing one and rename it.
Post Reply