This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

CC2540 delayed pairing for HID

Other Parts Discussed in Thread: CC2540

I currently have a CC2540 that implements a few profiles, one of which is HID.  HID requires encrypted pairing (using a pin) which I understand, but this can be annoying for users that want to connect the CC2540 without using HID.  What I would like to do is connect the CC2540 to a computer and have it delay a few seconds before allowing the pairing pin.  During these few second the computer can send a message through one of our custom gatt characteristics to cancel the pairing request.  

I've tried calling gapBondMgrSlaveSecurityReq() after the delay, but this doesn't seem to work properly.  I assume this is due to the fact that the pairing request must come from the computer instead of the CC2540 for HID.  Does anyone have any ideas on how to implement this?

Best,

Nathan

  • Hello Nathan,

    What you are describing is not in accordance to the HID Adopted Profile as Pairing is required to exchange HID data. You can do this, but it would mean you would be using a custom profile and compatibly with a Central device is not assured.

    Note that HID does not require a PIN. See the HIDEmuKbd example.

    Best wishes
  • Thanks for the response! Is there a way to configure HID so that no sustained bonding is required at least? I'm aware this is non-standard, but my main goal is to prevent poor customer UX. If the customer has to unpair in the settings menu as well as the app every time it's going to be a huge pain. Any thoughts on this?
  • Hello,

    I'm never seen this requirement to "un pair" a device from a PC on each connection. If you don't want to use HID, I suggest using a custom profile and not requesting or configuring to use a GATT Characteristic that requires Security.

    Best wishes
  • Yes, as a side effect of bonding a device you have to forget the connection through the settings menu.

    We are trying to emulate a mouse/keyboard and therefore require HID.

    I'm aware that pairing is required, all I'm asking is if the pairing dialogue can be delayed for a few seconds so that we have the option to cancel the pairing dialog (again I know this means HID won't work, I want the option to communicate through a separate characteristic to see if we want to enable HID or not for this connection.)
  • If you are connecting with a smart phone (Android or iOS), they (or more specifically, the phone's BLE Host) will start the Pairing process as soon as 1) the Peripheral sends the Slave Security Request, or 2) when the Client attempts to access a Characteristic that has a permission requiring Security (e.g., ENCRYPT_READ).

    You can control #1 from the Peripheral side. You'll need to control #2 on the Client (i.e., phone) side.

    Best wishes
  • I think this has cleared some things up for me. I think I have an idea of where to go from here. I'm going to delay the slave security request until I'm ready to use HID or the like. Thanks for your assistance!