Turn Off Broadcast Receiver Tutorial

This document helps you to understand how RDvbhReceiver handles session close and the power off for a Broadcast Receiver hardware.

Purpose

This tutorial tells you about shutting down the Broadcast Receiver hardware. The purpose is to end up with closed session and, or power off the hardware.

Required Background

When you have finished with a RDvbhReceiver instance, you must close the session before it is destroyed or else risk causing a memory leak and corrupt reference count on the receiver.

Introduction

To shut down the hardware, you need to power off and close the session to the receiver. There are two ways to shut down the receiver, they are as follows:

Setup and Configuration Requirements

You need a receiver instance for the DVB-H Receiver to be called.

Using Turn Off Broadcast Receiver Tutorial

The Following tasks will be covered in this tutorial:

Basic Procedure To Shut Down The Receiver

The high level steps to shut down immediately the broadcast receiver are shown here:

  1. For power downing the receiver immediately, you need to call RDvbhReceiver::SetDisabled(). This method takes a boolean parameter as ETrue to disable or EFalse to re-enable. If this method is called with ETrue on any instance, then power to the receiver is immediately cut and the receiver is put into disabled state.

    In disabled state, the power to the receiver remains off even if calls to RDvbhReceiver::PowerOn() are invoked. Indeed, RDvbhReceiver::PowerOn() returns KErrLocked while the receiver is in disabled state. In order for the receiver to be moved out of disabled state, RDvbhReceiver::SetDisabled(EFalse) must be called from each session that issued is RDvbhReceiver::SetDisabled(ETrue). When the receiver is moved out of the disabled state, it may be powered back on call to RDvbhReceiver::PowerOn() as usual.

Basic procedure to power off the broadcast receiver

The high level steps to power off the broadcast receiver are shown here:

  1. To power off the receiver, call RDvbhReceiver::PowerOff().

  2. In order to shut down power completely, RDvbhReceiver::PowerOff() takes into account the reference count of the receiver client and puts the power off until each client that has called RDvbhReceiver::PowerOn().

Example to off the broadcast receiver power



RDvbhReceiver receiver1;
RDvbhReceiver receiver2;
RDvbhReceiver receiver3;

User::LeaveIfError(receiver1.Open());
User::LeaveIfError(receiver2.Open()); 
User::LeaveIfError(receiver3.Open());

User::LeaveIfError(receiver1.PowerOn());
User::LeaveIfError(receiver3.PowerOn());

//Wait until booting has completed.  Shared receiver is now powered on.
receiver1.PowerOff(); //count decremented, but receiver power is still on.
receiver2.PowerOff(); //count not decremented, No effect.
receiver3.PowerOff(); //count decremented to 0. No more clients that have requested power 
                      // on, so the power is turned off.

Basic Procedure To Close Session Of The Broadcast Receiver

The high level steps to close session of the broadcast receiver are shown here:

  1. In order to close the session call RDvbhReceiver::Close().

  2. If RDvbhReceiver::PowerOn() is called on an instance, then RDvbhReceiver::Close() reduces the reference count as if RDvbhReceiver::PowerOff() is called. As a result, if there are no more open sessions to the receiver, then it is powered off.