accessoryservices/accessoryserver/inc/Server/AccSrvSubMode.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 Mode
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 
       
    20 #ifndef CACCSRVSUBMODE_H
       
    21 #define CACCSRVSUBMODE_H
       
    22 
       
    23 // INCLUDES
       
    24 #include "AsyProxyAPI.h"
       
    25 #include "AccSrvSubBase.h"
       
    26 #include <e32base.h>
       
    27 
       
    28 // CONSTANTS
       
    29 
       
    30 // MACROS
       
    31 
       
    32 // DATA TYPES
       
    33 
       
    34 // FUNCTION PROTOTYPES
       
    35 
       
    36 // FORWARD DECLARATIONS
       
    37 class CAccSrvMainSession;
       
    38 
       
    39 // CLASS DECLARATION
       
    40 
       
    41 /**
       
    42 *  Accessory Mode server-side sub-session implementation.
       
    43 *
       
    44 *  AccServer.lib
       
    45 *  @since S60 3.1
       
    46 */
       
    47 NONSHARABLE_CLASS( CAccSrvSubMode ) : public CAccSrvSubBase
       
    48     {
       
    49     public: // Constructors and destructor
       
    50 
       
    51         /**
       
    52         * Two-phased constructor.
       
    53         * @since S60 3.1
       
    54         * @param aSession              Handle to the ASY Proxy.
       
    55         * @param aConnectionController Handle to the Connection Controller.
       
    56         * @param aServerModel          Handle to the Server Model.
       
    57         * @return Pointer to a new subsession
       
    58         */
       
    59         static CAccSrvSubMode* NewL( CASYProxyAPI* aSession,
       
    60                                      CAccSrvConnectionController* aConnectionController,
       
    61                                      CAccSrvServerModel* aServerModel );
       
    62 
       
    63         /**
       
    64         * Destructor.
       
    65         */
       
    66         ~CAccSrvSubMode();
       
    67 
       
    68     public: // New functions
       
    69 
       
    70     public: // Functions from base classes
       
    71         
       
    72         /**
       
    73         * From CAccSrvSubBase
       
    74         * Handles received messages from client.
       
    75         * @since S60 3.1
       
    76         * @param aMessage Client request.
       
    77         * @return void
       
    78         */
       
    79         void DispatchMessageL( const RMessage2& aMessage );
       
    80 
       
    81         /**
       
    82         * From MQueueObserver.
       
    83         * Called when Queue passes message completion handling to registered observers.
       
    84         *
       
    85         * @since S60 3.1
       
    86         * @param aMsgID     Message in question.
       
    87         * @param aErrorCode Error Code of the operation.
       
    88         * @param aUniqueID  Unique ID of the Generic ID in question.
       
    89         * @return ETrue if the message was consumpted by a observer.
       
    90         *               Call-back order must be renewed after consumption
       
    91         *               if further call-backs are needed.
       
    92         */
       
    93         virtual TBool CompleteMessageL( TMsgID aMsgID,
       
    94                                         TInt aErrorCode,
       
    95                                         TInt aUniqueID );
       
    96 
       
    97     protected: // New functions
       
    98 
       
    99     protected:  // Functions from base classes
       
   100 
       
   101     private: // New functions
       
   102 
       
   103         /**
       
   104         * C++ default constructor.
       
   105         */
       
   106         CAccSrvSubMode( CASYProxyAPI* aSession,
       
   107                         CAccSrvConnectionController* aConnectionController,
       
   108                         CAccSrvServerModel* aServerModel );
       
   109 
       
   110         /**
       
   111         * By default Symbian 2nd phase constructor.
       
   112         */
       
   113         void ConstructL();
       
   114 
       
   115         /**
       
   116         * Handles GetAccessoryMode() client request.
       
   117         * If leave occurs, the client request is completed with that error code.
       
   118         *
       
   119         * @since S60 3.1
       
   120         * @param aMessage Client request.
       
   121         * @return void
       
   122         */
       
   123         void GetAccessoryModeL( const RMessage2& aMessage );
       
   124 
       
   125         /**
       
   126         * Handles GetAccessoryMode() asynchronous client request.
       
   127         * If leave occurs, the client request is completed with that error code.
       
   128         *
       
   129         * @since S60 3.1
       
   130         * @param aMessage Client request.
       
   131         * @return void
       
   132         */
       
   133         void GetAccessoryModeAsyncL( const RMessage2& aMessage );
       
   134 
       
   135         /**
       
   136         * Handles CancelGetAccessoryMode() client request.
       
   137         * If leave occurs, the client request is completed with that error code.
       
   138         *
       
   139         * @since S60 3.1
       
   140         * @param aMessage Client request.
       
   141         * @return void
       
   142         */
       
   143         void CancelGetAccessoryMode( const RMessage2& aMessage );
       
   144 
       
   145         /**
       
   146         * Handles NotifyAccessoryModeChanged() client request.
       
   147         * If leave occurs, the client request is completed with that error code.
       
   148         *
       
   149         * @since S60 3.1
       
   150         * @param aMessage Client request.
       
   151         * @return void
       
   152         */
       
   153         void NotifyAccessoryModeChangedL( const RMessage2& aMessage );
       
   154 
       
   155         /**
       
   156         * Handles CancelNotifyAccessoryModeChanged() client request.
       
   157         * If leave occurs, the client request is completed with that error code.
       
   158         *
       
   159         * @since S60 3.1
       
   160         * @param aMessage Client request.
       
   161         * @return void
       
   162         */
       
   163         void CancelNotifyAccessoryModeChanged( const RMessage2& aMessage );
       
   164 
       
   165         /**
       
   166         * Completes Accessory Mode request.
       
   167         *
       
   168         * @since S60 3.1
       
   169         * @param aMessage       RMessage2 to be completed.Client request.
       
   170         * @param aErrorCode     Error code for message completion.
       
   171         * @param aAccessoryMode Most recent accessory mode what client have.
       
   172         * @return void
       
   173         */
       
   174         void Complete( const RMessage2& aMessage,
       
   175                        TInt aErrorCode,
       
   176                        TAccPolAccessoryMode& aAccessoryMode );
       
   177 
       
   178     public:     // Data
       
   179 
       
   180     protected:  // Data
       
   181 
       
   182     private:    // Data
       
   183 
       
   184         // Stored NotifyAccessoryModeChangedL() client request for later completion.
       
   185         RMessage2 iNotifyAccessoryModeChanged;
       
   186 
       
   187         // Stored GetAccessoryModeAsyncL() client request for later completion.
       
   188         RMessage2 iGetAccessoryModeAsync;
       
   189 
       
   190         // NotifyAccessoryModeChanged() is not reordered fast enough 
       
   191         // (e.g. due to different process sceduling by kernel).
       
   192         // When notification is re-ordered, iRecentAccessoryMode is used 
       
   193         // to check such situation.
       
   194         // This is also most recent accessory mode what client have.
       
   195         TAccPolAccessoryMode iRecentAccessoryMode;
       
   196 
       
   197         //First notification order is not completed directly.
       
   198         TBool                iFirstOrder;
       
   199 
       
   200     public:     // Friend classes
       
   201 
       
   202     protected:  // Friend classes
       
   203 
       
   204     private:    // Friend classes
       
   205 
       
   206     };
       
   207 
       
   208 #endif // CACCSRVSUBMODE_H
       
   209 
       
   210 // End of File