Skip to contentSkip to conversation

network: query signal strength when status changes to registered or roaming.

PATCH In review Marit Henriksen 2 participants 3 messages Dec 3, 2010 – Dec 16, 2010

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 network: query signal strength when status changes to registered or roaming.

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, so add query towards driver to get it.

---
 src/network.c |   29 ++++++++++++++++-------------
 1 files changed, 16 insertions(+), 13 deletions(-)
src/network.c +16 -13
index d5b42a1..80fa83d 100644
@@ -1296,6 +1296,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)
 {
@@ -1319,6 +1332,9 @@ 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;
 
@@ -1345,19 +1361,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,
 					void *data)
Signature · 1 line
1.7.1
#1 lore raw

2010/12/3 Marit Henriksen <[email protected]>

Quoted 3 lines

From: Marit Henriksen <[email protected]>

Hi. I was wondering if you have had the chance to look at this patch yet?

regards, Marit

Quoted 69 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, so add query towards driver to get it.

---
 src/network.c |   29 ++++++++++++++++-------------
 1 files changed, 16 insertions(+), 13 deletions(-)
src/network.c +16 -13
index d5b42a1..80fa83d 100644
@@ -1296,6 +1296,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)
 {
@@ -1319,6 +1332,9 @@ 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;
@@ -1345,19 +1361,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,
void *data)
--
1.7.1

#2 lore raw
In reply to Marit Henriksen

Hi Marit,

Your commit subject is too big, you should not use more than 72 characters there. Ideally you should not use more than 50, but up to 72 is still ok. Leave the additional info to the commit message.

Quoted 54 lines · Marit Henriksen

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, so add query towards driver to get it.

---
 src/network.c |   29 ++++++++++++++++-------------
 1 files changed, 16 insertions(+), 13 deletions(-)
src/network.c +16 -6
index d5b42a1..80fa83d 100644
@@ -1296,6 +1296,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)
 {
@@ -1319,6 +1332,9 @@ 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;
 
@@ -1345,19 +1361,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) {

src/network.c void ofono_netreg_time_notify(struct ofono_netreg *netreg, · line 1366

Quoted 10 lines
src/network.c +0 -7
-		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,
 					void *data)

Otherwise patch looks good.

Signature · 2 lines
Gustavo F. Padovan
http://profusion.mobi