|
1 // Copyright (c) 2003-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 // Signalling message |
|
15 // The signalling message encapsulates the parsing and generation of signalling messages as outlined |
|
16 // in the AVDTP specification. |
|
17 // The signalling channel is called once the incoming signalling messages have parsed themselves |
|
18 // If a parse error occurs then: |
|
19 // - for commands, the parser leaves. The leave is trapped and an appropriate Rejection is sent by the |
|
20 // signalling channel |
|
21 // - for responses the error is sent to the signalling channel for delivery to the correct signalling session |
|
22 // so that client requests may be completed |
|
23 |
|
24 /** |
|
25 @file |
|
26 @internalComponent |
|
27 */ |
|
28 |
|
29 |
|
30 #ifndef AVDTPSIGNALLINGMESSAGES_H |
|
31 #define AVDTPSIGNALLINGMESSAGES_H |
|
32 |
|
33 #include <bluetoothav.h> |
|
34 #include "avdtpMessage.h" |
|
35 #include "gavdpinterface.h" |
|
36 #include "avdtpAllocators.h" |
|
37 #include "avdtputil.h" |
|
38 |
|
39 class CSignallingChannel; |
|
40 class CRemoteSEPCache; |
|
41 class CCapabilityVisitor; |
|
42 class RAvdtpTransactionLabel; |
|
43 class RMBufChain; |
|
44 |
|
45 enum TPostSendAction |
|
46 { |
|
47 EKeepSetRTX, //< commands with timeouts |
|
48 EKeepDontSetRTX, //< commands without timeouts |
|
49 EDiscard //< responses |
|
50 }; |
|
51 |
|
52 enum TAvdtpPacketType |
|
53 { |
|
54 ESingle =0x00, |
|
55 EStart =0x01, |
|
56 EContinue =0x02, |
|
57 EEnd =0x03, |
|
58 }; |
|
59 |
|
60 enum TAvdtpMessageType |
|
61 { |
|
62 ECommand =0x00, |
|
63 EGeneralReject =0x01, |
|
64 EResponseAccept =0x02, |
|
65 EResponseReject =0x03, |
|
66 }; |
|
67 |
|
68 const TUint KAvdtpMinimumSignallingSinglePacketLength = 2; |
|
69 const TUint KAvdtpMinimumSignallingStartPacketLength = 3; |
|
70 const TUint KAvdtpMinimumSignallingContinuePacketLength = 1; |
|
71 const TUint KAvdtpMinimumSignallingEndPacketLength = 1; |
|
72 |
|
73 // min/max lengths for signalling packets - not including the signalling header |
|
74 const TUint KAvdtpSignallingUnboundedMaximumLength = KMaxTUint; |
|
75 // Discover |
|
76 const TUint KAvdtpDiscoverCommandMinimumLength = 0; |
|
77 const TUint KAvdtpDiscoverCommandMaximumLength = 0; |
|
78 const TUint KAvdtpDiscoverAcceptMinimumLength = 2; |
|
79 const TUint KAvdtpDiscoverAcceptMaximumLength = 64; // 32 SEPs |
|
80 const TUint KAvdtpDiscoverRejectMinimumLength = 1; |
|
81 const TUint KAvdtpDiscoverRejectMaximumLength = 1; |
|
82 // Getcaps |
|
83 const TUint KAvdtpGetCapsCommandMinimumLength = 1; |
|
84 const TUint KAvdtpGetCapsCommandMaximumLength = 1; |
|
85 const TUint KAvdtpGetCapsAcceptMinimumLength = KAvdtpServiceCapabilitiesHeaderLen; |
|
86 const TUint KAvdtpGetCapsAcceptMaximumLength = KAvdtpSignallingUnboundedMaximumLength; |
|
87 const TUint KAvdtpGetCapsRejectMinimumLength = 1; |
|
88 const TUint KAvdtpGetCapsRejectMaximumLength = 1; |
|
89 // SetConfig |
|
90 const TUint KAvdtpSetConfigCommandMinimumLength = 2+KAvdtpServiceCapabilitiesHeaderLen; |
|
91 const TUint KAvdtpSetConfigCommandMaximumLength = KAvdtpSignallingUnboundedMaximumLength; |
|
92 const TUint KAvdtpSetConfigAcceptMinimumLength = 0; |
|
93 const TUint KAvdtpSetConfigAcceptMaximumLength = 0; |
|
94 const TUint KAvdtpSetConfigRejectMinimumLength = 2; |
|
95 const TUint KAvdtpSetConfigRejectMaximumLength = 2; |
|
96 // GetConfig |
|
97 const TUint KAvdtpGetConfigCommandMinimumLength = 1; |
|
98 const TUint KAvdtpGetConfigCommandMaximumLength = 1; |
|
99 const TUint KAvdtpGetConfigAcceptMinimumLength = KAvdtpServiceCapabilitiesHeaderLen; |
|
100 const TUint KAvdtpGetConfigAcceptMaximumLength = KAvdtpSignallingUnboundedMaximumLength; |
|
101 const TUint KAvdtpGetConfigRejectMinimumLength = 1; |
|
102 const TUint KAvdtpGetConfigRejectMaximumLength = 1; |
|
103 // ReConfig |
|
104 const TUint KAvdtpReConfigCommandMinimumLength = 1+KAvdtpServiceCapabilitiesHeaderLen; |
|
105 const TUint KAvdtpReConfigCommandMaximumLength = KAvdtpSignallingUnboundedMaximumLength; |
|
106 const TUint KAvdtpReConfigAcceptMinimumLength = 0; |
|
107 const TUint KAvdtpReConfigAcceptMaximumLength = 0; |
|
108 const TUint KAvdtpReConfigRejectMinimumLength = 2; |
|
109 const TUint KAvdtpReConfigRejectMaximumLength = 2; |
|
110 // Open |
|
111 const TUint KAvdtpOpenCommandMinimumLength = 1; |
|
112 const TUint KAvdtpOpenCommandMaximumLength = 1; |
|
113 const TUint KAvdtpOpenAcceptMinimumLength = 0; |
|
114 const TUint KAvdtpOpenAcceptMaximumLength = 0; |
|
115 const TUint KAvdtpOpenRejectMinimumLength = 1; |
|
116 const TUint KAvdtpOpenRejectMaximumLength = 1; |
|
117 // Close |
|
118 const TUint KAvdtpCloseCommandMinimumLength = 1; |
|
119 const TUint KAvdtpCloseCommandMaximumLength = 1; |
|
120 const TUint KAvdtpCloseAcceptMinimumLength = 0; |
|
121 const TUint KAvdtpCloseAcceptMaximumLength = 0; |
|
122 const TUint KAvdtpCloseRejectMinimumLength = 1; |
|
123 const TUint KAvdtpCloseRejectMaximumLength = 1; |
|
124 // Start |
|
125 const TUint KAvdtpStartCommandMinimumLength = 1; |
|
126 const TUint KAvdtpStartCommandMaximumLength = 32; // all SEIDs |
|
127 const TUint KAvdtpStartAcceptMinimumLength = 0; |
|
128 const TUint KAvdtpStartAcceptMaximumLength = 0; |
|
129 const TUint KAvdtpStartRejectMinimumLength = 2; |
|
130 const TUint KAvdtpStartRejectMaximumLength = 2; |
|
131 // Suspend |
|
132 const TUint KAvdtpSuspendCommandMinimumLength = 1; |
|
133 const TUint KAvdtpSuspendCommandMaximumLength = 32; // all SEIDs |
|
134 const TUint KAvdtpSuspendAcceptMinimumLength = 0; |
|
135 const TUint KAvdtpSuspendAcceptMaximumLength = 0; |
|
136 const TUint KAvdtpSuspendRejectMinimumLength = 2; |
|
137 const TUint KAvdtpSuspendRejectMaximumLength = 2; |
|
138 // Abort |
|
139 const TUint KAvdtpAbortCommandMinimumLength = 1; |
|
140 const TUint KAvdtpAbortCommandMaximumLength = 1; |
|
141 const TUint KAvdtpAbortAcceptMinimumLength = 0; |
|
142 const TUint KAvdtpAbortAcceptMaximumLength = 0; |
|
143 // no Abort reject |
|
144 // SecurityControl |
|
145 const TUint KAvdtpSecurityControlCommandMinimumLength = 1; |
|
146 const TUint KAvdtpSecurityControlCommandMaximumLength = KAvdtpSignallingUnboundedMaximumLength; |
|
147 const TUint KAvdtpSecurityControlAcceptMinimumLength = 1; |
|
148 const TUint KAvdtpSecurityControlAcceptMaximumLength = KAvdtpSignallingUnboundedMaximumLength; |
|
149 const TUint KAvdtpSecurityControlRejectMinimumLength = 1; |
|
150 const TUint KAvdtpSecurityControlRejectMaximumLength = 1; |
|
151 // General reject |
|
152 const TUint KAvdtpGeneralRejectLength = 0; |
|
153 |
|
154 |
|
155 // and ones for minimum and maximum LOSC for service categories in Set/Reconfig and GetCaps |
|
156 const TUint KAvdtpLOSCUnboundedMaximumLength = KMaxTUint; |
|
157 |
|
158 const TUint KAvdtpCapabilityMediaTransportMinimumLOSC = 0; |
|
159 const TUint KAvdtpCapabilityMediaTransportMaximumLOSC = 0; |
|
160 const TUint KAvdtpCapabilityReportingMinimumLOSC = 0; |
|
161 const TUint KAvdtpCapabilityReportingMaximumLOSC = 0; |
|
162 const TUint KAvdtpCapabilityRecoveryMinimumLOSC = 3; |
|
163 const TUint KAvdtpCapabilityRecoveryMaximumLOSC = 3; |
|
164 const TUint KAvdtpCapabilityMediaCodecMinimumLOSC = 2; |
|
165 const TUint KAvdtpCapabilityMediaCodecMaximumLOSC = KAvdtpLOSCUnboundedMaximumLength; |
|
166 const TUint KAvdtpCapabilityContentProtectionMinimumLOSC = 2; |
|
167 const TUint KAvdtpCapabilityContentProtectionMaximumLOSC = KAvdtpLOSCUnboundedMaximumLength; |
|
168 const TUint KAvdtpCapabilityHeaderCompressionMinimumLOSC = 1; |
|
169 const TUint KAvdtpCapabilityHeaderCompressionMaximumLOSC = 1; |
|
170 const TUint KAvdtpCapabilityMultiplexingMinimumLOSC = 3; |
|
171 const TUint KAvdtpCapabilityMultiplexingMaximumLOSC = 7; |
|
172 |
|
173 const TUint KAvdtpPacketTypeOffset = 0x02; |
|
174 const TUint KAvdtpPacketTypeMask = 0x03 << KAvdtpPacketTypeOffset; |
|
175 |
|
176 const TUint KAvdtpTransactionLabelOffset = 0x04; |
|
177 const TUint KAvdtpTransactionLabelMask = 0x0f << KAvdtpTransactionLabelOffset; |
|
178 |
|
179 const TUint KAvdtpMessageTypeOffset = 0x00; |
|
180 const TUint KAvdtpMessageTypeMask = 0x3 << KAvdtpMessageTypeOffset; |
|
181 |
|
182 const TUint KAvdtpSignalIdentifierMask = 0x3f; |
|
183 |
|
184 const TUint KAvdtpMediaTypeOffset = 4; // see 8.6.2 |
|
185 const TUint KAvdtpTSEPOffset = 3; |
|
186 const TUint KAvdtpPacketSEPInfoSize = 2; // see 8.6.2 |
|
187 const TUint KAvdtpInUseFlagOffset = 1; |
|
188 |
|
189 NONSHARABLE_CLASS(TAvdtpFragmentationInfo) |
|
190 { |
|
191 public: |
|
192 TAvdtpFragmentationInfo() : iFragmented(EFalse) {} |
|
193 TBool iFragmented; |
|
194 TInt iTotalPackets; |
|
195 TInt iPacketNumber; |
|
196 }; |
|
197 |
|
198 NONSHARABLE_CLASS(CAvdtpSignallingMessage) : public CAvdtpMessage |
|
199 { |
|
200 public: |
|
201 void SetType(TAvdtpMessageType aType,TAvdtpMessage aMessage); |
|
202 inline TAvdtpMessage Signal() const; |
|
203 protected: |
|
204 CAvdtpSignallingMessage(); |
|
205 protected: |
|
206 TAvdtpMessageType iMessageType; |
|
207 TAvdtpMessage iSignal; |
|
208 }; |
|
209 |
|
210 inline TAvdtpMessage CAvdtpSignallingMessage::Signal() const |
|
211 { |
|
212 return iSignal; |
|
213 } |
|
214 |
|
215 NONSHARABLE_CLASS(CAvdtpInboundSignallingMessage) : public CAvdtpSignallingMessage |
|
216 /** |
|
217 represents outgoing signalling messages, and has parsing methods for inbound packets |
|
218 */ |
|
219 { |
|
220 public: |
|
221 explicit CAvdtpInboundSignallingMessage(CSignallingChannel& aSignallingChannel); |
|
222 virtual TInt NewData(TUint aCount); |
|
223 private: |
|
224 static TAvdtpMessage SignalIdentifier(const RMBufChain& aMessage); |
|
225 static RMBufChain MessageL(RMBufChain& aPacket, const TAvdtpPacketType aPacketType); |
|
226 static TUint8 NumberSignalPackets(const RMBufChain& aChain); |
|
227 |
|
228 private: |
|
229 TInt CheckPacketType(RMBufChain& aFragment,TAvdtpPacketType& aPacketType, TAvdtpMessageType& aMessageType, TAvdtpTransactionLabel& aTransactionLabel); |
|
230 void Process(TAvdtpTransactionLabel aLabel); |
|
231 |
|
232 static void HandleDiscoverL(CAvdtpInboundSignallingMessage& aThat, TAvdtpTransactionLabel aLabel); |
|
233 static void HandleGetCapsL(CAvdtpInboundSignallingMessage& aThat, TAvdtpTransactionLabel aLabel); |
|
234 static void HandleSetConfigL(CAvdtpInboundSignallingMessage& aThat, TAvdtpTransactionLabel aLabel); |
|
235 static void HandleGetConfigL(CAvdtpInboundSignallingMessage& aThat, TAvdtpTransactionLabel aLabel); |
|
236 static void HandleReconfigL(CAvdtpInboundSignallingMessage& aThat, TAvdtpTransactionLabel aLabel); |
|
237 static void HandleOpenL(CAvdtpInboundSignallingMessage& aThat, TAvdtpTransactionLabel aLabel); |
|
238 static void HandleStartL(CAvdtpInboundSignallingMessage& aThat, TAvdtpTransactionLabel aLabel); |
|
239 static void HandleReleaseL(CAvdtpInboundSignallingMessage& aThat, TAvdtpTransactionLabel aLabel); |
|
240 static void HandleSuspendL(CAvdtpInboundSignallingMessage& aThat, TAvdtpTransactionLabel aLabel); |
|
241 static void HandleAbortL(CAvdtpInboundSignallingMessage& aThat, TAvdtpTransactionLabel aLabel); |
|
242 static void HandleSecurityControlL(CAvdtpInboundSignallingMessage& aThat, TAvdtpTransactionLabel aLabel); |
|
243 |
|
244 void DoHandleDiscoverL(TAvdtpTransactionLabel aLabel); |
|
245 void DoHandleGetCapsL(TAvdtpTransactionLabel aLabel); |
|
246 void DoHandleSetConfigL(TAvdtpTransactionLabel aLabel); |
|
247 void DoHandleGetConfigL(TAvdtpTransactionLabel aLabel); |
|
248 void DoHandleReconfigL(TAvdtpTransactionLabel aLabel); |
|
249 void DoHandleOpenL(TAvdtpTransactionLabel aLabel); |
|
250 void DoHandleStartL(TAvdtpTransactionLabel aLabel); |
|
251 void DoHandleReleaseL(TAvdtpTransactionLabel aLabel); |
|
252 void DoHandleSuspendL(TAvdtpTransactionLabel aLabel); |
|
253 void DoHandleAbortL(TAvdtpTransactionLabel aLabel); |
|
254 void DoHandleSecurityControlL(TAvdtpTransactionLabel aLabel); |
|
255 |
|
256 TSEID LocalSEIDL(); |
|
257 TSEID RemoteSEIDL(); |
|
258 TSEID SEIDL(TBool aIsSemanticallyLocal); // common helper |
|
259 |
|
260 TInt CheckPacketLength(TUint aMin, TUint aMax); |
|
261 void CheckPacketLengthL(TUint aMin, TUint aMax); |
|
262 |
|
263 private: |
|
264 enum TPacketBuildState |
|
265 { |
|
266 EAwaitingNew, // single or start |
|
267 EAwaitingContinue, |
|
268 EAwaitingEnd, |
|
269 }; |
|
270 TPacketBuildState iPacketBuildState; |
|
271 TAvdtpFragmentationInfo iFragmentationInfo; |
|
272 CSignallingChannel& iSignallingChannel; |
|
273 TAvdtpTransactionLabel iPacketBuildLabel; |
|
274 }; |
|
275 |
|
276 NONSHARABLE_CLASS(CAvdtpOutboundSignallingMessage) : public CAvdtpSignallingMessage |
|
277 { |
|
278 friend class CSignallingChannel; //que'd in the SignallingChannel |
|
279 public: |
|
280 TInt AllocateTransactionLabel(TTransactionLabelManager& aManager); |
|
281 void SetTransactionLabel(TAvdtpTransactionLabel aLabel); |
|
282 void AddSEPInfoL(const TAvdtpSEPInfo& aSEPInfo); |
|
283 void AddSEPCapabilityL(const TAvdtpServiceCapability& aCapability); |
|
284 TBool GetNextOutboundFragmentL(RMBufChain& aDest, TInt aMaxSize); |
|
285 TPostSendAction PostSendAction() const; |
|
286 inline TAvdtpTransactionLabel TransactionLabel() const; |
|
287 virtual ~CAvdtpOutboundSignallingMessage(); |
|
288 private: |
|
289 void Deque(); |
|
290 static void PrependSignallingHeaderL(RMBufChain& aDest, |
|
291 const TAvdtpPacketType& aPacketType, |
|
292 const TAvdtpTransactionLabel& aTransLabel, |
|
293 const TAvdtpMessageType& aMessageType, |
|
294 TAvdtpMessage aSigId=EAvdtpNull, |
|
295 TInt aNoSigPkts=0 |
|
296 ); |
|
297 virtual TInt NewData(TUint aCount); // pure - panic if called in this class |
|
298 private: |
|
299 TDblQueLink iLink; //so we can be put in ques |
|
300 TAvdtpFragmentationInfo iFragInfo; |
|
301 // next 2 are logically a union, but the R-class has a ctor, so cannot be a C++ union |
|
302 RAvdtpTransactionLabel iCommandLabel; |
|
303 TAvdtpTransactionLabel iResponseLabel; |
|
304 }; |
|
305 |
|
306 |
|
307 inline TAvdtpTransactionLabel CAvdtpOutboundSignallingMessage::TransactionLabel() const |
|
308 { |
|
309 //OutBound Signalling message should never be EReserved |
|
310 __ASSERT_DEBUG(Signal() != EReserved,Panic(EAvdtpInvalidReservedValueInOutboundSignallingMessage)); |
|
311 return (iMessageType==ECommand) ? iCommandLabel.TransactionLabel() : iResponseLabel; |
|
312 } |
|
313 |
|
314 using namespace SymbianBluetoothAV; |
|
315 |
|
316 /*static*/ namespace AvdtpSignallingMessage |
|
317 { |
|
318 static TInt AppendSEID(CAvdtpOutboundSignallingMessage& aSignallingMessage,TSEID aACPSEID); |
|
319 |
|
320 NONSHARABLE_CLASS(Command) |
|
321 { |
|
322 }; |
|
323 NONSHARABLE_CLASS(Response) |
|
324 { |
|
325 protected: |
|
326 static TInt AppendResult(CAvdtpOutboundSignallingMessage& aSignallingMessage, TBluetoothAvDistributionError aResult); |
|
327 }; |
|
328 NONSHARABLE_CLASS(Reject) |
|
329 { |
|
330 public: |
|
331 static TInt Format(CAvdtpOutboundSignallingMessage& aSignallingMessage, |
|
332 TBluetoothAvDistributionError aRejectionCode, const TDesC8* aRejectionData=NULL); |
|
333 private: |
|
334 static void FormatL(CAvdtpOutboundSignallingMessage& aSignallingMessage, |
|
335 TBluetoothAvDistributionError aRejectionCode, const TDesC8* aRejectionData=NULL); |
|
336 }; |
|
337 } |
|
338 |
|
339 |
|
340 namespace AvdtpSignallingMessageDiscover |
|
341 { |
|
342 NONSHARABLE_CLASS(Response) |
|
343 { |
|
344 public: |
|
345 static TInt ParseL(const RMBufChain& aMessageData, |
|
346 TDes8& aClientBuffer, |
|
347 CRemoteSEPCache& aSEPCache, |
|
348 const TBTDevAddr& aAddr); |
|
349 }; |
|
350 } |
|
351 |
|
352 namespace AvdtpSignallingMessageOpen |
|
353 { |
|
354 NONSHARABLE_CLASS(Command) : public AvdtpSignallingMessage::Command |
|
355 { |
|
356 public: |
|
357 inline static TInt Format(CAvdtpOutboundSignallingMessage& aSignallingMessage, TSEID aACPSEID); |
|
358 }; |
|
359 NONSHARABLE_CLASS(Response) : public AvdtpSignallingMessage::Response |
|
360 { |
|
361 public: |
|
362 inline static TInt Format(CAvdtpOutboundSignallingMessage& aSignallingMessage, TBluetoothAvDistributionError aResult); |
|
363 }; |
|
364 } |
|
365 |
|
366 |
|
367 namespace AvdtpSignallingMessageStreamRelease |
|
368 { |
|
369 NONSHARABLE_CLASS(Command) : public AvdtpSignallingMessage::Command |
|
370 { |
|
371 public: |
|
372 inline static TInt Format(CAvdtpOutboundSignallingMessage& aSignallingMessage, TSEID aACPSEID); |
|
373 }; |
|
374 NONSHARABLE_CLASS(Response) : public AvdtpSignallingMessage::Response |
|
375 { |
|
376 public: |
|
377 inline static TInt Format(CAvdtpOutboundSignallingMessage& aSignallingMessage, TBluetoothAvDistributionError aResult); |
|
378 }; |
|
379 } |
|
380 |
|
381 namespace AvdtpSignallingMessageSecurityControl |
|
382 { |
|
383 NONSHARABLE_CLASS(Command) : public AvdtpSignallingMessage::Command |
|
384 { |
|
385 public: |
|
386 inline static TInt Format(CAvdtpOutboundSignallingMessage& aSignallingMessage, TSEID aACPSEID, const TDesC8& aSecurityData); |
|
387 }; |
|
388 NONSHARABLE_CLASS(Accept) : public AvdtpSignallingMessage::Response |
|
389 { |
|
390 public: |
|
391 inline static TInt Format(CAvdtpOutboundSignallingMessage& aSignallingMessage, const TDesC8* aSecurityData = NULL); |
|
392 }; |
|
393 } |
|
394 |
|
395 |
|
396 namespace AvdtpSignallingMessageAbort |
|
397 { |
|
398 NONSHARABLE_CLASS(Command) : public AvdtpSignallingMessage::Command |
|
399 { |
|
400 public: |
|
401 inline static TInt Format(CAvdtpOutboundSignallingMessage& aSignallingMessage, TSEID aACPSEID); |
|
402 }; |
|
403 } |
|
404 |
|
405 namespace AvdtpSignallingMessageGetCapabilities |
|
406 { |
|
407 NONSHARABLE_CLASS(Command) : public AvdtpSignallingMessage::Command |
|
408 { |
|
409 public: |
|
410 inline static TInt Format(CAvdtpOutboundSignallingMessage& aSignallingMessage, TSEID aACPSEID); |
|
411 }; |
|
412 } |
|
413 |
|
414 /** |
|
415 Common stuff for Set and Re configure responses |
|
416 */ |
|
417 namespace AvdtpSignallingMessageConfigure |
|
418 { |
|
419 NONSHARABLE_CLASS(Response) : public AvdtpSignallingMessage::Response |
|
420 { |
|
421 public: |
|
422 inline static TInt Format(CAvdtpOutboundSignallingMessage& aMessage, TAvdtpServiceCategory aCategory); |
|
423 }; |
|
424 } |
|
425 |
|
426 namespace AvdtpSignallingMessageSetConfiguration |
|
427 { |
|
428 NONSHARABLE_CLASS(Command) : public AvdtpSignallingMessage::Command |
|
429 { |
|
430 public: |
|
431 inline static TInt Format(CAvdtpOutboundSignallingMessage& aSignallingMessage, TSEID aACPSEID, TSEID aINTSEID, const RBuf8& aConfiguration); |
|
432 private: |
|
433 static void FormatL(CAvdtpOutboundSignallingMessage& aSignallingMessage, TSEID aACPSEID, TSEID aINTSEID, const RBuf8& aConfiguration); |
|
434 }; |
|
435 NONSHARABLE_CLASS(Response) : public AvdtpSignallingMessageConfigure::Response |
|
436 { |
|
437 }; |
|
438 } |
|
439 |
|
440 namespace AvdtpSignallingMessageReconfigure |
|
441 { |
|
442 NONSHARABLE_CLASS(Command) : public AvdtpSignallingMessage::Command |
|
443 { |
|
444 public: |
|
445 inline static TInt Format(CAvdtpOutboundSignallingMessage& aSignallingMessage, TSEID aACPSEID, const RBuf8& aConfiguration); |
|
446 private: |
|
447 static void FormatL(CAvdtpOutboundSignallingMessage& aSignallingMessage, TSEID aACPSEID, const RBuf8& aConfiguration); |
|
448 }; |
|
449 NONSHARABLE_CLASS(Response) : public AvdtpSignallingMessageConfigure::Response |
|
450 { |
|
451 }; |
|
452 } |
|
453 |
|
454 namespace AvdtpSignallingMessageStart |
|
455 { |
|
456 NONSHARABLE_CLASS(Command) : public AvdtpSignallingMessage::Command |
|
457 { |
|
458 public: |
|
459 inline static TInt Format(CAvdtpOutboundSignallingMessage& aSignallingMessage, TSEID aACPSEID); |
|
460 }; |
|
461 NONSHARABLE_CLASS(Response) : public AvdtpSignallingMessage::Response |
|
462 { |
|
463 public: |
|
464 inline static TInt Format(CAvdtpOutboundSignallingMessage& aSignallingMessage, TBluetoothAvDistributionError aResult); |
|
465 }; |
|
466 } |
|
467 |
|
468 namespace AvdtpSignallingMessageSuspend |
|
469 { |
|
470 NONSHARABLE_CLASS(Command) : public AvdtpSignallingMessage::Command |
|
471 { |
|
472 public: |
|
473 inline static TInt Format(CAvdtpOutboundSignallingMessage& aSignallingMessage, TSEID aACPSEID); |
|
474 }; |
|
475 NONSHARABLE_CLASS(Response) : public AvdtpSignallingMessage::Response |
|
476 { |
|
477 public: |
|
478 inline static TInt Format(CAvdtpOutboundSignallingMessage& aSignallingMessage, TBluetoothAvDistributionError aResult); |
|
479 }; |
|
480 } |
|
481 |
|
482 |
|
483 |
|
484 /*static*/ |
|
485 inline TInt AvdtpSignallingMessage::Reject::Format(CAvdtpOutboundSignallingMessage& aSignallingMessage, |
|
486 TBluetoothAvDistributionError aRejectionCode, const TDesC8* aRejectionData/*=NULL*/) |
|
487 { |
|
488 TRAPD(err, FormatL(aSignallingMessage, aRejectionCode, aRejectionData)); |
|
489 return err; |
|
490 } |
|
491 |
|
492 |
|
493 /*static*/ |
|
494 inline TInt AvdtpSignallingMessageStart::Command::Format(CAvdtpOutboundSignallingMessage& aSignallingMessage, TSEID aACPSEID) |
|
495 { |
|
496 return AvdtpSignallingMessage::AppendSEID(aSignallingMessage, aACPSEID); |
|
497 } |
|
498 |
|
499 inline TInt AvdtpSignallingMessageStart::Response::Format(CAvdtpOutboundSignallingMessage& aSignallingMessage, |
|
500 TBluetoothAvDistributionError aResult) |
|
501 { |
|
502 return Response::AppendResult(aSignallingMessage, aResult); |
|
503 } |
|
504 |
|
505 /*static*/ |
|
506 inline TInt AvdtpSignallingMessageSuspend::Command::Format(CAvdtpOutboundSignallingMessage& aSignallingMessage, TSEID aACPSEID) |
|
507 { |
|
508 return AvdtpSignallingMessage::AppendSEID(aSignallingMessage, aACPSEID); |
|
509 } |
|
510 |
|
511 inline TInt AvdtpSignallingMessageSuspend::Response::Format(CAvdtpOutboundSignallingMessage& aSignallingMessage, |
|
512 TBluetoothAvDistributionError aResult) |
|
513 { |
|
514 return Response::AppendResult(aSignallingMessage, aResult); |
|
515 } |
|
516 |
|
517 /*static*/ |
|
518 inline TInt AvdtpSignallingMessageStreamRelease::Command::Format(CAvdtpOutboundSignallingMessage& aSignallingMessage, |
|
519 TSEID aACPSEID) |
|
520 { |
|
521 return AvdtpSignallingMessage::AppendSEID(aSignallingMessage, aACPSEID); |
|
522 } |
|
523 |
|
524 /*static*/ |
|
525 inline TInt AvdtpSignallingMessageSecurityControl::Command::Format(CAvdtpOutboundSignallingMessage& aSignallingMessage, |
|
526 TSEID aACPSEID, const TDesC8& aSecurityData) |
|
527 { |
|
528 TInt res = AvdtpSignallingMessage::AppendSEID(aSignallingMessage, aACPSEID); |
|
529 if (res==KErrNone) |
|
530 { |
|
531 TRAP(res, aSignallingMessage.AppendDataL(aSecurityData)); |
|
532 } |
|
533 return res; |
|
534 } |
|
535 |
|
536 /*static*/ |
|
537 inline TInt AvdtpSignallingMessageSecurityControl::Accept::Format(CAvdtpOutboundSignallingMessage& aSignallingMessage, |
|
538 const TDesC8* aSecurityData) |
|
539 { |
|
540 TInt res=KErrNone; |
|
541 |
|
542 if (aSecurityData) |
|
543 { |
|
544 TRAP(res, aSignallingMessage.AppendDataL(*aSecurityData)); |
|
545 } |
|
546 return res; |
|
547 } |
|
548 |
|
549 /*static*/ |
|
550 inline TInt AvdtpSignallingMessageAbort::Command::Format(CAvdtpOutboundSignallingMessage& aSignallingMessage, |
|
551 TSEID aACPSEID) |
|
552 { |
|
553 return AvdtpSignallingMessage::AppendSEID(aSignallingMessage, aACPSEID); |
|
554 } |
|
555 |
|
556 /*static*/ |
|
557 inline TInt AvdtpSignallingMessageGetCapabilities::Command::Format(CAvdtpOutboundSignallingMessage& aSignallingMessage, |
|
558 TSEID aACPSEID) |
|
559 { |
|
560 return AvdtpSignallingMessage::AppendSEID(aSignallingMessage, aACPSEID); |
|
561 } |
|
562 |
|
563 /*static*/ |
|
564 inline TInt AvdtpSignallingMessageSetConfiguration::Command::Format(CAvdtpOutboundSignallingMessage& aSignallingMessage, |
|
565 TSEID aACPSEID, |
|
566 TSEID aINTSEID, |
|
567 const RBuf8& aConfiguration) |
|
568 { |
|
569 TRAPD(err, FormatL(aSignallingMessage, aACPSEID, aINTSEID, aConfiguration)); |
|
570 return err; |
|
571 } |
|
572 |
|
573 /*static*/ |
|
574 inline TInt AvdtpSignallingMessageReconfigure::Command::Format(CAvdtpOutboundSignallingMessage& aSignallingMessage, |
|
575 TSEID aACPSEID, |
|
576 const RBuf8& aConfiguration) |
|
577 { |
|
578 TRAPD(err, FormatL(aSignallingMessage, aACPSEID, aConfiguration)); |
|
579 return err; |
|
580 } |
|
581 |
|
582 /*static*/ |
|
583 inline TInt AvdtpSignallingMessageConfigure::Response::Format(CAvdtpOutboundSignallingMessage& aSignallingMessage, |
|
584 TAvdtpServiceCategory aCategory) |
|
585 { |
|
586 TRAPD(err, aSignallingMessage.AppendDataL(aCategory)); |
|
587 return err; |
|
588 } |
|
589 |
|
590 /*static*/ |
|
591 inline TInt AvdtpSignallingMessageOpen::Response::Format(CAvdtpOutboundSignallingMessage& aSignallingMessage, |
|
592 TBluetoothAvDistributionError aResult) |
|
593 { |
|
594 return Response::AppendResult(aSignallingMessage, aResult); |
|
595 } |
|
596 |
|
597 /*static*/ |
|
598 inline TInt AvdtpSignallingMessageOpen::Command::Format(CAvdtpOutboundSignallingMessage& aSignallingMessage, |
|
599 TSEID aACPSEID) |
|
600 { |
|
601 return AvdtpSignallingMessage::AppendSEID(aSignallingMessage, aACPSEID); |
|
602 } |
|
603 |
|
604 |
|
605 /*static*/ |
|
606 inline TInt AvdtpSignallingMessage::AppendSEID(CAvdtpOutboundSignallingMessage& aSignallingMessage, |
|
607 TSEID aACPSEID) |
|
608 { |
|
609 TRAPD(err, aSignallingMessage.AppendDataL(aACPSEID.PacketValue())); |
|
610 return err; |
|
611 } |
|
612 |
|
613 /*static*/ |
|
614 inline TInt AvdtpSignallingMessage::Response::AppendResult(CAvdtpOutboundSignallingMessage& aSignallingMessage, |
|
615 TBluetoothAvDistributionError aResult) |
|
616 { |
|
617 TRAPD(err, aSignallingMessage.AppendDataL(aResult)); |
|
618 return err; |
|
619 } |
|
620 |
|
621 // internalComponent stack capability visitors |
|
622 |
|
623 |
|
624 /* |
|
625 @internalComponent |
|
626 */ |
|
627 NONSHARABLE_CLASS(CCapabilityExtractorVisitor) : public CCapabilityVisitor |
|
628 { |
|
629 public: |
|
630 CCapabilityExtractorVisitor(TAvdtpServiceCategory aRequiredCapability); |
|
631 TPtrC8 GetCapability() const; |
|
632 TBool Capability(TAvdtpServiceCategory aCat); |
|
633 private: |
|
634 TAvdtpServiceCategory iRequiredCapability; |
|
635 TPtrC8 iPtr; |
|
636 }; |
|
637 |
|
638 |
|
639 |
|
640 |
|
641 /* |
|
642 @internalComponent |
|
643 goes through to see if spec unknown capabilities present |
|
644 */ |
|
645 NONSHARABLE_CLASS(CCapabilityValidateVisitor) : public CCapabilityVisitor |
|
646 { |
|
647 public: |
|
648 virtual TBool Capability(TAvdtpServiceCategory aCat); |
|
649 inline TInt Result() const; |
|
650 inline TAvdtpServiceCategory InvalidCategory() const; |
|
651 private: |
|
652 inline TBool IsLOSCValid(TUint aLOSC, TUint aMin, TUint aMax); |
|
653 TInt iResult; // the error to use if invalid, or KErrNone |
|
654 TAvdtpServiceCategory iInvalidCategory; |
|
655 }; |
|
656 |
|
657 /* |
|
658 @internalComponent |
|
659 goes through to remove spec unknown capabilities |
|
660 */ |
|
661 NONSHARABLE_CLASS(CCapabilityRemoveUnknownVisitor) : public CCapabilityVisitor |
|
662 { |
|
663 public: |
|
664 virtual TBool Capability(TAvdtpServiceCategory aCat); |
|
665 }; |
|
666 |
|
667 #ifdef _DEBUG |
|
668 /* |
|
669 @internalComponent |
|
670 */ |
|
671 NONSHARABLE_CLASS(CCapabilityFlogVisitor) : public CCapabilityVisitor |
|
672 { |
|
673 public: |
|
674 virtual TBool Capability(TAvdtpServiceCategory aCat); |
|
675 }; |
|
676 #endif |
|
677 |
|
678 |
|
679 #endif //AVDTPSIGNALLINGMESSAGES_H |