btobexprofiles/obexreceiveservices/bip/inc/BIPController.h
branchRCL_3
changeset 23 9386f31cc85b
parent 22 613943a21004
child 24 269724087bed
equal deleted inserted replaced
22:613943a21004 23: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:  Bip controller class declaration.
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 #ifndef _BIPCONTROLLER_H
       
    20 #define _BIPCONTROLLER_H
       
    21 
       
    22 //INCLUDES
       
    23 
       
    24 #include <e32base.h>
       
    25 #include <obex.h>
       
    26 #include <obexutilsmessagehandler.h>
       
    27 #include "obexutilspropertynotifier.h"
       
    28 #include "debug.h"
       
    29 #include <SrcsInterface.h>
       
    30 #include <obexutilspropertynotifier.h>
       
    31 #include <btengsettings.h>
       
    32 #include "btengdevman.h"
       
    33 #include <obexutilsdialog.h>
       
    34 #include <hbdevicedialogsymbian.h>
       
    35 #include <hbsymbianvariant.h>
       
    36 
       
    37 // FORWARD DECLARATIONS
       
    38 
       
    39 class CBIPCapabilityHandler;
       
    40 class CBIPImageHandler;
       
    41 
       
    42 /**
       
    43 * Backup status.
       
    44 * The value is controlled by FileManager
       
    45 */
       
    46 enum TFileManagerBkupStatusType
       
    47     {
       
    48     EFileManagerBkupStatusUnset   = 0x00000000,
       
    49     EFileManagerBkupStatusBackup  = 0x00000001,
       
    50     EFileManagerBkupStatusRestore = 0x00000002
       
    51     };
       
    52 
       
    53 const TUid KUidMsgTypeBt                 = {0x10009ED5};
       
    54 
       
    55 // CLASS DECLARATION
       
    56 
       
    57 /**
       
    58 *  The main controller for Basic Imaging Profile.
       
    59 */
       
    60 NONSHARABLE_CLASS (CBIPController): public CSrcsInterface, public MObexServerNotify,
       
    61                                     public MObexUtilsPropertyNotifyHandler, 
       
    62                                     public MObexUtilsDialogObserver,
       
    63                                     public MBTEngDevManObserver,
       
    64                                     public MHbDeviceDialogObserver
       
    65     {
       
    66 public:
       
    67     static CBIPController* NewL();
       
    68     ~CBIPController();
       
    69     
       
    70 private: // from CSrcsInterface
       
    71     TBool IsOBEXActive();
       
    72     void SetMediaType(TSrcsMediaType aMediaType);
       
    73     TInt SetObexServer(CObexServer* aServer);
       
    74 
       
    75 private: // from MObexServerNotify
       
    76     void ErrorIndication(TInt aError);
       
    77     void TransportUpIndication();
       
    78     void TransportDownIndication();
       
    79     TInt ObexConnectIndication(const TObexConnectInfo& aRemoteInfo, const TDesC8& aInfo);
       
    80     void ObexDisconnectIndication(const TDesC8& aInfo);
       
    81     CObexBufObject* PutRequestIndication();
       
    82     TInt PutPacketIndication();
       
    83     TInt PutCompleteIndication();
       
    84     CObexBufObject* GetRequestIndication(CObexBaseObject* aRequiredObject);
       
    85     TInt GetPacketIndication();
       
    86     TInt GetCompleteIndication();
       
    87     TInt SetPathIndication(const CObex::TSetPathInfo& aPathInfo, const TDesC8& aInfo);
       
    88     void AbortIndication();
       
    89     
       
    90 private: // from MObexUtilsPropertyNotifyHandler
       
    91     void HandleNotifyL(TMemoryPropertyCheckType aCheckType);
       
    92     
       
    93     
       
    94 private: // from MBTEngDevManObserver
       
    95     void HandleGetDevicesComplete(TInt aErr, CBTDeviceArray* aDeviceArray);
       
    96     
       
    97 private: //from MObexUtilsDialogObserver
       
    98     void DialogDismissed(TInt aButtonId);
       
    99     
       
   100 private:
       
   101     CBIPController();
       
   102     void ConstructL();
       
   103     
       
   104     void CancelTransfer();
       
   105     
       
   106     void HandleError(TBool aAbort);
       
   107     void HandleGetCapabilityRequestL();
       
   108     void HandlePutImageRequestL();
       
   109     TInt HandlePutCompleteIndication();
       
   110     TInt RemoveCapabilityObject();
       
   111     
       
   112     TBool CheckCapacityL();
       
   113     void LaunchReceivingIndicatorL();
       
   114     inline TBool ReceivingIndicatorActive() const { return (iDialogActive); }
       
   115     void UpdateReceivingIndicatorL();
       
   116     void CloseReceivingIndicator(TBool aResetDisplayedState = ETrue);
       
   117     TInt GetDriveWithMaximumFreeSpaceL();
       
   118     TBool IsBackupRunning();
       
   119     TBool ProcessExists( const TSecureId& aSecureId );
       
   120     
       
   121 private:
       
   122     void DataReceived(CHbSymbianVariantMap& aData);
       
   123     void DeviceDialogClosed(TInt aCompletionCode);
       
   124     
       
   125 private:
       
   126     enum TBipTransferState
       
   127         {
       
   128         ETransferIdle,
       
   129         ETransferPut,
       
   130         ETransferGet,
       
   131         ETransferPutDiskError,
       
   132         ETransferPutInitError,
       
   133         ETransferPutCancel,
       
   134         };
       
   135     
       
   136     
       
   137 private: // Data
       
   138     CBIPCapabilityHandler*      iBIPCapabilityHandler;
       
   139     CObexBufObject*             iBTObject;
       
   140     CObexServer*                iBTObexServer;
       
   141     TBipTransferState           iBTTransferState;
       
   142     TInt                        iDrive;
       
   143     CBIPImageHandler*           iBIPImageHandler;
       
   144     CObexBufObject*             iGetObject;
       
   145     CObexUtilsPropertyNotifier* iLowMemoryActiveCDrive;
       
   146     CObexUtilsPropertyNotifier* iLowMemoryActiveMMC;
       
   147     TMsvId                      iMsvIdParent;
       
   148     TMsvId                      iMsvIdAttach;
       
   149     RFile                       iFile;
       
   150     RFs                         iFs;
       
   151     TFileName                   iFullPathFilename;
       
   152     TFileName                   iCapabilityFileName;
       
   153     TFileName                   iDefaultFolder;
       
   154     TFileName                   iPreviousDefaultFolder;
       
   155     CBufFlat                    *iBuf;
       
   156     TBool                       iLengthHeaderReceived;
       
   157     TInt                        iTotalSizeByte;
       
   158     TBool                       iNoteDisplayed;
       
   159     CBTEngDevMan*               iDevMan;
       
   160     CBTDeviceArray*             iResultArray;
       
   161     TBTDeviceName               iRemoteDeviceName;
       
   162     TFileName                   iReceivingFileName;
       
   163     TFileName                   iCenRepFolder;
       
   164     CObexUtilsDialog*           iDialog;
       
   165     CHbDeviceDialogSymbian*     iProgressDialog;
       
   166     TBool                       iDialogActive;
       
   167     TInt                        iFileCount;
       
   168     TBool                       iReceivingFailed;
       
   169     CHbDeviceDialogSymbian*     iRecvDoneDialog;
       
   170     TBool                       iShowRecvCompleteDialog;
       
   171     };
       
   172     
       
   173 _LIT(KBipPanicCategory, "BIP");
       
   174 enum TBipPanicCode
       
   175     {
       
   176     EBipPanicNotBluetoothMediaType = 0,
       
   177     };
       
   178 
       
   179 #endif      //_BIPCONTROLLER_H
       
   180 
       
   181 // End of File