Skip to contentSkip to conversation

network: query signal strength

PATCH In review Marit Henriksen 3 participants 3 messages Jan 5, 2011 – Jan 10, 2011

lore
Share & tools
lore
#0 lore raw

PATCH v3 1/1 network: query signal strength

From: Marit Henriksen <[email protected]>

Signal strength is set to -1 whenever registration status changes and differs from registered or roaming. When registration status changes again to registered or roaming, the signal strength needs to be updated, added query towards driver to get it.

---
 src/network.c |   29 +++++++++++++++++------------
 1 files changed, 17 insertions(+), 12 deletions(-)
src/network.c +17 -12
index 95af5d4..ac4942b 100644
@@ -1297,6 +1297,19 @@ emit:
 	notify_status_watches(netreg);
 }
 
+static void signal_strength_callback(const struct ofono_error *error,
+					int strength, void *data)
+{
+	struct ofono_netreg *netreg = data;
+
+	if (error->type != OFONO_ERROR_TYPE_NO_ERROR) {
+		DBG("Error during signal strength query");
+		return;
+	}
+
+	ofono_netreg_strength_notify(netreg, strength);
+}
+
 void ofono_netreg_status_notify(struct ofono_netreg *netreg, int status,
 			int lac, int ci, int tech)
 {
@@ -1320,6 +1333,10 @@ void ofono_netreg_status_notify(struct ofono_netreg *netreg, int status,
 		if (netreg->driver->current_operator)
 			netreg->driver->current_operator(netreg,
 					current_operator_callback, netreg);
+
+		if (netreg->driver->strength)
+			netreg->driver->strength(netreg,
+					signal_strength_callback, netreg);
 	} else {
 		struct ofono_error error;
 
@@ -1346,18 +1363,6 @@ void ofono_netreg_time_notify(struct ofono_netreg *netreg,
 	__ofono_nettime_info_received(modem, info);
 }
 
-static void signal_strength_callback(const struct ofono_error *error,
-					int strength, void *data)
-{
-	struct ofono_netreg *netreg = data;
-
-	if (error->type != OFONO_ERROR_TYPE_NO_ERROR) {
-		DBG("Error during signal strength query");
-		return;
-	}
-
-	ofono_netreg_strength_notify(netreg, strength);
-}
 
 static void init_registration_status(const struct ofono_error *error,
 					int status, int lac, int ci, int tech,
Signature · 1 line
1.7.1
#1 lore raw

Hi Marit,

Quoted 7 lines

Signal strength is set to -1 whenever registration status changes and differs from registered or roaming. When registration status changes again to registered or roaming, the signal strength needs to be updated, added query towards driver to get it.

---
 src/network.c |   29 +++++++++++++++++------------
 1 files changed, 17 insertions(+), 12 deletions(-)

patch has been applied.

I also put back the check to ignore signal strength notifications when not registered. With this fix that change should become obsolete.

Aki, since you remove that check originally, please double check that this does not break for you.

Regards

Marcel

#2 lore raw

Hi Marcel,

2011/1/6 Marcel Holtmann <[email protected]>:

Quoted 2 lines

Aki, since you remove that check originally, please double check that this does not break for you.

This should work ok.

Cheers,
Aki