videofeeds/vcnsuiengine/src/vcxnsservice.cpp
changeset 0 96612d01cf9f
equal deleted inserted replaced
-1:000000000000 0:96612d01cf9f
       
     1 /*
       
     2 * Copyright (c) 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: 
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 
       
    20 
       
    21 #include "IptvDebug.h"
       
    22 #include "vcxnsservice.h"
       
    23 
       
    24 // -----------------------------------------------------------------------------
       
    25 // CVcxNsService::CVcxNsService()
       
    26 // -----------------------------------------------------------------------------
       
    27 //
       
    28 CVcxNsService::CVcxNsService()
       
    29     : iHighlightIndex( 0 )
       
    30     {
       
    31     }
       
    32 
       
    33 // -----------------------------------------------------------------------------
       
    34 // CVcxNsService::~CVcxNsService()
       
    35 // -----------------------------------------------------------------------------
       
    36 //
       
    37 CVcxNsService::~CVcxNsService( )
       
    38     {
       
    39     delete iIconPath;
       
    40     delete iName;
       
    41     delete iUserName;
       
    42     delete iPassword;
       
    43     delete iCustomUri;
       
    44     delete iDescription;
       
    45     delete iAccountMgmtUri;
       
    46     
       
    47     iServiceGroup.ResetAndDestroy();
       
    48     }
       
    49 
       
    50 // -----------------------------------------------------------------------------
       
    51 // CVcxNsService::NewL()
       
    52 // -----------------------------------------------------------------------------
       
    53 //
       
    54 CVcxNsService* CVcxNsService::NewL( )
       
    55     {
       
    56     CVcxNsService* self = new ( ELeave ) CVcxNsService;
       
    57     
       
    58     return self;
       
    59     }
       
    60 
       
    61 // -----------------------------------------------------------------------------
       
    62 // CVcxNsService::GetName()
       
    63 // -----------------------------------------------------------------------------
       
    64 //
       
    65 EXPORT_C const TDesC& CVcxNsService::GetName()
       
    66     {
       
    67     if( iName && iName->Length() > 0 )
       
    68         {
       
    69         return *iName;
       
    70         }
       
    71     else
       
    72         {
       
    73         return KNullDesC;
       
    74         }
       
    75     }
       
    76 
       
    77 // -----------------------------------------------------------------------------
       
    78 // CVcxNsService::GetDesc()
       
    79 // -----------------------------------------------------------------------------
       
    80 //
       
    81 EXPORT_C const TDesC& CVcxNsService::GetDesc()
       
    82     {
       
    83     if( iDescription && iDescription->Length() > 0 )
       
    84         {
       
    85         return *iDescription;
       
    86         }
       
    87     else
       
    88         {
       
    89         return KNullDesC;
       
    90         }
       
    91     }
       
    92 
       
    93 // -----------------------------------------------------------------------------
       
    94 // CVcxNsService::GetIconPath()
       
    95 // -----------------------------------------------------------------------------
       
    96 //
       
    97 EXPORT_C const TDesC& CVcxNsService::GetIconPath()
       
    98     {
       
    99     if( iIconPath && iIconPath->Length() > 0 )
       
   100         {
       
   101         return *iIconPath;
       
   102         }
       
   103     else
       
   104         {
       
   105         return KNullDesC;
       
   106         }
       
   107     }
       
   108 
       
   109 // -----------------------------------------------------------------------------
       
   110 // CVcxNsService::GetUserNameL()
       
   111 // -----------------------------------------------------------------------------
       
   112 //
       
   113 EXPORT_C const TDesC& CVcxNsService::GetUserName()
       
   114     {
       
   115     if( iUserName && iUserName->Length() > 0 )
       
   116         {
       
   117         return *iUserName;
       
   118         }
       
   119     else
       
   120         {
       
   121         return KNullDesC;
       
   122         }
       
   123     }
       
   124 
       
   125 // -----------------------------------------------------------------------------
       
   126 // CVcxNsService::GetPasswordL()
       
   127 // -----------------------------------------------------------------------------
       
   128 //
       
   129 EXPORT_C const TDesC& CVcxNsService::GetPassword()
       
   130     {
       
   131     if( iPassword && iPassword->Length() > 0 )
       
   132         {
       
   133         return *iPassword;
       
   134         }
       
   135     else
       
   136         {
       
   137         return KNullDesC;
       
   138         }
       
   139     }
       
   140 
       
   141 // -----------------------------------------------------------------------------
       
   142 // CVcxNsService::GetServiceId()
       
   143 // -----------------------------------------------------------------------------
       
   144 //
       
   145 EXPORT_C TUint32 CVcxNsService::GetServiceId()
       
   146     {
       
   147     return iServiceId;
       
   148     }
       
   149 
       
   150 // -----------------------------------------------------------------------------
       
   151 // CVcxNsService::GetUpdateTime()
       
   152 // -----------------------------------------------------------------------------
       
   153 //
       
   154 EXPORT_C TTime  CVcxNsService::GetUpdateTime()
       
   155     {
       
   156     return iUpdateTime;
       
   157     }
       
   158 
       
   159 // -----------------------------------------------------------------------------
       
   160 // CVcxNsService::GetUpdateStatus()
       
   161 // -----------------------------------------------------------------------------
       
   162 //
       
   163 EXPORT_C CVcxNsService::TServiceUpdateStatus CVcxNsService::GetUpdateStatus()
       
   164     {
       
   165     return iUpdateStatus;
       
   166     }
       
   167 
       
   168 // -----------------------------------------------------------------------------
       
   169 // CVcxNsService::GetIap()
       
   170 // -----------------------------------------------------------------------------
       
   171 //
       
   172 EXPORT_C TUint32 CVcxNsService::GetIap()
       
   173     {
       
   174     return iIap;
       
   175     }
       
   176 
       
   177 // -----------------------------------------------------------------------------
       
   178 // CVcxNsService::GetIsReadOnlyIap()
       
   179 // -----------------------------------------------------------------------------
       
   180 //
       
   181 EXPORT_C TBool CVcxNsService::GetIsReadOnlyIap()
       
   182     {
       
   183     return iIsReadOnlyIap;
       
   184     }
       
   185 
       
   186 // -----------------------------------------------------------------------------
       
   187 // CVcxNsService::Type()
       
   188 // -----------------------------------------------------------------------------
       
   189 //
       
   190 EXPORT_C CVcxNsService::TVcxNsVodServiceType CVcxNsService::Type() const
       
   191     {
       
   192     return iType;
       
   193     }
       
   194 
       
   195 // -----------------------------------------------------------------------------
       
   196 // CVcxNsService::AccountMgmtUri
       
   197 // -----------------------------------------------------------------------------
       
   198 //
       
   199 EXPORT_C const TDesC& CVcxNsService::AccountMgmtUri()
       
   200     {
       
   201     if ( iAccountMgmtUri )
       
   202         {
       
   203         return *iAccountMgmtUri;
       
   204         }
       
   205     else
       
   206         { 
       
   207         return KNullDesC();
       
   208         }    
       
   209     }
       
   210 
       
   211 // -----------------------------------------------------------------------------
       
   212 // CVcxNsService::CustomUri
       
   213 // Get URI that can be used in browser launch
       
   214 // -----------------------------------------------------------------------------
       
   215 //
       
   216 const TDesC& CVcxNsService::CustomUri( )
       
   217     {
       
   218     if ( iCustomUri )
       
   219         {
       
   220         return *iCustomUri;
       
   221         }
       
   222     else
       
   223         { 
       
   224         return KNullDesC();
       
   225         }
       
   226     }
       
   227 
       
   228 // -----------------------------------------------------------------------------
       
   229 // CVcxNsService::SetNameL()
       
   230 // -----------------------------------------------------------------------------
       
   231 //
       
   232 void CVcxNsService::SetNameL( const TDesC& aName )
       
   233     {
       
   234     delete iName;
       
   235     iName = NULL;
       
   236     
       
   237     if( aName.Length() > 0 )
       
   238         {
       
   239         iName = aName.AllocL();
       
   240         } 
       
   241     }
       
   242 
       
   243 // -----------------------------------------------------------------------------
       
   244 // CVcxNsService::SetDescL()
       
   245 // -----------------------------------------------------------------------------
       
   246 //
       
   247 void CVcxNsService::SetDescL( const TDesC& aDesc )
       
   248     {
       
   249     delete iDescription;
       
   250     iDescription = NULL;
       
   251     
       
   252     if( aDesc.Length() > 0 )
       
   253         {
       
   254         iDescription = aDesc.AllocL();
       
   255         } 
       
   256     }
       
   257 
       
   258 // -----------------------------------------------------------------------------
       
   259 // CVcxNsService::SetIconPathL()
       
   260 // -----------------------------------------------------------------------------
       
   261 //
       
   262 void CVcxNsService::SetIconPathL(  const TDesC& aPath )
       
   263     {
       
   264     delete iIconPath;
       
   265     iIconPath = NULL;
       
   266     
       
   267     if( aPath.Length() > 0 )
       
   268         {
       
   269         iIconPath = aPath.AllocL();
       
   270         } 
       
   271     }
       
   272 
       
   273 // -----------------------------------------------------------------------------
       
   274 // CVcxNsService::SetUserNameL()
       
   275 // -----------------------------------------------------------------------------
       
   276 //
       
   277 void CVcxNsService::SetUserNameL(  const TDesC& aPath )
       
   278     {
       
   279     delete iUserName;
       
   280     iUserName = NULL;
       
   281     
       
   282     if( aPath.Length() > 0 )
       
   283         {
       
   284         iUserName = aPath.AllocL();
       
   285         } 
       
   286     }
       
   287 
       
   288 // -----------------------------------------------------------------------------
       
   289 // CVcxNsService::SetPasswordL()
       
   290 // -----------------------------------------------------------------------------
       
   291 //
       
   292 void CVcxNsService::SetPasswordL(  const TDesC& aPath )
       
   293     {
       
   294     delete iPassword;
       
   295     iPassword = NULL;
       
   296     
       
   297     if( aPath.Length() > 0 )
       
   298         {
       
   299         iPassword = aPath.AllocL();
       
   300         } 
       
   301     }
       
   302 
       
   303 // -----------------------------------------------------------------------------
       
   304 // CVcxNsService::SetServiceId()
       
   305 // -----------------------------------------------------------------------------
       
   306 //
       
   307 void CVcxNsService::SetServiceId( const TUint32 aServiceId )
       
   308     {
       
   309     iServiceId = aServiceId;
       
   310     }
       
   311 
       
   312 // -----------------------------------------------------------------------------
       
   313 // CVcxNsService::SetUpdateTime()
       
   314 // -----------------------------------------------------------------------------
       
   315 //
       
   316 void CVcxNsService::SetUpdateTime( const TTime aUpdateTime )
       
   317     {
       
   318     iUpdateTime = aUpdateTime;
       
   319     }
       
   320 
       
   321 // -----------------------------------------------------------------------------
       
   322 // CVcxNsService::SetUpdateStatus()
       
   323 // -----------------------------------------------------------------------------
       
   324 //
       
   325 void CVcxNsService::SetUpdateStatus( const TServiceUpdateStatus aUpdateStatus )
       
   326     {
       
   327 #ifdef _DEBUG    
       
   328     IPTVLOGSTRING2_LOW_LEVEL("CVcxNsService::SetUpdateStatus for service: %d ", iServiceId );
       
   329 
       
   330     switch ( aUpdateStatus )
       
   331         {
       
   332         case ENotUpdating:
       
   333             IPTVLOGSTRING_LOW_LEVEL("ENotUpdating");
       
   334             break;
       
   335         case EUpdatePending:
       
   336             IPTVLOGSTRING_LOW_LEVEL("EUpdatePending");
       
   337             break;
       
   338         case EStartingPending:
       
   339             IPTVLOGSTRING_LOW_LEVEL("EStartingPending");
       
   340             break;
       
   341         case EUpdateOngoing:
       
   342             IPTVLOGSTRING_LOW_LEVEL("EUpdateOngoing");
       
   343             break;
       
   344         case EUpdateFailed:
       
   345             IPTVLOGSTRING_LOW_LEVEL("EUpdateFailed");
       
   346             break;
       
   347         default:
       
   348             break;
       
   349         }
       
   350 #endif
       
   351     iUpdateStatus = aUpdateStatus;
       
   352     }
       
   353 
       
   354 // -----------------------------------------------------------------------------
       
   355 // CVcxNsService::SetIap()
       
   356 // -----------------------------------------------------------------------------
       
   357 //
       
   358 void CVcxNsService::SetIap( const TUint32 aIap )
       
   359     {
       
   360     iIap = aIap;
       
   361     }
       
   362 
       
   363 // -----------------------------------------------------------------------------
       
   364 // CVcxNsService::SetIsReadOnlyIap()
       
   365 // -----------------------------------------------------------------------------
       
   366 //
       
   367 void CVcxNsService::SetIsReadOnlyIap( const TBool aIsReadOnlyIap )
       
   368     {
       
   369     iIsReadOnlyIap = aIsReadOnlyIap;
       
   370     }
       
   371 
       
   372 // -----------------------------------------------------------------------------
       
   373 // CVcxNsService::SetUriL
       
   374 // Set URI that can be used in browser launch.
       
   375 // -----------------------------------------------------------------------------
       
   376 //
       
   377 void CVcxNsService::SetCustomUriL( const TDesC& aCustomUri )
       
   378     {
       
   379     delete iCustomUri;
       
   380     iCustomUri = NULL;
       
   381 
       
   382     iCustomUri = aCustomUri.AllocL();
       
   383     }
       
   384 
       
   385 // -----------------------------------------------------------------------------
       
   386 // Set service type
       
   387 // -----------------------------------------------------------------------------
       
   388 //
       
   389 void CVcxNsService::SetType( const TVcxNsVodServiceType aType )
       
   390     {
       
   391     iType = aType;
       
   392     }
       
   393 
       
   394 // -----------------------------------------------------------------------------
       
   395 // CVcxNsService::SetAccountMgmtUriL
       
   396 // -----------------------------------------------------------------------------
       
   397 //
       
   398 void CVcxNsService::SetAccountMgmtUriL( const TDesC& aAccountMgmtUri )
       
   399     {
       
   400     delete iAccountMgmtUri;
       
   401     iAccountMgmtUri = NULL;
       
   402     
       
   403     if ( aAccountMgmtUri.Length() > 0 )
       
   404         {
       
   405         iAccountMgmtUri = aAccountMgmtUri.AllocL();
       
   406         }
       
   407     }
       
   408 
       
   409 // -----------------------------------------------------------------------------
       
   410 // Set group id
       
   411 // -----------------------------------------------------------------------------
       
   412 //
       
   413 void CVcxNsService::SetGroupId( TUint32 aGroupId )
       
   414     {
       
   415     iGroupId = aGroupId;
       
   416     }
       
   417 
       
   418 // -----------------------------------------------------------------------------
       
   419 // Get group id
       
   420 // -----------------------------------------------------------------------------
       
   421 //
       
   422 TUint32 CVcxNsService::GroupId()
       
   423     {
       
   424     return iGroupId;
       
   425     }
       
   426 
       
   427 // -----------------------------------------------------------------------------
       
   428 // Add service to service group
       
   429 // -----------------------------------------------------------------------------
       
   430 //
       
   431 void CVcxNsService::AddSubServiceL( CVcxNsService* aSubService )
       
   432     {
       
   433     if ( iType != EVcxNsMainGroup || !aSubService )
       
   434         {
       
   435         User::Leave( KErrArgument );
       
   436         }
       
   437 
       
   438     iServiceGroup.AppendL( aSubService );
       
   439     }
       
   440 
       
   441 // -----------------------------------------------------------------------------
       
   442 // Get service group
       
   443 // -----------------------------------------------------------------------------
       
   444 //
       
   445 RPointerArray<CVcxNsService>& CVcxNsService::ServiceGroup()
       
   446     {
       
   447     return iServiceGroup;
       
   448     }
       
   449 
       
   450 // -----------------------------------------------------------------------------
       
   451 // Set highlight index
       
   452 // -----------------------------------------------------------------------------
       
   453 //
       
   454 void CVcxNsService::SetHighlightCategoryIndex( TInt aIndex )
       
   455     {
       
   456     iHighlightIndex = aIndex;
       
   457     }
       
   458 
       
   459 // -----------------------------------------------------------------------------
       
   460 // Get highlighted index
       
   461 // -----------------------------------------------------------------------------
       
   462 //
       
   463 TInt CVcxNsService::HighlightCategoryIndex()
       
   464     {
       
   465     return iHighlightIndex;
       
   466     }