--- a/bluetoothmgmt/bluetoothclientlib/btlib/btphysicallinks.cpp Mon May 03 13:34:38 2010 +0300
+++ b/bluetoothmgmt/bluetoothclientlib/btlib/btphysicallinks.cpp Fri May 14 16:59:23 2010 +0300
@@ -164,7 +164,7 @@
}
EXPORT_C TInt CBluetoothPhysicalLinks::DisconnectAll()
-/** Disconnect all members of piconet
+/** Disconnect all members of piconet with the reason code "Remote User Terminated Connection"
@return Error code
@capability NetworkControl
*/
@@ -176,10 +176,10 @@
//Allow ESock to do multiple disconnects
BTBaseband().Close();
- TInt ESockErr = BTBaseband().Open(SockServer());
- if(ESockErr != KErrNone)
+ TInt openErr = BTBaseband().Open(SockServer());
+ if(openErr != KErrNone)
{
- return ESockErr;
+ return openErr;
}
TRAPD(err, iBTDisconnector = CBTDisconnector::NewL(*this));
@@ -190,6 +190,33 @@
return err;
}
+EXPORT_C TInt CBluetoothPhysicalLinks::DisconnectAllForPowerOff()
+/** Disconnect all members of piconet with the reason code "Remote Device Terminated Connection due to Power Off"
+@return Error code
+@capability NetworkControl
+*/
+ {
+ if(iBTDisconnector)
+ {
+ return KErrInUse;
+ }
+
+ //Allow ESock to do multiple disconnects
+ BTBaseband().Close();
+ TInt openErr = BTBaseband().Open(SockServer());
+ if(openErr != KErrNone)
+ {
+ return openErr;
+ }
+
+ TRAPD(err, iBTDisconnector = CBTDisconnector::NewL(*this));
+ if(err == KErrNone)
+ {
+ iBTDisconnector->DisconnectAllForPowerOff();
+ }
+ return err;
+ }
+
EXPORT_C TInt CBluetoothPhysicalLinks::Broadcast(const TDesC8& aData)
/** Write (raw) broadcast data
@@ -417,11 +444,22 @@
{
__ASSERT_ALWAYS(!IsActive(), Panic(EUnfinishedBusiness));
- iParent.BTBaseband().TerminateAllPhysicalLinks(0, iStatus);
+ iParent.BTBaseband().TerminateAllPhysicalLinks(iStatus);
iCurrentRequest = EDisconnectAll;
SetActive();
}
+void CBTDisconnector::DisconnectAllForPowerOff()
+
+ {
+ __ASSERT_ALWAYS(!IsActive(), Panic(EUnfinishedBusiness));
+
+ iParent.BTBaseband().TerminateAllPhysicalLinksForPowerOff(iStatus);
+ iCurrentRequest = EDisconnectAll;
+ SetActive();
+ }
+
+
void CBTDisconnector::RunL()
//
//When logical socket has connected (only async bit),