voipplugins/sipconnectionprovider/inc/scpservicemanager.h
branchRCL_3
changeset 22 d38647835c2e
equal deleted inserted replaced
21:f742655b05bf 22:d38647835c2e
       
     1 /*
       
     2 * Copyright (c) 2006-2009 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 *
       
    16 */
       
    17 
       
    18 
       
    19 #ifndef C_CSCPSERVICEMANAGER_H
       
    20 #define C_CSCPSERVICEMANAGER_H
       
    21 
       
    22 #include <cchservice.h>
       
    23 
       
    24 #include "scpdefs.h"
       
    25 #include "scpstatecontainer.h"
       
    26 
       
    27 class CScpSettingHandler;
       
    28 class CScpProfileHandler;
       
    29 class CScpServiceStorage;
       
    30 class CScpService;
       
    31 class CScpSubService;
       
    32 class CScpSipConnection;
       
    33 
       
    34 /**
       
    35 *  CScpServiceManager class
       
    36 *  @lib sipconnectionprovider.dll
       
    37 */
       
    38 class CScpServiceManager : public CBase
       
    39     {
       
    40 public:    
       
    41 
       
    42     /**
       
    43     * Two-phased constructor
       
    44     */
       
    45     static CScpServiceManager* NewL( MCchServiceObserver& aServiceObserver );
       
    46 
       
    47     /**
       
    48     * Destructor.
       
    49     */
       
    50     virtual ~CScpServiceManager();
       
    51 
       
    52 public: // New functions
       
    53    
       
    54     /**
       
    55      * Client enables service. CCHService implementation
       
    56      * should use MCCHServiceObserver for service state notifications.
       
    57      * @see MCCHServiceObserver
       
    58      * @param aServiceId
       
    59      */
       
    60     void EnableServiceL( TUint aServiceId,
       
    61                          TCCHSubserviceType aSubServiceType );
       
    62                                  
       
    63     /**
       
    64      * Client enables service. CCHService implementation
       
    65      * should use MCCHServiceObserver for service state notifications.
       
    66      * @see MCCHServiceObserver
       
    67      * @param aServiceId
       
    68      * @param aIapId
       
    69      */
       
    70     void EnableServiceL( TUint aServiceId,
       
    71                          TCCHSubserviceType aSubServiceType,
       
    72                          TUint aIapId );
       
    73     
       
    74     /**
       
    75      * Client disables service. 
       
    76      * @param aServiceId
       
    77      */
       
    78     void DisableServiceL( TUint aServiceId,
       
    79                           TCCHSubserviceType aSubServiceType );
       
    80     
       
    81     /**
       
    82      * Client checks is the service available by the IAP id array.
       
    83      * CCHService implementation should return ETrue if service is
       
    84      * registrable by the (some) IAP, array contains. 
       
    85      * @param aServiceId
       
    86      * @param aIapIdArray Id array of the currently available iaps.
       
    87      * @return ETrue if service is available.
       
    88      */
       
    89     TBool IsAvailableL( TUint aServiceId,
       
    90                         TCCHSubserviceType aSubServiceType,
       
    91                         const RArray<TUint32>& aIapIdArray ) const;
       
    92     
       
    93     /**
       
    94      * Get service state information.
       
    95      * @param aServiceId
       
    96      * @param aState Current service state.
       
    97      * @return General symbian error code.
       
    98      */
       
    99     TInt GetServiceState( TUint aServiceId,
       
   100                           TCCHSubserviceType aSubServiceType, 
       
   101                           TCCHSubserviceState& aState ) const;
       
   102     
       
   103     /**
       
   104      * Get service network information.
       
   105      * @param aServiceId
       
   106      * @param aSnapId Used Snap id (should be set as null if
       
   107      *               not in use)
       
   108      * @param aIapId Used IAP id (should be set as null if
       
   109      *               not in use)
       
   110      * @param aSnapLocked Is snap locked or not.
       
   111      * @param aPasswordSet Is password set or not.
       
   112      * @return General symbian error code.
       
   113      */
       
   114     TInt GetServiceNetworkInfo( TUint aServiceId,
       
   115                                 TCCHSubserviceType aSubServiceType,
       
   116                                 TUint32& aSnapId, 
       
   117                                 TUint32& aIapId,
       
   118                                 TBool& aSnapLocked,
       
   119                                 TBool& aPasswordSet ) const;
       
   120                                         
       
   121     /**
       
   122      * Set Snap id for service.
       
   123      * @param aServiceId
       
   124      * @param aSnapId 
       
   125      * @return General symbian error code.
       
   126      */
       
   127     TInt SetSnapId( TUint aServiceId,
       
   128                     TCCHSubserviceType aSubServiceType,
       
   129                     TUint aSnapId );
       
   130                     
       
   131     /**
       
   132      * Set IAP id for service.
       
   133      * @param aServiceId
       
   134      * @param aSnapId 
       
   135      * @return General symbian error code.
       
   136      */
       
   137     TInt SetIapId( TUint aServiceId,
       
   138                    TCCHSubserviceType aSubServiceType,
       
   139                    TUint aIapId );                               
       
   140     
       
   141     /**
       
   142      * Get service specifics information about service and protocol
       
   143      * @param aServiceId
       
   144      * @param aSubservice
       
   145      * @param aBuffer  
       
   146      */
       
   147     void GetServiceInfoL( TUint aServiceId,
       
   148                           TCCHSubserviceType aSubServiceType,
       
   149                           RBuf& aBuffer ) const;
       
   150 
       
   151     /**
       
   152      * Sets service reserved or unreserved
       
   153      * @param aReserved Reserved
       
   154      * @param aServiceId
       
   155      * @param aSubServiceType Sub service type
       
   156      * @return Symbian error codes
       
   157      */
       
   158     TInt SetServiceReserved( TBool aReserved,
       
   159                              TUint aServiceId,
       
   160                              TCCHSubserviceType aSubServiceType );
       
   161 
       
   162     /**
       
   163      * Returns service reserved info
       
   164      * @param aServiceId
       
   165      * @param aSubServiceType Sub service type
       
   166      * @return ETrue if reserved
       
   167      */
       
   168     TBool IsReserved( TUint aServiceId,
       
   169                       TCCHSubserviceType aSubServiceType ) const;                              
       
   170 
       
   171 
       
   172     /**
       
   173      * Returns the connection parameters
       
   174      * @since S60 3.2.3
       
   175      * @param aServiceSelection Selected service, ID and type
       
   176      * @param aParameter Connection parameter of the service
       
   177      * @param aValue Value of the parameter
       
   178      * @leave Symbian error code
       
   179      */
       
   180     void GetConnectionParameterL( const TServiceSelection& aServiceSelection,
       
   181                                   TCchConnectionParameter aParameter,
       
   182                                   TInt& aValue ) const;
       
   183     
       
   184     /**
       
   185      * Returns the connection parameters
       
   186      * @since S60 3.2.3
       
   187      * @param aServiceSelection Selected service, ID and type
       
   188      * @param aParameter Connection parameter of the service
       
   189      * @param aValue Value of the parameter
       
   190      * @leave Symbian error code
       
   191      */
       
   192     void GetConnectionParameterL( const TServiceSelection& aServiceSelection, 
       
   193                                   TCchConnectionParameter aParameter,
       
   194                                   RBuf& aValue ) const;
       
   195     
       
   196     /**
       
   197      * Sets the connection parameters
       
   198      * @since S60 3.2.3
       
   199      * @param aServiceSelection Selected service, ID and type
       
   200      * @param aParameter Connection parameter of the service
       
   201      * @param aValue Value of the parameter
       
   202      * @leave Symbian error code
       
   203      */
       
   204     void SetConnectionParameterL( const TServiceSelection& aServiceSelection, 
       
   205                                  TCchConnectionParameter aParameter,
       
   206                                  TInt aValue );
       
   207     
       
   208     /**
       
   209      * Sets the connection parameters
       
   210      * @since S60 3.2.3
       
   211      * @param aServiceSelection Selected service, ID and type
       
   212      * @param aParameter Connection parameter of the service
       
   213      * @param aValue Value of the parameter
       
   214      * @leave Symbian error code
       
   215      */
       
   216     void SetConnectionParameterL( const TServiceSelection& aServiceSelection, 
       
   217                                   TCchConnectionParameter aParameter,
       
   218                                   const TDesC& aValue );
       
   219 
       
   220     
       
   221     
       
   222 private:
       
   223 
       
   224     /**
       
   225      * Default constructor
       
   226      * @param aStateObserver State Observer
       
   227      */
       
   228     CScpServiceManager( MCchServiceObserver& aServiceObserver );
       
   229     
       
   230     /**
       
   231      * 2nd phase constructor
       
   232      */
       
   233     void ConstructL();
       
   234                            
       
   235     /**
       
   236      * Get service network information. Leaves on failure.
       
   237      * @param aServiceId
       
   238      * @param a Sub service type
       
   239      * @param aSnapId Used Snap id (should be set as null if
       
   240      *               not in use)
       
   241      * @param aIapId Used IAP id (should be set as null if
       
   242      *               not in use)
       
   243      * @param aSnapLocked Snap locked
       
   244      */
       
   245     void GetServiceNetworkInfoL( TUint aServiceId,
       
   246                                  TCCHSubserviceType aSubServiceType,
       
   247                                  TUint32& aSnapId, 
       
   248                                  TUint32& aIapId,
       
   249                                  TBool& aSnapLocked,
       
   250                                  TBool& aPasswordSet ) const;
       
   251                                                                 
       
   252     /** 
       
   253      * Handles ALR events.
       
   254      * @param aServiceId Service Id
       
   255      * @param a Sub service type
       
   256      * @param aConnectionCreated ETrue if connection was created
       
   257      * @return SipConnection if exists
       
   258      */   
       
   259     CScpSipConnection* GetSipConnectionL( TUint aServiceId,
       
   260                                           TCCHSubserviceType aSubServiceType,
       
   261                                           TBool& aConnectionCreated ) const;
       
   262 
       
   263     /**
       
   264      * Gets and updates a service
       
   265      * @param aServiceId Service Id
       
   266      * @param a Sub service type
       
   267      * @return Service, NULL if failed
       
   268      */
       
   269     CScpService* GetServiceL( TUint aServiceId,
       
   270                               TCCHSubserviceType aSubServiceType );
       
   271 
       
   272     /**
       
   273      * Creates and updates a service. The service is saved to
       
   274      * service storage.
       
   275      * @param aServiceId Service Id
       
   276      * @param a Sub service type
       
   277      * @return Service
       
   278      */
       
   279     CScpService* CreateServiceL( TUint aServiceId,
       
   280                                  TCCHSubserviceType aSubServiceType );
       
   281 
       
   282     /**
       
   283      * Creates and updates a temporary service. The service is not
       
   284      * saved to service storage. These use cases are due to network
       
   285      * info queries.
       
   286      * @param aServiceId Service Id
       
   287      * @param a Sub service type
       
   288      * @return Service
       
   289      */
       
   290     CScpService* CreateTemporaryServiceL( TInt aServiceId,
       
   291                                           TCCHSubserviceType aSubServiceType ) const;
       
   292 
       
   293     /**
       
   294      * Set access point for a service
       
   295      * @param aServiceId Service Id
       
   296      * @param aSubServiceType Sub service type
       
   297      * @param aAccessPointType Access point type
       
   298      * @param aAccessPointId Id
       
   299      * @return Error code
       
   300      */ 
       
   301     TInt SetAccessPointId( TUint aServiceId,
       
   302                            TCCHSubserviceType aSubServiceType, 
       
   303                            TScpAccessPointType aAccessPointType, 
       
   304                            TInt aAccessPointId );
       
   305     
       
   306     /**
       
   307      * Updates the prfile handler's user agent header. Use before.
       
   308      * @param aServiceId Service Id
       
   309      * @param a SubServiceType sub service type
       
   310      */
       
   311     void UpdateProfileValuesL( TUint aServiceId, TCCHSubserviceType aSubServiceType ) const;
       
   312      
       
   313     /**
       
   314      * Updates username/password to XDM-setting
       
   315      * @param aServiceId Service Id
       
   316      * @param aUsername username
       
   317      * @param aSetUsername ETrue if username wish to be set
       
   318      * @param aPassword password
       
   319      * @param aSetPassword ETrue if username wish to be set
       
   320      */
       
   321     void SetUsernameAndPasswordToXdmL( 
       
   322         TUint aServiceId,
       
   323         const TDesC8& aUsername,
       
   324         TBool aSetUsername,
       
   325         const TDesC8& aPassword,
       
   326         TBool aSetPassword );
       
   327     
       
   328     /**
       
   329      * Checks restricted connections. In case where voip is not 
       
   330      * allowed via 3g and 3g ap is first ap, leave with error 
       
   331      * KCCHErrorAccessPointNotDefined so user can select another ap.
       
   332      * @param aServiceId Service Id
       
   333      */
       
   334     void CheckRestrictedConnectionsL( TUint aServiceId );
       
   335     
       
   336 private:  
       
   337 
       
   338     /**
       
   339      * Observer for state changes
       
   340      */
       
   341     MCchServiceObserver& iServiceObserver; 
       
   342     
       
   343     /**
       
   344      * Setting handler. Own.
       
   345      */ 
       
   346     CScpSettingHandler* iSettingHandler;
       
   347 
       
   348     /**
       
   349      * Setting handler. Own.
       
   350      */     
       
   351     CScpProfileHandler* iProfileHandler;
       
   352 
       
   353     /**
       
   354      * Service settings storage. Own.
       
   355      */    
       
   356     CScpServiceStorage* iServiceStorage;
       
   357     
       
   358     /**
       
   359      * Service state container. Singleton.
       
   360      */
       
   361     TScpStateContainer iStateContainer;
       
   362 
       
   363 private:
       
   364 
       
   365 #ifdef _DEBUG
       
   366     friend class T_CScpServiceManager;
       
   367     friend class T_CScpSipHelper;
       
   368     friend class T_CScpService;
       
   369     friend class T_CScpSettingHandler;
       
   370 #endif
       
   371     
       
   372     };    
       
   373 
       
   374 #endif  // C_CSCPSERVICEMANAGER_H
       
   375 
       
   376 // End of file
       
   377