btobexprofiles/obexreceiveservices/bip/inc/BIPController.h
author hgs
Wed, 13 Oct 2010 13:15:31 +0300
changeset 67 16e4b9007960
parent 57 5ebadcda06cb
permissions -rw-r--r--
201039_4
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
32
hgs
parents:
diff changeset
     1
/*
67
16e4b9007960 201039_4
hgs
parents: 57
diff changeset
     2
* Copyright (c) 2004-2010 Nokia Corporation and/or its subsidiary(-ies).
32
hgs
parents:
diff changeset
     3
* All rights reserved.
hgs
parents:
diff changeset
     4
* This component and the accompanying materials are made available
hgs
parents:
diff changeset
     5
* under the terms of "Eclipse Public License v1.0"
hgs
parents:
diff changeset
     6
* which accompanies this distribution, and is available
hgs
parents:
diff changeset
     7
* at the URL "http://www.eclipse.org/legal/epl-v10.html".
hgs
parents:
diff changeset
     8
*
hgs
parents:
diff changeset
     9
* Initial Contributors:
hgs
parents:
diff changeset
    10
* Nokia Corporation - initial contribution.
hgs
parents:
diff changeset
    11
*
hgs
parents:
diff changeset
    12
* Contributors:
hgs
parents:
diff changeset
    13
*
hgs
parents:
diff changeset
    14
* Description:  Bip controller class declaration.
hgs
parents:
diff changeset
    15
*
hgs
parents:
diff changeset
    16
*/
hgs
parents:
diff changeset
    17
hgs
parents:
diff changeset
    18
hgs
parents:
diff changeset
    19
#ifndef _BIPCONTROLLER_H
hgs
parents:
diff changeset
    20
#define _BIPCONTROLLER_H
hgs
parents:
diff changeset
    21
hgs
parents:
diff changeset
    22
//INCLUDES
hgs
parents:
diff changeset
    23
hgs
parents:
diff changeset
    24
#include <e32base.h>
hgs
parents:
diff changeset
    25
#include <obex.h>
hgs
parents:
diff changeset
    26
#include <obexutilsmessagehandler.h>
hgs
parents:
diff changeset
    27
#include "obexutilspropertynotifier.h"
hgs
parents:
diff changeset
    28
#include "debug.h"
hgs
parents:
diff changeset
    29
#include <SrcsInterface.h>
hgs
parents:
diff changeset
    30
#include <obexutilspropertynotifier.h>
hgs
parents:
diff changeset
    31
#include <btengsettings.h>
hgs
parents:
diff changeset
    32
#include "btengdevman.h"
42
hgs
parents: 32
diff changeset
    33
#include <hbdevicedialogsymbian.h>
hgs
parents: 32
diff changeset
    34
#include <hbsymbianvariant.h>
32
hgs
parents:
diff changeset
    35
hgs
parents:
diff changeset
    36
// FORWARD DECLARATIONS
hgs
parents:
diff changeset
    37
hgs
parents:
diff changeset
    38
class CBIPCapabilityHandler;
hgs
parents:
diff changeset
    39
class CBIPImageHandler;
67
16e4b9007960 201039_4
hgs
parents: 57
diff changeset
    40
class CBtConversationViewLauncher;
32
hgs
parents:
diff changeset
    41
42
hgs
parents: 32
diff changeset
    42
/**
hgs
parents: 32
diff changeset
    43
* Backup status.
hgs
parents: 32
diff changeset
    44
* The value is controlled by FileManager
hgs
parents: 32
diff changeset
    45
*/
hgs
parents: 32
diff changeset
    46
enum TFileManagerBkupStatusType
hgs
parents: 32
diff changeset
    47
    {
hgs
parents: 32
diff changeset
    48
    EFileManagerBkupStatusUnset   = 0x00000000,
hgs
parents: 32
diff changeset
    49
    EFileManagerBkupStatusBackup  = 0x00000001,
hgs
parents: 32
diff changeset
    50
    EFileManagerBkupStatusRestore = 0x00000002
hgs
parents: 32
diff changeset
    51
    };
hgs
parents: 32
diff changeset
    52
hgs
parents: 32
diff changeset
    53
const TUid KUidMsgTypeBt                 = {0x10009ED5};
32
hgs
parents:
diff changeset
    54
hgs
parents:
diff changeset
    55
// CLASS DECLARATION
hgs
parents:
diff changeset
    56
hgs
parents:
diff changeset
    57
/**
hgs
parents:
diff changeset
    58
*  The main controller for Basic Imaging Profile.
hgs
parents:
diff changeset
    59
*/
hgs
parents:
diff changeset
    60
NONSHARABLE_CLASS (CBIPController): public CSrcsInterface, public MObexServerNotify,
57
5ebadcda06cb 201035_7
hgs
parents: 47
diff changeset
    61
                                    public MObexUtilsPropertyNotifyHandler,
42
hgs
parents: 32
diff changeset
    62
                                    public MBTEngDevManObserver,
hgs
parents: 32
diff changeset
    63
                                    public MHbDeviceDialogObserver
32
hgs
parents:
diff changeset
    64
    {
hgs
parents:
diff changeset
    65
public:
hgs
parents:
diff changeset
    66
    static CBIPController* NewL();
hgs
parents:
diff changeset
    67
    ~CBIPController();
hgs
parents:
diff changeset
    68
    
hgs
parents:
diff changeset
    69
private: // from CSrcsInterface
hgs
parents:
diff changeset
    70
    TBool IsOBEXActive();
hgs
parents:
diff changeset
    71
    void SetMediaType(TSrcsMediaType aMediaType);
hgs
parents:
diff changeset
    72
    TInt SetObexServer(CObexServer* aServer);
hgs
parents:
diff changeset
    73
hgs
parents:
diff changeset
    74
private: // from MObexServerNotify
hgs
parents:
diff changeset
    75
    void ErrorIndication(TInt aError);
hgs
parents:
diff changeset
    76
    void TransportUpIndication();
hgs
parents:
diff changeset
    77
    void TransportDownIndication();
hgs
parents:
diff changeset
    78
    TInt ObexConnectIndication(const TObexConnectInfo& aRemoteInfo, const TDesC8& aInfo);
hgs
parents:
diff changeset
    79
    void ObexDisconnectIndication(const TDesC8& aInfo);
hgs
parents:
diff changeset
    80
    CObexBufObject* PutRequestIndication();
hgs
parents:
diff changeset
    81
    TInt PutPacketIndication();
hgs
parents:
diff changeset
    82
    TInt PutCompleteIndication();
hgs
parents:
diff changeset
    83
    CObexBufObject* GetRequestIndication(CObexBaseObject* aRequiredObject);
hgs
parents:
diff changeset
    84
    TInt GetPacketIndication();
hgs
parents:
diff changeset
    85
    TInt GetCompleteIndication();
hgs
parents:
diff changeset
    86
    TInt SetPathIndication(const CObex::TSetPathInfo& aPathInfo, const TDesC8& aInfo);
hgs
parents:
diff changeset
    87
    void AbortIndication();
hgs
parents:
diff changeset
    88
    
hgs
parents:
diff changeset
    89
private: // from MObexUtilsPropertyNotifyHandler
hgs
parents:
diff changeset
    90
    void HandleNotifyL(TMemoryPropertyCheckType aCheckType);
hgs
parents:
diff changeset
    91
    
hgs
parents:
diff changeset
    92
    
hgs
parents:
diff changeset
    93
private: // from MBTEngDevManObserver
hgs
parents:
diff changeset
    94
    void HandleGetDevicesComplete(TInt aErr, CBTDeviceArray* aDeviceArray);
hgs
parents:
diff changeset
    95
    
hgs
parents:
diff changeset
    96
private:
hgs
parents:
diff changeset
    97
    CBIPController();
hgs
parents:
diff changeset
    98
    void ConstructL();
hgs
parents:
diff changeset
    99
    
hgs
parents:
diff changeset
   100
    void CancelTransfer();
hgs
parents:
diff changeset
   101
    
hgs
parents:
diff changeset
   102
    void HandleError(TBool aAbort);
hgs
parents:
diff changeset
   103
    void HandleGetCapabilityRequestL();
hgs
parents:
diff changeset
   104
    void HandlePutImageRequestL();
hgs
parents:
diff changeset
   105
    TInt HandlePutCompleteIndication();
hgs
parents:
diff changeset
   106
    TInt RemoveCapabilityObject();
hgs
parents:
diff changeset
   107
    
hgs
parents:
diff changeset
   108
    TBool CheckCapacityL();
hgs
parents:
diff changeset
   109
    void LaunchReceivingIndicatorL();
42
hgs
parents: 32
diff changeset
   110
    inline TBool ReceivingIndicatorActive() const { return (iDialogActive); }
hgs
parents: 32
diff changeset
   111
    void UpdateReceivingIndicatorL();
32
hgs
parents:
diff changeset
   112
    void CloseReceivingIndicator(TBool aResetDisplayedState = ETrue);
hgs
parents:
diff changeset
   113
    TInt GetDriveWithMaximumFreeSpaceL();
42
hgs
parents: 32
diff changeset
   114
    TBool IsBackupRunning();
hgs
parents: 32
diff changeset
   115
    TBool ProcessExists( const TSecureId& aSecureId );
hgs
parents: 32
diff changeset
   116
    
57
5ebadcda06cb 201035_7
hgs
parents: 47
diff changeset
   117
    void LaunchFailureDialogL();
5ebadcda06cb 201035_7
hgs
parents: 47
diff changeset
   118
    void LaunchMemoryFullDialogL(TInt aDrive);
5ebadcda06cb 201035_7
hgs
parents: 47
diff changeset
   119
    void AddParamL(const TInt aKey, const TAny* aValue, 
5ebadcda06cb 201035_7
hgs
parents: 47
diff changeset
   120
            CHbSymbianVariant::TType aValueType, CHbSymbianVariantMap& aVariantMap);
5ebadcda06cb 201035_7
hgs
parents: 47
diff changeset
   121
    
42
hgs
parents: 32
diff changeset
   122
private:
hgs
parents: 32
diff changeset
   123
    void DataReceived(CHbSymbianVariantMap& aData);
hgs
parents: 32
diff changeset
   124
    void DeviceDialogClosed(TInt aCompletionCode);
32
hgs
parents:
diff changeset
   125
    
hgs
parents:
diff changeset
   126
private:
hgs
parents:
diff changeset
   127
    enum TBipTransferState
hgs
parents:
diff changeset
   128
        {
hgs
parents:
diff changeset
   129
        ETransferIdle,
hgs
parents:
diff changeset
   130
        ETransferPut,
hgs
parents:
diff changeset
   131
        ETransferGet,
hgs
parents:
diff changeset
   132
        ETransferPutDiskError,
hgs
parents:
diff changeset
   133
        ETransferPutInitError,
hgs
parents:
diff changeset
   134
        ETransferPutCancel,
hgs
parents:
diff changeset
   135
        };
hgs
parents:
diff changeset
   136
    
42
hgs
parents: 32
diff changeset
   137
    
32
hgs
parents:
diff changeset
   138
private: // Data
hgs
parents:
diff changeset
   139
    CBIPCapabilityHandler*      iBIPCapabilityHandler;
hgs
parents:
diff changeset
   140
    CObexBufObject*             iBTObject;
hgs
parents:
diff changeset
   141
    CObexServer*                iBTObexServer;
hgs
parents:
diff changeset
   142
    TBipTransferState           iBTTransferState;
hgs
parents:
diff changeset
   143
    TInt                        iDrive;
hgs
parents:
diff changeset
   144
    CBIPImageHandler*           iBIPImageHandler;
hgs
parents:
diff changeset
   145
    CObexBufObject*             iGetObject;
hgs
parents:
diff changeset
   146
    CObexUtilsPropertyNotifier* iLowMemoryActiveCDrive;
hgs
parents:
diff changeset
   147
    CObexUtilsPropertyNotifier* iLowMemoryActiveMMC;
hgs
parents:
diff changeset
   148
    TMsvId                      iMsvIdParent;
hgs
parents:
diff changeset
   149
    TMsvId                      iMsvIdAttach;
hgs
parents:
diff changeset
   150
    RFile                       iFile;
hgs
parents:
diff changeset
   151
    RFs                         iFs;
hgs
parents:
diff changeset
   152
    TFileName                   iFullPathFilename;
hgs
parents:
diff changeset
   153
    TFileName                   iCapabilityFileName;
hgs
parents:
diff changeset
   154
    TFileName                   iDefaultFolder;
hgs
parents:
diff changeset
   155
    TFileName                   iPreviousDefaultFolder;
hgs
parents:
diff changeset
   156
    CBufFlat                    *iBuf;
hgs
parents:
diff changeset
   157
    TBool                       iLengthHeaderReceived;
hgs
parents:
diff changeset
   158
    TInt                        iTotalSizeByte;
hgs
parents:
diff changeset
   159
    TBool                       iNoteDisplayed;
hgs
parents:
diff changeset
   160
    CBTEngDevMan*               iDevMan;
hgs
parents:
diff changeset
   161
    CBTDeviceArray*             iResultArray;
hgs
parents:
diff changeset
   162
    TBTDeviceName               iRemoteDeviceName;
hgs
parents:
diff changeset
   163
    TFileName                   iReceivingFileName;
hgs
parents:
diff changeset
   164
    TFileName                   iCenRepFolder;
42
hgs
parents: 32
diff changeset
   165
    CHbDeviceDialogSymbian*     iProgressDialog;
hgs
parents: 32
diff changeset
   166
    TBool                       iDialogActive;
hgs
parents: 32
diff changeset
   167
    TInt                        iFileCount;
57
5ebadcda06cb 201035_7
hgs
parents: 47
diff changeset
   168
    CHbDeviceDialogSymbian*     iFailureDialog;
47
9e2a905b887f 201029_02
hgs
parents: 42
diff changeset
   169
    TBool                       iReceivingFailed;
9e2a905b887f 201029_02
hgs
parents: 42
diff changeset
   170
    CHbDeviceDialogSymbian*     iRecvDoneDialog;
9e2a905b887f 201029_02
hgs
parents: 42
diff changeset
   171
    TBool                       iShowRecvCompleteDialog;
57
5ebadcda06cb 201035_7
hgs
parents: 47
diff changeset
   172
    CHbDeviceDialogSymbian*     iMemoryFullDailog;
67
16e4b9007960 201039_4
hgs
parents: 57
diff changeset
   173
    CBtConversationViewLauncher*    iBtCnvViewLauncher;
32
hgs
parents:
diff changeset
   174
    };
hgs
parents:
diff changeset
   175
    
hgs
parents:
diff changeset
   176
_LIT(KBipPanicCategory, "BIP");
hgs
parents:
diff changeset
   177
enum TBipPanicCode
hgs
parents:
diff changeset
   178
    {
hgs
parents:
diff changeset
   179
    EBipPanicNotBluetoothMediaType = 0,
hgs
parents:
diff changeset
   180
    };
hgs
parents:
diff changeset
   181
hgs
parents:
diff changeset
   182
#endif      //_BIPCONTROLLER_H
hgs
parents:
diff changeset
   183
hgs
parents:
diff changeset
   184
// End of File