IMPSengine/engsrv/src/impstoffobserver.cpp
changeset 0 094583676ce7
equal deleted inserted replaced
-1:000000000000 0:094583676ce7
       
     1 /*
       
     2 * Copyright (c) 2005 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 * Description:  Publish & Subscribe property change observer
       
    16 *
       
    17 */
       
    18 
       
    19 
       
    20 // INCLUDE FILES
       
    21 #include    <CoreApplicationUIsSDKCRKeys.h>
       
    22 #include    "impsutils.h"
       
    23 #include    "impsdatautils.h"
       
    24 #include    "impsserver.h"
       
    25 #include    "impspropertyobserver.h"
       
    26 #include    "impspropertyobserverapi.h"
       
    27 #include    "impstoffobserver.h"
       
    28 
       
    29 // ================= MEMBER FUNCTIONS =======================
       
    30 
       
    31 /**
       
    32 * CImpsTOffObserver
       
    33 * Observer for terminal off line events. Uses WV engine's common property
       
    34 * observer class CImpsPropertyObserver.
       
    35 * This is auxiliary class of CImpsServer.
       
    36 */
       
    37 // -----------------------------------------------------------------------------
       
    38 // CImpsTOffObserver::NewL
       
    39 // -----------------------------------------------------------------------------
       
    40 //
       
    41 CImpsTOffObserver* CImpsTOffObserver::NewL( CImpsServer& aServer )
       
    42     {
       
    43     CImpsTOffObserver* self = new ( ELeave ) CImpsTOffObserver( aServer );
       
    44     CleanupStack::PushL( self );
       
    45     self->ConstructL();
       
    46     CleanupStack::Pop();
       
    47     return self;
       
    48     };
       
    49 
       
    50 
       
    51 // -----------------------------------------------------------------------------
       
    52 // CImpsTOffObserver::CImpsTOffObserver
       
    53 // -----------------------------------------------------------------------------
       
    54 //
       
    55 CImpsTOffObserver::CImpsTOffObserver( CImpsServer& aServer ):
       
    56         iServer( aServer )
       
    57     {
       
    58     }
       
    59 
       
    60 // -----------------------------------------------------------------------------
       
    61 // Destructor
       
    62 // -----------------------------------------------------------------------------
       
    63 CImpsTOffObserver::~CImpsTOffObserver()
       
    64     {
       
    65 #ifndef _NO_IMPS_LOGGING_
       
    66     CImpsClientLogger::Log( _L( "CImpsTOffObserver: destructor" ) );
       
    67 #endif
       
    68     delete iObserver;
       
    69     }
       
    70 
       
    71 // -----------------------------------------------------------------------------
       
    72 // CImpsTOffObserver::ConstructL
       
    73 // -----------------------------------------------------------------------------
       
    74 void CImpsTOffObserver::ConstructL()
       
    75     {
       
    76     iObserver = CImpsPropertyObserver::NewL( *this,
       
    77                                              KCRUidCoreApplicationUIs, KCoreAppUIsNetworkConnectionAllowed );
       
    78     }
       
    79 
       
    80 // -----------------------------------------------------------------------------
       
    81 // CImpsTOffObserver::CheckConnAllowed
       
    82 // -----------------------------------------------------------------------------
       
    83 TBool CImpsTOffObserver::CheckConnAllowed()
       
    84     {
       
    85     TInt allowed( ECoreAppUIsNetworkConnectionAllowed );
       
    86     TInt errx = KErrNone;
       
    87     TRAP( errx, allowed = TImpsDataUtils::GetCenRepIntValueL(
       
    88                               KCRUidCoreApplicationUIs, KCoreAppUIsNetworkConnectionAllowed ) );
       
    89     if ( allowed == ECoreAppUIsNetworkConnectionNotAllowed )
       
    90         {
       
    91 #ifndef _NO_IMPS_LOGGING_
       
    92         CImpsClientLogger::Log( _L( "CImpsTOffObserver: CheckConnAllowed returns FALSE ***" ) );
       
    93 #endif
       
    94         return EFalse;
       
    95         }
       
    96     return ETrue;
       
    97     }
       
    98 
       
    99 // -----------------------------------------------------------------------------
       
   100 // CImpsTOffObserver::HandlePropertyChangeL
       
   101 // -----------------------------------------------------------------------------
       
   102 void CImpsTOffObserver::HandlePropertyChangeL( TInt aValue )
       
   103     {
       
   104 #ifndef _NO_IMPS_LOGGING_
       
   105     CImpsClientLogger::Log( _L( "CImpsTOffObserver: HandlePropertyChangeL val=%d" ), aValue );
       
   106 #endif
       
   107     iServer.SetConnAllowed( aValue );
       
   108     }
       
   109 
       
   110 
       
   111 //  End of File
       
   112