IEventSubscriber Delegates
This interface invokes a callback function to receive data and/or a detailed response. To register for the event(s), call the subscribeAll() function with the name of a class that implements the IEventSubscriber Delegate interface.
OnEvent
This is the handler for multiple event types.
public void OnEvent(
EventType eventType,
IData data);Parameter
Description
eventType
An enumeration for EventType. This indicates the event triggered by the device.
data
Contains the data for the event. The payload is dependent on the event type.
Return Value: None
Event implementation
The OnEvent method must be included and parameterized correctly as shown below to conform to the interface.
In this example, a separate class implements IEventSubscriber.
class OnEventClass : IEventSubscriber
{
public void OnEvent(EventType eventType, IData data)
{
// Event handler
}
}
OnEventClass eventCallBack = new OnEventClass();
device.subscribeAll(eventCallBack);In this example, the main window implements IEventSubscriber. The keyword “this” is used to pass in the name of the current class MainWindow.
Event Data Parsing
Classes can be initialized by passing in the data byte array. Example:
Last updated

