First public contribution.
1 // Copyright (c) 2007-2009 Nokia Corporation and/or its subsidiary(-ies).
2 // All rights reserved.
3 // This component and the accompanying materials are made available
4 // under the terms of "Eclipse Public License v1.0"
5 // which accompanies this distribution, and is available
6 // at the URL "http://www.eclipse.org/legal/epl-v10.html".
8 // Initial Contributors:
9 // Nokia Corporation - initial contribution.
14 // Declares the internal observer classes used by CDvbhReceiverInfo.
24 #ifndef DVBHRECEIVERINFOOBSERVER_H
25 #define DVBHRECEIVERINFOOBSERVER_H
27 #include "dvbhstubcommon.h"
28 #include <e32property.h>
31 class MDvbhStateObserver;
32 class MDvbhSignalQualityObserver;
33 class MDvbhPlatformObserver;
34 class MDvbhNetworkTimeObserver;
35 class MDvbhFrequencyObserver;
36 class MDvbhCellIdObserver;
37 class MDvbhNetworkIdObserver;
38 class MDvbhExtBatteryStateObserver;
39 class MDvbhExtConnectionObserver;
40 class MDvbhExtAntennaConnectionObserver;
43 * Interface to abstract the callback to be called when an RProperty changes.
45 class MPropertyNotifier
49 * Callback to be called when an RProperty changes.
50 * Implementations will probably want to call the appropriate callback on an external observer object.
51 * @param aProperty A handle to the RProperty that has just changed.
53 virtual void NotifyPropertyChanged(RProperty& aProperty) = 0;
56 * Called to get the key of the property of interest.
57 * @return the key value.
59 virtual TInt GetPropertyKey() const = 0;
63 * CDvbhPropertyObserver is the class used to observer changes to an RProperty.
65 * To observer changes to a particular RProperty, users must call
66 * CDvbhPropertyObserver::SetObserver() passing in an MPropertyNotifier
67 * implementation corresponding to the RProperty of interest.
68 * When the RProperty changes, CDvbhPropertyObserver::RunL() will call
69 * MPropertyNotifier::NotifyPropertyChanged() of the implementation.
71 NONSHARABLE_CLASS(CDvbhPropertyObserver) : public CActive
74 CDvbhPropertyObserver();
75 ~CDvbhPropertyObserver();
76 TInt SetObserver(MPropertyNotifier* aPropertyNotifier);
83 MPropertyNotifier* iPropertyNotifier; //Not owned
88 * Thin template base class for the RProperty notifiers.
90 NONSHARABLE_CLASS(TDvbhNotifierBase)
94 void SetExternalObserver(TAny* aObserver);
96 TAny* iExternalObserver; //Not owned
100 * Template on which RProperty Notifiers are based. Contains all the
101 * code common to a Notifier for any RProperty.
103 * The template parameter OBSERVER must be one of the observer M-classes declard in dvbhreceiverinfo.h.
105 template<class OBSERVER>
106 NONSHARABLE_CLASS(TDvbhNotifier) : protected TDvbhNotifierBase
109 inline void SetExternalObserver(OBSERVER* aObserver);
113 * The state notifier for CDvbhReceiverInfo::CPrivateData.
115 NONSHARABLE_CLASS(TDvbhStateNotifier) : public TDvbhNotifier<MDvbhStateObserver>,
116 public MPropertyNotifier
119 virtual TInt GetPropertyKey() const;
120 virtual void NotifyPropertyChanged(RProperty& aProperty);
124 * The SignalQuality notifier for CDvbhReceiverInfo::CPrivateData.
126 NONSHARABLE_CLASS(TDvbhSignalQualityNotifier) : public TDvbhNotifier<MDvbhSignalQualityObserver>,
127 public MPropertyNotifier
130 virtual TInt GetPropertyKey() const;
131 virtual void NotifyPropertyChanged(RProperty& aProperty);
135 * The Platform notifier for CDvbhReceiverInfo::CPrivateData.
137 NONSHARABLE_CLASS(TDvbhPlatformNotifier) : public TDvbhNotifier<MDvbhPlatformObserver>,
138 public MPropertyNotifier
141 virtual TInt GetPropertyKey() const;
142 virtual void NotifyPropertyChanged(RProperty& aProperty);
146 * The NetworkTime notifier for CDvbhReceiverInfo::CPrivateData.
148 NONSHARABLE_CLASS(TDvbhNetworkTimeNotifier) : public TDvbhNotifier<MDvbhNetworkTimeObserver>,
149 public MPropertyNotifier
152 virtual TInt GetPropertyKey() const;
153 virtual void NotifyPropertyChanged(RProperty& aProperty);
157 * The Frequency notifier for CDvbhReceiverInfo::CPrivateData.
159 NONSHARABLE_CLASS(TDvbhFrequencyNotifier) : public TDvbhNotifier<MDvbhFrequencyObserver>,
160 public MPropertyNotifier
163 virtual TInt GetPropertyKey() const;
164 virtual void NotifyPropertyChanged(RProperty& aProperty);
168 * The CellId notifier for CDvbhReceiverInfo::CPrivateData.
170 NONSHARABLE_CLASS(TDvbhCellIdNotifier) : public TDvbhNotifier<MDvbhCellIdObserver>,
171 public MPropertyNotifier
174 virtual TInt GetPropertyKey() const;
175 virtual void NotifyPropertyChanged(RProperty& aProperty);
179 * The NetworkId notifier for CDvbhReceiverInfo::CPrivateData.
181 NONSHARABLE_CLASS(TDvbhNetworkIdNotifier) : public TDvbhNotifier<MDvbhNetworkIdObserver>,
182 public MPropertyNotifier
185 virtual TInt GetPropertyKey() const;
186 virtual void NotifyPropertyChanged(RProperty& aProperty);
190 * The battery state for CDvbhReceiverInfo::CPrivateData.
192 NONSHARABLE_CLASS(TDvbhExtBatteryStateNotifier) : public TDvbhNotifier<MDvbhExtBatteryStateObserver>,
193 public MPropertyNotifier
196 virtual TInt GetPropertyKey() const;
197 virtual void NotifyPropertyChanged(RProperty& aProperty);
201 * The connection state for CDvbhReceiverInfo::CPrivateData.
203 NONSHARABLE_CLASS(TDvbhExtConnectionStateNotifier) : public TDvbhNotifier<MDvbhExtConnectionObserver>,
204 public MPropertyNotifier
207 virtual TInt GetPropertyKey() const;
208 virtual void NotifyPropertyChanged(RProperty& aProperty);
212 * The connection state for CDvbhReceiverInfo::CPrivateData.
214 NONSHARABLE_CLASS(TMtvAccConnectionStateNotifier) : public TDvbhNotifier<MDvbhExtConnectionObserver>,
215 public MPropertyNotifier
218 virtual TInt GetPropertyKey() const;
219 virtual void NotifyPropertyChanged(RProperty& aProperty);
223 * The antenna connection state for CDvbhReceiverInfo::CPrivateData.
225 NONSHARABLE_CLASS(TMtvAccAntennaConnectionStateNotifier) : public TDvbhNotifier<MDvbhExtAntennaConnectionObserver>,
226 public MPropertyNotifier
229 virtual TInt GetPropertyKey() const;
230 virtual void NotifyPropertyChanged(RProperty& aProperty);
234 #include "dvbhreceiverinfoobserver.inl"
236 #endif //DVBHRECEIVERINFOOBSERVER_H