convergedconnectionhandler/cchserver/inc/cchserviceinfo.h
changeset 0 a4daefaec16c
equal deleted inserted replaced
-1:000000000000 0:a4daefaec16c
       
     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:  CCCHServiceInfo declaration
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 #ifndef C_CCHSERVICEINFO_H
       
    20 #define C_CCHSERVICEINFO_H
       
    21 
       
    22 // INCLUDES
       
    23 #include <e32std.h>
       
    24 #include <e32base.h>
       
    25 #include <cchclientserver.h>
       
    26 
       
    27 // CONSTANTS
       
    28 // None
       
    29 
       
    30 // MACROS
       
    31 // None
       
    32 
       
    33 // FORWARD DECLARATIONS
       
    34 class CCCHSubserviceInfo;
       
    35 class CCCHServerBase;
       
    36 class MCCHServiceNotifier;
       
    37 
       
    38 // DATA TYPES
       
    39 typedef RPointerArray<CCCHSubserviceInfo> RSubserviceArray;
       
    40 
       
    41 // FUNCTION PROTOTYPES
       
    42 // None
       
    43 
       
    44 // CLASS DECLARATION
       
    45 
       
    46 /**
       
    47  *  CCCHServiceInfo declaration
       
    48  *  Contains Service information
       
    49  *  @lib cchserver.exe
       
    50  *  @since S60 3.2
       
    51  */
       
    52 NONSHARABLE_CLASS( CCCHServiceInfo ) : public CBase
       
    53     {
       
    54 
       
    55 public: // Constructors and destructor
       
    56 
       
    57     /**
       
    58     * Two-phased constructor.
       
    59     */
       
    60     static CCCHServiceInfo* NewL( CCCHServerBase& aServer );
       
    61 
       
    62     /**
       
    63      * Two-phased constructor.
       
    64      */
       
    65     static CCCHServiceInfo* NewLC( CCCHServerBase& aServer );
       
    66 
       
    67     /**
       
    68      * Destructor.
       
    69      */
       
    70     virtual ~CCCHServiceInfo();
       
    71 
       
    72 public: // New functions
       
    73     
       
    74     /**
       
    75      * ServiceId getter
       
    76      * @since S60 3.2
       
    77      * @return TUint Service's Id
       
    78      */
       
    79     TUint32 GetServiceId() const;
       
    80     
       
    81     /**
       
    82      * ServiceId setter
       
    83      * @since S60 3.2
       
    84      * @param aServiceId Service's Id
       
    85      */
       
    86     void SetServiceId( TUint32 aServiceId );
       
    87     
       
    88     /**
       
    89      * Name getter
       
    90      * @since S60 3.2
       
    91      * @return const TDesC Service's name
       
    92      */
       
    93     const TDesC GetName() const;
       
    94     
       
    95     /**
       
    96      * Name setter
       
    97      * @since S60 3.2
       
    98      * @param aName Service's name
       
    99      */
       
   100     void SetName( const TDesC& aName );
       
   101     
       
   102     /**
       
   103      * Enable given service
       
   104      * @since S60 3.2
       
   105      * @param aServiceType Service's Subservice type
       
   106      * @param aConnectivityCheck Is value is True Connectivity Plug-in will
       
   107      * make test call to check is the connection truly working.
       
   108      * @param aObserver Pointer to observer.
       
   109      */
       
   110     void EnableL( const TCCHSubserviceType aServiceType, 
       
   111                   const TBool aConnectivityCheck,
       
   112                   MCCHServiceNotifier* aNotifier );
       
   113     
       
   114     /**
       
   115      * Disable given service
       
   116      * @since S60 3.2
       
   117      * @param aServiceType Service's Subservice type
       
   118      */
       
   119     void DisableL( const TCCHSubserviceType aServiceType );
       
   120     
       
   121     /**
       
   122      * Connection information setter
       
   123      * @since S60 3.2
       
   124      * @param aServiceConnInfo Service's new connection information
       
   125      */
       
   126     void SetConnectionInfoL( const TServiceConnectionInfo aServiceConnInfo );
       
   127     
       
   128     /**
       
   129      * Connection information getter
       
   130      * @since S60 3.2
       
   131      * @param aServiceConnInfo On completion contains Service's 
       
   132      * connection(SNAP/IAP) information
       
   133      */
       
   134     void GetConnectionInfoL( TServiceConnectionInfo& aServiceConnInfo ) const;
       
   135     
       
   136     /**
       
   137      * Is service enabled
       
   138      * @since S60 3.2
       
   139      * @return ETrue if service is enabled.
       
   140      */
       
   141     TBool IsEnabled() const;
       
   142     
       
   143     /**
       
   144      * Add new Subservice to Service
       
   145      * @since S60 3.2
       
   146      * @param aSubservice Subservice information
       
   147      */
       
   148     void AddSubserviceL( TCCHSubservice& aSubservice );
       
   149     
       
   150     /**
       
   151      * Subservice getter
       
   152      * @since S60 3.2
       
   153      * @param aType Subservice's type
       
   154      */
       
   155     CCCHSubserviceInfo& GetSubserviceL( TCCHSubserviceType aType ) const;
       
   156     
       
   157     /**
       
   158      * Update service and subservice's states
       
   159      * @since S60 3.2
       
   160      * @param aReadServiceTable If ETrue class reads/updates all Services 
       
   161      * directly from Service Provider Settings 
       
   162      */ 
       
   163     void UpdateL( TBool aReadServiceTable = EFalse );
       
   164     
       
   165     /**
       
   166      * Update service and subservice's states
       
   167      * @since S60 3.2
       
   168      * @param aType Subservice's type
       
   169      * @param aState Service's new state
       
   170      */ 
       
   171     void SetStateL( const TCCHSubserviceType aType, 
       
   172                     const TInt aState );
       
   173 
       
   174     /**
       
   175      * Update service and subservice's states
       
   176      * @since S60 3.2
       
   177      * @param aPluginUid plugin uid wich services are updated
       
   178      * @param aState Service's new state
       
   179      */ 
       
   180     void SetStateL( const TUid& aPluginUid, 
       
   181                     const TCCHSubserviceState& aState );
       
   182     /**
       
   183      * Update service and subservice's error
       
   184      * @since S60 3.2
       
   185      * @param aType Subservice's type
       
   186      * @param aError Service's error
       
   187      */ 
       
   188     void SetErrorL( const TCCHSubserviceType aType, 
       
   189                     const TInt aError );
       
   190     /**
       
   191      * Update service and subservice's states
       
   192      * @since S60 3.2
       
   193      * @return TInt Count of subservices
       
   194      */ 
       
   195     TInt SubserviceCount() const;
       
   196     
       
   197     /**
       
   198      * Get Plug-in's Uid
       
   199      * @since S60 3.2
       
   200      * @param aSubserviceIndex Index of subservice
       
   201      * @return TUid Subservice's Uid
       
   202      */ 
       
   203     TUid GetUidL( TInt aSubserviceIndex ) const;
       
   204     
       
   205     /**
       
   206      * Fill Service's information
       
   207      * @since S60 3.2
       
   208      * @param aService On completion contains service and subservice information
       
   209      */
       
   210     void FillServiceInfo( TCCHService& aService );
       
   211     
       
   212     /**
       
   213      * Get Service's status
       
   214      * @since S60 3.2
       
   215      * @param aType Subservice's type
       
   216      * @param aState in return, state of subservice
       
   217      * @return error code, KErrNotFound if subservice is not existing
       
   218      */ 
       
   219     TInt GetStatus( TCCHSubserviceType aType, TCCHSubserviceState& aState ) const;
       
   220 
       
   221     
       
   222     /**
       
   223      * Get Service's error
       
   224      * @since S60 3.2
       
   225      * @param aType Subservice's type
       
   226      * @return TInt Current error of subservice
       
   227      */ 
       
   228     TInt GetError( TCCHSubserviceType aType ) const;
       
   229     
       
   230     /**
       
   231      * Reserve a service
       
   232      * @since S60 3.2
       
   233      * @param aType Subservice's type
       
   234      */ 
       
   235     void ReserveServiceL( TCCHSubserviceType aType );    
       
   236     
       
   237     /**
       
   238      * Free the service reservation
       
   239      * @since S60 3.2
       
   240      * @param aType Subservice's type
       
   241      */ 
       
   242     void FreeServiceL( TCCHSubserviceType aType ); 
       
   243     
       
   244     /**
       
   245      * Return the service reference count
       
   246      * @since S60 3.2
       
   247      * @param aType Subservice's type
       
   248      * @return Reference count
       
   249      */ 
       
   250     TBool IsReservedL( TCCHSubserviceType aType ) const;
       
   251     
       
   252     /**
       
   253      * Get Service's protocol information
       
   254      * @since S60 3.2
       
   255      * @param aBuffer On completion contains selected service's protocol
       
   256      * information.
       
   257      * @param aType Subservice's type
       
   258      */ 
       
   259     void GetServiceInfoL( TDes& aBuffer, TCCHSubserviceType aType ) const;
       
   260     
       
   261     /**
       
   262      * Subservice exist
       
   263      * @since S60 3.2
       
   264      * @param aType Subservice's type
       
   265      * @return ETrue if Subservice exits or type is not specified.
       
   266      */ 
       
   267     TBool SubserviceExist( TCCHSubserviceType aType ) const;
       
   268     
       
   269     /**
       
   270      * Find subservice by type
       
   271      * @since S60 3.2
       
   272      * @param aType Subservice's type
       
   273      * @return TInt position within iSubservices array or KErrNotFound
       
   274      */
       
   275     TInt FindSubservice( TCCHSubserviceType aType ) const;
       
   276     
       
   277     /**
       
   278      * Is any Subservice's startup-flag set to true
       
   279      * @since S60 3.2
       
   280      * @return ETrue if any startup-flag is set to true
       
   281      */
       
   282     TBool StartupFlagSet() const;
       
   283     
       
   284     /**
       
   285      * Is Subservice's startup-flag set to true
       
   286      * @since S60 3.2
       
   287      * @param aSubserviceIndex Subservice's index
       
   288      * @return ETrue if startup-flag is set to true
       
   289      */
       
   290     TBool StartupFlagSet( TInt aSubserviceIndex ) const;
       
   291     
       
   292     /**
       
   293      * Subservice's enable at startup info setter
       
   294      * @since S60 3.2
       
   295      * @param aType Subservice's type
       
   296      * @param aLoadAtStartUp Enable Subservice at the startup
       
   297      */
       
   298     TInt SetStartupFlag( TCCHSubserviceType aType, TBool aLoadAtStartUp ) const;
       
   299     
       
   300     /**
       
   301      * Gets Subservice's type
       
   302      * @since S60 3.2
       
   303      * @param aSubserviceIndex Subservice's index
       
   304      * @return TCCHSubserviceType type of Subservice
       
   305      */
       
   306     TCCHSubserviceType GetSubserviceType( TInt aSubserviceIndex ) const;
       
   307     
       
   308     /**
       
   309      * Gets services state
       
   310      * @since S60 3.2
       
   311      * @return TCCHSubserviceStates Status of service
       
   312      */
       
   313     TCCHSubserviceState GetState() const;
       
   314     
       
   315 private:
       
   316     
       
   317     /**
       
   318      * Exception errors cases
       
   319      * @since S60 3.2
       
   320      */
       
   321     void HandleErrorExceptions();
       
   322     
       
   323 private:
       
   324 
       
   325     /**
       
   326      * C++ default constructor.
       
   327      */
       
   328     CCCHServiceInfo( CCCHServerBase& aServer );
       
   329     
       
   330 private: // data
       
   331     
       
   332     /**
       
   333      * Handle to server
       
   334      */
       
   335     CCCHServerBase&                 iServer;
       
   336     
       
   337     /**
       
   338      * Service Id
       
   339      */
       
   340     TUint32                         iServiceId;
       
   341 
       
   342     /**
       
   343      * Service provider name
       
   344      */
       
   345     TBuf<KCCHMaxServiceNameLength>  iServiceName;
       
   346     
       
   347     /**
       
   348      * Subservice objects array
       
   349      */
       
   350     RSubserviceArray                iSubservices;
       
   351 
       
   352     /**
       
   353      * Is Servie enabled
       
   354      */
       
   355     TBool                           iIsEnabled;
       
   356     
       
   357     /**
       
   358     * Reserved, obsolote. When adding next new parameter (TInt)
       
   359     * rename Reserved to that, implementation is ready then.
       
   360     */
       
   361     TBool                           iReserved;
       
   362     };
       
   363 
       
   364 #endif // C_CCHSERVICEINFO_H
       
   365 
       
   366 // End of file