Bug 1042691: Asynchronous AVRCP response interfaces (under bluetooth2/), r=btian

This commit is contained in:
Thomas Zimmermann 2014-07-28 09:52:51 +02:00
parent c3e8519f16
commit 9ce0ff1312
3 changed files with 116 additions and 54 deletions

View File

@ -169,7 +169,7 @@ public:
}
NS_ENSURE_TRUE(sBtAvrcpInterface, NS_OK);
sBtAvrcpInterface->GetElementAttrRsp(mNumAttr, attrs);
sBtAvrcpInterface->GetElementAttrRsp(mNumAttr, attrs, nullptr);
return NS_OK;
}
@ -1136,7 +1136,7 @@ BluetoothA2dpManager::UpdateMetaData(const nsAString& aTitle,
mTrackChangedNotifyType = BTRC_NOTIFICATION_TYPE_CHANGED;
sBtAvrcpInterface->RegisterNotificationRsp(BTRC_EVT_TRACK_CHANGE,
BTRC_NOTIFICATION_TYPE_CHANGED,
&param);
&param, nullptr);
if (mPlayPosChangedNotifyType == BTRC_NOTIFICATION_TYPE_INTERIM) {
param.song_pos = mPosition;
// EVENT_PLAYBACK_POS_CHANGED shall be notified if changed current track
@ -1144,7 +1144,7 @@ BluetoothA2dpManager::UpdateMetaData(const nsAString& aTitle,
sBtAvrcpInterface->RegisterNotificationRsp(
BTRC_EVT_PLAY_POS_CHANGED,
BTRC_NOTIFICATION_TYPE_CHANGED,
&param);
&param, nullptr);
}
}
@ -1172,7 +1172,7 @@ BluetoothA2dpManager::UpdatePlayStatus(uint32_t aDuration,
NS_ENSURE_TRUE_VOID(sBtAvrcpInterface);
// always update playstatus first
sBtAvrcpInterface->GetPlayStatusRsp((btrc_play_status_t)aPlayStatus,
aDuration, aPosition);
aDuration, aPosition, nullptr);
// when play status changed, send both play status and position
if (mPlayStatus != aPlayStatus &&
mPlayStatusChangedNotifyType == BTRC_NOTIFICATION_TYPE_INTERIM) {
@ -1181,7 +1181,7 @@ BluetoothA2dpManager::UpdatePlayStatus(uint32_t aDuration,
mPlayStatusChangedNotifyType = BTRC_NOTIFICATION_TYPE_CHANGED;
sBtAvrcpInterface->RegisterNotificationRsp(BTRC_EVT_PLAY_STATUS_CHANGED,
BTRC_NOTIFICATION_TYPE_CHANGED,
&param);
&param, nullptr);
}
if (mPosition != aPosition &&
@ -1191,7 +1191,7 @@ BluetoothA2dpManager::UpdatePlayStatus(uint32_t aDuration,
mPlayPosChangedNotifyType = BTRC_NOTIFICATION_TYPE_CHANGED;
sBtAvrcpInterface->RegisterNotificationRsp(BTRC_EVT_PLAY_POS_CHANGED,
BTRC_NOTIFICATION_TYPE_CHANGED,
&param);
&param, nullptr);
}
mDuration = aDuration;
@ -1259,7 +1259,7 @@ BluetoothA2dpManager::UpdateRegisterNotification(int aEventId, int aParam)
sBtAvrcpInterface->RegisterNotificationRsp((btrc_event_id_t)aEventId,
BTRC_NOTIFICATION_TYPE_INTERIM,
&param);
&param, nullptr);
#endif
}

View File

@ -1015,64 +1015,118 @@ BluetoothAvrcpInterface::Cleanup(BluetoothAvrcpResultHandler* aRes)
}
}
bt_status_t
void
BluetoothAvrcpInterface::GetPlayStatusRsp(btrc_play_status_t aPlayStatus,
uint32_t aSongLen, uint32_t aSongPos)
uint32_t aSongLen, uint32_t aSongPos,
BluetoothAvrcpResultHandler* aRes)
{
return mInterface->get_play_status_rsp(aPlayStatus, aSongLen, aSongPos);
bt_status_t status = mInterface->get_play_status_rsp(aPlayStatus, aSongLen,
aSongPos);
if (aRes) {
DispatchBluetoothAvrcpResult(
aRes, &BluetoothAvrcpResultHandler::GetPlayStatusRsp, status);
}
}
bt_status_t
BluetoothAvrcpInterface::ListPlayerAppAttrRsp(int aNumAttr,
btrc_player_attr_t* aPAttrs)
void
BluetoothAvrcpInterface::ListPlayerAppAttrRsp(
int aNumAttr, btrc_player_attr_t* aPAttrs,
BluetoothAvrcpResultHandler* aRes)
{
return mInterface->list_player_app_attr_rsp(aNumAttr, aPAttrs);
bt_status_t status = mInterface->list_player_app_attr_rsp(aNumAttr, aPAttrs);
if (aRes) {
DispatchBluetoothAvrcpResult(
aRes, &BluetoothAvrcpResultHandler::ListPlayerAppAttrRsp, status);
}
}
bt_status_t
BluetoothAvrcpInterface::ListPlayerAppValueRsp(int aNumVal, uint8_t* aPVals)
void
BluetoothAvrcpInterface::ListPlayerAppValueRsp(
int aNumVal, uint8_t* aPVals, BluetoothAvrcpResultHandler* aRes)
{
return mInterface->list_player_app_value_rsp(aNumVal, aPVals);
bt_status_t status = mInterface->list_player_app_value_rsp(aNumVal, aPVals);
if (aRes) {
DispatchBluetoothAvrcpResult(
aRes, &BluetoothAvrcpResultHandler::ListPlayerAppValueRsp, status);
}
}
bt_status_t
BluetoothAvrcpInterface::GetPlayerAppValueRsp(btrc_player_settings_t* aPVals)
void
BluetoothAvrcpInterface::GetPlayerAppValueRsp(
btrc_player_settings_t* aPVals, BluetoothAvrcpResultHandler* aRes)
{
return mInterface->get_player_app_value_rsp(aPVals);
bt_status_t status = mInterface->get_player_app_value_rsp(aPVals);
if (aRes) {
DispatchBluetoothAvrcpResult(
aRes, &BluetoothAvrcpResultHandler::GetPlayerAppValueRsp, status);
}
}
bt_status_t
BluetoothAvrcpInterface::GetPlayerAppAttrTextRsp(int aNumAttr,
btrc_player_setting_text_t* aPAttrs)
void
BluetoothAvrcpInterface::GetPlayerAppAttrTextRsp(
int aNumAttr, btrc_player_setting_text_t* aPAttrs,
BluetoothAvrcpResultHandler* aRes)
{
return mInterface->get_player_app_attr_text_rsp(aNumAttr, aPAttrs);
bt_status_t status = mInterface->get_player_app_attr_text_rsp(aNumAttr,
aPAttrs);
if (aRes) {
DispatchBluetoothAvrcpResult(
aRes, &BluetoothAvrcpResultHandler::GetPlayerAppAttrTextRsp, status);
}
}
bt_status_t
BluetoothAvrcpInterface::GetPlayerAppValueTextRsp(int aNumVal,
btrc_player_setting_text_t* aPVals)
void
BluetoothAvrcpInterface::GetPlayerAppValueTextRsp(
int aNumVal, btrc_player_setting_text_t* aPVals,
BluetoothAvrcpResultHandler* aRes)
{
return mInterface->get_player_app_value_text_rsp(aNumVal, aPVals);
bt_status_t status = mInterface->get_player_app_value_text_rsp(aNumVal,
aPVals);
if (aRes) {
DispatchBluetoothAvrcpResult(
aRes, &BluetoothAvrcpResultHandler::GetPlayerAppValueTextRsp, status);
}
}
bt_status_t
BluetoothAvrcpInterface::GetElementAttrRsp(uint8_t aNumAttr,
btrc_element_attr_val_t* aPAttrs)
void
BluetoothAvrcpInterface::GetElementAttrRsp(
uint8_t aNumAttr, btrc_element_attr_val_t* aPAttrs,
BluetoothAvrcpResultHandler* aRes)
{
return mInterface->get_element_attr_rsp(aNumAttr, aPAttrs);
bt_status_t status = mInterface->get_element_attr_rsp(aNumAttr, aPAttrs);
if (aRes) {
DispatchBluetoothAvrcpResult(
aRes, &BluetoothAvrcpResultHandler::GetElementAttrRsp, status);
}
}
bt_status_t
BluetoothAvrcpInterface::SetPlayerAppValueRsp(btrc_status_t aRspStatus)
void
BluetoothAvrcpInterface::SetPlayerAppValueRsp(
btrc_status_t aRspStatus, BluetoothAvrcpResultHandler* aRes)
{
return mInterface->set_player_app_value_rsp(aRspStatus);
bt_status_t status = mInterface->set_player_app_value_rsp(aRspStatus);
if (aRes) {
DispatchBluetoothAvrcpResult(
aRes, &BluetoothAvrcpResultHandler::SetPlayerAppValueRsp, status);
}
}
bt_status_t
BluetoothAvrcpInterface::RegisterNotificationRsp(btrc_event_id_t aEventId,
btrc_notification_type_t aType, btrc_register_notification_t* aPParam)
void
BluetoothAvrcpInterface::RegisterNotificationRsp(
btrc_event_id_t aEventId, btrc_notification_type_t aType,
btrc_register_notification_t* aPParam, BluetoothAvrcpResultHandler* aRes)
{
return mInterface->register_notification_rsp(aEventId, aType, aPParam);
bt_status_t status = mInterface->register_notification_rsp(aEventId, aType,
aPParam);
if (aRes) {
DispatchBluetoothAvrcpResult(
aRes, &BluetoothAvrcpResultHandler::RegisterNotificationRsp, status);
}
}
bt_status_t

View File

@ -268,26 +268,34 @@ public:
BluetoothAvrcpResultHandler* aRes);
void Cleanup(BluetoothAvrcpResultHandler* aRes);
bt_status_t GetPlayStatusRsp(btrc_play_status_t aPlayStatus,
uint32_t aSongLen, uint32_t aSongPos);
void GetPlayStatusRsp(btrc_play_status_t aPlayStatus,
uint32_t aSongLen, uint32_t aSongPos,
BluetoothAvrcpResultHandler* aRes);
bt_status_t ListPlayerAppAttrRsp(int aNumAttr, btrc_player_attr_t* aPAttrs);
bt_status_t ListPlayerAppValueRsp(int aNumVal, uint8_t* aPVals);
void ListPlayerAppAttrRsp(int aNumAttr, btrc_player_attr_t* aPAttrs,
BluetoothAvrcpResultHandler* aRes);
void ListPlayerAppValueRsp(int aNumVal, uint8_t* aPVals,
BluetoothAvrcpResultHandler* aRes);
bt_status_t GetPlayerAppValueRsp(btrc_player_settings_t* aPVals);
bt_status_t GetPlayerAppAttrTextRsp(int aNumAttr,
btrc_player_setting_text_t* aPAttrs);
bt_status_t GetPlayerAppValueTextRsp(int aNumVal,
btrc_player_setting_text_t* aPVals);
void GetPlayerAppValueRsp(btrc_player_settings_t* aPVals,
BluetoothAvrcpResultHandler* aRes);
void GetPlayerAppAttrTextRsp(int aNumAttr,
btrc_player_setting_text_t* aPAttrs,
BluetoothAvrcpResultHandler* aRes);
void GetPlayerAppValueTextRsp(int aNumVal,
btrc_player_setting_text_t* aPVals,
BluetoothAvrcpResultHandler* aRes);
bt_status_t GetElementAttrRsp(uint8_t aNumAttr,
btrc_element_attr_val_t* aPAttrs);
void GetElementAttrRsp(uint8_t aNumAttr, btrc_element_attr_val_t* aPAttrs,
BluetoothAvrcpResultHandler* aRes);
bt_status_t SetPlayerAppValueRsp(btrc_status_t aRspStatus);
void SetPlayerAppValueRsp(btrc_status_t aRspStatus,
BluetoothAvrcpResultHandler* aRes);
bt_status_t RegisterNotificationRsp(btrc_event_id_t aEventId,
btrc_notification_type_t aType,
btrc_register_notification_t* aPParam);
void RegisterNotificationRsp(btrc_event_id_t aEventId,
btrc_notification_type_t aType,
btrc_register_notification_t* aPParam,
BluetoothAvrcpResultHandler* aRes);
bt_status_t SetVolume(uint8_t aVolume);