williamr@2
|
1 |
// Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies).
|
williamr@2
|
2 |
// All rights reserved.
|
williamr@2
|
3 |
// This component and the accompanying materials are made available
|
williamr@2
|
4 |
// 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
|
williamr@2
|
5 |
// which accompanies this distribution, and is available
|
williamr@2
|
6 |
// at the URL "http://www.symbianfoundation.org/legal/licencesv10.html".
|
williamr@2
|
7 |
//
|
williamr@2
|
8 |
// Initial Contributors:
|
williamr@2
|
9 |
// Nokia Corporation - initial contribution.
|
williamr@2
|
10 |
//
|
williamr@2
|
11 |
// Contributors:
|
williamr@2
|
12 |
//
|
williamr@2
|
13 |
// Description:
|
williamr@2
|
14 |
//
|
williamr@2
|
15 |
|
williamr@2
|
16 |
|
williamr@2
|
17 |
|
williamr@2
|
18 |
/**
|
williamr@2
|
19 |
@file
|
williamr@2
|
20 |
@publishedPartner
|
williamr@2
|
21 |
*/
|
williamr@2
|
22 |
|
williamr@2
|
23 |
#ifndef HCIFRAME_H
|
williamr@2
|
24 |
#define HCIFRAME_H
|
williamr@2
|
25 |
|
williamr@2
|
26 |
#include <e32std.h>
|
williamr@2
|
27 |
#include <e32base.h>
|
williamr@2
|
28 |
#include <bttypes.h>
|
williamr@2
|
29 |
#include <bluetooth/hci/hcitypes.h>
|
williamr@2
|
30 |
#include <bluetooth/hci/aclpacketconsts.h>
|
williamr@2
|
31 |
|
williamr@2
|
32 |
/**
|
williamr@2
|
33 |
Class representing an Hctl Frame as specified in the Bluetooth Core Specification, HCI Section
|
williamr@2
|
34 |
This is abstract and the different frame types (Command, ACL, SCO etc) derive from it
|
williamr@2
|
35 |
@publishedPartner
|
williamr@2
|
36 |
*/
|
williamr@2
|
37 |
NONSHARABLE_CLASS(CHctlFrameBase) : public CBase
|
williamr@2
|
38 |
{
|
williamr@2
|
39 |
public:
|
williamr@2
|
40 |
~CHctlFrameBase();
|
williamr@2
|
41 |
|
williamr@2
|
42 |
protected:
|
williamr@2
|
43 |
CHctlFrameBase(TUint8 aHctlHeaderSize, TUint8 aHctlTrailerSize);
|
williamr@2
|
44 |
void ConstructL(TUint32 aHctlFrameSize);
|
williamr@2
|
45 |
|
williamr@2
|
46 |
protected:
|
williamr@2
|
47 |
const TUint8 iHctlHeaderSize;
|
williamr@2
|
48 |
const TUint8 iHctlTrailerSize;
|
williamr@2
|
49 |
|
williamr@2
|
50 |
TPtr8 iFramePtr;
|
williamr@2
|
51 |
HBufC8* iHctlFrame;
|
williamr@2
|
52 |
};
|
williamr@2
|
53 |
|
williamr@2
|
54 |
/**
|
williamr@2
|
55 |
Class representing an Hctl Command Frame as specified in the Bluetooth Core Specification, HCI Section
|
williamr@2
|
56 |
@publishedPartner
|
williamr@2
|
57 |
*/
|
williamr@2
|
58 |
NONSHARABLE_CLASS(CHctlCommandFrame) : public CHctlFrameBase
|
williamr@2
|
59 |
{
|
williamr@2
|
60 |
public:
|
williamr@2
|
61 |
IMPORT_C static CHctlCommandFrame* NewL(TUint8 aHctlHeaderSize, TUint8 aHctlTrailerSize);
|
williamr@2
|
62 |
|
williamr@2
|
63 |
IMPORT_C void FinaliseCommand();
|
williamr@2
|
64 |
IMPORT_C void ResetCommand();
|
williamr@2
|
65 |
|
williamr@2
|
66 |
IMPORT_C void SetOpcode(THCIOpcode aOpcode);
|
williamr@2
|
67 |
IMPORT_C void PutByte(TUint8 aByte);
|
williamr@2
|
68 |
IMPORT_C void PutBytes16(TUint16 aVal);
|
williamr@2
|
69 |
IMPORT_C void PutBytes24(TUint32 aVal);
|
williamr@2
|
70 |
IMPORT_C void PutBytes32(TUint32 aVal);
|
williamr@2
|
71 |
IMPORT_C void PutBytes32(TUint32 aVal,TUint8 aNumOfBytes);
|
williamr@2
|
72 |
IMPORT_C void PutString(const TDesC8& aString);
|
williamr@2
|
73 |
IMPORT_C void PutPaddedString(const TDesC8& aString, TInt aRequiredLength);
|
williamr@2
|
74 |
IMPORT_C void PutDevAddr(const TBTDevAddr& aBdaddr);
|
williamr@2
|
75 |
IMPORT_C void PutAFHHostChannelClassification(const TDesC8& aClassification);
|
williamr@2
|
76 |
IMPORT_C void PutLinkKey(const TBTLinkKey& aLinkKey);
|
williamr@2
|
77 |
IMPORT_C void PutConnectionHandle(THCIConnectionHandle aConnectionHandle);
|
williamr@2
|
78 |
IMPORT_C void PutSimplePairingHash(const TBluetoothSimplePairingHash& aHash);
|
williamr@2
|
79 |
IMPORT_C void PutSimplePairingRandomizer(const TBluetoothSimplePairingRandomizer& aRandomizer);
|
williamr@2
|
80 |
|
williamr@2
|
81 |
IMPORT_C const TDesC8& HCTLPayload() const;
|
williamr@2
|
82 |
|
williamr@2
|
83 |
private:
|
williamr@2
|
84 |
CHctlCommandFrame(TUint8 aHctlHeaderSize, TUint8 aHctlTrailerSize);
|
williamr@2
|
85 |
|
williamr@2
|
86 |
public:
|
williamr@2
|
87 |
// Hctl Command specific constants
|
williamr@2
|
88 |
const static TUint8 KHCICommandLengthFieldOffset = 2;
|
williamr@2
|
89 |
const static TUint8 KHCICommandLengthFieldLength = 1;
|
williamr@2
|
90 |
|
williamr@2
|
91 |
const static TUint8 KHCICommandPacketHeaderLength = 3;
|
williamr@2
|
92 |
const static TInt KHCIMaxCommandLength = 255;
|
williamr@2
|
93 |
};
|
williamr@2
|
94 |
|
williamr@2
|
95 |
/**
|
williamr@2
|
96 |
Class representing an Hctl Data Frame as specified in the Bluetooth Core Specification, HCI Section
|
williamr@2
|
97 |
This is abstract and the different data types (ACL, SCO etc) derive from it
|
williamr@2
|
98 |
@publishedPartner
|
williamr@2
|
99 |
*/
|
williamr@2
|
100 |
NONSHARABLE_CLASS(CHctlDataFrameBase) : public CHctlFrameBase
|
williamr@2
|
101 |
{
|
williamr@2
|
102 |
public:
|
williamr@2
|
103 |
IMPORT_C void SetConnectionHandle(THCIConnHandle aConnectionHandle);
|
williamr@2
|
104 |
IMPORT_C static THCIConnHandle ConnectionHandle(const TDesC8& aHCIDataFrame);
|
williamr@2
|
105 |
IMPORT_C const TDesC8& HCTLPayload() const;
|
williamr@2
|
106 |
|
williamr@2
|
107 |
virtual void SetDataPayload(const TDesC8& aData)=0;
|
williamr@2
|
108 |
|
williamr@2
|
109 |
protected:
|
williamr@2
|
110 |
CHctlDataFrameBase(TUint8 aHctlHeaderSize, TUint8 aHctlTrailerSize);
|
williamr@2
|
111 |
|
williamr@2
|
112 |
public:
|
williamr@2
|
113 |
const static TUint8 KHCIDataPacketLengthFieldOffset = 2;
|
williamr@2
|
114 |
};
|
williamr@2
|
115 |
|
williamr@2
|
116 |
|
williamr@2
|
117 |
/**
|
williamr@2
|
118 |
Class representing an Hctl ACL Data Frame as specified in the Bluetooth Core Specification, HCI Section
|
williamr@2
|
119 |
@publishedPartner
|
williamr@2
|
120 |
*/
|
williamr@2
|
121 |
NONSHARABLE_CLASS(CHctlAclDataFrame) : public CHctlDataFrameBase
|
williamr@2
|
122 |
{
|
williamr@2
|
123 |
public:
|
williamr@2
|
124 |
IMPORT_C static CHctlAclDataFrame* NewL(TUint16 aPayloadSize, TUint8 aHctlHeaderSize, TUint8 aHctlTrailerSize);
|
williamr@2
|
125 |
|
williamr@2
|
126 |
IMPORT_C static TAclPacketBoundaryFlag PacketBoundaryFlag(const TDesC8& aData);
|
williamr@2
|
127 |
IMPORT_C static TAclPacketBroadcastFlag PacketBroadcastFlag(const TDesC8& aData);
|
williamr@2
|
128 |
|
williamr@2
|
129 |
IMPORT_C void SetFlags(TAclPacketBoundaryFlag aBoundaryFlag, TAclPacketBroadcastFlag aBroadcastFlag);
|
williamr@2
|
130 |
IMPORT_C void SetDataPayload(const TDesC8& aData);
|
williamr@2
|
131 |
IMPORT_C THCIConnHandle ConnectionHandle() const;
|
williamr@2
|
132 |
|
williamr@2
|
133 |
public:
|
williamr@2
|
134 |
// Hctl ACL Data specific constants
|
williamr@2
|
135 |
const static TUint8 KHCIACLDataPacketLengthFieldLength = 2;
|
williamr@2
|
136 |
|
williamr@2
|
137 |
const static TUint8 KHCIACLDataPacketHeaderLength = 4; // 2 bytes ConnH, 2 bytes data length field
|
williamr@2
|
138 |
const static TUint16 KHCTLMaxACLDataSize = 0xffff;
|
williamr@2
|
139 |
|
williamr@2
|
140 |
private:
|
williamr@2
|
141 |
CHctlAclDataFrame(TUint8 aHctlHeaderSize, TUint8 aHctlTrailerSize);
|
williamr@2
|
142 |
void Finalise();
|
williamr@2
|
143 |
};
|
williamr@2
|
144 |
|
williamr@2
|
145 |
/**
|
williamr@2
|
146 |
Class representing an Hctl Synchronous Data Frame as specified in the Bluetooth Core Specification, HCI Section
|
williamr@2
|
147 |
@publishedPartner
|
williamr@2
|
148 |
*/
|
williamr@2
|
149 |
NONSHARABLE_CLASS(CHctlSynchronousDataFrame) : public CHctlDataFrameBase
|
williamr@2
|
150 |
{
|
williamr@2
|
151 |
public:
|
williamr@2
|
152 |
IMPORT_C static CHctlSynchronousDataFrame* NewL(TUint8 aBufSize, TUint8 aHctlHeaderSize, TUint8 aHctlTrailerSize);
|
williamr@2
|
153 |
virtual void SetDataPayload(const TDesC8& aData);
|
williamr@2
|
154 |
|
williamr@2
|
155 |
public:
|
williamr@2
|
156 |
// HCI SCO Data specific constants
|
williamr@2
|
157 |
const static TUint8 KHCISCODataPacketLengthFieldLength = 1;
|
williamr@2
|
158 |
|
williamr@2
|
159 |
const static TUint8 KHCISynchronousDataPacketHeaderLength = 3; // 2 bytes ConnH, 1 byte data length field
|
williamr@2
|
160 |
const static TUint8 KHCTLMaxSynchronousDataSize = 0xff;
|
williamr@2
|
161 |
private:
|
williamr@2
|
162 |
CHctlSynchronousDataFrame(TUint8 aHctlHeaderSize, TUint8 aHctlTrailerSize);
|
williamr@2
|
163 |
void Finalise();
|
williamr@2
|
164 |
};
|
williamr@2
|
165 |
|
williamr@2
|
166 |
#endif // HCIFRAME_H
|