usbuis/imageprintui/inc/requestmanager.h
changeset 93 2dc695882abd
parent 89 3592750162a5
equal deleted inserted replaced
89:3592750162a5 93:2dc695882abd
     1 /*
       
     2 * Copyright (c) 2006, 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:  Header file for requestmanager  
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 #ifndef C_REQUESTMANAGER_H
       
    20 #define C_REQUESTMANAGER_H
       
    21 
       
    22 #include <dpsoperation.h>
       
    23 #include <dpsparam.h>
       
    24 #include <badesca.h>
       
    25 
       
    26 class CDpsEngine;
       
    27 class CCapabilityManager;
       
    28 class CImagePrintUiAppUi;
       
    29 
       
    30 const TInt KDefaultSize = 64;
       
    31 
       
    32 
       
    33 /**
       
    34 * Class for requesting DPS request
       
    35 */
       
    36 class CRequestManager : public CActive
       
    37     {
       
    38 
       
    39 public:
       
    40 
       
    41      enum TRequestType
       
    42     	{
       
    43     	EConfigurePrintService = 0,
       
    44     	EGetCapability,
       
    45     	EGetJobStatus,
       
    46     	EGetDeviceStatus,
       
    47     	EStartJob,
       
    48     	EAbortJob,
       
    49     	EContinueJob,
       
    50     	ESetPrintMode
       
    51     	}; 
       
    52     	
       
    53     enum TNotifyType
       
    54     	{
       
    55     	EConfigurePrintServiceOK = 1,
       
    56     	EConfigurePrintServiceNOK,
       
    57     	EGetCapabilityOK,
       
    58     	EGetJobStatusOK,
       
    59     	EGetJobStatusNOK,
       
    60     	EGetDeviceStatusOK,
       
    61     	EGetDeviceStatusNOK,
       
    62     	EStartJobOK,
       
    63     	EStartJobNOK,
       
    64     	EAbortJobOK,
       
    65     	EAbortJobNOK,
       
    66     	EContinueJobOK,
       
    67     	EPicturesNotFound
       
    68     	}; 	
       
    69 
       
    70     /**
       
    71      * Two-phase constructors
       
    72      * @param aDpsEngine the pointer to the PictBridge engine
       
    73      * @param aCapabilityManager the pointer to the Capability Manager
       
    74      * @param aAppUi the pointer to the AppUi class
       
    75      * @return  Initialized instance of CRequestManager
       
    76      */
       
    77     static CRequestManager* NewL( CDpsEngine* aDpsEngine, 
       
    78                                   CCapabilityManager* aCapabilityManager, CImagePrintUiAppUi* aAppUi);
       
    79     
       
    80     /**
       
    81      * Two-phase constructors
       
    82      * @param aDpsEngine the pointer to the PictBridge engine
       
    83      * @param aCapabilityManager the pointer to the Capability Manager
       
    84      * @param aAppUi the pointer to the AppUi class
       
    85      * @return  Initialized instance of CRequestManager
       
    86      */
       
    87     static CRequestManager* NewLC( CDpsEngine* aDpsEngine, 
       
    88                                    CCapabilityManager* aCapabilityManager, CImagePrintUiAppUi* aAppUi);
       
    89     
       
    90     
       
    91     /**
       
    92      * Default destructor.
       
    93      * @since S60 v3.2
       
    94      */	
       
    95     virtual ~CRequestManager();
       
    96     
       
    97     
       
    98     /**
       
    99      * Chooses DoDpsRequest type 
       
   100      * @param aType type of request
       
   101      * @return none
       
   102      */
       
   103    	 void ChooseDpsRequestTypeL( TRequestType aType );
       
   104    	 
       
   105    	/**
       
   106      * Give printer and vendor names to UI 
       
   107      * @param aVendorName the vendor name
       
   108      * @param aProductName the product name
       
   109      * @return none
       
   110      */
       
   111    	 void GetPrinterName(TDes8& aVendorName, TDes8& aProductName);
       
   112    	 
       
   113     /**
       
   114      * Issues again DoDpsRequest if iStatus indicates timeout or PictBridge is in use 
       
   115      */
       
   116      void ReIssueDoDpsRequestL();
       
   117     
       
   118 protected:
       
   119     
       
   120    /**
       
   121     *   @see CActive
       
   122     */
       
   123     void RunL();
       
   124     
       
   125    /**
       
   126     *   @see CActive
       
   127     */ 
       
   128     void DoCancel();
       
   129     
       
   130    /**
       
   131     *   @see CActive
       
   132     */
       
   133     TInt RunError(TInt aError);
       
   134     
       
   135    /**
       
   136     * Externalixe value when save those into config file
       
   137     */
       
   138     void ExternalizeL(RWriteStream& aStream) const;
       
   139 
       
   140 
       
   141 private:
       
   142 
       
   143    /**
       
   144     *  Default constructor
       
   145     * @param aDpsEngine the pointer to the PictBridge engine
       
   146     * @param aCapabilityManager the pointer to the Capability Manager
       
   147     * @param aAppUi the pointer to the AppUi class
       
   148     */
       
   149     CRequestManager( CDpsEngine* aDpsEngine, 
       
   150                      CCapabilityManager* aCapabilityManager, CImagePrintUiAppUi* aAppUi);
       
   151     
       
   152 
       
   153     /** 
       
   154      * 2nd phase construction 
       
   155      */
       
   156     void ConstructL();
       
   157     	
       
   158 	/**
       
   159      * Handles return situation after requesting DPS request GetDeviceStatus  
       
   160      */
       
   161     void HandleDeviceStatusL();
       
   162     
       
   163     /**
       
   164      * Handles return situation after requesting DPS request AbortJob
       
   165      */
       
   166     void HandleAbortL();
       
   167     
       
   168     
       
   169     /**
       
   170      * Handles return situation after requesting DPS request StartJob 
       
   171      */
       
   172     void HandleStartJobL();
       
   173     
       
   174     
       
   175     /**
       
   176      * Handles return situation after requesting DPS request GetJobStatus  
       
   177      */
       
   178 
       
   179      void HandleGetJobStatusL();
       
   180      
       
   181      /**
       
   182      * Handles return situation after requesting DPS request GetConfigure
       
   183      */ 
       
   184      void HandleConfigureL();
       
   185      
       
   186      /**
       
   187      * Saves configure info to file
       
   188      */ 
       
   189      void SaveConfigInfoL();
       
   190      
       
   191      
       
   192     /**
       
   193      * Read configure info from file
       
   194      */ 
       
   195      void ReadConfigInfoL();
       
   196      
       
   197     /**
       
   198      * Performs start job request
       
   199      */ 
       
   200      void ExecuteStartJobRequestL();
       
   201       
       
   202      
       
   203     
       
   204 private: 
       
   205     
       
   206     // owned by AppUi
       
   207     CDpsEngine* iDpsEngine;
       
   208     CCapabilityManager* iCapabilityManager;
       
   209     CImagePrintUiAppUi* iAppUi;
       
   210     
       
   211     // types for DoDpsRequest
       
   212     TDpsGetCapability      iCap;
       
   213     TDpsStartJob           iStart;
       
   214     TDpsAbortJob           iAbort;
       
   215     TDpsContinueJob        iContinue;
       
   216     TDpsGetPrinterStatus   iPrinter;
       
   217     TDpsGetJobStatus       iJob;
       
   218     TDpsConfigPrintService iConfig;
       
   219         
       
   220     TRequestType   iRequestType;
       
   221     
       
   222     TInt iNumberOfImages;
       
   223     
       
   224     TBool iJobFinished;
       
   225     TBool iFileExist;
       
   226     
       
   227     CDesCArrayFlat* iImageArrayFlat;
       
   228     
       
   229     TBuf8<KDefaultSize> iVendorName;
       
   230     TBuf8<KDefaultSize> iProductName;
       
   231       
       
   232     HBufC* iCongFileName;
       
   233      
       
   234     };
       
   235 
       
   236 
       
   237 #endif // C_REQUESTMANAGER_H