|
1 // Copyright (c) 2005-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 AVCTPPACKETSTATICS_H |
|
22 #define AVCTPPACKETSTATICS_H |
|
23 |
|
24 #include <bluetoothav.h> |
|
25 #include <bluetooth/avctptypes.h> |
|
26 |
|
27 namespace SymbianAvctp |
|
28 { |
|
29 |
|
30 const static TUint8 KUndefinedTransactionLabel = SymbianAvctp::KMaxTransactionLabel; |
|
31 |
|
32 const static TUint8 KIsValidPidMask = 0x01; |
|
33 const static TUint8 KMessageTypeMask = 0x02; |
|
34 const static TUint8 KPacketTypeMask = 0x0C; |
|
35 const static TUint8 KTransactionMask = 0xF0; |
|
36 |
|
37 const static TUint KNormalHeaderPidOffset = 1; |
|
38 const static TUint KStartHeaderPidOffset = 2; |
|
39 const static TUint KNumFragmentsOffset = 1; |
|
40 |
|
41 const static TUint KTransactionLabelShift = 4; |
|
42 const static TUint KPacketTypeShift = 2; |
|
43 |
|
44 const static TUint KResponseMsgBit = 2; |
|
45 |
|
46 /** |
|
47 Types of packet, as indicated in the packet header. |
|
48 Note these are the actual values used in the AVCTP v1.0 |
|
49 spec. |
|
50 */ |
|
51 enum TPacketType |
|
52 { |
|
53 /** An unfragmented AVCTP packet */ |
|
54 ENormalPkt = 0x0, |
|
55 /** An AVCTP fragment start packet */ |
|
56 EStartFrag = 0x1, |
|
57 /** An AVCTP fragment continue packet */ |
|
58 EContinueFrag = 0x2, |
|
59 /** An AVCTP fragment end packet */ |
|
60 EEndFrag = 0x3, |
|
61 /** This value should never be used in practise. It's only for initialisation */ |
|
62 EUnknownPkt = 0x4, |
|
63 }; |
|
64 |
|
65 /** |
|
66 Offset of the data within an AVCTP packet |
|
67 */ |
|
68 enum TPduHeaderLength |
|
69 { |
|
70 /** For an unfragmented AVCTP packet */ |
|
71 ENormalHeaderLength = 0x3, |
|
72 /** For an AVCTP fragment start packet */ |
|
73 EStartFragHeaderLength = 0x4, |
|
74 /** For an AVCTP fragment continue or end packet */ |
|
75 EOtherFragHeaderLength = 0x1, |
|
76 /** The minimum length of the three headers */ |
|
77 EMinimumHeaderLength = 0x1, |
|
78 }; |
|
79 |
|
80 // Avctp packet parsing functions |
|
81 IMPORT_C TMessageType MessageType(const TDesC8& aData); |
|
82 IMPORT_C TPacketType PacketType(const TDesC8& aData); |
|
83 IMPORT_C TTransactionLabel TransactionLabel(const TDesC8& aData); |
|
84 IMPORT_C TBool IsValidPid(const TDesC8& aData); |
|
85 IMPORT_C TPid Pid(const TDesC8& aData); |
|
86 IMPORT_C TUint8 FragmentsInSdu(const TDesC8& aData); |
|
87 IMPORT_C TPduHeaderLength ConvertPacketTypeToHeaderLength(TPacketType aPktType); |
|
88 |
|
89 } // end of namespace SymbianAvctp |
|
90 |
|
91 #endif // AVCTPPACKETSTATICS_H |
|
92 |