DirectPrint/DirectPrintServer/inc/directprintprotocolsloader.h
changeset 19 2275db202402
parent 11 613a5ff70823
equal deleted inserted replaced
2:acc370d7f2f6 19:2275db202402
       
     1 /*
       
     2 * Copyright (c) 2010 Kanrikogaku Kenkyusho, Ltd.
       
     3 * All rights reserved.
       
     4 * This component and the accompanying materials are made available
       
     5 * under the terms of the License "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 * Kanrikogaku Kenkyusho, Ltd. - Initial contribution
       
    11 *
       
    12 * Contributors:
       
    13 *
       
    14 * Description:  Contains the CDirectPrintProtocolsLoader class definition.
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 // Protection against nested includes
       
    20 #ifndef DIRECTPRINTPROTOCOLSLOADER_H
       
    21 #define DIRECTPRINTPROTOCOLSLOADER_H
       
    22 
       
    23 // System includes
       
    24 #include <e32base.h>
       
    25 
       
    26 // User includes
       
    27 #include "directprintprotocolinfo.h"
       
    28 
       
    29 // Forward declarations
       
    30 class MProtPrintingDevice;
       
    31 
       
    32 class CDirectPrintProtocolsLoader : public CBase
       
    33 	{
       
    34 	public:
       
    35 	
       
    36 		static CDirectPrintProtocolsLoader* NewL();
       
    37 		~CDirectPrintProtocolsLoader();
       
    38 
       
    39 		/**
       
    40 		 *	Gets the number of protocol implementations that could be loaded.
       
    41 		 *	@return Number of protocols available.
       
    42 		 */
       
    43 		TInt GetNumberOfProtocolsAvailable() const;
       
    44 		
       
    45 		/**
       
    46 		 *	Gets the next protocol in the internal list of protocols.
       
    47 		 *
       
    48 		 *	Returns a pointer to the next protocol in the list. If the end of the list is reached, it starts the list over.
       
    49 		 *	The order in which protocols will be returned is: DPOF, BPP, PictBridge, any other protocols (sorted alpha-
       
    50 		 *	betically). This pointer should not be deleted. 
       
    51 		 *	@return Pointer to the next protocol instance.
       
    52 		 */
       
    53 		MProtPrintingDevice* GetNextProtocol();
       
    54 		
       
    55 		/**
       
    56 		 *	Gets the protocol located in the position specified. 
       
    57 		 *	@param aIndex Index of the desired protocol. If there are 3 protocols, the valid indexes are: 0, 1, 2.
       
    58 		 *	@return Pointer to the next protocol instance. This pointer should not be deleted. 
       
    59 		 */
       
    60 		MProtPrintingDevice* GetProtocolAt(TInt aIndex);
       
    61 		
       
    62 		/**
       
    63 		 *	Resets the inner pointers to the beginning of the protocols' list.
       
    64 		 */
       
    65 		void Reset();
       
    66 		
       
    67 		/**
       
    68 		 * Returns the index of the current protocol
       
    69 		 */
       
    70 		TInt GetProtocolIndex() const;
       
    71 		
       
    72 		/**
       
    73 		 *	@brief Returns the Protocols supported by the DLL. It can be any of the KDirectPrint_PrinterProtocol* constants.
       
    74 		 *	@return An OR'ed value with the supported protocols information.
       
    75 		 */
       
    76 		TUint SupportedProtocols() const;
       
    77 
       
    78 		/**
       
    79 		 *	Gets the protocol name in the position specified. 
       
    80 		 *	@param aIndex Index of the desired protocol. If there are 3 protocols, the valid indexes are: 0, 1, 2.
       
    81 		 *	@param aName Name of the protocol.
       
    82 		 *	@param aUid Uid of the protocol.
       
    83 		 *	@return error code.
       
    84 		 */
       
    85 		TInt GetProtocolName(TInt aIndex, TDes& aName, TInt& aUid);
       
    86 
       
    87 	private:
       
    88 	
       
    89 		CDirectPrintProtocolsLoader();
       
    90 		void ConstructL();
       
    91 		void LoadL();
       
    92 		static void CleanupProt( TAny* aData );
       
    93 	
       
    94 	private: // data
       
    95 	
       
    96 		/// Used to store the number of protocols loaded and available for use.
       
    97 		TInt iAvailableProtocols;
       
    98 					
       
    99 		/// Index of the next protocol available.
       
   100 		TInt iProtIndex;
       
   101 
       
   102 		/// Pointer array used to store the reference to the protocols.
       
   103 		RPointerArray<MProtPrintingDevice> iProtocols;
       
   104 				
       
   105 		/// OR'ed value with the supported protocols information.
       
   106 		TUint iSupportedProtocols;
       
   107 
       
   108 		/// Pointer array used to store the reference to the protocol infomations.
       
   109 		RPointerArray<CDirectPrintProtocolInfo> iProtocolInfos;
       
   110 	};
       
   111 
       
   112 #endif // DIRECTPRINTPROTOCOLSLOADER_H
       
   113 
       
   114 //  End of File