systemswuis/touchscreencalib/tscstartupextensionplugin/src/tscpluginpubsubobserver.cpp
branchRCL_3
changeset 13 90fe62538f66
parent 12 3fec62e6e7fc
child 14 5f281e37a2f5
equal deleted inserted replaced
12:3fec62e6e7fc 13:90fe62538f66
     1 /*
       
     2 * Copyright (c) 2007 - 2008 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 *           This class the handles the received indications from the Public and
       
    16 *           Subscribe.
       
    17 *
       
    18 */
       
    19 
       
    20 
       
    21 // SYSTEM INCLUDES
       
    22 #ifdef RD_STARTUP_ANIMATION_CUSTOMIZATION
       
    23 #include <e32cmn.h>
       
    24 #include <touchscprivatepskeys.h>
       
    25 #else //RD_STARTUP_ANIMATION_CUSTOMIZATION
       
    26 #include <StartupAppInternalPSKeys.h>
       
    27 #endif //RD_STARTUP_ANIMATION_CUSTOMIZATION
       
    28 
       
    29 // USER INCLUDES
       
    30 #include "TSCPlugInPubSubObserver.h"
       
    31 #include "tscpluginsubscriber.h"
       
    32 #include "tscstartupextensionplugindef.h"
       
    33 
       
    34 // ================= MEMBER FUNCTIONS =======================
       
    35 
       
    36 // ----------------------------------------------------
       
    37 // TSCPlugInPubSubObserver::TSCPlugInPubSubObserver( CTSCStartupExtensionPlugIn* aTSCStartupExtensionPlugIn )
       
    38 // C++ default constructor can NOT contain any code, that
       
    39 // might leave.
       
    40 // ----------------------------------------------------
       
    41 CTSCPlugInPubSubObserver::CTSCPlugInPubSubObserver( CTSCStartupExtensionPlugIn* aTSCStartupExtensionPlugIn ) :
       
    42     iTSCStartupExtensionPlugIn( aTSCStartupExtensionPlugIn )
       
    43     {
       
    44     }
       
    45 
       
    46 // ----------------------------------------------------
       
    47 // CTSCPlugInPubSubObserver::ConstructL()
       
    48 // ----------------------------------------------------
       
    49 void CTSCPlugInPubSubObserver::ConstructL()
       
    50     {
       
    51     TRACES("CTSCPlugInPubSubObserver::ConstructL()");
       
    52 
       
    53     iTSCSyncSubscriber = CTSCPlugInSubscriber::NewL( *this, 
       
    54 #ifdef RD_STARTUP_ANIMATION_CUSTOMIZATION
       
    55                                                      KPSUidTouchScreenCalibration,
       
    56 #else //RD_STARTUP_ANIMATION_CUSTOMIZATION
       
    57                                                      KPSUidStartup,
       
    58 #endif //RD_STARTUP_ANIMATION_CUSTOMIZATION                                                     
       
    59                                                      KPSTouchScreenCalibration );
       
    60     iTSCSyncSubscriber->Subscribe();
       
    61 
       
    62     TInt touchScreenCalibrationState;
       
    63 #ifdef RD_STARTUP_ANIMATION_CUSTOMIZATION
       
    64     RProperty::Get( KPSUidTouchScreenCalibration, KPSTouchScreenCalibration, touchScreenCalibrationState );
       
    65 #else //RD_STARTUP_ANIMATION_CUSTOMIZATION
       
    66     RProperty::Get( KPSUidStartup, KPSTouchScreenCalibration, touchScreenCalibrationState );
       
    67 #endif //RD_STARTUP_ANIMATION_CUSTOMIZATION
       
    68     if ( touchScreenCalibrationState == ETouchScreenCalibrationOk )
       
    69         {
       
    70         iTSCStartupExtensionPlugIn->CalibrationDone();
       
    71         }
       
    72 
       
    73     TRACES("CTSCPlugInPubSubObserver::ConstructL(): End");
       
    74     }
       
    75 
       
    76 // ----------------------------------------------------------------------------
       
    77 // CTSCPlugInPubSubObserver::HandlePropertyChangedL()
       
    78 // ----------------------------------------------------------------------------
       
    79 void CTSCPlugInPubSubObserver::HandlePropertyChangedL( const TUid& /*aCategory*/, TUint aKey )
       
    80     {
       
    81     TRACES("CTSCPlugInPubSubObserver::HandlePropertyChangedL()");
       
    82     TRACES1("CTSCPlugInPubSubObserver::HandlePropertyChangedL(): aKey: %d",aKey );
       
    83 
       
    84     if (aKey == KPSTouchScreenCalibration)
       
    85         {
       
    86         TInt state;
       
    87     
       
    88 #ifdef RD_STARTUP_ANIMATION_CUSTOMIZATION
       
    89         RProperty::Get( KPSUidTouchScreenCalibration, KPSTouchScreenCalibration, state );
       
    90 #else //RD_STARTUP_ANIMATION_CUSTOMIZATION
       
    91         RProperty::Get( KPSUidStartup, KPSTouchScreenCalibration, state );
       
    92 #endif //RD_STARTUP_ANIMATION_CUSTOMIZATION
       
    93 
       
    94         if ( state == ETouchScreenCalibrationOk )
       
    95             {
       
    96             iTSCStartupExtensionPlugIn->CalibrationDone();
       
    97             }
       
    98         }
       
    99 
       
   100     TRACES("CTSCPlugInPubSubObserver::HandlePropertyChangedL(): End");
       
   101     }
       
   102 
       
   103 // ----------------------------------------------------
       
   104 // CTSCPlugInPubSubObserver::NewL( CTSCStartupExtensionPlugIn* aTSCStartupExtensionPlugIn )
       
   105 // ----------------------------------------------------
       
   106 CTSCPlugInPubSubObserver* CTSCPlugInPubSubObserver::NewL( CTSCStartupExtensionPlugIn* aTSCStartupExtensionPlugIn )
       
   107     {
       
   108     TRACES("CTSCPlugInPubSubObserver::NewL()");
       
   109     CTSCPlugInPubSubObserver* self = new (ELeave) CTSCPlugInPubSubObserver( aTSCStartupExtensionPlugIn );
       
   110 
       
   111     CleanupStack::PushL( self );
       
   112     self->ConstructL();
       
   113     CleanupStack::Pop(); // self
       
   114 
       
   115     TRACES("CTSCPlugInPubSubObserver::NewL(): End");
       
   116     return self;
       
   117     }
       
   118 
       
   119 // ----------------------------------------------------
       
   120 // CTSCPlugInPubSubObserver::~CTSCPlugInPubSubObserver()
       
   121 // ----------------------------------------------------
       
   122 CTSCPlugInPubSubObserver::~CTSCPlugInPubSubObserver()
       
   123     {
       
   124     TRACES("CTSCPlugInPubSubObserver::~CTSCPlugInPubSubObserver()");
       
   125 
       
   126     delete iTSCSyncSubscriber;
       
   127     iProperty.Close();
       
   128 
       
   129     TRACES("CTSCPlugInPubSubObserver::~CTSCPlugInPubSubObserver(): End");
       
   130     }
       
   131 
       
   132 //  End of File