typedef struct
{
btgatt_srvc_id_t srvc_id;
- btgatt_char_id_t char_id;
- bt_uuid_t descr_id;
+ btgatt_gatt_id_t char_id;
+ btgatt_gatt_id_t descr_id;
btgatt_unformatted_value_t value;
uint16_t value_type;
uint8_t status;
typedef struct
{
btgatt_srvc_id_t srvc_id;
- btgatt_char_id_t char_id;
- bt_uuid_t descr_id;
+ btgatt_gatt_id_t char_id;
+ btgatt_gatt_id_t descr_id;
uint8_t status;
} btgatt_write_params_t;
uint8_t value[BTGATT_MAX_ATTR_LEN];
bt_bdaddr_t bda;
btgatt_srvc_id_t srvc_id;
- btgatt_char_id_t char_id;
+ btgatt_gatt_id_t char_id;
uint16_t len;
uint8_t is_notify;
} btgatt_notify_params_t;
/** GATT characteristic enumeration result callback */
typedef void (*get_characteristic_callback)(int conn_id, int status,
- btgatt_srvc_id_t *srvc_id, btgatt_char_id_t *char_id,
+ btgatt_srvc_id_t *srvc_id, btgatt_gatt_id_t *char_id,
int char_prop);
/** GATT descriptor enumeration result callback */
typedef void (*get_descriptor_callback)(int conn_id, int status,
- btgatt_srvc_id_t *srvc_id, btgatt_char_id_t *char_id,
- bt_uuid_t *descr_id);
+ btgatt_srvc_id_t *srvc_id, btgatt_gatt_id_t *char_id,
+ btgatt_gatt_id_t *descr_id);
/** GATT included service enumeration result callback */
typedef void (*get_included_service_callback)(int conn_id, int status,
/** Callback invoked in response to [de]register_for_notification */
typedef void (*register_for_notification_callback)(int conn_id,
int registered, int status, btgatt_srvc_id_t *srvc_id,
- btgatt_char_id_t *char_id);
+ btgatt_gatt_id_t *char_id);
/**
* Remote device notification callback, invoked when a remote device sends
typedef void (*read_remote_rssi_callback)(int client_if, bt_bdaddr_t* bda,
int rssi, int status);
+/**
+ * Callback indicationg the status of a listen() operation
+ */
+typedef void (*listen_callback)(int status, int server_if);
+
typedef struct {
register_client_callback register_client_cb;
scan_result_callback scan_result_cb;
write_descriptor_callback write_descriptor_cb;
execute_write_callback execute_write_cb;
read_remote_rssi_callback read_remote_rssi_cb;
+ listen_callback listen_cb;
} btgatt_client_callbacks_t;
/** Represents the standard BT-GATT client interface. */
bt_status_t (*disconnect)( int client_if, const bt_bdaddr_t *bd_addr,
int conn_id);
+ /** Start or stop advertisements to listen for incoming connections */
+ bt_status_t (*listen)(int client_if, bool start);
+
/** Clear the attribute cache for a given device */
bt_status_t (*refresh)( int client_if, const bt_bdaddr_t *bd_addr );
* Set start_char_id to NULL to get the first characteristic.
*/
bt_status_t (*get_characteristic)( int conn_id,
- btgatt_srvc_id_t *srvc_id, btgatt_char_id_t *start_char_id);
+ btgatt_srvc_id_t *srvc_id, btgatt_gatt_id_t *start_char_id);
/**
* Enumerate descriptors for a given characteristic.
* Set start_descr_id to NULL to get the first descriptor.
*/
bt_status_t (*get_descriptor)( int conn_id,
- btgatt_srvc_id_t *srvc_id, btgatt_char_id_t *char_id,
- bt_uuid_t *start_descr_id);
+ btgatt_srvc_id_t *srvc_id, btgatt_gatt_id_t *char_id,
+ btgatt_gatt_id_t *start_descr_id);
/** Read a characteristic on a remote device */
bt_status_t (*read_characteristic)( int conn_id,
- btgatt_srvc_id_t *srvc_id, btgatt_char_id_t *char_id,
+ btgatt_srvc_id_t *srvc_id, btgatt_gatt_id_t *char_id,
int auth_req );
/** Write a remote characteristic */
bt_status_t (*write_characteristic)(int conn_id,
- btgatt_srvc_id_t *srvc_id, btgatt_char_id_t *char_id,
+ btgatt_srvc_id_t *srvc_id, btgatt_gatt_id_t *char_id,
int write_type, int len, int auth_req,
char* p_value);
/** Read the descriptor for a given characteristic */
bt_status_t (*read_descriptor)(int conn_id,
- btgatt_srvc_id_t *srvc_id, btgatt_char_id_t *char_id,
- bt_uuid_t *descr_id, int auth_req);
+ btgatt_srvc_id_t *srvc_id, btgatt_gatt_id_t *char_id,
+ btgatt_gatt_id_t *descr_id, int auth_req);
/** Write a remote descriptor for a given characteristic */
bt_status_t (*write_descriptor)( int conn_id,
- btgatt_srvc_id_t *srvc_id, btgatt_char_id_t *char_id,
- bt_uuid_t *descr_id, int write_type, int len,
+ btgatt_srvc_id_t *srvc_id, btgatt_gatt_id_t *char_id,
+ btgatt_gatt_id_t *descr_id, int write_type, int len,
int auth_req, char* p_value);
/** Execute a prepared write operation */
*/
bt_status_t (*register_for_notification)( int client_if,
const bt_bdaddr_t *bd_addr, btgatt_srvc_id_t *srvc_id,
- btgatt_char_id_t *char_id);
+ btgatt_gatt_id_t *char_id);
/** Deregister a previous request for notifications/indications */
bt_status_t (*deregister_for_notification)( int client_if,
const bt_bdaddr_t *bd_addr, btgatt_srvc_id_t *srvc_id,
- btgatt_char_id_t *char_id);
+ btgatt_gatt_id_t *char_id);
/** Request RSSI for a given remote device */
bt_status_t (*read_remote_rssi)( int client_if, const bt_bdaddr_t *bd_addr);
/** Determine the type of the remote device (LE, BR/EDR, Dual-mode) */
int (*get_device_type)( const bt_bdaddr_t *bd_addr );
+ /** Set the advertising data or scan response data */
+ bt_status_t (*set_adv_data)(int server_if, bool set_scan_rsp, bool include_name,
+ bool include_txpower, int min_interval, int max_interval, int appearance,
+ uint16_t manufacturer_len, char* manufacturer_data);
+
/** Test mode interface */
bt_status_t (*test_command)( int command, btgatt_test_params_t* params);
} btgatt_client_interface_t;
typedef uint8_t btrc_uid_t[BTRC_UID_SIZE];
typedef enum {
+ BTRC_FEAT_NONE = 0x00, /* AVRCP 1.0 */
+ BTRC_FEAT_METADATA = 0x01, /* AVRCP 1.3 */
+ BTRC_FEAT_ABSOLUTE_VOLUME = 0x02, /* Supports TG role and volume sync */
+ BTRC_FEAT_BROWSE = 0x04, /* AVRCP 1.4 and up, with Browsing support */
+} btrc_remote_features_t;
+
+typedef enum {
BTRC_PLAYSTATE_STOPPED = 0x00, /* Stopped */
BTRC_PLAYSTATE_PLAYING = 0x01, /* Playing */
BTRC_PLAYSTATE_PAUSED = 0x02, /* Paused */
uint8_t text[BTRC_MAX_ATTR_STR_LEN];
} btrc_element_attr_val_t;
+/** Callback for the controller's supported feautres */
+typedef void (* btrc_remote_features_callback)(bt_bdaddr_t *bd_addr,
+ btrc_remote_features_t features);
+
/** Callback for play status request */
typedef void (* btrc_get_play_status_callback)();
*/
typedef void (* btrc_register_notification_callback) (btrc_event_id_t event_id, uint32_t param);
+/* AVRCP 1.4 Enhancements */
+/** Callback for volume change on CT
+** volume: Current volume setting on the CT (0-127)
+*/
+typedef void (* btrc_volume_change_callback) (uint8_t volume, uint8_t ctype);
+
+/** Callback for passthrough commands */
+typedef void (* btrc_passthrough_cmd_callback) (int id, int key_state);
+
/** BT-RC callback structure. */
typedef struct {
/** set to sizeof(BtRcCallbacks) */
size_t size;
+ btrc_remote_features_callback remote_features_cb;
btrc_get_play_status_callback get_play_status_cb;
btrc_list_player_app_attr_callback list_player_app_attr_cb;
btrc_list_player_app_values_callback list_player_app_values_cb;
btrc_set_player_app_value_callback set_player_app_value_cb;
btrc_get_element_attr_callback get_element_attr_cb;
btrc_register_notification_callback register_notification_cb;
+ btrc_volume_change_callback volume_change_cb;
+ btrc_passthrough_cmd_callback passthrough_cmd_cb;
} btrc_callbacks_t;
/** Represents the standard BT-RC interface. */
btrc_notification_type_t type,
btrc_register_notification_t *p_param);
+ /* AVRCP 1.4 enhancements */
+
+ /**Send current volume setting to remote side. Support limited to SetAbsoluteVolume
+ ** This can be enhanced to support Relative Volume (AVRCP 1.0).
+ ** With RelateVolume, we will send VOLUME_UP/VOLUME_DOWN opposed to absolute volume level
+ ** volume: Should be in the range 0-127. bit7 is reseved and cannot be set
+ */
+ bt_status_t (*set_volume)(uint8_t volume);
+
/** Closes the interface. */
void (*cleanup)( void );
} btrc_interface_t;