imagehandlingutilities/thumbnailmanager/tmcommon/src/tmshutdownobserver.cpp
changeset 43 473df7bf149f
parent 29 4bdfb6b5c9b4
child 41 9d4d3445ce6e
equal deleted inserted replaced
36:c5df59b4ae2d 43:473df7bf149f
    19 #include <e32base.h>
    19 #include <e32base.h>
    20 
    20 
    21 #include "tmshutdownobserver.h"
    21 #include "tmshutdownobserver.h"
    22 #include "thumbnailmanagerconstants.h"
    22 #include "thumbnailmanagerconstants.h"
    23 #include "thumbnaillog.h"
    23 #include "thumbnaillog.h"
       
    24 #include "OstTraceDefinitions.h"
       
    25 #ifdef OST_TRACE_COMPILER_IN_USE
       
    26 #include "tmshutdownobserverTraces.h"
       
    27 #endif
       
    28 
    24 
    29 
    25 // ---------------------------------------------------------------------------
    30 // ---------------------------------------------------------------------------
    26 // CTMShutdownObserver::NewL()
    31 // CTMShutdownObserver::NewL()
    27 // ---------------------------------------------------------------------------
    32 // ---------------------------------------------------------------------------
    28 //
    33 //
    60 // ---------------------------------------------------------------------------
    65 // ---------------------------------------------------------------------------
    61 //
    66 //
    62 void CTMShutdownObserver::ConstructL()
    67 void CTMShutdownObserver::ConstructL()
    63     { 
    68     { 
    64     TN_DEBUG1( "CTMShutdownObserver::ConstructL()" );
    69     TN_DEBUG1( "CTMShutdownObserver::ConstructL()" );
       
    70     OstTrace0( TRACE_NORMAL, CTMSHUTDOWNOBSERVER_CONSTRUCTL, "CTMShutdownObserver::ConstructL" );
    65     // define P&S property types
    71     // define P&S property types
    66     if (iDefineKey)
    72     if (iDefineKey)
    67         {
    73         {
    68         TN_DEBUG1( "CTMShutdownObserver::ConstructL() define" );
    74         TN_DEBUG1( "CTMShutdownObserver::ConstructL() define" );
       
    75         OstTrace0( TRACE_NORMAL, DUP1_CTMSHUTDOWNOBSERVER_CONSTRUCTL, "CTMShutdownObserver::ConstructL - define" );
    69         RProperty::Define(iKeyCategory,iPropertyKey,
    76         RProperty::Define(iKeyCategory,iPropertyKey,
    70                           RProperty::EInt,KAllowAllPolicy,KPowerMgmtPolicy);
    77                           RProperty::EInt,KAllowAllPolicy,KPowerMgmtPolicy);
    71         }
    78         }
    72     
    79     
    73     // attach to the property
    80     // attach to the property
    74     TInt err = iProperty.Attach(iKeyCategory,iPropertyKey,EOwnerThread);
    81     TInt err = iProperty.Attach(iKeyCategory,iPropertyKey,EOwnerThread);
    75     TN_DEBUG2( "CTMShutdownObserver::ConstructL() attach err = %d", err );
    82     TN_DEBUG2( "CTMShutdownObserver::ConstructL() attach err = %d", err );
       
    83     OstTrace1( TRACE_NORMAL, DUP2_CTMSHUTDOWNOBSERVER_CONSTRUCTL, "CTMShutdownObserver::ConstructL - attach;err=%d", err );
    76     User::LeaveIfError(err);
    84     User::LeaveIfError(err);
    77     
    85     
    78     // wait for the previously attached property to be updated
    86     // wait for the previously attached property to be updated
    79     iProperty.Subscribe(iStatus);
    87     iProperty.Subscribe(iStatus);
    80     TN_DEBUG1( "CTMShutdownObserver::ConstructL() subscribe" );
    88     TN_DEBUG1( "CTMShutdownObserver::ConstructL() subscribe" );
       
    89     OstTrace0( TRACE_NORMAL, DUP3_CTMSHUTDOWNOBSERVER_CONSTRUCTL, "CTMShutdownObserver::ConstructL - subscribe" );
    81     SetActive();
    90     SetActive();
    82     }
    91     }
    83 
    92 
    84 // ---------------------------------------------------------------------------
    93 // ---------------------------------------------------------------------------
    85 // CTMShutdownObserver::~CTMShutdownObserver()
    94 // CTMShutdownObserver::~CTMShutdownObserver()
    86 // ---------------------------------------------------------------------------
    95 // ---------------------------------------------------------------------------
    87 //
    96 //
    88 CTMShutdownObserver::~CTMShutdownObserver()
    97 CTMShutdownObserver::~CTMShutdownObserver()
    89     {
    98     {
    90     TN_DEBUG1( "CTMShutdownObserver::~CTMShutdownObserver()" );
    99     TN_DEBUG1( "CTMShutdownObserver::~CTMShutdownObserver()" );
       
   100     OstTrace0( TRACE_NORMAL, CTMSHUTDOWNOBSERVER_CTMSHUTDOWNOBSERVER, "CTMShutdownObserver::~CTMShutdownObserver" );
    91     Cancel();
   101     Cancel();
    92     iProperty.Close();
   102     iProperty.Close();
    93     }
   103     }
    94 
   104 
    95 // ---------------------------------------------------------------------------
   105 // ---------------------------------------------------------------------------
    97 // ---------------------------------------------------------------------------
   107 // ---------------------------------------------------------------------------
    98 //
   108 //
    99 void CTMShutdownObserver::RunL()
   109 void CTMShutdownObserver::RunL()
   100     {
   110     {
   101     TN_DEBUG2( "CTMShutdownObserver::RunL(%d)", iStatus.Int() );
   111     TN_DEBUG2( "CTMShutdownObserver::RunL(%d)", iStatus.Int() );
       
   112     OstTrace1( TRACE_NORMAL, CTMSHUTDOWNOBSERVER_RUNL, "CTMShutdownObserver::RunL;iStatus.Int()=%d", iStatus.Int() );
   102     // resubscribe before processing new value to prevent missing updates
   113     // resubscribe before processing new value to prevent missing updates
   103     iProperty.Subscribe(iStatus);
   114     iProperty.Subscribe(iStatus);
   104     SetActive();
   115     SetActive();
   105     
   116     
   106     // retrieve the value
   117     // retrieve the value
   107     TInt value = 0;
   118     TInt value = 0;
   108     TInt err = iProperty.Get(value);
   119     TInt err = iProperty.Get(value);
   109     
   120     
   110     TN_DEBUG2( "CTMShutdownObserver::RunL() Get err = %d", err );
   121     TN_DEBUG2( "CTMShutdownObserver::RunL() Get err = %d", err );
       
   122     OstTrace1( TRACE_NORMAL, DUP1_CTMSHUTDOWNOBSERVER_RUNL, "CTMShutdownObserver::RunL - get err;err=%d", err );
   111 
   123 
   112     // observer callback
   124     // observer callback
   113     if (value)
   125     if (value)
   114         {
   126         {
   115         iObserver.ShutdownNotification();
   127         iObserver.ShutdownNotification();
   121 // ---------------------------------------------------------------------------
   133 // ---------------------------------------------------------------------------
   122 //
   134 //
   123 void CTMShutdownObserver::DoCancel()
   135 void CTMShutdownObserver::DoCancel()
   124     {
   136     {
   125     TN_DEBUG1( "CTMShutdownObserver::DoCancel()" );
   137     TN_DEBUG1( "CTMShutdownObserver::DoCancel()" );
       
   138     OstTrace0( TRACE_NORMAL, CTMSHUTDOWNOBSERVER_DOCANCEL, "CTMShutdownObserver::DoCancel" );
   126     iProperty.Cancel();
   139     iProperty.Cancel();
   127     }
   140     }
   128 
   141 
   129 // End of file
   142 // End of file