For the complete documentation index, see llms.txt. This page is also available as Markdown.

IEventSubscriber Delegates

MTUSDKNET API will invoke the callback function in this chapter to provide the requested data and/or a detailed response. To delegate the event, call the subscribeAll function with the name of a class that implements the IEventSubscriber Delegates interface.

OnEvent

OnEvent handles all event types. The eventType parameter defines which event is triggered.

public void OnEvent( 
    EventType eventType, 
    IData data);
Parameter
Description

eventType

An enumeration indicating the event triggered by the device.

data

Contains the data for the event. The payload is dependent on the event type.

Return Value: None

Example

public class OnEventClass implements IEventSubscriber
{
    public void OnEvent(EventType eventType, IData data)
    {
        // Event handler
    }

}

OnEventClass eventCallBack = new OnEventClass(); 
device.subscribeAll(evenCallBack);

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