This document helps you to understand how RDvbhReceiver handles session close and the power off for a Broadcast Receiver hardware.
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.
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.
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:
Call RDvbhReceiver::PowerOff() where signal to the receiver no longer to be called.
Shut down immediately. This is done by calling RDvbhReceiver::SetDisabled().
You need a receiver instance for the DVB-H Receiver to be called.
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:
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.
The high level steps to power off the broadcast receiver are shown here:
To power off the receiver, call RDvbhReceiver::PowerOff().
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().
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.
The high level steps to close session of the broadcast receiver are shown here:
In order to close the session call RDvbhReceiver::Close().
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.
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.