×

Discussion Board

Results 1 to 4 of 4
  1. #1
    Registered User
    Join Date
    Jun 2010
    Posts
    43

    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
    http://discussion.forum.nokia.com/fo...hlight=headset

    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;
    }
    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

  2. #2
    Registered User
    Join Date
    Apr 2008
    Posts
    27

    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);
    Last edited by agray; 2011-01-06 at 12:05. Reason: left something on the cleanup stack!

  3. #3
    Registered User
    Join Date
    Jun 2010
    Posts
    43

    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

  4. #4
    Registered User
    Join Date
    Jun 2010
    Posts
    43

    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.


    gaurav

Similar Threads

  1. how to detect wired headset and BT handsfree button
    By jonnekodu in forum Symbian C++
    Replies: 3
    Last Post: 2012-02-14, 01:50
  2. Replies: 2
    Last Post: 2008-12-26, 05:42
  3. how to detect whether headset is connected or not
    By kamaljaiswal in forum Symbian C++
    Replies: 0
    Last Post: 2007-06-29, 13:02
  4. How to detect headset?
    By jtnurmi in forum Symbian Media (Closed)
    Replies: 5
    Last Post: 2006-11-15, 06:57
  5. How to detect the connection with the headset?
    By k3tuka in forum Bluetooth Technology
    Replies: 3
    Last Post: 2006-07-28, 11:09

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •