PECengine/PresenceManager2/SrcNWSessionSlot/CPEngNWSessionSlotEventEntry.cpp
changeset 0 094583676ce7
equal deleted inserted replaced
-1:000000000000 0:094583676ce7
       
     1 /*
       
     2 * Copyright (c) 2004 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:  Tracked Presence ID entry.
       
    15 *
       
    16 */
       
    17 
       
    18 // INCLUDE FILES
       
    19 #include "CPEngNWSessionSlotEventEntry.h"
       
    20 #include "CPEngSessionSlotEvent.h"
       
    21 #include "CPEngNWSessionSlotID2Imp.h"
       
    22 #include <CPEngNWSessionSlotID2.h>
       
    23 #include <E32Std.h>
       
    24 
       
    25 
       
    26 
       
    27 // ============================ MEMBER FUNCTIONS ===============================
       
    28 
       
    29 // -----------------------------------------------------------------------------
       
    30 // CPEngNWSessionSlotEventEntry::NewL()
       
    31 // Two-phased constructor.
       
    32 // -----------------------------------------------------------------------------
       
    33 //
       
    34 CPEngNWSessionSlotEventEntry* CPEngNWSessionSlotEventEntry::NewL()
       
    35     {
       
    36     CPEngNWSessionSlotEventEntry* self = new ( ELeave ) CPEngNWSessionSlotEventEntry;
       
    37     CleanupStack::PushL( self );
       
    38     self->iNWSessionSlotID = CPEngNWSessionSlotID2::NewL();
       
    39     CleanupStack::Pop( self );
       
    40     return self;
       
    41     }
       
    42 
       
    43 
       
    44 
       
    45 
       
    46 // Destructor
       
    47 CPEngNWSessionSlotEventEntry::~CPEngNWSessionSlotEventEntry()
       
    48     {
       
    49     delete iNWSessionSlotID;
       
    50     delete iEventDescBuf;
       
    51     }
       
    52 
       
    53 
       
    54 // -----------------------------------------------------------------------------
       
    55 // CPEngNWSessionSlotEventEntry::CPEngNWSessionSlotEventEntry
       
    56 // C++ default constructor can NOT contain any code, that
       
    57 // might leave.
       
    58 // -----------------------------------------------------------------------------
       
    59 //
       
    60 CPEngNWSessionSlotEventEntry::CPEngNWSessionSlotEventEntry()
       
    61     {
       
    62     }
       
    63 
       
    64 
       
    65 // -----------------------------------------------------------------------------
       
    66 // CPEngNWSessionSlotEventEntry::CopyL()
       
    67 // -----------------------------------------------------------------------------
       
    68 //
       
    69 void CPEngNWSessionSlotEventEntry::CopyL( const CPEngNWSessionSlotEventEntry& aSource )
       
    70     {
       
    71     CPEngNWSessionSlotID2* newId = aSource.iNWSessionSlotID->CloneL();
       
    72     delete iNWSessionSlotID;
       
    73     iNWSessionSlotID = newId;
       
    74 
       
    75     iEvent = aSource.iEvent;
       
    76     iNWSessionSlotState = aSource.iNWSessionSlotState;
       
    77     iCSPSessionState = aSource.iCSPSessionState;
       
    78     iEventInt = aSource.iEventInt;
       
    79 
       
    80     //Carefully with the additional buffer.
       
    81     //Source may not always have the buffer, but
       
    82     //the TPtrC points always to valid data...
       
    83     HBufC* newBuf = aSource.iEventDesc.AllocL();
       
    84     delete iEventDescBuf;
       
    85     iEventDescBuf = newBuf;
       
    86     iEventDesc.Set( *iEventDescBuf );
       
    87     }
       
    88 
       
    89 
       
    90 
       
    91 // -----------------------------------------------------------------------------
       
    92 // CPEngNWSessionSlotEventEntry::SetFullEventReferenceL()
       
    93 // -----------------------------------------------------------------------------
       
    94 //
       
    95 void CPEngNWSessionSlotEventEntry::SetFullEventReferenceL( const CPEngSessionSlotEvent& aInternalEvent )
       
    96     {
       
    97     iNWSessionSlotID->Implementation()->SetAllL( aInternalEvent.SessionSlotIndentification(),
       
    98                                                  aInternalEvent.ApplicationId() );
       
    99 
       
   100     iEvent = aInternalEvent.Event();
       
   101     iNWSessionSlotState = aInternalEvent.AppSessSltState();
       
   102     iCSPSessionState = aInternalEvent.GlobSessSltState();
       
   103     iEventInt = aInternalEvent.EventInt();
       
   104 
       
   105     iEventDesc.Set( aInternalEvent.EventDesc() );
       
   106     }
       
   107 
       
   108 
       
   109 // -----------------------------------------------------------------------------
       
   110 // CPEngNWSessionSlotEventEntry::SetPseudoEventReferenceL()
       
   111 // -----------------------------------------------------------------------------
       
   112 //
       
   113 void CPEngNWSessionSlotEventEntry::SetPseudoEventReferenceL(
       
   114     const CPEngSessionSlotId& aBasePart,
       
   115     const TDesC& aAppId,
       
   116     TPEngNWSessionSlotState aAppState,
       
   117     TPEngNWSessionSlotState aCSPState )
       
   118     {
       
   119     //valid parts
       
   120     iNWSessionSlotID->Implementation()->SetAllL( aBasePart, aAppId );
       
   121     iNWSessionSlotState = aAppState;
       
   122     iCSPSessionState = aCSPState;
       
   123 
       
   124     //Pseudo data
       
   125     iEvent = EPEngEventNone;
       
   126     iEventInt = KErrNotFound;
       
   127     iEventDesc.Set( NULL, 0 );
       
   128     }
       
   129 
       
   130 
       
   131 
       
   132 // -----------------------------------------------------------------------------
       
   133 // CPEngNWSessionSlotEventEntry::ResetReferences()
       
   134 // -----------------------------------------------------------------------------
       
   135 //
       
   136 void CPEngNWSessionSlotEventEntry::ResetReferences()
       
   137     {
       
   138     iNWSessionSlotID->Implementation()->Reset();
       
   139     iEventDesc.Set( NULL, 0 );
       
   140     delete iEventDescBuf;
       
   141     iEventDescBuf = NULL;
       
   142     }
       
   143 
       
   144 
       
   145 
       
   146 //  End of File
       
   147