cdma-voicecall: Implement Answer method

This commit is contained in:
Caiwen Zhang 2011-08-12 17:19:09 +08:00 committed by Denis Kenzior
parent 06d45196a8
commit e2be184afb
1 changed files with 23 additions and 0 deletions

View File

@ -286,6 +286,27 @@ static DBusMessage *voicecall_manager_hangup(DBusConnection *conn,
return NULL;
}
static DBusMessage *voicecall_manager_answer(DBusConnection *conn,
DBusMessage *msg, void *data)
{
struct ofono_cdma_voicecall *vc = data;
if (vc->pending)
return __ofono_error_busy(msg);
if (vc->driver->answer == NULL)
return __ofono_error_not_implemented(msg);
if (vc->status != CDMA_CALL_STATUS_INCOMING)
return __ofono_error_failed(msg);
vc->pending = dbus_message_ref(msg);
vc->driver->answer(vc, generic_callback, vc);
return NULL;
}
static GDBusMethodTable manager_methods[] = {
{ "GetProperties", "", "a{sv}",
voicecall_manager_get_properties },
@ -293,6 +314,8 @@ static GDBusMethodTable manager_methods[] = {
G_DBUS_METHOD_FLAG_ASYNC },
{ "Hangup", "", "", voicecall_manager_hangup,
G_DBUS_METHOD_FLAG_ASYNC },
{ "Answer", "", "", voicecall_manager_answer,
G_DBUS_METHOD_FLAG_ASYNC },
{ }
};