\alps\external\bluetooth\bluedroid\stack\gap\gap_api.c
/*******************************************************************************
**
** Function GAP_SetPairableMode
**
** Description This function is called to allow or disallow pairing
** on the local device.
**
** Parameters: mode - GAP_ALLOW_PAIRING, GAP_DISALLOW_PAIRING
** connect_only_pairable - TRUE or FALSE connect only to paired devices
**
** callback - The callback is called when a pin number is requested.
**
** Returns BT_PASS (0) if successful, or a non-zero error code
**
*******************************************************************************/
UINT16 GAP_SetPairableMode (UINT16 mode, BOOLEAN connect_only_paired)
{
tBTM_STATUS btm_status;
UINT16 status = BT_PASS;
if (mode == GAP_ALLOW_PAIRING)
{
btm_status = BTM_SetConnectability(BTM_CONNECTABLE, 0, 0);
if ((status = gap_convert_btm_status (btm_status)) == BT_PASS)
BTM_SetPairableMode (TRUE, connect_only_paired);
}
else if (mode == GAP_DISALLOW_PAIRING)
{
BTM_SetPairableMode (FALSE, connect_only_paired);
}
else
{
GAP_TRACE_ERROR ("GAP_SetPairableMode: illegal mode %d", mode);
status = GAP_ERR_ILL_MODE;
}
return (status);
}