btobexprofiles/obexsendservices/obexservicesendutils/src/BTServiceStarter.cpp
changeset 40 997690c3397a
parent 37 91746b151f97
child 41 0b2439c3e397
equal deleted inserted replaced
37:91746b151f97 40:997690c3397a
    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();
       
    83     iProgressDialog = CHbDeviceProgressDialogSymbian::NewL(CHbDeviceProgressDialogSymbian::EWaitDialog,this);
       
    84     
    91     
    85     FeatureManager::InitializeLibL();
    92     FeatureManager::InitializeLibL();
    86     iFeatureManagerInitialized = ETrue;
    93     iFeatureManagerInitialized = ETrue;
       
    94     TBool ok = HbTextResolverSymbian::Init(KLocFileName, KPath);
       
    95     if (!ok) 
       
    96         {
       
    97         User::Leave( KErrNotFound );
       
    98         }
    87     FLOG(_L("[BTSU]\t CBTServiceStarter::ConstructL() completed"));
    99     FLOG(_L("[BTSU]\t CBTServiceStarter::ConstructL() completed"));
    88     }
   100     }
    89 
   101 
    90 // -----------------------------------------------------------------------------
   102 // -----------------------------------------------------------------------------
    91 // CBTServiceStarter::NewL
   103 // CBTServiceStarter::NewL
   115     delete iList;
   127     delete iList;
   116     delete iDevice;
   128     delete iDevice;
   117 
   129 
   118     delete iController;
   130     delete iController;
   119     delete iBTEngDiscovery;
   131     delete iBTEngDiscovery;
   120  //   delete iDialog;
   132     delete iDialog;
   121     delete iDeviceDialog;
       
   122     delete iProgressDialog;
       
   123     if(iProgressTimer)
       
   124         {
       
   125         delete iProgressTimer;
       
   126         }
       
   127 
   133 
   128     if(iWaiter && iWaiter->IsStarted() )
   134     if(iWaiter && iWaiter->IsStarted() )
   129         {
   135         {
   130         iWaiter->AsyncStop();
   136         iWaiter->AsyncStop();
   131         }
   137         }
   260         {
   266         {
   261         return iBytesSendWithBIP;
   267         return iBytesSendWithBIP;
   262         }
   268         }
   263     }
   269     }
   264 
   270 
   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 
   271 
   301 // -----------------------------------------------------------------------------
   272 // -----------------------------------------------------------------------------
   302 // CBTServiceStarter::ValidParameters
   273 // CBTServiceStarter::ValidParameters
   303 // -----------------------------------------------------------------------------
   274 // -----------------------------------------------------------------------------
   304 //
   275 //
   478         {
   449         {
   479  //       iDialog->LaunchWaitDialogL( R_BT_PRINTING_WAIT_NOTE );
   450  //       iDialog->LaunchWaitDialogL( R_BT_PRINTING_WAIT_NOTE );
   480         }
   451         }
   481     else
   452     else
   482         {
   453         {
   483         //       iDialog->LaunchWaitDialogL( R_BT_CONNECTING_WAIT_NOTE );
   454     //todo need to do the localisation here
   484         _LIT(KConnectText, "Connecting...");
   455         _LIT(KConnectText, "Connecting...");
   485         iProgressDialog->SetTextL(KConnectText);
   456         iDialog->LaunchWaitDialogL(KConnectText);
   486         iProgressDialog->ShowL();
       
   487         
   457         
   488         }    
   458         }    
   489     FLOG(_L("[BTSU]\t CBTServiceStarter::LaunchWaitNoteL() completed"));
   459     FLOG(_L("[BTSU]\t CBTServiceStarter::LaunchWaitNoteL() completed"));
   490     }
   460     }
   491 
   461 
   495 //
   465 //
   496 void CBTServiceStarter::CancelWaitNote()
   466 void CBTServiceStarter::CancelWaitNote()
   497     {
   467     {
   498     FLOG(_L("[BTSU]\t CBTServiceStarter::CancelWaitNote()"));
   468     FLOG(_L("[BTSU]\t CBTServiceStarter::CancelWaitNote()"));
   499 
   469 
   500   //  if ( iDialog )
   470     if ( iDialog )
   501   //      {
   471         {
   502         //       TRAP_IGNORE( iDialog->CancelWaitDialogL() );
   472         iDialog->CancelWaitDialog();
   503         if(iProgressDialog)
   473         }
   504             {
       
   505             //This has to be tested
       
   506             iProgressDialog->Close();
       
   507             }
       
   508     //    }
       
   509 
   474 
   510     FLOG(_L("[BTSU]\t CBTServiceStarter::CancelWaitNote() completed"));
   475     FLOG(_L("[BTSU]\t CBTServiceStarter::CancelWaitNote() completed"));
   511     }
   476     }
   512 
   477 
   513 
   478 
   514 // -----------------------------------------------------------------------------
   479 // -----------------------------------------------------------------------------
   515 // CBTServiceStarter::LaunchProgressNoteL
   480 // CBTServiceStarter::LaunchProgressNoteL
   516 // -----------------------------------------------------------------------------
   481 // -----------------------------------------------------------------------------
   517 //
   482 //
       
   483 //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,
   484 void CBTServiceStarter::LaunchProgressNoteL( MBTServiceProgressGetter* aGetter,
   519                                              TInt aTotalSize, TInt aFileCount)
   485                                               TInt aFileCount)
   520     {
   486     {
   521     FLOG(_L("[BTSU]\t CBTServiceStarter::LaunchProgressNoteL()"));
   487     FLOG(_L("[BTSU]\t CBTServiceStarter::LaunchProgressNoteL()"));
   522     (void) aTotalSize;
   488     RBuf deviceName;
   523     
       
   524     if ( iService != EBTPrintingService )
   489     if ( iService != EBTPrintingService )
   525         {    
   490         {    
   526         iProgressGetter = aGetter;     
   491         iProgressGetter = aGetter;     
   527         CancelWaitNote();        
   492         CancelWaitNote();        
   528         
   493         
   529         if ( !iProgressDialogActive )
   494         if ( !iProgressDialogActive )
   530         	{
   495         	{
   531             iFileCount = aFileCount;
   496             // todo need to change the last parameter because we are now using the textmap id which is a string
       
   497             // whether we replace it with that or remove the parameter is to be decided
   532         	iMessageServerIndex = TObexUtilsMessageHandler::CreateOutboxEntryL( 
   498         	iMessageServerIndex = TObexUtilsMessageHandler::CreateOutboxEntryL( 
   533             KUidMsgTypeBt, R_BT_SEND_OUTBOX_SENDING );        
   499             KUidMsgTypeBt, 0 );     
   534    //     	iDialog->LaunchProgressDialogL( this, aTotalSize, 
   500 
   535      //        								R_BT_SENDING_DATA, KBTProgressInterval );	
   501             deviceName.CreateL(KMaxDesCLength);
   536             CHbSymbianVariantMap* map = CHbSymbianVariantMap::NewL();
   502             
   537             CleanupStack::PushL(map);
   503             if ( iDevice->IsValidFriendlyName() )
   538             if ( iProgressTimer )
   504                 {
   539                 {
   505                 deviceName.Copy( iDevice->FriendlyName() );
   540                 iProgressTimer->Cancel();
       
   541                 delete iProgressTimer;
       
   542                 iProgressTimer = NULL;
       
   543                 }
   506                 }
   544 
   507             else 
   545             iProgressTimer = CBTSProgressTimer::NewL( this );
   508                 {
   546             iProgressTimer->SetTimeout( KBTProgressInterval );
   509                 deviceName.Copy( BTDeviceNameConverter::ToUnicodeL(iDevice->DeviceName()));
   547             
   510                 }        	
   548             iProgressTimer->Tickle();
   511         	iDialog->LaunchProgressDialogL( this, aFileCount, 
   549 
   512                                 deviceName, KBTProgressInterval );	
   550             CHbSymbianVariant* value = NULL;
   513         	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         	}        
   514         	}        
   559         iProgressDialogActive=ETrue;     
   515         iProgressDialogActive=ETrue;     
   560         }
   516         }
   561 
   517 
   562     FLOG(_L("[BTSU]\t CBTServiceStarter::LaunchProgressNoteL() completed"));
   518     FLOG(_L("[BTSU]\t CBTServiceStarter::LaunchProgressNoteL() completed"));
   563     }
   519     }
   564 
   520 
   565 void CBTServiceStarter::UpdateProgressNoteL(TInt aFileSize,TInt aFileIndex, const TDesC& aFileName )
   521 void CBTServiceStarter::UpdateProgressNoteL(TInt aFileSize,TInt aFileIndex, const TDesC& aFileName )
   566     {
   522     {
   567     HBufC* key = HBufC::NewL(50);
   523     
   568     CleanupStack::PushL(key);
   524     iDialog->UpdateProgressNoteL(aFileSize,aFileIndex,aFileName);
   569    
       
   570     HBufC* value = HBufC::NewL(50);
       
   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     }
   525     }
   636 // -----------------------------------------------------------------------------
   526 // -----------------------------------------------------------------------------
   637 // CBTServiceStarter::CancelProgressNote
   527 // CBTServiceStarter::CancelProgressNote
   638 // -----------------------------------------------------------------------------
   528 // -----------------------------------------------------------------------------
   639 //
   529 //
   640 void CBTServiceStarter::CancelProgressNote()
   530 void CBTServiceStarter::CancelProgressNote()
   641     {
   531     {
   642     FLOG(_L("[BTSU]\t CBTServiceStarter::CancelProgressNote()"));
   532     FLOG(_L("[BTSU]\t CBTServiceStarter::CancelProgressNote()"));
   643 
   533 
   644  //   if ( iDialog )
   534     if ( iDialog )
   645         {
   535         {
   646   //      TRAP_IGNORE( iDialog->CancelProgressDialogL() );
   536         iDialog->CancelProgressDialog();
   647     if ( iProgressTimer )
   537         }
   648          {
       
   649          iProgressTimer->Cancel();
       
   650          delete iProgressTimer;
       
   651          iProgressTimer = NULL;
       
   652          }
       
   653         }
       
   654     if(iDeviceDialog)
       
   655          {
       
   656          iDeviceDialog->Cancel();
       
   657          }
       
   658     }
   538     }
   659 
   539 
   660 // -----------------------------------------------------------------------------
   540 // -----------------------------------------------------------------------------
   661 // CBTServiceStarter::DialogDismissed
   541 // CBTServiceStarter::DialogDismissed
   662 // -----------------------------------------------------------------------------
   542 // -----------------------------------------------------------------------------
   663 //
   543 //
   664 void CBTServiceStarter::DialogDismissed( TInt aButtonId )
   544 void CBTServiceStarter::DialogDismissed(TInt aButtonId )
   665     {
   545     {
   666     FLOG(_L("[BTSU]\t CBTServiceStarter::DialogDismissed()"));   
   546     FLOG(_L("[BTSU]\t CBTServiceStarter::DialogDismissed()"));   
   667     if( aButtonId == EAknSoftkeyCancel )
   547     if( aButtonId == ECancelButton )
   668         {
   548         { // this condition is hit for the progress dialog and connecting dialog cancel
   669         FLOG(_L("[BTSU]\t CBTServiceStarter::DialogDissmissed(), cancelled by user"));        
   549         FLOG(_L("[BTSU]\t CBTServiceStarter::DialogDissmissed(), cancelled by user"));        
   670         iUserCancel=ETrue;
   550         iUserCancel=ETrue;
   671         if ( iController )
   551         if ( iController )
   672             {
   552             {
   673             iController->Abort();
   553             iController->Abort();
   675         else 
   555         else 
   676            {
   556            {
   677            StopTransfer(KErrCancel);
   557            StopTransfer(KErrCancel);
   678            }    
   558            }    
   679         }
   559         }
   680     else if ( aButtonId == EAknSoftkeyNo )
   560     else if ( aButtonId == ENoButton )
   681         {
   561         {
   682         // user abortion
   562         // user abortion
   683         //
   563         //
   684         iUserCancel = ETrue;
   564         iUserCancel = ETrue;
   685         StopTransfer( KErrCancel );
   565         StopTransfer( KErrCancel );
       
   566         CancelWaitNote();
       
   567         }
       
   568     else //EYesButton
       
   569         {// this condition is hit when user is ok with sending the unsupported images
       
   570         iController->SendUnSupportedFiles();
   686         }
   571         }
   687     FLOG(_L("[BTSU]\t CBTServiceStarter::DialogDismissed() completed"));
   572     FLOG(_L("[BTSU]\t CBTServiceStarter::DialogDismissed() completed"));
   688     }
   573     }
   689 
   574 
   690 // -----------------------------------------------------------------------------
   575 // -----------------------------------------------------------------------------
   693 //
   578 //
   694 void CBTServiceStarter::ShowNote( TInt aReason ) const
   579 void CBTServiceStarter::ShowNote( TInt aReason ) const
   695     {
   580     {
   696     FLOG(_L("[BTSU]\t CBTServiceStarter::ShowNote()"));
   581     FLOG(_L("[BTSU]\t CBTServiceStarter::ShowNote()"));
   697      
   582      
   698 //    TInt resource = 0;
   583     TBuf<KMaxDesCLength> buf;
   699     TBuf<255> buf;
   584     TPtrC sendTextMapId;
       
   585     
       
   586     if ( iDevice->IsValidFriendlyName() )
       
   587         {
       
   588         buf.Copy( iDevice->FriendlyName() );
       
   589         }
       
   590     else 
       
   591         {
       
   592         TRAP_IGNORE( buf.Copy( BTDeviceNameConverter::ToUnicodeL(iDevice->DeviceName())));
       
   593         }
       
   594     
   700 
   595 
   701     switch ( aReason )
   596     switch ( aReason )
   702         {
   597         {
   703         case EBTSNoError:
   598         case EBTSNoError:
   704             {
   599             {
   705     /*        if ( iService == EBTPrintingService )
   600             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;
   601             break;
   729             }
   602             }
   730         case EBTSConnectingFailed:
   603         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:
   604         case EBTSGettingFailed:
   738         case EBTSPuttingFailed:
   605         case EBTSPuttingFailed:
   739             {
   606         case EBTSNoSuitableProfiles:
   740             if ( iService == EBTPrintingService )
   607 //        case EBTSBIPSomeSend:
   741                 {
   608 //        case EBTSBIPOneNotSend:
   742                 _LIT(KText, "Sending failed");
   609 //        case EBTSBIPNoneSend:
   743                 //resource = R_BT_FAILED_TO_SEND2;
   610         default:            
   744                 buf.Copy(KText);
   611             {
   745                 }
   612             sendTextMapId.Set(KSendingFailedText());
   746             else
       
   747                 {
       
   748                 _LIT(KText, "Failed to send Data");
       
   749                 //resource = R_BT_FAILED_TO_SEND;
       
   750                 buf.Copy(KText);
       
   751                 }
       
   752             break;
   613             break;
   753             }
   614             }
   754         case EBTSNoSuitableProfiles:
   615             //todo below three enums are not valid and it is not being used at anywhere do we need to have it 
   755             {
   616 
   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         }        
   617         }        
   799     
   618     
   800 //	TRAP_IGNORE(TObexUtilsUiLayer::ShowInformationNoteL( resource ) );	
   619       TRAP_IGNORE(
   801 //    CHbDeviceMessageBoxSymbian::InformationL(buf);
   620               HBufC* sendText = HbTextResolverSymbian::LoadLC(sendTextMapId);
   802       TRAP_IGNORE(CHbDeviceNotificationDialogSymbian::NotificationL(KNullDesC, buf, KNullDesC));
   621               HBufC* deviceName =  HbTextResolverSymbian::LoadLC(KDeviceText,buf);
       
   622               CHbDeviceNotificationDialogSymbian::NotificationL(KNullDesC, deviceName->Des(), sendText->Des());
       
   623               CleanupStack::PopAndDestroy( deviceName );
       
   624               CleanupStack::PopAndDestroy( sendText );
       
   625               );
       
   626 
   803     FLOG(_L("[BTSU]\t CBTServiceStarter::ShowNote() completed"));
   627     FLOG(_L("[BTSU]\t CBTServiceStarter::ShowNote() completed"));
   804     }
   628     }
   805 
   629 
       
   630 
       
   631 
   806 // -----------------------------------------------------------------------------
   632 // -----------------------------------------------------------------------------
   807 // CBTServiceStarter::LaunchConfirmationQuery
   633 // CBTServiceStarter::LaunchConfirmationQuery
   808 // -----------------------------------------------------------------------------
   634 // -----------------------------------------------------------------------------
   809 //
   635 //
   810 TInt CBTServiceStarter::LaunchConfirmationQuery(TInt /*aResourceId*/)
   636 void  CBTServiceStarter::LaunchConfirmationQuery(const TDesC& aConfirmText)
   811 	{
   637     {
   812 	TInt keypress=0;
   638     TRAP_IGNORE(iDialog->LaunchQueryDialogL(aConfirmText ));
   813 //	TRAP_IGNORE( keypress = iDialog->LaunchQueryDialogL(  aResourceId ));	
   639     }
   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 
   640 
   823 // -----------------------------------------------------------------------------
   641 // -----------------------------------------------------------------------------
   824 // CBTServiceStarter::StopTransfer
   642 // CBTServiceStarter::StopTransfer
   825 // -----------------------------------------------------------------------------
   643 // -----------------------------------------------------------------------------
   826 //	
   644 //	
  1218     }
  1036     }
  1219 
  1037 
  1220 
  1038 
  1221 
  1039 
  1222 
  1040 
  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     }