1 /* 2 * Copyright 2023 The Android Open Source Project 3 * 4 * Licensed under the Apache License, Version 2.0 (the "License"); 5 * you may not use this file except in compliance with the License. 6 * You may obtain a copy of the License at 7 * 8 * http://www.apache.org/licenses/LICENSE-2.0 9 * 10 * Unless required by applicable law or agreed to in writing, software 11 * distributed under the License is distributed on an "AS IS" BASIS, 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 * See the License for the specific language governing permissions and 14 * limitations under the License. 15 */ 16 17 #pragma once 18 19 #include <vector> 20 21 #include "vendor_packet.h" 22 23 namespace bluetooth { 24 namespace avrcp { 25 26 class SetPlayerApplicationSettingValueResponseBuilder : public VendorPacketBuilder { 27 public: 28 virtual ~SetPlayerApplicationSettingValueResponseBuilder() = default; 29 30 static std::unique_ptr<SetPlayerApplicationSettingValueResponseBuilder> MakeBuilder(); 31 32 virtual size_t size() const override; 33 virtual bool Serialize(const std::shared_ptr<::bluetooth::Packet>& pkt) override; 34 35 protected: SetPlayerApplicationSettingValueResponseBuilder()36 SetPlayerApplicationSettingValueResponseBuilder() 37 : VendorPacketBuilder(CType::ACCEPTED, CommandPdu::SET_PLAYER_APPLICATION_SETTING_VALUE, 38 PacketType::SINGLE) {} 39 }; 40 41 class SetPlayerApplicationSettingValueRequest : public VendorPacket { 42 public: 43 virtual ~SetPlayerApplicationSettingValueRequest() = default; 44 45 /** 46 * Set Player Application Setting Value 47 * AvrcpPacket: 48 * CType c_type_; 49 * uint8_t subunit_type_ : 5; 50 * uint8_t subunit_id_ : 3; 51 * Opcode opcode_; 52 * VendorPacket: 53 * uint8_t company_id[3]; 54 * uint8_t command_pdu; 55 * uint8_t packet_type; 56 * uint16_t param_length; 57 * SetPlayerApplicationSettingValueRequest: 58 * uint8_t number_of_attributes; 59 * std::vector<PlayerAttribute> attributes; 60 * std::vector<uint8_t> values; 61 */ kMinSize()62 static constexpr size_t kMinSize() { return VendorPacket::kMinSize() + sizeof(uint8_t); } 63 64 uint8_t GetNumberOfRequestedAttributes() const; 65 std::vector<PlayerAttribute> GetRequestedAttributes() const; 66 std::vector<uint8_t> GetRequestedValues() const; 67 68 virtual bool IsValid() const override; 69 virtual std::string ToString() const override; 70 71 protected: 72 using VendorPacket::VendorPacket; 73 }; 74 75 } // namespace avrcp 76 } // namespace bluetooth 77