How to detect Headset(any Kind of weather BT or normal ) presence
Hello,
I want to detect Headset(any Kind of weather BT or normal ) presence in my symbian 5th ed. Application. i want to check it's presence at some specific time so i would not need to use AO. how to do so.
i found some code at
[URL="http://discussion.forum.nokia.com/forum/showthread.php?82645-Detect-bluetooth-Service-s-connection-status&highlight=headset"]http://discussion.forum.nokia.com/forum/showthread.php?82645-Detect-bluetooth-Service-s-connection-status&highlight=headset[/URL]
[QUOTE]
TBool CMyConnector::IsBtOn()
{
RHostResolver hr;
if (hr.Open(iSocketServ, KBTAddrFamily, KBTLinkManager) == KErrNone)
{
hr.Close();
iObserver->Log()->Write(_L("BT is on"));
return true;
}
iObserver->Log()->Write(_L("BT is off"));
return false;
}
[/QUOTE]
but i think it returns the status of BT(On/Off) not the presence of Headset (may be BT is on but Headset may not be present).
one more thing is that should i check the profile (if Headset would be connected then Headset profile should be active)
Thanks
Re: How to detect Headset(any Kind of weather BT or normal ) presence
On 5th edition, headset and accessory detection in general can be done through the Accessory Monitor API, for example:
[CODE]
iAccMonitor = CAccMonitor::NewL();
RConnectedAccessories connectedAccessories;
CleanupClosePushL(connectedAccessories);
iAccMonitor->GetConnectedAccessoriesL(connectedAccessories);
TInt count = connectedAccessories.Count();
for(TInt i = 0; i < count; i++)
{
TAccMonCapability type = connectedAccessories[i]->AccDeviceType();
if(type == KAccMonHeadset)
{
User::InfoPrint(_L("Found a headset!"));
}
}
CleanupStack::PopAndDestroy(&connectedAccessories);
[/CODE]
Re: How to detect Headset(any Kind of weather BT or normal ) presence
Thanks for your rply
I will try this in my app. I hope that it will also detect the Bluetooth Headset too. i will try it for that.
gaurav
Re: How to detect Headset(any Kind of weather BT or normal ) presence
thanks a lot
it worked for me on emulater will test it for bluetooth too on device. more info at link.
[QUOTE]
[url]http://wiki.forum.nokia.com/index.php/Listening_a_specific_accessory_connected/disconnected_notifications[/url]
[/QUOTE]
gaurav