btobexprofiles/obexsendservices/obexservicesendutils/src/BTSBIPController.cpp
author hgs
Fri, 03 Sep 2010 16:17:59 +0300
changeset 57 5ebadcda06cb
parent 42 b72428996822
permissions -rw-r--r--
201035_7
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
32
hgs
parents:
diff changeset
     1
/*
42
hgs
parents: 32
diff changeset
     2
* Copyright (c) 2002-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:  Image push implementation
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
hgs
parents:
diff changeset
    20
// INCLUDE FILES
hgs
parents:
diff changeset
    21
#include "BTSBIPController.h"
hgs
parents:
diff changeset
    22
#include "BTSUDebug.h"
hgs
parents:
diff changeset
    23
#include "BTSUImageConverter.h"
hgs
parents:
diff changeset
    24
#include "BTSUXmlParser.h"
42
hgs
parents: 32
diff changeset
    25
#include <hbtextresolversymbian.h>
32
hgs
parents:
diff changeset
    26
hgs
parents:
diff changeset
    27
hgs
parents:
diff changeset
    28
hgs
parents:
diff changeset
    29
// CONSTANTS
hgs
parents:
diff changeset
    30
// image push target header
hgs
parents:
diff changeset
    31
_LIT8( KBIPImagePushID, "\xE3\x3D\x95\x45\x83\x74\x4A\xD7\x9E\xC5\xC1\x6B\xE3\x1E\xDE\x8E" );
hgs
parents:
diff changeset
    32
hgs
parents:
diff changeset
    33
// type headers
hgs
parents:
diff changeset
    34
_LIT8( KBTSBIPCapabilities, "x-bt/img-capabilities\0");
hgs
parents:
diff changeset
    35
_LIT8( KBTSBIPImageType,    "x-bt/img-img\0");
hgs
parents:
diff changeset
    36
_LIT8( KBTSBIPThmType,      "x-bt/img-thm\0");
hgs
parents:
diff changeset
    37
hgs
parents:
diff changeset
    38
// imageBTS descriptor
hgs
parents:
diff changeset
    39
_LIT8( KBTSBIPDescriptorStart,     "<image-descriptor version=\"1.0\">\r" );
hgs
parents:
diff changeset
    40
_LIT8( KBTSBIPDescriptorEncoding,  "<image encoding=\"" );
hgs
parents:
diff changeset
    41
_LIT8( KBTSBIPDescriptorPixel,     "\" pixel=\"" );
hgs
parents:
diff changeset
    42
_LIT8( KBTSBIPDescriptorSize,      "\" size=\"" );
hgs
parents:
diff changeset
    43
_LIT8( KBTSBIPDescriptorEnd,       "\"/>\r</image-descriptor>" );
hgs
parents:
diff changeset
    44
hgs
parents:
diff changeset
    45
// temp file path for capabilities object
hgs
parents:
diff changeset
    46
hgs
parents:
diff changeset
    47
//temp file path drive letter
hgs
parents:
diff changeset
    48
_LIT(KBTSBIPTempPathDrive,"c:");
hgs
parents:
diff changeset
    49
const TInt KBTSUMaxPathLenght=256;
hgs
parents:
diff changeset
    50
const TInt KBTSUMaxPrivatePathLenght=20;
hgs
parents:
diff changeset
    51
57
5ebadcda06cb 201035_7
hgs
parents: 42
diff changeset
    52
_LIT(KLocFileName, "btdialogs_");
5ebadcda06cb 201035_7
hgs
parents: 42
diff changeset
    53
_LIT(KPath, "z:/resource/qt/translations/");  
5ebadcda06cb 201035_7
hgs
parents: 42
diff changeset
    54
42
hgs
parents: 32
diff changeset
    55
_LIT(KBTNotSendSomeText,"txt_bt_info_receiving_device_does_not_support_all");
hgs
parents: 32
diff changeset
    56
_LIT(KBTNotSendOneText,"txt_bt_info_receiving_device_does_not_support_this");
hgs
parents: 32
diff changeset
    57
hgs
parents: 32
diff changeset
    58
32
hgs
parents:
diff changeset
    59
hgs
parents:
diff changeset
    60
hgs
parents:
diff changeset
    61
// ============================ MEMBER FUNCTIONS ===============================
hgs
parents:
diff changeset
    62
hgs
parents:
diff changeset
    63
// -----------------------------------------------------------------------------
hgs
parents:
diff changeset
    64
// CBTSBIPController::CBTSBIPController
hgs
parents:
diff changeset
    65
// C++ default constructor can NOT contain any code, that
hgs
parents:
diff changeset
    66
// might leave.
hgs
parents:
diff changeset
    67
// -----------------------------------------------------------------------------
hgs
parents:
diff changeset
    68
//
hgs
parents:
diff changeset
    69
CBTSBIPController::CBTSBIPController( MBTServiceObserver* aObserver, 
hgs
parents:
diff changeset
    70
                                      CBTServiceParameterList* aList ) :
hgs
parents:
diff changeset
    71
                                      iListPtr( aList ),
hgs
parents:
diff changeset
    72
                                      iObserverPtr( aObserver )
hgs
parents:
diff changeset
    73
									  
hgs
parents:
diff changeset
    74
    {
hgs
parents:
diff changeset
    75
    }
hgs
parents:
diff changeset
    76
hgs
parents:
diff changeset
    77
// -----------------------------------------------------------------------------
hgs
parents:
diff changeset
    78
// CBTSBIPController::ConstructL
hgs
parents:
diff changeset
    79
// Symbian 2nd phase constructor can leave.
hgs
parents:
diff changeset
    80
// -----------------------------------------------------------------------------
hgs
parents:
diff changeset
    81
//
hgs
parents:
diff changeset
    82
void CBTSBIPController::ConstructL( const TUint aRemotePort, 
hgs
parents:
diff changeset
    83
                                    const TBTDevAddr& aRemoteDeviceAddr )
hgs
parents:
diff changeset
    84
    {
hgs
parents:
diff changeset
    85
    FLOG(_L("[BTSU]\t CBTSBIPController::ConstructL()"));
hgs
parents:
diff changeset
    86
    
hgs
parents:
diff changeset
    87
    // Add image push target header
hgs
parents:
diff changeset
    88
    //
hgs
parents:
diff changeset
    89
    CObexHeader* header = CObexHeader::NewL();
hgs
parents:
diff changeset
    90
    CleanupStack::PushL( header );
hgs
parents:
diff changeset
    91
    header->SetByteSeqL( KBTSUTargetHeader, KBIPImagePushID );
hgs
parents:
diff changeset
    92
hgs
parents:
diff changeset
    93
    RArray<CObexHeader*> headerList;
hgs
parents:
diff changeset
    94
    CleanupClosePushL( headerList );
hgs
parents:
diff changeset
    95
    headerList.Append( header );
hgs
parents:
diff changeset
    96
    
hgs
parents:
diff changeset
    97
    CreateClientL ( this, aRemoteDeviceAddr, aRemotePort, headerList );    
hgs
parents:
diff changeset
    98
hgs
parents:
diff changeset
    99
    CleanupStack::Pop( 2 ); //header, headerlist
hgs
parents:
diff changeset
   100
    headerList.Close();
hgs
parents:
diff changeset
   101
hgs
parents:
diff changeset
   102
    FLOG(_L("[BTSU]\t CBTSBIPController::ConstructL() completed"));
hgs
parents:
diff changeset
   103
    }
hgs
parents:
diff changeset
   104
hgs
parents:
diff changeset
   105
// -----------------------------------------------------------------------------
hgs
parents:
diff changeset
   106
// CBTSBIPController::NewL
hgs
parents:
diff changeset
   107
// Two-phased constructor.
hgs
parents:
diff changeset
   108
// -----------------------------------------------------------------------------
hgs
parents:
diff changeset
   109
//
hgs
parents:
diff changeset
   110
CBTSBIPController* CBTSBIPController::NewL( MBTServiceObserver* aObserver,
hgs
parents:
diff changeset
   111
                                           const TUint aRemotePort,
hgs
parents:
diff changeset
   112
                                           const TBTDevAddr& aRemoteDeviceAddr,
hgs
parents:
diff changeset
   113
                                           CBTServiceParameterList* aList )
hgs
parents:
diff changeset
   114
    {
hgs
parents:
diff changeset
   115
    CBTSBIPController* self = 
hgs
parents:
diff changeset
   116
        new( ELeave ) CBTSBIPController( aObserver, aList );
hgs
parents:
diff changeset
   117
    CleanupStack::PushL( self );
hgs
parents:
diff changeset
   118
    self->ConstructL( aRemotePort, aRemoteDeviceAddr );
hgs
parents:
diff changeset
   119
    CleanupStack::Pop(self);
hgs
parents:
diff changeset
   120
    return self;
hgs
parents:
diff changeset
   121
    }
hgs
parents:
diff changeset
   122
hgs
parents:
diff changeset
   123
// Destructor
hgs
parents:
diff changeset
   124
CBTSBIPController::~CBTSBIPController()
hgs
parents:
diff changeset
   125
    {
hgs
parents:
diff changeset
   126
    DeleteTempFile( iThumbnailFileName );
hgs
parents:
diff changeset
   127
    }
hgs
parents:
diff changeset
   128
hgs
parents:
diff changeset
   129
// -----------------------------------------------------------------------------
hgs
parents:
diff changeset
   130
// CBTSBIPController::ConnectCompleted
hgs
parents:
diff changeset
   131
// -----------------------------------------------------------------------------
hgs
parents:
diff changeset
   132
//
hgs
parents:
diff changeset
   133
void CBTSBIPController::ConnectCompleted( TInt aStatus )
hgs
parents:
diff changeset
   134
    {
hgs
parents:
diff changeset
   135
    FLOG(_L("[BTSU]\t CBTSBIPController::ConnectCompleted()"));
hgs
parents:
diff changeset
   136
hgs
parents:
diff changeset
   137
    if ( aStatus == KErrNone )
hgs
parents:
diff changeset
   138
        {
hgs
parents:
diff changeset
   139
        iFileIndex = 0;
hgs
parents:
diff changeset
   140
        // get remote device capabilities
hgs
parents:
diff changeset
   141
        //
hgs
parents:
diff changeset
   142
        TRAPD( error, GetL() );
hgs
parents:
diff changeset
   143
        if ( error != KErrNone )
hgs
parents:
diff changeset
   144
            {
hgs
parents:
diff changeset
   145
            iObserverPtr->ControllerComplete( EBTSGettingFailed );
hgs
parents:
diff changeset
   146
            }
hgs
parents:
diff changeset
   147
        }
hgs
parents:
diff changeset
   148
    else
hgs
parents:
diff changeset
   149
        {
hgs
parents:
diff changeset
   150
        //Error on Obex level
hgs
parents:
diff changeset
   151
        //
hgs
parents:
diff changeset
   152
        iObserverPtr->ControllerComplete( EBTSConnectingFailed );
hgs
parents:
diff changeset
   153
        }
hgs
parents:
diff changeset
   154
hgs
parents:
diff changeset
   155
    FLOG(_L("[BTSU]\t CBTSBIPController::ConnectCompleted() completed"));
hgs
parents:
diff changeset
   156
    }
hgs
parents:
diff changeset
   157
// -----------------------------------------------------------------------------
hgs
parents:
diff changeset
   158
// CBTSBIPController::ClientConnectionClosed
hgs
parents:
diff changeset
   159
// -----------------------------------------------------------------------------
hgs
parents:
diff changeset
   160
//
hgs
parents:
diff changeset
   161
void CBTSBIPController::ClientConnectionClosed()
hgs
parents:
diff changeset
   162
    {
hgs
parents:
diff changeset
   163
    FLOG(_L("[BTSU]\t CBTSBIPController::ClientConnectionClosed()"));
hgs
parents:
diff changeset
   164
hgs
parents:
diff changeset
   165
    // Everything ready, stop service
hgs
parents:
diff changeset
   166
    //    
hgs
parents:
diff changeset
   167
    iObserverPtr->ControllerComplete( EBTSNoError );	
hgs
parents:
diff changeset
   168
    FLOG(_L("[BTSU]\t CBTSBIPController::ClientConnectionClosed() completed"));
hgs
parents:
diff changeset
   169
    }
hgs
parents:
diff changeset
   170
hgs
parents:
diff changeset
   171
// -----------------------------------------------------------------------------
hgs
parents:
diff changeset
   172
// CBTSBIPController::PutCompleted
hgs
parents:
diff changeset
   173
// -----------------------------------------------------------------------------
hgs
parents:
diff changeset
   174
//
hgs
parents:
diff changeset
   175
void CBTSBIPController::PutCompleted( TInt aStatus, 
hgs
parents:
diff changeset
   176
                                      const CObexHeaderSet* aPutResponse )
hgs
parents:
diff changeset
   177
    {
hgs
parents:
diff changeset
   178
    FLOG(_L("[BTSU]\t CBTSBIPController::PutCompleted()"));
hgs
parents:
diff changeset
   179
hgs
parents:
diff changeset
   180
    // Remove temporary thumbnail file
hgs
parents:
diff changeset
   181
    //
hgs
parents:
diff changeset
   182
    DeleteTempFile( iThumbnailFileName );
hgs
parents:
diff changeset
   183
    if ( aStatus == KErrNone )
hgs
parents:
diff changeset
   184
        {              
hgs
parents:
diff changeset
   185
        iFileIndex++;
hgs
parents:
diff changeset
   186
        // Send was ok. Start sending next image
hgs
parents:
diff changeset
   187
        //
hgs
parents:
diff changeset
   188
        TRAPD( error, SendL() );
hgs
parents:
diff changeset
   189
        if ( error )
hgs
parents:
diff changeset
   190
            {
hgs
parents:
diff changeset
   191
            FTRACE(FPrint(_L("[BTSU]\t CBTSBPPController::Send leaved with %d"), error ));
hgs
parents:
diff changeset
   192
            iObserverPtr->ControllerComplete( EBTSPuttingFailed);
hgs
parents:
diff changeset
   193
            }                
hgs
parents:
diff changeset
   194
        }
hgs
parents:
diff changeset
   195
    else if ( aStatus == KErrIrObexRespPartialContent )
hgs
parents:
diff changeset
   196
        {
hgs
parents:
diff changeset
   197
        // Remote device has requested a thumbnail image
hgs
parents:
diff changeset
   198
        //
hgs
parents:
diff changeset
   199
        TRAPD( error, SendThumbnailL(aPutResponse ) );
hgs
parents:
diff changeset
   200
        if ( error )
hgs
parents:
diff changeset
   201
            {
hgs
parents:
diff changeset
   202
            FTRACE(FPrint(_L("[BTSU]\t CBTSBPPController::Send thumbnail leaved with %d"), error ));
hgs
parents:
diff changeset
   203
            iObserverPtr->ControllerComplete( EBTSPuttingFailed );
hgs
parents:
diff changeset
   204
            }
hgs
parents:
diff changeset
   205
        }
hgs
parents:
diff changeset
   206
    else
hgs
parents:
diff changeset
   207
        {
hgs
parents:
diff changeset
   208
        // Some error on Obex level
hgs
parents:
diff changeset
   209
        //
hgs
parents:
diff changeset
   210
        iObserverPtr->ControllerComplete( EBTSPuttingFailed);
hgs
parents:
diff changeset
   211
        }
hgs
parents:
diff changeset
   212
hgs
parents:
diff changeset
   213
    FLOG(_L("[BTSU]\t CBTSBIPController::PutCompleted() done"));
hgs
parents:
diff changeset
   214
    }
hgs
parents:
diff changeset
   215
hgs
parents:
diff changeset
   216
// -----------------------------------------------------------------------------
hgs
parents:
diff changeset
   217
// CBTSBIPController::GetCompleted
hgs
parents:
diff changeset
   218
// -----------------------------------------------------------------------------
hgs
parents:
diff changeset
   219
//
hgs
parents:
diff changeset
   220
void CBTSBIPController::GetCompleted( TInt aStatus, 
hgs
parents:
diff changeset
   221
                                      CObexBufObject* aGetResponse )
hgs
parents:
diff changeset
   222
    {
hgs
parents:
diff changeset
   223
    FLOG(_L("[BTSU]\t CBTSBIPController::GetCompleted()"));	
hgs
parents:
diff changeset
   224
hgs
parents:
diff changeset
   225
    if ( aStatus == KErrAbort )
hgs
parents:
diff changeset
   226
        {
hgs
parents:
diff changeset
   227
        // Connection is cancelled
hgs
parents:
diff changeset
   228
        //
hgs
parents:
diff changeset
   229
        iObserverPtr->ControllerComplete( EBTSGettingFailed );
hgs
parents:
diff changeset
   230
        }
hgs
parents:
diff changeset
   231
    
hgs
parents:
diff changeset
   232
    else if ( aStatus == KErrNone )
hgs
parents:
diff changeset
   233
        {
hgs
parents:
diff changeset
   234
        TRAPD( error, HandleGetCompleteIndicationL( aGetResponse ) );
hgs
parents:
diff changeset
   235
        if ( error != KErrNone )
hgs
parents:
diff changeset
   236
            {
hgs
parents:
diff changeset
   237
            DeleteTempFile( iTempFileName );
hgs
parents:
diff changeset
   238
            // Error on capability handling
hgs
parents:
diff changeset
   239
            //
hgs
parents:
diff changeset
   240
            iObserverPtr->ControllerComplete( EBTSGettingFailed );
hgs
parents:
diff changeset
   241
            }
hgs
parents:
diff changeset
   242
        }
hgs
parents:
diff changeset
   243
    else if( aStatus != KErrAbort && aGetResponse->BytesReceived()==0 )
hgs
parents:
diff changeset
   244
        {
42
hgs
parents: 32
diff changeset
   245
        TRAPD( error,iObserverPtr->LaunchProgressNoteL( iClient,iListPtr->ImageCount() ) );
32
hgs
parents:
diff changeset
   246
        error=KErrNone;
hgs
parents:
diff changeset
   247
        TRAP(error, SendL() );    	 
hgs
parents:
diff changeset
   248
        if ( error != KErrNone )
hgs
parents:
diff changeset
   249
            {            
hgs
parents:
diff changeset
   250
            iObserverPtr->ControllerComplete( EBTSPuttingFailed );
hgs
parents:
diff changeset
   251
            }    	      
hgs
parents:
diff changeset
   252
        } 	
hgs
parents:
diff changeset
   253
    else if ( aStatus != KErrNone && aGetResponse->BytesReceived()>0 )
hgs
parents:
diff changeset
   254
        {
hgs
parents:
diff changeset
   255
        // Error on Obex level
hgs
parents:
diff changeset
   256
        //
hgs
parents:
diff changeset
   257
        iObserverPtr->ControllerComplete( EBTSGettingFailed );
hgs
parents:
diff changeset
   258
        }
hgs
parents:
diff changeset
   259
    
hgs
parents:
diff changeset
   260
hgs
parents:
diff changeset
   261
    FLOG(_L("[BTSU]\t CBTSBIPController::GetCompleted() done"));
hgs
parents:
diff changeset
   262
    }
hgs
parents:
diff changeset
   263
hgs
parents:
diff changeset
   264
// -----------------------------------------------------------------------------
hgs
parents:
diff changeset
   265
// CBTSBIPController::SendL
hgs
parents:
diff changeset
   266
// -----------------------------------------------------------------------------
hgs
parents:
diff changeset
   267
//
hgs
parents:
diff changeset
   268
void CBTSBIPController::SendL()
hgs
parents:
diff changeset
   269
    {
hgs
parents:
diff changeset
   270
    FLOG(_L("[BTSU]\t CBTSBIPController::SendL()"));
hgs
parents:
diff changeset
   271
hgs
parents:
diff changeset
   272
    
hgs
parents:
diff changeset
   273
    if ( iListPtr->ImageCount() > 0 && iFileIndex < iListPtr->ImageCount())
hgs
parents:
diff changeset
   274
        {        
hgs
parents:
diff changeset
   275
        
hgs
parents:
diff changeset
   276
        RArray<CObexHeader*> headerList;
hgs
parents:
diff changeset
   277
        CleanupClosePushL( headerList );
hgs
parents:
diff changeset
   278
hgs
parents:
diff changeset
   279
        // Add Type header
hgs
parents:
diff changeset
   280
        //
hgs
parents:
diff changeset
   281
        CObexHeader* typeHeader = CObexHeader::NewL();
hgs
parents:
diff changeset
   282
        CleanupStack::PushL( typeHeader );
hgs
parents:
diff changeset
   283
        typeHeader->SetByteSeqL( KBTSUTypeHeader, KBTSBIPImageType );
hgs
parents:
diff changeset
   284
        headerList.Append( typeHeader );
hgs
parents:
diff changeset
   285
hgs
parents:
diff changeset
   286
        // Add image descriptor
hgs
parents:
diff changeset
   287
        //
hgs
parents:
diff changeset
   288
        HBufC8* imagedescriptor = CreateImageDescriptorL( );
hgs
parents:
diff changeset
   289
        CleanupStack::PushL( imagedescriptor );
hgs
parents:
diff changeset
   290
  
hgs
parents:
diff changeset
   291
        CObexHeader* imageDescriptorHeader = CObexHeader::NewL();
hgs
parents:
diff changeset
   292
        CleanupStack::PushL( imageDescriptorHeader );
hgs
parents:
diff changeset
   293
        imageDescriptorHeader->SetByteSeqL( KBTSUImgDescriptorHeader, imagedescriptor->Des() );
hgs
parents:
diff changeset
   294
        headerList.Append( imageDescriptorHeader );
hgs
parents:
diff changeset
   295
hgs
parents:
diff changeset
   296
        // Send image
hgs
parents:
diff changeset
   297
        //
hgs
parents:
diff changeset
   298
        
hgs
parents:
diff changeset
   299
        TBTSUImageParam imageparam = iListPtr->ImageAtL( iFileIndex );        
hgs
parents:
diff changeset
   300
        RBuf filename;
42
hgs
parents: 32
diff changeset
   301
        filename.CreateL(KMaxFileName);
32
hgs
parents:
diff changeset
   302
        CleanupClosePushL(filename);
57
5ebadcda06cb 201035_7
hgs
parents: 42
diff changeset
   303
        User::LeaveIfError(imageparam.iFile.Name(filename));
32
hgs
parents:
diff changeset
   304
        
hgs
parents:
diff changeset
   305
        iObserverPtr->UpdateProgressNoteL(imageparam.iFileSize,iFileIndex,filename);
hgs
parents:
diff changeset
   306
        CleanupStack::PopAndDestroy(&filename);
hgs
parents:
diff changeset
   307
        
hgs
parents:
diff changeset
   308
        iListPtr->MarkAsSendL(iFileIndex);
hgs
parents:
diff changeset
   309
        
hgs
parents:
diff changeset
   310
        
hgs
parents:
diff changeset
   311
        iClient->PutObjectL( headerList, imageparam.iFile );
hgs
parents:
diff changeset
   312
        
hgs
parents:
diff changeset
   313
          
hgs
parents:
diff changeset
   314
        CleanupStack::Pop(4); // headerList, imageDescriptorHeader, typeHeader, imagedescriptor
hgs
parents:
diff changeset
   315
        delete imagedescriptor;
hgs
parents:
diff changeset
   316
        headerList.Close();
hgs
parents:
diff changeset
   317
        }
hgs
parents:
diff changeset
   318
    else
hgs
parents:
diff changeset
   319
        {
hgs
parents:
diff changeset
   320
        FLOG(_L("[BTSU]\t CBTSBIPController::SendL() all images sent, closing connection"));
hgs
parents:
diff changeset
   321
hgs
parents:
diff changeset
   322
        // All images sent, close client connection.
hgs
parents:
diff changeset
   323
        //
hgs
parents:
diff changeset
   324
        iClient->CloseClientConnection();
hgs
parents:
diff changeset
   325
        }
hgs
parents:
diff changeset
   326
hgs
parents:
diff changeset
   327
    FLOG(_L("[BTSU]\t CBTSBIPController::SendL() completed"));
hgs
parents:
diff changeset
   328
    }
hgs
parents:
diff changeset
   329
hgs
parents:
diff changeset
   330
// -----------------------------------------------------------------------------
hgs
parents:
diff changeset
   331
// CBTSBIPController::GetL
hgs
parents:
diff changeset
   332
// -----------------------------------------------------------------------------
hgs
parents:
diff changeset
   333
//
hgs
parents:
diff changeset
   334
void CBTSBIPController::GetL()
hgs
parents:
diff changeset
   335
    {
hgs
parents:
diff changeset
   336
    FLOG(_L("[BTSU]\t CBTSBIPController::GetL()"));
hgs
parents:
diff changeset
   337
hgs
parents:
diff changeset
   338
    RArray<CObexHeader*> headerList;
hgs
parents:
diff changeset
   339
    CleanupClosePushL(headerList);
hgs
parents:
diff changeset
   340
    
hgs
parents:
diff changeset
   341
    // Add capabilities type header
hgs
parents:
diff changeset
   342
    //
hgs
parents:
diff changeset
   343
    CObexHeader* typeHeader = CObexHeader::NewL();
hgs
parents:
diff changeset
   344
    CleanupStack::PushL( typeHeader );
hgs
parents:
diff changeset
   345
    typeHeader->SetByteSeqL( KBTSUTypeHeader, KBTSBIPCapabilities );
hgs
parents:
diff changeset
   346
    headerList.Append( typeHeader );
hgs
parents:
diff changeset
   347
hgs
parents:
diff changeset
   348
    // Get capabilities object from remote device
hgs
parents:
diff changeset
   349
    //
hgs
parents:
diff changeset
   350
    iClient->GetObjectL( headerList );
hgs
parents:
diff changeset
   351
hgs
parents:
diff changeset
   352
    CleanupStack::Pop(2); // headerList, typeHeader
hgs
parents:
diff changeset
   353
    headerList.Close();
hgs
parents:
diff changeset
   354
    }
hgs
parents:
diff changeset
   355
hgs
parents:
diff changeset
   356
// -----------------------------------------------------------------------------
hgs
parents:
diff changeset
   357
// CBTSBIPController::SendThumbnailL
hgs
parents:
diff changeset
   358
// -----------------------------------------------------------------------------
hgs
parents:
diff changeset
   359
//
hgs
parents:
diff changeset
   360
void CBTSBIPController::SendThumbnailL( const CObexHeaderSet *aPutResponse )
hgs
parents:
diff changeset
   361
    {
hgs
parents:
diff changeset
   362
    FLOG(_L("[BTSU]\t CBTSBIPController::SendThumbnail()"));
hgs
parents:
diff changeset
   363
hgs
parents:
diff changeset
   364
    // Create thumbnail for sending
hgs
parents:
diff changeset
   365
    // Delete the created thumbnail on PutComplete
hgs
parents:
diff changeset
   366
    //
hgs
parents:
diff changeset
   367
hgs
parents:
diff changeset
   368
    // Fill header array
hgs
parents:
diff changeset
   369
    //
hgs
parents:
diff changeset
   370
	
hgs
parents:
diff changeset
   371
    RArray<CObexHeader*> headerList;
hgs
parents:
diff changeset
   372
    CleanupClosePushL(headerList);
hgs
parents:
diff changeset
   373
hgs
parents:
diff changeset
   374
    // Add ImageHandle header
hgs
parents:
diff changeset
   375
    //
hgs
parents:
diff changeset
   376
    CObexHeader* imageHandleHeader = CObexHeader::NewL();
hgs
parents:
diff changeset
   377
    CleanupStack::PushL( imageHandleHeader );
hgs
parents:
diff changeset
   378
hgs
parents:
diff changeset
   379
    aPutResponse->First();
hgs
parents:
diff changeset
   380
	User::LeaveIfError(aPutResponse->Find(KBTSUImageHandleHeader,
hgs
parents:
diff changeset
   381
			 *imageHandleHeader ) );
hgs
parents:
diff changeset
   382
	headerList.Append( imageHandleHeader );
hgs
parents:
diff changeset
   383
	
hgs
parents:
diff changeset
   384
    // Add Type header
hgs
parents:
diff changeset
   385
    //
hgs
parents:
diff changeset
   386
    CObexHeader* typeHeader = CObexHeader::NewL();
hgs
parents:
diff changeset
   387
    CleanupStack::PushL( typeHeader );
hgs
parents:
diff changeset
   388
    typeHeader->SetByteSeqL( KBTSUTypeHeader, KBTSBIPThmType );
hgs
parents:
diff changeset
   389
    headerList.Append( typeHeader );
hgs
parents:
diff changeset
   390
	
hgs
parents:
diff changeset
   391
	
hgs
parents:
diff changeset
   392
    CreateTempFileL( iThumbnailFileName );
hgs
parents:
diff changeset
   393
    CBTSUImageConverter* imageConverter = CBTSUImageConverter::NewL();
hgs
parents:
diff changeset
   394
    CleanupStack::PushL( imageConverter );
hgs
parents:
diff changeset
   395
    
hgs
parents:
diff changeset
   396
    TBTSUImageParam imgparam = iListPtr->ImageAtL( iFileIndex );
hgs
parents:
diff changeset
   397
    imageConverter->CreateThumbnailL(imgparam.iFile, iThumbnailFileName );
hgs
parents:
diff changeset
   398
    
hgs
parents:
diff changeset
   399
    CleanupStack::PopAndDestroy(imageConverter);    
hgs
parents:
diff changeset
   400
hgs
parents:
diff changeset
   401
	// Add Name header
hgs
parents:
diff changeset
   402
    //
hgs
parents:
diff changeset
   403
    TParse parse;
hgs
parents:
diff changeset
   404
    User::LeaveIfError( parse.Set( iThumbnailFileName, NULL, NULL ) );
hgs
parents:
diff changeset
   405
    CObexHeader* nameHeader = CObexHeader::NewL();
hgs
parents:
diff changeset
   406
    CleanupStack::PushL( nameHeader );
hgs
parents:
diff changeset
   407
    nameHeader->SetUnicodeL( KBTSUNameHeader, parse.NameAndExt() );
hgs
parents:
diff changeset
   408
    headerList.Append( nameHeader );
hgs
parents:
diff changeset
   409
hgs
parents:
diff changeset
   410
    // send thumbnail
hgs
parents:
diff changeset
   411
    //
hgs
parents:
diff changeset
   412
    iClient->PutObjectL( headerList, iThumbnailFileName );
hgs
parents:
diff changeset
   413
    
hgs
parents:
diff changeset
   414
    // Cleanup
hgs
parents:
diff changeset
   415
    //
hgs
parents:
diff changeset
   416
    CleanupStack::Pop(4); // headerList, imageHandleHeader, typeHeader, nameHeader
hgs
parents:
diff changeset
   417
    headerList.Close();
hgs
parents:
diff changeset
   418
    }
hgs
parents:
diff changeset
   419
hgs
parents:
diff changeset
   420
// -----------------------------------------------------------------------------
hgs
parents:
diff changeset
   421
// CBTSBIPController::CreateTempFileL
hgs
parents:
diff changeset
   422
// -----------------------------------------------------------------------------
hgs
parents:
diff changeset
   423
//
hgs
parents:
diff changeset
   424
void CBTSBIPController::CreateTempFileL( TFileName& aFileName )
hgs
parents:
diff changeset
   425
    {
hgs
parents:
diff changeset
   426
    FLOG(_L("[BTSU]\t CBTSBIPController::CreateTempFileL()"));
hgs
parents:
diff changeset
   427
hgs
parents:
diff changeset
   428
    RFs fileSession;
hgs
parents:
diff changeset
   429
    RFile file;    
hgs
parents:
diff changeset
   430
    
hgs
parents:
diff changeset
   431
    TBuf<KBTSUMaxPrivatePathLenght> privatepath;     
hgs
parents:
diff changeset
   432
    TBuf<KBTSUMaxPathLenght> tempPath;     
hgs
parents:
diff changeset
   433
    
hgs
parents:
diff changeset
   434
    User::LeaveIfError( fileSession.Connect() );
hgs
parents:
diff changeset
   435
    CleanupClosePushL( fileSession );    
hgs
parents:
diff changeset
   436
    
hgs
parents:
diff changeset
   437
    User::LeaveIfError(fileSession.CreatePrivatePath(EDriveC));
hgs
parents:
diff changeset
   438
    User::LeaveIfError(fileSession.PrivatePath(privatepath));
hgs
parents:
diff changeset
   439
    tempPath.Append(KBTSBIPTempPathDrive());
hgs
parents:
diff changeset
   440
    tempPath.Append(privatepath);    
hgs
parents:
diff changeset
   441
    User::LeaveIfError( file.Temp( fileSession, privatepath, 
hgs
parents:
diff changeset
   442
                            aFileName, EFileWrite ) );
hgs
parents:
diff changeset
   443
    
hgs
parents:
diff changeset
   444
    file.Flush();
hgs
parents:
diff changeset
   445
    file.Close();
hgs
parents:
diff changeset
   446
    CleanupStack::Pop();    // Close fileSession
hgs
parents:
diff changeset
   447
    fileSession.Close();
hgs
parents:
diff changeset
   448
    }
hgs
parents:
diff changeset
   449
hgs
parents:
diff changeset
   450
hgs
parents:
diff changeset
   451
// -----------------------------------------------------------------------------
hgs
parents:
diff changeset
   452
// CBTSBIPController::GenerateTempFileNameL
hgs
parents:
diff changeset
   453
// -----------------------------------------------------------------------------
hgs
parents:
diff changeset
   454
//
hgs
parents:
diff changeset
   455
void CBTSBIPController::GenerateTempFileNameL( TFileName& aFileName )
hgs
parents:
diff changeset
   456
    {
hgs
parents:
diff changeset
   457
    FLOG(_L("[BTSU]\t CBTSBIPController::GenerateTempFileNameL()"));
hgs
parents:
diff changeset
   458
hgs
parents:
diff changeset
   459
    RFs fileSession;
hgs
parents:
diff changeset
   460
    RFile file;  
hgs
parents:
diff changeset
   461
    
hgs
parents:
diff changeset
   462
    TBuf<KBTSUMaxPrivatePathLenght> privatepath;     
hgs
parents:
diff changeset
   463
    TBuf<KBTSUMaxPathLenght> tempPath;     
hgs
parents:
diff changeset
   464
    
hgs
parents:
diff changeset
   465
    User::LeaveIfError( fileSession.Connect() );
hgs
parents:
diff changeset
   466
    CleanupClosePushL( fileSession );
hgs
parents:
diff changeset
   467
    
hgs
parents:
diff changeset
   468
    User::LeaveIfError(fileSession.CreatePrivatePath(EDriveC));
hgs
parents:
diff changeset
   469
    User::LeaveIfError(fileSession.PrivatePath(privatepath ));
hgs
parents:
diff changeset
   470
    tempPath.Append(KBTSBIPTempPathDrive());
hgs
parents:
diff changeset
   471
    tempPath.Append(privatepath);
hgs
parents:
diff changeset
   472
    User::LeaveIfError(file.Temp( fileSession, tempPath, 
hgs
parents:
diff changeset
   473
                            aFileName, EFileWrite ) );                            
hgs
parents:
diff changeset
   474
    
hgs
parents:
diff changeset
   475
    file.Flush();
hgs
parents:
diff changeset
   476
    file.Close();
hgs
parents:
diff changeset
   477
    // Delete the file so that only a unique name is created
hgs
parents:
diff changeset
   478
    fileSession.Delete( aFileName );
hgs
parents:
diff changeset
   479
    CleanupStack::Pop();    // Close fileSession
hgs
parents:
diff changeset
   480
    fileSession.Close();
hgs
parents:
diff changeset
   481
    }    
hgs
parents:
diff changeset
   482
hgs
parents:
diff changeset
   483
hgs
parents:
diff changeset
   484
// -----------------------------------------------------------------------------
hgs
parents:
diff changeset
   485
// CBTSBIPController::DeleteTempFileL
hgs
parents:
diff changeset
   486
// -----------------------------------------------------------------------------
hgs
parents:
diff changeset
   487
//
hgs
parents:
diff changeset
   488
void CBTSBIPController::DeleteTempFile( TFileName& aFileName )
hgs
parents:
diff changeset
   489
    {
hgs
parents:
diff changeset
   490
    FLOG(_L("[BTSU]\t CBTSBIPController::DeleteTempFile()"));
hgs
parents:
diff changeset
   491
hgs
parents:
diff changeset
   492
    if ( &aFileName != NULL )
hgs
parents:
diff changeset
   493
        {
hgs
parents:
diff changeset
   494
        if ( aFileName.Length() > 0 )
hgs
parents:
diff changeset
   495
            {
hgs
parents:
diff changeset
   496
            RFs fileSession;
hgs
parents:
diff changeset
   497
            TInt retVal = fileSession.Connect();
hgs
parents:
diff changeset
   498
            if (retVal == KErrNone)
hgs
parents:
diff changeset
   499
                {
hgs
parents:
diff changeset
   500
                fileSession.Delete( aFileName );
hgs
parents:
diff changeset
   501
                }
hgs
parents:
diff changeset
   502
            fileSession.Close();
hgs
parents:
diff changeset
   503
            }
hgs
parents:
diff changeset
   504
        }
hgs
parents:
diff changeset
   505
hgs
parents:
diff changeset
   506
    FLOG(_L("[BTSU]\t CBTSBIPController::DeleteTempFile() complete"));
hgs
parents:
diff changeset
   507
    }
hgs
parents:
diff changeset
   508
hgs
parents:
diff changeset
   509
// -----------------------------------------------------------------------------
hgs
parents:
diff changeset
   510
// CBTSBIPController::CreateImageDescriptorL
hgs
parents:
diff changeset
   511
// -----------------------------------------------------------------------------
hgs
parents:
diff changeset
   512
//
hgs
parents:
diff changeset
   513
HBufC8*  CBTSBIPController::CreateImageDescriptorL()
hgs
parents:
diff changeset
   514
    {
hgs
parents:
diff changeset
   515
    FLOG(_L("[BTSU]\t CBTSBIPController::CreateImageDescriptorL()"));
hgs
parents:
diff changeset
   516
hgs
parents:
diff changeset
   517
    //   Example image descriptor of an small jpeg picture
hgs
parents:
diff changeset
   518
    //   with size 160*120 pixels and a size of 5000 bytes.
hgs
parents:
diff changeset
   519
    //
hgs
parents:
diff changeset
   520
    //  <image-descriptor version=\"1.0\">
hgs
parents:
diff changeset
   521
    //  <image encoding=\"JPEG\" pixel=\"160*120\" size=\"5000\"/>
hgs
parents:
diff changeset
   522
    //  </image-descriptor>
hgs
parents:
diff changeset
   523
    TBTSUImageParam param = iListPtr->ImageAtL( iFileIndex );
hgs
parents:
diff changeset
   524
    
hgs
parents:
diff changeset
   525
    // Add start of image description
hgs
parents:
diff changeset
   526
    //
hgs
parents:
diff changeset
   527
    TBuf8<KBTSUMaxStringLength> string( KBTSBIPDescriptorStart );
hgs
parents:
diff changeset
   528
hgs
parents:
diff changeset
   529
    // Add image encoding
hgs
parents:
diff changeset
   530
    //
hgs
parents:
diff changeset
   531
    string.Append( KBTSBIPDescriptorEncoding );
hgs
parents:
diff changeset
   532
    string.Append( *param.iDisplayName );
hgs
parents:
diff changeset
   533
hgs
parents:
diff changeset
   534
    // Add image pixel size
hgs
parents:
diff changeset
   535
    //
hgs
parents:
diff changeset
   536
    string.Append( KBTSBIPDescriptorPixel );
hgs
parents:
diff changeset
   537
    string.AppendNum( param.iPixelSize.iWidth );
hgs
parents:
diff changeset
   538
    string.Append( '*' );
hgs
parents:
diff changeset
   539
    string.AppendNum( param.iPixelSize.iHeight );
hgs
parents:
diff changeset
   540
hgs
parents:
diff changeset
   541
    // Add image size
hgs
parents:
diff changeset
   542
    //
hgs
parents:
diff changeset
   543
    string.Append( KBTSBIPDescriptorSize );
hgs
parents:
diff changeset
   544
    string.AppendNum( param.iFileSize );
hgs
parents:
diff changeset
   545
hgs
parents:
diff changeset
   546
    // Add end of image description
hgs
parents:
diff changeset
   547
    //
hgs
parents:
diff changeset
   548
    string.Append( KBTSBIPDescriptorEnd );
hgs
parents:
diff changeset
   549
hgs
parents:
diff changeset
   550
    FLOG(_L("[BTSU]\t CBTSBIPController::CreateImageDescriptorL() completed"));
hgs
parents:
diff changeset
   551
    
hgs
parents:
diff changeset
   552
    return string.AllocL();
hgs
parents:
diff changeset
   553
    }
hgs
parents:
diff changeset
   554
hgs
parents:
diff changeset
   555
hgs
parents:
diff changeset
   556
// -----------------------------------------------------------------------------
hgs
parents:
diff changeset
   557
// CBTSBIPController::HandleGetCompleteIndicationL
hgs
parents:
diff changeset
   558
// -----------------------------------------------------------------------------
hgs
parents:
diff changeset
   559
//
hgs
parents:
diff changeset
   560
void CBTSBIPController::HandleGetCompleteIndicationL( CObexBufObject* aGetResponse )
hgs
parents:
diff changeset
   561
    {
hgs
parents:
diff changeset
   562
    FLOG(_L("[BTSU]\t CBTSBIPController::HandleGetCompleteIndicationL()"));
hgs
parents:
diff changeset
   563
hgs
parents:
diff changeset
   564
    TBool found;
hgs
parents:
diff changeset
   565
    TBool allSupported;
hgs
parents:
diff changeset
   566
    TInt picindex,capindex;
hgs
parents:
diff changeset
   567
    CBTSUXmlParser* xmlParser = CBTSUXmlParser::NewL();
hgs
parents:
diff changeset
   568
    CleanupStack::PushL( xmlParser );
hgs
parents:
diff changeset
   569
    GenerateTempFileNameL( iTempFileName );
hgs
parents:
diff changeset
   570
    aGetResponse->WriteToFile( iTempFileName );
hgs
parents:
diff changeset
   571
    aGetResponse->Reset();
hgs
parents:
diff changeset
   572
    
hgs
parents:
diff changeset
   573
    // Parse capability object and create a list of supported image encodings
hgs
parents:
diff changeset
   574
    //
hgs
parents:
diff changeset
   575
    RArray<TBTSUImageCap>* remoteCapabilityList = 
hgs
parents:
diff changeset
   576
        xmlParser->GetImgCapabilityListL( iTempFileName );
hgs
parents:
diff changeset
   577
    
hgs
parents:
diff changeset
   578
    // Delete the temp file since we dont need it anymore
hgs
parents:
diff changeset
   579
    //
hgs
parents:
diff changeset
   580
    DeleteTempFile( iTempFileName );
hgs
parents:
diff changeset
   581
hgs
parents:
diff changeset
   582
    // Go through all the images on our sending list and check 
hgs
parents:
diff changeset
   583
    // if remote device is capable of receiving those.
hgs
parents:
diff changeset
   584
    // 
hgs
parents:
diff changeset
   585
    allSupported= ETrue;   
hgs
parents:
diff changeset
   586
    for (picindex=0; picindex< iListPtr->ImageCount(); picindex++ )
hgs
parents:
diff changeset
   587
    	{
hgs
parents:
diff changeset
   588
    	found=EFalse;
hgs
parents:
diff changeset
   589
    	for (capindex=0; capindex < remoteCapabilityList->Count(); capindex++)
hgs
parents:
diff changeset
   590
    		{
hgs
parents:
diff changeset
   591
    		//Find first is encoding suported			
hgs
parents:
diff changeset
   592
    		if((iListPtr->ImageAtL( picindex ).iDisplayName->Compare(*(*remoteCapabilityList)[capindex].iEncoding))==0)		
hgs
parents:
diff changeset
   593
    			{
hgs
parents:
diff changeset
   594
    			found=ETrue;    			
hgs
parents:
diff changeset
   595
    			//Check pixel size
hgs
parents:
diff changeset
   596
    			if((*remoteCapabilityList)[capindex].iMinPixelSize.iHeight>=0)
hgs
parents:
diff changeset
   597
    				{
hgs
parents:
diff changeset
   598
    				if(((*remoteCapabilityList)[capindex].iMaxPixelSize.iWidth < iListPtr->ImageAtL( picindex ).iPixelSize.iWidth)  ||
hgs
parents:
diff changeset
   599
    				   ((*remoteCapabilityList)[capindex].iMaxPixelSize.iHeight < iListPtr->ImageAtL( picindex ).iPixelSize.iHeight)|| 
hgs
parents:
diff changeset
   600
    				   ((*remoteCapabilityList)[capindex].iMinPixelSize.iHeight > iListPtr->ImageAtL( picindex ).iPixelSize.iHeight)||
hgs
parents:
diff changeset
   601
    				   ((*remoteCapabilityList)[capindex].iMinPixelSize.iWidth > iListPtr->ImageAtL( picindex ).iPixelSize.iWidth)
hgs
parents:
diff changeset
   602
    				   )
hgs
parents:
diff changeset
   603
    					{
hgs
parents:
diff changeset
   604
    					found=EFalse;
hgs
parents:
diff changeset
   605
    					}
hgs
parents:
diff changeset
   606
    				}
hgs
parents:
diff changeset
   607
    		
hgs
parents:
diff changeset
   608
    			//Check byte size
hgs
parents:
diff changeset
   609
    			if((*remoteCapabilityList)[capindex].iMaxByteSize>=0)
hgs
parents:
diff changeset
   610
    				{    				
hgs
parents:
diff changeset
   611
    				if((*remoteCapabilityList)[capindex].iMaxByteSize<iListPtr->ImageAtL( picindex ).iFileSize)
hgs
parents:
diff changeset
   612
    					{
hgs
parents:
diff changeset
   613
    					found=EFalse;
hgs
parents:
diff changeset
   614
    					}
hgs
parents:
diff changeset
   615
    				}    	
hgs
parents:
diff changeset
   616
    			// If file is supported, stop the loop.
hgs
parents:
diff changeset
   617
    			//
hgs
parents:
diff changeset
   618
    			if ( found )
hgs
parents:
diff changeset
   619
    			    break;
hgs
parents:
diff changeset
   620
    			}
hgs
parents:
diff changeset
   621
     		}
hgs
parents:
diff changeset
   622
    	allSupported = found & allSupported;
hgs
parents:
diff changeset
   623
    	}
hgs
parents:
diff changeset
   624
    	
hgs
parents:
diff changeset
   625
	for (TInt index=0; index < remoteCapabilityList->Count(); index++)
hgs
parents:
diff changeset
   626
		{
hgs
parents:
diff changeset
   627
		if((*remoteCapabilityList)[index].iEncoding)
hgs
parents:
diff changeset
   628
			{
hgs
parents:
diff changeset
   629
			delete ((*remoteCapabilityList)[index].iEncoding);
hgs
parents:
diff changeset
   630
			}
hgs
parents:
diff changeset
   631
hgs
parents:
diff changeset
   632
		}
hgs
parents:
diff changeset
   633
		
hgs
parents:
diff changeset
   634
	remoteCapabilityList->Close();
hgs
parents:
diff changeset
   635
	delete remoteCapabilityList;
hgs
parents:
diff changeset
   636
    CleanupStack::PopAndDestroy( xmlParser ); 
hgs
parents:
diff changeset
   637
    
57
5ebadcda06cb 201035_7
hgs
parents: 42
diff changeset
   638
    HbTextResolverSymbian::Init(KLocFileName, KPath);
32
hgs
parents:
diff changeset
   639
    if(!allSupported  && iListPtr->ImageCount() > 1)
hgs
parents:
diff changeset
   640
    	{      	
42
hgs
parents: 32
diff changeset
   641
        HBufC* sendText = HbTextResolverSymbian::LoadLC(KBTNotSendSomeText);
hgs
parents: 32
diff changeset
   642
    	iObserverPtr->LaunchConfirmationQuery(sendText->Des());
hgs
parents: 32
diff changeset
   643
    	CleanupStack::PopAndDestroy( sendText );
32
hgs
parents:
diff changeset
   644
    	}
hgs
parents:
diff changeset
   645
    else if ( !allSupported  &&  iListPtr->ImageCount() == 1)
hgs
parents:
diff changeset
   646
        {
hgs
parents:
diff changeset
   647
        // We allow user to choose wheather to send the image file which is not supported on target device
42
hgs
parents: 32
diff changeset
   648
        HBufC* sendText = HbTextResolverSymbian::LoadLC(KBTNotSendOneText);
hgs
parents: 32
diff changeset
   649
        iObserverPtr->LaunchConfirmationQuery(sendText->Des());
hgs
parents: 32
diff changeset
   650
        CleanupStack::PopAndDestroy( sendText );
32
hgs
parents:
diff changeset
   651
        } 	
hgs
parents:
diff changeset
   652
    else if( allSupported )  	
hgs
parents:
diff changeset
   653
        {
42
hgs
parents: 32
diff changeset
   654
    	iObserverPtr->LaunchProgressNoteL( iClient, iListPtr->ImageCount() + iListPtr->ObjectCount());
32
hgs
parents:
diff changeset
   655
    
hgs
parents:
diff changeset
   656
	    // Start sending images
hgs
parents:
diff changeset
   657
    	//   	
hgs
parents:
diff changeset
   658
   		SendL();   		
hgs
parents:
diff changeset
   659
    	}
hgs
parents:
diff changeset
   660
    	
hgs
parents:
diff changeset
   661
    
hgs
parents:
diff changeset
   662
    FLOG(_L("[BTSU]\t CBTSBIPController::HandleGetCompleteIndicationL() #3"));
hgs
parents:
diff changeset
   663
    }
hgs
parents:
diff changeset
   664
    
hgs
parents:
diff changeset
   665
hgs
parents:
diff changeset
   666
//-----------------------------------------------------------------------------
hgs
parents:
diff changeset
   667
// void CBTSBIPController::ConnectTimedOut()
hgs
parents:
diff changeset
   668
// -----------------------------------------------------------------------------
hgs
parents:
diff changeset
   669
//        
hgs
parents:
diff changeset
   670
void CBTSBIPController::ConnectTimedOut()    
hgs
parents:
diff changeset
   671
    {
hgs
parents:
diff changeset
   672
    iObserverPtr->ConnectTimedOut();    
hgs
parents:
diff changeset
   673
    }
hgs
parents:
diff changeset
   674
hgs
parents:
diff changeset
   675
42
hgs
parents: 32
diff changeset
   676
hgs
parents: 32
diff changeset
   677
void CBTSBIPController::SendUnSupportedFiles()
hgs
parents: 32
diff changeset
   678
    {
hgs
parents: 32
diff changeset
   679
    // Everything went ok. Start sending images
hgs
parents: 32
diff changeset
   680
hgs
parents: 32
diff changeset
   681
    // group leaving functions in one trap for better performance:
hgs
parents: 32
diff changeset
   682
    TRAPD(err, {
hgs
parents: 32
diff changeset
   683
            iObserverPtr->LaunchProgressNoteL( iClient, iListPtr->ImageCount() );
hgs
parents: 32
diff changeset
   684
            SendL(); } );
hgs
parents: 32
diff changeset
   685
    
hgs
parents: 32
diff changeset
   686
    if ( err != KErrNone )
hgs
parents: 32
diff changeset
   687
        {
hgs
parents: 32
diff changeset
   688
        DeleteTempFile( iTempFileName );
hgs
parents: 32
diff changeset
   689
        // Error on capability handling
hgs
parents: 32
diff changeset
   690
        //
hgs
parents: 32
diff changeset
   691
        iObserverPtr->ControllerComplete( EBTSGettingFailed );
hgs
parents: 32
diff changeset
   692
        }
hgs
parents: 32
diff changeset
   693
    }
hgs
parents: 32
diff changeset
   694
32
hgs
parents:
diff changeset
   695
//  End of File