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 #include "BTSProgresstimer.h" |
|
33 #include <hbdevicenotificationdialogsymbian.h> |
|
34 #include <btservices/bluetoothdevicedialogs.h> |
33 |
35 |
34 // CONSTANTS |
36 // CONSTANTS |
35 |
37 |
36 // From BT SIG - Assigned numbers |
38 // From BT SIG - Assigned numbers |
37 const TUint KBTServiceOPPSending = 0x1105; |
39 const TUint KBTServiceOPPSending = 0x1105; |
38 const TUint KBTServiceDirectPrinting = 0x1118; |
40 const TUint KBTServiceDirectPrinting = 0x1118; |
39 const TUint KBTServiceImagingResponder = 0x111B; |
41 const TUint KBTServiceImagingResponder = 0x111B; |
40 |
42 |
|
43 const TUint KBTProgressInterval = 1000000; |
|
44 |
|
45 |
|
46 _LIT(KSendingDialog,"com.nokia.hb.btdevicedialog/1.0"); |
41 |
47 |
42 // ============================ MEMBER FUNCTIONS =============================== |
48 // ============================ MEMBER FUNCTIONS =============================== |
43 |
49 |
44 // ----------------------------------------------------------------------------- |
50 // ----------------------------------------------------------------------------- |
45 // CBTServiceStarter::CBTServiceStarter |
51 // CBTServiceStarter::CBTServiceStarter |
246 { |
260 { |
247 return iBytesSendWithBIP; |
261 return iBytesSendWithBIP; |
248 } |
262 } |
249 } |
263 } |
250 |
264 |
|
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 |
251 // ----------------------------------------------------------------------------- |
301 // ----------------------------------------------------------------------------- |
252 // CBTServiceStarter::ValidParameters |
302 // CBTServiceStarter::ValidParameters |
253 // ----------------------------------------------------------------------------- |
303 // ----------------------------------------------------------------------------- |
254 // |
304 // |
255 TBool CBTServiceStarter::ValidParameters( |
305 TBool CBTServiceStarter::ValidParameters( |
465 // ----------------------------------------------------------------------------- |
514 // ----------------------------------------------------------------------------- |
466 // CBTServiceStarter::LaunchProgressNoteL |
515 // CBTServiceStarter::LaunchProgressNoteL |
467 // ----------------------------------------------------------------------------- |
516 // ----------------------------------------------------------------------------- |
468 // |
517 // |
469 void CBTServiceStarter::LaunchProgressNoteL( MBTServiceProgressGetter* aGetter, |
518 void CBTServiceStarter::LaunchProgressNoteL( MBTServiceProgressGetter* aGetter, |
470 TInt aTotalSize ) |
519 TInt aTotalSize, TInt aFileCount) |
471 { |
520 { |
472 FLOG(_L("[BTSU]\t CBTServiceStarter::LaunchProgressNoteL()")); |
521 FLOG(_L("[BTSU]\t CBTServiceStarter::LaunchProgressNoteL()")); |
473 (void) aTotalSize; |
522 (void) aTotalSize; |
474 |
523 |
475 if ( iService != EBTPrintingService ) |
524 if ( iService != EBTPrintingService ) |
476 { |
525 { |
477 iProgressGetter = aGetter; |
526 iProgressGetter = aGetter; |
478 CancelWaitNote(); |
527 CancelWaitNote(); |
479 |
528 |
480 if ( !iProgressDialogActive ) |
529 if ( !iProgressDialogActive ) |
481 { |
530 { |
|
531 iFileCount = aFileCount; |
482 iMessageServerIndex = TObexUtilsMessageHandler::CreateOutboxEntryL( |
532 iMessageServerIndex = TObexUtilsMessageHandler::CreateOutboxEntryL( |
483 KUidMsgTypeBt, R_BT_SEND_OUTBOX_SENDING ); |
533 KUidMsgTypeBt, R_BT_SEND_OUTBOX_SENDING ); |
484 // iDialog->LaunchProgressDialogL( this, aTotalSize, |
534 // iDialog->LaunchProgressDialogL( this, aTotalSize, |
485 // R_BT_SENDING_DATA, KBTProgressInterval ); |
535 // R_BT_SENDING_DATA, KBTProgressInterval ); |
|
536 CHbSymbianVariantMap* map = CHbSymbianVariantMap::NewL(); |
|
537 CleanupStack::PushL(map); |
|
538 if ( iProgressTimer ) |
|
539 { |
|
540 iProgressTimer->Cancel(); |
|
541 delete iProgressTimer; |
|
542 iProgressTimer = NULL; |
|
543 } |
|
544 |
|
545 iProgressTimer = CBTSProgressTimer::NewL( this ); |
|
546 iProgressTimer->SetTimeout( KBTProgressInterval ); |
|
547 |
|
548 iProgressTimer->Tickle(); |
|
549 |
|
550 CHbSymbianVariant* value = NULL; |
|
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); |
486 } |
558 } |
487 iProgressDialogActive=ETrue; |
559 iProgressDialogActive=ETrue; |
488 } |
560 } |
489 |
561 |
490 FLOG(_L("[BTSU]\t CBTServiceStarter::LaunchProgressNoteL() completed")); |
562 FLOG(_L("[BTSU]\t CBTServiceStarter::LaunchProgressNoteL() completed")); |
491 } |
563 } |
492 |
564 |
|
565 void CBTServiceStarter::UpdateProgressNoteL(TInt aFileSize,TInt aFileIndex, const TDesC& aFileName ) |
|
566 { |
|
567 HBufC* key = HBufC::NewL(50); |
|
568 CleanupStack::PushL(key); |
|
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 } |
493 // ----------------------------------------------------------------------------- |
636 // ----------------------------------------------------------------------------- |
494 // CBTServiceStarter::CancelProgressNote |
637 // CBTServiceStarter::CancelProgressNote |
495 // ----------------------------------------------------------------------------- |
638 // ----------------------------------------------------------------------------- |
496 // |
639 // |
497 void CBTServiceStarter::CancelProgressNote() |
640 void CBTServiceStarter::CancelProgressNote() |