23 #include <CWPParameter.h> |
23 #include <CWPParameter.h> |
24 #include "IptvDebug.h" |
24 #include "IptvDebug.h" |
25 #include "IptvEngineUids.h" |
25 #include "IptvEngineUids.h" |
26 #include "CIptvUtil.h" |
26 #include "CIptvUtil.h" |
27 #include <StringLoader.h> |
27 #include <StringLoader.h> |
28 #include <IptvOmaProvisioningAdapter.rsg> |
28 #include <IptvOmaProvisioningAdapterRes.rsg> |
29 #include <bautils.h> |
29 #include <bautils.h> |
30 #include <f32file.h> |
30 #include <f32file.h> |
31 #include "iptvlocalisationliterals.h" |
31 #include "iptvlocalisationliterals.h" |
32 #include <bautils.h> |
32 #include <bautils.h> |
|
33 #include "CIptvResourceLoader.h" |
33 |
34 |
34 #include "CIptvService.h" |
35 #include "CIptvService.h" |
35 #include "CIptvServices.h" |
36 #include "CIptvServices.h" |
36 #include "CIptvServiceManagementClient.h" |
37 #include "CIptvServiceManagementClient.h" |
37 #include "CIptvOmaProvisioningAdapter.h" |
38 #include "CIptvOmaProvisioningAdapter.h" |
65 _LIT(KIptvParamNameApplicationIconUrl, "APPLICATION/ICON-URL"); |
66 _LIT(KIptvParamNameApplicationIconUrl, "APPLICATION/ICON-URL"); |
66 _LIT(KIptvParamNameApplicationAccountUrl, "APPLICATION/ACCOUNT-URL"); |
67 _LIT(KIptvParamNameApplicationAccountUrl, "APPLICATION/ACCOUNT-URL"); |
67 |
68 |
68 const TInt KIptvDriveLetterSpace( 2 ); |
69 const TInt KIptvDriveLetterSpace( 2 ); |
69 |
70 |
|
71 _LIT( KIptvOmaProvisioningAdapterResFile, "\\Resource\\Plugins\\IptvOmaProvisioningAdapterRes."); |
|
72 |
70 // ================= MEMBER FUNCTIONS ======================= |
73 // ================= MEMBER FUNCTIONS ======================= |
71 |
74 |
72 // --------------------------------------------------------- |
75 // --------------------------------------------------------- |
73 // CIptvOmaProvisioningAdapter::CIptvOmaProvisioningAdapter |
76 // CIptvOmaProvisioningAdapter::CIptvOmaProvisioningAdapter |
74 // C++ default constructor can NOT contain any code, that |
77 // C++ default constructor can NOT contain any code, that |
90 { |
93 { |
91 IPTVLOGSTRING_LOW_LEVEL( "CIptvOmaProvisioningAdapter::ConstructL() start" ); |
94 IPTVLOGSTRING_LOW_LEVEL( "CIptvOmaProvisioningAdapter::ConstructL() start" ); |
92 |
95 |
93 iServices = CIptvServices::NewL(); |
96 iServices = CIptvServices::NewL(); |
94 |
97 |
95 HBufC* resourceText = LoadResourceTextL( R_IPTV_OMA_CLIENT_PROV_SUMMARY_TITLE ); |
98 CCoeEnv* env = CCoeEnv::Static(); |
96 CleanupStack::PushL( resourceText ); //1-> |
99 if( env ) |
97 if ( resourceText->Des().Length() > KIptvOcpMaxSummaryTitleLength ) |
100 { |
98 { |
101 CIptvResourceLoader* resourceLoader = CIptvResourceLoader::NewL( *env ); |
99 iSummaryTitle = resourceText->Des().Left( KIptvOcpMaxSummaryTitleLength - 1 ); |
102 if ( resourceLoader ) |
100 } |
103 { |
101 else |
104 CleanupStack::PushL( resourceLoader ); |
102 { |
105 resourceLoader->AddResourceL( KIptvOmaProvisioningAdapterResFile ); |
103 iSummaryTitle = resourceText->Des(); |
106 HBufC* resourceText = StringLoader::LoadLC( R_IPTV_OMA_CLIENT_PROV_SUMMARY_TITLE ); |
104 } |
107 if ( resourceText->Des().Length() > KIptvOcpMaxSummaryTitleLength ) |
105 |
108 { |
106 IPTVLOGSTRING2_LOW_LEVEL( "CIptvOmaProvisioningAdapter:: iSummaryTitle = %S", &iSummaryTitle ); |
109 iSummaryTitle = resourceText->Des().Left( KIptvOcpMaxSummaryTitleLength - 1 ); |
107 |
110 } |
108 CleanupStack::PopAndDestroy( resourceText ); // <-1 |
111 else |
|
112 { |
|
113 iSummaryTitle = resourceText->Des(); |
|
114 } |
|
115 CleanupStack::PopAndDestroy( resourceText ); |
|
116 CleanupStack::PopAndDestroy( resourceLoader ); |
|
117 } |
|
118 else |
|
119 { |
|
120 User::Leave( KErrGeneral ); |
|
121 } |
|
122 } |
109 |
123 |
110 User::LeaveIfError( iFs.Connect() ); |
124 User::LeaveIfError( iFs.Connect() ); |
111 |
125 |
112 IPTVLOGSTRING_LOW_LEVEL( "CIptvOmaProvisioningAdapter::ConstructL() exit" ); |
126 IPTVLOGSTRING_LOW_LEVEL( "CIptvOmaProvisioningAdapter::ConstructL() exit" ); |
113 } |
127 } |
420 break; |
434 break; |
421 |
435 |
422 case EWPParameterName: |
436 case EWPParameterName: |
423 IPTVLOGSTRING_LOW_LEVEL( "CIptvOmaProvisioningAdapter:: parameter EWPParameterName -> collecting" ); |
437 IPTVLOGSTRING_LOW_LEVEL( "CIptvOmaProvisioningAdapter:: parameter EWPParameterName -> collecting" ); |
424 |
438 |
425 #if defined(__SERIES60_30__) || defined(__SERIES60_31__) || defined(__SERIES60_32__) |
439 |
426 |
440 if ( aParameter.Value().Length() > KIptvSmServicesDbNameMaxLength ) |
427 // Video Store name must be localised here. |
|
428 if ( 0 == aParameter.Value().CompareF( KQtnIptvVideoStoreList ) ) |
|
429 { |
|
430 HBufC* resourceText = LoadResourceTextL( R_IPTV_VIDEO_STORE_LIST ); |
|
431 if ( resourceText->Length() > KIptvSmServicesDbNameMaxLength ) |
|
432 { |
|
433 IPTVLOGSTRING_LOW_LEVEL( "CIptvOmaProvisioningAdapter:: name too long! -> skipping value" ); |
|
434 } |
|
435 else |
|
436 { |
|
437 iCurrentService->SetName( *resourceText ); |
|
438 } |
|
439 delete resourceText; |
|
440 } |
|
441 else if ( aParameter.Value().Length() > KIptvSmServicesDbNameMaxLength ) |
|
442 { |
441 { |
443 IPTVLOGSTRING_LOW_LEVEL( "CIptvOmaProvisioningAdapter:: name too long! -> skipping value" ); |
442 IPTVLOGSTRING_LOW_LEVEL( "CIptvOmaProvisioningAdapter:: name too long! -> skipping value" ); |
444 } |
443 } |
445 else |
444 else |
446 { |
445 { |
447 iCurrentService->SetName( aParameter.Value() ); |
446 iCurrentService->SetName( aParameter.Value() ); |
448 } |
447 } |
449 |
|
450 #else // S60 5.0 -> |
|
451 |
|
452 if ( aParameter.Value().Length() > KIptvSmServicesDbNameMaxLength ) |
|
453 { |
|
454 IPTVLOGSTRING_LOW_LEVEL( "CIptvOmaProvisioningAdapter:: name too long! -> skipping value" ); |
|
455 } |
|
456 else |
|
457 { |
|
458 iCurrentService->SetName( aParameter.Value() ); |
|
459 } |
|
460 |
|
461 #endif // defined(__SERIES60_30__) || defined(__SERIES60_31__) || defined(__SERIES60_32__) |
|
462 |
|
463 break; |
448 break; |
464 |
449 |
465 case EWPParameterToNapID: |
450 case EWPParameterToNapID: |
466 IPTVLOGSTRING_LOW_LEVEL( "CIptvOmaProvisioningAdapter:: parameter EWPParameterToNapID -> collecting" ); |
451 IPTVLOGSTRING_LOW_LEVEL( "CIptvOmaProvisioningAdapter:: parameter EWPParameterToNapID -> collecting" ); |
467 if ( aParameter.Value().Length() > KIptvSmServicesDbIapNameMaxLength ) |
452 if ( aParameter.Value().Length() > KIptvSmServicesDbIapNameMaxLength ) |
771 |
756 |
772 IPTVLOGSTRING_LOW_LEVEL( "CIptvOmaProvisioningAdapter::SavingFinalizedL() exit" ); |
757 IPTVLOGSTRING_LOW_LEVEL( "CIptvOmaProvisioningAdapter::SavingFinalizedL() exit" ); |
773 } |
758 } |
774 |
759 |
775 // ----------------------------------------------------------------------------- |
760 // ----------------------------------------------------------------------------- |
776 // CIptvOmaProvisioningAdapter::LoadResourceTextL |
|
777 // ----------------------------------------------------------------------------- |
|
778 // |
|
779 HBufC* CIptvOmaProvisioningAdapter::LoadResourceTextL( TInt aResourceId ) const |
|
780 { |
|
781 IPTVLOGSTRING_LOW_LEVEL( "CIptvOmaProvisioningAdapter::LoadResourceTextL() start" ); |
|
782 |
|
783 // Open a file server session |
|
784 RFs fs; |
|
785 User::LeaveIfError( fs.Connect() ); |
|
786 CleanupClosePushL( fs ); // 1-> |
|
787 |
|
788 // Get the drive from DLL file name |
|
789 TFileName dllName; |
|
790 Dll::FileName( dllName ); |
|
791 |
|
792 TFileName fileName; |
|
793 TParsePtrC parse( dllName ); |
|
794 fileName = parse.Drive(); |
|
795 |
|
796 _LIT(KIptvOcpResourcePath, "\\Resource\\Plugins\\"); |
|
797 fileName.Append( KIptvOcpResourcePath ); |
|
798 |
|
799 _LIT(KIptvOcpResourceFileName, "IptvOmaProvisioningAdapter.rsc"); |
|
800 fileName.Append( KIptvOcpResourceFileName ); |
|
801 |
|
802 //Retrieve the correct suffix |
|
803 BaflUtils::NearestLanguageFile( fs, fileName ); |
|
804 |
|
805 IPTVLOGSTRING2_LOW_LEVEL( "CIptvOmaProvisioningAdapter:: resource file = %S", &fileName ); |
|
806 |
|
807 //Open the file |
|
808 RResourceFile resourceFile; |
|
809 resourceFile.OpenL( fs, fileName ); |
|
810 CleanupClosePushL( resourceFile ); // 2-> |
|
811 |
|
812 //Read data from resource file |
|
813 HBufC8* resourceData = resourceFile.AllocReadLC( aResourceId ); // 3-> |
|
814 |
|
815 //Extract text from data |
|
816 TResourceReader resReader; |
|
817 resReader.SetBuffer( resourceData ); |
|
818 HBufC* text = resReader.ReadHBufCL(); |
|
819 CleanupStack::PushL( text ); // 4-> |
|
820 |
|
821 TPtr textPtr( text->Des() ); |
|
822 |
|
823 IPTVLOGSTRING2_LOW_LEVEL( "CIptvOmaProvisioningAdapter:: resource text = %S", &textPtr ); |
|
824 |
|
825 CleanupStack::Pop( text ); // <-4 |
|
826 CleanupStack::PopAndDestroy( resourceData ); // <-3 |
|
827 CleanupStack::PopAndDestroy( &resourceFile ); // <-2 |
|
828 CleanupStack::PopAndDestroy( &fs ); // <-1 |
|
829 |
|
830 IPTVLOGSTRING_LOW_LEVEL( "CIptvOmaProvisioningAdapter::LoadResourceTextL() exit" ); |
|
831 return text; |
|
832 } |
|
833 |
|
834 // ----------------------------------------------------------------------------- |
|
835 // CIptvOmaProvisioningAdapter::AddServiceResp |
761 // CIptvOmaProvisioningAdapter::AddServiceResp |
836 // ----------------------------------------------------------------------------- |
762 // ----------------------------------------------------------------------------- |
837 // |
763 // |
838 void CIptvOmaProvisioningAdapter::AddServiceResp( TRespStatus /*aRespStatus*/ ) |
764 void CIptvOmaProvisioningAdapter::AddServiceResp( TRespStatus /*aRespStatus*/ ) |
839 { |
765 { |