adaptationlayer/tsy/simatktsy_dll/internal/test/simatktsy_testtool/notify/src/notifyhandler.cpp
changeset 0 63b37f68c1ce
equal deleted inserted replaced
-1:000000000000 0:63b37f68c1ce
       
     1 /*
       
     2 * Copyright (c) 2002-2006 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:   Handles notification of the active object
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 
       
    20 // INCLUDE FILES
       
    21 #include "notifyhandler.h"
       
    22 
       
    23 
       
    24 // ============================ MEMBER FUNCTIONS ===============================
       
    25 
       
    26 // -----------------------------------------------------------------------------
       
    27 // CSimAtkNotifyHandler::CSimAtkNotifyHandler
       
    28 // Standart constractor
       
    29 // -----------------------------------------------------------------------------
       
    30 //
       
    31 CSimAtkNotifyHandler::CSimAtkNotifyHandler
       
    32         (
       
    33         CSimAtkNotify* aNotify,
       
    34         CStifLogger* aNotifyLog
       
    35         ) : CActive(EPriorityStandard)												
       
    36 	{
       
    37 	iNotify = aNotify;
       
    38 	iLog = aNotifyLog;
       
    39 	iLog->Log( _L( "CSimAtkNotifyHandler::CSimAtkNotifyHandler \
       
    40 	    - Construction ongoing " ) );
       
    41 	CActiveScheduler::Add( this );
       
    42 	iLog->Log( _L( "CSimAtkNotifyHandler::CActiveScheduler " ) );	
       
    43 	}
       
    44 
       
    45 // -----------------------------------------------------------------------------
       
    46 // CSimAtkNotifyHandler::ConstructL
       
    47 // Standart ConstructL
       
    48 // -----------------------------------------------------------------------------
       
    49 //
       
    50 void CSimAtkNotifyHandler::ConstructL()
       
    51 	{
       
    52 	// No implementation needed
       
    53 	}
       
    54 
       
    55 // -----------------------------------------------------------------------------
       
    56 // CSimAtkNotifyHandler::NewL
       
    57 // Standart two way construct
       
    58 // -----------------------------------------------------------------------------
       
    59 //
       
    60 CSimAtkNotifyHandler* CSimAtkNotifyHandler::NewL
       
    61         ( 
       
    62         CSimAtkNotify* aNotify,
       
    63         CStifLogger* aNotifyLog
       
    64         )
       
    65 	{
       
    66 	CSimAtkNotifyHandler* self =
       
    67 	    new (ELeave) CSimAtkNotifyHandler( aNotify, aNotifyLog );
       
    68 	CleanupStack::PushL(self);
       
    69 	self->ConstructL();
       
    70 	CleanupStack::Pop();
       
    71 	
       
    72 	return self;	
       
    73 	}
       
    74 
       
    75 // -----------------------------------------------------------------------------
       
    76 // CSimAtkNotifyHandler::~CSimAtkNotifyHandler
       
    77 // Standart destructor
       
    78 // -----------------------------------------------------------------------------
       
    79 //
       
    80 CSimAtkNotifyHandler::~CSimAtkNotifyHandler()
       
    81     {
       
    82     Cancel();
       
    83     }
       
    84 
       
    85 // -----------------------------------------------------------------------------
       
    86 // CSimAtkNotifyHandler::Activate
       
    87 // activates active object if not active
       
    88 // -----------------------------------------------------------------------------
       
    89 //
       
    90 void CSimAtkNotifyHandler::Activate()
       
    91 	{
       
    92 	iLog->Log( _L( "CSimAtkNotifyHandler::Activate - Activating! " ) );
       
    93 	if ( !IsActive() )
       
    94 		{
       
    95 		SetActive();
       
    96 		iLog->Log( _L( "CSimAtkNotifyHandler::Activate \
       
    97 		    - Active, waiting RunL! " ) );		
       
    98 		}		
       
    99 	}
       
   100 	
       
   101 // -----------------------------------------------------------------------------
       
   102 // CSimAtkNotifyHandler::SetNotify
       
   103 // Copies notification IPC to class member
       
   104 // -----------------------------------------------------------------------------   	
       
   105 void CSimAtkNotifyHandler::SetNotify
       
   106         (
       
   107         TSatIpc aNotifyIpc
       
   108         )
       
   109     {
       
   110     iNotifyIpc = aNotifyIpc;
       
   111     } 
       
   112 
       
   113 // -----------------------------------------------------------------------------
       
   114 // CSimAtkNotifyHandler::Status
       
   115 // returns active object status
       
   116 // -----------------------------------------------------------------------------
       
   117 //
       
   118 TRequestStatus& CSimAtkNotifyHandler::Status()
       
   119 	{
       
   120 	return iStatus;	
       
   121 	}
       
   122 	
       
   123 // -----------------------------------------------------------------------------
       
   124 // CSimAtkNotifyHandler::DoCancel
       
   125 // Cancel active request
       
   126 // -----------------------------------------------------------------------------
       
   127 //
       
   128 void CSimAtkNotifyHandler::DoCancel()
       
   129     {
       
   130 	iLog->Log( _L( "CSimAtkNotifyHandler::DoCancel \
       
   131 	    - Canceling %d " ), iNotifyIpc );    
       
   132 
       
   133     if( IsActive()  && ( iNotify->SimAtkCore() != NULL ) )
       
   134         {
       
   135         iNotify->SimAtkCore()->NotifyCancel( iNotifyIpc );
       
   136         }
       
   137     }
       
   138       
       
   139 // -----------------------------------------------------------------------------
       
   140 // CSimAtkNotifyHandler::RunError
       
   141 // Handles the Cancel
       
   142 // -----------------------------------------------------------------------------
       
   143 //
       
   144 TInt CSimAtkNotifyHandler::RunError(TInt /*aError*/)
       
   145     {
       
   146     return KErrNone;
       
   147     }
       
   148 
       
   149 // -----------------------------------------------------------------------------
       
   150 // CSimAtkNotifyHandler::RunL
       
   151 // Handles completed event wait
       
   152 // -----------------------------------------------------------------------------
       
   153 //
       
   154 void CSimAtkNotifyHandler::RunL()
       
   155     {
       
   156     iLog->Log( _L( "CSimAtkNotifyHandler::RunL - Signaling!" ) );
       
   157     
       
   158     iNotify->Signal( iStatus.Int() );
       
   159 	}	
       
   160 	    
       
   161 //  End of File