IDevice
Base interface for all hardware device drivers. All device implementations must implement this interface.
Namespace: DeviceBase
Inheritance
This interface extends IDisposable.
Methods
Init
Initializes the device with configuration parameters.
void Init(Dictionary<string, object?> config);
Parameters:
config— A dictionary containing device-specific configuration parameters.
Usage Example
public class MyDevice : IDevice
{
public void Init(Dictionary<string, object?> config)
{
// Initialize device with configuration
if (config.TryGetValue("port", out var port))
{
// Configure port
}
}
public void Dispose()
{
// Clean up resources
}
}
Remarks
- All device drivers inherit from this base interface.
- The
Initmethod is called during device initialization to configure the hardware. - Implementations should properly implement
Disposeto release hardware resources.