static void cb_avrcp_get_element_attr(uint8_t num_attr, btrc_media_attr_t *p_attrs, bt_bdaddr_t *bd_addr);
static void cb_avrcp_register_notification(btrc_event_id_t event_id, uint32_t param, bt_bdaddr_t *bd_addr);
static void cb_avrcp_volume_change(uint8_t volume, uint8_t ctype, bt_bdaddr_t *bd_addr);
+static void cb_avrcp_delay_change(uint16_t delay, bt_bdaddr_t *bd_addr);
static void cb_avrcp_passthrough_command(int id, int pressed, bt_bdaddr_t *bd_addr);
typedef struct {
static const btrc_interface_t *avrcp_api;
static btrc_callbacks_t sBluetoothAvrcpCallbacks = {
- sizeof(sBluetoothAvrcpCallbacks),
+ .size = sizeof(sBluetoothAvrcpCallbacks),
#ifdef TIZEN_BT_HAL
- cb_connection_state,
+ .connection_state_cb = cb_connection_state,
#endif
- cb_avrcp_remote_features,
- cb_avrcp_get_play_status,
- NULL, /* cb_avrcp_list_player_app_attr, */
- NULL, /* cb_avrcp_list_player_app_values, */
- NULL, /* cb_avrcp_get_player_app_value, */
- NULL, /* cb_avrcp_get_player_app_attrs_text, */
- NULL, /* cb_avrcp_get_player_app_values_text, */
- cb_avrcp_set_player_app_value,
- cb_avrcp_get_element_attr,
- cb_avrcp_register_notification,
- cb_avrcp_volume_change,
- cb_avrcp_passthrough_command,
- NULL, /* cb_avrcp_set_addressed_player, */
- NULL, /* cb_avrcp_set_browsed_player, */
- NULL, /* cb_avrcp_get_folder_items, */
- NULL, /* cb_avrcp_change_path, */
- NULL, /* cb_avrcp_get_item_attr, */
- NULL, /* cb_avrcp_play_item, */
- NULL, /* cb_avrcp_get_total_num_of_items, */
- NULL, /* cb_avrcp_search, */
- NULL, /* cb_avrcp_add_to_now_playing, */
+ .remote_features_cb = cb_avrcp_remote_features,
+ .get_play_status_cb = cb_avrcp_get_play_status,
+ .list_player_app_attr_cb = NULL,
+ .list_player_app_values_cb = NULL,
+ .get_player_app_value_cb = NULL,
+ .get_player_app_attrs_text_cb = NULL,
+ .get_player_app_values_text_cb = NULL,
+ .set_player_app_value_cb = cb_avrcp_set_player_app_value,
+ .get_element_attr_cb = cb_avrcp_get_element_attr,
+ .register_notification_cb = cb_avrcp_register_notification,
+ .volume_change_cb = cb_avrcp_volume_change,
+ .delay_change_cb = cb_avrcp_delay_change,
+ .passthrough_cmd_cb = cb_avrcp_passthrough_command,
+ .set_addressed_player_cb = NULL,
+ .set_browsed_player_cb = NULL,
+ .get_folder_items_cb = NULL,
+ .change_path_cb = NULL,
+ .get_item_attr_cb = NULL,
+ .play_item_cb = NULL,
+ .get_total_num_of_items_cb = NULL,
+ .search_cb = NULL,
+ .add_to_now_playing_cb = NULL,
};
static void send_pos_changed(void)
int ret;
btrc_register_notification_t response;
+ memset(&response, 0x00, sizeof(btrc_register_notification_t));
+
track_info.cur_track = meta_data->number;
/* Send Track Change notification */
- memcpy(&response.track, &track_info.cur_track, BTRC_UID_SIZE);
+ memcpy(&response.track, &track_info.cur_track, sizeof(uint32_t));
ret = avrcp_api->register_notification_rsp(
BTRC_EVT_TRACK_CHANGE, BTRC_NOTIFICATION_TYPE_CHANGED, &response);
if (ret != BT_STATUS_SUCCESS)
return OAL_STATUS_SUCCESS;
}
+oal_status_t avrcp_tg_set_volume(bt_address_t *rem_addr, unsigned int volume)
+{
+ int result = OAL_STATUS_SUCCESS;
+ bt_status_t status;
+ bdstr_t bdstr;
+
+ API_TRACE();
+
+ CHECK_OAL_AVRCP_ENABLED();
+ OAL_CHECK_PARAMETER(rem_addr, return);
+
+ BT_INFO("BT Audio Address: %s", bdt_bd2str(rem_addr, &bdstr));
+
+#ifdef TIZEN_BT_HAL
+ status = avrcp_api->set_volume((bt_bdaddr_t *)rem_addr, volume);
+ if ((status != BT_STATUS_SUCCESS) && (status != BT_STATUS_DONE)) {
+ BT_ERR("set volume failed, err: %s", status2string(status));;
+ result = convert_to_oal_status(status);
+ }
+#else
+ BT_INFO("Not Supported");
+ result = OAL_STATUS_NOT_SUPPORT;
+#endif
+
+ return result;
+}
+
+oal_status_t avrcp_tg_get_volume(bt_address_t *rem_addr, unsigned int *volume)
+{
+ int result = OAL_STATUS_SUCCESS;
+ bt_status_t status;
+ bdstr_t bdstr;
+
+ API_TRACE();
+
+ CHECK_OAL_AVRCP_ENABLED();
+ OAL_CHECK_PARAMETER(rem_addr, return);
+
+ BT_INFO("BT Audio Address: %s", bdt_bd2str(rem_addr, &bdstr));
+
+#ifdef TIZEN_BT_HAL
+ status = avrcp_api->get_volume((bt_bdaddr_t *)rem_addr, volume);
+ if ((status != BT_STATUS_SUCCESS) && (status != BT_STATUS_DONE)) {
+ BT_ERR("set volume failed, err: %s", status2string(status));;
+ result = convert_to_oal_status(status);
+ }
+#else
+ BT_INFO("Not Supported");
+ result = OAL_STATUS_NOT_SUPPORT;
+#endif
+
+ return result;
+}
+
+
#ifdef TIZEN_BT_HAL
static void cb_connection_state(bt_bdaddr_t* bd_addr, btrc_connection_state_t state)
{
BT_ERR("AVRCP Not Enabled");
return ;
}
+ memset(&response, 0x00, sizeof(btrc_register_notification_t));
switch (event_id) {
case BTRC_EVT_PLAY_STATUS_CHANGED:
break;
case BTRC_EVT_TRACK_CHANGE:
registered_notifications.track_change = 1;
- memcpy(response.track, &track_info.cur_track, BTRC_UID_SIZE);
+ memcpy(response.track, &track_info.cur_track, sizeof(uint32_t));
ret = avrcp_api->register_notification_rsp(
BTRC_EVT_TRACK_CHANGE, BTRC_NOTIFICATION_TYPE_INTERIM, &response);
break;
avrcp_volume_mute, sizeof(oal_avrcp_volume_mute_t));
}
+static void cb_avrcp_delay_change(uint16_t delay, bt_bdaddr_t *bd_addr)
+{
+ BT_INFO("Delay : %d", delay);
+ oal_avrcp_delay_t *avrcp_delay = g_new0(oal_avrcp_delay_t, 1);
+ avrcp_delay->delay = delay;
+
+ send_event(OAL_EVENT_AVRCP_DELAY_CHANGED,
+ avrcp_delay, sizeof(oal_avrcp_delay_t));
+}
+
static void cb_avrcp_passthrough_command(int id, int key_state, bt_bdaddr_t *bd_addr)
{
BT_DBG("id: %d, key_state: %d", id, key_state);