camerauis/cameraapp/generic/inc/camtvaccessorymonitor.h
branchRCL_3
changeset 31 8f559c47d7fd
child 50 f54ad444594d
equal deleted inserted replaced
27:53c8aa5d97a3 31:8f559c47d7fd
       
     1 /*
       
     2 * Copyright (c) 2007-2010 Nokia Corporation and/or its subsidiary(-ies). 
       
     3 * All rights reserved.
       
     4 * This component and the accompanying materials are made available
       
     5 * under the terms of "Eclipse Public License v1.0"
       
     6 * which accompanies this distribution, and is available
       
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     8 *
       
     9 * Initial Contributors:
       
    10 * Nokia Corporation - initial contribution.
       
    11 *
       
    12 * Contributors:
       
    13 *
       
    14 * Description:  Utility class to handle TV accessory events
       
    15 */
       
    16 
       
    17 #ifndef CAMTVACCESSORYMONITOR_H
       
    18 #define CAMTVACCESSORYMONITOR_H
       
    19 
       
    20 
       
    21 #include <AknWsEventObserver.h>     // for MAknWsEventObserver
       
    22 #include <AccessoryServer.h>        // for RAccessoryServer
       
    23 #include <AccessoryMode.h>          // for RAccessoryMode
       
    24 #include <AccessoryConnection.h>    // for RAccessoryConnection
       
    25 #include <AccPolGenericIDArray.h>
       
    26 
       
    27 
       
    28 class MCamTvAccessoryObserver
       
    29     {
       
    30 public:
       
    31     virtual void HandleTvAccessoryConnectedL() = 0;
       
    32     virtual void HandleTvAccessoryDisconnectedL() = 0;
       
    33     };
       
    34 
       
    35 class CCamTvAccessoryMonitor : public CActive
       
    36     {
       
    37 public:
       
    38     // Cancel and destroy
       
    39     ~CCamTvAccessoryMonitor();
       
    40 
       
    41     // Two-phased constructor.
       
    42     static CCamTvAccessoryMonitor* NewL( MCamTvAccessoryObserver* aObserver );
       
    43 
       
    44 public:
       
    45 
       
    46     // Starts to listen to tv accessory events
       
    47     void StartListeningL();
       
    48     
       
    49     // Returns ETrue if TVOut cable is connected
       
    50     TBool IsTvOutCableConnected();
       
    51     
       
    52     // Returns ETrue if HDMI cable is connected
       
    53     TBool IsHdmiCableConnected();
       
    54     
       
    55 private:
       
    56     // C++ constructor
       
    57     CCamTvAccessoryMonitor( MCamTvAccessoryObserver* aObserver );
       
    58 
       
    59     // Second-phase constructor
       
    60     void ConstructL();
       
    61 
       
    62 private:
       
    63     // From CActive
       
    64     // Handle completion
       
    65     void RunL();
       
    66 
       
    67     // How to cancel me
       
    68     void DoCancel();
       
    69 
       
    70     // Override to handle leaves from RunL(). Default implementation causes
       
    71     // the active scheduler to panic.
       
    72     TInt RunError(TInt aError);
       
    73 
       
    74 
       
    75 private:
       
    76 
       
    77     MCamTvAccessoryObserver* iObserver;
       
    78  
       
    79     TBool iTvOutConnectionState;
       
    80     TBool iHDMIConnectionState;
       
    81 
       
    82     
       
    83     RAccessoryServer iTvAccServer;
       
    84     RAccessoryMode iTvAccMode;
       
    85     RAccessoryConnection iTvAccCon;
       
    86     TAccPolGenericIDArray iCurrentAccArray;
       
    87     TAccPolAccessoryMode iPolAccMode;
       
    88     TAccMode iPreviousMode;
       
    89     };
       
    90 
       
    91 #endif // CAMTVACCESSORYMONITOR_H