localconnectivityservice/obexreceiveservices/bip/inc/BIPController.h
branchRCL_3
changeset 39 4096754ee773
parent 38 3dcb815346df
child 40 52a167391590
equal deleted inserted replaced
38:3dcb815346df 39:4096754ee773
     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 <obexutilsuilayer.h>
       
    28 #include <obexutilsdialog.h>
       
    29 #include "obexutilspropertynotifier.h"
       
    30 #include "debug.h"
       
    31 #include <SrcsInterface.h>
       
    32 #include <obexutilspropertynotifier.h>
       
    33 #include <obexutilsglobalprogressdialog.h>
       
    34 #include <btengsettings.h>
       
    35 #include "btengdevman.h"
       
    36 #include <obexutilsdialog.h>
       
    37 
       
    38 // FORWARD DECLARATIONS
       
    39 
       
    40 class CBIPCapabilityHandler;
       
    41 class CBIPImageHandler;
       
    42 
       
    43 
       
    44 // CLASS DECLARATION
       
    45 
       
    46 /**
       
    47 *  The main controller for Basic Imaging Profile.
       
    48 */
       
    49 NONSHARABLE_CLASS (CBIPController): public CSrcsInterface, public MObexServerNotify,
       
    50                                     public MObexUtilsPropertyNotifyHandler, 
       
    51                                     public MGlobalProgressCallback, public MGlobalNoteCallback,
       
    52                                     public MBTEngDevManObserver
       
    53     {
       
    54 public:
       
    55     static CBIPController* NewL();
       
    56     ~CBIPController();
       
    57     
       
    58 private: // from CSrcsInterface
       
    59     TBool IsOBEXActive();
       
    60     void SetMediaType(TSrcsMediaType aMediaType);
       
    61     TInt SetObexServer(CObexServer* aServer);
       
    62 
       
    63 private: // from MObexServerNotify
       
    64     void ErrorIndication(TInt aError);
       
    65     void TransportUpIndication();
       
    66     void TransportDownIndication();
       
    67     TInt ObexConnectIndication(const TObexConnectInfo& aRemoteInfo, const TDesC8& aInfo);
       
    68     void ObexDisconnectIndication(const TDesC8& aInfo);
       
    69     CObexBufObject* PutRequestIndication();
       
    70     TInt PutPacketIndication();
       
    71     TInt PutCompleteIndication();
       
    72     CObexBufObject* GetRequestIndication(CObexBaseObject* aRequiredObject);
       
    73     TInt GetPacketIndication();
       
    74     TInt GetCompleteIndication();
       
    75     TInt SetPathIndication(const CObex::TSetPathInfo& aPathInfo, const TDesC8& aInfo);
       
    76     void AbortIndication();
       
    77     
       
    78 private: // from MObexUtilsPropertyNotifyHandler
       
    79     void HandleNotifyL(TMemoryPropertyCheckType aCheckType);
       
    80     
       
    81 private: // from MGlobalProgressCallback
       
    82     void HandleGlobalProgressDialogL(TInt aSoftkey); 
       
    83     
       
    84 private: // from MGlobalNoteCallback
       
    85     void HandleGlobalNoteDialogL(TInt aSoftkey);
       
    86     
       
    87 private: // from MBTEngDevManObserver
       
    88     void HandleGetDevicesComplete(TInt aErr, CBTDeviceArray* aDeviceArray);
       
    89     
       
    90 private:
       
    91     CBIPController();
       
    92     void ConstructL();
       
    93     
       
    94     void CancelTransfer();
       
    95     
       
    96     void HandleError(TBool aAbort);
       
    97     void HandleGetCapabilityRequestL();
       
    98     void HandlePutImageRequestL();
       
    99     TInt HandlePutCompleteIndication();
       
   100     TInt RemoveCapabilityObject();
       
   101     
       
   102     TBool CheckCapacityL();
       
   103     void LaunchReceivingIndicatorL();
       
   104     inline TBool ReceivingIndicatorActive() const { return (iProgressDialog || iWaitDialog); }
       
   105     void UpdateReceivingIndicator();
       
   106     void CloseReceivingIndicator(TBool aResetDisplayedState = ETrue);
       
   107     TInt GetDriveWithMaximumFreeSpaceL();
       
   108     
       
   109 private:
       
   110     enum TBipTransferState
       
   111         {
       
   112         ETransferIdle,
       
   113         ETransferPut,
       
   114         ETransferGet,
       
   115         ETransferPutDiskError,
       
   116         ETransferPutInitError,
       
   117         ETransferPutCancel,
       
   118         };
       
   119     
       
   120 private: // Data
       
   121     CBIPCapabilityHandler*      iBIPCapabilityHandler;
       
   122     CObexBufObject*             iBTObject;
       
   123     CObexServer*                iBTObexServer;
       
   124     TBipTransferState           iBTTransferState;
       
   125     TInt                        iDrive;
       
   126     CBIPImageHandler*           iBIPImageHandler;
       
   127     CObexBufObject*             iGetObject;
       
   128     CObexUtilsPropertyNotifier* iLowMemoryActiveCDrive;
       
   129     CObexUtilsPropertyNotifier* iLowMemoryActiveMMC;
       
   130     TMsvId                      iMsvIdParent;
       
   131     TMsvId                      iMsvIdAttach;
       
   132     RFile                       iFile;
       
   133     RFs                         iFs;
       
   134     TFileName                   iFullPathFilename;
       
   135     TFileName                   iCapabilityFileName;
       
   136     TFileName                   iDefaultFolder;
       
   137     TFileName                   iPreviousDefaultFolder;
       
   138     CBufFlat                    *iBuf;
       
   139     TBool                       iLengthHeaderReceived;
       
   140     TInt                        iTotalSizeByte;
       
   141     CGlobalProgressDialog*      iProgressDialog;
       
   142     CGlobalDialog*              iWaitDialog;
       
   143     TBool                       iNoteDisplayed;
       
   144     CBTEngDevMan*               iDevMan;
       
   145     CBTDeviceArray*             iResultArray;
       
   146     TBTDeviceName               iRemoteDeviceName;
       
   147     TFileName                   iReceivingFileName;
       
   148     TFileName                   iCenRepFolder;
       
   149     };
       
   150     
       
   151 _LIT(KBipPanicCategory, "BIP");
       
   152 enum TBipPanicCode
       
   153     {
       
   154     EBipPanicNotBluetoothMediaType = 0,
       
   155     };
       
   156 
       
   157 #endif      //_BIPCONTROLLER_H
       
   158 
       
   159 // End of File