Till now, the Ble advertsing interval min and max values were taken in the ms unit.
According to specs, the actual time value can be in decimal (ex: 28.125ms) but such cases are not properly handled currently.
So these changes will allow to take input in 0.625ms units.
Change-Id: Ia052cdc456aae067a6a453eac0a3780b9c59e9fd
Signed-off-by: Ayush Garg <ayush.garg@samsung.com>
#define BT_HAL_ADV_NON_CONNECTABLE 0x03 /* ADV_NONCOND_IND */
#define BT_HAL_ADV_CONNECTABLE_DIRECT_LOW 0x04 /* ADV_DIRECT_IND, low duty cycle */
-#define BT_HAL_ADV_INTERVAL_MIN 20 /* msec */
-#define BT_HAL_ADV_INTERVAL_MAX 10240
+#define BT_HAL_ADV_INTERVAL_MIN 32 /* in 0.625ms unit */
+#define BT_HAL_ADV_INTERVAL_MAX 16384
#define BT_HAL_ADV_INTERVAL_SPLIT 0.625
#define BT_HAL_DEFAULT_ADV_MIN_INTERVAL 500
#define BT_HAL_DEFAULT_ADV_MAX_INTERVAL 500
GDBusProxy *proxy;
GVariant *ret;
GError *error = NULL;
- guint32 min = 0;
- guint32 max = 0;
bt_hal_adv_event_data_t *event;
int slot_id = 0;
adv_filter_policy = BT_HAL_ADV_FILTER_POLICY_DEFAULT;
}
- 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,
+ g_variant_new("(uuuuii)", min_interval, max_interval,
adv_filter_policy, adv_type,
tx_power, slot_id), G_DBUS_CALL_FLAGS_NONE,
-1, NULL, &error);
__bt_service_get_parameters(in_param4, &use_reserved_slot,
sizeof(gboolean));
- BT_DBG("bluetooth_advertising_params_t [%f %f %d %d %d]",
+ BT_DBG("bluetooth_advertising_params_t [%d %d %d %d %d]",
adv_params.interval_min, adv_params.interval_max,
adv_params.filter_policy, adv_params.type, adv_params.tx_power_level);
result = _bt_set_custom_advertising(app, *adv_handle,
* Advertising parameters
*/
typedef struct {
- float interval_min;
- float interval_max;
+ int interval_min;
+ int interval_max;
guint8 filter_policy;
guint8 type;
int tx_power_level;
break;
case 3:
TC_PRT("SetCustomAdvertising ON, Filter 0x03");
- params.interval_min = 1280;
- params.interval_max = 1280;
+ params.interval_min = 2048; /* equals 1280ms */
+ params.interval_max = 2048;
params.filter_policy = 0x03;
params.type = 0x00;
ret = bluetooth_set_custom_advertising(0, TRUE, ¶ms);
break;
case 4:
TC_PRT("SetCustomAdvertising ON, Filter 0x00");
- params.interval_min = 1280;
- params.interval_max = 1280;
+ params.interval_min = 2048; /* equals 1280ms */
+ params.interval_max = 2048;
params.filter_policy = 0x00;
params.type = 0x00;
ret = bluetooth_set_custom_advertising(0, TRUE, ¶ms);
case BLUETOOTH_EVENT_ADVERTISING_STARTED:
TC_PRT("BLUETOOTH_EVENT_ADVERTISING_STARTED, result [0x%04x], "
- "interval_min [%f ms], interval_max [%f ms]",
+ "interval_min [%d (0.625ms units)], interval_max [%d (0.625ms units)]",
param->result,
((bluetooth_advertising_params_t *)param->param_data)->interval_min,
((bluetooth_advertising_params_t *)param->param_data)->interval_max);