MNcnNotification Class Reference

#include <app/MNcnNotification.h>

class MNcnNotification
Public Member Enumerations
enumTIndicationType { EIndicationIcon, EIndicationNormal, EIndicationToneAndIcon }
Public Member Functions
virtual ~MNcnNotification()
MNcnNotification *CreateMNcnNotificationL()
pure virtual TInt MarkUnread(const TMsvId &)
pure virtual TInt NewMessages(const TMsvId &, TIndicationType, const MDesCArray &)

Detailed Description

Public ECom notification API. This API allows the notification of new message(s) to the NcnList. It's main purpose is to provide a mechanism for an email MTM to broadcast the arrival of new messages and give the user an opportunity to navigate to the email folder

Example usage

 #include <badesca.h>	// CDesCArray
 #include <mncnnotification.h>	// ECOM interface to notification system

  // Get an instance of the ECOM interface to the notification system.
  MNcnNotification* notifyNewMessageEcom = 0;
  TRAP(err, notifyNewMessageEcom = MNcnNotification::CreateMNcnNotificationL());

  // Check for errors
  if(notifyNewMessageEcom && err == KErrNone)
      {
      // The interface is supported on this phone.
      CleanupDeletePushL(notifyNewMessageEcom);

      // Now notify the framework that new messages have been received
      // First create a descriptor array for aInfo - even though it isn't used presently.
      CDesCArray* tempArray = new (ELeave) CDesCArrayFlat(3);
      CleanupStack::PushL(tempArray);

      // Notify the framework that there are new messages.
		// This can return an error value.
      err = notifyNewMessageEcom->NewMessages(aServiceId, MNcnNotification::EIndicationNormal, *tempArray);

      // Cleanup the descriptor array.
      CleanupStack::PopAndDestroy(tempArray);

      // Clean up the ECOM interface now.
      CleanupStack::PopAndDestroy(notifyNewMessageEcom);
      }

The example above shows the interface object being created and then destroyed immediately after use. However, it is not necessary to create a new interface object for every function call. It is done here to demonstrate correct useage of the CleanupStack

Member Enumeration Documentation

Enum TIndicationType

Indication type enumeration.

EnumeratorValueDescription
EIndicationIconEIndicationIconBit
EIndicationNormalEIndicationIconBit | EIndicationToneBit | EIndicationSoftNoteBit
EIndicationToneAndIconEIndicationIconBit | EIndicationToneBit

Constructor & Destructor Documentation

~MNcnNotification ( )

~MNcnNotification()[inline, virtual]

Destructor.

Member Function Documentation

CreateMNcnNotificationL ( )

MNcnNotification *CreateMNcnNotificationL()[static, inline]

ECom implementation class factory method. Caller takes the ownership of the created object. If interface needs to be pushed into CleanupStack, remember to use the CleanupDeletePushL() function! DO NOT USE CleanupStack::PushL()!!

Returns: ECom implementation instance

MarkUnread ( const TMsvId & )

TInt MarkUnread(const TMsvId &aMailBox)[pure virtual]

Called by Messaging Server -compatible 3rd party Email plugins wanting to make a request to mark certain new messages as unread. Essentially, it sets the new message counter to zero for the given mailbox The new messages become 'old' messages but they remain marked as 'unread'.

ParameterDescription
aMailBoxThe id identifying the mailbox or mail folder containing the message(s) to be marked as unread.

Returns: KErrNone for success, or some error code

NewMessages ( const TMsvId &, TIndicationType, const MDesCArray & )

TInt NewMessages(const TMsvId &aMailBox,
TIndicationTypeaIndicationType,
const MDesCArray &aInfo
)[pure virtual]

Called by Messaging Server -compatible 3rd party Email plugins to inform NcnList that there is a new message (or more than one message). It should not (necessarily) be called for each new message but, say, at the end of synchronisation when one or more new messages have been received. It displays a 'New email' message with softkeys allowing direct navigation to the email folder Parameter aInfo is reserved for future use and is not handled in any way currently. Implementation of aIndicationType may vary between devices

ParameterDescription
aMailBoxThe service id of the email MTM
aIndicationTypeIndication type for new messages. May be any combination of enumeration TIndicationType values.
aInfoOptional info about message (subject, sender etc.). Not supported

Returns: KErrNone for success, or system error code