mmsharing/mmshavailability/inc/musavaoptionhandler.h
changeset 0 f0cf47e981f9
child 32 73a1feb507fb
equal deleted inserted replaced
-1:000000000000 0:f0cf47e981f9
       
     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 *
       
     9 * Initial Contributors:
       
    10 * Nokia Corporation - initial contribution.
       
    11 *
       
    12 * Contributors:
       
    13 *
       
    14 * Description:  Provide interface for the client request in capabilty
       
    15 *                availability.
       
    16 *
       
    17 */
       
    18 
       
    19 #ifndef __MUSAVAOPTIONHANDLER_H__
       
    20 #define __MUSAVAOPTIONHANDLER_H__
       
    21 
       
    22 #include <e32base.h>
       
    23 #include <badesca.h>
       
    24 #include "musavaavailability.h"
       
    25 #include "musavaobserver.h"
       
    26 #include "musunittesting.h"
       
    27 #include "mmusavacapabilityqueryobserver.h"
       
    28 
       
    29 class CMusAvaSharedObject;
       
    30 class MMusAvaAvailabilityObserver;
       
    31 class CMusAvaCapabilitySipAgent;
       
    32 class CMusAvaCapabilityExchange;
       
    33 class CMusAvaCapability;
       
    34 class CMusAvaCapabilityQueryBase;
       
    35 class CMusAvaSettingsImp;
       
    36 
       
    37 
       
    38 /**
       
    39  *  Implements handling of non-desired SIP invites.
       
    40  *
       
    41  *  Provide interface for the client to availability class.
       
    42  *
       
    43  *  @lib musavailabilityplugin.lib
       
    44  *  @since S60 v3.2
       
    45  */
       
    46 class CMusAvaOptionHandler : public CMusAvaAvailability,
       
    47                              public MMusAvaCapabilityQueryObserver
       
    48 	{
       
    49 public:
       
    50 	/**
       
    51      * Two-phased constructor
       
    52      *
       
    53      * @param aObserver Pointer to observer intercase
       
    54      * @param aSettings Availability settings.
       
    55      * @return Returns pointer to CMusAvaInterface object
       
    56      */
       
    57     static CMusAvaOptionHandler* NewL(
       
    58         MMusAvaAvailabilityObserver& aObserver,
       
    59         CMusAvaSettingsImp& aSettings );
       
    60 
       
    61 	/**
       
    62      * Two-phased constructor
       
    63      *
       
    64      * @param aObserver Pointer to observer intercase
       
    65      * @param aSettings Availability settings.
       
    66      * @return Returns pointer to CMusAvaInterface object
       
    67      */
       
    68 	static CMusAvaOptionHandler* NewLC(
       
    69         MMusAvaAvailabilityObserver& aObserver,
       
    70         CMusAvaSettingsImp& aSettings );
       
    71 
       
    72 	/**
       
    73      * Destructor
       
    74      */
       
    75 	~CMusAvaOptionHandler();
       
    76 
       
    77 protected:
       
    78 
       
    79 	/**
       
    80      * Constructor
       
    81      *
       
    82      * @since S60 v3.2
       
    83      * @param aObserver Pointer to observer intercase
       
    84      * @param aName availability name
       
    85      * @param aModules is data container
       
    86      */
       
    87 
       
    88 	CMusAvaOptionHandler(
       
    89 	    MMusAvaAvailabilityObserver& aObserver,
       
    90         CMusAvaSettingsImp& aSettings );
       
    91 
       
    92 	void ConstructL();
       
    93 
       
    94     void ConstructCapabilityExchangeL();
       
    95 
       
    96     HBufC8* ConstructTerminalIdL();
       
    97 
       
    98 public: // from base class CMusAvaAvailability
       
    99 
       
   100     /**
       
   101      * Executes for the availability.
       
   102      *
       
   103      * @since S60 v3.2
       
   104      * @return KErrNone if ExecutePatternL operation was
       
   105      *         successfully executed; system wide error otherwise
       
   106      */
       
   107     virtual void DoExecuteL();
       
   108 
       
   109 
       
   110     /**
       
   111      * Stop the execution.
       
   112      *
       
   113      * @since S60 v3.2
       
   114      * @return KErrNone if stop operation was successfully executed;
       
   115      *         system wide error otherwise
       
   116      */
       
   117     virtual void Stop();
       
   118 
       
   119     /**
       
   120      * From CMusAvaAvailability.
       
   121      * Returns availability name.
       
   122      *
       
   123      * @return Name of *this* availability.
       
   124      */
       
   125     virtual MMusAvaObserver::TAvailabilityName Name();
       
   126     
       
   127 
       
   128 public: // functions from base class MMusAvaCapabilityQueryObserver
       
   129 
       
   130     void CapabilitiesResolved( const CMusAvaCapabilityQueryBase& aSentQuery );
       
   131 
       
   132     void CapabilitiesResolvedL( const TDesC& aUri );
       
   133 
       
   134     void SetCapabilitiesResolvedForCingular();
       
   135 
       
   136     TBool CapabilitiesResolvedForCingular();   
       
   137     
       
   138     /**
       
   139      * This is to advertise MMusAvaCapabilityQueryObserver implementors
       
   140      * about sip header change. It is mainly used in below scneraio but could
       
   141      * be used in future if anyother sip headers has to be set.
       
   142      * 
       
   143      * Incase if we receive OPTIONS request already and 
       
   144      * P-Asserted-Identity Header is present then OPTIONS
       
   145      * request should be sent to this ID. This function should be
       
   146      * called to configure this id in CMusAvaSettingsImp& iSettings
       
   147      *
       
   148      * @aHeaders Array of SIP Headers.    
       
   149      * @aHeaderType Type of the header.
       
   150      * Leavs if Array is empty or pointer is NULL.
       
   151      * Ownership Transferred.
       
   152      */
       
   153     void SipHeadersL(const MDesCArray& aHeaders,
       
   154                           SipStrConsts::TStrings aHeaderType);
       
   155 
       
   156     /**
       
   157      * Advertise about video codec capabilities     
       
   158      */
       
   159     void VideoCodecsResolvedL( const MDesCArray& aVideoCodecs );
       
   160 
       
   161 
       
   162     TBool CapabilityQueryAnswered( TBool aAnswered );
       
   163 
       
   164 private:
       
   165 
       
   166     /**
       
   167      * Reference to availability settings (data store)
       
   168      */
       
   169     CMusAvaSettingsImp&         iSettings;
       
   170 
       
   171 	/**
       
   172      * Pointer to CMusAvaSharedObject object
       
   173      */
       
   174 	CMusAvaSharedObject*        iSharedObj;
       
   175 
       
   176     CMusAvaCapabilitySipAgent*  iSipAgent;
       
   177     CMusAvaCapabilityExchange*  iCapabilityExchange;
       
   178     CMusAvaCapability*          iSwisCapability;
       
   179     TBool                       iCapabilitiesRequestAnswered;
       
   180     TBool                       iCapabilityQueryAnswered;
       
   181     
       
   182     MUS_UNITTEST ( UT_CMusAvaOptionHandler )
       
   183     MUS_UNITTEST ( UT_CMusAvaCapabilityExchange )
       
   184     MUS_UNITTEST ( UT_CMusAvaCapability )
       
   185     MUS_UNITTEST ( UT_CMusAvaTerminal )
       
   186     MUS_UNITTEST ( UT_CMusAvaCapabilitySipAgent )
       
   187     MUS_UNITTEST ( UT_CMusAvaCapabilityQuery )
       
   188     };
       
   189 
       
   190 #endif // __MUSAVAOPTIONHANDLER_H__