MeeGo 1.2 Harmattan Developer Documentation Develop for the Nokia N9

OviNotificationInterface Class Reference

List of all members.

Public Member Functions

virtual void  registerApplication (const QString &aApplicationId)=0
virtual void  setWakeUp (bool aWakeUp)=0
virtual bool  setNotificationUi (bool aUseNotificationUi, const QString &aIcon="")=0
virtual bool  isWakeUp ()=0
virtual bool  isNotificationUi ()=0
virtual void  unregisterApplication ()=0
virtual void  getNotificationInformation (const QString &aServiceId="")=0
virtual void  getVersion ()=0

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

virtual void OviNotificationInterface::getNotificationInformation ( 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:
aServiceId  The identifier of the Notification Service

Implemented in OviNotificationSession.

virtual void OviNotificationInterface::getVersion (  )  [pure virtual]

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

Implemented in OviNotificationSession.

virtual bool OviNotificationInterface::isNotificationUi (  )  [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.

Implemented in OviNotificationSession.

virtual bool OviNotificationInterface::isWakeUp (  )  [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.

Implemented in OviNotificationSession.

virtual void OviNotificationInterface::registerApplication ( 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:
aApplicationId  Application's Identifier

Implemented in OviNotificationSession.

virtual bool OviNotificationInterface::setNotificationUi ( bool  aUseNotificationUi,
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.
Parameters:
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 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 of
  1. Too large Icon

Note: setWakeUp must be set that setNotificationUi would affect

Implemented in OviNotificationSession.

virtual void OviNotificationInterface::setWakeUp ( bool  aWakeUp  )  [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:
aWakeUp  If true will enable the wakeup feature else will disable wakeup feature.

Implemented in OviNotificationSession.

virtual void OviNotificationInterface::unregisterApplication (  )  [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.

Implemented in OviNotificationSession.


Copyright (C) 2010-2011 Nokia Corporation and/or its subsidiary(-ies). All rights reserved. Contact: notifications.support@nokia.com This software, including documentation, is protected by copyright controlled by Nokia Corporation. All rights reserved. You may use this file only in accordance with the Nokia Developer Software Agreement version 2.0 and accompanying Ovi any additional terms. This material also contains confidential information which may not be disclosed to others without the prior written consent of Nokia.
Nokia Developer Software Agreement version 2.0 and accompanying Ovi any additional terms
MeeGo 1.2 Harmattan API