From f088341fa0aa5a2c7c979d38888de715047ed9cc Mon Sep 17 00:00:00 2001 From: "Szu-Yu Chen [:aknow]" Date: Mon, 20 Oct 2014 03:12:00 -0400 Subject: [PATCH] Bug 978639 - Part 4: Add hangUpConference method (ipc). r=hsinyi --- dom/telephony/ipc/PTelephony.ipdl | 6 ++++++ dom/telephony/ipc/TelephonyIPCService.cpp | 7 +++++++ dom/telephony/ipc/TelephonyParent.cpp | 16 ++++++++++++++++ dom/telephony/ipc/TelephonyParent.h | 3 +++ 4 files changed, 32 insertions(+) diff --git a/dom/telephony/ipc/PTelephony.ipdl b/dom/telephony/ipc/PTelephony.ipdl index 229525b5894..25c9a4d43af 100644 --- a/dom/telephony/ipc/PTelephony.ipdl +++ b/dom/telephony/ipc/PTelephony.ipdl @@ -30,11 +30,17 @@ struct USSDRequest nsString ussd; }; +struct HangUpConferenceRequest +{ + uint32_t clientId; +}; + union IPCTelephonyRequest { EnumerateCallsRequest; DialRequest; USSDRequest; + HangUpConferenceRequest; }; sync protocol PTelephony { diff --git a/dom/telephony/ipc/TelephonyIPCService.cpp b/dom/telephony/ipc/TelephonyIPCService.cpp index 1d31ae5c743..a2cec3994e8 100644 --- a/dom/telephony/ipc/TelephonyIPCService.cpp +++ b/dom/telephony/ipc/TelephonyIPCService.cpp @@ -253,6 +253,13 @@ TelephonyIPCService::SeparateCall(uint32_t aClientId, uint32_t aCallIndex) return NS_OK; } +NS_IMETHODIMP +TelephonyIPCService::HangUpConference(uint32_t aClientId, + nsITelephonyCallback *aCallback) +{ + return SendRequest(nullptr, aCallback, HangUpConferenceRequest(aClientId)); +} + NS_IMETHODIMP TelephonyIPCService::HoldConference(uint32_t aClientId) { diff --git a/dom/telephony/ipc/TelephonyParent.cpp b/dom/telephony/ipc/TelephonyParent.cpp index 4cb5fe4714a..309a27c82e6 100644 --- a/dom/telephony/ipc/TelephonyParent.cpp +++ b/dom/telephony/ipc/TelephonyParent.cpp @@ -45,6 +45,8 @@ TelephonyParent::RecvPTelephonyRequestConstructor(PTelephonyRequestParent* aActo return actor->DoRequest(aRequest.get_DialRequest()); case IPCTelephonyRequest::TUSSDRequest: return actor->DoRequest(aRequest.get_USSDRequest()); + case IPCTelephonyRequest::THangUpConferenceRequest: + return actor->DoRequest(aRequest.get_HangUpConferenceRequest()); default: MOZ_CRASH("Unknown type!"); } @@ -451,6 +453,20 @@ TelephonyRequestParent::DoRequest(const USSDRequest& aRequest) return true; } +bool +TelephonyRequestParent::DoRequest(const HangUpConferenceRequest& aRequest) +{ + nsCOMPtr service = + do_GetService(TELEPHONY_SERVICE_CONTRACTID); + if (service) { + service->HangUpConference(aRequest.clientId(), this); + } else { + return NS_SUCCEEDED(NotifyError(NS_LITERAL_STRING("InvalidStateError"))); + } + + return true; +} + nsresult TelephonyRequestParent::SendResponse(const IPCTelephonyResponse& aResponse) { diff --git a/dom/telephony/ipc/TelephonyParent.h b/dom/telephony/ipc/TelephonyParent.h index e88710e092d..cfaec304ff5 100644 --- a/dom/telephony/ipc/TelephonyParent.h +++ b/dom/telephony/ipc/TelephonyParent.h @@ -129,6 +129,9 @@ private: bool DoRequest(const USSDRequest& aRequest); + + bool + DoRequest(const HangUpConferenceRequest& aRequest); }; END_TELEPHONY_NAMESPACE