|
1 /* |
|
2 * Copyright (c) 2005 Nokia Corporation and/or its subsidiary(-ies). |
|
3 * All rights reserved. |
|
4 * This component and the accompanying materials are made available |
|
5 * under the terms of "Eclipse Public License v1.0" |
|
6 * which accompanies this distribution, and is available |
|
7 * at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
8 * |
|
9 * Initial Contributors: |
|
10 * Nokia Corporation - initial contribution. |
|
11 * |
|
12 * Contributors: |
|
13 * |
|
14 * Description: |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 |
|
20 |
|
21 #include "mcemanager.h" |
|
22 #include "mceevent.h" |
|
23 #include "mceeventreceiver.h" |
|
24 #include "mce.h" |
|
25 #include "mceserial.h" |
|
26 #include "mceevents.h" |
|
27 #include "mceclilogs.h" |
|
28 |
|
29 // ----------------------------------------------------------------------------- |
|
30 // CMceEventReceiver::CMceEventReceiver |
|
31 // ----------------------------------------------------------------------------- |
|
32 // |
|
33 CMceEventReceiver::CMceEventReceiver( RMce& aMce, |
|
34 CMceEvent& aEvent ) |
|
35 : CMceItcReceiverBase( aMce ), |
|
36 iEvent( aEvent ) |
|
37 { |
|
38 iIdsPckg().iAppUID = aEvent.Manager().AppUid().iUid; |
|
39 iIdsPckg().iManagerType = KMceCSSIPEvent; |
|
40 iIdsPckg().iSessionID = aEvent.Id(); |
|
41 |
|
42 Init(); |
|
43 |
|
44 } |
|
45 |
|
46 // ----------------------------------------------------------------------------- |
|
47 // CMceEventReceiver::~CMceEventReceiver |
|
48 // ----------------------------------------------------------------------------- |
|
49 // |
|
50 CMceEventReceiver::~CMceEventReceiver () |
|
51 { |
|
52 } |
|
53 |
|
54 // ----------------------------------------------------------------------------- |
|
55 // CMceEventReceiver::IncomingEventL |
|
56 // ----------------------------------------------------------------------------- |
|
57 // |
|
58 void CMceEventReceiver::IncomingEventL( TMceItcCallBack aEvent, TMceIds& aIds, |
|
59 const TDesC8& aContext ) |
|
60 { |
|
61 MCECLI_DEBUG("CMceEventReceiver::IncomingEventL, Entry"); |
|
62 MCECLI_DEBUG_DVALUE("context size", aContext.Length() ); |
|
63 |
|
64 switch ( aEvent ) |
|
65 { |
|
66 case EMceItcStateChanged: |
|
67 case EMceItcNotifyReceived: |
|
68 { |
|
69 MCECLI_DEBUG("CMceEventReceiver::IncomingEventL, incoming event. \ |
|
70 passing to event"); |
|
71 |
|
72 CMceMsgBase* message = DecodeMessageLC( aIds, aContext ); |
|
73 User::LeaveIfError( message ? KErrNone : KErrGeneral ); |
|
74 message->PushL(); |
|
75 |
|
76 iEvent.EventReceivedL( aIds, *message ); |
|
77 |
|
78 message->Pop(); |
|
79 CleanupStack::PopAndDestroy( message ); |
|
80 |
|
81 break; |
|
82 } |
|
83 default: |
|
84 { |
|
85 MCECLI_DEBUG("CMceEventReceiver::IncomingEventL, not supported"); |
|
86 User::Leave( KErrNotSupported ); |
|
87 } |
|
88 } |
|
89 |
|
90 MCECLI_DEBUG("CMceEventReceiver::IncomingEventL, Exit"); |
|
91 } |
|
92 |
|
93 |
|
94 // ----------------------------------------------------------------------------- |
|
95 // CMceEventReceiver::IncomingEventL |
|
96 // ----------------------------------------------------------------------------- |
|
97 // |
|
98 void CMceEventReceiver::IncomingEventL( TMceItcCallBack aEvent, TMceIds& aIds, |
|
99 const TDesC8& aContext, |
|
100 HBufC8* aContent ) |
|
101 { |
|
102 MCECLI_DEBUG("CMceEventReceiver::IncomingEventL, Entry"); |
|
103 MCECLI_DEBUG_DVALUE("context size", aContext.Length() ); |
|
104 MCECLI_DEBUG_DVALUE("content size", aContent ? aContent->Length() : 0 ); |
|
105 |
|
106 switch ( aEvent ) |
|
107 { |
|
108 case EMceItcStateChanged: |
|
109 case EMceItcNotifyReceived: |
|
110 { |
|
111 MCECLI_DEBUG("CMceEventReceiver::IncomingEventL, incoming event. \ |
|
112 passing to event"); |
|
113 CMceMsgBase* message = DecodeMessageLC( aIds, aContext ); |
|
114 User::LeaveIfError( message ? KErrNone : KErrGeneral ); |
|
115 message->PushL(); |
|
116 |
|
117 iEvent.EventReceivedL( aIds, *message, aContent ); |
|
118 |
|
119 message->Pop(); |
|
120 CleanupStack::PopAndDestroy( message ); |
|
121 break; |
|
122 } |
|
123 default: |
|
124 { |
|
125 MCECLI_DEBUG("CMceEventReceiver::IncomingEventL, not supported"); |
|
126 User::Leave( KErrNotSupported ); |
|
127 } |
|
128 } |
|
129 |
|
130 MCECLI_DEBUG("CMceEventReceiver::IncomingEventL, Exit"); |
|
131 } |
|
132 |
|
133 |
|
134 // ----------------------------------------------------------------------------- |
|
135 // CMceEventReceiver::IncomingEventL |
|
136 // ----------------------------------------------------------------------------- |
|
137 // |
|
138 void CMceEventReceiver::IncomingEventL( TMceItcCallBack /*aEvent*/, TMceIds& aIds ) |
|
139 { |
|
140 MCECLI_DEBUG("CMceEventReceiver::IncomingEventL, Entry"); |
|
141 |
|
142 iEvent.EventReceivedL( aIds ); |
|
143 |
|
144 MCECLI_DEBUG("CMceEventReceiver::IncomingEventL, Exit"); |
|
145 |
|
146 } |
|
147 |
|
148 // ----------------------------------------------------------------------------- |
|
149 // CMceEventReceiver::ErrorOccuredL |
|
150 // ----------------------------------------------------------------------------- |
|
151 // |
|
152 void CMceEventReceiver::ErrorOccuredL (TMceIds& /*aIds*/, TInt aError ) |
|
153 { |
|
154 MCECLI_DEBUG("CMceEventReceiver::ErrorOccuredL, Entry"); |
|
155 iEvent.ErrorOccuredL( aError ); |
|
156 MCECLI_DEBUG("CMceEventReceiver::ErrorOccuredL, Exit"); |
|
157 } |
|
158 |
|
159 // ----------------------------------------------------------------------------- |
|
160 // CMceEventReceiver::DecodeMessageL |
|
161 // ----------------------------------------------------------------------------- |
|
162 // |
|
163 CMceMsgBase* CMceEventReceiver::DecodeMessageLC( TMceIds& aIds, |
|
164 const TDesC8& aContext ) |
|
165 { |
|
166 CMceMsgBase* message = NULL; |
|
167 switch ( aIds.iMsgType ) |
|
168 { |
|
169 case EMceItcMsgTypeSIPReply: |
|
170 { |
|
171 message = new (ELeave) CMceMsgSIPReply(); |
|
172 break; |
|
173 } |
|
174 case EMceItcMsgTypeEvent: |
|
175 { |
|
176 message = new (ELeave) CMceMsgSIPEvent(); |
|
177 break; |
|
178 } |
|
179 default: |
|
180 { |
|
181 } |
|
182 } |
|
183 |
|
184 if ( message ) |
|
185 { |
|
186 CleanupStack::PushL( message ); |
|
187 message->DecodeL( aContext ); |
|
188 } |
|
189 |
|
190 return message; |
|
191 } |
|
192 |
|
193 |
|
194 |
|
195 |
|
196 |
|
197 |
|
198 |