bluetoothengine/btsap/inc/BTSapHciExtensionMan.h
changeset 0 f63038272f30
equal deleted inserted replaced
-1:000000000000 0:f63038272f30
       
     1 /*
       
     2 * Copyright (c) 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: 
       
    15 *     This class holds the HCI Extension Conduit singleton
       
    16 *
       
    17 *
       
    18 */
       
    19 
       
    20 #ifndef BT_SERVER_HCIEXTENSIONMAN_H
       
    21 #define BT_SERVER_HCIEXTENSIONMAN_H
       
    22 
       
    23 //  INCLUDES
       
    24 #include <hciproxy.h>
       
    25 
       
    26 // CLASS DECLARATION
       
    27 /**
       
    28 * This class holds the HCI Extension Conduit instance and is the single interface to 
       
    29 * access HCI enxtension functionality.
       
    30 */
       
    31 NONSHARABLE_CLASS(CBTHciExtensionMan) : public CBase, public MVendorSpecificHciConduit 
       
    32     {
       
    33     public:  // Constructors and destructor
       
    34 
       
    35         /**
       
    36         * Two-phased constructor.
       
    37         */
       
    38         static CBTHciExtensionMan* NewL();
       
    39 
       
    40         /**
       
    41         * Destructor.
       
    42         */
       
    43 	    ~CBTHciExtensionMan();
       
    44 	    
       
    45     public: // New functions
       
    46 
       
    47         /**
       
    48         * Hanldes a request throught Hci extension
       
    49         * @param aStatus: for signalling the completion of the operation
       
    50         * @param aBTDevAddr: the BT device address
       
    51         */
       
    52         void GetEncryptionKeyLengthL(const TBTDevAddr& aBTDevAddr, TRequestStatus& aStatus);
       
    53         
       
    54         /**
       
    55         * Cancel the outstanding request if there is any
       
    56         * @param aMessage the requested service 
       
    57         * @return TInt the error code of this operation
       
    58         */
       
    59         void CancelRequest();
       
    60         
       
    61         /**
       
    62         * After the GetEncryptionKeyLengthL operation is completed
       
    63         * the result can be read with the GetResult method
       
    64         */
       
    65         TInt GetResultL(TUint8& aKeyLength);
       
    66         
       
    67         
       
    68     private: //From MVendorSpecificHciConduit
       
    69 
       
    70         /**
       
    71         * CommandCompleted is called when a vendor specific command issued through the conduit
       
    72         * receives a completion from the hardware.
       
    73         * @param aError	:	The error code with which the command completed.
       
    74         **/	
       
    75         void CommandCompleted(TInt aError);
       
    76     	
       
    77         /**
       
    78         * ReceiveEvent is called when a vendor specific command issued through the conduit
       
    79         * receives a completion from the hardware.
       
    80         *
       
    81         * @param aEvent 	Returns raw vendor specific debug event data generated from the 
       
    82         *                   hardware (with no HCTL framing)
       
    83         * @param aError 	An error indicating that the conduit did not successfully receive 
       
    84         *                   the event.
       
    85         * @return           If ETrue, the conduit will continue to listen for vendor specific 
       
    86         *                   debug events, 
       
    87         *                   If EFalse, the conduit stops listening for these events.
       
    88         **/	
       
    89         TBool ReceiveEvent(TDesC8& aEvent, TInt aError);
       
    90 
       
    91     private:
       
    92 
       
    93         /**
       
    94         * By default Symbian 2nd phase constructor is private.
       
    95         */
       
    96         void ConstructL();
       
    97 
       
    98         /**
       
    99         * C++ default constructor.
       
   100         */
       
   101         CBTHciExtensionMan();
       
   102 
       
   103     private:  // DATA
       
   104         CHciExtensionConduit* iConduit;
       
   105         TRequestStatus* iStatus;
       
   106         TUint8  iRequestOpcode;
       
   107         TUint8 iKeyLength;
       
   108     };
       
   109 
       
   110 // Helper class 
       
   111 /**
       
   112 * This class represents a HCI extension command
       
   113 */
       
   114 NONSHARABLE_CLASS(CBTHciExtensionCmd) : CBase
       
   115     {
       
   116     public: // Constrtuctor and destructor
       
   117     
       
   118         /**
       
   119         * Two-phased constructor.
       
   120         */
       
   121         static CBTHciExtensionCmd* NewL(TUint8 aOpcode);
       
   122 
       
   123         /**
       
   124         * Two-phased constructor. Leave it in CleanupStack
       
   125         */
       
   126         static CBTHciExtensionCmd* NewLC(TUint8 aOpcode);
       
   127 
       
   128         /**
       
   129         * Destructor.
       
   130         */
       
   131         ~CBTHciExtensionCmd();
       
   132     
       
   133     public: // New Functions
       
   134         
       
   135         /**
       
   136         * Gets the opcode of this command
       
   137         */
       
   138         TUint8 Opcode() const;
       
   139         
       
   140         /**
       
   141         * Gets the command descritpor
       
   142         * @return the reference to the command descriptor
       
   143         */
       
   144         TPtrC8 DesC() const;
       
   145         
       
   146         /**
       
   147         * Sets the parameter in this command
       
   148         */
       
   149         void SetParamL(const TDesC8& aParam);
       
   150 
       
   151     private:
       
   152     
       
   153         /**
       
   154         * C++ default constructor.
       
   155         */
       
   156         CBTHciExtensionCmd(TUint8 aOpcode);
       
   157         
       
   158         /**
       
   159         * By default Symbian 2nd phase constructor is private.
       
   160         */
       
   161         void ConstructL();
       
   162         
       
   163         /**
       
   164         * Initialize command descritpor
       
   165         */
       
   166         void InitializeCmdDesL();
       
   167         
       
   168     protected: // DATA
       
   169         TUint8 iChannelID;
       
   170         TUint8 iOpcode;
       
   171         HBufC8* iCmdDes;
       
   172         TInt iParamTotalLength;
       
   173         TInt iCmdLength;
       
   174     };
       
   175 
       
   176 /**
       
   177 * This class represents the response to a hci extension functionality command
       
   178 */
       
   179 NONSHARABLE_CLASS(CBTHciExtensionCmdEvent) : CBase
       
   180     {
       
   181     public: // Constrtuctor and destructor
       
   182     
       
   183         /**
       
   184         * Two-phased constructor.
       
   185         */
       
   186         static CBTHciExtensionCmdEvent* NewL(const TDesC8& aEvent);
       
   187 
       
   188         /**
       
   189         * Two-phased constructor. Leave it in CleanupStack
       
   190         */
       
   191         static CBTHciExtensionCmdEvent* NewLC(const TDesC8& aEvent);
       
   192 
       
   193         /**
       
   194         * Destructor.
       
   195         */
       
   196         ~CBTHciExtensionCmdEvent();
       
   197     
       
   198     public: // New Functions
       
   199         
       
   200         /**
       
   201         * Gets the event opcode
       
   202         */
       
   203         TUint8 Opcode() const;
       
   204         
       
   205         /**
       
   206         * Gets the event descritpor
       
   207         * @return the reference to the event descriptor
       
   208         */
       
   209         TPtrC8 DesC() const;
       
   210 
       
   211     private:
       
   212     
       
   213         /**
       
   214         * C++ default constructor.
       
   215         */
       
   216         CBTHciExtensionCmdEvent();
       
   217         
       
   218         /**
       
   219         * By default Symbian 2nd phase constructor is private.
       
   220         */
       
   221         void ConstructL(const TDesC8& aEvent);
       
   222         
       
   223     protected: // DATA
       
   224         HBufC8* iEventDes;
       
   225     };
       
   226 #endif // BT_SERVER_HCIEXTENSIONMAN_H