Skip to contentSkip to conversation

doc/device-api: Add TxPower

PATCH In review Jakub Pawlowski 2 participants 9 messages Apr 18, 2015 – Apr 23, 2015 Bluetooth drivers

lore
Share & tools
lore
#0 lore raw

PATCH 1/3 doc/device-api: Add TxPower

This adds TxPower from advertisement data.

---
 doc/device-api.txt | 5 +++++
 1 file changed, 5 insertions(+)
doc/device-api.txt +5 -0
index 72c597e..875fd9d 100644
@@ -196,6 +196,11 @@ Properties	string Address [readonly]
 			Received Signal Strength Indicator of the remote
 			device (inquiry or advertising).
 
+		int16 TxPower [readonly, optional]
+
+			Advertised transmitted power level (inquiry or
+			advertising).
+
 		dict ManufacturerData [readonly, optional]
 
 			Manufacturer specific advertisement data. Keys are
Signature · 1 line
2.2.0.rc0.207.ga3a616c
#1 lore raw

PATCH 2/3 core: Add implementation of TxPower

This adds 'TxPower' property to Device interface.

---
 src/adapter.c |  9 +++++++--
 src/device.c  | 43 +++++++++++++++++++++++++++++++++++++++++++
 src/device.h  |  1 +
 3 files changed, 51 insertions(+), 2 deletions(-)
src/adapter.c +7 -2
index 5af8489..8ee5b5b 100644
@@ -1680,16 +1680,18 @@ static int compare_sender(gconstpointer a, gconstpointer b)
 	return g_strcmp0(client->owner, sender);
 }
 
-static void invalidate_rssi(gpointer a)
+static void invalidate_rssi_and_tx_power(gpointer a)
 {
 	struct btd_device *dev = a;
 
 	device_set_rssi(dev, 0);
+	device_set_tx_power(dev, 127);
 }
 
 static void discovery_cleanup(struct btd_adapter *adapter)
 {
-	g_slist_free_full(adapter->discovery_found, invalidate_rssi);
+	g_slist_free_full(adapter->discovery_found,
+						invalidate_rssi_and_tx_power);
 	adapter->discovery_found = NULL;
 }
 
@@ -5449,6 +5451,9 @@ static void update_found_devices(struct btd_adapter *adapter,
 	else
 		device_set_rssi(dev, rssi);
 
+	if (eir_data.tx_power != 127)
+		device_set_tx_power(dev, eir_data.tx_power);
+
 	if (eir_data.appearance != 0)
 		device_set_appearance(dev, eir_data.appearance);
 
src/device.c +43 -0

73 lines not on this page · raw message

src/device.h +1 -0
index b91916d..1955f54 100644
@@ -95,6 +95,7 @@ void device_set_legacy(struct btd_device *device, bool legacy);
 void device_set_rssi_with_delta(struct btd_device *device, int8_t rssi,
 							int8_t delta_threshold);
 void device_set_rssi(struct btd_device *device, int8_t rssi);
+void device_set_tx_power(struct btd_device *device, int8_t tx_power);
 bool btd_device_is_connected(struct btd_device *dev);
 uint8_t btd_device_get_bdaddr_type(struct btd_device *dev);
 bool device_is_retrying(struct btd_device *device);
Signature · 1 line
2.2.0.rc0.207.ga3a616c
#2 lore raw

PATCH 3/3 client: Make command info print TxPower and RSSI

In reply to Jakub Pawlowski

This makes command info to also print TxPower and RSSI if available.

---
 client/main.c | 2 ++
 1 file changed, 2 insertions(+)
client/main.c +2 -0
index 5250a33..46ef72a 100644
@@ -952,6 +952,8 @@ static void cmd_info(const char *arg)
 	print_property(proxy, "Modalias");
 	print_property(proxy, "ManufacturerData");
 	print_property(proxy, "ServiceData");
+	print_property(proxy, "RSSI");
+	print_property(proxy, "TxPower");
 }
 
 static void pair_reply(DBusMessage *message, void *user_data)
Signature · 1 line
2.2.0.rc0.207.ga3a616c
#3 lore raw
In reply to Jakub Pawlowski

Hi Jakub,

Quoted 24 lines · Jakub Pawlowski

This adds TxPower from advertisement data.

---
 doc/device-api.txt | 5 +++++
 1 file changed, 5 insertions(+)
doc/device-api.txt +5 -1
index 72c597e..875fd9d 100644
@@ -196,6 +196,11 @@ Properties string Address [readonly]
                        Received Signal Strength Indicator of the remote
                        device (inquiry or advertising).
 
+               int16 TxPower [readonly, optional]
+
+                       Advertised transmitted power level (inquiry or
+                       advertising).
+
                dict ManufacturerData [readonly, optional]
 
                        Manufacturer specific advertisement data. Keys are
--
Quoted 1 line

2.2.0.rc0.207.ga3a616c

I thought we discussed about this before and we would like to have the pathloss instead of TxPower, or do you have something else useful for TxPower?

Signature · 1 line
Luiz Augusto von Dentz
#4 lore raw

Hi Luiz

Quoted 25 lines · Luiz Augusto von Dentz

Hi Jakub,

Quoted 22 lines · Jakub Pawlowski

This adds TxPower from advertisement data.

---
 doc/device-api.txt | 5 +++++
 1 file changed, 5 insertions(+)
doc/device-api.txt +5 -0
index 72c597e..875fd9d 100644
@@ -196,6 +196,11 @@ Properties string Address [readonly]
                        Received Signal Strength Indicator of the remote
                        device (inquiry or advertising).
 
+               int16 TxPower [readonly, optional]
+
+                       Advertised transmitted power level (inquiry or
+                       advertising).
+
                dict ManufacturerData [readonly, optional]
 
Quoted 7 lines
Quoted 3 lines
doc/device-api.txt +0 -1
                        Manufacturer specific advertisement data. Keys are
--

2.2.0.rc0.207.ga3a616c

I thought we discussed about this before and we would like to have the pathloss instead of TxPower, or do you have something else useful for TxPower?

I don't remember such discussion, I remember we were discussing about SetDiscoveryFilter, and it have option to filter by pathloss. So I exposed TxPower for two reasons:
1. It's just a field in advertisement, and I wanted just to access it as any other.
2. If I turn it into Pathloss field, it would change together with RSSI, and PropertyChanged event will be doubled. Pathloss is very simple to compute, so having only RSSI that change is more efficient.

Quoted 4 lines

--
Luiz Augusto von Dentz

#5 lore raw

Ping ?

Quoted 51 lines · Jakub Pawlowski

Hi Luiz

Quoted 25 lines · Luiz Augusto von Dentz

Hi Jakub,

Quoted 22 lines · Jakub Pawlowski

This adds TxPower from advertisement data.

---
 doc/device-api.txt | 5 +++++
 1 file changed, 5 insertions(+)
doc/device-api.txt +5 -0
index 72c597e..875fd9d 100644
@@ -196,6 +196,11 @@ Properties string Address [readonly]
                        Received Signal Strength Indicator of the remote
                        device (inquiry or advertising).
 
+               int16 TxPower [readonly, optional]
+
+                       Advertised transmitted power level (inquiry or
+                       advertising).
+
                dict ManufacturerData [readonly, optional]
 
Quoted 7 lines
Quoted 3 lines
doc/device-api.txt +0 -1
                        Manufacturer specific advertisement data. Keys are
--

2.2.0.rc0.207.ga3a616c

I thought we discussed about this before and we would like to have the pathloss instead of TxPower, or do you have something else useful for TxPower?

I don't remember such discussion, I remember we were discussing about SetDiscoveryFilter, and it have option to filter by pathloss. So I exposed TxPower for two reasons:
1. It's just a field in advertisement, and I wanted just to access it as any other.
2. If I turn it into Pathloss field, it would change together with RSSI, and PropertyChanged event will be doubled. Pathloss is very simple to compute, so having only RSSI that change is more efficient.

Quoted 4 lines

--
Luiz Augusto von Dentz

#6 lore raw

Hi Jakub,

Quoted 1 line · Jakub Pawlowski

Ping ?

Sorry, I forgot about this one.

Quoted 38 lines · Jakub Pawlowski
Quoted 37 lines

Hi Luiz

Quoted 32 lines · Luiz Augusto von Dentz

Hi Jakub,

Quoted 24 lines · Jakub Pawlowski

This adds TxPower from advertisement data.

---
 doc/device-api.txt | 5 +++++
 1 file changed, 5 insertions(+)
doc/device-api.txt +5 -1
index 72c597e..875fd9d 100644
@@ -196,6 +196,11 @@ Properties string Address [readonly]
                        Received Signal Strength Indicator of the remote
                        device (inquiry or advertising).
 
+               int16 TxPower [readonly, optional]
+
+                       Advertised transmitted power level (inquiry or
+                       advertising).
+
                dict ManufacturerData [readonly, optional]
 
                        Manufacturer specific advertisement data. Keys are
--
Quoted 1 line

2.2.0.rc0.207.ga3a616c

I thought we discussed about this before and we would like to have the pathloss instead of TxPower, or do you have something else useful for TxPower?

Quoted 8 lines
Quoted 8 lines

I don't remember such discussion, I remember we were discussing about SetDiscoveryFilter, and it have option to filter by pathloss. So I exposed TxPower for two reasons:
1. It's just a field in advertisement, and I wanted just to access it as any other.
2. If I turn it into Pathloss field, it would change together with RSSI, and PropertyChanged event will be doubled. Pathloss is very simple to compute, so having only RSSI that change is more efficient.

Fair enough, I just notice I did not mark the these properties as experimental in the documentation, but no need to send another version I will fix it when applying your patches.

Signature · 1 line
Luiz Augusto von Dentz
#7 lore raw
Quoted 54 lines · Luiz Augusto von Dentz

Hi Jakub,

Quoted 1 line · Jakub Pawlowski

Ping ?

Sorry, I forgot about this one.

Quoted 38 lines · Jakub Pawlowski
Quoted 37 lines

Hi Luiz

Quoted 32 lines · Luiz Augusto von Dentz

Hi Jakub,

Quoted 24 lines · Jakub Pawlowski

This adds TxPower from advertisement data.

---
 doc/device-api.txt | 5 +++++
 1 file changed, 5 insertions(+)
doc/device-api.txt +5 -1
index 72c597e..875fd9d 100644
@@ -196,6 +196,11 @@ Properties string Address [readonly]
                        Received Signal Strength Indicator of the remote
                        device (inquiry or advertising).
 
+               int16 TxPower [readonly, optional]
+
+                       Advertised transmitted power level (inquiry or
+                       advertising).
+
                dict ManufacturerData [readonly, optional]
 
                        Manufacturer specific advertisement data. Keys are
--
Quoted 1 line

2.2.0.rc0.207.ga3a616c

I thought we discussed about this before and we would like to have the pathloss instead of TxPower, or do you have something else useful for TxPower?

Quoted 8 lines
Quoted 8 lines

I don't remember such discussion, I remember we were discussing about SetDiscoveryFilter, and it have option to filter by pathloss. So I exposed TxPower for two reasons:
1. It's just a field in advertisement, and I wanted just to access it as any other.
2. If I turn it into Pathloss field, it would change together with RSSI, and PropertyChanged event will be doubled. Pathloss is very simple to compute, so having only RSSI that change is more efficient.

Quoted 3 lines

Fair enough, I just notice I did not mark the these properties as experimental in the documentation, but no need to send another version I will fix it when applying your patches.

Ok, Thanks!

Quoted 4 lines

--
Luiz Augusto von Dentz

#8 lore raw

Hi Jakub,

Quoted 56 lines · Jakub Pawlowski
Quoted 54 lines · Luiz Augusto von Dentz

Hi Jakub,

Quoted 1 line · Jakub Pawlowski

Ping ?

Sorry, I forgot about this one.

Quoted 46 lines · Jakub Pawlowski
Quoted 45 lines

Hi Luiz

Quoted 25 lines · Luiz Augusto von Dentz

Hi Jakub,

Quoted 22 lines · Jakub Pawlowski

This adds TxPower from advertisement data.

---
 doc/device-api.txt | 5 +++++
 1 file changed, 5 insertions(+)
doc/device-api.txt +5 -0
index 72c597e..875fd9d 100644
@@ -196,6 +196,11 @@ Properties string Address [readonly]
                        Received Signal Strength Indicator of the remote
                        device (inquiry or advertising).
 
+               int16 TxPower [readonly, optional]
+
+                       Advertised transmitted power level (inquiry or
+                       advertising).
+
                dict ManufacturerData [readonly, optional]
 
Quoted 7 lines
Quoted 3 lines
doc/device-api.txt +0 -1
                        Manufacturer specific advertisement data. Keys are
--

2.2.0.rc0.207.ga3a616c

I thought we discussed about this before and we would like to have the pathloss instead of TxPower, or do you have something else useful for TxPower?

I don't remember such discussion, I remember we were discussing about SetDiscoveryFilter, and it have option to filter by pathloss. So I exposed TxPower for two reasons:
1. It's just a field in advertisement, and I wanted just to access it as any other.
2. If I turn it into Pathloss field, it would change together with RSSI, and PropertyChanged event will be doubled. Pathloss is very simple to compute, so having only RSSI that change is more efficient.

Quoted 5 lines
Quoted 3 lines

Fair enough, I just notice I did not mark the these properties as experimental in the documentation, but no need to send another version I will fix it when applying your patches.

Ok, Thanks!

Applied after removing Signed-off-by line as well as fixing the missing experimental flag, thanks.

Signature · 1 line
Luiz Augusto von Dentz