os/mm/mmhais/dvbhreceiverhai/hai/dvbh/teststubs/dvbhreceiverinfoobserver.h
changeset 0 bde4ae8d615e
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/os/mm/mmhais/dvbhreceiverhai/hai/dvbh/teststubs/dvbhreceiverinfoobserver.h	Fri Jun 15 03:10:57 2012 +0200
     1.3 @@ -0,0 +1,241 @@
     1.4 +// Copyright (c) 2007-2009 Nokia Corporation and/or its subsidiary(-ies).
     1.5 +// All rights reserved.
     1.6 +// This component and the accompanying materials are made available
     1.7 +// under the terms of "Eclipse Public License v1.0"
     1.8 +// which accompanies this distribution, and is available
     1.9 +// at the URL "http://www.eclipse.org/legal/epl-v10.html".
    1.10 +//
    1.11 +// Initial Contributors:
    1.12 +// Nokia Corporation - initial contribution.
    1.13 +//
    1.14 +// Contributors:
    1.15 +//
    1.16 +// Description:
    1.17 +// Declares the internal observer classes used by CDvbhReceiverInfo.
    1.18 +// 
    1.19 +//
    1.20 +
    1.21 +/**
    1.22 + @file
    1.23 + @internalComponent
    1.24 + @prototype
    1.25 +*/
    1.26 +
    1.27 +#ifndef DVBHRECEIVERINFOOBSERVER_H
    1.28 +#define DVBHRECEIVERINFOOBSERVER_H
    1.29 +
    1.30 +#include "dvbhstubcommon.h"
    1.31 +#include <e32property.h>
    1.32 +#include <e32cons.h>
    1.33 +
    1.34 +class MDvbhStateObserver;
    1.35 +class MDvbhSignalQualityObserver;
    1.36 +class MDvbhPlatformObserver;
    1.37 +class MDvbhNetworkTimeObserver;
    1.38 +class MDvbhFrequencyObserver;
    1.39 +class MDvbhCellIdObserver;
    1.40 +class MDvbhNetworkIdObserver;
    1.41 +class MDvbhExtBatteryStateObserver;
    1.42 +class MDvbhExtConnectionObserver;
    1.43 +class MDvbhExtAntennaConnectionObserver;
    1.44 +
    1.45 +/**
    1.46 +* Interface to abstract the callback to be called when an RProperty changes. 
    1.47 +*/
    1.48 +class MPropertyNotifier
    1.49 +	{
    1.50 +public:
    1.51 +	/**
    1.52 +	* Callback to be called when an RProperty changes.
    1.53 +	* Implementations will probably want to call the appropriate callback on an external observer object.
    1.54 +	* @param aProperty A handle to the RProperty that has just changed.
    1.55 +	*/
    1.56 +	virtual void NotifyPropertyChanged(RProperty& aProperty) = 0;
    1.57 +	
    1.58 +	/**
    1.59 +	* Called to get the key of the property of interest.
    1.60 +	* @return the key value.
    1.61 +	*/
    1.62 +	virtual TInt GetPropertyKey() const = 0;
    1.63 +	};
    1.64 +
    1.65 +/**
    1.66 +* CDvbhPropertyObserver is the class used to observer changes to an RProperty.
    1.67 +*
    1.68 +* To observer changes to a particular RProperty, users must call 
    1.69 +* CDvbhPropertyObserver::SetObserver() passing in an MPropertyNotifier 
    1.70 +* implementation corresponding to the RProperty of interest.  
    1.71 +* When the RProperty changes, CDvbhPropertyObserver::RunL() will call 
    1.72 +* MPropertyNotifier::NotifyPropertyChanged() of the implementation. 
    1.73 +*/
    1.74 +NONSHARABLE_CLASS(CDvbhPropertyObserver) : public CActive
    1.75 +	{
    1.76 +public:
    1.77 +	CDvbhPropertyObserver();
    1.78 +	~CDvbhPropertyObserver();
    1.79 +	TInt SetObserver(MPropertyNotifier* aPropertyNotifier);
    1.80 +
    1.81 +private: 
    1.82 +	void RunL();
    1.83 +	void DoCancel();
    1.84 +	
    1.85 +private:
    1.86 +	MPropertyNotifier* iPropertyNotifier; //Not owned
    1.87 +	RProperty iProperty;
    1.88 +	};
    1.89 +
    1.90 +/**
    1.91 +* Thin template base class for the RProperty notifiers.
    1.92 +*/
    1.93 +NONSHARABLE_CLASS(TDvbhNotifierBase)
    1.94 +	{
    1.95 +protected:
    1.96 +	TDvbhNotifierBase();
    1.97 +	void SetExternalObserver(TAny* aObserver);
    1.98 +protected:
    1.99 +	TAny* iExternalObserver; //Not owned
   1.100 +	};
   1.101 +
   1.102 +/**
   1.103 +* Template on which RProperty Notifiers are based.  Contains all the
   1.104 +* code common to a Notifier for any RProperty.
   1.105 +*
   1.106 +* The template parameter OBSERVER must be one of the observer M-classes declard in dvbhreceiverinfo.h.
   1.107 +*/
   1.108 +template<class OBSERVER>
   1.109 +NONSHARABLE_CLASS(TDvbhNotifier) : protected TDvbhNotifierBase
   1.110 +	{
   1.111 +public:
   1.112 +	inline void SetExternalObserver(OBSERVER* aObserver);
   1.113 +	};
   1.114 +	
   1.115 +/**
   1.116 +* The state notifier for CDvbhReceiverInfo::CPrivateData. 
   1.117 +*/	
   1.118 +NONSHARABLE_CLASS(TDvbhStateNotifier) : public TDvbhNotifier<MDvbhStateObserver>,
   1.119 +										public MPropertyNotifier
   1.120 +	{
   1.121 +public:
   1.122 +	virtual TInt GetPropertyKey() const;
   1.123 +	virtual void NotifyPropertyChanged(RProperty& aProperty);
   1.124 +	};
   1.125 +
   1.126 +/**
   1.127 +* The SignalQuality notifier for CDvbhReceiverInfo::CPrivateData. 
   1.128 +*/	
   1.129 +NONSHARABLE_CLASS(TDvbhSignalQualityNotifier) : public TDvbhNotifier<MDvbhSignalQualityObserver>,
   1.130 +												public MPropertyNotifier
   1.131 +	{
   1.132 +public:
   1.133 +	virtual TInt GetPropertyKey() const;
   1.134 +	virtual void NotifyPropertyChanged(RProperty& aProperty);
   1.135 +	};
   1.136 +
   1.137 +/**
   1.138 +* The Platform notifier for CDvbhReceiverInfo::CPrivateData. 
   1.139 +*/	
   1.140 +NONSHARABLE_CLASS(TDvbhPlatformNotifier) : public TDvbhNotifier<MDvbhPlatformObserver>,
   1.141 +										   public MPropertyNotifier
   1.142 +	{
   1.143 +public:
   1.144 +	virtual TInt GetPropertyKey() const;
   1.145 +	virtual void NotifyPropertyChanged(RProperty& aProperty);
   1.146 +	};
   1.147 +
   1.148 +/**
   1.149 +* The NetworkTime notifier for CDvbhReceiverInfo::CPrivateData. 
   1.150 +*/	
   1.151 +NONSHARABLE_CLASS(TDvbhNetworkTimeNotifier) : public TDvbhNotifier<MDvbhNetworkTimeObserver>,
   1.152 +											  public MPropertyNotifier
   1.153 +	{
   1.154 +public:
   1.155 +	virtual TInt GetPropertyKey() const;
   1.156 +	virtual void NotifyPropertyChanged(RProperty& aProperty);
   1.157 +	};
   1.158 +
   1.159 +/**
   1.160 +* The Frequency notifier for CDvbhReceiverInfo::CPrivateData. 
   1.161 +*/	
   1.162 +NONSHARABLE_CLASS(TDvbhFrequencyNotifier) : public TDvbhNotifier<MDvbhFrequencyObserver>,
   1.163 +											public MPropertyNotifier
   1.164 +	{
   1.165 +public:
   1.166 +	virtual TInt GetPropertyKey() const;
   1.167 +	virtual void NotifyPropertyChanged(RProperty& aProperty);
   1.168 +	};
   1.169 +
   1.170 +/**
   1.171 +* The CellId notifier for CDvbhReceiverInfo::CPrivateData. 
   1.172 +*/	
   1.173 +NONSHARABLE_CLASS(TDvbhCellIdNotifier) : public TDvbhNotifier<MDvbhCellIdObserver>,
   1.174 +										 public MPropertyNotifier
   1.175 +	{
   1.176 +public:
   1.177 +	virtual TInt GetPropertyKey() const;
   1.178 +	virtual void NotifyPropertyChanged(RProperty& aProperty);
   1.179 +	};
   1.180 +
   1.181 +/**
   1.182 +* The NetworkId notifier for CDvbhReceiverInfo::CPrivateData. 
   1.183 +*/	
   1.184 +NONSHARABLE_CLASS(TDvbhNetworkIdNotifier) : public TDvbhNotifier<MDvbhNetworkIdObserver>,
   1.185 +											public MPropertyNotifier
   1.186 +	{
   1.187 +public:
   1.188 +	virtual TInt GetPropertyKey() const;
   1.189 +	virtual void NotifyPropertyChanged(RProperty& aProperty);
   1.190 +	};
   1.191 +
   1.192 +/**
   1.193 +* The battery state for CDvbhReceiverInfo::CPrivateData. 
   1.194 +*/	
   1.195 +NONSHARABLE_CLASS(TDvbhExtBatteryStateNotifier) : public TDvbhNotifier<MDvbhExtBatteryStateObserver>,
   1.196 +											     public MPropertyNotifier
   1.197 +	{
   1.198 +public:
   1.199 +	virtual TInt GetPropertyKey() const;
   1.200 +	virtual void NotifyPropertyChanged(RProperty& aProperty);
   1.201 +	};
   1.202 +
   1.203 +/**
   1.204 +* The connection state for CDvbhReceiverInfo::CPrivateData. 
   1.205 +*/	
   1.206 +NONSHARABLE_CLASS(TDvbhExtConnectionStateNotifier) : public TDvbhNotifier<MDvbhExtConnectionObserver>,
   1.207 +											         public MPropertyNotifier
   1.208 +	{
   1.209 +public:
   1.210 +	virtual TInt GetPropertyKey() const;
   1.211 +	virtual void NotifyPropertyChanged(RProperty& aProperty);
   1.212 +	};
   1.213 +    
   1.214 +/**
   1.215 +* The connection state for CDvbhReceiverInfo::CPrivateData. 
   1.216 +*/	
   1.217 +NONSHARABLE_CLASS(TMtvAccConnectionStateNotifier) : public TDvbhNotifier<MDvbhExtConnectionObserver>,
   1.218 +											        public MPropertyNotifier
   1.219 +	{
   1.220 +public:
   1.221 +	virtual TInt GetPropertyKey() const;
   1.222 +	virtual void NotifyPropertyChanged(RProperty& aProperty);
   1.223 +	};
   1.224 +
   1.225 +/**
   1.226 +* The antenna connection state for CDvbhReceiverInfo::CPrivateData. 
   1.227 +*/	
   1.228 +NONSHARABLE_CLASS(TMtvAccAntennaConnectionStateNotifier) : public TDvbhNotifier<MDvbhExtAntennaConnectionObserver>,
   1.229 +											               public MPropertyNotifier
   1.230 +	{
   1.231 +public:
   1.232 +	virtual TInt GetPropertyKey() const;
   1.233 +	virtual void NotifyPropertyChanged(RProperty& aProperty);
   1.234 +	};
   1.235 +
   1.236 +
   1.237 +#include "dvbhreceiverinfoobserver.inl"
   1.238 + 
   1.239 +#endif //DVBHRECEIVERINFOOBSERVER_H
   1.240 +
   1.241 +
   1.242 +
   1.243 +
   1.244 +