MeeGo 1.2 Harmattan Developer Documentation Develop for the Nokia N9

OviNotificationSession Class Reference

List of all members.

Public Slots

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

Signals

void  received (QObject *aNotification) const
void  stateChanged (QObject *aState)
void  notificationInformation (QObject *aData)
void  version (QString aVersion)

Public Member Functions

  OviNotificationSession ()
  ~OviNotificationSession ()

Constructor & Destructor Documentation

OviNotificationSession::OviNotificationSession (  ) 

Constructor. Creates the OviNotificationSession object.

OviNotificationSession::~OviNotificationSession (  ) 

Destructor. Destroys the OviNotificationSession object and frees all allocated resources.


Member Function Documentation

void OviNotificationSession::getNotificationInformation ( 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.
Parameters:
aServiceId  If wakeup is true then the application is woken up in the event of ovi notifications.

Implements OviNotificationInterface.

void OviNotificationSession::getVersion (  )  [virtual, slot]

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

Implements OviNotificationInterface.

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

Implements OviNotificationInterface.

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

Implements OviNotificationInterface.

void OviNotificationSession::notificationInformation ( 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);
      
Parameters:
aData  OviNotificationInfo Object
void OviNotificationSession::received ( 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);
      
Parameters:
aNotification  OviNotificationMessage containing the Ownership is passed.
void OviNotificationSession::registerApplication ( 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.

Parameters:
aApplicationId  Application's Identifier

Implements OviNotificationInterface.

bool OviNotificationSession::setNotificationUi ( bool  aUseNotificationUi,
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.
    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 size limitation is 128*128 pixels. The icon format should be Base64 encoded image data read from the file.
    1. Symbian 3 and Harmattan, the Icon format could be QIcon supported formats
    2. Symbian 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

Implements OviNotificationInterface.

void OviNotificationSession::setWakeUp ( bool  aWakeUp  )  [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.
Parameters:
aWakeUp  If wakeup is true then the application is woken up in the event of ovi notifications.

Implements OviNotificationInterface.

void OviNotificationSession::stateChanged ( 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*)));
      
Parameters:
aState  OviNotificationState Object
void OviNotificationSession::unregisterApplication (  )  [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.

Implements OviNotificationInterface.

void OviNotificationSession::version ( QString  aVersion  )  [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)));

      
Parameters:
aVersion  returned version information

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