localconnectivityservice/obexreceiveservices/opp/inc/oppcontroller.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: 
       
    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 <obexutilsuilayer.h>
       
    30 #include "obexutilspropertynotifier.h"
       
    31 #include <SrcsInterface.h>
       
    32 #include "btengdevman.h"
       
    33 
       
    34 #include <obexutilspropertynotifier.h>
       
    35 #include <obexutilsglobalprogressdialog.h>
       
    36 
       
    37 #include <AiwServiceHandler.h> // The AIW service handler
       
    38 
       
    39 _LIT( KUniqueTransportName, "RFCOMM" );
       
    40 const TInt KBtStartReserveChannel   = 9;
       
    41 const TInt KBtEndReserveChannel     = 30;
       
    42 
       
    43 /**
       
    44 *  CBtListenActive
       
    45 *  Class to implement IrObex permanent listen
       
    46 */
       
    47 class COPPController : public CSrcsInterface, public MObexServerNotify, 
       
    48                        public MObexUtilsPropertyNotifyHandler,
       
    49                        public MGlobalProgressCallback, public MGlobalNoteCallback, 
       
    50                        public MBTEngDevManObserver     
       
    51     {
       
    52 public:
       
    53     static COPPController* NewL();
       
    54     ~COPPController();   
       
    55 
       
    56 private: // from CSrcsInterface
       
    57     TBool IsOBEXActive();
       
    58     void SetMediaType(TSrcsMediaType aMediaType);
       
    59     TInt SetObexServer(CObexServer* aServer);
       
    60 
       
    61 private: // from MObexServerNotify
       
    62     void ErrorIndication(TInt aError);
       
    63     void TransportUpIndication();
       
    64     void TransportDownIndication();
       
    65     TInt ObexConnectIndication(const TObexConnectInfo& aRemoteInfo, const TDesC8& aInfo);
       
    66     void ObexDisconnectIndication(const TDesC8& aInfo);
       
    67     CObexBufObject* PutRequestIndication();
       
    68     TInt PutPacketIndication();
       
    69     TInt PutCompleteIndication();
       
    70     CObexBufObject* GetRequestIndication(CObexBaseObject* aRequiredObject);
       
    71     TInt GetPacketIndication();
       
    72     TInt GetCompleteIndication();
       
    73     TInt SetPathIndication(const CObex::TSetPathInfo& aPathInfo, const TDesC8& aInfo);
       
    74     void AbortIndication();
       
    75     
       
    76 private: // from MObexUtilsPropertyNotifyHandler
       
    77     void HandleNotifyL(TMemoryPropertyCheckType aCheckType);
       
    78     
       
    79 private: // from MGlobalProgressCallback
       
    80     void HandleGlobalProgressDialogL(TInt aSoftkey); 
       
    81     
       
    82 private: // from MGlobalNoteCallback
       
    83     void HandleGlobalNoteDialogL(TInt aSoftkey);
       
    84     
       
    85 private: // from MBTEngDevManObserver
       
    86     void HandleGetDevicesComplete(TInt aErr, CBTDeviceArray* aDeviceArray);
       
    87     
       
    88 private:
       
    89     COPPController();
       
    90     void ConstructL();
       
    91     
       
    92     void CancelTransfer();
       
    93     void HandlePutRequestL();
       
    94     TInt HandlePutCompleteIndication();
       
    95     void HandleError(TBool aAbort);
       
    96     
       
    97     TBool CheckCapacityL();
       
    98     void LaunchReceivingIndicatorL();
       
    99     inline TBool ReceivingIndicatorActive() const { return (iProgressDialog || iWaitDialog); }
       
   100     void UpdateReceivingIndicator();
       
   101     void CloseReceivingIndicator(TBool aResetDisplayedState = ETrue);
       
   102     TInt GetDriveWithMaximumFreeSpaceL();    
       
   103 
       
   104 private:
       
   105     enum TObexTransferState
       
   106         {
       
   107         ETransferIdle,
       
   108         ETransferPut,
       
   109         ETransferPutDiskError,
       
   110         ETransferPutInitError,
       
   111         ETransferPutCancel,
       
   112         };
       
   113 
       
   114 private:
       
   115     CObexServer*                iObexServer;
       
   116     TObexTransferState          iObexTransferState;
       
   117     CObexBufObject*             iObexObject;
       
   118     TInt                        iDrive;
       
   119     TBool                       iListening;
       
   120     CObexUtilsPropertyNotifier* iLowMemoryActiveCDrive;
       
   121     CObexUtilsPropertyNotifier* iLowMemoryActiveMMC;
       
   122     TMsvId                      iMsvIdParent;
       
   123     TMsvId                      iMsvIdAttach;
       
   124     TFileName                   iFullPathFilename;
       
   125     TFileName                   iDefaultFolder;
       
   126     TFileName                   iPreviousDefaultFolder;
       
   127     TFileName                   iCenRepFolder;
       
   128     RFs                         iFs;
       
   129     RFile                       iFile;
       
   130     CBufFlat*                   iBuf;
       
   131     TBool                       iLengthHeaderReceived;
       
   132     TSrcsMediaType              iMediaType;
       
   133     TInt                        iTotalSizeByte;
       
   134     TFileName                   iReceivingFileName;
       
   135     CGlobalProgressDialog*      iProgressDialog;
       
   136     CGlobalDialog*              iWaitDialog;
       
   137     TBool                       iNoteDisplayed;
       
   138     CBTEngDevMan*               iDevMan;
       
   139     CBTDeviceArray*             iResultArray;
       
   140     TBTDeviceName               iRemoteDeviceName;
       
   141     };
       
   142 
       
   143 #endif      // OPPCONTROLLER_H
       
   144             
       
   145 // End of File