27 #include <Obexutils.rsg> |
27 #include <Obexutils.rsg> |
28 #include <obexutilsuilayer.h> |
28 #include <obexutilsuilayer.h> |
29 #include <obexutilsmessagehandler.h> |
29 #include <obexutilsmessagehandler.h> |
30 #include <btnotif.h> |
30 #include <btnotif.h> |
31 #include <featmgr.h> |
31 #include <featmgr.h> |
|
32 #include "hbdevicemessageboxsymbian.h" |
32 |
33 |
33 // CONSTANTS |
34 // CONSTANTS |
34 |
35 |
35 // From BT SIG - Assigned numbers |
36 // From BT SIG - Assigned numbers |
36 const TUint KBTServiceOPPSending = 0x1105; |
37 const TUint KBTServiceOPPSending = 0x1105; |
37 const TUint KBTServiceDirectPrinting = 0x1118; |
38 const TUint KBTServiceDirectPrinting = 0x1118; |
38 const TUint KBTServiceImagingResponder = 0x111B; |
39 const TUint KBTServiceImagingResponder = 0x111B; |
39 |
40 |
40 const TUint KBTProgressInterval = 1000000; |
|
41 |
41 |
42 // ============================ MEMBER FUNCTIONS =============================== |
42 // ============================ MEMBER FUNCTIONS =============================== |
43 |
43 |
44 // ----------------------------------------------------------------------------- |
44 // ----------------------------------------------------------------------------- |
45 // CBTServiceStarter::CBTServiceStarter |
45 // CBTServiceStarter::CBTServiceStarter |
422 void CBTServiceStarter::LaunchWaitNoteL() |
424 void CBTServiceStarter::LaunchWaitNoteL() |
423 { |
425 { |
424 FLOG(_L("[BTSU]\t CBTServiceStarter::LaunchWaitNoteL()")); |
426 FLOG(_L("[BTSU]\t CBTServiceStarter::LaunchWaitNoteL()")); |
425 if ( iService == EBTPrintingService ) |
427 if ( iService == EBTPrintingService ) |
426 { |
428 { |
427 iDialog->LaunchWaitDialogL( R_BT_PRINTING_WAIT_NOTE ); |
429 // iDialog->LaunchWaitDialogL( R_BT_PRINTING_WAIT_NOTE ); |
428 } |
430 } |
429 else |
431 else |
430 { |
432 { |
431 iDialog->LaunchWaitDialogL( R_BT_CONNECTING_WAIT_NOTE ); |
433 // iDialog->LaunchWaitDialogL( R_BT_CONNECTING_WAIT_NOTE ); |
|
434 _LIT(KConnectText, "Connecting..."); |
|
435 iProgressDialog = CHbDeviceProgressDialogSymbian::NewL(CHbDeviceProgressDialogSymbian::EWaitDialog,this); |
|
436 iProgressDialog->SetTextL(KConnectText); |
|
437 iProgressDialog->ShowL(); |
|
438 |
432 } |
439 } |
433 FLOG(_L("[BTSU]\t CBTServiceStarter::LaunchWaitNoteL() completed")); |
440 FLOG(_L("[BTSU]\t CBTServiceStarter::LaunchWaitNoteL() completed")); |
434 } |
441 } |
435 |
442 |
436 // ----------------------------------------------------------------------------- |
443 // ----------------------------------------------------------------------------- |
456 // |
468 // |
457 void CBTServiceStarter::LaunchProgressNoteL( MBTServiceProgressGetter* aGetter, |
469 void CBTServiceStarter::LaunchProgressNoteL( MBTServiceProgressGetter* aGetter, |
458 TInt aTotalSize ) |
470 TInt aTotalSize ) |
459 { |
471 { |
460 FLOG(_L("[BTSU]\t CBTServiceStarter::LaunchProgressNoteL()")); |
472 FLOG(_L("[BTSU]\t CBTServiceStarter::LaunchProgressNoteL()")); |
461 |
473 (void) aTotalSize; |
|
474 |
462 if ( iService != EBTPrintingService ) |
475 if ( iService != EBTPrintingService ) |
463 { |
476 { |
464 iProgressGetter = aGetter; |
477 iProgressGetter = aGetter; |
465 CancelWaitNote(); |
478 CancelWaitNote(); |
466 |
479 |
467 if ( !iProgressDialogActive ) |
480 if ( !iProgressDialogActive ) |
468 { |
481 { |
469 iMessageServerIndex = TObexUtilsMessageHandler::CreateOutboxEntryL( |
482 iMessageServerIndex = TObexUtilsMessageHandler::CreateOutboxEntryL( |
470 KUidMsgTypeBt, R_BT_SEND_OUTBOX_SENDING ); |
483 KUidMsgTypeBt, R_BT_SEND_OUTBOX_SENDING ); |
471 iDialog->LaunchProgressDialogL( this, aTotalSize, |
484 // iDialog->LaunchProgressDialogL( this, aTotalSize, |
472 R_BT_SENDING_DATA, KBTProgressInterval ); |
485 // R_BT_SENDING_DATA, KBTProgressInterval ); |
473 } |
486 } |
474 iProgressDialogActive=ETrue; |
487 iProgressDialogActive=ETrue; |
475 } |
488 } |
476 |
489 |
477 FLOG(_L("[BTSU]\t CBTServiceStarter::LaunchProgressNoteL() completed")); |
490 FLOG(_L("[BTSU]\t CBTServiceStarter::LaunchProgressNoteL() completed")); |
527 // |
540 // |
528 void CBTServiceStarter::ShowNote( TInt aReason ) const |
541 void CBTServiceStarter::ShowNote( TInt aReason ) const |
529 { |
542 { |
530 FLOG(_L("[BTSU]\t CBTServiceStarter::ShowNote()")); |
543 FLOG(_L("[BTSU]\t CBTServiceStarter::ShowNote()")); |
531 |
544 |
532 TInt resource = 0; |
545 // TInt resource = 0; |
|
546 TBuf<255> buf; |
533 |
547 |
534 switch ( aReason ) |
548 switch ( aReason ) |
535 { |
549 { |
536 case EBTSNoError: |
550 case EBTSNoError: |
537 { |
551 { |
538 if ( iService == EBTPrintingService ) |
552 if ( iService == EBTPrintingService ) |
539 { |
553 { |
540 resource = R_BT_DATA_SENT2; |
554 // resource = R_BT_DATA_SENT2; |
|
555 |
|
556 _LIT(KText, "Data Sent"); |
|
557 buf.Copy(KText); |
541 } |
558 } |
542 else |
559 else |
543 { |
560 { |
544 resource = R_BT_DATA_SENT; |
561 //resource = R_BT_DATA_SENT; |
|
562 _LIT(KText, "Data Sent"); |
|
563 buf.Copy(KText); |
545 } |
564 } |
546 break; |
565 break; |
547 } |
566 } |
548 case EBTSConnectingFailed: |
567 case EBTSConnectingFailed: |
549 { |
568 { |
550 resource = R_BT_DEV_NOT_AVAIL; |
569 //resource = R_BT_DEV_NOT_AVAIL; |
|
570 _LIT(KText, "Cannot establish Bluetooth connection"); |
|
571 buf.Copy(KText); |
551 break; |
572 break; |
552 } |
573 } |
553 case EBTSGettingFailed: |
574 case EBTSGettingFailed: |
554 case EBTSPuttingFailed: |
575 case EBTSPuttingFailed: |
555 { |
576 { |
556 if ( iService == EBTPrintingService ) |
577 if ( iService == EBTPrintingService ) |
557 { |
578 { |
558 resource = R_BT_FAILED_TO_SEND2; |
579 _LIT(KText, "Sending failed"); |
|
580 //resource = R_BT_FAILED_TO_SEND2; |
|
581 buf.Copy(KText); |
559 } |
582 } |
560 else |
583 else |
561 { |
584 { |
562 resource = R_BT_FAILED_TO_SEND; |
585 _LIT(KText, "Failed to send Data"); |
|
586 //resource = R_BT_FAILED_TO_SEND; |
|
587 buf.Copy(KText); |
563 } |
588 } |
564 break; |
589 break; |
565 } |
590 } |
566 case EBTSNoSuitableProfiles: |
591 case EBTSNoSuitableProfiles: |
567 { |
592 { |
568 if ( iService == EBTPrintingService ) |
593 if ( iService == EBTPrintingService ) |
569 { |
594 { |
570 resource = R_BT_PRINTING_NOT_SUPPORTED; |
595 _LIT(KText, "Printer not supported"); |
|
596 buf.Copy(KText); |
|
597 // resource = R_BT_PRINTING_NOT_SUPPORTED; |
571 } |
598 } |
572 else |
599 else |
573 { |
600 { |
574 resource = R_BT_FAILED_TO_SEND; |
601 _LIT(KText, "Failed to send Data"); |
|
602 buf.Copy(KText); |
|
603 // resource = R_BT_FAILED_TO_SEND; |
575 } |
604 } |
576 break; |
605 break; |
577 } |
606 } |
578 case EBTSBIPSomeSend: |
607 case EBTSBIPSomeSend: |
579 { |
608 { |
580 resource = R_BT_FAILED_TO_SEND; |
609 _LIT(KText, "Failed to send Data"); |
|
610 buf.Copy(KText); |
|
611 //resource = R_BT_FAILED_TO_SEND; |
581 break; |
612 break; |
582 } |
613 } |
583 case EBTSBIPOneNotSend: |
614 case EBTSBIPOneNotSend: |
584 { |
615 { |
585 resource = R_BT_NOT_RECEIVE_ONE; |
616 _LIT(KText, "Receiving device does not support this image format."); |
|
617 buf.Copy(KText); |
|
618 //resource = R_BT_NOT_RECEIVE_ONE; |
586 break; |
619 break; |
587 } |
620 } |
588 case EBTSBIPNoneSend: |
621 case EBTSBIPNoneSend: |
589 { |
622 { |
590 resource = R_BT_NOT_RECEIVE_ANY; |
623 _LIT(KText, "Receiving device does not support the needed image formats."); |
|
624 buf.Copy(KText); |
|
625 //resource = R_BT_NOT_RECEIVE_ANY; |
591 break; |
626 break; |
592 } |
627 } |
593 default: |
628 default: |
594 { |
629 { |
595 resource = R_BT_DEV_NOT_AVAIL; |
630 // resource = R_BT_DEV_NOT_AVAIL; |
|
631 _LIT(KText, "Cannot establish Bluetooth connection"); |
|
632 buf.Copy(KText); |
596 break; |
633 break; |
597 } |
634 } |
598 } |
635 } |
599 |
636 |
600 TRAP_IGNORE(TObexUtilsUiLayer::ShowInformationNoteL( resource ) ); |
637 // TRAP_IGNORE(TObexUtilsUiLayer::ShowInformationNoteL( resource ) ); |
|
638 CHbDeviceMessageBoxSymbian::InformationL(buf); |
601 FLOG(_L("[BTSU]\t CBTServiceStarter::ShowNote() completed")); |
639 FLOG(_L("[BTSU]\t CBTServiceStarter::ShowNote() completed")); |
602 } |
640 } |
603 |
641 |
604 // ----------------------------------------------------------------------------- |
642 // ----------------------------------------------------------------------------- |
605 // CBTServiceStarter::LaunchConfirmationQuery |
643 // CBTServiceStarter::LaunchConfirmationQuery |
606 // ----------------------------------------------------------------------------- |
644 // ----------------------------------------------------------------------------- |
607 // |
645 // |
608 TInt CBTServiceStarter::LaunchConfirmationQuery(TInt aResourceId) |
646 TInt CBTServiceStarter::LaunchConfirmationQuery(TInt /*aResourceId*/) |
609 { |
647 { |
610 TInt keypress=0; |
648 TInt keypress=0; |
611 TRAP_IGNORE( keypress = iDialog->LaunchQueryDialogL( aResourceId )); |
649 // TRAP_IGNORE( keypress = iDialog->LaunchQueryDialogL( aResourceId )); |
612 if ( !keypress ) |
650 if ( !keypress ) |
613 { |
651 { |
614 FLOG(_L("[BTSU]\t CBTServiceStarter::LaunchConfirmationQuery(), cancelled by user")); |
652 FLOG(_L("[BTSU]\t CBTServiceStarter::LaunchConfirmationQuery(), cancelled by user")); |
615 DialogDismissed(EAknSoftkeyNo); |
653 DialogDismissed(EAknSoftkeyNo); |
616 CancelWaitNote(); |
654 CancelWaitNote(); |