localconnectivityservice/locod/inc/locodservice.h
branchRCL_3
changeset 39 4096754ee773
parent 38 3dcb815346df
child 40 52a167391590
equal deleted inserted replaced
38:3dcb815346df 39:4096754ee773
     1 /*
       
     2 * Copyright (c) 2006 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:  A service which constains a service plugin and its status.
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 #ifndef C_LOCODSERVICE_H
       
    20 #define C_LOCODSERVICE_H
       
    21 
       
    22 #include <e32base.h>
       
    23 #include <startupdomainpskeys.h>
       
    24 #include <locodbearerpluginobserver.h>
       
    25 #include <locodservicepluginobserver.h>
       
    26 
       
    27 class CLocodServicePlugin;
       
    28 class TLocodServiceRequest;
       
    29 
       
    30 /**
       
    31  *  Specific service that is managed by locod
       
    32  *   Locod creates all service and add it to 
       
    33  *   a an array
       
    34  *  @ euser.lib
       
    35  *  @since S60 3.2
       
    36  */        
       
    37 class CLocodService : public CBase
       
    38     {
       
    39 public:
       
    40 
       
    41     /**
       
    42      *  Factory function
       
    43      * @since S60 3.2
       
    44      * @param aPlugin  the sevice plug ins that will be managed (for example DUN, obex)
       
    45      * @return an instance of CLocodService
       
    46      */
       
    47     static CLocodService* NewL(CLocodServicePlugin& aPlugin);
       
    48     
       
    49     ~CLocodService();
       
    50     
       
    51     CLocodServicePlugin& Plugin();
       
    52     
       
    53     /**
       
    54      *  Called to manage service when the bearer status has been changed
       
    55      * @since S60 3.2
       
    56      * @param aBearer  the bearer whose status has been changed
       
    57      * @param aStatus  status of the bearer connected, disconnected or on or off
       
    58      * @return  TInt
       
    59      */
       
    60     TInt ManageService(TLocodBearer aBearer, 
       
    61         TBool aStatus); 
       
    62 
       
    63     /**
       
    64      *  Called when the service has been managed by service plug ins
       
    65      * @since S60 3.2
       
    66      * @param aBearer  the bearer whose service has been managed
       
    67      * @param aStatus  status of the bearer connected, disconnected or on or off
       
    68      * @param err   error code that may occured during managing the service
       
    69      * @return  TInt
       
    70      */
       
    71     void ManageServiceCompleted(TLocodBearer aBearer, 
       
    72         TBool aStatus,
       
    73         TInt err); 
       
    74 
       
    75     /**
       
    76      *  Check if there are any service pending
       
    77      * @since S60 3.2
       
    78      * @return  TBool if there are service pending
       
    79      */
       
    80     TBool HasServiceToManage() const;
       
    81 
       
    82 private:
       
    83 
       
    84     CLocodService(CLocodServicePlugin& aPlugin);
       
    85     
       
    86     void ConstructL();
       
    87 
       
    88 private:
       
    89     // the service plugin, owned
       
    90     CLocodServicePlugin* iPlugin;
       
    91     
       
    92     // The latest status of this service plugin
       
    93     TInt iServiceStatus;
       
    94     
       
    95     // Queue of ManageService request
       
    96     RArray<TLocodServiceRequest> iRequests;
       
    97     };
       
    98     
       
    99 /**
       
   100  * A ManageService request
       
   101  */
       
   102 class TLocodServiceRequest
       
   103     {
       
   104 public:
       
   105 
       
   106     TLocodServiceRequest(TLocodBearer aBearer, TBool aStatus);
       
   107     
       
   108     // The bearer whose status has changed
       
   109     TLocodBearer iBearer;
       
   110     
       
   111     // The new bearer status
       
   112     TBool iStatus;
       
   113     
       
   114     // The request status
       
   115     TBool iRequesting;
       
   116     };
       
   117 
       
   118 #endif // C_LOCODSERVICE_H