ImagePrint/ImagePrintUI/imageprinteng/inc/cdiscoverymanager.h
branchRCL_3
changeset 27 159fc2f68139
parent 21 26673e532f65
child 28 d59c248c9d36
equal deleted inserted replaced
21:26673e532f65 27:159fc2f68139
     1 /*
       
     2 * Copyright (c) 2004-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:  
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 #ifndef CDISCOVERYMANAGER_H
       
    20 #define CDISCOVERYMANAGER_H
       
    21 
       
    22 #include <e32def.h>
       
    23 #include <e32std.h>
       
    24 #include <e32base.h>
       
    25 #include <f32file.h>
       
    26 
       
    27 #include "mdiscovery.h"
       
    28 #include "mdiscoveryobserver.h"
       
    29 #include "imageprint.h"
       
    30 
       
    31 class CRealFactory;
       
    32 class CIFFactory;
       
    33 class CImagePrint;
       
    34 
       
    35 /**
       
    36  *
       
    37  *  Manages the device discovery part.
       
    38  *
       
    39  */
       
    40 class CDiscoveryManager
       
    41     : public CBase,
       
    42       public MDiscovery,
       
    43       public MPrinterDiscoveryObserver
       
    44     {
       
    45     public:     // Construction and destruction
       
    46 
       
    47         /**
       
    48          *  Two-phase construction
       
    49          *
       
    50          *  @param aFactory Pointer to factory
       
    51          *  @return Initialized instance of the class
       
    52          */
       
    53         static CDiscoveryManager* NewL( CIFFactory* aFactory );
       
    54         static CDiscoveryManager* NewLC( CIFFactory* aFactory );
       
    55 
       
    56         /**
       
    57          *  Destructor
       
    58          */
       
    59         virtual ~CDiscoveryManager();
       
    60 
       
    61     private:    // Construction and destruction
       
    62 
       
    63         /**
       
    64          *  Constructor
       
    65          *
       
    66          *  @param aFactory Pointer to factory
       
    67          */
       
    68         CDiscoveryManager( CIFFactory* aFactory );
       
    69 
       
    70         /**
       
    71          *  Second-phase constructor
       
    72          */
       
    73         void ConstructL();
       
    74 
       
    75     private:    // Methods derived from MDiscovery
       
    76 
       
    77         virtual void StartDeviceDiscoveryL(
       
    78             MDiscoveryObserver* aNotifier, TUint aProtocol );
       
    79         virtual void CancelDeviceDiscoveryL();
       
    80         virtual TInt ChoosePrinterL( TInt aPrinterUid );
       
    81         virtual TUint SupportedProtocols();
       
    82         virtual TInt IsPictBridgeMode();
       
    83         virtual void RemoveDiscoveryObserver();
       
    84 
       
    85     private:    // Methods derived from MPrinterDiscoveryObserver
       
    86 
       
    87         virtual void FoundPrinterL( const TPrinter& aPrinterInfo );
       
    88 	    virtual void DiscoveryStatusL( TInt aStatus, TInt aErrorCode,
       
    89             TInt aErrorStringCode );
       
    90         virtual void RemovePrinterL( const TPrinter& aPrinterInfo );
       
    91 
       
    92     private:    // Enumerations
       
    93 
       
    94         // Different states of device discovery
       
    95         enum TDiscoveryState
       
    96             {
       
    97             EDiscovering,
       
    98             EDoneDiscovery,
       
    99             ECancellingDiscovery
       
   100             };
       
   101 
       
   102     private:    // Data
       
   103 
       
   104         // Pointer to factory object
       
   105         CIFFactory* iFactory;
       
   106 
       
   107         // Pointer to the observer
       
   108         MDiscoveryObserver* iDiscoveryObserver;
       
   109 
       
   110         // Flag to indicate if the discovery or cancelling of discovery is on-going
       
   111         TBool iOnGoingDiscovery;
       
   112         TBool iCancelling;
       
   113 
       
   114         // Chosen printer UID
       
   115         TInt iPrinterUid;
       
   116 
       
   117         // Synchronous wait system for cancellation
       
   118         CActiveSchedulerWait iWait;
       
   119 
       
   120         // UID for MMC printer (if available)
       
   121         TInt iMMCUid;
       
   122     };
       
   123 
       
   124 #endif  //  CDISCOVERYMANAGER_H
       
   125 
       
   126 //  End of File