accessoryservices/accessoryserver/inc/ASYProxy/ASYProxyCommsService.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:  Communication channel to Accessory server
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 #ifndef CASYPROXYCOMMSSERVICE_H
       
    20 #define CASYPROXYCOMMSSERVICE_H
       
    21 
       
    22 // INCLUDES
       
    23 #include "ASYProxyCommandObserver.h"
       
    24 #include "AccessoryAsyComms.h"
       
    25 #include <AsyCmdTypes.h>
       
    26 #include <e32std.h>
       
    27 #include <e32base.h>
       
    28 
       
    29 // CONSTANTS
       
    30 
       
    31 // MACROS
       
    32 
       
    33 // DATA TYPES
       
    34 
       
    35 // FUNCTION PROTOTYPES
       
    36 
       
    37 // FORWARD DECLARATIONS
       
    38 class CASYProxyCommsStack;
       
    39 class CASYCommandHandlerBase;
       
    40 class CASYMainServiceBase;
       
    41 
       
    42 // CLASS DECLARATION
       
    43 
       
    44 /**
       
    45 *  Creates communication channel to Accessory server
       
    46 *    using RAccessoryAsyComms -client.
       
    47 *  Creates CASYCommandHandlerBase -object, handler part of ASY.
       
    48 *
       
    49 *  @lib ASYProxy.dll
       
    50 *  @since S60 3.1
       
    51 */
       
    52 class CASYProxyCommsService : public CBase
       
    53     {
       
    54     public: // Constructors and destructor
       
    55 
       
    56         /**
       
    57         * Two-phased constructor.
       
    58         */
       
    59         static CASYProxyCommsService* NewL( const TUid aHandlerUid,
       
    60                                             const TUid aMainServiceUid );
       
    61 
       
    62         /**
       
    63         * Destructor.
       
    64         */
       
    65         virtual ~CASYProxyCommsService();
       
    66 
       
    67     public: // New functions
       
    68 
       
    69         /**
       
    70         * Creates CASYCommandHandlerBase -object.
       
    71         * @since S60 3.1
       
    72         * @param aASYProxyCommandObserver Pointer to Observer object
       
    73         * @return void
       
    74         */
       
    75         void CreateAsyCommandHandlerL(
       
    76                     CASYProxyCommandObserver* aASYProxyCommandObserver );
       
    77 
       
    78         /**
       
    79         * Gets session to Accessory server
       
    80         * @since S60 3.1
       
    81         * @param void
       
    82         * @return Session to server
       
    83         */
       
    84         RAccessoryServer& GetServerSession();
       
    85 
       
    86     public: // Functions from base classes
       
    87 
       
    88     protected: // New functions
       
    89 
       
    90     protected: // Functions from base classes
       
    91 
       
    92     private:
       
    93 
       
    94         /**
       
    95         * C++ default constructor.
       
    96         */
       
    97         CASYProxyCommsService( const TUid aHandlerUid );
       
    98 
       
    99         /**
       
   100         * By default Symbian 2nd phase constructor is private.
       
   101         */
       
   102         void ConstructL( const TUid aMainServiceUid );
       
   103 
       
   104         /**
       
   105         * By default Symbian 2nd phase constructor is private.
       
   106         */
       
   107         void ConstructL();
       
   108 
       
   109         void Destroy( TInt aTrId );
       
   110         void UpdateAsyCommsStackL();
       
   111 
       
   112     public:     // Data
       
   113 
       
   114         // Pointer to a ASYMainService
       
   115         CASYMainServiceBase* iAsyMainServiceBase; // Not owned
       
   116 
       
   117     protected:  // Data
       
   118 
       
   119     private:    // Data
       
   120 
       
   121         // Client API of Accessory server
       
   122         RAccessoryAsyComms iAsyComms;
       
   123 
       
   124         // Implementation uid of ASY's handler object to be created
       
   125         TUid iHandlerUid;
       
   126 
       
   127         // Pointer to a commands stack object
       
   128         CASYProxyCommsStack* iAsyProxyCommsStack; // Owned
       
   129 
       
   130         // Pointer to a handler object of ASY.
       
   131         //  This class creates
       
   132         //  CASYProxyCommandObserver deletes
       
   133         CASYCommandHandlerBase *iAsyCmdHndlr;
       
   134 
       
   135         // Accessory server's client
       
   136         RAccessoryServer iServer;
       
   137 
       
   138         // Dummy observer for zero ( non existing ) handler
       
   139         // This AO is needed for obligatory CActiveScheduler::Start()
       
   140         CASYProxyCommandObserver* iZeroObserver;
       
   141 
       
   142     public:     // Friend classes
       
   143 
       
   144     protected:  // Friend classes
       
   145 
       
   146     private:    // Friend classes
       
   147 
       
   148         friend class CASYProxyCommandObserver;
       
   149     };
       
   150 
       
   151 #endif // CASYPROXYCOMMSSERVICE_H
       
   152 
       
   153 // End of File