get_total_number_of_items.h 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  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 "avrcp_browse_packet.h"
  18. namespace bluetooth {
  19. namespace avrcp {
  20. class GetTotalNumberOfItemsResponseBuilder : public BrowsePacketBuilder {
  21. public:
  22. virtual ~GetTotalNumberOfItemsResponseBuilder() = default;
  23. static std::unique_ptr<GetTotalNumberOfItemsResponseBuilder> MakeBuilder(
  24. Status status, uint16_t uid_counter, uint32_t num_items_in_folder);
  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. uint16_t uid_counter_;
  31. uint32_t num_items_in_folder_;
  32. GetTotalNumberOfItemsResponseBuilder(Status status, uint16_t uid_counter,
  33. uint32_t num_items_in_folder)
  34. : BrowsePacketBuilder(BrowsePdu::GET_TOTAL_NUMBER_OF_ITEMS),
  35. status_(status),
  36. uid_counter_(uid_counter),
  37. num_items_in_folder_(num_items_in_folder){};
  38. };
  39. class GetTotalNumberOfItemsRequest : public BrowsePacket {
  40. public:
  41. virtual ~GetTotalNumberOfItemsRequest() = default;
  42. /**
  43. * AVRCP Get Total Number Of Items Packet Layout
  44. * BrowsePacket:
  45. * uint8_t pdu_;
  46. * uint16_t length_;
  47. * GetTotalNumberOfItemsRequest:
  48. * uint8_t scope_;
  49. */
  50. static constexpr size_t kMinSize() { return BrowsePacket::kMinSize() + 1; }
  51. Scope GetScope() const;
  52. virtual bool IsValid() const override;
  53. virtual std::string ToString() const override;
  54. protected:
  55. using BrowsePacket::BrowsePacket;
  56. };
  57. } // namespace avrcp
  58. } // namespace bluetooth