227 |
227 |
228 void CBtmRfcommSock::HandleConnectCompleteL(TInt aErr) |
228 void CBtmRfcommSock::HandleConnectCompleteL(TInt aErr) |
229 { |
229 { |
230 TRACE_FUNC_ENTRY |
230 TRACE_FUNC_ENTRY |
231 TRACE_INFO((_L("err %d"), aErr)) |
231 TRACE_INFO((_L("err %d"), aErr)) |
232 |
232 |
|
233 if (aErr == KErrNone) |
|
234 { |
|
235 TBTSockAddr sockAddr; |
|
236 iDataSocket->RemoteName(sockAddr); |
|
237 iRemote = sockAddr.BTAddr(); |
|
238 } |
|
239 |
233 // Process the connect complete before issuing a receive request to ensure that |
240 // Process the connect complete before issuing a receive request to ensure that |
234 // we are ready to process the data when it is received. |
241 // we are ready to process the data when it is received. |
235 iObserver->RfcommConnectCompletedL(aErr); |
242 iObserver->RfcommConnectCompletedL(aErr); |
236 |
243 |
237 if (!aErr) |
244 if (aErr == KErrNone) |
238 { |
245 { |
239 TBTSockAddr sockAddr; |
|
240 iDataSocket->RemoteName(sockAddr); |
|
241 iRemote = sockAddr.BTAddr(); |
|
242 iInData.ReAllocL(256); |
246 iInData.ReAllocL(256); |
243 RequestMasterRole(); |
247 RequestMasterRole(); |
244 TInt err = iAda.Open(iServer, iRemote); |
248 TInt err = iAda.Open(iServer, iRemote); |
245 TRACE_INFO((_L("ada.Open err %d"), err)) |
249 TRACE_INFO((_L("ada.Open err %d"), err)) |
246 iDataSocket->ActivateBasebandEventNotifier(ENotifyAnyPowerMode | ENotifyAnyRole | |
250 iDataSocket->ActivateBasebandEventNotifier(ENotifyAnyPowerMode | ENotifyAnyRole | |
254 |
258 |
255 void CBtmRfcommSock::HandleAcceptCompleteL(TInt aErr) |
259 void CBtmRfcommSock::HandleAcceptCompleteL(TInt aErr) |
256 { |
260 { |
257 TRACE_FUNC_ENTRY |
261 TRACE_FUNC_ENTRY |
258 |
262 |
259 iRemoteHasConnected = ETrue; |
263 if (aErr == KErrNone) |
|
264 { |
|
265 iRemoteHasConnected = ETrue; |
|
266 TBTSockAddr sockAddr; |
|
267 iDataSocket->RemoteName(sockAddr); |
|
268 iRemote = sockAddr.BTAddr(); |
|
269 } |
260 |
270 |
261 // Process the accept complete before issuing a receive request to ensure that |
271 // Process the accept complete before issuing a receive request to ensure that |
262 // we are ready to process the data when it is received. |
272 // we are ready to process the data when it is received. |
263 iObserver->RfcommAcceptCompletedL(aErr, iService); |
273 iObserver->RfcommAcceptCompletedL(aErr, iService); |
264 |
274 |
265 if (!aErr) |
275 if (aErr == KErrNone) |
266 { |
276 { |
267 TBTSockAddr sockAddr; |
|
268 iDataSocket->RemoteName(sockAddr); |
|
269 iRemote = sockAddr.BTAddr(); |
|
270 iInData.ReAllocL(256); |
277 iInData.ReAllocL(256); |
271 RequestMasterRole(); |
278 RequestMasterRole(); |
272 TInt err = iAda.Open(iServer, iRemote); |
279 TInt err = iAda.Open(iServer, iRemote); |
273 TRACE_INFO((_L("ada.Open err %d"), err)) |
280 TRACE_INFO((_L("ada.Open err %d"), err)) |
274 iDataSocket->ActivateBasebandEventNotifier(ENotifyAnyPowerMode | ENotifyAnyRole | |
281 iDataSocket->ActivateBasebandEventNotifier(ENotifyAnyPowerMode | ENotifyAnyRole | |