Hi all,
I'm creating an application which switch on/off the bluetooth programatically using the CBTMCMSettings.
This is my hearder file
class CMyBTEngine : public CBase
{
public:
static CMyBTEngine* NewL();
static CMyBTEngine* NewLC();
~CMyBTEngine();
private:
void ConstructL();
CMyBTEngine();
public:
void SetPowerStateOn();
void SetPowerStateOff();
private:
CBTMCMSettings* iBtSettings;
TBool iPowerState;
TInt iErrCode;
TBuf<5> iErrCodeBuf;
};
My Source Code :
// Standard construction sequence
CMyBTEngine* CMyBTEngine::NewL()
{
CMyBTEngine* self = CMyBTEngine::NewLC();
CleanupStack::Pop(self);
return self;
}
CMyBTEngine* CMyBTEngine::NewLC()
{
CMyBTEngine* self = new (ELeave) CMyBTEngine;
CleanupStack::PushL(self);
self->ConstructL();
return self;
}
CMyBTEngine::CMyBTEngine()
{
}
void CMyBTEngine::ConstructL()
{
iBtSettings = CBTMCMSettings::NewL(NULL);
}
CMyBTEngine::~CMyBTEngine()
{
if ( iBtSettings )
{
delete iBtSettings;
iBtSettings = NULL;
}
}
// sets the Bluetooth Power State On
void CMyBTEngine::SetPowerStateOn()
{
iErrCode = iBtSettings->SetPowerState(ETrue);
if ( iErrCode == KErrNone )
{
CEikonEnv::InfoWinL(_L("setting of Power State On"),_L("successful"));
}
else
{
iErrCodeBuf.AppendNum(iErrCode);
CEikonEnv::InfoWinL(_L("SetPowerStateOn Error"), iErrCodeBuf);
iErrCodeBuf.Zero();
}
}
// sets the Bluetooth Power State Off
void CMyBTEngine::SetPowerStateOff()
{
iErrCode = iBtSettings->SetPowerState(EFalse);
if ( iErrCode == KErrNone )
{
CEikonEnv::InfoWinL(_L("setting of Power State Off"),_L("successful"));
}
else
{
iErrCodeBuf.AppendNum(iErrCode);
CEikonEnv::InfoWinL(_L("SetPowerStateOff Error"), iErrCodeBuf);
iErrCodeBuf.Zero();
}
}
Lib:
bteng.lib
Capability:
LocalServices,NetworkSerivices.
when i'm using the above codes on my application, the installation is got failed saying that "Unable to Install"
If i removed the above code from my app, then its got installed successfully.
Please help me out from this issue.
I dont know what i need to do to fix this.
Thanks in Advance
Karthikeyan.B




