accessoryservices/accessoryserver/inc/Server/AccSrvSubControl.h
changeset 0 4e1aa6a622a0
equal deleted inserted replaced
-1:000000000000 0:4e1aa6a622a0
       
     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:  Server-side sub-session of Accessory Control
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 
       
    20 #ifndef CACCSRVSUBCONTROL_H
       
    21 #define CACCSRVSUBCONTROL_H
       
    22 
       
    23 // INCLUDES
       
    24 #include "AccSrvSubConnection.h"
       
    25 #include <e32base.h>
       
    26 
       
    27 // CONSTANTS
       
    28 
       
    29 // MACROS
       
    30 
       
    31 // DATA TYPES
       
    32 
       
    33 // FUNCTION PROTOTYPES
       
    34 
       
    35 // FORWARD DECLARATIONS
       
    36 class CAccSrvMainSession;
       
    37 
       
    38 // CLASS DECLARATION
       
    39 
       
    40 /**
       
    41 *  Accessory Control server-side sub-session implementation
       
    42 *
       
    43 *  AccServer.lib
       
    44 *  @since S60 3.1
       
    45 */
       
    46 NONSHARABLE_CLASS( CAccSrvSubControl ) : public CAccSrvSubConnection
       
    47     {
       
    48     public: // Constructors and destructor
       
    49 
       
    50         /**
       
    51         * Two-phased constructor.
       
    52         * @since S60 3.1
       
    53         * @param aSession              Handle to the ASY Proxy.
       
    54         * @param aConnectionController Handle to the Connection Controller.
       
    55         * @param aServerModel          Handle to the Server Model.
       
    56         * @return Pointer to a new subsession
       
    57         */
       
    58         static CAccSrvSubControl* NewL( CASYProxyAPI* aSession,
       
    59                                         CAccSrvConnectionController* aConnectionController,
       
    60                                         CAccSrvServerModel* aServerModel );
       
    61 
       
    62         /**
       
    63         * Destructor.
       
    64         */
       
    65         virtual ~CAccSrvSubControl();
       
    66 
       
    67     public: // New functions
       
    68 
       
    69     public: // Functions from base classes
       
    70 
       
    71         /**
       
    72         * From CAccSrvSubBase.
       
    73         * Handles received messages from client. Sub classes of this base class
       
    74         * may or may not implement this, however, if message is not handled
       
    75         * in sub class, it should call this base class to handle it.
       
    76         * @since S60 3.1
       
    77         * @param aMessage Client request.
       
    78         * @return void
       
    79         */
       
    80         virtual void DispatchMessageL( const RMessage2& aMessage );
       
    81 
       
    82         /**
       
    83         * From MQueueObserver.
       
    84         * Called when Queue passes message completion handling to registered observers.
       
    85         *
       
    86         * @since S60 3.1
       
    87         * @param aMsgID     Message in question.
       
    88         * @param aErrorCode Error Code of the operation.
       
    89         * @param aUniqueID  Unique ID of the Generic ID in question.
       
    90         * @return ETrue if the message was consumpted by a observer.
       
    91         *               Call-back order must be renewed after consumption
       
    92         *               if further call-backs are needed.
       
    93         */
       
    94         virtual TBool CompleteMessageL( TMsgID aMsgID,
       
    95                                         TInt aErrorCode,
       
    96                                         TInt aUniqueID );
       
    97 
       
    98         /**
       
    99         * From MQueueObserver.
       
   100         * Called when Queue passes message completion handling to registered observers.
       
   101         * This is meant for GetValue() and SetValue() type of operations.
       
   102         *
       
   103         * @since S60 3.1
       
   104         * @param aMsgID       Message in question.
       
   105         * @param aCmdResponse Value of the operation, used in GetValue()
       
   106         *                     type of operations.
       
   107         * @param aErrorCode   Error Code of the operation.
       
   108         * @param aTrId        Transaction Id of the operation.
       
   109         * @return void
       
   110         */
       
   111         virtual void HandleValueMessageL( TMsgID aMsgID,
       
   112                                           TAccValueTypeTBool aValueTBool,
       
   113                                           TInt aErrorCode,
       
   114                                           TInt aTrId );
       
   115 
       
   116         /**
       
   117         * From MQueueObserver.
       
   118         * Called when Queue passes message completion handling to registered observers.
       
   119         * This is meant for GetValue() and SetValue() type of operations.
       
   120         *
       
   121         * @since S60 3.1
       
   122         * @param aMsgID       Message in question.
       
   123         * @param aCmdResponse Value of the operation, used in GetValue()
       
   124         *                     type of operations.
       
   125         * @param aErrorCode   Error Code of the operation.
       
   126         * @param aTrId        Transaction Id of the operation.
       
   127         * @return void
       
   128         */
       
   129         virtual void HandleValueMessageL( TMsgID aMsgID,
       
   130                                           TAccValueTypeTInt aValueTInt,
       
   131                                           TInt aErrorCode,
       
   132                                           TInt aTrId );
       
   133                                           
       
   134         /**
       
   135         * From MQueueObserver.
       
   136         * Called when Queue passes message completion handling to registered observers.
       
   137         * This is meant for GetValue() and SetValue() type of operations.
       
   138         *
       
   139         * @param aMsgID       Message in question.
       
   140         * @param aTrId        Transaction Id of the operation.
       
   141         * @param aPtrBuf      Value of the operation, used in GetValue()
       
   142         *                     type of operations.
       
   143         * @param aErrorCode   Error Code of the operation.
       
   144         * @return void
       
   145         */
       
   146         virtual void HandleValueMessageL( TMsgID aMsgID,
       
   147                                           TInt aTrId,
       
   148                                           TPtr8* aPtrBuf,
       
   149                                           TInt aErrorCode );       
       
   150 
       
   151     protected: // New functions
       
   152 
       
   153         /**
       
   154         * C++ default constructor.
       
   155         */
       
   156         CAccSrvSubControl( CASYProxyAPI* aSession,
       
   157                            CAccSrvConnectionController* aConnectionController,
       
   158                            CAccSrvServerModel* aServerModel );
       
   159 
       
   160         /**
       
   161         * Symbian 2nd phase constructor.
       
   162         */
       
   163         void ConstructL();
       
   164 
       
   165     private:  // New functions
       
   166         
       
   167         /**
       
   168         * Handles ConnectAccessory() client request.
       
   169         * If leave occurs, the client request is completed with that error code.
       
   170         *
       
   171         * @since S60 3.1
       
   172         * @param aMessage Client request.
       
   173         * @return void
       
   174         */
       
   175         void ConnectAccessory2L( const RMessage2& aMessage );
       
   176 
       
   177         /**
       
   178         * Handles DisconnectAccessory() client request.
       
   179         * If leave occurs, the client request is completed with that error code.
       
   180         *
       
   181         * @since S60 3.1
       
   182         * @param aMessage Client request.
       
   183         * @return void
       
   184         */
       
   185         void DisconnectAccessoryL( const RMessage2& aMessage );
       
   186 
       
   187         /**
       
   188         * Handles SetValueL() TBool client request.
       
   189         * If leave occurs, the client request is completed with that error code.
       
   190         *
       
   191         * @since S60 3.1
       
   192         * @param aMessage Client request.
       
   193         * @return void
       
   194         */
       
   195         void SetValueTBoolL( const RMessage2& aMessage );
       
   196 
       
   197         /**
       
   198         * Handles SetValueL() TInt client request.
       
   199         * If leave occurs, the client request is completed with that error code.
       
   200         *
       
   201         * @since S60 3.1
       
   202         * @param aMessage Client request.
       
   203         * @return void
       
   204         */
       
   205         void SetValueTIntL( const RMessage2& aMessage );
       
   206 
       
   207         /**
       
   208         * Handles SetValueL() CAccPolObjectBase client request.
       
   209         * If leave occurs, the client request is completed with that error code.
       
   210         *        
       
   211         * @param aMessage Client request.
       
   212         * @return void
       
   213         */
       
   214         void SetValueObjectBaseL( const RMessage2& aMessage );
       
   215 
       
   216         /**
       
   217         * Handles AccessoryValueChangedNotify() TBool client request.
       
   218         * If leave occurs, the client request is completed with that error code.
       
   219         *
       
   220         * @since S60 3.1
       
   221         * @param aMessage Client request.
       
   222         * @return void
       
   223         */
       
   224         void AccessoryValueChangedTBoolNotifyL( const RMessage2& aMessage );
       
   225 
       
   226         /**
       
   227         * Handles AccessoryValueChangedNotify() TInt client request.
       
   228         * If leave occurs, the client request is completed with that error code.
       
   229         *
       
   230         * @since S60 3.1
       
   231         * @param aMessage Client request.
       
   232         * @return void
       
   233         */
       
   234         void AccessoryValueChangedTIntNotifyL( const RMessage2& aMessage );
       
   235 
       
   236         /**
       
   237         * Handles AccessoryValueChangedNotify() object client request.
       
   238         * If leave occurs, the client request is completed with that error code.
       
   239         *
       
   240         * @since S60 5.2
       
   241         * @param aMessage Client request.
       
   242         * @return void
       
   243         */
       
   244         void AccessoryValueChangedObjectNotifyL( const RMessage2& aMessage );
       
   245 
       
   246         /**
       
   247         * 
       
   248         * @since S60 3.1
       
   249         * @param aMessage Client request.
       
   250         * @return void
       
   251         */
       
   252         void HandleSetValueTIntCompletionL( TInt aErrorCode, TInt aTrId );
       
   253 
       
   254         /**
       
   255         * 
       
   256         * @since S60 3.1
       
   257         * @param aMessage Client request.
       
   258         * @return void
       
   259         */
       
   260         void HandleSetValueTBoolCompletionL( TInt aErrorCode, TInt aTrId );
       
   261 
       
   262         /**
       
   263         *         
       
   264         * @param aMessage Client request.
       
   265         * @return void
       
   266         */
       
   267         void HandleSetValueObjectCompletion( TInt aErrorCode, TInt aTrId );
       
   268 
       
   269     public:     // Data
       
   270 
       
   271     protected:  // Data
       
   272 
       
   273     private:    // Data
       
   274 
       
   275        //Stored ConnectAccessory() client request for later completion.
       
   276         RMessage2 iConnectAccessoryMsg;
       
   277 
       
   278         //Stored SetValueL() TBool client request for later completion.
       
   279         RMessage2 iSetValueTBoolMsg;
       
   280 
       
   281         //Stored SetValueL() TInt client request for later completion.
       
   282         RMessage2 iSetValueTIntMsg;
       
   283         
       
   284         //Stored SetValueL() Object client request for later completion.
       
   285         RMessage2 iSetValueObjectMsg;
       
   286 
       
   287         //Transaction id for outstanding SetValueL()
       
   288         TInt      iOutstandingTrId;
       
   289 
       
   290     public:     // Friend classes
       
   291 
       
   292     protected:  // Friend classes
       
   293 
       
   294     private:    // Friend classes
       
   295 
       
   296     };
       
   297 
       
   298 #endif // CACCSRVSUBCONTROL_H
       
   299 
       
   300 // End of File