bthci/hci2implementations/hctls/bcsp/inc/hctlbcsp.h
changeset 0 29b1cd4cb562
equal deleted inserted replaced
-1:000000000000 0:29b1cd4cb562
       
     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 HCTLBCSP_H
       
    22 #define HCTLBCSP_H
       
    23 
       
    24 #include <bluetooth/hci/hctluartbase.h>
       
    25 #include <bluetooth/hciframelogger.h>
       
    26 
       
    27 class CHCTLBcspReceiver;
       
    28 class CLinkEstablishment;
       
    29 class CHCTLBcspSequencer;
       
    30 class CHCTLBcspFrameQueue;
       
    31 class CRxHctlBcspFrame;
       
    32 class CHCTLBcspControllerManager;
       
    33 
       
    34 /**BCSP HCI Framing constants for command frames */
       
    35 static const TInt KHCTLCommandHeaderSize =0;
       
    36 static const TInt KHCTLCommandTrailerSize=0;
       
    37 
       
    38 /**BCSP HCI Framing constants for ACL data frames */
       
    39 static const TInt KHCTLAclDataHeaderSize =0;
       
    40 static const TInt KHCTLAclDataTrailerSize=0;
       
    41 
       
    42 /**BCSP HCI Framing constants for Synchronous data frames */
       
    43 static const TInt KHCTLSynchronousDataHeaderSize =0;
       
    44 static const TInt KHCTLSynchronousDataTrailerSize=0;
       
    45 
       
    46 _LIT(KIniFileName, "hctl_bcsp");
       
    47 
       
    48 /**
       
    49 	This is the class that implements the BCSP specific HCTL.	
       
    50 */
       
    51 NONSHARABLE_CLASS(CHCTLBcsp) : public CHCTLUartBase
       
    52 	{
       
    53 public:	
       
    54 	static CHCTLBcsp* NewL();
       
    55 
       
    56 	void DoConfigL();
       
    57 	void CanSend(TBool aCanSend);	// BCSP opens/closes all channels together
       
    58 
       
    59 	void QueueReadForNextFrame();
       
    60 	TInt HandleRx(const TDesC8& aReceivedFrame); // Handles slip decoding and BCSPFrame Decoding
       
    61 	TInt PacketRouter();
       
    62 	
       
    63 	void TxAckMsg();
       
    64 	void TxLinkMsg(const TDesC8 &aData);
       
    65 
       
    66 	void FlogRx();
       
    67 
       
    68 	TBool CheckIsAckPacket() const;
       
    69 	void UnChoke();
       
    70 	void Choke();
       
    71 	void HandlePeerReset();
       
    72 	void Reset();
       
    73 	TInt WriteBcCmd(const TDesC8& aData); //For controller manager to send BCCMDs
       
    74 
       
    75 	TBool Muzzled();
       
    76 	void ResetMuzzled();	
       
    77 	~CHCTLBcsp();
       
    78 	
       
    79 private:
       
    80 	CHCTLBcsp();
       
    81 	void ConstructL();
       
    82 
       
    83 	TAny* Interface(TUid aUid);
       
    84 
       
    85 	void ProcessACLData();
       
    86 	void ProcessEventData();
       
    87 	void ProcessBcCmdEventData();
       
    88 	void ProcessSynchronousData();
       
    89 
       
    90 	void DoWriteCommandL(const TDesC8& aData);
       
    91 	void DoWriteACLDataL(const TDesC8& aData);
       
    92 	void DoWriteBcCmdL(const TDesC8& aData); //For controller manager to send BCCMDs
       
    93 
       
    94 	// From CHCTLUartBase
       
    95 	void PortOpenedL();
       
    96 
       
    97 	// From MHCTLInterface
       
    98 	TInt MhiWriteCommand(const TDesC8& aData);
       
    99 	TInt MhiWriteAclData(const TDesC8& aData);
       
   100 	TInt MhiWriteSynchronousData(const TDesC8& aData);
       
   101 	void MhiGetAclDataTransportOverhead(TUint& aHeaderSize, TUint& aTrailerSize) const;
       
   102 	void MhiGetSynchronousDataTransportOverhead(TUint& aHeaderSize, TUint& aTrailerSize) const;
       
   103 	void MhiGetCommandTransportOverhead(TUint& aHeaderSize, TUint& aTrailerSize) const;
       
   104 	void MhiSetChannelObserver(MHCTLChannelObserver& aChannelObserver);
       
   105 	void MhiSetDataObserver(MHCTLDataObserver& aDataObserver);
       
   106 	void MhiSetEventObserver(MHCTLEventObserver& aEventObserver);
       
   107 	void MhiSetControllerStateObserver(MControllerStateObserver& aControllerStateObserver);
       
   108 	void MhiSetQdpPluginInterfaceFinder(MQdpPluginInterfaceFinder& aQdpPluginInterfaceFinder);
       
   109 
       
   110 	// From MHardResetInitiator 
       
   111 	void MhriStartHardReset();
       
   112 
       
   113 private:
       
   114 	TBool iMuzzled;
       
   115 	TBool iCanSend;
       
   116 	//When BCSP is choked, it means we hasn't established a link with the controller yet. 
       
   117 	//Only UART link management packets are allowed to pass through. 
       
   118 	TBool iChoked;
       
   119 	CHCTLBcspReceiver* iReceiver;
       
   120 	CHCTLBcspSequencer* iSequencer;
       
   121 	CLinkEstablishment* iLinkEstablishment;
       
   122 	MControllerStateObserver* iControllerStateObserver;
       
   123 	MQdpPluginInterfaceFinder* iQdpPluginInterfaceFinder;
       
   124 
       
   125 	CHCTLBcspFrameQueue* iFrameQueue;
       
   126 
       
   127 	CRxHctlBcspFrame* iReceivedFrame;
       
   128 
       
   129 	TInt iCommUnit;
       
   130 	TUint8 iAck;
       
   131 
       
   132 	CHCTLBcspControllerManager* iControllerMan;
       
   133 	
       
   134 	DECLARE_HCI_LOGGER
       
   135 	};
       
   136 #endif // HCTLBCSP_H