bthci/hci2implementations/hctls/brcmh4/inc/Broadcom_Hctl_H4.h
branchbroadcom_h4
changeset 37 f53839ff73b7
equal deleted inserted replaced
4:28479eeba3fb 37:f53839ff73b7
       
     1 // Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies).
       
     2 // All rights reserved.
       
     3 // This component and the accompanying materials are made available
       
     4 // under the terms of "Eclipse Public License v1.0"
       
     5 // which accompanies this distribution, and is available
       
     6 // at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     7 //
       
     8 // Initial Contributors:
       
     9 // Nokia Corporation - initial contribution.
       
    10 //
       
    11 // Contributors:
       
    12 //
       
    13 // Description:
       
    14 //
       
    15 
       
    16 /**
       
    17  @file
       
    18  @internalComponent
       
    19 */
       
    20 
       
    21 #ifndef BROADCOMHCTLH4_H
       
    22 #define BROADCOMHCTLH4_H
       
    23 
       
    24 #include <bluetooth/hci/hctluartbase.h>
       
    25 #include <bluetooth/hciframelogger.h>
       
    26 #include <bluetooth/hci/hcitypes.h>
       
    27 
       
    28 #include <bluetooth/hci/hctlbcmconfiginterface.h>
       
    29 
       
    30 
       
    31 class CHCTLBcmH4Receiver;
       
    32 class CHCTLBcmH4Sender;
       
    33 class CControllerManager;
       
    34 
       
    35 // Define HCTL Packet Header Size
       
    36 static const TInt KHctlHeaderSize = 1;
       
    37 static const TInt KHctlPacketTypeOffset = 0;
       
    38 
       
    39 // UART HCI Framing constants for command frames
       
    40 static const TInt KHCTLCommandHeaderSize = 1;
       
    41 static const TInt KHCTLCommandTrailerSize = 0;
       
    42 
       
    43 // UART HCI Framing constants for ACL data frames
       
    44 static const TInt KHCTLAclDataHeaderSize = 1;
       
    45 static const TInt KHCTLAclDataTrailerSize = 0;
       
    46 
       
    47 // UART HCI Framing constants for Synchronous data frames
       
    48 static const TInt KHCTLSynchronousDataHeaderSize = 1;
       
    49 static const TInt KHCTLSynchronousDataTrailerSize = 0;
       
    50 
       
    51 _LIT(KIniFileName, "hctl_broadcom");
       
    52 
       
    53 /**
       
    54 This is the class that implements the UART specific HCTL.	
       
    55 */
       
    56 NONSHARABLE_CLASS(CHCTLBcmH4) : public CHCTLUartBase,
       
    57 								public MHctlBcmConfigInterface
       
    58 	{
       
    59 public:
       
    60 	static CHCTLBcmH4* NewL();
       
    61 	~CHCTLBcmH4();
       
    62 
       
    63 	void DoConfigL();
       
    64 	virtual void ProcessACLData(const TDesC8& aData);
       
    65 	virtual void ProcessSynchronousData(const TDesC8& aData);
       
    66 	virtual void ProcessEvent(const TDesC8& aEvent);
       
    67 	
       
    68 	MQdpPluginInterfaceFinder* QdpPluginInterfaceFinder();
       
    69 
       
    70 	// From MHardResetInitiator
       
    71 	virtual void MhriStartHardReset();
       
    72 
       
    73 	// Called from the Controller Manager
       
    74 	void HandlePowerOff();
       
    75 	void HandlePowerOn();
       
    76 
       
    77 	TBTPowerState CurrentPowerState() const;
       
    78 	//CHRIS MODIF
       
    79 	//void SetInitFlag(TBool flag);
       
    80 	
       
    81 public:
       
    82 	// HCTL packet types as defined in Section 2, Part H: 4 of the
       
    83 	// bluetooth specification.
       
    84 	enum THctlPacketType 
       
    85 	    {
       
    86 		ECommandPacket			= 0x01,
       
    87 		EACLDataPacket			= 0x02,
       
    88 		ESynchronousDataPacket	= 0x03,
       
    89 		EEventPacket			= 0x04,
       
    90 	    };
       
    91 
       
    92 private:
       
    93 	CHCTLBcmH4();
       
    94 	void ConstructL();
       
    95 	TAny* Interface(TUid aUid);
       
    96 
       
    97 	static void SetPacketIndicator(THctlPacketType aType, const TDesC8& aData);
       
    98 
       
    99 	// From CHCTLUartBase
       
   100 	virtual void PortOpenedL();
       
   101 	
       
   102 	// From MHCTLInterface
       
   103 	virtual TInt MhiWriteCommand(const TDesC8& aData);
       
   104 	virtual TInt MhiWriteAclData(const TDesC8& aData);
       
   105 	virtual TInt MhiWriteSynchronousData(const TDesC8& aData);
       
   106 	virtual void MhiGetAclDataTransportOverhead(TUint& aHeaderSize, TUint& aTrailerSize) const;
       
   107 	virtual void MhiGetSynchronousDataTransportOverhead(TUint& aHeaderSize, TUint& aTrailerSize) const;
       
   108 	virtual void MhiGetCommandTransportOverhead(TUint& aHeaderSize, TUint& aTrailerSize) const;
       
   109 	virtual void MhiSetChannelObserver(MHCTLChannelObserver& aChannelObserver);
       
   110 	virtual void MhiSetDataObserver(MHCTLDataObserver& aDataObserver);
       
   111 	virtual void MhiSetEventObserver(MHCTLEventObserver& aEventObserver);
       
   112 	virtual void MhiSetControllerStateObserver(MControllerStateObserver& aControllerStateObserver);
       
   113 	virtual void MhiSetQdpPluginInterfaceFinder(MQdpPluginInterfaceFinder& aQdpPluginInterfaceFinder);
       
   114 
       
   115 	// From MHCTLBcmConfigInterface
       
   116 	virtual TInt MhciUpdateBaudRate(TUint32 aBaudRate);
       
   117 	
       
   118 	virtual void MhciSetInitPluginState(TInitState InitState);
       
   119 private:
       
   120 	CHCTLBcmH4Receiver* iReceiver;
       
   121 	CHCTLBcmH4Sender* iSender;   
       
   122 	MQdpPluginInterfaceFinder* iQdpPluginInterfaceFinder;
       
   123 	TBTPowerState iCurrentPowerState;
       
   124 
       
   125 	CControllerManager* iControllerMan;
       
   126 	//CHRIS MODIF
       
   127 	//TBool iInitFlag;
       
   128 public:
       
   129 	TInitState iInitpluginState;
       
   130 	DECLARE_HCI_LOGGER
       
   131 	};
       
   132 
       
   133 
       
   134 #endif // BROADCOMHCTLH4_H
       
   135