OviNotificationInterface Class Reference

#include <mw/cwrt/ovinotificationinterface.h>

class OviNotificationInterface
Public Member Functions
pure virtual voidgetNotificationInformation(const QString &)
pure virtual voidgetVersion()
pure virtual boolisAudioNotification()
pure virtual boolisNotificationUi()
pure virtual boolisNotificationUiUpdate()
pure virtual boolisWakeUp()
pure virtual voidmarkConsumed(const QStringList &)
pure virtual voidregisterApplication(const QString &)
pure virtual voidsetAudioNotification(bool)
pure virtual boolsetNotificationUi(bool, const QString &)
pure virtual voidsetNotificationUiUpdate(bool)
pure virtual voidsetWakeUp(bool)
pure virtual voidunregisterApplication()

Detailed Description

Main class of the Ovi Notification service provider.

Code example of how Qt applications uses this API.

 // OviNotificationSession *iNotificationSession;

 // Load service object
 QPluginLoader* loader = new QPluginLoader(ONEPLUGIN);
 iNotificationSession = static_cast<OviNotificationSession*>(loader->instance());

 // Connect signals from session

 // State enumerations is emitted from stateChanged(QObject*) signal.
 connect(iNotificationSession,SIGNAL(stateChanged(QObject*)), SLOT(sessionStateChanged(QObject*)));

 // Incoming notification objects is emitted from received(QObject*) signal.
 connect(iNotificationSession,SIGNAL(received(QObject)), SLOT(receivedClb(QObject)));

 // Register application. This is an asynchronous call.
 // OviNotificationSession::stateChanged signal is emitted with state EStateOnline
 // when application is successfully registered.
 iNotificationSession->registerApplication(aApplicationId, aWakeup);
 }

 // When message is received , received(QObject) signal is emitted.
 OviNotificationMessage* message = static_cast<OviNotificationMessage*>(obj);

 message->from();
 message->senderInformation();
 message->timestamp();

 }

 

Client application should connect all signals from Ovi Notification service object to receive callbacks. See signals in OviNotificationSession.

Member Function Documentation

getNotificationInformation ( const QString & )

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

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.

Parameters
aServiceIdThe identifier of the Notification Service

getVersion ( )

voidgetVersion()[pure virtual]

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

isAudioNotification ( )

boolisAudioNotification()[pure virtual]

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.

isNotificationUi ( )

boolisNotificationUi()[pure virtual]

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. Returns true if the NotificationUi setting is true otherwise returns false.

isNotificationUiUpdate ( )

boolisNotificationUiUpdate()[pure virtual]

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.

isWakeUp ( )

boolisWakeUp()[pure virtual]

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.

markConsumed ( const QStringList & )

voidmarkConsumed(const QStringList &aMessageIds)[pure virtual]
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.

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

registerApplication ( const QString & )

voidregisterApplication(const QString &aApplicationId)[pure virtual]

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 succesfull Notifications Enabler will open connection Notification Service if not open already. OviNotificationSession::stateChanged signal is emitted with EStateConnecting and EStateOnline after succesfull registration. Otherwise one of the OviNotificationState::StateError errors is emited.

Parameters
aApplicationIdApplication's Identifier

setAudioNotification ( bool )

voidsetAudioNotification(boolaAudio)[pure virtual]
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 application 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.

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

setNotificationUi ( bool, const QString & )

boolsetNotificationUi(boolaUseNotificationUi,
const QString &aIcon = ""
)[pure virtual]
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.

Note: setWakeUp must be set that setNotificationUi would affect

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 icon format should be Base64 encoded image data read from the file, supported formats svg, png, img, bmp,jpg Returns true if the NotificationUi setting has been succesful else returns false in cases ofToo large Icon

setNotificationUiUpdate ( bool )

voidsetNotificationUiUpdate(boolaNotificationUiUpdate)[pure virtual]
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.

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

setWakeUp ( bool )

voidsetWakeUp(boolaWakeUp)[pure virtual]
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 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.

Parameters
aWakeUpIf true will enable the wakeup feature else will disable wakeup feature.

unregisterApplication ( )

voidunregisterApplication()[pure virtual]
Asynchronous call used to unregister application. Should be called when application wants to close and no longer wishes to receive the notifications from the from Ovi Notification service. 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.