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