IEventPublisher
Interface in Oadm.Sdk.Events · Oadm.Sdk.dll
Publishes events to the server’s event rules. Fire and forget: calls only queue (never block, never throw for a full queue) and may come from any thread. Only the source’s own event types are accepted.
Contract for stateful types: off is the default, no initial value is declared. After every start (and after being turned on) a source sends one IEventPublisher.ReplaceStates per stateful type it serves: that is its “ready”; until then the server keeps the states it stored before the restart and runs nothing for the type. Later it may send IEventPublisher.SetState per change or IEventPublisher.ReplaceStates again at any time (e.g. after each check round): the server works out what changed. A source that is turned off counts as ReplaceStates(type, []).
public interface IEventPublisherGuide: Event rules
Methods
Section titled “Methods”void Fire(string typeId, Guid? deviceId, IReadOnlyDictionary<string, string>? data = null)Stateless: the event happened.
IsWatched
Section titled “IsWatched”bool IsWatched(string typeId)Whether an enabled rule uses the type: a source may skip work nobody needs.
ReplaceStates
Section titled “ReplaceStates”void ReplaceStates(string typeId, IReadOnlyCollection<Guid> onDevices)Stateful: the full picture of one type. Every device in onDevices is on, every other device is off. Server-scoped types: an empty list is off, a list with Guid.Empty is on.
SetState
Section titled “SetState”void SetState(string typeId, Guid? deviceId, bool isOn, IReadOnlyDictionary<string, string>? data = null)Stateful: the event turned on or off for a device (null device for server-scoped types).