phoneclientserver/phoneclient/Src/ExtCall/ExtCall_Aiw/CPhCltExtPhoneDialData.cpp
changeset 0 ff3b6d0fd310
child 19 7d48bed6ce0c
equal deleted inserted replaced
-1:000000000000 0:ff3b6d0fd310
       
     1 /*
       
     2 * Copyright (c) 2002-2007 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 "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:  Ext Phone Dial Data.
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 
       
    20 // INCLUDE FILES
       
    21 #include "CPhCltExtPhoneDialData.h"
       
    22 #include <cphcltdialdata.h>
       
    23 
       
    24 
       
    25 // ============================ MEMBER FUNCTIONS ===============================
       
    26 
       
    27 
       
    28 // -----------------------------------------------------------------------------
       
    29 // CPhCltExtPhoneDialData::CPhCltExtPhoneDialData
       
    30 // C++ default constructor can NOT contain any code, that
       
    31 // might leave.
       
    32 // -----------------------------------------------------------------------------
       
    33 //
       
    34 CPhCltExtPhoneDialData::CPhCltExtPhoneDialData()
       
    35     : CPhCltDialData()
       
    36     { 
       
    37     iRedialMaximumDuration = 0;      
       
    38     }
       
    39 
       
    40 
       
    41 // ---------------------------------------------------------------------------
       
    42 // 
       
    43 // Symbian OS constructor
       
    44 // 
       
    45 // ---------------------------------------------------------------------------
       
    46 //
       
    47 void CPhCltExtPhoneDialData::ConstructL()
       
    48     {
       
    49     CPhCltDialData::ConstructL();
       
    50     }
       
    51 
       
    52 // ---------------------------------------------------------------------------
       
    53 // 
       
    54 // Symbian OS constructor  
       
    55 // Initialises the member data from package.
       
    56 //
       
    57 // ---------------------------------------------------------------------------
       
    58 //
       
    59 void CPhCltExtPhoneDialData::ConstructL(
       
    60     const TDesC8& aPackage ) 
       
    61     {
       
    62     RDesReadStream stream( aPackage );
       
    63     CleanupClosePushL( stream );
       
    64     
       
    65     stream >> iTelNumber;
       
    66     iCallType = static_cast<TPhCltCallType>( stream.ReadInt32L() );
       
    67     stream >> iName;
       
    68     iWindowGroup = stream.ReadInt32L();
       
    69     iRedial = stream.ReadInt32L();
       
    70     iRedialMaximumDuration = stream.ReadInt32L();
       
    71     ReadDescriptorFromStreamL( stream, iContactLink );
       
    72     stream >> iSubAddress;
       
    73     iShowNumber = stream.ReadInt32L();
       
    74     iAllowMatch = stream.ReadInt32L();
       
    75     iSATCall = stream.ReadInt32L(); 
       
    76     iEndOtherCalls = stream.ReadInt32L();
       
    77     stream >> iBearer;
       
    78     iSendKey = stream.ReadInt32L();
       
    79     iReturnToNumberEntryOnFailure = stream.ReadInt32L();
       
    80     iInitCall = stream.ReadInt32L();
       
    81     iFlags = stream.ReadUint32L();
       
    82     iServiceId = stream.ReadUint32L();
       
    83     ReadDescriptorFromStreamL( stream, iUUI );
       
    84     CleanupStack::PopAndDestroy( 1 ); // stream;
       
    85     }
       
    86 // -----------------------------------------------------------------------------
       
    87 // CPhCltExtPhoneDialData::NewL
       
    88 // Two-phased constructor.
       
    89 // -----------------------------------------------------------------------------
       
    90 //
       
    91 EXPORT_C CPhCltExtPhoneDialData* CPhCltExtPhoneDialData::NewL()
       
    92     {
       
    93     CPhCltExtPhoneDialData* self = CPhCltExtPhoneDialData::NewLC();
       
    94     CleanupStack::Pop( self );
       
    95     return self;
       
    96     }
       
    97 
       
    98 // -----------------------------------------------------------------------------
       
    99 // CPhCltExtPhoneDialData::NewLC
       
   100 // Two-phased constructor.
       
   101 // -----------------------------------------------------------------------------
       
   102 //
       
   103 EXPORT_C CPhCltExtPhoneDialData* CPhCltExtPhoneDialData::NewLC(  )
       
   104     {
       
   105     CPhCltExtPhoneDialData* self = new( ELeave ) CPhCltExtPhoneDialData;
       
   106     CleanupStack::PushL( self );
       
   107     self->ConstructL();
       
   108     return self;
       
   109     }
       
   110     
       
   111 // ---------------------------------------------------------------------------
       
   112 // 
       
   113 // First phase constructor
       
   114 // Initialises the member data from package.
       
   115 // 
       
   116 // --------------------------------------------------------------------------- 
       
   117 //    
       
   118 EXPORT_C CPhCltExtPhoneDialData* CPhCltExtPhoneDialData::NewL( 
       
   119     const TDesC8& aPackage )
       
   120     {
       
   121     CPhCltExtPhoneDialData* self = CPhCltExtPhoneDialData::NewLC( aPackage );
       
   122     CleanupStack::Pop( self );
       
   123     return self;
       
   124     }
       
   125     
       
   126 // ---------------------------------------------------------------------------
       
   127 // 
       
   128 // First phase constructor
       
   129 // Initialises the member data from package.
       
   130 // 
       
   131 // --------------------------------------------------------------------------- 
       
   132 //
       
   133 EXPORT_C CPhCltExtPhoneDialData* CPhCltExtPhoneDialData::NewLC(
       
   134     const TDesC8& aPackage )
       
   135     {
       
   136     CPhCltExtPhoneDialData* self = new( ELeave ) CPhCltExtPhoneDialData;
       
   137     CleanupStack::PushL( self );
       
   138     self->ConstructL( aPackage );
       
   139     return self;
       
   140     }
       
   141 
       
   142 // Destructor
       
   143 EXPORT_C CPhCltExtPhoneDialData::~CPhCltExtPhoneDialData()
       
   144     {
       
   145     }
       
   146 
       
   147 
       
   148  // Access - Setters  
       
   149  
       
   150 // ---------------------------------------------------------------------------
       
   151 // Sets allow match.
       
   152 // ---------------------------------------------------------------------------
       
   153 //   
       
   154 EXPORT_C void CPhCltExtPhoneDialData::SetAllowMatch( TBool aAllowMatch ) 
       
   155     {
       
   156     iAllowMatch = aAllowMatch;
       
   157     }
       
   158 
       
   159 // ---------------------------------------------------------------------------
       
   160 // Sets bearer.
       
   161 // ---------------------------------------------------------------------------
       
   162 EXPORT_C void CPhCltExtPhoneDialData::SetBearerL ( 
       
   163 const TPhCltBearerCapability& aBearer )
       
   164     {
       
   165     iBearer = aBearer;
       
   166     }
       
   167     
       
   168 // ---------------------------------------------------------------------------
       
   169 // Sets call type.
       
   170 // ---------------------------------------------------------------------------
       
   171 //   
       
   172 EXPORT_C void CPhCltExtPhoneDialData::SetCallType( TPhCltCallType aCallType ) 
       
   173     {
       
   174     iCallType = aCallType;
       
   175     }
       
   176  
       
   177 // ---------------------------------------------------------------------------
       
   178 // Sets used contact link.
       
   179 // ---------------------------------------------------------------------------
       
   180 //
       
   181 EXPORT_C void CPhCltExtPhoneDialData::SetContactLinkL( const TDesC8& aContactLink ) 
       
   182     {
       
   183     CopyDescriptorToMemberDescriptorL( aContactLink, iContactLink );
       
   184     }
       
   185 
       
   186 // ---------------------------------------------------------------------------
       
   187 // Sets end other calls.
       
   188 // ---------------------------------------------------------------------------
       
   189 //
       
   190 EXPORT_C void CPhCltExtPhoneDialData::SetEndOtherCalls( TBool aEndCalls ) 
       
   191     {
       
   192     iEndOtherCalls = aEndCalls ;
       
   193     }
       
   194  
       
   195  // ---------------------------------------------------------------------------
       
   196 // Set initiate call.
       
   197 // ---------------------------------------------------------------------------
       
   198 //    
       
   199 EXPORT_C void CPhCltExtPhoneDialData::SetInitiateCall( TBool aInitCall )
       
   200     {
       
   201     iInitCall = aInitCall;
       
   202     } 
       
   203 // ---------------------------------------------------------------------------
       
   204 // Set name.
       
   205 // ---------------------------------------------------------------------------
       
   206 //    
       
   207 EXPORT_C void CPhCltExtPhoneDialData::SetNameL( const TPhCltNameBuffer& aName ) 
       
   208     {
       
   209     iName = aName;
       
   210     }
       
   211     
       
   212 // ---------------------------------------------------------------------------
       
   213 // Sets phone number.
       
   214 // ---------------------------------------------------------------------------
       
   215 //
       
   216 EXPORT_C void CPhCltExtPhoneDialData::SetTelephoneNumber(
       
   217     const TPhCltTelephoneNumber& aNumber ) 
       
   218     {
       
   219     iTelNumber = aNumber;
       
   220     }
       
   221   
       
   222 // ---------------------------------------------------------------------------
       
   223 // Sets redial value.
       
   224 // ---------------------------------------------------------------------------
       
   225 //    
       
   226 EXPORT_C void CPhCltExtPhoneDialData::SetRedial( TInt aRedial ) 
       
   227     {
       
   228     iRedial = aRedial;
       
   229     }
       
   230     
       
   231 // ---------------------------------------------------------------------------
       
   232 // Sets redial max duration time.
       
   233 // ---------------------------------------------------------------------------
       
   234 //
       
   235 EXPORT_C void CPhCltExtPhoneDialData::SetRedialMaximumDuration( 
       
   236     TTimeIntervalSeconds aMaximumRedialDuration ) 
       
   237     {
       
   238     iRedialMaximumDuration = aMaximumRedialDuration;
       
   239     }
       
   240   
       
   241 // ---------------------------------------------------------------------------
       
   242 // Sets SAT call.
       
   243 // ---------------------------------------------------------------------------
       
   244 //
       
   245 EXPORT_C void CPhCltExtPhoneDialData::SetSATCall( TBool aIsSATCall ) 
       
   246     {
       
   247     iSATCall = aIsSATCall;
       
   248     }
       
   249 
       
   250 // -----------------------------------------------------------------------------
       
   251 // SetSendKeyPressed
       
   252 // 
       
   253 // 
       
   254 // -----------------------------------------------------------------------------
       
   255 //
       
   256 EXPORT_C void CPhCltExtPhoneDialData::SetSendKeyPressed( TBool aSendKey )
       
   257     {
       
   258     iSendKey = aSendKey;
       
   259     }
       
   260 
       
   261 // ---------------------------------------------------------------------------
       
   262 // Set show number.
       
   263 // ---------------------------------------------------------------------------
       
   264 //    
       
   265 EXPORT_C void CPhCltExtPhoneDialData::SetShowNumber( TBool aShowNumber ) 
       
   266     {
       
   267     iShowNumber = aShowNumber;
       
   268     } 
       
   269     
       
   270 // ---------------------------------------------------------------------------
       
   271 // Sets SubAddress for SAT call.
       
   272 // ---------------------------------------------------------------------------
       
   273 EXPORT_C void CPhCltExtPhoneDialData::SetSubAddressL( 
       
   274     const TPhCltSubAddress& aSubAddress )
       
   275     {
       
   276     iSubAddress = aSubAddress;
       
   277     }
       
   278     
       
   279 // ---------------------------------------------------------------------------
       
   280 // Sets window group.
       
   281 // ---------------------------------------------------------------------------
       
   282 //    
       
   283 EXPORT_C void CPhCltExtPhoneDialData::SetWindowGroup( TInt aWindowGroup ) 
       
   284     {
       
   285     iWindowGroup = aWindowGroup;
       
   286     }
       
   287   
       
   288 // ---------------------------------------------------------------------------
       
   289 // Sets window group.
       
   290 // ---------------------------------------------------------------------------
       
   291 //
       
   292 EXPORT_C void CPhCltExtPhoneDialData::SetUUIL( const TDesC& aUUI )
       
   293     {
       
   294     CopyDescriptorToMemberDescriptorL( aUUI, iUUI );
       
   295     }
       
   296 
       
   297 // Access - Getters 
       
   298 
       
   299 // ---------------------------------------------------------------------------
       
   300 // Return allow match.
       
   301 // ---------------------------------------------------------------------------
       
   302 //   
       
   303 EXPORT_C TBool CPhCltExtPhoneDialData::AllowMatch() const 
       
   304     {
       
   305     return iAllowMatch;
       
   306     }
       
   307     
       
   308 // ---------------------------------------------------------------------------
       
   309 // Returns bearer.
       
   310 // ---------------------------------------------------------------------------
       
   311 //
       
   312 EXPORT_C const TPhCltBearerCapability& CPhCltExtPhoneDialData::Bearer() const
       
   313     {
       
   314     return iBearer;
       
   315     }
       
   316     
       
   317 // ---------------------------------------------------------------------------
       
   318 // Returns call type.
       
   319 // ---------------------------------------------------------------------------
       
   320 //    
       
   321 EXPORT_C TPhCltCallType  CPhCltExtPhoneDialData::CallType() const 
       
   322     {
       
   323     return iCallType;
       
   324     }
       
   325 
       
   326 // ---------------------------------------------------------------------------
       
   327 // Return contact link.
       
   328 // ---------------------------------------------------------------------------
       
   329 //    
       
   330 EXPORT_C const TDesC8& CPhCltExtPhoneDialData::ContactLink() const 
       
   331     {
       
   332     return *iContactLink;
       
   333     } 
       
   334      
       
   335 // ---------------------------------------------------------------------------
       
   336 // Returns end other calls value.
       
   337 // ---------------------------------------------------------------------------
       
   338 //
       
   339 EXPORT_C TBool CPhCltExtPhoneDialData::EndOtherCalls() const
       
   340     {
       
   341     return iEndOtherCalls;
       
   342     }
       
   343     
       
   344 // ---------------------------------------------------------------------------
       
   345 // Returns initiate call.
       
   346 // ---------------------------------------------------------------------------
       
   347 //
       
   348 EXPORT_C TBool CPhCltExtPhoneDialData::InitiateCall() const 
       
   349     {
       
   350     return iInitCall;
       
   351     } 
       
   352     
       
   353 // ---------------------------------------------------------------------------
       
   354 // Returns name.
       
   355 // ---------------------------------------------------------------------------
       
   356 //
       
   357 EXPORT_C const TPhCltNameBuffer& CPhCltExtPhoneDialData::Name() const 
       
   358     {
       
   359     return iName;
       
   360     }
       
   361 
       
   362 // ---------------------------------------------------------------------------
       
   363 // Returns phone number.
       
   364 // ---------------------------------------------------------------------------
       
   365 //    
       
   366 EXPORT_C const TPhCltTelephoneNumber& CPhCltExtPhoneDialData::TelephoneNumber() const 
       
   367     {
       
   368     return iTelNumber;    
       
   369     }
       
   370 
       
   371 // ---------------------------------------------------------------------------
       
   372 // Return redial value.
       
   373 // ---------------------------------------------------------------------------
       
   374 //    
       
   375 EXPORT_C TInt CPhCltExtPhoneDialData::Redial() const 
       
   376     {
       
   377     return iRedial;
       
   378     }
       
   379 // ---------------------------------------------------------------------------
       
   380 // Returns redial max duration.
       
   381 // ---------------------------------------------------------------------------
       
   382 //
       
   383 EXPORT_C const TTimeIntervalSeconds CPhCltExtPhoneDialData::RedialMaximumDuration() const
       
   384     {
       
   385     return iRedialMaximumDuration;
       
   386     }   
       
   387 
       
   388 // ---------------------------------------------------------------------------
       
   389 // Returns SAT call value.
       
   390 // ---------------------------------------------------------------------------
       
   391 //
       
   392 EXPORT_C TBool CPhCltExtPhoneDialData::SATCall() const
       
   393     {
       
   394     return iSATCall;    
       
   395     }
       
   396     
       
   397  // -----------------------------------------------------------------------------
       
   398 // SendKeyPressed
       
   399 // 
       
   400 // 
       
   401 // -----------------------------------------------------------------------------
       
   402 //
       
   403 EXPORT_C TBool CPhCltExtPhoneDialData::SendKeyPressed() const
       
   404     {
       
   405     return iSendKey;
       
   406     }
       
   407         
       
   408 // ---------------------------------------------------------------------------
       
   409 // Returns show number.
       
   410 // ---------------------------------------------------------------------------
       
   411 //   
       
   412 EXPORT_C TBool CPhCltExtPhoneDialData::ShowNumber() const 
       
   413     {
       
   414     return iShowNumber;
       
   415     }
       
   416     
       
   417 // ---------------------------------------------------------------------------
       
   418 // Returns subaddress.
       
   419 // ---------------------------------------------------------------------------
       
   420 //   
       
   421 EXPORT_C const TPhCltSubAddress& CPhCltExtPhoneDialData::SubAddress() const
       
   422     {
       
   423     return iSubAddress;
       
   424     }
       
   425     
       
   426 // ---------------------------------------------------------------------------
       
   427 // Return window group.
       
   428 // ---------------------------------------------------------------------------
       
   429 //    
       
   430 EXPORT_C TInt CPhCltExtPhoneDialData::WindowGroup() const
       
   431     {
       
   432     return iWindowGroup;
       
   433     }
       
   434     
       
   435 // ---------------------------------------------------------------------------
       
   436 // Return user to user information
       
   437 // ---------------------------------------------------------------------------
       
   438 //      
       
   439 EXPORT_C const TDesC& CPhCltExtPhoneDialData::UUI() const 
       
   440     {
       
   441     return *iUUI;
       
   442     }
       
   443  
       
   444  // Other member functions   
       
   445 
       
   446 // ---------------------------------------------------------------------------
       
   447 // Calculates the size of descriptor in package. Note that to retreave 
       
   448 // a descriptor from stream in ConstructL we need to know the size of a
       
   449 // descriptor in order to allocate right size descriptor. This is the reason
       
   450 // for adding sizeof( int ) to descriptor length.
       
   451 // ---------------------------------------------------------------------------
       
   452 // 
       
   453 TInt CPhCltExtPhoneDialData::CalculateDescriptorSize( const TDesC& aDescriptor ) const 
       
   454     {
       
   455     // sizeof( TInt ) is for the length of a descriptor.
       
   456     return sizeof( TInt ) + aDescriptor.Length() * 2; // unicode takes 2 bytes.
       
   457     }
       
   458     
       
   459 // ---------------------------------------------------------------------------
       
   460 // Calculates the size of descriptor in package. Note that to retreave 
       
   461 // a descriptor from stream in ConstructL we need to know the size of a
       
   462 // descriptor in order to allocate right size descriptor. This is the reason
       
   463 // for adding sizeof( int ) to descriptor length.
       
   464 // ---------------------------------------------------------------------------
       
   465 // 
       
   466 TInt CPhCltExtPhoneDialData::CalculateDescriptorSize( const TDesC8& aDescriptor ) const 
       
   467     {
       
   468     // sizeof( TInt ) is for the length of a descriptor in stream
       
   469     return sizeof( TInt ) + aDescriptor.Length();
       
   470     }   
       
   471     
       
   472 // ---------------------------------------------------------------------------
       
   473 // Calculates the size of all member data.
       
   474 // ---------------------------------------------------------------------------
       
   475 //
       
   476 EXPORT_C TInt CPhCltExtPhoneDialData::CalculatePackageSize() const
       
   477     {
       
   478     TInt packageSize = 0;
       
   479     packageSize += CalculateDescriptorSize( iTelNumber );
       
   480     packageSize += sizeof( iCallType );
       
   481     packageSize += CalculateDescriptorSize( iName );
       
   482     packageSize += sizeof( iWindowGroup );
       
   483     packageSize += sizeof( iRedial );
       
   484     packageSize+=sizeof( iRedialMaximumDuration.Int() );
       
   485     packageSize += CalculateDescriptorSize( *iContactLink );
       
   486     packageSize += CalculateDescriptorSize( iSubAddress );
       
   487     packageSize += sizeof( iShowNumber);
       
   488     packageSize += sizeof( iAllowMatch );
       
   489     packageSize += sizeof( iSATCall );
       
   490     packageSize += sizeof( iEndOtherCalls );
       
   491     packageSize += CalculateDescriptorSize( iBearer );
       
   492     packageSize += sizeof (iSendKey );
       
   493     packageSize += sizeof( iReturnToNumberEntryOnFailure);
       
   494     packageSize += sizeof (iInitCall );
       
   495     packageSize += sizeof( iFlags );
       
   496     packageSize += sizeof( iServiceId );
       
   497     packageSize += CalculateDescriptorSize( *iUUI );
       
   498     return packageSize;
       
   499     }
       
   500     
       
   501 // ---------------------------------------------------------------------------
       
   502 // Checks that descriptorLength is not longer than maximum allowed descriptor
       
   503 // length.
       
   504 // ---------------------------------------------------------------------------
       
   505 //   
       
   506 void CPhCltExtPhoneDialData::CheckDescriptorMaxLengthL( 
       
   507     TInt aDescriptorLength, TInt aMaxAllowedDescriptorLength ) const
       
   508     {
       
   509     if( aDescriptorLength > aMaxAllowedDescriptorLength )
       
   510         {
       
   511         User::Leave( KErrArgument );
       
   512         }
       
   513     }
       
   514 
       
   515 // ---------------------------------------------------------------------------
       
   516 // Copies aSource descriptor to aMemberDescriptor. This quarantees that member
       
   517 // descriptor will be valid even if the allocation fails.
       
   518 // ---------------------------------------------------------------------------
       
   519 //   
       
   520 void CPhCltExtPhoneDialData::CopyDescriptorToMemberDescriptorL( 
       
   521     const TDesC& aSource, 
       
   522     HBufC*& aMemberDescriptor )
       
   523     {
       
   524     HBufC* temp = aSource.AllocL();
       
   525     delete aMemberDescriptor;
       
   526     aMemberDescriptor = temp;
       
   527     }
       
   528 
       
   529 // ---------------------------------------------------------------------------
       
   530 // Copies aSource descriptor to aMemberDescriptor. This quarantees that member
       
   531 // descriptor will be valid even if the allocation fails.
       
   532 // ---------------------------------------------------------------------------
       
   533 //       
       
   534 void CPhCltExtPhoneDialData::CopyDescriptorToMemberDescriptorL( 
       
   535     const TDesC8& aSource, 
       
   536     HBufC8*& aMemberDescriptor )
       
   537     {
       
   538     HBufC8* temp = aSource.AllocL();
       
   539     delete aMemberDescriptor;
       
   540     aMemberDescriptor = temp;
       
   541     }
       
   542               
       
   543   
       
   544 // ---------------------------------------------------------------------------
       
   545 // Reads descriptor from stream.
       
   546 // ---------------------------------------------------------------------------
       
   547 //  
       
   548 void CPhCltExtPhoneDialData::ReadDescriptorFromStreamL( 
       
   549     RDesReadStream& aStream,
       
   550     HBufC8*& aDescriptor 
       
   551     )
       
   552     {
       
   553     const TInt descLength( aStream.ReadInt32L() );
       
   554     if ( aDescriptor )
       
   555         {
       
   556         delete aDescriptor;
       
   557         }
       
   558     // Not to cleanupstack, aDescriptor is member variable
       
   559     aDescriptor = HBufC8::NewL( descLength ); 
       
   560     TPtr8 ptr = aDescriptor->Des();
       
   561     aStream.ReadL( ptr, descLength );
       
   562     }    
       
   563     
       
   564 // ---------------------------------------------------------------------------
       
   565 // Reads descriptor from stream.
       
   566 // ---------------------------------------------------------------------------
       
   567 //  
       
   568 void CPhCltExtPhoneDialData::ReadDescriptorFromStreamL( 
       
   569     RDesReadStream& aStream, 
       
   570     HBufC*& aDescriptor )
       
   571     {
       
   572    const TInt descLength( aStream.ReadInt32L() );
       
   573     if ( aDescriptor )
       
   574         {
       
   575         delete aDescriptor;
       
   576         }
       
   577     // Not to cleanupstack, aDescriptor will be member variable
       
   578     aDescriptor = HBufC::NewL( descLength ); 
       
   579     TPtr16 ptr = aDescriptor->Des();
       
   580     aStream.ReadL( ptr, descLength );
       
   581     }
       
   582 
       
   583 // ---------------------------------------------------------------------------
       
   584 // Writes descriptor to stream.
       
   585 // ---------------------------------------------------------------------------
       
   586 //  
       
   587 void CPhCltExtPhoneDialData::WriteDescriptorToStreamL( 
       
   588     RDesWriteStream& aStream, 
       
   589     const TDesC8& aDescriptor ) 
       
   590     {
       
   591     aStream.WriteInt32L( aDescriptor.Length() );
       
   592     aStream.WriteL( aDescriptor );
       
   593     }
       
   594     
       
   595 // ---------------------------------------------------------------------------
       
   596 // Writes descriptor to stream.
       
   597 // ---------------------------------------------------------------------------
       
   598 //  
       
   599 void CPhCltExtPhoneDialData::WriteDescriptorToStreamL( 
       
   600     RDesWriteStream& aStream, 
       
   601     const TDesC& aDescriptor ) 
       
   602     {
       
   603     aStream.WriteInt32L( aDescriptor.Length() );
       
   604     aStream.WriteL( aDescriptor );
       
   605     }    
       
   606 
       
   607 // ---------------------------------------------------------------------------
       
   608 // Packs the member data to descriptor. Ownershipd of returned descriptor
       
   609 // is given for caller.
       
   610 // ---------------------------------------------------------------------------
       
   611 //  
       
   612 EXPORT_C HBufC8* CPhCltExtPhoneDialData::PackLC() 
       
   613     {
       
   614     HBufC8* package = HBufC8::NewLC( CalculatePackageSize() );
       
   615     
       
   616     TPtr8 des = package->Des();
       
   617     RDesWriteStream stream( des );
       
   618     
       
   619     CleanupClosePushL( stream );
       
   620 
       
   621     stream << iTelNumber;     
       
   622     stream.WriteInt32L( iCallType );       
       
   623     stream << iName;
       
   624     stream.WriteInt32L( iWindowGroup );
       
   625     stream.WriteInt32L( iRedial );
       
   626     stream.WriteInt32L( iRedialMaximumDuration.Int() );
       
   627     WriteDescriptorToStreamL( stream, *iContactLink );
       
   628     stream << iSubAddress;
       
   629     stream.WriteInt32L( iShowNumber );
       
   630     stream.WriteInt32L( iAllowMatch );
       
   631     stream.WriteInt32L( iSATCall);
       
   632     stream.WriteInt32L( iEndOtherCalls );
       
   633     stream << iBearer;
       
   634     stream.WriteInt32L( iSendKey );
       
   635     stream.WriteInt32L( iReturnToNumberEntryOnFailure );
       
   636     stream.WriteInt32L( iInitCall );
       
   637     
       
   638     
       
   639     iFlags = EPhCltCallFlagsDefault;
       
   640 
       
   641     if ( iShowNumber )
       
   642         {
       
   643         iFlags |= EPhCltCallFlagsAllowNumberShowing;
       
   644         }
       
   645 
       
   646     if ( iAllowMatch )
       
   647         {
       
   648         iFlags |= 
       
   649             EPhCltCallFlagsAllowPersonalDirectoryMatching;
       
   650         }
       
   651     if ( iEndOtherCalls )
       
   652         {
       
   653            iFlags |= EPhCltCallFlagsEndBeforeDial;
       
   654         }
       
   655 
       
   656     if ( iSATCall )
       
   657         {
       
   658         iFlags |= EPhCltCallFlagsSAT;
       
   659         }
       
   660 
       
   661     if ( ( iCallType == EPhCltVideo ) || ( iCallType == EPhCltForcedVideo  ) )
       
   662         {
       
   663         iFlags |= EPhCltCallFlagsVideoCall;
       
   664         }
       
   665 
       
   666     if ( iCallType == EPhCltCallVoIP   )
       
   667         {
       
   668         iFlags |= EPhCltCallFlagsVoIPCall;
       
   669         }
       
   670 
       
   671       
       
   672       if ( iSendKey )
       
   673         {
       
   674         iFlags |= EPhCltCallFlagsSendKey;
       
   675         }
       
   676 
       
   677     stream.WriteUint32L( iFlags );   
       
   678     stream.WriteUint32L( iServiceId );
       
   679     WriteDescriptorToStreamL( stream, *iUUI );
       
   680     stream.CommitL();
       
   681     
       
   682     CleanupStack::PopAndDestroy( 1 ); // stream
       
   683     
       
   684     return package;   
       
   685     
       
   686       }    
       
   687 
       
   688 // -----------------------------------------------------------------------------
       
   689 // CPhCltExtPhoneDialData::SetServiceId
       
   690 // 
       
   691 // 
       
   692 // -----------------------------------------------------------------------------
       
   693 //
       
   694 EXPORT_C void CPhCltExtPhoneDialData::SetServiceId( TUint32 aServiceId )
       
   695     {
       
   696     iServiceId = aServiceId;
       
   697     } 
       
   698 // -----------------------------------------------------------------------------
       
   699 // CPhCltExtPhoneDialData::ServiceId
       
   700 // 
       
   701 // 
       
   702 // -----------------------------------------------------------------------------
       
   703 //
       
   704 EXPORT_C TUint32 CPhCltExtPhoneDialData::ServiceId() const
       
   705     {
       
   706     return iServiceId;
       
   707     }
       
   708     
       
   709 // ---------------------------------------------------------------------------
       
   710 // Sets dial data values using given package
       
   711 //
       
   712 // ---------------------------------------------------------------------------
       
   713 //
       
   714 void CPhCltExtPhoneDialData::SetParamsL(
       
   715     const TDesC8& aPackage ) 
       
   716     {
       
   717     RDesReadStream stream( aPackage );
       
   718     CleanupClosePushL( stream );
       
   719     
       
   720     stream >> iTelNumber;
       
   721     iCallType = static_cast<TPhCltCallType>( stream.ReadInt32L() );
       
   722     stream >> iName;
       
   723     iWindowGroup = stream.ReadInt32L();
       
   724     iRedial = stream.ReadInt32L();
       
   725     iRedialMaximumDuration = stream.ReadInt32L();
       
   726     ReadDescriptorFromStreamL( stream, iContactLink );
       
   727     stream >> iSubAddress;
       
   728     iShowNumber = stream.ReadInt32L();
       
   729     iAllowMatch = stream.ReadInt32L();
       
   730     iSATCall = stream.ReadInt32L(); 
       
   731     iEndOtherCalls = stream.ReadInt32L();
       
   732     stream >> iBearer;
       
   733     iSendKey = stream.ReadInt32L();
       
   734     iReturnToNumberEntryOnFailure = stream.ReadInt32L();
       
   735     iInitCall = stream.ReadInt32L();
       
   736     iFlags = stream.ReadUint32L();
       
   737     iServiceId = stream.ReadUint32L();
       
   738     ReadDescriptorFromStreamL( stream, iUUI );
       
   739 
       
   740     CleanupStack::PopAndDestroy( 1 ); // stream;
       
   741     }
       
   742 //  End of File