91 FeatureManager::UnInitializeLib(); |
91 FeatureManager::UnInitializeLib(); |
92 |
92 |
93 iBTEngSettings = CBTEngSettings::NewL(); |
93 iBTEngSettings = CBTEngSettings::NewL(); |
94 iDevMan = CBTEngDevMan::NewL( this ); |
94 iDevMan = CBTEngDevMan::NewL( this ); |
95 iNotifUiUtil = CBTNotifUIUtil::NewL( iIsCoverUI ); |
95 iNotifUiUtil = CBTNotifUIUtil::NewL( iIsCoverUI ); |
|
96 iAuthoriseDialog = CBTNotifUIUtil::NewL( iIsCoverUI ); |
|
97 |
|
98 TCallBack processParamsCb(ProcessStartParamsCallBack, this); |
|
99 iProcessStartParamsCallBack = new (ELeave) CAsyncCallBack(processParamsCb, CActive::EPriorityHigh); |
96 } |
100 } |
97 |
101 |
98 // ---------------------------------------------------------- |
102 // ---------------------------------------------------------- |
99 // Destructor. |
103 // Destructor. |
100 // ---------------------------------------------------------- |
104 // ---------------------------------------------------------- |
101 // |
105 // |
102 CBTNotifierBase::~CBTNotifierBase() |
106 CBTNotifierBase::~CBTNotifierBase() |
103 { |
107 { |
104 FLOG(_L("[BTNOTIF]\t CBTNotifierBase::~CBTNotifierBase()")); |
108 FLOG(_L("[BTNOTIF]\t CBTNotifierBase::~CBTNotifierBase()")); |
105 Cancel(); |
109 Cancel(); |
|
110 |
|
111 delete iProcessStartParamsCallBack; |
106 FLOG(_L("[BTNOTIF]\t CBTNotifierBase::~CBTNotifierBase() -- Done")); |
112 FLOG(_L("[BTNOTIF]\t CBTNotifierBase::~CBTNotifierBase() -- Done")); |
107 } |
113 } |
108 |
114 |
109 // ---------------------------------------------------------- |
115 // ---------------------------------------------------------- |
110 // CBTNotifierBase::Release |
116 // CBTNotifierBase::Release |
143 // Asynchronic notifier launch. |
149 // Asynchronic notifier launch. |
144 // ---------------------------------------------------------- |
150 // ---------------------------------------------------------- |
145 // |
151 // |
146 void CBTNotifierBase::StartL(const TDesC8& aBuffer, TInt aReplySlot, const RMessagePtr2& aMessage) |
152 void CBTNotifierBase::StartL(const TDesC8& aBuffer, TInt aReplySlot, const RMessagePtr2& aMessage) |
147 { |
153 { |
|
154 if (!iMessage.IsNull()) |
|
155 { |
|
156 // We're already active. The notifier server will complete the message if we leave. |
|
157 User::Leave(KErrInUse); |
|
158 } |
|
159 |
|
160 __ASSERT_DEBUG(!iParamBuffer, BTNOTIF_PANIC(EiParamBufferLeakedFromPreviousActivation)); |
|
161 |
148 if( !iNotifUiUtil ) |
162 if( !iNotifUiUtil ) |
149 { |
163 { |
150 iNotifUiUtil = CBTNotifUIUtil::NewL( iIsCoverUI ); |
164 iNotifUiUtil = CBTNotifUIUtil::NewL( iIsCoverUI ); |
151 } |
165 } |
152 |
166 if( !iAuthoriseDialog ) |
153 TRAPD(err, GetParamsL(aBuffer, aReplySlot, aMessage)); |
167 { |
154 if (err) |
168 iNotifUiUtil = CBTNotifUIUtil::NewL( iIsCoverUI ); |
155 { |
169 } |
156 CompleteMessage(err); |
170 |
157 } |
171 iParamBuffer = aBuffer.AllocL(); // ProcessStartParamsCallBack responsible for deallocation |
|
172 iMessage = aMessage; |
|
173 iReplySlot = aReplySlot; |
|
174 |
|
175 // Return from StartL as soon as possible - processing the parameters involves displaying |
|
176 // waiting dialogs which would block the notifier server thus preventing other notifiers |
|
177 // from running, were we to do it from here. |
|
178 iProcessStartParamsCallBack->CallBack(); |
158 } |
179 } |
159 |
180 |
160 // ---------------------------------------------------------- |
181 // ---------------------------------------------------------- |
161 // CBTNotifierBase::Cancel |
182 // CBTNotifierBase::Cancel |
162 // Cancelling method. |
183 // Cancelling method. |
164 // |
185 // |
165 void CBTNotifierBase::Cancel() |
186 void CBTNotifierBase::Cancel() |
166 { |
187 { |
167 FLOG(_L("[BTNOTIF]\t CBTNotifierBase::Cancel()")); |
188 FLOG(_L("[BTNOTIF]\t CBTNotifierBase::Cancel()")); |
168 |
189 |
|
190 // In case we are being called before ProcessStartParamsCallBack |
|
191 // had a chance to run: |
|
192 delete iParamBuffer; |
|
193 iParamBuffer = NULL; |
|
194 |
|
195 if (iProcessStartParamsCallBack) |
|
196 { |
|
197 iProcessStartParamsCallBack->Cancel(); |
|
198 // - the callback object is deleted in the destructor. |
|
199 } |
|
200 |
169 delete iNotifUiUtil; |
201 delete iNotifUiUtil; |
170 iNotifUiUtil = NULL; |
202 iNotifUiUtil = NULL; |
|
203 |
|
204 delete iAuthoriseDialog; |
|
205 iAuthoriseDialog = NULL; |
171 |
206 |
172 delete iBTEngSettings; |
207 delete iBTEngSettings; |
173 iBTEngSettings = NULL; |
208 iBTEngSettings = NULL; |
174 |
209 |
175 delete iDevMan; |
210 delete iDevMan; |
195 // |
230 // |
196 TPtrC8 CBTNotifierBase::UpdateL(const TDesC8& /*aBuffer*/) |
231 TPtrC8 CBTNotifierBase::UpdateL(const TDesC8& /*aBuffer*/) |
197 { |
232 { |
198 TPtrC8 ret(KNullDesC8); |
233 TPtrC8 ret(KNullDesC8); |
199 return (ret); |
234 return (ret); |
|
235 } |
|
236 |
|
237 TInt CBTNotifierBase::ProcessStartParamsCallBack(TAny* aNotif) |
|
238 { |
|
239 CBTNotifierBase* notif = static_cast<CBTNotifierBase*>(aNotif); |
|
240 |
|
241 __ASSERT_DEBUG(notif->iParamBuffer, BTNOTIF_PANIC(EiParamBufferNullInProcessStartParams)); |
|
242 __ASSERT_DEBUG(!notif->iMessage.IsNull(), BTNOTIF_PANIC(EiMessageNullInProcessStartParams)); |
|
243 |
|
244 TRAPD(err, notif->ProcessStartParamsL()); |
|
245 if (err) |
|
246 { |
|
247 notif->CompleteMessage(err); |
|
248 } |
|
249 |
|
250 delete notif->iParamBuffer; |
|
251 notif->iParamBuffer = NULL; |
|
252 |
|
253 return 0; |
200 } |
254 } |
201 |
255 |
202 |
256 |
203 // ---------------------------------------------------------- |
257 // ---------------------------------------------------------- |
204 // CBTNotifierBase::AutoLockOnL |
258 // CBTNotifierBase::AutoLockOnL |