tvout/tvoutengine/inc/glxtvconnectionmonitor.h
author Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
Fri, 11 Jun 2010 13:38:23 +0300
changeset 36 6481344a6d67
parent 33 1ee2af37811f
child 52 a3a4c0de738e
permissions -rw-r--r--
Revision: 201021 Kit: 2010123

/*
* Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies). 
* All rights reserved.
* This component and the accompanying materials are made available
* under the terms of "Eclipse Public License v1.0"
* which accompanies this distribution, and is available
* at the URL "http://www.eclipse.org/legal/epl-v10.html".
*
* Initial Contributors:
* Nokia Corporation - initial contribution.
*
* Contributors:
*
* Description:    Monitoring class of the Tv Out Connection
*
*/



/**
 * @internal reviewed 24/08/2007 by D Holland
 */

#ifndef __GLX_WNDWCONNECTION_MONITOR_H__
#define __GLX_WNDWCONNECTION_MONITOR_H__

// External Includes
#include <e32base.h>                // for CActive
#include <AknWsEventObserver.h>     // for MAknWsEventObserver
#include <AccessoryServer.h>        // for RAccessoryServer
#include <AccessoryMode.h>          // for RAccessoryMode
#include <AccessoryConnection.h>	// for RAccessoryConnection
#include <AccPolGenericIDArray.h>


// Forward Declarations
class MGlxTvConnectionObserver;


/**
 * Class Description
 * An Active object derived class is used to monitor the TV out connection
 * @author Loughlin
 */
NONSHARABLE_CLASS(CGlxTvConnectionMonitor) : public CActive
    {
public:

    /**
     * Static Symbian 2 stage constructor.
     */
    static CGlxTvConnectionMonitor* NewL(
                            MGlxTvConnectionObserver& aConnectionObserver);

    /**
     * Destructor.
     */
    ~CGlxTvConnectionMonitor();

private:

    /**
     * Standard C++ constructor
     */
    CGlxTvConnectionMonitor(
                        MGlxTvConnectionObserver& aConnectionObserver);

    /*
     * Symbian second stage construction
     */
    void ConstructL();

public: // class member functions

    /*
     * Provides the caller with the current TV connetion state
     * @return The TV connection state
     */
    TBool IsConnected() const;

    /*
     * Provides the caller with the current HDMI connetion state
     * @return The HDMI connection state
     */
    TBool IsHDMIConnected() const;

private: // From CActive
    /**
     * @ref CActive::RunL
     */
	void RunL();

    /**
     * @ref CActive::DoCancel
     */
	void DoCancel();

    /**
     * @ref CActive::RunError
     */
    TInt RunError( TInt aError );


private:

    /**
     * Requests TV on/off events
     */
    void IssueRequest();

    /**
     * Sends notification to observers when TV Out cable is connected
     */
    void IssueNotificationL();

    /**
	 * Updates the ConnectionState of Tv Out and HDMI
	 */
	void UpdateConnectionStatusL();

private: // class member data

    // Not owned: TV connection observer
    MGlxTvConnectionObserver& iConnectionObserver;

    // TVout The Connection state
    TBool iIsTvOutConnected;

    // TVout The Connection state
    TBool iIsHDMIConnected;

    // Headset The Connection state
    TBool iIsHeadSetConnected;

    // The (external device) Accessory Server
    RAccessoryServer iTvAccServer;

    // Accessory mode
    RAccessoryMode iTvAccMode;

    // Accessory Connection - details the type of accessory
    RAccessoryConnection iTvAccCon;

    //Class gives Generic ID
    TAccPolGenericIDArray iCurrentAccArray;
    };


#endif // __GLX_WNDWCONNECTION_MONITOR_H__