mme_register_for_events()

Register and unregister for events from the MME

Synopsis:

#include <mme/mme.h>

int mme_register_for_events( mme_hdl_t *hdl,
                             mme_event_class_t event_class,
                             struct sigevent *event );

Arguments:

hdl
The MME connection handle.
event_class
The MME event class or classes for which the client application wants to register or unregister.
event
The event to have delivered when it is received. To unregister for the specified class set event to NULL.

Library:

mme

Description:

The function mme_register_for_events() allows the client application to determine the events it wants to receive from the MME.

Register for events

The MME does not deliver events to a client application unless it is specifically instructed to do so. To receive events from the MME, a client application must register for events after connecting to the MME, specifying the class or classes of events it wants to receive.

The client application must register after each connection. This feature allows the client application to register different different classes of events for connections. For example, a connection used to handle synchronizations can register for synchronization events, but not for playback events, because it will never call functions that deliver playback events.

Each event class has a different sigevent. When it has registered for an event class, the client application has told the MME which sigevents it wants to receive. When it has a relevant event, the MME will:

The client application can then decide from the sigevent if it needs to see the associated event. When it needs to see events, the client application can use the function mme_get_event() to have them delivered from the MME's event queue.

Unregister for events

To stop receiving a class of events, the client application must unregister for that event class. To unregister for an event class, call the function mme_register_for_events() with the event_class set to the event class for which you want to stop receiving events, and the argument event set to NULL.

If the client application has registered for several or all event classes, it can unregister for any event class without affecting the registration for the other event classes. For example:

mme_register_for_events( hdl, MME_EVENT_CLASS_ALL, &event );

// Do some work here.

mme_register_for_events( hdl, MM_EVENT_CLASS_COPY, NULL);

MME event classes

mme_event_classes_t defines the different MME event classes as bitmasks:

MME_EVENT_CLASS_PLAY
Playback events.
MME_EVENT_CLASS_SYNC
Synchronization events.
MME_EVENT_CLASS_COPY
Copying and ripping events.
MME_EVENT_CLASS_GENERAL
Events not specified in the other classes.
MME_EVENT_CLASS_ALL
All events.

The MME event classes are bitmasks. They can be used together with an OR operator to register for several events at once. For example, to register for playback and synchronization events call the function mme_register_for_events() as follows:

mme_register_for_events( hdl,
                         MME_EVENT_CLASS_PLAY | MME_EVENT_CLASS_SYNC,
                         event);

For more information about events, see the chapter MME Events and following.

Events

None delivered.

 

Blocking and validation

This function doesn't block.

Returns:

0
Success.
-1
An error occurred (errno is set).

Classification:

QNX Neutrino

Safety:
Interrupt handler No
Signal handler No
Thread Yes

See also:

mme_connect(), mme_disconnect(), mme_get_event(), MME Events