idlefw/plugins/devicestatus/src/aimcnpublisher.cpp
branchRCL_3
changeset 114 a5a39a295112
child 118 8baec10861af
equal deleted inserted replaced
113:0efa10d348c0 114:a5a39a295112
       
     1 /*
       
     2 * Copyright (c) 2005-2006 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:  Micro Cellular Network (MCN) publisher.
       
    15 *
       
    16 */
       
    17 
       
    18 #include <aicontentobserver.h>
       
    19 #include "aimcnpublisher.h"
       
    20 #include "ainetworkinfolistener.h"
       
    21 
       
    22 
       
    23 // ======== MEMBER FUNCTIONS ========
       
    24 
       
    25 CAiMCNPublisher::CAiMCNPublisher()
       
    26     {
       
    27     }
       
    28 
       
    29 
       
    30 void CAiMCNPublisher::ConstructL()
       
    31     {
       
    32     iListener = CAiNetworkInfoListener::InstanceL();
       
    33     }
       
    34 
       
    35 
       
    36 CAiMCNPublisher* CAiMCNPublisher::NewL()
       
    37     {
       
    38     CAiMCNPublisher* self = new( ELeave ) CAiMCNPublisher;
       
    39     CleanupStack::PushL( self );
       
    40     self->ConstructL();
       
    41     CleanupStack::Pop( self );
       
    42     return self;
       
    43     }
       
    44 
       
    45 
       
    46 CAiMCNPublisher::~CAiMCNPublisher()
       
    47     {
       
    48     if( iListener )
       
    49         {
       
    50         iListener->RemoveObserver( *this );
       
    51         iListener->Release();
       
    52         }
       
    53     }
       
    54 
       
    55 
       
    56 void CAiMCNPublisher::ResumeL()
       
    57     {
       
    58     iListener->AddObserverL( *this );
       
    59     }
       
    60 
       
    61 
       
    62 void CAiMCNPublisher::Subscribe( MAiContentObserver& aObserver, 
       
    63 							        CHsContentPublisher& aExtension,
       
    64                                     MAiPublishPrioritizer& /*aPrioritizer*/,
       
    65                                     MAiPublisherBroadcaster& /*aBroadcaster*/ )
       
    66     {
       
    67     iContentObserver = &aObserver;
       
    68     iExtension = &aExtension;
       
    69     }
       
    70     
       
    71     
       
    72 void CAiMCNPublisher::RefreshL( TBool /*aClean*/ )
       
    73     {
       
    74     //cannot be refreshed
       
    75     }
       
    76 
       
    77 
       
    78 void CAiMCNPublisher::HandleNetworkInfoChange( 
       
    79 						const MNWMessageObserver::TNWMessages& aMessage, 
       
    80 						const TNWInfo& aInfo,
       
    81 						const TBool /*aShowOpInd*/ )
       
    82     {
       
    83 	//If MSN message was received, publish it.
       
    84     if ( aMessage == MNWMessageObserver::ENWMessageCurrentCellInfoMessage )
       
    85         {
       
    86         if ( aInfo.iMCNIndicatorType == ENWMCNIndicatorTypeActive )
       
    87             {
       
    88             TPtrC msg = aInfo.iMCNName;
       
    89             iContentObserver->Publish( *iExtension, 
       
    90             							EAiDeviceStatusContentMCNIndicator, 
       
    91             							msg, 
       
    92             							0 );
       
    93             }
       
    94         else if ( aInfo.iMCNIndicatorType == ENWMCNIndicatorTypeNone )
       
    95             {
       
    96             iContentObserver->Clean( *iExtension, 
       
    97             							EAiDeviceStatusContentMCNIndicator,
       
    98             							0 );
       
    99             }
       
   100         }
       
   101     }
       
   102 
       
   103 
       
   104 TBool CAiMCNPublisher::RefreshL( TInt aContentId, TBool aClean )
       
   105 	{
       
   106     if( aContentId == EAiDeviceStatusContentMCNIndicator )
       
   107         {
       
   108    	    RefreshL( aClean );
       
   109    	    return ETrue;
       
   110     	}
       
   111     	
       
   112     return EFalse;
       
   113 	}