Class ZlgCanDevice
Represents a ZLG CAN device (supports all ZLG device types)
public class ZlgCanDevice : ICanDevice, IDisposable
- Inheritance
-
ZlgCanDevice
- Implements
- Inherited Members
Constructors
ZlgCanDevice(DeviceType, uint)
Creates a new ZLG CAN device instance
public ZlgCanDevice(DeviceType deviceType, uint deviceIndex = 0)
Parameters
deviceTypeDeviceTypeDevice type
deviceIndexuintDevice index (0-based, for multiple devices)
Properties
DeviceIndex
Device index (for multiple devices of same type)
public uint DeviceIndex { get; }
Property Value
DeviceInfo
Device information (hardware version, serial number, etc.)
public DeviceInfo? DeviceInfo { get; }
Property Value
DeviceType
public DeviceType DeviceType { get; }
Property Value
IsOpen
Whether the device is currently open
public bool IsOpen { get; }
Property Value
Methods
Close()
Closes the device and all its channels
public void Close()
Dispose()
Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.
public void Dispose()
~ZlgCanDevice()
Finalizer to ensure proper cleanup of device resources.
protected ~ZlgCanDevice()
GetDeviceInfo()
Gets device information
public DeviceInfo GetDeviceInfo()
Returns
- DeviceInfo
Device information
IsDeviceOnline()
Checks if the device is online
public bool IsDeviceOnline()
Returns
- bool
True if device is online, false otherwise
Open()
Opens the device
public void Open()
Exceptions
- DeviceOpenException
Thrown when device cannot be opened
OpenChannel(int, ChannelConfig)
Opens a CAN channel with the specified configuration
public ICanChannel OpenChannel(int channelIndex, ChannelConfig config)
Parameters
channelIndexintChannel index (0-based)
configChannelConfigChannel configuration
Returns
- ICanChannel
The opened channel
Exceptions
- ChannelInitException
Thrown when channel cannot be initialized