Skip to contentSkip to conversation

voicecall: Add EmergencyCall property.

PATCH In review John Mathew 3 participants 11 messages Nov 11, 2010 – Dec 17, 2010

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 voicecall: Add EmergencyCall property.

---
 doc/voicecall-api.txt |    4 ++++
 src/voicecall.c       |   34 +++++++++++++++++++++++++++++++++-
 2 files changed, 37 insertions(+), 1 deletions(-)
doc/voicecall-api.txt +4 -0
index f0ba316..60c692c 100644
@@ -125,3 +125,7 @@ Properties	string LineIdentification [readonly]
 
 			Icon identifier to be used instead of or together
 			with the text information.
+
+		boolean EmergencyCall [readonly]
+
+			Contains the indication if the voice call is emergency call or not.
src/voicecall.c +33 -1
index bd64432..e39f4b7 100644
@@ -315,6 +315,20 @@ static void tone_request_finish(struct ofono_voicecall *vc,
 	g_free(entry);
 }
 
+static gboolean voicecall_isemergency(struct voicecall *v)
+{
+	struct ofono_call *call = v->call;
+	const char *lineid_str;
+
+	lineid_str = phone_number_to_string(&call->phone_number);
+
+	if (g_slist_find_custom(v->vc->en_list, lineid_str,
+						(GCompareFunc) strcmp))
+		return TRUE;
+	else
+		return FALSE;
+}
+
 static void append_voicecall_properties(struct voicecall *v,
 					DBusMessageIter *dict)
 {
@@ -322,7 +336,8 @@ static void append_voicecall_properties(struct voicecall *v,
 	const char *status;
 	const char *callerid;
 	const char *timestr;
-	ofono_bool_t mpty;
+	ofono_bool_t mpt;
+	dbus_bool_t emergency_call;
 
 	status = call_status_to_string(call->status);
 	callerid = phone_number_to_string(&call->phone_number);
@@ -358,6 +373,14 @@ static void append_voicecall_properties(struct voicecall *v,
 	if (v->icon_id)
 		ofono_dbus_dict_append(dict, "Icon", DBUS_TYPE_BYTE,
 					&v->icon_id);
+
+	if (voicecall_isemergency(v))
+			emergency_call = TRUE;
+	else
+			emergency_call = FALSE;
+
+	ofono_dbus_dict_append(dict, "EmergencyCall", DBUS_TYPE_BOOLEAN,
+					&emergency_call);
 }
 
 static DBusMessage *voicecall_get_properties(DBusConnection *conn,
@@ -722,6 +745,15 @@ static void voicecall_set_call_lineid(struct voicecall *v,
 						OFONO_VOICECALL_INTERFACE,
 						"LineIdentification",
 						DBUS_TYPE_STRING, &lineid_str);
+
+	if (voicecall_isemergency(v)) {
+		dbus_bool_t emergency_call = TRUE;
+		ofono_dbus_signal_property_changed(conn, path,
+						OFONO_VOICECALL_INTERFACE,
+						"EmergencyCall",
+						DBUS_TYPE_BOOLEAN,
+						&emergency_call);
+	}
 }
 
 static gboolean voicecall_dbus_register(struct voicecall *v)
Signature · 1 line
1.7.0.4
#1 lore raw

Hi John,

Quoted 9 lines
 doc/voicecall-api.txt |    4 ++++
 src/voicecall.c       |   34 +++++++++++++++++++++++++++++++++-
 2 files changed, 37 insertions(+), 1 deletions(-)
doc/voicecall-api.txt +0 -0
index f0ba316..60c692c 100644

doc/voicecall-api.txt Properties string LineIdentification [readonly] · line 131

Quoted 7 lines
doc/voicecall-api.txt +4 -0
@@ -125,3 +125,7 @@ Properties	string LineIdentification [readonly]
 
 			Icon identifier to be used instead of or together
 			with the text information.
+
+		boolean EmergencyCall [readonly]
+
+			Contains the indication if the voice call is emergency call or not.

do we really wanna call this EmergencyCall instead of just Emergency? In theory the "call" is already in the interface name.

Regards

Marcel

#2 lore raw

Hi Marcel,

Will change the property name to Emergency and resend the patch.

Regards,
John

-----Original Message-----
From: ofono-bounces(a)ofono.org [mailto:ofono-bounces(a)ofono.org] On Behalf Of Marcel Holtmann
Sent: 11 November 2010 17:15
To: ofono(a)ofono.org
Subject: Re: [PATCH] voicecall: Add EmergencyCall property.

Hi John,

doc/voicecall-api.txt Properties string LineIdentification

Quoted 9 lines
 doc/voicecall-api.txt |    4 ++++
 src/voicecall.c       |   34 +++++++++++++++++++++++++++++++++-
 2 files changed, 37 insertions(+), 1 deletions(-)
doc/voicecall-api.txt index renamed from doc/voicecall-api.txt +0 -0

f0ba316..60c692c 100644

doc/voicecall-api.txt +0 -0
@@ -125,3 +125,7 @@ Properties	string LineIdentification

[readonly]

doc/voicecall-api.txt Properties string LineIdentification · line 125

Quoted 2 lines
doc/voicecall-api.txt +0 -0
 			Icon identifier to be used instead of or

together

doc/voicecall-api.txt Properties string LineIdentification [readonly]

Quoted 5 lines
doc/voicecall-api.txt +4 -0
 			with the text information.
+
+		boolean EmergencyCall [readonly]
+
+			Contains the indication if the voice call is

emergency call or not.

do we really wanna call this EmergencyCall instead of just Emergency? In theory the "call" is already in the interface name.

Regards

Marcel

_______________________________________________
ofono mailing list
ofono(a)ofono.org
http://lists.ofono.org/listinfo/ofono

#7 lore raw
In reply to John Mathew

Hi John,

Quoted 1 line

+static gboolean voicecall_isemergency(struct voicecall *v)

Please use voicecall_is_emergency

src/voicecall.c static void tone_request_finish(struct ofono_voicecall *vc, · line 326

Quoted 8 lines
src/voicecall.c +8 -0
+{
+	struct ofono_call *call = v->call;
+	const char *lineid_str;
+
+	lineid_str = phone_number_to_string(&call->phone_number);
+
+	if (g_slist_find_custom(v->vc->en_list, lineid_str,
+						(GCompareFunc) strcmp))

As a general rule, the only function casting we allow is for GFunc use of g_free. I really prefer that you write a separate function here.

src/voicecall.c static void tone_request_finish(struct ofono_voicecall *vc, · line 328

Quoted 2 lines
src/voicecall.c +2 -0
+		return TRUE;
+	else

Please drop the else, it isn't actually required and makes the code slightly cleaner.

src/voicecall.c static void append_voicecall_properties(struct voicecall *v, · line 339

Quoted 12 lines
src/voicecall.c +4 -1
+		return FALSE;
+}
+
 static void append_voicecall_properties(struct voicecall *v,
 					DBusMessageIter *dict)
 {
@@ -322,7 +336,8 @@ static void append_voicecall_properties(struct voicecall *v,
 	const char *status;
 	const char *callerid;
 	const char *timestr;
-	ofono_bool_t mpty;
+	ofono_bool_t mpt;

Is there a reason you're changing this variable name?

Quoted 20 lines
src/voicecall.c +9 -0
+	dbus_bool_t emergency_call;
 
 	status = call_status_to_string(call->status);
 	callerid = phone_number_to_string(&call->phone_number);
@@ -358,6 +373,14 @@ static void append_voicecall_properties(struct voicecall *v,
 	if (v->icon_id)
 		ofono_dbus_dict_append(dict, "Icon", DBUS_TYPE_BYTE,
 					&v->icon_id);
+
+	if (voicecall_isemergency(v))
+			emergency_call = TRUE;
+	else
+			emergency_call = FALSE;
+
+	ofono_dbus_dict_append(dict, "EmergencyCall", DBUS_TYPE_BOOLEAN,
+					&emergency_call);
 }
 
 static DBusMessage *voicecall_get_properties(DBusConnection *conn,

src/voicecall.c static void voicecall_set_call_lineid(struct voicecall *v, · line 750

Quoted 6 lines
src/voicecall.c +3 -0
@@ -722,6 +745,15 @@ static void voicecall_set_call_lineid(struct voicecall *v,
 						OFONO_VOICECALL_INTERFACE,
 						"LineIdentification",
 						DBUS_TYPE_STRING, &lineid_str);
+
+	if (voicecall_isemergency(v)) {
+		dbus_bool_t emergency_call = TRUE;

In general we prefer an empty line after every variable declaration block.

src/voicecall.c static void voicecall_set_call_lineid(struct voicecall *v, · line 759

Quoted 9 lines
src/voicecall.c +6 -0
+		ofono_dbus_signal_property_changed(conn, path,
+						OFONO_VOICECALL_INTERFACE,
+						"EmergencyCall",
+						DBUS_TYPE_BOOLEAN,
+						&emergency_call);
+	}
 }
 
 static gboolean voicecall_dbus_register(struct voicecall *v)

Regards,
-Denis

#3 lore raw
In reply to [email protected]

Hi John,

please do not top post on this mailing list. I am really serious with the fact that I am going to ignore people from now on that do that.

Quoted 1 line

Will change the property name to Emergency and resend the patch.

This was a question open for discussion. What would be the appropriate property name?

Regards

Marcel

#8 lore raw
In reply to Denis Kenzior

Hi Denis,

Quoted 3 lines

+static gboolean voicecall_isemergency(struct voicecall *v)

Please use voicecall_is_emergency

Will change

Quoted 10 lines
src/voicecall.c +8 -0
+{
+     struct ofono_call *call = v->call;
+     const char *lineid_str;
+
+     lineid_str = phone_number_to_string(&call->phone_number);
+
+     if (g_slist_find_custom(v->vc->en_list, lineid_str,
+                                             (GCompareFunc) strcmp))

As a general rule, the only function casting we allow is for GFunc use of g_free. I really prefer that you write a separate function here.

I had two options, to write a function comparing the string, or to use strcmp. A search in ofono source showed me 2 instances where strcmp is used and I followed it here too.

I can write a function to compare the phone number, and will make a patch.

Quoted 4 lines
src/voicecall.c +2 -0
+             return TRUE;
+     else

Please drop the else, it isn't actually required and makes the code slightly cleaner.

Agreed, will make the change.

Quoted 13 lines
src/voicecall.c +4 -1
+             return FALSE;
+}
+
 static void append_voicecall_properties(struct voicecall *v,
                                      DBusMessageIter *dict)
 {
@@ -322,7 +336,8 @@ static void append_voicecall_properties(struct voicecall *v,
      const char *status;
      const char *callerid;
      const char *timestr;
-     ofono_bool_t mpty;
+     ofono_bool_t mpt;
 
Quoted 1 line

Is there a reason you're changing this variable name?

Will recity this, came in as typo mistake.

Quoted 27 lines
src/voicecall.c +12 -1
+     dbus_bool_t emergency_call;
 
      status = call_status_to_string(call->status);
      callerid = phone_number_to_string(&call->phone_number);
@@ -358,6 +373,14 @@ static void append_voicecall_properties(struct voicecall *v,
      if (v->icon_id)
              ofono_dbus_dict_append(dict, "Icon", DBUS_TYPE_BYTE,
                                      &v->icon_id);
+
+     if (voicecall_isemergency(v))
+                     emergency_call = TRUE;
+     else
+                     emergency_call = FALSE;
+
+     ofono_dbus_dict_append(dict, "EmergencyCall", DBUS_TYPE_BOOLEAN,
+                                     &emergency_call);
 }
 
 static DBusMessage *voicecall_get_properties(DBusConnection *conn, @@
-722,6 +745,15 @@ static void voicecall_set_call_lineid(struct voicecall *v,
                                              OFONO_VOICECALL_INTERFACE,
                                              "LineIdentification",
                                              DBUS_TYPE_STRING, &lineid_str);
+
+     if (voicecall_isemergency(v)) {
+             dbus_bool_t emergency_call = TRUE;
Quoted 1 line

In general we prefer an empty line after every variable declaration block.

Sure will change

src/voicecall.c static void voicecall_set_call_lineid(struct voicecall *v, · line 759

Quoted 9 lines
src/voicecall.c +6 -0
+             ofono_dbus_signal_property_changed(conn, path,
+                                             OFONO_VOICECALL_INTERFACE,
+                                             "EmergencyCall",
+                                             DBUS_TYPE_BOOLEAN,
+                                             &emergency_call);
+     }
 }
 
 static gboolean voicecall_dbus_register(struct voicecall *v)

Regards,
John

#4 lore raw
In reply to Marcel Holtmann

Hi Marcel,

Quoted 1 line

This was a question open for discussion. What would be the appropriate

property name?

As per my understanding, this property is only to provide the Emergency call indication to the application side, so that applications can display a different UI compared to the normal UI. In this case, I think the property name "Emergency" is enough.

Since this is a property for the call, the following fits as well. We can remove the existing multiparty property and add it to the new property.

string Type [readonly]
Contains the Type of the current call.

The Values can be:
"Normal"
"Emergency"
"Data"
"Multiparty"

Let me know your opinion on this.

regards
John

#5 lore raw
In reply to Marcel Holtmann

Hi Marcel,

Quoted 16 lines
Quoted 2 lines

This was a question open for discussion. What would be the

appropriate property name?

As per my understanding, this property is only to provide the Emergency call indication to the application side, so that applications can display a different UI compared to the normal UI. In this case, I think the property name "Emergency" is enough.

Since this is a property for the call, the following fits as well. We can remove the existing multiparty property and add it to the new property.

string Type [readonly]
Contains the Type of the current call.

Quoted 8 lines

The Values can be:
"Normal"
"Emergency"
"Data"
"Multiparty"

Let me know your opinion on this.

Any comments?

#6 lore raw

Hi John,

Quoted 24 lines · John.Mathew(a)elektrobit.com

Hi Marcel,

Quoted 22 lines
Quoted 2 lines

This was a question open for discussion. What would be the

appropriate property name?

As per my understanding, this property is only to provide the Emergency call indication to the application side, so that applications can display a different UI compared to the normal UI. In this case, I think the property name "Emergency" is enough.

Since this is a property for the call, the following fits as well. We can remove the existing multiparty property and add it to the new property.

string Type [readonly]
Contains the Type of the current call.

The Values can be:
"Normal"
"Emergency"
"Data"
"Multiparty"

Quoted 5 lines
Quoted 2 lines

Let me know your opinion on this.

Any comments?

We're not going to support data calls, not by re-using the Voicecall interface anyway. So I still prefer the original proposal of using boolean Emergency property here.

Regards,
-Denis

#9 lore raw

PATCH 1/1 voicecall: Add emergency property

In reply to Denis Kenzior
---
 doc/voicecall-api.txt |    5 +++++
 src/voicecall.c       |   37 +++++++++++++++++++++++++++++++++++++
 2 files changed, 42 insertions(+), 0 deletions(-)
doc/voicecall-api.txt +5 -0
index f0ba316..95a43a6 100644
@@ -125,3 +125,8 @@ Properties	string LineIdentification [readonly]
 
 			Icon identifier to be used instead of or together
 			with the text information.
+
+		boolean Emergency [readonly]
+
+			Contains the indication if the voice call is an emergency
+			call or not.
src/voicecall.c +37 -0
index dbf3e9a..3f9fe54 100644
@@ -316,6 +316,23 @@ static void tone_request_finish(struct ofono_voicecall *vc,
 	g_free(entry);
 }
 
+static gint number_compare(gconstpointer a, gconstpointer b)
+{
+	const char *s1 = a, *s2 = b;
+	return strcmp(s1, s2);
+}
+
+static gboolean voicecall_is_emergency(struct voicecall *v)
+{
+	struct ofono_call *call = v->call;
+	const char *lineid_str;
+
+	lineid_str = phone_number_to_string(&call->phone_number);
+
+	return (g_slist_find_custom(v->vc->en_list, lineid_str,
+						number_compare)) ? TRUE : FALSE;
+}
+
 static void append_voicecall_properties(struct voicecall *v,
 					DBusMessageIter *dict)
 {
@@ -324,6 +341,7 @@ static void append_voicecall_properties(struct voicecall *v,
 	const char *callerid;
 	const char *timestr;
 	ofono_bool_t mpty;
+	dbus_bool_t emergency_call;
 
 	status = call_status_to_string(call->status);
 	callerid = phone_number_to_string(&call->phone_number);
@@ -359,6 +377,15 @@ static void append_voicecall_properties(struct voicecall *v,
 	if (v->icon_id)
 		ofono_dbus_dict_append(dict, "Icon", DBUS_TYPE_BYTE,
 					&v->icon_id);
+
+	if (voicecall_is_emergency(v) == TRUE)
+		emergency_call = TRUE;
+	else
+		emergency_call = FALSE;
+
+	ofono_dbus_dict_append(dict, "Emergency", DBUS_TYPE_BOOLEAN,
+					&emergency_call);
+
 }
 
 static DBusMessage *voicecall_get_properties(DBusConnection *conn,
@@ -721,6 +748,16 @@ static void voicecall_set_call_lineid(struct voicecall *v,
 						OFONO_VOICECALL_INTERFACE,
 						"LineIdentification",
 						DBUS_TYPE_STRING, &lineid_str);
+
+	if (voicecall_is_emergency(v)) {
+		dbus_bool_t emergency_call = TRUE;
+
+		ofono_dbus_signal_property_changed(conn, path,
+						OFONO_VOICECALL_INTERFACE,
+						"Emergency",
+						DBUS_TYPE_BOOLEAN,
+						&emergency_call);
+	}
 }
 
 static gboolean voicecall_dbus_register(struct voicecall *v)
Signature · 1 line
1.7.0.4
#10 lore raw

Re: [PATCH] voicecall: Add emergency property

Hi John,

Quoted 5 lines · John Mathew
---
 doc/voicecall-api.txt |    5 +++++
 src/voicecall.c       |   37 +++++++++++++++++++++++++++++++++++++
 2 files changed, 42 insertions(+), 0 deletions(-)

I applied this patch but broke it up into two. One for the doc changes and one for voicecall atom changes.

I've also updated the features document and the TODO list for you ;)

Regards,
-Denis