Interface IPhoneBookClientDevice
interface IPhoneBookClientDevice
Extends com.amazon.apmf.IStandard
Methods
addListener()
Subscribe to phonebook client device events that are triggered by the remote device. A call to IPhoneBookClientDevice::connect() or IPhoneBookClientDevice::disconnect() does NOT trigger events in this listener. This listener is for receiving events related to connections and pull response triggered by the remote device and other applications only. Bluetooth phonebook client profile is not a listening service for connections. There can’t be incoming connection request from the remote device. Privilege: com.amazon.bluetooth.privilege.accesscom.amazon.apmf.ISubscription*addListener(IPhoneBookClientDeviceListener*listener)
Parameters
listener
IPhoneBookClientDeviceListener* — Required
For receiving phonebook client incoming
connection events OR connections triggered by other applications,
see IPhoneBookClientListener.
Returns
com.amazon.apmf.ISubscription*
Returns ISubscription. The client can use the unsubscribe() to remove
the listener.
connect()
void connect()
Connect to a device with the Phonebook Client profile.
This is a blocking call. This triggers an outgoing connection.
This device is the Phonebook client equipment and the remote device
is the Phonebook server equipment. The device that is connected
is the same device that is passed into
IPhoneBookClient::getOrMakePhoneBookClientDevice() when creating this
IPhoneBookClientDevice interface. If the device is already connected,
this function returns without exception.
Throws
BluetoothConnectionFailed— if connection can’t be created.BluetoothOutOfResources— if maximum number of phonebook client connections already connected.
disconnect()
void disconnect()
Disconnect a device from the Phonebook client profile.
This is a blocking call. The device from
IPhoneBookClientDevice is the the device that gets disconnected.
Privilege: com.amazon.bluetooth.privilege.phonebook_client
Throws
BluetoothNotConnected— if there is no phonebook client profile-level connection for the device.BluetoothFail— if the disconnection, fails for any other reason.
isConnected()
bool isConnected()
Get Phonebook client profile connection state.
Privlege: com.amazon.bluetooth.privilege.access
Returns
bool
Returns True if connected, False otherwise.
getPhoneBook()
Send a request to get phonebook from the remote device. This is blocking call. This method pulls the phonebook entries from remote device and then forms PhoneBookContactCard data object list. The ownership of the PhoneBookContactCard list is transferred to client up on the return of this method. Privilege: com.amazon.bluetooth.privilege.phonebook_clientPhoneBookContactCard*[]getPhoneBook(PhoneBookFolder*folder)
Parameters
folder
PhoneBookFolder* — Required
Phonebook folder PhoneBookFolder.
Returns
PhoneBookContactCard*[]
Returns list of references to PhoneBookContactCard.
Throws
BluetoothBusy— if the pull request is already in progress.BluetoothFail— if the phonebook is empty from the remote device. Clients are expected to notify the user to allow user consent for contacts on the phone Bluetooth settings. Also, if phonebook failed to fetch intermediately from the remote device. Clients are expected to retry again.BluetoothMaxBuffer— if out of resource to allocate for phonebook entries on client’s process.BluetoothNotConnected— if the request is made without a profile connection.
getPhoneBookSize()
Get phonebook size of folder from the remote device. This is the blocking call, this method makes request to remote device to fetch the size of phonebook folder from the remote device. Privilege: com.amazon.bluetooth.privilege.phonebook_clienti32getPhoneBookSize(PhoneBookFolder*folder)
Parameters
folder
PhoneBookFolder* — Required
Folder name to get size from PhoneBookFolder.
Returns
i32
Returns number of entires of the phonebook folder.
Throws
BluetoothBusy— if the pull request is already in progress.BluetoothNotConnected— if the request is made with out a profile connection.
isPhoneBookModified()
Get the status of phonebook folder on remote device. Default return value of this method is True. This is the blocking call. This method makes request to remote device to fetch database and version information from remote device and compares against cached previous information to determine if the phonebook is modified on remote device. Privilege: com.amazon.bluetooth.privilege.phonebook_clientboolisPhoneBookModified(PhoneBookFolder*folder)
Parameters
folder
PhoneBookFolder* — Required
Folder name to get the status from PhoneBookFolder.
Returns
bool
Returns true if phonebook folder is modified on remote, else false.
Throws
BluetoothBusy— if the pull request is already in progress.BluetoothNotConnected— if the request is made with out a profile connection.
getDevice()
Retrieves the device interface corresponding to the Bluetooth device with the Phonebook client profile-level connection. Privilege: com.amazon.bluetooth.privilege.phonebook_clientIDevice*getDevice()
Returns
IDevice*
Returns pointer to IDevice.

