169 { |
171 { |
170 iPairingOkTimer.Cancel(); |
172 iPairingOkTimer.Cancel(); |
171 iActivePairingOk->CancelRequest(); |
173 iActivePairingOk->CancelRequest(); |
172 UnSetPairResult(); // we might have set it before (if the link went down) so we want to reset it. |
174 UnSetPairResult(); // we might have set it before (if the link went down) so we want to reset it. |
173 } |
175 } |
174 switch ( aDev.LinkKeyType() ) |
176 if (aDev.LinkKeyType() == ELinkKeyUnauthenticatedNonUpgradable && !iUserAwarePairing) |
175 { |
177 { |
176 case ELinkKeyUnauthenticatedNonUpgradable: |
178 // If an application uses btengconnman API to connect a service of |
177 { |
179 // this device and JW pairing occurred as part of security enforcement, |
178 // If an application uses btengconnman API to connect a service of |
180 // it shall be a user aware pairing, and we shall add this device in paired |
179 // this device and JW pairing occurred as part of security enforcement, |
181 // view. In this way, user is able to disconnect the device from our UI. |
180 // it shall be a user aware pairing, and we shall add this device in paired |
182 // Otherwise the link key has been created by a device without IO requesting |
181 // view. In this way, user is able to disconnect the device from our UI. |
183 // a service connection with phone. We won't take any action (e.g. remove |
182 // Otherwise the link key has been created by a device without IO requesting |
184 // link key) in this case. As the result, this device can't be seen in our UI, |
183 // a service connection with phone. We won't take any action (e.g. remove |
185 // however other applications are still freely to use its services. |
184 // link key) in this case. As the result, this device can't be seen in our UI, |
186 TRACE_INFO(_L("[BTEng]: CBTEngIncPair: JW pairing with no IO device" ) ) |
185 // however other applications are still freely to use its services. |
187 TBTEngConnectionStatus status = iParent.IsDeviceConnected( aDev.Address() ); |
186 TRACE_INFO(_L("[BTEng]: CBTEngIncPair: JW pairing with no IO device" ) ) |
188 if ( status == EBTEngConnecting || status == EBTEngConnected ) |
187 TBTEngConnectionStatus status = iParent.IsDeviceConnected( aDev.Address() ); |
189 { |
188 if ( status == EBTEngConnecting || status == EBTEngConnected ) |
190 // the return error is ingore as we can not have other proper |
189 { |
191 // exception handling option: |
190 // the return error is ingore as we can not have other proper |
192 (void) iParent.AddUiCookieJustWorksPaired( aDev ); |
191 // exception handling option: |
193 } |
192 (void) iParent.AddUiCookieJustWorksPaired( aDev ); |
194 iParent.RenewPairer( NULL ); |
193 } |
195 } |
194 iParent.RenewPairer( NULL ); |
196 else if (aDev.LinkKeyType() == ELinkKeyUnauthenticatedUpgradable && !iUserAwarePairing) |
195 break; |
197 { |
196 } |
198 // The linkkey has been created by an incoming OBEX service request |
197 case ELinkKeyUnauthenticatedUpgradable: |
199 // which resulted a pairing event received from pair server. |
198 { |
200 TRACE_INFO(_L("[BTEng]: CBTEngIncPair: JW pairing with IO device" ) ) |
199 // The linkkey has been created by an incoming OBEX service request |
201 iParent.RenewPairer( NULL ); |
200 // which resulted a pairing event received from pair server. |
202 } |
201 TRACE_INFO(_L("[BTEng]: CBTEngIncPair: JW pairing with IO device" ) ) |
203 else |
202 iParent.RenewPairer( NULL ); |
204 { |
203 break; |
205 if (aDev.LinkKeyType() == ELinkKeyUnauthenticatedNonUpgradable || aDev.LinkKeyType() == ELinkKeyUnauthenticatedUpgradable) |
204 } |
206 { |
205 default: |
207 // The user was involved in the pairing, so display in the paired devices list |
206 { |
208 (void) iParent.AddUiCookieJustWorksPaired(aDev); |
207 // Other pairing model than Just Works: |
209 } |
208 CancelPlaNotification(); |
210 TRACE_INFO(_L("[BTEng]: CBTEngIncPair: Non-JW pairing")) |
209 SetPairResult( KErrNone ); |
211 // Other pairing model than Just Works: |
210 ShowPairingNoteAndAuthorizeQuery(); |
212 CancelPlaNotification(); |
211 break; |
213 SetPairResult( KErrNone ); |
212 } |
214 ShowPairingNoteAndAuthorizeQuery(); |
213 } |
215 } |
214 TRACE_FUNC_EXIT |
216 TRACE_FUNC_EXIT |
215 } |
217 } |
216 |
218 |
217 // --------------------------------------------------------------------------- |
219 // --------------------------------------------------------------------------- |
218 // From class MBTEngActiveObserver. |
220 // From class MBTEngActiveObserver. |