systemswuis/touchscreencalib/tsccustcmds/src/tscsubscriber.cpp
branchRCL_3
changeset 14 5f281e37a2f5
parent 0 254040eb3b7d
equal deleted inserted replaced
13:90fe62538f66 14:5f281e37a2f5
       
     1 /*
       
     2 * Copyright (c) 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:  TSC Subscriber (Publish & Subscribe).
       
    15 *
       
    16 */
       
    17 
       
    18 // INCLUDES
       
    19 #include <e32svr.h>
       
    20 #include "tscstartupextension.h"
       
    21 #include "tscsubscriber.h"
       
    22 #include "tscstartupextensiondef.h"
       
    23 
       
    24 // CONSTANTS
       
    25 
       
    26 // ============================= MEMBER FUNCTIONS =============================
       
    27 
       
    28 // ----------------------------------------------------------------------------
       
    29 // CTSCSubscriber::NewL()
       
    30 // ----------------------------------------------------------------------------
       
    31 CTSCSubscriber* CTSCSubscriber::NewL( 
       
    32                             MTSCPropertyResponder& aTSCPropertyResponder,
       
    33                             const TUid& aCategory, 
       
    34                             TUint aKey )
       
    35     {
       
    36     CTSCSubscriber* self = new (ELeave) CTSCSubscriber( aTSCPropertyResponder,
       
    37                                                         aCategory, 
       
    38                                                         aKey );
       
    39     CleanupStack::PushL( self );
       
    40     self->ConstructL();
       
    41     CleanupStack::Pop(); //self
       
    42     return self;
       
    43     }
       
    44 
       
    45 // ----------------------------------------------------------------------------
       
    46 // CTSCSubscriber::ConstructL()
       
    47 // ----------------------------------------------------------------------------
       
    48 void CTSCSubscriber::ConstructL()
       
    49     {
       
    50     CActiveScheduler::Add( this );
       
    51     iProperty.Attach( iCategory, iKey );
       
    52     }
       
    53 
       
    54 // ----------------------------------------------------------------------------
       
    55 // CTSCSubscriber::Subscribe()
       
    56 // ----------------------------------------------------------------------------
       
    57 void CTSCSubscriber::Subscribe()
       
    58     {
       
    59     TRACES("CTSCSubscriber::Subscribe()");
       
    60     iProperty.Subscribe( iStatus );
       
    61     SetActive();
       
    62     TRACES("CTSCSubscriber::Subscribe(): End");
       
    63     }
       
    64 
       
    65 // ----------------------------------------------------------------------------
       
    66 // CTSCSubscriber::CTSCSubscriber()
       
    67 // ----------------------------------------------------------------------------
       
    68 CTSCSubscriber::CTSCSubscriber( MTSCPropertyResponder& aTSCPropertyResponder, 
       
    69                                         const TUid& aCategory, 
       
    70                                         TUint aKey ) :
       
    71     CActive( EPriorityStandard ),
       
    72     iTSCPropertyResponder( aTSCPropertyResponder ),
       
    73     iCategory( aCategory),
       
    74     iKey( aKey )
       
    75     {
       
    76     }
       
    77 
       
    78 // ----------------------------------------------------------------------------
       
    79 // CTSCSubscriber::RunL()
       
    80 // ----------------------------------------------------------------------------
       
    81 void CTSCSubscriber::RunL()
       
    82     {
       
    83     TRACES("CTSCSubscriber::RunL()");
       
    84     Subscribe();
       
    85     iTSCPropertyResponder.HandlePropertyChangedL( iCategory, iKey );
       
    86     TRACES("CTSCSubscriber::RunL(): End");
       
    87     }
       
    88 
       
    89 // ----------------------------------------------------------------------------
       
    90 // CTSCSubscriber::DoCancel()
       
    91 // ----------------------------------------------------------------------------
       
    92 void CTSCSubscriber::DoCancel()
       
    93     {
       
    94     iProperty.Cancel();
       
    95     }
       
    96 
       
    97 // ----------------------------------------------------------------------------
       
    98 // CTSCSubscriber::RunError()
       
    99 // ----------------------------------------------------------------------------
       
   100 TInt CTSCSubscriber::RunError( TInt aError )
       
   101     {    
       
   102     return aError;
       
   103     }
       
   104 
       
   105 // ----------------------------------------------------------------------------
       
   106 // CTSCSubscriber::~CTSCSubscriber()
       
   107 // ----------------------------------------------------------------------------
       
   108 CTSCSubscriber::~CTSCSubscriber()
       
   109     {
       
   110     TRACES("CTSCSubscriber::~CTSCSubscriber()");
       
   111     Cancel();
       
   112     iProperty.Close();
       
   113     TRACES("CTSCSubscriber::~CTSCSubscriber(): End");
       
   114     }
       
   115 
       
   116 // End of File
       
   117 
       
   118 
       
   119