diff -r 16aa830c86c8 -r f8503e232b0c bluetoothmgmt/bluetoothclientlib/btlib/btphysicallinks.cpp --- a/bluetoothmgmt/bluetoothclientlib/btlib/btphysicallinks.cpp Wed Apr 14 17:08:52 2010 +0300 +++ b/bluetoothmgmt/bluetoothclientlib/btlib/btphysicallinks.cpp Tue Apr 27 17:48:21 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),