connectivitymodules/SeCon/plugins/pcconn/inc/sconpcconnplugin.h
branchRCL_3
changeset 19 0aa8cc770c8a
parent 18 453dfc402455
child 20 4a793f564d72
equal deleted inserted replaced
18:453dfc402455 19:0aa8cc770c8a
     1 /*
       
     2 * Copyright (c) 2005-2009 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:  PC Connectivity plugin header file
       
    15 *
       
    16 */
       
    17 
       
    18 #ifndef _SCONPCCONNPLUGIN_H
       
    19 #define _SCONPCCONNPLUGIN_H
       
    20 
       
    21 #include <obexserver.h>
       
    22 #include <SrcsInterface.h>
       
    23 #include <apmstd.h>
       
    24 
       
    25 #include "sconpcconnclient.h"
       
    26 #include "sconshutdownwatcher.h"
       
    27 
       
    28 // forward declaration
       
    29 class CSConFTP;
       
    30 class CSConServiceTimer;
       
    31 class CCatalogsPCConnectivityPlugin;
       
    32 
       
    33 
       
    34 
       
    35 class CSConPCConnplugin : public CSrcsInterface, public MObexServerNotify,
       
    36                           public MShutdownObserver
       
    37     {
       
    38     public:
       
    39         static CSConPCConnplugin* NewL();
       
    40         virtual ~CSConPCConnplugin();
       
    41 
       
    42         /**
       
    43          * Returns active status of OBEX session
       
    44          * @return ETrue if session is active, else EFalse
       
    45          */
       
    46         TBool IsOBEXActive();
       
    47         
       
    48         /**
       
    49          * Device is shutting down, abort connection.
       
    50          */
       
    51         void NotifyShutdown();
       
    52 
       
    53     private:
       
    54         /**
       
    55          * Loads sconftp.dll module
       
    56          * @return none
       
    57          */
       
    58         void LoadFTPDllL();
       
    59         /**
       
    60          * Closes initialized services
       
    61          * @return none
       
    62          */
       
    63         void Disconnect();
       
    64         /**
       
    65          * Removes spaces and nulls from the end of the string
       
    66          * @param aDes String to be formatted
       
    67          * @return none
       
    68          */
       
    69         void TrimRightSpaceAndNull( TDes8& aDes ) const;
       
    70         /**
       
    71          * Current used transfer media (IR,USB,BT)
       
    72          * @param aMediaType Enumeration indicating the media type
       
    73          * @return none
       
    74          */
       
    75         void SetMediaType( TSrcsMediaType aMediaType );
       
    76         /**
       
    77          * MObexServerNotify implementation
       
    78          * @param aError Error code
       
    79          * @return none
       
    80          */
       
    81         void ErrorIndication( TInt aError );
       
    82         /**
       
    83          * MObexServerNotify implementation
       
    84          * @return none
       
    85          */
       
    86         void TransportUpIndication();
       
    87         /**
       
    88          * MObexServerNotify implementation
       
    89          * @return none
       
    90          */
       
    91         void TransportDownIndication();
       
    92         /**
       
    93          * MObexServerNotify implementation
       
    94          * @param aRemoteInfo Structure containing information used during OBEX
       
    95          * connection
       
    96          * @param aInfo Further information about the requested connection
       
    97          * @return System wide error code that indicates the success of the connection
       
    98          */
       
    99         TInt ObexConnectIndication( const TObexConnectInfo& aRemoteInfo,
       
   100                                     const TDesC8& aInfo );
       
   101         /**
       
   102          * MObexServerNotify implementation
       
   103          * @param aInfo Contains information about the disconnection
       
   104          * @return none
       
   105          */
       
   106         void ObexDisconnectIndication( const TDesC8& aInfo );
       
   107         /**
       
   108          * MObexServerNotify implementation
       
   109          * @return CObexBaseObject-derived object, which the object being put
       
   110          * will be parsed into.
       
   111          */
       
   112         CObexBufObject* PutRequestIndication();
       
   113         /**
       
   114          * MObexServerNotify implementation
       
   115          * @return System wide error code that indicates the success of the
       
   116          * PUT packet operation.
       
   117          */
       
   118         TInt PutPacketIndication();
       
   119         /**
       
   120          * MObexServerNotify implementation
       
   121          * @return System wide error code that indicates the success of the
       
   122          * PUT packet operation.
       
   123          */
       
   124         TInt PutCompleteIndication();
       
   125         /**
       
   126          * MObexServerNotify implementation
       
   127          * @param aRequiredObject Details about the object the remote client
       
   128          * has requested
       
   129          * @returnObject to return to the client
       
   130          */
       
   131         CObexBufObject* GetRequestIndication( CObexBaseObject
       
   132                                                 *aRequiredObject );
       
   133         /**
       
   134          * MObexServerNotify implementation
       
   135          * @return System wide error code that indicates the success of the
       
   136          * GET packet operation.
       
   137          */
       
   138         TInt GetPacketIndication();
       
   139         /**
       
   140          * MObexServerNotify implementation
       
   141          * @return System wide error code that indicates the success of the
       
   142          * GET packet operation.
       
   143          */
       
   144         TInt GetCompleteIndication();
       
   145         /**
       
   146          * MObexServerNotify implementation
       
   147          * @param aPathInfo SETPATH command parameters
       
   148          * @param aInfo Not currently used
       
   149          * @return System wide error code indicating the success of the
       
   150          * setpath command.
       
   151          */
       
   152         TInt SetPathIndication( const CObex::TSetPathInfo& aPathInfo,
       
   153                                 const TDesC8& aInfo );
       
   154         /**
       
   155          * SetObexServer
       
   156          * @param aObexServer pass obex server pointer to sevice controller
       
   157          * @return System wide error code.
       
   158          */
       
   159         TInt SetObexServer( CObexServer* aObexServer );
       
   160         /**
       
   161          * MObexServerNotify implementation
       
   162          * @return none
       
   163          */
       
   164         void AbortIndication();
       
   165         /**
       
   166          * Checks if mime type belongs to Catalogs
       
   167          * @return TBool
       
   168          */
       
   169         TBool IsCatalogsMimeType( TDataType aMime );
       
   170 
       
   171         void ConstructL();
       
   172         CSConPCConnplugin();
       
   173         
       
   174         /**
       
   175          * Handles PCD object. Used for advanced file handling.
       
   176          * @param aDescriptionHeader Contains command code and destination filename
       
   177          * @param aNameHeader Source filename
       
   178          * @return System wide error code.
       
   179          */
       
   180         TInt HandlePCDObjectPut( const TDesC& aDescriptionHeader, const TDesC& aNameHeader );
       
   181         
       
   182         /**
       
   183          * Get Capbility object or ConML message from PCConnServer
       
   184          * @param aNameHeader Name information.
       
   185          * @param aTypeHeader Object type header. ConML or Capability object type
       
   186          * @return none
       
   187          */
       
   188         void HandleGetPCConnObjectL( const TDesC& aNameHeader, const TDesC8& aTypeHeader );
       
   189         
       
   190         /**
       
   191          * Get Catalogs object
       
   192          * @param aTypeHeader Object type header.
       
   193          * @return none
       
   194          */
       
   195         void HandleGetCatalogsObjectL( const TDesC8& aTypeHeader );
       
   196         
       
   197         /**
       
   198          * Get file object
       
   199          * @param aNameHeader requested filename.
       
   200          * @return none
       
   201          */
       
   202         void HandleGetFileObjectL( const TDesC& aNameHeader );
       
   203         
       
   204     private:
       
   205         RLibrary                    iFTPlib;
       
   206         CObexBufObject*             iObject;
       
   207         CBufFlat*                   iBuffer;
       
   208         CSConFTP*                   iFTPHandler;
       
   209         TInt                        iPutError;
       
   210         TBool                       iSessionActive;
       
   211         CSConServiceTimer*          iServiceTimer;
       
   212         TBool                       iStartTimer;
       
   213         TSrcsMediaType              iMediaType;
       
   214         CObexFileObject*            iFileObject;
       
   215         RSConPCConnSession          iPCConnSession;
       
   216         TBool                       iPCConnSessionConnected;
       
   217         CCatalogsPCConnectivityPlugin*  iCatalogs;
       
   218         TBool                           iCatalogsConnected;
       
   219         HBufC8*                         iCatalogsMimeType;
       
   220         RPointerArray<TDataType>        iMimeArray;
       
   221         TBool                           iCatalogsMimeTypesExist;
       
   222         TBool                       iPutPacketIndicationCalled;
       
   223         CShutdownWatcher*           iShutdownWatcher;
       
   224         TBool                       iShutdownInProgress;
       
   225         CObexServer*                iObexServer;
       
   226         RSocketServ                 iSocketServer;
       
   227         RBTPhysicalLinkAdapter      iLinkAdapter;
       
   228     private:
       
   229         // Friend class is used,because existing impelentation has been working
       
   230         // properly. Avoiding re-design.
       
   231         friend class CSConServiceTimer;
       
   232     };
       
   233 
       
   234 #endif // SCONPCCONNPLUGIN_H