• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright 2018 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 "vendor_packet.h"
20 
21 namespace bluetooth {
22 namespace avrcp {
23 
24 class SetAddressedPlayerResponseBuilder : public VendorPacketBuilder {
25  public:
26   virtual ~SetAddressedPlayerResponseBuilder() = default;
27 
28   static std::unique_ptr<SetAddressedPlayerResponseBuilder> MakeBuilder(
29       Status status);
30 
31   virtual size_t size() const override;
32   virtual bool Serialize(
33       const std::shared_ptr<::bluetooth::Packet>& pkt) override;
34 
35  protected:
36   Status status_;
37 
SetAddressedPlayerResponseBuilder(Status status)38   SetAddressedPlayerResponseBuilder(Status status)
39       : VendorPacketBuilder(CType::ACCEPTED, CommandPdu::SET_ADDRESSED_PLAYER,
40                             PacketType::SINGLE),
41         status_(status){};
42 };
43 
44 class SetAddressedPlayerRequest : public VendorPacket {
45  public:
46   virtual ~SetAddressedPlayerRequest() = default;
47 
48   /**
49    *  Register Notificaiton Request Packet Layout
50    *   AvrcpPacket:
51    *     CType c_type_;
52    *     uint8_t subunit_type_ : 5;
53    *     uint8_t subunit_id_ : 3;
54    *     Opcode opcode_;
55    *   VendorPacket:
56    *     uint8_t company_id[3];
57    *     uint8_t command_pdu;
58    *     uint8_t packet_type;
59    *     uint16_t param_length;
60    *   SetAddressedPlayerRequest:
61    *     uint16_t player_id;
62    */
kMinSize()63   static constexpr size_t kMinSize() { return VendorPacket::kMinSize() + 2; }
64 
65   uint16_t GetPlayerId() const;
66 
67   virtual bool IsValid() const override;
68   virtual std::string ToString() const override;
69 
70  protected:
71   using VendorPacket::VendorPacket;
72 };
73 
74 }  // namespace avrcp
75 }  // namespace bluetooth