pd_register_event()

Registers an event for notifications.

Synopsis:

#include <peripheral_discovery.h>
 
int pd_register_event(pd_class_t class_id, struct sigevent *event)

Since:

BlackBerry 10.2.0

Arguments:

class_id

The class of peripherals you want to be notified of.

event

The sigevent to use as a notification.

Library:

libperipheral_discovery (For the qcc command, use the -l peripheral_discovery option to link against this library)

Description:

This event is delivered when peripherals are inserted or removed for a specific class. On registration, you will get a separate notification for each currently connected peripheral. After receiving a notification event, call pd_get_event() to get the event data.

This code sample shows how to register a pulse event for serial peripherals:
 #define MY_PULSE_CODE 1
 struct sigevent ev;
 // Initialize pulse sigevent.
 // You can add the class id to help identify events later, if you're
 // registering for multiple classes.
 SIGEV_PULSE_INIT( &ev, coid, SIGEV_PULSE_PRIO_INHERIT,
                   MY_PULSE_CODE, PD_CLASS_SERIAL );

 pd_register_event( PD_CLASS_SERIAL, &ev );

Returns:

EOK on success.