DirectPrint/DirectPrintClient/inc/directprintclient.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:  
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 #ifndef RDIRECTPRINTCLIENT_H
       
    20 #define RDIRECTPRINTCLIENT_H
       
    21 
       
    22 #include <e32std.h>
       
    23 
       
    24 #include "directprintselectitem.h"
       
    25 
       
    26 class TDirectPrintCapability;
       
    27 //class TIdleGuardData;
       
    28 //class TDiscoveryGuardData;
       
    29 class TDirectPrintJobGuardData;
       
    30 
       
    31 class RDirectPrintClient : public RSessionBase
       
    32 	{
       
    33 	public:
       
    34 
       
    35 		/**
       
    36          *	Constructor      
       
    37          */
       
    38 		IMPORT_C RDirectPrintClient();
       
    39 
       
    40 		/**
       
    41          *	Connect to the DirectPrint server
       
    42 		 *
       
    43 		 *  @return KErrNone if successful, otherwise another of the system-wide error codes
       
    44          */
       
    45 		IMPORT_C void ConnectL();
       
    46 
       
    47 		/**
       
    48          *	Close the session         
       
    49          */
       
    50 		IMPORT_C void Close();
       
    51 
       
    52 		/**
       
    53          *	Count connections to the server ( all clients in all prosesses )
       
    54          *	
       
    55 		 *	@param aConnections holder for connnections count 
       
    56          *  @return KErrNone if successful, otherwise another of the system-wide error codes
       
    57          */
       
    58 		IMPORT_C TInt CountConnections( TInt& aConnections ) const;
       
    59 		
       
    60 		/**    
       
    61 		 *	Inform server about foreground/background state of the client
       
    62 		 *
       
    63 		 *	@param aFg foreground/background flag
       
    64          *  @return KErrNone if successful, otherwise another of the system-wide error codes
       
    65          */
       
    66 		IMPORT_C TInt SetForeground( TInt aFg ) const;
       
    67 	
       
    68 		
       
    69 		/**
       
    70          *	Reserves DirectPrint engine for this client
       
    71          *	
       
    72          *  @return KErrNone if successful, KErrInUse if used by another client
       
    73          */
       
    74 		IMPORT_C TInt ReserveEngine() const;
       
    75 
       
    76 		/**
       
    77          *	Releases DirectPrint engine
       
    78          *	
       
    79          *  @return KErrNone if successful, KErrInUse if used by another client 
       
    80          */
       
    81 		IMPORT_C TInt ReleaseEngine() const;
       
    82 		
       
    83 		/**
       
    84          *	Get protocols supported by DirectPrint engine
       
    85          *	
       
    86          *  @return OR:ed protocols or KErrInUse if used by another client 
       
    87          */
       
    88 		IMPORT_C TInt SupportedProtocols() const;				
       
    89 		
       
    90 		/**
       
    91 		 *	Gets the number of pages to be printed
       
    92 		 *
       
    93 		 *	@return Number of pages to print or KErrInUse if used by another client  
       
    94 		 */
       
    95 		IMPORT_C TInt GetNumPrintPages() const;
       
    96 		
       
    97 		/**
       
    98 		 *	Gets the status of the printing job created
       
    99 		 *
       
   100 		 *	@return Printing job status or KErrInUse if used by another client
       
   101 		 */
       
   102 		IMPORT_C TInt GetJobStatus() const;
       
   103 		
       
   104 		/**
       
   105 		 *	Gets the status of the printer
       
   106 		 *
       
   107 		 *	@param aPrinterID The exposed ID of the printer the client wants to know about.
       
   108 		 *  @return Any standard Symbian error code or error codes [ KErrInvalidSequence (-50) / KErrInvalidData (-51) ].
       
   109 		 */
       
   110 		IMPORT_C TInt GetPrinterStatus( TInt aPrinterID ) const;
       
   111 		
       
   112 		/**
       
   113 		 *	Cancel discovery
       
   114 		 *
       
   115 		 *	@return KErrNone or KErrInUse if used by another client
       
   116 		 */
       
   117 		IMPORT_C TInt CancelDiscovery() const;
       
   118 		
       
   119 		/**
       
   120 		 *	Submits a print job already created. The actual job execution is asynchronous so this 
       
   121 		 *	function returns immediately. If successful, notification of job status and job 
       
   122 		 *	completion is received by the client through the MPrintEventObserver.
       
   123 		 *
       
   124 		 *  @return Any standard Symbian error code or error codes [ KErrInvalidSequence (-50) / KErrInvalidData (-51) ].
       
   125 		 */
       
   126 		IMPORT_C TInt SubmitPrintJob() const;
       
   127 		
       
   128 		/**
       
   129 		 *	Cancels the print job. This is an asynchronous command. MPrintEventObserver::PrintJobProgressEvent 
       
   130 		 *	will be called with the status of TPrintJobProgressEventStatus::EDone when the cancellation 
       
   131 		 *	is completed. The notification can potentially be received by the client before 
       
   132 		 *	this command returns to the client.
       
   133 		 *
       
   134 		 *  @return Any standard Symbian error code or error codes [ KErrInvalidSequence (-50) / KErrInvalidData (-51) ].
       
   135 		 */
       
   136 		IMPORT_C TInt CancelPrintJob() const;
       
   137 		
       
   138 		/**
       
   139 		 *	Continues printing and / or submitting a print job.
       
   140 		 *
       
   141 		 *  @return Any standard Symbian error code or error codes [ KErrInvalidSequence (-50) / KErrInvalidData (-51) ].
       
   142 		 */
       
   143 		IMPORT_C TInt ContinuePrintJob() const;
       
   144 		
       
   145 		/**
       
   146 		 *	Removes a specified cached printer.
       
   147 		 *
       
   148 		 *	@param aPrinterID The exposed ID of the printer the client wants to remove.
       
   149 		 *  @return Any standard Symbian error code or error codes [ KErrInvalidSequence (-50) / KErrInvalidData (-51) ].
       
   150 		 */
       
   151 		IMPORT_C TInt RemoveCachedPrinter( TInt aPrinterID ) const;
       
   152 		
       
   153 		/**
       
   154 		 *	Gets the icon representing a given layout or template.
       
   155 		 *
       
   156 		 *	@param aTemplateID ID of the template / layout of interest.
       
   157 		 *	@param aFbsBitmapHandle Handle to the appropriate bitmap.
       
   158 		 *  @return Any standard Symbian error code or error codes [ KErrInvalidSequence (-50) / KErrInvalidData (-51) ].
       
   159 		 */
       
   160 		IMPORT_C TInt GetJobTemplateIcon( TInt aTemplateID, TInt& aFbsBitmapHandle ) const;
       
   161 		
       
   162 		/**
       
   163 		 *	Gets the number of pages in the preview.
       
   164 		 *
       
   165 		 *	@return Number of pages in the preview. 
       
   166 		 */
       
   167 		IMPORT_C TInt GetNumPreviewPages() const;
       
   168 		
       
   169 		/**
       
   170 		 *	Sets a print job setting.
       
   171 		 *
       
   172 		 *	@param aCapabilityID ID of the capability of interest.
       
   173 		 *	@param aValue New capability value.
       
   174 		 *	@param aAffectedCapability ID of any affected capability.
       
   175 		 *  @return Any standard Symbian error code or error codes [ KErrInvalidSequence (-50) / KErrInvalidData (-51) ].
       
   176 		 */
       
   177 		IMPORT_C TInt SetJobSetting( TInt aCapabilityID, TInt aValue, TInt& aAffectedCapability ) const;
       
   178 		
       
   179 		/**
       
   180 		 *	Gets a setting configured for the created print job.
       
   181 		 *
       
   182 		 *	@param aCapabilityID ID of the capability of interest.
       
   183 		 *	@param aValue Capability value.
       
   184 		 *  @return Any standard Symbian error code or error codes [ KErrInvalidSequence (-50) / KErrInvalidData (-51) ].
       
   185 		 */
       
   186 		IMPORT_C TInt GetJobSetting( TInt aCapabilityID, TInt& aValue ) const;
       
   187 		
       
   188 		/**
       
   189 		 *	Gets the detail of a certain capability of a certain printer.
       
   190 		 *
       
   191 		 *	@param aPrinterID The exposed ID of the printer the client wants to know about.
       
   192 		 *	@param aCapabilityID ID of the capability of interest.
       
   193 		 *	@param aCapability Capability information.
       
   194 		 *  @return Any standard Symbian error code or error codes [ KErrInvalidSequence (-50) / KErrInvalidData (-51) ].
       
   195 		 */
       
   196 		IMPORT_C TInt GetPrinterCapability(TInt aPrinterID, TInt aCapabilityID, TDirectPrintCapability& aCapability) const;
       
   197 		
       
   198 		/**
       
   199 		 *	Gets the IDs of the capabilities supported by the printer specified.
       
   200 		 *
       
   201 		 *	@param aPrinterID The exposed ID of the printer the client wants to know about.
       
   202 		 *	@param aCapabilityIDs Array containing the ID's of the capabilities of the specified printer.
       
   203 		 *  @return Any standard Symbian error code or error codes [ KErrInvalidSequence (-50) / KErrInvalidData (-51) ].
       
   204 		 */
       
   205 		IMPORT_C TInt GetPrinterCapabilityIDs( TInt aPrinterID, RArray<TInt>& aCapabilityIDs ) const;
       
   206 		
       
   207 		/**
       
   208 		 *  Registers the IdleObserver to send idle event notifications. Asynchronous function.
       
   209 		 *
       
   210 		 *  @param aData place holder for idle event. On function completion contains idle event data.
       
   211 		 *  @param aStatus request status
       
   212 		 *  @return Any standard Symbian error code or error codes [ KErrInvalidSequence (-50) / KErrInvalidData (-51) ].
       
   213 		 */
       
   214 //		IMPORT_C TInt RegisterIdleObserver( TIdleGuardData& aData, TRequestStatus& aStatus );
       
   215 		
       
   216 		/**
       
   217 		 *  Cancel registering idle observer
       
   218 		 *
       
   219 		 *  @return Any standard Symbian error code or error codes [ KErrInvalidSequence (-50) / KErrInvalidData (-51) ].
       
   220 		 */
       
   221 //		IMPORT_C TInt CancelRegisterIdleObserver() const;
       
   222 		
       
   223 		/**
       
   224 		 *  Start discovery and set request for discovery event. Asynchronous function.
       
   225 		 *
       
   226 		 *  @param aData place holder for discovery event. On function completion contains discovery event data.
       
   227 		 *	@param aProtocols OR:ed protocol ids
       
   228 		 *  @param aStatus request status
       
   229 		 *  @return Any standard Symbian error code or error codes [ KErrInvalidSequence (-50) / KErrInvalidData (-51) ].
       
   230 		 */
       
   231 //		IMPORT_C TInt StartDiscovery( TDiscoveryGuardData& aData, TUint aProtocols, TRequestStatus& aStatus );
       
   232 		
       
   233 		/**
       
   234 		 *  Set next request for discovery event. Asynchronous function.
       
   235 		 *
       
   236 		 *  @param aData place holder for discovery event. On function completion contains discovery event data.
       
   237 		 *  @param aStatus request status
       
   238 		 *  @return Any standard Symbian error code or error codes [ KErrInvalidSequence (-50) / KErrInvalidData (-51) ].
       
   239 		 */
       
   240 //		IMPORT_C TInt ContinueDiscovery( TDiscoveryGuardData& aData, TRequestStatus& aStatus );
       
   241 
       
   242 		/**
       
   243 		 *  Create print job and set request for print job event. Asynchronous function.
       
   244 		 *
       
   245 		 *	@param aPrinterID printer id
       
   246 		 *  @param aData place holder for print job event. On function completion contains print job event data.
       
   247 		 *	@param aImages array of image file names
       
   248 		 *  @param aStatus request status
       
   249 		 *  @return Any standard Symbian error code or error codes [ KErrInvalidSequence (-50) / KErrInvalidData (-51) ].
       
   250 		 */
       
   251 		IMPORT_C TInt CreateJob( TInt aPrinterID, TDirectPrintJobGuardData& aData, RPointerArray<TDesC>& aImages, TRequestStatus& aStatus );
       
   252 		
       
   253 		/**
       
   254 		 *  Set next request for print job event. Asynchronous function.
       
   255 		 *
       
   256 		 *  @param aData place holder for print job event. On function completion contains print job event data.
       
   257 		 *  @param aStatus request status
       
   258 		 *  @return Any standard Symbian error code or error codes [ KErrInvalidSequence (-50) / KErrInvalidData (-51) ].
       
   259 		 */
       
   260 		IMPORT_C TInt ContinueCreateJob( TDirectPrintJobGuardData& aData, TRequestStatus& aStatus );
       
   261 		
       
   262 		/**
       
   263 		 *  Cancel starting discovery
       
   264 		 *
       
   265 		 *  @return Any standard Symbian error code or error codes [ KErrInvalidSequence (-50) / KErrInvalidData (-51) ].
       
   266 		 */
       
   267 		IMPORT_C TInt CancelStartDiscovery() const;
       
   268 		
       
   269 		/**
       
   270 		 *  Cancel creating print job
       
   271 		 *
       
   272 		 *  @return Any standard Symbian error code or error codes [ KErrInvalidSequence (-50) / KErrInvalidData (-51) ].
       
   273 		 */
       
   274 		IMPORT_C TInt CancelCreateJob() const;
       
   275 
       
   276 		/**
       
   277 		 *	PictBridge USB mode checker
       
   278 		 *
       
   279 		 *	@return TInt value more than 0, if PictBridge USB mode is on; 0 if off; negative value if error
       
   280 		 */
       
   281 		IMPORT_C TInt IsPictBridgeMode() const;
       
   282 		
       
   283 		/**
       
   284 		 *  Set number of copies
       
   285 		 *
       
   286 		 *  @param aArray array of number of copies elements. Each array element corresponds to the array
       
   287 		 *		of image file names of created print job
       
   288 		 *  @return Any standard Symbian error code or error codes [ KErrInvalidSequence (-50) / KErrInvalidData (-51) ].
       
   289 		 */
       
   290 		IMPORT_C TInt SetNumberOfCopies( const RArray<TInt>& aArray ) const;
       
   291 
       
   292 		IMPORT_C TInt GetProtocolNames(RSelectItemArray& aNames) const;
       
   293 
       
   294 	public:
       
   295 
       
   296 		/**
       
   297 		 *	Version getter
       
   298 		 *
       
   299 		 *	@return version of the client
       
   300 		 */
       
   301 		TVersion Version() const;
       
   302 
       
   303 	private:
       
   304 		
       
   305 		TPtr8 iDicsoveryDataPtr;
       
   306 		TPtr8 iIdleDataPtr;
       
   307 		TPtr8 iJobDataPtr;
       
   308 		TDirectPrintCapability* iCapability;
       
   309 		TPtr8 iNameDataPtr;
       
   310 	};
       
   311 	
       
   312 	
       
   313 #endif // RDIRECTPRINTCLIENT_H
       
   314 
       
   315 //  End of File