btobexprofiles/obexserviceman/obexservicemanserver/inc/SrcsServiceManager.h
branchRCL_3
changeset 56 9386f31cc85b
parent 55 613943a21004
child 61 269724087bed
equal deleted inserted replaced
55:613943a21004 56:9386f31cc85b
     1 /*
       
     2 * Copyright (c) 2002-2010 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:  This class handles service management requests.
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 #ifndef _SRCSSERVICEMANAGER_H
       
    20 #define _SRCSSERVICEMANAGER_H
       
    21 
       
    22 //  INCLUDES
       
    23 #include <e32base.h>
       
    24 #include "obexserviceman.h"
       
    25 #include "SrcsTransport.h"
       
    26 #include "SrcsInterface.h"
       
    27 
       
    28 
       
    29 
       
    30 // CONSTANTS
       
    31 
       
    32 
       
    33 // FORWARD DECLARATIONS
       
    34 
       
    35 /**
       
    36  *  Callback interface for completing request
       
    37  * 
       
    38  *  @since S60 v3.2
       
    39  */ 
       
    40 class MObexSMRequestObserver
       
    41     {   
       
    42      public:        
       
    43         /**
       
    44         * Comleting request
       
    45         *
       
    46         * @since    S60 v3.2
       
    47         * @param    aMessage Reference to message to be completed
       
    48         * @param    aError   Possible error code             
       
    49         */
       
    50         virtual void RequestCompleted(const RMessage2 &aMessage, TInt aError)=0;   
       
    51     };
       
    52 /**
       
    53 *  SRCS service manager class.
       
    54 *  It handles all service requests.
       
    55 */ 
       
    56 
       
    57 class CSrcsServiceManager: public CActive
       
    58     {
       
    59 public:
       
    60 
       
    61     /**
       
    62     * Two-phased constructor.
       
    63     */
       
    64     static CSrcsServiceManager* NewL();
       
    65 
       
    66     /**
       
    67     * Destructor.
       
    68     */
       
    69     virtual ~CSrcsServiceManager();
       
    70         
       
    71 public:
       
    72 
       
    73    /**
       
    74     * Manage services on or off
       
    75     *
       
    76     * @since    S60 v3.2
       
    77     * @param    aTransport  Transporter name for request
       
    78     * @param    aState      Request On or Off
       
    79     * @param    aObserver   Callback interface for completing request
       
    80     * @param    aMessage    Reference to message
       
    81     * @return   TInt    Indicates if the service request has succeed.
       
    82     */
       
    83     TInt ManageServices( TSrcsTransport aTransport, TBool aState, 
       
    84                                             MObexSMRequestObserver* aObserver, 
       
    85                                             const RMessage2& aMessage );
       
    86    /**
       
    87     * Manage services on or off
       
    88     *
       
    89     * @since    S60 v3.2
       
    90     * @param    aTransport  Transporter name for request
       
    91     * @param    aState      Request On or Off
       
    92     * @param    aObserver   Callback interface for completing request
       
    93     * @param    aMessage    Reference to message
       
    94     * @return   None
       
    95     */    
       
    96     void DoManageServices( TSrcsTransport aTransport, TBool aState, MObexSMRequestObserver* aObserver, 
       
    97                                             const RMessage2& aMessage);
       
    98    /**
       
    99     * Manage services on or off
       
   100     *
       
   101     * @since    S60 v3.2
       
   102     * @param    aTransport  Transporter name for request
       
   103     * @param    aState      Request On or Off    
       
   104     * @return   None
       
   105     */                                            
       
   106     void RealDoManageServiceL(TSrcsTransport aTransport, TBool aState);	
       
   107     
       
   108 private:
       
   109    /**
       
   110     * Second phase constructor.
       
   111     */
       
   112     void ConstructL();
       
   113     
       
   114    /**
       
   115     * From CActive
       
   116     *
       
   117     * @since    S60 v3.2
       
   118     */
       
   119     void RunL();
       
   120     
       
   121     
       
   122    /**
       
   123     * From CActive
       
   124     *
       
   125     * @since    S60 v3.2
       
   126     */
       
   127     void RunError();
       
   128     
       
   129     
       
   130    /**
       
   131     * From CActive
       
   132     *
       
   133     * @since    S60 v3.2
       
   134     */
       
   135     void DoCancel();    
       
   136 
       
   137     /**
       
   138     * Handling of Service array 
       
   139     * 
       
   140     */	
       
   141     void ServiceArrayL(CArrayPtr<CSrcsTransport> &aTransport, TBool aState);
       
   142     
       
   143 private:
       
   144     
       
   145    /**
       
   146     * C++ default constructor.
       
   147     */
       
   148     CSrcsServiceManager();
       
   149     
       
   150     /*
       
   151      * Perform service controllers post-initialization
       
   152      */
       
   153     void PostInitialize(CArrayPtr<CSrcsTransport> &aTransport);
       
   154     
       
   155     CArrayPtr<CSrcsTransport>*		iBTConnectionArray;		// array of BT Connections
       
   156     CArrayPtr<CSrcsTransport>*		iUSBConnectionArray;	// array of USB Connections
       
   157     CArrayPtr<CSrcsTransport>*		iIrDAConnectionArray;	// array of IrDA Connections
       
   158     MObexSMRequestObserver*         iRequestObserver;	
       
   159     MObexSMRequestObserver*         iObserver; 
       
   160     RMessage2                       iMessage;
       
   161     TInt                            iErrorState;
       
   162     TPtrC8                          iTransportName;     // Service name
       
   163     TSrcsTransport                  iTransportType;     // Service type
       
   164     TBool                           iTransportState;    // Service On/Off
       
   165     };
       
   166 #endif      // SRCSSERVICEMANAGER_H
       
   167 
       
   168 // End of File