Connect BLE HID mouse to mobile phone or tablet

Hi,

I've developed an application based on your BLE HID mouse sample. I commented out display and keyboard authentication callbacks so no passkey is showed nor confirmation is requested.

In a PC works OK, but with Android or IOS mobile phone or tablet, can't connect.

In Android it says "The device could not be paired because the access key or PIN is incorrect." and in IOS it says something like "It was not possible to connect, please ensure that the device is turned on and within range."

Is there any further step to connect to a mobile device? What am I doing wrong?

Thanks and kind regards,

Pedro.

Parents
  • I update info. It's not a fact of being android o IOS device, the problem is once it is paired with a device, it stores the info in the flash and can't be connected to another until you make an "erase and flash".

    Knowing that, How can I solve this issue?

    Thanks again!

  • Hello,

    I am not sure I understand. Does it work if you don't comment out the authentication bits that you removed?

    And what do you mean by:

    Pedro said:
    can't be connected to another until you make an "erase and flash".

    Could it be that you are using bonding and whitelisting? Please let me know if you don't know what this means.

    BR,

    Edvin

  • Hi Edvin,

    I'm using bonding to automatically connect to yet paired devices. The problem is once you reach the max paired devices (CONFIG_BT_MAX_PAIRED) it does not automatically delete the oldest one to have space for the newest one. Just there is an error in the connection (Normally error 19, which implies host refused the connection).

    I'd like to know how to delete oldest bond, if CONFIG_BT_MAX_PAIRED is reached.

    Thanks for your help!

  • Hello,

    I see. So I assume that you have the peer_manager up and running, then.

    You can use pm_peer_delete() to delete one  peer, or you can use pm_peers_delete() to delete all. 

    In order to use pm_peer_delete() (to delete one), you need to have a peer_id which is a handle to the peer that you want to delete. 

    To cycle through all your peers, you can use pm_next_peer_id_get(). To get the ranks of the peers you can use pm_peer_ranks_get(). Note that the ranks are not set automatically. You need to use pm_peer_rank_highest() (or *_lowest()) to set the rank of your peers, e.g. by which peer that was connected most recently. Read about it in the API descriptions from the links.

    So let us say that you will rank the peer highest whenever you connect to a known peer. If your paired devices list is full, you can use the pm_peer_ranks_get() to find the lowest ranked peer, and delete it using pm_peer_delete().

    Best regards,

    Edvin

Reply
  • Hello,

    I see. So I assume that you have the peer_manager up and running, then.

    You can use pm_peer_delete() to delete one  peer, or you can use pm_peers_delete() to delete all. 

    In order to use pm_peer_delete() (to delete one), you need to have a peer_id which is a handle to the peer that you want to delete. 

    To cycle through all your peers, you can use pm_next_peer_id_get(). To get the ranks of the peers you can use pm_peer_ranks_get(). Note that the ranks are not set automatically. You need to use pm_peer_rank_highest() (or *_lowest()) to set the rank of your peers, e.g. by which peer that was connected most recently. Read about it in the API descriptions from the links.

    So let us say that you will rank the peer highest whenever you connect to a known peer. If your paired devices list is full, you can use the pm_peer_ranks_get() to find the lowest ranked peer, and delete it using pm_peer_delete().

    Best regards,

    Edvin

Children
Related