Skip to main content

Using services

The MoBro plugin SDK offers several services that can be used to easily handle or implement some of the most common use cases of a data plugin like support for settings or recurring tasks to poll sensor values.

Dependency Injection

Any service offered by the MoBro plugin SDK can simply be injected in the plugins' constructor like so:

Plugin.cs
public class Plugin : IMoBroPlugin
{
private readonly IMoBroService _mobro;
private readonly IMoBroScheduler _scheduler;
private readonly IMoBroSettings _settings;
private readonly ILogger _logger;

public Plugin(IMoBroService mobro, IMoBroScheduler scheduler, IMoBroSettings settings, ILogger logger)
{
_mobro = mobro;
_scheduler = scheduler;
_settings = settings;
_logger = logger;
}

[...]
}
note

In order for MoBro to be able to instantiate the plugin, the constructor must be public.

Injectable Services

The following interfaces are currently supported for dependency injection via the plugins constructor: