epoc32/include/app/mncnnotification.h
author William Roberts <williamr@symbian.org>
Wed, 31 Mar 2010 12:33:34 +0100
branchSymbian3
changeset 4 837f303aceeb
parent 2 2fe1408b6811
permissions -rw-r--r--
Current Symbian^3 public API header files (from PDK 3.0.h)
This is the epoc32/include tree with the "platform" subtrees removed, and
all but a selected few mbg and rsg files removed.
williamr@2
     1
/*
williamr@2
     2
* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
williamr@2
     3
* All rights reserved.
williamr@2
     4
* This component and the accompanying materials are made available
williamr@4
     5
* under the terms of "Eclipse Public License v1.0"
williamr@2
     6
* which accompanies this distribution, and is available
williamr@4
     7
* at the URL "http://www.eclipse.org/legal/epl-v10.html".
williamr@2
     8
*
williamr@2
     9
* Initial Contributors:
williamr@2
    10
* Nokia Corporation - initial contribution.
williamr@2
    11
*
williamr@2
    12
* Contributors:
williamr@2
    13
*
williamr@2
    14
* Description:  
williamr@2
    15
*       Public ECom notification API for NcnList.
williamr@2
    16
*
williamr@2
    17
*/
williamr@2
    18
williamr@2
    19
williamr@2
    20
williamr@2
    21
#ifndef __MNCNNOTIFICATION_H__
williamr@2
    22
#define __MNCNNOTIFICATION_H__
williamr@2
    23
williamr@2
    24
//  INCLUDES
williamr@2
    25
#include <e32base.h>
williamr@2
    26
#include <msvstd.h>
williamr@2
    27
#include <bamdesca.h>
williamr@4
    28
#include <ecom/ecom.h>
williamr@4
    29
#include <ecom/ecomresolverparams.h>
williamr@2
    30
williamr@2
    31
// FORWARD DECLARATIONS
williamr@2
    32
williamr@2
    33
// UID of this interface
williamr@2
    34
const TUid KNcnNotificationInterfaceUid = {0x101f8855};
williamr@2
    35
williamr@2
    36
// CLASS DECLARATION
williamr@2
    37
williamr@2
    38
/**
williamr@2
    39
 * Public ECom notification API.
williamr@2
    40
 * This API allows the notification of new message(s) to the NcnList.
williamr@2
    41
 * It's main purpose is to provide a mechanism for an email MTM to broadcast the arrival of new messages
williamr@2
    42
 * and give the user an opportunity to navigate to the email folder
williamr@2
    43
 *
williamr@2
    44
 * Example usage
williamr@2
    45
 *
williamr@2
    46
 * @code
williamr@2
    47
 * #include <badesca.h>	// CDesCArray
williamr@2
    48
 * #include <mncnnotification.h>	// ECOM interface to notification system
williamr@2
    49
 *
williamr@2
    50
 *  // Get an instance of the ECOM interface to the notification system.
williamr@2
    51
 *  MNcnNotification* notifyNewMessageEcom = 0;
williamr@2
    52
 *  TRAP(err, notifyNewMessageEcom = MNcnNotification::CreateMNcnNotificationL());
williamr@2
    53
 *
williamr@2
    54
 *  // Check for errors
williamr@2
    55
 *  if(notifyNewMessageEcom && err == KErrNone)
williamr@2
    56
 *      {
williamr@2
    57
 *      // The interface is supported on this phone.
williamr@2
    58
 *      CleanupDeletePushL(notifyNewMessageEcom);
williamr@2
    59
 *
williamr@2
    60
 *      // Now notify the framework that new messages have been received
williamr@2
    61
 *      // First create a descriptor array for aInfo - even though it isn't used presently.
williamr@2
    62
 *      CDesCArray* tempArray = new (ELeave) CDesCArrayFlat(3);
williamr@2
    63
 *      CleanupStack::PushL(tempArray);
williamr@2
    64
 *
williamr@2
    65
 *      // Notify the framework that there are new messages.
williamr@2
    66
 *		// This can return an error value.
williamr@2
    67
 *      err = notifyNewMessageEcom->NewMessages(aServiceId, MNcnNotification::EIndicationNormal, *tempArray);
williamr@2
    68
 *
williamr@2
    69
 *      // Cleanup the descriptor array.
williamr@2
    70
 *      CleanupStack::PopAndDestroy(tempArray);
williamr@2
    71
 *
williamr@2
    72
 *      // Clean up the ECOM interface now.
williamr@2
    73
 *      CleanupStack::PopAndDestroy(notifyNewMessageEcom);
williamr@2
    74
 *      }
williamr@2
    75
 * @endcode
williamr@2
    76
 *
williamr@2
    77
 * The example above shows the interface object being created and then destroyed immediately after use.
williamr@2
    78
 * However, it is not necessary to create a new interface object for every function call. It is done here to
williamr@2
    79
 * demonstrate correct useage of the CleanupStack
williamr@2
    80
 */
williamr@2
    81
class MNcnNotification
williamr@2
    82
    {
williamr@2
    83
    private: // Enumerations
williamr@2
    84
        /**
williamr@2
    85
         * Indication type bit enumeration.
williamr@2
    86
         */
williamr@2
    87
        enum TIndicationTypeBits
williamr@2
    88
            {
williamr@2
    89
            /* Icon bit */
williamr@2
    90
            EIndicationIconBit = 0x1,
williamr@2
    91
williamr@2
    92
            /* Tone bit */
williamr@2
    93
            EIndicationToneBit = 0x2,
williamr@2
    94
williamr@2
    95
            /* Soft note bit */
williamr@2
    96
            EIndicationSoftNoteBit = 0x4
williamr@2
    97
            };
williamr@2
    98
williamr@2
    99
    public: // Enumerations
williamr@2
   100
        /**
williamr@2
   101
         * Indication type enumeration.
williamr@2
   102
         */
williamr@2
   103
        enum TIndicationType
williamr@2
   104
            {
williamr@2
   105
            /* Icon indication */
williamr@2
   106
            EIndicationIcon = EIndicationIconBit,
williamr@2
   107
williamr@2
   108
            /* Normal indication */
williamr@2
   109
            EIndicationNormal = EIndicationIconBit | EIndicationToneBit | EIndicationSoftNoteBit,
williamr@2
   110
williamr@2
   111
            /* Tone and icon indication */
williamr@2
   112
            EIndicationToneAndIcon = EIndicationIconBit | EIndicationToneBit
williamr@2
   113
            };
williamr@2
   114
williamr@2
   115
    public: // Constructor and destructor
williamr@2
   116
williamr@2
   117
       /**
williamr@2
   118
        * ECom implementation class factory method.
williamr@2
   119
        * Caller takes the ownership of the created object.
williamr@2
   120
        * If interface needs to be pushed into CleanupStack,
williamr@2
   121
        * remember to use the CleanupDeletePushL() function!
williamr@2
   122
        * DO NOT USE CleanupStack::PushL()!!
williamr@2
   123
        * @return ECom implementation instance
williamr@2
   124
        *
williamr@2
   125
        *
williamr@2
   126
        */
williamr@2
   127
        static MNcnNotification* CreateMNcnNotificationL();
williamr@2
   128
williamr@2
   129
       /**
williamr@2
   130
        * Destructor.
williamr@2
   131
        */
williamr@2
   132
        virtual ~MNcnNotification();
williamr@2
   133
williamr@2
   134
    public: // Interface
williamr@2
   135
williamr@2
   136
		/**
williamr@2
   137
         * Called by Messaging Server -compatible 3rd party Email plugins
williamr@2
   138
         * to inform NcnList that there is a new message (or more than one message).
williamr@2
   139
         * It should not (necessarily) be called for each new message but, say, at the
williamr@2
   140
         * end of synchronisation when one or more new messages have been received.
williamr@2
   141
         * It displays a 'New email' message with softkeys allowing direct
williamr@2
   142
         * navigation to the email folder
williamr@2
   143
         * Parameter aInfo is reserved for future use and is not handled in any way currently.
williamr@2
   144
         * Implementation of aIndicationType may vary between devices
williamr@2
   145
         *
williamr@2
   146
         * @param aMailBox        The service id of the email MTM
williamr@2
   147
         * @param aIndicationType Indication type for new messages. May be any combination
williamr@2
   148
         *                        of enumeration TIndicationType values.
williamr@2
   149
         * @param aInfo           Optional info about message (subject, sender etc.). Not supported
williamr@2
   150
         *
williamr@2
   151
         * @return                KErrNone for success, or system error code
williamr@2
   152
         */
williamr@2
   153
        virtual TInt NewMessages( const TMsvId& aMailBox,
williamr@2
   154
                                  TIndicationType aIndicationType,
williamr@2
   155
                                  const MDesCArray& aInfo ) = 0;
williamr@2
   156
williamr@2
   157
        /**
williamr@2
   158
         * Called by Messaging Server -compatible 3rd party Email plugins
williamr@2
   159
         * wanting to make a request to mark certain new messages as unread.<BR>
williamr@2
   160
         * Essentially, it sets the new message counter to zero for the given mailbox <BR>
williamr@2
   161
         * The new messages  become 'old' messages but they remain marked as 'unread'.
williamr@2
   162
         * @param aMailBox The id identifying the mailbox or mail
williamr@2
   163
         *                 folder containing the message(s) to be marked as unread.
williamr@2
   164
         *
williamr@2
   165
         * @return         KErrNone for success, or some error code
williamr@2
   166
         */
williamr@2
   167
        virtual TInt MarkUnread( const TMsvId& aMailBox ) = 0;
williamr@2
   168
williamr@2
   169
    private: // data
williamr@2
   170
williamr@2
   171
        // for ECom to identify plug-in instance
williamr@2
   172
        TUid iDtor_ID_Key;
williamr@2
   173
    };
williamr@2
   174
williamr@2
   175
#include <MNcnNotification.inl>
williamr@2
   176
williamr@2
   177
#endif // __MNCNNOTIFICATION_H__
williamr@2
   178
williamr@2
   179
// End of File