Receiver Information Notifications

This document is about the receiving notification of changes to the receiver information.

Purpose

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:

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:

Using Receiver Information Notified Changes Tutorial

The Following tasks will be covered in this tutorial:

Basic Procedure

The high level steps to receive notification changes of receiver information are shown here:

  1. Implement the M-class appropriate to the information you want to observe.

  2. 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.
    ...
    }