set_addressed_player.h 2.1 KB

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