Interface IHandsfreeClientConnection
interface IHandsfreeClientConnection
Extends com.amazon.apmf.IStandard
Methods
addListener()
Subscribe to hands-free client events. Must be called to receive events for the device associated with the corresponding IHandsfreeClientConnection. Privilege: com.amazon.bluetooth.privilege.handsfree_clientcom.amazon.apmf.ISubscription*addListener(IHandsfreeClientConnectionListener*listener)
Parameters
listener
IHandsfreeClientConnectionListener* — Required
Callback for receiving hands-free client events. See
IHandsfreeClientConnectionListener.
Returns
com.amazon.apmf.ISubscription*
Returns pointer to ISubscription.
connect()
void connect()
Connect to a device with the hands-free profile.
This is a blocking call. This triggers an outgoing connection. This device
is the hands-free client and the remote device is the audio
gateway. The device that is connected is the same device that is
passed into IHandsfreeClient::getOrMakeHandsfreeClientDevice() when
creating this IHandsfreeClientConnection interface. If the device is
already connected, this API returns without an exception.
Privilege: com.amazon.bluetooth.privilege.handsfree_client.
Throws
BluetoothConnectionFailed— if connection can’t be initiated.BluetoothOutOfResources— if the maximum number of hands-free client connections are already connected.
disconnect()
void disconnect()
Disconnect a device from the hands-free client capability.
This is a blocking call.
Privilege: com.amazon.bluetooth.privilege.handsfree_client
Throws
BluetoothNotConnected— if there is no hands-free client. profile-level connection for the device.BluetoothFail— if the disconnection fails for any other reason.
isConnected()
bool isConnected()
Get profile connection state.
Privilege: com.amazon.bluetooth.privilege.access
Returns
bool
Returns true if connected, false otherwise.
connectAudio()
void connectAudio()
Connect audio to start receiving/sending call audio.
This is a blocking call. If the device already has audio connected, this
function returns without an exception.
Privilege: com.amazon.bluetooth.privilege.handsfree_client
Throws
BluetoothNotConnected— if there is no hands-free client profile-level connection for the device.InvalidOperationError— if there is no active call.BluetoothOutOfResources— if another device has audio connected.
disconnectAudio()
void disconnectAudio()
Disconnect audio to stop receiving/sending call audio.
This is a blocking call.
Privilege: com.amazon.bluetooth.privilege.handsfree_client
Throws
BluetoothAudioNotConnected— if there is no hands-free client audio connection for the device.BluetoothNotConnected— if there is no hands-free client connection.
isAudioConnected()
bool isAudioConnected()
Get audio connection state.
Returns
bool
Returns true if audio connected, false otherwise.
Throws
BluetoothNotConnected— if there is no hands-free client profile-level connection for the device.
dialCall()
Dial a call to a number. Use empty string to redial. Any strings over 15 characters are truncated. After the call is successfully dialed, onCallStateChanged() callback is triggered with the updated call state and a new ICall object. Privilege: com.amazon.bluetooth.privilege.handsfree_clientvoiddialCall(stringnumber)
Parameters
number
string — Required
Number to call
Throws
BluetoothNotConnected— if there is no hands-free client profile-level connection for the device.
endAllCalls()
void endAllCalls()
End all calls on device.
After the call(s) are successfully ended, an onCallStateChanged() callback
is triggered with the updated call state(s).
Privilege: com.amazon.bluetooth.privilege.handsfree_client
Throws
BluetoothNotConnected— if there is no hands-free client profile-level connection for the device.BluetoothFail— if the command fails to execute.
getCalls()
Returns the list of calls (ICall) on-going on device. This is a synchronous API with no corresponding callback. Privilege: com.amazon.bluetooth.privilege.handsfree_clientICall*[]getCalls()
Returns
ICall*[]
Returns a list with of all calls on-going (can be empty if no calls
on-going).
Throws
BluetoothNotConnected— if there is no hands-free client profile-level connection for the device.
sendDtmf()
Send dual-tone multi frequency (DTMF) signaling code. After the call(s) are successfully sent, an onCommandComplete() callback is triggered. An on-going call must exist for the code to be sent successfully to the device. Privilege: com.amazon.bluetooth.privilege.handsfree_clientvoidsendDtmf(stringcode)
Parameters
code
string — Required
NFC-normalized UTF-8 string containing a single character from
the characters ‘0’-‘9’, ‘A’-‘D’, ’*’, ’#’.
Throws
BluetoothNotConnected— if there is no hands-free client profile-level connection for the device.InvalidArgumentError— if an invalid string is passed in.
getSubscriberInformation()
string getSubscriberInformation()
Retrieve the subscriber information (phone number) of the current connected
phone. This call blocks until the subscriber information received from the
device.
Privilege: com.amazon.bluetooth.privilege.handsfree_client
Returns
string
Returns a string containing the subscriber information.
Throws
BluetoothNotConnected— if there is no hands-free client profile-level connection for the device.TimeoutError— if device does not respond.BluetoothUnsupported— if the connected device does not support the query.
isNetworkAvailable()
bool isNetworkAvailable()
Get network availability status.
This is a blocking API.
Privilege: com.amazon.bluetooth.privilege.access
Returns
bool
Returns true if network is available, false otherwise.
Throws
BluetoothNotConnected— if there is no hands-free client profile-level connection for the device.TimeoutError— if device does not respond.
isServiceRoam()
bool isServiceRoam()
Get roaming status indication.
This is a blocking API. This indicates whether the device is connected to
its home cellular network or if it is roaming (using another cellular
network).
Privilege: com.amazon.bluetooth.privilege.access
Returns
bool
Returns true is service is roaming, false if service type is home.
Throws
BluetoothNotConnected— if there is no hands-free client profile-level connection for the device.TimeoutError— if device does not respond.
getSignalStrength()
u32 getSignalStrength()
Get signal strength indication.
This is a blocking API.
Privilege: com.amazon.bluetooth.privilege.handsfree_client
Returns
u32
Returns current signal strength (0-5).
Throws
BluetoothNotConnected— if there is no hands-free client profile-level connection for the device.TimeoutError— if device does not respond.
getBatteryLevel()
u32 getBatteryLevel()
Get battery level indication.
This is a blocking API.
Privilege: com.amazon.bluetooth.privilege.handsfree_client
Returns
u32
Returns current battery level (0-5).
Throws
BluetoothNotConnected— if there is no hands-free client profile-level connection for the device.TimeoutError— if device does not respond.
getNetworkName()
string getNetworkName()
Get selected operator string.
This is a blocking API.
Privilege: com.amazon.bluetooth.privilege.handsfree_client
Returns
string
Returns a string containing the current network operator name.
Throws
BluetoothNotConnected— if there is no hands-free client profile-level connection for the device.TimeoutError— if device does not respond.
getDevice()
Retrieves the device interface corresponding to the Bluetooth device with the hands-free client profile-level connection.IDevice*getDevice()
Returns
IDevice*
Returns a pointer to IDevice.

