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