tsrc/musenginestub/inc/mussipprofilehandler.h
branchRCL_3
changeset 23 bc78a40cd63c
parent 22 73a1feb507fb
child 24 6c57ef9392d2
equal deleted inserted replaced
22:73a1feb507fb 23:bc78a40cd63c
     1 /*
       
     2 * Copyright (c) 2005-2006 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:
       
    15 *  Version     : %version: 1 % << Don't touch! Updated by Synergy at check-out.
       
    16 *
       
    17 */
       
    18 
       
    19 
       
    20 
       
    21 #ifndef MUSSIPPROFILEHANDLER_H
       
    22 #define MUSSIPPROFILEHANDLER_H
       
    23 
       
    24 
       
    25 // INTERNAL INCLUDE
       
    26 #include "musunittesting.h"
       
    27 
       
    28 // SYSTEM INCLUDE
       
    29 #include <e32base.h>
       
    30 #include <sipobserver.h>
       
    31 #include <sipconnectionobserver.h>
       
    32 #include <sipprofileregistryobserver.h>
       
    33 #include <sipprofilealrobserver.h>
       
    34 
       
    35 
       
    36 class CSIPProfile;
       
    37 class CSIPProfileRegistry;
       
    38 class CSipProfileAlrController;
       
    39 class CUri8;
       
    40 class MMusSipProfileUser;
       
    41 
       
    42 /**
       
    43 *
       
    44 * @lib musengine.lib
       
    45 */
       
    46 class CMusSipProfileHandler : public CBase,
       
    47                               public MSIPProfileRegistryObserver,
       
    48                               public MSIPObserver,
       
    49                               public MSIPConnectionObserver,
       
    50                               public MSipProfileAlrObserver                             
       
    51     {
       
    52     MUS_UNITTEST( UT_CMusEngSipProfileHandler )
       
    53     
       
    54     public:
       
    55 
       
    56         /**
       
    57         * Creates new instance of CMusSipProfileHandler
       
    58         * @param aSipProfileId profile id of requested profile
       
    59         */
       
    60         static CMusSipProfileHandler* NewL( MMusSipProfileUser& aUser );
       
    61 
       
    62         /**
       
    63         * Destructor
       
    64         *
       
    65         */
       
    66         ~CMusSipProfileHandler();
       
    67 
       
    68 
       
    69     public: // API
       
    70         
       
    71         /**
       
    72         * Creates the SIP profile used.
       
    73         * @param aSipProfileId profile ID of requested SIP profile
       
    74         */
       
    75         void CreateProfileL( TUint32 aSipProfileId );
       
    76         
       
    77         /**
       
    78         * Returns the used SIP profile.
       
    79         * @pre SipProfileL has been called
       
    80         * @return SIP profile or NULL if the SIP profile cannot be found,
       
    81         *         The ownership is not transferred.
       
    82         */ 
       
    83         CSIPProfile* Profile();
       
    84         
       
    85         /**
       
    86         * Returns the registered public user identity of the used SIP profile
       
    87         * @pre SipProfileL has been called
       
    88         * @return a pointer to the URI, the ownership is transferred 
       
    89         */       
       
    90         CUri8* UserFromProfileLC();
       
    91 
       
    92         /**
       
    93         * Refreshes the availabilities of the access points 
       
    94         * for the used SIP profile.
       
    95         * Should be called when a MuS session terminates.
       
    96         */
       
    97         void RefreshIapAvailabilities();
       
    98         
       
    99         /**
       
   100          * @return ETrue if SIP profile returned by Profile() is registered
       
   101          */
       
   102         TBool IsRegistered();
       
   103 
       
   104         
       
   105     private:
       
   106 
       
   107         /**
       
   108         * Constructor
       
   109         */
       
   110         CMusSipProfileHandler( MMusSipProfileUser& aUser );
       
   111 
       
   112         /**
       
   113         * Second-phase constructor
       
   114         */
       
   115         void ConstructL();
       
   116 
       
   117     private: // From MSIPProfileRegistryObserver
       
   118 
       
   119         /**
       
   120         * An event related to SIP Profile has accorred
       
   121         *
       
   122         * @param aProfileId a profile Id
       
   123         * @param aEvent an occurred event
       
   124         **/
       
   125         void ProfileRegistryEventOccurred( 
       
   126             TUint32 aProfileId,
       
   127             MSIPProfileRegistryObserver::TEvent aEvent );
       
   128 
       
   129         /**
       
   130         * An asynchronous error has occurred related to SIP profile
       
   131         * Event is send to those observers, who have the
       
   132         * corresponding profile instantiated.
       
   133         *
       
   134         * @param aProfileId the id of failed profile
       
   135         * @param aError an occurred error
       
   136         */
       
   137         void ProfileRegistryErrorOccurred( 
       
   138             TUint32 aProfileId,
       
   139             TInt aError );
       
   140 
       
   141     private: // From MSIPObserver    
       
   142 
       
   143         void IncomingRequest( TUint32 aIapId,
       
   144                               CSIPServerTransaction* aTransaction );
       
   145 
       
   146         void TimedOut( CSIPServerTransaction& aTransaction );
       
   147 
       
   148     private: // MSIPConnectionObserver must be implemented to enable SIP profile
       
   149         
       
   150         void IncomingRequest (CSIPServerTransaction* aTransaction );
       
   151 
       
   152         void IncomingRequest (CSIPServerTransaction* aTransaction,
       
   153                               CSIPDialog& aDialog );
       
   154 
       
   155         void IncomingResponse (CSIPClientTransaction& aTransaction );
       
   156 
       
   157         void IncomingResponse ( CSIPClientTransaction& aTransaction,
       
   158                                 CSIPDialogAssocBase& aDialogAssoc );
       
   159 
       
   160         void IncomingResponse ( CSIPClientTransaction& aTransaction,
       
   161                                 CSIPInviteDialogAssoc* aDialogAssoc );
       
   162 
       
   163         void IncomingResponse( CSIPClientTransaction& aTransaction,
       
   164                                CSIPRegistrationBinding& aRegistration );
       
   165 
       
   166         void ErrorOccured( TInt aError, CSIPTransactionBase& aTransaction );
       
   167 
       
   168         void ErrorOccured( TInt aError,
       
   169                            CSIPClientTransaction& aTransaction,
       
   170                            CSIPRegistrationBinding& aRegistration );
       
   171 
       
   172         void ErrorOccured( TInt aError,
       
   173                            CSIPTransactionBase& aTransaction,
       
   174                            CSIPDialogAssocBase& aDialogAssoc );
       
   175         
       
   176         void ErrorOccured( TInt aError, CSIPRefresh& aSIPRefresh );
       
   177 
       
   178         void ErrorOccured( TInt aError, 
       
   179                            CSIPRegistrationBinding& aRegistration );
       
   180 
       
   181         void ErrorOccured( TInt aError, CSIPDialogAssocBase& aDialogAssoc );
       
   182 
       
   183         void InviteCompleted( CSIPClientTransaction& aTransaction );
       
   184 
       
   185         void InviteCanceled( CSIPServerTransaction& aTransaction );
       
   186         
       
   187         void ConnectionStateChanged( CSIPConnection::TState aState );     
       
   188         
       
   189     private: // From MSipProfileAlrObserver    
       
   190         
       
   191         void AlrEvent( MSipProfileAlrObserver::TEvent aEvent,
       
   192                        TUint32 aProfileId,
       
   193                        TUint32 aSnapId,
       
   194                        TUint32 aIapId );
       
   195 
       
   196         void AlrError( TInt aError,
       
   197                        TUint32 aProfileId,
       
   198                        TUint32 aSnapId,
       
   199                        TUint32 aIapId );         
       
   200   
       
   201     private: // New functions
       
   202         
       
   203         TUint32 ProfileId() const;
       
   204         
       
   205     private: // DATA
       
   206         
       
   207         MMusSipProfileUser& iUser;
       
   208         CSIP* iSip;
       
   209         CSIPProfileRegistry* iProfileRegistry;
       
   210         CSipProfileAlrController* iProfileAlrController;
       
   211         CSIPProfile* iSipProfile;
       
   212     };
       
   213 
       
   214 
       
   215 #endif // MUSSIPPROFILEHANDLER_H