mtpdataproviders/mtppictbridgedp/inc/rptp.h
changeset 0 d0791faffa3f
equal deleted inserted replaced
-1:000000000000 0:d0791faffa3f
       
     1 // Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
       
     2 // All rights reserved.
       
     3 // This component and the accompanying materials are made available
       
     4 // under the terms of "Eclipse Public License v1.0"
       
     5 // which accompanies this distribution, and is available
       
     6 // at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     7 //
       
     8 // Initial Contributors:
       
     9 // Nokia Corporation - initial contribution.
       
    10 //
       
    11 // Contributors:
       
    12 //
       
    13 // Description:
       
    14 // cmtpdeltadatamgr.h
       
    15 // 
       
    16 //
       
    17 
       
    18 /**
       
    19  @file
       
    20  @publishedPartner
       
    21  @released
       
    22 */
       
    23 
       
    24 #ifndef  __INC_RPTP_H
       
    25 #define  __INC_RPTP_H
       
    26 
       
    27 #include <e32base.h>
       
    28 
       
    29 const TInt KFileExtLength = 8;
       
    30 
       
    31 enum TDpsPrinterState
       
    32     {
       
    33     EPrinterNotAvailable,
       
    34     EPrinterAvailable
       
    35     };       
       
    36 
       
    37 /**
       
    38 *  RPtp class is used to create a PTP Server session and a connection to the
       
    39 *  selected transport medium.
       
    40 */
       
    41 NONSHARABLE_CLASS(RPtp) : public RSessionBase
       
    42     {
       
    43     
       
    44 public:
       
    45     IMPORT_C RPtp();
       
    46     
       
    47     /**
       
    48     * Creates new session to PTP Server. This also register the observer
       
    49     * to the ptp server. This should be only used by the client
       
    50     */  
       
    51     IMPORT_C TInt Connect();
       
    52     
       
    53     /**
       
    54     * Creates connection to the server and initializes the ptp stack based on
       
    55     * specified transport medium.
       
    56     * @return KErrNone if success or system error if failed.
       
    57     */
       
    58     IMPORT_C TInt CreatePtpStack( const TUid aTransport );
       
    59     
       
    60     /**
       
    61     * Performs DPS discovery.
       
    62     * @param aStatus the result of the Dps discovery, either EAvailable or
       
    63     *   NotAvailable from TDpsPrinterState enum
       
    64     */
       
    65     IMPORT_C void IsDpsPrinter(TRequestStatus& aStatus);
       
    66     
       
    67     /**
       
    68     * Cancels previously issued Asynch request IsDpsPrinter
       
    69     */
       
    70     IMPORT_C void CancelIsDpsPrinter();
       
    71         
       
    72     /**
       
    73     * Client sends object and get informed when the object is received by
       
    74     * the host. This method is intended for sending DPS files only.
       
    75     * @param aNameAndPath, the name and full path of the file.
       
    76     * @param aStatus, Asynchronous completion word for the operation.
       
    77     * @param aTimeout whether the client needs the reply for this request. If
       
    78     *   it needs the timeout will be true, which means if timout happened, 
       
    79     *   the reply is KErrTimedout. 
       
    80     * @param aSize  size of the object to be sent. Not used. @deprecated 5.2
       
    81     * @param aAdd  Not used. @deprecated 5.2
       
    82     */
       
    83     IMPORT_C void SendObject(const TDesC& aNameAndPath, 
       
    84                              TRequestStatus& aStatus, TBool aTimeout,
       
    85                              TInt aSize=0, TBool aAdd = EFalse);
       
    86     
       
    87     /**
       
    88     * Cancel object sending request.
       
    89     */
       
    90     IMPORT_C void CancelSendObject();
       
    91         
       
    92     /**
       
    93     * Registers the certain DPS files arrival (from the host) notification. 
       
    94     * Note that the received file is deleted when next call on this API is made.
       
    95     * @param aFileExtension.  file extension
       
    96     * @param aNameAndPath  name and path of the file.
       
    97     * @param aDelete @deprecated. The recveived file is always deleted when next
       
    98     *    call to any method on this API is made.
       
    99     * @param aStatus, Asynchronous completion word for the operation.
       
   100     * @return None.
       
   101     */
       
   102     IMPORT_C void ObjectReceivedNotify(const TDesC& aFileExtension,
       
   103                                        TDes& aNameAndPath, 
       
   104                                        TRequestStatus& aStatus,
       
   105                                        TBool aDelete = EFalse);
       
   106     
       
   107     /**
       
   108     * Gets the object handle (whether the object exists).
       
   109     * The client may use this function to delete certain file 
       
   110     * (mainly for dps now)  
       
   111     * @param aNameAndPath, A name and full path of the file.
       
   112     * @param aHandle , 32bit handle of the object
       
   113     * @param aAdd if ETrue, this object is added to the list if not found.
       
   114     * @return KErrNone if object is found or KErrNotFound if not.
       
   115     */
       
   116     IMPORT_C TInt GetObjectHandleByName(const TDesC& aNameAndPath, 
       
   117                                         TUint32& aHandle, 
       
   118                                         TBool aAdd = EFalse);
       
   119     
       
   120     /**
       
   121     * Gets the file name.
       
   122     * @param aNameAndPath, A name and full path of the file.
       
   123     * @param aHandle , 32bit handle of the objcet
       
   124     * @return KErrNone if successfull or system error if failed
       
   125     */
       
   126     IMPORT_C TInt GetNameByObjectHandle(TDes& aNameAndPath, 
       
   127                                         const TUint32 aHandle );
       
   128     
       
   129     
       
   130     /**
       
   131     * Cancel Object received notification 
       
   132     */
       
   133     IMPORT_C void CancelObjectReceivedNotify();
       
   134     
       
   135     /**
       
   136     * Closes the connection to PTP server.
       
   137     */
       
   138     IMPORT_C void DestroyPtpStatck();
       
   139     
       
   140     /**
       
   141     * Returns name and path of folder. Note: while this still returns a valid folder name,
       
   142     * that folder is no more used for anything.
       
   143     * @return Folder Name and Path
       
   144     */
       
   145     IMPORT_C const TDesC& PtpFolder();
       
   146 
       
   147     /**
       
   148     */
       
   149     IMPORT_C void Close();    
       
   150 private:
       
   151     TInt DoConnect();        
       
   152     
       
   153 private:
       
   154     TBuf<KFileExtLength> iExt;
       
   155     TFileName iFile;
       
   156     TBool iConnected;
       
   157     };
       
   158     
       
   159 #endif
       
   160