void _bt_hal_set_advertising_status(int slot_id, gboolean mode)
{
- DBG("Advertising enabled [%s] server_slot [%d]", mode ? "TRUE" : "FALSE", slot_id);
bt_hal_adv_event_data_t *event;
- int adv_slot_id = -1;
+ int adv_slot_id = slot_id;
+ int server_if = 0;
- if (le_adv_slot == NULL)
- return;
+ server_if = bt_hal_gatts_get_server_if(slot_id);
- adv_slot_id = bt_hal_gatts_get_adv_slot_id(slot_id);
- if (adv_slot_id < 0)
+ DBG("Advertising enabled [%s] server_slot [%d] server_if[%d]", mode ? "TRUE" : "FALSE", slot_id, server_if);
+
+ if (le_adv_slot == NULL)
return;
le_adv_slot[adv_slot_id].is_advertising = mode;
event = g_malloc0(sizeof(bt_hal_adv_event_data_t));
event->event = mode ? BT_HAL_MULTI_ADV_ENB_EVT : BT_HAL_MULTI_ADV_DISABLE_EVT;
- event->server_if = slot_id;
+
+ event->server_if = server_if;
event->status = BT_STATUS_SUCCESS;
/* To be removed later when we completely descope Legacy Adv concept */
if (mode == false ) {
DBG("release the adv_slot");
- bt_hal_gatts_release_adv_slot(slot_id);
+ bt_hal_gatts_release_adv_slot(server_if);
}
__bt_hal_adv_event_cb((gpointer)event);
}
ret = g_dbus_proxy_call_sync(proxy, "SetAdvertising",
- g_variant_new("(bi)", enable, server_if),
+ g_variant_new("(bi)", enable, adv_slot_id),
G_DBUS_CALL_FLAGS_NONE,
-1,
NULL,
guint32 min = 0;
guint32 max = 0;
bt_hal_adv_event_data_t *event;
+ int slot_id = 0;
proxy = _bt_hal_get_adapter_proxy();
min = min_interval / BT_HAL_ADV_INTERVAL_SPLIT;
max = max_interval / BT_HAL_ADV_INTERVAL_SPLIT;
+ slot_id = bt_hal_gatts_allocate_adv_slot_by_server_if(server_if);
+
ret = g_dbus_proxy_call_sync(proxy, "SetAdvertisingParameters",
g_variant_new("(uuuuii)", min, max,
BT_HAL_ADV_FILTER_POLICY_DEFAULT, adv_type,
- tx_power, server_if), G_DBUS_CALL_FLAGS_NONE,
+ tx_power, slot_id), G_DBUS_CALL_FLAGS_NONE,
-1, NULL, &error);
if (error) {
ERR("SetAdvertisingParameters Fail: %s", error->message);
bt_hal_adv_event_data_t *event;
int length = 0;
int i;
+ int slot_id = 0;
/* Parse data according to Bluez Interface */
if (__bt_hal_is_factory_test_mode()) {
if (proxy == NULL)
return BT_STATUS_FAIL;
+ slot_id = bt_hal_gatts_allocate_adv_slot_by_server_if(adv_param_setup.server_if);
+
memset(&adv_data, 0, 31);
/* Service UUID */
if (adv_param_setup.set_scan_rsp == 0) {
/* Set Advertising data to stack */
ret = g_dbus_proxy_call_sync(proxy, "SetAdvertisingData",
- g_variant_new("(@ayi)", temp, adv_param_setup.server_if),
+ g_variant_new("(@ayi)", temp, slot_id),
G_DBUS_CALL_FLAGS_NONE,
-1, NULL, &error);
} else {
/* Set Scan response data to stack */
ret = g_dbus_proxy_call_sync(proxy, "SetScanRespData",
- g_variant_new("(@ayi)", temp, adv_param_setup.server_if),
+ g_variant_new("(@ayi)", temp, slot_id),
G_DBUS_CALL_FLAGS_NONE,
-1, NULL, &error);
}