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 ListPlayerApplicationSettingValuesResponseBuilder : public VendorPacketBuilder { 27 public: 28 virtual ~ListPlayerApplicationSettingValuesResponseBuilder() = default; 29 30 static std::unique_ptr<ListPlayerApplicationSettingValuesResponseBuilder> MakeBuilder( 31 std::vector<uint8_t> values); 32 33 virtual size_t size() const override; 34 virtual bool Serialize(const std::shared_ptr<::bluetooth::Packet>& pkt) override; 35 36 protected: 37 std::vector<uint8_t> values_; 38 ListPlayerApplicationSettingValuesResponseBuilder(std::vector<uint8_t> values)39 ListPlayerApplicationSettingValuesResponseBuilder(std::vector<uint8_t> values) 40 : VendorPacketBuilder(CType::STABLE, CommandPdu::LIST_PLAYER_APPLICATION_SETTING_VALUES, 41 PacketType::SINGLE), 42 values_(std::move(values)) {} 43 }; 44 45 class ListPlayerApplicationSettingValuesRequest : public VendorPacket { 46 public: 47 virtual ~ListPlayerApplicationSettingValuesRequest() = default; 48 49 /** 50 * List Player Application Setting Values 51 * AvrcpPacket: 52 * CType c_type_; 53 * uint8_t subunit_type_ : 5; 54 * uint8_t subunit_id_ : 3; 55 * Opcode opcode_; 56 * VendorPacket: 57 * uint8_t company_id[3]; 58 * uint8_t command_pdu; 59 * uint8_t packet_type; 60 * uint16_t param_length; 61 * ListPlayerApplicationSettingValuesRequest: 62 * PlayerAttribute attribute; 63 */ kMinSize()64 static constexpr size_t kMinSize() { return VendorPacket::kMinSize() + sizeof(uint8_t); } 65 66 PlayerAttribute GetRequestedAttribute() 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