This document is about the receiving notification of changes to the receiver information.
This tutorial helps you to request to be notified of changes to receiver information by observing objects appropriate for the information.
Required Background
In order to be notified of changes to receiver information, you will require a CDvbhReceiverInfo instances, which is created using CDvbhReceiverInfo::NewL() or CDvbhReceiverInfo::NewLC().
You need to have an observer object appropriate for the information which will be a concrete realisations of one more of the following interface classes:
MDvbhStateObserver used for receiving notifications of state changes
MDvbhSignalQualityObserver used for receiving notifications of signal quality changes
MDvbhPlatformObserver used for receiving notifications of platform changes
MDvbhNetworkTimeObserver used for receiving notifications of network time changes
MDvbhFrequencyObserver used for receiving notifications of frequency changes
MDvbhCellIdObserver used for receiving notifications of cellId changes
MDvbhNetworkIdObserver used for receiving notifications of networkId changes
Introduction
CDvbhReceiverInfo is used for receiving notifications of state changes, signal quality changes, platform changes, network time changes, frequency changes, cellId changes and networkId changes.
Setup and Configuration Requirements
Each of the above observer classes contains a single callback function, to be called by CDvbhReceiverInfo whenever the information to which it relates changes. The callback functions are:
The Following tasks will be covered in this tutorial:
The high level steps to receive notification changes of receiver information are shown here:
Implement the M-class appropriate to the information you want to observe.
Call the appropriate set observer method for the information you want to observe, passing in your M-class object. For example to receive the state changes, call CDvbhReceiverInfo::SetStateObserver() function.
List of consequences to receive notification of changes to receiver information are:
Whenever the related information changes, the call back function on the registered observer object is executed and you will be informed in this way. Once an observer is registered, it remains registered until either CDvbhReceiverInfo instance is destroyed, or until a new observer is registered with another call to same set observer method. It is worth nothing that observers are registered with individual instances, not with any resource shared between instances.
Thus it is possible for two CDvbhReceiverInfo instances to have different MDvbhStateObserver instances registered simultaneously. For example when the state changes, callbacks on both of these observers are called.
Example
//Context: Assume the following code is part of some CExampleClient method, //where CExampleClient is a class that implements MDvbhStateObserver //(e.g. class CExampleClient : public CBase, public MDvbhStateObserver). //Assume that CExampleClient::iReceiver has not been initialised. User::LeaveIfError(iReceiver.Open()); // State is Inactive to begin with. User::LeaveIfError(iReceiverInfo->SetStateObserver(*this)); //From now on, whenever the receiver state changes, //CExampleClient::DvbhStateChange() will be called. User::LeaveIfError(iReceiver.PowerOn()); //This causes the state to transition to Booting, which will cause //CExampleClient::DvbhStateChange() to be run. When booting completes, //the state will transition to NoPlatform and this will cause //CExampleClient::DvbhStateChange() to be run again, and so on.... //CExampleClient code: void CExampleClient::DvbhStateChange(TDvbhState& aNewState) { //Client writes code here to do whatever it needs to do when the //state changes. In our example, it has just powered on the receiver //so it may want to be informed when it has finished booting and //transitioned to the NoPlatform state so that it can start a signal //scan. ... }
Copyright ©2010 Nokia Corporation and/or its subsidiary(-ies).
All rights
reserved. Unless otherwise stated, these materials are provided under the terms of the Eclipse Public License
v1.0.