зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1142408 - Add data length parameter for Register Notification Response Command. r=tzimmermann
This commit is contained in:
Родитель
8610c13659
Коммит
528865edc6
|
@ -265,8 +265,9 @@ BluetoothDaemonAvrcpModule::RegisterNotificationRspCmd(
|
||||||
1 + // Data length
|
1 + // Data length
|
||||||
256)); // Maximum data length
|
256)); // Maximum data length
|
||||||
|
|
||||||
nsresult rv = PackPDU(aEvent, aType,
|
BluetoothAvrcpEventParamPair data(aEvent, aParam);
|
||||||
BluetoothAvrcpEventParamPair(aEvent, aParam), *pdu);
|
nsresult rv = PackPDU(aEvent, aType, static_cast<uint8_t>(data.GetLength()),
|
||||||
|
data, *pdu);
|
||||||
if (NS_FAILED(rv)) {
|
if (NS_FAILED(rv)) {
|
||||||
return rv;
|
return rv;
|
||||||
}
|
}
|
||||||
|
|
|
@ -85,6 +85,37 @@ struct BluetoothAvrcpEventParamPair {
|
||||||
, mParam(aParam)
|
, mParam(aParam)
|
||||||
{ }
|
{ }
|
||||||
|
|
||||||
|
size_t GetLength()
|
||||||
|
{
|
||||||
|
size_t size;
|
||||||
|
|
||||||
|
switch(mEvent) {
|
||||||
|
case AVRCP_EVENT_PLAY_STATUS_CHANGED:
|
||||||
|
/* PackPDU casts ControlPlayStatus to uint8_t */
|
||||||
|
size = sizeof(static_cast<uint8_t>(mParam.mPlayStatus));
|
||||||
|
break;
|
||||||
|
case AVRCP_EVENT_TRACK_CHANGE:
|
||||||
|
size = sizeof(mParam.mTrack);
|
||||||
|
break;
|
||||||
|
case AVRCP_EVENT_TRACK_REACHED_END:
|
||||||
|
case AVRCP_EVENT_TRACK_REACHED_START:
|
||||||
|
/* no data to pack */
|
||||||
|
size = 0;
|
||||||
|
break;
|
||||||
|
case AVRCP_EVENT_PLAY_POS_CHANGED:
|
||||||
|
size = sizeof(mParam.mSongPos);
|
||||||
|
break;
|
||||||
|
case AVRCP_EVENT_APP_SETTINGS_CHANGED:
|
||||||
|
size = (sizeof(mParam.mIds[0]) + sizeof(mParam.mValues[0])) * mParam.mNumAttr;
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
size = 0;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
return size;
|
||||||
|
}
|
||||||
|
|
||||||
BluetoothAvrcpEvent mEvent;
|
BluetoothAvrcpEvent mEvent;
|
||||||
const BluetoothAvrcpNotificationParam& mParam;
|
const BluetoothAvrcpNotificationParam& mParam;
|
||||||
};
|
};
|
||||||
|
|
Загрузка…
Ссылка в новой задаче