btobexprofiles/obexreceiveservices/opp/inc/oppcontroller.h
branchRCL_3
changeset 56 9386f31cc85b
parent 55 613943a21004
child 61 269724087bed
equal deleted inserted replaced
55:613943a21004 56:9386f31cc85b
     1 /*
       
     2 * Copyright (c) 2004 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: 
       
    15 *     Class handles Bluetooth OPP reception.
       
    16 *
       
    17 *
       
    18 */
       
    19 
       
    20 
       
    21 #ifndef OPPCONTROLLER_H
       
    22 #define OPPCONTROLLER_H
       
    23 
       
    24 //  INCLUDES
       
    25 
       
    26 
       
    27 #include <e32base.h>
       
    28 #include <obexutilsmessagehandler.h>
       
    29 #include "obexutilspropertynotifier.h"
       
    30 #include <SrcsInterface.h>
       
    31 #include "btengdevman.h"
       
    32 
       
    33 #include <obexutilspropertynotifier.h>
       
    34 
       
    35 #include <obexutilsdialog.h>
       
    36 #include <hbdevicedialogsymbian.h>
       
    37 #include <hbsymbianvariant.h>
       
    38 
       
    39 
       
    40 const TInt KBtStartReserveChannel   = 9;
       
    41 const TInt KBtEndReserveChannel     = 30;
       
    42 
       
    43 // todo @ QT migration: take official definition from Messaging at app layer (btmsgtypeuid.h)
       
    44 const TUid KUidMsgTypeBt                 = {0x10009ED5};
       
    45 /**
       
    46 * Backup status.
       
    47 * The value is controlled by FileManager
       
    48 */
       
    49 enum TFileManagerBkupStatusType
       
    50     {
       
    51     EFileManagerBkupStatusUnset   = 0x00000000,
       
    52     EFileManagerBkupStatusBackup  = 0x00000001,
       
    53     EFileManagerBkupStatusRestore = 0x00000002
       
    54     };
       
    55 /**
       
    56 *  CBtListenActive
       
    57 *  Class to implement IrObex permanent listen
       
    58 */
       
    59 class COPPController : public CSrcsInterface, public MObexServerNotify, 
       
    60                        public MObexUtilsPropertyNotifyHandler,
       
    61                        public MObexUtilsDialogObserver,
       
    62                        public MBTEngDevManObserver,
       
    63                        public MHbDeviceDialogObserver     
       
    64     {
       
    65 public:
       
    66     static COPPController* NewL();
       
    67     ~COPPController();   
       
    68 
       
    69 private: // from CSrcsInterface
       
    70     TBool IsOBEXActive();
       
    71     void SetMediaType(TSrcsMediaType aMediaType);
       
    72     TInt SetObexServer(CObexServer* aServer);
       
    73 
       
    74 private: // from MObexServerNotify
       
    75     void ErrorIndication(TInt aError);
       
    76     void TransportUpIndication();
       
    77     void TransportDownIndication();
       
    78     TInt ObexConnectIndication(const TObexConnectInfo& aRemoteInfo, const TDesC8& aInfo);
       
    79     void ObexDisconnectIndication(const TDesC8& aInfo);
       
    80     CObexBufObject* PutRequestIndication();
       
    81     TInt PutPacketIndication();
       
    82     TInt PutCompleteIndication();
       
    83     CObexBufObject* GetRequestIndication(CObexBaseObject* aRequiredObject);
       
    84     TInt GetPacketIndication();
       
    85     TInt GetCompleteIndication();
       
    86     TInt SetPathIndication(const CObex::TSetPathInfo& aPathInfo, const TDesC8& aInfo);
       
    87     void AbortIndication();
       
    88     
       
    89 private: // from MObexUtilsPropertyNotifyHandler
       
    90     void HandleNotifyL(TMemoryPropertyCheckType aCheckType);
       
    91     
       
    92     
       
    93 private: // from MBTEngDevManObserver
       
    94     void HandleGetDevicesComplete(TInt aErr, CBTDeviceArray* aDeviceArray);
       
    95     
       
    96 private: //from MObexUtilsDialogObserver
       
    97     void DialogDismissed(TInt aButtonId);
       
    98     
       
    99 private:
       
   100     COPPController();
       
   101     void ConstructL();
       
   102     
       
   103     void CancelTransfer();
       
   104     void HandlePutRequestL();
       
   105     TInt HandlePutCompleteIndication();
       
   106     void HandleError(TBool aAbort);
       
   107     
       
   108     TBool CheckCapacityL();
       
   109     void LaunchReceivingIndicatorL();
       
   110     inline TBool ReceivingIndicatorActive() const { return (iDialogActive); }
       
   111     void UpdateReceivingIndicatorL();
       
   112     void CloseReceivingIndicator(TBool aResetDisplayedState = ETrue);
       
   113     TInt GetDriveWithMaximumFreeSpaceL();  
       
   114     TBool IsBackupRunning();
       
   115     TBool ProcessExists( const TSecureId& aSecureId );
       
   116     
       
   117 private:
       
   118     void DataReceived(CHbSymbianVariantMap& aData);
       
   119     void DeviceDialogClosed(TInt aCompletionCode);
       
   120 
       
   121 private:
       
   122     enum TObexTransferState
       
   123         {
       
   124         ETransferIdle,
       
   125         ETransferPut,
       
   126         ETransferPutDiskError,
       
   127         ETransferPutInitError,
       
   128         ETransferPutCancel,
       
   129         };
       
   130 
       
   131 private:
       
   132     CObexServer*                iObexServer;
       
   133     TObexTransferState          iObexTransferState;
       
   134     CObexBufObject*             iObexObject;
       
   135     TInt                        iDrive;
       
   136     TBool                       iListening;
       
   137     CObexUtilsPropertyNotifier* iLowMemoryActiveCDrive;
       
   138     CObexUtilsPropertyNotifier* iLowMemoryActiveMMC;
       
   139     TMsvId                      iMsvIdParent;
       
   140     TMsvId                      iMsvIdAttach;
       
   141     TFileName                   iFullPathFilename;
       
   142     TFileName                   iDefaultFolder;
       
   143     TFileName                   iPreviousDefaultFolder;
       
   144     TFileName                   iCenRepFolder;
       
   145     RFs                         iFs;
       
   146     RFile                       iFile;
       
   147     CBufFlat*                   iBuf;
       
   148     TBool                       iLengthHeaderReceived;
       
   149     TSrcsMediaType              iMediaType;
       
   150     TInt                        iTotalSizeByte;
       
   151     TFileName                   iReceivingFileName;
       
   152     TBool                       iNoteDisplayed;
       
   153     CBTEngDevMan*               iDevMan;
       
   154     CBTDeviceArray*             iResultArray;
       
   155     TBTDeviceName               iRemoteDeviceName;
       
   156     CObexUtilsDialog*           iDialog;
       
   157     CHbDeviceDialogSymbian*     iProgressDialog;
       
   158     TBool                       iDialogActive;
       
   159     TInt                        iFileCount;
       
   160     TBool                       iReceivingFailed;
       
   161     CHbDeviceDialogSymbian*     iRecvDoneDialog;
       
   162     TBool                       iShowRecvCompleteDialog;
       
   163     };
       
   164 
       
   165 #endif      // OPPCONTROLLER_H
       
   166             
       
   167 // End of File