diff --git a/dom/bluetooth/bluedroid/BluetoothDaemonHelpers.cpp b/dom/bluetooth/bluedroid/BluetoothDaemonHelpers.cpp index d69a10ceeec..31672134362 100644 --- a/dom/bluetooth/bluedroid/BluetoothDaemonHelpers.cpp +++ b/dom/bluetooth/bluedroid/BluetoothDaemonHelpers.cpp @@ -69,6 +69,39 @@ Convert(int aIn, int16_t& aOut) return NS_OK; } +nsresult +Convert(int32_t aIn, BluetoothDeviceType& aOut) +{ + static const BluetoothDeviceType sDeviceType[] = { + CONVERT(0x00, static_cast(0)), // invalid, required by gcc + CONVERT(0x01, DEVICE_TYPE_BREDR), + CONVERT(0x02, DEVICE_TYPE_BLE), + CONVERT(0x03, DEVICE_TYPE_DUAL) + }; + if (NS_WARN_IF(!aIn) || + NS_WARN_IF(static_cast(aIn) >= MOZ_ARRAY_LENGTH(sDeviceType))) { + return NS_ERROR_ILLEGAL_VALUE; + } + aOut = sDeviceType[aIn]; + return NS_OK; +} + +nsresult +Convert(int32_t aIn, BluetoothScanMode& aOut) +{ + static const BluetoothScanMode sScanMode[] = { + CONVERT(0x00, SCAN_MODE_NONE), + CONVERT(0x01, SCAN_MODE_CONNECTABLE), + CONVERT(0x02, SCAN_MODE_CONNECTABLE_DISCOVERABLE) + }; + if (NS_WARN_IF(aIn < 0) || + NS_WARN_IF(static_cast(aIn) >= MOZ_ARRAY_LENGTH(sScanMode))) { + return NS_ERROR_ILLEGAL_VALUE; + } + aOut = sScanMode[aIn]; + return NS_OK; +} + nsresult Convert(uint8_t aIn, bool& aOut) { @@ -97,6 +130,13 @@ Convert(uint8_t aIn, int& aOut) return NS_OK; } +nsresult +Convert(uint8_t aIn, unsigned long& aOut) +{ + aOut = static_cast(aIn); + return NS_OK; +} + nsresult Convert(uint8_t aIn, BluetoothA2dpAudioState& aOut) { @@ -142,6 +182,93 @@ Convert(uint8_t aIn, BluetoothAclState& aOut) return NS_OK; } +nsresult +Convert(uint8_t aIn, BluetoothAvrcpEvent& aOut) +{ + static const BluetoothAvrcpEvent sAvrcpEvent[] = { + CONVERT(0x00, static_cast(0)), + CONVERT(0x01, AVRCP_EVENT_PLAY_STATUS_CHANGED), + CONVERT(0x02, AVRCP_EVENT_TRACK_CHANGE), + CONVERT(0x03, AVRCP_EVENT_TRACK_REACHED_END), + CONVERT(0x04, AVRCP_EVENT_TRACK_REACHED_START), + CONVERT(0x05, AVRCP_EVENT_PLAY_POS_CHANGED), + CONVERT(0x06, static_cast(0)), + CONVERT(0x07, static_cast(0)), + CONVERT(0x08, AVRCP_EVENT_APP_SETTINGS_CHANGED) + }; + if (NS_WARN_IF(!aIn) || + NS_WARN_IF(aIn == 0x06) || + NS_WARN_IF(aIn == 0x07) || + NS_WARN_IF(aIn >= MOZ_ARRAY_LENGTH(sAvrcpEvent))) { + aOut = static_cast(0); // silences compiler warning + return NS_ERROR_ILLEGAL_VALUE; + } + aOut = sAvrcpEvent[aIn]; + return NS_OK; +} + +nsresult +Convert(uint8_t aIn, BluetoothAvrcpMediaAttribute& aOut) +{ + static const BluetoothAvrcpMediaAttribute sAvrcpMediaAttribute[] = { + CONVERT(0x00, static_cast(0)), + CONVERT(0x01, AVRCP_MEDIA_ATTRIBUTE_TITLE), + CONVERT(0x02, AVRCP_MEDIA_ATTRIBUTE_ARTIST), + CONVERT(0x03, AVRCP_MEDIA_ATTRIBUTE_ALBUM), + CONVERT(0x04, AVRCP_MEDIA_ATTRIBUTE_TRACK_NUM), + CONVERT(0x05, AVRCP_MEDIA_ATTRIBUTE_NUM_TRACKS), + CONVERT(0x06, AVRCP_MEDIA_ATTRIBUTE_GENRE), + CONVERT(0x07, AVRCP_MEDIA_ATTRIBUTE_PLAYING_TIME) + }; + if (NS_WARN_IF(!aIn) || + NS_WARN_IF(aIn >= MOZ_ARRAY_LENGTH(sAvrcpMediaAttribute))) { + // silences compiler warning + aOut = static_cast(0); + return NS_ERROR_ILLEGAL_VALUE; + } + aOut = sAvrcpMediaAttribute[aIn]; + return NS_OK; +} + +nsresult +Convert(uint8_t aIn, BluetoothAvrcpPlayerAttribute& aOut) +{ + static const BluetoothAvrcpPlayerAttribute sAvrcpPlayerAttribute[] = { + CONVERT(0x00, static_cast(0)), + CONVERT(0x01, AVRCP_PLAYER_ATTRIBUTE_EQUALIZER), + CONVERT(0x02, AVRCP_PLAYER_ATTRIBUTE_REPEAT), + CONVERT(0x03, AVRCP_PLAYER_ATTRIBUTE_SHUFFLE), + CONVERT(0x04, AVRCP_PLAYER_ATTRIBUTE_SCAN) + }; + if (NS_WARN_IF(!aIn) || + NS_WARN_IF(aIn >= MOZ_ARRAY_LENGTH(sAvrcpPlayerAttribute))) { + // silences compiler warning + aOut = static_cast(0); + return NS_ERROR_ILLEGAL_VALUE; + } + aOut = sAvrcpPlayerAttribute[aIn]; + return NS_OK; +} + +nsresult +Convert(uint8_t aIn, BluetoothAvrcpRemoteFeature& aOut) +{ + static const BluetoothAvrcpRemoteFeature sAvrcpRemoteFeature[] = { + CONVERT(0x00, AVRCP_REMOTE_FEATURE_NONE), + CONVERT(0x01, AVRCP_REMOTE_FEATURE_METADATA), + CONVERT(0x02, AVRCP_REMOTE_FEATURE_ABSOLUTE_VOLUME), + CONVERT(0x03, AVRCP_REMOTE_FEATURE_BROWSE) + }; + if (NS_WARN_IF(!aIn) || + NS_WARN_IF(aIn >= MOZ_ARRAY_LENGTH(sAvrcpRemoteFeature))) { + // silences compiler warning + aOut = static_cast(0); + return NS_ERROR_ILLEGAL_VALUE; + } + aOut = sAvrcpRemoteFeature[aIn]; + return NS_OK; +} + nsresult Convert(uint8_t aIn, BluetoothBondState& aOut) { @@ -248,23 +375,6 @@ Convert(uint8_t aIn, BluetoothHandsfreeVolumeType& aOut) return NS_OK; } -nsresult -Convert(int32_t aIn, BluetoothDeviceType& aOut) -{ - static const BluetoothDeviceType sDeviceType[] = { - CONVERT(0x00, static_cast(0)), // invalid, required by gcc - CONVERT(0x01, DEVICE_TYPE_BREDR), - CONVERT(0x02, DEVICE_TYPE_BLE), - CONVERT(0x03, DEVICE_TYPE_DUAL) - }; - if (NS_WARN_IF(!aIn) || - NS_WARN_IF(static_cast(aIn) >= MOZ_ARRAY_LENGTH(sDeviceType))) { - return NS_ERROR_ILLEGAL_VALUE; - } - aOut = sDeviceType[aIn]; - return NS_OK; -} - nsresult Convert(uint8_t aIn, BluetoothPropertyType& aOut) { @@ -317,22 +427,6 @@ Convert(BluetoothSocketType aIn, uint8_t& aOut) return NS_OK; } -nsresult -Convert(int32_t aIn, BluetoothScanMode& aOut) -{ - static const BluetoothScanMode sScanMode[] = { - CONVERT(0x00, SCAN_MODE_NONE), - CONVERT(0x01, SCAN_MODE_CONNECTABLE), - CONVERT(0x02, SCAN_MODE_CONNECTABLE_DISCOVERABLE) - }; - if (NS_WARN_IF(aIn < 0) || - NS_WARN_IF(static_cast(aIn) >= MOZ_ARRAY_LENGTH(sScanMode))) { - return NS_ERROR_ILLEGAL_VALUE; - } - aOut = sScanMode[aIn]; - return NS_OK; -} - nsresult Convert(uint8_t aIn, BluetoothSspPairingVariant& aOut) { @@ -379,6 +473,18 @@ Convert(uint32_t aIn, int& aOut) return NS_OK; } +nsresult +Convert(uint32_t aIn, uint8_t& aOut) +{ + if (NS_WARN_IF(aIn < std::numeric_limits::min()) || + NS_WARN_IF(aIn > std::numeric_limits::max())) { + aOut = 0; // silences compiler warning + return NS_ERROR_ILLEGAL_VALUE; + } + aOut = static_cast(aIn); + return NS_OK; +} + nsresult Convert(size_t aIn, uint16_t& aOut) { @@ -521,6 +627,50 @@ Convert(const BluetoothAddress& aIn, nsAString& aOut) return NS_OK; } +nsresult +Convert(BluetoothAvrcpEvent aIn, uint8_t& aOut) +{ + static const uint8_t sValue[] = { + CONVERT(AVRCP_EVENT_PLAY_STATUS_CHANGED, 0x01), + CONVERT(AVRCP_EVENT_TRACK_CHANGE, 0x02), + CONVERT(AVRCP_EVENT_TRACK_REACHED_END, 0x03), + CONVERT(AVRCP_EVENT_TRACK_REACHED_START, 0x04), + CONVERT(AVRCP_EVENT_PLAY_POS_CHANGED, 0x05), + CONVERT(AVRCP_EVENT_APP_SETTINGS_CHANGED, 0x08) + }; + if (NS_WARN_IF(aIn >= MOZ_ARRAY_LENGTH(sValue))) { + return NS_ERROR_ILLEGAL_VALUE; + } + aOut = sValue[aIn]; + return NS_OK; +} + +nsresult +Convert(BluetoothAvrcpNotification aIn, uint8_t& aOut) +{ + static const bool sValue[] = { + CONVERT(AVRCP_NTF_INTERIM, 0x00), + CONVERT(AVRCP_NTF_CHANGED, 0x01) + }; + if (NS_WARN_IF(aIn >= MOZ_ARRAY_LENGTH(sValue))) { + return NS_ERROR_ILLEGAL_VALUE; + } + aOut = sValue[aIn]; + return NS_OK; +} + +nsresult +Convert(BluetoothAvrcpRemoteFeature aIn, unsigned long& aOut) +{ + if (NS_WARN_IF(aIn < std::numeric_limits::min()) || + NS_WARN_IF(aIn > std::numeric_limits::max())) { + aOut = 0; // silences compiler warning + return NS_ERROR_ILLEGAL_VALUE; + } + aOut = static_cast(aIn); + return NS_OK; +} + nsresult Convert(BluetoothHandsfreeAtResponse aIn, uint8_t& aOut) { @@ -748,6 +898,30 @@ Convert(BluetoothSspPairingVariant aIn, nsAString& aOut) return NS_OK; } +nsresult +Convert(ControlPlayStatus aIn, uint8_t& aOut) +{ + static const uint8_t sValue[] = { + CONVERT(PLAYSTATUS_STOPPED, 0x00), + CONVERT(PLAYSTATUS_PLAYING, 0x01), + CONVERT(PLAYSTATUS_PAUSED, 0x02), + CONVERT(PLAYSTATUS_FWD_SEEK, 0x03), + CONVERT(PLAYSTATUS_REV_SEEK, 0x04) + }; + if (aIn == PLAYSTATUS_ERROR) { + /* This case is handled separately to not populate + * |sValue| with empty entries. */ + aOut = 0xff; + return NS_OK; + } + if (NS_WARN_IF(aIn >= MOZ_ARRAY_LENGTH(sValue))) { + aOut = 0; // silences compiler warning + return NS_ERROR_ILLEGAL_VALUE; + } + aOut = sValue[aIn]; + return NS_OK; +} + /* |ConvertArray| is a helper for converting arrays. Pass an * instance of this structure as the first argument to |Convert| * to convert an array. The output type has to support the array @@ -798,6 +972,142 @@ PackPDU(const BluetoothAddress& aIn, BluetoothDaemonPDU& aPDU) return PackPDU(PackArray(aIn.mAddr, sizeof(aIn.mAddr)), aPDU); } +nsresult +PackPDU(const BluetoothAvrcpAttributeTextPairs& aIn, + BluetoothDaemonPDU& aPDU) +{ + size_t i; + + for (i = 0; i < aIn.mLength; ++i) { + nsresult rv = PackPDU(aIn.mAttr[i], aPDU); + if (NS_FAILED(rv)) { + return rv; + } + + uint8_t len; + const uint8_t* str; + + if (aIn.mText[i]) { + str = reinterpret_cast(aIn.mText[i]); + len = strlen(aIn.mText[i]) + 1; + } else { + /* write \0 character for NULL strings */ + str = reinterpret_cast("\0"); + len = 1; + } + + rv = PackPDU(len, aPDU); + if (NS_FAILED(rv)) { + return rv; + } + rv = PackPDU(PackArray(str, len), aPDU); + if (NS_FAILED(rv)) { + return rv; + } + } + return NS_OK; +} + +nsresult +PackPDU(const BluetoothAvrcpAttributeValuePairs& aIn, + BluetoothDaemonPDU& aPDU) +{ + size_t i; + + for (i = 0; i < aIn.mLength; ++i) { + nsresult rv = PackPDU(aIn.mAttr[i], aPDU); + if (NS_FAILED(rv)) { + return rv; + } + rv = PackPDU(aIn.mValue[i], aPDU); + if (NS_FAILED(rv)) { + return rv; + } + } + return NS_OK; +} + +nsresult +PackPDU(const BluetoothAvrcpElementAttribute& aIn, BluetoothDaemonPDU& aPDU) +{ + nsresult rv = PackPDU(PackConversion(aIn.mId), aPDU); + if (NS_FAILED(rv)) { + return rv; + } + + const NS_ConvertUTF16toUTF8 cstr(aIn.mValue); + + if (NS_WARN_IF(cstr.Length() == PR_UINT32_MAX)) { + return NS_ERROR_ILLEGAL_VALUE; /* integer overflow detected */ + } + + PRUint32 clen = cstr.Length() + 1; /* include \0 character */ + + rv = PackPDU(PackConversion(clen), aPDU); + if (NS_FAILED(rv)) { + return rv; + } + + return PackPDU( + PackArray(reinterpret_cast(cstr.get()), clen), + aPDU); +} + +nsresult +PackPDU(BluetoothAvrcpEvent aIn, BluetoothDaemonPDU& aPDU) +{ + return PackPDU(PackConversion(aIn), aPDU); +} + +nsresult +PackPDU(const BluetoothAvrcpEventParamPair& aIn, BluetoothDaemonPDU& aPDU) +{ + nsresult rv; + + switch (aIn.mEvent) { + case AVRCP_EVENT_PLAY_STATUS_CHANGED: + rv = PackPDU(aIn.mParam.mPlayStatus, aPDU); + break; + case AVRCP_EVENT_TRACK_CHANGE: + rv = PackPDU(PackArray(aIn.mParam.mTrack, + MOZ_ARRAY_LENGTH(aIn.mParam.mTrack)), + aPDU); + break; + case AVRCP_EVENT_TRACK_REACHED_END: + /* fall through */ + case AVRCP_EVENT_TRACK_REACHED_START: + /* no data to pack */ + rv = NS_OK; + break; + case AVRCP_EVENT_PLAY_POS_CHANGED: + rv = PackPDU(aIn.mParam.mSongPos, aPDU); + break; + case AVRCP_EVENT_APP_SETTINGS_CHANGED: + /* pack number of attribute-value pairs */ + rv = PackPDU(aIn.mParam.mNumAttr, aPDU); + if (NS_FAILED(rv)) { + return rv; + } + /* pack attribute-value pairs */ + rv = PackPDU(BluetoothAvrcpAttributeValuePairs(aIn.mParam.mIds, + aIn.mParam.mValues, + aIn.mParam.mNumAttr), + aPDU); + break; + default: + rv = NS_ERROR_ILLEGAL_VALUE; + break; + } + return rv; +} + +nsresult +PackPDU(BluetoothAvrcpNotification aIn, BluetoothDaemonPDU& aPDU) +{ + return PackPDU( + PackConversion(aIn), aPDU); +} + nsresult PackPDU(const BluetoothConfigurationParameter& aIn, BluetoothDaemonPDU& aPDU) { @@ -949,6 +1259,12 @@ PackPDU(BluetoothSocketType aIn, BluetoothDaemonPDU& aPDU) return PackPDU(PackConversion(aIn), aPDU); } +nsresult +PackPDU(ControlPlayStatus aIn, BluetoothDaemonPDU& aPDU) +{ + return PackPDU(PackConversion(aIn), aPDU); +} + // // Unpacking // @@ -985,6 +1301,56 @@ UnpackPDU(BluetoothDaemonPDU& aPDU, BluetoothAclState& aOut) return UnpackPDU(aPDU, UnpackConversion(aOut)); } +nsresult +UnpackPDU(BluetoothDaemonPDU& aPDU, BluetoothAvrcpEvent& aOut) +{ + return UnpackPDU( + aPDU, UnpackConversion(aOut)); +} + +nsresult +UnpackPDU(BluetoothDaemonPDU& aPDU, BluetoothAvrcpMediaAttribute& aOut) +{ + return UnpackPDU( + aPDU, UnpackConversion(aOut)); +} + +nsresult +UnpackPDU(BluetoothDaemonPDU& aPDU, BluetoothAvrcpPlayerAttribute& aOut) +{ + return UnpackPDU( + aPDU, UnpackConversion(aOut)); +} + +nsresult +UnpackPDU(BluetoothDaemonPDU& aPDU, BluetoothAvrcpPlayerSettings& aOut) +{ + /* Read number of attribute-value pairs */ + nsresult rv = UnpackPDU(aPDU, aOut.mNumAttr); + if (NS_FAILED(rv)) { + return rv; + } + /* Read attribute-value pairs */ + for (uint8_t i = 0; i < aOut.mNumAttr; ++i) { + nsresult rv = UnpackPDU(aPDU, aOut.mIds[i]); + if (NS_FAILED(rv)) { + return rv; + } + rv = UnpackPDU(aPDU, aOut.mValues[i]); + if (NS_FAILED(rv)) { + return rv; + } + } + return NS_OK; +} + +nsresult +UnpackPDU(BluetoothDaemonPDU& aPDU, BluetoothAvrcpRemoteFeature& aOut) +{ + return UnpackPDU( + aPDU, UnpackConversion(aOut)); +} + nsresult UnpackPDU(BluetoothDaemonPDU& aPDU, BluetoothBondState& aOut) { diff --git a/dom/bluetooth/bluedroid/BluetoothDaemonHelpers.h b/dom/bluetooth/bluedroid/BluetoothDaemonHelpers.h index a890ea19afc..c0d8cc58d64 100644 --- a/dom/bluetooth/bluedroid/BluetoothDaemonHelpers.h +++ b/dom/bluetooth/bluedroid/BluetoothDaemonHelpers.h @@ -50,6 +50,45 @@ struct BluetoothAddress { uint8_t mAddr[6]; }; +struct BluetoothAvrcpAttributeTextPairs { + BluetoothAvrcpAttributeTextPairs(const uint8_t* aAttr, + const char** aText, + size_t aLength) + : mAttr(aAttr) + , mText(aText) + , mLength(aLength) + { } + + const uint8_t* mAttr; + const char** mText; + size_t mLength; +}; + +struct BluetoothAvrcpAttributeValuePairs { + BluetoothAvrcpAttributeValuePairs(const uint8_t* aAttr, + const uint8_t* aValue, + size_t aLength) + : mAttr(aAttr) + , mValue(aValue) + , mLength(aLength) + { } + + const uint8_t* mAttr; + const uint8_t* mValue; + size_t mLength; +}; + +struct BluetoothAvrcpEventParamPair { + BluetoothAvrcpEventParamPair(BluetoothAvrcpEvent aEvent, + const BluetoothAvrcpNotificationParam& aParam) + : mEvent(aEvent) + , mParam(aParam) + { } + + BluetoothAvrcpEvent mEvent; + const BluetoothAvrcpNotificationParam& mParam; +}; + struct BluetoothConfigurationParameter { uint8_t mType; uint16_t mLength; @@ -109,6 +148,12 @@ Convert(int aIn, uint8_t& aOut); nsresult Convert(int aIn, int16_t& aOut); +nsresult +Convert(int32_t aIn, BluetoothDeviceType& aOut); + +nsresult +Convert(int32_t aIn, BluetoothScanMode& aOut); + nsresult Convert(uint8_t aIn, bool& aOut); @@ -118,6 +163,9 @@ Convert(uint8_t aIn, char& aOut); nsresult Convert(uint8_t aIn, int& aOut); +nsresult +Convert(uint8_t aIn, unsigned long& aOut); + nsresult Convert(uint8_t aIn, BluetoothA2dpAudioState& aOut); @@ -127,6 +175,18 @@ Convert(uint8_t aIn, BluetoothA2dpConnectionState& aOut); nsresult Convert(uint8_t aIn, BluetoothAclState& aOut); +nsresult +Convert(uint8_t aIn, BluetoothAvrcpEvent& aOut); + +nsresult +Convert(uint8_t aIn, BluetoothAvrcpMediaAttribute& aOut); + +nsresult +Convert(uint8_t aIn, BluetoothAvrcpPlayerAttribute& aOut); + +nsresult +Convert(uint8_t aIn, BluetoothAvrcpRemoteFeature& aOut); + nsresult Convert(uint8_t aIn, BluetoothHandsfreeAudioState& aOut); @@ -166,6 +226,9 @@ Convert(uint8_t aIn, BluetoothStatus& aOut); nsresult Convert(uint32_t aIn, int& aOut); +nsresult +Convert(uint32_t aIn, uint8_t& aOut); + nsresult Convert(size_t aIn, uint16_t& aOut); @@ -190,6 +253,15 @@ Convert(BluetoothAclState aIn, bool& aOut); nsresult Convert(const BluetoothAddress& aIn, nsAString& aOut); +nsresult +Convert(BluetoothAvrcpEvent aIn, uint8_t& aOut); + +nsresult +Convert(BluetoothAvrcpNotification aIn, uint8_t& aOut); + +nsresult +Convert(BluetoothAvrcpRemoteFeature aIn, unsigned long& aOut); + nsresult Convert(BluetoothHandsfreeAtResponse aIn, uint8_t& aOut); @@ -235,6 +307,9 @@ Convert(BluetoothSspPairingVariant aIn, uint8_t& aOut); nsresult Convert(BluetoothSspPairingVariant aIn, nsAString& aOut); +nsresult +Convert(ControlPlayStatus aIn, uint8_t& aOut); + // // Packing // @@ -269,6 +344,26 @@ PackPDU(uint32_t aIn, BluetoothDaemonPDU& aPDU) nsresult PackPDU(const BluetoothAddress& aIn, BluetoothDaemonPDU& aPDU); +nsresult +PackPDU(const BluetoothAvrcpAttributeTextPairs& aIn, + BluetoothDaemonPDU& aPDU); + +nsresult +PackPDU(const BluetoothAvrcpAttributeValuePairs& aIn, + BluetoothDaemonPDU& aPDU); + +nsresult +PackPDU(const BluetoothAvrcpElementAttribute& aIn, BluetoothDaemonPDU& aPDU); + +nsresult +PackPDU(BluetoothAvrcpEvent aIn, BluetoothDaemonPDU& aPDU); + +nsresult +PackPDU(const BluetoothAvrcpEventParamPair& aIn, BluetoothDaemonPDU& aPDU); + +nsresult +PackPDU(BluetoothAvrcpNotification aIn, BluetoothDaemonPDU& aPDU); + nsresult PackPDU(const BluetoothConfigurationParameter& aIn, BluetoothDaemonPDU& aPDU); @@ -323,6 +418,9 @@ PackPDU(BluetoothSspPairingVariant aIn, BluetoothDaemonPDU& aPDU); nsresult PackPDU(BluetoothScanMode aIn, BluetoothDaemonPDU& aPDU); +nsresult +PackPDU(ControlPlayStatus aIn, BluetoothDaemonPDU& aPDU); + /* |PackConversion| is a helper for packing converted values. Pass * an instance of this structure to |PackPDU| to convert a value from * the input type to the output type and and write it to the PDU. @@ -575,6 +673,21 @@ UnpackPDU(BluetoothDaemonPDU& aPDU, BluetoothAddress& aOut) return aPDU.Read(aOut.mAddr, sizeof(aOut.mAddr)); } +nsresult +UnpackPDU(BluetoothDaemonPDU& aPDU, BluetoothAvrcpEvent& aOut); + +nsresult +UnpackPDU(BluetoothDaemonPDU& aPDU, BluetoothAvrcpMediaAttribute& aOut); + +nsresult +UnpackPDU(BluetoothDaemonPDU& aPDU, BluetoothAvrcpPlayerAttribute& aOut); + +nsresult +UnpackPDU(BluetoothDaemonPDU& aPDU, BluetoothAvrcpPlayerSettings& aOut); + +nsresult +UnpackPDU(BluetoothDaemonPDU& aPDU, BluetoothAvrcpRemoteFeature& aOut); + nsresult UnpackPDU(BluetoothDaemonPDU& aPDU, BluetoothBondState& aOut);