sl@0: // Copyright (c) 2007-2009 Nokia Corporation and/or its subsidiary(-ies). sl@0: // All rights reserved. sl@0: // This component and the accompanying materials are made available sl@0: // under the terms of "Eclipse Public License v1.0" sl@0: // which accompanies this distribution, and is available sl@0: // at the URL "http://www.eclipse.org/legal/epl-v10.html". sl@0: // sl@0: // Initial Contributors: sl@0: // Nokia Corporation - initial contribution. sl@0: // sl@0: // Contributors: sl@0: // sl@0: // Description: sl@0: // Declares the internal observer classes used by CDvbhReceiverInfo. sl@0: // sl@0: // sl@0: sl@0: /** sl@0: @file sl@0: @internalComponent sl@0: @prototype sl@0: */ sl@0: sl@0: #ifndef DVBHRECEIVERINFOOBSERVER_H sl@0: #define DVBHRECEIVERINFOOBSERVER_H sl@0: sl@0: #include "dvbhstubcommon.h" sl@0: #include sl@0: #include sl@0: sl@0: class MDvbhStateObserver; sl@0: class MDvbhSignalQualityObserver; sl@0: class MDvbhPlatformObserver; sl@0: class MDvbhNetworkTimeObserver; sl@0: class MDvbhFrequencyObserver; sl@0: class MDvbhCellIdObserver; sl@0: class MDvbhNetworkIdObserver; sl@0: class MDvbhExtBatteryStateObserver; sl@0: class MDvbhExtConnectionObserver; sl@0: class MDvbhExtAntennaConnectionObserver; sl@0: sl@0: /** sl@0: * Interface to abstract the callback to be called when an RProperty changes. sl@0: */ sl@0: class MPropertyNotifier sl@0: { sl@0: public: sl@0: /** sl@0: * Callback to be called when an RProperty changes. sl@0: * Implementations will probably want to call the appropriate callback on an external observer object. sl@0: * @param aProperty A handle to the RProperty that has just changed. sl@0: */ sl@0: virtual void NotifyPropertyChanged(RProperty& aProperty) = 0; sl@0: sl@0: /** sl@0: * Called to get the key of the property of interest. sl@0: * @return the key value. sl@0: */ sl@0: virtual TInt GetPropertyKey() const = 0; sl@0: }; sl@0: sl@0: /** sl@0: * CDvbhPropertyObserver is the class used to observer changes to an RProperty. sl@0: * sl@0: * To observer changes to a particular RProperty, users must call sl@0: * CDvbhPropertyObserver::SetObserver() passing in an MPropertyNotifier sl@0: * implementation corresponding to the RProperty of interest. sl@0: * When the RProperty changes, CDvbhPropertyObserver::RunL() will call sl@0: * MPropertyNotifier::NotifyPropertyChanged() of the implementation. sl@0: */ sl@0: NONSHARABLE_CLASS(CDvbhPropertyObserver) : public CActive sl@0: { sl@0: public: sl@0: CDvbhPropertyObserver(); sl@0: ~CDvbhPropertyObserver(); sl@0: TInt SetObserver(MPropertyNotifier* aPropertyNotifier); sl@0: sl@0: private: sl@0: void RunL(); sl@0: void DoCancel(); sl@0: sl@0: private: sl@0: MPropertyNotifier* iPropertyNotifier; //Not owned sl@0: RProperty iProperty; sl@0: }; sl@0: sl@0: /** sl@0: * Thin template base class for the RProperty notifiers. sl@0: */ sl@0: NONSHARABLE_CLASS(TDvbhNotifierBase) sl@0: { sl@0: protected: sl@0: TDvbhNotifierBase(); sl@0: void SetExternalObserver(TAny* aObserver); sl@0: protected: sl@0: TAny* iExternalObserver; //Not owned sl@0: }; sl@0: sl@0: /** sl@0: * Template on which RProperty Notifiers are based. Contains all the sl@0: * code common to a Notifier for any RProperty. sl@0: * sl@0: * The template parameter OBSERVER must be one of the observer M-classes declard in dvbhreceiverinfo.h. sl@0: */ sl@0: template sl@0: NONSHARABLE_CLASS(TDvbhNotifier) : protected TDvbhNotifierBase sl@0: { sl@0: public: sl@0: inline void SetExternalObserver(OBSERVER* aObserver); sl@0: }; sl@0: sl@0: /** sl@0: * The state notifier for CDvbhReceiverInfo::CPrivateData. sl@0: */ sl@0: NONSHARABLE_CLASS(TDvbhStateNotifier) : public TDvbhNotifier, sl@0: public MPropertyNotifier sl@0: { sl@0: public: sl@0: virtual TInt GetPropertyKey() const; sl@0: virtual void NotifyPropertyChanged(RProperty& aProperty); sl@0: }; sl@0: sl@0: /** sl@0: * The SignalQuality notifier for CDvbhReceiverInfo::CPrivateData. sl@0: */ sl@0: NONSHARABLE_CLASS(TDvbhSignalQualityNotifier) : public TDvbhNotifier, sl@0: public MPropertyNotifier sl@0: { sl@0: public: sl@0: virtual TInt GetPropertyKey() const; sl@0: virtual void NotifyPropertyChanged(RProperty& aProperty); sl@0: }; sl@0: sl@0: /** sl@0: * The Platform notifier for CDvbhReceiverInfo::CPrivateData. sl@0: */ sl@0: NONSHARABLE_CLASS(TDvbhPlatformNotifier) : public TDvbhNotifier, sl@0: public MPropertyNotifier sl@0: { sl@0: public: sl@0: virtual TInt GetPropertyKey() const; sl@0: virtual void NotifyPropertyChanged(RProperty& aProperty); sl@0: }; sl@0: sl@0: /** sl@0: * The NetworkTime notifier for CDvbhReceiverInfo::CPrivateData. sl@0: */ sl@0: NONSHARABLE_CLASS(TDvbhNetworkTimeNotifier) : public TDvbhNotifier, sl@0: public MPropertyNotifier sl@0: { sl@0: public: sl@0: virtual TInt GetPropertyKey() const; sl@0: virtual void NotifyPropertyChanged(RProperty& aProperty); sl@0: }; sl@0: sl@0: /** sl@0: * The Frequency notifier for CDvbhReceiverInfo::CPrivateData. sl@0: */ sl@0: NONSHARABLE_CLASS(TDvbhFrequencyNotifier) : public TDvbhNotifier, sl@0: public MPropertyNotifier sl@0: { sl@0: public: sl@0: virtual TInt GetPropertyKey() const; sl@0: virtual void NotifyPropertyChanged(RProperty& aProperty); sl@0: }; sl@0: sl@0: /** sl@0: * The CellId notifier for CDvbhReceiverInfo::CPrivateData. sl@0: */ sl@0: NONSHARABLE_CLASS(TDvbhCellIdNotifier) : public TDvbhNotifier, sl@0: public MPropertyNotifier sl@0: { sl@0: public: sl@0: virtual TInt GetPropertyKey() const; sl@0: virtual void NotifyPropertyChanged(RProperty& aProperty); sl@0: }; sl@0: sl@0: /** sl@0: * The NetworkId notifier for CDvbhReceiverInfo::CPrivateData. sl@0: */ sl@0: NONSHARABLE_CLASS(TDvbhNetworkIdNotifier) : public TDvbhNotifier, sl@0: public MPropertyNotifier sl@0: { sl@0: public: sl@0: virtual TInt GetPropertyKey() const; sl@0: virtual void NotifyPropertyChanged(RProperty& aProperty); sl@0: }; sl@0: sl@0: /** sl@0: * The battery state for CDvbhReceiverInfo::CPrivateData. sl@0: */ sl@0: NONSHARABLE_CLASS(TDvbhExtBatteryStateNotifier) : public TDvbhNotifier, sl@0: public MPropertyNotifier sl@0: { sl@0: public: sl@0: virtual TInt GetPropertyKey() const; sl@0: virtual void NotifyPropertyChanged(RProperty& aProperty); sl@0: }; sl@0: sl@0: /** sl@0: * The connection state for CDvbhReceiverInfo::CPrivateData. sl@0: */ sl@0: NONSHARABLE_CLASS(TDvbhExtConnectionStateNotifier) : public TDvbhNotifier, sl@0: public MPropertyNotifier sl@0: { sl@0: public: sl@0: virtual TInt GetPropertyKey() const; sl@0: virtual void NotifyPropertyChanged(RProperty& aProperty); sl@0: }; sl@0: sl@0: /** sl@0: * The connection state for CDvbhReceiverInfo::CPrivateData. sl@0: */ sl@0: NONSHARABLE_CLASS(TMtvAccConnectionStateNotifier) : public TDvbhNotifier, sl@0: public MPropertyNotifier sl@0: { sl@0: public: sl@0: virtual TInt GetPropertyKey() const; sl@0: virtual void NotifyPropertyChanged(RProperty& aProperty); sl@0: }; sl@0: sl@0: /** sl@0: * The antenna connection state for CDvbhReceiverInfo::CPrivateData. sl@0: */ sl@0: NONSHARABLE_CLASS(TMtvAccAntennaConnectionStateNotifier) : public TDvbhNotifier, sl@0: public MPropertyNotifier sl@0: { sl@0: public: sl@0: virtual TInt GetPropertyKey() const; sl@0: virtual void NotifyPropertyChanged(RProperty& aProperty); sl@0: }; sl@0: sl@0: sl@0: #include "dvbhreceiverinfoobserver.inl" sl@0: sl@0: #endif //DVBHRECEIVERINFOOBSERVER_H sl@0: sl@0: sl@0: sl@0: sl@0: