Phone

Since: BlackBerry 10.0.0

#include <bb/system/phone/Phone>

To link against this class, add the following line to your .pro file: LIBS += -lbbsystem

Provides phone-related functionality.

The Phone class is the entry point for phone-related functionality, such as showing the dial pad, starting an outgoing call, checking the available lines supported on the phone, listening to call related notifications, and so on.

The following example shows how to start a cellular call to the phone number "519-555-0100":

bb::system::phone::Phone phone;
phone.initiateCellularCall("519-555-0100");

Permissions:

You must also specify the access_phone and control_phone permissions in your bar-descriptor.xml file.


Overview

Public Functions Index

Phone (QObject *parent=0)
virtual ~Phone ()
LineactiveLine () const
QList< Line >availableLines (const QString &address) const
boolisLineAvailable (LineType::Type type) const
QMap< QString, Line >lines () const

Public Slots Index

boolendCall (int callId)
voidinitiateCall (const QString &address, bb::system::phone::LineType::Type lineType=bb::system::phone::LineType::Cellular)
voidinitiateCellularCall (const QString &phoneNumber, bool applySmartDialing=false)
voidrequestDialpad (const QString &address, bb::system::phone::LineType::Type type=bb::system::phone::LineType::Cellular)
boolsendDTMFTones (const QByteArray &tones, bb::system::phone::LineType::Type lineType=bb::system::phone::LineType::Cellular)

Signals Index

voidcallCommandResponseReceived (const bb::system::phone::CallCommandResponse &commandResponse)
voidcallUpdated (const bb::system::phone::Call &call)
voidlineRemoved (const bb::system::phone::Line &line)
voidlineUpdated (const bb::system::phone::Line &line)

Public Functions

Phone (

Creates a new Phone object.

Parameters
parent

If not 0, the supplied parent will be responsible for deleting this instance.

Since:

BlackBerry 10.0.0

virtual~Phone ()

Destructor.

Since:

BlackBerry 10.0.0

Line activeLine ()

Returns the currently active line.

Return:

The currently active line. If there is no active line, an invalid Line object is returned.

Since:

BlackBerry 10.0.0

QList< Line > availableLines (

Returns a list of phone lines that are currently available to call a phone number.

The lines are sorted based on priority.

For a given phone number, more than one line can be used to call. For instance a cellular number can be called using MVS or cellular line. This method will return the list of lines that can be used to call the given number and the lines are sorted according to their priority. For e.g. an MVS line has more priority over cellular line when both lines are available so MVS will be first item in the list followed by cellular and so on.

Parameters
address

The Phone number(e.g 3125559678) or PIN(e.g A564BBD1) or BBID (e.g test@blackberry.com) that can be used to call a contact.

Return:

A list of currently available lines which can be used to call the number. The lines are sorted based on their priority.

Since:

BlackBerry 10.2.0

bool isLineAvailable (

Checks whether a given line is available.

Parameters
type

The type of the line to check. See LineType for the list of line types.

Return:

true if the given line type is available, false otherwise.

Since:

BlackBerry 10.0.0

QMap< QString, Line > lines ()

Returns a map of lines supported on the device.

Return:

A map of lines keyed on the line identifier supported on the device.

Since:

BlackBerry 10.0.0

Public Slots

bool endCall (
  • intcallId)

Ends an ongoing call.

endCall will return a boolean to inform the client if the end call command was sent successfully. If the client wants to know about the response of the execution of the call command, it needs to listen to callCommandResponseReceived signal.

Parameters
callId

Unique call session identifier

Return:

true if the end call command was sent successfully false otherwise

Since:

BlackBerry 10.2

void initiateCall (

Initiate an outgoing call.

Parameters
address

The address (for example, phone number for cellular call, BBID for video chat, and so on) to call.

lineType

The phone line to use when making the call. The default is LineType::Cellular. See LineType for the list of line types.

Since:

BlackBerry 10.0.0

void initiateCellularCall (
  • const QString &phoneNumber,
  • boolapplySmartDialing )

Initiates an outgoing cellular call.

Subsequent updates for the initiated call are indicated by the callUpdated() signal.

Parameters
phoneNumber

The phone number to call.

applySmartDialing

Whether to apply smart dialing or not. The default is false.

Since:

BlackBerry 10.0.0

void requestDialpad (

Brings the phone dial pad to the foreground with the number field pre-populated with the given address.

The callUpdated() signal will not be emitted for calls resulting from the requestDialpad() method.

Parameters
address

The address with which to populate the number field.

type

The phone line to use when making the call. The default is LineType::Cellular. See LineType for the complete list of line types.

Since:

BlackBerry 10.0.0

bool sendDTMFTones (

Sends DTMF tones to the active call.

The DTMF tones are sent in the order in which they appear in the QByteArray.

Parameters
tones

The DTMF tones to send. Each element in tones should correspond to a DTMF tone.

lineType

The phone line to which the DTMF tones should be sent. The default is LineType::Cellular. See LineType::Type for the complete list of line types.

Return:

true if the tones were successfully sent to the active call, false otherwise.

Since:

BlackBerry 10.0.0

Signals

void callCommandResponseReceived (

Emitted when the response of a call command (e.g.

endCall) initiated through this Phone object instance is returned.

Parameters
commandResponse

A CallCommandResponse object with updated information.

Since:

BlackBerry 10.2

void callUpdated (

Emitted when an incoming call is received or updated, or an outgoing call initiated through this Phone object instance is updated.

Parameters
call

A Call object with updated information.

Since:

BlackBerry 10.0.0

void lineRemoved (

Emitted when a line is removed.

Parameters
line

A Line object that was removed

Since:

BlackBerry 10.0.0

void lineUpdated (

Emitted when a line is updated.

Parameters
line

A Line object with updated information.

Since:

BlackBerry 10.0.0

Last modified: 2014-03-13

comments powered by Disqus