aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSaman Mahmoodi <mahmoudi.saman1@gmail.com>2021-02-16 17:00:28 +0330
committerSaman Mahmoodi <mahmoudi.saman1@gmail.com>2021-02-24 07:53:15 +0330
commit4739f747c8fbdeda94a400122651862cfdb522b7 (patch)
treec6beff585c2f88008a8c0795c62bdb7448e127e7
parentc1fb92c004eb2bda1f214a3012fc661bd1797d7e (diff)
Fixing warnings and add last_dial to README.md
Bug-AGL: SPEC-3813 Signed-off-by: Saman Mahmoodi <mahmoudi.saman1@gmail.com> Change-Id: Ieb06aa4b7f81d50decbdc3614511516e2cf3785d
-rw-r--r--README.md1
-rw-r--r--binding/gdbus/ofono_voicecallmanager.c26
-rw-r--r--binding/gdbus/ofono_voicecallmanager.h2
-rw-r--r--binding/telephony-binding.c4
4 files changed, 18 insertions, 15 deletions
diff --git a/README.md b/README.md
index 0d3aac6..920be61 100644
--- a/README.md
+++ b/README.md
@@ -11,6 +11,7 @@ Telephony service allows respective clients access to the Handsfree Profile via
| subscribe | subscribe to telephony events | *Request:* {"value": "callStateChanged"} |
| unsubscribe | unsubscribe to telephony events | *Request:* {"value": "callStateChanged"} |
| dial | dial respective number | *Request:* {"value": "15035551212"} |
+| last_dial | dial last dialed number | |
| send_tones | send tone through the active call | *Request:* {"value": "1"} |
| hangup | hangup an active call or reject incoming call | |
| answer | answer incoming call | |
diff --git a/binding/gdbus/ofono_voicecallmanager.c b/binding/gdbus/ofono_voicecallmanager.c
index 7e8f407..2a361a1 100644
--- a/binding/gdbus/ofono_voicecallmanager.c
+++ b/binding/gdbus/ofono_voicecallmanager.c
@@ -147,32 +147,34 @@ gchar *ofono_voicecallmanager_dial(OrgOfonoVoiceCallManager *manager,
return out;
}
-int ofono_voicecallmanager_last_dial(OrgOfonoVoiceCallManager *manager)
+gboolean ofono_voicecallmanager_last_dial(OrgOfonoVoiceCallManager *manager)
{
GError *error = NULL;
+ gboolean res;
if (!manager) {
AFB_ERROR("Ofono VoiceCallmanager uninitialized\n");
- return NULL;
+ return FALSE;
}
- org_ofono_voice_call_manager_call_dial_last_sync(manager, NULL, &error);
- if (error != NULL)
- return 0;
- else
- return -1;
+ res = org_ofono_voice_call_manager_call_dial_last_sync(manager, NULL, &error);
+
+ return (res && error == NULL);
}
-int ofono_voicecallmanager_send_tones(OrgOfonoVoiceCallManager *manager, const gchar *number)
+gboolean ofono_voicecallmanager_send_tones(OrgOfonoVoiceCallManager *manager, const gchar *number)
{
+ GError *error = NULL;
+ gboolean res;
+
if (!manager) {
AFB_ERROR("Ofono VoiceCallmanager uninitialized\n");
- return -1;
+ return FALSE;
}
- if (org_ofono_voice_call_manager_call_send_tones_sync(manager, number, NULL, NULL))
- return 0;
- return -1;
+ res = org_ofono_voice_call_manager_call_send_tones_sync(manager, number, NULL, &error);
+
+ return (res && error == NULL);
}
void ofono_voicecallmanager_hangup_all(OrgOfonoVoiceCallManager *manager)
diff --git a/binding/gdbus/ofono_voicecallmanager.h b/binding/gdbus/ofono_voicecallmanager.h
index c878cfc..65535cd 100644
--- a/binding/gdbus/ofono_voicecallmanager.h
+++ b/binding/gdbus/ofono_voicecallmanager.h
@@ -25,6 +25,6 @@ OrgOfonoVoiceCallManager
void(*)(OrgOfonoVoiceCallManager *, gchar *));
void ofono_voicecallmanager_free(OrgOfonoVoiceCallManager *);
gchar *ofono_voicecallmanager_dial(OrgOfonoVoiceCallManager *, gchar *, gchar *);
-int ofono_voicecallmanager_last_dial(OrgOfonoVoiceCallManager *manager);
+gboolean ofono_voicecallmanager_last_dial(OrgOfonoVoiceCallManager *manager);
gboolean ofono_voicecallmanager_send_tones(OrgOfonoVoiceCallManager *manager, const char *call_path);
void ofono_hangup_all(OrgOfonoVoiceCallManager *);
diff --git a/binding/telephony-binding.c b/binding/telephony-binding.c
index 5eb3dc2..10c00fc 100644
--- a/binding/telephony-binding.c
+++ b/binding/telephony-binding.c
@@ -72,7 +72,7 @@ static void last_dial(afb_req_t request)
AFB_ERROR("dial: cannot dial with active call");
afb_req_fail(request, "active call", NULL);
} else {
- if (!ofono_voicecallmanager_last_dial(vcm)) {
+ if (ofono_voicecallmanager_last_dial(vcm)) {
afb_req_success(request, NULL, NULL);
} else {
AFB_ERROR("dial: failed to dial number\n");
@@ -89,7 +89,7 @@ static void send_tones(afb_req_t request)
AFB_ERROR("send_tones: cannot send tone without active call");
afb_req_fail(request, "there is no active call", NULL);
} else {
- if (!ofono_voicecallmanager_send_tones(vcm, value)) {
+ if (ofono_voicecallmanager_send_tones(vcm, value)) {
afb_req_success(request, NULL, NULL);
} else {
AFB_ERROR("send_tones: failed to send tone\n");