phoneengine/phonemodel/src/cpenetworkregistrationstatusmonitor.cpp
changeset 37 ba76fc04e6c2
child 51 f39ed5e045e0
equal deleted inserted replaced
36:2eacb6118286 37:ba76fc04e6c2
       
     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:  This module contains the implementation of CPENetworkRegistrationStatusMonitor class 
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 // INCLUDES
       
    20 #include "cpenetworkregistrationstatusmonitor.h"
       
    21 #include "cpepubsubmonitor.h"
       
    22 #include "mpephonemodelinternal.h"
       
    23 #include <e32property.h>
       
    24 #include <mpedatastore.h>
       
    25 #include <networkhandlingdomainpskeys.h>
       
    26 #include <talogger.h>
       
    27 
       
    28 
       
    29 // EXTERNAL DATA STRUCTURES
       
    30 // None.
       
    31 
       
    32 // EXTERNAL FUNCTION PROTOTYPES  
       
    33 // None.
       
    34 
       
    35 // CONSTANTS
       
    36 // None.
       
    37 
       
    38 // MACROS
       
    39 // None.
       
    40 
       
    41 // LOCAL CONSTANTS AND MACROS
       
    42 // None.
       
    43 
       
    44 // MODULE DATA STRUCTURES
       
    45 // None.
       
    46 
       
    47 // LOCAL FUNCTION PROTOTYPES
       
    48 // None.
       
    49 
       
    50 // FORWARD DECLARATIONS
       
    51 // None. 
       
    52 
       
    53 // ==================== LOCAL FUNCTIONS ====================
       
    54 // None.
       
    55 
       
    56 // ================= MEMBER FUNCTIONS =======================
       
    57 
       
    58 // -----------------------------------------------------------------------------
       
    59 // CPENetworkRegistrationStatusMonitor::NewL
       
    60 // Two-phased constructor.
       
    61 // -----------------------------------------------------------------------------
       
    62 CPENetworkRegistrationStatusMonitor* CPENetworkRegistrationStatusMonitor::NewL(
       
    63         MPEPhoneModelInternal& aModel
       
    64         ) 
       
    65     {
       
    66     TEFLOGSTRING(KTAOBJECT, "CPENetworkRegistrationStatusMonitor::NewL");
       
    67     CPENetworkRegistrationStatusMonitor* self = new (ELeave) CPENetworkRegistrationStatusMonitor( 
       
    68         aModel );
       
    69     CleanupStack::PushL( self );
       
    70     self->ConstructL();
       
    71     CleanupStack::Pop( self );
       
    72     return( self );
       
    73     }
       
    74                                                                             
       
    75 // -----------------------------------------------------------------------------
       
    76 // CPENetworkRegistrationStatusMonitor::CPENetworkRegistrationStatusMonitor
       
    77 // C++ default constructor can NOT contain any code, that
       
    78 // might leave.
       
    79 // -----------------------------------------------------------------------------
       
    80 //
       
    81 CPENetworkRegistrationStatusMonitor::CPENetworkRegistrationStatusMonitor(
       
    82         MPEPhoneModelInternal& aModel
       
    83         ): CPEPubSubMonitor( aModel )
       
    84     {
       
    85     }
       
    86 
       
    87 // -----------------------------------------------------------------------------
       
    88 // CPENetworkRegistrationStatusMonitor::ConstructL
       
    89 // Symbian 2nd phase constructor can leave.
       
    90 // -----------------------------------------------------------------------------
       
    91 //
       
    92 void CPENetworkRegistrationStatusMonitor::ConstructL(
       
    93         // None
       
    94         )
       
    95         {
       
    96     TEFLOGSTRING(KTAOBJECT, "CPENetworkRegistrationStatusMonitor::ConstructL");
       
    97     
       
    98     BaseConstructL( KPSUidNetworkInfo, KNWRegistrationStatus, RProperty::EInt );
       
    99        
       
   100     //  Now retrieve the value
       
   101     TInt value;
       
   102     TInt error = Get( value );
       
   103     
       
   104     // if not able to retrieve the value, set it to the default value of ENWStatusRegistrationUnknown
       
   105     if ( error != KErrNone )
       
   106         {
       
   107         value = ENWStatusRegistrationUnknown; 
       
   108         }
       
   109         
       
   110     iModel.DataStore()->SetNetworkRegistrationStatus( 
       
   111         static_cast< TNWNetworkRegistrationStatus > ( value ) );
       
   112     }
       
   113 
       
   114 // -----------------------------------------------------------------------------
       
   115 // CPECenRepMonitor::UpdateL
       
   116 // -----------------------------------------------------------------------------
       
   117 //
       
   118 void CPENetworkRegistrationStatusMonitor::UpdateL(
       
   119         // None
       
   120         )
       
   121     {
       
   122     TEFLOGSTRING(KTAINT, "CPENetworkRegistrationStatusMonitor::UpdateL" );
       
   123    
       
   124     //  Now retrieve the value
       
   125     TInt value;
       
   126     User::LeaveIfError(Get(value)); 
       
   127         
       
   128     iModel.DataStore()->SetNetworkRegistrationStatus( 
       
   129         static_cast< TNWNetworkRegistrationStatus > ( value ) );
       
   130     iModel.SendMessage( MEngineMonitor::EPEMessageNetworkRegistrationStatusChange );
       
   131     }
       
   132     
       
   133 // End of file