xdmprotocols/LocalProtocol/inc/LocalProtocol.h
changeset 0 c8caa15ef882
equal deleted inserted replaced
-1:000000000000 0:c8caa15ef882
       
     1 /*
       
     2 * Copyright (c) 2005 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: CLocalProtocol
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 
       
    20 
       
    21 #ifndef __LOCALPROTOCOL__
       
    22 #define __LOCALPROTOCOL__
       
    23 
       
    24 #include <e32base.h>
       
    25 #include "XdmEngine.h"
       
    26 #include "XdmProtocol.h"
       
    27 #include "XdmShutdownSwitch.h"
       
    28 
       
    29 //CONSTANTS
       
    30 _LIT( KLocalEngLogFile,                          "LocalProtocol" );
       
    31 _LIT( KLocalEngPrivateRoot,                      "C:\\private\\" );
       
    32 const TInt KLocalEngLogBufferMaxSize		    = 2000;
       
    33 
       
    34 //FORWARD DECLARATIONS
       
    35 class CXdmXmlParser;
       
    36 class CXdmLogWriter;
       
    37 class CXdmOperationFactory;
       
    38 
       
    39 //CLASS DECLARATION
       
    40 class CLocalProtocol : public CXdmProtocol
       
    41     {
       
    42     
       
    43     public:
       
    44         
       
    45         /**
       
    46         * Fetch the capabilities for this protocol. May require
       
    47         * network operations.
       
    48         */
       
    49         IMPORT_C static RFs& FileSession(); 
       
    50         
       
    51                 
       
    52         /**
       
    53         * A Global logging function
       
    54         * @param TRefByValue<const TDesC8> aFmt,...
       
    55         * @return void
       
    56         */ 
       
    57         IMPORT_C static TPtrC RootFolder();
       
    58         
       
    59     private:  //From CXdmProtocol
       
    60    
       
    61         /**
       
    62         * Initialise the media used to transfer Xdm data
       
    63         */
       
    64         void InitTransferMedium( TInt aIdleTimeout,
       
    65                                  TRequestStatus& aStatus  );
       
    66         
       
    67         /**
       
    68         * Cancel initialisation of the transfer media.
       
    69         */
       
    70         void CancelTransferMediumInit();
       
    71         
       
    72         /**
       
    73         * Is the transfer medium ready
       
    74         */
       
    75         TBool IsTransferAvailable() const;
       
    76         
       
    77         /**
       
    78         * Create a new document node.
       
    79         */
       
    80         CXdmDocumentNode* CreateDocumentNodeL();
       
    81         
       
    82         /**
       
    83         * Create a new protocol dependent document model
       
    84         */
       
    85         CXdmDocument* CreateDocumentL( const TDesC& aDocumentName,
       
    86                                        const TXdmDocType aDocumentType );
       
    87         
       
    88         /**
       
    89         * Create a new protocol dependent document model
       
    90         */
       
    91         CXdmDirectory* CreateDirectoryL( const TDesC& aDirectoryPath );
       
    92 
       
    93         /**
       
    94         * Destructor.
       
    95         */      
       
    96         virtual ~CLocalProtocol();
       
    97 
       
    98     public:  //Static
       
    99         
       
   100         /**
       
   101         * Symbian OS default constructor.
       
   102         * @param TInt Default Access Point ID
       
   103         * @return CXdmDocOperation*
       
   104         */     
       
   105         static CLocalProtocol* NewL( const TXdmProtocolParams& aProtocolInfo );
       
   106         
       
   107         /**
       
   108         * A Global logging function
       
   109         * @param TRefByValue<const TDesC8> aFmt,...
       
   110         * @return void
       
   111         */ 
       
   112         RFs& RFSession();
       
   113         
       
   114         /**
       
   115         * A Global logging function
       
   116         * @param TRefByValue<const TDesC8> aFmt,...
       
   117         * @return void
       
   118         */ 
       
   119         TPtrC Root();
       
   120         
       
   121     public:
       
   122     
       
   123         /**
       
   124         * A logging function
       
   125         * @param TRefByValue<const TDesC8> aFmt,...
       
   126         * @return void
       
   127         */ 
       
   128         void WriteToLog( TRefByValue<const TDesC8> aFmt,... ) const;
       
   129 
       
   130     private:  //Methods
       
   131         
       
   132         /**
       
   133         * Symbian OS default constructor.
       
   134         * @param TInt Default Access Point ID
       
   135         * @return CXdmDocOperation*
       
   136         */     
       
   137         CLocalProtocol( const CXdmEngine& aXdmEngine,
       
   138                         const CXdmProtocolInfo& aProtocolInfo );
       
   139         
       
   140         /**
       
   141         * Symbian OS default constructor.
       
   142         * @param TInt Default Access Point ID
       
   143         * @return CXdmDocOperation*
       
   144         */     
       
   145         void ConstructL();
       
   146         
       
   147         /**
       
   148         * Symbian OS default constructor.
       
   149         * @param TInt Default Access Point ID
       
   150         * @return CXdmDocOperation*
       
   151         */     
       
   152         void SetRootDirectoryL( const TDesC& aRootPath );
       
   153     
       
   154     private:
       
   155     
       
   156         /**
       
   157         * From MXdmShutdownSwitch
       
   158         * @return void
       
   159         */ 
       
   160         //void SwitchOff();
       
   161 
       
   162     private:  //Data
       
   163         
       
   164         RFs                                      iFileSession;
       
   165         TBool                                    iTransferMediaOpen;
       
   166         HBufC*                                   iRootFolder;
       
   167         CXdmEngine&                              iXdmEngine;
       
   168         CXdmLogWriter*                           iLogWriter;
       
   169         CXdmXmlParser*                           iXmlParser;
       
   170         const CXdmProtocolInfo&                  iProtocolInfo;
       
   171     };
       
   172 
       
   173 #endif      //__LOCALPROTOCOL__
       
   174             
       
   175 // End of File