accessoryservices/accessoryserver/inc/Server/AccSrvSubBTControl.h
changeset 0 4e1aa6a622a0
equal deleted inserted replaced
-1:000000000000 0:4e1aa6a622a0
       
     1 /*
       
     2 * Copyright (c) 2002-2009 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 BT Control
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 
       
    20 #ifndef CACCSRVSUBBTCONTROL_H
       
    21 #define CACCSRVSUBBTCONTROL_H
       
    22 
       
    23 // INCLUDES
       
    24 #include "AccSrvSubControl.h"
       
    25 #include <e32base.h>
       
    26 #include <btmanclient.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 BT Control server-side sub-session implementation
       
    43 *
       
    44 *  AccServer.lib
       
    45 *  @since S60 3.1
       
    46 */
       
    47 NONSHARABLE_CLASS( CAccSrvSubBTControl ) : public CAccSrvSubControl
       
    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 CAccSrvSubBTControl* NewL( CASYProxyAPI* aSession,
       
    60                                           CAccSrvConnectionController* aConnectionController,
       
    61                                           CAccSrvServerModel* aServerModel );
       
    62 
       
    63         /**
       
    64         * Destructor.
       
    65         */
       
    66         ~CAccSrvSubBTControl();
       
    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         TBool CompleteMessageL( TMsgID aMsgID,
       
    94                                 TInt aErrorCode,
       
    95                                 TInt aUniqueID );
       
    96 
       
    97     protected:  // New functions
       
    98 
       
    99         /**
       
   100         * C++ default constructor.
       
   101         */
       
   102         CAccSrvSubBTControl( CASYProxyAPI* aSession,
       
   103                              CAccSrvConnectionController* aConnectionController,
       
   104                              CAccSrvServerModel* aServerModel );
       
   105 
       
   106         /**
       
   107         * Symbian 2nd phase constructor.
       
   108         */
       
   109         void ConstructL();
       
   110 
       
   111     private:  // New functions
       
   112 
       
   113         /**
       
   114         * Handles Bluetooth ConnectAccessory() client request.
       
   115         * If leave occurs, the client request is completed with that error code.
       
   116         *
       
   117         * @since S60 3.1
       
   118         * @param aMessage Client request.
       
   119         * @return void
       
   120         */
       
   121         void BluetoothConnectAccessoryL( const RMessage2& aMessage );
       
   122 
       
   123         /**
       
   124         * Handles Bluetooth DisconnectAccessory() client request.
       
   125         * If leave occurs, the client request is completed with that error code.
       
   126         *
       
   127         * @since S60 3.1
       
   128         * @param aMessage Client request.
       
   129         * @return void
       
   130         */
       
   131         void BluetoothDisconnectAccessoryL( const RMessage2& aMessage );
       
   132 
       
   133         /**
       
   134         * Handles BluetoothAudioLinkOpenRespL() client request.
       
   135         * If leave occurs, the client request is completed with that error code.
       
   136         *
       
   137         * @since S60 3.1
       
   138         * @param aMessage Client request.
       
   139         * @return void
       
   140         */
       
   141         void BluetoothAudioLinkOpenRespL( const RMessage2& aMessage );
       
   142 
       
   143         /**
       
   144         * Handles BluetoothAudioLinkCloseRespL() client request.
       
   145         * If leave occurs, the client request is completed with that error code.
       
   146         *
       
   147         * @since S60 3.1
       
   148         * @param aMessage Client request.
       
   149         * @return void
       
   150         */
       
   151         void BluetoothAudioLinkCloseRespL( const RMessage2& aMessage );
       
   152 
       
   153         /**
       
   154         * Handles BluetoothAudioLinkOpenedNotifyL() client request.
       
   155         * If leave occurs, the client request is completed with that error code.
       
   156         *
       
   157         * @since S60 3.1
       
   158         * @param aMessage Client request.
       
   159         * @return void
       
   160         */
       
   161         void BluetoothAudioLinkOpenedNotifyL( const RMessage2& aMessage );
       
   162 
       
   163         /**
       
   164         * Handles BluetoothAudioLinkClosedNotifyL() client request.
       
   165         * If leave occurs, the client request is completed with that error code.
       
   166         *
       
   167         * @since S60 3.1
       
   168         * @param aMessage Client request.
       
   169         * @return void
       
   170         */
       
   171         void BluetoothAudioLinkClosedNotifyL( const RMessage2& aMessage );
       
   172 
       
   173         /**
       
   174         * Handles NotifyBluetoothAudioLinkOpenReq() client request.
       
   175         * If leave occurs, the client request is completed with that error code.
       
   176         *
       
   177         * @since S60 3.1
       
   178         * @param aMessage Client request.
       
   179         * @return void
       
   180         */
       
   181         void NotifyBluetoothAudioLinkOpenReqL( const RMessage2& aMessage );
       
   182 
       
   183         /**
       
   184         * Handles NotifyBluetoothAudioLinkCloseReq() client request.
       
   185         * If leave occurs, the client request is completed with that error code.
       
   186         *
       
   187         * @since S60 3.1
       
   188         * @param aMessage Client request.
       
   189         * @return void
       
   190         */
       
   191         void NotifyBluetoothAudioLinkCloseReqL( const RMessage2& aMessage );
       
   192 
       
   193         /**
       
   194         * Handles NotifyAccessoryValueChanged() TBool client request (From BTControl API).
       
   195         * If leave occurs, the client request is completed with that error code.
       
   196         *
       
   197         * @since S60 3.1
       
   198         * @param aMessage Client request.
       
   199         * @return void
       
   200         */
       
   201         void NotifyBTAccessoryValueChangedTBoolL( const RMessage2& aMessage );
       
   202 
       
   203         /**
       
   204         * Handles NotifyAccessoryValueChanged() TInt client request (From BTControl API).
       
   205         * If leave occurs, the client request is completed with that error code.
       
   206         *
       
   207         * @since S60 3.2
       
   208         * @param aMessage Client request.
       
   209         * @return void
       
   210         */
       
   211         void NotifyBTAccessoryValueChangedTIntL( const RMessage2& aMessage );
       
   212 
       
   213         /**
       
   214         * Handles CancelNotifyBluetoothAudioLinkOpenReq() client request.
       
   215         * If leave occurs, the client request is completed with that error code.
       
   216         *
       
   217         * @since S60 3.1
       
   218         * @param aMessage Client request.
       
   219         * @return void
       
   220         */
       
   221         void CancelNotifyBluetoothAudioLinkOpenReq( const RMessage2& aMessage );
       
   222 
       
   223         /**
       
   224         * Handles CancelNotifyBluetoothAudioLinkCloseReq() client request.
       
   225         * If leave occurs, the client request is completed with that error code.
       
   226         *
       
   227         * @since S60 3.1
       
   228         * @param aMessage Client request.
       
   229         * @return void
       
   230         */
       
   231         void CancelNotifyBluetoothAudioLinkCloseReq( const RMessage2& aMessage );
       
   232 
       
   233         /**
       
   234         * Handles CancelConnectAccessory() client request.
       
   235         * If leave occurs, the client request is completed with that error code.
       
   236         *
       
   237         * @since S60 3.1
       
   238         * @param aMessage Client request.
       
   239         * @return void
       
   240         */
       
   241         void CancelConnectAccessory( const RMessage2& aMessage );
       
   242 
       
   243         /**
       
   244         * Handles CancelDisconnectAccessory() client request.
       
   245         * If leave occurs, the client request is completed with that error code.
       
   246         *
       
   247         * @since S60 3.1
       
   248         * @param aMessage Client request.
       
   249         * @return void
       
   250         */
       
   251         void CancelDisconnectAccessory( const RMessage2& aMessage );
       
   252 
       
   253         /**
       
   254         * This will reset the AudioLinkOpen cancellation flag.
       
   255         * The flag is reseted if both BluetoothAudioLinkOpenRespL() and 
       
   256         * BluetoothAudioLinkOpenedNotifyL() are received.
       
   257         * The flag is also reseted if BluetoothAudioLinkOpenRespL() is
       
   258         * called with error response (i.e. AudioLinkOpen is failed)
       
   259         *
       
   260         * @since S60 3.1
       
   261         * @param aResponse Indicates the status of the BluetoothAudioLinkOpenRespL().
       
   262         * @return void
       
   263         */
       
   264         void ResetAudioLinkOpenCancelFlag( TInt aResponse );
       
   265         
       
   266         /**
       
   267         * This will reset the AudioLinkClose cancellation flag.
       
   268         * The flag is reseted if both BluetoothAudioLinkCloseRespL() and 
       
   269         * BluetoothAudioLinkClosedNotifyL() are received.
       
   270         * The flag is also reseted if BluetoothAudioLinkCloseRespL() is
       
   271         * called with error response (i.e. AudioLinkClose is failed)
       
   272         *
       
   273         * @since S60 3.1
       
   274         * @param aResponse Indicates the status of the BluetoothAudioLinkCloseRespL().
       
   275         * @return void
       
   276         */
       
   277         void ResetAudioLinkCloseCancelFlag( TInt aResponse );
       
   278         
       
   279         /**
       
   280         * Convert TBTDevAddr to TUint64 format.
       
   281         *
       
   282         * @since S60 3.1
       
   283         * @param aBTDevAddr BT device address.
       
   284         * @return BT device address in TUint64 format.
       
   285         */
       
   286         TUint64 MakeTUint64( const TBTDevAddr& aBTDevAddr );
       
   287 
       
   288     public:     // Data
       
   289 
       
   290     protected:  // Data
       
   291 
       
   292     private:    // Data
       
   293 
       
   294         //Stored BT ConnectAccessory() client request for later completion.
       
   295         RMessage2 iConnectBluetoothAccessoryMsg;
       
   296 
       
   297         //Stored NotifyBluetoothAudioLinkCloseReq() client request for later completion.
       
   298         RMessage2 iNotifyBluetoothAudioLinkCloseReqMsg;
       
   299 
       
   300         //Stored NotifyBluetoothAudioLinkOpenReq() client request for later completion.
       
   301         RMessage2 iNotifyBluetoothAudioLinkOpenReqMsg;
       
   302         
       
   303         //This will count that both BluetoothAudioLinkOpenRespL() and 
       
   304         //BluetoothAudioLinkOpenedNotifyL() are received.
       
   305         TBool iAudioLinkOpenCancelFlagResetCalledTwice;
       
   306         
       
   307         //This will count that both BluetoothAudioLinkCloseRespL() and 
       
   308         //BluetoothAudioLinkClosedNotifyL() are received.
       
   309         TBool iAudioLinkCloseCancelFlagResetCalledTwice;
       
   310 
       
   311     public:     // Friend classes
       
   312 
       
   313     protected:  // Friend classes
       
   314 
       
   315     private:    // Friend classes
       
   316 
       
   317     };
       
   318 
       
   319 #endif // CACCSRVSUBBTCONTROL_H
       
   320 
       
   321 // End of File