gba/gbaapi/inc/GbaClientrequesthandler.h
changeset 0 164170e6151a
child 1 d5423fbb4f29
equal deleted inserted replaced
-1:000000000000 0:164170e6151a
       
     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:  Interface for handling gba bootstrapping
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 #ifndef GBACLIENTREQUESTHANDLER_H
       
    20 #define GBACLIENTREQUESTHANDLER_H
       
    21 
       
    22 #include <e32base.h>
       
    23 #include "gbautility.h"
       
    24 
       
    25 // CLASS DECLARATION
       
    26 class RGbaServerSession;
       
    27 
       
    28 /**
       
    29  * Interface for handling gba bootstrapping
       
    30  *
       
    31  * @lib gba2.lib
       
    32  * @since S60 3.2
       
    33  *
       
    34 */  
       
    35 class CGbaClientRequestHandler : public CActive
       
    36     {
       
    37     public:
       
    38         
       
    39         /**
       
    40         * NewL factory function with an observer. It is used with callback function
       
    41         * which should be implemented by the client. The interface is defined in class
       
    42         * MGbaObserver
       
    43         *
       
    44         * @since S60 3.2
       
    45         * @param aObserver Client implemented observer that will be
       
    46         *                  called when the bootstrap is done
       
    47         * @return
       
    48         */
       
    49         static CGbaClientRequestHandler* NewL(MGbaObserver& aObserver);
       
    50 
       
    51         /**
       
    52         * NewLC factory function with an observer. It is used with callback function
       
    53         * which should be implemented by the client. The interface is defined in class
       
    54         * MGbaObserver
       
    55         *
       
    56         * @since S60 3.2
       
    57         * @param aObserver Client implemented observer that will be
       
    58         *                  called when the bootstrap is done
       
    59         * @return
       
    60         */
       
    61         static CGbaClientRequestHandler* NewLC(MGbaObserver& aObserver) ;
       
    62         
       
    63         
       
    64         /**
       
    65         * NewL factory function without observer. User should create its own state 
       
    66         * machine.
       
    67         *
       
    68         * @since S60 3.2
       
    69         * @param 
       
    70         *
       
    71         * @return
       
    72         */
       
    73         static CGbaClientRequestHandler* NewL();
       
    74 
       
    75         /**
       
    76         * NewLC factory function without observer. User should create its own state 
       
    77         * machine.
       
    78         *
       
    79         * @since S60 3.2
       
    80         * @param 
       
    81         *
       
    82         * @return
       
    83         */
       
    84         static CGbaClientRequestHandler* NewLC() ;
       
    85 
       
    86         
       
    87         /**
       
    88         * destructor
       
    89         */
       
    90         virtual ~CGbaClientRequestHandler();
       
    91 
       
    92     public:
       
    93     
       
    94         /**
       
    95         * Bootstrap function. It is a asynchronous function with callback function.
       
    96         * Performs a bootstrap and calls the callback function when bootstrap is done.
       
    97         * This function should be used when the instance of CGbaClientRequestHandler is 
       
    98         * created by factory function with observer.
       
    99         * This function requires ReadDeviceData capability
       
   100         *
       
   101         * @since S60 3.2
       
   102         * @param aInput/aOutput structures to hold input and output parameters, 
       
   103         *        client must ensure that buffer is available when boostrapping is completed
       
   104         *
       
   105         * @return KErrNone factory function and bootstrap match
       
   106         *         KErrGeneral factory fucntion and boostrap function doesnot match
       
   107         */
       
   108         TInt Bootstrap( const TGBABootstrapInputParams aInput, TGBABootstrapOutputParams& aOutput);
       
   109                 
       
   110         /**
       
   111         * Asynchronous bootstrap function. Performs asynchronous bootstrap.
       
   112         * This function should be used when the instance of CGbaClientRequestHandler is 
       
   113         * created by factory function without observer.
       
   114         * This function requires ReadDeviceData capability
       
   115         *
       
   116         * @since S60 3.2
       
   117         * @param aInput/aOutput structures to hold input and output parameters, 
       
   118         *                 client must ensure that buffer is available when
       
   119         *                 boostrapping is completed
       
   120         *        aStatus 
       
   121         *
       
   122         * @return KErrNone factory function and bootstrap match
       
   123         *         KErrGeneral factory fucntion and boostrap function doesnot match
       
   124         */
       
   125         //IMPORT_C TInt Bootstrap(TGBABootstrapCredentials& aCredentials, TRequestStatus& aStatus );
       
   126         TInt Bootstrap( const TGBABootstrapInputParams aInput, TGBABootstrapOutputParams& aOutput, TRequestStatus& aStatus);
       
   127                 
       
   128         /**
       
   129         * Cancel Bootstrap function
       
   130         *
       
   131         * @since S60 3.2
       
   132         * @param 
       
   133         * @return 
       
   134         */
       
   135        TInt CancelBootstrap();
       
   136           
       
   137       /**
       
   138         * Set the BSF address. 
       
   139         * required WriteDeviceData capability. 
       
   140         * The BSF address set by this function will overwrite
       
   141         * the one calculated from IMPI.
       
   142         *
       
   143         * @since S60 3.2
       
   144         * @param aNewVal contain the address
       
   145         *            
       
   146         * @return KErrPermissionDenied, not enought capability
       
   147         */
       
   148         TInt SetBSFAddress( const TDesC8& aAddress );
       
   149       
       
   150     protected: // from CActive
       
   151         
       
   152         void RunL();
       
   153 
       
   154         void DoCancel();
       
   155 
       
   156        TInt RunError(TInt aError);
       
   157 
       
   158     private:
       
   159 
       
   160         void ConstructL();
       
   161 
       
   162         CGbaClientRequestHandler(MGbaObserver& aObserver);
       
   163       
       
   164         CGbaClientRequestHandler();
       
   165     
       
   166     private: 
       
   167 
       
   168     enum TGbaState
       
   169         {
       
   170         EBootstrapNone = 0,
       
   171         EBootstrapping,
       
   172         EBootstrapCancelling
       
   173         };
       
   174         
       
   175 
       
   176     private:
       
   177   
       
   178         // the Gba server session 
       
   179         RGbaServerSession*  iSession;
       
   180         
       
   181         TGBABootstrapOutputParams* iGbaOutputParams;
       
   182         
       
   183         TGBABootstrapInputParams iGbaInputParams;
       
   184         
       
   185         //the observer of this class that is informed of Gba updated
       
   186         MGbaObserver* iObserver;
       
   187         
       
   188         //bootstrap state
       
   189         TGbaState iBootstrapState;
       
   190   
       
   191     };
       
   192 
       
   193 #endif //GBACLIENTREQUESTHANDLER_H  
       
   194 
       
   195 
       
   196 //EOF