Gets the event from the server.
#include <peripheral_discovery.h>
int pd_get_event(pd_event_type_t *type, int *peripheral_id, pd_peripheral_t *peripheral)
BlackBerry 10.2.0
The type of event.
The peripheral id.
The peripheral from pd_alloc_peripheral() to populate. This will not be populated on PD_EVENT_REMOVAL.
Call this function after getting a notification event.
MsgReceive(chid, &pulse, sizeof(pulse), NULL);
// If you populated the sigevent value pointer, retrieve it now.
event_class = (pd_class_t) pulse.value.sival_ptr;
// Get the event that woke this thread up.
if( pd_get_event( &type, &peripheral_id, peripheral ) == EOK ) {
switch( type ) {
case PD_EVENT_INSERTION:
printf( "Peripheral Insertion. id=%d, class=%d\n",
peripheral_id, event_class );
// do something with peripheral
break;
case PD_EVENT_REMOVAL:
printf( "Peripheral Removal. id=%d, class=%d\n",
peripheral_id, event_class );
break;
}
}
EOK on success.