dosservices/dosserver/src/doswaitingevent.cpp
changeset 0 4e1aa6a622a0
equal deleted inserted replaced
-1:000000000000 0:4e1aa6a622a0
       
     1 /*
       
     2 * Copyright (c) 2002 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: 
       
    15 *    Implementation for the CDosWaitingEvent class
       
    16 *
       
    17 */
       
    18 
       
    19 
       
    20 #include "doswaitingevent.h"
       
    21 
       
    22 //
       
    23 // ---------------------------------------------------------
       
    24 // CDosWaitingEvent Constructor
       
    25 // ---------------------------------------------------------
       
    26 //  
       
    27 
       
    28 CDosWaitingEvent::CDosWaitingEvent()
       
    29 {
       
    30 	iParameter = NULL;
       
    31 	iQueueCount = 0;
       
    32 }
       
    33 
       
    34 //
       
    35 // ---------------------------------------------------------
       
    36 // CDosWaitingEvent Destructor
       
    37 // ---------------------------------------------------------
       
    38 //  
       
    39 
       
    40 CDosWaitingEvent::~CDosWaitingEvent()
       
    41 {
       
    42 	if(iParameter)
       
    43 	{
       
    44 		delete iParameter;
       
    45 	}
       
    46 }
       
    47 
       
    48 //
       
    49 // ---------------------------------------------------------
       
    50 // CDosWaitingEvent::AddMeToQueue
       
    51 // ---------------------------------------------------------
       
    52 //  
       
    53 	
       
    54 void CDosWaitingEvent::AddMeToQueue(TSglQue<CDosWaitingEvent>& aQueue)
       
    55 {
       
    56 	aQueue.AddLast(*this);
       
    57 	iQueueCount++;
       
    58 }
       
    59 
       
    60 //
       
    61 // ---------------------------------------------------------
       
    62 // CDosWaitingEvent:RemoveMeFromQueue
       
    63 // ---------------------------------------------------------
       
    64 //  
       
    65 
       
    66 void CDosWaitingEvent::RemoveMeFromQueueD(TSglQue<CDosWaitingEvent>& aQueue)
       
    67 {
       
    68 	if(iQueueCount>0)
       
    69 	{
       
    70 		aQueue.Remove(*this);
       
    71 		iQueueCount--;
       
    72 		if(iQueueCount==0)
       
    73 		{
       
    74 			delete this;
       
    75 		}
       
    76 	}
       
    77 }
       
    78 
       
    79 //
       
    80 // ---------------------------------------------------------
       
    81 // CDosWaitingEvent::SetParameterL
       
    82 //
       
    83 // This version is used when the RDosEventSnd call was used
       
    84 // to initiate the event.
       
    85 // ---------------------------------------------------------
       
    86 //  
       
    87 
       
    88 void CDosWaitingEvent::SetParameterL(const RMessage2& aMessage)
       
    89 {
       
    90 	if(aMessage.Int2()>0)
       
    91 	{
       
    92 		iParameter = HBufC8::NewL(aMessage.Int2());
       
    93 		TPtr8 parPtr(iParameter->Des());
       
    94 		aMessage.ReadL(1, parPtr);
       
    95 	}
       
    96 }
       
    97 
       
    98 //
       
    99 // ---------------------------------------------------------
       
   100 // CDosWaitingEvent::SetParameterL
       
   101 //
       
   102 // This version is used when the CDosEventManager class was
       
   103 // used to raise the event.
       
   104 // ---------------------------------------------------------
       
   105 //  
       
   106 
       
   107 void CDosWaitingEvent::SetParameterL(TAny* aParameter,TInt aParLength)
       
   108 {
       
   109 	if(aParLength>0)
       
   110 	{
       
   111 		iParameter = HBufC8::NewL(aParLength);
       
   112 		TPtr8 parPtr(iParameter->Des());
       
   113 		parPtr.Copy(static_cast<TUint8*>(aParameter),aParLength);
       
   114 	}
       
   115 }