idlefw/tsrc/idleint/stubs/caipspropertyobserver.cpp
branchRCL_3
changeset 110 2c7f27287390
equal deleted inserted replaced
101:9e077f9a342c 110:2c7f27287390
       
     1 /*
       
     2 * Copyright (c) 2010 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:  Publish and subscribe parameter observer implementation.
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 #include <e32property.h>
       
    20 
       
    21 //#include <TelephonyInternalPSKeys.h>
       
    22 #include <StartupDomainPSKeys.h>
       
    23 
       
    24 #include "caipspropertyobserver.h"
       
    25 
       
    26 
       
    27 
       
    28 //const TInt KNotifyTimeShort( 100000 );
       
    29 //const TInt KNotifyTimeLong( 10000000 );
       
    30 // ---------------------------------------------------------------------------
       
    31 // void ConstructL( TCallBack aCallBack, TUid aCategory, TInt aKey )
       
    32 // ---------------------------------------------------------------------------
       
    33 //
       
    34 void CPSPropertyObserver::ConstructL()
       
    35     {
       
    36 
       
    37     //User::LeaveIfError( iProperty.Attach( iCategory, iKey ) );
       
    38     User::LeaveIfError( iTimer.CreateLocal() );
       
    39     CActiveScheduler::Add( this );
       
    40     
       
    41     //iProperty.Subscribe( iStatus );
       
    42     //SetActive();
       
    43     }
       
    44 
       
    45 // ---------------------------------------------------------------------------
       
    46 // CPSPropertyObserver()
       
    47 // ---------------------------------------------------------------------------
       
    48 //
       
    49 CPSPropertyObserver::CPSPropertyObserver( TUid aCategory,
       
    50                                           TInt aKey )
       
    51     : 
       
    52     CActive( CActive::EPriorityStandard ),
       
    53     iCategory( aCategory ),
       
    54     iKey( aKey ),
       
    55     iCounter( 0 )
       
    56     {
       
    57     }
       
    58     
       
    59 // ---------------------------------------------------------------------------
       
    60 // CPSPropertyObserver* NewL( TCallBack aCallBack, TUid aCategory, TInt aKey )
       
    61 // ---------------------------------------------------------------------------
       
    62 //
       
    63 CPSPropertyObserver* CPSPropertyObserver::NewL( TUid aCategory,
       
    64                                                 TInt aKey )
       
    65     { 
       
    66     CPSPropertyObserver* self = new ( ELeave ) CPSPropertyObserver( aCategory,
       
    67                                                                     aKey );
       
    68     CleanupStack::PushL( self );
       
    69     self->ConstructL();
       
    70     CleanupStack::Pop( self );
       
    71     return self;
       
    72     }
       
    73     
       
    74 // ---------------------------------------------------------------------------
       
    75 // ~CPSPropertyObserver()
       
    76 // ---------------------------------------------------------------------------
       
    77 //
       
    78 CPSPropertyObserver::~CPSPropertyObserver()
       
    79     {
       
    80     //Deque();
       
    81     //iProperty.Close();
       
    82     iTimer.Close();
       
    83     }
       
    84     
       
    85 // ---------------------------------------------------------------------------
       
    86 // void Release()
       
    87 // ---------------------------------------------------------------------------
       
    88 //
       
    89 void CPSPropertyObserver::Release()
       
    90     {
       
    91     iTimer.Close();
       
    92     delete this;    
       
    93     }
       
    94     
       
    95 // ---------------------------------------------------------------------------
       
    96 // void RunL()
       
    97 // ---------------------------------------------------------------------------
       
    98 //
       
    99 void CPSPropertyObserver::RunL()
       
   100     {
       
   101     iTimer.Close();
       
   102     iOtherObserver->DoEvent();
       
   103     //iCallBack.CallBack();
       
   104     }
       
   105 
       
   106 // ---------------------------------------------------------------------------
       
   107 // void DoCancel()
       
   108 // ---------------------------------------------------------------------------
       
   109 //
       
   110 void CPSPropertyObserver::DoCancel()
       
   111     {
       
   112     iTimer.Cancel();
       
   113     }
       
   114 
       
   115 // ---------------------------------------------------------------------------
       
   116 // TInt Get()
       
   117 // ---------------------------------------------------------------------------
       
   118 //
       
   119 void CPSPropertyObserver::SetCallBack( TCallBack aCallBack )
       
   120     {
       
   121     iCallBack = aCallBack;
       
   122     }
       
   123 
       
   124 void CPSPropertyObserver::DoEvent()
       
   125     {
       
   126     iCallBack.CallBack();
       
   127     }
       
   128 
       
   129 void CPSPropertyObserver::SetOtherObserver( CPSPropertyObserver* aOther )
       
   130     {
       
   131     iOtherObserver = aOther;
       
   132     }
       
   133 
       
   134 TInt CPSPropertyObserver::Get()
       
   135     {
       
   136     TInt value = 0;
       
   137 
       
   138     // iProperty.Get( iCategory, iKey, value );
       
   139 
       
   140     return value;
       
   141     }
       
   142 
       
   143 // ---------------------------------------------------------------------------
       
   144 // TInt Get( TInt& aValue )
       
   145 // ---------------------------------------------------------------------------
       
   146 //
       
   147 TInt CPSPropertyObserver::Get( TInt& aValue )
       
   148     { 	
       
   149 	//TInt error = iProperty.Get( iCategory, iKey, aValue );
       
   150     TInt error = KErrNone;
       
   151     
       
   152    	aValue = ESwStateCriticalPhaseOK;
       
   153 
       
   154     return error;
       
   155     }
       
   156     
       
   157 // ---------------------------------------------------------------------------
       
   158 // TInt Get( TDes8& aString )
       
   159 // ---------------------------------------------------------------------------
       
   160 //
       
   161 TInt CPSPropertyObserver::Get( TDes8& aString )
       
   162 	{ 
       
   163 	_LIT8( txt, "TEST");
       
   164 	aString.Copy( txt );
       
   165 	//TInt error = iProperty.Get( iCategory, iKey, aString );
       
   166     TInt error = KErrNone;
       
   167     return error;
       
   168     }
       
   169 
       
   170 // ---------------------------------------------------------------------------
       
   171 // TInt Get( TDes16& aString )
       
   172 // ---------------------------------------------------------------------------
       
   173 //
       
   174 TInt CPSPropertyObserver::Get( TDes16& /*aString*/ )
       
   175     { 
       
   176 	//TInt error = iProperty.Get( iCategory, iKey, aString );
       
   177     return KErrNone;
       
   178     }
       
   179 
       
   180 // ========== OTHER EXPORTED FUNCTIONS ========================================
       
   181 
       
   182 // End of File.