|
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 // Defines the avdtp signalling transaction |
|
15 // |
|
16 // |
|
17 |
|
18 /** |
|
19 @file |
|
20 @internalComponent |
|
21 */ |
|
22 |
|
23 #ifndef AVDTPSIGNALLINGTRANSACTION_H |
|
24 #define AVDTPSIGNALLINGTRANSACTION_H |
|
25 |
|
26 #include "avdtpSignallingMessages.h" |
|
27 |
|
28 /** |
|
29 NB the value here is specified by GAVDP to be 0.5~3.0 seconds. |
|
30 It also only applies to certain signalling operations (see GAVDP 4.1.8) |
|
31 |
|
32 This value is in microseconds. |
|
33 */ |
|
34 const TInt KAvdtpSigRTXTimeout = 3000000; |
|
35 |
|
36 class CSignallingChannel; |
|
37 class XAvdtpSignalReceiver; |
|
38 |
|
39 NONSHARABLE_CLASS(CSignallingTransaction) : public CBase |
|
40 /** |
|
41 Represents data pertaining to an actual transaction: the message, the label, |
|
42 a pointer to useful data that is not received in AVDTP responses etc. |
|
43 |
|
44 It also manages the response timer for commands. |
|
45 */ |
|
46 { |
|
47 public: |
|
48 static CSignallingTransaction* New(CSignallingChannel& aSignallingChannel, |
|
49 TAvdtpMessage aSignal, |
|
50 TAvdtpMessageType aMessageType); |
|
51 ~CSignallingTransaction(); |
|
52 |
|
53 inline void SetUser(XAvdtpSignalReceiver* aUser); |
|
54 inline void SetLabel(TAvdtpTransactionLabel aLabel); |
|
55 inline void SetCookie(TAny* aCookie); |
|
56 void SetSentAction(); |
|
57 |
|
58 inline XAvdtpSignalReceiver* User() const; |
|
59 inline TAvdtpTransactionLabel Label() const; |
|
60 inline TAny* Cookie() const; |
|
61 inline TPostSendAction SentAction() const; |
|
62 inline CSignallingChannel& SignallingChannel() const; |
|
63 inline TAvdtpMessage Signal() const; |
|
64 inline CAvdtpOutboundSignallingMessage& Message() const; |
|
65 |
|
66 void StartTimer(); |
|
67 void CancelTimer(); |
|
68 |
|
69 static TInt TimerExpired(TAny* aTransaction); |
|
70 void Error(TInt aError); |
|
71 public: |
|
72 TDblQueLink iLink; // to que |
|
73 |
|
74 private: |
|
75 CSignallingTransaction(CSignallingChannel& aSignallingChannel, |
|
76 TAvdtpMessage aSignal); |
|
77 TInt Construct(TAvdtpMessageType aMessageType); |
|
78 private: |
|
79 // not-owned, NULL if resp, or command to which issues does not need reply (eg Abort and Release) |
|
80 XAvdtpSignalReceiver* iUser; |
|
81 // used in packet && by us to mux |
|
82 TAvdtpTransactionLabel iLabel; |
|
83 |
|
84 // the signal represented by the transaction - this is effectively a "cache" of the message signal |
|
85 // do reduce RAM footprint the message is destroyed upon sending as AVDTP signalling |
|
86 // does not retransmit |
|
87 TAvdtpMessage iSignal; |
|
88 // represents what actually is transmitted |
|
89 CAvdtpOutboundSignallingMessage* iMessage; |
|
90 // e.g to remember useful stuff that the protocol specification doesnt give back in responses |
|
91 TAny* iCookie; |
|
92 // the object that will perform this transaction |
|
93 CSignallingChannel& iSigCh; |
|
94 |
|
95 TDeltaTimerEntry iTimerEntry; // for pending messages |
|
96 TBool iTimerSet; |
|
97 TPostSendAction iPostSendAction; |
|
98 }; |
|
99 |
|
100 |
|
101 inline void CSignallingTransaction::SetUser(XAvdtpSignalReceiver* aUser) |
|
102 { |
|
103 iUser = aUser; |
|
104 } |
|
105 |
|
106 inline void CSignallingTransaction::SetLabel(TAvdtpTransactionLabel aLabel) |
|
107 { |
|
108 iLabel = aLabel; |
|
109 } |
|
110 |
|
111 inline void CSignallingTransaction::SetCookie(TAny* aCookie) |
|
112 { |
|
113 iCookie = aCookie; |
|
114 } |
|
115 |
|
116 inline XAvdtpSignalReceiver* CSignallingTransaction::User() const |
|
117 { |
|
118 return iUser; |
|
119 } |
|
120 |
|
121 inline TAvdtpTransactionLabel CSignallingTransaction::Label() const |
|
122 { |
|
123 return iLabel; |
|
124 } |
|
125 |
|
126 inline TAny* CSignallingTransaction::Cookie() const |
|
127 { |
|
128 return iCookie; |
|
129 } |
|
130 |
|
131 inline TPostSendAction CSignallingTransaction::SentAction() const |
|
132 { |
|
133 return iPostSendAction; |
|
134 } |
|
135 |
|
136 inline CSignallingChannel& CSignallingTransaction::SignallingChannel() const |
|
137 { |
|
138 return iSigCh; |
|
139 } |
|
140 |
|
141 inline TAvdtpMessage CSignallingTransaction::Signal() const |
|
142 { |
|
143 return iSignal; |
|
144 } |
|
145 |
|
146 inline CAvdtpOutboundSignallingMessage& CSignallingTransaction::Message() const |
|
147 { |
|
148 __ASSERT_DEBUG(iMessage, User::Panic(_L("avdtp sig tr h"), __LINE__)); |
|
149 return *iMessage; |
|
150 } |
|
151 |
|
152 |
|
153 #endif //AVDTPSIGNALLINGTRANSACTION |
|
154 |