equal
deleted
inserted
replaced
122 iIndicatorChannel.Complete(KErrNone); |
122 iIndicatorChannel.Complete(KErrNone); |
123 } |
123 } |
124 aMessage.Complete( KErrNone ); |
124 aMessage.Complete( KErrNone ); |
125 break; |
125 break; |
126 } |
126 } |
|
127 case EHbSrvActivatedIndicatorData: { |
|
128 WriteIndicatorDataL(aMessage); |
|
129 break; |
|
130 } |
127 default: { |
131 default: { |
128 break; |
132 break; |
129 } |
133 } |
130 |
134 |
131 }; // end switch |
135 }; // end switch |
165 addToIndicatorQueue(deactivated, IndicatorDeactivated); |
169 addToIndicatorQueue(deactivated, IndicatorDeactivated); |
166 TRAP_IGNORE( WriteIndicatorInfoL() ); |
170 TRAP_IGNORE( WriteIndicatorInfoL() ); |
167 TRACE_EXIT |
171 TRACE_EXIT |
168 } |
172 } |
169 |
173 |
|
174 void HbIndicatorSessionHandler::IndicatorUserActivated(const QVariantMap& data) |
|
175 { |
|
176 QString type = data.value("type").toString(); |
|
177 |
|
178 if (indicatorTypes.contains(type) && iIndicatorChannelOpen) { |
|
179 indicatorDataMap = data; |
|
180 TRAP_IGNORE(WriteIndicatorDataL(iIndicatorChannel)); |
|
181 } |
|
182 } |
|
183 |
170 HbDeviceDialogServerPrivate& HbIndicatorSessionHandler::Server() |
184 HbDeviceDialogServerPrivate& HbIndicatorSessionHandler::Server() |
171 { |
185 { |
172 return iSession->Server(); |
186 return iSession->Server(); |
173 } |
187 } |
174 |
188 |
179 void HbIndicatorSessionHandler::ActivateIndicatorL( const RMessage2 &aMessage ) |
193 void HbIndicatorSessionHandler::ActivateIndicatorL( const RMessage2 &aMessage ) |
180 { |
194 { |
181 TRACE_ENTRY |
195 TRACE_ENTRY |
182 QVariant parameter; |
196 QVariant parameter; |
183 QString type = indicatorTypeFromMessageL(aMessage, parameter); |
197 QString type = indicatorTypeFromMessageL(aMessage, parameter); |
|
198 if (!indicatorTypes.contains(type)) { |
|
199 indicatorTypes.append(type); |
|
200 } |
184 HbDeviceDialogServer::IndicatorParameters indicatorParameters(type, aMessage, parameter); |
201 HbDeviceDialogServer::IndicatorParameters indicatorParameters(type, aMessage, parameter); |
185 TInt result = Server().activateIndicator(indicatorParameters); |
202 TInt result = Server().activateIndicator(indicatorParameters); |
186 aMessage.Complete(result); |
203 aMessage.Complete(result); |
187 TRACE_EXIT_ARGS("result: " << result) |
204 TRACE_EXIT_ARGS("result: " << result) |
188 } |
205 } |
194 void HbIndicatorSessionHandler::DeactivateIndicatorL( const RMessage2 &aMessage ) |
211 void HbIndicatorSessionHandler::DeactivateIndicatorL( const RMessage2 &aMessage ) |
195 { |
212 { |
196 TRACE_ENTRY |
213 TRACE_ENTRY |
197 QVariant parameter; |
214 QVariant parameter; |
198 QString type = indicatorTypeFromMessageL(aMessage, parameter); |
215 QString type = indicatorTypeFromMessageL(aMessage, parameter); |
|
216 indicatorTypes.removeAll(type); |
|
217 |
|
218 if (indicatorTypes.isEmpty() && iIndicatorChannelOpen) { |
|
219 indicatorDataMap.clear(); |
|
220 iIndicatorChannelOpen = false; |
|
221 iIndicatorChannel.Complete(KErrCancel); |
|
222 } |
|
223 |
199 HbDeviceDialogServer::IndicatorParameters indicatorParameters(type, aMessage, parameter); |
224 HbDeviceDialogServer::IndicatorParameters indicatorParameters(type, aMessage, parameter); |
200 TInt result = Server().deactivateIndicator(indicatorParameters); |
225 TInt result = Server().deactivateIndicator(indicatorParameters); |
201 aMessage.Complete(result); |
226 aMessage.Complete(result); |
202 TRACE_EXIT_ARGS("result: " << result) |
227 TRACE_EXIT_ARGS("result: " << result) |
203 } |
228 } |
216 iIndicatorChannelOpen = false; |
241 iIndicatorChannelOpen = false; |
217 return; |
242 return; |
218 } |
243 } |
219 |
244 |
220 WriteIndicatorInfoL(); |
245 WriteIndicatorInfoL(); |
|
246 |
|
247 // check whether there is buffered indicator data also present. |
|
248 if (iIndicatorChannelOpen && !indicatorDataMap.isEmpty()) { |
|
249 WriteIndicatorDataL(iIndicatorChannel); |
|
250 } |
221 TRACE_EXIT |
251 TRACE_EXIT |
222 } |
252 } |
223 |
253 |
224 /*! |
254 /*! |
225 \internal |
255 \internal |
330 |
360 |
331 TRACE_EXIT |
361 TRACE_EXIT |
332 return clientInfoCount - clientInfoStoreCount; |
362 return clientInfoCount - clientInfoStoreCount; |
333 } |
363 } |
334 |
364 |
|
365 void HbIndicatorSessionHandler::WriteIndicatorDataL(const RMessage2& aMessage) |
|
366 { |
|
367 iIndicatorChannelOpen = EFalse; |
|
368 QByteArray array; |
|
369 QDataStream stream( &array, QIODevice::WriteOnly ); |
|
370 |
|
371 QVariant var(indicatorDataMap); |
|
372 stream << var; |
|
373 |
|
374 // Get client data buffer size |
|
375 TInt size = aMessage.GetDesMaxLength( KSlot0 ); |
|
376 |
|
377 TPckgBuf<TInt> buf( EHbIndicatorUserActivated ); |
|
378 User::LeaveIfError(aMessage.Write(KSlot1, buf)); |
|
379 |
|
380 if (size >= array.size()) { |
|
381 // Buffer ok. Write data. |
|
382 TPtr8 ptr( reinterpret_cast<TUint8*>(array.data()), array.size(), array.size()); |
|
383 TInt error = aMessage.Write( KSlot0, ptr ); |
|
384 aMessage.Complete(error); |
|
385 indicatorDataMap.clear(); |
|
386 } else { |
|
387 aMessage.Complete(array.size()); |
|
388 } |
|
389 } |
335 /*! |
390 /*! |
336 \internal |
391 \internal |
337 get the indicator type and parameter from the message. |
392 get the indicator type and parameter from the message. |
338 */ |
393 */ |
339 QString HbIndicatorSessionHandler::indicatorTypeFromMessageL(const RMessage2 &aMessage, |
394 QString HbIndicatorSessionHandler::indicatorTypeFromMessageL(const RMessage2 &aMessage, |