PushNotificationService.hpp Example File
pushCollector/10.0/pushCollector/src/service/PushNotificationService.hpp
#ifndef PUSHNOTIFICATIONSERVICE_HPP
#define PUSHNOTIFICATIONSERVICE_HPP
#include "PushHandler.hpp"
#include "PushNotificationService.hpp"
#include "RegisterService.hpp"
#include "UnregisterService.hpp"
#include <bb/network/PushService>
#include <bb/network/PushStatus>
#include <QObject>
#include <QVariantList>
#define INVOKE_TARGET_KEY_PUSH "com.example.pushCollector.invoke.push"
#define INVOKE_TARGET_KEY_OPEN "com.example.pushCollector.invoke.open"
class PushNotificationService : public QObject
{
Q_OBJECT
public:
PushNotificationService(QObject *parent = 0);
void createSession();
void createChannel();
void registerToLaunch();
void unregisterFromLaunch();
User getCurrentlyRegisteredUser();
void subscribeToPushInitiator(const User &user, const QString &token);
void unsubscribeFromPushInitiator(const User &user);
void destroyChannel();
void initializePushService();
void acceptPush(const QString &payloadId);
void rejectPush(const QString &payloadId);
bool checkForDuplicatePush(const PushHistoryItem &pushHistoryItem);
int savePush(const Push &push);
Push push(int pushSeqNum);
QVariantList pushes();
bool removePush(int pushSeqNum);
bool removeAllPushes();
bool removeAllPushHistory();
bool markPushAsRead(int pushSeqNum);
bool markAllPushesAsRead();
void handleSimChange();
Q_SIGNALS:
void createSessionCompleted(const bb::network::PushStatus &status);
void createChannelCompleted(const bb::network::PushStatus &status, const QString &token);
void destroyChannelCompleted(const bb::network::PushStatus &status);
void registerToLaunchCompleted(const bb::network::PushStatus &status);
void unregisterFromLaunchCompleted(const bb::network::PushStatus &status);
void simChanged();
void pushTransportReady(bb::network::PushCommand::Type command);
void piRegistrationCompleted(int code, const QString &description);
void piDeregistrationCompleted(int code, const QString &description);
void noPushServiceConnection();
void allPushesRemoved();
private:
ConfigurationService m_configurationService;
bb::network::PushService *m_pushService;
QString m_previousApplicationId;
RegisterService m_registerService;
UnregisterService m_unregisterService;
UnregisterService m_simChangeUnregisterService;
PushHandler m_pushHandler;
};
#endif