Hi Denis,
+static gboolean voicecall_isemergency(struct voicecall *v)
Please use voicecall_is_emergency
Will change
+{
+ 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.
+ return TRUE;
+ else
Please drop the else, it isn't actually required and makes the
code slightly cleaner.
Agreed, will make the change.
+ 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?
Will recity this, came in as typo mistake.
+ 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;
In general we prefer an empty line after every variable declaration
block.
Sure will change
+ 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