OviNotificationSession Class Reference

#include <mw/cwrt/ovinotificationsession.h>

Link against: oneplugin.lib

class OviNotificationSession : public QObject, public OviNotificationInterface, public QObject, public OviNotificationInterface

Ovi notification session class implementing OviNotificationInterface. This class provides the signals to be connected for receiving the right callbacks.

Inherits from

Public Slots
virtual voidgetNotificationInformation(const QString &)
virtual voidgetVersion()
virtual boolisAudioNotification()
virtual boolisNotificationUi()
virtual boolisNotificationUiUpdate()
virtual boolisWakeUp()
virtual voidmarkConsumed(const QStringList &)
virtual voidregisterApplication(const QString &)
virtual voidsetAudioNotification(bool)
virtual boolsetNotificationUi(bool, const QString &)
virtual voidsetNotificationUiUpdate(bool)
virtual voidsetWakeUp(bool)
virtual voidunregisterApplication()
Public Signals
voidnotificationInformation(QObject *)
voidreceived(QObject *)
voidstateChanged(QObject *)
voidversion(QString)
Inherited Attributes
QObject::d_ptr
QObject::objectName
QObject::staticQtMetaObject
Inherited Functions
QObject::QObject(QObjectPrivate &,QObject *)
QObject::blockSignals(bool)
QObject::childEvent(QChildEvent *)
QObject::children()const
QObject::connect(const QObject *,const QMetaMethod &,const QObject *,const QMetaMethod &,Qt::ConnectionType)
QObject::connect(const QObject *,const char *,const QObject *,const char *,Qt::ConnectionType)
QObject::connect(const QObject *,const char *,const char *,Qt::ConnectionType)const
QObject::connectNotify(const char *)
QObject::customEvent(QEvent *)
QObject::deleteLater
QObject::destroyed
QObject::disconnect(const QObject *,const QMetaMethod &,const QObject *,const QMetaMethod &)
QObject::disconnect(const QObject *,const char *)
QObject::disconnect(const QObject *,const char *,const QObject *,const char *)
QObject::disconnect(const char *,const QObject *,const char *)
QObject::disconnectNotify(const char *)
QObject::dumpObjectInfo()
QObject::dumpObjectTree()
QObject::dynamicPropertyNames()const
QObject::event(QEvent *)
QObject::eventFilter(QObject *,QEvent *)
QObject::findChild(const QString &)const
QObject::findChildren(const QRegExp &)const
QObject::findChildren(const QString &)const
QObject::inherits(const char *)const
QObject::installEventFilter(QObject *)
QObject::isWidgetType()const
QObject::killTimer(int)
QObject::moveToThread(QThread *)
QObject::objectName()const
QObject::parent()const
QObject::property(const char *)const
QObject::receivers(const char *)const
QObject::registerUserData()
QObject::removeEventFilter(QObject *)
QObject::sender()const
QObject::senderSignalIndex()const
QObject::setObjectName(const QString &)
QObject::setParent(QObject *)
QObject::setProperty(const char *,const QVariant &)
QObject::setUserData(uint,QObjectUserData *)
QObject::signalsBlocked()const
QObject::startTimer(int)
QObject::thread()const
QObject::timerEvent(QTimerEvent *)
QObject::userData(uint)const
QObject::~QObject()

Member Function Documentation

getNotificationInformation ( const QString & )

voidgetNotificationInformation(const QString &aServiceId = "")[virtual, slot]

Retrieve user information used by Notifications Enabler. Requested information is returned by emitting OviNotificationSession::notificationInformation(QObject* ) signal. The information contains the user account used by application. This value could be empty in case of the service is not available or the request has timedout. The signal stateChanged(QObject* ) with OviNotificationState::StateError OviNotificationState::EErrorInvalidServiceId is emitted if the passed ServiceId is invalid.

This function should be called when session state is OviNotificationState::EStateOnline. The stateChanged(QObject* ) signal would be emitted with OviNotificationState::StateError OviNotificationState::EErrorNotAllowed in the following cases
  1. If this function is called in state other than OviNotificationState::EStateOnline.

  2. If the function is trying to call before the previous request has not been processed by the Notifications Enabler.

Retrieve user information used by Notifications Enabler. Requested information is returned by emitting OviNotificationSession::notificationInformation(QObject* ) signal. The information contains the user account used by application. This value could be empty in case of the service is not available or the request has timedout. The signal stateChanged(QObject* ) with OviNotificationState::StateError OviNotificationState::EErrorInvalidServiceId is emitted if the passed ServiceId is invalid.

This function should be called when session state is OviNotificationState::EStateOnline. The stateChanged(QObject* ) signal would be emitted with OviNotificationState::StateError OviNotificationState::EErrorNotAllowed in the following cases If this function is called in state other than OviNotificationState::EStateOnline. If the function is trying to call before the previous request has not been processed by the Notifications Enabler.

aServiceId If wakeup is true then the application is woken up in the event of ovi notifications.

See also: notificationInformation()

Parameters
aServiceIdIf wakeup is true then the application is woken up in the event of ovi notifications.

getVersion ( )

voidgetVersion()[virtual, slot]

Retrieve version information. Requested version information is returned in OviNotificationSession::version() signal.

Retrieve version information. Requested version information is returned in OviNotificationSession::version() signal.

See also: version()

isAudioNotification ( )

boolisAudioNotification()[virtual, slot]

Getter for the audio notification. This function should be called when session state is OviNotificationState::EStateOnline. If the function is called in any other state then stateChanged signal would be emitted with OviNotificationState::EErrorNotAllowed which indicates the values returned by this function are not valid.

Returns true if the audion notificaiton setting is true otherwise returns false.

Getter for the audio notification. This function should be called when session state is OviNotificationState::EStateOnline. If the function is called in any other state then stateChanged signal would be emitted with OviNotificationState::EErrorNotAllowed which indicates the values returned by this function are not valid.

See also: isAudioNotification()

Return Value
Returns true if the audio notification setting is true otherwise returns false.

isNotificationUi ( )

boolisNotificationUi()[virtual, slot]

Getter for the notification UI. This function should be called when session state is OviNotificationState::EStateOnline. If the function is called in any other state then stateChanged signal would be emitted with OviNotificationState::EErrorNotAllowed which indicates the values returned by this function are not valid.

Getter for the notification UI. This function should be called when session state is OviNotificationState::EStateOnline. If the function is called in any other state then stateChanged signal would be emitted with OviNotificationState::EErrorNotAllowed which indicates the values returned by this function are not valid.

See also: setNotificationUi()

Return Value
Returns true if the NotificationUi setting is true otherwise returns false.

isNotificationUiUpdate ( )

boolisNotificationUiUpdate()[virtual, slot]

Getter for the Notification Ui update value. This function should be called when session state is OviNotificationState::EStateOnline. If the function is called in any other state then stateChanged signal would be emitted with OviNotificationState::EErrorNotAllowed which indicates the values returned by this function are not valid.

Returns true if the NotificationUi update setting is true otherwise returns false.

Getter for the Notification Ui update value. This function should be called when session state is OviNotificationState::EStateOnline. If the function is called in any other state then stateChanged signal would be emitted with OviNotificationState::EErrorNotAllowed which indicates the values returned by this function are not valid.

See also: isNotificationUiUpdate()

Return Value
Returns true if the NotificationUi update setting is true otherwise returns false.

isWakeUp ( )

boolisWakeUp()[virtual, slot]

Getter for the wakeup. This function should be called when session state is OviNotificationState::EStateOnline. If the function is called in any other state then stateChanged signal would be emitted with OviNotificationState::EErrorNotAllowed which indicates the values returned by this function are not valid. Returns true if the wakeup setting is true otherwise returns false.

Getter for the wakeup. This function should be called when session state is OviNotificationState::EStateOnline. If the function is called in any other state then stateChanged signal would be emitted with OviNotificationState::EErrorNotAllowed which indicates the values returned by this function are not valid.

See also: setWakeUp()

Return Value
Returns true if the wakeup setting is true otherwise returns false.

markConsumed ( const QStringList & )

voidmarkConsumed(const QStringList &markConsumed)[virtual, slot]
Informs stack that the notifications received by the application has been consumed. This is an asynchronous method. This function wmust be used only if the Notification Ui update is set as true else it will have no effect. This function should be called when session state is OviNotificationState::EStateOnline. The stateChanged(QObject* ) signal would be emitted with OviNotificationState::StateError OviNotificationState::EErrorNotAllowed in the following cases
  1. If this function is called in state other than OviNotificationState::EStateOnline.

  2. If the function is trying to set value before the previous value has not been saved in the Notifications Enabler.

For application using Notification Ui update flag alongwith Notification Ui flag, they must ensure that once they receive the notification and have processed it, they must call this API and pass the messageIds of the notifications which are processed, those notifications will be removed from the Notification Ui. In case Notification UI update flag is not set then the Notification Ui will remove the message after it has been delivered to the application, this API will have no effect. Stores the notificaiton Ui update settings in the stack.

Informs stack that the notifications received by the application has been consumed.This is an asynchronous method. This function wmust be used only if the Notification Ui update is set as true else it will have no effect. This function should be called when session state is OviNotificationState::EStateOnline. The stateChanged(QObject* ) signal would be emitted with OviNotificationState::StateError

OviNotificationState::EErrorNotAllowed in the following cases If this function is called in state other than OviNotificationState::EStateOnline. If the function is trying to set value before the previous value has not been saved in the Notifications Enabler. For application using Notification Ui update flag alongwith Notification Ui flag, they must ensure that once they receive the notification and have processed it, they must call this API and pass the messageIds of the notifications which are processed, those notifications will be removed from the Notification Ui. In case Notification UI update flag is not set then the Notification Ui will remove the message after it has been delivered to the application, this API will have no effect. Stores the notificaiton Ui update settings in the stack.

aMessageIds List of notification Ids which are processed by the application and wants to remove from NUI.

See also: markConsumed()

Parameters
markConsumedList of notification Ids which are processed by the application and wants to remove from NUI.

notificationInformation ( QObject * )

voidnotificationInformation(QObject *aData)[signal]

NotificationInfo signal.

Signal emitted when NotificationInfo message has been received.

      // Load the service and get the service object
      connect(serviceObject,SIGNAL(notificationInfo(QObject*)),
                            SLOT(notificationInfoResponse(QObject*)));

      // Signal handling
      OviNotificationInfo* notificationInfo = static_cast<OviNotificationInfo*>(object);
      

This signal emitted when NotificationInfo message has been received.

// Load the service and get the service object
connect(serviceObject,SIGNAL(notificationInfo(QObject*)),
					SLOT(notificationInfoResponse(QObject*)));

// Signal handling
OviNotificationInfo* notificationInfo = static_cast<OviNotificationInfo*>(object);

aData OviNotificationInfo Object

See also: getNotificationInformation()

Parameters
aDataOviNotificationInfo Object

received ( QObject * )

voidreceived(QObject *aNotification)const [signal]

Signal is emitted when application receives notification

      // Load the service and get the service object
      connect(serviceObject,SIGNAL(received(QObject)), SLOT(receivedClb(QObject)));
      // Signal handling
      OviNotificationMessage* notification = static_cast<OviNotificationMessage*>(object);
      

This signal is emitted when application receives notification

  // Load the service and get the service object
  connect(serviceObject,SIGNAL(received(QObject)), SLOT(receivedClb(QObject)));
  // Signal handling
  OviNotificationMessage* notification = static_cast<OviNotificationMessage*>(object);

aNotification OviNotificationMessage containing the Ownership is passed.

Parameters
aNotificationOviNotificationMessage containing the Ownership is passed.

registerApplication ( const QString & )

voidregisterApplication(const QString &aApplicationId)[virtual, slot]

Registers Notifications Enabler application.

This is an asynchronous method. It is mandatory to call this method before Ovi Notifications can be used.

If registration is successful Notifications Enabler will open a network connection if not open already. OviNotificationSession::stateChanged signal is emitted with EStateConnecting and EStateOnline after successful registration. Otherwise one of the OviNotificationState::StateError errors is emited.

Registers Ovi Notification Enabler application.

This is an asynchronous method. It is mandatory to call this method before Ovi Notifications can be used.

If registration is successful Ovi Notification Enabler will open a network connection if not open already. OviNotificationSession::stateChanged signal is emitted with EStateConnecting and EStateOnline after successful registration. Otherwise one of the OviNotificationInterface::StateErrors errors is emited.

aApplicationId Application's Identifier

See also: unregisterApplication(), stateChanged()

Parameters
aApplicationIdApplication's Identifier

setAudioNotification ( bool )

voidsetAudioNotification(boolaAudio)[virtual, slot]
Setter for the sound alert for the notification received by the application. This is an asynchronous method. This function should be called when session state is OviNotificationState::EStateOnline. The stateChanged(QObject* ) signal would be emitted with OviNotificationState::StateError OviNotificationState::EErrorNotAllowed in the following cases
  1. If this function is called in state other than OviNotificationState::EStateOnline.

  2. If the function is trying to set value before the previous value has not been saved in the Notifications Enabler.

If this flag is set and the applicatin receives notifications which has alert flag in it then the user will hear the audio beep for the received notificaiton In case this flag is not set then no audio beep will be played even though the notification might have the audio flag set in it. Simialrly, if this flag is set but the received notification does not have the audio flag in it then also no beep will be played. Stores the audio notificaiton settings in the stack.

Setter for the sound alert for the notification received by the application. This is an asynchronous method. This function should be called when session state is OviNotificationState::EStateOnline. The stateChanged(QObject* ) signal would be emitted with OviNotificationState::StateError OviNotificationState::EErrorNotAllowed in the following cases If this function is called in state other than OviNotificationState::EStateOnline. If the function is trying to set value before the previous value has not been saved in the Notifications Enabler. aAudio If this flag is set and the applicatin receives notifications which has alert flag in it then the user will hear the audio beep for the received notificaiton In case this flag is not set then no audio beep will be played even though the notification might have the audio flag set in it. Simialrly, if this flag is set but the received notification does not have the audio flag in it then also no beep will be played. Stores the audio notificaiton settings in the stack.

See also: setAudioNotification()

Parameters
aAudioIf true will enable the audio notification feature else will disable this feature.

setNotificationUi ( bool, const QString & )

boolsetNotificationUi(boolaUseNotificationUi,
const QString &aIcon = ""
)[virtual, slot]
Setter for the Notification Ui This function should be called when session state is OviNotificationState::EStateOnline. The stateChanged(QObject* ) signal would be emitted with OviNotificationState::StateError OviNotificationState::EErrorNotAllowed in the following cases
  1. If this function is called in state other than OviNotificationState::EStateOnline.

  2. If the function is trying to set value before the previous value has not been saved in the Notifications Enabler. Setter for the Notification Ui This function should be called when session state is OviNotificationState::EStateOnline. The stateChanged(QObject* ) signal would be emitted with OviNotificationState::StateError OviNotificationState::EErrorNotAllowed in the following cases If this function is called in state other than OviNotificationState::EStateOnline. If the function is trying to set value before the previous value has not been saved in the Notifications Enabler.

aUseNotificationUi If set to true then the Notification UI is shown in the events of new messages when the application is not running.

aIcon The icon data to be shown for this application in the notification ui, the size limitation is 128*128 pixels. The icon format should be Base64 encoded image data read from the file. Symbian 3 and Harmattan, the Icon format could be QIcon supported formats Symbian 1 the Icon format should be PNG, GIF

See also: isNotificationUi()

Parameters
aUseNotificationUiIf set to true then the Notification UI is shown in the events of new messages when the application is not running.
aIconThe icon data to be shown for this application in the notification ui, the size limitation is 128*128 pixels. The icon format should be Base64 encoded image data read from the file.Symbian 3 and Harmattan, the Icon format could be QIcon supported formatsSymbian 1 the Icon format should be PNG, GIF Returns true if the NotificationUi setting has been successful else returns false in cases of Too large Icon
Return Value
bool true if the NotificationUi setting has been succesful else returns false in case of Too large Icon

setNotificationUiUpdate ( bool )

voidsetNotificationUiUpdate(boolaNotificationUiUpdate)[virtual, slot]
Setter for the Notification UI update(syncing) for the notification received by the application. This is an asynchronous method. This function should be called when session state is OviNotificationState::EStateOnline. The stateChanged(QObject* ) signal would be emitted with OviNotificationState::StateError OviNotificationState::EErrorNotAllowed in the following cases
  1. If this function is called in state other than OviNotificationState::EStateOnline.

  2. If the function is trying to set value before the previous value has not been saved in the Notifications Enabler.

If this flag is set alongwith the Notification Ui flag then the stack will sync the notification status in Notification Ui and the application. For application using this flag alongwith Notification Ui flag, they must ensure that once they receive the notification and have processed it, they must call markConsumed() API and pass the messageIds of the notifications which are processed, those notifications will be removed from the Notification Ui. In case this flag is not set then the Notification Ui will remove the message after it has been delivered to the application, there is no need to call markConsumed(). Stores the notificaiton Ui update settings in the stack.

Setter for the Notification UI update(syncing) for the notification received by the application. This is an asynchronous method. This function should be called when session state is OviNotificationState::EStateOnline. The stateChanged(QObject* ) signal would be emitted with OviNotificationState::StateError OviNotificationState::EErrorNotAllowed in the following cases If this function is called in state other than OviNotificationState::EStateOnline. If the function is trying to set value before the previous value has not been saved in the Notifications Enabler. aNotificationUiUpdate If this flag is set alongwith the Notification Ui flag then the stack will sync the notification status in Notification Ui and the application. For application using this flag alongwith Notification Ui flag, they must ensure that once they receive the notification and have processed it, they must call markConsumed() API and pass the messageIds of the notifications which are processed, those notifications will be removed from the Notification Ui. In case this flag is not set then the Notification Ui will remove the message after it has been delivered to the application, there is no need to call markConsumed(). Stores the notificaiton Ui update settings in the stack.

See also: setNotificationUiUpdate()

Parameters
aNotificationUiUpdateIf true will enable the notification ui update feature else will disable this feature.

setWakeUp ( bool )

voidsetWakeUp(boolaWakeUp)[virtual, slot]
Setter for the wakeup of the application. This is an asynchronous method. This function should be called when session state is OviNotificationState::EStateOnline. The stateChanged(QObject* ) signal would be emitted with OviNotificationState::StateError OviNotificationState::EErrorNotAllowed in the following cases
  1. If this function is called in state other than OviNotificationState::EStateOnline.

  2. If the function is trying to set value before the previous value has not been saved in the Notifications Enabler.

If this flag is set and the application receives notifications while application is not running then
  1. if notificationUi is true - user will receive notification popup informing that this application has received notification,user needs to select the popup and it will lauch this application.

  2. if notification Ui is false - Application will directly launch. To receive the notification, application must call registerApplication() after launching. This is an asynchronous method. In case the application is running and notification arrives for the application it is directly delivered to the application. Stores the wakeup related settings in the stack.

Setter for the wakeup of the application. This is an asynchronous method. This function should be called when session state is OviNotificationState::EStateOnline. The stateChanged(QObject* ) signal would be emitted with OviNotificationState::StateError OviNotificationState::EErrorNotAllowed in the following cases If this function is called in state other than OviNotificationState::EStateOnline. If the function is trying to set value before the previous value has not been saved in the Notifications Enabler. If this flag is set and the applicatin receives notifications while application is not running then if notificationUi is true - user will receive notification popup informing that this application has received notification,user needs to select the popup and it will lauch this application. if notification Ui is false - Application will directly launch. To receive the notification, application must call registerApplication() after launching. In case the application is running and notification arrives for the application it is directly delivered to the application. Stores the wakeup related settings in the stack.

aWakeUp If wakeup is true then the application is woken up in the event of ovi notifications.

See also: isWakeUp()

Parameters
aWakeUpIf wakeup is true then the application is woken up in the event of ovi notifications.

stateChanged ( QObject * )

voidstateChanged(QObject *aState)[signal]

Session status change signal.

Signal emitted when a OviNotification session state has changed. Indicates Notifications Enabler states. In the normal cases the the state changes would be OviNotificationState::EStateOffline to OviNotificationState::EStateConnecting to OviNotificationState::EStateOnline, with OviNotificationState::EErrorNone. In case of error OviNotificationState::StateError would be other than OviNotificationState::EErrorNone. For example, client has connected to Notifications Enabler.

      // Load the service and get the service object
      connect(serviceObject,SIGNAL(stateChanged(QObject*)),
                            SLOT(sessionStateChanged(QObject*)));
      

This signal emitted when a OviNotification session state has changed. Indicates Ovi Notification Enabler states. In the normal cases the the state changes would be OviNotificationState::EStateOffline to OviNotificationState::EStateConnecting to OviNotificationState::EStateOnline, with OviNotificationState::EErrorNone. In case of error OviNotificationState::StateError would be other than OviNotificationState::EErrorNone. For example, client has connected to Ovi Notification Enabler.

  // Load the service and get the service object
  connect(serviceObject,SIGNAL(stateChanged(QObject*)),
						SLOT(sessionStateChanged(QObject*)));

aState OviNotificationState Object

See also: registerApplication(), unregisterApplication()

Parameters
aStateOviNotificationState Object

unregisterApplication ( )

voidunregisterApplication()[virtual, slot]

Asynchronous call used to unregister application.

Should be called when application wants to close and unregister from Ovi Notification service, for example when uninstalling the application. Removes all application related information and stored settings. Like
  1. Wakeup

  2. NotificationUi

If application is already unregistered or is not registered at all, OviNotificationState::EErrorNotAllowed is emited in OviNotificationSession::stateChanged() signal.

Asynchronous call used to unregister application.

Should be called when application wants to close and unregister from Ovi Notification service, for example when uninstalling the application. Removes all application related information and stored settings. Like Wakeup and NotificationUi

If application is already unregistered or is not registered at all, OviNotificationState::EStateErrorNotAllowed is emited in OviNotificationSession::stateChanged() signal.

See also: registerApplication(), stateChanged()

version ( QString )

voidversion(QStringaVersion)[signal]

Version info signal.

Signal is emitted when version information has been received.

      // Load the service and get the service object
      connect(serviceObject,SIGNAL(version(QString)),
                            SLOT(versionResponse(QString)));

      
This signal is emitted when version information has been received.
// Load the service and get the service object
connect(serviceObject,SIGNAL(version(QString)),
					SLOT(versionResponse(QString)));
aVersion returned version information

See also: getVersion()

Parameters
aVersionreturned version information