From 7d4a6ee92438318a86cb386711a0cd936ca2cac1 Mon Sep 17 00:00:00 2001 From: "injun.yang" Date: Tue, 23 Oct 2018 09:51:21 +0900 Subject: [PATCH] Implement interface to set advertise Tx power level [Model] All [BinType] AP [Customer] OPEN [Issue#] N/A [Request] Internal [Occurrence Version] N/A [Problem] n/a [Cause & Measure] Application will set advertise Tx power level [Checking Method] n/a [Team] Basic Connection [Developer] Injun Yang [Solution company] Samsung [Change Type] Specification change Change-Id: I8dfa4b9aa94a9f0a3e7bc71a3cf2afa48cf77095 Signed-off-by: injun.yang Signed-off-by: DoHyun Pyun --- doc/adapter-api.txt | 2 +- src/adapter.c | 9 ++++++--- src/adapter_le_vsc_features.h | 2 +- 3 files changed, 8 insertions(+), 5 deletions(-) diff --git a/doc/adapter-api.txt b/doc/adapter-api.txt index 4cc47b2..70b5dee 100755 --- a/doc/adapter-api.txt +++ b/doc/adapter-api.txt @@ -239,7 +239,7 @@ Methods void StartDiscovery() void SetAdvertisingParameters(uint32 interval_min, uint32 interval_max, uint32 filter_policy, - uint32 type) + uint32 type, int32 tx_power_level, int32 slot_id) This method allows for setting the Low Energy advertising interval and advertising filter policy. diff --git a/src/adapter.c b/src/adapter.c index 3319e1a..dcb67fc 100644 --- a/src/adapter.c +++ b/src/adapter.c @@ -4372,6 +4372,7 @@ static DBusMessage *adapter_set_advertising_params(DBusConnection *conn, dbus_uint32_t interval_max; dbus_uint32_t filter_policy; dbus_uint32_t type; + dbus_int32_t tx_power_level; dbus_int32_t slot_id; gboolean ret; @@ -4385,14 +4386,15 @@ static DBusMessage *adapter_set_advertising_params(DBusConnection *conn, DBUS_TYPE_UINT32, &interval_max, DBUS_TYPE_UINT32, &filter_policy, DBUS_TYPE_UINT32, &type, + DBUS_TYPE_INT32, &tx_power_level, DBUS_TYPE_INT32, &slot_id, DBUS_TYPE_INVALID)) return btd_error_invalid_args(msg); memset(&cp, 0, sizeof(cp)); - DBG("advertising interval min %x, max %x, filter %x type %x", - interval_min, interval_max, filter_policy, type); + DBG("advertising interval min %x, max %x, filter %x type %x, tx power %d", + interval_min, interval_max, filter_policy, type, tx_power_level); if (filter_policy > 0x03) return btd_error_invalid_args(msg); @@ -4412,7 +4414,7 @@ static DBusMessage *adapter_set_advertising_params(DBusConnection *conn, p_params->adv_type = type; p_params->channel_map = 0x07; /* fixed channel :: will be used all */ p_params->adv_filter_policy = filter_policy; - p_params->tx_power = BLE_ADV_TX_POWER_MID; /* TODO:need to optimize */ + p_params->tx_power = tx_power_level; if (adapter->current_settings & MGMT_SETTING_PRIVACY) { p_inst->bdaddr_type = 0x01; @@ -7393,6 +7395,7 @@ static const GDBusMethodTable adapter_methods[] = { { "interval_max", "u" }, { "filter_policy", "u" }, { "type", "u" }, + { "tx_power_level", "i" }, { "slot_id", "i" }), NULL, adapter_set_advertising_params) }, { GDBUS_METHOD("SetAdvertisingData", diff --git a/src/adapter_le_vsc_features.h b/src/adapter_le_vsc_features.h index ea4d91d..1a74f02 100755 --- a/src/adapter_le_vsc_features.h +++ b/src/adapter_le_vsc_features.h @@ -247,7 +247,7 @@ typedef struct { uint8_t channel_map; uint8_t adv_filter_policy; uint8_t inst_id; - uint8_t tx_power; + int8_t tx_power; } __attribute__ ((packed)) adapter_le_vsc_cp_set_multi_adv_params; /** -- 2.7.4