Bug 1147736 - Part 1: Extend TelephonyCallInfo. r=aknow

This commit is contained in:
Ben Hsu 2015-05-18 01:03:00 -04:00
parent 748d5b4220
commit 805b50fd47
5 changed files with 76 additions and 11 deletions

View File

@ -15,10 +15,13 @@ NS_IMPL_ISUPPORTS(TelephonyCallInfo, nsITelephonyCallInfo)
TelephonyCallInfo::TelephonyCallInfo(uint32_t aClientId,
uint32_t aCallIndex,
uint16_t aCallState,
const nsAString& aDisconnectedReason,
const nsAString& aNumber,
uint16_t aNumberPresentation,
const nsAString& aName,
uint16_t aNamePresentation,
bool aIsOutgoing,
bool aIsEmergency,
bool aIsConference,
@ -27,10 +30,13 @@ TelephonyCallInfo::TelephonyCallInfo(uint32_t aClientId,
: mClientId(aClientId),
mCallIndex(aCallIndex),
mCallState(aCallState),
mDisconnectedReason(aDisconnectedReason),
mNumber(aNumber),
mNumberPresentation(aNumberPresentation),
mName(aName),
mNamePresentation(aNamePresentation),
mIsOutgoing(aIsOutgoing),
mIsEmergency(aIsEmergency),
mIsConference(aIsConference),
@ -60,6 +66,13 @@ TelephonyCallInfo::GetCallState(uint16_t* aCallState)
return NS_OK;
}
NS_IMETHODIMP
TelephonyCallInfo::GetDisconnectedReason(nsAString& aDisconnectedReason)
{
aDisconnectedReason = mDisconnectedReason;
return NS_OK;
}
NS_IMETHODIMP
TelephonyCallInfo::GetNumber(nsAString& aNumber)
{

View File

@ -21,12 +21,21 @@ public:
NS_DECL_ISUPPORTS
NS_DECL_NSITELEPHONYCALLINFO
TelephonyCallInfo(uint32_t aClientId, uint32_t aCallIndex,
uint16_t aCallState, const nsAString& aNumber,
uint16_t aNumberPresentation, const nsAString& aName,
uint16_t aNamePresentation, bool aIsOutgoing,
bool aIsEmergency, bool aIsConference,
bool aIsSwitchable, bool aIsMergeable);
TelephonyCallInfo(uint32_t aClientId,
uint32_t aCallIndex,
uint16_t aCallState,
const nsAString& aDisconnectedReason,
const nsAString& aNumber,
uint16_t aNumberPresentation,
const nsAString& aName,
uint16_t aNamePresentation,
bool aIsOutgoing,
bool aIsEmergency,
bool aIsConference,
bool aIsSwitchable,
bool aIsMergeable);
private:
// Don't try to use the default constructor.
@ -37,10 +46,13 @@ private:
uint32_t mClientId;
uint32_t mCallIndex;
uint16_t mCallState;
nsString mDisconnectedReason;
nsString mNumber;
uint16_t mNumberPresentation;
nsString mName;
uint16_t mNamePresentation;
bool mIsOutgoing;
bool mIsEmergency;
bool mIsConference;

View File

@ -124,10 +124,13 @@ function TelephonyCallInfo(aCall) {
this.clientId = aCall.clientId;
this.callIndex = aCall.callIndex;
this.callState = aCall.state;
this.disconnectedReason = aCall.disconnectedReason || "";
this.number = aCall.number;
this.numberPresentation = aCall.numberPresentation;
this.name = aCall.name;
this.namePresentation = aCall.namePresentation;
this.isOutgoing = aCall.isOutgoing;
this.isEmergency = aCall.isEmergency;
this.isConference = aCall.isConference;
@ -148,10 +151,13 @@ TelephonyCallInfo.prototype = {
clientId: 0,
callIndex: 0,
callState: nsITelephonyService.CALL_STATE_UNKNOWN,
disconnectedReason: "",
number: "",
numberPresentation: nsITelephonyService.CALL_PRESENTATION_ALLOWED,
name: "",
namePresentation: nsITelephonyService.CALL_PRESENTATION_ALLOWED,
isOutgoing: true,
isEmergency: false,
isConference: false,

View File

@ -37,10 +37,13 @@ struct ParamTraits<nsITelephonyCallInfo*>
uint32_t clientId;
uint32_t callIndex;
uint16_t callState;
nsString disconnectedReason;
nsString number;
uint16_t numberPresentation;
nsString name;
uint16_t namePresentation;
bool isOutgoing;
bool isEmergency;
bool isConference;
@ -50,10 +53,13 @@ struct ParamTraits<nsITelephonyCallInfo*>
aParam->GetClientId(&clientId);
aParam->GetCallIndex(&callIndex);
aParam->GetCallState(&callState);
aParam->GetDisconnectedReason(disconnectedReason);
aParam->GetNumber(number);
aParam->GetNumberPresentation(&numberPresentation);
aParam->GetName(name);
aParam->GetNamePresentation(&namePresentation);
aParam->GetIsOutgoing(&isOutgoing);
aParam->GetIsEmergency(&isEmergency);
aParam->GetIsConference(&isConference);
@ -63,10 +69,13 @@ struct ParamTraits<nsITelephonyCallInfo*>
WriteParam(aMsg, clientId);
WriteParam(aMsg, callIndex);
WriteParam(aMsg, callState);
WriteParam(aMsg, disconnectedReason);
WriteParam(aMsg, number);
WriteParam(aMsg, numberPresentation);
WriteParam(aMsg, name);
WriteParam(aMsg, namePresentation);
WriteParam(aMsg, isOutgoing);
WriteParam(aMsg, isEmergency);
WriteParam(aMsg, isConference);
@ -90,10 +99,13 @@ struct ParamTraits<nsITelephonyCallInfo*>
uint32_t clientId;
uint32_t callIndex;
uint16_t callState;
nsString disconnectedReason;
nsString number;
uint16_t numberPresentation;
nsString name;
uint16_t namePresentation;
bool isOutgoing;
bool isEmergency;
bool isConference;
@ -104,10 +116,13 @@ struct ParamTraits<nsITelephonyCallInfo*>
if (!(ReadParam(aMsg, aIter, &clientId) &&
ReadParam(aMsg, aIter, &callIndex) &&
ReadParam(aMsg, aIter, &callState) &&
ReadParam(aMsg, aIter, &disconnectedReason) &&
ReadParam(aMsg, aIter, &number) &&
ReadParam(aMsg, aIter, &numberPresentation) &&
ReadParam(aMsg, aIter, &name) &&
ReadParam(aMsg, aIter, &namePresentation) &&
ReadParam(aMsg, aIter, &isOutgoing) &&
ReadParam(aMsg, aIter, &isEmergency) &&
ReadParam(aMsg, aIter, &isConference) &&
@ -117,10 +132,21 @@ struct ParamTraits<nsITelephonyCallInfo*>
}
nsCOMPtr<nsITelephonyCallInfo> info =
new TelephonyCallInfo(clientId, callIndex, callState, number,
numberPresentation, name, namePresentation,
isOutgoing, isEmergency, isConference,
isSwitchable, isMergeable);
new TelephonyCallInfo(clientId,
callIndex,
callState,
disconnectedReason,
number,
numberPresentation,
name,
namePresentation,
isOutgoing,
isEmergency,
isConference,
isSwitchable,
isMergeable);
info.forget(aResult);

View File

@ -4,7 +4,7 @@
#include "nsISupports.idl"
[scriptable, uuid(3ea2d155-8ea2-42be-85d7-bd8ede8afc40)]
[scriptable, uuid(e5e1be26-a3d4-49b3-8d9f-c1df5192b364)]
interface nsITelephonyCallInfo : nsISupports
{
/**
@ -22,6 +22,14 @@ interface nsITelephonyCallInfo : nsISupports
*/
readonly attribute unsigned short callState;
/**
* The disconnectedReason of a call is defualt to an empty string when the
* call is "not disconnected", but once the call becomes "disconnected" the
* disconnectedReason should be a non-empty string no matter the call is
* disconnected for a noraml reason or an error.
*/
readonly attribute DOMString disconnectedReason;
/**
* Number of the other party.
*/