blob: 6355c1e4d697a63a0c7146b7f303c6069d1028ce [file] [log] [blame]
Myles Watsone22dde22019-01-18 11:42:33 -08001/*
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 <cstdint>
20#include <memory>
21#include <vector>
22
23#include "packets/packet_view.h"
24
25namespace test_vendor_lib {
26namespace packets {
27
28// Command packets are specified in the Bluetooth Core Specification Version
29// 4.2, Volume 2, Part E, Section 5.4.1
30class CommandPacketView : public PacketView<true> {
31 public:
32 virtual ~CommandPacketView() override = default;
33
34 static CommandPacketView Create(std::shared_ptr<std::vector<uint8_t>> packet);
35
36 uint16_t GetOpcode() const;
37
38 PacketView<true> GetPayload() const;
39
40 private:
41 CommandPacketView(std::shared_ptr<std::vector<uint8_t>> packet);
42 CommandPacketView() = delete;
43};
44
45} // namespace packets
46} // namespace test_vendor_lib