SysEvent_RegisterForEventNotifications Function
Header: #include <applibs/sysevent.h>
Registers the application with a set of events.
Note
There must only be one active EventRegistration struct at a time for all system event notifications.
EventRegistration *SysEvent_RegisterForEventNotifications(EventLoop *el, SysEvent_Events eventBitmask SysEvent_EventsCallback callback_function, void *context);
Parameters
el
The event loop to which theEventRegistration
is registered.eventBitmask
A bitmask that indicates the event types to listen to.callbackFunction
A function handler that is called when the state of an event ineventBitmask
changes.context
An optional user context pointer that is passed to the events callback when an event occurs.
Errors
Returns NULL if an error is encountered and sets errno
to the error value.
- EACCES: The application doesn't have the SystemEventNotifications capability.
- EFAULT: The
el
orcallback_function
parameter is NULL. - EINVAL: The
eventBitmask
specifies invalid events.
Any other errno
may also be specified, but the same behavior might not be retained through system updates.
Return value
Returns a pointer to an EventRegistration struct, or NULL, in which case errno
is set to the error value.
Remarks
The EventRegistration struct that is returned needs to be retained until it is passed to SysEvent_UnregisterForEventNotifications.
Application manifest requirements
The application manifest must include the SystemEventNotifications capability.