videoplayback/videohelix/inc/mpxvideoaccessoryobserver.h
changeset 0 96612d01cf9f
child 20 b9e04db066d4
equal deleted inserted replaced
-1:000000000000 0:96612d01cf9f
       
     1 /*
       
     2 * Copyright (c) 2008 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:   This class observes the accessory framework.
       
    15  *
       
    16 */
       
    17 
       
    18 // Version : %version: 6 %
       
    19 
       
    20 
       
    21 
       
    22 #ifndef MPXVIDEOACCESSORYOBSERVER_H
       
    23 #define MPXVIDEOACCESSORYOBSERVER_H
       
    24 
       
    25 //
       
    26 //  INCLUDES
       
    27 //
       
    28 #include <e32std.h>
       
    29 #include <e32base.h>
       
    30 #include <AccessoryServer.h>
       
    31 #include <AccessoryConnection.h>
       
    32 
       
    33 #include "mpxvideo_debug.h"
       
    34 
       
    35 //
       
    36 //  FORWARD DECLARATIONS
       
    37 //
       
    38 class CMPXVideoPlaybackController;
       
    39 
       
    40 //
       
    41 //  CLASS DECLARATION
       
    42 //
       
    43 
       
    44 NONSHARABLE_CLASS( CMPXVideoAccessoryObserver ) : public CActive
       
    45 {
       
    46     public:
       
    47         /*
       
    48          *  Two phase constructor
       
    49          *  @param aObs  Reference to an event observer
       
    50          */
       
    51         static CMPXVideoAccessoryObserver* NewL( CMPXVideoPlaybackController* aController );
       
    52 
       
    53         /*
       
    54          *  Destructor
       
    55          */
       
    56         virtual ~CMPXVideoAccessoryObserver();
       
    57 
       
    58     public:
       
    59 
       
    60         /*
       
    61          *  Returns the status of the TV-Out cable connection
       
    62          *  @return the cable connection status
       
    63          *     ETrue    cable is connected.
       
    64          *     EFalse   cable is not connected.
       
    65          */
       
    66         TBool IsTvOutConnected();
       
    67 
       
    68         /*
       
    69          *  Returns if the playback is allowed when the TV-Out cable is connected
       
    70          *  @return  playback is allowed
       
    71          *     ETrue    playback is allowed.
       
    72          *     EFalse   playback is not allowed.
       
    73          */
       
    74         TBool IsTvOutPlaybackAllowed();
       
    75 
       
    76     private:
       
    77 
       
    78         /*
       
    79          *  From CActive
       
    80          *
       
    81          *  DoCancel() must not wait for event completion;
       
    82          *  this is handled by Cancel().
       
    83          */
       
    84         void DoCancel();
       
    85 
       
    86         /*
       
    87          *  From CActive
       
    88          *
       
    89          *  Handles an active object's request completion event.
       
    90          */
       
    91         void RunL();
       
    92 
       
    93         /*
       
    94          *  From CActive
       
    95          *
       
    96          *  If RunL leaves, then the active scheduler calls RunError()
       
    97          *  to handle the leave.
       
    98          */
       
    99         TInt RunError( TInt aError );
       
   100 
       
   101     private:
       
   102 
       
   103         /*
       
   104          *  C++ default constructor.
       
   105          *  @param aObs  Reference to an event observer
       
   106          */
       
   107         CMPXVideoAccessoryObserver( CMPXVideoPlaybackController* aController );
       
   108 
       
   109         /*
       
   110          *  By default Symbian 2nd phase constructor is private.
       
   111          *  Create and connect to the driver and Central Repository.
       
   112          */
       
   113         void ConstructL();
       
   114 
       
   115         /*
       
   116          *  Checks if the TV-Out status has changed by parsing
       
   117          *  the Generic ID Array searching for changes with accessories
       
   118          *  that support TV-Out
       
   119          *  @return   Status Changed
       
   120          *      ETrue   TV-Out Status has changed
       
   121          *      EFalse  TV-Out Status has not changed
       
   122          */
       
   123         TBool UpdateTvOutStatusL();
       
   124 
       
   125         /*
       
   126          *  Starts listening for Accessory events.
       
   127          *  @param None
       
   128          *  @return None
       
   129          */
       
   130         void StartMonitoringL();
       
   131 
       
   132     private:
       
   133 
       
   134         CMPXVideoPlaybackController*        iController;
       
   135         TBool                               iTvOutConnected;
       
   136         TBool                               iTvOutPlaybackAllowed;
       
   137 
       
   138 #ifdef __ACCESSORY_FW
       
   139         RAccessoryServer                    iServer;
       
   140         RAccessoryConnection                iConnection;
       
   141         TAccPolGenericIDArray               iGenericIdArray;
       
   142 #endif //__ACCESSORY_FW
       
   143 };
       
   144 
       
   145 #endif  //  MPXVIDEOACCESSORYOBSERVER_H
       
   146 
       
   147 // End of File