voipplugins/sipconnectionprovider/ipvoicemailengine/inc/ipvmbxbase.h
branchRCL_3
changeset 21 f742655b05bf
parent 20 65a3ef1d5bd0
child 22 d38647835c2e
equal deleted inserted replaced
20:65a3ef1d5bd0 21:f742655b05bf
     1 /*
       
     2 * Copyright (c) 2002-2008 Nokia Corporation and/or its subsidiary(-ies).
       
     3 * All rights reserved.
       
     4 * This component and the accompanying materials are made available
       
     5 * under the terms of "Eclipse Public License v1.0"
       
     6 * which accompanies this distribution, and is available
       
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     8 *
       
     9 * Initial Contributors:
       
    10 * Nokia Corporation - initial contribution.
       
    11 *
       
    12 * Contributors:
       
    13 *
       
    14 * Description:  Creates SMS message if Event in MailBox has occurred
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 
       
    20 #ifndef IPVMBXBASE_H
       
    21 #define IPVMBXBASE_H
       
    22 
       
    23 #include <e32base.h>
       
    24 #include <sipprofile.h>
       
    25 
       
    26 #include "ipvmbxconstants.h"
       
    27 
       
    28 
       
    29 class CMceOutEvent;
       
    30 class CMceManager;
       
    31 class CSIPProfile;
       
    32 class CIpVmbxEngine;
       
    33 
       
    34 
       
    35 /**
       
    36  *  Creates SMS message if Event in MailBox has occurred.
       
    37  *
       
    38  *  @lib ipvmbxengine.dll
       
    39  */
       
    40 NONSHARABLE_CLASS( CIpVmbxBase ) : public CBase
       
    41     {
       
    42 
       
    43 public:
       
    44 
       
    45     /** States for base class */
       
    46     enum TIpVmbxBaseStates
       
    47         {
       
    48         ESubscribing,
       
    49         ERegistered,
       
    50         ETerminating,
       
    51         EDisabled
       
    52         };
       
    53 
       
    54     /**
       
    55      * Two-phased constructor.
       
    56      *
       
    57      * @param aVmbxEngine Instance to engine
       
    58      * @param aVoiceMailUri Address of voice mail account
       
    59      * @param aMceManager Manager instance of IPVME
       
    60      * @return Created base class
       
    61      */
       
    62     static CIpVmbxBase* NewL(
       
    63         CIpVmbxEngine& aVmbxEngine,
       
    64         TDesC8& aVoiceMailUri8,
       
    65         CMceManager& aMceManager );
       
    66 
       
    67     /**
       
    68      * Destructor.
       
    69      */
       
    70     virtual ~CIpVmbxBase();
       
    71 
       
    72     /**
       
    73      * Set changing parameters for spescfic voice mail account.
       
    74      *
       
    75      * @param aServiceProviderId Service provider id
       
    76      * @param aSipProfile Sip profile
       
    77      */
       
    78     void Initialize(
       
    79         TUint32 aServiceProviderId,
       
    80         CSIPProfile& aSipProfile );
       
    81 
       
    82     /**
       
    83      * Subscribes to mail server. If refresh value is not entered,
       
    84      * defaults to KReSubscribe.
       
    85      *
       
    86      * @param aReSubscribe Parameter for refresh initiated by IPVME
       
    87      */
       
    88     void SubscribeL( TInt aReSubscribe );
       
    89 
       
    90     /**
       
    91      * Unsubscribes from mail server.
       
    92      */
       
    93     void TerminateEventL();
       
    94 
       
    95     /**
       
    96      * Cleans MceEvent instance.
       
    97      */
       
    98     void DeleteEvent();
       
    99 
       
   100     /**
       
   101      * Cancel resubscribe timer
       
   102      */
       
   103     void Cancel();
       
   104 
       
   105     /**
       
   106      * Get service provider data
       
   107      *
       
   108      * @return Service id
       
   109      */
       
   110     TUint32 ServiceProviderId() const;
       
   111 
       
   112     /**
       
   113      * Account uri to which app base has connected
       
   114      *
       
   115      * @return MBX account
       
   116      */
       
   117     const TDesC8& VmbxUrl() const;
       
   118 
       
   119     /**
       
   120      * Sets base state to connected state and starts
       
   121      * resubscription process.
       
   122      */
       
   123     void SetStateRegistered();
       
   124 
       
   125     /**
       
   126      * State of base class
       
   127      *
       
   128      * @return State of base class
       
   129      */
       
   130     CIpVmbxBase::TIpVmbxBaseStates State() const;
       
   131 
       
   132     /**
       
   133      * Save current message state of mailbox
       
   134      *
       
   135      * @param Total messages
       
   136      * @param New messages
       
   137      */
       
   138     void SetAccountMessageCount( TInt aTotalCount, TInt aNewCount );
       
   139 
       
   140     /**
       
   141      * Get previous message state of mailbox
       
   142      *
       
   143      * @param Total messages
       
   144      * @param New messages
       
   145      */
       
   146     void AccountMessageCount( TInt& aTotalCount, TInt& aNewCount);
       
   147 
       
   148 private:
       
   149 
       
   150     void ConstructL( TDesC8& aVoiceMailUri8 );
       
   151 
       
   152     /**
       
   153      * C++ default constructor.
       
   154      *
       
   155      * @param aVmbxEngine Engine instance to send status messages
       
   156      * @param aVoiceMailUri Uri which this base class will subscribe
       
   157      * @param aMceManager Required manager instance for outbound connections
       
   158      */
       
   159     CIpVmbxBase(
       
   160         CIpVmbxEngine& aVmbxEngine,
       
   161         CMceManager& aMceManager );
       
   162 
       
   163 private:    // Data
       
   164 
       
   165     /**
       
   166      * SIP profile information
       
   167      * Not own.
       
   168      */
       
   169     CSIPProfile* iSipProfile;
       
   170 
       
   171     /**
       
   172      * MO events
       
   173      * Own.
       
   174      */
       
   175     CMceOutEvent* iMceOutEvent;
       
   176 
       
   177     /**
       
   178      * MCE server connection
       
   179      */
       
   180     CMceManager& iMceManager;
       
   181 
       
   182     /**
       
   183      * State of base class
       
   184      */
       
   185     TIpVmbxBaseStates iState;
       
   186 
       
   187     /**
       
   188      * Id of service this base class is using
       
   189      */
       
   190     TUint32 iServiceProviderId;
       
   191 
       
   192     /**
       
   193      * Uri this base class is monitoring
       
   194      */
       
   195     TBuf8< KMaxIpVoiceMailBoxUriLength > iVmbxUri8;
       
   196 
       
   197     /**
       
   198      * Server total messages
       
   199      */
       
   200     TInt iTotalMessageCount;
       
   201 
       
   202     /**
       
   203      * Server new messages
       
   204      */
       
   205     TInt iNewMessageCount;
       
   206 
       
   207     /**
       
   208      * Amount of pending resubscribes
       
   209      */
       
   210     TInt iPendingResubscribeCount;
       
   211 
       
   212     /**
       
   213      * Message sender
       
   214      */
       
   215     CIpVmbxEngine& iVmbxEngine;
       
   216 
       
   217     EUNIT_IMPLEMENTATION
       
   218     };
       
   219 
       
   220 #endif // IPVMBXBASE_H