btobexprofiles/obexsendservices/obexservicesendutils/src/BTServiceStarter.cpp
changeset 41 0b2439c3e397
parent 40 997690c3397a
child 52 4545c04e61e1
equal deleted inserted replaced
40:997690c3397a 41:0b2439c3e397
    86 void CBTServiceStarter::ConstructL()
    86 void CBTServiceStarter::ConstructL()
    87     {
    87     {
    88     FLOG(_L("[BTSU]\t CBTServiceStarter::ConstructL()"));
    88     FLOG(_L("[BTSU]\t CBTServiceStarter::ConstructL()"));
    89     iDevice = CBTDevice::NewL();
    89     iDevice = CBTDevice::NewL();
    90     iDialog = CObexUtilsDialog::NewL( this );
    90     iDialog = CObexUtilsDialog::NewL( this );
    91     
    91     iDelayedDestroyer = CBTServiceDelayedDestroyer::NewL(CActive::EPriorityStandard);
    92     FeatureManager::InitializeLibL();
    92     FeatureManager::InitializeLibL();
    93     iFeatureManagerInitialized = ETrue;
    93     iFeatureManagerInitialized = ETrue;
    94     TBool ok = HbTextResolverSymbian::Init(KLocFileName, KPath);
    94     iLocalisationInit = HbTextResolverSymbian::Init(KLocFileName, KPath);
    95     if (!ok) 
       
    96         {
       
    97         User::Leave( KErrNotFound );
       
    98         }
       
    99     FLOG(_L("[BTSU]\t CBTServiceStarter::ConstructL() completed"));
    95     FLOG(_L("[BTSU]\t CBTServiceStarter::ConstructL() completed"));
   100     }
    96     }
   101 
    97 
   102 // -----------------------------------------------------------------------------
    98 // -----------------------------------------------------------------------------
   103 // CBTServiceStarter::NewL
    99 // CBTServiceStarter::NewL
   128     delete iDevice;
   124     delete iDevice;
   129 
   125 
   130     delete iController;
   126     delete iController;
   131     delete iBTEngDiscovery;
   127     delete iBTEngDiscovery;
   132     delete iDialog;
   128     delete iDialog;
   133 
   129     delete iDelayedDestroyer;
       
   130     
   134     if(iWaiter && iWaiter->IsStarted() )
   131     if(iWaiter && iWaiter->IsStarted() )
   135         {
   132         {
   136         iWaiter->AsyncStop();
   133         iWaiter->AsyncStop();
   137         }
   134         }
   138     delete iBTEngSettings;
   135     delete iBTEngSettings;
   516         }
   513         }
   517 
   514 
   518     FLOG(_L("[BTSU]\t CBTServiceStarter::LaunchProgressNoteL() completed"));
   515     FLOG(_L("[BTSU]\t CBTServiceStarter::LaunchProgressNoteL() completed"));
   519     }
   516     }
   520 
   517 
       
   518 // -----------------------------------------------------------------------------
       
   519 // CBTServiceStarter::UpdateProgressNoteL
       
   520 // -----------------------------------------------------------------------------
       
   521 //
   521 void CBTServiceStarter::UpdateProgressNoteL(TInt aFileSize,TInt aFileIndex, const TDesC& aFileName )
   522 void CBTServiceStarter::UpdateProgressNoteL(TInt aFileSize,TInt aFileIndex, const TDesC& aFileName )
   522     {
   523     {
   523     
   524     
   524     iDialog->UpdateProgressNoteL(aFileSize,aFileIndex,aFileName);
   525     iDialog->UpdateProgressNoteL(aFileSize,aFileIndex,aFileName);
   525     }
   526     }
       
   527 
   526 // -----------------------------------------------------------------------------
   528 // -----------------------------------------------------------------------------
   527 // CBTServiceStarter::CancelProgressNote
   529 // CBTServiceStarter::CancelProgressNote
   528 // -----------------------------------------------------------------------------
   530 // -----------------------------------------------------------------------------
   529 //
   531 //
   530 void CBTServiceStarter::CancelProgressNote()
   532 void CBTServiceStarter::CancelProgressNote()
   571         }
   573         }
   572     FLOG(_L("[BTSU]\t CBTServiceStarter::DialogDismissed() completed"));
   574     FLOG(_L("[BTSU]\t CBTServiceStarter::DialogDismissed() completed"));
   573     }
   575     }
   574 
   576 
   575 // -----------------------------------------------------------------------------
   577 // -----------------------------------------------------------------------------
   576 // CBTServiceStarter::ShowNote
   578 // CBTServiceStarter::ShowErrorNote
   577 // -----------------------------------------------------------------------------
   579 // -----------------------------------------------------------------------------
   578 //
   580 //
   579 void CBTServiceStarter::ShowNote( TInt aReason ) const
   581 void CBTServiceStarter::ShowErrorNote( TInt aReason ) const
   580     {
   582     {
   581     FLOG(_L("[BTSU]\t CBTServiceStarter::ShowNote()"));
   583     FLOG(_L("[BTSU]\t CBTServiceStarter::ShowErrorNote()"));
   582      
   584      
   583     TBuf<KMaxDesCLength> buf;
   585     TBuf<KMaxDesCLength> buf;
   584     TPtrC sendTextMapId;
   586     TPtrC sendTextMapId;
   585     
   587     
   586     if ( iDevice->IsValidFriendlyName() )
   588     if ( iDevice->IsValidFriendlyName() )
   602             }
   604             }
   603         case EBTSConnectingFailed:
   605         case EBTSConnectingFailed:
   604         case EBTSGettingFailed:
   606         case EBTSGettingFailed:
   605         case EBTSPuttingFailed:
   607         case EBTSPuttingFailed:
   606         case EBTSNoSuitableProfiles:
   608         case EBTSNoSuitableProfiles:
       
   609       //todo below three enums are not valid and it is not being used at anywhere do we need to have it 
       
   610             
   607 //        case EBTSBIPSomeSend:
   611 //        case EBTSBIPSomeSend:
   608 //        case EBTSBIPOneNotSend:
   612 //        case EBTSBIPOneNotSend:
   609 //        case EBTSBIPNoneSend:
   613 //        case EBTSBIPNoneSend:
   610         default:            
   614         default:            
   611             {
   615             {
   612             sendTextMapId.Set(KSendingFailedText());
   616             sendTextMapId.Set(KSendingFailedText());
   613             break;
   617             break;
   614             }
   618             }
   615             //todo below three enums are not valid and it is not being used at anywhere do we need to have it 
       
   616 
       
   617         }        
   619         }        
   618     
   620     
   619       TRAP_IGNORE(
   621     
   620               HBufC* sendText = HbTextResolverSymbian::LoadLC(sendTextMapId);
   622     if(iLocalisationInit)
   621               HBufC* deviceName =  HbTextResolverSymbian::LoadLC(KDeviceText,buf);
   623         {
   622               CHbDeviceNotificationDialogSymbian::NotificationL(KNullDesC, deviceName->Des(), sendText->Des());
   624         TRAP_IGNORE(
   623               CleanupStack::PopAndDestroy( deviceName );
   625                HBufC* sendText = HbTextResolverSymbian::LoadLC(sendTextMapId);
   624               CleanupStack::PopAndDestroy( sendText );
   626                HBufC* deviceName =  HbTextResolverSymbian::LoadLC(KDeviceText,buf);
   625               );
   627                CHbDeviceNotificationDialogSymbian::NotificationL(KNullDesC, deviceName->Des(), sendText->Des());
   626 
   628                CleanupStack::PopAndDestroy( deviceName );
   627     FLOG(_L("[BTSU]\t CBTServiceStarter::ShowNote() completed"));
   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"));
   628     }
   637     }
   629 
   638 
   630 
   639 
   631 
   640 
   632 // -----------------------------------------------------------------------------
   641 // -----------------------------------------------------------------------------
   652 	    CancelWaitNote();
   661 	    CancelWaitNote();
   653         CancelProgressNote();
   662         CancelProgressNote();
   654 	
   663 	
   655         if ( aError != KErrCancel )
   664         if ( aError != KErrCancel )
   656             {
   665             {
   657             ShowNote( aError );
   666             ShowErrorNote( aError );
   658             }     
   667             }     
   659         }
   668         }
   660     if ( iMessageServerIndex != 0 )
   669     if ( iMessageServerIndex != 0 )
   661         {                 
   670         {                 
   662         TRAPD( notUsedRetVal, TObexUtilsMessageHandler::DeleteOutboxEntryL( iMessageServerIndex ) );
   671         TRAPD( notUsedRetVal, TObexUtilsMessageHandler::DeleteOutboxEntryL( iMessageServerIndex ) );
   803         iState = EBTSStarterFindingBIP;  
   812         iState = EBTSStarterFindingBIP;  
   804         iTriedOPP = ETrue;
   813         iTriedOPP = ETrue;
   805         }
   814         }
   806     else
   815     else
   807         {
   816         {
   808         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.
   809         iBTEngDiscovery = NULL;    
   823         iBTEngDiscovery = NULL;    
   810         StopTransfer(EBTSConnectingFailed);    
   824         StopTransfer(EBTSConnectingFailed);    
   811         }    
   825         }    
   812     FLOG(_L("[BTSU]\t CBTServiceStarter::ServiceAttributeSearchComplete() done"));               
   826     FLOG(_L("[BTSU]\t CBTServiceStarter::ServiceAttributeSearchComplete() done"));               
   813     }
   827     }