videofeeds/clientapi/src/CIptvService.cpp
changeset 0 96612d01cf9f
equal deleted inserted replaced
-1:000000000000 0:96612d01cf9f
       
     1 /*
       
     2 * Copyright (c) 2006-2008 Nokia Corporation and/or its subsidiary(-ies).
       
     3 * All rights reserved.
       
     4 * This component and the accompanying materials are made available
       
     5 * under the terms of the License "Eclipse Public License v1.0"
       
     6 * which accompanies this distribution, and is available
       
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     8 *
       
     9 * Initial Contributors:
       
    10 * Nokia Corporation - initial contribution.
       
    11 *
       
    12 * Contributors:
       
    13 *
       
    14 * Description:    Holds information of the service.*
       
    15 */
       
    16 
       
    17 
       
    18 
       
    19 
       
    20 
       
    21 // INCLUDE FILES
       
    22 #include <e32base.h>
       
    23 #include "IptvDebug.h"
       
    24 #include <sysutil.h>
       
    25 
       
    26 #include "ciptvsecureprovisioningparameters.h"
       
    27 #include "CIptvService.h"
       
    28 
       
    29 // EXTERNAL DATA STRUCTURES
       
    30 
       
    31 // EXTERNAL FUNCTION PROTOTYPES  
       
    32 
       
    33 // CONSTANTS
       
    34 
       
    35 // MACROS
       
    36 
       
    37 // LOCAL CONSTANTS AND MACROS
       
    38 
       
    39 // MODULE DATA STRUCTURES
       
    40 
       
    41 // LOCAL FUNCTION PROTOTYPES
       
    42 
       
    43 // FORWARD DECLARATIONS
       
    44 
       
    45 // ============================= LOCAL FUNCTIONS ===============================
       
    46 
       
    47 // ============================ MEMBER FUNCTIONS ===============================
       
    48 
       
    49 // -----------------------------------------------------------------------------
       
    50 // CIptvService::ConstructL
       
    51 // Symbian 2nd phase constructor can leave.
       
    52 // -----------------------------------------------------------------------------
       
    53 //
       
    54 void CIptvService::ConstructL()
       
    55     {
       
    56     iIapList = CIptvIapList::NewL();
       
    57     // Create right away since we want SearchUrl() and UploadUrl() to always
       
    58     // return something meaningfull
       
    59     iSearchUrl = HBufC::NewL( 1 );  
       
    60     iRecordUrl = HBufC::NewL( 1 );
       
    61     }
       
    62 
       
    63 // -----------------------------------------------------------------------------
       
    64 // CIptvService::NewL
       
    65 // Two-phased constructor.
       
    66 // -----------------------------------------------------------------------------
       
    67 //
       
    68 EXPORT_C CIptvService* CIptvService::NewL()
       
    69     {
       
    70     CIptvService* self = new( ELeave ) CIptvService;
       
    71     CleanupStack::PushL( self );
       
    72     self->ConstructL();
       
    73     CleanupStack::Pop(self);
       
    74     return self;
       
    75     }
       
    76     
       
    77 // -----------------------------------------------------------------------------
       
    78 // CIptvService::~CIptvService()
       
    79 // Destructor.
       
    80 // -----------------------------------------------------------------------------
       
    81 //
       
    82 EXPORT_C CIptvService::~CIptvService()
       
    83     {
       
    84     delete iIapList;
       
    85     delete iSearchUrl;
       
    86     delete iRecordUrl;
       
    87     }
       
    88     
       
    89 // -----------------------------------------------------------------------------
       
    90 // CIptvService::SetId()
       
    91 // 
       
    92 // -----------------------------------------------------------------------------
       
    93 //
       
    94 EXPORT_C void CIptvService::SetId( TUint32 aId )
       
    95     {
       
    96     IPTVLOGSTRING2_LOW_LEVEL("CIptvService::SetId() aId = %d", aId);   
       
    97     iId = aId;
       
    98     }
       
    99 
       
   100 // -----------------------------------------------------------------------------
       
   101 // CIptvService::GetId()
       
   102 // 
       
   103 // -----------------------------------------------------------------------------
       
   104 //    
       
   105 EXPORT_C TUint32 CIptvService::GetId()
       
   106     {
       
   107     IPTVLOGSTRING2_LOW_LEVEL("CIptvService::GetId() iId = %d", iId);
       
   108     return iId;
       
   109     }
       
   110     
       
   111 // -----------------------------------------------------------------------------
       
   112 // CIptvService::SetName()
       
   113 // 
       
   114 // -----------------------------------------------------------------------------
       
   115 //
       
   116 EXPORT_C TInt CIptvService::SetName( const TDesC16& aName )
       
   117     {
       
   118     if ( aName.Length() > KIptvSmServicesDbNameMaxLength )
       
   119         {
       
   120         return KErrNoMemory;
       
   121         }
       
   122         
       
   123     iName = aName;
       
   124     return KErrNone;
       
   125     }
       
   126 
       
   127 // -----------------------------------------------------------------------------
       
   128 // CIptvService::GetName()
       
   129 // 
       
   130 // -----------------------------------------------------------------------------
       
   131 //
       
   132 EXPORT_C TDes16& CIptvService::GetName()
       
   133     {
       
   134     return iName;    
       
   135     }
       
   136 
       
   137 // -----------------------------------------------------------------------------
       
   138 // CIptvService::SetAddress()
       
   139 // 
       
   140 // -----------------------------------------------------------------------------
       
   141 //
       
   142 EXPORT_C TInt CIptvService::SetAddress( const TDesC16& aAddress )
       
   143     {
       
   144     if( aAddress.Length() > KIptvSmServicesDbAddressMaxLength )
       
   145         {
       
   146         return KErrNoMemory;
       
   147         }
       
   148         
       
   149     iAddress = aAddress;
       
   150     return KErrNone;
       
   151     }
       
   152 
       
   153 // -----------------------------------------------------------------------------
       
   154 // CIptvService::GetAddress()
       
   155 // 
       
   156 // -----------------------------------------------------------------------------
       
   157 //
       
   158 EXPORT_C TDes16& CIptvService::GetAddress()
       
   159     {
       
   160     return iAddress;
       
   161     }
       
   162     
       
   163 // -----------------------------------------------------------------------------
       
   164 // CIptvService::SetIconPath()
       
   165 // 
       
   166 // -----------------------------------------------------------------------------
       
   167 //
       
   168 EXPORT_C TInt CIptvService::SetIconPath( const TDesC16& aIconPath )
       
   169     {
       
   170     if ( aIconPath.Length() > KIptvSmServicesDbIconPathMaxLength )
       
   171         {
       
   172         return KErrNoMemory;
       
   173         }
       
   174         
       
   175     iIconPath = aIconPath;
       
   176     return KErrNone;
       
   177     }
       
   178 
       
   179 // -----------------------------------------------------------------------------
       
   180 // CIptvService::GetIconPath()
       
   181 // 
       
   182 // -----------------------------------------------------------------------------
       
   183 //
       
   184 EXPORT_C TDes16& CIptvService::GetIconPath()
       
   185     {
       
   186     return iIconPath;
       
   187     }
       
   188     
       
   189 // -----------------------------------------------------------------------------
       
   190 // CIptvService::SetEpgPluginUid()
       
   191 // 
       
   192 // -----------------------------------------------------------------------------
       
   193 //
       
   194 EXPORT_C void CIptvService::SetEpgPluginUid( TUid aEpgPluginUid )
       
   195     {
       
   196     iEpgPluginUid = aEpgPluginUid.iUid;
       
   197     }
       
   198     
       
   199 // -----------------------------------------------------------------------------
       
   200 // CIptvService::GetEpgPluginUid()
       
   201 // 
       
   202 // -----------------------------------------------------------------------------
       
   203 //
       
   204 EXPORT_C TUid CIptvService::GetEpgPluginUid()
       
   205     {
       
   206     TUid uid;
       
   207     uid.iUid = iEpgPluginUid;
       
   208     
       
   209     return uid;
       
   210     }
       
   211 
       
   212 // -----------------------------------------------------------------------------
       
   213 // CIptvService::SetVodPluginUid()
       
   214 // 
       
   215 // -----------------------------------------------------------------------------
       
   216 //
       
   217 EXPORT_C void CIptvService::SetVodPluginUid( TUid aVodPluginUid )
       
   218     {
       
   219     iVodPluginUid = aVodPluginUid.iUid;
       
   220     }
       
   221     
       
   222 // -----------------------------------------------------------------------------
       
   223 // CIptvService::GetVodPluginUid()
       
   224 // 
       
   225 // -----------------------------------------------------------------------------
       
   226 //
       
   227 EXPORT_C TUid CIptvService::GetVodPluginUid()
       
   228     {
       
   229     TUid uid;
       
   230     uid.iUid = iVodPluginUid;
       
   231 
       
   232     return uid;
       
   233     }
       
   234 
       
   235 // -----------------------------------------------------------------------------
       
   236 // CIptvService::SetIptvPluginUid()
       
   237 // 
       
   238 // -----------------------------------------------------------------------------
       
   239 //
       
   240 EXPORT_C void CIptvService::SetIptvPluginUid( TUid aIptvPluginUid )
       
   241     {
       
   242     iIptvPluginUid = aIptvPluginUid.iUid;
       
   243     }
       
   244     
       
   245 // -----------------------------------------------------------------------------
       
   246 // CIptvService::GetIptvPluginUid()
       
   247 // 
       
   248 // -----------------------------------------------------------------------------
       
   249 //
       
   250 EXPORT_C TUid CIptvService::GetIptvPluginUid()
       
   251     {
       
   252     TUid uid;
       
   253     uid.iUid = iIptvPluginUid;
       
   254 
       
   255     return uid;
       
   256     }
       
   257 
       
   258 // -----------------------------------------------------------------------------
       
   259 // CIptvService::SetType()
       
   260 // 
       
   261 // -----------------------------------------------------------------------------
       
   262 //
       
   263 EXPORT_C void CIptvService::SetType( TServiceType aType )
       
   264     {
       
   265     iType = aType;
       
   266     }
       
   267 
       
   268 // -----------------------------------------------------------------------------
       
   269 // CIptvService::GetType()
       
   270 // 
       
   271 // -----------------------------------------------------------------------------
       
   272 //
       
   273 EXPORT_C CIptvService::TServiceType CIptvService::GetType()
       
   274     {
       
   275     return ( CIptvService::TServiceType )iType;
       
   276     }
       
   277 
       
   278 // -----------------------------------------------------------------------------
       
   279 // CIptvService::SetIapList()
       
   280 // 
       
   281 // -----------------------------------------------------------------------------
       
   282 //
       
   283 EXPORT_C TInt CIptvService::SetIapListL( CIptvIapList& aIapList )
       
   284     {
       
   285     if ( aIapList.Count() > KIptvSmServicesDbMaxIaps )
       
   286         {
       
   287         IPTVLOGSTRING_LOW_LEVEL("CIptvService:: SetIapListL() Max IAP count exceeded, aborting");
       
   288         return KErrArgument;
       
   289         }
       
   290         
       
   291     iIapList->SetL( aIapList );
       
   292     return KErrNone;
       
   293     }
       
   294 
       
   295 // -----------------------------------------------------------------------------
       
   296 // CIptvService::GetIapList()
       
   297 // 
       
   298 // -----------------------------------------------------------------------------
       
   299 //
       
   300 EXPORT_C CIptvIapList& CIptvService::GetIapList()
       
   301     {
       
   302     return *iIapList;
       
   303     }
       
   304 
       
   305 // -----------------------------------------------------------------------------
       
   306 // CIptvService::SetUserName()
       
   307 // 
       
   308 // -----------------------------------------------------------------------------
       
   309 //
       
   310 EXPORT_C TInt CIptvService::SetUserName( const TDesC16& aUserName )
       
   311     {
       
   312     if ( aUserName.Length() > KIptvSmPasswordsDbUserNameMaxLength )
       
   313         {
       
   314         return KErrNoMemory;
       
   315         }
       
   316     
       
   317     iUserName = aUserName;
       
   318     return KErrNone;
       
   319     }
       
   320 
       
   321 // -----------------------------------------------------------------------------
       
   322 // CIptvService::GetUserName()
       
   323 // 
       
   324 // -----------------------------------------------------------------------------
       
   325 //
       
   326 EXPORT_C TDes16& CIptvService::GetUserName()
       
   327     {
       
   328     return iUserName;
       
   329     }
       
   330 
       
   331 // -----------------------------------------------------------------------------
       
   332 // CIptvService::SetPassword()
       
   333 // 
       
   334 // -----------------------------------------------------------------------------
       
   335 //
       
   336 EXPORT_C TInt CIptvService::SetPassword( const TDesC16& aPassword )
       
   337     {
       
   338     if ( aPassword.Length() > KIptvSmPasswordsDbPasswordMaxLength )
       
   339         {
       
   340         return KErrNoMemory;
       
   341         }
       
   342 
       
   343     iPassword = aPassword;
       
   344     return KErrNone;
       
   345     }
       
   346 
       
   347 // -----------------------------------------------------------------------------
       
   348 // CIptvService::GetPassword()
       
   349 // 
       
   350 // -----------------------------------------------------------------------------
       
   351 //
       
   352 EXPORT_C TDes16& CIptvService::GetPassword()
       
   353     {
       
   354     return iPassword;
       
   355     }
       
   356 
       
   357 // -----------------------------------------------------------------------------
       
   358 // CIptvService::SetDesc()
       
   359 // 
       
   360 // -----------------------------------------------------------------------------
       
   361 //
       
   362 EXPORT_C TInt CIptvService::SetDesc( const TDesC16& aDesc )
       
   363     {
       
   364     if ( aDesc.Length() > KIptvSmServicesDbDescMaxLength )
       
   365         {
       
   366         return KErrNoMemory;
       
   367         }
       
   368     
       
   369     iDesc = aDesc;
       
   370     return KErrNone;
       
   371     }
       
   372 
       
   373 // -----------------------------------------------------------------------------
       
   374 // CIptvService::GetDesc()
       
   375 // 
       
   376 // -----------------------------------------------------------------------------
       
   377 //
       
   378 EXPORT_C TDes16& CIptvService::GetDesc()
       
   379     {
       
   380     return iDesc;
       
   381     }
       
   382 
       
   383 // -----------------------------------------------------------------------------
       
   384 // CIptvService::SetFlags()
       
   385 // 
       
   386 // -----------------------------------------------------------------------------
       
   387 //
       
   388 EXPORT_C void CIptvService::SetFlags( TUint32 aFlags )
       
   389     {
       
   390     iFlags = aFlags;
       
   391     }
       
   392     
       
   393 // -----------------------------------------------------------------------------
       
   394 // CIptvService::GetFlags()
       
   395 // 
       
   396 // -----------------------------------------------------------------------------
       
   397 //
       
   398 EXPORT_C TUint32 CIptvService::GetFlags()
       
   399     {
       
   400     return iFlags;
       
   401     }
       
   402     
       
   403 // -----------------------------------------------------------------------------
       
   404 // CIptvService::SetApplicationUid()
       
   405 // 
       
   406 // -----------------------------------------------------------------------------
       
   407 //
       
   408 EXPORT_C void CIptvService::SetApplicationUid( TInt32 aUid )
       
   409     {
       
   410     iApplicationUid = aUid;
       
   411     }
       
   412     
       
   413 // -----------------------------------------------------------------------------
       
   414 // CIptvService::GetApplicationUid()
       
   415 // 
       
   416 // -----------------------------------------------------------------------------
       
   417 //
       
   418 EXPORT_C TInt32 CIptvService::GetApplicationUid()
       
   419     {
       
   420     return iApplicationUid;
       
   421     }
       
   422     
       
   423 // -----------------------------------------------------------------------------
       
   424 // CIptvService::SetDisplayOrder()
       
   425 // 
       
   426 // -----------------------------------------------------------------------------
       
   427 //
       
   428 EXPORT_C void CIptvService::SetDisplayOrder( TUint32 aOrder )
       
   429     {
       
   430     iDisplayOrder = aOrder;
       
   431     }
       
   432     
       
   433 // -----------------------------------------------------------------------------
       
   434 // CIptvService::GetDisplayOrder()
       
   435 // 
       
   436 // -----------------------------------------------------------------------------
       
   437 //    
       
   438 EXPORT_C TUint32 CIptvService::GetDisplayOrder()
       
   439     {
       
   440     return iDisplayOrder;
       
   441     }
       
   442 
       
   443 // -----------------------------------------------------------------------------
       
   444 // CIptvService::SetProviderId()
       
   445 // 
       
   446 // -----------------------------------------------------------------------------
       
   447 //    
       
   448 
       
   449 EXPORT_C TInt CIptvService::SetProviderId( const TDesC& aProviderId )
       
   450     {
       
   451     if ( aProviderId.Length() > KIptvSmServicesDbProviderIdMaxLength )
       
   452         {
       
   453         return KErrOverflow;
       
   454         }
       
   455     
       
   456     iProviderId = aProviderId;
       
   457     return KErrNone;
       
   458     }
       
   459 
       
   460 // -----------------------------------------------------------------------------
       
   461 // CIptvService::GetProviderId()
       
   462 // 
       
   463 // -----------------------------------------------------------------------------
       
   464 //    
       
   465 EXPORT_C TDesC& CIptvService::GetProviderId()
       
   466     {
       
   467     return iProviderId;
       
   468     }
       
   469 
       
   470 // -----------------------------------------------------------------------------
       
   471 // CIptvService::SetAccountManagementUrl()
       
   472 // 
       
   473 // -----------------------------------------------------------------------------
       
   474 //    
       
   475 EXPORT_C TInt CIptvService::SetAccountManagementUrl(
       
   476     const TDesC& aAccountManagementUrl )
       
   477     {
       
   478     if ( aAccountManagementUrl.Length() >
       
   479          KIptvSmServicesDbAccountManagementUrlMaxLength )
       
   480         {
       
   481         return KErrOverflow;
       
   482         }
       
   483     
       
   484     iAccountManagementUrl = aAccountManagementUrl;
       
   485     return KErrNone;
       
   486     }
       
   487 
       
   488 // -----------------------------------------------------------------------------
       
   489 // CIptvService::GetAccountManagementUrl()
       
   490 // 
       
   491 // -----------------------------------------------------------------------------
       
   492 //    
       
   493 EXPORT_C TDesC& CIptvService::GetAccountManagementUrl()
       
   494     {
       
   495     return iAccountManagementUrl;
       
   496     }
       
   497 
       
   498 // -----------------------------------------------------------------------------
       
   499 // CIptvService::SetEpgUpdateTimeL()
       
   500 //
       
   501 // -----------------------------------------------------------------------------
       
   502 //    
       
   503 EXPORT_C void CIptvService::SetEpgUpdateTimeL( const TTime& aTime )
       
   504     {
       
   505     iEpgUpdateTime = aTime;
       
   506     }
       
   507 
       
   508 // -----------------------------------------------------------------------------
       
   509 // CIptvService::GetEpgUpdateTimeL()
       
   510 //
       
   511 // -----------------------------------------------------------------------------
       
   512 //    
       
   513 EXPORT_C TTime& CIptvService::GetEpgUpdateTimeL()
       
   514     {
       
   515     return iEpgUpdateTime;
       
   516     }
       
   517         
       
   518 // -----------------------------------------------------------------------------
       
   519 // CIptvService::SetIapNameL()
       
   520 //
       
   521 // -----------------------------------------------------------------------------
       
   522 //    
       
   523 EXPORT_C void CIptvService::SetIapNameL( const TDesC& aIapName )
       
   524     {
       
   525     if ( aIapName.Length() > KIptvSmServicesDbIapNameMaxLength )
       
   526         {
       
   527         User::Leave( KErrOverflow );
       
   528         }
       
   529     
       
   530     iIapName = aIapName;    
       
   531     }
       
   532 
       
   533 // -----------------------------------------------------------------------------
       
   534 // CIptvService::GetIapNameL()
       
   535 //
       
   536 // -----------------------------------------------------------------------------
       
   537 //    
       
   538 EXPORT_C const TDesC& CIptvService::GetIapNameL()
       
   539     {
       
   540     return iIapName;
       
   541     }
       
   542 
       
   543 // -----------------------------------------------------------------------------
       
   544 // CIptvService::SetSearchUrl()
       
   545 //
       
   546 // -----------------------------------------------------------------------------
       
   547 //
       
   548 EXPORT_C void CIptvService::SetSearchUrlL( const TDesC& aSearchUrl )
       
   549     {
       
   550     if ( aSearchUrl.Length() > KIptvSmServicesDbSearchUrlMaxLength )
       
   551         {
       
   552         User::Leave( KErrOverflow );
       
   553         }
       
   554     
       
   555     delete iSearchUrl;
       
   556     iSearchUrl = NULL;
       
   557     iSearchUrl = aSearchUrl.AllocL();
       
   558     }
       
   559 
       
   560 // -----------------------------------------------------------------------------
       
   561 // CIptvService::SearchUrl()
       
   562 //
       
   563 // -----------------------------------------------------------------------------
       
   564 //
       
   565 EXPORT_C const TDesC& CIptvService::SearchUrl() const
       
   566     {
       
   567     return *iSearchUrl;
       
   568     }
       
   569 
       
   570 // -----------------------------------------------------------------------------
       
   571 // CIptvService::SetRecordUrlL()
       
   572 //
       
   573 // -----------------------------------------------------------------------------
       
   574 //
       
   575 EXPORT_C void CIptvService::SetRecordUrlL( const TDesC& aRecordUrl )
       
   576     {
       
   577     IPTVLOGSTRING2_LOW_LEVEL("CIptvService::SetRecordUrlL(): aRecordUrl = %S", &aRecordUrl);
       
   578         
       
   579     if ( aRecordUrl.Length() > KIptvSmServicesDbRecordUrlMaxLength )
       
   580         {
       
   581         IPTVLOGSTRING_LOW_LEVEL ("Record URL is too long -> User::Leave( KErrOverflow");        
       
   582         User::Leave( KErrOverflow );
       
   583         }
       
   584     
       
   585     delete iRecordUrl;
       
   586     iRecordUrl = NULL;
       
   587     iRecordUrl = HBufC::NewL( aRecordUrl.Length() );
       
   588     iRecordUrl->Des() = aRecordUrl;     
       
   589     }
       
   590 
       
   591 // -----------------------------------------------------------------------------
       
   592 // CIptvService::RecordUrl()
       
   593 //
       
   594 // -----------------------------------------------------------------------------
       
   595 //
       
   596 EXPORT_C const TDesC& CIptvService::RecordUrl() const
       
   597     {
       
   598     return *iRecordUrl;
       
   599     }
       
   600 
       
   601 // -----------------------------------------------------------------------------
       
   602 // CIptvService::SetScheduleDlNetwork()
       
   603 //
       
   604 // -----------------------------------------------------------------------------
       
   605 //
       
   606 EXPORT_C void CIptvService::SetScheduleDlNetwork( TUint aScheduleDlNetwork )
       
   607     {
       
   608     iScheduleDownloadNetwork = aScheduleDlNetwork;
       
   609     }
       
   610 
       
   611 // -----------------------------------------------------------------------------
       
   612 // CIptvService::ScheduleDlNetwork()
       
   613 //
       
   614 // -----------------------------------------------------------------------------
       
   615 //
       
   616 EXPORT_C TUint CIptvService::ScheduleDlNetwork() const
       
   617     {
       
   618     return iScheduleDownloadNetwork;
       
   619     }
       
   620 
       
   621 // -----------------------------------------------------------------------------
       
   622 // CIptvService::SetScheduleDlTime()
       
   623 //
       
   624 // -----------------------------------------------------------------------------
       
   625 //
       
   626 EXPORT_C void CIptvService::SetScheduleDlTime( TUint aScheduleDlTime )
       
   627     {
       
   628     iScheduleDownloadTime = aScheduleDlTime;
       
   629     }
       
   630 
       
   631 // -----------------------------------------------------------------------------
       
   632 // CIptvService::ScheduleDlTime()
       
   633 //
       
   634 // -----------------------------------------------------------------------------
       
   635 //
       
   636 EXPORT_C TUint CIptvService::ScheduleDlTime() const
       
   637     {
       
   638     return iScheduleDownloadTime;
       
   639     }
       
   640 
       
   641 // -----------------------------------------------------------------------------
       
   642 // CIptvService::SetScheduleDlType()
       
   643 //
       
   644 // -----------------------------------------------------------------------------
       
   645 //
       
   646 EXPORT_C void CIptvService::SetScheduleDlType( TUint aScheduleDlType )
       
   647     {
       
   648     iScheduleDownloadType = aScheduleDlType;
       
   649     }
       
   650 
       
   651 // -----------------------------------------------------------------------------
       
   652 // CIptvService::ScheduleDlType()
       
   653 //
       
   654 // -----------------------------------------------------------------------------
       
   655 //
       
   656 EXPORT_C TUint CIptvService::ScheduleDlType() const
       
   657     {
       
   658     return iScheduleDownloadType;
       
   659     }
       
   660 
       
   661 // -----------------------------------------------------------------------------
       
   662 // CIptvService::SetLastScheduledDownloadTimeL
       
   663 //
       
   664 // -----------------------------------------------------------------------------
       
   665 //    
       
   666 EXPORT_C void CIptvService::SetScheduledLastDownloadTime( const TTime& aTime )
       
   667     {
       
   668     iLastScheduledDownloadTime = aTime;
       
   669     }
       
   670 
       
   671 // -----------------------------------------------------------------------------
       
   672 // CIptvService::GetLastScheduledDownloadTimeL
       
   673 //
       
   674 // -----------------------------------------------------------------------------
       
   675 //    
       
   676 EXPORT_C const TTime& CIptvService::GetScheduledLastDownloadTime() const
       
   677     {
       
   678     return iLastScheduledDownloadTime;
       
   679     }
       
   680 
       
   681 // -----------------------------------------------------------------------------
       
   682 // CIptvService::SetGroupId()
       
   683 // 
       
   684 // -----------------------------------------------------------------------------
       
   685 //
       
   686 EXPORT_C void CIptvService::SetGroupId( TUint32 aGroupId )
       
   687     {
       
   688     iGroupId = aGroupId;
       
   689     }
       
   690 
       
   691 // -----------------------------------------------------------------------------
       
   692 // CIptvService::GetGroupId()
       
   693 // 
       
   694 // -----------------------------------------------------------------------------
       
   695 //    
       
   696 EXPORT_C TUint32 CIptvService::GetGroupId()
       
   697     {
       
   698     return iGroupId;
       
   699     }
       
   700     
       
   701 // -----------------------------------------------------------------------------
       
   702 // CIptvService::SetUseCategory()
       
   703 //
       
   704 // -----------------------------------------------------------------------------
       
   705 //    
       
   706 EXPORT_C void CIptvService::SetUseCategory( const TBool& aUseCategory )
       
   707     {
       
   708     iUseCategory = ( TUint8 )aUseCategory;    
       
   709     }
       
   710 
       
   711 // -----------------------------------------------------------------------------
       
   712 // CIptvService::GetUseCategory()
       
   713 //
       
   714 // -----------------------------------------------------------------------------
       
   715 //    
       
   716 EXPORT_C TBool CIptvService::GetUseCategory()
       
   717     {
       
   718     return ( iUseCategory != 0 );
       
   719     }
       
   720 
       
   721 // -----------------------------------------------------------------------------
       
   722 // CIptvService::SetUploadProvider()
       
   723 //
       
   724 // -----------------------------------------------------------------------------
       
   725 //
       
   726 EXPORT_C TInt CIptvService::SetUploadProvider( const TDesC& aProvider )
       
   727     {
       
   728     if ( aProvider.Length() > KIptvSmServicesDbNameMaxLength )
       
   729         {
       
   730         return KErrNoMemory;
       
   731         }
       
   732         
       
   733     iUploadProvider = aProvider;
       
   734     return KErrNone;
       
   735     }
       
   736 
       
   737 // -----------------------------------------------------------------------------
       
   738 // CIptvService::GetUploadProvider()
       
   739 //
       
   740 // -----------------------------------------------------------------------------
       
   741 //
       
   742 EXPORT_C const TDesC& CIptvService::GetUploadProvider() const
       
   743     {
       
   744     return iUploadProvider;
       
   745     }
       
   746 
       
   747 // -----------------------------------------------------------------------------
       
   748 // CIptvService::SetIconUrl()
       
   749 // 
       
   750 // -----------------------------------------------------------------------------
       
   751 //
       
   752 EXPORT_C TInt CIptvService::SetIconUrl( const TDesC16& aAddress )
       
   753     {
       
   754     if ( aAddress.Length() > KIptvSmServicesDbAddressMaxLength )
       
   755         {
       
   756         return KErrNoMemory;
       
   757         }
       
   758         
       
   759     iIconUrl = aAddress;
       
   760     return KErrNone;
       
   761     }
       
   762 
       
   763 // -----------------------------------------------------------------------------
       
   764 // CIptvService::GetIconUrl()
       
   765 // 
       
   766 // -----------------------------------------------------------------------------
       
   767 //
       
   768 EXPORT_C TDes16& CIptvService::GetIconUrl()
       
   769     {
       
   770     return iIconUrl;
       
   771     }
       
   772     
       
   773 // -----------------------------------------------------------------------------
       
   774 // CIptvService::Set()
       
   775 // This format is used when sending service data over IPC of when handling
       
   776 // arrays of services.
       
   777 // -----------------------------------------------------------------------------
       
   778 //
       
   779 EXPORT_C TInt CIptvService::SetL( const TDesC8& aService )
       
   780     {
       
   781     RDesReadStream readStream;
       
   782     readStream.Open(aService);
       
   783     readStream.PushL(); // 1->
       
   784     InternalizeL(readStream);
       
   785     readStream.Pop(); // <-1
       
   786     readStream.Close();
       
   787         
       
   788     return KErrNone; //successful
       
   789     }
       
   790 
       
   791 // -----------------------------------------------------------------------------
       
   792 // CIptvService::GetL()
       
   793 // This format is used when sending service data over IPC and handling
       
   794 // arrays of services.
       
   795 // -----------------------------------------------------------------------------
       
   796 //
       
   797 EXPORT_C HBufC8* CIptvService::GetL()
       
   798     {
       
   799     HBufC8* serviceDes;
       
   800     serviceDes = HBufC8::NewL( CountSize() + 1 );
       
   801     CleanupStack::PushL( serviceDes ); // 1->
       
   802     
       
   803     RDesWriteStream writeStream;
       
   804     TPtr8 servicePtr8(serviceDes->Des());
       
   805     writeStream.Open(servicePtr8);
       
   806     writeStream.PushL(); // 2->
       
   807     ExternalizeL( writeStream );
       
   808     writeStream.Pop(); // <-2
       
   809     writeStream.Close();
       
   810     
       
   811     CleanupStack::Pop(serviceDes); // <-1 //ownership moves to caller
       
   812     return serviceDes;
       
   813     }
       
   814     
       
   815 // -----------------------------------------------------------------------------
       
   816 // CIptvService::CountSize()
       
   817 // Returns binary descriptor size with current member values.
       
   818 // Size is in 8-bit bytes.
       
   819 // -----------------------------------------------------------------------------
       
   820 //
       
   821 EXPORT_C TUint32 CIptvService::CountSize()
       
   822     {
       
   823     return CountExternalizeSize();
       
   824     }
       
   825 
       
   826 // -----------------------------------------------------------------------------
       
   827 // CIptvService::InternalizeL()
       
   828 // -----------------------------------------------------------------------------
       
   829 //    
       
   830 EXPORT_C void CIptvService::InternalizeL( RDesReadStream& aStream )
       
   831     {
       
   832     iId = aStream.ReadInt32L();
       
   833 
       
   834     CIptvUtil::ReadDesFromStreamL( iName, aStream );    
       
   835     CIptvUtil::ReadDesFromStreamL( iAddress, aStream );
       
   836     CIptvUtil::ReadDesFromStreamL( iIconPath, aStream );
       
   837 
       
   838     iEpgPluginUid  = aStream.ReadInt32L();
       
   839     iVodPluginUid  = aStream.ReadInt32L();
       
   840     iIptvPluginUid = aStream.ReadInt32L();
       
   841 
       
   842     iType = ( TServiceType )aStream.ReadInt16L();
       
   843 
       
   844     iIapList->InternalizeL( aStream );    
       
   845 
       
   846     CIptvUtil::ReadDesFromStreamL( iUserName, aStream );
       
   847     CIptvUtil::ReadDesFromStreamL( iPassword, aStream );
       
   848     CIptvUtil::ReadDesFromStreamL( iDesc, aStream );
       
   849 
       
   850     iFlags = aStream.ReadInt32L();
       
   851     iApplicationUid = aStream.ReadInt32L();
       
   852     iDisplayOrder = aStream.ReadInt32L();    
       
   853 
       
   854     CIptvUtil::ReadDesFromStreamL( iProviderId, aStream );
       
   855     CIptvUtil::ReadDesFromStreamL( iAccountManagementUrl, aStream );
       
   856 
       
   857     //iEpgUpdateTime
       
   858     TUint low  = static_cast<TUint>( aStream.ReadUint32L() );
       
   859     TUint high = static_cast<TUint>( aStream.ReadUint32L() );
       
   860     TInt64 time;
       
   861     time = high;
       
   862     time = time << 32;
       
   863     time |= low;
       
   864     iEpgUpdateTime = time;
       
   865     
       
   866     CIptvUtil::ReadDesFromStreamL( iIapName, aStream );
       
   867 
       
   868     // Fill iSearchUrl, can't use ReadDesFromStreamL since we need to know length for HBufC creation
       
   869     TInt length( aStream.ReadUint16L() );
       
   870     delete iSearchUrl;
       
   871     iSearchUrl = NULL;
       
   872     iSearchUrl = HBufC::NewL( length );
       
   873     TPtr searchUrlPtr( iSearchUrl->Des() );
       
   874     for ( TInt i = 0; i < length; i++ )
       
   875         {
       
   876         searchUrlPtr.Append( aStream.ReadUint16L() );
       
   877         }
       
   878         
       
   879     iScheduleDownloadNetwork = aStream.ReadInt32L();
       
   880     iScheduleDownloadTime = aStream.ReadInt32L();
       
   881     iScheduleDownloadType = aStream.ReadInt32L();
       
   882 
       
   883     low  = static_cast<TUint>( aStream.ReadUint32L() );
       
   884     high = static_cast<TUint>( aStream.ReadUint32L() );
       
   885     time = high;
       
   886     time = time << 32;
       
   887     time |= low;
       
   888     iLastScheduledDownloadTime = time;
       
   889 
       
   890     iGroupId = aStream.ReadInt32L();
       
   891     iUseCategory = aStream.ReadInt8L();
       
   892     CIptvUtil::ReadDesFromStreamL( iUploadProvider, aStream );
       
   893     CIptvUtil::ReadDesFromStreamL( iIconUrl, aStream );
       
   894     
       
   895     // Fill iRecordUrl, can't use ReadDesFromStreamL since we need to 
       
   896     // know length for HBufC creation
       
   897     length = aStream.ReadUint16L();
       
   898     delete iRecordUrl;
       
   899     iRecordUrl = NULL;
       
   900     iRecordUrl = HBufC::NewL( length );
       
   901     TPtr recordUrlPtr( iRecordUrl->Des() );
       
   902     for ( TInt i = 0; i < length; i++ )
       
   903         {
       
   904         recordUrlPtr.Append( aStream.ReadUint16L() );
       
   905         }
       
   906     }
       
   907 
       
   908 // -----------------------------------------------------------------------------
       
   909 // CIptvService::ExternalizeL()
       
   910 // -----------------------------------------------------------------------------
       
   911 //        
       
   912 EXPORT_C void CIptvService::ExternalizeL( RDesWriteStream& aStream ) const
       
   913     {    
       
   914     aStream.WriteInt32L( iId );
       
   915 
       
   916     CIptvUtil::WriteDesToStreamL( iName, aStream );
       
   917     CIptvUtil::WriteDesToStreamL( iAddress, aStream );
       
   918     CIptvUtil::WriteDesToStreamL( iIconPath, aStream );
       
   919                 
       
   920     aStream.WriteInt32L( iEpgPluginUid );
       
   921     aStream.WriteInt32L( iVodPluginUid );
       
   922     aStream.WriteInt32L( iIptvPluginUid );
       
   923 
       
   924     aStream.WriteInt16L( iType );
       
   925 
       
   926     iIapList->ExternalizeL( aStream );
       
   927 
       
   928     CIptvUtil::WriteDesToStreamL( iUserName, aStream );
       
   929     CIptvUtil::WriteDesToStreamL( iPassword, aStream );
       
   930     CIptvUtil::WriteDesToStreamL( iDesc, aStream );
       
   931 
       
   932     aStream.WriteInt32L( iFlags );
       
   933     aStream.WriteInt32L( iApplicationUid );
       
   934     aStream.WriteInt32L( iDisplayOrder );    
       
   935 
       
   936     CIptvUtil::WriteDesToStreamL( iProviderId, aStream );
       
   937     CIptvUtil::WriteDesToStreamL( iAccountManagementUrl, aStream );
       
   938     
       
   939     aStream.WriteUint32L( iEpgUpdateTime.Int64() & 0x00000000FFFFFFFFULL );
       
   940     aStream.WriteUint32L( ( iEpgUpdateTime.Int64() & 0xFFFFFFFF00000000ULL ) >> 32 );
       
   941     
       
   942     CIptvUtil::WriteDesToStreamL( iIapName, aStream );
       
   943 
       
   944     TPtr searchUrlPtr( iSearchUrl->Des() );
       
   945     CIptvUtil::WriteDesToStreamL( searchUrlPtr, aStream );
       
   946         
       
   947     aStream.WriteInt32L( iScheduleDownloadNetwork );
       
   948     aStream.WriteInt32L( iScheduleDownloadTime );
       
   949     aStream.WriteInt32L( iScheduleDownloadType );
       
   950     aStream.WriteUint32L( 
       
   951         iLastScheduledDownloadTime.Int64() & 0x00000000FFFFFFFFULL );
       
   952     aStream.WriteUint32L( 
       
   953         ( iLastScheduledDownloadTime.Int64() & 0xFFFFFFFF00000000ULL ) >> 32 );
       
   954 
       
   955     aStream.WriteInt32L( iGroupId );
       
   956     aStream.WriteInt8L( iUseCategory );
       
   957     CIptvUtil::WriteDesToStreamL( iUploadProvider, aStream );
       
   958     CIptvUtil::WriteDesToStreamL( iIconUrl, aStream );
       
   959     TPtr recordUrlPtr( iRecordUrl->Des() );
       
   960     CIptvUtil::WriteDesToStreamL( recordUrlPtr, aStream );
       
   961     }
       
   962 
       
   963 // -----------------------------------------------------------------------------    
       
   964 // CIptvService::CountExternalizeSize()
       
   965 // Return externalize size in 8bit bytes.
       
   966 // -----------------------------------------------------------------------------
       
   967 //
       
   968 EXPORT_C TUint32 CIptvService::CountExternalizeSize()
       
   969     {
       
   970     return   4   //TUint32 iId                          // 1
       
   971            + 2 + ( iName.Length() * 2 )                 // 2
       
   972            + 2 + ( iAddress.Length() * 2 )              // 3
       
   973            + 2 + ( iIconPath.Length() * 2 )             // 4
       
   974            + 4   //TUint32 iEpdPluginUid                // 5
       
   975            + 4   //TUint32 iVodPlugingUid               // 6
       
   976            + 4   //TUint32 iIptvPluginUid               // 7
       
   977            + 2   //TUint16 iType                        // 8
       
   978            + ( iIapList->CountExternalizeSize() )       // 9
       
   979            + 2 + ( iUserName.Length() * 2 )             // 10
       
   980            + 2 + ( iPassword.Length() * 2 )             // 11
       
   981            + 2 + ( iDesc.Length() * 2 )                 // 12
       
   982            + 4   //TUint32 iFlags                       // 13
       
   983            + 4   //TInt32  iApplicationUid              // 14
       
   984            + 4   //TUint32 iDisplayOrder                // 15    
       
   985            + 2 + ( iProviderId.Length() * 2 )           // 16
       
   986            + 2 + ( iAccountManagementUrl.Length() * 2 ) // 17
       
   987            + 8 + //TTime iEpgUpdateTime                 // 18
       
   988            + 2 + ( iIapName.Length() * 2 )              // 19
       
   989            + 2 + ( iSearchUrl->Length() * 2 )           // 20
       
   990            + 4   //TUint iScheduleDownloadNetwork       // 21
       
   991            + 4   //TUint iScheduleDownloadTime          // 22
       
   992            + 4   //TUint iScheduleDownloadType          // 23
       
   993            + 8   //TTime iLastScheduledDownloadTime     // 24
       
   994            + 4 + //TUint32 iGroupId                     // 25
       
   995            + 1 + //TUint8 iUseCategory                  // 26
       
   996            + 2 + ( iUploadProvider.Length() * 2 )       // 27
       
   997            + 2 + ( iIconUrl.Length() * 2 )              // 28
       
   998            + 2 + ( iRecordUrl->Length() * 2 );          // 29
       
   999     }
       
  1000 
       
  1001 // -----------------------------------------------------------------------------    
       
  1002 // CIptvService::CompareL()
       
  1003 // -----------------------------------------------------------------------------
       
  1004 //
       
  1005 EXPORT_C TBool CIptvService::CompareL( CIptvService& aService )
       
  1006     {
       
  1007     IPTVLOGSTRING_LOW_LEVEL( "CIptvService::CompareL() start" );
       
  1008     
       
  1009     HBufC8* serviceStreamed = aService.GetL();
       
  1010     CleanupStack::PushL( serviceStreamed ); // 1->
       
  1011     HBufC8* thisServiceStreamed = GetL();
       
  1012     CleanupStack::PushL( thisServiceStreamed ); // 2->
       
  1013 
       
  1014     TBool result( EFalse );
       
  1015     if ( serviceStreamed->Des() == thisServiceStreamed->Des() )
       
  1016         {
       
  1017         IPTVLOGSTRING_LOW_LEVEL("CIptvService:: services are equal");
       
  1018         result = ETrue;
       
  1019         }
       
  1020     else
       
  1021         {
       
  1022         IPTVLOGSTRING_LOW_LEVEL("CIptvService:: services are not equal");
       
  1023         result = EFalse;
       
  1024         }
       
  1025            
       
  1026     CleanupStack::PopAndDestroy( thisServiceStreamed ); // <-2
       
  1027     CleanupStack::PopAndDestroy( serviceStreamed );    // <-1
       
  1028     
       
  1029     IPTVLOGSTRING_LOW_LEVEL("CIptvService::CompareL() exit");
       
  1030 
       
  1031     return result;
       
  1032     }
       
  1033 
       
  1034 // -----------------------------------------------------------------------------    
       
  1035 // CIptvService::SecureProvisioningUrlParametersL()
       
  1036 // -----------------------------------------------------------------------------
       
  1037 //
       
  1038 EXPORT_C HBufC* CIptvService::SecureProvisioningUrlParametersL()
       
  1039     {
       
  1040     CIptvSecureProvisioningParameters* spp = CIptvSecureProvisioningParameters::NewL();
       
  1041     CleanupStack::PushL( spp ); // 1->
       
  1042     
       
  1043     HBufC* parameters = spp->SecureProvisioningUrlParametersL();
       
  1044     CleanupStack::PopAndDestroy( spp ); // <-1
       
  1045     return parameters;
       
  1046     }
       
  1047