equal
deleted
inserted
replaced
162 } |
162 } |
163 return err; |
163 return err; |
164 } |
164 } |
165 |
165 |
166 EXPORT_C TInt CBluetoothPhysicalLinks::DisconnectAll() |
166 EXPORT_C TInt CBluetoothPhysicalLinks::DisconnectAll() |
167 /** Disconnect all members of piconet |
167 /** Disconnect all members of piconet with the reason code "Remote User Terminated Connection" |
168 @return Error code |
168 @return Error code |
169 @capability NetworkControl |
169 @capability NetworkControl |
170 */ |
170 */ |
171 { |
171 { |
172 if(iBTDisconnector) |
172 if(iBTDisconnector) |
174 return KErrInUse; |
174 return KErrInUse; |
175 } |
175 } |
176 |
176 |
177 //Allow ESock to do multiple disconnects |
177 //Allow ESock to do multiple disconnects |
178 BTBaseband().Close(); |
178 BTBaseband().Close(); |
179 TInt ESockErr = BTBaseband().Open(SockServer()); |
179 TInt openErr = BTBaseband().Open(SockServer()); |
180 if(ESockErr != KErrNone) |
180 if(openErr != KErrNone) |
181 { |
181 { |
182 return ESockErr; |
182 return openErr; |
183 } |
183 } |
184 |
184 |
185 TRAPD(err, iBTDisconnector = CBTDisconnector::NewL(*this)); |
185 TRAPD(err, iBTDisconnector = CBTDisconnector::NewL(*this)); |
186 if(err == KErrNone) |
186 if(err == KErrNone) |
187 { |
187 { |
188 iBTDisconnector->DisconnectAll(); |
188 iBTDisconnector->DisconnectAll(); |
|
189 } |
|
190 return err; |
|
191 } |
|
192 |
|
193 EXPORT_C TInt CBluetoothPhysicalLinks::DisconnectAllForPowerOff() |
|
194 /** Disconnect all members of piconet with the reason code "Remote Device Terminated Connection due to Power Off" |
|
195 @return Error code |
|
196 @capability NetworkControl |
|
197 */ |
|
198 { |
|
199 if(iBTDisconnector) |
|
200 { |
|
201 return KErrInUse; |
|
202 } |
|
203 |
|
204 //Allow ESock to do multiple disconnects |
|
205 BTBaseband().Close(); |
|
206 TInt openErr = BTBaseband().Open(SockServer()); |
|
207 if(openErr != KErrNone) |
|
208 { |
|
209 return openErr; |
|
210 } |
|
211 |
|
212 TRAPD(err, iBTDisconnector = CBTDisconnector::NewL(*this)); |
|
213 if(err == KErrNone) |
|
214 { |
|
215 iBTDisconnector->DisconnectAllForPowerOff(); |
189 } |
216 } |
190 return err; |
217 return err; |
191 } |
218 } |
192 |
219 |
193 EXPORT_C TInt CBluetoothPhysicalLinks::Broadcast(const TDesC8& aData) |
220 EXPORT_C TInt CBluetoothPhysicalLinks::Broadcast(const TDesC8& aData) |
415 void CBTDisconnector::DisconnectAll() |
442 void CBTDisconnector::DisconnectAll() |
416 |
443 |
417 { |
444 { |
418 __ASSERT_ALWAYS(!IsActive(), Panic(EUnfinishedBusiness)); |
445 __ASSERT_ALWAYS(!IsActive(), Panic(EUnfinishedBusiness)); |
419 |
446 |
420 iParent.BTBaseband().TerminateAllPhysicalLinks(0, iStatus); |
447 iParent.BTBaseband().TerminateAllPhysicalLinks(iStatus); |
421 iCurrentRequest = EDisconnectAll; |
448 iCurrentRequest = EDisconnectAll; |
422 SetActive(); |
449 SetActive(); |
423 } |
450 } |
|
451 |
|
452 void CBTDisconnector::DisconnectAllForPowerOff() |
|
453 |
|
454 { |
|
455 __ASSERT_ALWAYS(!IsActive(), Panic(EUnfinishedBusiness)); |
|
456 |
|
457 iParent.BTBaseband().TerminateAllPhysicalLinksForPowerOff(iStatus); |
|
458 iCurrentRequest = EDisconnectAll; |
|
459 SetActive(); |
|
460 } |
|
461 |
424 |
462 |
425 void CBTDisconnector::RunL() |
463 void CBTDisconnector::RunL() |
426 // |
464 // |
427 //When logical socket has connected (only async bit), |
465 //When logical socket has connected (only async bit), |
428 //opens baseband socket. |
466 //opens baseband socket. |