Open Source Telephony
 help / color / mirror / Atom feed
* [PATCH 1/6] voicecall, common: promote call_status_to_string() to be public
@ 2017-09-07 20:22 Alexander Couzens
  2017-09-07 20:22 ` [PATCH 2/6] voicecall: use ofono_call_status_name in DBG messages Alexander Couzens
                   ` (5 more replies)
  0 siblings, 6 replies; 17+ messages in thread
From: Alexander Couzens @ 2017-09-07 20:22 UTC (permalink / raw)
  To: ofono

[-- Attachment #1: Type: text/plain, Size: 2960 bytes --]

call_status_to_string() is useful for debug output.
Change signature to contain enum call_status
Replace default case to get compiler warning when new enums added
---
 src/common.c    | 21 +++++++++++++++++++++
 src/common.h    |  1 +
 src/voicecall.c | 24 ++----------------------
 3 files changed, 24 insertions(+), 22 deletions(-)

diff --git a/src/common.c b/src/common.c
index ce07b934970d..d99647998a6f 100644
--- a/src/common.c
+++ b/src/common.c
@@ -743,3 +743,24 @@ void ofono_call_init(struct ofono_call *call)
 	call->cnap_validity = CNAP_VALIDITY_NOT_AVAILABLE;
 	call->clip_validity = CLIP_VALIDITY_NOT_AVAILABLE;
 }
+
+const char *ofono_call_status_to_string(enum call_status status)
+{
+	switch (status) {
+	case CALL_STATUS_ACTIVE:
+		return "active";
+	case CALL_STATUS_HELD:
+		return "held";
+	case CALL_STATUS_DIALING:
+		return "dialing";
+	case CALL_STATUS_ALERTING:
+		return "alerting";
+	case CALL_STATUS_INCOMING:
+		return "incoming";
+	case CALL_STATUS_WAITING:
+		return "waiting";
+	case CALL_STATUS_DISCONNECTED:
+		return "disconnected";
+	}
+	return "unknown";
+}
diff --git a/src/common.h b/src/common.h
index 05f2a851bd57..de72bd418792 100644
--- a/src/common.h
+++ b/src/common.h
@@ -184,3 +184,4 @@ const char *registration_tech_to_string(int tech);
 const char *packet_bearer_to_string(int bearer);
 
 gboolean is_valid_apn(const char *apn);
+const char *ofono_call_status_to_string(enum call_status status);
diff --git a/src/voicecall.c b/src/voicecall.c
index 6907b5025cb4..c99f11fabc01 100644
--- a/src/voicecall.c
+++ b/src/voicecall.c
@@ -174,26 +174,6 @@ static const char *disconnect_reason_to_string(enum ofono_disconnect_reason r)
 	}
 }
 
-static const char *call_status_to_string(int status)
-{
-	switch (status) {
-	case CALL_STATUS_ACTIVE:
-		return "active";
-	case CALL_STATUS_HELD:
-		return "held";
-	case CALL_STATUS_DIALING:
-		return "dialing";
-	case CALL_STATUS_ALERTING:
-		return "alerting";
-	case CALL_STATUS_INCOMING:
-		return "incoming";
-	case CALL_STATUS_WAITING:
-		return "waiting";
-	default:
-		return "disconnected";
-	}
-}
-
 static const char *phone_and_clip_to_string(const struct ofono_phone_number *n,
 						int clip_validity)
 {
@@ -421,7 +401,7 @@ static void append_voicecall_properties(struct voicecall *v,
 	ofono_bool_t mpty;
 	dbus_bool_t emergency_call;
 
-	status = call_status_to_string(call->status);
+	status = ofono_call_status_to_string(call->status);
 
 	ofono_dbus_dict_append(dict, "State", DBUS_TYPE_STRING, &status);
 
@@ -920,7 +900,7 @@ static void voicecall_set_call_status(struct voicecall *call, int status)
 
 	call->call->status = status;
 
-	status_str = call_status_to_string(status);
+	status_str = ofono_call_status_to_string(status);
 	path = voicecall_build_path(call->vc, call->call);
 
 	ofono_dbus_signal_property_changed(conn, path,
-- 
2.14.1


^ permalink raw reply related	[flat|nested] 17+ messages in thread

end of thread, other threads:[~2017-09-08 17:20 UTC | newest]

Thread overview: 17+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-09-07 20:22 [PATCH 1/6] voicecall, common: promote call_status_to_string() to be public Alexander Couzens
2017-09-07 20:22 ` [PATCH 2/6] voicecall: use ofono_call_status_name in DBG messages Alexander Couzens
2017-09-07 20:22 ` [PATCH 3/6] qmimodem: add strength (in %) to the debug output Alexander Couzens
2017-09-07 21:49   ` Denis Kenzior
2017-09-07 20:22 ` [PATCH 4/6] qmimodem: extract network time from serving system Alexander Couzens
2017-09-07 21:50   ` Denis Kenzior
2017-09-08  8:48   ` Jonas Bonn
2017-09-08  9:33     ` Jonas Bonn
2017-09-08 17:20     ` Denis Kenzior
2017-09-07 20:22 ` [PATCH 5/6] gprs: use registration_status_to_string in debug messages Alexander Couzens
2017-09-07 21:51   ` Denis Kenzior
2017-09-07 20:23 ` [PATCH 6/6] plugins/udevng: use else if instead of if Alexander Couzens
2017-09-07 21:52   ` Denis Kenzior
2017-09-07 21:57 ` [PATCH 1/6] voicecall, common: promote call_status_to_string() to be public Denis Kenzior
2017-09-07 22:27   ` [PATCH][v2 1/2] voicecall, common: move call_status_to_string() to common Alexander Couzens
2017-09-07 22:27     ` [PATCH][v2 2/2] voicecall: use ofono_call_status_name in DBG messages Alexander Couzens
2017-09-07 22:30     ` [PATCH][v2 1/2] voicecall, common: move call_status_to_string() to common Denis Kenzior

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox