btobexprofiles/obexsendservices/obexservicesendutils/src/BTServiceStarter.cpp
changeset 42 b72428996822
parent 32 19bd632b5100
child 45 b0aebde9b1fb
equal deleted inserted replaced
32:19bd632b5100 42:b72428996822
    22 #include "BTSUDebug.h"
    22 #include "BTSUDebug.h"
    23 #include "BTSOPPController.h"
    23 #include "BTSOPPController.h"
    24 #include "BTSBIPController.h"
    24 #include "BTSBIPController.h"
    25 #include "BTSBPPController.h"
    25 #include "BTSBPPController.h"
    26 
    26 
    27 #include <Obexutils.rsg>
       
    28 #include <obexutilsuilayer.h>
       
    29 #include <obexutilsmessagehandler.h>
    27 #include <obexutilsmessagehandler.h>
    30 #include <btnotif.h>
       
    31 #include <featmgr.h>
    28 #include <featmgr.h>
    32 #include "BTSProgresstimer.h"
       
    33 #include <hbdevicenotificationdialogsymbian.h>
    29 #include <hbdevicenotificationdialogsymbian.h>
    34 #include <btservices/bluetoothdevicedialogs.h>
    30 #include <hbtextresolversymbian.h>
    35 
    31 
    36 // CONSTANTS
    32 // CONSTANTS
    37 
    33 
    38 // From BT SIG - Assigned numbers
    34 // From BT SIG - Assigned numbers
    39 const TUint KBTServiceOPPSending        = 0x1105;
    35 const TUint KBTServiceOPPSending        = 0x1105;
    40 const TUint KBTServiceDirectPrinting    = 0x1118;
    36 const TUint KBTServiceDirectPrinting    = 0x1118;
    41 const TUint KBTServiceImagingResponder  = 0x111B;
    37 const TUint KBTServiceImagingResponder  = 0x111B;
    42 
    38 
    43 const TUint KBTProgressInterval         = 1000000;
    39 const TUint KBTProgressInterval         = 1000000;
    44 
    40 
    45 
    41 const TUid KUidMsgTypeBt                 = {0x10009ED5};
    46 _LIT(KSendingDialog,"com.nokia.hb.btdevicedialog/1.0");
    42 //todo  need to find a suitable header to include. This is from obexutilslayer.h
       
    43 
       
    44 const TInt KMaxDesCLength  = 256;
       
    45 
       
    46 
       
    47 //_LIT(KSendingDialog,"com.nokia.hb.btdevicedialog/1.0");
       
    48 
       
    49 _LIT(KLocFileName, "btdialogs_");
       
    50 _LIT(KPath, "z:/resource/qt/translations/");  
       
    51 
       
    52 _LIT(KFilesSentText, "txt_bt_dpophead_all_files_sent");//All files sent 
       
    53 _LIT(KDeviceText,"txt_bt_dpopinfo_sent_to_1");
       
    54 //_LIT(KNotConnectedText,"txt_bt_info_unable_to_connect_with_bluetooth");
       
    55 _LIT(KSendingFailedText,"txt_bt_dpophead_sending_failed");
    47 
    56 
    48 // ============================ MEMBER FUNCTIONS ===============================
    57 // ============================ MEMBER FUNCTIONS ===============================
    49 
    58 
    50 // -----------------------------------------------------------------------------
    59 // -----------------------------------------------------------------------------
    51 // CBTServiceStarter::CBTServiceStarter
    60 // CBTServiceStarter::CBTServiceStarter
    76 //
    85 //
    77 void CBTServiceStarter::ConstructL()
    86 void CBTServiceStarter::ConstructL()
    78     {
    87     {
    79     FLOG(_L("[BTSU]\t CBTServiceStarter::ConstructL()"));
    88     FLOG(_L("[BTSU]\t CBTServiceStarter::ConstructL()"));
    80     iDevice = CBTDevice::NewL();
    89     iDevice = CBTDevice::NewL();
    81 //    iDialog = CObexUtilsDialog::NewL( this );
    90     iDialog = CObexUtilsDialog::NewL( this );
    82     iDeviceDialog = CHbDeviceDialogSymbian::NewL();
    91     iDelayedDestroyer = CBTServiceDelayedDestroyer::NewL(CActive::EPriorityStandard);
    83     iProgressDialog = CHbDeviceProgressDialogSymbian::NewL(CHbDeviceProgressDialogSymbian::EWaitDialog,this);
       
    84     
       
    85     FeatureManager::InitializeLibL();
    92     FeatureManager::InitializeLibL();
    86     iFeatureManagerInitialized = ETrue;
    93     iFeatureManagerInitialized = ETrue;
       
    94     iLocalisationInit = HbTextResolverSymbian::Init(KLocFileName, KPath);
    87     FLOG(_L("[BTSU]\t CBTServiceStarter::ConstructL() completed"));
    95     FLOG(_L("[BTSU]\t CBTServiceStarter::ConstructL() completed"));
    88     }
    96     }
    89 
    97 
    90 // -----------------------------------------------------------------------------
    98 // -----------------------------------------------------------------------------
    91 // CBTServiceStarter::NewL
    99 // CBTServiceStarter::NewL
   115     delete iList;
   123     delete iList;
   116     delete iDevice;
   124     delete iDevice;
   117 
   125 
   118     delete iController;
   126     delete iController;
   119     delete iBTEngDiscovery;
   127     delete iBTEngDiscovery;
   120  //   delete iDialog;
   128     delete iDialog;
   121     delete iDeviceDialog;
   129     delete iDelayedDestroyer;
   122     delete iProgressDialog;
   130     
   123     if(iProgressTimer)
       
   124         {
       
   125         delete iProgressTimer;
       
   126         }
       
   127 
       
   128     if(iWaiter && iWaiter->IsStarted() )
   131     if(iWaiter && iWaiter->IsStarted() )
   129         {
   132         {
   130         iWaiter->AsyncStop();
   133         iWaiter->AsyncStop();
   131         }
   134         }
   132     delete iBTEngSettings;
   135     delete iBTEngSettings;
   260         {
   263         {
   261         return iBytesSendWithBIP;
   264         return iBytesSendWithBIP;
   262         }
   265         }
   263     }
   266     }
   264 
   267 
   265 void CBTServiceStarter::UpdateProgressInfoL()
       
   266     {
       
   267     HBufC* key = HBufC::NewL(50);
       
   268     CleanupStack::PushL(key);
       
   269    
       
   270     HBufC* value = HBufC::NewL(50);
       
   271     CleanupStack::PushL(value);
       
   272     
       
   273     CHbSymbianVariantMap* map = CHbSymbianVariantMap::NewL();
       
   274     CleanupStack::PushL(map);
       
   275     
       
   276     TInt progress = GetProgressStatus();
       
   277     
       
   278     key->Des().Copy(_L("progressValue"));
       
   279     CHbSymbianVariant* progressvalue = CHbSymbianVariant::NewL(&progress, CHbSymbianVariant::EInt);
       
   280     map->Add(*key,progressvalue);
       
   281     
       
   282     key->Des().Copy(_L("currentFileIdx"));
       
   283     value->Des().AppendNum(iFileIndex);
       
   284     CHbSymbianVariant* currentFileIdx = CHbSymbianVariant::NewL(value, CHbSymbianVariant::EDes);
       
   285     map->Add(*key,currentFileIdx);
       
   286 
       
   287     
       
   288     TInt ret = iDeviceDialog->Update(*map);
       
   289     
       
   290     CleanupStack::PopAndDestroy(map);
       
   291     CleanupStack::PopAndDestroy(value);            
       
   292     CleanupStack::PopAndDestroy(key);
       
   293     
       
   294     
       
   295     if ( iProgressTimer )
       
   296         {
       
   297         iProgressTimer->Tickle();
       
   298         }
       
   299     }
       
   300 
   268 
   301 // -----------------------------------------------------------------------------
   269 // -----------------------------------------------------------------------------
   302 // CBTServiceStarter::ValidParameters
   270 // CBTServiceStarter::ValidParameters
   303 // -----------------------------------------------------------------------------
   271 // -----------------------------------------------------------------------------
   304 //
   272 //
   478         {
   446         {
   479  //       iDialog->LaunchWaitDialogL( R_BT_PRINTING_WAIT_NOTE );
   447  //       iDialog->LaunchWaitDialogL( R_BT_PRINTING_WAIT_NOTE );
   480         }
   448         }
   481     else
   449     else
   482         {
   450         {
   483         //       iDialog->LaunchWaitDialogL( R_BT_CONNECTING_WAIT_NOTE );
   451     //todo need to do the localisation here
   484         _LIT(KConnectText, "Connecting...");
   452         _LIT(KConnectText, "Connecting...");
   485         iProgressDialog->SetTextL(KConnectText);
   453         iDialog->LaunchWaitDialogL(KConnectText);
   486         iProgressDialog->ShowL();
       
   487         
   454         
   488         }    
   455         }    
   489     FLOG(_L("[BTSU]\t CBTServiceStarter::LaunchWaitNoteL() completed"));
   456     FLOG(_L("[BTSU]\t CBTServiceStarter::LaunchWaitNoteL() completed"));
   490     }
   457     }
   491 
   458 
   495 //
   462 //
   496 void CBTServiceStarter::CancelWaitNote()
   463 void CBTServiceStarter::CancelWaitNote()
   497     {
   464     {
   498     FLOG(_L("[BTSU]\t CBTServiceStarter::CancelWaitNote()"));
   465     FLOG(_L("[BTSU]\t CBTServiceStarter::CancelWaitNote()"));
   499 
   466 
   500   //  if ( iDialog )
   467     if ( iDialog )
   501   //      {
   468         {
   502         //       TRAP_IGNORE( iDialog->CancelWaitDialogL() );
   469         iDialog->CancelWaitDialog();
   503         if(iProgressDialog)
   470         }
   504             {
       
   505             //This has to be tested
       
   506             iProgressDialog->Close();
       
   507             }
       
   508     //    }
       
   509 
   471 
   510     FLOG(_L("[BTSU]\t CBTServiceStarter::CancelWaitNote() completed"));
   472     FLOG(_L("[BTSU]\t CBTServiceStarter::CancelWaitNote() completed"));
   511     }
   473     }
   512 
   474 
   513 
   475 
   514 // -----------------------------------------------------------------------------
   476 // -----------------------------------------------------------------------------
   515 // CBTServiceStarter::LaunchProgressNoteL
   477 // CBTServiceStarter::LaunchProgressNoteL
   516 // -----------------------------------------------------------------------------
   478 // -----------------------------------------------------------------------------
   517 //
   479 //
       
   480 //todo reusing the second param aTotalSize to aFileCount as it is no longer used check it being used in other places
   518 void CBTServiceStarter::LaunchProgressNoteL( MBTServiceProgressGetter* aGetter,
   481 void CBTServiceStarter::LaunchProgressNoteL( MBTServiceProgressGetter* aGetter,
   519                                              TInt aTotalSize, TInt aFileCount)
   482                                               TInt aFileCount)
   520     {
   483     {
   521     FLOG(_L("[BTSU]\t CBTServiceStarter::LaunchProgressNoteL()"));
   484     FLOG(_L("[BTSU]\t CBTServiceStarter::LaunchProgressNoteL()"));
   522     (void) aTotalSize;
   485     RBuf deviceName;
   523     
       
   524     if ( iService != EBTPrintingService )
   486     if ( iService != EBTPrintingService )
   525         {    
   487         {    
   526         iProgressGetter = aGetter;     
   488         iProgressGetter = aGetter;     
   527         CancelWaitNote();        
   489         CancelWaitNote();        
   528         
   490         
   529         if ( !iProgressDialogActive )
   491         if ( !iProgressDialogActive )
   530         	{
   492         	{
   531             iFileCount = aFileCount;
   493             // todo need to change the last parameter because we are now using the textmap id which is a string
       
   494             // whether we replace it with that or remove the parameter is to be decided
   532         	iMessageServerIndex = TObexUtilsMessageHandler::CreateOutboxEntryL( 
   495         	iMessageServerIndex = TObexUtilsMessageHandler::CreateOutboxEntryL( 
   533             KUidMsgTypeBt, R_BT_SEND_OUTBOX_SENDING );        
   496             KUidMsgTypeBt, 0 );     
   534    //     	iDialog->LaunchProgressDialogL( this, aTotalSize, 
   497 
   535      //        								R_BT_SENDING_DATA, KBTProgressInterval );	
   498             deviceName.CreateL(KMaxDesCLength);
   536             CHbSymbianVariantMap* map = CHbSymbianVariantMap::NewL();
   499             
   537             CleanupStack::PushL(map);
   500             if ( iDevice->IsValidFriendlyName() )
   538             if ( iProgressTimer )
   501                 {
   539                 {
   502                 deviceName.Copy( iDevice->FriendlyName() );
   540                 iProgressTimer->Cancel();
       
   541                 delete iProgressTimer;
       
   542                 iProgressTimer = NULL;
       
   543                 }
   503                 }
   544 
   504             else 
   545             iProgressTimer = CBTSProgressTimer::NewL( this );
   505                 {
   546             iProgressTimer->SetTimeout( KBTProgressInterval );
   506                 deviceName.Copy( BTDeviceNameConverter::ToUnicodeL(iDevice->DeviceName()));
   547             
   507                 }        	
   548             iProgressTimer->Tickle();
   508         	iDialog->LaunchProgressDialogL( this, aFileCount, 
   549 
   509                                 deviceName, KBTProgressInterval );	
   550             CHbSymbianVariant* value = NULL;
   510         	deviceName.Close();
   551             TBuf<6> key;
       
   552             TInt data = TBluetoothDialogParams::ESend;
       
   553             key.Num(TBluetoothDialogParams::EDialogType);
       
   554             value = CHbSymbianVariant::NewL( (TAny*) &data, CHbSymbianVariant::EInt );
       
   555             User::LeaveIfError(map->Add( key, value ));   // Takes ownership of value
       
   556             iDeviceDialog->Show(KSendingDialog(),*map,this);
       
   557             CleanupStack::PopAndDestroy(map);
       
   558         	}        
   511         	}        
   559         iProgressDialogActive=ETrue;     
   512         iProgressDialogActive=ETrue;     
   560         }
   513         }
   561 
   514 
   562     FLOG(_L("[BTSU]\t CBTServiceStarter::LaunchProgressNoteL() completed"));
   515     FLOG(_L("[BTSU]\t CBTServiceStarter::LaunchProgressNoteL() completed"));
   563     }
   516     }
   564 
   517 
       
   518 // -----------------------------------------------------------------------------
       
   519 // CBTServiceStarter::UpdateProgressNoteL
       
   520 // -----------------------------------------------------------------------------
       
   521 //
   565 void CBTServiceStarter::UpdateProgressNoteL(TInt aFileSize,TInt aFileIndex, const TDesC& aFileName )
   522 void CBTServiceStarter::UpdateProgressNoteL(TInt aFileSize,TInt aFileIndex, const TDesC& aFileName )
   566     {
   523     {
   567     HBufC* key = HBufC::NewL(50);
   524     
   568     CleanupStack::PushL(key);
   525     iDialog->UpdateProgressNoteL(aFileSize,aFileIndex,aFileName);
   569    
   526     }
   570     HBufC* value = HBufC::NewL(50);
   527 
   571     CleanupStack::PushL(value);
       
   572     
       
   573     CHbSymbianVariantMap* map = CHbSymbianVariantMap::NewL();
       
   574     CleanupStack::PushL(map);
       
   575     
       
   576     iFileIndex = aFileIndex+1;
       
   577     key->Des().Copy(_L("currentFileIdx"));
       
   578     value->Des().AppendNum(aFileIndex+1);
       
   579     CHbSymbianVariant* currentFileIdx = CHbSymbianVariant::NewL(value, CHbSymbianVariant::EDes);
       
   580     map->Add(*key,currentFileIdx);
       
   581     
       
   582     key->Des().Copy(_L("totalFilesCnt"));
       
   583     value->Des().Zero();
       
   584     value->Des().AppendNum(iFileCount);
       
   585     CHbSymbianVariant* totalFilesCnt = CHbSymbianVariant::NewL(value, CHbSymbianVariant::EDes);
       
   586     map->Add(*key,totalFilesCnt);
       
   587 
       
   588     
       
   589     key->Des().Copy(_L("destinationName"));
       
   590     if ( iDevice->IsValidFriendlyName() )
       
   591         {
       
   592         value->Des().Copy( iDevice->FriendlyName() );
       
   593         }
       
   594     else 
       
   595         {
       
   596         value->Des().Copy( BTDeviceNameConverter::ToUnicodeL(iDevice->DeviceName()));
       
   597         }
       
   598 
       
   599     CHbSymbianVariant* destinationName = CHbSymbianVariant::NewL(value, CHbSymbianVariant::EDes);
       
   600     map->Add(*key,destinationName);
       
   601     
       
   602     key->Des().Copy(_L("fileName"));
       
   603     value->Des().Copy(aFileName);
       
   604     CHbSymbianVariant* fileName = CHbSymbianVariant::NewL(value, CHbSymbianVariant::EDes);
       
   605     map->Add(*key,fileName);
       
   606     
       
   607     key->Des().Copy(_L("fileSzTxt"));
       
   608     value->Des().Zero();
       
   609     if(aFileSize < 1024)
       
   610         {
       
   611         value->Des().AppendNum(aFileSize);
       
   612         value->Des().Append(_L(" Bytes"));
       
   613         }
       
   614     else
       
   615         {
       
   616         TInt filesize =  aFileSize/1024;
       
   617         value->Des().AppendNum(filesize);
       
   618         value->Des().Append(_L(" KB"));
       
   619         }
       
   620 
       
   621     CHbSymbianVariant* fileSzTxt = CHbSymbianVariant::NewL(value, CHbSymbianVariant::EDes);
       
   622     map->Add(*key,fileSzTxt);
       
   623     
       
   624     
       
   625     key->Des().Copy(_L("fileSz"));
       
   626     CHbSymbianVariant* fileSz = CHbSymbianVariant::NewL(&aFileSize, CHbSymbianVariant::EInt);
       
   627     map->Add(*key,fileSz);
       
   628 
       
   629 
       
   630     
       
   631     TInt ret = iDeviceDialog->Update(*map);
       
   632     CleanupStack::PopAndDestroy(map);
       
   633     CleanupStack::PopAndDestroy(value);            
       
   634     CleanupStack::PopAndDestroy(key);
       
   635     }
       
   636 // -----------------------------------------------------------------------------
   528 // -----------------------------------------------------------------------------
   637 // CBTServiceStarter::CancelProgressNote
   529 // CBTServiceStarter::CancelProgressNote
   638 // -----------------------------------------------------------------------------
   530 // -----------------------------------------------------------------------------
   639 //
   531 //
   640 void CBTServiceStarter::CancelProgressNote()
   532 void CBTServiceStarter::CancelProgressNote()
   641     {
   533     {
   642     FLOG(_L("[BTSU]\t CBTServiceStarter::CancelProgressNote()"));
   534     FLOG(_L("[BTSU]\t CBTServiceStarter::CancelProgressNote()"));
   643 
   535 
   644  //   if ( iDialog )
   536     if ( iDialog )
   645         {
   537         {
   646   //      TRAP_IGNORE( iDialog->CancelProgressDialogL() );
   538         iDialog->CancelProgressDialog();
   647     if ( iProgressTimer )
   539         }
   648          {
       
   649          iProgressTimer->Cancel();
       
   650          delete iProgressTimer;
       
   651          iProgressTimer = NULL;
       
   652          }
       
   653         }
       
   654     if(iDeviceDialog)
       
   655          {
       
   656          iDeviceDialog->Cancel();
       
   657          }
       
   658     }
   540     }
   659 
   541 
   660 // -----------------------------------------------------------------------------
   542 // -----------------------------------------------------------------------------
   661 // CBTServiceStarter::DialogDismissed
   543 // CBTServiceStarter::DialogDismissed
   662 // -----------------------------------------------------------------------------
   544 // -----------------------------------------------------------------------------
   663 //
   545 //
   664 void CBTServiceStarter::DialogDismissed( TInt aButtonId )
   546 void CBTServiceStarter::DialogDismissed(TInt aButtonId )
   665     {
   547     {
   666     FLOG(_L("[BTSU]\t CBTServiceStarter::DialogDismissed()"));   
   548     FLOG(_L("[BTSU]\t CBTServiceStarter::DialogDismissed()"));   
   667     if( aButtonId == EAknSoftkeyCancel )
   549     if( aButtonId == ECancelButton )
   668         {
   550         { // this condition is hit for the progress dialog and connecting dialog cancel
   669         FLOG(_L("[BTSU]\t CBTServiceStarter::DialogDissmissed(), cancelled by user"));        
   551         FLOG(_L("[BTSU]\t CBTServiceStarter::DialogDissmissed(), cancelled by user"));        
   670         iUserCancel=ETrue;
   552         iUserCancel=ETrue;
   671         if ( iController )
   553         if ( iController )
   672             {
   554             {
   673             iController->Abort();
   555             iController->Abort();
   675         else 
   557         else 
   676            {
   558            {
   677            StopTransfer(KErrCancel);
   559            StopTransfer(KErrCancel);
   678            }    
   560            }    
   679         }
   561         }
   680     else if ( aButtonId == EAknSoftkeyNo )
   562     else if ( aButtonId == ENoButton )
   681         {
   563         {
   682         // user abortion
   564         // user abortion
   683         //
   565         //
   684         iUserCancel = ETrue;
   566         iUserCancel = ETrue;
   685         StopTransfer( KErrCancel );
   567         StopTransfer( KErrCancel );
       
   568         CancelWaitNote();
       
   569         }
       
   570     else //EYesButton
       
   571         {// this condition is hit when user is ok with sending the unsupported images
       
   572         iController->SendUnSupportedFiles();
   686         }
   573         }
   687     FLOG(_L("[BTSU]\t CBTServiceStarter::DialogDismissed() completed"));
   574     FLOG(_L("[BTSU]\t CBTServiceStarter::DialogDismissed() completed"));
   688     }
   575     }
   689 
   576 
   690 // -----------------------------------------------------------------------------
   577 // -----------------------------------------------------------------------------
   691 // CBTServiceStarter::ShowNote
   578 // CBTServiceStarter::ShowErrorNote
   692 // -----------------------------------------------------------------------------
   579 // -----------------------------------------------------------------------------
   693 //
   580 //
   694 void CBTServiceStarter::ShowNote( TInt aReason ) const
   581 void CBTServiceStarter::ShowErrorNote( TInt aReason ) const
   695     {
   582     {
   696     FLOG(_L("[BTSU]\t CBTServiceStarter::ShowNote()"));
   583     FLOG(_L("[BTSU]\t CBTServiceStarter::ShowErrorNote()"));
   697      
   584      
   698 //    TInt resource = 0;
   585     TBuf<KMaxDesCLength> buf;
   699     TBuf<255> buf;
   586     TPtrC sendTextMapId;
       
   587     
       
   588     if ( iDevice->IsValidFriendlyName() )
       
   589         {
       
   590         buf.Copy( iDevice->FriendlyName() );
       
   591         }
       
   592     else 
       
   593         {
       
   594         TRAP_IGNORE( buf.Copy( BTDeviceNameConverter::ToUnicodeL(iDevice->DeviceName())));
       
   595         }
       
   596     
   700 
   597 
   701     switch ( aReason )
   598     switch ( aReason )
   702         {
   599         {
   703         case EBTSNoError:
   600         case EBTSNoError:
   704             {
   601             {
   705     /*        if ( iService == EBTPrintingService )
   602             sendTextMapId.Set(KFilesSentText());
   706                 {
       
   707                // resource = R_BT_DATA_SENT2;
       
   708                 
       
   709                 _LIT(KText, "Data Sent");
       
   710                 buf.Copy(KText);
       
   711                 }
       
   712             else
       
   713                 {
       
   714                 //resource = R_BT_DATA_SENT;*/
       
   715                 _LIT(KText, "All files Sent to ");
       
   716                 buf.Copy(KText);
       
   717                 if ( iDevice->IsValidFriendlyName() )
       
   718                     {
       
   719                     buf.Append( iDevice->FriendlyName() );
       
   720                     }
       
   721                 else 
       
   722                     {
       
   723                    TRAP_IGNORE( buf.Append( BTDeviceNameConverter::ToUnicodeL(iDevice->DeviceName())));
       
   724                     }
       
   725 
       
   726 
       
   727 //                }
       
   728             break;
   603             break;
   729             }
   604             }
   730         case EBTSConnectingFailed:
   605         case EBTSConnectingFailed:
   731             {
       
   732             //resource = R_BT_DEV_NOT_AVAIL;
       
   733             _LIT(KText, "Cannot establish Bluetooth connection");
       
   734             buf.Copy(KText);
       
   735             break;
       
   736             }
       
   737         case EBTSGettingFailed:
   606         case EBTSGettingFailed:
   738         case EBTSPuttingFailed:
   607         case EBTSPuttingFailed:
   739             {
   608         case EBTSNoSuitableProfiles:
   740             if ( iService == EBTPrintingService )
   609       //todo below three enums are not valid and it is not being used at anywhere do we need to have it 
   741                 {
   610             
   742                 _LIT(KText, "Sending failed");
   611 //        case EBTSBIPSomeSend:
   743                 //resource = R_BT_FAILED_TO_SEND2;
   612 //        case EBTSBIPOneNotSend:
   744                 buf.Copy(KText);
   613 //        case EBTSBIPNoneSend:
   745                 }
   614         default:            
   746             else
   615             {
   747                 {
   616             sendTextMapId.Set(KSendingFailedText());
   748                 _LIT(KText, "Failed to send Data");
       
   749                 //resource = R_BT_FAILED_TO_SEND;
       
   750                 buf.Copy(KText);
       
   751                 }
       
   752             break;
   617             break;
   753             }
   618             }
   754         case EBTSNoSuitableProfiles:
       
   755             {
       
   756             if ( iService == EBTPrintingService )
       
   757                 {
       
   758                 _LIT(KText, "Printer not supported");
       
   759                 buf.Copy(KText);
       
   760             //    resource = R_BT_PRINTING_NOT_SUPPORTED;
       
   761                 }
       
   762             else
       
   763                 {
       
   764                 _LIT(KText, "Failed to send Data");
       
   765                 buf.Copy(KText);
       
   766          //       resource = R_BT_FAILED_TO_SEND;
       
   767                 }
       
   768             break;
       
   769             }
       
   770         case EBTSBIPSomeSend:
       
   771         	{
       
   772         	_LIT(KText, "Failed to send Data");
       
   773         	 buf.Copy(KText);
       
   774         	//resource = R_BT_FAILED_TO_SEND;
       
   775         	break;	
       
   776         	}    
       
   777         case EBTSBIPOneNotSend:
       
   778         	{
       
   779         	_LIT(KText, "Receiving device does not support this image format.");
       
   780         	 buf.Copy(KText);
       
   781         	//resource = R_BT_NOT_RECEIVE_ONE;
       
   782         	break;
       
   783         	}
       
   784         case EBTSBIPNoneSend:
       
   785         	{
       
   786         	_LIT(KText, "Receiving device does not support the needed image formats.");
       
   787         	 buf.Copy(KText);
       
   788         	//resource = R_BT_NOT_RECEIVE_ANY;
       
   789         	break;
       
   790         	}	
       
   791         default:
       
   792             {            
       
   793            // resource = R_BT_DEV_NOT_AVAIL;
       
   794             _LIT(KText, "Cannot establish Bluetooth connection");
       
   795             buf.Copy(KText);
       
   796             break;
       
   797             }
       
   798         }        
   619         }        
   799     
   620     
   800 //	TRAP_IGNORE(TObexUtilsUiLayer::ShowInformationNoteL( resource ) );	
   621     
   801 //    CHbDeviceMessageBoxSymbian::InformationL(buf);
   622     if(iLocalisationInit)
   802       TRAP_IGNORE(CHbDeviceNotificationDialogSymbian::NotificationL(KNullDesC, buf, KNullDesC));
   623         {
   803     FLOG(_L("[BTSU]\t CBTServiceStarter::ShowNote() completed"));
   624         TRAP_IGNORE(
   804     }
   625                HBufC* sendText = HbTextResolverSymbian::LoadLC(sendTextMapId);
       
   626                HBufC* deviceName =  HbTextResolverSymbian::LoadLC(KDeviceText,buf);
       
   627                CHbDeviceNotificationDialogSymbian::NotificationL(KNullDesC, deviceName->Des(), sendText->Des());
       
   628                CleanupStack::PopAndDestroy( deviceName );
       
   629                CleanupStack::PopAndDestroy( sendText );
       
   630                );
       
   631         }
       
   632     else
       
   633         {
       
   634         TRAP_IGNORE(CHbDeviceNotificationDialogSymbian::NotificationL(KNullDesC, KDeviceText(), sendTextMapId));
       
   635         }
       
   636     FLOG(_L("[BTSU]\t CBTServiceStarter::ShowErrorNote() completed"));
       
   637     }
       
   638 
       
   639 
   805 
   640 
   806 // -----------------------------------------------------------------------------
   641 // -----------------------------------------------------------------------------
   807 // CBTServiceStarter::LaunchConfirmationQuery
   642 // CBTServiceStarter::LaunchConfirmationQuery
   808 // -----------------------------------------------------------------------------
   643 // -----------------------------------------------------------------------------
   809 //
   644 //
   810 TInt CBTServiceStarter::LaunchConfirmationQuery(TInt /*aResourceId*/)
   645 void  CBTServiceStarter::LaunchConfirmationQuery(const TDesC& aConfirmText)
   811 	{
   646     {
   812 	TInt keypress=0;
   647     TRAP_IGNORE(iDialog->LaunchQueryDialogL(aConfirmText ));
   813 //	TRAP_IGNORE( keypress = iDialog->LaunchQueryDialogL(  aResourceId ));	
   648     }
   814 	if ( !keypress )
       
   815 		{
       
   816 		FLOG(_L("[BTSU]\t CBTServiceStarter::LaunchConfirmationQuery(), cancelled by user"));
       
   817 		DialogDismissed(EAknSoftkeyNo);
       
   818 		CancelWaitNote();		
       
   819 		}   		
       
   820 	return keypress;
       
   821 	}
       
   822 
   649 
   823 // -----------------------------------------------------------------------------
   650 // -----------------------------------------------------------------------------
   824 // CBTServiceStarter::StopTransfer
   651 // CBTServiceStarter::StopTransfer
   825 // -----------------------------------------------------------------------------
   652 // -----------------------------------------------------------------------------
   826 //	
   653 //	
   834 	    CancelWaitNote();
   661 	    CancelWaitNote();
   835         CancelProgressNote();
   662         CancelProgressNote();
   836 	
   663 	
   837         if ( aError != KErrCancel )
   664         if ( aError != KErrCancel )
   838             {
   665             {
   839             ShowNote( aError );
   666             ShowErrorNote( aError );
   840             }     
   667             }     
   841         }
   668         }
   842     if ( iMessageServerIndex != 0 )
   669     if ( iMessageServerIndex != 0 )
   843         {                 
   670         {                 
   844         TRAPD( notUsedRetVal, TObexUtilsMessageHandler::DeleteOutboxEntryL( iMessageServerIndex ) );
   671         TRAPD( notUsedRetVal, TObexUtilsMessageHandler::DeleteOutboxEntryL( iMessageServerIndex ) );
   985         iState = EBTSStarterFindingBIP;  
   812         iState = EBTSStarterFindingBIP;  
   986         iTriedOPP = ETrue;
   813         iTriedOPP = ETrue;
   987         }
   814         }
   988     else
   815     else
   989         {
   816         {
   990         delete iBTEngDiscovery;
   817         // Set destroyer AO active (destroys CBTEngDiscovery/CBTEngSdpQuery classes). This is done
       
   818         // to ensure that CBTEngDiscovery/CBTEngSdpQuery classes have finished all their activities,
       
   819         // callbacks etc.. Destructing it self is handled in CBTServiceDelayedDestroyer's RunL.
       
   820         iDelayedDestroyer->SetDestructPointer(iBTEngDiscovery);
       
   821         iDelayedDestroyer->GoActive();
       
   822         // Set iBTEngDiscovery pointer to zero. Pointer doesn't exist CBTServiceStarter point of view anymore.
   991         iBTEngDiscovery = NULL;    
   823         iBTEngDiscovery = NULL;    
   992         StopTransfer(EBTSConnectingFailed);    
   824         StopTransfer(EBTSConnectingFailed);    
   993         }    
   825         }    
   994     FLOG(_L("[BTSU]\t CBTServiceStarter::ServiceAttributeSearchComplete() done"));               
   826     FLOG(_L("[BTSU]\t CBTServiceStarter::ServiceAttributeSearchComplete() done"));               
   995     }
   827     }
  1218     }
  1050     }
  1219 
  1051 
  1220 
  1052 
  1221 
  1053 
  1222 
  1054 
  1223 void CBTServiceStarter::ProgressDialogCancelled(const CHbDeviceProgressDialogSymbian*/*  aDialog*/)
       
  1224     {
       
  1225     FLOG(_L("[BTSU]\t CBTServiceStarter::ProgressDialogCancelled(), cancelled by user"));        
       
  1226     iUserCancel=ETrue;
       
  1227     if ( iController )
       
  1228         {
       
  1229         iController->Abort();
       
  1230         }
       
  1231     else 
       
  1232        {
       
  1233        StopTransfer(KErrCancel);
       
  1234        }    
       
  1235     }
       
  1236 
       
  1237 
       
  1238 void CBTServiceStarter::ProgressDialogClosed(const CHbDeviceProgressDialogSymbian* /* aDialog*/)
       
  1239     {
       
  1240     }
       
  1241 
       
  1242 
       
  1243 void CBTServiceStarter::DataReceived(CHbSymbianVariantMap& /*aData*/)
       
  1244     {
       
  1245     
       
  1246     }
       
  1247 
       
  1248 
       
  1249 void CBTServiceStarter::DeviceDialogClosed(TInt /* aCompletionCode*/)
       
  1250     {
       
  1251     TBuf<255> buf;
       
  1252     _LIT(KText, "Sending Cancelled to ");
       
  1253     buf.Copy(KText);
       
  1254     if ( iDevice->IsValidFriendlyName() )
       
  1255         {
       
  1256         buf.Append( iDevice->FriendlyName() );
       
  1257         }
       
  1258     else 
       
  1259         {
       
  1260         TRAP_IGNORE(buf.Append( BTDeviceNameConverter::ToUnicodeL(iDevice->DeviceName())));
       
  1261         }
       
  1262 
       
  1263     iUserCancel=ETrue;
       
  1264     if ( iController )
       
  1265         {
       
  1266         iController->Abort();
       
  1267         }
       
  1268     else 
       
  1269        {
       
  1270        StopTransfer(KErrCancel);
       
  1271        }    
       
  1272     
       
  1273     if ( iProgressTimer )
       
  1274         {
       
  1275         iProgressTimer->Cancel();
       
  1276         delete iProgressTimer;
       
  1277         iProgressTimer = NULL;
       
  1278         }
       
  1279     TRAP_IGNORE(CHbDeviceNotificationDialogSymbian::NotificationL(KNullDesC, buf, KNullDesC));
       
  1280     }