accessoryservices/pluggeddisplay/pluggeddisplayengine/inc/accessorycontrolif.h
changeset 0 4e1aa6a622a0
equal deleted inserted replaced
-1:000000000000 0:4e1aa6a622a0
       
     1 /*
       
     2  * Copyright (c) 2009 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:
       
    15  * CAccessoryControlIf class declaration.
       
    16  *
       
    17  */
       
    18 
       
    19 #ifndef C_ACCESSORYCONTROLIF_H
       
    20 #define C_ACCESSORYCONTROLIF_H
       
    21 
       
    22 // INCLUDES
       
    23 #include <e32base.h>
       
    24 #include <AccessoryControl.h>
       
    25 #include <AccConGenericID.h>
       
    26 #include "pdengine.h"
       
    27 
       
    28 
       
    29 // CONSTANTS
       
    30 
       
    31 // MACROS
       
    32 
       
    33 // DATA TYPES
       
    34 
       
    35 // FUNCTION PROTOTYPES
       
    36 
       
    37 // FORWARD DECLARATIONS
       
    38 class MFSMBody;
       
    39 class RAccessoryServer;
       
    40 class RAccessoryControl;
       
    41 
       
    42 enum TAccessoryControlIf
       
    43     {
       
    44     EAccessoryControlIfNoRequestActive = 10,
       
    45     EAccessoryControlIfConnectRequested,
       
    46     EAccessoryControlIfDisconnectRequested
       
    47     };
       
    48 
       
    49 
       
    50 // CLASS DECLARATION
       
    51 /**
       
    52  * Accessory Control interface.
       
    53  *
       
    54  *  @code
       
    55  *   ?good_class_usage_example(s)
       
    56  *  @endcode
       
    57  *
       
    58  *  @lib none.
       
    59  *  @since TB 9.2
       
    60  */
       
    61 NONSHARABLE_CLASS( CAccessoryControlIf ): public CActive
       
    62     {
       
    63     public:  // Constructors and destructor
       
    64 
       
    65         /**
       
    66          * Symbian two phased constructor.
       
    67          * 
       
    68          * @since S60 TB9.2
       
    69          * @param aFSM A FSM.
       
    70          * @param aAccessoryServer Accessory Server.
       
    71          * @return CAccessoryControlIf*
       
    72          */
       
    73         static CAccessoryControlIf* NewL(
       
    74                 MFSMForBody& aFSM,
       
    75                 RAccessoryServer& aAccessoryServer );
       
    76 
       
    77         /**
       
    78         * Destructor.
       
    79         */
       
    80         virtual ~CAccessoryControlIf();
       
    81         
       
    82     public: // New methods
       
    83 
       
    84         /**
       
    85          * Sends a connect accessory request to Accessory Server.
       
    86          * 
       
    87          * @since TB9.2
       
    88          * @param aCopyProtectionStatus Current Copy Protection Status.
       
    89          * @return void.
       
    90          */
       
    91         void ConnectAccessoryL( TBool aCopyProtectionStatus );
       
    92 
       
    93         /**
       
    94          * Sends a disconnect accessory request to Accessory Server.
       
    95          * 
       
    96          * @since TB9.2
       
    97          * @param None.
       
    98          * @return void.
       
    99          */
       
   100         void DisconnectAccessory();
       
   101         
       
   102         /**
       
   103          * Get the Unique ID of connected accessory.
       
   104          * 
       
   105          * @since TB9.2
       
   106          * @param None.
       
   107          * @return Unique ID. Zero if don't exist.
       
   108          */
       
   109         TInt GetUniqueID();
       
   110 
       
   111         /**
       
   112          * Get the Generic ID of connected accessory.
       
   113          * 
       
   114          * @since TB9.2
       
   115          * @param aAccPolGenericID Object where to copy actual values.
       
   116          * @return Error code. KErrNotFound if don't exist.
       
   117          */
       
   118         TInt GetAccPolGenericID( TAccPolGenericID& aAccPolGenericID );
       
   119 
       
   120         /**
       
   121          * Notify value change.
       
   122          * 
       
   123          * @since TB9.2
       
   124          * @param aNameRecord Accessory capability.
       
   125          * @param aValue      Value for the specific accessory capability.
       
   126          * @return TInt Error code. system-wide error code if failed.
       
   127          *            Specifically:
       
   128          *            KErrArgument if an argument is out of range.
       
   129          */
       
   130         TInt NotifyValueChange( 
       
   131                 const TUint32& aName,
       
   132                 const TAccValueTypeTBool aValue ) const;
       
   133 
       
   134         /**
       
   135          * Notify value change.
       
   136          * 
       
   137          * @since TB9.2
       
   138          * @param aNameRecord Accessory capability.
       
   139          * @param aValue      Value for the specific accessory capability.
       
   140          * @return TInt Error code. system-wide error code if failed.
       
   141          *            Specifically:
       
   142          *            KErrArgument if an argument is out of range.
       
   143          */
       
   144         TInt NotifyValueChange( 
       
   145                 const TUint32& aName,
       
   146                 const CAccPolObjectCon& aValue ) const;
       
   147         
       
   148     private: // Functions from base classes
       
   149 
       
   150         /**
       
   151         * RunL()
       
   152         */
       
   153         void RunL();
       
   154 
       
   155         /**
       
   156         * DoCancel()
       
   157         */
       
   158         void DoCancel();
       
   159 
       
   160     private:  // Constructors
       
   161 
       
   162         /**
       
   163         * C++ constructor.
       
   164         * @param aFSM A FSM.
       
   165         */
       
   166         CAccessoryControlIf( MFSMForBody& aFSM );
       
   167 
       
   168         /**
       
   169         * Symbian 2nd phase constructor.
       
   170         * 
       
   171         * @since S60 TB9.2
       
   172         * @param aAccessoryServer Accessory Server
       
   173          */
       
   174         void ConstructL(
       
   175                 RAccessoryServer& aAccessoryServer );
       
   176 
       
   177 
       
   178     private:  // Data
       
   179 
       
   180         // A FSM pointer.
       
   181         // Not own.
       
   182         MFSMForBody& iFSM;
       
   183         
       
   184         // Accessory Control API
       
   185         RAccessoryControl iAccessoryControl;
       
   186         
       
   187         // Generic ID pointer.
       
   188         // Own.
       
   189         CAccConGenericID* iGenericIDPtr;
       
   190         
       
   191         // Id of the active (object) request 
       
   192         TInt iActiveRequestId;
       
   193 
       
   194         // Indicates whether Composite cable has been
       
   195         // connected by calling RAccessoryControl::ConnectAccessory()
       
   196         TBool iAccessoryConnected; 
       
   197     };
       
   198 
       
   199 #endif // C_ACCESSORYCONTROLIF_H