|
1 // Copyright (c) 2008-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 |
|
18 /** |
|
19 @file |
|
20 @internalTechnology |
|
21 @released |
|
22 */ |
|
23 |
|
24 #include "remconqueuemessage.h" |
|
25 #include <bluetooth/logger.h> |
|
26 |
|
27 #ifdef __FLOG_ACTIVE |
|
28 _LIT8(KLogComponent, LOG_COMPONENT_AVRCP_BEARER); |
|
29 #endif |
|
30 |
|
31 EXPORT_C CRemConQueuedMessage* CRemConQueuedMessage::NewL(TUid aInterfaceUid |
|
32 ,const TDesC8& aData |
|
33 ,TInt aOperationId |
|
34 ) |
|
35 { |
|
36 LOG_STATIC_FUNC |
|
37 CRemConQueuedMessage* self = new(ELeave) CRemConQueuedMessage( |
|
38 aInterfaceUid |
|
39 ,aOperationId |
|
40 ); |
|
41 |
|
42 CleanupStack::PushL(self); |
|
43 self->ConstructL(aData); |
|
44 CleanupStack::Pop(self); |
|
45 return self; |
|
46 } |
|
47 |
|
48 CRemConQueuedMessage::CRemConQueuedMessage(TUid aInterfaceUid |
|
49 ,TInt aOperationId |
|
50 ) |
|
51 : iInterfaceUid(aInterfaceUid), iOperationId(aOperationId) |
|
52 { |
|
53 LOG_FUNC |
|
54 } |
|
55 |
|
56 void CRemConQueuedMessage::ConstructL(const TDesC8& aData) |
|
57 { |
|
58 iData.CreateL(aData); |
|
59 } |
|
60 |
|
61 EXPORT_C CRemConQueuedMessage::~CRemConQueuedMessage() |
|
62 { |
|
63 LOG_FUNC |
|
64 iData.Close(); |
|
65 } |
|
66 |
|
67 EXPORT_C const TDesC8& CRemConQueuedMessage::Data() |
|
68 { |
|
69 return iData; |
|
70 } |
|
71 |
|
72 EXPORT_C const CRemConQueuedMessage* TRemConMessageQueue::Find( |
|
73 TUid aInterfaceUid |
|
74 ,TInt aOperationId |
|
75 ) |
|
76 { |
|
77 CRemConQueuedMessage* request = NULL; |
|
78 while (iIter) |
|
79 { |
|
80 request = iIter++; |
|
81 if(request->iInterfaceUid == aInterfaceUid |
|
82 && request->iOperationId == aOperationId |
|
83 ) |
|
84 { |
|
85 return request; |
|
86 } |
|
87 } |
|
88 |
|
89 return NULL; |
|
90 } |
|
91 |
|
92 EXPORT_C TRemConMessageQueue::TRemConMessageQueue() |
|
93 :iQueue(_FOFF(CRemConQueuedMessage, iLink)) |
|
94 , iIter(iQueue) |
|
95 { |
|
96 |
|
97 } |
|
98 |
|
99 EXPORT_C void TRemConMessageQueue::Reset() |
|
100 { |
|
101 CRemConQueuedMessage* msg; |
|
102 iIter.SetToFirst(); |
|
103 while (NULL != (msg = iIter++)) |
|
104 { |
|
105 iQueue.Remove(*msg); |
|
106 delete msg; |
|
107 } |
|
108 } |
|
109 |
|
110 EXPORT_C void TRemConMessageQueue::AddLast(CRemConQueuedMessage& aMsg) |
|
111 { |
|
112 iQueue.AddLast(aMsg); |
|
113 } |
|
114 |
|
115 EXPORT_C TBool TRemConMessageQueue::IsEmpty() |
|
116 { |
|
117 return iQueue.IsEmpty(); |
|
118 } |
|
119 |
|
120 EXPORT_C CRemConQueuedMessage* TRemConMessageQueue::First() const |
|
121 { |
|
122 return iQueue.First(); |
|
123 } |
|
124 |
|
125 EXPORT_C void TRemConMessageQueue::Remove(CRemConQueuedMessage& aMsg) |
|
126 { |
|
127 iQueue.Remove(aMsg); |
|
128 } |