voipplugins/sipconnectionprovider/inc/scpservice.h
branchRCL_3
changeset 22 d38647835c2e
parent 0 a4daefaec16c
equal deleted inserted replaced
21:f742655b05bf 22:d38647835c2e
       
     1 /*
       
     2 * Copyright (c) 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:  
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 #ifndef C_SCPSERVICE_H
       
    20 #define C_SCPSERVICE_H
       
    21 
       
    22 #include <e32base.h>
       
    23 #include <cchservice.h>
       
    24 
       
    25 #include "scpdefs.h"
       
    26 
       
    27 /**
       
    28  *  SCP service info.
       
    29  *  @lib sipconnectionprovider.dll
       
    30  */
       
    31 class CScpSubService;
       
    32 class CScpServiceStorage;
       
    33 class CScpProfileHandler;
       
    34 class CScpSipConnection;
       
    35 
       
    36 class CScpService : public CBase
       
    37     {
       
    38 public:
       
    39 
       
    40     /**
       
    41      * Constructor
       
    42      * @param aId Internal id
       
    43      * @param aServiceId Service Id
       
    44      */ 
       
    45     static CScpService* NewL( TInt aId, 
       
    46                               TInt aServiceId,
       
    47                               CScpProfileHandler& aProfileHandler,
       
    48                               CScpServiceStorage& aServiceStorage,
       
    49                               MCchServiceObserver& aServiceObserver );
       
    50     
       
    51     /**
       
    52      * Destructor
       
    53      */ 
       
    54     ~CScpService();
       
    55 
       
    56     /**
       
    57      * Returns internal id of this service
       
    58      * @return Id
       
    59      */ 
       
    60     TInt Id() const;
       
    61 
       
    62     /**
       
    63      * Returns profile handler
       
    64      */
       
    65     CScpProfileHandler& ProfileHandler() const;
       
    66 
       
    67     /**
       
    68      * Returns service storage
       
    69      */
       
    70     CScpServiceStorage& ServiceStorage() const;
       
    71 
       
    72     /**
       
    73      * Returns service observer
       
    74      */
       
    75     MCchServiceObserver& ServiceObserver() const;
       
    76 
       
    77     /**
       
    78      * Adds a new subservice to the service and returns it
       
    79      * @return New subservice
       
    80      */ 
       
    81     CScpSubService& AddSubServiceL( TCCHSubserviceType aSubServiceType );
       
    82 
       
    83     /**
       
    84      * Returns count of subservices for this service
       
    85      * @returns Count of subservices
       
    86      */ 
       
    87     TInt SubServiceCount() const;
       
    88 
       
    89     /**
       
    90      * Fills all internal ids of the subservices within this service 
       
    91      * to the given aray
       
    92      * @param aIds Id array to be filled
       
    93      */ 
       
    94     void GetSubServiceIds( RArray<TInt>& aIds ) const;
       
    95 
       
    96     /**
       
    97      * Returns a subservice with the given id
       
    98      * @param aId Internal id of the subservice 
       
    99      */ 
       
   100     CScpSubService* GetSubService( TInt aId ) const;
       
   101 
       
   102     /**
       
   103      * Removes a subservice from this service with given id
       
   104      * @param aId Internal id of the subservice
       
   105      * @return KErrNone if successfull
       
   106      */ 
       
   107     TInt RemoveSubService( TInt aId );
       
   108 
       
   109     /**
       
   110      * Returns service id of this service
       
   111      * @return service id
       
   112      */ 
       
   113     TInt ServiceId() const;
       
   114 
       
   115     /**
       
   116      * Sets service id for this service
       
   117      * @param aServiceId Service Id
       
   118      */ 
       
   119     void SetServiceId( TInt aServiceId );
       
   120 
       
   121     /**
       
   122      * Returns state of the service by sub service type
       
   123      * @param aSubServiceType Sub service type
       
   124      * @param aState Result state
       
   125      * @return Symbian error codes
       
   126      */ 
       
   127     TInt State( TCCHSubserviceType aSubServiceType, 
       
   128                 TCCHSubserviceState& aState ) const;
       
   129 
       
   130     /**
       
   131      * Queries if this service contains a subservice with the given type
       
   132      * @return ETrue if sub service with given type exists
       
   133      */ 
       
   134     TBool ContainsSubServiceType( TCCHSubserviceType aSubServiceType ) const;
       
   135 
       
   136     /**
       
   137      * Returns a sub service from this service based on a type
       
   138      * @param a Type
       
   139      * @return Sub service
       
   140      */
       
   141     CScpSubService* GetSubServiceByType( TCCHSubserviceType aSubServiceType ) const;
       
   142 
       
   143     /**
       
   144      * Checks if sub services of this service contain same sip profile
       
   145      * @return ETrue if they contain the same profile
       
   146      */
       
   147     TBool SubServicesContainSameSipProfile() const;
       
   148 
       
   149     /**
       
   150      * Sets reservation status for the service based on type
       
   151      * @param aReserved Reserved
       
   152      * @param aSubServiceType Sub service type
       
   153      * @return Error code
       
   154      */
       
   155     TInt SetReserved( TBool aReserved, TCCHSubserviceType aSubServiceType );
       
   156 
       
   157     /**
       
   158      * Returns reservation status for the service based on type
       
   159      * @param aSubServiceType Sub service type
       
   160      * @return ETrue if reserved
       
   161      */
       
   162     TBool IsReserved( TCCHSubserviceType aSubServiceType ) const;
       
   163 
       
   164     /**
       
   165      * Set access point for the service
       
   166      * @param aSubServiceType Sub service type
       
   167      * @param aAccessPointType Access point type
       
   168      * @param aAccessPointId Id
       
   169      * @return Error code
       
   170      */ 
       
   171     TInt SetAccessPointId( TCCHSubserviceType aSubServiceType, 
       
   172                            TScpAccessPointType aAccessPointType, 
       
   173                            TInt aAccessPointId );
       
   174     
       
   175     /**
       
   176      * Checks is all subservices in disabled state
       
   177      * @return TBool ETrue if all service's subservices are in disabled state
       
   178      */
       
   179     TBool IsAllSubservicesDisabled() const;
       
   180     
       
   181     /**
       
   182      * Change all service's subservices last error to given error
       
   183      * @param aError error which to be set
       
   184      */
       
   185     void ChangeLastReportedErrors( const TInt aError );
       
   186 
       
   187 private:
       
   188 
       
   189     /**
       
   190      * Default constructor hidden
       
   191      * @param aId Internal id
       
   192      * @param aServiceId Service Id
       
   193      */ 
       
   194     CScpService( TInt aId, 
       
   195                  TInt aServiceId,
       
   196                  CScpProfileHandler& aProfileHandler, 
       
   197                  CScpServiceStorage& aServiceStorage,
       
   198                  MCchServiceObserver& aServiceObserver );
       
   199     
       
   200     /**
       
   201      * Generates new internal sub service id
       
   202      * @return New id
       
   203      */ 
       
   204     TInt GenerateNewSubServiceId();
       
   205 
       
   206     /**
       
   207      * Checks if the service's access point can be modified
       
   208      * @param aSubServiceType Sub service type
       
   209      * @return ETrue if modifiable
       
   210      */ 
       
   211     TBool IsAccessPointModifiable( TCCHSubserviceType aSubServiceType ) const;
       
   212 
       
   213     /**
       
   214      * Gets sip connection that the service is using
       
   215      * @param aSubServiceType Sub service type
       
   216      * @param aSipConnectionCreated ETrue if the connection was created
       
   217      * @return Sip connection.
       
   218      */ 
       
   219     CScpSipConnection* GetSipConnection( TCCHSubserviceType aSubServiceType,
       
   220                                          TBool& aSipConnectionCreated );
       
   221 
       
   222 private:
       
   223 
       
   224     /**
       
   225      * Internal sub service id
       
   226      */ 
       
   227     TInt iId;
       
   228     
       
   229     /**
       
   230      * Service id.
       
   231      */     
       
   232     TInt iServiceId;
       
   233 
       
   234     /**
       
   235      * Profile handler.
       
   236      */
       
   237     CScpProfileHandler& iProfileHandler;
       
   238 
       
   239     /**
       
   240      * Service storage
       
   241      */
       
   242     CScpServiceStorage& iServiceStorage; 
       
   243 
       
   244     /**
       
   245      * Service Observer
       
   246      */
       
   247     MCchServiceObserver& iServiceObserver;
       
   248     
       
   249     /**
       
   250      * Default sip profile.
       
   251      */     
       
   252     TInt iDefaultSipProfileId;
       
   253     
       
   254     /**
       
   255      * Sub services of this service
       
   256      */
       
   257     RPointerArray< CScpSubService > iSubServices; 
       
   258 
       
   259     /**
       
   260      * Counter for creating unique internal sub service ids
       
   261      */     
       
   262     TInt iSubServiceIdCounter;
       
   263     };
       
   264 
       
   265 
       
   266 
       
   267 #endif // C_SCPSERVICE_H