return (btc_transfer_context(&msg, &arg, sizeof(btc_ble_gap_args_t), NULL) == BT_STATUS_SUCCESS ? ESP_OK : ESP_FAIL);
}
+esp_err_t esp_ble_gap_config_local_icon (uint16_t icon)
+{
+ btc_msg_t msg;
+ btc_ble_gap_args_t arg;
+
+ ESP_BLUEDROID_STATUS_CHECK(ESP_BLUEDROID_STATUS_ENABLED);
+
+ msg.sig = BTC_SIG_API_CALL;
+ msg.pid = BTC_PID_GAP_BLE;
+ msg.act = BTC_GAP_BLE_ACT_CONFIG_LOCAL_ICON;
+ arg.cfg_local_icon.icon = icon;
+
+ return (btc_transfer_context(&msg, &arg, sizeof(btc_ble_gap_args_t), NULL) == BT_STATUS_SUCCESS ? ESP_OK : ESP_FAIL);
+}
+
esp_err_t esp_ble_gap_update_whitelist(bool add_remove, esp_bd_addr_t remote_bda)
{
btc_msg_t msg;
*/
esp_err_t esp_ble_gap_config_local_privacy (bool privacy_enable);
+/**
+ * @brief set local gap appearance icon
+ *
+ *
+ * @param[in] icon - Appearance value, these vlues are Defined by the Bluetooth organization, please refer to
+ * https://www.bluetooth.com/specifications/gatt/viewer?attributeXmlFile=org.bluetooth.characteristic.gap.appearance.xml
+ *
+ * @return
+ * - ESP_OK : success
+ * - other : failed
+ *
+ */
+esp_err_t esp_ble_gap_config_local_icon (uint16_t icon);
+
/**
* @brief Add or remove device from white list
*
}
#endif
+/*******************************************************************************
+**
+** Function bta_dm_ble_config_local_privacy
+**
+** Description This function set the local device LE privacy settings.
+**
+**
+*******************************************************************************/
+void bta_dm_ble_config_local_icon (tBTA_DM_MSG *p_data)
+{
+ BTM_BleConfigLocalIcon (p_data->ble_local_icon.icon);
+}
+
/*******************************************************************************
**
** Function bta_dm_ble_observe
}
#if BLE_INCLUDED == TRUE
+/*******************************************************************************
+**
+** Function BTA_DmBleConfigLocalIcon
+**
+** Description set gap local icon
+**
+** Parameters: icon - appearance value.
+**
+** Returns void
+**
+*******************************************************************************/
+void BTA_DmBleConfigLocalIcon(uint16_t icon)
+{
+ tBTA_DM_API_LOCAL_ICON *p_msg;
+
+ if ((p_msg = (tBTA_DM_API_LOCAL_ICON *) osi_malloc(sizeof(tBTA_DM_API_LOCAL_ICON))) != NULL) {
+ memset (p_msg, 0, sizeof(tBTA_DM_API_LOCAL_ICON));
+
+ p_msg->hdr.event = BTA_DM_API_LOCAL_ICON_EVT;
+ p_msg->icon = icon;
+ bta_sys_sendmsg(p_msg);
+ }
+}
+
/*******************************************************************************
**
** Function BTA_BleEnableAdvInstance
#if BLE_PRIVACY_SPT == TRUE
bta_dm_ble_config_local_privacy, /* BTA_DM_API_LOCAL_PRIVACY_EVT */
#endif
+ bta_dm_ble_config_local_icon, /* BTA_DM_API_LOCAL_ICON_EVT */
bta_dm_ble_set_adv_params, /* BTA_DM_API_BLE_ADV_PARAM_EVT */
bta_dm_ble_set_adv_params_all, /* BTA_DM_API_BLE_ADV_PARAM_All_EVT */
bta_dm_ble_set_adv_config, /* BTA_DM_API_BLE_SET_ADV_CONFIG_EVT */
*******************************************************************************/
extern void BTA_DmBleConfigLocalPrivacy(BOOLEAN privacy_enable, tBTA_SET_LOCAL_PRIVACY_CBACK *set_local_privacy_cback);
+/*******************************************************************************
+**
+** Function BTA_DmBleConfigLocalIcon
+**
+** Description set gap local icon
+**
+** Parameters: icon - appearance value.
+**
+** Returns void
+**
+*******************************************************************************/
+extern void BTA_DmBleConfigLocalIcon(uint16_t icon);
+
/*******************************************************************************
**
** Function BTA_DmBleEnableRemotePrivacy
#if BLE_PRIVACY_SPT == TRUE
BTA_DM_API_LOCAL_PRIVACY_EVT,
#endif
+ BTA_DM_API_LOCAL_ICON_EVT,
BTA_DM_API_BLE_ADV_PARAM_EVT,
/*******This event added by Yulong at 2016/10/20 to
tBTA_SET_LOCAL_PRIVACY_CBACK *set_local_privacy_cback;
} tBTA_DM_API_LOCAL_PRIVACY;
+typedef struct {
+ BT_HDR hdr;
+ uint16_t icon;
+} tBTA_DM_API_LOCAL_ICON;
+
/* set scan parameter for BLE connections */
typedef struct {
BT_HDR hdr;
tBTA_DM_API_BLE_SCAN ble_scan;
tBTA_DM_API_ENABLE_PRIVACY ble_remote_privacy;
tBTA_DM_API_LOCAL_PRIVACY ble_local_privacy;
+ tBTA_DM_API_LOCAL_ICON ble_local_icon;
tBTA_DM_API_BLE_ADV_PARAMS ble_set_adv_params;
tBTA_DM_API_BLE_ADV_PARAMS_ALL ble_set_adv_params_all;
tBTA_DM_API_SET_ADV_CONFIG ble_set_adv_data;
extern void bta_dm_ble_set_rand_address(tBTA_DM_MSG *p_data);
extern void bta_dm_ble_stop_advertising(tBTA_DM_MSG *p_data);
extern void bta_dm_ble_config_local_privacy (tBTA_DM_MSG *p_data);
+extern void bta_dm_ble_config_local_icon (tBTA_DM_MSG *p_data);
extern void bta_dm_ble_set_adv_params (tBTA_DM_MSG *p_data);
extern void bta_dm_ble_set_adv_params_all(tBTA_DM_MSG *p_data);
extern void bta_dm_ble_set_adv_config (tBTA_DM_MSG *p_data);
BTA_DmBleSetDataLength(remote_device, tx_data_length, p_set_pkt_data_cback);
}
+static void btc_ble_config_local_icon(uint16_t icon)
+{
+ BTA_DmBleConfigLocalIcon(icon);
+}
+
static void btc_ble_set_rand_addr (BD_ADDR rand_addr, tBTA_SET_RAND_ADDR_CBACK *p_set_rand_addr_cback)
{
if (rand_addr != NULL) {
case BTC_GAP_BLE_ACT_CONFIG_LOCAL_PRIVACY:
btc_ble_config_local_privacy(arg->cfg_local_privacy.privacy_enable, btc_set_local_privacy_callback);
break;
+ case BTC_GAP_BLE_ACT_CONFIG_LOCAL_ICON:
+ btc_ble_config_local_icon(arg->cfg_local_icon.icon);
+ break;
case BTC_GAP_BLE_ACT_UPDATE_WHITE_LIST:
BTA_DmUpdateWhiteList(arg->update_white_list.add_remove, arg->update_white_list.remote_bda, btc_add_whitelist_complete_callback);
break;
BTC_GAP_BLE_ACT_SET_PKT_DATA_LEN,
BTC_GAP_BLE_ACT_SET_RAND_ADDRESS,
BTC_GAP_BLE_ACT_CONFIG_LOCAL_PRIVACY,
+ BTC_GAP_BLE_ACT_CONFIG_LOCAL_ICON,
BTC_GAP_BLE_ACT_UPDATE_WHITE_LIST,
BTC_GAP_BLE_ACT_SET_CONN_PARAMS,
BTC_GAP_BLE_ACT_SET_DEV_NAME,
struct cfg_local_privacy_args {
bool privacy_enable;
} cfg_local_privacy;
+ //BTC_GAP_BLE_ACT_CONFIG_LOCAL_ICON,
+ struct cfg_local_icon_args {
+ uint16_t icon;
+ } cfg_local_icon;
//BTC_GAP_BLE_ACT_UPDATE_WHITE_LIST
struct update_white_list_args {
bool add_remove;
#endif
}
+/*******************************************************************************
+**
+** Function BTM_BleConfigLocalIcon
+**
+** Description This function is called to set local icon
+**
+** Parameters icon: appearance value.
+**
+**
+*******************************************************************************/
+void BTM_BleConfigLocalIcon(uint16_t icon)
+{
+#if (defined(GAP_INCLUDED) && GAP_INCLUDED == TRUE && GATTS_INCLUDED == TRUE)
+ tGAP_BLE_ATTR_VALUE p_value;
+ p_value.icon = icon;
+ GAP_BleAttrDBUpdate(GATT_UUID_GAP_ICON, &p_value);
+#else
+ BTM_TRACE_ERROR("%s\n", __func__);
+#endif
+}
/*******************************************************************************
**
** Function BTM_BleMaxMultiAdvInstanceCount
//extern
BOOLEAN BTM_BleConfigPrivacy(BOOLEAN enable, tBTM_SET_LOCAL_PRIVACY_CBACK *set_local_privacy_cabck);
+/*******************************************************************************
+**
+** Function BTM_BleConfigLocalIcon
+**
+** Description This function is called to set local icon
+**
+** Parameters icon: appearance value.
+**
+**
+*******************************************************************************/
+void BTM_BleConfigLocalIcon(uint16_t icon);
+
/*******************************************************************************
**
** Function BTM_BleLocalPrivacyEnabled