|
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 #include "avctpOutboundQ.h" |
|
22 #include "avctpcommon.h" |
|
23 |
|
24 using namespace SymbianAvctp; |
|
25 |
|
26 // |
|
27 // CAvctpFragStartPacket utility functions |
|
28 // |
|
29 |
|
30 inline TAvctpHeaderInfo::TAvctpHeaderInfo() |
|
31 : iTransactionLabel(SymbianAvctp::KMaxTransactionLabel), |
|
32 iPktType(SymbianAvctp::EUnknownPkt), |
|
33 iMsgType(SymbianAvctp::EUndefined) |
|
34 { |
|
35 } |
|
36 |
|
37 inline TAvctpHeaderInfo::TAvctpHeaderInfo(SymbianAvctp::TTransactionLabel aTransactionLabel, |
|
38 SymbianAvctp::TPacketType aPktType, |
|
39 SymbianAvctp::TMessageType aMsgType) |
|
40 : iTransactionLabel(aTransactionLabel), |
|
41 iPktType(aPktType), |
|
42 iMsgType(aMsgType) |
|
43 { |
|
44 } |
|
45 |
|
46 inline SymbianAvctp::TPduHeaderLength TAvctpHeaderInfo::HeaderLength() const |
|
47 { |
|
48 return ConvertPacketTypeToHeaderLength(iPktType); |
|
49 } |
|
50 |
|
51 |
|
52 inline TAvctpNormalHeaderInfo::TAvctpNormalHeaderInfo() |
|
53 : TAvctpHeaderInfo(), |
|
54 iHasValidPid(EFalse), |
|
55 iPid(0) |
|
56 { |
|
57 } |
|
58 |
|
59 inline TAvctpNormalHeaderInfo::TAvctpNormalHeaderInfo( |
|
60 SymbianAvctp::TTransactionLabel aTransactionLabel, |
|
61 SymbianAvctp::TPacketType aPktType, |
|
62 SymbianAvctp::TMessageType aMsgType, |
|
63 TBool aHasValidPid, |
|
64 SymbianAvctp::TPid aPid) |
|
65 : TAvctpHeaderInfo(aTransactionLabel, aPktType, aMsgType), |
|
66 iHasValidPid(aHasValidPid), |
|
67 iPid(aPid) |
|
68 { |
|
69 } |
|
70 |
|
71 inline TAvctpStartHeaderInfo::TAvctpStartHeaderInfo() |
|
72 : TAvctpNormalHeaderInfo(), |
|
73 iFragmentsInSdu(0) |
|
74 { |
|
75 } |
|
76 |
|
77 inline TAvctpStartHeaderInfo::TAvctpStartHeaderInfo( |
|
78 SymbianAvctp::TTransactionLabel aTransactionLabel, |
|
79 SymbianAvctp::TPacketType aPktType, |
|
80 SymbianAvctp::TMessageType aMsgType, |
|
81 TBool aHasValidPid, |
|
82 SymbianAvctp::TPid aPid, |
|
83 TUint aFragmentsInSdu) |
|
84 : TAvctpNormalHeaderInfo(aTransactionLabel, aPktType, aMsgType, aHasValidPid, aPid), |
|
85 iFragmentsInSdu(aFragmentsInSdu) |
|
86 { |
|
87 } |
|
88 |
|
89 // |
|
90 // Outgoing Sdu |
|
91 |
|
92 inline HAvctpOutgoingSdu::HAvctpOutgoingSdu( |
|
93 const TAvctpNormalHeaderInfo& aHeaderInfo, |
|
94 const TBTDevAddr& aAddr) |
|
95 : iHeaderInfo(aHeaderInfo), |
|
96 iAddr(aAddr), |
|
97 iOutboundQ(NULL), |
|
98 iChannel(KAvctpPrimaryChannel) |
|
99 { |
|
100 } |
|
101 |
|
102 inline const TBTDevAddr& HAvctpOutgoingSdu::BTAddr() const |
|
103 { |
|
104 return iAddr; |
|
105 } |
|
106 |
|
107 inline TAvctpNormalHeaderInfo& HAvctpOutgoingSdu::HeaderInfo() |
|
108 { |
|
109 return iHeaderInfo; |
|
110 } |
|
111 |
|
112 inline RMBufChain& HAvctpOutgoingSdu::Data() |
|
113 { |
|
114 return iSduData; |
|
115 } |
|
116 |
|
117 inline void HAvctpOutgoingSdu::AddToQueue(TAvctpOutboundQ* aOutboundQ) |
|
118 { |
|
119 // This needs to be local as it is in a header file |
|
120 #ifdef __FLOG_ACTIVE |
|
121 _LIT8(KLogComponent, LOG_COMPONENT_AVCTP); |
|
122 #endif |
|
123 |
|
124 #ifdef _DEBUG |
|
125 PANICCATEGORY("pktinl"); |
|
126 #endif |
|
127 |
|
128 // We shouldn't already be on a Q and we need to be given a valid Q |
|
129 ASSERT_DEBUG(iOutboundQ == NULL && aOutboundQ != NULL); |
|
130 iOutboundQ = aOutboundQ; |
|
131 } |
|
132 |
|
133 // |
|
134 // Incoming Sdu |
|
135 |
|
136 inline HAvctpIncomingSdu::HAvctpIncomingSdu(const TBTDevAddr& aAddr, |
|
137 RMBufChain& aSduData) |
|
138 : iAddr(aAddr) |
|
139 { |
|
140 iSduData.Assign(aSduData); |
|
141 } |
|
142 |
|
143 inline const TBTDevAddr& HAvctpIncomingSdu::BTAddr() const |
|
144 { |
|
145 return iAddr; |
|
146 } |
|
147 |
|
148 inline TInt HAvctpOutgoingSdu::Channel() const |
|
149 { |
|
150 return iChannel; |
|
151 } |
|
152 |
|
153 inline const RMBufChain& HAvctpIncomingSdu::Data() const |
|
154 { |
|
155 return iSduData; |
|
156 } |
|
157 |
|
158 inline HAvctpIncomingSdu::~HAvctpIncomingSdu() |
|
159 { |
|
160 iSduData.Free(); |
|
161 iQueLink.Deque(); |
|
162 } |