BPSEventHandler.cpp Example File
bpstoqml/src/BPSEventHandler.cpp
#include "BPSEventHandler.hpp"
#include <bps/event.h>
namespace bb {
namespace cascades {
namespace bps {
BPSEventHandler::BPSEventHandler() :
AbstractBpsEventHandler() {
}
BPSEventHandler::~BPSEventHandler() {
}
void BPSEventHandler::registerService(BlackBerryPlatformService *service) {
m_services << service;
service->requestEvents();
subscribe(service->eventDomain());
}
void BPSEventHandler::event(bps_event_t *event) {
if (event != NULL) {
int domain = bps_event_get_domain(event);
for (int i = 0; i < m_services.size(); ++i) {
BlackBerryPlatformService *service = m_services.at(i);
if (domain == service->eventDomain()) {
service->handleEvent(event);
}
}
}
}
}
}
}