Ejemplo n.º 1
0
/**
 * @param aSend A boolean indicates whether we need to notify headset or not
 */
nsresult
TelephonyListener::HandleCallInfo(nsITelephonyCallInfo* aInfo, bool aSend)
{
  BluetoothHfpManager* hfp = BluetoothHfpManager::Get();
  NS_ENSURE_TRUE(hfp, NS_ERROR_FAILURE);

  uint32_t callIndex;
  uint16_t callState;
  nsAutoString number;
  nsAutoString disconnectedReason;
  bool isOutgoing;
  bool isConference;

  aInfo->GetCallIndex(&callIndex);
  aInfo->GetCallState(&callState);
  aInfo->GetNumber(number);
  aInfo->GetDisconnectedReason(disconnectedReason);
  aInfo->GetIsOutgoing(&isOutgoing);
  aInfo->GetIsConference(&isConference);

  // The disconnectedReason of a disconnected call must be nonempty no matter
  // the call is disconnected for a normal reason or an error.
  MOZ_ASSERT((callState != nsITelephonyService::CALL_STATE_DISCONNECTED ||
              !disconnectedReason.IsEmpty()),
             "disconnectedReason of an disconnected call must be nonempty.");
  hfp->HandleCallStateChanged(callIndex, callState, disconnectedReason, number,
                              isOutgoing, isConference, aSend);
  return NS_OK;
}
Ejemplo n.º 2
0
NS_IMETHODIMP
BluetoothRILTelephonyCallback::EnumerateCallState(uint32_t aCallIndex,
                                                  uint16_t aCallState,
                                                  const nsAString_internal& aNumber,
                                                  bool aIsActive,
                                                  bool* aResult)
{
  BluetoothHfpManager* hfp = BluetoothHfpManager::Get();
  hfp->HandleCallStateChanged(aCallIndex, aCallState, aNumber, false);
  *aResult = true;
  return NS_OK;
}
Ejemplo n.º 3
0
NS_IMETHODIMP
BluetoothRILTelephonyCallback::CallStateChanged(uint32_t aCallIndex,
                                                uint16_t aCallState,
                                                const nsAString& aNumber,
                                                bool aIsActive)
{
  BluetoothHfpManager* hfp = BluetoothHfpManager::Get();
  hfp->HandleCallStateChanged(aCallIndex, aCallState, aNumber, true);
  BluetoothA2dpManager* a2dp = BluetoothA2dpManager::Get();
  a2dp->HandleCallStateChanged(aCallState);
  return NS_OK;
}
Ejemplo n.º 4
0
NS_IMETHODIMP
TelephonyListener::EnumerateCallState(uint32_t aServiceId,
                                      uint32_t aCallIndex,
                                      uint16_t aCallState,
                                      const nsAString_internal& aNumber,
                                      bool aIsOutgoing,
                                      bool aIsEmergency,
                                      bool aIsConference,
                                      bool aIsSwitchable,
                                      bool aIsMergeable)
{
  BluetoothHfpManager* hfp = BluetoothHfpManager::Get();
  NS_ENSURE_TRUE(hfp, NS_ERROR_FAILURE);

  hfp->HandleCallStateChanged(aCallIndex, aCallState, EmptyString(), aNumber,
                              aIsOutgoing, aIsConference, false);
  return NS_OK;
}
Ejemplo n.º 5
0
/**
 * @param aSend A boolean indicates whether we need to notify headset or not
 */
nsresult
TelephonyListener::HandleCallInfo(nsITelephonyCallInfo* aInfo, bool aSend)
{
  BluetoothHfpManager* hfp = BluetoothHfpManager::Get();
  NS_ENSURE_TRUE(hfp, NS_ERROR_FAILURE);

  uint32_t callIndex;
  uint16_t callState;
  nsAutoString number;
  bool isOutgoing;
  bool isConference;

  aInfo->GetCallIndex(&callIndex);
  aInfo->GetCallState(&callState);
  aInfo->GetNumber(number);
  aInfo->GetIsOutgoing(&isOutgoing);
  aInfo->GetIsConference(&isConference);

  hfp->HandleCallStateChanged(callIndex, callState, EmptyString(), number,
                              isOutgoing, isConference, aSend);
  return NS_OK;
}
Ejemplo n.º 6
0
NS_IMETHODIMP
TelephonyListener::NotifyError(uint32_t aServiceId,
                               int32_t aCallIndex,
                               const nsAString& aError)
{
  BluetoothHfpManager* hfp = BluetoothHfpManager::Get();
  NS_ENSURE_TRUE(hfp, NS_ERROR_FAILURE);

  if (aCallIndex > 0) {
    // In order to not miss any related call state transition.
    // It's possible that 3G network signal lost for unknown reason.
    // If a call is released abnormally, NotifyError() will be called,
    // instead of CallStateChanged(). We need to reset the call array state
    // via setting CALL_STATE_DISCONNECTED
    hfp->HandleCallStateChanged(aCallIndex,
                                nsITelephonyService::CALL_STATE_DISCONNECTED,
                                aError, EmptyString(), false, false, true);
    BT_WARNING("Reset the call state due to call transition ends abnormally");
  }

  BT_WARNING(NS_ConvertUTF16toUTF8(aError).get());
  return NS_OK;
}