mmsharing/mmshavailability/inc/musavaregisteravailability.h
changeset 15 ccd8e69b5392
parent 2 b31261fd4e04
child 20 e8be2c2e049d
child 22 496ad160a278
equal deleted inserted replaced
2:b31261fd4e04 15:ccd8e69b5392
     1 /*
       
     2 * Copyright (c) 2005-2007 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 *  Version     : %version: 15.1.4 % << Don't touch! Updated by Synergy at check-out.
       
     9 *
       
    10 * Initial Contributors:
       
    11 * Nokia Corporation - initial contribution.
       
    12 *
       
    13 * Contributors:
       
    14 *
       
    15 * Description:  Provide interface for the client requestin register availability.
       
    16 *
       
    17 */
       
    18 
       
    19 
       
    20 
       
    21 #ifndef __MUSAVAREGISTERAVAILABILITY_H__
       
    22 #define __MUSAVAREGISTERAVAILABILITY_H___
       
    23 
       
    24 
       
    25 #include "musunittesting.h"
       
    26 #include "musavaavailability.h"
       
    27 #include "musavasipconnectionadapter.h"
       
    28 #include "musavasipprofileregistryadapter.h"
       
    29 #include "mussettingskeys.h"
       
    30 #include <sipprofileregistryobserver.h>
       
    31 #include <e32base.h>
       
    32 
       
    33 
       
    34 class CMusAvaSettingsImp;
       
    35 class CSIPProfileRegistry;
       
    36 class CSIPProfile;
       
    37 class MMusAvaObserver;
       
    38 class CMusAvaSharedObject;
       
    39 class CSIPProfile;
       
    40 class CSIPProfileRegistry;
       
    41 class CSIPConnection;
       
    42 
       
    43 
       
    44 /**
       
    45  *  Implemets register vailability.
       
    46  *
       
    47  *  Provide interface for the client to availability class.
       
    48  *
       
    49  *  @lib musavailabilityplugin.lib
       
    50  *  @since S60 v3.2
       
    51  */
       
    52 class CMusAvaRegisterAvailability : public CMusAvaAvailability,
       
    53                                     public MMusAvaSipProfileRegistryAdapter
       
    54 	{
       
    55 public:
       
    56 
       
    57 	/**
       
    58      * Two-phased constructor
       
    59      *
       
    60      * @param aObserver Pointer to observer intercase
       
    61      * @param aModules is data container
       
    62      * @return Returns pointer to CMusAvaInterface object
       
    63      */
       
    64 	static CMusAvaRegisterAvailability* NewL(
       
    65         MMusAvaAvailabilityObserver& aObserver,
       
    66         CMusAvaSettingsImp& aSettings );
       
    67 
       
    68 
       
    69 	static CMusAvaRegisterAvailability* NewLC(
       
    70 	    MMusAvaAvailabilityObserver& aObserver,
       
    71         CMusAvaSettingsImp& aSettings );
       
    72 
       
    73     /**
       
    74      * Destructor
       
    75      */
       
    76 
       
    77     ~CMusAvaRegisterAvailability();
       
    78 
       
    79     protected:
       
    80 
       
    81     /**
       
    82      * Constructor
       
    83      *
       
    84      * @param aObserver Pointer to observer intercase
       
    85      * @param aName availability name
       
    86      * @param aModules is data container
       
    87      * @return
       
    88      */
       
    89     CMusAvaRegisterAvailability(
       
    90         MMusAvaAvailabilityObserver& aObserver,
       
    91         CMusAvaSettingsImp& aSettings );
       
    92 
       
    93     void ConstructL();
       
    94 
       
    95 // from base class CMusAvaAvailability
       
    96 
       
    97 public:
       
    98 
       
    99    /**
       
   100     * Executes for the availability.
       
   101     */
       
   102     virtual void DoExecuteL();
       
   103 
       
   104    /**
       
   105     * Stop the execution.
       
   106     */
       
   107     virtual void Stop();
       
   108     
       
   109     /**
       
   110      * From CMusAvaAvailability.
       
   111      * Returns availability name.
       
   112      *
       
   113      * @return Name of *this* availability.
       
   114      */
       
   115     virtual MMusAvaObserver::TAvailabilityName Name();
       
   116 
       
   117 // from base class MSIPProfileRegistryObserver
       
   118 
       
   119 public:
       
   120 
       
   121    /**
       
   122     * An event related to SIP Profile has accorred
       
   123     * @param aProfileId a profile Id
       
   124     * @param aEvent an occurred event
       
   125     **/
       
   126     virtual void ProfileRegistryEventOccurred(
       
   127         TUint32 aProfileId,
       
   128         MSIPProfileRegistryObserver::TEvent aEvent );
       
   129 
       
   130    /**
       
   131     * An asynchronous error has occurred related to SIP profile
       
   132     * Event is send to those observers, who have the
       
   133     * corresponding profile instantiated.
       
   134     * @param aProfileId the id of failed profile
       
   135     * @param aError an occurred error
       
   136     */
       
   137     virtual void ProfileRegistryErrorOccurred(
       
   138         TUint32 aProfileId,
       
   139         TInt aError );
       
   140 
       
   141 // from base class MMusAvaSipConnectionAdapter
       
   142 
       
   143 public:
       
   144 
       
   145    /**
       
   146 	* Connection state has changed.
       
   147     * If connection state has changed to EInactive or EUnavailable,
       
   148 	* SIP stack has removed all stand-alone SIP refreshes, registrations
       
   149 	* and dialog associations that client requested to refresh. Client may
       
   150 	* re-issue refresh requests (stand-alone, registration or dialog
       
   151 	* association related) when connection becomes EActive again.
       
   152 	* SIP stack also terminates all pending SIP client transactions and no
       
   153     * errors are reported back to the client about the terminated
       
   154     * transactions nor about removed refreshes in order to avoid event
       
   155     * flood.
       
   156 	*
       
   157 	* @param aState indicates the current connection state
       
   158 	*/
       
   159 	TInt ConnectionStateChanged (CSIPConnection::TState aState );
       
   160 
       
   161 
       
   162 private: // Helpers
       
   163 
       
   164    /**
       
   165 	* Creates proposal sip address and send event.
       
   166 	*
       
   167 	*/
       
   168     void CreateSipAddressProposalL();
       
   169     
       
   170     /**
       
   171 	* Enables SIP Register.
       
   172 	*
       
   173 	*/
       
   174     void EnableRegisterL();
       
   175 
       
   176    /**
       
   177 	* Initialize SIP Register request.
       
   178 	*
       
   179 	* @return ETrue if Register request was initialized
       
   180     *         successfully; EFalse otherwise
       
   181 	*/
       
   182     TBool InitializeRegister();
       
   183 
       
   184    /**
       
   185 	* Send SIP Register request.
       
   186 	*
       
   187 	* @return ETrue if Register operation was
       
   188     *         successfully executed; EFalse otherwise
       
   189 	*/
       
   190     TBool RegisterL();
       
   191     
       
   192     /**
       
   193 	* Update SIP profile for general data.
       
   194 	*
       
   195 	* @return ETrue if SIP Profile was found; 
       
   196 	* EFalse otherwise
       
   197 	*/
       
   198     TBool UpdateSIPProfile();
       
   199     
       
   200      /**
       
   201 	* Current SIP profile status.
       
   202 	*
       
   203 	* @return ETrue if SIP Profile is registred; 
       
   204 	* EFalse otherwise
       
   205 	*/
       
   206     TBool RegistrationStatusL();
       
   207     
       
   208 private: // Data
       
   209 
       
   210     /**
       
   211      * Pointer to CMusAvaSharedObject object
       
   212      */
       
   213      CMusAvaSharedObject* iSharedObj;
       
   214 
       
   215     /**
       
   216      * Pointer to CSIPProfileRegistry object
       
   217      */
       
   218      CSIPProfileRegistry* iRegistry;
       
   219 
       
   220 	/**
       
   221      * Reference to CMusAvaSettingsImp object
       
   222      */
       
   223      CMusAvaSettingsImp& iSettings;
       
   224 
       
   225     /**
       
   226      * Pointer to CSIPConnection object
       
   227      */
       
   228      CSIPConnection* iConnection;
       
   229 
       
   230      MusSettingsKeys::TOperatorVariant iOperatorVariant;
       
   231     MUS_UNITTEST( UT_CMusAvaRegisterAvailability )
       
   232     };
       
   233 
       
   234 
       
   235 #endif // __MUSAVAREGISTERAVAILABILITY_H__