accessoryservices/accessoryremotecontrol/inc/remconkeyeventconverter/RemConKeyEventConverter.h
changeset 0 4e1aa6a622a0
equal deleted inserted replaced
-1:000000000000 0:4e1aa6a622a0
       
     1 /*
       
     2 * Copyright (c) 2002-2005 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:  CRemConKeyEventConverter -class.
       
    15 *                    Defines the Accessory Key event handling API of
       
    16 *                    Accessory Framework.
       
    17 *
       
    18 */
       
    19 
       
    20 
       
    21 
       
    22 #ifndef CREMCONKEYEVENTCONVERTER_H
       
    23 #define CREMCONKEYEVENTCONVERTER_H
       
    24 
       
    25 //  INCLUDES
       
    26 #include <e32base.h>
       
    27 #include <remcon/remconconverterplugin.h>
       
    28 #include <remcon/remconconverterinterface.h>
       
    29 #include "RemConKeyEventData.h"
       
    30 
       
    31 // DATA TYPES
       
    32 typedef TPckgBuf<TRemConKeyEventData> TRemConKeyEventDataBuf;
       
    33 
       
    34 // FORWARD DECLARATIONS
       
    35 class CRemConKeyEventConverterImpl;
       
    36 
       
    37 // CLASS DECLARATION
       
    38 /**
       
    39 *  CRemConKeyEventConverter defines the ASY Key event handling API of Accessory
       
    40 *  Framework.
       
    41 * 
       
    42 *  @lib 
       
    43 *  @since S60 3.0
       
    44 */
       
    45 class CRemConKeyEventConverter : public CRemConConverterPlugin, 
       
    46  								 public MRemConConverterInterface
       
    47 	{
       
    48     public:  // Constructors and destructor
       
    49         
       
    50         /**
       
    51         * Two-phased constructor.
       
    52         */
       
    53         static CRemConKeyEventConverter* NewL();
       
    54         
       
    55         /**
       
    56         * Destructor.
       
    57         */
       
    58         virtual ~CRemConKeyEventConverter();
       
    59 
       
    60     public: // New functions
       
    61         
       
    62     public: // Functions from base classes
       
    63 	    
       
    64     protected:  // Functions from base classes
       
    65     
       
    66     private:	// From CRemConConverterPlugin
       
    67     
       
    68     	/**
       
    69 		* Called by RemCon server to get a pointer to an object which implements
       
    70 		* the converter API with UID aUid. This is a mechanism for allowing 
       
    71 		* future change to the converter API without breaking BC in existing 
       
    72 		* (non-updated) converter plugins.
       
    73 		* @since S60 3.0
       
    74         * @param aUid aUid Identifies converter API version.
       
    75 		*/
       
    76         TAny* GetInterface( TUid aUid );
       
    77     	
       
    78     private:	// From MRemConConverterInterface
       
    79     	
       
    80     	/** 
       
    81         * Called by the server to get the converter to convert from the 
       
    82         * interface See remconconverterplugin.h for function declaration 
       
    83         * details.
       
    84         * Not implemented in key event converter. Returns KErrNone.
       
    85         */
       
    86         TInt InterfaceToBearer(TUid aInterfaceUid, 
       
    87             TUint aOperationId,
       
    88             const TDesC8& aData,
       
    89             TRemConMessageType aMsgType, 
       
    90             TDes8& aBearerData) const;
       
    91 
       
    92         /** 
       
    93         * Tells the converter to convert from the bearer -specific format to
       
    94         * the interface (API) format.
       
    95         * The key-event data has to be passed in the descriptor as of type
       
    96         * TRemConKeyEventDataBuf.
       
    97         * @since S60 3.0
       
    98         * @param aBearerData Bearer input (of type TRemConKeyEventDataBuf).
       
    99         * @param aInterfaceUid The interface UID from Converter.
       
   100         * @param aOperationId Operation ID from Converter.
       
   101         * @param aMsgType The type of the message (not used).
       
   102         * @param aData Data associated with the operation.
       
   103         * @return KErrNone if successfull, KErrNotSupported if matching 
       
   104         * key-event was found from Accessory Policy but functionality defined 
       
   105         * for the key event is not currently supported and KErrGeneral if 
       
   106         * passed data is not valid or some other non-recoverable error has 
       
   107         * occurred.
       
   108         */
       
   109         TInt BearerToInterface(const TDesC8& aBearerData,
       
   110             TUid& aInterfaceUid, 
       
   111             TUint& aOperationId,
       
   112             TRemConMessageType& aMsgType, 
       
   113             TDes8& aData) const;
       
   114 
       
   115         /**
       
   116         * Called by the server to get the interface and bearer, the formats of
       
   117         *  which this converter converts between.
       
   118         * @since S60 3.0
       
   119         * @param aInterfaceUid The interface UID.
       
   120         * @param aBearerUid The bearer UID.
       
   121         * @return ETrue if the parameters match with UIDs defined in the 
       
   122         *           converter, otherwise EFalse.
       
   123         */
       
   124         TBool SupportedUids(const TUid& aInterfaceUid, 
       
   125             const TUid& aBearerUid) const;
       
   126 
       
   127         /**
       
   128         * Called by the server to find out if this converter converts between 
       
   129         * the formats of this bearer interface and RemCon interface.
       
   130         * @since S60 3.0
       
   131         * @param aInterfaceData The identifier of this interface in a bearer 
       
   132         *   defined format.
       
   133         * @param aBearerUid The bearer UID.
       
   134         * @return ETrue if the parameters match with corresponding values 
       
   135         *   defined in the converter, otherwise EFalse.
       
   136         */
       
   137         TBool SupportedInterface(const TDesC8& aInterfaceData, 
       
   138             const TUid& aBearerUid) const;
       
   139     	    	
       
   140     private:
       
   141 
       
   142         /**
       
   143         * C++ default constructor.
       
   144         */
       
   145         CRemConKeyEventConverter();
       
   146 
       
   147         /**
       
   148         * By default Symbian 2nd phase constructor is private.
       
   149         */
       
   150         void ConstructL();
       
   151         
       
   152     private:    // Data
       
   153         // Instance of CAccFWKeyEventConverterImpl implementation class.
       
   154         CRemConKeyEventConverterImpl* iImpl;
       
   155 
       
   156     };
       
   157 
       
   158 #endif      // CREMCONKEYEVENTCONVERTER_H   
       
   159             
       
   160 // End of File