epoc32/include/bluetooth/hci/hciframe.h
branchSymbian2
changeset 2 2fe1408b6811
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/epoc32/include/bluetooth/hci/hciframe.h	Tue Mar 16 16:12:26 2010 +0000
     1.3 @@ -0,0 +1,166 @@
     1.4 +// Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies).
     1.5 +// All rights reserved.
     1.6 +// This component and the accompanying materials are made available
     1.7 +// under the terms of the License "Symbian Foundation License v1.0" to Symbian Foundation members and "Symbian Foundation End User License Agreement v1.0" to non-members
     1.8 +// which accompanies this distribution, and is available
     1.9 +// at the URL "http://www.symbianfoundation.org/legal/licencesv10.html".
    1.10 +//
    1.11 +// Initial Contributors:
    1.12 +// Nokia Corporation - initial contribution.
    1.13 +//
    1.14 +// Contributors:
    1.15 +//
    1.16 +// Description:
    1.17 +//
    1.18 +
    1.19 +
    1.20 +
    1.21 +/**
    1.22 + @file
    1.23 + @publishedPartner
    1.24 +*/
    1.25 +
    1.26 +#ifndef HCIFRAME_H
    1.27 +#define HCIFRAME_H
    1.28 +
    1.29 +#include <e32std.h>
    1.30 +#include <e32base.h>
    1.31 +#include <bttypes.h>
    1.32 +#include <bluetooth/hci/hcitypes.h>
    1.33 +#include <bluetooth/hci/aclpacketconsts.h>
    1.34 +
    1.35 +/**
    1.36 +Class representing an Hctl Frame as specified in the Bluetooth Core Specification, HCI Section
    1.37 +This is abstract and the different frame types (Command, ACL, SCO etc) derive from it
    1.38 +@publishedPartner
    1.39 +*/
    1.40 +NONSHARABLE_CLASS(CHctlFrameBase) : public CBase
    1.41 +	{
    1.42 +public:
    1.43 +	~CHctlFrameBase();
    1.44 +	
    1.45 +protected:
    1.46 +	CHctlFrameBase(TUint8 aHctlHeaderSize, TUint8 aHctlTrailerSize);
    1.47 +	void ConstructL(TUint32 aHctlFrameSize);
    1.48 +	
    1.49 +protected:
    1.50 +	const TUint8 iHctlHeaderSize;
    1.51 +	const TUint8 iHctlTrailerSize;
    1.52 +
    1.53 +	TPtr8 iFramePtr;
    1.54 +	HBufC8*	iHctlFrame;
    1.55 +	};
    1.56 +
    1.57 +/**
    1.58 +Class representing an Hctl Command Frame as specified in the Bluetooth Core Specification, HCI Section
    1.59 +@publishedPartner
    1.60 +*/
    1.61 +NONSHARABLE_CLASS(CHctlCommandFrame) : public CHctlFrameBase
    1.62 +	{
    1.63 +public:
    1.64 +	IMPORT_C static CHctlCommandFrame* NewL(TUint8 aHctlHeaderSize, TUint8 aHctlTrailerSize);
    1.65 +
    1.66 +	IMPORT_C void FinaliseCommand();
    1.67 +	IMPORT_C void ResetCommand();
    1.68 +
    1.69 +	IMPORT_C void SetOpcode(THCIOpcode aOpcode);
    1.70 +	IMPORT_C void PutByte(TUint8 aByte);
    1.71 +	IMPORT_C void PutBytes16(TUint16 aVal);
    1.72 +	IMPORT_C void PutBytes24(TUint32 aVal);
    1.73 +	IMPORT_C void PutBytes32(TUint32 aVal);
    1.74 +	IMPORT_C void PutBytes32(TUint32 aVal,TUint8 aNumOfBytes);
    1.75 +	IMPORT_C void PutString(const TDesC8& aString);
    1.76 +	IMPORT_C void PutPaddedString(const TDesC8& aString, TInt aRequiredLength);
    1.77 +	IMPORT_C void PutDevAddr(const TBTDevAddr& aBdaddr);
    1.78 +	IMPORT_C void PutAFHHostChannelClassification(const TDesC8& aClassification);
    1.79 +    IMPORT_C void PutLinkKey(const TBTLinkKey& aLinkKey);
    1.80 +    IMPORT_C void PutConnectionHandle(THCIConnectionHandle aConnectionHandle);
    1.81 +	IMPORT_C void PutSimplePairingHash(const TBluetoothSimplePairingHash& aHash);
    1.82 +	IMPORT_C void PutSimplePairingRandomizer(const TBluetoothSimplePairingRandomizer& aRandomizer);
    1.83 +
    1.84 +	IMPORT_C const TDesC8& HCTLPayload() const;
    1.85 +	
    1.86 +private:
    1.87 +	CHctlCommandFrame(TUint8 aHctlHeaderSize, TUint8 aHctlTrailerSize);
    1.88 +
    1.89 +public:
    1.90 +	// Hctl Command specific constants
    1.91 +	const static TUint8 KHCICommandLengthFieldOffset 	= 2;
    1.92 +	const static TUint8 KHCICommandLengthFieldLength 	= 1;
    1.93 +
    1.94 +	const static TUint8 KHCICommandPacketHeaderLength 	= 3;
    1.95 +	const static TInt KHCIMaxCommandLength				= 255;
    1.96 +	};
    1.97 +
    1.98 +/**
    1.99 +Class representing an Hctl Data Frame as specified in the Bluetooth Core Specification, HCI Section
   1.100 +This is abstract and the different data types (ACL, SCO etc) derive from it
   1.101 +@publishedPartner
   1.102 +*/
   1.103 +NONSHARABLE_CLASS(CHctlDataFrameBase) : public CHctlFrameBase
   1.104 +	{
   1.105 +public:
   1.106 +	IMPORT_C void SetConnectionHandle(THCIConnHandle aConnectionHandle);
   1.107 +	IMPORT_C static THCIConnHandle ConnectionHandle(const TDesC8& aHCIDataFrame);
   1.108 +	IMPORT_C const TDesC8& HCTLPayload() const;
   1.109 +
   1.110 +	virtual void SetDataPayload(const TDesC8& aData)=0;
   1.111 +	
   1.112 +protected:
   1.113 +	CHctlDataFrameBase(TUint8 aHctlHeaderSize, TUint8 aHctlTrailerSize);
   1.114 +
   1.115 +public:
   1.116 +	const static TUint8 KHCIDataPacketLengthFieldOffset = 2;
   1.117 +	};
   1.118 +
   1.119 +
   1.120 +/**
   1.121 +Class representing an Hctl ACL Data Frame as specified in the Bluetooth Core Specification, HCI Section
   1.122 +@publishedPartner
   1.123 +*/
   1.124 +NONSHARABLE_CLASS(CHctlAclDataFrame) : public CHctlDataFrameBase
   1.125 +	{
   1.126 +public:
   1.127 +	IMPORT_C static CHctlAclDataFrame* NewL(TUint16 aPayloadSize, TUint8 aHctlHeaderSize, TUint8 aHctlTrailerSize);
   1.128 +
   1.129 +	IMPORT_C static TAclPacketBoundaryFlag PacketBoundaryFlag(const TDesC8& aData);
   1.130 +	IMPORT_C static TAclPacketBroadcastFlag PacketBroadcastFlag(const TDesC8& aData);
   1.131 +	
   1.132 +	IMPORT_C void SetFlags(TAclPacketBoundaryFlag aBoundaryFlag, TAclPacketBroadcastFlag aBroadcastFlag);
   1.133 +	IMPORT_C void SetDataPayload(const TDesC8& aData);
   1.134 +	IMPORT_C THCIConnHandle ConnectionHandle() const;
   1.135 +
   1.136 +public:
   1.137 +	// Hctl ACL Data specific constants
   1.138 +	const static TUint8 KHCIACLDataPacketLengthFieldLength = 2;
   1.139 +
   1.140 +	const static TUint8 KHCIACLDataPacketHeaderLength = 4; // 2 bytes ConnH, 2 bytes data length field
   1.141 +	const static TUint16 KHCTLMaxACLDataSize = 0xffff;
   1.142 +
   1.143 +private:
   1.144 +	CHctlAclDataFrame(TUint8 aHctlHeaderSize, TUint8 aHctlTrailerSize);
   1.145 +	void Finalise();
   1.146 +	};
   1.147 +
   1.148 +/**
   1.149 +Class representing an Hctl Synchronous Data Frame as specified in the Bluetooth Core Specification, HCI Section
   1.150 +@publishedPartner
   1.151 +*/
   1.152 +NONSHARABLE_CLASS(CHctlSynchronousDataFrame) : public CHctlDataFrameBase
   1.153 +	{
   1.154 +public:
   1.155 +	IMPORT_C static CHctlSynchronousDataFrame* NewL(TUint8 aBufSize, TUint8 aHctlHeaderSize, TUint8 aHctlTrailerSize);
   1.156 +	virtual void SetDataPayload(const TDesC8& aData);
   1.157 +
   1.158 +public:
   1.159 +	// HCI SCO Data specific constants
   1.160 +	const static TUint8 KHCISCODataPacketLengthFieldLength = 1;
   1.161 +
   1.162 +	const static TUint8 KHCISynchronousDataPacketHeaderLength = 3; // 2 bytes ConnH, 1 byte data length field 
   1.163 +	const static TUint8 KHCTLMaxSynchronousDataSize = 0xff;
   1.164 +private:
   1.165 +	CHctlSynchronousDataFrame(TUint8 aHctlHeaderSize, TUint8 aHctlTrailerSize);
   1.166 +	void Finalise();
   1.167 +	};
   1.168 +
   1.169 +#endif // HCIFRAME_H