dotstack API Reference  1.10.37
Macros | Functions
PBAP

The Phone Book Access Profile (PBAP) defines the protocols and procedures that shall be used by devices for the retrieval of phone book objects. More...

Macros

#define bt_pbap_get_phonebook_size(session, pb_type)   bt_pbap_pull_phonebook(session, pb_type, 0, 0, 0, 0)
 Get a phonebook's size. More...
 
#define bt_pbap_pull_vcard_listing_all(session, pb_type, order)   bt_pbap_pull_vcard_listing(session, pb_type, order, 0, NULL, 0, 0xFFFF, 0)
 Pull a vCard listing from a remote device. More...
 
#define bt_pbap_get_vcard_listing_size(session, pb_type)   bt_pbap_pull_vcard_listing(session, pb_type, 0, 0, NULL, 0, 0, 0)
 Get the size of a vCard listing from a remote device. More...
 

Functions

bt_bool bt_pbap_init (void)
 Initialize the PBAP layer. More...
 
bt_pbap_session_t * bt_pbap_allocate_session (void)
 Allocate PBAP session. More...
 
void bt_pbap_free_session (bt_pbap_session_t *psess)
 Release PBAP session. More...
 
bt_bool bt_pbap_connect (bt_pbap_session_t *session, bt_bdaddr_t *remote_addr, bt_uint header_count, bt_obex_header *headers, bt_pbap_session_callback_pf callback, void *param)
 Connect to a remote device. More...
 
bt_bool bt_pbap_connect_ex (bt_pbap_session_t *session, bt_bdaddr_t *pbdaddr_remote, bt_byte server_channel, bt_uint header_count, bt_obex_header *headers, bt_pbap_session_callback_pf callback, void *param)
 Connect to a remote device. More...
 
bt_bool bt_pbap_disconnect (bt_pbap_session_t *session)
 Disconnect from a remote device. More...
 
bt_bool bt_pbap_disconnect_ex (bt_pbap_session_t *session, bt_uint header_count, bt_obex_header *headers)
 Disconnect from a remote device. More...
 
void bt_pbap_set_vcard_buffer (bt_pbap_session_t *session, bt_vcard *buffer, bt_uint buffer_size)
 Sets a pointer to a vCard buffer. More...
 
bt_bool bt_pbap_pull_phonebook (bt_pbap_session_t *session, bt_byte pb_type, bt_ulong filter, bt_byte format, bt_uint max_list_count, bt_uint list_start_offset)
 Pull a phonebook from a remote device. More...
 
bt_bool bt_pbap_pull_vcard_listing (bt_pbap_session_t *session, bt_byte pb_type, bt_byte order, bt_byte search_attr, bt_byte *search_value, bt_byte search_value_len, bt_uint max_list_count, bt_uint list_start_offset)
 Pull a vCard listing from a remote device. More...
 
bt_bool bt_pbap_pull_vcard (bt_pbap_session_t *session, bt_byte pb_type, bt_byte *vcard_name, bt_byte vcard_name_len, bt_ulong filter, bt_byte format)
 Pull a vCard from a remote device. More...
 
bt_bool bt_pbap_login (bt_pbap_session_t *session, const obex_auth_challenge_t *challenge, const bt_char *password)
 Authenticate PBAP session. More...
 
bt_bool bt_pbap_abort (bt_pbap_session_t *session)
 Close PBAP session. More...
 
bt_hci_conn_state_t * bt_pbap_get_hci_connection (const bt_pbap_session_t *session)
 Get PBAP session underlying HCI connection. More...
 

Detailed Description

The Phone Book Access Profile (PBAP) defines the protocols and procedures that shall be used by devices for the retrieval of phone book objects.

Macro Definition Documentation

#define bt_pbap_get_phonebook_size (   session,
  pb_type 
)    bt_pbap_pull_phonebook(session, pb_type, 0, 0, 0, 0)

Get a phonebook's size.

This function gets the size of a phonebook from a remote device.

Parameters
sessionPBAP session.
pb_typePhonebook type to pull.
Returns
  • TRUE if the function succeeds.
  • FALSE otherwise.
#define bt_pbap_get_vcard_listing_size (   session,
  pb_type 
)    bt_pbap_pull_vcard_listing(session, pb_type, 0, 0, NULL, 0, 0, 0)

Get the size of a vCard listing from a remote device.

This function gets the size of a vCard listing from a remote device.

Parameters
sessionPBAP session.
pb_typePhonebook type to pull.
Returns
  • TRUE if the function succeeds.
  • FALSE otherwise.
#define bt_pbap_pull_vcard_listing_all (   session,
  pb_type,
  order 
)    bt_pbap_pull_vcard_listing(session, pb_type, order, 0, NULL, 0, 0xFFFF, 0)

Pull a vCard listing from a remote device.

This function pulls a vCard listing from a remote device that contains all vCards. Received vCards are reported to an app via PBAP session callback with PBAP_EVT_SESSION_PHONEBOOK_ENTRY event.

Parameters
sessionPBAP session.
pb_typePhonebook type to pull.
orderSort order.
Returns
  • TRUE if the function succeeds.
  • FALSE otherwise.

Function Documentation

bt_bool bt_pbap_abort ( bt_pbap_session_t *  session)

Close PBAP session.

This function closes PBAP session with a remote device.

Parameters
sessionPBAP session.
Returns
  • TRUE if the function succeeds.
  • FALSE otherwise.
bt_pbap_session_t* bt_pbap_allocate_session ( void  )

Allocate PBAP session.

This function allocates new PBAP session.

Returns
  • A pointer to the new PBAP session structure if the function succeeds.
  • NULL otherwise.
bt_bool bt_pbap_connect ( bt_pbap_session_t *  session,
bt_bdaddr_t *  remote_addr,
bt_uint  header_count,
bt_obex_header headers,
bt_pbap_session_callback_pf  callback,
void *  param 
)

Connect to a remote device.

This function establishes a PBAP connection with a remote device which is running PBAP server. Changes in the session state are reported through a callback function.

Parameters
sessionPBAP session.
remote_addrAddress of the remote device.
header_countThe number of optional OBEX headers sent with the connect request.
headersOptional OBEX headers sent with the connect request.
callbackThe callback function that will be called when the PBAP generates an event.
paramA pointer to arbitrary data to be passed to the callback function.
Returns
  • TRUE if the function succeeds.
  • FALSE otherwise. The callback function is not called in this case.
bt_bool bt_pbap_connect_ex ( bt_pbap_session_t *  session,
bt_bdaddr_t *  pbdaddr_remote,
bt_byte  server_channel,
bt_uint  header_count,
bt_obex_header headers,
bt_pbap_session_callback_pf  callback,
void *  param 
)

Connect to a remote device.

This function establishes a PBAP connection with a remote device which is running PBAP server. Changes in the session state are reported through a callback function.

Parameters
sessionPBAP session.
remote_addrAddress of the remote device.
server_channelRFCOMM server channel to connect to.
header_countThe number of optional OBEX headers sent with the connect request.
headersOptional OBEX headers sent with the connect request.
callbackThe callback function that will be called when the PBAP generates an event.
paramA pointer to arbitrary data to be passed to the callback function.
Returns
  • TRUE if the function succeeds.
  • FALSE otherwise. The callback function is not called in this case.
bt_bool bt_pbap_disconnect ( bt_pbap_session_t *  session)

Disconnect from a remote device.

This function closes a PBAP connection with a remote device. Changes in the session state are reported through a callback function set in bt_pbap_connect call.

Parameters
sessionPBAP session.
Returns
  • TRUE if the function succeeds.
  • FALSE otherwise.
bt_bool bt_pbap_disconnect_ex ( bt_pbap_session_t *  session,
bt_uint  header_count,
bt_obex_header headers 
)

Disconnect from a remote device.

This function closes a PBAP connection with a remote device. Changes in the session state are reported through a callback function set in bt_pbap_connect call.

Parameters
sessionPBAP session.
header_countThe number of optional OBEX headers sent with the disconnect request.
headersOptional OBEX headers sent with the disconnect request.
Returns
  • TRUE if the function succeeds.
  • FALSE otherwise.
void bt_pbap_free_session ( bt_pbap_session_t *  psess)

Release PBAP session.

This function deallocated the specified PBAP session. This function does not disconnect the session. It just frees the memory used by the bt_pbap_session_t structure. The session has to be disconnected by a remote device or by calling bt_pbap_disconnect.

Parameters
sessionThe PBAP session to be deallocated.
bt_hci_conn_state_t* bt_pbap_get_hci_connection ( const bt_pbap_session_t *  session)

Get PBAP session underlying HCI connection.

This function returns PBAP session underlying HCI connection.

Parameters
sessionPBAP session.
Returns
  • TRUE if the function succeeds.
  • FALSE otherwise.
bt_bool bt_pbap_init ( void  )

Initialize the PBAP layer.

This function initializes the PBAP layer of the stack. It must be called prior to any other PBAP function is called.

bt_bool bt_pbap_login ( bt_pbap_session_t *  session,
const obex_auth_challenge_t challenge,
const bt_char *  password 
)

Authenticate PBAP session.

This function authenticates PBAP session with a remote device.

Parameters
sessionPBAP session.
challengeCallnage received from a remote device in PBAP_EVT_SESSION_AUTH_REQUESTED event.
passwordPassword ("0000")
Returns
  • TRUE if the function succeeds.
  • FALSE otherwise.
bt_bool bt_pbap_pull_phonebook ( bt_pbap_session_t *  session,
bt_byte  pb_type,
bt_ulong  filter,
bt_byte  format,
bt_uint  max_list_count,
bt_uint  list_start_offset 
)

Pull a phonebook from a remote device.

This function pulls a phonebook from a remote device. VCARDs are stored in bt_pbap_session::vcard_list.

Parameters
sessionPBAP session.
pb_typePhonebook type to pull.
filterA bitmmask that defines witch vCard attributes to pull.
formatThe format of vCard to return.
max_list_countThe maximum number of vCards to return.
list_start_offsetThe first vCard to return.
Returns
  • TRUE if the function succeeds.
  • FALSE otherwise.
bt_bool bt_pbap_pull_vcard ( bt_pbap_session_t *  session,
bt_byte  pb_type,
bt_byte *  vcard_name,
bt_byte  vcard_name_len,
bt_ulong  filter,
bt_byte  format 
)

Pull a vCard from a remote device.

This function pulls a vCard from a remote device. The vCard is stored in bt_pbap_session::vcard_list.

Parameters
sessionPBAP session.
pb_typePhonebook type to pull.
vcard_namevCard name
vcard_name_lenThe length of the vCard name
filterA bitmmask that defines witch vCard attributes to pull.
formatThe format of vCard to return.
Returns
  • TRUE if the function succeeds.
  • FALSE otherwise.
bt_bool bt_pbap_pull_vcard_listing ( bt_pbap_session_t *  session,
bt_byte  pb_type,
bt_byte  order,
bt_byte  search_attr,
bt_byte *  search_value,
bt_byte  search_value_len,
bt_uint  max_list_count,
bt_uint  list_start_offset 
)

Pull a vCard listing from a remote device.

This function pulls a vCard listing from a remote device. Received vCards are reported to an app via PBAP session callback with PBAP_EVT_SESSION_PHONEBOOK_ENTRY event.

Parameters
sessionPBAP session.
pb_typePhonebook type to pull.
orderSort order.
search_attrThe Id of a vCard attribute which is used to filter the listing.
search_valueThe value of a vCard attribute which is used to filter the listing. Optional.
search_value_lenThe length of the value of a vCard attribute which is used to filter the listing. Not used if search_value is NULL.
max_list_countThe maximum number of VACRDs to return.
list_start_offsetThe first vCard to return.
Returns
  • TRUE if the function succeeds.
  • FALSE otherwise.
void bt_pbap_set_vcard_buffer ( bt_pbap_session_t *  session,
bt_vcard buffer,
bt_uint  buffer_size 
)

Sets a pointer to a vCard buffer.

This function sets a pointer to a buffer that stores VCARDs received from a remote device.

Parameters
sessionPBAP session.
bufferThe vCard buffer.
buffer_sizeThe number of vCards that can be stored in the buffer.