systemswstubs/wiredbearerreference/inc/WiredAccessoryKeyEventHandler.h
branchRCL_3
changeset 44 b5894bb67e73
parent 35 37b610eb7fe3
equal deleted inserted replaced
35:37b610eb7fe3 44:b5894bb67e73
     1 /*
       
     2 * Copyright (c) 2002-2004 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:  Used as an reference implementation.
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 
       
    20 #ifndef WIREDACCESSORYKEYEVENTHANDLER_H
       
    21 #define WIREDACCESSORYKEYEVENTHANDLER_H
       
    22 
       
    23 //  INCLUDES
       
    24 #include <remcon/remconbearerinterface.h>
       
    25 #include <remcon/remconbearerplugin.h>
       
    26 #include <remcon/remconbearerobserver.h>
       
    27 #include <remcon/messagetype.h> // from RemCon
       
    28 #include <RemConKeyEventData.h>
       
    29 #include "MAdaptation.h"
       
    30 
       
    31 // CONSTANTS
       
    32 
       
    33 // MACROS
       
    34 
       
    35 // DATA TYPES
       
    36 
       
    37 // FUNCTION PROTOTYPES
       
    38 
       
    39 // FORWARD DECLARATIONS
       
    40 class TBearerParams;
       
    41 class TAdaptationMessage;
       
    42 
       
    43 // CLASS DECLARATION
       
    44 
       
    45 /**
       
    46 *  Declaration of CWiredAccessoryKeyEventHandler class.
       
    47 */
       
    48 class CWiredAccessoryKeyEventHandler : public CRemConBearerPlugin, public MAdaptation, public MRemConBearerInterface
       
    49     {
       
    50     public:  // Constructors and destructor
       
    51 
       
    52         /**
       
    53         * Two-phased constructor.
       
    54         * @param aBearerParams
       
    55         */
       
    56         static CWiredAccessoryKeyEventHandler* NewL( TBearerParams& aBearerParams );
       
    57 
       
    58         /**
       
    59         * Destructor.
       
    60         */
       
    61         virtual ~CWiredAccessoryKeyEventHandler();
       
    62 
       
    63     private: // Constructors
       
    64 
       
    65         /**
       
    66         * C++ constructor.
       
    67         * @param aBearerParams
       
    68         */
       
    69         CWiredAccessoryKeyEventHandler( TBearerParams& aBearerParams );
       
    70 
       
    71         /**
       
    72         * Symbian 2nd phase constructor.
       
    73         * @return void
       
    74         */
       
    75         void ConstructL();
       
    76 
       
    77     private: // Functions from base classes
       
    78 
       
    79         /**
       
    80         * From CRemConBearerPlugin
       
    81         *
       
    82         * Called by RemCon server to get a pointer to
       
    83         * an object which implements the bearer API
       
    84         * @param aUid
       
    85         * @return TAny*
       
    86         */
       
    87         TAny* GetInterface( TUid aUid );
       
    88 
       
    89         /**
       
    90         * From MRemConBearerInterface
       
    91         *
       
    92         * Called by RemCon to retrieve a response on a
       
    93         * connection. Must only be  called as a result
       
    94         * of a NewResponse up-call.
       
    95         * @param aInterfaceUid
       
    96         * @param aTransactionId
       
    97         * @param aOperationId
       
    98         * @param aData, On success, ownership is returned.
       
    99         * @param aAddr
       
   100         * @return Error code.
       
   101         */
       
   102         TInt GetResponse( TUid& aInterfaceUid,
       
   103                           TUint& aTransactionId,
       
   104                           TUint& aOperationId,
       
   105                           RBuf8& aData,
       
   106                           TRemConAddress& aAddr );
       
   107 
       
   108         /**
       
   109         * From MRemConBearerInterface
       
   110         *
       
   111         * Called by RemCon to retrieve a command on a
       
   112         * connection. Must only be called as a result of
       
   113         * a NewCommand up-call.
       
   114         * @param aInterfaceUid
       
   115         * @param aTransactionId
       
   116         * @param aOperationId
       
   117         * @param aCommandData, On success, ownership is returned.
       
   118         * @param aAddr
       
   119         * @return Error code.
       
   120         */
       
   121         TInt GetCommand( TUid& aInterfaceUid,
       
   122                          TUint& aTransactionId,
       
   123                          TUint& aOperationId,
       
   124                          RBuf8& aCommandData,
       
   125                          TRemConAddress& aAddr );
       
   126                          
       
   127         /**
       
   128         * From MRemConBearerInterface
       
   129         *
       
   130         * Called by RemCon to send a command on a connection.
       
   131         * The connection is not assumed to exist- the bearer
       
   132         * is responsible for bringing up the requested.
       
   133         * connection if necessary.
       
   134         * @param aInterfaceUid
       
   135         * @param aOperationId
       
   136         * @param aTransactionId
       
   137         * @param aData, On success, ownership is passed.
       
   138         * @param aAddr
       
   139         * @return Error code.
       
   140         */
       
   141         TInt SendCommand( TUid aInterfaceUid,
       
   142                           TUint aOperationId,
       
   143                           TUint aTransactionId,
       
   144                           RBuf8& aData,
       
   145                           const TRemConAddress& aAddr );
       
   146 
       
   147         /**
       
   148         * From MRemConBearerInterface
       
   149         *
       
   150         * Called by RemCon to send a response on a connection.
       
   151         * The connection is not assumed to exist- the bearer is
       
   152         * responsible for bringing up the requested connection if necessary.
       
   153         * @param aInterfaceUid
       
   154         * @param aOperationId
       
   155         * @param aTransactionId
       
   156         * @param aData, On success, ownership is passed.
       
   157         * @param aAddr
       
   158         * @return Error code.
       
   159         */
       
   160         TInt SendResponse( TUid aInterfaceUid,
       
   161                            TUint aOperationId,
       
   162                            TUint aTransactionId,
       
   163                            RBuf8& aData,
       
   164                            const TRemConAddress& aAddr );
       
   165 
       
   166         /**
       
   167         * From MRemConBearerInterface
       
   168         *
       
   169         * Called by RemCon to establish a bearer-level
       
   170         * connection to another party. Completion is signalled
       
   171         * back in ConnectConfirm.
       
   172         * @param aAddr
       
   173         * @return void
       
   174         */
       
   175         void ConnectRequest( const TRemConAddress& aAddr );
       
   176 
       
   177         /**
       
   178         * From MRemConBearerInterface
       
   179         *
       
   180         * Called by RemCon to destroy a bearer-level connection to another party. 
       
   181         * Completion is signalled back in DisconnectConfirm.
       
   182         * @param aAddr
       
   183         * @return void
       
   184         */
       
   185         void DisconnectRequest( const TRemConAddress& aAddr );
       
   186 
       
   187         /**
       
   188         * From MRemConBearerInterface
       
   189         *
       
   190         * Called by RemCon when either (a) the number of controller clients changes 
       
   191         * from 0 to 1 or from 1 to 0, or (b) the number of target clients changes 
       
   192         * from 0 to 1 or from 1 to 0.
       
   193         * @param aControllerPresent
       
   194         * @param aTargetPresent
       
   195         */
       
   196         void ClientStatus( TBool aControllerPresent, TBool aTargetPresent );
       
   197 
       
   198         /**
       
   199         * From MRemConBearerInterface
       
   200         *
       
   201         * Called by RemCon to get the capabilities required to make/destroy
       
   202         * connections over the bearer, and to send and receive messages over
       
   203         * the bearer.
       
   204         * @return TSecurityPolicy
       
   205         */
       
   206         TSecurityPolicy SecurityPolicy() const;
       
   207 
       
   208     private: // Enumerations
       
   209 
       
   210         // internal states
       
   211         enum TAccKeyEventHandlerState
       
   212             {
       
   213             EAccKeyEventHandlerStateUnknown = -1,
       
   214             EAccKeyEventHandlerStateReady,
       
   215             EAccKeyEventHandlerStateNewCommand
       
   216             };
       
   217 
       
   218     private: // Functions from base classes
       
   219 
       
   220         /**
       
   221         * From MAdaptation
       
   222         */
       
   223         
       
   224         void ProcessResponseL( TAdaptationMessage& aMessage );
       
   225        
       
   226         void ProcessErrorResponseL( TInt aErrorCode, TAdaptationMessage& aMessage );
       
   227         
       
   228         void RaiseEventL( TAdaptationMessage& aMessage );
       
   229 
       
   230     private:    // Data
       
   231         
       
   232         // internal state
       
   233         TAccKeyEventHandlerState iState;
       
   234         
       
   235         // event data
       
   236         TUid iInterfaceUid;
       
   237         TUint iOperationId;
       
   238         TUint iTransactionId;
       
   239         TBuf8<64> iData;
       
   240 
       
   241     };
       
   242 
       
   243 #endif      // WIREDACCESSORYKEYEVENTHANDLER_H
       
   244 
       
   245 // End of File