voipplugins/sipconnectionprovider/inc/scpservicestorage.h
branchRCL_3
changeset 21 f742655b05bf
parent 20 65a3ef1d5bd0
child 22 d38647835c2e
equal deleted inserted replaced
20:65a3ef1d5bd0 21:f742655b05bf
     1 /*
       
     2 * Copyright (c) 2002-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_CSCSERVICESTORAGE_H
       
    20 #define C_CSCSERVICESTORAGE_H
       
    21 
       
    22 #include <e32base.h>
       
    23 #include <cchclientserver.h>
       
    24 
       
    25 #include "scpdefs.h"
       
    26 
       
    27 class CScpService;
       
    28 class CScpSubService;
       
    29 class CScpProfileHandler;
       
    30 class CScpSettingHandler;
       
    31 class MCchServiceObserver;
       
    32 
       
    33 /**
       
    34 *  Service storage class.
       
    35 *
       
    36 *  @lib sipconnectionprovider.dll
       
    37 */
       
    38 class CScpServiceStorage : public CBase
       
    39     {
       
    40 public:  // Constructors and destructor
       
    41 
       
    42     /**
       
    43      * Two-phased constructor
       
    44      */
       
    45     static CScpServiceStorage* NewL(CScpSettingHandler& iScpSettingHandler);  
       
    46     
       
    47     /**
       
    48      * Destructor.
       
    49      */
       
    50     virtual ~CScpServiceStorage();
       
    51 
       
    52     /**
       
    53      * Creates a service to the storage.
       
    54      * @param aService Service settings.
       
    55      */
       
    56     CScpService& CreateServiceL( TInt aServiceId, 
       
    57                                  CScpProfileHandler& aProfileHandler,
       
    58                                  MCchServiceObserver& aServiceObserver );
       
    59 
       
    60     /**
       
    61      * Removes a service from the storage by internal id.
       
    62      * @param aId Id of the service.
       
    63      */
       
    64     TInt RemoveService( TInt aId );
       
    65 
       
    66     /**
       
    67      * Removes services with disabled or no subservices from the storage.
       
    68      * @since Series 60 3.0
       
    69      */
       
    70     void RemoveDisabledServices();
       
    71 
       
    72     /**
       
    73      * Returns a service from the storage by id.
       
    74      * @param aId Id of the service.
       
    75      * @return Service if found (ownership not transferred) - otherwise NULL
       
    76      */
       
    77     CScpService* GetService( TInt aId ) const;
       
    78             
       
    79     /**
       
    80      * Fills all internal ids of the services to the given array.
       
    81      * @param aIds Internal ids of the services.
       
    82      */
       
    83     void GetServiceIds( RArray<TInt>& aIds ) const;
       
    84 
       
    85     /**
       
    86      * Returns a service from the storage by service id.
       
    87      * @param aId Service id of the service.
       
    88      * @return Service if found (ownership not transferred) - otherwise NULL
       
    89      */
       
    90     CScpService* GetServiceByServiceId( TUint aServiceId ) const;               
       
    91 
       
    92     /**
       
    93      * Returns a sub service from the storage by sub service internal id.
       
    94      * @param aId Internal id of the sub service.
       
    95      * @return Sub service if found (ownership not transferred) - otherwise NULL
       
    96      */
       
    97     CScpSubService* GetSubService( TInt aId ) const;
       
    98 
       
    99     /**
       
   100      * Fills all internal sub service ids to the given array.
       
   101      * @param aIds Array of sub service internal ids.
       
   102      */
       
   103     void GetSubServiceIds( RArray<TInt>& aIds ) const;
       
   104 
       
   105     /**
       
   106      * Fills all internal sub service ids by type to the given array.
       
   107      * @param aIds Array of sub service internal ids.
       
   108      */
       
   109     void GetSubServiceIds( TCCHSubserviceType aSubServiceType,
       
   110                            RArray<TInt>& aIds ) const;
       
   111 
       
   112     /**
       
   113      * Fills sub service ids to the given array that match profile id and type
       
   114      * @param aProfileId Sip profile id
       
   115      * @param a Sub service type
       
   116      * @param aIds Array of sub service internal ids.
       
   117      */
       
   118     void GetSubServiceIds( TUint32 aProfileId,
       
   119                            TCCHSubserviceType aSubServiceType, 
       
   120                            RArray<TInt>& aIds ) const;
       
   121 
       
   122     /**
       
   123      * Queries if a sub service with given profile id is enabled
       
   124      * @param aProfileId Sip profile id
       
   125      * @return ETrue if enabled
       
   126      */
       
   127     TBool IsSubServiceEnabled( TUint32 aProfileId ) const;
       
   128 
       
   129     /**
       
   130      * Queries if all sub service with given profile ids are
       
   131      * disconnected from service. 
       
   132      * @param aProfileId Sip profile id
       
   133      * @return ETrue if all are disconnected
       
   134      */
       
   135     TBool AreAllSubServicesDisconnected( TUint32 aProfileId ) const;
       
   136    
       
   137    /**
       
   138      * Returns CScpSettingHandler 
       
   139      * @return CScpSettingHandler reference
       
   140      */
       
   141     CScpSettingHandler& SettingsHandler();
       
   142 
       
   143 #ifdef _DEBUG
       
   144     void GetDebugInfo( TDes& aInfo ) const;
       
   145 #endif
       
   146 
       
   147 private:  // Constructors
       
   148 
       
   149     /**
       
   150      * C++ default constructor.
       
   151      */
       
   152     CScpServiceStorage(CScpSettingHandler& aScpSettingHandler);
       
   153     
       
   154     /**
       
   155      * Generates a new internal id for a service
       
   156      * @return Ner internal id
       
   157      */
       
   158     TInt GenerateNewInternalIdForService();
       
   159 
       
   160 private:
       
   161 
       
   162     // Settings handler
       
   163     CScpSettingHandler& iSettingHandler;
       
   164 
       
   165     // Services
       
   166     RPointerArray<CScpService> iServiceItems;
       
   167 
       
   168     // Counter for generating unique internal service ids
       
   169     TInt iServiceIdCounter;
       
   170 
       
   171     /**
       
   172      *
       
   173      */
       
   174     CPeriodic* iRemoveTimer;
       
   175     };
       
   176 
       
   177 #endif      // C_CSCSERVICESTORAGE_H   
       
   178             
       
   179 // End of File